* [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
@ 2025-09-10 5:48 Yeounsu Moon
2025-09-11 17:02 ` Simon Horman
2025-09-12 0:08 ` Jakub Kicinski
0 siblings, 2 replies; 6+ messages in thread
From: Yeounsu Moon @ 2025-09-10 5:48 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Yeounsu Moon, netdev, linux-kernel
Track dropped packet statistics when skb allocation fails
in the receive path.
Tested-on: D-Link DGE-550T Rev-A3
Signed-off-by: Yeounsu Moon <yyyynoom@gmail.com>
---
drivers/net/ethernet/dlink/dl2k.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
index 6bbf6e5584e5..47d9eef2e725 100644
--- a/drivers/net/ethernet/dlink/dl2k.c
+++ b/drivers/net/ethernet/dlink/dl2k.c
@@ -1009,6 +1009,7 @@ receive_packet (struct net_device *dev)
skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz);
if (skb == NULL) {
np->rx_ring[entry].fraginfo = 0;
+ dev->stats.rx_dropped++;
printk (KERN_INFO
"%s: receive_packet: "
"Unable to re-allocate Rx skbuff.#%d\n",
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
2025-09-10 5:48 [PATCH net-next] net: dlink: count dropped packets on skb allocation failure Yeounsu Moon
@ 2025-09-11 17:02 ` Simon Horman
2025-09-12 9:27 ` Yeounsu Moon
2025-09-12 0:08 ` Jakub Kicinski
1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2025-09-11 17:02 UTC (permalink / raw)
To: Yeounsu Moon
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Wed, Sep 10, 2025 at 02:48:37PM +0900, Yeounsu Moon wrote:
> Track dropped packet statistics when skb allocation fails
> in the receive path.
>
> Tested-on: D-Link DGE-550T Rev-A3
> Signed-off-by: Yeounsu Moon <yyyynoom@gmail.com>
> ---
> drivers/net/ethernet/dlink/dl2k.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
> index 6bbf6e5584e5..47d9eef2e725 100644
> --- a/drivers/net/ethernet/dlink/dl2k.c
> +++ b/drivers/net/ethernet/dlink/dl2k.c
> @@ -1009,6 +1009,7 @@ receive_packet (struct net_device *dev)
> skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz);
> if (skb == NULL) {
> np->rx_ring[entry].fraginfo = 0;
> + dev->stats.rx_dropped++;
Although new users of dev->stats are discoraged (see ndetdevice.h).
That is not the case here, as the driver already uses dev-stats.
So I believe this is change is good.
> printk (KERN_INFO
> "%s: receive_packet: "
> "Unable to re-allocate Rx skbuff.#%d\n",
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
2025-09-10 5:48 [PATCH net-next] net: dlink: count dropped packets on skb allocation failure Yeounsu Moon
2025-09-11 17:02 ` Simon Horman
@ 2025-09-12 0:08 ` Jakub Kicinski
2025-09-12 10:03 ` Yeounsu Moon
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-09-12 0:08 UTC (permalink / raw)
To: Yeounsu Moon
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, netdev,
linux-kernel
On Wed, 10 Sep 2025 14:48:37 +0900 Yeounsu Moon wrote:
> Track dropped packet statistics when skb allocation fails
> in the receive path.
I'm not sure that failing to allocate a buffer results in dropping
one packet in this driver. The statistics have specific meaning, if
you're just trying to use dropped to mean "buffer allocation failures"
that's not allowed. If I'm misreading the code please explain in more
detail in the commit message and repost.
> diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
> index 6bbf6e5584e5..47d9eef2e725 100644
> --- a/drivers/net/ethernet/dlink/dl2k.c
> +++ b/drivers/net/ethernet/dlink/dl2k.c
> @@ -1009,6 +1009,7 @@ receive_packet (struct net_device *dev)
> skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz);
> if (skb == NULL) {
> np->rx_ring[entry].fraginfo = 0;
> + dev->stats.rx_dropped++;
> printk (KERN_INFO
> "%s: receive_packet: "
> "Unable to re-allocate Rx skbuff.#%d\n",
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
2025-09-11 17:02 ` Simon Horman
@ 2025-09-12 9:27 ` Yeounsu Moon
0 siblings, 0 replies; 6+ messages in thread
From: Yeounsu Moon @ 2025-09-12 9:27 UTC (permalink / raw)
To: Simon Horman
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Fri Sep 12, 2025 at 2:02 AM KST, Simon Horman wrote:
> Although new users of dev->stats are discoraged (see ndetdevice.h).
> That is not the case here, as the driver already uses dev-stats.
> So I believe this is change is good.
Thank you for pointing that out! I also plan to rework statistics code
to rtnl-based statistics. However, that change affects a large amount
of code, so I'd like to introduce it gradually and gracefully.
>
>> printk (KERN_INFO
>> "%s: receive_packet: "
>> "Unable to re-allocate Rx skbuff.#%d\n",
>
> Reviewed-by: Simon Horman <horms@kernel.org>
Thank you again for reviewing my patch, Simon :)
Yeounsu Moon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
2025-09-12 0:08 ` Jakub Kicinski
@ 2025-09-12 10:03 ` Yeounsu Moon
2025-09-12 14:35 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Yeounsu Moon @ 2025-09-12 10:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, netdev,
linux-kernel
On Fri Sep 12, 2025 at 9:08 AM KST, Jakub Kicinski wrote:
> On Wed, 10 Sep 2025 14:48:37 +0900 Yeounsu Moon wrote:
>> Track dropped packet statistics when skb allocation fails
>> in the receive path.
>
> I'm not sure that failing to allocate a buffer results in dropping
> one packet in this driver. The statistics have specific meaning, if
> you're just trying to use dropped to mean "buffer allocation failures"
> that's not allowed. If I'm misreading the code please explain in more
> detail in the commit message and repost.
>
I think you understand the code better than I do.
Your insights are always surprising to me.
I believed that when `netdev_alloc_skb()` fails, it leads to dropping packets.
I also found many cases where `rx_dropped` was incremented when
`netdev_alloc_skb()` failed.
However, I'm not entirely sure whether such a failure actually results
in a misisng packet. I'll resend the patch after verifying whether the packet
is really dropped.
Thank you for reviewing!
Yeounsu Moon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: dlink: count dropped packets on skb allocation failure
2025-09-12 10:03 ` Yeounsu Moon
@ 2025-09-12 14:35 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-09-12 14:35 UTC (permalink / raw)
To: Yeounsu Moon
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, netdev,
linux-kernel
On Fri, 12 Sep 2025 19:03:46 +0900 Yeounsu Moon wrote:
> > I'm not sure that failing to allocate a buffer results in dropping
> > one packet in this driver. The statistics have specific meaning, if
> > you're just trying to use dropped to mean "buffer allocation failures"
> > that's not allowed. If I'm misreading the code please explain in more
> > detail in the commit message and repost.
>
> I think you understand the code better than I do.
> Your insights are always surprising to me.
>
> I believed that when `netdev_alloc_skb()` fails, it leads to dropping packets.
> I also found many cases where `rx_dropped` was incremented when
> `netdev_alloc_skb()` failed.
>
> However, I'm not entirely sure whether such a failure actually results
> in a misisng packet. I'll resend the patch after verifying whether the packet
> is really dropped.
There's a ring of outstanding Rx buffers. If the ring becomes
completely empty we'll start dropping. But that's not the same
as one allocation failure == one packet drop.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-12 14:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-10 5:48 [PATCH net-next] net: dlink: count dropped packets on skb allocation failure Yeounsu Moon
2025-09-11 17:02 ` Simon Horman
2025-09-12 9:27 ` Yeounsu Moon
2025-09-12 0:08 ` Jakub Kicinski
2025-09-12 10:03 ` Yeounsu Moon
2025-09-12 14:35 ` Jakub Kicinski
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).