[dpdk-dev] [PATCH v2] pci/linux: copy new id for inserted device
Thomas Monjalon
thomas at monjalon.net
Mon Oct 12 23:54:48 CEST 2020
12/10/2020 22:58, Harris, James R:
>
> 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.
Yes please, direct assignment is preferred.
Thanks
More information about the dev
mailing list