Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796219412; b=0b7QxfEuqsDP34qd2XEXfYUnO4iCzdkyChilQ3Log1kqOsVh8AUXTm4FPvhJRQ+GpAtQ PR793HjZZYeDNH5ILtfFt0VzwEaqQ4946t9VCxe10Ok383G7lXjLR9tzVFcqMSi68EzeJ wVy+hd9lAXVggDxiF9I5DmFXeXzzDHwpoZ+Bv1T2+WT7LK50QGpciJLm9GoUs0dS8jJB6 JCIDpn00Dg9bP8r9sTANpb0qt4W7klQyPLrV9pXqbzutnffc+nfXsnJ+huFP53KX4QCas YRAzapst/BIA/EZY6y01pY+O5PZ8UwPv37tN1WHJrhTkl1OUu1czyA3YLmITN/OwVmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796219412; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF: X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=0ullj2awZPB2xhF4EzkBPNLjnHMYA2mJ4CVsbSYR61w=; b=vy8gVo4V2BVTgK+TU93dCB36Y5FhPkXn0SOCITOqA4CwVTbiKukBynezzhY+VQeJ+ub/ 1UAJJhTR+7GVXvfMxOAhl3NIDSP7XRHp5r9qIcMOvmxqictVSL+MTRccAuepxY4DS5vTN DmU9SIRAD7Zfa2xZVG6xhqOf8UjqYcUxF81jWenjgC0cmsfzTNuFiWE0CFWiil3O/SE49 cnMDT6PifrNhugw40bh/wHcVkZUf19X9vL8ZVmSLLGcloqeWSGYTipMPYv8gJYJAnZ4gT u/vF0Ilyv0qaXvWWsNSa10rbVHCcVaULa2rkZaLVDHHyHW4wwcICN688fREmoP2UVwA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=qOPAYVaj; arc=none smtp.remote-ip=148.163.158.5 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBF6F606A32C for ; Wed, 2 Dec 2026 13:50:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EBF6F606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=qOPAYVaj Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2AM8ti233479; Wed, 2 Dec 2026 13:49:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=0ullj2 awZPB2xhF4EzkBPNLjnHMYA2mJ4CVsbSYR61w=; b=qOPAYVajyrNHd9VXaoS50B lY+l4nlBHcI2UpL74V5aDlRRQfI048g1VLcd0g54vbn+PoqvlKcnQb7iQEX14XBs molv0aNgevi8z3tOvraO74ORL0XFHo3b6lkQI2RnBNQHYpWV6Bg1UTH6M5H+2d4V Q1Kg37B27PL/VeVN4X8v96zahmH5UOA7HzB/X0xxnhKd5rlMMY/Scsdss7tLskVJ xYqoBguXzUyNzkzDKF9V3vtDx3QHk/KekO5CwTDf3jXDMX96OklkQ315k1JNfHr0 AwdGsF2Ob/U8J7Ni86VzM0Ng3D/tTRHxNPjcbQu3GKLGJpwXMgeWwFMgxa3BArIg == Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pku9u97-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 13:49:50 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2BdTRs3858579; Wed, 2 Dec 2026 13:49:49 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ja2uv3pe3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 13:49:49 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B2DnmkX8585932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 13:49:49 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9B3458054; Wed, 2 Dec 2026 13:49:48 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C1F15804E; Wed, 2 Dec 2026 13:49:40 +0000 (GMT) Received: from [9.61.73.68] (unknown [9.61.73.68]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 13:49:39 +0000 (GMT) Message-ID: Date: Wed, 2 Dec 2026 19:19:38 +0530 X-Mailing-List: sashiko-reviews@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs To: sashiko-reviews@lists.linux.dev Cc: linux-nvme@lists.infradead.org, Christoph Hellwig , Hannes Reinecke , Keith Busch , Daniel Wagner , Sagi Grimberg , Chaitanya Kulkarni , Greg Joyce References: <20261201095146.510810-3-nilay@linux.ibm.com> <20261201095146.510810-4-nilay@linux.ibm.com> Content-Language: en-US From: Nilay Shroff In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=KZZHIgYD c=1 sm=1 tr=0 ts=6b1021fe cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=3cGW3RretmfWb0h6BfsA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA1NCBTYWx0ZWRfX8OpbEMjxoDx8 7GvE/rxELKTu21+Gu3yARfsUeJzY9Q+TggZjKbe8TMNkbfBl9gK+j1NXFqy0QXCMzVoeaz4Kbap K2OEgTfTpBVhAbV1jY1yPZPyU8Qs+uFWJa5yp+aNqUL3RymoiH/LtucJwIXzzrA9vAXnPG2NxQH 9zRE76J9NpFmDtnN+xH7ZE8Xmrqcrpk5gFkXKg4gcqoTts99b3IszkHUDTEr2L/wFTB1n49PTVr xlvSc3r+D7UNy2EkvFSWLDMF0VbFz+cpha8LGSG4yhGyDyp4iW75m0b5lQNeQxFeoq4smSA4hKR NAS+Jh3gMWoH+JPaGz8CHMXw3HJJJpVEqKc7NUwsdTSQJ3w37lWHF0Y6byxMUDXOeOlTxSGKwfB e7rIW5DVHOnFvr3nVUDwWzfxr4BZCjgKPOUcNUVw8eSlw9mkrxnrWAxuqSvk1tLx5O6V+1uytTt 0USpe7ltNH2byCexMOA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA1NCBTYWx0ZWRfXyU1I+iyUZTFO vHFD6EELetEvsvqcau/6SjmYg/SS4dwNe7Qrr8Uz5jsZSkZ37SiKjHqwHdgrLgvTEN1iQ+6rejM szilnUXptXeh3MPPrZTTlu2L7rrcO5A= X-Proofpoint-ORIG-GUID: PPidyIe1LGnTczfPaAIPXW7tKanEdCrF X-Proofpoint-GUID: PPidyIe1LGnTczfPaAIPXW7tKanEdCrF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_02,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1011 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020054 On 12/1/26 3:34 PM, sashiko-bot@kernel.org wrote: > 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 > > 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. > Yes, that's correct. However, IMO, emitting %0 as the scope ID for the unscoped IPv6 address should be acceptable. First, I doubt there are many use cases where a host connects to a link-local target address using a non-link-local source address. Even if such a configuration exists, a parser consuming this sysfs attribute can simply treat a scope-id of 0 as no scope-id. On another note, the kernel also supports the %pISsc printk format specifier to print an IPv6 address along with its scope ID. This would similarly print %0 when the scope ID is zero. That said, it is possible to avoid printing the scope-id for an endpoint when it is zero. However, doing so would require additional conditional formatting logic, making the code slightly more complicated. If others feel that we should omit the scope-id when it is zero, I'm happy to make that change. Thanks, --Nilay