Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-nvme@lists.infradead.org
Cc: MRuijter@onestopsystems.com, hch@lst.de,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [PATCH] nvmetcli: allow setting of the subsystem model
Date: Wed, 13 Nov 2019 13:58:46 -0800
Message-ID: <20191113215846.22399-2-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20191113215846.22399-1-chaitanya.kulkarni@wdc.com>

From: Mark Ruijter <MRuijter@onestopsystems.com>

This patch allows users to set the subsystem's model.

Signed-off-by: Mark Ruijter <MRuijter@onestopsystems.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
In case anyone is intrested here is the test report:-

1. Try input empty string to model attr, should get Linux in nvme list and
   in nvmetcli :-

1.1 # nvme list | tr -s ' ' ' ' | grep -v "\-\-"
 Node SN Model Namespace Usage Format FW Rev 
 /dev/nvme0n1 foo QEMU NVMe Ctrl 1 2.10 MB / 2.10 MB 1 B + 9 B 1.0 
 /dev/nvme1n1 8c2f4de7cc2d177b Linux 1 524.29 MB / 524.29 MB 1 B + 9 B 5.4.0-rc
 nvmetcli should show Linux as default model :-

1.2 # ./nvmetcli/nvmetcli 
/subsystems/fs> ls
o- fs ................................ [version=1.3, allow_any=1, \
                                        serial=a222fc0cd4e5859a, model=Linux]

2, Try and set the model, change from default, new value should reflect
   in nvme list and nvmetcli :-

2.1 # echo "testmodel" > /sys/kernel/config/nvmet/subsystems/fs/attr_model 

2.2# nvme list | tr -s ' ' ' ' | grep -v "\-\-"
Node SN Model Namespace Usage Format FW Rev 
/dev/nvme0n1 foo QEMU NVMe Ctrl 1 2.10 MB / 2.10 MB 1 B + 9 B 1.0 
/dev/nvme1n1 8c2f4de7cc2d177b testmodel 1 524.29 MB / 524.29 MB 1 B + 9 B 5.4.0-rc

2.3. # ./nvmetcli/nvmetcli 
/subsystems/fs> ls
o- fs ............................ [version=1.3, allow_any=1, \
                                    serial=a222fc0cd4e5859a, model=testmodel]

3. Change model value from nvmetcli and check nvme list should be the same :-

3.1 # ./nvmetcli 
/subsystems/fs> set attr model=cool~model
Parameter model is now 'cool~model'.

3.2# nvme list | tr -s ' ' ' ' | grep -v "\-\-"
Node SN Model Namespace Usage Format FW Rev 
/dev/nvme0n1 foo QEMU NVMe Ctrl 1 2.10 MB / 2.10 MB 1 B + 9 B 1.0 
/dev/nvme1n1 9a85e5d40cfc22a2 cool~model 1 524.29 MB / 524.29 MB 1 B + 9 B 5.4.0-rc

4. Initialize subsys with model name bdefore we link the subsys to port,
   nvmecli and nvmetcli should display new model name and not the default :-

4.1 # nvme list | tr -s ' ' ' ' | grep -v "\-\-"
Node SN Model Namespace Usage Format FW Rev 
/dev/nvme0n1 foo QEMU NVMe Ctrl 1 2.10 MB / 2.10 MB 1 B + 9 B 1.0 
/dev/nvme1n1 5033aba0a518cf48 new-model 1 524.29 MB / 524.29 MB 1 B + 9 B 5.4.0-rc

4.2 # ./nvmetcli/nvmetcli 
/subsystems/fs> get attr model 
model=new-model 

---
 nvmetcli | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nvmetcli b/nvmetcli
index 3d8c16e..7347fbb 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -155,6 +155,7 @@ class UISubsystemNode(UINode):
     ui_desc_attr = {
         'allow_any_host': ('string', 'Allow access by any host if set to 1'),
         'serial': ('string', 'Export serial number to hosts'),
+        'model': ('string', 'Set a model description'),
         'version': ('string', 'Export version number to hosts'),
     }
 
@@ -172,6 +173,7 @@ class UISubsystemNode(UINode):
         info.append("allow_any=" +
                     self.cfnode.get_attr("attr", "allow_any_host"))
         info.append("serial=" + self.cfnode.get_attr("attr", "serial"))
+        info.append("model=" + self.cfnode.get_attr("attr", "model"))
         return (", ".join(info), True)
 
 
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 21:58 [PATCH V2] nvmet: make ctrl model configurable Chaitanya Kulkarni
2019-11-13 21:58 ` Chaitanya Kulkarni [this message]
2019-11-20  4:38   ` [PATCH] nvmetcli: allow setting of the subsystem model Chaitanya Kulkarni
2019-11-20  4:38 ` [PATCH V2] nvmet: make ctrl model configurable Chaitanya Kulkarni
2019-11-20 18:41 ` Christoph Hellwig

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191113215846.22399-2-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=MRuijter@onestopsystems.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git