Page MenuHomeFreeBSD

cam: Add NVMe reservation, format and features CCB building functions
Needs ReviewPublic

Authored by ken on Wed, Sep 9, 3:34 PM.

Details

Reviewers
None
Group Reviewers
cam
Summary

Add NVMe CCB (union ccb / struct ccb_nvmeio) building functions for
the four NVMe reservation opcodes, Format NVM, and Get Features /
Set Features. These use the nvme_command building blocks added to
sys/dev/nvme/nvme.h, and are used by the new camcontrol(8) nvres,
nvformat and nvfeature subcommands that will be added separately.

sys/cam/nvme/nvme_all.c:
Add NVMe CCB building functions for the four NVMe reservation
opcodes: nvme_resv_report(), nvme_resv_register(),
nvme_resv_acquire() and nvme_resv_release(). Data direction
is set internally (CAM_DIR_IN or CAM_DIR_OUT as appropriate),
so no flags parameter is needed.

Add a new nvme_format() CCB building function.

Add nvme_get_feature() and nvme_set_feature() CCB building
functions, along with nvme_get_feature_hostid() and
nvme_set_feature_hostid() convenience wrappers for the hostid
feature. nvme_set_feature_hostid() takes an sv argument so
the caller can request that the hostid persist across reset.

sys/cam/nvme/nvme_all.h:
Add prototypes for the above. Wrap the declarations in
BEGIN_DECLS / END_DECLS so C++ compilers don't mangle the
names of the C symbols.

Co-authored-by: Reid Linnemann <reidl@spectralogic.com>
Co-authored-by: Dave Baukus <daveb@spectralogic.com>
Sponsored by: Spectra Logic

Depends on D59531

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 76697
Build 73580: arc lint + arc unit

Event Timeline

ken requested review of this revision.Wed, Sep 9, 3:34 PM
sys/cam/nvme/nvme_all.c
301

Why do some calls have the comments, and some don't?

sys/cam/nvme/nvme_all.h
33

This isn't needed since nvme.h includes sys/param.h.

sys/cam/nvme/nvme_all.c
301

When we're setting certain parameters to 0, it is helpful to know which ones we are setting (especially with nvme_set_feature()) instead of just having 0, 0, 0, 0 etc.

When we're passing variables like cbfcnp, data_ptr, etc. it is more obvious. From an indentation/style standpoint it looks better to have all or none commented on a given call...

I can modify the calls to be all commented.

sys/cam/nvme/nvme_all.h
33

Ok, I'll take it out.

ken edited the summary of this revision. (Show Details)

Address review feedback: drop the redundant sys/cdefs.h include (nvme.h pulls in sys/param.h), and annotate the arguments on all calls in the new functions so the comment style is consistent throughout. Also fix two annotation typos (dxfrer_len, and cdw10 on a cdw11 argument) in the hostid wrappers.

ken marked 2 inline comments as done.Wed, Sep 9, 9:01 PM