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 14F134301F for ; Thu, 10 Aug 2023 02:13:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FAEA4325F; Thu, 10 Aug 2023 02:13:04 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id E76BE406B6 for ; Thu, 10 Aug 2023 02:13:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z87DS2dYNmddU4JnCYHIwTUi4U0UbF8gxExdZqwXsKbcyQ5aR2UCZiEJsdh+57HccTaIvq1bPrCDu/IrYq+29sNs2cl8kdrCoR9cUwyx9H180NPKoGIOXg6dGbJYm7uvSsPY8K0rxjmAMRLFHr4sm8K3iP7ZurCLIZOUeNEdvDt1fIX9GcG19d4lSn/wxT7LzkwAnex+fmS/I0ye65qUQltfEPMD2Q4+X8aLsx8ayrp0XsIwXUTsQAfbQ9MqbagLO/UynHUZVX30RFCMT/am2iS378kr99gw9nxi/CgmGUHm3O9qWV7mMDHGrYmnY83qWbppAco06/O5tU9HvHmyUA== 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=MjNSKXqMMB0o6EHeB7ZLTj1/I7pHoo7AkBchCFqKpdA=; b=ggk6CJ7cPNk5SUChXKcR3flzQ64c7GAw9oxhQy5O3jJKywpmT6AJWHUCtRgrLbF0mTRSQ6JLASwge8x1k/HaYR3/9Cy6TKUXA37Ow8OZ0pNj+DorEc5InGDlTW1jbD0GF3e4P9sTokbJZcVROsCXkY7B5JaPeIOr8I56iyuXAnJ6Aw5mn2u1L1+Y1M0zuwaAVlHgzugTFdq/0xZyMQGNZoknDAOEj3KAaVFOvURfqg3siOpo/gHp/+2inwhJSQjsu1YU1adQ3dncIjPhlvSt0vpc6EjsU32N8tRzSybxOSjga+Zn3i/T7zJhGYxJ437hcZYoSpZN4dF9HoHhIB1kdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=corigine.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MjNSKXqMMB0o6EHeB7ZLTj1/I7pHoo7AkBchCFqKpdA=; b=CvUHiYhTQjROuNK2ne3wm8fVSxN477x5jFmOqNzYU8RxVa+4IKmvs/OLE3OtWyB1BOrWvudM2a/JATB/KFzoGMOTwz6lsuyQDLKggKE25WTu4cwhv06fVAM1iXMIGinX3kpQ6XKf/F4RzCMCwtOkbtvYp4/G9xsMywUWVmW4v7kubTquu7gRol4KPaKBIetrmC3YQxhfa2eVBWfGrowlFAVke9cyF55w9pEHcbUTETmudNE7GCdiBsaZj1Oz+fy4lK3wBL7aQt6iFZYVA6pCiLfdLEteiVP879lJQ6kQ2s8Dy+orcys6AEmg8oZhM/9zBs2HsCQyWIeZCLKFc4x8Eg== Received: from SA1P222CA0191.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c4::24) by CY8PR12MB9036.namprd12.prod.outlook.com (2603:10b6:930:78::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Thu, 10 Aug 2023 00:13:01 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:806:3c4:cafe::34) by SA1P222CA0191.outlook.office365.com (2603:10b6:806:3c4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Thu, 10 Aug 2023 00:13:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.19 via Frontend Transport; Thu, 10 Aug 2023 00:13:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 9 Aug 2023 17:12:48 -0700 Received: from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 9 Aug 2023 17:12:46 -0700 From: Xueming Li To: Chaoyong He CC: =?UTF-8?q?Niklas=20S=C3=B6derlund?= , "dpdk stable" Subject: patch 'net/nfp: fix offloading flows' has been queued to stable release 22.11.3 Date: Thu, 10 Aug 2023 08:10:44 +0800 Message-ID: <20230810001045.2662-24-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230810001045.2662-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> <20230810001045.2662-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C6:EE_|CY8PR12MB9036:EE_ X-MS-Office365-Filtering-Correlation-Id: 92fce44c-f3c2-47bf-802d-08db99368f1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 08ZaAF4RJWmfW46GUsmribqcGcfdKhlgKYrpvz4hz9BSKFQdNJcuvgDAa7qiNMSQ3TWcf/VMvDjeKvAOuoh9BcWCvSWx6x31ndrfXxQ0XC+xyH9W1lYvh/AS1r/+yc1rLmspBQS0RtL4P9O1JPny6HuhbiPIS7obBR86KSwr4Zgn4jwREIhetx9lgDYgN23xRYTBiHyQgvzfFPku1aDW7Ax/NYWL2LPGQsUYeLoNsftO8UOEpmV+KGb3jrgRYofOA80GEpkey7hg/2umznnrM0ch8GTXBp5CW1CabOwVarjVLMbDG+KeyfBnl6tO8uqAEAIgCEO5w7jbY+w8E8INeqaXzT/ABZS0P/dXu+L6sfspA/93VBNehfMrGLOVFvZMcLYiUH+HuQlqt0Hf9KVmPSGSDi+2CDsMvl+G3Bjlv2Alc/s2UXAZAsVKt3BaUQdLXb9udKeE1TcOLyop+HxYElvD/9zfSLlvtA7kMN9CJ4elDu2hz9K5knUWp8NWR7VGeAOC8/Ka0KhYQHXKYhNf+NEo6q/+2xhEl904eu4aGC37wjg9MUB7rm/NTWiyrOsiVKhpmEv/FaRt1hY5zSoWs1BNHjyuLKpOnAdmzKpNwmd1bjwO3kzPBoybmZYVuEvxvly6DksUjlc7OxodZ2M188aWdjrboXaV7eU7KdnEckYLTC4QhxuaM/CeZHHkZTtTsgQ1FzKjJ0/4wqVpiT9TqHyZB6othlaaTpbME70djKVM0+kiFytBmzkg3j0+BLxVT5JWGF/UHvhdjZTE91MEEA== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(376002)(39860400002)(136003)(82310400008)(186006)(1800799006)(451199021)(46966006)(36840700001)(40470700004)(83380400001)(47076005)(426003)(66574015)(36860700001)(2616005)(40480700001)(40460700003)(53546011)(55016003)(8936002)(2906002)(6916009)(30864003)(5660300002)(316002)(336012)(70586007)(70206006)(6286002)(16526019)(478600001)(966005)(356005)(7636003)(1076003)(41300700001)(82740400003)(7696005)(8676002)(54906003)(26005)(86362001)(4326008)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2023 00:13:00.9812 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92fce44c-f3c2-47bf-802d-08db99368f1a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB9036 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/11/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=933defac2b797d847bdbfb83f055f53f9965029c Thanks. Xueming Li --- >From 933defac2b797d847bdbfb83f055f53f9965029c Mon Sep 17 00:00:00 2001 From: Chaoyong He Date: Tue, 20 Jun 2023 10:49:58 +0800 Subject: [PATCH] net/nfp: fix offloading flows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Xueming Li [ upstream commit 925c27ec8de92efe69f4cb56e3fc0e413354c739 ] The symbol '_abi_flower_extra_features' is in IMEM for NFP4000, but in EMU_CACHE for NFP3800 because which does not have IMEM. The original logic can't read symbol from EMU_CACHE, so the probe process will fail when we try to offload flows use NFP3800. Modify the related data structure and logics to support read symbol from EMU_CACHE. Fixes: c7e9729da6b5 ("net/nfp: support CPP") Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_ethdev.c | 4 +- drivers/net/nfp/nfpcore/nfp_cpp.h | 7 +- drivers/net/nfp/nfpcore/nfp_cppcore.c | 54 ++++++++--- drivers/net/nfp/nfpcore/nfp_rtsym.c | 135 +++++++++++++++++++++++--- 4 files changed, 174 insertions(+), 26 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index dc63b05bd6..29491f6e6d 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -929,6 +929,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) int ret; int err = 0; uint64_t addr; + uint32_t cpp_id; struct nfp_cpp *cpp; enum nfp_app_fw_id app_fw_id; struct nfp_pf_dev *pf_dev; @@ -1028,7 +1029,8 @@ nfp_pf_init(struct rte_pci_device *pci_dev) goto pf_cleanup; } - pf_dev->hw_queues = nfp_cpp_map_area(pf_dev->cpp, 0, 0, + cpp_id = NFP_CPP_ISLAND_ID(0, NFP_CPP_ACTION_RW, 0, 0); + pf_dev->hw_queues = nfp_cpp_map_area(pf_dev->cpp, cpp_id, addr, NFP_QCP_QUEUE_AREA_SZ, &pf_dev->hwqueues_area); if (pf_dev->hw_queues == NULL) { diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h index a04a68f546..68851b22e4 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp.h +++ b/drivers/net/nfp/nfpcore/nfp_cpp.h @@ -34,6 +34,9 @@ struct nfp_cpp { */ uint32_t imb_cat_table[16]; + /* MU access type bit offset */ + uint32_t mu_locality_lsb; + int driver_lock_needed; }; @@ -363,7 +366,7 @@ struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, */ void nfp_cpp_area_release_free(struct nfp_cpp_area *area); -uint8_t *nfp_cpp_map_area(struct nfp_cpp *cpp, int domain, int target, +uint8_t *nfp_cpp_map_area(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, unsigned long size, struct nfp_cpp_area **area); /* @@ -778,4 +781,6 @@ int nfp_cpp_mutex_unlock(struct nfp_cpp_mutex *mutex); */ int nfp_cpp_mutex_trylock(struct nfp_cpp_mutex *mutex); +uint32_t nfp_cpp_mu_locality_lsb(struct nfp_cpp *cpp); + #endif /* !__NFP_CPP_H__ */ diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 37799af558..014f6c9df8 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -19,6 +19,7 @@ #include "nfp6000/nfp6000.h" #include "nfp6000/nfp_xpb.h" #include "nfp_nffw.h" +#include "../nfp_logs.h" #define NFP_PL_DEVICE_ID 0x00000004 #define NFP_PL_DEVICE_ID_MASK 0xff @@ -118,6 +119,36 @@ nfp_cpp_area_name(struct nfp_cpp_area *cpp_area) return cpp_area->name; } +#define NFP_IMB_TGTADDRESSMODECFG_MODE_of(_x) (((_x) >> 13) & 0x7) +#define NFP_IMB_TGTADDRESSMODECFG_ADDRMODE RTE_BIT32(12) + +static int +nfp_cpp_set_mu_locality_lsb(struct nfp_cpp *cpp) +{ + int ret; + int mode; + int addr40; + uint32_t imbcppat; + + imbcppat = cpp->imb_cat_table[NFP_CPP_TARGET_MU]; + mode = NFP_IMB_TGTADDRESSMODECFG_MODE_of(imbcppat); + addr40 = imbcppat & NFP_IMB_TGTADDRESSMODECFG_ADDRMODE; + + ret = nfp_cppat_mu_locality_lsb(mode, addr40); + if (ret < 0) + return ret; + + cpp->mu_locality_lsb = ret; + + return 0; +} + +uint32_t +nfp_cpp_mu_locality_lsb(struct nfp_cpp *cpp) +{ + return cpp->mu_locality_lsb; +} + /* * nfp_cpp_area_alloc - allocate a new CPP area * @cpp: CPP handle @@ -142,10 +173,6 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, if (!cpp) return NULL; - /* CPP bus uses only a 40-bit address */ - if ((address + size) > (1ULL << 40)) - return NFP_ERRPTR(EFAULT); - /* Remap from cpp_island to cpp_target */ err = nfp_target_cpp(dest, tmp64, &dest, &tmp64, cpp->imb_cat_table); if (err < 0) @@ -588,6 +615,13 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) } } + err = nfp_cpp_set_mu_locality_lsb(cpp); + if (err < 0) { + PMD_DRV_LOG(ERR, "Can't calculate MU locality bit offset"); + free(cpp); + return NULL; + } + return cpp; } @@ -819,8 +853,7 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) /* * nfp_cpp_map_area() - Helper function to map an area * @cpp: NFP CPP handler - * @domain: CPP domain - * @target: CPP target + * @cpp_id: CPP ID * @addr: CPP address * @size: Size of the area * @area: Area handle (output) @@ -828,18 +861,15 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) * Map an area of IOMEM access. To undo the effect of this function call * @nfp_cpp_area_release_free(*area). * - * Return: Pointer to memory mapped area or ERR_PTR + * Return: Pointer to memory mapped area or NULL */ uint8_t * -nfp_cpp_map_area(struct nfp_cpp *cpp, int domain, int target, uint64_t addr, +nfp_cpp_map_area(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, unsigned long size, struct nfp_cpp_area **area) { uint8_t *res; - uint32_t dest; - - dest = NFP_CPP_ISLAND_ID(target, NFP_CPP_ACTION_RW, 0, domain); - *area = nfp_cpp_area_alloc_acquire(cpp, dest, addr, size); + *area = nfp_cpp_area_alloc_acquire(cpp, cpp_id, addr, size); if (!*area) goto err_eio; diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 56bbf05cd8..21879f7eb6 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -14,6 +14,7 @@ #include "nfp_mip.h" #include "nfp_rtsym.h" #include "nfp6000/nfp6000.h" +#include "../nfp_logs.h" /* These need to match the linker */ #define SYM_TGT_LMEM 0 @@ -213,6 +214,113 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) return NULL; } +static uint64_t +nfp_rtsym_size(const struct nfp_rtsym *sym) +{ + switch (sym->type) { + case NFP_RTSYM_TYPE_NONE: + PMD_DRV_LOG(ERR, "rtsym '%s': type NONE", sym->name); + return 0; + case NFP_RTSYM_TYPE_OBJECT: /* Fall through */ + case NFP_RTSYM_TYPE_FUNCTION: + return sym->size; + case NFP_RTSYM_TYPE_ABS: + return sizeof(uint64_t); + default: + PMD_DRV_LOG(ERR, "rtsym '%s': unknown type: %d", sym->name, sym->type); + return 0; + } +} + +static int +nfp_rtsym_to_dest(struct nfp_cpp *cpp, + const struct nfp_rtsym *sym, + uint8_t action, + uint8_t token, + uint64_t offset, + uint32_t *cpp_id, + uint64_t *addr) +{ + if (sym->type != NFP_RTSYM_TYPE_OBJECT) { + PMD_DRV_LOG(ERR, "rtsym '%s': direct access to non-object rtsym", + sym->name); + return -EINVAL; + } + + *addr = sym->addr + offset; + + if (sym->target >= 0) { + *cpp_id = NFP_CPP_ISLAND_ID(sym->target, action, token, sym->domain); + } else if (sym->target == NFP_RTSYM_TARGET_EMU_CACHE) { + int locality_off = nfp_cpp_mu_locality_lsb(cpp); + + *addr &= ~(NFP_MU_ADDR_ACCESS_TYPE_MASK << locality_off); + *addr |= NFP_MU_ADDR_ACCESS_TYPE_DIRECT << locality_off; + + *cpp_id = NFP_CPP_ISLAND_ID(NFP_CPP_TARGET_MU, action, token, + sym->domain); + } else { + PMD_DRV_LOG(ERR, "rtsym '%s': unhandled target encoding: %d", + sym->name, sym->target); + return -EINVAL; + } + + return 0; +} + +static int +nfp_rtsym_readl(struct nfp_cpp *cpp, + const struct nfp_rtsym *sym, + uint8_t action, + uint8_t token, + uint64_t offset, + uint32_t *value) +{ + int ret; + uint64_t addr; + uint32_t cpp_id; + + if (offset + 4 > nfp_rtsym_size(sym)) { + PMD_DRV_LOG(ERR, "rtsym '%s': readl out of bounds", sym->name); + return -ENXIO; + } + + ret = nfp_rtsym_to_dest(cpp, sym, action, token, offset, &cpp_id, &addr); + if (ret != 0) + return ret; + + return nfp_cpp_readl(cpp, cpp_id, addr, value); +} + +static int +nfp_rtsym_readq(struct nfp_cpp *cpp, + const struct nfp_rtsym *sym, + uint8_t action, + uint8_t token, + uint64_t offset, + uint64_t *value) +{ + int ret; + uint64_t addr; + uint32_t cpp_id; + + if (offset + 8 > nfp_rtsym_size(sym)) { + PMD_DRV_LOG(ERR, "rtsym '%s': readq out of bounds", sym->name); + return -ENXIO; + } + + if (sym->type == NFP_RTSYM_TYPE_ABS) { + *value = sym->addr; + return 0; + } + + ret = nfp_rtsym_to_dest(cpp, sym, action, token, offset, &cpp_id, &addr); + if (ret != 0) + return ret; + + return nfp_cpp_readq(cpp, cpp_id, addr, value); +} + /* * nfp_rtsym_read_le() - Read a simple unsigned scalar value from symbol * @rtbl: NFP RTsym table @@ -229,7 +337,7 @@ uint64_t nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) { const struct nfp_rtsym *sym; - uint32_t val32, id; + uint32_t val32; uint64_t val; int err; @@ -239,19 +347,13 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) goto exit; } - id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain); - -#ifdef DEBUG - printf("Reading symbol %s with size %" PRIu64 " at %" PRIx64 "\n", - name, sym->size, sym->addr); -#endif switch (sym->size) { case 4: - err = nfp_cpp_readl(rtbl->cpp, id, sym->addr, &val32); + err = nfp_rtsym_readl(rtbl->cpp, sym, NFP_CPP_ACTION_RW, 0, 0, &val32); val = val32; break; case 8: - err = nfp_cpp_readq(rtbl->cpp, id, sym->addr, &val); + err = nfp_rtsym_readq(rtbl->cpp, sym, NFP_CPP_ACTION_RW, 0, 0, &val); break; default: printf("rtsym '%s' unsupported size: %" PRId64 "\n", @@ -276,8 +378,11 @@ uint8_t * nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, unsigned int min_size, struct nfp_cpp_area **area) { - const struct nfp_rtsym *sym; + int ret; uint8_t *mem; + uint64_t addr; + uint32_t cpp_id; + const struct nfp_rtsym *sym; #ifdef DEBUG printf("mapping symbol %s\n", name); @@ -288,14 +393,20 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, return NULL; } + ret = nfp_rtsym_to_dest(rtbl->cpp, sym, NFP_CPP_ACTION_RW, 0, 0, + &cpp_id, &addr); + if (ret != 0) { + PMD_DRV_LOG(ERR, "rtsym '%s': mapping failed", name); + return NULL; + } + if (sym->size < min_size) { printf("Symbol %s too small (%" PRIu64 " < %u)\n", name, sym->size, min_size); return NULL; } - mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr, - sym->size, area); + mem = nfp_cpp_map_area(rtbl->cpp, cpp_id, addr, sym->size, area); if (!mem) { printf("Failed to map symbol %s\n", name); return NULL; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-08-09 21:51:21.380339100 +0800 +++ 0127-net-nfp-fix-offloading-flows.patch 2023-08-09 21:51:18.304352000 +0800 @@ -1 +1 @@ -From 925c27ec8de92efe69f4cb56e3fc0e413354c739 Mon Sep 17 00:00:00 2001 +From 933defac2b797d847bdbfb83f055f53f9965029c Mon Sep 17 00:00:00 2001 @@ -3 +3 @@ -Date: Wed, 7 Jun 2023 09:57:00 +0800 +Date: Tue, 20 Jun 2023 10:49:58 +0800 @@ -7,0 +8,3 @@ +Cc: Xueming Li + +[ upstream commit 925c27ec8de92efe69f4cb56e3fc0e413354c739 ] @@ -19 +21,0 @@ -Cc: stable@dpdk.org @@ -26,3 +28,3 @@ - drivers/net/nfp/nfpcore/nfp_cppcore.c | 51 +++++++--- - drivers/net/nfp/nfpcore/nfp_rtsym.c | 132 ++++++++++++++++++++++++-- - 4 files changed, 171 insertions(+), 23 deletions(-) + drivers/net/nfp/nfpcore/nfp_cppcore.c | 54 ++++++++--- + drivers/net/nfp/nfpcore/nfp_rtsym.c | 135 +++++++++++++++++++++++--- + 4 files changed, 174 insertions(+), 26 deletions(-) @@ -31 +33 @@ -index f73bffc09b..e84d2ac82e 100644 +index dc63b05bd6..29491f6e6d 100644 @@ -34 +36 @@ -@@ -937,6 +937,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) +@@ -929,6 +929,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) @@ -42 +44 @@ -@@ -1036,7 +1037,8 @@ nfp_pf_init(struct rte_pci_device *pci_dev) +@@ -1028,7 +1029,8 @@ nfp_pf_init(struct rte_pci_device *pci_dev) @@ -53 +55 @@ -index 2441012b95..8f87c09327 100644 +index a04a68f546..68851b22e4 100644 @@ -56 +58 @@ -@@ -31,6 +31,9 @@ struct nfp_cpp { +@@ -34,6 +34,9 @@ struct nfp_cpp { @@ -66 +68 @@ -@@ -455,7 +458,7 @@ struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, +@@ -363,7 +366,7 @@ struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, @@ -75 +77 @@ -@@ -869,4 +872,6 @@ int nfp_cpp_mutex_unlock(struct nfp_cpp_mutex *mutex); +@@ -778,4 +781,6 @@ int nfp_cpp_mutex_unlock(struct nfp_cpp_mutex *mutex); @@ -83 +85 @@ -index 681ec93b96..6daee313ce 100644 +index 37799af558..014f6c9df8 100644 @@ -86 +88,9 @@ -@@ -118,6 +118,36 @@ nfp_cpp_area_name(struct nfp_cpp_area *cpp_area) +@@ -19,6 +19,7 @@ + #include "nfp6000/nfp6000.h" + #include "nfp6000/nfp_xpb.h" + #include "nfp_nffw.h" ++#include "../nfp_logs.h" + + #define NFP_PL_DEVICE_ID 0x00000004 + #define NFP_PL_DEVICE_ID_MASK 0xff +@@ -118,6 +119,36 @@ nfp_cpp_area_name(struct nfp_cpp_area *cpp_area) @@ -123,2 +133,2 @@ -@@ -142,10 +172,6 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, - if (cpp == NULL) +@@ -142,10 +173,6 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, + if (!cpp) @@ -129 +139 @@ -- return NULL; +- return NFP_ERRPTR(EFAULT); @@ -134 +144 @@ -@@ -578,6 +604,13 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) +@@ -588,6 +615,13 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) @@ -148 +158 @@ -@@ -809,8 +842,7 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) +@@ -819,8 +853,7 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) @@ -158,2 +168,6 @@ -@@ -821,15 +853,12 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) - * Return: Pointer to memory mapped area or NULL +@@ -828,18 +861,15 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) + * Map an area of IOMEM access. To undo the effect of this function call + * @nfp_cpp_area_release_free(*area). + * +- * Return: Pointer to memory mapped area or ERR_PTR ++ * Return: Pointer to memory mapped area or NULL @@ -173 +187 @@ - if (*area == NULL) + if (!*area) @@ -177 +191 @@ -index 9713605580..343b0d0bcf 100644 +index 56bbf05cd8..21879f7eb6 100644 @@ -180 +194,9 @@ -@@ -211,6 +211,113 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) +@@ -14,6 +14,7 @@ + #include "nfp_mip.h" + #include "nfp_rtsym.h" + #include "nfp6000/nfp6000.h" ++#include "../nfp_logs.h" + + /* These need to match the linker */ + #define SYM_TGT_LMEM 0 +@@ -213,6 +214,113 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) @@ -294 +316 @@ -@@ -227,7 +334,7 @@ uint64_t +@@ -229,7 +337,7 @@ uint64_t @@ -303 +325 @@ -@@ -237,17 +344,13 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) +@@ -239,19 +347,13 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) @@ -309 +331,2 @@ -- PMD_DRV_LOG(DEBUG, "Reading symbol %s with size %" PRIu64 " at %" PRIx64 "", +-#ifdef DEBUG +- printf("Reading symbol %s with size %" PRIu64 " at %" PRIx64 "\n", @@ -310,0 +334 @@ +-#endif @@ -322,2 +346,2 @@ - PMD_DRV_LOG(ERR, "rtsym '%s' unsupported size: %" PRId64, -@@ -272,8 +375,11 @@ uint8_t * + printf("rtsym '%s' unsupported size: %" PRId64 "\n", +@@ -276,8 +378,11 @@ uint8_t * @@ -334,3 +358,3 @@ - PMD_DRV_LOG(DEBUG, "mapping symbol %s", name); - sym = nfp_rtsym_lookup(rtbl, name); -@@ -282,14 +388,20 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, + #ifdef DEBUG + printf("mapping symbol %s\n", name); +@@ -288,14 +393,20 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, @@ -348 +372 @@ - PMD_DRV_LOG(ERR, "Symbol %s too small (%" PRIu64 " < %u)", name, + printf("Symbol %s too small (%" PRIu64 " < %u)\n", name, @@ -356,2 +380,2 @@ - if (mem == NULL) { - PMD_INIT_LOG(ERR, "Failed to map symbol %s", name); + if (!mem) { + printf("Failed to map symbol %s\n", name);