Skip to content

Commit 2004b21

Browse files
committed
libnvme: drop fabric_args
Remove the final references to 'fabric_args' and remove the structure. Signed-off-by; Hannes Reinecke <[email protected]>
1 parent 7cf2368 commit 2004b21

2 files changed

Lines changed: 17 additions & 66 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,11 +2539,10 @@ static bool validate_uri(struct nvme_global_ctx *ctx,
25392539
static int nbft_connect(struct nvme_global_ctx *ctx,
25402540
struct nvmf_context *fctx, struct nvme_host *h,
25412541
struct nvmf_disc_log_entry *e,
2542-
struct nbft_info_subsystem_ns *ss, struct fabric_args *trcfg,
2542+
struct nbft_info_subsystem_ns *ss,
25432543
struct nvme_fabrics_config *cfg)
25442544
{
25452545
nvme_ctrl_t c;
2546-
struct nvmf_context next_fctx = *fctx;
25472546
int saved_log_level;
25482547
bool saved_log_tstamp;
25492548
bool saved_log_pid;
@@ -2553,20 +2552,13 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
25532552
&saved_log_pid);
25542553

25552554
/* Already connected ? */
2556-
next_fctx.subsysnqn = trcfg->subsysnqn;
2557-
next_fctx.transport = trcfg->transport;
2558-
next_fctx.traddr = trcfg->traddr;
2559-
next_fctx.trsvcid = trcfg->trsvcid;
2560-
next_fctx.host_traddr = trcfg->host_traddr;
2561-
next_fctx.host_iface = trcfg->host_iface;
2562-
2563-
c = lookup_ctrl(h, &next_fctx);
2555+
c = lookup_ctrl(h, fctx);
25642556
if (c && nvme_ctrl_get_name(c))
25652557
return 0;
25662558

2567-
ret = nvme_create_ctrl(ctx, next_fctx.subsysnqn, next_fctx.transport,
2568-
next_fctx.traddr, next_fctx.host_traddr,
2569-
next_fctx.host_iface, next_fctx.trsvcid, &c);
2559+
ret = nvme_create_ctrl(ctx, fctx->subsysnqn, fctx->transport,
2560+
fctx->traddr, fctx->host_traddr,
2561+
fctx->host_iface, fctx->trsvcid, &c);
25702562
if (ret)
25712563
return ret;
25722564

@@ -2604,16 +2596,16 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
26042596
return ret;
26052597
}
26062598

2607-
if (next_fctx.connected)
2608-
next_fctx.connected(&next_fctx, c, next_fctx.user_data);
2599+
if (fctx->connected)
2600+
fctx->connected(fctx, c, fctx->user_data);
26092601

26102602
return 0;
26112603
}
26122604

26132605
static int nbft_discovery(struct nvme_global_ctx *ctx,
26142606
struct nvmf_context *fctx, struct nbft_info_discovery *dd,
26152607
struct nvme_host *h, struct nvme_ctrl *c,
2616-
struct nvme_fabrics_config *defcfg, struct fabric_args *deftrcfg)
2608+
struct nvme_fabrics_config *defcfg)
26172609
{
26182610
struct nvmf_discovery_log *log = NULL;
26192611
int ret;
@@ -2647,15 +2639,6 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26472639
next_fctx.traddr = e->traddr;
26482640
next_fctx.trsvcid = e->trsvcid;
26492641

2650-
struct fabric_args trcfg = {
2651-
.subsysnqn = e->subnqn,
2652-
.transport = nvmf_trtype_str(e->trtype),
2653-
.traddr = e->traddr,
2654-
.host_traddr = fctx->host_traddr,
2655-
.host_iface = fctx->host_iface,
2656-
.trsvcid = e->trsvcid,
2657-
};
2658-
26592642
if (e->subtype == NVME_NQN_CURR)
26602643
continue;
26612644

@@ -2677,27 +2660,25 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26772660
defcfg, NULL, &child);
26782661
if (ret)
26792662
continue;
2680-
nbft_discovery(ctx, &next_fctx, dd, h, child,
2681-
defcfg, &trcfg);
2663+
nbft_discovery(ctx, &next_fctx, dd, h, child, defcfg);
26822664
nvme_disconnect_ctrl(child);
26832665
nvme_free_ctrl(child);
26842666
} else {
2685-
ret = nbft_connect(ctx, &next_fctx, h, e, NULL,
2686-
&trcfg, defcfg);
2667+
ret = nbft_connect(ctx, &next_fctx, h, e, NULL, defcfg);
26872668

26882669
/*
26892670
* With TCP/DHCP, it can happen that the OS
26902671
* obtains a different local IP address than the
26912672
* firmware had. Retry without host_traddr.
26922673
*/
26932674
if (ret == -ENVME_CONNECT_ADDRNOTAVAIL &&
2694-
!strcmp(trcfg.transport, "tcp") &&
2675+
!strcmp(next_fctx.transport, "tcp") &&
26952676
strlen(dd->hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2696-
const char *htradr = trcfg.host_traddr;
2677+
const char *htradr = next_fctx.host_traddr;
26972678

2698-
trcfg.host_traddr = NULL;
2679+
next_fctx.host_traddr = NULL;
26992680
ret = nbft_connect(ctx, &next_fctx, h, e, NULL,
2700-
&trcfg, defcfg);
2681+
defcfg);
27012682

27022683
if (ret == 0)
27032684
nvme_msg(ctx, LOG_INFO,
@@ -2807,17 +2788,8 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28072788
nfctx.trsvcid = (*ss)->trsvcid;
28082789
nfctx.host_iface = NULL;
28092790

2810-
struct fabric_args trcfg = {
2811-
.subsysnqn = (*ss)->subsys_nqn,
2812-
.transport = (*ss)->transport,
2813-
.traddr = (*ss)->traddr,
2814-
.trsvcid = (*ss)->trsvcid,
2815-
.host_traddr = host_traddr,
2816-
.host_iface = NULL,
2817-
};
2818-
28192791
rr = nbft_connect(ctx, &nfctx, h, NULL,
2820-
*ss, &trcfg, fctx->cfg);
2792+
*ss, fctx->cfg);
28212793

28222794
/*
28232795
* With TCP/DHCP, it can happen that the OS
@@ -2827,11 +2799,10 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28272799
if (rr == -ENVME_CONNECT_ADDRNOTAVAIL &&
28282800
!strcmp(nfctx.transport, "tcp") &&
28292801
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2830-
trcfg.host_traddr = NULL;
28312802
nfctx.host_traddr = NULL;
28322803

28332804
rr = nbft_connect(ctx, &nfctx, h, NULL,
2834-
*ss, &trcfg, fctx->cfg);
2805+
*ss, fctx->cfg);
28352806

28362807
if (rr == 0)
28372808
nvme_msg(ctx, LOG_INFO,
@@ -2899,15 +2870,6 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28992870
strdup(nvmf_get_default_trsvcid(
29002871
uri->protocol, true));
29012872

2902-
struct fabric_args trcfg = {
2903-
.subsysnqn = NVME_DISC_SUBSYS_NAME,
2904-
.transport = uri->protocol,
2905-
.traddr = uri->host,
2906-
.trsvcid = trsvcid,
2907-
.host_traddr = host_traddr,
2908-
.host_iface = NULL,
2909-
};
2910-
29112873
nfctx.subsysnqn = NVME_DISC_SUBSYS_NAME;
29122874
nfctx.transport = uri->protocol;
29132875
nfctx.traddr = uri->host;
@@ -2926,7 +2888,6 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29262888
if (ret == -ENVME_CONNECT_ADDRNOTAVAIL &&
29272889
!strcmp(nfctx.transport, "tcp") &&
29282890
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2929-
trcfg.host_traddr = NULL;
29302891
nfctx.traddr = NULL;
29312892
ret = nvmf_create_discovery_ctrl(ctx,
29322893
&nfctx, h, fctx->cfg, &c);
@@ -2941,8 +2902,7 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29412902
goto out_free;
29422903
}
29432904

2944-
rr = nbft_discovery(ctx, &nfctx, *dd, h, c, fctx->cfg,
2945-
&trcfg);
2905+
rr = nbft_discovery(ctx, &nfctx, *dd, h, c, fctx->cfg);
29462906
if (!persistent)
29472907
nvme_disconnect_ctrl(c);
29482908
nvme_free_ctrl(c);

libnvme/src/nvme/private.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,6 @@ struct nvmf_context {
405405
void *user_data;
406406
};
407407

408-
struct fabric_args {
409-
const char *subsysnqn;
410-
const char *transport;
411-
const char *traddr;
412-
const char *trsvcid;
413-
const char *host_traddr;
414-
const char *host_iface;
415-
};
416-
417408
int nvme_set_attr(const char *dir, const char *attr, const char *value);
418409

419410
int json_read_config(struct nvme_global_ctx *ctx, const char *config_file);

0 commit comments

Comments
 (0)