mi-mctp: better handling for error/unexpected responses
Currently, the mi-mctp transport expects there to be at least a complete
header-sized reply - matching the caller's resp->hdr_size value,
otherwise we consider this a transport failure.
However, Admin command responses have a header that's larger than the
generic error response message, so we should be able to handle response
messages that are just the small header and no payload.
This change reworks the response-buffer handling in the MCTP transport.
Rather than storing the payload and MIC into an extra allocated buffer,
we just lay out the response iovec directly into the header, payload and
MIC buffers, and then handle the short-response cases as needed. This
means we can properly extract the error response, rather than just
having the transport report a generic "header too small" failure itself.
This is at high risk for off-by-one errors, so add tests to cover each
of the possible buffer-arrangement cases.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>