Commit 7104c833 authored by Boris Glimcher's avatar Boris Glimcher Committed by Tomasz Zawadzki
Browse files
parent a83dc054
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ in the future.
Add num_md_pages_per_cluster_ratio parameter to the bdev_lvol_create_lvstore RPC.
Calculate num_md_pages from num_md_pages_per_cluster_ratio, and pass it to spdk_bs_opts.

### rpc

New options `ktls` and `tls_version` were added to the `spdk_sock_opts` structure.

## v22.05

### sock
+27 −1
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ static char *g_sock_impl_name;
static int g_port;
static bool g_is_server;
static int g_zcopy;
static int g_ktls;
static int g_tls_version;
static bool g_verbose;

/*
@@ -36,6 +38,8 @@ struct hello_context_t {
	char *sock_impl_name;
	int port;
	int zcopy;
	int ktls;
	int tls_version;

	bool verbose;
	int bytes_in;
@@ -61,6 +65,9 @@ hello_sock_usage(void)
	printf(" -P port       port number\n");
	printf(" -N sock_impl  socket implementation, e.g., -N posix or -N uring\n");
	printf(" -S            start in server mode\n");
	printf(" -T tls_ver    TLS version, e.g., -T 12 or -T 13. If omitted, auto-negotiation will take place\n");
	printf(" -k            disable KTLS for the given sock implementation (default)\n");
	printf(" -K            enable KTLS for the given sock implementation\n");
	printf(" -V            print out additional informations\n");
	printf(" -z            disable zero copy send for the given sock implementation\n");
	printf(" -Z            enable zero copy send for the given sock implementation\n");
@@ -89,6 +96,19 @@ hello_sock_parse_arg(int ch, char *arg)
	case 'S':
		g_is_server = 1;
		break;
	case 'K':
		g_ktls = 1;
		break;
	case 'k':
		g_ktls = 0;
		break;
	case 'T':
		g_tls_version = spdk_strtol(arg, 10);
		if (g_tls_version < 0) {
			fprintf(stderr, "Invalid TLS version\n");
			return g_tls_version;
		}
		break;
	case 'V':
		g_verbose = true;
		break;
@@ -203,6 +223,8 @@ hello_sock_connect(struct hello_context_t *ctx)
	opts.opts_size = sizeof(opts);
	spdk_sock_get_default_opts(&opts);
	opts.zcopy = ctx->zcopy;
	opts.ktls = ctx->ktls;
	opts.tls_version = ctx->tls_version;

	SPDK_NOTICELOG("Connecting to the server on %s:%d with sock_impl(%s)\n", ctx->host, ctx->port,
		       ctx->sock_impl_name);
@@ -339,6 +361,8 @@ hello_sock_listen(struct hello_context_t *ctx)
	opts.opts_size = sizeof(opts);
	spdk_sock_get_default_opts(&opts);
	opts.zcopy = ctx->zcopy;
	opts.ktls = ctx->ktls;
	opts.tls_version = ctx->tls_version;

	ctx->sock = spdk_sock_listen_ext(ctx->host, ctx->port, ctx->sock_impl_name, &opts);
	if (ctx->sock == NULL) {
@@ -407,7 +431,7 @@ main(int argc, char **argv)
	opts.name = "hello_sock";
	opts.shutdown_cb = hello_sock_shutdown_cb;

	if ((rc = spdk_app_parse_args(argc, argv, &opts, "H:N:P:SVzZ", NULL, hello_sock_parse_arg,
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "H:kKN:P:ST:VzZ", NULL, hello_sock_parse_arg,
				      hello_sock_usage)) != SPDK_APP_PARSE_ARGS_SUCCESS) {
		exit(rc);
	}
@@ -416,6 +440,8 @@ main(int argc, char **argv)
	hello_context.sock_impl_name = g_sock_impl_name;
	hello_context.port = g_port;
	hello_context.zcopy = g_zcopy;
	hello_context.ktls = g_ktls;
	hello_context.tls_version = g_tls_version;
	hello_context.verbose = g_verbose;

	rc = spdk_app_start(&opts, hello_start, &hello_context);
+15 −0
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ enum spdk_placement_mode {
	PLACEMENT_MARK,
};

#define SPDK_TLS_VERSION_1_1 11
#define SPDK_TLS_VERSION_1_2 12
#define SPDK_TLS_VERSION_1_3 13

/**
 * SPDK socket implementation options.
 *
@@ -150,6 +154,17 @@ struct spdk_sock_opts {
	 * Time in msec to wait ack until connection is closed forcefully.
	 */
	uint32_t ack_timeout;

	/**
	 * 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;

};

/**
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 6
SO_VER := 7
SO_MINOR := 0

C_SRCS = sock.c sock_rpc.c
+18 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
#define SPDK_SOCK_DEFAULT_PRIORITY 0
#define SPDK_SOCK_DEFAULT_ZCOPY true
#define SPDK_SOCK_DEFAULT_ACK_TIMEOUT 0
#define SPDK_SOCK_DEFAULT_TLS_VERSION 0
#define SPDK_SOCK_DEFAULT_KTLS false

#define SPDK_SOCK_OPTS_FIELD_OK(opts, field) (offsetof(struct spdk_sock_opts, field) + sizeof(opts->field) <= (opts->opts_size))

@@ -245,6 +247,14 @@ spdk_sock_get_default_opts(struct spdk_sock_opts *opts)
	if (SPDK_SOCK_OPTS_FIELD_OK(opts, ack_timeout)) {
		opts->ack_timeout = SPDK_SOCK_DEFAULT_ACK_TIMEOUT;
	}

	if (SPDK_SOCK_OPTS_FIELD_OK(opts, tls_version)) {
		opts->tls_version = SPDK_SOCK_DEFAULT_TLS_VERSION;
	}

	if (SPDK_SOCK_OPTS_FIELD_OK(opts, ktls)) {
		opts->ktls = SPDK_SOCK_DEFAULT_KTLS;
	}
}

/*
@@ -273,6 +283,14 @@ sock_init_opts(struct spdk_sock_opts *opts, struct spdk_sock_opts *opts_user)
	if (SPDK_SOCK_OPTS_FIELD_OK(opts, ack_timeout)) {
		opts->ack_timeout = opts_user->ack_timeout;
	}

	if (SPDK_SOCK_OPTS_FIELD_OK(opts, tls_version)) {
		opts->tls_version = opts_user->tls_version;
	}

	if (SPDK_SOCK_OPTS_FIELD_OK(opts, ktls)) {
		opts->ktls = opts_user->ktls;
	}
}

struct spdk_sock *
Loading