From 30ebad2dee1bc348c9b8234f0649a0b8f7a9cb40 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Sat, 11 Jan 2014 11:15:30 +0000 Subject: ar71xx: ag71xx: increase calculated max frame length value The r39147 commit introduces a regression: at lease on some routers with ar8216 switch large packets get lost if 802.1q tagged port is used on the interface connected to the aforementioned switch. The r39147 changes code in the way so interface is set to accept packets no longer than max ethernet frame length for a given mtu. Unfortunately ar8216 has a feature: it sends two additional bytes as a packet header and those this header needs to be added to the max frame length. Otherwise long enough packets get lost. The problem only manuifests itself if interface is used in vlan tagged mode. If interface is untagged then ar8216's header fits into space used by 802.1q tag and not packets are lost. Include two additional bytes in the max frame length calculation to fix the issue. This patch is tested and works with Trendnet TEW-632BRP. Signed-off-by Nikolay Martynov Patchwork: http://patchwork.openwrt.org/patch/4656/ [juhosg: - simplify the patch to include the additional bytes of the switch header unconditionally, - change subject and update commit message] Signed-off-by: Gabor Juhos SVN-Revision: 39219 --- .../ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'target/linux') 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 715c1cef1b..d010373155 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,9 +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)"); +#define ETH_SWITCH_HEADER_LEN 2 + static inline unsigned int ag71xx_max_frame_len(unsigned int mtu) { - return ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; + return ETH_SWITCH_HEADER_LEN + ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; } static void ag71xx_dump_dma_regs(struct ag71xx *ag) -- cgit v1.2.3