[v1,41/43] net/dpaa2: support VLAN traffic splitting

Message ID 20240913055959.3246917-42-vanshika.shukla@nxp.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series DPAA2 specific patches |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

vanshika.shukla@nxp.com Sept. 13, 2024, 5:59 a.m. UTC
From: Vanshika Shukla <vanshika.shukla@nxp.com>

This patch adds support for adding rules in DPDMUX
to split VLAN traffic based on VLAN ids.

Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/net/dpaa2/dpaa2_mux.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Patch

diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index 3c9e155b23..c35baf4cde 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -118,6 +118,26 @@  rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
 	}
 	break;
 
+	case RTE_FLOW_ITEM_TYPE_VLAN:
+	{
+		const struct rte_flow_item_vlan *spec;
+
+		kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
+		kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_VLAN;
+		kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_VLAN_TCI;
+		kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FROM_FIELD;
+		kg_cfg.extracts[0].extract.from_hdr.offset = 1;
+		kg_cfg.extracts[0].extract.from_hdr.size = 1;
+		kg_cfg.num_extracts = 1;
+
+		spec = (const struct rte_flow_item_vlan *)pattern[0]->spec;
+		memcpy((void *)key_iova, (const void *)(&spec->hdr.vlan_tci),
+			sizeof(uint16_t));
+		memcpy(mask_iova, pattern[0]->mask, sizeof(uint16_t));
+		key_size = sizeof(uint16_t);
+	}
+	break;
+
 	case RTE_FLOW_ITEM_TYPE_UDP:
 	{
 		const struct rte_flow_item_udp *spec;