diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-06-08 08:39:40 +0000 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-09-16 18:26:37 -0700 |
commit | d7ccb8c2f2f73a9fcdb8fb0f3bcdd09746f3a9ef (patch) | |
tree | ef6f3869eb52d196825efd454f508537c0f26366 /drivers/net/ethernet/intel/ixgb/ixgb_main.c | |
parent | f78a5fda9116525809d088917638be912b85f838 (diff) |
ixgb: convert to ndo_fix_features
Private rx_csum flags are now duplicate of netdev->features & NETIF_F_RXCSUM.
Removing this needs deeper surgery.
Things noticed:
- ixgb has RX csum disabled by default
- HW VLAN acceleration probably can be toggled, but it's left as is
- the resets on RX csum offload change can probably be avoided
- there is A LOT of copy-and-pasted code here
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgb/ixgb_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgb/ixgb_main.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index c8b9c9028bc..b8fb1630459 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -325,6 +325,28 @@ ixgb_reset(struct ixgb_adapter *adapter) } } +static int +ixgb_set_features(struct net_device *netdev, u32 features) +{ + struct ixgb_adapter *adapter = netdev_priv(netdev); + u32 changed = features ^ netdev->features; + + if (!(changed & NETIF_F_RXCSUM)) + return 0; + + adapter->rx_csum = !!(features & NETIF_F_RXCSUM); + + if (netif_running(netdev)) { + ixgb_down(adapter, true); + ixgb_up(adapter); + ixgb_set_speed_duplex(netdev); + } else + ixgb_reset(adapter); + + return 0; +} + + static const struct net_device_ops ixgb_netdev_ops = { .ndo_open = ixgb_open, .ndo_stop = ixgb_close, @@ -340,6 +362,7 @@ static const struct net_device_ops ixgb_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = ixgb_netpoll, #endif + .ndo_set_features = ixgb_set_features, }; /** @@ -439,12 +462,14 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init; - netdev->features = NETIF_F_SG | - NETIF_F_HW_CSUM | + netdev->hw_features = NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_HW_CSUM; + netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; - netdev->features |= NETIF_F_TSO; + netdev->hw_features |= NETIF_F_RXCSUM; if (pci_using_dac) { netdev->features |= NETIF_F_HIGHDMA; |