2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2020-01-28 11:54:47 +00:00
|
|
|
* Copyright (c) Intel Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2020 Mellanox Technologies LTD. All rights reserved.
|
2018-02-07 19:58:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* TCP socket abstraction layer
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPDK_SOCK_H
|
|
|
|
#define SPDK_SOCK_H
|
|
|
|
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
2019-08-26 22:03:07 +00:00
|
|
|
#include "spdk/queue.h"
|
2020-01-28 22:18:16 +00:00
|
|
|
#include "spdk/json.h"
|
2019-08-26 22:03:07 +00:00
|
|
|
|
2018-02-07 19:58:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-02-07 21:46:22 +00:00
|
|
|
struct spdk_sock;
|
2018-02-08 00:28:19 +00:00
|
|
|
struct spdk_sock_group;
|
2018-02-07 19:58:14 +00:00
|
|
|
|
2019-08-26 22:03:07 +00:00
|
|
|
/**
|
|
|
|
* Anywhere this struct is used, an iovec array is assumed to
|
|
|
|
* immediately follow the last member in memory, without any
|
|
|
|
* padding.
|
|
|
|
*
|
|
|
|
* A simpler implementation would be to place a 0-length array
|
|
|
|
* of struct iovec at the end of this request. However, embedding
|
|
|
|
* a structure that ends with a variable length array inside of
|
|
|
|
* another structure is a GNU C extension and not standard.
|
|
|
|
*/
|
|
|
|
struct spdk_sock_request {
|
|
|
|
/* When the request is completed, this callback will be called.
|
2022-03-18 07:44:53 +00:00
|
|
|
* On success, err will be:
|
|
|
|
* - for writes: 0,
|
|
|
|
* - for reads: number of bytes read.
|
|
|
|
* On failure: negative errno value.
|
|
|
|
*/
|
2019-08-26 22:03:07 +00:00
|
|
|
void (*cb_fn)(void *cb_arg, int err);
|
|
|
|
void *cb_arg;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These fields are used by the socket layer and should not be modified
|
|
|
|
*/
|
|
|
|
struct __sock_request_internal {
|
|
|
|
TAILQ_ENTRY(spdk_sock_request) link;
|
2022-03-01 19:16:12 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
void *curr_list;
|
|
|
|
#endif
|
2019-10-09 21:06:15 +00:00
|
|
|
uint32_t offset;
|
sock: introduce dynamic zerocopy according to data size
MSG_ZEROCOPY is not always effective as mentioned in
https://www.kernel.org/doc/html/v4.15/networking/msg_zerocopy.html.
Currently in spdk, once we enable sendmsg zerocopy, then all data
transferred through _sock_flush are sent with zerocopy, and vice
versa. Here dynamic zerocopy is introduced to allow data sent with
MSG_ZEROCOPY or not according to its size, which can be enabled by
setting "enable_dynamic_zerocopy" as true.
Test with 16 P4610 NVMe SSD, 2 initiators, target's and initiators'
configurations are the same as spdk report:
https://ci.spdk.io/download/performance-reports/SPDK_tcp_perf_report_2104.pdf
For posix socket, rw_percent=0(randwrite), it has 1.9%~8.3% performance boost
tested with target 1~40 cpu cores and qdepth=128,256,512. And it has no obvious
influence when read percentage is greater than 50%.
For uring socket, rw_percent=0(randwrite), it has 1.8%~7.9% performance boost
tested with target 1~40 cpu cores and qdepth=128,256,512. And it still has
1%~7% improvement when read percentage is greater than 50%.
The following is part of the detailed data.
posix:
qdepth=128
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 286.5 298.5 4.19% 307 304.15 -0.93%
4 1042.5 1107 6.19% 1135.5 1136 0.04%
8 1952.5 2058 5.40% 2170.5 2170.5 0.00%
12 2658.5 2879 8.29% 3042 3046 0.13%
16 3247.5 3460.5 6.56% 3793.5 3775 -0.49%
24 4232.5 4459.5 5.36% 4614.5 4756.5 3.08%
32 4810 5095 5.93% 4488 4845 7.95%
40 5306.5 5435 2.42% 4427.5 4902 10.72%
qdepth=512
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 275 287 4.36% 294.4 295.45 0.36%
4 979 1041 6.33% 1073 1083.5 0.98%
8 1822.5 1914.5 5.05% 2030.5 2018.5 -0.59%
12 2441 2598.5 6.45% 2808.5 2779.5 -1.03%
16 2920.5 3109.5 6.47% 3455 3411.5 -1.26%
24 3709 3972.5 7.10% 4483.5 4502.5 0.42%
32 4225.5 4532.5 7.27% 4463.5 4733 6.04%
40 4790.5 4884.5 1.96% 4427 4904.5 10.79%
uring:
qdepth=128
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 270.5 287.5 6.28% 295.75 304.75 3.04%
4 1018.5 1089.5 6.97% 1119.5 1156.5 3.31%
8 1907 2055 7.76% 2127 2211.5 3.97%
12 2614 2801 7.15% 2982.5 3061.5 2.65%
16 3169.5 3420 7.90% 3654.5 3781.5 3.48%
24 4109.5 4414 7.41% 4691.5 4750.5 1.26%
32 4752.5 4908 3.27% 4494 4825.5 7.38%
40 5233.5 5327 1.79% 4374.5 4891 11.81%
qdepth=512
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 259.95 276 6.17% 286.65 294.8 2.84%
4 955 1021 6.91% 1070.5 1100 2.76%
8 1772 1903.5 7.42% 1992.5 2077.5 4.27%
12 2380.5 2543.5 6.85% 2752.5 2860 3.91%
16 2920.5 3099 6.11% 3391.5 3540 4.38%
24 3697 3912 5.82% 4401 4637 5.36%
32 4256.5 4454.5 4.65% 4516 4777 5.78%
40 4707 4968.5 5.56% 4400.5 4933 12.10%
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I730dcf89ed2bf3efe91586421a89045fc11c81f0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12210
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-12-07 09:37:02 +00:00
|
|
|
|
|
|
|
/* Indicate if the whole req or part of it is sent with zerocopy */
|
|
|
|
bool is_zcopy;
|
2019-08-26 22:03:07 +00:00
|
|
|
} internal;
|
|
|
|
|
|
|
|
int iovcnt;
|
|
|
|
/* struct iovec iov[]; */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SPDK_SOCK_REQUEST_IOV(req, i) ((struct iovec *)(((uint8_t *)req + sizeof(struct spdk_sock_request)) + (sizeof(struct iovec) * i)))
|
|
|
|
|
2021-03-29 19:34:51 +00:00
|
|
|
enum spdk_placement_mode {
|
|
|
|
PLACEMENT_NONE,
|
|
|
|
PLACEMENT_NAPI,
|
|
|
|
PLACEMENT_CPU,
|
2021-04-06 21:48:51 +00:00
|
|
|
PLACEMENT_MARK,
|
2021-03-29 19:34:51 +00:00
|
|
|
};
|
|
|
|
|
2022-05-11 14:27:38 +00:00
|
|
|
#define SPDK_TLS_VERSION_1_1 11
|
|
|
|
#define SPDK_TLS_VERSION_1_2 12
|
|
|
|
#define SPDK_TLS_VERSION_1_3 13
|
|
|
|
|
2020-01-28 11:54:47 +00:00
|
|
|
/**
|
|
|
|
* SPDK socket implementation options.
|
|
|
|
*
|
|
|
|
* A pointer to this structure is used by spdk_sock_impl_get_opts() and spdk_sock_impl_set_opts()
|
|
|
|
* to allow the user to request options for the socket module implementation.
|
|
|
|
* Each socket module defines which options from this structure are applicable to the module.
|
|
|
|
*/
|
2020-01-29 11:39:59 +00:00
|
|
|
struct spdk_sock_impl_opts {
|
|
|
|
/**
|
2020-09-10 14:57:52 +00:00
|
|
|
* Size of sock receive buffer. Used by posix and uring socket modules.
|
2020-01-29 11:39:59 +00:00
|
|
|
*/
|
|
|
|
uint32_t recv_buf_size;
|
|
|
|
|
|
|
|
/**
|
2020-09-10 14:57:52 +00:00
|
|
|
* Size of sock send buffer. Used by posix and uring socket modules.
|
2020-01-29 11:39:59 +00:00
|
|
|
*/
|
|
|
|
uint32_t send_buf_size;
|
2020-07-14 13:28:30 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-10 14:57:52 +00:00
|
|
|
* Enable or disable receive pipe. Used by posix and uring socket modules.
|
2020-07-14 13:28:30 +00:00
|
|
|
*/
|
|
|
|
bool enable_recv_pipe;
|
2020-07-14 19:03:45 +00:00
|
|
|
|
|
|
|
/**
|
2021-04-26 09:15:52 +00:00
|
|
|
* **Deprecated, please use enable_zerocopy_send_server or enable_zerocopy_send_client instead**
|
2020-07-14 19:03:45 +00:00
|
|
|
* Enable or disable use of zero copy flow on send. Used by posix socket module.
|
|
|
|
*/
|
|
|
|
bool enable_zerocopy_send;
|
2020-07-30 01:59:57 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-10 17:22:24 +00:00
|
|
|
* Enable or disable quick ACK. Used by posix and uring socket modules.
|
2020-07-30 01:59:57 +00:00
|
|
|
*/
|
|
|
|
bool enable_quickack;
|
2020-09-10 17:22:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable or disable placement_id. Used by posix and uring socket modules.
|
2021-03-29 19:34:51 +00:00
|
|
|
* Valid values in the enum spdk_placement_mode.
|
2020-09-10 17:22:24 +00:00
|
|
|
*/
|
2020-12-15 07:05:44 +00:00
|
|
|
uint32_t enable_placement_id;
|
2020-09-10 17:22:24 +00:00
|
|
|
|
2021-04-16 14:05:48 +00:00
|
|
|
/**
|
2022-05-09 01:59:58 +00:00
|
|
|
* Enable or disable use of zero copy flow on send for server sockets. Used by posix and uring socket modules.
|
2021-04-16 14:05:48 +00:00
|
|
|
*/
|
|
|
|
bool enable_zerocopy_send_server;
|
|
|
|
|
|
|
|
/**
|
2022-05-09 01:59:58 +00:00
|
|
|
* Enable or disable use of zero copy flow on send for client sockets. Used by posix and uring socket modules.
|
2021-04-16 14:05:48 +00:00
|
|
|
*/
|
|
|
|
bool enable_zerocopy_send_client;
|
sock: introduce dynamic zerocopy according to data size
MSG_ZEROCOPY is not always effective as mentioned in
https://www.kernel.org/doc/html/v4.15/networking/msg_zerocopy.html.
Currently in spdk, once we enable sendmsg zerocopy, then all data
transferred through _sock_flush are sent with zerocopy, and vice
versa. Here dynamic zerocopy is introduced to allow data sent with
MSG_ZEROCOPY or not according to its size, which can be enabled by
setting "enable_dynamic_zerocopy" as true.
Test with 16 P4610 NVMe SSD, 2 initiators, target's and initiators'
configurations are the same as spdk report:
https://ci.spdk.io/download/performance-reports/SPDK_tcp_perf_report_2104.pdf
For posix socket, rw_percent=0(randwrite), it has 1.9%~8.3% performance boost
tested with target 1~40 cpu cores and qdepth=128,256,512. And it has no obvious
influence when read percentage is greater than 50%.
For uring socket, rw_percent=0(randwrite), it has 1.8%~7.9% performance boost
tested with target 1~40 cpu cores and qdepth=128,256,512. And it still has
1%~7% improvement when read percentage is greater than 50%.
The following is part of the detailed data.
posix:
qdepth=128
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 286.5 298.5 4.19% 307 304.15 -0.93%
4 1042.5 1107 6.19% 1135.5 1136 0.04%
8 1952.5 2058 5.40% 2170.5 2170.5 0.00%
12 2658.5 2879 8.29% 3042 3046 0.13%
16 3247.5 3460.5 6.56% 3793.5 3775 -0.49%
24 4232.5 4459.5 5.36% 4614.5 4756.5 3.08%
32 4810 5095 5.93% 4488 4845 7.95%
40 5306.5 5435 2.42% 4427.5 4902 10.72%
qdepth=512
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 275 287 4.36% 294.4 295.45 0.36%
4 979 1041 6.33% 1073 1083.5 0.98%
8 1822.5 1914.5 5.05% 2030.5 2018.5 -0.59%
12 2441 2598.5 6.45% 2808.5 2779.5 -1.03%
16 2920.5 3109.5 6.47% 3455 3411.5 -1.26%
24 3709 3972.5 7.10% 4483.5 4502.5 0.42%
32 4225.5 4532.5 7.27% 4463.5 4733 6.04%
40 4790.5 4884.5 1.96% 4427 4904.5 10.79%
uring:
qdepth=128
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 270.5 287.5 6.28% 295.75 304.75 3.04%
4 1018.5 1089.5 6.97% 1119.5 1156.5 3.31%
8 1907 2055 7.76% 2127 2211.5 3.97%
12 2614 2801 7.15% 2982.5 3061.5 2.65%
16 3169.5 3420 7.90% 3654.5 3781.5 3.48%
24 4109.5 4414 7.41% 4691.5 4750.5 1.26%
32 4752.5 4908 3.27% 4494 4825.5 7.38%
40 5233.5 5327 1.79% 4374.5 4891 11.81%
qdepth=512
rw_percent 0 | 30
cpu origin thisPatch opt | origin thisPatch opt
1 259.95 276 6.17% 286.65 294.8 2.84%
4 955 1021 6.91% 1070.5 1100 2.76%
8 1772 1903.5 7.42% 1992.5 2077.5 4.27%
12 2380.5 2543.5 6.85% 2752.5 2860 3.91%
16 2920.5 3099 6.11% 3391.5 3540 4.38%
24 3697 3912 5.82% 4401 4637 5.36%
32 4256.5 4454.5 4.65% 4516 4777 5.78%
40 4707 4968.5 5.56% 4400.5 4933 12.10%
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I730dcf89ed2bf3efe91586421a89045fc11c81f0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12210
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-12-07 09:37:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set zerocopy threshold in bytes. A consecutive sequence of requests' iovecs that fall below this
|
|
|
|
* threshold may be sent without zerocopy flag set.
|
|
|
|
*/
|
|
|
|
uint32_t zerocopy_threshold;
|
2020-01-29 11:39:59 +00:00
|
|
|
};
|
2020-01-28 11:54:47 +00:00
|
|
|
|
2020-02-19 11:18:51 +00:00
|
|
|
/**
|
|
|
|
* Spdk socket initialization options.
|
|
|
|
*
|
|
|
|
* A pointer to this structure will be used by spdk_sock_listen_ext() or spdk_sock_connect_ext() to
|
|
|
|
* allow the user to request non-default options on the socket.
|
|
|
|
*/
|
|
|
|
struct spdk_sock_opts {
|
|
|
|
/**
|
|
|
|
* The size of spdk_sock_opts according to the caller of this library is used for ABI
|
|
|
|
* compatibility. The library uses this field to know how many fields in this
|
|
|
|
* structure are valid. And the library will populate any remaining fields with default values.
|
|
|
|
*/
|
|
|
|
size_t opts_size;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The priority on the socket and default value is zero.
|
|
|
|
*/
|
|
|
|
int priority;
|
2020-09-01 09:06:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to enable or disable zero copy on socket layer.
|
|
|
|
*/
|
|
|
|
bool zcopy;
|
2022-04-11 06:35:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Time in msec to wait ack until connection is closed forcefully.
|
|
|
|
*/
|
|
|
|
uint32_t ack_timeout;
|
2022-05-11 14:27:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TLS protocol version. Used by posix socket module.
|
|
|
|
*/
|
|
|
|
uint32_t tls_version;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to enable or disable KTLS for ssl posix socket module.
|
|
|
|
*/
|
|
|
|
bool ktls;
|
|
|
|
|
2022-07-06 15:59:45 +00:00
|
|
|
/**
|
|
|
|
* Socket implementation options. If non-NULL, these will override those set by
|
|
|
|
* spdk_sock_impl_set_opts(). The library copies this structure internally, so the user can
|
|
|
|
* free it immediately after a spdk_sock_connect()/spdk_sock_listen() call.
|
|
|
|
*/
|
|
|
|
struct spdk_sock_impl_opts *impl_opts;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Size of the impl_opts structure.
|
|
|
|
*/
|
|
|
|
size_t impl_opts_size;
|
2020-02-19 11:18:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the default value of opts.
|
|
|
|
*
|
|
|
|
* \param opts Data structure where SPDK will initialize the default sock options.
|
|
|
|
* Users must set opts_size to sizeof(struct spdk_sock_opts). This will ensure that the
|
|
|
|
* libraryonly tries to fill as many fields as allocated by the caller. This allows ABI
|
|
|
|
* compatibility with future versions of this library that may extend the spdk_sock_opts
|
|
|
|
* structure.
|
|
|
|
*/
|
|
|
|
void spdk_sock_get_default_opts(struct spdk_sock_opts *opts);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Get client and server addresses of the given socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to get address.
|
|
|
|
* \param saddr A pointer to the buffer to hold the address of server.
|
|
|
|
* \param slen Length of the buffer 'saddr'.
|
2018-10-08 01:51:03 +00:00
|
|
|
* \param sport A pointer(May be NULL) to the buffer to hold the port info of server.
|
2018-05-15 06:31:01 +00:00
|
|
|
* \param caddr A pointer to the buffer to hold the address of client.
|
2018-06-19 10:56:11 +00:00
|
|
|
* \param clen Length of the buffer 'caddr'.
|
2018-10-08 01:51:03 +00:00
|
|
|
* \param cport A pointer(May be NULL) to the buffer to hold the port info of server.
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-10-08 01:51:03 +00:00
|
|
|
int spdk_sock_getaddr(struct spdk_sock *sock, char *saddr, int slen, uint16_t *sport,
|
|
|
|
char *caddr, int clen, uint16_t *cport);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
* Create a socket using the specific sock implementation, connect the socket
|
|
|
|
* to the specified address and port (of the server), and then return the socket.
|
|
|
|
* This function is used by client.
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
|
|
|
* \param ip IP address of the server.
|
|
|
|
* \param port Port number of the server.
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
* \param impl_name The sock_implementation to use, such as "posix". If impl_name is
|
2020-02-19 11:18:51 +00:00
|
|
|
* specified, it will *only* try to connect on that impl. If it is NULL, it will try
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
* all the sock implementations in order and uses the first sock implementation which
|
2020-08-11 09:46:18 +00:00
|
|
|
* can connect.
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
|
|
|
* \return a pointer to the connected socket on success, or NULL on failure.
|
|
|
|
*/
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
struct spdk_sock *spdk_sock_connect(const char *ip, int port, char *impl_name);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
2020-02-19 11:18:51 +00:00
|
|
|
/**
|
|
|
|
* Create a socket using the specific sock implementation, connect the socket
|
|
|
|
* to the specified address and port (of the server), and then return the socket.
|
|
|
|
* This function is used by client.
|
|
|
|
*
|
|
|
|
* \param ip IP address of the server.
|
|
|
|
* \param port Port number of the server.
|
|
|
|
* \param impl_name The sock_implementation to use, such as "posix". If impl_name is
|
|
|
|
* specified, it will *only* try to connect on that impl. If it is NULL, it will try
|
|
|
|
* all the sock implementations in order and uses the first sock implementation which
|
2020-08-11 09:46:18 +00:00
|
|
|
* can connect.
|
2020-02-19 11:18:51 +00:00
|
|
|
* \param opts The sock option pointer provided by the user which should not be NULL pointer.
|
|
|
|
*
|
|
|
|
* \return a pointer to the connected socket on success, or NULL on failure.
|
|
|
|
*/
|
|
|
|
struct spdk_sock *spdk_sock_connect_ext(const char *ip, int port, char *impl_name,
|
|
|
|
struct spdk_sock_opts *opts);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
* Create a socket using the specific sock implementation, bind the socket to
|
|
|
|
* the specified address and port and listen on the socket, and then return the socket.
|
|
|
|
* This function is used by server.
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
|
|
|
* \param ip IP address to listen on.
|
|
|
|
* \param port Port number.
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
* \param impl_name The sock_implementation to use, such as "posix". If impl_name is
|
|
|
|
* specified, it will *only* try to listen on that impl. If it is NULL, it will try
|
|
|
|
* all the sock implementations in order and uses the first sock implementation which
|
2020-08-11 09:46:18 +00:00
|
|
|
* can listen.
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
|
|
|
* \return a pointer to the listened socket on success, or NULL on failure.
|
|
|
|
*/
|
sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,
(1)We can support using different sock implementations in
one application together.
(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.
Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-12-17 13:57:10 +00:00
|
|
|
struct spdk_sock *spdk_sock_listen(const char *ip, int port, char *impl_name);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
2020-02-19 11:18:51 +00:00
|
|
|
/**
|
|
|
|
* Create a socket using the specific sock implementation, bind the socket to
|
|
|
|
* the specified address and port and listen on the socket, and then return the socket.
|
|
|
|
* This function is used by server.
|
|
|
|
*
|
|
|
|
* \param ip IP address to listen on.
|
|
|
|
* \param port Port number.
|
|
|
|
* \param impl_name The sock_implementation to use, such as "posix". If impl_name is
|
|
|
|
* specified, it will *only* try to listen on that impl. If it is NULL, it will try
|
|
|
|
* all the sock implementations in order and uses the first sock implementation which
|
2020-08-11 09:46:18 +00:00
|
|
|
* can listen.
|
2020-02-19 11:18:51 +00:00
|
|
|
* \param opts The sock option pointer provided by the user, which should not be NULL pointer.
|
|
|
|
*
|
|
|
|
* \return a pointer to the listened socket on success, or NULL on failure.
|
|
|
|
*/
|
|
|
|
struct spdk_sock *spdk_sock_listen_ext(const char *ip, int port, char *impl_name,
|
|
|
|
struct spdk_sock_opts *opts);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Accept a new connection from a client on the specified socket and return a
|
|
|
|
* socket structure which holds the connection.
|
|
|
|
*
|
|
|
|
* \param sock Listening socket.
|
|
|
|
*
|
|
|
|
* \return a pointer to the accepted socket on success, or NULL on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
struct spdk_sock *spdk_sock_accept(struct spdk_sock *sock);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Close a socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to close.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
int spdk_sock_close(struct spdk_sock **sock);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
2019-11-21 15:16:18 +00:00
|
|
|
/**
|
|
|
|
* Flush a socket from data gathered in previous writev_async calls.
|
|
|
|
*
|
|
|
|
* \param sock Socket to flush.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
int spdk_sock_flush(struct spdk_sock *sock);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Receive a message from the given socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to receive message.
|
|
|
|
* \param buf Pointer to a buffer to hold the data.
|
|
|
|
* \param len Length of the buffer.
|
|
|
|
*
|
|
|
|
* \return the length of the received message on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
ssize_t spdk_sock_recv(struct spdk_sock *sock, void *buf, size_t len);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Write message to the given socket from the I/O vector array.
|
|
|
|
*
|
|
|
|
* \param sock Socket to write to.
|
|
|
|
* \param iov I/O vector.
|
|
|
|
* \param iovcnt Number of I/O vectors in the array.
|
|
|
|
*
|
|
|
|
* \return the length of written message on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
ssize_t spdk_sock_writev(struct spdk_sock *sock, struct iovec *iov, int iovcnt);
|
2019-02-26 23:58:24 +00:00
|
|
|
|
2019-08-26 22:03:07 +00:00
|
|
|
/**
|
|
|
|
* Write data to the given socket asynchronously, calling
|
|
|
|
* the provided callback when the data has been written.
|
|
|
|
*
|
|
|
|
* \param sock Socket to write to.
|
|
|
|
* \param req The write request to submit.
|
|
|
|
*/
|
|
|
|
void spdk_sock_writev_async(struct spdk_sock *sock, struct spdk_sock_request *req);
|
|
|
|
|
2019-02-26 23:58:24 +00:00
|
|
|
/**
|
|
|
|
* Read message from the given socket to the I/O vector array.
|
|
|
|
*
|
|
|
|
* \param sock Socket to receive message.
|
|
|
|
* \param iov I/O vector.
|
|
|
|
* \param iovcnt Number of I/O vectors in the array.
|
|
|
|
*
|
|
|
|
* \return the length of the received message on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
ssize_t spdk_sock_readv(struct spdk_sock *sock, struct iovec *iov, int iovcnt);
|
2018-02-07 19:58:14 +00:00
|
|
|
|
2022-03-18 07:44:53 +00:00
|
|
|
/**
|
|
|
|
* Read message from the given socket asynchronously, calling the provided callback when the whole
|
|
|
|
* buffer is filled or an error is encountered. Only a single read request can be active at a time
|
|
|
|
* (including synchronous reads).
|
|
|
|
*
|
|
|
|
* \param sock Socket to receive message.
|
|
|
|
* \param req The read request to submit.
|
|
|
|
*/
|
|
|
|
void spdk_sock_readv_async(struct spdk_sock *sock, struct spdk_sock_request *req);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Set the value used to specify the low water mark (in bytes) for this socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to set for.
|
|
|
|
* \param nbytes Value for recvlowat.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
int spdk_sock_set_recvlowat(struct spdk_sock *sock, int nbytes);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set receive buffer size for the given socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to set buffer size for.
|
|
|
|
* \param sz Buffer size in bytes.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
int spdk_sock_set_recvbuf(struct spdk_sock *sock, int sz);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set send buffer size for the given socket.
|
|
|
|
*
|
|
|
|
* \param sock Socket to set buffer size for.
|
|
|
|
* \param sz Buffer size in bytes.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
int spdk_sock_set_sendbuf(struct spdk_sock *sock, int sz);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Check whether the address of socket is ipv6.
|
|
|
|
*
|
|
|
|
* \param sock Socket to check.
|
|
|
|
*
|
|
|
|
* \return true if the address of socket is ipv6, or false otherwise.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
bool spdk_sock_is_ipv6(struct spdk_sock *sock);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the address of socket is ipv4.
|
|
|
|
*
|
|
|
|
* \param sock Socket to check.
|
|
|
|
*
|
|
|
|
* \return true if the address of socket is ipv4, or false otherwise.
|
|
|
|
*/
|
2018-02-07 21:46:22 +00:00
|
|
|
bool spdk_sock_is_ipv4(struct spdk_sock *sock);
|
2018-02-07 19:58:14 +00:00
|
|
|
|
2019-10-04 17:48:32 +00:00
|
|
|
/**
|
|
|
|
* Check whether the socket is currently connected.
|
|
|
|
*
|
|
|
|
* \param sock Socket to check
|
|
|
|
*
|
|
|
|
* \return true if the socket is connected or false otherwise.
|
|
|
|
*/
|
|
|
|
bool spdk_sock_is_connected(struct spdk_sock *sock);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
|
|
|
* Callback function for spdk_sock_group_add_sock().
|
|
|
|
*
|
|
|
|
* \param arg Argument for the callback function.
|
|
|
|
* \param group Socket group.
|
|
|
|
* \param sock Socket.
|
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
typedef void (*spdk_sock_cb)(void *arg, struct spdk_sock_group *group, struct spdk_sock *sock);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
/**
|
2019-05-14 18:40:20 +00:00
|
|
|
* Create a new socket group with user provided pointer
|
2018-05-15 06:31:01 +00:00
|
|
|
*
|
2019-05-14 18:40:20 +00:00
|
|
|
* \param ctx the context provided by user.
|
2018-05-15 06:31:01 +00:00
|
|
|
* \return a pointer to the created group on success, or NULL on failure.
|
|
|
|
*/
|
2019-05-14 18:40:20 +00:00
|
|
|
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);
|
|
|
|
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a socket to the group.
|
|
|
|
*
|
|
|
|
* \param group Socket group.
|
|
|
|
* \param sock Socket to add.
|
|
|
|
* \param cb_fn Called when the operation completes.
|
|
|
|
* \param cb_arg Argument passed to the callback function.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
int spdk_sock_group_add_sock(struct spdk_sock_group *group, struct spdk_sock *sock,
|
|
|
|
spdk_sock_cb cb_fn, void *cb_arg);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a socket from the group.
|
|
|
|
*
|
|
|
|
* \param group Socket group.
|
|
|
|
* \param sock Socket to remove.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
int spdk_sock_group_remove_sock(struct spdk_sock_group *group, struct spdk_sock *sock);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Poll incoming events for each registered socket.
|
|
|
|
*
|
|
|
|
* \param group Group to poll.
|
|
|
|
*
|
2019-07-31 02:08:30 +00:00
|
|
|
* \return the number of events on success, -1 on failure.
|
2018-05-15 06:31:01 +00:00
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
int spdk_sock_group_poll(struct spdk_sock_group *group);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Poll incoming events up to max_events for each registered socket.
|
|
|
|
*
|
|
|
|
* \param group Group to poll.
|
|
|
|
* \param max_events Number of maximum events to poll for each socket.
|
|
|
|
*
|
|
|
|
* \return the number of events on success, -1 on failure.
|
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
int spdk_sock_group_poll_count(struct spdk_sock_group *group, int max_events);
|
2018-05-15 06:31:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Close all registered sockets of the group and then remove the group.
|
|
|
|
*
|
|
|
|
* \param group Group to close.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2018-02-08 00:28:19 +00:00
|
|
|
int spdk_sock_group_close(struct spdk_sock_group **group);
|
|
|
|
|
2019-05-14 12:50:15 +00:00
|
|
|
/**
|
|
|
|
* Get the optimal sock group for this sock.
|
|
|
|
*
|
|
|
|
* \param sock The socket
|
|
|
|
* \param group Returns the optimal sock group. If there is no optimal sock group, returns NULL.
|
2021-11-17 13:19:58 +00:00
|
|
|
* \param hint When return is 0 and group is set to NULL, hint is used to set optimal sock group for the socket.
|
2019-05-14 12:50:15 +00:00
|
|
|
*
|
|
|
|
* \return 0 on success. Negated errno on failure.
|
|
|
|
*/
|
2021-11-17 13:19:58 +00:00
|
|
|
int spdk_sock_get_optimal_sock_group(struct spdk_sock *sock, struct spdk_sock_group **group,
|
|
|
|
struct spdk_sock_group *hint);
|
2019-05-14 12:50:15 +00:00
|
|
|
|
2020-01-28 11:54:47 +00:00
|
|
|
/**
|
|
|
|
* Get current socket implementation options.
|
|
|
|
*
|
|
|
|
* \param impl_name The socket implementation to use, such as "posix".
|
|
|
|
* \param opts Pointer to allocated spdk_sock_impl_opts structure that will be filled with actual values.
|
|
|
|
* \param len On input specifies size of passed opts structure. On return it is set to actual size that was filled with values.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure. errno is set to indicate the reason of failure.
|
|
|
|
*/
|
|
|
|
int spdk_sock_impl_get_opts(const char *impl_name, struct spdk_sock_impl_opts *opts, size_t *len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set socket implementation options.
|
|
|
|
*
|
|
|
|
* \param impl_name The socket implementation to use, such as "posix".
|
|
|
|
* \param opts Pointer to allocated spdk_sock_impl_opts structure with new options values.
|
|
|
|
* \param len Size of passed opts structure.
|
|
|
|
*
|
|
|
|
* \return 0 on success, -1 on failure. errno is set to indicate the reason of failure.
|
|
|
|
*/
|
|
|
|
int spdk_sock_impl_set_opts(const char *impl_name, const struct spdk_sock_impl_opts *opts,
|
|
|
|
size_t len);
|
|
|
|
|
2020-09-21 11:07:52 +00:00
|
|
|
/**
|
|
|
|
* Set the given sock implementation to be used a default one.
|
|
|
|
*
|
|
|
|
* Note: passing a specific sock implementation name in some sock API functions
|
|
|
|
* (such as @ref spdk_sock_connect, @ref spdk_sock_listen and etc) ignores the default value set by this function.
|
|
|
|
*
|
|
|
|
* \param impl_name The socket implementation to use, such as "posix".
|
|
|
|
* \return 0 on success, -1 on failure. errno is set to indicate the reason of failure.
|
|
|
|
*/
|
|
|
|
int spdk_sock_set_default_impl(const char *impl_name);
|
|
|
|
|
2020-01-28 22:18:16 +00:00
|
|
|
/**
|
|
|
|
* Write socket subsystem configuration into provided JSON context.
|
|
|
|
*
|
|
|
|
* \param w JSON write context
|
|
|
|
*/
|
|
|
|
void spdk_sock_write_config_json(struct spdk_json_write_ctx *w);
|
|
|
|
|
2018-02-07 19:58:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* SPDK_SOCK_H */
|