Author: np
Date: Wed Feb  5 00:13:15 2020
New Revision: 357553
URL: https://svnweb.freebsd.org/changeset/base/357553

Log:
  cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed by
  the hardware.
  
  hw.cxgbe.nm_txcsum=1
  
  MFC after:    2 weeks
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==============================================================================
--- head/sys/dev/cxgbe/t4_netmap.c      Wed Feb  5 00:08:58 2020        
(r357552)
+++ head/sys/dev/cxgbe/t4_netmap.c      Wed Feb  5 00:13:15 2020        
(r357553)
@@ -110,6 +110,16 @@ static int nm_split_rss = 0;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_split_rss, CTLFLAG_RWTUN,
     &nm_split_rss, 0, "Split the netmap rx queues into two groups.");
 
+/*
+ * netmap(4) says "netmap does not use features such as checksum offloading, 
TCP
+ * segmentation offloading, encryption, VLAN encapsulation/decapsulation, etc."
+ * but this knob can be used to get the hardware to checksum all tx traffic
+ * anyway.
+ */
+static int nm_txcsum = 0;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_txcsum, CTLFLAG_RWTUN,
+    &nm_txcsum, 0, "Enable transmit checksum offloading.");
+
 static int
 alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong)
 {
@@ -696,13 +706,8 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_
                        cpl->ctrl0 = nm_txq->cpl_ctrl0;
                        cpl->pack = 0;
                        cpl->len = htobe16(slot->len);
-                       /*
-                        * netmap(4) says "netmap does not use features such as
-                        * checksum offloading, TCP segmentation offloading,
-                        * encryption, VLAN encapsulation/decapsulation, etc."
-                        */
-                       cpl->ctrl1 = htobe64(F_TXPKT_IPCSUM_DIS |
-                           F_TXPKT_L4CSUM_DIS);
+                       cpl->ctrl1 = nm_txcsum ? 0 :
+                           htobe64(F_TXPKT_IPCSUM_DIS | F_TXPKT_L4CSUM_DIS);
 
                        usgl = (void *)(cpl + 1);
                        usgl->cmd_nsge = htobe32(V_ULPTX_CMD(ULP_TX_SC_DSGL) |
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to