dma/idxd: fix failure to configure a device instance for DSA

Message ID 20240628053458.78337-1-wenwux.ma@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series dma/idxd: fix failure to configure a device instance for DSA |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Wenwu Ma June 28, 2024, 5:34 a.m. UTC
In ubuntu 24.04, DSA's workqueue has a new driver_name file in sysfs,
DPDK needs to write a correct value to this file when configuring a device
instance using the dpdk_idxd_cfg.py script, otherwise it will fail to be
configured, this patch fixes the issue.

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
 drivers/dma/idxd/dpdk_idxd_cfg.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson June 28, 2024, 9:27 a.m. UTC | #1
On Fri, Jun 28, 2024 at 01:34:58PM +0800, Wenwu Ma wrote:
> In ubuntu 24.04, DSA's workqueue has a new driver_name file in sysfs,
> DPDK needs to write a correct value to this file when configuring a device
> instance using the dpdk_idxd_cfg.py script, otherwise it will fail to be
> configured, this patch fixes the issue.
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---

One comment inline below. With that addressed:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  drivers/dma/idxd/dpdk_idxd_cfg.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py
> index c0c833ade9..9ca4c4d76c 100755
> --- a/drivers/dma/idxd/dpdk_idxd_cfg.py
> +++ b/drivers/dma/idxd/dpdk_idxd_cfg.py
> @@ -104,8 +104,10 @@ def configure_dsa(dsa_id, args):
>                   "priority": 1,
>                   "max_batch_size": 1024,
>                   "size": int(max_work_queues_size / nb_queues)}
> -        wqcfg.update(parse_wq_opts(args.wq_option))
>          wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
> +        if os.path.exists(SysfsDir(os.path.join(wq_dir.path, f"driver_name")).path):

I think this be simplified to remove the extra SysfsDir call as:
	if os.path.exists(os.path.join(wq_dir.path,"driver_name")):

> +            wqcfg.update({"driver_name": "user"})
> +        wqcfg.update(parse_wq_opts(args.wq_option))
>          wq_dir.write_values(wqcfg)
>  
>      # enable device and then queues
> -- 
> 2.25.1
>
  
Wenwu Ma June 28, 2024, 10:08 a.m. UTC | #2
hi

> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Friday, June 28, 2024 5:28 PM
> To: Ma, WenwuX <wenwux.ma@intel.com>
> Cc: dev@dpdk.org; Jiale, SongX <songx.jiale@intel.com>
> Subject: Re: [PATCH] dma/idxd: fix failure to configure a device instance for
> DSA
> 
> On Fri, Jun 28, 2024 at 01:34:58PM +0800, Wenwu Ma wrote:
> > In ubuntu 24.04, DSA's workqueue has a new driver_name file in sysfs,
> > DPDK needs to write a correct value to this file when configuring a
> > device instance using the dpdk_idxd_cfg.py script, otherwise it will
> > fail to be configured, this patch fixes the issue.
> >
> > Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> > ---
> 
> One comment inline below. With that addressed:
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> >  drivers/dma/idxd/dpdk_idxd_cfg.py | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py
> > b/drivers/dma/idxd/dpdk_idxd_cfg.py
> > index c0c833ade9..9ca4c4d76c 100755
> > --- a/drivers/dma/idxd/dpdk_idxd_cfg.py
> > +++ b/drivers/dma/idxd/dpdk_idxd_cfg.py
> > @@ -104,8 +104,10 @@ def configure_dsa(dsa_id, args):
> >                   "priority": 1,
> >                   "max_batch_size": 1024,
> >                   "size": int(max_work_queues_size / nb_queues)}
> > -        wqcfg.update(parse_wq_opts(args.wq_option))
> >          wq_dir = SysfsDir(os.path.join(dsa_dir.path,
> > f"wq{dsa_id}.{q}"))
> > +        if os.path.exists(SysfsDir(os.path.join(wq_dir.path,
> f"driver_name")).path):
> 
> I think this be simplified to remove the extra SysfsDir call as:
> 	if os.path.exists(os.path.join(wq_dir.path,"driver_name")):
Ok, thanks

> 
> > +            wqcfg.update({"driver_name": "user"})
> > +        wqcfg.update(parse_wq_opts(args.wq_option))
> >          wq_dir.write_values(wqcfg)
> >
> >      # enable device and then queues
> > --
> > 2.25.1
> >
  

Patch

diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py
index c0c833ade9..9ca4c4d76c 100755
--- a/drivers/dma/idxd/dpdk_idxd_cfg.py
+++ b/drivers/dma/idxd/dpdk_idxd_cfg.py
@@ -104,8 +104,10 @@  def configure_dsa(dsa_id, args):
                  "priority": 1,
                  "max_batch_size": 1024,
                  "size": int(max_work_queues_size / nb_queues)}
-        wqcfg.update(parse_wq_opts(args.wq_option))
         wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
+        if os.path.exists(SysfsDir(os.path.join(wq_dir.path, f"driver_name")).path):
+            wqcfg.update({"driver_name": "user"})
+        wqcfg.update(parse_wq_opts(args.wq_option))
         wq_dir.write_values(wqcfg)
 
     # enable device and then queues