* [PATCH v2] net: sh_eth: fix skb_over_panic happen
@ 2012-02-07 9:55 Shimoda, Yoshihiro
2012-02-07 18:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Shimoda, Yoshihiro @ 2012-02-07 9:55 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet, Nobuhiro Iwamatsu
When this GETHER controller received a large frame (about 1800 bytes
or more), skb_over_panic() happened. This is because the previous
driver set the RFLR to 0x1000 (4096 bytes) and the skb allocate size
is smaller than 4096 bytes. So, the controller accepted such a frame.
The controller can discard a large frame by the RFLR setting.
So, the patch modifies the value of RFLR to mtu + ETH_HLEN +
VLAN_HLEN + ETH_FCS_LEN.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
---
about v2:
- add VLAN_HLEN to the value of RFLR.
drivers/net/ethernet/renesas/sh_eth.c | 4 +++-
drivers/net/ethernet/renesas/sh_eth.h | 3 ---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 0887d17..698b080 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -38,6 +38,7 @@
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/ethtool.h>
+#include <linux/if_vlan.h>
#include <linux/sh_eth.h>
#include "sh_eth.h"
@@ -817,7 +818,8 @@ static int sh_eth_dev_init(struct net_device *ndev)
sh_eth_write(ndev, 0, TRIMD);
/* Recv frame limit set register */
- sh_eth_write(ndev, RFLR_VALUE, RFLR);
+ sh_eth_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN,
+ RFLR);
sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index ba72976..cb07add 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -575,9 +575,6 @@ enum RPADIR_BIT {
RPADIR_PADR = 0x0003f,
};
-/* RFLR */
-#define RFLR_VALUE 0x1000
-
/* FDR */
#define DEFAULT_FDR_INIT 0x00000707
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: sh_eth: fix skb_over_panic happen
2012-02-07 9:55 [PATCH v2] net: sh_eth: fix skb_over_panic happen Shimoda, Yoshihiro
@ 2012-02-07 18:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-02-07 18:38 UTC (permalink / raw)
To: yoshihiro.shimoda.uh; +Cc: netdev, eric.dumazet, nobuhiro.iwamatsu.yj
From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
Date: Tue, 07 Feb 2012 18:55:15 +0900
> When this GETHER controller received a large frame (about 1800 bytes
> or more), skb_over_panic() happened. This is because the previous
> driver set the RFLR to 0x1000 (4096 bytes) and the skb allocate size
> is smaller than 4096 bytes. So, the controller accepted such a frame.
>
> The controller can discard a large frame by the RFLR setting.
> So, the patch modifies the value of RFLR to mtu + ETH_HLEN +
> VLAN_HLEN + ETH_FCS_LEN.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-07 18:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07 9:55 [PATCH v2] net: sh_eth: fix skb_over_panic happen Shimoda, Yoshihiro
2012-02-07 18:38 ` David Miller
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).