Page MenuHomeFreeBSD

Fix bhyve's NVMe queue bookkeeping
ClosedPublic

Authored by chuck on Dec 31 2018, 6:52 PM.
Tags
Referenced Files
Unknown Object (File)
Sat, Mar 30, 3:26 AM
Unknown Object (File)
Mar 15 2024, 11:27 AM
Unknown Object (File)
Mar 7 2024, 11:49 PM
Unknown Object (File)
Dec 23 2023, 12:18 AM
Unknown Object (File)
Nov 6 2023, 5:44 AM
Unknown Object (File)
Oct 5 2023, 4:23 AM
Unknown Object (File)
Sep 5 2023, 9:49 PM
Unknown Object (File)
Aug 23 2023, 4:10 AM
Subscribers

Details

Summary

Many size / length parameters in NVMe are "0's based", meaning, a value
of 0x0 represents 1, 0x1 represents 2, etc.. While this leads to an
efficient encoding, it can lead to subtle bugs. With respect to queues,
these parameters include:

  • Maximum number of queue entries
  • Maximum number of queues
  • Number of Completion Queues
  • Number of Submission Queues

To be consistent, convert all 0's based values from the host to 1's
based value internally. Likewise, covert internal 1's based values to
0's based values when returned to the host. This fixes an off-by-one bug
when creating IO queues and simplifies some of the code. Note that this
bug is masked by another bug.

While in the neighborhood,

  • fix an erroneous queue ID check (checking CQ count when deleting SQ)
  • check for queue ID of 0x0 in a few places where this is illegal
  • clean up the Set Features, Number of Queues command and check for illegal values

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Use ONE_BASED() macro for CQ creation as well as SQ

LGTM! Do you mind set a MFC?

This revision is now accepted and ready to land.Jan 2 2019, 4:20 AM
araujo added a reviewer: bhyve.

This looks good to me as well...

This revision was automatically updated to reflect the committed changes.