[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250814011132.GA30001@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Wed, 13 Aug 2025 18:11:32 -0700
From: Dipayaan Roy <dipayanroy@...ux.microsoft.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: horms@...nel.org, kys@...rosoft.com, haiyangz@...rosoft.com,
wei.liu@...nel.org, decui@...rosoft.com, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
longli@...rosoft.com, kotaranov@...rosoft.com, ast@...nel.org,
daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
sdf@...ichev.me, lorenzo@...nel.org, michal.kubiak@...el.com,
ernis@...ux.microsoft.com, shradhagupta@...ux.microsoft.com,
shirazsaleem@...rosoft.com, rosenp@...il.com,
netdev@...r.kernel.org, linux-hyperv@...r.kernel.org,
linux-rdma@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, dipayanroy@...rosoft.com
Subject: Re: [PATCH net-next v4] net: mana: Use page pool fragments for RX
buffers instead of full pages to improve memory efficiency.
Hi Jakub,
Thank you for the review comments,
On Wed, Aug 13, 2025 at 04:48:47PM -0700, Jakub Kicinski wrote:
> On Mon, 11 Aug 2025 15:29:19 -0700 Dipayaan Roy wrote:
> > - if (apc->port_is_up)
> > + if (apc->port_is_up) {
> > + /* Re-create rxq's after xdp prog was loaded or unloaded.
> > + * Ex: re create rxq's to switch from full pages to smaller
> > + * size page fragments when xdp prog is unloaded and
> > + * vice-versa.
> > + */
> > +
> > + /* Pre-allocate buffers to prevent failure in mana_attach */
> > + err = mana_pre_alloc_rxbufs(apc, ndev->mtu, apc->num_queues);
> > + if (err) {
> > + NL_SET_ERR_MSG_MOD
> > + (extack,
> > + "XDP: Insufficient memory for tx/rx re-config");
>
> This weird line breaking is not necessary, checkpatch understands that
> string can go over line limit:
>
> NL_SET_ERR_MSG_MOD(extack,
> "XDP: Insufficient memory for tx/rx re-config");
>
Ok, I willl rectify this in v5.
> > + return err;
>
> I think you already replaced the bpf program at this point?
> So the allocation should happen earlier. On failure changes
> to the driver state should be undone.
The bpf prog gets completely replaced in mana_chn_setxdp,
I suggest these changes below to address your point on alloc failure
and will work on a v5:
diff --git a/drivers/net/ethernet/microsoft/mana/mana_bpf.c
b/drivers/net/ethernet/microsoft/mana/mana_bpf.c
index e616f4239294..0000c1dd7aa2 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_bpf.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_bpf.c
@@ -196,9 +196,6 @@ static int mana_xdp_set(struct net_device *ndev,
struct bpf_prog *prog,
*/
apc->bpf_prog = prog;
- if (old_prog)
- bpf_prog_put(old_prog);
-
if (apc->port_is_up) {
/* Re-create rxq's after xdp prog was loaded or
* unloaded.
* Ex: re create rxq's to switch from full pages to
* smaller
@@ -237,6 +234,9 @@ static int mana_xdp_set(struct net_device *ndev,
struct bpf_prog *prog,
mana_pre_dealloc_rxbufs(apc);
}
+ if (old_prog)
+ bpf_prog_put(old_prog);
+
if (prog)
ndev->max_mtu = MANA_XDP_MTU_MAX;
else
@@ -245,6 +245,7 @@ static int mana_xdp_set(struct net_device *ndev,
struct bpf_prog *prog,
return 0;
err_dealloc_rxbuffs:
+ apc->bpf_prog = old_prog;
mana_pre_dealloc_rxbufs(apc);
return err;
}
> --
> pw-bot: cr
Thanks
Dipayaan Roy
Powered by blists - more mailing lists