[dpdk-dev] [PATCH v4 5/7] ethdev: add API to retrieve multiple ethernet addresses
Thomas Monjalon
thomas at monjalon.net
Tue Oct 5 15:13:39 CEST 2021
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.
[...]
> +* **Add new function into ethdev lib.**
> +
> + * Added ``rte_eth_macaddrs_get`` to allow user to retrieve all Ethernet
> + addresses aasigned to given ethernet port.
typo above
> +/**
> + * 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?
> + */
> +__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);
Another approach would be to get addresses one by one by passing an index.
More information about the dev
mailing list