[dpdk-dev,v2] i40e: fix ipv6 TSO issue for tx function

Message ID 1458703670-19898-1-git-send-email-zhe.tao@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Zhe Tao March 23, 2016, 3:27 a.m. UTC
  Issue:
when using the following CLI in testpmd to enable ipv6 TSO feature
  

Comments

Ananyev, Konstantin March 23, 2016, 12:46 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhe Tao
> Sent: Wednesday, March 23, 2016 3:28 AM
> To: dev@dpdk.org
> Cc: Tao, Zhe; Wu, Jingjing
> Subject: [dpdk-dev] [PATCH v2] i40e: fix ipv6 TSO issue for tx function
> 
> Issue:
> when using the following CLI in testpmd to enable ipv6 TSO feature
> =============
> set verbose 1
> csum set ip hw 0
> csum set udp hw 0
> csum set tcp hw 0
> csum set sctp hw 0
> csum set outer-ip hw 0
> csum parse_tunnel on 0
> tso set 800 0
> set fwd csum
> 
> start
> =============
> 
> We will not get we want, the ipv6 packets sent out from IXIA can be received by
> i40e, but cannot forward to another port.
> The root cause is when HW doing the TSO offload for packets, it not only depends
> on the context descriptor to define the MSS and TSO payload size, it also
> need to know whether this packets is ipv4 or ipv6, ipv4 need the header csum,
> but ipv6 doesn't need the csum. We need to use the i40e_txd_enable_checksum to
> set the ipv6 type flag into the data descriptor when the packets are for
> ipv6 TSO.
> 
> Fixes: e3f0151f (i40e: enable Tx checksum only for offloaded packets)
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
> v2: change condition check for ipv6 TSO checksum offload
>     use a more clear check method which include both ipv4 & ipv6 TSO
> 
> 
>  drivers/net/i40e/i40e_rxtx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 1488f2f..3422ec2 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -73,9 +73,16 @@
> 
>  #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
> 
> +/* need to add the TSO flag to the checksum offload mask
> + * even the packets like ipv6 doesn't need the checksum for ip header
> + * but the FW need to know whether this TCP packets is ipv4 or ipv6,
> + * so add this kind of information in the checksum offload field in the
> + * normal data descriptor.
> + */
>  #define I40E_TX_CKSUM_OFFLOAD_MASK (		 \
>  		PKT_TX_IP_CKSUM |		 \
>  		PKT_TX_L4_MASK |		 \
> +		PKT_TX_TCP_SEG |		 \
>  		PKT_TX_OUTER_IP_CKSUM)
> 
>  static uint16_t i40e_xmit_pkts_simple(void *tx_queue,
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.1.4
  
Bruce Richardson March 24, 2016, 2:58 p.m. UTC | #2
On Wed, Mar 23, 2016 at 11:27:50AM +0800, Zhe Tao wrote:
> Issue:
> when using the following CLI in testpmd to enable ipv6 TSO feature
> =============
> set verbose 1
> csum set ip hw 0
> csum set udp hw 0
> csum set tcp hw 0
> csum set sctp hw 0
> csum set outer-ip hw 0
> csum parse_tunnel on 0
> tso set 800 0
> set fwd csum
> 
> start
> =============
> 
> We will not get we want, the ipv6 packets sent out from IXIA can be received by
> i40e, but cannot forward to another port.
> The root cause is when HW doing the TSO offload for packets, it not only depends
> on the context descriptor to define the MSS and TSO payload size, it also
> need to know whether this packets is ipv4 or ipv6, ipv4 need the header csum,
> but ipv6 doesn't need the csum. We need to use the i40e_txd_enable_checksum to
> set the ipv6 type flag into the data descriptor when the packets are for
> ipv6 TSO.  
>  
> Fixes: e3f0151f (i40e: enable Tx checksum only for offloaded packets)
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
> v2: change condition check for ipv6 TSO checksum offload
>     use a more clear check method which include both ipv4 & ipv6 TSO
> 
> 
>  drivers/net/i40e/i40e_rxtx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 1488f2f..3422ec2 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -73,9 +73,16 @@
>  
>  #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
>  
> +/* need to add the TSO flag to the checksum offload mask
> + * even the packets like ipv6 doesn't need the checksum for ip header
> + * but the FW need to know whether this TCP packets is ipv4 or ipv6,
> + * so add this kind of information in the checksum offload field in the
> + * normal data descriptor.
> + */
>  #define I40E_TX_CKSUM_OFFLOAD_MASK (		 \
>  		PKT_TX_IP_CKSUM |		 \
>  		PKT_TX_L4_MASK |		 \
> +		PKT_TX_TCP_SEG |		 \
>  		PKT_TX_OUTER_IP_CKSUM)
>  
>  static uint16_t i40e_xmit_pkts_simple(void *tx_queue,
> -- 

To be honest, I'm a little confused by the patch description and the comment
added into the code. The commit message talks about flagging to the HW whether
a packet is IPv4 or IPv6. However, the change made is to add a TCP segmentation
bit to an offload mask - something that seems irrelevant to telling if something
is IPv4 or v6.

As for the comment itself. The comment reads like a commit message for a patch,
rather than as the comment on a macro. The comment talks exclusively about the
TSO part of the mask, and ignores the other values in it. It also suffers the
same problem as the commit message of not explaining how a TSO flag ties in
with identifying IPv4 or v6.

Could you please reword the commit message and rework the comment to be a proper
comment on the whole macro and resubmit the patch. 

Thanks,
/Bruce
  
Bruce Richardson March 24, 2016, 3 p.m. UTC | #3
On Wed, Mar 23, 2016 at 11:27:50AM +0800, Zhe Tao wrote:
> Issue:
> when using the following CLI in testpmd to enable ipv6 TSO feature
> =============
> set verbose 1
> csum set ip hw 0
> csum set udp hw 0
> csum set tcp hw 0
> csum set sctp hw 0
> csum set outer-ip hw 0
> csum parse_tunnel on 0
> tso set 800 0
> set fwd csum
> 
> start
> =============

The "===" lines in the message are confusing patchwork. For a new version of
this patch can you indent the commands rather than putting the "===" above and 
below. E.g.

 Issue:
 when using the following CLI in testpmd to enable ipv6 TSO feature

 	set verbose 1
 	csum set ip hw 0
 	csum set udp hw 0
	....

Thanks,
/Bruce
  
Zhe Tao March 31, 2016, 3:58 a.m. UTC | #4
On Thu, Mar 24, 2016 at 03:00:14PM +0000, Bruce Richardson wrote:
> On Wed, Mar 23, 2016 at 11:27:50AM +0800, Zhe Tao wrote:
> > Issue:
> > when using the following CLI in testpmd to enable ipv6 TSO feature
> > =============
> > set verbose 1
> > csum set ip hw 0
> > csum set udp hw 0
> > csum set tcp hw 0
> > csum set sctp hw 0
> > csum set outer-ip hw 0
> > csum parse_tunnel on 0
> > tso set 800 0
> > set fwd csum
> > 
> > start
> > =============
> 
> The "===" lines in the message are confusing patchwork. For a new version of
> this patch can you indent the commands rather than putting the "===" above and 
> below. E.g.
> 
>  Issue:
>  when using the following CLI in testpmd to enable ipv6 TSO feature
> 
>  	set verbose 1
>  	csum set ip hw 0
>  	csum set udp hw 0
> 	....
> 
> Thanks,
> /Bruce
very good advise, will send the new patch, thanks!
Zhe Tao
  

Patch

=============
set verbose 1
csum set ip hw 0
csum set udp hw 0
csum set tcp hw 0
csum set sctp hw 0
csum set outer-ip hw 0
csum parse_tunnel on 0
tso set 800 0
set fwd csum

start
=============

We will not get we want, the ipv6 packets sent out from IXIA can be received by
i40e, but cannot forward to another port.
The root cause is when HW doing the TSO offload for packets, it not only depends
on the context descriptor to define the MSS and TSO payload size, it also
need to know whether this packets is ipv4 or ipv6, ipv4 need the header csum,
but ipv6 doesn't need the csum. We need to use the i40e_txd_enable_checksum to
set the ipv6 type flag into the data descriptor when the packets are for
ipv6 TSO.  
 
Fixes: e3f0151f (i40e: enable Tx checksum only for offloaded packets)

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
v2: change condition check for ipv6 TSO checksum offload
    use a more clear check method which include both ipv4 & ipv6 TSO


 drivers/net/i40e/i40e_rxtx.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 1488f2f..3422ec2 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -73,9 +73,16 @@ 
 
 #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
 
+/* need to add the TSO flag to the checksum offload mask
+ * even the packets like ipv6 doesn't need the checksum for ip header
+ * but the FW need to know whether this TCP packets is ipv4 or ipv6,
+ * so add this kind of information in the checksum offload field in the
+ * normal data descriptor.
+ */
 #define I40E_TX_CKSUM_OFFLOAD_MASK (		 \
 		PKT_TX_IP_CKSUM |		 \
 		PKT_TX_L4_MASK |		 \
+		PKT_TX_TCP_SEG |		 \
 		PKT_TX_OUTER_IP_CKSUM)
 
 static uint16_t i40e_xmit_pkts_simple(void *tx_queue,