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

Tested with..
stge0 at pci0 dev 3 function 0 "D-Link DGE-550T" rev 0x07


Index: if_stge.c
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_stge.c,v
retrieving revision 1.54
diff -u -p -r1.54 if_stge.c
--- if_stge.c   18 Oct 2012 21:44:21 -0000      1.54
+++ if_stge.c   4 Nov 2012 06:35:01 -0000
@@ -376,7 +376,8 @@ stge_attach(struct device *parent, struc
        IFQ_SET_MAXLEN(&ifp->if_snd, STGE_NTXDESC - 1);
        IFQ_SET_READY(&ifp->if_snd);
 
-       ifp->if_capabilities = IFCAP_VLAN_MTU;
+       ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
+           IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
 
 #if NVLAN > 0
        ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
@@ -399,14 +400,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.
         */
@@ -556,7 +549,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.
@@ -568,7 +560,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