[dpdk-dev] [PATCH v3 6/8] net/dpaa2: support UDP dst port based muxing

Hemant Agrawal hemant.agrawal at nxp.com
Mon May 4 14:41:16 CEST 2020


From: Nipun Gupta <nipun.gupta at nxp.com>

This change adds DPDMUX support to bifurcate traffic on
the basis of UDP destination port.

Signed-off-by: Nipun Gupta <nipun.gupta at nxp.com>
---
 drivers/net/dpaa2/dpaa2_mux.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index af90adb828..9ac8806faf 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include <sys/queue.h>
@@ -99,6 +99,7 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 	{
 		const struct rte_flow_item_ipv4 *spec;
+
 		kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP;
 		kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO;
 		kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
@@ -113,10 +114,31 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
 	}
 	break;
 
+	case RTE_FLOW_ITEM_TYPE_UDP:
+	{
+		const struct rte_flow_item_udp *spec;
+		uint16_t udp_dst_port;
+
+		kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_UDP;
+		kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_UDP_PORT_DST;
+		kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
+		kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD;
+		kg_cfg.num_extracts = 1;
+
+		spec = (const struct rte_flow_item_udp *)pattern[0]->spec;
+		udp_dst_port = rte_constant_bswap16(spec->hdr.dst_port);
+		memcpy((void *)key_iova, (const void *)&udp_dst_port,
+							sizeof(rte_be16_t));
+		memcpy(mask_iova, pattern[0]->mask, sizeof(uint16_t));
+		key_size = sizeof(uint16_t);
+	}
+	break;
+
 	case RTE_FLOW_ITEM_TYPE_ETH:
 	{
 		const struct rte_flow_item_eth *spec;
 		uint16_t eth_type;
+
 		kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_ETH;
 		kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_ETH_TYPE;
 		kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
-- 
2.17.1



More information about the dev mailing list