Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdb37a7f authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by David S. Miller
Browse files

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: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d25886e
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -38,6 +38,7 @@
#include <linux/pm_runtime.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/ethtool.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/sh_eth.h>
#include <linux/sh_eth.h>


#include "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);
		sh_eth_write(ndev, 0, TRIMD);


	/* Recv frame limit set register */
	/* 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, sh_eth_read(ndev, EESR), EESR);
	sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
	sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+0 −3
Original line number Original line Diff line number Diff line
@@ -575,9 +575,6 @@ enum RPADIR_BIT {
	RPADIR_PADR = 0x0003f,
	RPADIR_PADR = 0x0003f,
};
};


/* RFLR */
#define RFLR_VALUE 0x1000

/* FDR */
/* FDR */
#define DEFAULT_FDR_INIT	0x00000707
#define DEFAULT_FDR_INIT	0x00000707