ibm_newemac: Fixes entry of short packets
Subsystems (2)
PATCH 1/1 ibm_newemac: Fixes entry of short packets
From: Sathya Narayanan <[email protected]>
Short packets has to be discarded by the driver. So this patch addresses the issue of discarding the short packets of size lesser then ethernet header size.
--- drivers/net/ibm_newemac/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/ibm_newemac/core.c +7 -0
@@ -1652,6 +1652,13 @@ static int emac_poll_rx(void *param, int budget)skb_put (skb, len); push_packet: +if (skb->len <ETH_HLEN ) { +dev_kfree_skb (skb); +printk (KERN_WARNING "%s: short packets dropped\n" , + dev->ndev->name); + ++dev->estats.rx_dropped_stack; + goto next; + } skb->dev = dev->ndev; skb->protocol =eth_type_trans (skb, dev->ndev);emac_rx_csum (dev, skb, ctrl);
Signature · 1 line
1.5.6
Quoted 5 lines · Stefan Roese
From: Sathya Narayanan <[email protected]>
Short packets has to be discarded by the driver. So this patch addresses the issue of discarding the short packets of size lesser then ethernet header size.
You are freeing the skb, why ? Shouldn't we just keep the skb in the ring for further rx ?
Quoted 24 lines
Signed-off-by Sathya Narayanan <[email protected]>Signed-off-by Stefan Roese <[email protected]>--- drivers/net/ibm_newemac/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)drivers/net/ibm_newemac/core.c +7
-0@@ -1652,6 +1652,13 @@ static int emac_poll_rx(void *param, int budget)skb_put (skb, len); push_packet: +if (skb->len <ETH_HLEN ) { +dev_kfree_skb (skb); +printk (KERN_WARNING "%s: short packets dropped\n" , + dev->ndev->name); + ++dev->estats.rx_dropped_stack; + goto next; + } skb->dev = dev->ndev; skb->protocol =eth_type_trans (skb, dev->ndev);emac_rx_csum (dev, skb, ctrl);
Hi benh,
Please find my comments inline.
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 3 lines · Stefan Roese
From: Sathya Narayanan <[email protected]>
Short packets has to be discarded by the driver. So this patch addresses
the
Quoted 2 lines
issue of discarding the short packets of size lesser then ethernet header size.
You are freeing the skb, why ? Shouldn't we just keep the skb in the ring for further rx ?
Actually , short packets are not allowed to flow through the higher layers, If any of the layer tried to use the extra room available may hit wit crash .
Since it is a invalid packet it has to be dropped and freed in driver. Actually if you see in code, the other invalid packets are also handelled similar.
Quoted 14 lines
Review
Quoted 8 lines
Signed-off-by Sathya Narayanan <[email protected]>Signed-off-by Stefan Roese <[email protected]>--- drivers/net/ibm_newemac/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/drivers/net/ibm_newemac/core.cQuoted 5 lines
index 6dfc2c9..aa407b2 100644
drivers/net/ibm_newemac/core.c +0
-0@@ -1652,6 +1652,13 @@ static int emac_poll_rx(void *param, int budget)
Quoted 14 lines
drivers/net/ibm_newemac/core.c static int emac_poll_rx(void *param, int budget) · line 1664
Quoted 12 lines
drivers/net/ibm_newemac/core.c +7
-0skb_put (skb, len); push_packet: +if (skb->len <ETH_HLEN ) { +dev_kfree_skb (skb); +printk (KERN_WARNING "%s: short packets dropped\n" , + dev->ndev->name); + ++dev->estats.rx_dropped_stack; + goto next; + } skb->dev = dev->ndev; skb->protocol =eth_type_trans (skb, dev->ndev);emac_rx_csum (dev, skb, ctrl);
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Quoted 9 lines
Actually , short packets are not allowed to flow through the higher layers, If any of the layer tried to use the extra room available may hit wit crash .
Since it is a invalid packet it has to be dropped and freed in driver. Actually if you see in code, the other invalid packets are also handelled similar.
My point is they should not. The rx skb should be kept in the ring for further rx (ie, the data ignored and re-use the skb). A bit like we do when we decide the packet is small enough to be copied to a new skb.
Ie. Move you test above the threshold test and recycle the skb.
We need to fix the usage of the dma operations in this driver anyway and this will make it easier as we'll be able to avoid re-mapping an skb we just recycle. (the current driver never unmaps which means it can't be used with an iommu, which is a problem on some cell based platforms).
Ben.