Commit 1fad5243 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Jim Harris
Browse files

perf: Prepare perf appliation for PSK identity generation



Change the way PSK is stored to use global variable.
This is to avoid setting the PSK twice: first time
in SSL socket opts, and a second time in probe_cb,
where controller opts are populated.

Copy user set PSK into controller opts in perf
application to indicate that nvme_tcp driver
should handle psk_identity generation.

Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I564629ab18166bda7a5165dca2b981dc0332cfd8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16670


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent 171345eb
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ static char *g_sock_threshold_impl;
static uint8_t g_transport_tos = 0;

static uint32_t g_rdma_srq_size;
uint8_t *g_psk = NULL;

/* When user specifies -Q, some error messages are rate limited.  When rate
 * limited, we only print the error message every g_quiet_count times the
@@ -339,9 +340,9 @@ perf_set_sock_opts(const char *impl_name, const char *field, uint32_t val, const
			fprintf(stderr, "No socket opts value specified\n");
			return;
		}
		sock_opts.psk_key = strdup(valstr);
		if (sock_opts.psk_key == NULL) {
			fprintf(stderr, "Failed to allocate psk_key in sock_impl\n");
		g_psk = strdup(valstr);
		if (g_psk == NULL) {
			fprintf(stderr, "Failed to allocate memory for psk\n");
			return;
		}
	} else if (strcmp(field, "psk_identity") == 0) {
@@ -2864,6 +2865,10 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
		opts->num_io_queues = g_num_workers * g_nr_io_queues_per_ns;
	}

	if (g_psk != NULL) {
		memcpy(opts->psk, g_psk, strlen(g_psk));
	}

	return true;
}

@@ -3212,6 +3217,8 @@ cleanup:

	spdk_env_fini();

	free(g_psk);

	pthread_mutex_destroy(&g_stats_mutex);

	if (rc != 0) {