|
54 | 54 | #include <linux/reset.h> |
55 | 55 |
|
56 | 56 | #define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x) |
57 | | -#define JUMBO_LEN 9000 |
58 | 57 |
|
59 | 58 | /* Module parameters */ |
60 | 59 | #define TX_TIMEO 5000 |
@@ -93,7 +92,7 @@ static int tc = TC_DEFAULT; |
93 | 92 | module_param(tc, int, S_IRUGO | S_IWUSR); |
94 | 93 | MODULE_PARM_DESC(tc, "DMA threshold control value"); |
95 | 94 |
|
96 | | -#define DMA_BUFFER_SIZE BUF_SIZE_2KiB |
| 95 | +#define DMA_BUFFER_SIZE BUF_SIZE_4KiB |
97 | 96 | static int buf_sz = DMA_BUFFER_SIZE; |
98 | 97 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); |
99 | 98 | MODULE_PARM_DESC(buf_sz, "DMA buffer size"); |
@@ -994,6 +993,8 @@ static int init_dma_desc_rings(struct net_device *dev) |
994 | 993 | if (bfsize < BUF_SIZE_16KiB) |
995 | 994 | bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); |
996 | 995 |
|
| 996 | + priv->dma_buf_sz = bfsize; |
| 997 | + |
997 | 998 | if (netif_msg_probe(priv)) |
998 | 999 | pr_debug("%s: txsize %d, rxsize %d, bfsize %d\n", __func__, |
999 | 1000 | txsize, rxsize, bfsize); |
@@ -1023,7 +1024,6 @@ static int init_dma_desc_rings(struct net_device *dev) |
1023 | 1024 | } |
1024 | 1025 | priv->cur_rx = 0; |
1025 | 1026 | priv->dirty_rx = (unsigned int)(i - rxsize); |
1026 | | - priv->dma_buf_sz = bfsize; |
1027 | 1027 | buf_sz = bfsize; |
1028 | 1028 |
|
1029 | 1029 | /* Setup the chained descriptor addresses */ |
@@ -1624,7 +1624,7 @@ static int stmmac_hw_setup(struct net_device *dev) |
1624 | 1624 | priv->plat->bus_setup(priv->ioaddr); |
1625 | 1625 |
|
1626 | 1626 | /* Initialize the MAC Core */ |
1627 | | - priv->hw->mac->core_init(priv->ioaddr); |
| 1627 | + priv->hw->mac->core_init(priv->ioaddr, dev->mtu); |
1628 | 1628 |
|
1629 | 1629 | /* Enable the MAC Rx/Tx */ |
1630 | 1630 | stmmac_set_mac(priv->ioaddr, true); |
@@ -2274,6 +2274,9 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) |
2274 | 2274 | else |
2275 | 2275 | max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN); |
2276 | 2276 |
|
| 2277 | + if (priv->plat->maxmtu < max_mtu) |
| 2278 | + max_mtu = priv->plat->maxmtu; |
| 2279 | + |
2277 | 2280 | if ((new_mtu < 46) || (new_mtu > max_mtu)) { |
2278 | 2281 | pr_err("%s: invalid MTU, max MTU is: %d\n", dev->name, max_mtu); |
2279 | 2282 | return -EINVAL; |
|
0 commit comments