diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-04-03 13:59:08 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-04-03 13:59:08 +0000 |
commit | c874513cfad123d5577f38cb6f316a77e13aa7d7 (patch) | |
tree | 6ff948209f3e759a4ab547b1478d2510379343a6 /target | |
parent | 10c00a63684c778d05306f5d3c8ea1a262a6ced2 (diff) | |
download | mtk-20170518-c874513cfad123d5577f38cb6f316a77e13aa7d7.zip mtk-20170518-c874513cfad123d5577f38cb6f316a77e13aa7d7.tar.gz mtk-20170518-c874513cfad123d5577f38cb6f316a77e13aa7d7.tar.bz2 |
ar71xx: fix broken LAN ports on the boards with AR8216 switch (closes #7024)
* cc: backfire@openwrt.org
SVN-Revision: 20673
Diffstat (limited to 'target')
3 files changed, 12 insertions, 8 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h index c313720..a64b4a8 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h @@ -455,7 +455,8 @@ static void inline ag71xx_mii_ctrl_set_speed(struct ag71xx *ag, #ifdef CONFIG_AG71XX_AR8216_SUPPORT void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb); -int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb); +int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb, + int pktlen); static inline int ag71xx_has_ar8216(struct ag71xx *ag) { return ag71xx_get_pdata(ag)->has_ar8216; @@ -467,7 +468,8 @@ static inline void ag71xx_add_ar8216_header(struct ag71xx *ag, } static inline int ag71xx_remove_ar8216_header(struct ag71xx *ag, - struct sk_buff *skb) + struct sk_buff *skb, + int pktlen) { return 0; } diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c index 564fae7..7801b9f 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c @@ -25,19 +25,21 @@ void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb) skb->data[1] = 0x80; } -int ag71xx_remove_ar8216_header(struct ag71xx *ag, - struct sk_buff *skb) +int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb, + int pktlen) { u8 type; type = skb->data[1] & AR8216_PACKET_TYPE_MASK; switch (type) { case AR8216_PACKET_TYPE_NORMAL: - skb_pull(skb, AR8216_HEADER_LEN); break; + default: return -EINVAL; } + skb_put(skb, pktlen); + skb_pull(skb, AR8216_HEADER_LEN); return 0; } diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c index 989ed0e..4b35b1f 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c @@ -770,6 +770,8 @@ static int ag71xx_rx_copy_skb(struct ag71xx *ag, struct sk_buff **pskb, skb_reserve(copy_skb, NET_IP_ALIGN); skb_copy_from_linear_data(*pskb, copy_skb->data, pktlen); + skb_put(copy_skb, pktlen); + dev_kfree_skb_any(*pskb); *pskb = copy_skb; @@ -814,7 +816,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) dev->stats.rx_bytes += pktlen; if (ag71xx_has_ar8216(ag)) - err = ag71xx_remove_ar8216_header(ag, skb); + err = ag71xx_remove_ar8216_header(ag, skb, pktlen); else err = ag71xx_rx_copy_skb(ag, &skb, pktlen); @@ -822,8 +824,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) dev->stats.rx_dropped++; kfree_skb(skb); } else { - skb_put(skb, pktlen); - skb->dev = dev; skb->ip_summed = CHECKSUM_NONE; skb->protocol = eth_type_trans(skb, dev); |