aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files/drivers/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-24 22:45:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-24 22:45:16 +0000
commit2bc783064dfb9ca0b61ce27c4b46e4816ec5e1a8 (patch)
tree70571bc3d44645be5eb34a02aa56e82ce604fe69 /target/linux/ramips/files/drivers/net
parentff3864e8a42485bafb5d082e513e8177d593b429 (diff)
downloadupstream-2bc783064dfb9ca0b61ce27c4b46e4816ec5e1a8.tar.gz
upstream-2bc783064dfb9ca0b61ce27c4b46e4816ec5e1a8.tar.bz2
upstream-2bc783064dfb9ca0b61ce27c4b46e4816ec5e1a8.zip
ralink: use fe_max_buf_size to get rx buffer size
the rx_buf_size now is 1534 when mtu is 1500. the ethernet frame with vlan tag and FCS is 1522. so the buffer is enough. Signed-off-by: michael lee <igvtee@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44116 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/drivers/net')
-rw-r--r--target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
index 550b424835..0047b28fd0 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
@@ -178,7 +178,7 @@ static inline int fe_max_frag_size(int mtu)
static inline int fe_max_buf_size(int frag_size)
{
- return frag_size - FE_RX_HLEN -
+ return frag_size - NET_SKB_PAD - NET_IP_ALIGN -
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
}
@@ -1284,13 +1284,11 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
if (old_mtu > ETH_DATA_LEN && new_mtu > ETH_DATA_LEN)
return 0;
- if (new_mtu <= ETH_DATA_LEN) {
+ if (new_mtu <= ETH_DATA_LEN)
priv->frag_size = fe_max_frag_size(ETH_DATA_LEN);
- priv->rx_buf_size = MAX_RX_LENGTH;
- } else {
+ else
priv->frag_size = PAGE_SIZE;
- priv->rx_buf_size = fe_max_buf_size(PAGE_SIZE);
- }
+ priv->rx_buf_size = fe_max_buf_size(priv->frag_size);
if (!netif_running(dev))
return 0;
@@ -1443,7 +1441,7 @@ static int fe_probe(struct platform_device *pdev)
priv->soc = soc;
priv->msg_enable = netif_msg_init(fe_msg_level, FE_DEFAULT_MSG_ENABLE);
priv->frag_size = fe_max_frag_size(ETH_DATA_LEN);
- priv->rx_buf_size = MAX_RX_LENGTH;
+ priv->rx_buf_size = fe_max_buf_size(priv->frag_size);
if (priv->frag_size > PAGE_SIZE) {
dev_err(&pdev->dev, "error frag size.\n");
err = -EINVAL;