[v,4/4] net/hns3: add checking tso segsz when sending TSO packets

Message ID 1591176721-46875-5-git-send-email-xavier.huwei@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series bugfixes for hns3 PMD driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Wei Hu (Xavier) June 3, 2020, 9:32 a.m. UTC
  From: Hongbo Zheng <zhenghongbo3@huawei.com>

Base on hns3 network engine, when the rte_eth_tx_burst API is called
by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
process this packet as an non-TSO packet, otherwise hardware will enter
an abnormal state.

Fixes: 6dca716c9e1d ("net/hns3: support TSO")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Comments

Ferruh Yigit June 4, 2020, 4:56 p.m. UTC | #1
On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
> From: Hongbo Zheng <zhenghongbo3@huawei.com>
> 
> Base on hns3 network engine, when the rte_eth_tx_burst API is called
> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
> process this packet as an non-TSO packet, otherwise hardware will enter
> an abnormal state.

What is ULP (Upper Level Process)?

And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
set, shouldn't this needs to fixed in app level?

> 
> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>

<...>
  
Wei Hu (Xavier) June 5, 2020, 8:50 a.m. UTC | #2
On 2020/6/5 0:56, Ferruh Yigit wrote:
> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>
>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>> process this packet as an non-TSO packet, otherwise hardware will enter
>> an abnormal state.
> What is ULP (Upper Level Process)?
>
> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
> set, shouldn't this needs to fixed in app level?
ULP is our own test application.
The process is added to the driver to ensure If the upper application 
called the API
in the wrong way, it will still not cause serious abnormalities in 
network engine.

Thanks, Xavier
>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> <...>
>
>
  
Ferruh Yigit June 5, 2020, 9:44 a.m. UTC | #3
On 6/5/2020 9:50 AM, Wei Hu (Xavier) wrote:
> 
> 
> On 2020/6/5 0:56, Ferruh Yigit wrote:
>> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>
>>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>>> process this packet as an non-TSO packet, otherwise hardware will enter
>>> an abnormal state.
>> What is ULP (Upper Level Process)?
>>
>> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
>> set, shouldn't this needs to fixed in app level?
> ULP is our own test application.

OK. Is it open source?

> The process is added to the driver to ensure If the upper application 
> called the API
> in the wrong way, it will still not cause serious abnormalities in 
> network engine.
> 
> Thanks, Xavier
>>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> <...>
>>
>>
>
  
Wei Hu (Xavier) June 6, 2020, 1:06 a.m. UTC | #4
On 2020/6/5 17:44, Ferruh Yigit wrote:
> On 6/5/2020 9:50 AM, Wei Hu (Xavier) wrote:
>>
>> On 2020/6/5 0:56, Ferruh Yigit wrote:
>>> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>>>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>>
>>>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>>>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>>>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>>>> process this packet as an non-TSO packet, otherwise hardware will enter
>>>> an abnormal state.
>>> What is ULP (Upper Level Process)?
>>>
>>> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
>>> set, shouldn't this needs to fixed in app level?
>> ULP is our own test application.
> OK. Is it open source?
We have do some modification on the basis of the current DPDK test program,
as our own internal test program.
But it is not perfect enough, so there is not open source.

Thanks, Xavier
>> The process is added to the driver to ensure If the upper application
>> called the API
>> in the wrong way, it will still not cause serious abnormalities in
>> network engine.
>>
>> Thanks, Xavier
>>>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>> <...>
>>>
>>>
>
  

Patch

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index d870d51..2ce9bf4 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1850,6 +1850,12 @@  hns3_tso_proc_tunnel(struct hns3_desc *desc, uint64_t ol_flags,
 	return 0;
 }
 
+static inline bool
+hns3_pkt_is_tso(struct rte_mbuf *m)
+{
+	return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG);
+}
+
 static void
 hns3_set_tso(struct hns3_desc *desc,
 	     uint64_t ol_flags, struct rte_mbuf *rxm)
@@ -1858,7 +1864,7 @@  hns3_set_tso(struct hns3_desc *desc,
 	uint32_t tmp;
 	uint8_t l2_len = rxm->l2_len;
 
-	if (!(ol_flags & PKT_TX_TCP_SEG))
+	if (!hns3_pkt_is_tso(rxm))
 		return;
 
 	if (hns3_tso_proc_tunnel(desc, ol_flags, rxm, &l2_len))
@@ -2307,12 +2313,6 @@  hns3_outer_header_cksum_prepare(struct rte_mbuf *m)
 	}
 }
 
-static inline bool
-hns3_pkt_is_tso(struct rte_mbuf *m)
-{
-	return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG);
-}
-
 static int
 hns3_check_tso_pkt_valid(struct rte_mbuf *m)
 {