em: Change TXCSUM does not require reinitialize hardware
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 15 Aug 2012 02:37:44 +0000 (10:37 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 15 Aug 2012 02:37:44 +0000 (10:37 +0800)
sys/dev/netif/em/if_em.c

index f82e8b9..b4a3442 100644 (file)
@@ -1111,10 +1111,17 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr)
        case SIOCSIFCAP:
                reinit = 0;
                mask = ifr->ifr_reqcap ^ ifp->if_capenable;
        case SIOCSIFCAP:
                reinit = 0;
                mask = ifr->ifr_reqcap ^ ifp->if_capenable;
-               if (mask & IFCAP_HWCSUM) {
-                       ifp->if_capenable ^= (mask & IFCAP_HWCSUM);
+               if (mask & IFCAP_RXCSUM) {
+                       ifp->if_capenable ^= IFCAP_RXCSUM;
                        reinit = 1;
                }
                        reinit = 1;
                }
+               if (mask & IFCAP_TXCSUM) {
+                       ifp->if_capenable ^= IFCAP_TXCSUM;
+                       if (ifp->if_capenable & IFCAP_TXCSUM)
+                               ifp->if_hwassist |= EM_CSUM_FEATURES;
+                       else
+                               ifp->if_hwassist &= ~EM_CSUM_FEATURES;
+               }
                if (mask & IFCAP_VLAN_HWTAGGING) {
                        ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
                        reinit = 1;
                if (mask & IFCAP_VLAN_HWTAGGING) {
                        ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
                        reinit = 1;
@@ -1292,12 +1299,6 @@ em_init(void *xsc)
                E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
        }
 
                E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
        }
 
-       /* Set hardware offload abilities */
-       if (ifp->if_capenable & IFCAP_TXCSUM)
-               ifp->if_hwassist = EM_CSUM_FEATURES;
-       else
-               ifp->if_hwassist = 0;
-
        /* Configure for OS presence */
        em_get_mgmt(adapter);
 
        /* Configure for OS presence */
        em_get_mgmt(adapter);