From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F1B8A00C2; Fri, 14 Oct 2022 11:09:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEE04410F2; Fri, 14 Oct 2022 11:09:30 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2127.outbound.protection.outlook.com [40.107.220.127]) by mails.dpdk.org (Postfix) with ESMTP id 6F0A2410F1 for ; Fri, 14 Oct 2022 11:09:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTRECaKXwaZGwciYR5ZtEyyR7ZNUXttPTuvLg0Dd3my4iTE3iqKsbWyxeI9TJHXVq7jruMMo0CyPwf9CofHZkF3qvyDxQH5hGsfo3dzdA2MR0RkPAsJwS75soJVn8JKOy6Zx7Ci/XjZrxVqtcbUAEam1Gikpgpb5X5yrzd3GWNauY9cEfWLD+g+eU90FZ/ljKQ+CRGVfTRPytJHUzcLRVx96SQozOX3tc+vaMKdeFhtXb/LSOi88ra2iIM+Zbt6JrYeYW99uR4a3MbQ/+g19iZsqXPwBQ4SgcmxDhzMe0VrdHYCadMVholMrWJaudBFhpXO82rzTP++hxQ43K+A9Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XaTj7JgpRVsBEUtOy7+dI0TH4ELxA7cJVmiCwszpqB4=; b=NaqmNkujUjqrVZsCYDX518+d/8E0fBemLr1D0/ebvK2aJIYjK2sqEzrtB/MlFmyCopyO/Eo/pyNAz6D0iVEWq0D3RnbwhZiGX2tayE4in3J+5s7iKyljSmXjkSc0x4ZVtvs/WyorN3JsfNsw/9puIvLxY7azzNPuyh+ZKcSBwPCiv+vffWYZQaKKpvst2h6WfRbFnAtvkMQTmIRtzXva1I8UPqQPp2/khpPEderFsu7mT3ZXKCtlU/qafqnlaAP/XxxCBZhjaertQJFB4LiR7cyisZo9dPyf6iNXbz8yU2IBIpyFdFgCr0MSSeuHKFBeZsvuIWZoTgg1VriXYWA5sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XaTj7JgpRVsBEUtOy7+dI0TH4ELxA7cJVmiCwszpqB4=; b=M6TW+Ron3qc3acdRwtdw+CJxJHhq3Vz9JfyGCVVCwpaaxfGGMF2ZtoKptZpyPDM+ttqhy39dCKWVsvEK82E2xtfgNCejdWqHFraYmoJ9vuR9izf01orXNTG7jxKaU2E9nQXgWEqOX0dx6LDFY3BmUy182zSj6qMkcgZR9LyGr6I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH0PR13MB5170.namprd13.prod.outlook.com (2603:10b6:610:eb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Fri, 14 Oct 2022 09:09:27 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Fri, 14 Oct 2022 09:09:26 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2] net/nfp: add the feature of RSS based on VXLAN inner layer Date: Fri, 14 Oct 2022 17:09:08 +0800 Message-Id: <1665738548-20974-1-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0022.apcprd01.prod.exchangelabs.com (2603:1096:4:192::14) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH0PR13MB5170:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ffedf19-de9a-4729-7be2-08daadc3cb4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FsoyrmDTcReudtI2sCUmzx5ub1U3XcasJWGGBCP/9Z4Uk5VXLMoA3LCrOLEPgmYAV9I9tihMoMgtHUUB+duoaUqtPC0sl44r/Nj6w5Q+9FG1+KZ7FNjB1uUP65svbYJ/Ct8Kc67uHW79ahDM/6ewq+lEnnRkTVaS5fgGDLXHyl4We8JTtFNIQ5ZRU67LQmykAs6D/UOYqPyPT+3TiEenzq+NO08jbgYG4w7jbwotQ5EN5SM2uRzvf+372NJYIgv3+dsQkOg+gwzqJDHvhqs0vgGCSjnK95jmDVKDxMB4n8vl/8Kcv5bJ0iXR7l19DnEQ5dyuvqhyOgJiBnNxn7mNFpV91K+6YqpxZJHKfcj+kuDJ2yiQGadisG+lZEOF4oJsOU1zyit5E/QGpk1XT7B5RQvg2cGbb8zuMSFdQfUSG8HQLwg02wWreArlmHKEfu3oegyWfiNbHYr+olwyyXHek4QK2c64aSXRC4GQ/nPQU6Z1YATx2o3/YVFAU7h+r+pnJ3eU544e6bSoptNLLCp5m4+gOYu5PZHntZIGqmVNFAptg8RoDjcNVrpuy5e8SO2nnnKMz9vsVHZ4Dtv9wGeFU3HUBPnqYtbSf+HFU/6Ueqwx2CfLhBiShw5RinORESaSESZuBj7p3pK4sKIfuWqUR6u7TaddPDPhNtKSCVAJ66zzQ41VxL38CK6nv9t1V7PNAAo1HSVflhAJ5jBAiOTwiVnNXoQJYP5oeGH24niKFNP4dTZMeJ6AgMt2iopUnUHT7Nx8OJjgukw/pJhDS/RbrVqdT2GeL3TMz6sKQLhu1Yc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(366004)(376002)(346002)(396003)(451199015)(44832011)(186003)(38350700002)(6486002)(478600001)(38100700002)(5660300002)(6916009)(2906002)(66476007)(26005)(83380400001)(8936002)(316002)(6512007)(2616005)(66556008)(86362001)(6666004)(6506007)(8676002)(66946007)(4326008)(107886003)(66574015)(41300700001)(52116002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WW9ta2ZDRm42RDdZS3NwTmtLSWtLT1lzVDN6Q3Qyek40cFFURlJobGxCMlo0?= =?utf-8?B?bzB1aGQxNFJRVjF0cDVPYW9Da2ZYeFcwZTdMVk5IdENYZ0pXdmhzWjdoc2xY?= =?utf-8?B?M0RLQktHVUdwV2lORXg1M2grWlBiQUFpbDUwWVNXSm1RZjl6VUh0WU1hbGJS?= =?utf-8?B?Z1FKc0F1UkgvZkpTTjFNckRna2ZZb1lFdTdGTFRMUlMvRWxERzBaMnJoSjdO?= =?utf-8?B?aFlUME1PTXc1cXAxV3lGUGI1aVV5V3ZKZHFVOUVUZVdraXlsc09YWmd4aUVu?= =?utf-8?B?VEFjQ1VyMkdzVDA5O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zBDRzlKcVFack5D?= =?utf-8?B?NmJXUDIyNGs2UXRQbDBEc1Bjb01SZEFvZmlUQzg1MUg0Rk52eEtRVXhmVXlE?= =?utf-8?B?eVE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ffedf19-de9a-4729-7be2-08daadc3cb4b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 09:09:26.8545 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n/tQsm9C/+Z48j6vw0Gf1fBkXfq1Rs16o2Ql+q4sH4ji9plX3QjN2pvoetbmRARYtyn9cislulPYvpIbgZ+s1ZSj6xFt+63VGtP5JneTkVM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR13MB5170 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 Add the logics to support the feature of RSS packets based on the inner layer of VXLAN tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund * Changes since v1 - Don't expose the dependency relation of header files to source files. Depends-on: series-24819 ("preparation for the rte_flow offload of nfp PMD") --- drivers/net/nfp/flower/nfp_flower.c | 1 - drivers/net/nfp/flower/nfp_flower_ctrl.c | 1 - drivers/net/nfp/flower/nfp_flower_representor.c | 1 - drivers/net/nfp/nfp_common.c | 33 ++++++- drivers/net/nfp/nfp_common.h | 6 ++ drivers/net/nfp/nfp_ethdev.c | 111 +++++++++++++++++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 1 - drivers/net/nfp/nfp_rxtx.c | 1 - 8 files changed, 148 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 3e97f5c..53d378c 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -12,7 +12,6 @@ #include "../nfp_common.h" #include "../nfp_logs.h" -#include "../nfp_ctrl.h" #include "../nfp_cpp_bridge.h" #include "../nfp_rxtx.h" #include "../nfpcore/nfp_mip.h" diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index df908ef..19ac8b0 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -8,7 +8,6 @@ #include "../nfp_common.h" #include "../nfp_logs.h" -#include "../nfp_ctrl.h" #include "../nfp_rxtx.h" #include "nfp_flower.h" #include "nfp_flower_ctrl.h" diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 0e60f50..a73cf80 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -8,7 +8,6 @@ #include "../nfp_common.h" #include "../nfp_logs.h" -#include "../nfp_ctrl.h" #include "../nfp_rxtx.h" #include "../nfpcore/nfp_mip.h" #include "../nfpcore/nfp_rtsym.h" diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 07781a1..53d134e 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -38,7 +38,6 @@ #include "nfpcore/nfp_nsp.h" #include "nfp_common.h" -#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" #include "nfp_cpp_bridge.h" @@ -1370,6 +1369,38 @@ } } +int +nfp_net_set_vxlan_port(struct nfp_net_hw *hw, + size_t idx, + uint16_t port) +{ + int ret; + uint32_t i; + + if (idx > NFP_NET_N_VXLAN_PORTS) { + PMD_DRV_LOG(ERR, "The idx value is out of range."); + return -ERANGE; + } + + hw->vxlan_ports[idx] = port; + + for (i = 0; i < NFP_NET_N_VXLAN_PORTS; i += 2) { + nn_cfg_writel(hw, NFP_NET_CFG_VXLAN_PORT + i * sizeof(port), + (hw->vxlan_ports[i + 1] << 16) | hw->vxlan_ports[i]); + } + + rte_spinlock_lock(&hw->reconfig_lock); + + nn_cfg_writel(hw, NFP_NET_CFG_UPDATE, NFP_NET_CFG_UPDATE_VXLAN); + rte_wmb(); + + ret = __nfp_net_reconfig(hw, NFP_NET_CFG_UPDATE_VXLAN); + + rte_spinlock_unlock(&hw->reconfig_lock); + + return ret; +} + RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE); RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE); RTE_LOG_REGISTER_SUFFIX(nfp_logtype_cpp, cpp, NOTICE); diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 27ea9c2..d7861a2 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -14,6 +14,8 @@ #ifndef _NFP_COMMON_H_ #define _NFP_COMMON_H_ +#include "nfp_ctrl.h" + #define NFP_NET_PMD_VERSION "0.1" #define PCI_VENDOR_ID_NETRONOME 0x19ee #define PCI_VENDOR_ID_CORIGINE 0x1da8 @@ -209,6 +211,9 @@ struct nfp_net_hw { int stride_rx; int stride_tx; + uint16_t vxlan_ports[NFP_NET_N_VXLAN_PORTS]; + uint8_t vxlan_usecnt[NFP_NET_N_VXLAN_PORTS]; + uint8_t *qcp_cfg; rte_spinlock_t reconfig_lock; @@ -438,6 +443,7 @@ int nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, void nfp_net_close_rx_queue(struct rte_eth_dev *dev); void nfp_net_stop_tx_queue(struct rte_eth_dev *dev); void nfp_net_close_tx_queue(struct rte_eth_dev *dev); +int nfp_net_set_vxlan_port(struct nfp_net_hw *hw, size_t idx, uint16_t port); #define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\ (&((struct nfp_net_adapter *)adapter)->hw) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index e131021..d938e01 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -33,7 +33,6 @@ #include "nfpcore/nfp_nsp.h" #include "nfp_common.h" -#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" #include "nfp_cpp_bridge.h" @@ -138,6 +137,10 @@ update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING; + /* Enable vxlan */ + new_ctrl |= NFP_NET_CFG_CTRL_VXLAN; + update |= NFP_NET_CFG_UPDATE_VXLAN; + if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG) new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG; @@ -319,6 +322,110 @@ return 0; } +static int +nfp_net_find_vxlan_idx(struct nfp_net_hw *hw, + uint16_t port, + uint32_t *idx) +{ + uint32_t i; + int free_idx = -1; + + for (i = 0; i < NFP_NET_N_VXLAN_PORTS; i++) { + if (hw->vxlan_ports[i] == port) { + free_idx = i; + break; + } + + if (hw->vxlan_usecnt[i] == 0) { + free_idx = i; + break; + } + } + + if (free_idx == -1) + return -EINVAL; + + *idx = free_idx; + + return 0; +} + +static int +nfp_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp) +{ + int ret; + uint32_t idx; + uint16_t vxlan_port; + struct nfp_net_hw *hw; + enum rte_eth_tunnel_type tnl_type; + + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + vxlan_port = tunnel_udp->udp_port; + tnl_type = tunnel_udp->prot_type; + + if (tnl_type != RTE_ETH_TUNNEL_TYPE_VXLAN) { + PMD_DRV_LOG(ERR, "Not VXLAN tunnel"); + return -ENOTSUP; + } + + ret = nfp_net_find_vxlan_idx(hw, vxlan_port, &idx); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed find valid vxlan idx"); + return -EINVAL; + } + + if (hw->vxlan_usecnt[idx] == 0) { + ret = nfp_net_set_vxlan_port(hw, idx, vxlan_port); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed set vxlan port"); + return -EINVAL; + } + } + + hw->vxlan_usecnt[idx]++; + + return 0; +} + +static int +nfp_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp) +{ + int ret; + uint32_t idx; + uint16_t vxlan_port; + struct nfp_net_hw *hw; + enum rte_eth_tunnel_type tnl_type; + + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + vxlan_port = tunnel_udp->udp_port; + tnl_type = tunnel_udp->prot_type; + + if (tnl_type != RTE_ETH_TUNNEL_TYPE_VXLAN) { + PMD_DRV_LOG(ERR, "Not VXLAN tunnel"); + return -ENOTSUP; + } + + ret = nfp_net_find_vxlan_idx(hw, vxlan_port, &idx); + if (ret != 0 || hw->vxlan_usecnt[idx] == 0) { + PMD_DRV_LOG(ERR, "Failed find valid vxlan idx"); + return -EINVAL; + } + + hw->vxlan_usecnt[idx]--; + + if (hw->vxlan_usecnt[idx] == 0) { + ret = nfp_net_set_vxlan_port(hw, idx, 0); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed set vxlan port"); + return -EINVAL; + } + } + + return 0; +} + /* Initialise and register driver with DPDK Application */ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_configure = nfp_net_configure, @@ -347,6 +454,8 @@ .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable, + .udp_tunnel_port_add = nfp_udp_tunnel_port_add, + .udp_tunnel_port_del = nfp_udp_tunnel_port_del, }; static inline int diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 6c6caef..6556dfe 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -19,7 +19,6 @@ #include "nfpcore/nfp_rtsym.h" #include "nfp_common.h" -#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index b8c874d..9e4fa8d 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -17,7 +17,6 @@ #include #include "nfp_common.h" -#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" #include "nfpcore/nfp_mip.h" -- 1.8.3.1