From: Simon Horman <simon.horman@corigine.com>
To: Sai Krishna <saikrishnag@marvell.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, leon@kernel.org,
sgoutham@marvell.com, gakula@marvell.com, lcherian@marvell.com,
jerinj@marvell.com, hkelam@marvell.com, sbhatta@marvell.com,
Ratheesh Kannoth <rkannoth@marvell.com>
Subject: Re: [net PATCH v3 09/10] octeontx2-af: Skip PFs if not enabled
Date: Wed, 19 Apr 2023 12:51:09 +0200 [thread overview]
Message-ID: <ZD/HncVvuuDIlHXv@corigine.com> (raw)
In-Reply-To: <20230419062018.286136-10-saikrishnag@marvell.com>
On Wed, Apr 19, 2023 at 11:50:17AM +0530, Sai Krishna wrote:
> From: Ratheesh Kannoth <rkannoth@marvell.com>
>
> Skip mbox initialization of disabled PFs. Firmware configures PFs
> and allocate mbox resources etc. Linux should configure particular
> PFs, which ever are enabled by firmware.
>
> Fixes: 9bdc47a6e328 ("octeontx2-af: Mbox communication support btw AF and it's VFs")
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
...
> @@ -2343,8 +2349,27 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> int err = -EINVAL, i, dir, dir_up;
> void __iomem *reg_base;
> struct rvu_work *mwork;
> + unsigned long *pf_bmap;
> void **mbox_regions;
> const char *name;
> + u64 cfg;
> +
> + pf_bmap = kcalloc(BITS_TO_LONGS(num), sizeof(long), GFP_KERNEL);
Sorry for not noticing this earlier, but
maybe bitmap_alloc() is appropriate here.
> + if (!pf_bmap)
> + return -ENOMEM;
> +
> + /* RVU VFs */
> + if (type == TYPE_AFVF)
> + bitmap_set(pf_bmap, 0, num);
> +
> + if (type == TYPE_AFPF) {
> + /* Mark enabled PFs in bitmap */
> + for (i = 0; i < num; i++) {
> + cfg = rvu_read64(rvu, BLKADDR_RVUM, RVU_PRIV_PFX_CFG(i));
> + if (cfg & BIT_ULL(20))
> + set_bit(i, pf_bmap);
> + }
> + }
>
> mbox_regions = kcalloc(num, sizeof(void *), GFP_KERNEL);
> if (!mbox_regions)
I think pf_bmap is leaked here.
> @@ -2356,7 +2381,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> dir = MBOX_DIR_AFPF;
> dir_up = MBOX_DIR_AFPF_UP;
> reg_base = rvu->afreg_base;
> - err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF);
> + err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF, pf_bmap);
> if (err)
> goto free_regions;
> break;
> @@ -2365,7 +2390,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> dir = MBOX_DIR_PFVF;
> dir_up = MBOX_DIR_PFVF_UP;
> reg_base = rvu->pfreg_base;
> - err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF);
> + err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF, pf_bmap);
> if (err)
> goto free_regions;
> break;
> @@ -2396,16 +2421,19 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> }
>
> err = otx2_mbox_regions_init(&mw->mbox, mbox_regions, rvu->pdev,
> - reg_base, dir, num);
> + reg_base, dir, num, pf_bmap);
> if (err)
> goto exit;
>
> err = otx2_mbox_regions_init(&mw->mbox_up, mbox_regions, rvu->pdev,
> - reg_base, dir_up, num);
> + reg_base, dir_up, num, pf_bmap);
> if (err)
> goto exit;
>
> for (i = 0; i < num; i++) {
> + if (!test_bit(i, pf_bmap))
> + continue;
> +
> mwork = &mw->mbox_wrk[i];
> mwork->rvu = rvu;
> INIT_WORK(&mwork->work, mbox_handler);
> @@ -2415,6 +2443,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> INIT_WORK(&mwork->work, mbox_up_handler);
> }
> kfree(mbox_regions);
> + kfree(pf_bmap);
> return 0;
>
> exit:
> @@ -2424,6 +2453,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
> iounmap((void __iomem *)mbox_regions[num]);
> free_regions:
> kfree(mbox_regions);
> + kfree(pf_bmap);
> return err;
> }
>
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-04-19 10:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 6:20 [net PATCH v3 00/10] octeontx2: Miscellaneous fixes Sai Krishna
2023-04-19 6:20 ` [net PATCH v3 01/10] octeontx2-af: Secure APR table update with the lock Sai Krishna
2023-04-19 6:20 ` [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for scan config Sai Krishna
2023-04-19 10:35 ` Simon Horman
2023-04-20 7:32 ` Sai Krishna Gajula
2023-04-19 6:20 ` [net PATCH v3 03/10] octeontx2-af: Fix depth of cam and mem table Sai Krishna
2023-04-19 9:54 ` Simon Horman
2023-04-20 7:40 ` Sai Krishna Gajula
2023-04-19 6:20 ` [net PATCH v3 04/10] octeontx2-pf: Increase the size of dmac filter flows Sai Krishna
2023-04-19 10:38 ` Simon Horman
2023-04-19 6:20 ` [net PATCH v3 05/10] octeontx2-af: Add validation for lmac type Sai Krishna
2023-04-19 6:20 ` [net PATCH v3 06/10] octeontx2-af: Update correct mask to filter IPv4 fragments Sai Krishna
2023-04-19 6:20 ` [net PATCH v3 07/10] octeontx2-af: Update/Fix NPC field hash extract feature Sai Krishna
2023-04-19 11:05 ` Simon Horman
2023-04-19 6:20 ` [net PATCH v3 08/10] octeontx2-af: Fix issues with NPC field hash extract Sai Krishna
2023-04-19 11:06 ` Simon Horman
2023-04-19 6:20 ` [net PATCH v3 09/10] octeontx2-af: Skip PFs if not enabled Sai Krishna
2023-04-19 10:51 ` Simon Horman [this message]
2023-04-20 7:29 ` Sai Krishna Gajula
2023-04-19 6:20 ` [net PATCH v3 10/10] octeontx2-pf: Disable packet I/O for graceful exit Sai Krishna
2023-04-19 11:03 ` Simon Horman
2023-04-20 7:21 ` Sai Krishna Gajula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZD/HncVvuuDIlHXv@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=jerinj@marvell.com \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=saikrishnag@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).