From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0040.outbound.protection.outlook.com [104.47.32.40]) by dpdk.org (Postfix) with ESMTP id 95ECD1C01; Mon, 2 Jul 2018 08:30:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X72ww/BbY9nqdbFOHIo3fn/9reefxZcJQPgpViEeblU=; b=eVg8NF19PHfc6+oQ6eP6AoFmQSZBFBpQndwEL8Mjv23RnK/iX1cq4g8wGsYgHmH4Doe76iubLANpsjckv9aaKwzsUhE1/XUnPOq4sIkJZ04X/poJFL/vSM/OoJDKQURrmQjP0O+vQcyy5qQFaMVrDKR2VLmGQQt7Ll3wYmC038Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by CY4PR07MB3462.namprd07.prod.outlook.com (2603:10b6:910:75::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Mon, 2 Jul 2018 06:30:05 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, olivier.matz@6wind.com Cc: dev@dpdk.org, stable@dpdk.org, Pavan Nikhilesh Date: Mon, 2 Jul 2018 11:59:32 +0530 Message-Id: <20180702062932.1548-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180627114736.29484-1-pbhagavatula@caviumnetworks.com> References: <20180627114736.29484-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::27) To CY4PR07MB3462.namprd07.prod.outlook.com (2603:10b6:910:75::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9cfc7d8-7339-4ab9-0eb9-08d5dfe540cd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(2017052603328)(7153060)(7193020); SRVR:CY4PR07MB3462; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 3:D7UI9bomRbebSA+7XqXjV1yDwyqgVTXf16ro4mD5hU1FbJJ7xK/xcUBG6IhmQlE+d3JY5bOU3m/XHcLG8Idu+I59mqW6/gpWHbJGZ1lra1cOXGrIDQQYzmmMvFDpoNyEbPbk/jNy4PAmjTqQdPQSuU+yqFvDlz+srtUdcCjvpjlLXM+bmsfasaMsi/QPBFN0IGMSW9XNAVjcJDsPH/ByZYqtVoRKzwD8bcpIMBZa19CwFT8tvz9zRBZBWfn7iQgk; 25:YbQwKIbG+RvXVHDBlIyRD97d22G2GsoY66loqn0MaF5/ef+KNCj0wcOo3/LyS8EJBw5PxTOKyadqmU9yRgR1nhEYDhVNGYWOKHEolPtY0dKM0V1O29C3it/u4Z6fJhGTLxQBnaQoqMrY3xKygnAjpu1SbU9Dm9X+MWxWH38c4XhRtT3yPc5XFPEc/lU3fVA66V39z1BgH9LeOLNxRXJF+HAGq6r2CZVuQYEuvGclxYa/nxTezb4cipFk8TDymOQ9o3Ob6r6v2uKGcMqNSUof5Wl4eqr4YyPU/lLZn8TOYBE5/xPQNlmektAaGEVxR8+CsJxlWWl4jPmaVSGNdzDOBg==; 31:GZtRcVxTxARyiQnK6/NY3hkquNDw9R4kchdkxDphNm7y2xDuNUOlkWJY7fsErPtAYl6/CVdvBEoqvTFQTsii2Zpb7yZJ27pXlD5uhW4QcaLsWlCyrcfBYXm/CQkEb+n1qhk73nn7It357z1kCCSezqYohxKLBSQj4jeQa1z0PX54GcbN5LP13AjuH6P193Tv2rtWrT+pE8/rCBmJv5XuP4Eq7CfDo1tWhH41ZZeO5BM= X-MS-TrafficTypeDiagnostic: CY4PR07MB3462: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 20:Qsg+tuMdFhh6iKLwk7aTiVcYbGEoYNLoCJ9XmvVtOg8isM3kdaJ1ZCVnemULImOzJRoen2PFxwRujqi5EUK/wC9vb4R2Jve3hrr6HwcE5GesD3YqEuRQxSqh0a+J21sX49b7/Moi8zNoPeREDuHEPVYbVMr4QjuhKjobXCtbOlGYMXi0KGV2Z/6jrlY9ug+QDbWFgV3E5x/ilMp95jkeNOvRw6GVmTdGO/i3V6kqD9KnL7kNqGKW2GfNuR3e4/yfZoqQ+IpDytGXw8jPJjQoAL4k2TCLutFuYGbWM8uuEhizV3+p9C+OFHnp4r6Lyf9lfkWjJKIQaee9tXV4a2DlQU+PfyHBnFL+CQheRi+9DfHgXcwzQx2F7H/Y2G+Q80wXZITr/gdlROJsPLBLuKaXN/qh7RpHka2fumjntPapVnUzH936Jcpz711VDfSHeR9WaqW8oJzvZ+sSc+wnwE6eByqgXQhlyWA8wMZf/XpF7ye1mmhSHfN8uKRIIJB512C7YwSFv4fp+bujPQivKYWf11hb4H/sXCMc9dRE5mLKuBfJoLS3q31LhJbqaIssu6CZfBVSkwls4AoHJLmQ/ucDSkWISxczToqYstHqbDCO1BU=; 4:OykN99yu0rgcbBbVZzSwCDAGXV3LYgzhGNHRFfFuhCyrh+3ysknW2sfXlqUX1XhUZoYKBFV+7GmraL1FZbSbxz+vtIID9SvLVVygKFXqywUbAP8YWmyT94JdzzqMU2YVtDauiqFDw/yiZc6A2J27RC/t9J1OZGfsJFWRgbC8u1WE16tjqFXcvvMXZKAcqCih4VdQ4hRKtcpJ6isa7a8MHhihS5OA2N+/Y3codtH90ECLIB9Qt7hTQ2YbIrPcq7Jo8Kyno2Kp1GbiPRtJ6wVhsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CY4PR07MB3462; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3462; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(366004)(346002)(136003)(39850400004)(396003)(189003)(199004)(316002)(6486002)(36756003)(16586007)(106356001)(6666003)(14444005)(42882007)(5024004)(53936002)(107886003)(105586002)(4326008)(2906002)(1857600001)(16526019)(6512007)(5660300001)(97736004)(305945005)(48376002)(50466002)(8936002)(72206003)(8676002)(7736002)(476003)(486006)(956004)(2616005)(446003)(11346002)(50226002)(47776003)(66066001)(6116002)(3846002)(81156014)(1076002)(81166006)(76176011)(52116002)(51416003)(6506007)(386003)(26005)(25786009)(68736007)(478600001)(5009440100003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3462; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3462; 23:Lh9W8xZeSav33zy8NrcBd9q8vDuWwVGwvRyPJoxB3?= =?us-ascii?Q?ReKyiUS6szRqdL8ioQX/NvugLMtHwOIiOuCiykKH0Ydf8hdJY7R0NY8kV3po?= =?us-ascii?Q?1r9o0+Gk4AQq3hiYo/svaAv/SW2bkSqkmBc/qKTB/h4vN7v2P7jNnnHfIMnj?= =?us-ascii?Q?ylULGhM1XcDRCuVj/MA+6ICfnfqvXBnJGgDonRskd7O9s7TDWvQby4Zb65dG?= =?us-ascii?Q?a5HvooJsD1JPm6yrXdQmjzV0IYugVcgO4eTw82D2+VUQjZiqZ04PrBtRe/ym?= =?us-ascii?Q?x8I8RMRek7Uw5QBG9Ln/LdPjSzYM1eVMrHzgaFgJW507dRUzgf42KeEW6F3Q?= =?us-ascii?Q?LRh2V5m14qVmE8QnVjqnhdb8Gqs3HE4M23EEht++Aj24LUhZvTwtkP+I5L3c?= =?us-ascii?Q?Fl+mElgbghmMSMLx0erP0V9JDBsHGYMc4xa1tDThNy8R5nyeuMRfxgGGyBFv?= =?us-ascii?Q?lTdnXcJcb3S+Ytpnin9mvEeeDE+Rp928h2zKQaaGa/6B9Gz5fkhCEpMl84aa?= =?us-ascii?Q?8PaRRs+jSr8beiwwoDMbP73/Z2d03ObJANWyayWGNeXAU6vDB+uuNlei0GuI?= =?us-ascii?Q?FwgOgqlYrawr6JYtpoBoEEeoxsL0i07/u8Wd1jxrJN++AiOJKcq8vaUumhxo?= =?us-ascii?Q?OhhekKPhuQ6nhPTnIsmUtYY2Lqc4UEyThq9fzgO9Fk6tmNa2ylDnkTU3kGjd?= =?us-ascii?Q?kQXTFhIsF3dNRFs9lSZYdwhTIigJzNGEPZikGa3h4D8BxFkhnnWvBsWKFk51?= =?us-ascii?Q?7pAtB+cC5o42F9A64Zvn+W5Q59ch03fR7OJTdYTDqdrW37lBSDRvNaLyrWxG?= =?us-ascii?Q?hSiLsFuIFpEZSDYGlQ+ojBMa5UpBK3gteKN0tBgzQSqLBy5JmTU4MLiCTGk7?= =?us-ascii?Q?ZvRHwfQCHws8e+KpBJt/W3V9DFQQOAk6dUo8c9H/G8gC49m1dyKyUNw2Cvou?= =?us-ascii?Q?Mo5JcHZqo89bNW0ESwpqaKyOPyPndReOOEwyPNgU1M0xGXTkq/UHOnbiJX7X?= =?us-ascii?Q?43UxkoqlVbHVXx4VMbrGL+5aDgVnHNTWV3aYcYGMTU5+XWWEh32lRyErJ0ux?= =?us-ascii?Q?2yFqLkiXdcJamDXLBDGMJl30vBTcekdXuoBacnlMfAT7cSJpraN3JC3LbO/E?= =?us-ascii?Q?zI6w6UP/hbnF8YFOL/14XZlvV47dpYNCkdjToqCo+0OewgLxMEK3jEnIUnfE?= =?us-ascii?Q?cxHCnCmLsMixrhCPsodvTeOWQGhwp2r6UBdA4klHF/1HE+N7X9T38alhVsRj?= =?us-ascii?Q?ZYwHSyy+uBVd+SouZMuartLVezRnmb0FAUYMdx6VScx/P3BiL3Jq5Y697u7T?= =?us-ascii?Q?CCG86svDdBvGviI6kvuLYrqOThr+Rbbxakd6a5MoG75?= X-Microsoft-Antispam-Message-Info: S4rmP/JhxCgDrz9MlDWBU1VRg+CMEgSXguArRkoBai1XSlPB+MUt6gAWQ8S8ogmG87/uxxacUex7W3SzrW+P77jgt4HwSqduCrbmtJ4vWW0o60dSg9s73xxuaKdktZohD6abnFETpJlNphLVi5ms3ASuRc6xRRlWVn3vcGrhXTfJaphxiKXKYiQXEaJ7/EqiBGS7pgdfEY1GLFrSZMwXzQnQPe210FtHt9GssBtL6HH0eTCk1Rr/mKrcoV9ovHt+MfHdNs6z+mNvFqVE45lLVbiPVCyK2lFsiqTNQfzWSX5JHdvigFJa9bGO+6Hr2UBoIhrUu4djZsnYFDHXazcxzooAF0rcC0z9NU4UD0S+Nj8= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 6:j9uCCvUPXRjtfjprAUeZRRPMRwMaChUqyLjnYt9KnYOtajLLaceWX3T+NWxXm1WjtJZ8nXhNhB7dg+ZbExMgaZq4+WiJszDwaApYbAM48NErLDAi+LLpzLMDa/VQimwHYyz1tBQwvfXzfhQUZFq1i/qneKmkHl+q69ca0+kpe+keh51fHnPAnvY3R8R9L26QuY+54e36Bipr72GxfUXKCRactjuTzwtzpKu06nQdCkOFZmy2Ym2pF3Sf7ArtbAG+MmI/yuHlckh11vA9qZqVz6ejNVorZiIjpOzVfAPxJZCCKIh7RWlAP9ODBDXjdxxwrl47ZGfnmtnC7fiPhMgsV6yKFatp+oJEzH2Stg8tl10H3Hnn2FreAOB5cQQmhtDtHFwuvJBZ2Yp28k9OsRE1kJPHOQCwC0xChQcviWfCp/vdNbwgK5nXKo22bbIOwh6+Vv78Tf8z3Y5RQNuoTKCGXg==; 5:pkrlvx6WOy5QBy0fDl+bjtIeJQcFl4UiYb6Ihtb8NBSdfHQToOgQRtJlnU/R2VKZ/M7+x6fIzV0fBprFvoOCWpe3z4sYUn8inDHS1JuMpGLvOHchfFlNfNo8uJ7C2zSAfB3o+N6vUB9soV3/CULoVHEQSscBphGyoxQfHjyahDU=; 24:925/7k0keYMpXic+MgZjHyHgJ/mGZBpwmgMvVJz464ba9rpiaH29Y8/IvA9ln7uY5sXhTQ58dMqzF8T7mEdOjY261MCVPQTnOurpvE1cMow= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 7:Au3fegjGf6KIN4qVwozLwT5nP9uzy9xDxsoUX1++q9MblofvP8T4CfnV7v3dapwJUwRtofx+UgiA7omSG8IZKiAA2jYBYYiyP9NtXDQpnTDvVGtRqWobLvhqUjB0nzFkBBMGk87HCjXJdKarnQDQ+FozNgM0eFbqzQLkyyUXQ2cBqWPSkEeRoV58bu06s1gKGyXZMD2nTQE1xYe9fBmU2J2qtanpBqhDxGRxB/HarPTwrIi78WE60VMcj8DGRVAu X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 06:30:05.0134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9cfc7d8-7339-4ab9-0eb9-08d5dfe540cd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3462 Subject: [dpdk-dev] [PATCH v2] mempool/octeontx: fix pool to aura mapping 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: , X-List-Received-Date: Mon, 02 Jul 2018 06:30:09 -0000 HW needs each pool to be mapped to an aura set of 16 auras. Previously, pool to aura mapping was considered to be 1:1. Fixes: 02fd6c744350 ("mempool/octeontx: support allocation") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh Acked-by: Santosh Shukla --- v2 Changes: - use macro to avoid code duplication (Santosh). - use uint16_t for gaura id. drivers/event/octeontx/timvf_evdev.c | 2 +- drivers/mempool/octeontx/octeontx_fpavf.c | 45 ++++++++++++++--------- drivers/mempool/octeontx/octeontx_fpavf.h | 9 +++++ drivers/net/octeontx/octeontx_ethdev.c | 6 +-- drivers/net/octeontx/octeontx_rxtx.c | 2 +- 5 files changed, 42 insertions(+), 22 deletions(-) diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index c4fbd2d86..8a045c250 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -174,7 +174,7 @@ timvf_ring_start(const struct rte_event_timer_adapter *adptr) if (use_fpa) { pool = (uintptr_t)((struct rte_mempool *) timr->chunk_pool)->pool_id; - ret = octeontx_fpa_bufpool_gpool(pool); + ret = octeontx_fpa_bufpool_gaura(pool); if (ret < 0) { timvf_log_dbg("Unable to get gaura id"); ret = -ENOMEM; diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 7aecaa85d..e5918c866 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.c +++ b/drivers/mempool/octeontx/octeontx_fpavf.c @@ -243,7 +243,7 @@ octeontx_fpapf_pool_setup(unsigned int gpool, unsigned int buf_size, POOL_LTYPE(0x2) | POOL_STYPE(0) | POOL_SET_NAT_ALIGN | POOL_ENA; - cfg.aid = 0; + cfg.aid = FPA_AURA_IDX(gpool); cfg.pool_cfg = reg; cfg.pool_stack_base = phys_addr; cfg.pool_stack_end = phys_addr + memsz; @@ -327,7 +327,7 @@ octeontx_fpapf_aura_attach(unsigned int gpool_index) hdr.vfid = gpool_index; hdr.res_code = 0; memset(&cfg, 0x0, sizeof(struct octeontx_mbox_fpa_cfg)); - cfg.aid = gpool_index; /* gpool is guara */ + cfg.aid = gpool_index << FPA_GAURA_SHIFT; ret = octeontx_mbox_send(&hdr, &cfg, sizeof(struct octeontx_mbox_fpa_cfg), @@ -335,7 +335,8 @@ octeontx_fpapf_aura_attach(unsigned int gpool_index) if (ret < 0) { fpavf_log_err("Could not attach fpa "); fpavf_log_err("aura %d to pool %d. Err=%d. FuncErr=%d\n", - gpool_index, gpool_index, ret, hdr.res_code); + gpool_index << FPA_GAURA_SHIFT, gpool_index, ret, + hdr.res_code); ret = -EACCES; goto err; } @@ -355,14 +356,15 @@ octeontx_fpapf_aura_detach(unsigned int gpool_index) goto err; } - cfg.aid = gpool_index; /* gpool is gaura */ + cfg.aid = gpool_index << FPA_GAURA_SHIFT; hdr.coproc = FPA_COPROC; hdr.msg = FPA_DETACHAURA; hdr.vfid = gpool_index; ret = octeontx_mbox_send(&hdr, &cfg, sizeof(cfg), NULL, 0); if (ret < 0) { fpavf_log_err("Couldn't detach FPA aura %d Err=%d FuncErr=%d\n", - gpool_index, ret, hdr.res_code); + gpool_index << FPA_GAURA_SHIFT, ret, + hdr.res_code); ret = -EINVAL; } @@ -469,6 +471,7 @@ octeontx_fpa_bufpool_free_count(uintptr_t handle) { uint64_t cnt, limit, avail; uint8_t gpool; + uint16_t gaura; uintptr_t pool_bar; if (unlikely(!octeontx_fpa_handle_valid(handle))) @@ -476,14 +479,16 @@ octeontx_fpa_bufpool_free_count(uintptr_t handle) /* get the gpool */ gpool = octeontx_fpa_bufpool_gpool(handle); + /* get the aura */ + gaura = octeontx_fpa_bufpool_gaura(handle); /* Get pool bar address from handle */ pool_bar = handle & ~(uint64_t)FPA_GPOOL_MASK; cnt = fpavf_read64((void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT(gpool))); + FPA_VF_VHAURA_CNT(gaura))); limit = fpavf_read64((void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_LIMIT(gpool))); + FPA_VF_VHAURA_CNT_LIMIT(gaura))); avail = fpavf_read64((void *)((uintptr_t)pool_bar + FPA_VF_VHPOOL_AVAILABLE(gpool))); @@ -496,6 +501,7 @@ octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, unsigned int buf_offset, int node_id) { unsigned int gpool; + unsigned int gaura; uintptr_t gpool_handle; uintptr_t pool_bar; int res; @@ -545,16 +551,18 @@ octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, goto error_pool_destroy; } + gaura = FPA_AURA_IDX(gpool); + /* Release lock */ rte_spinlock_unlock(&fpadev.lock); /* populate AURA registers */ fpavf_write64(object_count, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT(gpool))); + FPA_VF_VHAURA_CNT(gaura))); fpavf_write64(object_count, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_LIMIT(gpool))); + FPA_VF_VHAURA_CNT_LIMIT(gaura))); fpavf_write64(object_count + 1, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_THRESHOLD(gpool))); + FPA_VF_VHAURA_CNT_THRESHOLD(gaura))); octeontx_fpapf_start_count(gpool); @@ -581,6 +589,7 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) uint64_t sz; uint64_t cnt, avail; uint8_t gpool; + uint16_t gaura; uintptr_t pool_bar; int ret; @@ -594,13 +603,15 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) /* get the pool */ gpool = octeontx_fpa_bufpool_gpool(handle); + /* get the aura */ + gaura = octeontx_fpa_bufpool_gaura(handle); /* Get pool bar address from handle */ pool_bar = handle & ~(uint64_t)FPA_GPOOL_MASK; /* Check for no outstanding buffers */ cnt = fpavf_read64((void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT(gpool))); + FPA_VF_VHAURA_CNT(gaura))); if (cnt) { fpavf_log_dbg("buffer exist in pool cnt %" PRId64 "\n", cnt); return -EBUSY; @@ -613,9 +624,9 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) /* Prepare to empty the entire POOL */ fpavf_write64(avail, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_LIMIT(gpool))); + FPA_VF_VHAURA_CNT_LIMIT(gaura))); fpavf_write64(avail + 1, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_THRESHOLD(gpool))); + FPA_VF_VHAURA_CNT_THRESHOLD(gaura))); /* Empty the pool */ /* Invalidate the POOL */ @@ -627,11 +638,11 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) /* Yank a buffer from the pool */ node = (void *)(uintptr_t) fpavf_read64((void *) - (pool_bar + FPA_VF_VHAURA_OP_ALLOC(gpool))); + (pool_bar + FPA_VF_VHAURA_OP_ALLOC(gaura))); if (node == NULL) { fpavf_log_err("GAURA[%u] missing %" PRIx64 " buf\n", - gpool, avail); + gaura, avail); break; } @@ -665,9 +676,9 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) /* Deactivate the AURA */ fpavf_write64(0, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_LIMIT(gpool))); + FPA_VF_VHAURA_CNT_LIMIT(gaura))); fpavf_write64(0, (void *)((uintptr_t)pool_bar + - FPA_VF_VHAURA_CNT_THRESHOLD(gpool))); + FPA_VF_VHAURA_CNT_THRESHOLD(gaura))); ret = octeontx_fpapf_aura_detach(gpool); if (ret) { diff --git a/drivers/mempool/octeontx/octeontx_fpavf.h b/drivers/mempool/octeontx/octeontx_fpavf.h index b76f40e75..b00be137a 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.h +++ b/drivers/mempool/octeontx/octeontx_fpavf.h @@ -14,6 +14,7 @@ #define FPA_VF_MAX 32 #define FPA_GPOOL_MASK (FPA_VF_MAX-1) +#define FPA_GAURA_SHIFT 4 /* FPA VF register offsets */ #define FPA_VF_INT(x) (0x200ULL | ((x) << 22)) @@ -36,6 +37,7 @@ #define FPA_VF_FREE_ADDRS_S(x, y, z) \ ((x) | (((y) & 0x1ff) << 3) | ((((z) & 1)) << 14)) +#define FPA_AURA_IDX(gpool) (gpool << FPA_GAURA_SHIFT) /* FPA VF register offsets from VF_BAR4, size 2 MByte */ #define FPA_VF_MSIX_VEC_ADDR 0x00000 #define FPA_VF_MSIX_VEC_CTL 0x00008 @@ -102,4 +104,11 @@ octeontx_fpa_bufpool_gpool(uintptr_t handle) { return (uint8_t)handle & FPA_GPOOL_MASK; } + +static __rte_always_inline uint16_t +octeontx_fpa_bufpool_gaura(uintptr_t handle) +{ + return octeontx_fpa_bufpool_gpool(handle) << FPA_GAURA_SHIFT; +} + #endif /* __OCTEONTX_FPAVF_H__ */ diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 1eb453b21..705378186 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -787,7 +787,7 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, pki_qos_cfg_t pki_qos; uintptr_t pool; int ret, port; - uint8_t gaura; + uint16_t gaura; unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx; unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx; @@ -898,8 +898,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, pool = (uintptr_t)mb_pool->pool_id; - /* Get the gpool Id */ - gaura = octeontx_fpa_bufpool_gpool(pool); + /* Get the gaura Id */ + gaura = octeontx_fpa_bufpool_gaura(pool); pki_qos.qpg_qos = PKI_QPG_QOS_NONE; pki_qos.num_entry = 1; diff --git a/drivers/net/octeontx/octeontx_rxtx.c b/drivers/net/octeontx/octeontx_rxtx.c index 2502d90e9..a9149b4e1 100644 --- a/drivers/net/octeontx/octeontx_rxtx.c +++ b/drivers/net/octeontx/octeontx_rxtx.c @@ -31,7 +31,7 @@ __octeontx_xmit_pkts(void *lmtline_va, void *ioreg_va, int64_t *fc_status_va, return -ENOSPC; /* Get the gaura Id */ - gaura_id = octeontx_fpa_bufpool_gpool((uintptr_t)tx_pkt->pool->pool_id); + gaura_id = octeontx_fpa_bufpool_gaura((uintptr_t)tx_pkt->pool->pool_id); /* Setup PKO_SEND_HDR_S */ cmd_buf[0] = tx_pkt->data_len & 0xffff; -- 2.18.0