]> bbs.cooldavid.org Git - jme.git/commitdiff
net: Fix too optimistic NETIF_F_HW_CSUM features
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Tue, 30 Nov 2010 06:38:00 +0000 (06:38 +0000)
committerGuo-Fu Tseng <cooldavid@cooldavid.org>
Tue, 14 Dec 2010 16:02:52 +0000 (00:02 +0800)
NETIF_F_HW_CSUM is a superset of NETIF_F_IP_CSUM+NETIF_F_IPV6_CSUM, but
some drivers miss the difference. Fix this and also fix UFO dependency
on checksumming offload as it makes the same mistake in assumptions.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
jme.c
jme.h

diff --git a/jme.c b/jme.c
index 5e83dd82850a85303f7c98e8ac3c99155a72402d..2dd1ac7ba34a5ea797cfba23d0a817a72734218a 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -2150,21 +2150,13 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
        }
 
        if (new_mtu > 1900) {
-               netdev->features &= ~(NETIF_F_HW_CSUM |
-                               NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               );
+               netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+                               NETIF_F_TSO | NETIF_F_TSO6);
        } else {
                if (test_bit(JME_FLAG_TXCSUM, &jme->flags))
-                       netdev->features |= NETIF_F_HW_CSUM;
+                       netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
                if (test_bit(JME_FLAG_TSO, &jme->flags))
-                       netdev->features |= NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               ;
+                       netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
        }
 
        netdev->mtu = new_mtu;
@@ -2613,10 +2605,12 @@ jme_set_tx_csum(struct net_device *netdev, u32 on)
        if (on) {
                set_bit(JME_FLAG_TXCSUM, &jme->flags);
                if (netdev->mtu <= 1900)
-                       netdev->features |= NETIF_F_HW_CSUM;
+                       netdev->features |=
+                               NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
        } else {
                clear_bit(JME_FLAG_TXCSUM, &jme->flags);
-               netdev->features &= ~NETIF_F_HW_CSUM;
+               netdev->features &=
+                               ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
        }
 
        return 0;
@@ -2630,18 +2624,10 @@ jme_set_tso(struct net_device *netdev, u32 on)
        if (on) {
                set_bit(JME_FLAG_TSO, &jme->flags);
                if (netdev->mtu <= 1900)
-                       netdev->features |= NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               ;
+                       netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
        } else {
                clear_bit(JME_FLAG_TSO, &jme->flags);
-               netdev->features &= ~(NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               );
+               netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
        }
 
        return 0;
@@ -2949,12 +2935,11 @@ jme_init_one(struct pci_dev *pdev,
 #endif
        netdev->ethtool_ops             = &jme_ethtool_ops;
        netdev->watchdog_timeo          = TX_TIMEOUT;
-       netdev->features                =       NETIF_F_HW_CSUM |
+       netdev->features                =       NETIF_F_IP_CSUM |
+                                               NETIF_F_IPV6_CSUM |
                                                NETIF_F_SG |
                                                NETIF_F_TSO |
-#ifdef NETIF_F_TSO6
                                                NETIF_F_TSO6 |
-#endif
                                                NETIF_F_HW_VLAN_TX |
                                                NETIF_F_HW_VLAN_RX;
        if (using_dac)
diff --git a/jme.h b/jme.h
index 7eed87058496f0b9b580098ee54115d101daf5c8..531a1f12aab8c8a67e07a0937e4b5772aa48d588 100644 (file)
--- a/jme.h
+++ b/jme.h
@@ -100,6 +100,13 @@ do {                                                                       \
        msg_ ## type(priv, fmt, ## args)
 #endif
 
+#ifndef NETIF_F_TSO6
+#define NETIF_F_TSO6 0
+#endif
+#ifndef NETIF_F_IPV6_CSUM
+#define NETIF_F_IPV6_CSUM 0
+#endif
+
 /*
  * Extra PCI Configuration space interface
  */