]> www.infradead.org Git - users/sagi/libnvme.git/commit
mi: allow non-4-byte-aligned responses
authorJeremy Kerr <jk@codeconstruct.com.au>
Mon, 3 Jul 2023 08:14:47 +0000 (16:14 +0800)
committerDaniel Wagner <wagi@monom.org>
Thu, 20 Jul 2023 08:40:38 +0000 (10:40 +0200)
commit116421b3a33d7a9e81a3756e9a1d7620fbc5c02e
tree4971a05e5097da1010a028c03ce5cf47d3a2083c
parentdea640be8d325399ed3d4fb73f404ca4f89bf8bc
mi: allow non-4-byte-aligned responses

We currently assume that a MI response will be a multiple of four bytes
in length. However, this may not be the case: for example, a Read MI
Data (Controller List) with an even number of controllers, and with an
unpadded response, may only be aligned on a two-byte boundary.

The NVMe-MI spec states, for the MIC field:

    This field is byte aligned.

So, relax the requirement for alignment on the response sizes, and the
expected response size values. We only do this for the mi commands; the
Admin commands still require an aligned value for DLEN.

In doing so, drop the explicit alignment tests, and add a couple that
check that the Controller List example above will work.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reported-by: Klaus Jensen <its@irrelevant.dk>
src/nvme/mi.c
test/mi-mctp.c