diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-08-30 13:07:11 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-10-16 16:18:47 -0400 |
commit | fd38f734cb8200529e281338514945fcbff2364b (patch) | |
tree | b3ebe33151fa90fdfd0196adafb1aa6d4ab7a1de /drivers | |
parent | 11ba69e876e1141fa4b11a7c0efb256a8df9ae7d (diff) |
igbvf: 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:
- 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')
-rw-r--r-- | drivers/net/ethernet/intel/igbvf/ethtool.c | 57 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igbvf/netdev.c | 25 |
2 files changed, 20 insertions, 62 deletions
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c index 0ee8b684584..2c25858cc0f 100644 --- a/drivers/net/ethernet/intel/igbvf/ethtool.c +++ b/drivers/net/ethernet/intel/igbvf/ethtool.c | |||
@@ -128,55 +128,6 @@ static int igbvf_set_pauseparam(struct net_device *netdev, | |||
128 | return -EOPNOTSUPP; | 128 | return -EOPNOTSUPP; |
129 | } | 129 | } |
130 | 130 | ||
131 | static u32 igbvf_get_rx_csum(struct net_device *netdev) | ||
132 | { | ||
133 | struct igbvf_adapter *adapter = netdev_priv(netdev); | ||
134 | return !(adapter->flags & IGBVF_FLAG_RX_CSUM_DISABLED); | ||
135 | } | ||
136 | |||
137 | static int igbvf_set_rx_csum(struct net_device *netdev, u32 data) | ||
138 | { | ||
139 | struct igbvf_adapter *adapter = netdev_priv(netdev); | ||
140 | |||
141 | if (data) | ||
142 | adapter->flags &= ~IGBVF_FLAG_RX_CSUM_DISABLED; | ||
143 | else | ||
144 | adapter->flags |= IGBVF_FLAG_RX_CSUM_DISABLED; | ||
145 | |||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static u32 igbvf_get_tx_csum(struct net_device *netdev) | ||
150 | { | ||
151 | return (netdev->features & NETIF_F_IP_CSUM) != 0; | ||
152 | } | ||
153 | |||
154 | static int igbvf_set_tx_csum(struct net_device *netdev, u32 data) | ||
155 | { | ||
156 | if (data) | ||
157 | netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | ||
158 | else | ||
159 | netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int igbvf_set_tso(struct net_device *netdev, u32 data) | ||
164 | { | ||
165 | struct igbvf_adapter *adapter = netdev_priv(netdev); | ||
166 | |||
167 | if (data) { | ||
168 | netdev->features |= NETIF_F_TSO; | ||
169 | netdev->features |= NETIF_F_TSO6; | ||
170 | } else { | ||
171 | netdev->features &= ~NETIF_F_TSO; | ||
172 | netdev->features &= ~NETIF_F_TSO6; | ||
173 | } | ||
174 | |||
175 | dev_info(&adapter->pdev->dev, "TSO is %s\n", | ||
176 | data ? "Enabled" : "Disabled"); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static u32 igbvf_get_msglevel(struct net_device *netdev) | 131 | static u32 igbvf_get_msglevel(struct net_device *netdev) |
181 | { | 132 | { |
182 | struct igbvf_adapter *adapter = netdev_priv(netdev); | 133 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
@@ -507,14 +458,6 @@ static const struct ethtool_ops igbvf_ethtool_ops = { | |||
507 | .set_ringparam = igbvf_set_ringparam, | 458 | .set_ringparam = igbvf_set_ringparam, |
508 | .get_pauseparam = igbvf_get_pauseparam, | 459 | .get_pauseparam = igbvf_get_pauseparam, |
509 | .set_pauseparam = igbvf_set_pauseparam, | 460 | .set_pauseparam = igbvf_set_pauseparam, |
510 | .get_rx_csum = igbvf_get_rx_csum, | ||
511 | .set_rx_csum = igbvf_set_rx_csum, | ||
512 | .get_tx_csum = igbvf_get_tx_csum, | ||
513 | .set_tx_csum = igbvf_set_tx_csum, | ||
514 | .get_sg = ethtool_op_get_sg, | ||
515 | .set_sg = ethtool_op_set_sg, | ||
516 | .get_tso = ethtool_op_get_tso, | ||
517 | .set_tso = igbvf_set_tso, | ||
518 | .self_test = igbvf_diag_test, | 461 | .self_test = igbvf_diag_test, |
519 | .get_sset_count = igbvf_get_sset_count, | 462 | .get_sset_count = igbvf_get_sset_count, |
520 | .get_strings = igbvf_get_strings, | 463 | .get_strings = igbvf_get_strings, |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index b3d760b08a5..32b3044fa45 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -2530,6 +2530,18 @@ static void igbvf_print_device_info(struct igbvf_adapter *adapter) | |||
2530 | dev_info(&pdev->dev, "MAC: %d\n", hw->mac.type); | 2530 | dev_info(&pdev->dev, "MAC: %d\n", hw->mac.type); |
2531 | } | 2531 | } |
2532 | 2532 | ||
2533 | static int igbvf_set_features(struct net_device *netdev, u32 features) | ||
2534 | { | ||
2535 | struct igbvf_adapter *adapter = netdev_priv(netdev); | ||
2536 | |||
2537 | if (features & NETIF_F_RXCSUM) | ||
2538 | adapter->flags &= ~IGBVF_FLAG_RX_CSUM_DISABLED; | ||
2539 | else | ||
2540 | adapter->flags |= IGBVF_FLAG_RX_CSUM_DISABLED; | ||
2541 | |||
2542 | return 0; | ||
2543 | } | ||
2544 | |||
2533 | static const struct net_device_ops igbvf_netdev_ops = { | 2545 | static const struct net_device_ops igbvf_netdev_ops = { |
2534 | .ndo_open = igbvf_open, | 2546 | .ndo_open = igbvf_open, |
2535 | .ndo_stop = igbvf_close, | 2547 | .ndo_stop = igbvf_close, |
@@ -2545,6 +2557,7 @@ static const struct net_device_ops igbvf_netdev_ops = { | |||
2545 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2557 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2546 | .ndo_poll_controller = igbvf_netpoll, | 2558 | .ndo_poll_controller = igbvf_netpoll, |
2547 | #endif | 2559 | #endif |
2560 | .ndo_set_features = igbvf_set_features, | ||
2548 | }; | 2561 | }; |
2549 | 2562 | ||
2550 | /** | 2563 | /** |
@@ -2652,16 +2665,18 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2652 | 2665 | ||
2653 | adapter->bd_number = cards_found++; | 2666 | adapter->bd_number = cards_found++; |
2654 | 2667 | ||
2655 | netdev->features = NETIF_F_SG | | 2668 | netdev->hw_features = NETIF_F_SG | |
2656 | NETIF_F_IP_CSUM | | 2669 | NETIF_F_IP_CSUM | |
2670 | NETIF_F_IPV6_CSUM | | ||
2671 | NETIF_F_TSO | | ||
2672 | NETIF_F_TSO6 | | ||
2673 | NETIF_F_RXCSUM; | ||
2674 | |||
2675 | netdev->features = netdev->hw_features | | ||
2657 | NETIF_F_HW_VLAN_TX | | 2676 | NETIF_F_HW_VLAN_TX | |
2658 | NETIF_F_HW_VLAN_RX | | 2677 | NETIF_F_HW_VLAN_RX | |
2659 | NETIF_F_HW_VLAN_FILTER; | 2678 | NETIF_F_HW_VLAN_FILTER; |
2660 | 2679 | ||
2661 | netdev->features |= NETIF_F_IPV6_CSUM; | ||
2662 | netdev->features |= NETIF_F_TSO; | ||
2663 | netdev->features |= NETIF_F_TSO6; | ||
2664 | |||
2665 | if (pci_using_dac) | 2680 | if (pci_using_dac) |
2666 | netdev->features |= NETIF_F_HIGHDMA; | 2681 | netdev->features |= NETIF_F_HIGHDMA; |
2667 | 2682 | ||