]> www.infradead.org Git - users/sagi/libnvme.git/commit
mi: Distinguish MI status from NVMe (CDW3) status
authorJeremy Kerr <jk@codeconstruct.com.au>
Thu, 20 Oct 2022 07:02:10 +0000 (15:02 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Sun, 23 Oct 2022 08:06:14 +0000 (16:06 +0800)
commitd8b5bb881afe8b46da348a908ac5f0557903f154
tree1ce24192ec7ea8eb480b32653f69ba8ac71a8ddc
parentb483bbd5f8069a79c7a638fc8049f54185acd2b9
mi: Distinguish MI status from NVMe (CDW3) status

We curerently have some overloading in the status values returned from
the nvme_* API, as the NVMe CDW3 values overlap with the
recently-introduced NVMe-MI response header status.

This change introduces a new encoding for the return values of MI
functions, where we use a set of bits in the return value to encode
whether the value is either a MI status value or a NVMe status value. We
leave room for future expansion too, by defining three bits of possible
type values.

This has minimal change to the current API, as we're using 0 for the
current NVMe status codes, so they are all unchanged. Since the MI
values alised those, they will have high bits set now, but we couldn't
previously distinguish them from the NVMe values anyway.

Fixes: https://github.com/linux-nvme/libnvme/issues/456
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
src/nvme/mi.c
src/nvme/types.h
test/mi-mctp.c