patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [PATCH 3/8] net/txgbe: fix packet type to parse from offload flags
Date: Wed, 1 Feb 2023 10:41:00 +0000	[thread overview]
Message-ID: <16ff4010-0b0a-4f4d-e328-bb3710895e03@amd.com> (raw)
In-Reply-To: <027501d935eb$50bdc120$f2394360$@trustnetic.com>

On 2/1/2023 3:14 AM, Jiawen Wu wrote:
> On Friday, January 27, 2023 11:37 PM, Ferruh Yigit wrote:
>> On 1/18/2023 6:00 AM, Jiawen Wu wrote:
>>> In some external applications, developers may fill in wrong
>>> packet_type in rte_mbuf for transmission. It will result in Tx ring
>>> hang when Tx checksum offload is on. So change it to parse from ol_flags.
>>>
>>
>> Can you please give more information on what packet_type value is causing
>> problem in Tx path?
>>
>>> Fixes: ca46fcd753b1 ("net/txgbe: support Tx with hardware offload")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
>>> ---
>>>  drivers/net/txgbe/txgbe_rxtx.c | 19 ++++++++++++++-----
>>>  1 file changed, 14 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/net/txgbe/txgbe_rxtx.c
>>> b/drivers/net/txgbe/txgbe_rxtx.c index ae70ca3beb..e91aaf60ef 100644
>>> --- a/drivers/net/txgbe/txgbe_rxtx.c
>>> +++ b/drivers/net/txgbe/txgbe_rxtx.c
>>> @@ -516,20 +516,21 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags)
>>>  	return cmdtype;
>>>  }
>>>
>>> -static inline uint8_t
>>> -tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype)
>>> +static inline uint32_t
>>> +tx_desc_ol_flags_to_ptype(uint64_t oflags)
>>>  {
>>> +	uint32_t ptype;
>>>  	bool tun;
>>>
>>> -	if (ptype)
>>> -		return txgbe_encode_ptype(ptype);
>>> -
>>>  	/* Only support flags in TXGBE_TX_OFFLOAD_MASK */
>>>  	tun = !!(oflags & RTE_MBUF_F_TX_TUNNEL_MASK);
>>>
>>>  	/* L2 level */
>>>  	ptype = RTE_PTYPE_L2_ETHER;
>>>  	if (oflags & RTE_MBUF_F_TX_VLAN)
>>> +		ptype |= (tun ? RTE_PTYPE_INNER_L2_ETHER_VLAN :
>>> +RTE_PTYPE_L2_ETHER_VLAN);
>>> +
>>> +	if (oflags & RTE_MBUF_F_TX_QINQ) //tun + qinq is not supported
>>
>> checkpatch is complaining about c99 comment syntax ('//').
>>
>>>  		ptype |= RTE_PTYPE_L2_ETHER_VLAN;
>>>
>>>  	/* L3 level */
>>> @@ -587,6 +588,14 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags,
>>> uint32_t ptype)
>>>  		break;
>>>  	}
>>>
>>> +	return ptype;
>>> +}
>>> +
>>> +static inline uint8_t
>>> +tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) {
>>> +	ptype = tx_desc_ol_flags_to_ptype(oflags);
>>> +
>>
>> This function get 'ptype' as parameter and immediately overwrites is with
>> calculated value, what is the point of getting 'ptype' as argument.
>>
>>>  	return txgbe_encode_ptype(ptype);
>>>  }
>>>
>>
>> Overall why 'ptype' is calculated for Tx path, I see this value is used to see if it is
>> tunneled packet or not, is there any other usage of ptype in this path? If not why
>> parse all packet types?
>>
> 
> If Tx checksum offload or TSO is on, a context descriptor is needed for our hardware, which contains the length of each packet layer and the packet type.
> If the packet type and length do not strictly match, it will cause Tx ring hang. It's not just for tunnel packets. But most cases are caused by developers encap/decap at the application layer.
> However, we can flexibly set the packet type. For example, if there is no inner checksum for a VXLAN packet, we can only regard it as a UDP packet.
> 
> 

Thanks for clarification, can you please expand commit log with above
information in next version.


  reply	other threads:[~2023-02-01 10:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230118060039.3074016-1-jiawenwu@trustnetic.com>
2023-01-18  6:00 ` [PATCH 1/8] net/txgbe: fix Rx buffer size in configure register Jiawen Wu
2023-01-27 15:36   ` Ferruh Yigit
2023-02-01  2:34     ` Jiawen Wu
2023-02-01 10:40       ` Ferruh Yigit
2023-01-18  6:00 ` [PATCH 2/8] net/txgbe: fix default signal quality value for KX/KX4 Jiawen Wu
2023-01-18  6:00 ` [PATCH 3/8] net/txgbe: fix packet type to parse from offload flags Jiawen Wu
2023-01-27 15:36   ` Ferruh Yigit
2023-02-01  3:14     ` Jiawen Wu
2023-02-01 10:41       ` Ferruh Yigit [this message]
2023-01-18  6:00 ` [PATCH 4/8] net/ngbe: " Jiawen Wu
2023-01-27 15:37   ` Ferruh Yigit
2023-01-18  6:00 ` [PATCH 5/8] net/ngbe: add spinlock protection on YT PHY Jiawen Wu
     [not found] ` <20230202092132.3271910-1-jiawenwu@trustnetic.com>
2023-02-02  9:21   ` [PATCH v2 01/10] net/ngbe: fix Rx buffer size in configure register Jiawen Wu
2023-02-08 10:28     ` Ferruh Yigit
2023-02-09  9:00       ` Jiawen Wu
2023-02-14  8:15         ` Jiawen Wu
2023-02-14  9:55           ` Ferruh Yigit
2023-02-15  9:35             ` Ferruh Yigit
2023-02-15 10:09               ` Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 02/10] net/txgbe: " Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 03/10] net/txgbe: fix default signal quality value for KX/KX4 Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 04/10] net/txgbe: fix packet type to parse from offload flags Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 05/10] net/ngbe: " Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 06/10] net/ngbe: add spinlock protection on YT PHY Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 09/10] net/txgbe: fix interrupt loss Jiawen Wu
2023-02-15  2:00 ` [PATCH v3] net/txgbe: fix Rx buffer size in configure register Jiawen Wu
2023-02-15 10:24   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16ff4010-0b0a-4f4d-e328-bb3710895e03@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).