From patchwork Wed Jan 20 06:22:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 366957 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp182511jam; Tue, 19 Jan 2021 22:33:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnMve2GwzBiOi36VPkZcPL73kM578UU3qFMpMzlPEf0vkaViDsWWk1CkeGc78AurJslz3w X-Received: by 2002:a17:907:36a:: with SMTP id rs10mr5258705ejb.281.1611124416528; Tue, 19 Jan 2021 22:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611124416; cv=none; d=google.com; s=arc-20160816; b=HYix4VyC1dmHNAFZ5hbz+mEt8h12qBlaDg6oscPj6W+XoqzJjwoK58aCyidCsKtesQ k2dBffbfgiGNxLVs2o2S2hNtTg7T83/ShCNV7b9RUPbwUgtCivb+D5Xk2j4z940Tfq/j fgODbjw91qW6hhyp1e4/Fmrl4vCaQNnqCObmciv77bHMdAd3FXUdxIDsSJHVe1wkN9kW S2H+n5MBuOZoa/hnPUZk1uu6o3YPjgMm1bLzQkq3WciFC6pVs3PXfTPISKstqn1Tg0mm AJnhTBxvXsdMUHxI6NYTT257uH5STXos1kJKD4aemXYJyCQJGCQmt2XxAHQyhsUmwe46 zzSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:cc:to :from; bh=09agLbACwHpsvk38R1/OSmHD5ZHN8cxq+tfLu3d08YA=; b=m+KP9mhEvnWk2LwXMMRFfgN5xmCbMolO1XQhIYog/f8qK7CC1GcHS269yIqSjTJ0yX xigmu+Y65dWBRgrwdCfWe9vLRjlY2lAB7ICirjk63lefS7WqWAz/oge/txnS7HcGJUgr AllA+iWHaTdRCLXAwlfT9r3ibPBE7flcKNbu71lU4DZgzDalYI7bOsEPqw3UnCz/ujC/ IaIeMoi2Oxu1NHV+r6YQjjOLhxn6YUwZ/nm8R7Dwub2bv0WlvNvxxfV+ZcBLW7NtTjlK 8haktnreUXtEctNYVDdgTc8/6AZaKkg2evpdl462TqxQi7BTB/5XQaEAovxOde4BKW7o mqRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id ia3si379987ejc.39.2021.01.19.22.33.36; Tue, 19 Jan 2021 22:33:36 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4434140CEF; Wed, 20 Jan 2021 07:33:35 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id E409E140CE8 for ; Wed, 20 Jan 2021 07:33:33 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A9034200003; Wed, 20 Jan 2021 07:33:33 +0100 (CET) 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 12314200663; Wed, 20 Jan 2021 07:33:32 +0100 (CET) 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 99A9A402B7; Wed, 20 Jan 2021 07:33:29 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Hemant Agrawal Date: Wed, 20 Jan 2021 11:52:37 +0530 Message-Id: <20210120062238.18721-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 1/2] ethdev: add MPLS RSS offload type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" This patch defines new RSS offload types for MPLS. The distribution will on the basis of MPLS tag. Signed-off-by: Hemant Agrawal --- app/test-pmd/cmdline.c | 4 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- lib/librte_ethdev/rte_ethdev.h | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Ferruh Yigit diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 89034c8b72..01cc79b12c 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2220,6 +2220,8 @@ cmd_config_rss_parsed(void *parsed_result, rss_conf.rss_hf = ETH_RSS_GTPU; else if (!strcmp(res->value, "ecpri")) rss_conf.rss_hf = ETH_RSS_ECPRI; + else if (!strcmp(res->value, "mpls")) + rss_conf.rss_hf = ETH_RSS_MPLS; else if (!strcmp(res->value, "none")) rss_conf.rss_hf = 0; else if (!strcmp(res->value, "level-default")) { @@ -2290,7 +2292,7 @@ cmdline_parse_inst_t cmd_config_rss = { .data = NULL, .help_str = "port config all rss " "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|" - "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|none|level-default|" + "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-default|" "level-outer|level-inner|", .tokens = { (void *)&cmd_config_rss_port, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 458f25bb63..3ccc9fc300 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2270,7 +2270,7 @@ port config - RSS Set the RSS (Receive Side Scaling) mode on or off:: - testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|none) + testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none) RSS is on by default. diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index eb299955d4..7c0b6eda8f 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -527,6 +527,7 @@ struct rte_eth_rss_conf { #define ETH_RSS_PFCP (1ULL << 30) #define ETH_RSS_PPPOE (1ULL << 31) #define ETH_RSS_ECPRI (1ULL << 32) +#define ETH_RSS_MPLS (1ULL << 33) /* * We use the following macros to combine with above ETH_RSS_* for @@ -758,7 +759,8 @@ rte_eth_rss_hf_refine(uint64_t rss_hf) ETH_RSS_PORT | \ ETH_RSS_VXLAN | \ ETH_RSS_GENEVE | \ - ETH_RSS_NVGRE) + ETH_RSS_NVGRE | \ + ETH_RSS_MPLS) /* * Definitions used for redirection table entry size. From patchwork Wed Jan 20 06:22:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 366958 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp182557jam; Tue, 19 Jan 2021 22:33:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2zPGhPXFwP584Q4LltIzYyMni/A0FtJTrgmhI/lNu2JwCnLaXVTi+5WMo06rn1DUL50CP X-Received: by 2002:a17:906:2681:: with SMTP id t1mr5172783ejc.29.1611124421241; Tue, 19 Jan 2021 22:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611124421; cv=none; d=google.com; s=arc-20160816; b=mXnWj5g08WqmazoQpjkzxZi578Ie3ldz/wyXYFT/dh6nqfJBMCXwox7l/0c4ty4tXH I1pMGlkZD1FnuRNw/iWbdaLJLiqK8EuY9l4cKpkaNZQO+1Iz3T5+J2OxeSzUF+scqKNB 3J6RqwjrEwHeL3NU4VfqeGKEQriF2U5WqLicy0CSwYKiD0Hxf5thlQ6cjktXirBbGqPb P4qRJZkORo3u1J4SpNVS6amgBZsNjAvcQTnNiODNHA1Om8heyY/TOVveHP7aLhjtHEQg ahHOZsdIPqzQpK/Kj1WzwUt0gAhR2wLf+iiFxLn8JUWZAzg9ZQ5mf3IrCJFnqEEH8Aa/ vj6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=b0GE5LuyjVI8hEVN1ahbmlzW6YW75e1Q9Nosebfi0IY=; b=V4B4J5aaAaVtrxKINDHl70m+LX3YZSssMbvJkp3NQkvQXQxwS4DKEg7G+OMCpjS8mv Ni69syCpGfCc8f7wjh2RP5t/IsxkO9dZnv7dxCkcSFTW4xrHIxY8HRCHZ0dkSP94vZQC SBK/to9D1s/FfJbiVPtQUlXpIvyAZuqwfC4vrKc2NujVPsSx6I1PKQI6bjdX2VJiLbU6 +skrn34GSZGSfjhgstQpFJfiu9Z4iadTha4w4nMyBblDtcYulN3whYgDzMBw6MavCfbc NSt1C0oj47dysTgAI3ZMKRvxJuHIhtl1AdME+Yeal5M9l6+A6VflgX+on1oNPBP1lZAd SGsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id yh27si366067ejb.290.2021.01.19.22.33.41; Tue, 19 Jan 2021 22:33:41 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 019DD140D17; Wed, 20 Jan 2021 07:33:38 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id B8EC7140D01 for ; Wed, 20 Jan 2021 07:33:36 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8C1B91A1448; Wed, 20 Jan 2021 07:33:36 +0100 (CET) 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 BD4261A16DA; Wed, 20 Jan 2021 07:33:34 +0100 (CET) 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 37650402E8; Wed, 20 Jan 2021 07:33:30 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Apeksha Gupta Date: Wed, 20 Jan 2021 11:52:38 +0530 Message-Id: <20210120062238.18721-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210120062238.18721-1-hemant.agrawal@nxp.com> References: <20210120062238.18721-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/2] net/dpaa2: support MPLS distribution X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Apeksha Gupta add support for MPLS based distribution is supported. Signed-off-by: Apeksha Gupta --- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 45 ++++++++++++++++++++++++-- drivers/net/dpaa2/dpaa2_ethdev.h | 3 +- drivers/net/dpaa2/dpaa2_rxtx.c | 4 +++ drivers/net/dpaa2/mc/fsl_net.h | 5 +++ 4 files changed, 53 insertions(+), 4 deletions(-) -- 2.17.1 Acked-by: Hemant Agrawal diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 25b1d2bb6d..e543b73981 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * */ @@ -194,9 +194,11 @@ dpaa2_distset_to_dpkg_profile_cfg( uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg) { - uint32_t loop = 0, i = 0, dist_field = 0; + uint32_t loop = 0, i = 0; + uint64_t dist_field = 0; int l2_configured = 0, l3_configured = 0; int l4_configured = 0, sctp_configured = 0; + int mpls_configured = 0; memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); while (req_dist_set) { @@ -220,6 +222,43 @@ dpaa2_distset_to_dpkg_profile_cfg( i++; break; + case ETH_RSS_MPLS: + + if (mpls_configured) + break; + mpls_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_1; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_2; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_N; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + break; + case ETH_RSS_IPV4: case ETH_RSS_FRAG_IPV4: case ETH_RSS_NONFRAG_IPV4_OTHER: @@ -326,7 +365,7 @@ dpaa2_distset_to_dpkg_profile_cfg( default: DPAA2_PMD_WARN( - "Unsupported flow dist option %x", + "unsupported flow dist option 0x%" PRIx64, dist_field); return -EINVAL; } diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index cacb11bd3e..bb49fa9a38 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -65,7 +65,8 @@ ETH_RSS_IP | \ ETH_RSS_UDP | \ ETH_RSS_TCP | \ - ETH_RSS_SCTP) + ETH_RSS_SCTP | \ + ETH_RSS_MPLS) /* LX2 FRC Parsed values (Little Endian) */ #define DPAA2_PKT_TYPE_ETHER 0x0060 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 9cca6d16c3..6b4526cd2d 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -166,6 +166,10 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf, goto parse_done; } + if (BIT_ISSET_AT_POS(annotation->word3, L2_MPLS_1_PRESENT | + L2_MPLS_N_PRESENT)) + pkt_type |= RTE_PTYPE_L2_ETHER_MPLS; + if (BIT_ISSET_AT_POS(annotation->word4, L3_IPV4_1_PRESENT | L3_IPV4_N_PRESENT)) { pkt_type |= RTE_PTYPE_L3_IPV4; diff --git a/drivers/net/dpaa2/mc/fsl_net.h b/drivers/net/dpaa2/mc/fsl_net.h index 3eaad2f717..2d26d5d6c3 100644 --- a/drivers/net/dpaa2/mc/fsl_net.h +++ b/drivers/net/dpaa2/mc/fsl_net.h @@ -343,6 +343,11 @@ /*************************** GTP fields ************************************/ #define NH_FLD_GTP_TEID (1) +/*************************** MPLS fields ************************************/ +#define NH_FLD_MPLS_MPLSL_1 (1) +#define NH_FLD_MPLS_MPLSL_2 (NH_FLD_MPLS_MPLSL_1 << 1) +#define NH_FLD_MPLS_MPLSL_N (NH_FLD_MPLS_MPLSL_1 << 2) + /* Protocol options */ /* Ethernet options */