Hi benh,<br><br> Please find my comments inline.<br><br><div class="gmail_quote">On Tue, Jun 24, 2008 at 4:50 AM, Benjamin Herrenschmidt <<a href="mailto:benh@kernel.crashing.org">benh@kernel.crashing.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Mon, 2008-06-23 at 14:55 +0200, Stefan Roese wrote:<br>
> From: Sathya Narayanan <<a href="mailto:sathyan@teamf1.com">sathyan@teamf1.com</a>><br>
><br>
> Short packets has to be discarded by the driver. So this patch addresses the<br>
> issue of discarding the short packets of size lesser then ethernet header<br>
> size.<br>
<br>
</div>You are freeing the skb, why ? Shouldn't we just keep the skb in the<br>
ring for further rx ?</blockquote><div><br>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 .<br>Since it is a invalid packet it has to be dropped and freed in driver.<br>
Actually if you see in code, the other invalid packets are also handelled similar.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div><div></div><div class="Wj3C7c"><br>
> Signed-off-by: Sathya Narayanan <<a href="mailto:sathyan@teamf1.com">sathyan@teamf1.com</a>><br>
> Signed-off-by: Stefan Roese <<a href="mailto:sr@denx.de">sr@denx.de</a>><br>
> ---<br>
> drivers/net/ibm_newemac/core.c | 7 +++++++<br>
> 1 files changed, 7 insertions(+), 0 deletions(-)<br>
><br>
> diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c<br>
> index 6dfc2c9..aa407b2 100644<br>
> --- a/drivers/net/ibm_newemac/core.c<br>
> +++ b/drivers/net/ibm_newemac/core.c<br>
> @@ -1652,6 +1652,13 @@ static int emac_poll_rx(void *param, int budget)<br>
><br>
> skb_put(skb, len);<br>
> push_packet:<br>
> + if (skb->len < ETH_HLEN) {<br>
> + dev_kfree_skb(skb);<br>
> + printk(KERN_WARNING "%s: short packets dropped\n",<br>
> + dev->ndev->name);<br>
> + ++dev->estats.rx_dropped_stack;<br>
> + goto next;<br>
> + }<br>
> skb->dev = dev->ndev;<br>
> skb->protocol = eth_type_trans(skb, dev->ndev);<br>
> emac_rx_csum(dev, skb, ctrl);<br>
<br>
</div></div></blockquote></div><br>