Commit b09bd95a authored by Ziye Yang's avatar Ziye Yang Committed by Darek Stojaczyk
Browse files

sock: update spdk_sock_group_add_sock



And also add spdk_sock_group_get_ctx function

Change-Id: I2a2a58b0588ff7d99d3538ea0a633a3b8c7a234b
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454538


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
parent 8bb174f8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ spdk_sock_group_add_sock so that a set of sockets can be polled more efficiently
For some network devices, it is optimal to assign particular sockets to specific
sock groups. This API is intended to provide the user with that information.

spdk_sock_group_get_ctx() was added to return the context of the spdk_sock_group.
spdk_sock_group_create() is updated to allow input the user provided ctx.

## v19.04:

### nvme
+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ hello_sock_listen(struct hello_context_t *ctx)
	/*
	 * Create sock group for server socket
	 */
	ctx->group = spdk_sock_group_create();
	ctx->group = spdk_sock_group_create(NULL);

	g_is_running = true;

+12 −2
Original line number Diff line number Diff line
@@ -195,11 +195,21 @@ bool spdk_sock_is_ipv4(struct spdk_sock *sock);
typedef void (*spdk_sock_cb)(void *arg, struct spdk_sock_group *group, struct spdk_sock *sock);

/**
 * Create a new socket group.
 * Create a new socket group with user provided pointer
 *
 * \param ctx the context provided by user.
 * \return a pointer to the created group on success, or NULL on failure.
 */
struct spdk_sock_group *spdk_sock_group_create(void);
struct spdk_sock_group *spdk_sock_group_create(void *ctx);

/**
 * Get the ctx of the sock group
 *
 * \param sock_group Socket group.
 * \return a pointer which is ctx of the sock_group.
 */
void *spdk_sock_group_get_ctx(struct spdk_sock_group *sock_group);


/**
 * Add a socket to the group.
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ struct spdk_sock {

struct spdk_sock_group {
	STAILQ_HEAD(, spdk_sock_group_impl)	group_impls;
	void					*ctx;
};

struct spdk_sock_group_impl {
+1 −1
Original line number Diff line number Diff line
@@ -1203,7 +1203,7 @@ iscsi_poll_group_create(void *ctx)
	pg->core = spdk_env_get_current_core();

	STAILQ_INIT(&pg->connections);
	pg->sock_group = spdk_sock_group_create();
	pg->sock_group = spdk_sock_group_create(NULL);
	assert(pg->sock_group != NULL);

	pg->poller = spdk_poller_register(iscsi_poll_group_poll, pg, 0);
Loading