Skip to content

Conversation

@xyan264
Copy link
Collaborator

@xyan264 xyan264 commented Dec 3, 2020

Made the following changes:

  • delete nXXXX from switchtec list command output
  • don't accept nXXXX in switchtec device string
  • remove support for get-ns-id command: return error code
  • delete unused is_blk field from pax_nvme_device structure

Output is shown below:

root@/switchtec-nvme-cli# ./switchtec-nvme switchtec list
Node                       SN                   Model                                    Namespace Usage                      Format           FW Rev
-------------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               1           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               2           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               3           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               1           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               2           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q

root@/switchtec-nvme-cli# ./switchtec-nvme get-ns-id 0x3b00@/dev/switchtec0
Error: requesting namespace-id from non-block device
switchtec0: Block device required

root@/switchtec-nvme-cli# ./switchtec-nvme id-ctrl 0x3b00n1@/dev/switchtec0
Invalid device 0x3b00n1@/dev/switchtec0
Usage: nvme id-ctrl <device> [OPTIONS]

Send an Identify Controller command to the given device and report
...

New switchtec device name format is: pdfid@devicefile. Example: 0x3b00@/dev/switchtec0
Only display device name in 'Node' field. The NSID is displayed in 'Namespace' field
@xyan264 xyan264 requested a review from kelvin-cao December 3, 2020 20:28
@kelvin-cao
Copy link
Collaborator

Looks good to me. Only issue is that the items in the Usage and Format column are not aligned with the column name. For example, the "4.29" in the second line doesn't have the same offset in line as "Usage" has.

@xyan264
Copy link
Collaborator Author

xyan264 commented Dec 8, 2020

Yes this is an issue with the printf("%6.2f",size). However, if I force left alignment with %-6.2f, we have this:

Node                       SN                   Model                                    Namespace Usage                      Format           FW Rev
-------------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               1         4.29    GB /   4.29  GB    4   KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               2         4.29    GB /   4.29  GB    4   KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               3         4.29    GB /   4.29  GB    4   KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               1         4.29    GB /   4.29  GB    4   KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               2         4.29    GB /   4.29  GB    4   KiB +  0 B   EPK9AJ5Q

this generates too many spaces between 4.29 and GB, and 4 and KiB, and is less desirable, in my opinion.

@xyan264
Copy link
Collaborator Author

xyan264 commented Dec 8, 2020

The other solution is to move Usage and Format to the middle, like this:

Node                       SN                   Model                                    Namespace         Usage                  Format       FW Rev
-------------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               1           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               2           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x3b00@/dev/switchtec0     S4YNNE0N800321       SAMSUNG MZWLJ1T9HBJR-00007               3           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               1           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q
0x1300@/dev/switchtec0     S4YNNE0N800316       SAMSUNG MZWLJ1T9HBJR-00007               2           4.29  GB /   4.29  GB      4 KiB +  0 B   EPK9AJ5Q

Copy link
Collaborator

@kelvin-cao kelvin-cao left a comment

Choose a reason for hiding this comment

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

I'm good with current format. It seems we have to choose between alignment and extra spaces. Let's keep it as is. Thanks.

@xyan264 xyan264 merged commit babb066 into Microsemi:devel Dec 9, 2020
@xyan264 xyan264 deleted the nsid-fix branch December 9, 2020 18:46
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.

2 participants