]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
nvmetcli: support inline_data_size port parameter
authorSteve Wise <swise@opengridcomputing.com>
Mon, 9 Jul 2018 17:00:26 +0000 (10:00 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 17 Jul 2018 13:24:16 +0000 (06:24 -0700)
The port parameter attribute param_inline_data_size allows adjusting
the amount of inline data that can be included in a write IO. Setting
it to < 0 (or not setting it at all) allows the transport to choose a
reasonable default, which will be 0 if that transport does not support
inline.  Setting it to 0 disables the transport from using inline_data.
And setting it to > 0 configures that port/transport to use that inline
data size, in bytes, if the transport supports it.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
nvmet/nvme.py
nvmetcli

index 8253ea9264b77ff6c3764b100f4ab23bf9327d43..7ab0846bf835ebebce98c6efd26ec923afdf71c1 100644 (file)
@@ -609,7 +609,7 @@ class Port(CFSNode):
     def __init__(self, portid, mode='any'):
         super(Port, self).__init__()
 
-        self.attr_groups = ['addr']
+        self.attr_groups = ['addr', 'param']
         self._portid = int(portid)
         self._path = "%s/ports/%d" % (self.configfs_dir, self._portid)
         self._create_in_cfs(mode)
index 6b102a235450c41ce4a31521d5bede0618781d99..131d7845262c91472a186637f71ea89537f017a3 100755 (executable)
--- a/nvmetcli
+++ b/nvmetcli
@@ -374,6 +374,9 @@ class UIPortNode(UINode):
         'trsvcid': ('string', 'Transport Service ID (e.g. IP Port)'),
         'trtype': ('string', 'Transport Type (e.g. rdma or loop or fc)'),
     }
+    ui_desc_param = {
+        'inline_data_size': ('string', 'Port inline data size in bytes'),
+    }
 
     def __init__(self, parent, cfnode):
         UINode.__init__(self, str(cfnode.portid), parent, cfnode)
@@ -387,6 +390,16 @@ class UIPortNode(UINode):
         trsvcid = self.cfnode.get_attr("addr", "trsvcid")
         if trsvcid != "none":
             info.append("trsvcid=%s" % trsvcid)
+
+       '''
+       Support older target driver w/o the inline_data_size parameter
+       '''
+       try:
+               inline_data_size = self.cfnode.get_attr("param", "inline_data_size")
+       except:
+               inline_data_size = "n/a"
+       if inline_data_size != "n/a":
+               info.append("inline_data_size=" + inline_data_size);
         enabled = not (not self.cfnode.subsystems and not list(self.cfnode.referrals))
         return (", ".join(info), True if enabled else 0)