On Sat, Nov 03, 2012 at 09:49:02PM +0000, Christian Weisgerber wrote:
> Like bge(4), we previously couldn't enable TCP/UDP transmit checksum
> offload on em(4).  We can now.
> 
> Works fine here on
>   em0 at pci1 dev 1 function 0 "Intel PRO/1000MT (82540EM)" rev 0x02
> and with VLAN on
>   em0 at pci5 dev 0 function 0 "Intel PRO/1000 MT (82574L)" rev 0x00
> 
> Does anybody see any value in keeping the #ifdef around?

Updated diff to disable with hw with known broken driver support.


Index: if_em.c
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.267
diff -u -p -r1.267 if_em.c
--- if_em.c     16 Aug 2012 09:31:53 -0000      1.267
+++ if_em.c     4 Nov 2012 14:20:30 -0000
@@ -211,10 +211,8 @@ int  em_rxfill(struct em_softc *);
 void em_rxeof(struct em_softc *);
 void em_receive_checksum(struct em_softc *, struct em_rx_desc *,
                         struct mbuf *);
-#ifdef EM_CSUM_OFFLOAD
 void em_transmit_checksum_setup(struct em_softc *, struct mbuf *,
                                u_int32_t *, u_int32_t *);
-#endif
 void em_iff(struct em_softc *);
 #ifdef EM_DEBUG
 void em_print_hw_stats(struct em_softc *);
@@ -1121,14 +1119,10 @@ em_encap(struct em_softc *sc, struct mbu
        if (map->dm_nsegs > sc->num_tx_desc_avail - 2)
                goto fail;
 
-#ifdef EM_CSUM_OFFLOAD
        if (sc->hw.mac_type >= em_82543)
                em_transmit_checksum_setup(sc, m_head, &txd_upper, &txd_lower);
        else
                txd_upper = txd_lower = 0;
-#else
-       txd_upper = txd_lower = 0;
-#endif
 
        i = sc->next_avail_tx_desc;
        if (sc->pcix_82544)
@@ -1853,10 +1847,9 @@ em_setup_interface(struct em_softc *sc)
                ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
 #endif
 
-#ifdef EM_CSUM_OFFLOAD
-       if (sc->hw.mac_type >= em_82543)
-               ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;
-#endif
+       if (sc->hw.mac_type >= em_82543 && sc->hw.mac_type != em_82575 &&
+           sc->hw.mac_type != em_82580 && sc->hw.mac_type != em_i350)
+               ifp->if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
 
        /* 
         * Specify the media types supported by this adapter and register
@@ -2275,7 +2268,6 @@ em_free_transmit_structures(struct em_so
                sc->txtag = NULL;
 }
 
-#ifdef EM_CSUM_OFFLOAD
 /*********************************************************************
  *
  *  The offload context needs to be set when we transfer the first
@@ -2356,7 +2348,6 @@ em_transmit_checksum_setup(struct em_sof
        sc->num_tx_desc_avail--;
        sc->next_avail_tx_desc = curr_txd;
 }
-#endif /* EM_CSUM_OFFLOAD */
 
 /**********************************************************************
  *

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

Reply via email to