aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4vf/cxgb4vf_main.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-07-20 00:54:16 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-21 16:47:54 -0400
commit87737663d5d7668c8553c572a5a7c26e86c5842b (patch)
tree9a8f3d1c26ace7787364b8a681f7b4c4eed97775 /drivers/net/cxgb4vf/cxgb4vf_main.c
parent133b08513a99d44d9ed916bb83e46343f6ad2855 (diff)
cxgb4vf: do vlan cleanup
- unify vlan and nonvlan rx path - kill pi->vlan_grp and cxgb4vf_vlan_rx_register - allow to turn on/off rx/tx vlan accel via ethtool (set_features) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4vf/cxgb4vf_main.c')
-rw-r--r--drivers/net/cxgb4vf/cxgb4vf_main.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 3942a825b3dd..ec799139dfe2 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -209,18 +209,8 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
209 * ====================== 209 * ======================
210 */ 210 */
211 211
212/*
213 * Record our new VLAN Group and enable/disable hardware VLAN Tag extraction
214 * based on whether the specified VLAN Group pointer is NULL or not.
215 */
216static void cxgb4vf_vlan_rx_register(struct net_device *dev,
217 struct vlan_group *grp)
218{
219 struct port_info *pi = netdev_priv(dev);
220 212
221 pi->vlan_grp = grp; 213
222 t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, grp != NULL, 0);
223}
224 214
225/* 215/*
226 * Perform the MAC and PHY actions needed to enable a "port" (Virtual 216 * Perform the MAC and PHY actions needed to enable a "port" (Virtual
@@ -233,9 +223,9 @@ static int link_start(struct net_device *dev)
233 223
234 /* 224 /*
235 * We do not set address filters and promiscuity here, the stack does 225 * We do not set address filters and promiscuity here, the stack does
236 * that step explicitly. 226 * that step explicitly. Enable vlan accel.
237 */ 227 */
238 ret = t4vf_set_rxmode(pi->adapter, pi->viid, dev->mtu, -1, -1, -1, -1, 228 ret = t4vf_set_rxmode(pi->adapter, pi->viid, dev->mtu, -1, -1, -1, 1,
239 true); 229 true);
240 if (ret == 0) { 230 if (ret == 0) {
241 ret = t4vf_change_mac(pi->adapter, pi->viid, 231 ret = t4vf_change_mac(pi->adapter, pi->viid,
@@ -1102,6 +1092,32 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu)
1102 return ret; 1092 return ret;
1103} 1093}
1104 1094
1095static u32 cxgb4vf_fix_features(struct net_device *dev, u32 features)
1096{
1097 /*
1098 * Since there is no support for separate rx/tx vlan accel
1099 * enable/disable make sure tx flag is always in same state as rx.
1100 */
1101 if (features & NETIF_F_HW_VLAN_RX)
1102 features |= NETIF_F_HW_VLAN_TX;
1103 else
1104 features &= ~NETIF_F_HW_VLAN_TX;
1105
1106 return features;
1107}
1108
1109static int cxgb4vf_set_features(struct net_device *dev, u32 features)
1110{
1111 struct port_info *pi = netdev_priv(dev);
1112 u32 changed = dev->features ^ features;
1113
1114 if (changed & NETIF_F_HW_VLAN_RX)
1115 t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1,
1116 features & NETIF_F_HW_VLAN_TX, 0);
1117
1118 return 0;
1119}
1120
1105/* 1121/*
1106 * Change the devices MAC address. 1122 * Change the devices MAC address.
1107 */ 1123 */
@@ -2431,7 +2447,8 @@ static const struct net_device_ops cxgb4vf_netdev_ops = {
2431 .ndo_validate_addr = eth_validate_addr, 2447 .ndo_validate_addr = eth_validate_addr,
2432 .ndo_do_ioctl = cxgb4vf_do_ioctl, 2448 .ndo_do_ioctl = cxgb4vf_do_ioctl,
2433 .ndo_change_mtu = cxgb4vf_change_mtu, 2449 .ndo_change_mtu = cxgb4vf_change_mtu,
2434 .ndo_vlan_rx_register = cxgb4vf_vlan_rx_register, 2450 .ndo_fix_features = cxgb4vf_fix_features,
2451 .ndo_set_features = cxgb4vf_set_features,
2435#ifdef CONFIG_NET_POLL_CONTROLLER 2452#ifdef CONFIG_NET_POLL_CONTROLLER
2436 .ndo_poll_controller = cxgb4vf_poll_controller, 2453 .ndo_poll_controller = cxgb4vf_poll_controller,
2437#endif 2454#endif
@@ -2600,12 +2617,11 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
2600 2617
2601 netdev->hw_features = NETIF_F_SG | TSO_FLAGS | 2618 netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
2602 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2619 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2603 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM; 2620 NETIF_F_HW_VLAN_RX | NETIF_F_RXCSUM;
2604 netdev->vlan_features = NETIF_F_SG | TSO_FLAGS | 2621 netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
2605 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2622 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2606 NETIF_F_HIGHDMA; 2623 NETIF_F_HIGHDMA;
2607 netdev->features = netdev->hw_features | 2624 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_TX;
2608 NETIF_F_HW_VLAN_RX;
2609 if (pci_using_dac) 2625 if (pci_using_dac)
2610 netdev->features |= NETIF_F_HIGHDMA; 2626 netdev->features |= NETIF_F_HIGHDMA;
2611 2627