[S87,v5,2/7] i40e: Cleanup i40e_vlan_rx_register

Message ID 20180308225211.12254-2-jeffrey.t.kirsher@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show
Series
  • [S87,v5,1/7] i40e: Fix attach VF to VM issue
Related show

Commit Message

Jeff Kirsher March 8, 2018, 10:52 p.m.
From: Jacob Keller <jacob.e.keller@intel.com>

We used to use the function i40e_vlan_rx_register as a way to hook
into the now defunct .ndo_vlan_rx_register netdev hook. This was
removed but we kept the function around because we still used it
internally to control enabling or disabling of VLAN stripping.

As pointed out in upstream review, VLAN stripping is only used in a
single location and the previous function is quite small, just inline
it into i40e_restore_vlan() rather than carrying the function
separately.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

Comments

Shannon Nelson March 9, 2018, 12:28 a.m. | #1
On 3/8/2018 2:52 PM, Jeff Kirsher wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> We used to use the function i40e_vlan_rx_register as a way to hook
> into the now defunct .ndo_vlan_rx_register netdev hook. This was
> removed but we kept the function around because we still used it
> internally to control enabling or disabling of VLAN stripping.
> 
> As pointed out in upstream review, VLAN stripping is only used in a
> single location and the previous function is quite small, just inline
> it into i40e_restore_vlan() rather than carrying the function
> separately.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_main.c | 21 ++++-----------------
>   1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 4b34bbc83b99..183c8b84b7ea 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -2719,22 +2719,6 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi)
>   	}
>   }
>   
> -/**
> - * i40e_vlan_rx_register - Setup or shutdown vlan offload
> - * @netdev: network interface to be adjusted
> - * @features: netdev features to test if VLAN offload is enabled or not
> - **/
> -static void i40e_vlan_rx_register(struct net_device *netdev, u32 features)
> -{
> -	struct i40e_netdev_priv *np = netdev_priv(netdev);
> -	struct i40e_vsi *vsi = np->vsi;
> -
> -	if (features & NETIF_F_HW_VLAN_CTAG_RX)
> -		i40e_vlan_stripping_enable(vsi);
> -	else
> -		i40e_vlan_stripping_disable(vsi);
> -}
> -
>   /**
>    * i40e_add_vlan_all_mac - Add a MAC/VLAN filter for each existing MAC address
>    * @vsi: the vsi being configured
> @@ -2910,7 +2894,10 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi)
>   	if (!vsi->netdev)
>   		return;
>   
> -	i40e_vlan_rx_register(vsi->netdev, vsi->netdev->features);
> +	if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
> +		i40e_vlan_stripping_enable(vsi);
> +	else
> +		i40e_vlan_stripping_disable(vsi);

That's better - thanks.
sln

>   
>   	for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID)
>   		i40e_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q),
>
Bowers, AndrewX March 12, 2018, 7:29 p.m. | #2
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Jeff Kirsher
> Sent: Thursday, March 8, 2018 2:52 PM
> To: intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [S87 v5 2/7] i40e: Cleanup i40e_vlan_rx_register
> 
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> We used to use the function i40e_vlan_rx_register as a way to hook into the
> now defunct .ndo_vlan_rx_register netdev hook. This was removed but we
> kept the function around because we still used it internally to control
> enabling or disabling of VLAN stripping.
> 
> As pointed out in upstream review, VLAN stripping is only used in a single
> location and the previous function is quite small, just inline it into
> i40e_restore_vlan() rather than carrying the function separately.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4b34bbc83b99..183c8b84b7ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -2719,22 +2719,6 @@  void i40e_vlan_stripping_disable(struct i40e_vsi *vsi)
 	}
 }
 
-/**
- * i40e_vlan_rx_register - Setup or shutdown vlan offload
- * @netdev: network interface to be adjusted
- * @features: netdev features to test if VLAN offload is enabled or not
- **/
-static void i40e_vlan_rx_register(struct net_device *netdev, u32 features)
-{
-	struct i40e_netdev_priv *np = netdev_priv(netdev);
-	struct i40e_vsi *vsi = np->vsi;
-
-	if (features & NETIF_F_HW_VLAN_CTAG_RX)
-		i40e_vlan_stripping_enable(vsi);
-	else
-		i40e_vlan_stripping_disable(vsi);
-}
-
 /**
  * i40e_add_vlan_all_mac - Add a MAC/VLAN filter for each existing MAC address
  * @vsi: the vsi being configured
@@ -2910,7 +2894,10 @@  static void i40e_restore_vlan(struct i40e_vsi *vsi)
 	if (!vsi->netdev)
 		return;
 
-	i40e_vlan_rx_register(vsi->netdev, vsi->netdev->features);
+	if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
+		i40e_vlan_stripping_enable(vsi);
+	else
+		i40e_vlan_stripping_disable(vsi);
 
 	for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID)
 		i40e_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q),