The inclusion of the ar8216 driver in ar71xx most probably broke
networking for those devices.

The ag71xx driver currently unconditionally adds/removes the header
on ar8216 devices independent whether the header is enabled or not.

The ar8216 driver can handle that itself, but needs support by the
ag71xx driver to call ar8216's netif_receive_skb.

This patch removed the ar8216 packet header workaround in the ag71xx
driver and instead calls ar8216's netif_receive_skb so that there is
only header handling if it enabled.

Regards,
Jonas Gorski

Signed-off-by: Jonas Gorski <[email protected]>
---
 target/linux/ar71xx/config-2.6.32                  |    2 +-
 target/linux/ar71xx/config-2.6.33                  |    2 +-
 target/linux/ar71xx/config-2.6.34                  |    2 +-
 .../linux/ar71xx/files/drivers/net/ag71xx/Kconfig  |    8 ----
 .../linux/ar71xx/files/drivers/net/ag71xx/Makefile |    1 -
 .../linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h |   21 ---------
 .../files/drivers/net/ag71xx/ag71xx_ar8216.c       |   45 --------------------
 .../ar71xx/files/drivers/net/ag71xx/ag71xx_main.c  |   20 ++++-----
 8 files changed, 12 insertions(+), 89 deletions(-)
 delete mode 100644 target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c

diff --git a/target/linux/ar71xx/config-2.6.32 
b/target/linux/ar71xx/config-2.6.32
index 417d718..347e603 100644
--- a/target/linux/ar71xx/config-2.6.32
+++ b/target/linux/ar71xx/config-2.6.32
@@ -1,7 +1,7 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 CONFIG_AG71XX=y
-CONFIG_AG71XX_AR8216_SUPPORT=y
+# CONFIG_AG71XX_AR8216_SUPPORT is not set
 # CONFIG_AG71XX_DEBUG is not set
 # CONFIG_AG71XX_DEBUG_FS is not set
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
diff --git a/target/linux/ar71xx/config-2.6.33 
b/target/linux/ar71xx/config-2.6.33
index e147b01..d8567ef 100644
--- a/target/linux/ar71xx/config-2.6.33
+++ b/target/linux/ar71xx/config-2.6.33
@@ -1,7 +1,7 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 CONFIG_AG71XX=y
-CONFIG_AG71XX_AR8216_SUPPORT=y
+# CONFIG_AG71XX_AR8216_SUPPORT is not set
 # CONFIG_AG71XX_DEBUG is not set
 # CONFIG_AG71XX_DEBUG_FS is not set
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
diff --git a/target/linux/ar71xx/config-2.6.34 
b/target/linux/ar71xx/config-2.6.34
index 549b7a8..8cdbb87 100644
--- a/target/linux/ar71xx/config-2.6.34
+++ b/target/linux/ar71xx/config-2.6.34
@@ -1,7 +1,7 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 CONFIG_AG71XX=y
-CONFIG_AG71XX_AR8216_SUPPORT=y
+# CONFIG_AG71XX_AR8216_SUPPORT is not set
 # CONFIG_AG71XX_DEBUG is not set
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
 # CONFIG_AR7 is not set
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig 
b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
index 7db779e..fff31c0 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
@@ -22,12 +22,4 @@ config AG71XX_DEBUG_FS
          Say Y, if you need access to various statistics provided by
          the ag71xx driver.
 
-config AG71XX_AR8216_SUPPORT
-       bool "special support for the Atheros AR8216 switch"
-       default n
-       default y if AR71XX_MACH_WNR2000 || AR71XX_MACH_MZK_W04NU
-       help
-         Say 'y' here if you want to enable special support for the
-         Atheros AR8216 switch found on some boards.
-
 endif
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile 
b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
index 3485ab3..4c83696 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
@@ -8,7 +8,6 @@ ag71xx-y        += ag71xx_phy.o
 ag71xx-y       += ag71xx_mdio.o
 
 ag71xx-$(CONFIG_AG71XX_DEBUG_FS)       += ag71xx_debugfs.o
-ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o
 
 obj-$(CONFIG_AG71XX)   += ag71xx.o
 
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h 
b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index a64b4a8..03653df 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -453,31 +453,10 @@ static void inline ag71xx_mii_ctrl_set_speed(struct 
ag71xx *ag,
        ag71xx_mii_ctrl_wr(ag, t);
 }
 
-#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 pktlen);
 static inline int ag71xx_has_ar8216(struct ag71xx *ag)
 {
        return ag71xx_get_pdata(ag)->has_ar8216;
 }
-#else
-static inline void ag71xx_add_ar8216_header(struct ag71xx *ag,
-                                          struct sk_buff *skb)
-{
-}
-
-static inline int ag71xx_remove_ar8216_header(struct ag71xx *ag,
-                                             struct sk_buff *skb,
-                                             int pktlen)
-{
-       return 0;
-}
-static inline int ag71xx_has_ar8216(struct ag71xx *ag)
-{
-       return 0;
-}
-#endif
 
 #ifdef CONFIG_AG71XX_DEBUG_FS
 int ag71xx_debugfs_root_init(void);
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c 
b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
deleted file mode 100644
index 7801b9f..0000000
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Atheros AR71xx built-in ethernet mac driver
- *  Special support for the Atheros ar8216 switch chip
- *
- *  Copyright (C) 2009-2010 Gabor Juhos <[email protected]>
- *
- *  Based on Atheros' AG7100 driver
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- */
-
-#include "ag71xx.h"
-
-#define AR8216_PACKET_TYPE_MASK                0xf
-#define AR8216_PACKET_TYPE_NORMAL      0
-
-#define AR8216_HEADER_LEN      2
-
-void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb)
-{
-       skb_push(skb, AR8216_HEADER_LEN);
-       skb->data[0] = 0x10;
-       skb->data[1] = 0x80;
-}
-
-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:
-               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 4b35b1f..464da9e 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -614,9 +614,6 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff 
*skb,
        if (!ag71xx_desc_empty(desc))
                goto err_drop;
 
-       if (ag71xx_has_ar8216(ag))
-               ag71xx_add_ar8216_header(ag, skb);
-
        if (skb->len <= 0) {
                DBG("%s: packet len is too small\n", ag->dev->name);
                goto err_drop;
@@ -815,19 +812,20 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
                dev->stats.rx_packets++;
                dev->stats.rx_bytes += pktlen;
 
-               if (ag71xx_has_ar8216(ag))
-                       err = ag71xx_remove_ar8216_header(ag, skb, pktlen);
-               else
-                       err = ag71xx_rx_copy_skb(ag, &skb, pktlen);
-
-               if (err) {
+               if (ag71xx_rx_copy_skb(ag, &skb, pktlen)) {
                        dev->stats.rx_dropped++;
                        kfree_skb(skb);
                } else {
                        skb->dev = dev;
                        skb->ip_summed = CHECKSUM_NONE;
-                       skb->protocol = eth_type_trans(skb, dev);
-                       netif_receive_skb(skb);
+                       if (ag71xx_has_ar8216(ag) && ag->phy_dev) {
+                               err = ag->phy_dev->netif_receive_skb(skb);
+                       } else {
+                               skb->protocol = eth_type_trans(skb, dev);
+                               err = netif_receive_skb(skb);
+                       }
+                       if (err)
+                               dev->stats.rx_dropped++;
                }
 
                ring->buf[i].skb = NULL;
-- 
1.7.0

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to