[dpdk-dev] [PATCH v4 5/7] ethdev: add API to retrieve multiple ethernet addresses
Thomas Monjalon
thomas at monjalon.net
Tue Oct 5 18:45:19 CEST 2021
05/10/2021 18:35, Ananyev, Konstantin:
> > 04/10/2021 15:56, Konstantin Ananyev:
> > > Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
> > > addresses assigned to given port.
> >
> > We already have functions to get MAC addresses.
> > Please explain the difference.
>
> rte_eth_macaddr_get() returns just first (primary) MAC address
> assigned to the port.
> That one allow user to retrieve all addresses assigned to the port.
I was sure we had other function.
Anyway, would be good to reference rte_eth_macaddr_get in the commit.
> > > +/**
> > > + * Retrieve the Ethernet addresses of an Ethernet device.
> > > + *
> > > + * @param port_id
> > > + * The port identifier of the Ethernet device.
> > > + * @param ma
> > > + * A pointer to an array of structures of type *ether_addr* to be filled with
> > > + * the Ethernet addresses of the Ethernet device.
> > > + * @param num
> > > + * Number of elements in the *ma* array.
> > > + * @return
> > > + * - number of retrieved addresses if successful
> > > + * - (-ENODEV) if *port_id* invalid.
> > > + * - (-EINVAL) if bad parameter.
> >
> > Which error if the array is too small?
>
> None, we just return up to *num* addresses, that's it.
So we don't know know whether there are more.
> > > + */
> > > +__rte_experimental
> > > +int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr ma[],
> >
> > Please don't use array syntax in parameters, it should be a pointer.
> > How do we get the number of returned addresses?
> >
> > > + uint32_t num);
>
> From above:
> * @return
> * - number of retrieved addresses if successful
>
> > Another approach would be to get addresses one by one by passing an index.
> >
>
> Yes, it is another possible way.
> Though current one seems a bit more convenient to me.
It misses a way to get the number of addresses.
More information about the dev
mailing list