From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8613633A6E9 for ; Thu, 18 Jun 2026 03:12:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781752353; cv=none; b=QC2Qbekks2e/JJECsF9i5UZW21Z5R9tsX+46QzbyNODd6VOgnE+tnT+zosXZgdYaCJiZxxnfqNXbb1sSfg5RKvubR0pg2gPo1GxrZdDIsths8rCf0k4me9bWtqTzikg4DAsAeAXiSRFhWYxyfMwFVp9hbDyTr9nu0cz4wI82gwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781752353; c=relaxed/simple; bh=uUgGi1gAXB+aEdyd3N6OuQkfZrorMJPFi1xxivK5ar4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=RFtQmz6AHMnqN9hZTuaiJKM0fxsG9OrWLoFKmmwe05otvpslxCnOsrllRdu/sR/G03CvrJK9ZUFmuDgSoZARUnhByHm+R3JQ2o2M0rzi8+68CkTnWI5UiU6tz9W2Lb92ijzEPA31ikvtCABgAp47Qr5D/u0qIfaj6mqeD2KSjpE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 82a9b9626ac311f1aa26b74ffac11d73-20260618 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:620d1433-5573-4c72-a1ca-b69b26657322,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:6d55710aaaa8060313bc92c833766890,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|865|898,TC:nil,Content:0|15|50,EDM:- 3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,A V:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 82a9b9626ac311f1aa26b74ffac11d73-20260618 X-User: liuxixin@kylinos.cn Received: from [127.0.1.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1365626505; Thu, 18 Jun 2026 11:12:16 +0800 From: Xixin Liu To: linux-nvme@lists.infradead.org Cc: hch@lst.de, sagi@grimberg.me, kch@nvidia.com, kbusch@kernel.org, axboe@kernel.dk, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, liuxixin@kylinos.cn Subject: [PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00 Date: Thu, 18 Jun 2026 11:03:36 +0800 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailer: nvme-ecn124/send-local.py Hi, NVM Express Base Specification 2.3 defines Get Log CDW14 Offset Type (OT): when OT is set, LPO is a structure index into the log page rather than a byte offset. For the Discovery log (LID 0x70), the controller advertises Index Offset Supported (IOS) in Supported Log Pages (LID 0x00) and must reject OT=1 when IOS is clear for the requested LID. nvmet already handles OT=0 byte offsets on the Discovery controller (including partial reads and zero-fill within the log page). It does not implement LID 0x00 there, does not set IOS for LID 0x70, and treats LPO as bytes even when OT=1. This patch: - Answers Get Log LID 0x00 on the Discovery controller. - Sets LSUPP|IOS for the Supported and Discovery log page IDs. - Adds NVME_LIDS_IOS and NVME_LOG_CDW14_OT (bit 23, matching libnvme). - Translates OT=1 LPO from index to byte offset (index 0 = header). - Rejects OT=1 when IOS is not set for the requested LID. - Guards u64 overflow when converting large indices so a wrapped offset cannot bypass the existing offset > alloc_len check. OT=0 behaviour and nvme discover (libnvme default) are unchanged. Tested on linux-next (7.1.0-rc7-next-20260611) with nvmet-tcp and null_blk: - nvme get-log LID 0x00 / 0x70 with OT=0 and OT=1 (index and byte paths) - blktests nvme/003 (tcp), nvme/002/016/017/030 (loop): passed - make -C drivers/nvme/target Thanks, Xixin Liu --- Xixin Liu (1): nvmet: implement discovery Get Log indexing and LID 0x00 drivers/nvme/target/discovery.c | 101 +++++++++++++++++++++++++++++++++++++++-- include/linux/nvme.h | 18 +++++++- 2 files changed, 113 insertions(+), 6 deletions(-) -- 2.43.0