Skip to content

Commit

Permalink
ixgbe: remove vlan_filter_disable and enable functions
Browse files Browse the repository at this point in the history
Previously these functions handled stripping setup as well, but this has
already been removed from these functions. Rather than encapsulating
this into a function, we can just do the work directly in set_rx_mode.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
jacob-keller authored and Jeff Kirsher committed Apr 23, 2014
1 parent f8e2472 commit a9b8943
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3767,35 +3767,6 @@ static int ixgbe_vlan_rx_kill_vid(struct net_device *netdev,
return 0;
}

/**
* ixgbe_vlan_filter_disable - helper to disable hw vlan filtering
* @adapter: driver data
*/
static void ixgbe_vlan_filter_disable(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
u32 vlnctrl;

vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlnctrl &= ~(IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN);
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
}

/**
* ixgbe_vlan_filter_enable - helper to enable hw vlan filtering
* @adapter: driver data
*/
static void ixgbe_vlan_filter_enable(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
u32 vlnctrl;

vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlnctrl |= IXGBE_VLNCTRL_VFE;
vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
}

/**
* ixgbe_vlan_strip_disable - helper to disable hw vlan stripping
* @adapter: driver data
Expand Down Expand Up @@ -3933,11 +3904,13 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_hw *hw = &adapter->hw;
u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
u32 vlnctrl;
int count;

/* Check for Promiscuous and All Multicast modes */

fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);

/* set all bits that we expect to always be set */
fctrl &= ~IXGBE_FCTRL_SBP; /* disable store-bad-packets */
Expand All @@ -3947,7 +3920,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)

/* clear the bits we are changing the status of */
fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);

vlnctrl &= ~(IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN);
if (netdev->flags & IFF_PROMISC) {
hw->addr_ctrl.user_set_promisc = true;
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
Expand All @@ -3958,15 +3931,13 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
*/
if (!(adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED |
IXGBE_FLAG_SRIOV_ENABLED)))
ixgbe_vlan_filter_disable(adapter);
else
ixgbe_vlan_filter_enable(adapter);
vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN);
} else {
if (netdev->flags & IFF_ALLMULTI) {
fctrl |= IXGBE_FCTRL_MPE;
vmolr |= IXGBE_VMOLR_MPE;
}
ixgbe_vlan_filter_enable(adapter);
vlnctrl |= IXGBE_VLNCTRL_VFE;
hw->addr_ctrl.user_set_promisc = false;
}

Expand Down Expand Up @@ -4010,6 +3981,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
/* NOTE: VLAN filtering is disabled by setting PROMISC */
}

IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);

if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
Expand Down

0 comments on commit a9b8943

Please sign in to comment.