[dpdk-dev] [PATCH v2] pci/linux: copy new id for inserted device

Harris, James R james.r.harris at intel.com
Mon Oct 12 22:58:01 CEST 2020



On 10/7/20, 8:06 AM, "Thomas Monjalon" <thomas at monjalon.net> wrote:

    Hi Jim,

    Sorry I see nobody reviewed your patch.

    Jim Harris <james.r.harris at intel.com> wrote:
    > + memcpy(&dev2->id, &dev->id, sizeof(dev2->id));
    [...]
    > + memcmp(&dev2->id, &dev->id, sizeof(dev2->id)))

    Why using memcpy and memcmp instead of simple assignment and comparison?

Direct assignment and comparison would work too.  I did see some similar cases though using memcpy for rte_pci_addr (which is similar to rte_pci_id) in linux/pci_uio.c and linux/pci_vfio.c.  It wasn't clear to me if direct assignment/comparison for structures was the norm for DPDK.

I'm happy to send a v2 with a direct assignment/comparison though if that is preferred.

-Jim





More information about the dev mailing list