ebsnvme-stats: Correct numd - #56
Open
cperciva wants to merge 1 commit into
Open
Conversation
Per the NVMe specification: "Number of Dwords Lower (NUMDL): This field specifies the least significant 16 bits of the number of dwords to return unless otherwise specified. If the host specifies a size larger than the log page requested, the controller returns the complete log page with undefined results for dwords beyond the end of the log page, unless otherwise specified. The combined NUMDL field and NUMDU field form a 0's based value." Since the number of Dwords is 1024 (4096 / 4) and this is expressed as a *0's based value* the value which must be stored in the top 16 bits of Command Dword 10 is 1024 - 1 = 1023, not 1024. Signed-off-by: Colin Percival <cperciva@FreeBSD.org>
Author
|
I have not confirmed that EBS implements NVMe correctly (in fact, I know that it does not implement NVMe correctly in other ways...) but if EBS is bug-for-bug compatible with the previous behaviour of this command-line tool then this change should still be harmless since the only difference is whether a reserved value is copied out. I have not tested this change, since I do not use the tool in question; this bug was found purely by code inspection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the NVMe specification:
"Number of Dwords Lower (NUMDL): This field specifies the least
significant 16 bits of the number of dwords to return unless
otherwise specified. If the host specifies a size larger than
the log page requested, the controller returns the complete log
page with undefined results for dwords beyond the end of the log
page, unless otherwise specified. The combined NUMDL field and
NUMDU field form a 0's based value."
Since the number of Dwords is 1024 (4096 / 4) and this is expressed as a 0's based value the value which must be stored in the top 16 bits of Command Dword 10 is 1024 - 1 = 1023, not 1024.
Issue #, if available:
n/a
Description of changes:
Bug fix; see commit message.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.