diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-12-17 15:18:16 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-12-17 15:18:16 +0000 |
commit | 6072e777e97fc11d25f7e013855a31d9eaaf0e74 (patch) | |
tree | d3f18d3aa69972525f34c208feeb1343f8784e40 /target/linux/ar71xx/files/drivers/net/ethernet | |
parent | ea89cc9250dc5f303925d2d91cbad8bb69b9d924 (diff) | |
download | mtk-20170518-6072e777e97fc11d25f7e013855a31d9eaaf0e74.zip mtk-20170518-6072e777e97fc11d25f7e013855a31d9eaaf0e74.tar.gz mtk-20170518-6072e777e97fc11d25f7e013855a31d9eaaf0e74.tar.bz2 |
ar71xx: ag71xx: store maximum frame length in the ag71xx struct
This will allow to use different values for the
different SoCs.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 39117
Diffstat (limited to 'target/linux/ar71xx/files/drivers/net/ethernet')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index 606c6f1..68d2691 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -168,6 +168,8 @@ struct ag71xx { unsigned int speed; int duplex; + unsigned int max_frame_len; + struct work_struct restart_work; struct delayed_work link_work; struct timer_list oom_timer; diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 0c2163f..281d0f5 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -434,7 +434,7 @@ static void ag71xx_hw_setup(struct ag71xx *ag) MAC_CFG2_PAD_CRC_EN | MAC_CFG2_LEN_CHECK); /* setup max frame length */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, AG71XX_TX_MTU_LEN); + ag71xx_wr(ag, AG71XX_REG_MAC_MFL, ag->max_frame_len); /* setup FIFO configuration registers */ ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, FIFO_CFG0_INIT); @@ -1048,8 +1048,10 @@ static void ag71xx_netpoll(struct net_device *dev) static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) { + struct ag71xx *ag = netdev_priv(dev); + if (new_mtu < 68 || - new_mtu > AG71XX_TX_MTU_LEN - ETH_HLEN - ETH_FCS_LEN) + new_mtu > ag->max_frame_len - ETH_HLEN - ETH_FCS_LEN) return -EINVAL; dev->mtu = new_mtu; @@ -1164,6 +1166,8 @@ static int ag71xx_probe(struct platform_device *pdev) ag->tx_ring.size = AG71XX_TX_RING_SIZE_DEFAULT; ag->rx_ring.size = AG71XX_RX_RING_SIZE_DEFAULT; + ag->max_frame_len = AG71XX_TX_MTU_LEN; + ag->stop_desc = dma_alloc_coherent(NULL, sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL); |