Here is a diff to enable the checksum offload support for stge(4).

Looking for any testing.


Index: if_stge.c
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_stge.c,v
retrieving revision 1.55
diff -u -p -r1.55 if_stge.c
--- if_stge.c   7 Aug 2013 01:06:38 -0000       1.55
+++ if_stge.c   14 Aug 2013 04:08:45 -0000
@@ -377,6 +377,12 @@ stge_attach(struct device *parent, struc
 
        ifp->if_capabilities = IFCAP_VLAN_MTU;
 
+       /* Revision B3 and earlier chips have a checksum bug. */
+       if (sc->sc_rev >= 0x0c) {
+               ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 |
+                   IFCAP_CSUM_UDPv4;
+       }
+
 #if NVLAN > 0
        ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
 #endif
@@ -398,14 +404,6 @@ stge_attach(struct device *parent, struc
                sc->sc_DMACtrl |= DMAC_MWIDisable;
 #endif
 
-#ifdef STGE_CHECKSUM
-       /*
-        * We can do IPv4/TCPv4/UDPv4 checksums in hardware.
-        */
-       sc->sc_arpcom.ac_if.if_capabilities |= IFCAP_CSUM_IPv4 |
-           IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
-#endif
-
        /*
         * Attach the interface.
         */
@@ -555,7 +553,6 @@ stge_start(struct ifnet *ifp)
                        totlen += dmamap->dm_segs[seg].ds_len;
                }
 
-#ifdef STGE_CHECKSUM
                /*
                 * Initialize checksumming flags in the descriptor.
                 * Byte-swap constants so the compiler can optimize.
@@ -567,7 +564,6 @@ stge_start(struct ifnet *ifp)
                        csum_flags |= TFD_TCPChecksumEnable;
                else if (m0->m_pkthdr.csum_flags & M_UDP_CSUM_OUT)
                        csum_flags |= TFD_UDPChecksumEnable;
-#endif
 
                /*
                 * Initialize the descriptor and give it to the chip.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to