* [PATCH dpdk] pmdinfogen: fix warning with python 3.14
@ 2025-10-29 16:46 Robin Jarry
2025-10-29 19:46 ` Dmitry Kozlyuk
0 siblings, 1 reply; 2+ messages in thread
From: Robin Jarry @ 2025-10-29 16:46 UTC (permalink / raw)
To: dev, Dmitry Kozlyuk
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH dpdk] pmdinfogen: fix warning with python 3.14
2025-10-29 16:46 [PATCH dpdk] pmdinfogen: fix warning with python 3.14 Robin Jarry
@ 2025-10-29 19:46 ` Dmitry Kozlyuk
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Kozlyuk @ 2025-10-29 19:46 UTC (permalink / raw)
To: Robin Jarry, dev
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-29 19:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-29 16:46 [PATCH dpdk] pmdinfogen: fix warning with python 3.14 Robin Jarry
2025-10-29 19:46 ` Dmitry Kozlyuk
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).