* [PATCH v5 0/1] nvme-tcp: NIC topology aware I/O queue scaling and queue info export
@ 2026-12-01 9:51 Nilay Shroff
2026-12-01 9:51 ` [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs Nilay Shroff
0 siblings, 1 reply; 3+ messages in thread
From: Nilay Shroff @ 2026-12-01 9:51 UTC (permalink / raw)
To: kbusch, dwagner, hch, hare, sagi, chaitanyak, gjoyce; +Cc: linux-nvme
This patch series has been revised based on feedback from the netdev
community [1].
Following the feedback, the logic for determining the number of fabric I/O
queues (nr-io-queues) has been now moved to userspace in nvme-cli [2]. As a
result, the first two patches from the earlier series v2, which implemented
this logic in the kernel driver, have been dropped in series v3.
Based on further feedback received on v3, this revision also moves the
export of NVMe/TCP I/O queue information from debugfs to sysfs, making
it easier for userspace tools to access the information and configure
host-side network tuning.
The patch exports the socket endpoint addresses of each NVMe/TCP
I/O queue through a new per-queue sysfs attribute named address.
This provides the TCP flow information (source/destination IP addresses
and ports) for each I/O queue. The associated CPU assignment can be
retrieved through the existing io_cpu attribute.
Together, these attributes provide userspace tools with the information
needed to configure:
- IRQ affinity
- RPS/XPS
- ntuple steering
- or any other scaling as deemed feasible
Together with tunning, these changes allow better alignment of:
flow -> NIC queue -> IRQ -> CPU -> NVMe/TCP I/O worker
Improving this alignment can enhance flow-to-CPU locality, potentially
improving performance and reducing I/O latency. Performance evaluation
results comparing the baseline with the tuned configuration are
available in [3].
Thanks!
[1]: https://lore.kernel.org/all/20260807160904.2eb1b3d1@kernel.org/
[2]: https://github.com/linux-nvme/nvme-cli/pull/4140
[3]: https://lore.kernel.org/all/20260731073918.614014-1-nilay@linux.ibm.com/
changes from v4
- Squashed the ABI documentation changes into first patch and so with
that now this series only has one patch (Hannes Reinecke)
- Renamed traddr, trsvcid, host_traddr and host_trsvcid to dip, dport
sip and sport respectively to match the generic terms used for tcp
queue socket connection endpoint
- show IPv6 scope id along with IPv6 address if scope-id is non-zero.
Link to v4: https://lore.kernel.org/all/20261123173727.2022020-1-nilay@linux.ibm.com/
Changes from v3
- Moved per-queue tcp flow information from debugfs to sysfs
(Daniel Wagner, Hannes Reinecke)
Link to v3: https://lore.kernel.org/all/20261026123411.1988949-4-nilay@linux.ibm.com/
Changes from v2
- Dropped patch #1 and #2 from v2
- Added new debugfs attribute parameter "is_visible" which could be useful
to hide the attribute for certain configuration or transport.
Link to v2: https://lore.kernel.org/all/20260731073918.614014-1-nilay@linux.ibm.com/
Nilay Shroff (1):
nvme-tcp: expose per-queue socket addresses via sysfs
Documentation/ABI/stable/sysfs-nvme | 25 ++++++++++++
drivers/nvme/host/tcp.c | 59 +++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
base-commit: 1c2ff060b8144fa816e7db751a8ed47c86032c92
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs 2026-12-01 9:51 [PATCH v5 0/1] nvme-tcp: NIC topology aware I/O queue scaling and queue info export Nilay Shroff @ 2026-12-01 9:51 ` Nilay Shroff 2026-12-01 10:04 ` sashiko-bot 0 siblings, 1 reply; 3+ messages in thread From: Nilay Shroff @ 2026-12-01 9:51 UTC (permalink / raw) To: kbusch, dwagner, hch, hare, sagi, chaitanyak, gjoyce; +Cc: linux-nvme Add a read-only per-queue sysfs attribute named "address" to expose the socket addresses associated with each NVMe/TCP I/O queue. The attribute reports the socket's peer and local endpoint information using the following fields: - sip: Local transport address (IPv4/IPv6). For IPv6, appends %<scope-id> if used for connection. - sport: Local transport service identifier. - dip: Peer transport address (IPV4/IPv6). For IPv6, appends %<scope-id> if used for connection. - dport: Peer transport service identifier The attribute is available at: /sys/class/nvme/nvmeX/queues/<qid>/address Together with the existing per-queue "io_cpu" attribute, this information helps correlate NVMe/TCP I/O queues with network stack components and tune their interaction, including IRQ affinity, RPS/RFS, XPS and NIC flow steering (ntuple). Also, document the per-IO-queue "address" sysfs attribute in Documentation/ABI/stable/sysfs-nvme. No changes to I/O behavior are expected. Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> --- Documentation/ABI/stable/sysfs-nvme | 25 ++++++++++++ drivers/nvme/host/tcp.c | 59 +++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/Documentation/ABI/stable/sysfs-nvme b/Documentation/ABI/stable/sysfs-nvme index fcfd0426866c..7dec65e306e7 100644 --- a/Documentation/ABI/stable/sysfs-nvme +++ b/Documentation/ABI/stable/sysfs-nvme @@ -534,3 +534,28 @@ Description: managed: (RO) Shows who owns the CPU placement. 1 while io_cpu is driver managed, 0 once the user assigned it, for the life of the controller. + +What: /sys/class/nvme/nvmeX/queues/<qid>/address +Date: December 2026 +KernelVersion: 7.5 +Contact: Nilay Shroff <nilay@linux.ibm.com> +Description: + (RO) Shows the socket endpoint addresses associated with + an NVMe/TCP I/O queue. The output contains the following + comma-separated fields: + + sip: Local transport address (IPv4/IPv6). For IPv6, + appends %<scope-id> if scope-id is used for + connection. + + sport: Local transport service identifier (TCP port). + + dip: Peer transport address (IPv4/IPv6). For Ipv6, + appends %<scope-id> if scope-id is used for + connection. + + dport: Peer transport service identifier (TCP port). + + Returns an empty result if the I/O queue is not live. + Returns error if host or peer transport address can't be + determined or transport address family is unsupported. diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index cf3c98b188bd..05cf7000ef67 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2127,14 +2127,73 @@ static ssize_t managed_show(struct kobject *kobj, struct kobj_attribute *attr, !test_bit(NVME_TCP_Q_IO_CPU_USER, &queue->flags)); } +static ssize_t address_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + struct nvme_tcp_queue *queue = nvme_queue_info_data(kobj); + struct sockaddr_storage src, dst; + int ret = 0; + + mutex_lock(&queue->queue_lock); + + if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags)) + goto out; + + ret = kernel_getsockname(queue->sock, (struct sockaddr *)&src); + if (ret <= 0) + goto out; + + ret = kernel_getpeername(queue->sock, (struct sockaddr *)&dst); + if (ret <= 0) + goto out; + + if (src.ss_family != dst.ss_family) { + ret = -EAFNOSUPPORT; + goto out; + } + + if (src.ss_family == AF_INET) { + struct sockaddr_in *sip = (struct sockaddr_in *)&src; + struct sockaddr_in *dip = (struct sockaddr_in *)&dst; + + ret = sysfs_emit(buf, "sip=%pI4,sport=%hu,dip=%pI4,dport=%hu\n", + &sip->sin_addr.s_addr, ntohs(sip->sin_port), + &dip->sin_addr.s_addr, ntohs(dip->sin_port)); + } else if (src.ss_family == AF_INET6) { + struct sockaddr_in6 *sip6 = (struct sockaddr_in6 *)&src; + struct sockaddr_in6 *dip6 = (struct sockaddr_in6 *)&dst; + + if (sip6->sin6_scope_id || dip6->sin6_scope_id) + ret = sysfs_emit(buf, "sip=%pI6c%%%u,sport=%hu,dip=%pI6c%%%u,dport=%hu\n", + &sip6->sin6_addr, sip6->sin6_scope_id, + ntohs(sip6->sin6_port), + &dip6->sin6_addr, dip6->sin6_scope_id, + ntohs(dip6->sin6_port)); + else + ret = sysfs_emit(buf, "sip=%pI6c,sport=%hu,dip=%pI6c,dport=%hu\n", + &sip6->sin6_addr, + ntohs(sip6->sin6_port), + &dip6->sin6_addr, + ntohs(dip6->sin6_port)); + } else { + ret = -EAFNOSUPPORT; + } +out: + mutex_unlock(&queue->queue_lock); + return ret; +} + static struct kobj_attribute nvme_tcp_io_cpu_attr = __ATTR(io_cpu, 0644, io_cpu_show, io_cpu_store); static struct kobj_attribute nvme_tcp_managed_attr = __ATTR_RO(managed); +static struct kobj_attribute nvme_tcp_address_attr = + __ATTR_RO(address); static struct attribute *nvme_tcp_queue_attrs[] = { &nvme_tcp_io_cpu_attr.attr, &nvme_tcp_managed_attr.attr, + &nvme_tcp_address_attr.attr, NULL, }; ATTRIBUTE_GROUPS(nvme_tcp_queue); -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs 2026-12-01 9:51 ` [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs Nilay Shroff @ 2026-12-01 10:04 ` sashiko-bot 0 siblings, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-12-01 10:04 UTC (permalink / raw) To: Nilay Shroff; +Cc: linux-nvme Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] nvme-tcp: address_show() emits %0 scope ID when one IPv6 endpoint is unscoped -- commit cef888fe89d146daf5915c1274fff0343c037eb2 Author: Nilay Shroff <nilay@linux.ibm.com> nvme-tcp: expose per-queue socket addresses via sysfs This commit adds a read-only per-queue sysfs attribute named "address" to expose the local and peer socket endpoint addresses for each NVMe/TCP I/O queue, and documents it in Documentation/ABI/stable/sysfs-nvme. > diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c > index cf3c98b188bd1..05cf7000ef678 100644 > --- a/drivers/nvme/host/tcp.c > +++ b/drivers/nvme/host/tcp.c > @@ -2127,14 +2127,73 @@ static ssize_t managed_show(struct kobject *kobj, struct kobj_attribute *attr, > !test_bit(NVME_TCP_Q_IO_CPU_USER, &queue->flags)); > } > > +static ssize_t address_show(struct kobject *kobj, struct kobj_attribute *attr, > + char *buf) > +{ > + struct nvme_tcp_queue *queue = nvme_queue_info_data(kobj); > + struct sockaddr_storage src, dst; > + int ret = 0; > + > + mutex_lock(&queue->queue_lock); > + > + if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags)) > + goto out; > + > + ret = kernel_getsockname(queue->sock, (struct sockaddr *)&src); > + if (ret <= 0) > + goto out; > + > + ret = kernel_getpeername(queue->sock, (struct sockaddr *)&dst); > + if (ret <= 0) > + goto out; > + > + if (src.ss_family != dst.ss_family) { > + ret = -EAFNOSUPPORT; > + goto out; > + } > + > + if (src.ss_family == AF_INET) { > + struct sockaddr_in *sip = (struct sockaddr_in *)&src; > + struct sockaddr_in *dip = (struct sockaddr_in *)&dst; > + > + ret = sysfs_emit(buf, "sip=%pI4,sport=%hu,dip=%pI4,dport=%hu\n", > + &sip->sin_addr.s_addr, ntohs(sip->sin_port), > + &dip->sin_addr.s_addr, ntohs(dip->sin_port)); > + } else if (src.ss_family == AF_INET6) { > + struct sockaddr_in6 *sip6 = (struct sockaddr_in6 *)&src; > + struct sockaddr_in6 *dip6 = (struct sockaddr_in6 *)&dst; > + > + if (sip6->sin6_scope_id || dip6->sin6_scope_id) > + ret = sysfs_emit(buf, "sip=%pI6c%%%u,sport=%hu,dip=%pI6c%%%u,dport=%hu\n", > + &sip6->sin6_addr, sip6->sin6_scope_id, > + ntohs(sip6->sin6_port), > + &dip6->sin6_addr, dip6->sin6_scope_id, > + ntohs(dip6->sin6_port)); [Severity: Medium] Does this emit a "%0" suffix on the unscoped endpoint when only one of sip6->sin6_scope_id or dip6->sin6_scope_id is non-zero? inet6_getname() sets sin6_scope_id via ipv6_iface_scope_id(), which only returns sk->sk_bound_dev_if for addresses that need a scope ID (such as link-local addresses) and returns 0 for global or unique-local addresses. If one side of the connection uses a link-local address and the other uses a global or unique-local address, formatting both with "%%%u" appends "%0" to the unscoped address. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261201095146.510810-3-nilay@linux.ibm.com?part=1 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-01 10:04 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-01 9:51 [PATCH v5 0/1] nvme-tcp: NIC topology aware I/O queue scaling and queue info export Nilay Shroff 2026-12-01 9:51 ` [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs Nilay Shroff 2026-12-01 10:04 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox