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 2320AA0C49 for ; Wed, 16 Jun 2021 20:43:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CDDF4067A; Wed, 16 Jun 2021 20:43:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id AE111410DA for ; Wed, 16 Jun 2021 20:43:05 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15GIUOmb024391; Wed, 16 Jun 2021 11:43:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=jJ/8pWMM5FQbtM5CX7UfK37BQOyY0Qow+g9NLuba83Q=; b=hoUGTHmV3nmL6bltYCJ1jM8PuzCuYfpplzpMD4+IjztFJVAB3/zXzMsBWeDV49ddnyLG i/uUuWRZwNN9NVmRgHjjEh1MPchhzqMNvJbfOhF7H2go//GUnndTuQFlFS2O2gyY2LIn pIaKHB92187ZU4Ek9GhXJp6KRX/UDhE7DlxqgSlKBXAVmedK9P7YJvvx6qprfrqItdSO dLoMPwh5Vl9AVBrtrMJQ8moGAatIRkJ9gi5Y52gggjNiZvgn/aAJ2eOVRm7I2lIOEJIx jyg34LXIyhUdE2pMozdWYmj59lnJakJ0kE76KgUdXvNt9JoG9Q8sqWZbuHE0asw7XCcK EQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 397auvk9ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 16 Jun 2021 11:43:04 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 16 Jun 2021 11:43:03 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 16 Jun 2021 11:43:03 -0700 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id 4DDE03F70D1; Wed, 16 Jun 2021 11:43:02 -0700 (PDT) From: Shijith Thotton To: CC: Pavan Nikhilesh , Date: Thu, 17 Jun 2021 00:12:10 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: QMOE9uK3RjXWaflzCVWMXpyidKuGv3ck X-Proofpoint-GUID: QMOE9uK3RjXWaflzCVWMXpyidKuGv3ck X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-16_11:2021-06-15, 2021-06-16 signatures=0 Subject: [dpdk-stable] [PATCH 20.11 3/3] event/octeontx2: fix XAQ pool reconfigure 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 Sender: "stable" From: Pavan Nikhilesh [ upstream commit 052a5d38676373971cf2840c695a1421d2ac3045 ] When XAQ pool is being re-configured, and if the same memzone is used for fc_mem when freeing the old mempool the fc_mem will be incorrectly updated with the free count. Fixes: ffa4ec0b6063 ("event/octeontx2: allow adapters to resize inflight buffers") Signed-off-by: Pavan Nikhilesh --- drivers/common/octeontx2/otx2_mbox.h | 7 +++++++ drivers/event/octeontx2/otx2_evdev.c | 31 ++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/common/octeontx2/otx2_mbox.h b/drivers/common/octeontx2/otx2_mbox.h index f6d884c19..51b25ab42 100644 --- a/drivers/common/octeontx2/otx2_mbox.h +++ b/drivers/common/octeontx2/otx2_mbox.h @@ -177,6 +177,8 @@ M(SSO_GRP_GET_STATS, 0x609, sso_grp_get_stats, sso_info_req, \ sso_grp_stats) \ M(SSO_HWS_GET_STATS, 0x610, sso_hws_get_stats, sso_info_req, \ sso_hws_stats) \ +M(SSO_HW_RELEASE_XAQ, 0x611, sso_hw_release_xaq_aura, \ + sso_release_xaq, msg_rsp) \ /* TIM mbox IDs (range 0x800 - 0x9FF) */ \ M(TIM_LF_ALLOC, 0x800, tim_lf_alloc, tim_lf_alloc_req, \ tim_lf_alloc_rsp) \ @@ -1177,6 +1179,11 @@ struct sso_hw_setconfig { uint16_t __otx2_io hwgrps; }; +struct sso_release_xaq { + struct mbox_msghdr hdr; + uint16_t __otx2_io hwgrps; +}; + struct sso_info_req { struct mbox_msghdr hdr; union { diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c index 3afb5a30e..dd75b9f85 100644 --- a/drivers/event/octeontx2/otx2_evdev.c +++ b/drivers/event/octeontx2/otx2_evdev.c @@ -981,7 +981,7 @@ sso_xaq_allocate(struct otx2_sso_evdev *dev) dev->fc_iova = mz->iova; dev->fc_mem = mz->addr; - + *dev->fc_mem = 0; aura = (struct npa_aura_s *)((uintptr_t)dev->fc_mem + OTX2_ALIGN); memset(aura, 0, sizeof(struct npa_aura_s)); @@ -1057,6 +1057,19 @@ sso_ggrp_alloc_xaq(struct otx2_sso_evdev *dev) return otx2_mbox_process(mbox); } +static int +sso_ggrp_free_xaq(struct otx2_sso_evdev *dev) +{ + struct otx2_mbox *mbox = dev->mbox; + struct sso_release_xaq *req; + + otx2_sso_dbg("Freeing XAQ for GGRPs"); + req = otx2_mbox_alloc_msg_sso_hw_release_xaq_aura(mbox); + req->hwgrps = dev->nb_event_queues; + + return otx2_mbox_process(mbox); +} + static void sso_lf_teardown(struct otx2_sso_evdev *dev, enum otx2_sso_lf_type lf_type) @@ -1447,6 +1460,8 @@ sso_cleanup(struct rte_eventdev *event_dev, uint8_t enable) ssogws_reset((struct otx2_ssogws *)&ws->ws_state[1]); ws->swtag_req = 0; ws->vws = 0; + ws->fc_mem = dev->fc_mem; + ws->xaq_lmt = dev->xaq_lmt; ws->ws_state[0].cur_grp = 0; ws->ws_state[0].cur_tt = SSO_SYNC_EMPTY; ws->ws_state[1].cur_grp = 0; @@ -1457,6 +1472,8 @@ sso_cleanup(struct rte_eventdev *event_dev, uint8_t enable) ws = event_dev->data->ports[i]; ssogws_reset(ws); ws->swtag_req = 0; + ws->fc_mem = dev->fc_mem; + ws->xaq_lmt = dev->xaq_lmt; ws->cur_grp = 0; ws->cur_tt = SSO_SYNC_EMPTY; } @@ -1503,28 +1520,30 @@ int sso_xae_reconfigure(struct rte_eventdev *event_dev) { struct otx2_sso_evdev *dev = sso_pmd_priv(event_dev); - struct rte_mempool *prev_xaq_pool; int rc = 0; if (event_dev->data->dev_started) sso_cleanup(event_dev, 0); - prev_xaq_pool = dev->xaq_pool; + rc = sso_ggrp_free_xaq(dev); + if (rc < 0) { + otx2_err("Failed to free XAQ\n"); + return rc; + } + + rte_mempool_free(dev->xaq_pool); dev->xaq_pool = NULL; rc = sso_xaq_allocate(dev); if (rc < 0) { otx2_err("Failed to alloc xaq pool %d", rc); - rte_mempool_free(prev_xaq_pool); return rc; } rc = sso_ggrp_alloc_xaq(dev); if (rc < 0) { otx2_err("Failed to alloc xaq to ggrp %d", rc); - rte_mempool_free(prev_xaq_pool); return rc; } - rte_mempool_free(prev_xaq_pool); rte_mb(); if (event_dev->data->dev_started) sso_cleanup(event_dev, 1); -- 2.25.1