[PATCH v7 2/4] lib: fix comparison between devices
Stephen Hemminger
stephen at networkplumber.org
Wed Feb 19 17:50:25 CET 2025
On Wed, 12 Feb 2025 18:38:33 +0200
Shani Peretz <shperetz at nvidia.com> wrote:
> DPDK supports multiple formats for specifying buses,
> (such as "0000:08:00.0" and "08:00.0" for PCI).
> This flexibility can lead to inconsistencies when using one
> format while running testpmd, then attempts to use the other
> format in a later command, resulting in a failure.
>
> The issue arises from the find_device function, which compares
> the user-provided string directly with the device->name in
> the rte_device structure.
> If we want to accurately compare these names, we'll need to bring both
> sides to the same representation by invoking the parse function
> on the user input.
>
> The proposed solution is to utilize the parse function implemented
> by each bus. When comparing names, we will call parse on the supplied
> string as well as on the device name itself and compare the results.
> As part of the change the parse function will now recive the address
> to write to and the size of the pointer, in addition it will return
> the size of the parsed address.
>
> This will allow consistent comparisons between different representations
> of same devices.
>
> In addition, fixed vdev test to use the rte_cmp_dev_name function
> instead of the custom one.
>
> Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
>
> Signed-off-by: Shani Peretz <shperetz at nvidia.com>
This patch set seems to transform the device name from a null terminated
string to a an array of bytes with a length. Not sure if this is completely
needed. Understand that C null terminated strings are a bug magnet, but
not sure how the PCI changes force this.
More information about the dev
mailing list