aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb/ixgb_main.c
diff options
context:
space:
mode:
authorEmil Tantilov <emil.s.tantilov@intel.com>2010-12-04 00:35:17 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2010-12-11 01:12:36 -0500
commitae54496f9e8d40c89e5668205c181dccfa9ecda1 (patch)
tree3cc8aafc1fb76dcc97e70035c93394afea596234 /drivers/net/ixgb/ixgb_main.c
parent667445008db3f45a760c235d771be0c9671e59e5 (diff)
ixgb: Don't check for vlan group on transmit
Based on a patch from Jesse Gross. Enable vlan tag insertion even when vlan group is not configured. For ixgb HW both CTRL0.VME and VLE bit in the Tx descriptor need to be set in order to enable HW acceleration. Introduced separate functions for enabling/disabling of vlan tag stripping similar to ixgbe. CC: Jesse Gross <jesse@nicira.com> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgb/ixgb_main.c')
-rw-r--r--drivers/net/ixgb/ixgb_main.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 211a1694667e..2e98506d12e3 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -98,6 +98,8 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int);
98static void ixgb_tx_timeout(struct net_device *dev); 98static void ixgb_tx_timeout(struct net_device *dev);
99static void ixgb_tx_timeout_task(struct work_struct *work); 99static void ixgb_tx_timeout_task(struct work_struct *work);
100 100
101static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter);
102static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter);
101static void ixgb_vlan_rx_register(struct net_device *netdev, 103static void ixgb_vlan_rx_register(struct net_device *netdev,
102 struct vlan_group *grp); 104 struct vlan_group *grp);
103static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 105static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
@@ -1076,6 +1078,8 @@ ixgb_set_multi(struct net_device *netdev)
1076 1078
1077 if (netdev->flags & IFF_PROMISC) { 1079 if (netdev->flags & IFF_PROMISC) {
1078 rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); 1080 rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1081 /* disable VLAN filtering */
1082 rctl &= ~IXGB_RCTL_CFIEN;
1079 rctl &= ~IXGB_RCTL_VFE; 1083 rctl &= ~IXGB_RCTL_VFE;
1080 } else { 1084 } else {
1081 if (netdev->flags & IFF_ALLMULTI) { 1085 if (netdev->flags & IFF_ALLMULTI) {
@@ -1084,7 +1088,9 @@ ixgb_set_multi(struct net_device *netdev)
1084 } else { 1088 } else {
1085 rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); 1089 rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1086 } 1090 }
1091 /* enable VLAN filtering */
1087 rctl |= IXGB_RCTL_VFE; 1092 rctl |= IXGB_RCTL_VFE;
1093 rctl &= ~IXGB_RCTL_CFIEN;
1088 } 1094 }
1089 1095
1090 if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { 1096 if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
@@ -1103,6 +1109,12 @@ ixgb_set_multi(struct net_device *netdev)
1103 1109
1104 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); 1110 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
1105 } 1111 }
1112
1113 if (netdev->features & NETIF_F_HW_VLAN_RX)
1114 ixgb_vlan_strip_enable(adapter);
1115 else
1116 ixgb_vlan_strip_disable(adapter);
1117
1106} 1118}
1107 1119
1108/** 1120/**
@@ -2150,33 +2162,30 @@ static void
2150ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) 2162ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
2151{ 2163{
2152 struct ixgb_adapter *adapter = netdev_priv(netdev); 2164 struct ixgb_adapter *adapter = netdev_priv(netdev);
2153 u32 ctrl, rctl;
2154 2165
2155 ixgb_irq_disable(adapter);
2156 adapter->vlgrp = grp; 2166 adapter->vlgrp = grp;
2167}
2157 2168
2158 if (grp) { 2169static void
2159 /* enable VLAN tag insert/strip */ 2170ixgb_vlan_strip_enable(struct ixgb_adapter *adapter)
2160 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); 2171{
2161 ctrl |= IXGB_CTRL0_VME; 2172 u32 ctrl;
2162 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2163
2164 /* enable VLAN receive filtering */
2165 2173
2166 rctl = IXGB_READ_REG(&adapter->hw, RCTL); 2174 /* enable VLAN tag insert/strip */
2167 rctl &= ~IXGB_RCTL_CFIEN; 2175 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
2168 IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); 2176 ctrl |= IXGB_CTRL0_VME;
2169 } else { 2177 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2170 /* disable VLAN tag insert/strip */ 2178}
2171 2179
2172 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); 2180static void
2173 ctrl &= ~IXGB_CTRL0_VME; 2181ixgb_vlan_strip_disable(struct ixgb_adapter *adapter)
2174 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl); 2182{
2175 } 2183 u32 ctrl;
2176 2184
2177 /* don't enable interrupts unless we are UP */ 2185 /* disable VLAN tag insert/strip */
2178 if (adapter->netdev->flags & IFF_UP) 2186 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
2179 ixgb_irq_enable(adapter); 2187 ctrl &= ~IXGB_CTRL0_VME;
2188 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2180} 2189}
2181 2190
2182static void 2191static void