aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2012-02-06 18:55:15 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-07 13:37:30 -0500
commitfdb37a7f84a58ccad24abffd54ad46d23b763e13 (patch)
tree0e9dc5efda48b1eb2430ef9d27e884c5be5305f6 /drivers/net
parent6d25886ee2fbc05a7bf4dae5f5ae345cb73df2fd (diff)
net: sh_eth: fix skb_over_panic happen
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c4
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h3
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 813d41c4a845..87b650131774 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -38,6 +38,7 @@
38#include <linux/pm_runtime.h> 38#include <linux/pm_runtime.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/ethtool.h> 40#include <linux/ethtool.h>
41#include <linux/if_vlan.h>
41#include <linux/sh_eth.h> 42#include <linux/sh_eth.h>
42 43
43#include "sh_eth.h" 44#include "sh_eth.h"
@@ -817,7 +818,8 @@ static int sh_eth_dev_init(struct net_device *ndev)
817 sh_eth_write(ndev, 0, TRIMD); 818 sh_eth_write(ndev, 0, TRIMD);
818 819
819 /* Recv frame limit set register */ 820 /* Recv frame limit set register */
820 sh_eth_write(ndev, RFLR_VALUE, RFLR); 821 sh_eth_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN,
822 RFLR);
821 823
822 sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); 824 sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
823 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); 825 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 47877b13ffad..cdbd844662a7 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -575,9 +575,6 @@ enum RPADIR_BIT {
575 RPADIR_PADR = 0x0003f, 575 RPADIR_PADR = 0x0003f,
576}; 576};
577 577
578/* RFLR */
579#define RFLR_VALUE 0x1000
580
581/* FDR */ 578/* FDR */
582#define DEFAULT_FDR_INIT 0x00000707 579#define DEFAULT_FDR_INIT 0x00000707
583 580