All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvme: consider also host_iface when checking ip options
@ 2022-07-22  9:24 Daniel Wagner
  2022-07-22  9:37 ` Chao Leng
  2022-07-22 13:49 ` Daniel Wagner
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Wagner @ 2022-07-22  9:24 UTC (permalink / raw)
  To: linux-nvme; +Cc: Daniel Wagner

It's perfectly fine to use the same traddr and trsvcid more than once
as long we use different a host_iface. This is used in setups where
the host has more than one interface but the target exposes only one
IP.

To keep the match logic simple don't allow mixed setups. The user
needs to use host_iface option consistently for all controllers in
such setups.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---


leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 

leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 
Failed to write to /dev/nvme-fabrics: Operation already in progress
no controller found: failed to write to nvme-fabrics device

leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth1
Failed to write to /dev/nvme-fabrics: Operation already in progress
no controller found: failed to write to nvme-fabrics device

leap154:~ # nvme disconnect -n nvmet-test
NQN:nvmet-test disconnected 1 controller(s)

leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth0

leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth1

 drivers/nvme/host/fabrics.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 604ab0e5a2ad..dc12853d04c9 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -944,7 +944,10 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl,
 {
 	if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
 	    strcmp(opts->traddr, ctrl->opts->traddr) ||
-	    strcmp(opts->trsvcid, ctrl->opts->trsvcid))
+	    strcmp(opts->trsvcid, ctrl->opts->trsvcid) ||
+	    (((opts->mask & NVMF_OPT_HOST_IFACE) &&
+	      (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) &&
+	       strcmp(opts->host_iface, ctrl->opts->host_iface)))
 		return false;
 
 	/*
-- 
2.37.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-07-28  1:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22  9:24 [PATCH v2] nvme: consider also host_iface when checking ip options Daniel Wagner
2022-07-22  9:37 ` Chao Leng
2022-07-22  9:46   ` Daniel Wagner
2022-07-22  9:55     ` Chao Leng
2022-07-22 10:09       ` Daniel Wagner
2022-07-25  0:52         ` Chao Leng
2022-07-25  9:25           ` Daniel Wagner
2022-07-26  2:11             ` Chao Leng
2022-07-26  7:18               ` Daniel Wagner
2022-07-27  6:52                 ` Chao Leng
2022-07-27  8:03                   ` Daniel Wagner
2022-07-28  1:20                     ` Chao Leng
2022-07-22 13:49 ` Daniel Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.