public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames
@ 2024-06-10  3:53 Aryan Srivastava
  2024-06-12  2:33 ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Aryan Srivastava @ 2024-06-10  3:53 UTC (permalink / raw)
  To: linux
  Cc: netdev, linux-kernel, Aryan Srivastava, Marcin Wojtas,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni

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

Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-10  3:53 [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames Aryan Srivastava
@ 2024-06-12  2:33 ` Jakub Kicinski
  2024-06-13  2:49   ` [PATCH v1] " Aryan Srivastava
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-06-12  2:33 UTC (permalink / raw)
  To: Aryan Srivastava
  Cc: linux, netdev, linux-kernel, Marcin Wojtas, David S. Miller,
	Eric Dumazet, Paolo Abeni

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-12  2:33 ` Jakub Kicinski
@ 2024-06-13  2:49   ` Aryan Srivastava
  2024-06-13  3:05     ` Kees Cook
  2024-06-14  0:20     ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 8+ messages in thread
From: Aryan Srivastava @ 2024-06-13  2:49 UTC (permalink / raw)
  To: kuba
  Cc: aryan.srivastava, davem, edumazet, linux-kernel, linux, mw,
	netdev, pabeni, Kees Cook

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 <aryan.srivastava@alliedtelesis.co.nz>
---
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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-13  2:49   ` [PATCH v1] " Aryan Srivastava
@ 2024-06-13  3:05     ` Kees Cook
  2024-06-13  3:13       ` Aryan Srivastava
  2024-06-14  0:20     ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 8+ messages in thread
From: Kees Cook @ 2024-06-13  3:05 UTC (permalink / raw)
  To: Aryan Srivastava
  Cc: kuba, davem, edumazet, linux-kernel, linux, mw, netdev, pabeni

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 <aryan.srivastava@alliedtelesis.co.nz>
> ---
> 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 <kees@kernel.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-13  3:05     ` Kees Cook
@ 2024-06-13  3:13       ` Aryan Srivastava
  2024-06-13  3:34         ` Kees Cook
  0 siblings, 1 reply; 8+ messages in thread
From: Aryan Srivastava @ 2024-06-13  3:13 UTC (permalink / raw)
  To: kees@kernel.org
  Cc: linux@armlinux.org.uk, davem@davemloft.net, mw@semihalf.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	kuba@kernel.org, edumazet@google.com, pabeni@redhat.com

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
> > <aryan.srivastava@alliedtelesis.co.nz>
> > ---
> > 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 <kees@kernel.org>
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-13  3:13       ` Aryan Srivastava
@ 2024-06-13  3:34         ` Kees Cook
  2024-06-13  3:39           ` Aryan Srivastava
  0 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2024-06-13  3:34 UTC (permalink / raw)
  To: Aryan Srivastava
  Cc: linux@armlinux.org.uk, davem@davemloft.net, mw@semihalf.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	kuba@kernel.org, edumazet@google.com, pabeni@redhat.com

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
> > > <aryan.srivastava@alliedtelesis.co.nz>
> > > ---
> > > 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 <kees@kernel.org>
> > 
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-13  3:34         ` Kees Cook
@ 2024-06-13  3:39           ` Aryan Srivastava
  0 siblings, 0 replies; 8+ messages in thread
From: Aryan Srivastava @ 2024-06-13  3:39 UTC (permalink / raw)
  To: kees@kernel.org
  Cc: linux@armlinux.org.uk, davem@davemloft.net, mw@semihalf.com,
	linux-kernel@vger.kernel.org, kuba@kernel.org,
	netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com

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
> > > > <aryan.srivastava@alliedtelesis.co.nz>
> > > > ---
> > > > 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 <kees@kernel.org>
> > > 
> > 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] net: mvpp2: use slab_build_skb for oversized frames
  2024-06-13  2:49   ` [PATCH v1] " Aryan Srivastava
  2024-06-13  3:05     ` Kees Cook
@ 2024-06-14  0:20     ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-14  0:20 UTC (permalink / raw)
  To: Aryan Srivastava
  Cc: kuba, davem, edumazet, linux-kernel, linux, mw, netdev, pabeni,
	keescook

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 <aryan.srivastava@alliedtelesis.co.nz>
> ---
> 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-14  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10  3:53 [PATCH v0] net: mvpp2: use slab_build_skb for oversized frames Aryan Srivastava
2024-06-12  2:33 ` Jakub Kicinski
2024-06-13  2:49   ` [PATCH v1] " Aryan Srivastava
2024-06-13  3:05     ` Kees Cook
2024-06-13  3:13       ` Aryan Srivastava
2024-06-13  3:34         ` Kees Cook
2024-06-13  3:39           ` Aryan Srivastava
2024-06-14  0:20     ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox