Skip to content

Commit caaeaeb

Browse files
hreineckeigaw
authored andcommitted
libnvme: drop fabric_args
Remove the final references to 'fabric_args' and remove the structure. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 8527604 commit caaeaeb

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
@@ -2543,11 +2543,10 @@ static bool validate_uri(struct nvme_global_ctx *ctx,
25432543
static int nbft_connect(struct nvme_global_ctx *ctx,
25442544
struct nvmf_context *fctx, struct nvme_host *h,
25452545
struct nvmf_disc_log_entry *e,
2546-
struct nbft_info_subsystem_ns *ss, struct fabric_args *trcfg,
2546+
struct nbft_info_subsystem_ns *ss,
25472547
struct nvme_fabrics_config *cfg)
25482548
{
25492549
nvme_ctrl_t c;
2550-
struct nvmf_context nfctx = *fctx;
25512550
int saved_log_level;
25522551
bool saved_log_tstamp;
25532552
bool saved_log_pid;
@@ -2556,21 +2555,13 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
25562555
saved_log_level = nvme_get_logging_level(ctx, &saved_log_tstamp,
25572556
&saved_log_pid);
25582557

2559-
/* Already connected ? */
2560-
nfctx.subsysnqn = trcfg->subsysnqn;
2561-
nfctx.transport = trcfg->transport;
2562-
nfctx.traddr = trcfg->traddr;
2563-
nfctx.trsvcid = trcfg->trsvcid;
2564-
nfctx.host_traddr = trcfg->host_traddr;
2565-
nfctx.host_iface = trcfg->host_iface;
2566-
2567-
c = lookup_ctrl(h, &nfctx);
2558+
c = lookup_ctrl(h, fctx);
25682559
if (c && nvme_ctrl_get_name(c))
25692560
return 0;
25702561

2571-
ret = nvme_create_ctrl(ctx, nfctx.subsysnqn, nfctx.transport,
2572-
nfctx.traddr, nfctx.host_traddr,
2573-
nfctx.host_iface, nfctx.trsvcid, &c);
2562+
ret = nvme_create_ctrl(ctx, fctx->subsysnqn, fctx->transport,
2563+
fctx->traddr, fctx->host_traddr,
2564+
fctx->host_iface, fctx->trsvcid, &c);
25742565
if (ret)
25752566
return ret;
25762567

@@ -2608,16 +2599,16 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
26082599
return ret;
26092600
}
26102601

2611-
if (nfctx.connected)
2612-
nfctx.connected(&nfctx, c, nfctx.user_data);
2602+
if (fctx->connected)
2603+
fctx->connected(fctx, c, fctx->user_data);
26132604

26142605
return 0;
26152606
}
26162607

26172608
static int nbft_discovery(struct nvme_global_ctx *ctx,
26182609
struct nvmf_context *fctx, struct nbft_info_discovery *dd,
26192610
struct nvme_host *h, struct nvme_ctrl *c,
2620-
struct nvme_fabrics_config *defcfg, struct fabric_args *deftrcfg)
2611+
struct nvme_fabrics_config *defcfg)
26212612
{
26222613
struct nvmf_discovery_log *log = NULL;
26232614
int ret;
@@ -2651,15 +2642,6 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26512642
nfctx.traddr = e->traddr;
26522643
nfctx.trsvcid = e->trsvcid;
26532644

2654-
struct fabric_args trcfg = {
2655-
.subsysnqn = e->subnqn,
2656-
.transport = nvmf_trtype_str(e->trtype),
2657-
.traddr = e->traddr,
2658-
.host_traddr = fctx->host_traddr,
2659-
.host_iface = fctx->host_iface,
2660-
.trsvcid = e->trsvcid,
2661-
};
2662-
26632645
if (e->subtype == NVME_NQN_CURR)
26642646
continue;
26652647

@@ -2681,27 +2663,26 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26812663
defcfg, NULL, &child);
26822664
if (ret)
26832665
continue;
2684-
nbft_discovery(ctx, &nfctx, dd, h, child,
2685-
defcfg, &trcfg);
2666+
nbft_discovery(ctx, &nfctx, dd, h, child, defcfg);
26862667
nvme_disconnect_ctrl(child);
26872668
nvme_free_ctrl(child);
26882669
} else {
26892670
ret = nbft_connect(ctx, &nfctx, h, e, NULL,
2690-
&trcfg, defcfg);
2671+
defcfg);
26912672

26922673
/*
26932674
* With TCP/DHCP, it can happen that the OS
26942675
* obtains a different local IP address than the
26952676
* firmware had. Retry without host_traddr.
26962677
*/
26972678
if (ret == -ENVME_CONNECT_ADDRNOTAVAIL &&
2698-
!strcmp(trcfg.transport, "tcp") &&
2679+
!strcmp(nfctx.transport, "tcp") &&
26992680
strlen(dd->hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2700-
const char *htradr = trcfg.host_traddr;
2681+
const char *htradr = nfctx.host_traddr;
27012682

2702-
trcfg.host_traddr = NULL;
2683+
nfctx.host_traddr = NULL;
27032684
ret = nbft_connect(ctx, &nfctx, h, e, NULL,
2704-
&trcfg, defcfg);
2685+
defcfg);
27052686

27062687
if (ret == 0)
27072688
nvme_msg(ctx, LOG_INFO,
@@ -2812,17 +2793,8 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28122793
nfctx.trsvcid = (*ss)->trsvcid;
28132794
nfctx.host_iface = NULL;
28142795

2815-
struct fabric_args trcfg = {
2816-
.subsysnqn = (*ss)->subsys_nqn,
2817-
.transport = (*ss)->transport,
2818-
.traddr = (*ss)->traddr,
2819-
.trsvcid = (*ss)->trsvcid,
2820-
.host_traddr = host_traddr,
2821-
.host_iface = NULL,
2822-
};
2823-
28242796
rr = nbft_connect(ctx, &nfctx, h, NULL,
2825-
*ss, &trcfg, fctx->cfg);
2797+
*ss, fctx->cfg);
28262798

28272799
/*
28282800
* With TCP/DHCP, it can happen that the OS
@@ -2832,11 +2804,10 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28322804
if (rr == -ENVME_CONNECT_ADDRNOTAVAIL &&
28332805
!strcmp(nfctx.transport, "tcp") &&
28342806
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2835-
trcfg.host_traddr = NULL;
28362807
nfctx.host_traddr = NULL;
28372808

28382809
rr = nbft_connect(ctx, &nfctx, h, NULL,
2839-
*ss, &trcfg, fctx->cfg);
2810+
*ss, fctx->cfg);
28402811

28412812
if (rr == 0)
28422813
nvme_msg(ctx, LOG_INFO,
@@ -2904,15 +2875,6 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29042875
strdup(nvmf_get_default_trsvcid(
29052876
uri->protocol, true));
29062877

2907-
struct fabric_args trcfg = {
2908-
.subsysnqn = NVME_DISC_SUBSYS_NAME,
2909-
.transport = uri->protocol,
2910-
.traddr = uri->host,
2911-
.trsvcid = trsvcid,
2912-
.host_traddr = host_traddr,
2913-
.host_iface = NULL,
2914-
};
2915-
29162878
nfctx.subsysnqn = NVME_DISC_SUBSYS_NAME;
29172879
nfctx.transport = uri->protocol;
29182880
nfctx.traddr = uri->host;
@@ -2931,7 +2893,6 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29312893
if (ret == -ENVME_CONNECT_ADDRNOTAVAIL &&
29322894
!strcmp(nfctx.transport, "tcp") &&
29332895
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
2934-
trcfg.host_traddr = NULL;
29352896
nfctx.traddr = NULL;
29362897
ret = nvmf_create_discovery_ctrl(ctx,
29372898
&nfctx, h, fctx->cfg, &c);
@@ -2946,8 +2907,7 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29462907
goto out_free;
29472908
}
29482909

2949-
rr = nbft_discovery(ctx, &nfctx, *dd, h, c, fctx->cfg,
2950-
&trcfg);
2910+
rr = nbft_discovery(ctx, &nfctx, *dd, h, c, fctx->cfg);
29512911
if (!persistent)
29522912
nvme_disconnect_ctrl(c);
29532913
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)