igb: Change TXCSUM does not require reinitialize hardware
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 2 Aug 2012 11:59:27 +0000 (19:59 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 2 Aug 2012 11:59:27 +0000 (19:59 +0800)
sys/dev/netif/igb/if_igb.c

index a3d695c..705ae37 100644 (file)
@@ -807,14 +807,21 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr)
        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;
                }
                if (mask & IFCAP_VLAN_HWTAGGING) {
                        ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
                        reinit = 1;
                }
+               if (mask & IFCAP_TXCSUM) {
+                       ifp->if_capenable ^= IFCAP_TXCSUM;
+                       if (ifp->if_capenable & IFCAP_TXCSUM)
+                               ifp->if_hwassist |= IGB_CSUM_FEATURES;
+                       else
+                               ifp->if_hwassist &= ~IGB_CSUM_FEATURES;
+               }
                if (mask & IFCAP_RSS)
                        ifp->if_capenable ^= IFCAP_RSS;
                if (reinit && (ifp->if_flags & IFF_RUNNING))
@@ -851,12 +858,6 @@ igb_init(void *xsc)
 
        E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN);
 
-       /* Set hardware offload abilities */
-       if (ifp->if_capenable & IFCAP_TXCSUM)
-               ifp->if_hwassist = IGB_CSUM_FEATURES;
-       else
-               ifp->if_hwassist = 0;
-
        /* Configure for OS presence */
        igb_get_mgmt(sc);