Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2025 08:53:24 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        Warner Losh <imp@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 53825afc5dd1 - main - nvme: There's 64 LBAF descriptors, not 16
Message-ID:  <7467df7d-b01e-466c-8902-73a1f536c5a9@FreeBSD.org>
In-Reply-To: <202510100021.59A0LBYG001967@gitrepo.freebsd.org>
References:  <202510100021.59A0LBYG001967@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/9/25 20:21, Warner Losh wrote:
> The branch main has been updated by imp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=53825afc5dd13f3d16c3db6727260d7184bcd581
> 
> commit 53825afc5dd13f3d16c3db6727260d7184bcd581
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2025-10-10 00:16:47 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2025-10-10 00:19:04 +0000
> 
>      nvme: There's 64 LBAF descriptors, not 16
>      
>      Older versions of the standard were limited to 16, but the actual limit
>      is 64. Bump the limit to 64. This should be a #define, but there's no
>      good standardized name, so I'm punting on that. All the places that use
>      it, apart from the byte swapping code, do the right thing and use the
>      nlbaf field to limit what to access.
>      
>      Sponsored by:           Netflix
> ---
>   sys/dev/nvme/nvme.h | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
> index 17c5cdb4db87..57cb37907e65 100644
> --- a/sys/dev/nvme/nvme.h
> +++ b/sys/dev/nvme/nvme.h
> @@ -1507,9 +1507,7 @@ struct nvme_namespace_data {
>   	uint8_t			eui64[8];
>   
>   	/** lba format support */
> -	uint32_t		lbaf[16];
> -
> -	uint8_t			reserved7[192];
> +	uint32_t		lbaf[64];
>   
>   	uint8_t			vendor_specific[3712];
>   } __packed __aligned(4);
> @@ -2175,7 +2173,7 @@ void	nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused)
>   	s->anagrpid = le32toh(s->anagrpid);
>   	s->nvmsetid = le16toh(s->nvmsetid);
>   	s->endgid = le16toh(s->endgid);
> -	for (i = 0; i < 16; i++)
> +	for (i = 0; i < 64; i++)
>   		s->lbaf[i] = le32toh(s->lbaf[i]);

You could use `nitems(s->lbaf)` instead of 64 in this loop.

-- 
John Baldwin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7467df7d-b01e-466c-8902-73a1f536c5a9>