DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device
@ 2025-04-02  6:58 liwencheng
  2025-04-02 23:28 ` Stephen Hemminger
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: liwencheng @ 2025-04-02  6:58 UTC (permalink / raw)
  To: dev

This patch mainly adds functions for bind and unbind platform devices,
such as bind_platform_one and unbind_platform_one.

Signed-off-by: liwencheng <liwencheng@phytium.com.cn>
---
 usertools/dpdk-devbind.py | 131 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 114 insertions(+), 17 deletions(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 06ae25a..600c4ba 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -65,7 +65,7 @@
 intel_idxd_spr = {'Class': '08', 'Vendor': '8086', 'Device': '0b25',
                   'SVendor': None, 'SDevice': None}
 intel_idxd_gnrd = {'Class': '08', 'Vendor': '8086', 'Device': '11fb',
-                  'SVendor': None, 'SDevice': None}
+                   'SVendor': None, 'SDevice': None}
 intel_idxd_dmr = {'Class': '08', 'Vendor': '8086', 'Device': '1212',
                   'SVendor': None, 'SDevice': None}
 intel_ntb_skx = {'Class': '06', 'Vendor': '8086', 'Device': '201c',
@@ -156,10 +156,32 @@ def module_is_loaded(module):
     return module in loaded_modules
 
 
+def get_platform_devices():
+    global platform_devices
+
+    platform_device_path = "/sys/bus/platform/devices/"
+    platform_devices = os.listdir(platform_device_path)
+
+
+def devices_are_platform(devs):
+    all_devices_are_platform = True
+
+    get_platform_devices()
+    for d in devs:
+        if d not in platform_devices:
+            all_devices_are_platform = False
+            break
+
+    return all_devices_are_platform
+
+
 def check_modules():
     '''Checks that igb_uio is loaded'''
     global dpdk_drivers
 
+    if devices_are_platform(args):
+        return
+
     # list of supported modules
     mods = [{"Name": driver, "Found": False} for driver in dpdk_drivers]
 
@@ -330,11 +352,38 @@ def dev_id_from_dev_name(dev_name):
     for d in devices.keys():
         if dev_name in devices[d]["Interface"].split(","):
             return devices[d]["Slot"]
+
+    # Check if it is a platform device
+    if dev_name in platform_devices:
+        return dev_name
+
     # if nothing else matches - error
     raise ValueError("Unknown device: %s. "
                      "Please specify device in \"bus:slot.func\" format" % dev_name)
 
 
+def unbind_platform_one(dev_name):
+    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
+
+    if exists(filename):
+        try:
+            f = open(os.path.join(filename, "unbind"), "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
+                     (dev_name, os.path.join(filename, "unbind"), err))
+        f.write(dev_name)
+        f.close()
+        filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
+        try:
+            f = open(filename, "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
+                     (dev_name, filename, err))
+        f.write("")
+        f.close()
+        print("Successfully unbind platform device %s" % dev_name)
+
+
 def unbind_one(dev_id, force):
     '''Unbind the device identified by "dev_id" from its current driver'''
     dev = devices[dev_id]
@@ -360,6 +409,48 @@ def unbind_one(dev_id, force):
     f.close()
 
 
+def bind_platform_one(dev_name, driver):
+    filename = "/sys/bus/platform/drivers/%s" % driver
+
+    if not exists(filename):
+        print("The driver %s is not loaded" % driver)
+        return
+    # unbind any existing drivers we don't want
+    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
+    if exists(filename):
+        unbind_platform_one(dev_name)
+    # driver_override can be used to specify the driver
+    filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
+    if exists(filename):
+        try:
+            f = open(filename, "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s"
+                     % (dev_name, filename, err))
+        try:
+            f.write(driver)
+            f.close()
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot write %s: %s"
+                     % (dev_name, filename, err))
+    # do the bind by writing to /sys
+    filename = "/sys/bus/platform/drivers/%s/bind" % driver
+    try:
+        f = open(filename, "w")
+    except OSError as err:
+        print("Error: bind failed for %s - Cannot open %s: %s"
+              % (dev_name, filename, err), file=sys.stderr)
+        return
+    try:
+        f.write(dev_name)
+        f.close()
+    except OSError as err:
+        print("Error: bind failed for %s - Cannot bind to driver %s: %s"
+              % (dev_name, driver, err), file=sys.stderr)
+        return
+    print("Successfully bind platform device %s to driver %s" % (dev_name, driver))
+
+
 def bind_one(dev_id, driver, force):
     '''Bind the device given by "dev_id" to the driver "driver". If the device
     is already bound to a different driver, it will be unbound first'''
@@ -484,7 +575,10 @@ def unbind_all(dev_list, force=False):
         sys.exit(1)
 
     for d in dev_list:
-        unbind_one(d, force)
+        if d in platform_devices:
+            unbind_platform_one(d)
+        else:
+            unbind_one(d, force)
 
 
 def has_iommu():
@@ -500,7 +594,7 @@ def check_noiommu_mode():
     try:
         with open(filename, "r") as f:
             value = f.read(1)
-            if value in ("1", "y" ,"Y"):
+            if value in ("1", "y", "Y"):
                 return
     except OSError as err:
         sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")
@@ -547,20 +641,23 @@ def bind_all(dev_list, driver, force=False):
         check_noiommu_mode()
 
     for d in dev_list:
-        bind_one(d, driver, force)
-        # if we're binding to vfio-pci, set the IOMMU user/group ownership if one was specified
-        if driver == "vfio-pci" and (vfio_uid != -1 or vfio_gid != -1):
-            # find IOMMU group for a particular PCI device
-            iommu_grp_base_path = os.path.join("/sys/bus/pci/devices", d, "iommu_group")
-            # extract the IOMMU group number
-            iommu_grp = os.path.basename(os.readlink(iommu_grp_base_path))
-            # find VFIO device correspondiong to this IOMMU group
-            dev_path = os.path.join("/dev/vfio", iommu_grp)
-            # set ownership
-            try:
-                os.chown(dev_path, vfio_uid, vfio_gid)
-            except OSError as err:
-                sys.exit(f"Error: failed to set IOMMU group ownership for {d}: {err}")
+        if d in platform_devices:
+            bind_platform_one(d, driver)
+        else:
+            bind_one(d, driver, force)
+            # if we're binding to vfio-pci, set the IOMMU user/group ownership if one was specified
+            if driver == "vfio-pci" and (vfio_uid != -1 or vfio_gid != -1):
+                # find IOMMU group for a particular PCI device
+                iommu_grp_base_path = os.path.join("/sys/bus/pci/devices", d, "iommu_group")
+                # extract the IOMMU group number
+                iommu_grp = os.path.basename(os.readlink(iommu_grp_base_path))
+                # find VFIO device correspondiong to this IOMMU group
+                dev_path = os.path.join("/dev/vfio", iommu_grp)
+                # set ownership
+                try:
+                    os.chown(dev_path, vfio_uid, vfio_gid)
+                except OSError as err:
+                    sys.exit(f"Error: failed to set IOMMU group ownership for {d}: {err}")
 
     # For kernels < 3.15 when binding devices to a generic driver
     # (i.e. one that doesn't have a PCI ID table) using new_id, some devices
-- 
2.7.4


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

* Re: [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device
  2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
@ 2025-04-02 23:28 ` Stephen Hemminger
  2025-04-03  1:42 ` Stephen Hemminger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2025-04-02 23:28 UTC (permalink / raw)
  To: liwencheng; +Cc: dev

On Wed,  2 Apr 2025 06:58:32 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:

> This patch mainly adds functions for bind and unbind platform devices,
> such as bind_platform_one and unbind_platform_one.
> 
> Signed-off-by: liwencheng <liwencheng@phytium.com.cn>
> ---

Please use cover letter option when sending multi-part patches.

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

* Re: [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device
  2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
  2025-04-02 23:28 ` Stephen Hemminger
@ 2025-04-03  1:42 ` Stephen Hemminger
  2025-04-07  6:36 ` [PATCH v5 0/4] liwencheng
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2025-04-03  1:42 UTC (permalink / raw)
  To: liwencheng; +Cc: dev

On Wed,  2 Apr 2025 06:58:32 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:

> This patch mainly adds functions for bind and unbind platform devices,
> such as bind_platform_one and unbind_platform_one.
> 
> Signed-off-by: liwencheng <liwencheng@phytium.com.cn>

Please add your name and email to .mailmap

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

* [PATCH v5 0/4]
  2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
  2025-04-02 23:28 ` Stephen Hemminger
  2025-04-03  1:42 ` Stephen Hemminger
@ 2025-04-07  6:36 ` liwencheng
  2025-04-07 18:22   ` Stephen Hemminger
  2025-04-07  6:37 ` [PATCH v5 1/4] usertools/dpdk-devbind: add platform devices support liwencheng
  2025-04-07 15:13 ` [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device Stephen Hemminger
  4 siblings, 1 reply; 7+ messages in thread
From: liwencheng @ 2025-04-07  6:36 UTC (permalink / raw)
  To: dev

v5:
- Putting __rte_unused after the declaration.
- Correct RX-bytes and TX-bytes statistics.
- Initialize the mbuf_initializer.
- Add driver based on 25.07.
- Fixed some code style issues.

v4:
- Fix tab errors in meson.build file.
- Use RTE_LOG_LINE instead of rte_log.
- Replace %l with %PRI*64.
- Replace rte_smp_[r/w]mb with rte_[r/w]mb.
- Do not use variadic arguments in macros.
- Do not use variable-length array pkts[nb_bufs].
- Use __rte_cache_aligned only for struct or union types alignment.
- Support hardware Rx/Tx checksum offload.
- Fixed some code style issues.
v3:
- Changed functions that always return 0 and whose return value
is unused to void type, improving code simplicity and readability.
- Fixed the implicit conversion issues in the
macb_usxgmii_pcs_check_for_link and
macb_usxgmii_pcs_check_for_link functions.
- Added the missing SPDX license tags.
- Added the missing mailmap entry.
- Updated the MAINTAINERS file to include the missing information.

v2:
- Split the driver into three logically independent patches,
rather than one large patch.
- Added conditional compilation to address the issue of
macb_rxtx_vec_neon.c failing to compile in certain modes.
- Fixed some code style issues.

v1:
- updated net macb driver.

*** BLURB HERE ***

Wencheng Li (4):
  usertools/dpdk-devbind: add platform devices support
  net/macb: add new poll mode driver
  net/macb: add NEON vectorized Rx/Tx
  net/macb: add necessary docs and update related files

 .mailmap                               |    1 +
 MAINTAINERS                            |    6 +
 doc/guides/nics/features/macb.ini      |   27 +
 doc/guides/nics/index.rst              |    1 +
 doc/guides/nics/macb.rst               |   26 +
 doc/guides/rel_notes/release_25_07.rst |    4 +
 drivers/net/macb/base/generic_phy.c    |  271 +++++
 drivers/net/macb/base/generic_phy.h    |  202 ++++
 drivers/net/macb/base/macb_common.c    |  670 ++++++++++++
 drivers/net/macb/base/macb_common.h    |  253 +++++
 drivers/net/macb/base/macb_errno.h     |   58 +
 drivers/net/macb/base/macb_hw.h        | 1138 +++++++++++++++++++
 drivers/net/macb/base/macb_type.h      |   23 +
 drivers/net/macb/base/macb_uio.c       |  351 ++++++
 drivers/net/macb/base/macb_uio.h       |   50 +
 drivers/net/macb/base/meson.build      |   29 +
 drivers/net/macb/macb_ethdev.c         | 1861 ++++++++++++++++++++++++++++++++
 drivers/net/macb/macb_ethdev.h         |   91 ++
 drivers/net/macb/macb_log.h            |   19 +
 drivers/net/macb/macb_rxtx.c           | 1394 ++++++++++++++++++++++++
 drivers/net/macb/macb_rxtx.h           |  325 ++++++
 drivers/net/macb/macb_rxtx_vec_neon.c  |  675 ++++++++++++
 drivers/net/macb/meson.build           |   23 +
 drivers/net/meson.build                |    1 +
 usertools/dpdk-devbind.py              |  131 ++-
 25 files changed, 7613 insertions(+), 17 deletions(-)
 create mode 100644 doc/guides/nics/features/macb.ini
 create mode 100644 doc/guides/nics/macb.rst
 create mode 100644 drivers/net/macb/base/generic_phy.c
 create mode 100644 drivers/net/macb/base/generic_phy.h
 create mode 100644 drivers/net/macb/base/macb_common.c
 create mode 100644 drivers/net/macb/base/macb_common.h
 create mode 100644 drivers/net/macb/base/macb_errno.h
 create mode 100644 drivers/net/macb/base/macb_hw.h
 create mode 100644 drivers/net/macb/base/macb_type.h
 create mode 100644 drivers/net/macb/base/macb_uio.c
 create mode 100644 drivers/net/macb/base/macb_uio.h
 create mode 100644 drivers/net/macb/base/meson.build
 create mode 100644 drivers/net/macb/macb_ethdev.c
 create mode 100644 drivers/net/macb/macb_ethdev.h
 create mode 100644 drivers/net/macb/macb_log.h
 create mode 100644 drivers/net/macb/macb_rxtx.c
 create mode 100644 drivers/net/macb/macb_rxtx.h
 create mode 100644 drivers/net/macb/macb_rxtx_vec_neon.c
 create mode 100644 drivers/net/macb/meson.build

-- 
2.7.4


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

* [PATCH v5 1/4] usertools/dpdk-devbind: add platform devices support
  2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
                   ` (2 preceding siblings ...)
  2025-04-07  6:36 ` [PATCH v5 0/4] liwencheng
@ 2025-04-07  6:37 ` liwencheng
  2025-04-07 15:13 ` [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device Stephen Hemminger
  4 siblings, 0 replies; 7+ messages in thread
From: liwencheng @ 2025-04-07  6:37 UTC (permalink / raw)
  To: dev

Modify dpdk-devbind to support bind and unbind platform devices,
such as bind_platform_one and unbind_platform_one.

v5:
* Add name and email to .mailmap.

Signed-off-by: liwencheng <liwencheng@phytium.com.cn>
---
 .mailmap                  |   1 +
 usertools/dpdk-devbind.py | 131 ++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 115 insertions(+), 17 deletions(-)

diff --git a/.mailmap b/.mailmap
index d8439b7..001d7b2 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1675,6 +1675,7 @@ Wen Chiu <wchiu@brocade.com>
 Wen-Chi Yang <wolkayang@gmail.com>
 Wenfeng Liu <liuwf@arraynetworks.com.cn>
 Wenjie Li <wenjiex.a.li@intel.com>
+Wencheng Li <liwencheng@phytium.com.cn>
 Wenjie Sun <findtheonlyway@gmail.com>
 Wenjing Qiao <wenjing.qiao@intel.com>
 Wenjun Wu <wenjun1.wu@intel.com>
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 06ae25a..600c4ba 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -65,7 +65,7 @@
 intel_idxd_spr = {'Class': '08', 'Vendor': '8086', 'Device': '0b25',
                   'SVendor': None, 'SDevice': None}
 intel_idxd_gnrd = {'Class': '08', 'Vendor': '8086', 'Device': '11fb',
-                  'SVendor': None, 'SDevice': None}
+                   'SVendor': None, 'SDevice': None}
 intel_idxd_dmr = {'Class': '08', 'Vendor': '8086', 'Device': '1212',
                   'SVendor': None, 'SDevice': None}
 intel_ntb_skx = {'Class': '06', 'Vendor': '8086', 'Device': '201c',
@@ -156,10 +156,32 @@ def module_is_loaded(module):
     return module in loaded_modules
 
 
+def get_platform_devices():
+    global platform_devices
+
+    platform_device_path = "/sys/bus/platform/devices/"
+    platform_devices = os.listdir(platform_device_path)
+
+
+def devices_are_platform(devs):
+    all_devices_are_platform = True
+
+    get_platform_devices()
+    for d in devs:
+        if d not in platform_devices:
+            all_devices_are_platform = False
+            break
+
+    return all_devices_are_platform
+
+
 def check_modules():
     '''Checks that igb_uio is loaded'''
     global dpdk_drivers
 
+    if devices_are_platform(args):
+        return
+
     # list of supported modules
     mods = [{"Name": driver, "Found": False} for driver in dpdk_drivers]
 
@@ -330,11 +352,38 @@ def dev_id_from_dev_name(dev_name):
     for d in devices.keys():
         if dev_name in devices[d]["Interface"].split(","):
             return devices[d]["Slot"]
+
+    # Check if it is a platform device
+    if dev_name in platform_devices:
+        return dev_name
+
     # if nothing else matches - error
     raise ValueError("Unknown device: %s. "
                      "Please specify device in \"bus:slot.func\" format" % dev_name)
 
 
+def unbind_platform_one(dev_name):
+    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
+
+    if exists(filename):
+        try:
+            f = open(os.path.join(filename, "unbind"), "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
+                     (dev_name, os.path.join(filename, "unbind"), err))
+        f.write(dev_name)
+        f.close()
+        filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
+        try:
+            f = open(filename, "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
+                     (dev_name, filename, err))
+        f.write("")
+        f.close()
+        print("Successfully unbind platform device %s" % dev_name)
+
+
 def unbind_one(dev_id, force):
     '''Unbind the device identified by "dev_id" from its current driver'''
     dev = devices[dev_id]
@@ -360,6 +409,48 @@ def unbind_one(dev_id, force):
     f.close()
 
 
+def bind_platform_one(dev_name, driver):
+    filename = "/sys/bus/platform/drivers/%s" % driver
+
+    if not exists(filename):
+        print("The driver %s is not loaded" % driver)
+        return
+    # unbind any existing drivers we don't want
+    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
+    if exists(filename):
+        unbind_platform_one(dev_name)
+    # driver_override can be used to specify the driver
+    filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
+    if exists(filename):
+        try:
+            f = open(filename, "w")
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot open %s: %s"
+                     % (dev_name, filename, err))
+        try:
+            f.write(driver)
+            f.close()
+        except OSError as err:
+            sys.exit("Error: unbind failed for %s - Cannot write %s: %s"
+                     % (dev_name, filename, err))
+    # do the bind by writing to /sys
+    filename = "/sys/bus/platform/drivers/%s/bind" % driver
+    try:
+        f = open(filename, "w")
+    except OSError as err:
+        print("Error: bind failed for %s - Cannot open %s: %s"
+              % (dev_name, filename, err), file=sys.stderr)
+        return
+    try:
+        f.write(dev_name)
+        f.close()
+    except OSError as err:
+        print("Error: bind failed for %s - Cannot bind to driver %s: %s"
+              % (dev_name, driver, err), file=sys.stderr)
+        return
+    print("Successfully bind platform device %s to driver %s" % (dev_name, driver))
+
+
 def bind_one(dev_id, driver, force):
     '''Bind the device given by "dev_id" to the driver "driver". If the device
     is already bound to a different driver, it will be unbound first'''
@@ -484,7 +575,10 @@ def unbind_all(dev_list, force=False):
         sys.exit(1)
 
     for d in dev_list:
-        unbind_one(d, force)
+        if d in platform_devices:
+            unbind_platform_one(d)
+        else:
+            unbind_one(d, force)
 
 
 def has_iommu():
@@ -500,7 +594,7 @@ def check_noiommu_mode():
     try:
         with open(filename, "r") as f:
             value = f.read(1)
-            if value in ("1", "y" ,"Y"):
+            if value in ("1", "y", "Y"):
                 return
     except OSError as err:
         sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")
@@ -547,20 +641,23 @@ def bind_all(dev_list, driver, force=False):
         check_noiommu_mode()
 
     for d in dev_list:
-        bind_one(d, driver, force)
-        # if we're binding to vfio-pci, set the IOMMU user/group ownership if one was specified
-        if driver == "vfio-pci" and (vfio_uid != -1 or vfio_gid != -1):
-            # find IOMMU group for a particular PCI device
-            iommu_grp_base_path = os.path.join("/sys/bus/pci/devices", d, "iommu_group")
-            # extract the IOMMU group number
-            iommu_grp = os.path.basename(os.readlink(iommu_grp_base_path))
-            # find VFIO device correspondiong to this IOMMU group
-            dev_path = os.path.join("/dev/vfio", iommu_grp)
-            # set ownership
-            try:
-                os.chown(dev_path, vfio_uid, vfio_gid)
-            except OSError as err:
-                sys.exit(f"Error: failed to set IOMMU group ownership for {d}: {err}")
+        if d in platform_devices:
+            bind_platform_one(d, driver)
+        else:
+            bind_one(d, driver, force)
+            # if we're binding to vfio-pci, set the IOMMU user/group ownership if one was specified
+            if driver == "vfio-pci" and (vfio_uid != -1 or vfio_gid != -1):
+                # find IOMMU group for a particular PCI device
+                iommu_grp_base_path = os.path.join("/sys/bus/pci/devices", d, "iommu_group")
+                # extract the IOMMU group number
+                iommu_grp = os.path.basename(os.readlink(iommu_grp_base_path))
+                # find VFIO device correspondiong to this IOMMU group
+                dev_path = os.path.join("/dev/vfio", iommu_grp)
+                # set ownership
+                try:
+                    os.chown(dev_path, vfio_uid, vfio_gid)
+                except OSError as err:
+                    sys.exit(f"Error: failed to set IOMMU group ownership for {d}: {err}")
 
     # For kernels < 3.15 when binding devices to a generic driver
     # (i.e. one that doesn't have a PCI ID table) using new_id, some devices
-- 
2.7.4


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

* Re: [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device
  2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
                   ` (3 preceding siblings ...)
  2025-04-07  6:37 ` [PATCH v5 1/4] usertools/dpdk-devbind: add platform devices support liwencheng
@ 2025-04-07 15:13 ` Stephen Hemminger
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2025-04-07 15:13 UTC (permalink / raw)
  To: liwencheng; +Cc: dev

On Wed,  2 Apr 2025 06:58:32 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:

>  
> +def unbind_platform_one(dev_name):
> +    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
> +
> +    if exists(filename):
> +        try:
> +            f = open(os.path.join(filename, "unbind"), "w")
> +        except OSError as err:
> +            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
> +                     (dev_name, os.path.join(filename, "unbind"), err))
> +        f.write(dev_name)
> +        f.close()
> +        filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
> +        try:
> +            f = open(filename, "w")
> +        except OSError as err:
> +            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
> +                     (dev_name, filename, err))
> +        f.write("")
> +        f.close()
> +        print("Successfully unbind platform device %s" % dev_name)
> +

Although other parts of devbind don't use it, the current preferred Python
style is to use f' strings.

Also if you use a "with" block, then the close function is automatic.

Lastly, when I looked at adding vmbus support, it was rejected in favor
the more complete driverctl utility. So at least in theory, this patch
should be rejected, and the functionality moved to driverctl.

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

* Re: [PATCH v5 0/4]
  2025-04-07  6:36 ` [PATCH v5 0/4] liwencheng
@ 2025-04-07 18:22   ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2025-04-07 18:22 UTC (permalink / raw)
  To: liwencheng; +Cc: dev

On Mon,  7 Apr 2025 06:36:52 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:

> v5:
> - Putting __rte_unused after the declaration.
> - Correct RX-bytes and TX-bytes statistics.
> - Initialize the mbuf_initializer.
> - Add driver based on 25.07.
> - Fixed some code style issues.
> 
> v4:
> - Fix tab errors in meson.build file.
> - Use RTE_LOG_LINE instead of rte_log.
> - Replace %l with %PRI*64.
> - Replace rte_smp_[r/w]mb with rte_[r/w]mb.
> - Do not use variadic arguments in macros.
> - Do not use variable-length array pkts[nb_bufs].
> - Use __rte_cache_aligned only for struct or union types alignment.
> - Support hardware Rx/Tx checksum offload.
> - Fixed some code style issues.
> v3:
> - Changed functions that always return 0 and whose return value
> is unused to void type, improving code simplicity and readability.
> - Fixed the implicit conversion issues in the
> macb_usxgmii_pcs_check_for_link and
> macb_usxgmii_pcs_check_for_link functions.
> - Added the missing SPDX license tags.
> - Added the missing mailmap entry.
> - Updated the MAINTAINERS file to include the missing information.
> 
> v2:
> - Split the driver into three logically independent patches,
> rather than one large patch.
> - Added conditional compilation to address the issue of
> macb_rxtx_vec_neon.c failing to compile in certain modes.
> - Fixed some code style issues.
> 
> v1:
> - updated net macb driver.
> 
> *** BLURB HERE ***
> 
> Wencheng Li (4):
>   usertools/dpdk-devbind: add platform devices support
>   net/macb: add new poll mode driver
>   net/macb: add NEON vectorized Rx/Tx
>   net/macb: add necessary docs and update related files
> 
>  .mailmap                               |    1 +
>  MAINTAINERS                            |    6 +
>  doc/guides/nics/features/macb.ini      |   27 +
>  doc/guides/nics/index.rst              |    1 +
>  doc/guides/nics/macb.rst               |   26 +
>  doc/guides/rel_notes/release_25_07.rst |    4 +
>  drivers/net/macb/base/generic_phy.c    |  271 +++++
>  drivers/net/macb/base/generic_phy.h    |  202 ++++
>  drivers/net/macb/base/macb_common.c    |  670 ++++++++++++
>  drivers/net/macb/base/macb_common.h    |  253 +++++
>  drivers/net/macb/base/macb_errno.h     |   58 +
>  drivers/net/macb/base/macb_hw.h        | 1138 +++++++++++++++++++
>  drivers/net/macb/base/macb_type.h      |   23 +
>  drivers/net/macb/base/macb_uio.c       |  351 ++++++
>  drivers/net/macb/base/macb_uio.h       |   50 +
>  drivers/net/macb/base/meson.build      |   29 +
>  drivers/net/macb/macb_ethdev.c         | 1861 ++++++++++++++++++++++++++++++++
>  drivers/net/macb/macb_ethdev.h         |   91 ++
>  drivers/net/macb/macb_log.h            |   19 +
>  drivers/net/macb/macb_rxtx.c           | 1394 ++++++++++++++++++++++++
>  drivers/net/macb/macb_rxtx.h           |  325 ++++++
>  drivers/net/macb/macb_rxtx_vec_neon.c  |  675 ++++++++++++
>  drivers/net/macb/meson.build           |   23 +
>  drivers/net/meson.build                |    1 +
>  usertools/dpdk-devbind.py              |  131 ++-
>  25 files changed, 7613 insertions(+), 17 deletions(-)
>  create mode 100644 doc/guides/nics/features/macb.ini
>  create mode 100644 doc/guides/nics/macb.rst
>  create mode 100644 drivers/net/macb/base/generic_phy.c
>  create mode 100644 drivers/net/macb/base/generic_phy.h
>  create mode 100644 drivers/net/macb/base/macb_common.c
>  create mode 100644 drivers/net/macb/base/macb_common.h
>  create mode 100644 drivers/net/macb/base/macb_errno.h
>  create mode 100644 drivers/net/macb/base/macb_hw.h
>  create mode 100644 drivers/net/macb/base/macb_type.h
>  create mode 100644 drivers/net/macb/base/macb_uio.c
>  create mode 100644 drivers/net/macb/base/macb_uio.h
>  create mode 100644 drivers/net/macb/base/meson.build
>  create mode 100644 drivers/net/macb/macb_ethdev.c
>  create mode 100644 drivers/net/macb/macb_ethdev.h
>  create mode 100644 drivers/net/macb/macb_log.h
>  create mode 100644 drivers/net/macb/macb_rxtx.c
>  create mode 100644 drivers/net/macb/macb_rxtx.h
>  create mode 100644 drivers/net/macb/macb_rxtx_vec_neon.c
>  create mode 100644 drivers/net/macb/meson.build
> 

Please put a subject on your cover letter, without it patchwork gets confused.

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

end of thread, other threads:[~2025-04-07 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-02  6:58 [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
2025-04-02 23:28 ` Stephen Hemminger
2025-04-03  1:42 ` Stephen Hemminger
2025-04-07  6:36 ` [PATCH v5 0/4] liwencheng
2025-04-07 18:22   ` Stephen Hemminger
2025-04-07  6:37 ` [PATCH v5 1/4] usertools/dpdk-devbind: add platform devices support liwencheng
2025-04-07 15:13 ` [PATCH v4 1/4] usertools/dpdk-devbind: add bind/unbind for platform device Stephen Hemminger

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).