diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-12-20 11:41:18 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-12-20 11:41:18 +0000 |
commit | 60f7a8a3575c1ce8d2a159cb91dfb4a9d1f3edc4 (patch) | |
tree | fc49d4f8b4e2fc248bd494c7d7283d309bfbdb90 /target/linux | |
parent | c52c793ce1ea54b92622608cff26c1fb93d9451c (diff) | |
download | upstream-60f7a8a3575c1ce8d2a159cb91dfb4a9d1f3edc4.tar.gz upstream-60f7a8a3575c1ce8d2a159cb91dfb4a9d1f3edc4.tar.bz2 upstream-60f7a8a3575c1ce8d2a159cb91dfb4a9d1f3edc4.zip |
ar71xx: ag71xx: add ag71xx_max_frame_len() helper
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39146 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 10 |
1 files changed, 8 insertions, 2 deletions
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 9df27ff1a9..ce05c10882 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 @@ -28,6 +28,11 @@ static int ag71xx_msg_level = -1; module_param_named(msg_level, ag71xx_msg_level, int, 0); MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); +static inline unsigned int ag71xx_max_frame_len(unsigned int mtu) +{ + return ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; +} + static void ag71xx_dump_dma_regs(struct ag71xx *ag) { DBG("%s: dma_tx_ctrl=%08x, dma_tx_desc=%08x, dma_tx_status=%08x\n", @@ -1052,9 +1057,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); + unsigned int max_frame_len; - if (new_mtu < 68 || - new_mtu > ag->max_frame_len - ETH_HLEN - ETH_FCS_LEN) + max_frame_len = ag71xx_max_frame_len(new_mtu); + if (new_mtu < 68 || max_frame_len > ag->max_frame_len) return -EINVAL; dev->mtu = new_mtu; |