[dpdk-dev] [PATCH v2] ethdev: return diagnostic when setting MAC address

Adrien Mazarguil adrien.mazarguil at 6wind.com
Tue Apr 3 16:57:24 CEST 2018


On Tue, Apr 03, 2018 at 02:41:03PM +0200, Olivier Matz wrote:
> Change the prototype and the behavior of dev_ops->eth_mac_addr_set(): a
> return code is added to notify the caller (librte_ether) if an error
> occurred in the PMD.
> 
> The new default MAC address is now copied in dev->data->mac_addrs[0]
> only if the operation is successful.
> 
> The patch also updates all the PMDs accordingly.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> Signed-off-by: Ivan Malov <ivan.malov at oktetlabs.ru>
> ---
> 
> v2:
> * add same change for net/cxgbe
> * mrvl was renamed as mvpp2
> * mvpp2: return success if no ppio as suggested by Tomasz
> * mlx5: update comment as suggested by Adrien
> * sfc: replace by Ivan's patch

Just one remaining nit regarding mlx5, please see below. Otherwise for both
mlx4 and mlx5:

Acked-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>

<snip>
> diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
> index 01c7ba17a..3bf76e38c 100644
> --- a/drivers/net/mlx5/mlx5_mac.c
> +++ b/drivers/net/mlx5/mlx5_mac.c
> @@ -124,8 +124,11 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
>   *   Pointer to Ethernet device structure.
>   * @param mac_addr
>   *   MAC address to register.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
>  {
>  	int ret;
> @@ -137,4 +140,6 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
>  	if (ret)
>  		DRV_LOG(ERR, "port %u cannot set mac address: %s",
>  			dev->data->port_id, strerror(rte_errno));
> +

This empty line is unnecessary (this follows the work done to remove
non-mandatory empty lines sprinkled everywhere in these PMDs for coding
style consistency).

> +	return ret;
<snip>

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list