nvme-tcp: print actual source IP address through sysfs "address" attr
authorMartin Belanger <martin.belanger@dell.com>
Wed, 7 Sep 2022 12:27:37 +0000 (08:27 -0400)
committerChristoph Hellwig <hch@lst.de>
Mon, 19 Sep 2022 15:55:28 +0000 (17:55 +0200)
commit02c57a82c0081141abc19150beab48ef47f97f18
tree0d7567cde51359985d862629ef7f3da0db567daf
parent5bfaba275ae6486700194cad962574e3eb7ae60d
nvme-tcp: print actual source IP address through sysfs "address" attr

TCP transport relies on the routing table to determine which source
address and interface to use when making a connection. Currently, there
is no way to tell from userspace where a connection was made. This
patch exposes the actual source address using a new field named
"src_addr=" in the "address" attribute.

This is needed to diagnose and identify connectivity issues. With the
source address we can infer the interface associated with each
connection.

This was tested with nvme-cli 2.0 to verify it does not have any
adverse effect. The new "src_addr=" field will simply be displayed in
the output of the "list-subsys" or "list -v" commands as shown here.

$ nvme list-subsys
nvme-subsys0 - NQN=nqn.2014-08.org.nvmexpress.discovery
\
 +- nvme0 tcp traddr=192.168.56.1,trsvcid=8009,src_addr=192.168.56.101 live

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/tcp.c