DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] support generic flow item
@ 2024-05-28  1:55 Chaoyong He
  2024-05-28  1:55 ` [PATCH 1/4] net/nfp: support generic ETH " Chaoyong He
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Chaoyong He @ 2024-05-28  1:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series add the support of some generic flow items, namely 
flow items with a NULL 'item->spec' value, including:
- ETH flow item
- TCP flow item
- UDP flow item
- SCTP flow item

Chaoyong He (4):
  net/nfp: support generic ETH flow item
  net/nfp: support generic TCP flow item
  net/nfp: support generic UDP flow item
  net/nfp: support generic SCTP flow item

 drivers/net/nfp/flower/nfp_flower_flow.c | 126 +++++++++++++++--------
 1 file changed, 83 insertions(+), 43 deletions(-)

-- 
2.39.1


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

* [PATCH 1/4] net/nfp: support generic ETH flow item
  2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
@ 2024-05-28  1:55 ` Chaoyong He
  2024-05-28  1:55 ` [PATCH 2/4] net/nfp: support generic TCP " Chaoyong He
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2024-05-28  1:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Add support of ETH flow item with a NULL 'item->spec' value.

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/flower/nfp_flower_flow.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index ae3f25e410..098a714ea5 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -1230,10 +1230,9 @@ nfp_flow_merge_eth(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 	}
 
 	eth->mpls_lse = 0;
-
-eth_end:
 	*mbuf_off += sizeof(struct nfp_flower_mac_mpls);
 
+eth_end:
 	return 0;
 }
 
-- 
2.39.1


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

* [PATCH 2/4] net/nfp: support generic TCP flow item
  2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
  2024-05-28  1:55 ` [PATCH 1/4] net/nfp: support generic ETH " Chaoyong He
@ 2024-05-28  1:55 ` Chaoyong He
  2024-05-28  1:55 ` [PATCH 3/4] net/nfp: support generic UDP " Chaoyong He
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2024-05-28  1:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Add support of TCP flow item with a NULL 'item->spec' value.

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/flower/nfp_flower_flow.c | 45 +++++++++++++++---------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 098a714ea5..810f55f805 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -1316,11 +1316,6 @@ nfp_flow_merge_ipv4(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 			ipv4_udp_tun->ipv4.dst   = hdr->dst_addr;
 		}
 	} else {
-		if (spec == NULL) {
-			PMD_DRV_LOG(DEBUG, "nfp flow merge ipv4: no item->spec!");
-			goto ipv4_end;
-		}
-
 		/*
 		 * Reserve space for L4 info.
 		 * rte_flow has ipv4 before L4 but NFP flower fw requires L4 before ipv4.
@@ -1328,6 +1323,11 @@ nfp_flow_merge_ipv4(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0)
 			*mbuf_off += sizeof(struct nfp_flower_tp_ports);
 
+		if (spec == NULL) {
+			PMD_DRV_LOG(DEBUG, "nfp flow merge ipv4: no item->spec!");
+			goto ipv4_end;
+		}
+
 		hdr = is_mask ? &mask->hdr : &spec->hdr;
 		ipv4 = (struct nfp_flower_ipv4 *)*mbuf_off;
 
@@ -1399,11 +1399,6 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 					sizeof(ipv6_udp_tun->ipv6.ipv6_dst));
 		}
 	} else {
-		if (spec == NULL) {
-			PMD_DRV_LOG(DEBUG, "nfp flow merge ipv6: no item->spec!");
-			goto ipv6_end;
-		}
-
 		/*
 		 * Reserve space for L4 info.
 		 * rte_flow has ipv6 before L4 but NFP flower fw requires L4 before ipv6.
@@ -1411,6 +1406,11 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0)
 			*mbuf_off += sizeof(struct nfp_flower_tp_ports);
 
+		if (spec == NULL) {
+			PMD_DRV_LOG(DEBUG, "nfp flow merge ipv6: no item->spec!");
+			goto ipv6_end;
+		}
+
 		hdr = is_mask ? &mask->hdr : &spec->hdr;
 		vtc_flow = rte_be_to_cpu_32(hdr->vtc_flow);
 		ipv6 = (struct nfp_flower_ipv6 *)*mbuf_off;
@@ -1445,23 +1445,34 @@ nfp_flow_merge_tcp(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 	const struct rte_flow_item_tcp *mask;
 	struct nfp_flower_meta_tci *meta_tci;
 
-	spec = item->spec;
-	if (spec == NULL) {
-		PMD_DRV_LOG(DEBUG, "nfp flow merge tcp: no item->spec!");
-		return 0;
-	}
-
 	meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data;
 	if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
 		ipv4  = (struct nfp_flower_ipv4 *)
 				(*mbuf_off - sizeof(struct nfp_flower_ipv4));
+		if (is_mask)
+			ipv4->ip_ext.proto = 0xFF;
+		else
+			ipv4->ip_ext.proto = IPPROTO_TCP;
 		ports = (struct nfp_flower_tp_ports *)
 				((char *)ipv4 - sizeof(struct nfp_flower_tp_ports));
-	} else { /* IPv6 */
+	} else if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6) != 0) {
 		ipv6  = (struct nfp_flower_ipv6 *)
 				(*mbuf_off - sizeof(struct nfp_flower_ipv6));
+		if (is_mask)
+			ipv6->ip_ext.proto = 0xFF;
+		else
+			ipv6->ip_ext.proto = IPPROTO_TCP;
 		ports = (struct nfp_flower_tp_ports *)
 				((char *)ipv6 - sizeof(struct nfp_flower_tp_ports));
+	} else {
+		PMD_DRV_LOG(ERR, "nfp flow merge tcp: no L3 layer!");
+		return -EINVAL;
+	}
+
+	spec = item->spec;
+	if (spec == NULL) {
+		PMD_DRV_LOG(DEBUG, "nfp flow merge tcp: no item->spec!");
+		return 0;
 	}
 
 	mask = item->mask ? item->mask : proc->mask_default;
-- 
2.39.1


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

* [PATCH 3/4] net/nfp: support generic UDP flow item
  2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
  2024-05-28  1:55 ` [PATCH 1/4] net/nfp: support generic ETH " Chaoyong He
  2024-05-28  1:55 ` [PATCH 2/4] net/nfp: support generic TCP " Chaoyong He
@ 2024-05-28  1:55 ` Chaoyong He
  2024-05-28  1:55 ` [PATCH 4/4] net/nfp: support generic SCTP " Chaoyong He
  2024-07-05 17:30 ` [PATCH 0/4] support generic " Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2024-05-28  1:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Add support of UDP flow item with a NULL 'item->spec' value.

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/flower/nfp_flower_flow.c | 41 ++++++++++++++++--------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 810f55f805..4cbdfd02b8 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -1522,18 +1522,13 @@ nfp_flow_merge_udp(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		bool is_mask,
 		bool is_outer_layer)
 {
-	char *ports_off;
 	struct nfp_flower_tp_ports *ports;
+	struct nfp_flower_ipv4 *ipv4 = NULL;
+	struct nfp_flower_ipv6 *ipv6 = NULL;
 	const struct rte_flow_item_udp *spec;
 	const struct rte_flow_item_udp *mask;
 	struct nfp_flower_meta_tci *meta_tci;
 
-	spec = item->spec;
-	if (spec == NULL) {
-		PMD_DRV_LOG(DEBUG, "nfp flow merge udp: no item->spec!");
-		return 0;
-	}
-
 	/* Don't add L4 info if working on a inner layer pattern */
 	if (!is_outer_layer) {
 		PMD_DRV_LOG(INFO, "Detected inner layer UDP, skipping.");
@@ -1542,13 +1537,33 @@ nfp_flow_merge_udp(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 
 	meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data;
 	if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
-		ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv4) -
-				sizeof(struct nfp_flower_tp_ports);
-	} else {/* IPv6 */
-		ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv6) -
-				sizeof(struct nfp_flower_tp_ports);
+		ipv4 = (struct nfp_flower_ipv4 *)
+				(*mbuf_off - sizeof(struct nfp_flower_ipv4));
+		if (is_mask)
+			ipv4->ip_ext.proto = 0xFF;
+		else
+			ipv4->ip_ext.proto = IPPROTO_UDP;
+		ports = (struct nfp_flower_tp_ports *)
+				((char *)ipv4 - sizeof(struct nfp_flower_tp_ports));
+	} else if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6) != 0) {
+		ipv6 = (struct nfp_flower_ipv6 *)
+				(*mbuf_off - sizeof(struct nfp_flower_ipv6));
+		if (is_mask)
+			ipv6->ip_ext.proto = 0xFF;
+		else
+			ipv6->ip_ext.proto = IPPROTO_UDP;
+		ports = (struct nfp_flower_tp_ports *)
+				((char *)ipv6 - sizeof(struct nfp_flower_tp_ports));
+	} else {
+		PMD_DRV_LOG(ERR, "nfp flow merge udp: no L3 layer!");
+		return -EINVAL;
+	}
+
+	spec = item->spec;
+	if (spec == NULL) {
+		PMD_DRV_LOG(DEBUG, "nfp flow merge udp: no item->spec!");
+		return 0;
 	}
-	ports = (struct nfp_flower_tp_ports *)ports_off;
 
 	mask = item->mask ? item->mask : proc->mask_default;
 	if (is_mask) {
-- 
2.39.1


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

* [PATCH 4/4] net/nfp: support generic SCTP flow item
  2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
                   ` (2 preceding siblings ...)
  2024-05-28  1:55 ` [PATCH 3/4] net/nfp: support generic UDP " Chaoyong He
@ 2024-05-28  1:55 ` Chaoyong He
  2024-07-05 17:30 ` [PATCH 0/4] support generic " Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2024-05-28  1:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Add support of SCTP flow item with a NULL 'item->spec' value.

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/flower/nfp_flower_flow.c | 37 +++++++++++++++++-------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 4cbdfd02b8..bd77807db0 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -1586,28 +1586,43 @@ nfp_flow_merge_sctp(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		bool is_mask,
 		__rte_unused bool is_outer_layer)
 {
-	char *ports_off;
 	struct nfp_flower_tp_ports *ports;
+	struct nfp_flower_ipv4 *ipv4 = NULL;
+	struct nfp_flower_ipv6 *ipv6 = NULL;
 	struct nfp_flower_meta_tci *meta_tci;
 	const struct rte_flow_item_sctp *spec;
 	const struct rte_flow_item_sctp *mask;
 
+	meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data;
+	if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
+		ipv4 = (struct nfp_flower_ipv4 *)
+				(*mbuf_off - sizeof(struct nfp_flower_ipv4));
+		if (is_mask)
+			ipv4->ip_ext.proto = 0xFF;
+		else
+			ipv4->ip_ext.proto = IPPROTO_SCTP;
+		ports = (struct nfp_flower_tp_ports *)
+				((char *)ipv4 - sizeof(struct nfp_flower_tp_ports));
+	} else if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6) != 0) {
+		ipv6 = (struct nfp_flower_ipv6 *)
+				(*mbuf_off - sizeof(struct nfp_flower_ipv6));
+		if (is_mask)
+			ipv6->ip_ext.proto = 0xFF;
+		else
+			ipv6->ip_ext.proto = IPPROTO_SCTP;
+		ports = (struct nfp_flower_tp_ports *)
+				((char *)ipv6 - sizeof(struct nfp_flower_tp_ports));
+	} else {
+		PMD_DRV_LOG(ERR, "nfp flow merge sctp: no L3 layer!");
+		return -EINVAL;
+	}
+
 	spec = item->spec;
 	if (spec == NULL) {
 		PMD_DRV_LOG(DEBUG, "nfp flow merge sctp: no item->spec!");
 		return 0;
 	}
 
-	meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data;
-	if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
-		ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv4) -
-				sizeof(struct nfp_flower_tp_ports);
-	} else { /* IPv6 */
-		ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv6) -
-				sizeof(struct nfp_flower_tp_ports);
-	}
-	ports = (struct nfp_flower_tp_ports *)ports_off;
-
 	mask = item->mask ? item->mask : proc->mask_default;
 	if (is_mask) {
 		ports->port_src = mask->hdr.src_port;
-- 
2.39.1


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

* Re: [PATCH 0/4] support generic flow item
  2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
                   ` (3 preceding siblings ...)
  2024-05-28  1:55 ` [PATCH 4/4] net/nfp: support generic SCTP " Chaoyong He
@ 2024-07-05 17:30 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2024-07-05 17:30 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 5/28/2024 2:55 AM, Chaoyong He wrote:
> This patch series add the support of some generic flow items, namely 
> flow items with a NULL 'item->spec' value, including:
> - ETH flow item
> - TCP flow item
> - UDP flow item
> - SCTP flow item
> 
> Chaoyong He (4):
>   net/nfp: support generic ETH flow item
>   net/nfp: support generic TCP flow item
>   net/nfp: support generic UDP flow item
>   net/nfp: support generic SCTP flow item
>

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

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

end of thread, other threads:[~2024-07-05 17:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28  1:55 [PATCH 0/4] support generic flow item Chaoyong He
2024-05-28  1:55 ` [PATCH 1/4] net/nfp: support generic ETH " Chaoyong He
2024-05-28  1:55 ` [PATCH 2/4] net/nfp: support generic TCP " Chaoyong He
2024-05-28  1:55 ` [PATCH 3/4] net/nfp: support generic UDP " Chaoyong He
2024-05-28  1:55 ` [PATCH 4/4] net/nfp: support generic SCTP " Chaoyong He
2024-07-05 17:30 ` [PATCH 0/4] support generic " 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).