Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mi: set correct rc and errno when crc mismatch #773

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

jinliangw
Copy link
Contributor

Before the fix, when we meet crc mismatch response, the errno is 0 and rc is 1. This combination will be mistaken as Admin Generic Command Status code value 0x1 (Invalid Command Opcode):
$ nvme id-ctrl mctp:1,20
crc mismatch
NVMe status: Invalid Command Opcode: A reserved coded value or an unsupported value in the command opcode field(0x1

After the fix, the rc is -1, and errno is set to Bad message.
$ nvme id-ctrl mctp:1,20
crc mismatch
identify controller: Bad message

@igaw igaw requested a review from jk-ozlabs January 19, 2024 12:44
@igaw
Copy link
Collaborator

igaw commented Jan 19, 2024

Looks good. Just wonder if the return right above also needs this treatment?

libnvme/src/nvme/mi.c

Lines 427 to 430 in 5084885

if (rc) {
nvme_msg(ep->root, LOG_INFO, "transport failure\n");
return rc;
}

Copy link
Collaborator

@jk-ozlabs jk-ozlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@jk-ozlabs
Copy link
Collaborator

Looks good. Just wonder if the return right above also needs this treatment?

The transport's submit callback should be setting errno appropriately there. The case from this fix is detected entirely from the MI core's MIC check, so we're responsible for setting errno in this case.

Before the fix, when we meet crc mismatch response, the errno is 0
and rc is 1. This combination will be mistaken as Admin Generic Command
Status code value 0x1 (Invalid Command Opcode):
  $ nvme id-ctrl mctp:1,20
  crc mismatch
  NVMe status: Invalid Command Opcode: A reserved coded value or an
    unsupported value in the command opcode field(0x1

After the fix, the rc is -1, and errno is set to Bad message.
  $ nvme id-ctrl mctp:1,20
  crc mismatch
  identify controller: Bad message

Signed-off-by: Jinliang Wang <[email protected]>
@jinliangw
Copy link
Contributor Author

Thank @igaw and @jk-ozlabs for the review, the checkpatch failure is fixed now.

@igaw igaw merged commit 2f722b1 into linux-nvme:master Jan 22, 2024
14 checks passed
@igaw
Copy link
Collaborator

igaw commented Jan 22, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants