[dpdk-dev] [PATCH v2 4/7] ethdev: change allmulticast callbacks to return status

Ferruh Yigit ferruh.yigit at intel.com
Thu Sep 26 09:41:24 CEST 2019


On 9/26/2019 3:00 AM, Yang, Qiming wrote:
> [snip] ...
> 
> Hi, Andrew
> I think it's no need to define a 'ret'.
> Return -EAGAIN and return 0 is enough.

Hi Qiming,

I have already merged the patchset to the next-net, what you have mentioned
looks like a minor issue, would you be OK with as it is?

> 
> Qiming
> 
> static int
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 46ed70816..c699f3ef0 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -69,8 +69,8 @@ static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
>  				 struct rte_eth_rss_conf *rss_conf);
>  static int ice_promisc_enable(struct rte_eth_dev *dev);
>  static int ice_promisc_disable(struct rte_eth_dev *dev);
> -static void ice_allmulti_enable(struct rte_eth_dev *dev);
> -static void ice_allmulti_disable(struct rte_eth_dev *dev);
> +static int ice_allmulti_enable(struct rte_eth_dev *dev);
> +static int ice_allmulti_disable(struct rte_eth_dev *dev);
>  static int ice_vlan_filter_set(struct rte_eth_dev *dev,
>  			       uint16_t vlan_id,
>  			       int on);
> @@ -3152,7 +3152,7 @@ ice_promisc_disable(struct rte_eth_dev *dev)
>  	return ret;
>  }
>  
> -static void
> +static int
>  ice_allmulti_enable(struct rte_eth_dev *dev)
>  {
>  	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> @@ -3160,15 +3160,26 @@ ice_allmulti_enable(struct rte_eth_dev *dev)
>  	struct ice_vsi *vsi = pf->main_vsi;
>  	enum ice_status status;
>  	uint8_t pmask;
> +	int ret = 0;
>  
>  	pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
>  
>  	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
> -	if (status != ICE_SUCCESS)
> +
> +	switch (status) {
> +	case ICE_ERR_ALREADY_EXISTS:
> +		PMD_DRV_LOG(DEBUG, "Allmulti has already been enabled");
> +	case ICE_SUCCESS:
> +		break;
> +	default:
>  		PMD_DRV_LOG(ERR, "Failed to enable allmulti, err=%d", status);
> +		ret = -EAGAIN;
> +	}
> +
> +	return ret;
>  }
>  
> -static void
> +static int
>  ice_allmulti_disable(struct rte_eth_dev *dev)
>  {
>  	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> @@ -3176,15 +3187,20 @@ ice_allmulti_disable(struct rte_eth_dev *dev)
>  	struct ice_vsi *vsi = pf->main_vsi;
>  	enum ice_status status;
>  	uint8_t pmask;
> +	int ret = 0;
>  
>  	if (dev->data->promiscuous == 1)
> -		return; /* must remain in all_multicast mode */
> +		return 0; /* must remain in all_multicast mode */
>  
>  	pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
>  
>  	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
> -	if (status != ICE_SUCCESS)
> +	if (status != ICE_SUCCESS) {
>  		PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status);
> +		ret = -EAGAIN;
> +	}
> +
> +	return ret;
>  }
>  
> 
> [snip] ...
> 



More information about the dev mailing list