From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33339C38A24 for ; Thu, 7 May 2020 10:49:51 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id E7ACE207DD for ; Thu, 7 May 2020 10:49:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7ACE207DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 043E91DC18; Thu, 7 May 2020 12:49:10 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id CFB5D1DBE1 for ; Thu, 7 May 2020 12:49:02 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B340A200FAC; Thu, 7 May 2020 12:49:02 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 127752017FB; Thu, 7 May 2020 12:49:01 +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 8CE7140319; Thu, 7 May 2020 18:48:58 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Nipun Gupta Date: Thu, 7 May 2020 16:16:42 +0530 Message-Id: <20200507104645.31990-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200507104645.31990-1-hemant.agrawal@nxp.com> References: <20200504124118.22877-1-hemant.agrawal@nxp.com> <20200507104645.31990-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v4 6/9] 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