Commit 9475ec8d authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

sock: remove "socket" from "numa_socket_id"



We will just use "numa_id" to refer to a NUMA socket ID (also
called NUMA node ID). This will eliminate any confusion over conflicts
with "socket" used to describe TCP sockets.

These APIs were all added since last release, so we can change
this freely.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Ifb8591c1066a61a78c31ad0e40745a59abb2759f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24606


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 634a610f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -376,13 +376,13 @@ const char *spdk_sock_get_interface_name(struct spdk_sock *sock);


/**
 * Gets the NUMA socket ID for the network interface of the local port for the TCP socket.
 * Gets the NUMA node ID for the network interface of the local port for the TCP socket.
 *
 * \param sock TCP socket to find the NUMA socket ID for
 *
 * \return NUMA socket ID, or SPDK_ENV_SOCKET_ID_ANY if the NUMA socket ID is unknown
 * \return NUMA ID, or SPDK_ENV_SOCKET_ID_ANY if the NUMA ID is unknown
 */
int32_t spdk_sock_get_numa_socket_id(struct spdk_sock *sock);
int32_t spdk_sock_get_numa_id(struct spdk_sock *sock);

/**
 * Close a socket.
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ struct spdk_net_impl {
	int (*getaddr)(struct spdk_sock *sock, char *saddr, int slen, uint16_t *sport, char *caddr,
		       int clen, uint16_t *cport);
	const char *(*get_interface_name)(struct spdk_sock *sock);
	int32_t (*get_numa_socket_id)(struct spdk_sock *sock);
	int32_t (*get_numa_id)(struct spdk_sock *sock);
	struct spdk_sock *(*connect)(const char *ip, int port, struct spdk_sock_opts *opts);
	struct spdk_sock *(*listen)(const char *ip, int port, struct spdk_sock_opts *opts);
	struct spdk_sock *(*accept)(struct spdk_sock *sock);
+3 −3
Original line number Diff line number Diff line
@@ -243,10 +243,10 @@ spdk_sock_get_interface_name(struct spdk_sock *sock)
}

int32_t
spdk_sock_get_numa_socket_id(struct spdk_sock *sock)
spdk_sock_get_numa_id(struct spdk_sock *sock)
{
	if (sock->net_impl->get_numa_socket_id) {
		return sock->net_impl->get_numa_socket_id(sock);
	if (sock->net_impl->get_numa_id) {
		return sock->net_impl->get_numa_id(sock);
	} else {
		return SPDK_ENV_SOCKET_ID_ANY;
	}
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
	spdk_sock_get_default_opts;
	spdk_sock_getaddr;
	spdk_sock_get_interface_name;
	spdk_sock_get_numa_socket_id;
	spdk_sock_get_numa_id;
	spdk_sock_connect;
	spdk_sock_connect_ext;
	spdk_sock_listen;
+7 −7
Original line number Diff line number Diff line
@@ -257,10 +257,10 @@ posix_sock_get_interface_name(struct spdk_sock *_sock)
}

static int32_t
posix_sock_get_numa_socket_id(struct spdk_sock *sock)
posix_sock_get_numa_id(struct spdk_sock *sock)
{
	const char *interface_name;
	uint32_t numa_socket_id;
	uint32_t numa_id;
	int rc;

	interface_name = posix_sock_get_interface_name(sock);
@@ -268,10 +268,10 @@ posix_sock_get_numa_socket_id(struct spdk_sock *sock)
		return SPDK_ENV_SOCKET_ID_ANY;
	}

	rc = spdk_read_sysfs_attribute_uint32(&numa_socket_id,
	rc = spdk_read_sysfs_attribute_uint32(&numa_id,
					      "/sys/class/net/%s/device/numa_node", interface_name);
	if (rc == 0 && numa_socket_id <= INT32_MAX) {
		return (int32_t)numa_socket_id;
	if (rc == 0 && numa_id <= INT32_MAX) {
		return (int32_t)numa_id;
	} else {
		return SPDK_ENV_SOCKET_ID_ANY;
	}
@@ -2242,7 +2242,7 @@ static struct spdk_net_impl g_posix_net_impl = {
	.name		= "posix",
	.getaddr	= posix_sock_getaddr,
	.get_interface_name = posix_sock_get_interface_name,
	.get_numa_socket_id = posix_sock_get_numa_socket_id,
	.get_numa_id	= posix_sock_get_numa_id,
	.connect	= posix_sock_connect,
	.listen		= posix_sock_listen,
	.accept		= posix_sock_accept,
@@ -2295,7 +2295,7 @@ static struct spdk_net_impl g_ssl_net_impl = {
	.name		= "ssl",
	.getaddr	= posix_sock_getaddr,
	.get_interface_name = posix_sock_get_interface_name,
	.get_numa_socket_id = posix_sock_get_numa_socket_id,
	.get_numa_id	= posix_sock_get_numa_id,
	.connect	= ssl_sock_connect,
	.listen		= ssl_sock_listen,
	.accept		= ssl_sock_accept,
Loading