]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: atl*: convert to hw_features
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Thu, 7 Apr 2011 07:32:18 +0000 (07:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Apr 2011 03:19:01 +0000 (20:19 -0700)
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>
drivers/net/atl1c/atl1c_ethtool.c
drivers/net/atl1c/atl1c_main.c
drivers/net/atl1e/atl1e_ethtool.c
drivers/net/atl1e/atl1e_main.c
drivers/net/atlx/atl1.c
drivers/net/atlx/atl2.c

index 7c521508313c28a300d264ad7a610e2c91732739..3af5a336a5afd40c60b07935b559c18b7f065248 100644 (file)
@@ -113,11 +113,6 @@ static int atl1c_set_settings(struct net_device *netdev,
        return 0;
 }
 
-static u32 atl1c_get_tx_csum(struct net_device *netdev)
-{
-       return (netdev->features & NETIF_F_HW_CSUM) != 0;
-}
-
 static u32 atl1c_get_msglevel(struct net_device *netdev)
 {
        struct atl1c_adapter *adapter = netdev_priv(netdev);
@@ -307,9 +302,6 @@ static const struct ethtool_ops atl1c_ethtool_ops = {
        .get_link               = ethtool_op_get_link,
        .get_eeprom_len         = atl1c_get_eeprom_len,
        .get_eeprom             = atl1c_get_eeprom,
-       .get_tx_csum            = atl1c_get_tx_csum,
-       .get_sg                 = ethtool_op_get_sg,
-       .set_sg                 = ethtool_op_set_sg,
 };
 
 void atl1c_set_ethtool_ops(struct net_device *netdev)
index 7d9d5067a65ce1bb368bd2128d75c5ef87446828..894d485bf5bc9d92084f0a5963003009050410b4 100644 (file)
@@ -484,6 +484,15 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter,
        adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ?
                roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
 }
+
+static u32 atl1c_fix_features(struct net_device *netdev, u32 features)
+{
+       if (netdev->mtu > MAX_TSO_FRAME_SIZE)
+               features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+
+       return features;
+}
+
 /*
  * atl1c_change_mtu - Change the Maximum Transfer Unit
  * @netdev: network interface device structure
@@ -510,14 +519,8 @@ static int atl1c_change_mtu(struct net_device *netdev, int new_mtu)
                netdev->mtu = new_mtu;
                adapter->hw.max_frame_size = new_mtu;
                atl1c_set_rxbufsize(adapter, netdev);
-               if (new_mtu > MAX_TSO_FRAME_SIZE) {
-                       adapter->netdev->features &= ~NETIF_F_TSO;
-                       adapter->netdev->features &= ~NETIF_F_TSO6;
-               } else {
-                       adapter->netdev->features |= NETIF_F_TSO;
-                       adapter->netdev->features |= NETIF_F_TSO6;
-               }
                atl1c_down(adapter);
+               netdev_update_features(netdev);
                atl1c_up(adapter);
                clear_bit(__AT_RESETTING, &adapter->flags);
                if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) {
@@ -2585,6 +2588,7 @@ static const struct net_device_ops atl1c_netdev_ops = {
        .ndo_set_mac_address    = atl1c_set_mac_addr,
        .ndo_set_multicast_list = atl1c_set_multi,
        .ndo_change_mtu         = atl1c_change_mtu,
+       .ndo_fix_features       = atl1c_fix_features,
        .ndo_do_ioctl           = atl1c_ioctl,
        .ndo_tx_timeout         = atl1c_tx_timeout,
        .ndo_get_stats          = atl1c_get_stats,
@@ -2605,12 +2609,13 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
        atl1c_set_ethtool_ops(netdev);
 
        /* TODO: add when ready */
-       netdev->features =      NETIF_F_SG         |
+       netdev->hw_features =   NETIF_F_SG         |
                                NETIF_F_HW_CSUM    |
                                NETIF_F_HW_VLAN_TX |
-                               NETIF_F_HW_VLAN_RX |
                                NETIF_F_TSO        |
                                NETIF_F_TSO6;
+       netdev->features =      netdev->hw_features |
+                               NETIF_F_HW_VLAN_RX;
        return 0;
 }
 
index 1209297433b828083bb8892f9118809593237835..47783749d9fa6be18b1d508ce0fee1e1b0e487ad 100644 (file)
@@ -382,9 +382,6 @@ static const struct ethtool_ops atl1e_ethtool_ops = {
        .get_eeprom_len         = atl1e_get_eeprom_len,
        .get_eeprom             = atl1e_get_eeprom,
        .set_eeprom             = atl1e_set_eeprom,
-       .set_tx_csum            = ethtool_op_set_tx_hw_csum,
-       .set_sg                 = ethtool_op_set_sg,
-       .set_tso                = ethtool_op_set_tso,
 };
 
 void atl1e_set_ethtool_ops(struct net_device *netdev)
index 1ff001a8270cec79343be82983220a6e04e36e1f..c05b2e7c93d00a648caf61d4872d956a257b784a 100644 (file)
@@ -1927,11 +1927,7 @@ void atl1e_down(struct atl1e_adapter *adapter)
         * reschedule our watchdog timer */
        set_bit(__AT_DOWN, &adapter->flags);
 
-#ifdef NETIF_F_LLTX
        netif_stop_queue(netdev);
-#else
-       netif_tx_disable(netdev);
-#endif
 
        /* reset MAC to disable all RX/TX */
        atl1e_reset_hw(&adapter->hw);
@@ -2223,10 +2219,10 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
        netdev->watchdog_timeo = AT_TX_WATCHDOG;
        atl1e_set_ethtool_ops(netdev);
 
-       netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
-               NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-       netdev->features |= NETIF_F_LLTX;
-       netdev->features |= NETIF_F_TSO;
+       netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
+               NETIF_F_HW_VLAN_TX;
+       netdev->features = netdev->hw_features |
+               NETIF_F_HW_VLAN_RX | NETIF_F_LLTX;
 
        return 0;
 }
index e973d056dc8fdb545cad0454541ef992b0bb4303..98334a1f0c5cb8366a474ab6549e036b5cf238ab 100644 (file)
@@ -2986,6 +2986,11 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
        netdev->features |= NETIF_F_SG;
        netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
 
+       netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO;
+
+       /* is this valid? see atl1_setup_mac_ctrl() */
+       netdev->features |= NETIF_F_RXCSUM;
+
        /*
         * patch for some L1 of old version,
         * the final version of L1 may not need these
@@ -3595,12 +3600,6 @@ static int atl1_set_pauseparam(struct net_device *netdev,
        return 0;
 }
 
-/* FIXME: is this right? -- CHS */
-static u32 atl1_get_rx_csum(struct net_device *netdev)
-{
-       return 1;
-}
-
 static void atl1_get_strings(struct net_device *netdev, u32 stringset,
        u8 *data)
 {
@@ -3668,13 +3667,9 @@ static const struct ethtool_ops atl1_ethtool_ops = {
        .set_ringparam          = atl1_set_ringparam,
        .get_pauseparam         = atl1_get_pauseparam,
        .set_pauseparam         = atl1_set_pauseparam,
-       .get_rx_csum            = atl1_get_rx_csum,
-       .set_tx_csum            = ethtool_op_set_tx_hw_csum,
        .get_link               = ethtool_op_get_link,
-       .set_sg                 = ethtool_op_set_sg,
        .get_strings            = atl1_get_strings,
        .nway_reset             = atl1_nway_reset,
        .get_ethtool_stats      = atl1_get_ethtool_stats,
        .get_sset_count         = atl1_get_sset_count,
-       .set_tso                = ethtool_op_set_tso,
 };
index 937ef1afa5db873397c821392153d1f5ebc3ff32..02761dd23fb83b037495a95b1a9c1e60e727ce9a 100644 (file)
@@ -1411,9 +1411,8 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
 
        err = -EIO;
 
-#ifdef NETIF_F_HW_VLAN_TX
+       netdev->hw_features = NETIF_F_SG;
        netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-#endif
 
        /* Init PHY as early as possible due to power saving issue  */
        atl2_phy_init(&adapter->hw);
@@ -1840,11 +1839,6 @@ static int atl2_set_settings(struct net_device *netdev,
        return 0;
 }
 
-static u32 atl2_get_tx_csum(struct net_device *netdev)
-{
-       return (netdev->features & NETIF_F_HW_CSUM) != 0;
-}
-
 static u32 atl2_get_msglevel(struct net_device *netdev)
 {
        return 0;
@@ -2112,12 +2106,6 @@ static const struct ethtool_ops atl2_ethtool_ops = {
        .get_eeprom_len         = atl2_get_eeprom_len,
        .get_eeprom             = atl2_get_eeprom,
        .set_eeprom             = atl2_set_eeprom,
-       .get_tx_csum            = atl2_get_tx_csum,
-       .get_sg                 = ethtool_op_get_sg,
-       .set_sg                 = ethtool_op_set_sg,
-#ifdef NETIF_F_TSO
-       .get_tso                = ethtool_op_get_tso,
-#endif
 };
 
 static void atl2_set_ethtool_ops(struct net_device *netdev)