freebsd-src/sys/dev/nvme
Warner Losh 1bce7cd885 nvme: Add Linux copatible ioctls
Add the NVME_IOCTL_ID, NVME_IOCTL_ADMIN_CMD, and NVME_IOCTL_IO_CMD Linux
compatible ioctls. These may be run on either an I/O (ns) dev or a nvme
(admin) dev. Linux allows both on either device, and programs use this
and aren't careful about having the right device open. Emulate this
feature, and implement these ioctls. The data is passed in into the
kernel in host byte order (not converted to le). Results are returned in
host order.

The timeout field is ignore, and the metadata and metadata_len fields
must be zero.

The addr field can be null, even when the data_len is non zero (FreeBSD's
ioctl interface prohibits this, Linux's just ignores the inconsistency).

Only the cdw10 is returned from the command: the status is not returned
in 'result' field. XXX need to verify that this is what Linux does on an
error signaled from the drive.

No external include file is yet available for this: most programs that
call this interface either use a linux-specific path <linux/nvme.h> or
have their own private copy of the data. It's unclear the best thing to
do.

Also, create a /dev/nvmeXnY as an alias for /dev/nvmeXnsY.

These changes allow a native build of nvme-cli to work for everything
that doesn't depend on sysfs entries in /sys, calls that use metadata,
send / receive drive data and sed functionality not in our nvme driver.

Sponsored by:		Netflix
Co-Authored-by:		Chuck Tuffli <chuck@freebsd.org>
Reviewed by:		chuck
Differential Revision:	https://reviews.freebsd.org/D45415
2024-06-14 16:40:08 -06:00
..
nvme.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
nvme.h nvme: Add Linux copatible ioctls 2024-06-14 16:40:08 -06:00
nvme_ahci.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
nvme_ctrlr.c nvme: Add Linux copatible ioctls 2024-06-14 16:40:08 -06:00
nvme_ctrlr_cmd.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nvme_linux.h nvme: Add Linux copatible ioctls 2024-06-14 16:40:08 -06:00
nvme_ns.c nvme: Add Linux copatible ioctls 2024-06-14 16:40:08 -06:00
nvme_ns_cmd.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nvme_pci.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
nvme_private.h nvme: Count number of alginment splits 2024-05-24 08:32:47 -06:00
nvme_qpair.c nvme: Add comment about where tr->deadline is set 2024-05-13 16:14:04 -06:00
nvme_sim.c nvme: Use strlcpy instead of strncpy to ensure termination 2024-05-13 12:03:49 -07:00
nvme_sysctl.c nvme: Count number of alginment splits 2024-05-24 08:32:47 -06:00
nvme_test.c Reduce reliance on sys/sysproto.h pollution 2024-04-15 21:35:40 +01:00
nvme_util.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00