[PATCH v4] nvme-tcp: Print actual source IP address through sysfs "address" attr

Hannes Reinecke hare at suse.de
Thu Sep 8 00:18:02 PDT 2022


On 9/7/22 14:27, Martin Belanger wrote:
> From: Martin Belanger <martin.belanger at dell.com>
> 
> 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
> 
> Changes to v3:
> Per Chaitanya review comments: Change the order of the variables
> declaration. And although len can never be 0, for completeness add a
> check (lev > 0) before decrementing its value.
> 
> Changes to v2:
> Taken Sagi's comments into account
> 
> Changes to original submission:
> Reword comments per Chaitanya's suggestion
> 
> Signed-off-by: Martin Belanger <martin.belanger at dell.com>
> ---
>   drivers/nvme/host/tcp.c | 21 ++++++++++++++++++++-
>   1 file changed, 20 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman



More information about the Linux-nvme mailing list