Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 2025 20:42:12 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        Charlie Li <vishwin@freebsd.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 60159a98a837 - main - nvme: Move opcode and status code tables from base CAM to nvme_util.c
Message-ID:  <d2f95ea5-aa29-4e7a-804c-4980d1a29f9e@FreeBSD.org>
In-Reply-To: <53d9ce10-191c-4edf-85d1-41b3162aefa4@freebsd.org>
References:  <202506052106.555L6XBV089396@gitrepo.freebsd.org> <53d9ce10-191c-4edf-85d1-41b3162aefa4@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6/5/25 19:29, Charlie Li wrote:
> John Baldwin wrote:
>> The branch main has been updated by jhb:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=60159a98a83747e539eb14c6a0eaaa1875e2cacc
>>
>> commit 60159a98a83747e539eb14c6a0eaaa1875e2cacc
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2025-06-05 21:03:01 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2025-06-05 21:03:01 +0000
>>
>>       nvme: Move opcode and status code tables from base CAM to nvme_util.c
>>       
>>       This makes it possible to share these tables with the nvme(4) driver
>>       in custom kernels that do not include any CAM support, only nvd(4).
>>       
>>       Reviewed by:    imp
>>       Sponsored by:   Chelsio Communications
>>       Differential Revision:  https://reviews.freebsd.org/D50685
>> ---
>>    sys/cam/nvme/nvme_all.c  | 224 ---------------------------------------------
>>    sys/cam/nvme/nvme_all.h  |   2 -
>>    sys/conf/files           |   2 +-
>>    sys/dev/nvme/nvme.h      |   4 +
>>    sys/dev/nvme/nvme_util.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++
>>    5 files changed, 236 insertions(+), 227 deletions(-)
>>
>> diff --git a/sys/cam/nvme/nvme_all.c b/sys/cam/nvme/nvme_all.c
>> index 4145aa16ed49..2ab8ae5340c6 100644
>> --- a/sys/cam/nvme/nvme_all.c
>> +++ b/sys/cam/nvme/nvme_all.c
>> @@ -292,24 +130,6 @@ nvme_command_string(struct ccb_nvmeio *nvmeio, char *cmd_string, size_t len)
>>    	return(sbuf_data(&sb));
>>    }
>>    
>> -void
>> -nvme_opcode_sbuf(bool admin, uint8_t opc, struct sbuf *sb)
>> -{
>> -	const char *s, *type;
>> -
>> -	if (admin) {
>> -		s = admin_opcode[opc];
>> -		type = "ADMIN";
>> -	} else {
>> -		s = nvm_opcode[opc];
>> -		type = "NVM";
>> -	}
>> -	if (s == NULL)
>> -		sbuf_printf(sb, "%s:0x%02x", type, opc);
>> -	else
>> -		sbuf_printf(sb, "%s", s);
>> -}
>> -
>> diff --git a/sys/cam/nvme/nvme_all.h b/sys/cam/nvme/nvme_all.h
>> index 17c068b825be..2bc1953e79be 100644
>> --- a/sys/cam/nvme/nvme_all.h
>> +++ b/sys/cam/nvme/nvme_all.h
>> @@ -42,11 +42,9 @@ struct sbuf;
>>    void	nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *);
>>    void	nvme_print_ident_short(const struct nvme_controller_data *,
>>        const struct nvme_namespace_data *, struct sbuf *);
>> -void nvme_opcode_sbuf(bool admin, uint8_t opc, struct sbuf *sb);
>>    void nvme_cmd_sbuf(const struct nvme_command *, struct sbuf *sb);
>>    int nvme_command_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb);
>>    const char *nvme_command_string(struct ccb_nvmeio *nvmeio, char *, size_t);
>> -void nvme_cpl_sbuf(const struct nvme_completion *cpl, struct sbuf *sbuf);
>>    int nvme_status_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb);
>>    const void *nvme_get_identify_cntrl(struct cam_periph *);
>>    const void *nvme_get_identify_ns(struct cam_periph *);
>>
>>
> <sys/dev/nvme.h> doesn't appear to be making it in nvme_all.h as the
> build complains about missing nvme_opcode_sbuf() in nvme_all.c.

Are you getting a link error or a compile error?  I built this locally several times
today to test various combinations (kernels with and without either CAM or nvme and
loading nvme.ko in kernels without to make sure it worked).  I also built GENERIC
prior to pushing and it built fine.

Sigh, so from ci.freebsd.org, it appears to be userland that is choking (libcam)
rather than the kernel.  I'll fix shortly (mostly it just means removing the
#ifdef _KERNEL).

-- 
John Baldwin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d2f95ea5-aa29-4e7a-804c-4980d1a29f9e>