Re: svn commit: r357553 - head/sys/dev/cxgbe

2020-02-05 Thread Navdeep Parhar
On 2/5/20 3:19 AM, Slawa Olhovchenkov wrote:
> On Wed, Feb 05, 2020 at 12:13:15AM +, Navdeep Parhar wrote:
> 
>> 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
> 
> Very interesting.
> Please, describe some more detail about using this feture (for
> example, set this before driver loading? first netmap open? any netmap
> open? on the fly?)
> 

If you set this to 1 then all netmap Tx traffic that is recognized as
valid TCP/UDP on IP/IPv6 by the chip will get L3 and L4 checksums
inserted in proper places automatically.  This means a netmap
application trying to send legitimate traffic doesn't have to calculate
checksums in software.

It is safe to change this at any time and it will take effect immediately.

netmap(4) says that hw checksum should be disabled on the interface but
cxgbe has always had a way to bypass this.  It used to be via the normal
csum capabilities of the interface but those sometimes caused confusion
because they aren't supposed to be set with netmap so r355673 removed
netmap tx checksumming.  This rev brought it back with a driver-specific
knob.

Regards,
Navdeep
___
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"


Re: svn commit: r357553 - head/sys/dev/cxgbe

2020-02-05 Thread Slawa Olhovchenkov
On Wed, Feb 05, 2020 at 12:13:15AM +, Navdeep Parhar wrote:

> 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

Very interesting.
Please, describe some more detail about using this feture (for
example, set this before driver loading? first netmap open? any netmap
open? on the fly?)
___
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"


svn commit: r357553 - head/sys/dev/cxgbe

2020-02-04 Thread Navdeep Parhar
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,
 _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,
+_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"