diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-07 03:32:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-07 23:19:01 -0400 |
commit | 782d640afd15af7a1faf01cfe566ca4ac511319d (patch) | |
tree | fdf50de5e124d1ee61c7dd20a6fef1c585e53b0e /drivers | |
parent | dc668910f4eaa233c241d43d96ed6b0b9258cc43 (diff) |
net: atl*: convert to hw_features
Things left as they were:
- atl1: is RX checksum really enabled?
- atl2: copy-paste from atl1, with-errors-on-modify I presume
- atl1c: there's a bug: MTU can't be changed if device is not up
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/atl1c/atl1c_ethtool.c | 8 | ||||
-rw-r--r-- | drivers/net/atl1c/atl1c_main.c | 23 | ||||
-rw-r--r-- | drivers/net/atl1e/atl1e_ethtool.c | 3 | ||||
-rw-r--r-- | drivers/net/atl1e/atl1e_main.c | 12 | ||||
-rw-r--r-- | drivers/net/atlx/atl1.c | 15 | ||||
-rw-r--r-- | drivers/net/atlx/atl2.c | 14 |
6 files changed, 24 insertions, 51 deletions
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c index 7c521508313c..3af5a336a5af 100644 --- a/drivers/net/atl1c/atl1c_ethtool.c +++ b/drivers/net/atl1c/atl1c_ethtool.c | |||
@@ -113,11 +113,6 @@ static int atl1c_set_settings(struct net_device *netdev, | |||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | 115 | ||
116 | static u32 atl1c_get_tx_csum(struct net_device *netdev) | ||
117 | { | ||
118 | return (netdev->features & NETIF_F_HW_CSUM) != 0; | ||
119 | } | ||
120 | |||
121 | static u32 atl1c_get_msglevel(struct net_device *netdev) | 116 | static u32 atl1c_get_msglevel(struct net_device *netdev) |
122 | { | 117 | { |
123 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 118 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
@@ -307,9 +302,6 @@ static const struct ethtool_ops atl1c_ethtool_ops = { | |||
307 | .get_link = ethtool_op_get_link, | 302 | .get_link = ethtool_op_get_link, |
308 | .get_eeprom_len = atl1c_get_eeprom_len, | 303 | .get_eeprom_len = atl1c_get_eeprom_len, |
309 | .get_eeprom = atl1c_get_eeprom, | 304 | .get_eeprom = atl1c_get_eeprom, |
310 | .get_tx_csum = atl1c_get_tx_csum, | ||
311 | .get_sg = ethtool_op_get_sg, | ||
312 | .set_sg = ethtool_op_set_sg, | ||
313 | }; | 305 | }; |
314 | 306 | ||
315 | void atl1c_set_ethtool_ops(struct net_device *netdev) | 307 | void atl1c_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index 7d9d5067a65c..894d485bf5bc 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -484,6 +484,15 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, | |||
484 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? | 484 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? |
485 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; | 485 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; |
486 | } | 486 | } |
487 | |||
488 | static u32 atl1c_fix_features(struct net_device *netdev, u32 features) | ||
489 | { | ||
490 | if (netdev->mtu > MAX_TSO_FRAME_SIZE) | ||
491 | features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
492 | |||
493 | return features; | ||
494 | } | ||
495 | |||
487 | /* | 496 | /* |
488 | * atl1c_change_mtu - Change the Maximum Transfer Unit | 497 | * atl1c_change_mtu - Change the Maximum Transfer Unit |
489 | * @netdev: network interface device structure | 498 | * @netdev: network interface device structure |
@@ -510,14 +519,8 @@ static int atl1c_change_mtu(struct net_device *netdev, int new_mtu) | |||
510 | netdev->mtu = new_mtu; | 519 | netdev->mtu = new_mtu; |
511 | adapter->hw.max_frame_size = new_mtu; | 520 | adapter->hw.max_frame_size = new_mtu; |
512 | atl1c_set_rxbufsize(adapter, netdev); | 521 | atl1c_set_rxbufsize(adapter, netdev); |
513 | if (new_mtu > MAX_TSO_FRAME_SIZE) { | ||
514 | adapter->netdev->features &= ~NETIF_F_TSO; | ||
515 | adapter->netdev->features &= ~NETIF_F_TSO6; | ||
516 | } else { | ||
517 | adapter->netdev->features |= NETIF_F_TSO; | ||
518 | adapter->netdev->features |= NETIF_F_TSO6; | ||
519 | } | ||
520 | atl1c_down(adapter); | 522 | atl1c_down(adapter); |
523 | netdev_update_features(netdev); | ||
521 | atl1c_up(adapter); | 524 | atl1c_up(adapter); |
522 | clear_bit(__AT_RESETTING, &adapter->flags); | 525 | clear_bit(__AT_RESETTING, &adapter->flags); |
523 | if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) { | 526 | if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) { |
@@ -2585,6 +2588,7 @@ static const struct net_device_ops atl1c_netdev_ops = { | |||
2585 | .ndo_set_mac_address = atl1c_set_mac_addr, | 2588 | .ndo_set_mac_address = atl1c_set_mac_addr, |
2586 | .ndo_set_multicast_list = atl1c_set_multi, | 2589 | .ndo_set_multicast_list = atl1c_set_multi, |
2587 | .ndo_change_mtu = atl1c_change_mtu, | 2590 | .ndo_change_mtu = atl1c_change_mtu, |
2591 | .ndo_fix_features = atl1c_fix_features, | ||
2588 | .ndo_do_ioctl = atl1c_ioctl, | 2592 | .ndo_do_ioctl = atl1c_ioctl, |
2589 | .ndo_tx_timeout = atl1c_tx_timeout, | 2593 | .ndo_tx_timeout = atl1c_tx_timeout, |
2590 | .ndo_get_stats = atl1c_get_stats, | 2594 | .ndo_get_stats = atl1c_get_stats, |
@@ -2605,12 +2609,13 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) | |||
2605 | atl1c_set_ethtool_ops(netdev); | 2609 | atl1c_set_ethtool_ops(netdev); |
2606 | 2610 | ||
2607 | /* TODO: add when ready */ | 2611 | /* TODO: add when ready */ |
2608 | netdev->features = NETIF_F_SG | | 2612 | netdev->hw_features = NETIF_F_SG | |
2609 | NETIF_F_HW_CSUM | | 2613 | NETIF_F_HW_CSUM | |
2610 | NETIF_F_HW_VLAN_TX | | 2614 | NETIF_F_HW_VLAN_TX | |
2611 | NETIF_F_HW_VLAN_RX | | ||
2612 | NETIF_F_TSO | | 2615 | NETIF_F_TSO | |
2613 | NETIF_F_TSO6; | 2616 | NETIF_F_TSO6; |
2617 | netdev->features = netdev->hw_features | | ||
2618 | NETIF_F_HW_VLAN_RX; | ||
2614 | return 0; | 2619 | return 0; |
2615 | } | 2620 | } |
2616 | 2621 | ||
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c index 1209297433b8..47783749d9fa 100644 --- a/drivers/net/atl1e/atl1e_ethtool.c +++ b/drivers/net/atl1e/atl1e_ethtool.c | |||
@@ -382,9 +382,6 @@ static const struct ethtool_ops atl1e_ethtool_ops = { | |||
382 | .get_eeprom_len = atl1e_get_eeprom_len, | 382 | .get_eeprom_len = atl1e_get_eeprom_len, |
383 | .get_eeprom = atl1e_get_eeprom, | 383 | .get_eeprom = atl1e_get_eeprom, |
384 | .set_eeprom = atl1e_set_eeprom, | 384 | .set_eeprom = atl1e_set_eeprom, |
385 | .set_tx_csum = ethtool_op_set_tx_hw_csum, | ||
386 | .set_sg = ethtool_op_set_sg, | ||
387 | .set_tso = ethtool_op_set_tso, | ||
388 | }; | 385 | }; |
389 | 386 | ||
390 | void atl1e_set_ethtool_ops(struct net_device *netdev) | 387 | void atl1e_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index 1ff001a8270c..c05b2e7c93d0 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c | |||
@@ -1927,11 +1927,7 @@ void atl1e_down(struct atl1e_adapter *adapter) | |||
1927 | * reschedule our watchdog timer */ | 1927 | * reschedule our watchdog timer */ |
1928 | set_bit(__AT_DOWN, &adapter->flags); | 1928 | set_bit(__AT_DOWN, &adapter->flags); |
1929 | 1929 | ||
1930 | #ifdef NETIF_F_LLTX | ||
1931 | netif_stop_queue(netdev); | 1930 | netif_stop_queue(netdev); |
1932 | #else | ||
1933 | netif_tx_disable(netdev); | ||
1934 | #endif | ||
1935 | 1931 | ||
1936 | /* reset MAC to disable all RX/TX */ | 1932 | /* reset MAC to disable all RX/TX */ |
1937 | atl1e_reset_hw(&adapter->hw); | 1933 | atl1e_reset_hw(&adapter->hw); |
@@ -2223,10 +2219,10 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev) | |||
2223 | netdev->watchdog_timeo = AT_TX_WATCHDOG; | 2219 | netdev->watchdog_timeo = AT_TX_WATCHDOG; |
2224 | atl1e_set_ethtool_ops(netdev); | 2220 | atl1e_set_ethtool_ops(netdev); |
2225 | 2221 | ||
2226 | netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | | 2222 | netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | |
2227 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 2223 | NETIF_F_HW_VLAN_TX; |
2228 | netdev->features |= NETIF_F_LLTX; | 2224 | netdev->features = netdev->hw_features | |
2229 | netdev->features |= NETIF_F_TSO; | 2225 | NETIF_F_HW_VLAN_RX | NETIF_F_LLTX; |
2230 | 2226 | ||
2231 | return 0; | 2227 | return 0; |
2232 | } | 2228 | } |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index e973d056dc8f..98334a1f0c5c 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -2986,6 +2986,11 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
2986 | netdev->features |= NETIF_F_SG; | 2986 | netdev->features |= NETIF_F_SG; |
2987 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 2987 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
2988 | 2988 | ||
2989 | netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO; | ||
2990 | |||
2991 | /* is this valid? see atl1_setup_mac_ctrl() */ | ||
2992 | netdev->features |= NETIF_F_RXCSUM; | ||
2993 | |||
2989 | /* | 2994 | /* |
2990 | * patch for some L1 of old version, | 2995 | * patch for some L1 of old version, |
2991 | * the final version of L1 may not need these | 2996 | * the final version of L1 may not need these |
@@ -3595,12 +3600,6 @@ static int atl1_set_pauseparam(struct net_device *netdev, | |||
3595 | return 0; | 3600 | return 0; |
3596 | } | 3601 | } |
3597 | 3602 | ||
3598 | /* FIXME: is this right? -- CHS */ | ||
3599 | static u32 atl1_get_rx_csum(struct net_device *netdev) | ||
3600 | { | ||
3601 | return 1; | ||
3602 | } | ||
3603 | |||
3604 | static void atl1_get_strings(struct net_device *netdev, u32 stringset, | 3603 | static void atl1_get_strings(struct net_device *netdev, u32 stringset, |
3605 | u8 *data) | 3604 | u8 *data) |
3606 | { | 3605 | { |
@@ -3668,13 +3667,9 @@ static const struct ethtool_ops atl1_ethtool_ops = { | |||
3668 | .set_ringparam = atl1_set_ringparam, | 3667 | .set_ringparam = atl1_set_ringparam, |
3669 | .get_pauseparam = atl1_get_pauseparam, | 3668 | .get_pauseparam = atl1_get_pauseparam, |
3670 | .set_pauseparam = atl1_set_pauseparam, | 3669 | .set_pauseparam = atl1_set_pauseparam, |
3671 | .get_rx_csum = atl1_get_rx_csum, | ||
3672 | .set_tx_csum = ethtool_op_set_tx_hw_csum, | ||
3673 | .get_link = ethtool_op_get_link, | 3670 | .get_link = ethtool_op_get_link, |
3674 | .set_sg = ethtool_op_set_sg, | ||
3675 | .get_strings = atl1_get_strings, | 3671 | .get_strings = atl1_get_strings, |
3676 | .nway_reset = atl1_nway_reset, | 3672 | .nway_reset = atl1_nway_reset, |
3677 | .get_ethtool_stats = atl1_get_ethtool_stats, | 3673 | .get_ethtool_stats = atl1_get_ethtool_stats, |
3678 | .get_sset_count = atl1_get_sset_count, | 3674 | .get_sset_count = atl1_get_sset_count, |
3679 | .set_tso = ethtool_op_set_tso, | ||
3680 | }; | 3675 | }; |
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index 937ef1afa5db..02761dd23fb8 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -1411,9 +1411,8 @@ static int __devinit atl2_probe(struct pci_dev *pdev, | |||
1411 | 1411 | ||
1412 | err = -EIO; | 1412 | err = -EIO; |
1413 | 1413 | ||
1414 | #ifdef NETIF_F_HW_VLAN_TX | 1414 | netdev->hw_features = NETIF_F_SG; |
1415 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 1415 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
1416 | #endif | ||
1417 | 1416 | ||
1418 | /* Init PHY as early as possible due to power saving issue */ | 1417 | /* Init PHY as early as possible due to power saving issue */ |
1419 | atl2_phy_init(&adapter->hw); | 1418 | atl2_phy_init(&adapter->hw); |
@@ -1840,11 +1839,6 @@ static int atl2_set_settings(struct net_device *netdev, | |||
1840 | return 0; | 1839 | return 0; |
1841 | } | 1840 | } |
1842 | 1841 | ||
1843 | static u32 atl2_get_tx_csum(struct net_device *netdev) | ||
1844 | { | ||
1845 | return (netdev->features & NETIF_F_HW_CSUM) != 0; | ||
1846 | } | ||
1847 | |||
1848 | static u32 atl2_get_msglevel(struct net_device *netdev) | 1842 | static u32 atl2_get_msglevel(struct net_device *netdev) |
1849 | { | 1843 | { |
1850 | return 0; | 1844 | return 0; |
@@ -2112,12 +2106,6 @@ static const struct ethtool_ops atl2_ethtool_ops = { | |||
2112 | .get_eeprom_len = atl2_get_eeprom_len, | 2106 | .get_eeprom_len = atl2_get_eeprom_len, |
2113 | .get_eeprom = atl2_get_eeprom, | 2107 | .get_eeprom = atl2_get_eeprom, |
2114 | .set_eeprom = atl2_set_eeprom, | 2108 | .set_eeprom = atl2_set_eeprom, |
2115 | .get_tx_csum = atl2_get_tx_csum, | ||
2116 | .get_sg = ethtool_op_get_sg, | ||
2117 | .set_sg = ethtool_op_set_sg, | ||
2118 | #ifdef NETIF_F_TSO | ||
2119 | .get_tso = ethtool_op_get_tso, | ||
2120 | #endif | ||
2121 | }; | 2109 | }; |
2122 | 2110 | ||
2123 | static void atl2_set_ethtool_ops(struct net_device *netdev) | 2111 | static void atl2_set_ethtool_ops(struct net_device *netdev) |