On 10/13/21 4:37 PM, Konstantin Ananyev wrote: > Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
ethernet -> Ethernet > addresses assigned to given port. > Change testpmd to use this new function and avoid referencing directly > rte_eth_devices[]. > > Signed-off-by: Konstantin Ananyev <konstantin.anan...@intel.com> Reviewed-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> except one nit below [snip] > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index f4c92b3b5e..dbc14f4a23 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -3007,6 +3007,27 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t > port_id, > */ > int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); > > +/** Experimental header is missing > + * 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 @p ma array. > + * Note that rte_eth_dev_info::max_mac_addrs can be used to retrieve > + * max number of Ethernet addresses for given port. > + * @return > + * - number of retrieved addresses if successful > + * - (-ENODEV) if *port_id* invalid. > + * - (-EINVAL) if bad parameter. > + */ > +__rte_experimental > +int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma, > + unsigned int num); > + > /** > * Retrieve the contextual information of an Ethernet device. > * [snip]