DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] dma/idxd: add verbose option to config script
@ 2023-02-28 14:50 Bruce Richardson
  2023-03-10 17:46 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Richardson @ 2023-02-28 14:50 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Kevin Laatz

In case there are issues when configuring a device instance using the
dpdk_idxd_cfg.py script, add a "verbose" mode option to it. This allows
the user to see what changes are being made, and therefore which
operation, if any, within the config fails.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/dma/idxd/dpdk_idxd_cfg.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py
index 41b4d13b9c..c0c833ade9 100755
--- a/drivers/dma/idxd/dpdk_idxd_cfg.py
+++ b/drivers/dma/idxd/dpdk_idxd_cfg.py
@@ -13,18 +13,24 @@
 
 
 class SysfsDir:
+    verbose = False
+
     "Used to read/write paths in a sysfs directory"
     def __init__(self, path):
         self.path = path
 
     def read_int(self, filename):
         "Return a value from sysfs file"
+        if SysfsDir.verbose:
+            print(f"Reading '{filename}' in {self.path}")
         with open(os.path.join(self.path, filename)) as f:
             return int(f.readline())
 
     def write_values(self, values):
         "write dictionary, where key is filename and value is value to write"
         for filename, contents in values.items():
+            if SysfsDir.verbose:
+                print(f"Writing '{contents}' to '{filename}' in {self.path}")
             with open(os.path.join(self.path, filename), "w") as f:
                 f.write(str(contents))
 
@@ -124,12 +130,16 @@ def main(args):
                        help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     arg_p.add_argument('--wq-option', action='append', default=[],
                        help="Provide additional config option for queues (format 'x=y')")
+    arg_p.add_argument('--verbose', '-v', action='store_true',
+                       help="Provide addition info on tasks being performed")
     arg_p.add_argument('--reset', action='store_true',
                        help="Reset DSA device and its queues")
     parsed_args = arg_p.parse_args(args[1:])
 
     dsa_id = parsed_args.dsa_id
     dsa_id = get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id
+
+    SysfsDir.verbose = parsed_args.verbose
     if parsed_args.reset:
         reset_device(dsa_id)
     else:
-- 
2.37.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dma/idxd: add verbose option to config script
  2023-02-28 14:50 [PATCH] dma/idxd: add verbose option to config script Bruce Richardson
@ 2023-03-10 17:46 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2023-03-10 17:46 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Kevin Laatz

28/02/2023 15:50, Bruce Richardson:
> In case there are issues when configuring a device instance using the
> dpdk_idxd_cfg.py script, add a "verbose" mode option to it. This allows
> the user to see what changes are being made, and therefore which
> operation, if any, within the config fails.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-10 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 14:50 [PATCH] dma/idxd: add verbose option to config script Bruce Richardson
2023-03-10 17:46 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).