From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11F38A00C5; Fri, 8 May 2020 15:05:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B035B1DBB9; Fri, 8 May 2020 15:04:35 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id EC98F1DB44 for ; Fri, 8 May 2020 15:04:27 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C254B1A1532; Fri, 8 May 2020 15:04:27 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 215631A00E9; Fri, 8 May 2020 15:04:26 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 99AC5402DB; Fri, 8 May 2020 21:04:23 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Nipun Gupta Date: Fri, 8 May 2020 18:32:07 +0530 Message-Id: <20200508130211.14334-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508130211.14334-1-hemant.agrawal@nxp.com> References: <20200507104645.31990-1-hemant.agrawal@nxp.com> <20200508130211.14334-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v6 06/10] net/dpaa2: support UDP dst port based muxing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nipun Gupta This change adds DPDMUX support to bifurcate traffic on the basis of UDP destination port. Signed-off-by: Nipun Gupta --- 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 @@ -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