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 74F07A0548 for ; Sun, 21 Mar 2021 11:05:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66EDF140E6B; Sun, 21 Mar 2021 11:05:49 +0100 (CET) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by mails.dpdk.org (Postfix) with ESMTP id 00F7E40041; Sun, 21 Mar 2021 11:05:46 +0100 (CET) Received: by mail-il1-f181.google.com with SMTP id y17so469660ila.6; Sun, 21 Mar 2021 03:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uQZZ2daFetDa7wqozeJpV9otKspEkCAlKUfPWnY+nTE=; b=lSW5qMUUNeWgcuswuq3556rr9MAyz2CjMhL1I5QJ/fonFD02NKeS10A2r/fMV2ZR9B 9Xxdozlhjb5Zd59R8nZeS8Ef71xTfp0ZcmXrX3LfYhDWKuRJ/CHm+zAkV34JjRCRhyTp HvP4POZfOWQNZc0B0ZraWyxNEA0sDbiZ/TudIoysqLZ+5Mw7sW1x3dMF8cQO5w9GUkQy mMz8naOqaw8i7hI92ktIg4gXMQvDsKtlNlsTncjePwSftXta/HBE6ELdUUb7VpzEHcu1 9lR9UOf8hcHgWjPqNeeqTo4UvteQa+P6NzGf78xCYiOjqRZWS3+5J2MXiBZO769L0XxH jCtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uQZZ2daFetDa7wqozeJpV9otKspEkCAlKUfPWnY+nTE=; b=Q/I64E/7XqHpS3tk2c7cBNeRCz7iNB1uLzO0TBtYlgXhz/KIobe7+cwWpaOxJ8KOUu Oa+DRJd+npSCcU4OBeMluCZdwTXRDTmPr0Ne+nbkoVPGj3gTLIg06FuZmGBFEj3ZwGLO RMq4wPFVT5wty9TyBlwjLXddQTFAGfQKxPHjdvlj/th9il0gqioU2oGk2iLpFee0UQTe E6vrwE9SgTBEEmWpkMh09Tzf7QbRZKREWxYjsffjKq1vSWCCXykO7brthfnJeTj441fx L/SsViVbVd7ws0yohjAOfhJWVpezNdOB1/xx/dYo8r7eMUw1Cw6pOBnuwO2W0NEySSA/ UccA== X-Gm-Message-State: AOAM530rE14UuzTQotVkIji3qjMp+ScSo0AEm1o7gZclj2s/qMAR+T0S XPLLVYUEHf8XKJ2DPXvFWbNSl90kTdHQFFytxNexjUEvbryPLA== X-Google-Smtp-Source: ABdhPJweYtl3/jl1X1tYj9SLC35Jtn/0B9sBgSG3nCeFPBd3QWf7EzGd8/5bQ7f2NA3lL0kr4o+T7K/HKZsFq2dqFHU= X-Received: by 2002:a05:6e02:f90:: with SMTP id v16mr7674677ilo.294.1616321146211; Sun, 21 Mar 2021 03:05:46 -0700 (PDT) MIME-Version: 1.0 References: <20210319210815.2884-1-pbhagavatula@marvell.com> In-Reply-To: <20210319210815.2884-1-pbhagavatula@marvell.com> From: Jerin Jacob Date: Sun, 21 Mar 2021 15:35:29 +0530 Message-ID: To: Pavan Nikhilesh Cc: Jerin Jacob , Nithin Dabilpuram , dpdk-dev , dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] 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" On Sat, Mar 20, 2021 at 2:38 AM wrote: > > From: Pavan Nikhilesh > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Pavan Nikhilesh Applied to dpdk-next-net-eventdev/for-main. Thanks > --- > 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 7e7667bf0..ae6c661ab 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) \ > @@ -1190,6 +1192,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 7e2343599..770a801c4 100644 > --- a/drivers/event/octeontx2/otx2_evdev.c > +++ b/drivers/event/octeontx2/otx2_evdev.c > @@ -986,7 +986,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)); > > @@ -1062,6 +1062,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) > @@ -1452,12 +1465,16 @@ 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; > } else { > struct otx2_ssogws *ws; > > 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; > } > } > > @@ -1498,28 +1515,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.17.1 >