From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Subject: [PATCH dpdk] pmdinfogen: fix warning with python 3.14
Date: Wed, 29 Oct 2025 17:46:17 +0100	[thread overview]
Message-ID: <20251029164616.76233-2-rjarry@redhat.com> (raw)
Fix the following warning seen on Fedora 43 with Python 3.14:
 buildtools/pmdinfogen.py:118: DeprecationWarning: Due to '_pack_', the
 'rte_pci_id' Structure will use memory layout compatible with MSVC
 (Windows). If this is intended, set _layout_ to 'ms'. The implicit
 default is dep recated and slated to become an error in Python 3.19.
Use the struct module which is simpler and assumes everything is packed
by default.
There is no change in the output of dpdk-pmdinfo.py before and after
this patch.
Link: https://docs.python.org/3/library/struct.html
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 buildtools/pmdinfogen.py | 42 +++++++++++-----------------------------
 1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py
index 63e0a8b364a8..4401106f0bf5 100755
--- a/buildtools/pmdinfogen.py
+++ b/buildtools/pmdinfogen.py
@@ -4,9 +4,9 @@
 # Copyright (c) 2020 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
 
 import argparse
-import ctypes
 import json
 import re
+import struct
 import sys
 import tempfile
 
@@ -110,24 +110,6 @@ def find_by_name(self, name):
         return None
 
 
-def define_rte_pci_id(is_big_endian):
-    base_type = ctypes.LittleEndianStructure
-    if is_big_endian:
-        base_type = ctypes.BigEndianStructure
-
-    class rte_pci_id(base_type):
-        _pack_ = True
-        _fields_ = [
-            ("class_id", ctypes.c_uint32),
-            ("vendor_id", ctypes.c_uint16),
-            ("device_id", ctypes.c_uint16),
-            ("subsystem_vendor_id", ctypes.c_uint16),
-            ("subsystem_device_id", ctypes.c_uint16),
-        ]
-
-    return rte_pci_id
-
-
 class Driver:
     OPTIONS = [
         ("params", "_param_string_export"),
@@ -166,26 +148,24 @@ def _load_pci_ids(image, table_name_symbol):
         if not table_symbol:
             raise Exception("PCI table declared but not defined: %d" % table_name)
 
-        rte_pci_id = define_rte_pci_id(image.is_big_endian)
+        if image.is_big_endian:
+            fmt = ">"
+        else:
+            fmt = "<"
+        fmt += "LHHHH"
 
         result = []
         while True:
-            size = ctypes.sizeof(rte_pci_id)
+            size = struct.calcsize(fmt)
             offset = size * len(result)
             data = table_symbol.get_value(offset, size)
             if not data:
                 break
-            pci_id = rte_pci_id.from_buffer_copy(data)
-            if not pci_id.device_id:
+            _, vendor, device, ss_vendor, ss_device = struct.unpack_from(fmt, data)
+            if not device:
                 break
-            result.append(
-                [
-                    pci_id.vendor_id,
-                    pci_id.device_id,
-                    pci_id.subsystem_vendor_id,
-                    pci_id.subsystem_device_id,
-                ]
-            )
+            result.append((vendor, device, ss_vendor, ss_device))
+
         return result
 
     def dump(self, file):
-- 
2.51.1
next             reply	other threads:[~2025-10-29 16:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 16:46 Robin Jarry [this message]
2025-10-29 19:46 ` Dmitry Kozlyuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20251029164616.76233-2-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).