aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-07 03:32:18 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-07 23:19:01 -0400
commit782d640afd15af7a1faf01cfe566ca4ac511319d (patch)
treefdf50de5e124d1ee61c7dd20a6fef1c585e53b0e /drivers/net/atl1c
parentdc668910f4eaa233c241d43d96ed6b0b9258cc43 (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/net/atl1c')
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c8
-rw-r--r--drivers/net/atl1c/atl1c_main.c23
2 files changed, 14 insertions, 17 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
116static u32 atl1c_get_tx_csum(struct net_device *netdev)
117{
118 return (netdev->features & NETIF_F_HW_CSUM) != 0;
119}
120
121static u32 atl1c_get_msglevel(struct net_device *netdev) 116static 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
315void atl1c_set_ethtool_ops(struct net_device *netdev) 307void 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
488static 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