Re: em(4): enable checksum offload

2013-09-19 Thread Christian Weisgerber
Brad Smith b...@comstyle.com wrote:

   Since I have been asked to send out these diffs again here is a diff
 to enable
   the checksum offload support for em(4).
  
   Looking for any testing.
  
  tx checksum offloading will not work on 75, 76, 80, i350.
  
 Oh yes, you're right. The same exclusion logic should have been
 propagated from the HW VLAN tagging/stripping code.
-snip-

Works for me on 82540EM, 82574L, 82579LM, and doesn't harm the I350.
If there are subtle issues, we won't find them without putting
things out in -current.

ok naddy@

-- 
Christian naddy Weisgerber  na...@mips.inka.de



em(4): enable checksum offload

2013-09-09 Thread Brad Smith
Since I have been asked to send out these diffs again here is a diff to enable
the checksum offload support for em(4).

Looking for any testing.


Index: if_em.c
===
RCS file: /home/cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.269
diff -u -p -r1.269 if_em.c
--- if_em.c 27 Jan 2013 04:18:02 -  1.269
+++ if_em.c 9 Sep 2013 18:33:45 -
@@ -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,8 @@ 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
+   ifp-if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
 
/* 
 * Specify the media types supported by this adapter and register
@@ -2275,7 +2267,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 +2347,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.



Re: em(4): enable checksum offload

2013-09-09 Thread Brad Smith
On Mon, Sep 09, 2013 at 10:08:52PM +0200, Mike Belopuhov wrote:
 On 9 September 2013 21:44, Brad Smith b...@comstyle.com wrote:
  Since I have been asked to send out these diffs again here is a diff to 
  enable
  the checksum offload support for em(4).
 
  Looking for any testing.
 
 
 
 tx checksum offloading will not work on 75, 76, 80, i350.
 
Oh yes, you're right. The same exclusion logic should have been
propagated from the HW VLAN tagging/stripping code.
 

Index: if_em.c
===
RCS file: /home/cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.269
diff -u -p -r1.269 if_em.c
--- if_em.c 27 Jan 2013 04:18:02 -  1.269
+++ if_em.c 9 Sep 2013 21:14:21 -
@@ -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,11 @@ 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)
+   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)
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 +1848,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 +2269,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 +2349,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.



Re: em(4): enable checksum offload

2013-09-09 Thread Mike Belopuhov
On 9 September 2013 21:44, Brad Smith b...@comstyle.com wrote:
 Since I have been asked to send out these diffs again here is a diff to enable
 the checksum offload support for em(4).

 Looking for any testing.



tx checksum offloading will not work on 75, 76, 80, i350.