DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] fix meta data process problem
@ 2024-02-20  8:14 Chaoyong He
  2024-02-20  8:14 ` [PATCH 1/2] net/nfp: fix meta data process problem of NFD3 Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chaoyong He @ 2024-02-20  8:14 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

The Tx function can not check if the meta data process success for
the process function with void return type. This problem exist for
both NFD3 and NFDk logic.

Chaoyong He (2):
  net/nfp: fix meta data process problem of NFD3
  net/nfp: fix meta data process problem of NFDk

 drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 19 +++++++++++++------
 drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 27 ++++++++++++++++++---------
 2 files changed, 31 insertions(+), 15 deletions(-)

-- 
2.39.1


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

* [PATCH 1/2] net/nfp: fix meta data process problem of NFD3
  2024-02-20  8:14 [PATCH 0/2] fix meta data process problem Chaoyong He
@ 2024-02-20  8:14 ` Chaoyong He
  2024-02-20  8:14 ` [PATCH 2/2] net/nfp: fix meta data process problem of NFDk Chaoyong He
  2024-02-21 17:07 ` [PATCH 0/2] fix meta data process problem Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-02-20  8:14 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, peng.zhang, stable, Long Wu

The Tx function can not check if the meta data process success for
the process function with void return type.

Fix it by change the return type of the meata data function from
void to integer and add the error handle logic in the Tx function.

Fixes: 962791ba6804 ("net/nfp: support VLAN insert with NFD3")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
index ee120f55ab..be31f4ac33 100644
--- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
+++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
@@ -142,7 +142,7 @@ nfp_net_nfd3_tx_vlan(struct nfp_net_txq *txq,
 	}
 }
 
-static inline void
+static inline int
 nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data,
 		struct nfp_net_txq *txq,
 		struct rte_mbuf *pkt)
@@ -177,7 +177,7 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data,
 	}
 
 	if (meta_data->length == 0)
-		return;
+		return 0;
 
 	meta_info = meta_data->header;
 	meta_data->header = rte_cpu_to_be_32(meta_data->header);
@@ -191,15 +191,16 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data,
 		case NFP_NET_META_VLAN:
 			if (vlan_layer > 0) {
 				PMD_DRV_LOG(ERR, "At most 1 layers of vlan is supported");
-				return;
+				return -EINVAL;
 			}
+
 			nfp_net_set_meta_vlan(meta_data, pkt, layer);
 			vlan_layer++;
 			break;
 		case NFP_NET_META_IPSEC:
 			if (ipsec_layer > 2) {
 				PMD_DRV_LOG(ERR, "At most 3 layers of ipsec is supported for now.");
-				return;
+				return -EINVAL;
 			}
 
 			nfp_net_set_meta_ipsec(meta_data, txq, pkt, layer, ipsec_layer);
@@ -207,11 +208,13 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data,
 			break;
 		default:
 			PMD_DRV_LOG(ERR, "The metadata type not supported");
-			return;
+			return -ENOTSUP;
 		}
 
 		memcpy(meta, &meta_data->data[layer], sizeof(meta_data->data[layer]));
 	}
+
+	return 0;
 }
 
 uint16_t
@@ -228,6 +231,7 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue,
 		uint16_t nb_pkts,
 		bool repr_flag)
 {
+	int ret;
 	uint16_t i;
 	uint8_t offset;
 	uint32_t pkt_size;
@@ -274,7 +278,10 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue,
 		if (!repr_flag) {
 			struct nfp_net_meta_raw meta_data;
 			memset(&meta_data, 0, sizeof(meta_data));
-			nfp_net_nfd3_set_meta_data(&meta_data, txq, pkt);
+			ret = nfp_net_nfd3_set_meta_data(&meta_data, txq, pkt);
+			if (unlikely(ret != 0))
+				goto xmit_end;
+
 			offset = meta_data.length;
 		} else {
 			offset = FLOWER_PKT_DATA_OFFSET;
-- 
2.39.1


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

* [PATCH 2/2] net/nfp: fix meta data process problem of NFDk
  2024-02-20  8:14 [PATCH 0/2] fix meta data process problem Chaoyong He
  2024-02-20  8:14 ` [PATCH 1/2] net/nfp: fix meta data process problem of NFD3 Chaoyong He
@ 2024-02-20  8:14 ` Chaoyong He
  2024-02-21 17:07 ` [PATCH 0/2] fix meta data process problem Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-02-20  8:14 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, peng.zhang, stable, Long Wu

The Tx function can not check if the meta data process success for
the process function with void return type.

Fix it by change the return type of the meata data function from
void to integer and add the error handle logic in the Tx function.

Fixes: 7c82b8626af8 ("net/nfp: support VLAN insert with NFDk")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
index a1c6ecdfe5..daf5ac5b30 100644
--- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
+++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
@@ -169,7 +169,7 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq,
 	return nop_slots;
 }
 
-static void
+static int
 nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 		struct nfp_net_txq *txq,
 		uint64_t *metadata)
@@ -206,8 +206,10 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 		meta_data.length += 3 * NFP_NET_META_FIELD_SIZE;
 	}
 
-	if (meta_data.length == 0)
-		return;
+	if (meta_data.length == 0) {
+		*metadata = 0;
+		return 0;
+	}
 
 	meta_type = meta_data.header;
 	header_offset = meta_type << NFP_NET_META_NFDK_LENGTH;
@@ -223,15 +225,16 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 		case NFP_NET_META_VLAN:
 			if (vlan_layer > 0) {
 				PMD_DRV_LOG(ERR, "At most 1 layers of vlan is supported");
-				return;
+				return -EINVAL;
 			}
+
 			nfp_net_set_meta_vlan(&meta_data, pkt, layer);
 			vlan_layer++;
 			break;
 		case NFP_NET_META_IPSEC:
 			if (ipsec_layer > 2) {
 				PMD_DRV_LOG(ERR, "At most 3 layers of ipsec is supported for now.");
-				return;
+				return -EINVAL;
 			}
 
 			nfp_net_set_meta_ipsec(&meta_data, txq, pkt, layer, ipsec_layer);
@@ -239,13 +242,15 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 			break;
 		default:
 			PMD_DRV_LOG(ERR, "The metadata type not supported");
-			return;
+			return -ENOTSUP;
 		}
 
 		memcpy(meta, &meta_data.data[layer], sizeof(meta_data.data[layer]));
 	}
 
 	*metadata = NFDK_DESC_TX_CHAIN_META;
+
+	return 0;
 }
 
 uint16_t
@@ -292,6 +297,7 @@ nfp_net_nfdk_xmit_pkts_common(void *tx_queue,
 
 	/* Sending packets */
 	while (npkts < nb_pkts && free_descs > 0) {
+		int ret;
 		int nop_descs;
 		uint32_t type;
 		uint32_t dma_len;
@@ -319,10 +325,13 @@ nfp_net_nfdk_xmit_pkts_common(void *tx_queue,
 
 		temp_pkt = pkt;
 
-		if (repr_flag)
+		if (repr_flag) {
 			metadata = NFDK_DESC_TX_CHAIN_META;
-		else
-			nfp_net_nfdk_set_meta_data(pkt, txq, &metadata);
+		} else {
+			ret = nfp_net_nfdk_set_meta_data(pkt, txq, &metadata);
+			if (unlikely(ret != 0))
+				goto xmit_end;
+		}
 
 		if (unlikely(pkt->nb_segs > 1 &&
 				(hw->super.ctrl & NFP_NET_CFG_CTRL_GATHER) == 0)) {
-- 
2.39.1


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

* Re: [PATCH 0/2] fix meta data process problem
  2024-02-20  8:14 [PATCH 0/2] fix meta data process problem Chaoyong He
  2024-02-20  8:14 ` [PATCH 1/2] net/nfp: fix meta data process problem of NFD3 Chaoyong He
  2024-02-20  8:14 ` [PATCH 2/2] net/nfp: fix meta data process problem of NFDk Chaoyong He
@ 2024-02-21 17:07 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2024-02-21 17:07 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 2/20/2024 8:14 AM, Chaoyong He wrote:
> The Tx function can not check if the meta data process success for
> the process function with void return type. This problem exist for
> both NFD3 and NFDk logic.
> 
> Chaoyong He (2):
>   net/nfp: fix meta data process problem of NFD3
>   net/nfp: fix meta data process problem of NFDk
>

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

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

end of thread, other threads:[~2024-02-21 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20  8:14 [PATCH 0/2] fix meta data process problem Chaoyong He
2024-02-20  8:14 ` [PATCH 1/2] net/nfp: fix meta data process problem of NFD3 Chaoyong He
2024-02-20  8:14 ` [PATCH 2/2] net/nfp: fix meta data process problem of NFDk Chaoyong He
2024-02-21 17:07 ` [PATCH 0/2] fix meta data process problem 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).