[v6,08/16] usertools: add support for virtio blk device

Message ID 1650530034-59744-9-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series add virtio_blk device support to vdpa/ifc |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pei, Andy April 21, 2022, 8:33 a.m. UTC
  Add virtio blk device support to devbind.

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 usertools/dpdk-devbind.py | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Chenbo Xia April 25, 2022, 1:53 p.m. UTC | #1
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Thursday, April 21, 2022 4:34 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao,
> Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> Subject: [PATCH v6 08/16] usertools: add support for virtio blk device
> 
> Add virtio blk device support to devbind.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  usertools/dpdk-devbind.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index ace4627..cbe336f 100755
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> @@ -14,6 +14,8 @@
>  from os.path import join as path_join

Supporting it in this script or not, it should not be named as 'XXX_class'.
And even may not be defined as new class. Maybe go to misc devices for now?
I'd like to hear others' opinion.

And Stephen commented about using driverctl, please reply to that.

Thanks,
Chenbo

> 
>  # The PCI base class for all devices
> +virtio_blk_class = {'Class': '01', 'Vendor': "1af4", 'Device': '1001',
> +                    'SVendor': '8086', 'SDevice': '0002'}
>  network_class = {'Class': '02', 'Vendor': None, 'Device': None,
>                   'SVendor': None, 'SDevice': None}
>  acceleration_class = {'Class': '12', 'Vendor': None, 'Device': None,
> @@ -72,6 +74,7 @@
>  cn9k_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
>                   'SVendor': None, 'SDevice': None}
> 
> +virtio_blk_devices = [virtio_blk_class]
>  network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
>  baseband_devices = [acceleration_class]
>  crypto_devices = [encryption_class, intel_processor_class]
> @@ -587,6 +590,9 @@ def show_status():
>      Displays to the user what devices are bound to the igb_uio driver,
> the
>      kernel driver or to no driver'''
> 
> +    if status_dev in ["virtio_blk", "all"]:
> +        show_device_status(virtio_blk_devices, "virtio_blk")
> +
>      if status_dev in ["net", "all"]:
>          show_device_status(network_devices, "Network", if_field=True)
> 
> @@ -746,6 +752,7 @@ def do_arg_actions():
>          if b_flag is not None:
>              clear_data()
>              # refresh if we have changed anything
> +            get_device_details(virtio_blk_devices)
>              get_device_details(network_devices)
>              get_device_details(baseband_devices)
>              get_device_details(crypto_devices)
> @@ -769,6 +776,7 @@ def main():
>      parse_args()
>      check_modules()
>      clear_data()
> +    get_device_details(virtio_blk_devices)
>      get_device_details(network_devices)
>      get_device_details(baseband_devices)
>      get_device_details(crypto_devices)
> --
> 1.8.3.1
  
Pei, Andy April 26, 2022, 4:13 a.m. UTC | #2
Hi Chenbo,

Thanks for your reply.
I will send out a new version, and put blk device into misc devices.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, April 25, 2022 9:53 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>; david.marchand@redhat.com
> Subject: RE: [PATCH v6 08/16] usertools: add support for virtio blk device
> 
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Thursday, April 21, 2022 4:34 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > <changpeng.liu@intel.com>
> > Subject: [PATCH v6 08/16] usertools: add support for virtio blk device
> >
> > Add virtio blk device support to devbind.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  usertools/dpdk-devbind.py | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> > index ace4627..cbe336f 100755
> > --- a/usertools/dpdk-devbind.py
> > +++ b/usertools/dpdk-devbind.py
> > @@ -14,6 +14,8 @@
> >  from os.path import join as path_join
> 
> Supporting it in this script or not, it should not be named as 'XXX_class'.
> And even may not be defined as new class. Maybe go to misc devices for
> now?
> I'd like to hear others' opinion.
> 
> And Stephen commented about using driverctl, please reply to that.
> 
> Thanks,
> Chenbo
> 
> >
> >  # The PCI base class for all devices
> > +virtio_blk_class = {'Class': '01', 'Vendor': "1af4", 'Device': '1001',
> > +                    'SVendor': '8086', 'SDevice': '0002'}
> >  network_class = {'Class': '02', 'Vendor': None, 'Device': None,
> >                   'SVendor': None, 'SDevice': None}
> > acceleration_class = {'Class': '12', 'Vendor': None, 'Device': None,
> > @@ -72,6 +74,7 @@  cn9k_ree = {'Class': '08', 'Vendor': '177d',
> > 'Device': 'a0f4',
> >                   'SVendor': None, 'SDevice': None}
> >
> > +virtio_blk_devices = [virtio_blk_class]
> >  network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
> > baseband_devices = [acceleration_class]  crypto_devices =
> > [encryption_class, intel_processor_class] @@ -587,6 +590,9 @@ def
> > show_status():
> >      Displays to the user what devices are bound to the igb_uio
> > driver, the
> >      kernel driver or to no driver'''
> >
> > +    if status_dev in ["virtio_blk", "all"]:
> > +        show_device_status(virtio_blk_devices, "virtio_blk")
> > +
> >      if status_dev in ["net", "all"]:
> >          show_device_status(network_devices, "Network", if_field=True)
> >
> > @@ -746,6 +752,7 @@ def do_arg_actions():
> >          if b_flag is not None:
> >              clear_data()
> >              # refresh if we have changed anything
> > +            get_device_details(virtio_blk_devices)
> >              get_device_details(network_devices)
> >              get_device_details(baseband_devices)
> >              get_device_details(crypto_devices)
> > @@ -769,6 +776,7 @@ def main():
> >      parse_args()
> >      check_modules()
> >      clear_data()
> > +    get_device_details(virtio_blk_devices)
> >      get_device_details(network_devices)
> >      get_device_details(baseband_devices)
> >      get_device_details(crypto_devices)
> > --
> > 1.8.3.1
>
  

Patch

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index ace4627..cbe336f 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -14,6 +14,8 @@ 
 from os.path import join as path_join
 
 # The PCI base class for all devices
+virtio_blk_class = {'Class': '01', 'Vendor': "1af4", 'Device': '1001',
+                    'SVendor': '8086', 'SDevice': '0002'}
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                  'SVendor': None, 'SDevice': None}
 acceleration_class = {'Class': '12', 'Vendor': None, 'Device': None,
@@ -72,6 +74,7 @@ 
 cn9k_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
                  'SVendor': None, 'SDevice': None}
 
+virtio_blk_devices = [virtio_blk_class]
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 baseband_devices = [acceleration_class]
 crypto_devices = [encryption_class, intel_processor_class]
@@ -587,6 +590,9 @@  def show_status():
     Displays to the user what devices are bound to the igb_uio driver, the
     kernel driver or to no driver'''
 
+    if status_dev in ["virtio_blk", "all"]:
+        show_device_status(virtio_blk_devices, "virtio_blk")
+
     if status_dev in ["net", "all"]:
         show_device_status(network_devices, "Network", if_field=True)
 
@@ -746,6 +752,7 @@  def do_arg_actions():
         if b_flag is not None:
             clear_data()
             # refresh if we have changed anything
+            get_device_details(virtio_blk_devices)
             get_device_details(network_devices)
             get_device_details(baseband_devices)
             get_device_details(crypto_devices)
@@ -769,6 +776,7 @@  def main():
     parse_args()
     check_modules()
     clear_data()
+    get_device_details(virtio_blk_devices)
     get_device_details(network_devices)
     get_device_details(baseband_devices)
     get_device_details(crypto_devices)