2024-06-10 03:53:23

by Aryan Srivastava

[permalink] [raw]
Subject: [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames

Setting frag_size to 0 to indicate kmalloc has been deprecated,
use slab_build_skb directly.

Signed-off-by: Aryan Srivastava <[email protected]>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index aca17082b9ec..05f4aa11b95c 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4001,7 +4001,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
}
}

- skb = build_skb(data, frag_size);
+ if (frag_size)
+ skb = build_skb(data, frag_size);
+ else
+ skb = slab_build_skb(data);
if (!skb) {
netdev_warn(port->dev, "skb build failed\n");
goto err_drop_frame;
--
2.43.2



2024-06-12 02:33:30

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames

On Mon, 10 Jun 2024 15:53:00 +1200 Aryan Srivastava wrote:
> Setting frag_size to 0 to indicate kmalloc has been deprecated,
> use slab_build_skb directly.

Makes sense but please repost with a Fixes tag added.
Presumably pointing at the commit which started rejecting 0-length frag
from build_skb().
--
pw-bot: cr

2024-06-13 02:49:27

by Aryan Srivastava

[permalink] [raw]
Subject: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

Setting frag_size to 0 to indicate kmalloc has been deprecated,
use slab_build_skb directly.

Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
Signed-off-by: Aryan Srivastava <[email protected]>
---
Changes in v1:
- Added Fixes tag

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index aca17082b9ec..05f4aa11b95c 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4001,7 +4001,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
}
}

- skb = build_skb(data, frag_size);
+ if (frag_size)
+ skb = build_skb(data, frag_size);
+ else
+ skb = slab_build_skb(data);
if (!skb) {
netdev_warn(port->dev, "skb build failed\n");
goto err_drop_frame;
--
2.43.2


2024-06-13 03:08:04

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

On Thu, Jun 13, 2024 at 02:49:00PM +1200, Aryan Srivastava wrote:
> Setting frag_size to 0 to indicate kmalloc has been deprecated,
> use slab_build_skb directly.
>
> Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
> Signed-off-by: Aryan Srivastava <[email protected]>
> ---
> Changes in v1:
> - Added Fixes tag

This looks like similar updates like commit 99b415fe8986 ("tg3: Use
slab_build_skb() when needed")

Reviewed-by: Kees Cook <[email protected]>

--
Kees Cook

2024-06-13 03:34:45

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

On Thu, Jun 13, 2024 at 03:13:34AM +0000, Aryan Srivastava wrote:
> On Wed, 2024-06-12 at 20:05 -0700, Kees Cook wrote:
> > On Thu, Jun 13, 2024 at 02:49:00PM +1200, Aryan Srivastava wrote:
> > > Setting frag_size to 0 to indicate kmalloc has been deprecated,
> > > use slab_build_skb directly.
> > >
> > > Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
> > > Signed-off-by: Aryan Srivastava
> > > <[email protected]>
> > > ---
> > > Changes in v1:
> > > - Added Fixes tag
> >
> > This looks like similar updates like commit 99b415fe8986 ("tg3: Use
> > slab_build_skb() when needed")
> Yeah, I noticed that when I was looking for examples of other "Fixes"
> tags for the "skbuff: Introduce slab_build_skb()" commit. I suspect
> there are many drivers that will need this "fix".

Yeah, at the time the API changes was made it was clear it wasn't easy
to identify which needed it, so the WARN was added along with supporting
the old style via internal fall-back.

-Kees

> >
> > Reviewed-by: Kees Cook <[email protected]>
> >
>

--
Kees Cook

2024-06-13 23:33:33

by Aryan Srivastava

[permalink] [raw]
Subject: Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

On Wed, 2024-06-12 at 20:05 -0700, Kees Cook wrote:
> On Thu, Jun 13, 2024 at 02:49:00PM +1200, Aryan Srivastava wrote:
> > Setting frag_size to 0 to indicate kmalloc has been deprecated,
> > use slab_build_skb directly.
> >
> > Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
> > Signed-off-by: Aryan Srivastava
> > <[email protected]>
> > ---
> > Changes in v1:
> > - Added Fixes tag
>
> This looks like similar updates like commit 99b415fe8986 ("tg3: Use
> slab_build_skb() when needed")
Yeah, I noticed that when I was looking for examples of other "Fixes"
tags for the "skbuff: Introduce slab_build_skb()" commit. I suspect
there are many drivers that will need this "fix".
>
> Reviewed-by: Kees Cook <[email protected]>
>

2024-06-13 23:57:10

by Aryan Srivastava

[permalink] [raw]
Subject: Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

On Wed, 2024-06-12 at 20:34 -0700, Kees Cook wrote:
> On Thu, Jun 13, 2024 at 03:13:34AM +0000, Aryan Srivastava wrote:
> > On Wed, 2024-06-12 at 20:05 -0700, Kees Cook wrote:
> > > On Thu, Jun 13, 2024 at 02:49:00PM +1200, Aryan Srivastava wrote:
> > > > Setting frag_size to 0 to indicate kmalloc has been deprecated,
> > > > use slab_build_skb directly.
> > > >
> > > > Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
> > > > Signed-off-by: Aryan Srivastava
> > > > <[email protected]>
> > > > ---
> > > > Changes in v1:
> > > > - Added Fixes tag
> > >
> > > This looks like similar updates like commit 99b415fe8986 ("tg3:
> > > Use
> > > slab_build_skb() when needed")
> > Yeah, I noticed that when I was looking for examples of other
> > "Fixes"
> > tags for the "skbuff: Introduce slab_build_skb()" commit. I suspect
> > there are many drivers that will need this "fix".
>
> Yeah, at the time the API changes was made it was clear it wasn't
> easy
> to identify which needed it, so the WARN was added along with
> supporting
> the old style via internal fall-back.
>
> -Kees
I love that about the kernel. Just nudges you in the right direction.

-Aryan
>
> > >
> > > Reviewed-by: Kees Cook <[email protected]>
> > >
> >
>

2024-06-14 00:20:59

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

On Thu, 13 Jun 2024 14:49:00 +1200 you wrote:
> Setting frag_size to 0 to indicate kmalloc has been deprecated,
> use slab_build_skb directly.
>
> Fixes: ce098da1497c ("skbuff: Introduce slab_build_skb()")
> Signed-off-by: Aryan Srivastava <[email protected]>
> ---
> Changes in v1:
> - Added Fixes tag
>
> [...]

Here is the summary with links:
- [v1] net: mvpp2: use slab_build_skb for oversized frames
https://git.kernel.org/netdev/net/c/4467c09bc7a6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html