diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-07-20 06:54:15 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 22:47:54 +0200 |
commit | 133b08513a99d44d9ed916bb83e46343f6ad2855 (patch) | |
tree | 60bc1cfef6756f646c16ee6ecc37799b9937398b /drivers/net/chelsio/cxgb2.c | |
parent | bnad: do vlan cleanup (diff) | |
download | linux-133b08513a99d44d9ed916bb83e46343f6ad2855.tar.xz linux-133b08513a99d44d9ed916bb83e46343f6ad2855.zip |
chelsio: do vlan cleanup
- unify vlan and nonvlan rx path
- kill adapter->vlan_grp and t1_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/chelsio/cxgb2.c')
-rw-r--r-- | drivers/net/chelsio/cxgb2.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index b422d83f5343..3edbbc4c5112 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c @@ -263,6 +263,8 @@ static int cxgb_open(struct net_device *dev) if (!other_ports && adapter->params.stats_update_period) schedule_mac_stats_update(adapter, adapter->params.stats_update_period); + + t1_vlan_mode(adapter, dev->features); return 0; } @@ -849,19 +851,30 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) return 0; } -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -static void t1_vlan_rx_register(struct net_device *dev, - struct vlan_group *grp) +static u32 t1_fix_features(struct net_device *dev, u32 features) { - struct adapter *adapter = dev->ml_priv; + /* + * Since there is no support for separate rx/tx vlan accel + * enable/disable make sure tx flag is always in same state as rx. + */ + if (features & NETIF_F_HW_VLAN_RX) + features |= NETIF_F_HW_VLAN_TX; + else + features &= ~NETIF_F_HW_VLAN_TX; - spin_lock_irq(&adapter->async_lock); - adapter->vlan_grp = grp; - t1_set_vlan_accel(adapter, grp != NULL); - spin_unlock_irq(&adapter->async_lock); + return features; } -#endif +static int t1_set_features(struct net_device *dev, u32 features) +{ + u32 changed = dev->features ^ features; + struct adapter *adapter = dev->ml_priv; + + if (changed & NETIF_F_HW_VLAN_RX) + t1_vlan_mode(adapter, features); + + return 0; +} #ifdef CONFIG_NET_POLL_CONTROLLER static void t1_netpoll(struct net_device *dev) { @@ -955,9 +968,8 @@ static const struct net_device_ops cxgb_netdev_ops = { .ndo_do_ioctl = t1_ioctl, .ndo_change_mtu = t1_change_mtu, .ndo_set_mac_address = t1_set_mac_addr, -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) - .ndo_vlan_rx_register = t1_vlan_rx_register, -#endif + .ndo_fix_features = t1_fix_features, + .ndo_set_features = t1_set_features, #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = t1_netpoll, #endif @@ -1080,10 +1092,9 @@ static int __devinit init_one(struct pci_dev *pdev, if (pci_using_dac) netdev->features |= NETIF_F_HIGHDMA; if (vlan_tso_capable(adapter)) { -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; -#endif + netdev->hw_features |= NETIF_F_HW_VLAN_RX; /* T204: disable TSO */ if (!(is_T2(adapter)) || bi->port_number != 4) { |