DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/5] net/hns3: add some bugfix
@ 2024-04-03 10:16 Jie Hai
  2024-04-03 10:16 ` [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588 Jie Hai
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev; +Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui, haijie1

This patchset adds some bugfixes.

Dengdui Huang (4):
  net/hns3: fix offload flag of IEEE 1588
  net/hns3: fix read Rx timestamp handle
  net/hns3: fix double free for Rx/Tx queue
  net/hns3: fix variable overflow

Jie Hai (1):
  net/hns3: disable SCTP verification Tag for RSS hash input

 drivers/net/hns3/hns3_common.c |  2 +-
 drivers/net/hns3/hns3_rss.c    |  6 ++----
 drivers/net/hns3/hns3_rss.h    |  6 ++----
 drivers/net/hns3/hns3_rxtx.c   | 29 +++++++++++++++++++++--------
 4 files changed, 26 insertions(+), 17 deletions(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
@ 2024-04-03 10:16 ` Jie Hai
  2024-04-05 14:33   ` Patrick Robb
  2024-04-03 10:16 ` [PATCH 2/5] net/hns3: fix read Rx timestamp handle Jie Hai
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev, Yisen Zhuang, Min Hu (Connor)
  Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui, haijie1

From: Dengdui Huang <huangdengdui@huawei.com>

Currently, the RTE_MBUF_F_RX_IEEE1588_TMST offload flag will
not be set when the scatter algorithm is used.
This patch fixes it.

Fixes: 4801f0403b58 ("net/hns3: fix IEEE 1588 PTP for scalar scattered Rx")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 7e636a0a2e99..3e7dd1057940 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2669,6 +2669,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
 			continue;
 		}
 
+		first_seg->ol_flags = 0;
 		if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B)))
 			hns3_rx_ptp_timestamp_handle(rxq, first_seg, timestamp);
 
@@ -2698,7 +2699,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
 
 		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash);
-		first_seg->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
+		first_seg->ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
 		if (unlikely(bd_base_info & BIT(HNS3_RXD_LUM_B))) {
 			first_seg->hash.fdir.hi =
 				rte_le_to_cpu_16(rxd.rx.fd_id);
-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/5] net/hns3: fix read Rx timestamp handle
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
  2024-04-03 10:16 ` [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588 Jie Hai
@ 2024-04-03 10:16 ` Jie Hai
  2024-04-03 10:16 ` [PATCH 3/5] net/hns3: fix double free for Rx/Tx queue Jie Hai
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev, Yisen Zhuang, Min Hu (Connor)
  Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui, haijie1

From: Dengdui Huang <huangdengdui@huawei.com>

The flag RTE_MBUF_F_RX_IEEE1588_PTP depends on the packet
type and does not need to be set when reading Rx timestamp.

Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 3e7dd1057940..54bf724a0e6c 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2389,8 +2389,7 @@ hns3_rx_ptp_timestamp_handle(struct hns3_rx_queue *rxq, struct rte_mbuf *mbuf,
 {
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(rxq->hns);
 
-	mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP |
-			  RTE_MBUF_F_RX_IEEE1588_TMST;
+	mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_TMST;
 	if (hns3_timestamp_rx_dynflag > 0) {
 		*RTE_MBUF_DYNFIELD(mbuf, hns3_timestamp_dynfield_offset,
 			rte_mbuf_timestamp_t *) = timestamp;
-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] net/hns3: fix double free for Rx/Tx queue
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
  2024-04-03 10:16 ` [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588 Jie Hai
  2024-04-03 10:16 ` [PATCH 2/5] net/hns3: fix read Rx timestamp handle Jie Hai
@ 2024-04-03 10:16 ` Jie Hai
  2024-04-03 10:16 ` [PATCH 4/5] net/hns3: fix variable overflow Jie Hai
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev, Yisen Zhuang, Hao Chen, Wei Hu (Xavier), Min Wang (Jushui),
	Min Hu (Connor),
	Huisong Li
  Cc: fengchengwen, liuyonglong, huangdengdui, haijie1

From: Dengdui Huang <huangdengdui@huawei.com>

The Pointers to some resources on the Rx/Tx queue need to be set to NULL
after free inside the hns3_rx/tx_queue_release(), as this function is
called from multiple threads (reset thread, device config thread, etc),
leading to double memory free error.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 54bf724a0e6c..fbc5ef3225c5 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -86,9 +86,14 @@ hns3_rx_queue_release(void *queue)
 	struct hns3_rx_queue *rxq = queue;
 	if (rxq) {
 		hns3_rx_queue_release_mbufs(rxq);
-		if (rxq->mz)
+		if (rxq->mz) {
 			rte_memzone_free(rxq->mz);
-		rte_free(rxq->sw_ring);
+			rxq->mz = NULL;
+		}
+		if (rxq->sw_ring) {
+			rte_free(rxq->sw_ring);
+			rxq->sw_ring = NULL;
+		}
 		rte_free(rxq);
 	}
 }
@@ -99,10 +104,18 @@ hns3_tx_queue_release(void *queue)
 	struct hns3_tx_queue *txq = queue;
 	if (txq) {
 		hns3_tx_queue_release_mbufs(txq);
-		if (txq->mz)
+		if (txq->mz) {
 			rte_memzone_free(txq->mz);
-		rte_free(txq->sw_ring);
-		rte_free(txq->free);
+			txq->mz = NULL;
+		}
+		if (txq->sw_ring) {
+			rte_free(txq->sw_ring);
+			txq->sw_ring = NULL;
+		}
+		if (txq->free) {
+			rte_free(txq->free);
+			txq->free = NULL;
+		}
 		rte_free(txq);
 	}
 }
-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/5] net/hns3: fix variable overflow
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
                   ` (2 preceding siblings ...)
  2024-04-03 10:16 ` [PATCH 3/5] net/hns3: fix double free for Rx/Tx queue Jie Hai
@ 2024-04-03 10:16 ` Jie Hai
  2024-04-03 10:16 ` [PATCH 5/5] net/hns3: disable SCTP verification Tag for RSS hash input Jie Hai
  2024-04-18 22:57 ` [PATCH 0/5] net/hns3: add some bugfix Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev, Yisen Zhuang, Min Hu (Connor), Chengchang Tang
  Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui, haijie1

From: Dengdui Huang <huangdengdui@huawei.com>

the function strtoul() returns an unsigned long, which should
be received using the variable uint64_t.

Fixes: 2fc3e696a7f1 ("net/hns3: add runtime config for mailbox limit time")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 28c26b049cf9..5e6cdfdaa019 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -224,7 +224,7 @@ hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args)
 static int
 hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args)
 {
-	uint32_t val;
+	uint64_t val;
 
 	RTE_SET_USED(key);
 
-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] net/hns3: disable SCTP verification Tag for RSS hash input
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
                   ` (3 preceding siblings ...)
  2024-04-03 10:16 ` [PATCH 4/5] net/hns3: fix variable overflow Jie Hai
@ 2024-04-03 10:16 ` Jie Hai
  2024-04-18 22:57 ` [PATCH 0/5] net/hns3: add some bugfix Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Jie Hai @ 2024-04-03 10:16 UTC (permalink / raw)
  To: dev, Yisen Zhuang
  Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui, haijie1

When the symmetric RSS algorithm is used, the same packet is
expected to be hashed to the same queue in the upstream and
downstream directions.

The problem is that it could map the packets in the same SCTP
connection to different NIC RX queues depending on the direction
of packets. This is because the verification Tag is used as the
RSS hash input for the SCTP packets, and the value depends on the
peer end of the SCTP connection and could not be symmetrically
used in the hardware-implemented RSS algorithm.

In addition, the ethdev framework doesn't support setting SCTP
V-tag as the RSS hash input. So disable it for all RSS hash
algorithms.

Cc: stable@dpdk.org

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/hns3/hns3_rss.c | 6 ++----
 drivers/net/hns3/hns3_rss.h | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 15feb26043af..3eae4caf52a2 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -153,8 +153,7 @@ static const struct {
 	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) |
 	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) |
 	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) |
-	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) |
-	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER),
+	  BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D),
 	  HNS3_RSS_TUPLE_IPV4_SCTP_M },
 
 	/* IPV6-FRAG */
@@ -274,8 +273,7 @@ static const struct {
 	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) |
 	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) |
 	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) |
-	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) |
-	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER),
+	  BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S),
 	  HNS3_RSS_TUPLE_IPV6_SCTP_M },
 };
 
diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h
index 9d182a8025c5..0755760b4513 100644
--- a/drivers/net/hns3/hns3_rss.h
+++ b/drivers/net/hns3/hns3_rss.h
@@ -49,7 +49,6 @@ enum hns3_tuple_field {
 	HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S,
 	HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D,
 	HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S,
-	HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER,
 
 	/* IPV4 ENABLE FIELD */
 	HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D = 24,
@@ -74,7 +73,6 @@ enum hns3_tuple_field {
 	HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S,
 	HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D,
 	HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S,
-	HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER,
 
 	/* IPV6 ENABLE FIELD */
 	HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D = 56,
@@ -96,12 +94,12 @@ enum hns3_tuple_field {
 
 #define HNS3_RSS_TUPLE_IPV4_TCP_M	GENMASK(3, 0)
 #define HNS3_RSS_TUPLE_IPV4_UDP_M	GENMASK(11, 8)
-#define HNS3_RSS_TUPLE_IPV4_SCTP_M	GENMASK(20, 16)
+#define HNS3_RSS_TUPLE_IPV4_SCTP_M	GENMASK(19, 16)
 #define HNS3_RSS_TUPLE_IPV4_NONF_M	GENMASK(25, 24)
 #define HNS3_RSS_TUPLE_IPV4_FLAG_M	GENMASK(27, 26)
 #define HNS3_RSS_TUPLE_IPV6_TCP_M	GENMASK(35, 32)
 #define HNS3_RSS_TUPLE_IPV6_UDP_M	GENMASK(43, 40)
-#define HNS3_RSS_TUPLE_IPV6_SCTP_M	GENMASK(52, 48)
+#define HNS3_RSS_TUPLE_IPV6_SCTP_M	GENMASK(51, 48)
 #define HNS3_RSS_TUPLE_IPV6_NONF_M	GENMASK(57, 56)
 #define HNS3_RSS_TUPLE_IPV6_FLAG_M	GENMASK(59, 58)
 
-- 
2.30.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588
  2024-04-03 10:16 ` [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588 Jie Hai
@ 2024-04-05 14:33   ` Patrick Robb
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Robb @ 2024-04-05 14:33 UTC (permalink / raw)
  To: Jie Hai
  Cc: dev, Yisen Zhuang, Min Hu (Connor),
	lihuisong, fengchengwen, liuyonglong, huangdengdui

Recheck-request: iol-intel-Functional, iol-intel-Performance

On Wed, Apr 3, 2024 at 6:21 AM Jie Hai <haijie1@huawei.com> wrote:
>
> From: Dengdui Huang <huangdengdui@huawei.com>
>
> Currently, the RTE_MBUF_F_RX_IEEE1588_TMST offload flag will
> not be set when the scatter algorithm is used.
> This patch fixes it.
>
> Fixes: 4801f0403b58 ("net/hns3: fix IEEE 1588 PTP for scalar scattered Rx")
> Cc: stable@dpdk.org
>
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
>  drivers/net/hns3/hns3_rxtx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
> index 7e636a0a2e99..3e7dd1057940 100644
> --- a/drivers/net/hns3/hns3_rxtx.c
> +++ b/drivers/net/hns3/hns3_rxtx.c
> @@ -2669,6 +2669,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
>                         continue;
>                 }
>
> +               first_seg->ol_flags = 0;
>                 if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B)))
>                         hns3_rx_ptp_timestamp_handle(rxq, first_seg, timestamp);
>
> @@ -2698,7 +2699,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
>
>                 first_seg->port = rxq->port_id;
>                 first_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash);
> -               first_seg->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
> +               first_seg->ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
>                 if (unlikely(bd_base_info & BIT(HNS3_RXD_LUM_B))) {
>                         first_seg->hash.fdir.hi =
>                                 rte_le_to_cpu_16(rxd.rx.fd_id);
> --
> 2.30.0
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/5] net/hns3: add some bugfix
  2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
                   ` (4 preceding siblings ...)
  2024-04-03 10:16 ` [PATCH 5/5] net/hns3: disable SCTP verification Tag for RSS hash input Jie Hai
@ 2024-04-18 22:57 ` Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2024-04-18 22:57 UTC (permalink / raw)
  To: Jie Hai, dev; +Cc: lihuisong, fengchengwen, liuyonglong, huangdengdui

On 4/3/2024 11:16 AM, Jie Hai wrote:
> This patchset adds some bugfixes.
> 
> Dengdui Huang (4):
>   net/hns3: fix offload flag of IEEE 1588
>   net/hns3: fix read Rx timestamp handle
>   net/hns3: fix double free for Rx/Tx queue
>   net/hns3: fix variable overflow
> 
> Jie Hai (1):
>   net/hns3: disable SCTP verification Tag for RSS hash input
>

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-18 22:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 10:16 [PATCH 0/5] net/hns3: add some bugfix Jie Hai
2024-04-03 10:16 ` [PATCH 1/5] net/hns3: fix offload flag of IEEE 1588 Jie Hai
2024-04-05 14:33   ` Patrick Robb
2024-04-03 10:16 ` [PATCH 2/5] net/hns3: fix read Rx timestamp handle Jie Hai
2024-04-03 10:16 ` [PATCH 3/5] net/hns3: fix double free for Rx/Tx queue Jie Hai
2024-04-03 10:16 ` [PATCH 4/5] net/hns3: fix variable overflow Jie Hai
2024-04-03 10:16 ` [PATCH 5/5] net/hns3: disable SCTP verification Tag for RSS hash input Jie Hai
2024-04-18 22:57 ` [PATCH 0/5] net/hns3: add some bugfix Ferruh Yigit

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).