alx driver
Subsystems (3)
cover alx driver
So ... I was stupid enough to not research drivers for this device before buying a board that included one, I figured in 2013 it wasn't really possible for such a simple gigabit ethernet device to not have a driver in Linux.
Boy was I wrong.
The vendor driver was previously posted on netdev, and subsequently somewhat cleaned up, but ... it still had useless hand-rolled locks (with test_and_set_bit/msleep!), horrible macros, and was generally quite a mess.
I do have to admit that I'm not very familiar with all the netdev APIs, since wireless devices are so slow that NAPI etc. hardly matters. In a way, this is also me learning about it since we'll be betting faster wireless too :-)
I hope I did an OK job at cleaning it up/rewriting it, but while I thought about the locking for a while, or rather the lack thereof, I'm not entirely sure that it's completely safe. It seemed to me that since we have TX/RX all done from NAPI it won't actually have to be reentrant/locked.
Also, I kept the FIELD macros, which seemed wrong at first but the code didn't get nicer w/o them. I did fix them for endianness and converted some to inlines; I don't get why they actually had endian annotations and even turned on the sparse checks by default only to then ignore all the errors it was giving. I'll happily kill these if anyone thinks that would be better.
Anyway, as I said, I'm not very good at ethernet drivers, so let me know what I need to fix.
Maybe the responsible QCA folks can actually add back the features that I liberally pruned from the driver.
johannes
PATCH 1/1 alx: add a simple AR816x/AR817x device driver
From: Johannes Berg <[email protected]>
This is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously. I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
--- drivers/net/ethernet/atheros/Kconfig | 18 + drivers/net/ethernet/atheros/Makefile | 1 + drivers/net/ethernet/atheros/alx/Makefile | 3 + drivers/net/ethernet/atheros/alx/alx.h | 107 ++ drivers/net/ethernet/atheros/alx/ethtool.c | 273 +++++ drivers/net/ethernet/atheros/alx/hw.c | 1253 ++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/hw.h | 506 +++++++++ drivers/net/ethernet/atheros/alx/main.c | 1590 ++++++++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/reg.h | 813 ++++++++++++++ 9 files changed, 4564 insertions(+) create mode 100644 drivers/net/ethernet/atheros/alx/Makefile create mode 100644 drivers/net/ethernet/atheros/alx/alx.h create mode 100644 drivers/net/ethernet/atheros/alx/ethtool.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.h create mode 100644 drivers/net/ethernet/atheros/alx/main.c create mode 100644 drivers/net/ethernet/atheros/alx/reg.h
drivers/net/ethernet/atheros/Kconfig +18 -0
@@ -67,4 +67,22 @@ config ATL1C To compile this driver as a module, choose M here. The module will be called atl1c. +config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_CORE + select MDIO + help + This driver supports the Qualcomm Atheros L1F ethernet adapter, + i.e. the following chipsets: + + 1969:1091 - AR8161 Gigabit Ethernet + 1969:1090 - AR8162 Fast Ethernet + 1969:10A1 - AR8171 Gigabit Ethernet + 1969:10A0 - AR8172 Fast Ethernet + + To compile this driver as a module, choose M here. The module + will be called alx. + endif # NET_VENDOR_ATHEROS
drivers/net/ethernet/atheros/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_ATL1) += atlx/ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ +obj-$(CONFIG_ALX) += alx/
drivers/net/ethernet/atheros/alx/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ALX) += alx.o +alx-objs := main.o ethtool.o hw.o +ccflags-y += -D__CHECK_ENDIAN__
drivers/net/ethernet/atheros/alx/alx.h new file +107 -0
107 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/ethtool.c new file +273 -0
273 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.c new file +1253 -0
1,253 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.h new file +506 -0
506 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/main.c new file +1590 -0
832 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/reg.h new file +813 -0
813 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.0
Part of the diff is not shown here. View the raw message.
PATCH v2 1/1 alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergThis is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously. I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
---
v2: ick, obviously this has nothing to do with Intel whatsoever.
--- drivers/net/ethernet/atheros/Kconfig | 18 + drivers/net/ethernet/atheros/Makefile | 1 + drivers/net/ethernet/atheros/alx/Makefile | 3 + drivers/net/ethernet/atheros/alx/alx.h | 107 ++ drivers/net/ethernet/atheros/alx/ethtool.c | 273 +++++ drivers/net/ethernet/atheros/alx/hw.c | 1253 ++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/hw.h | 506 +++++++++ drivers/net/ethernet/atheros/alx/main.c | 1590 ++++++++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/reg.h | 813 ++++++++++++++ 9 files changed, 4564 insertions(+) create mode 100644 drivers/net/ethernet/atheros/alx/Makefile create mode 100644 drivers/net/ethernet/atheros/alx/alx.h create mode 100644 drivers/net/ethernet/atheros/alx/ethtool.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.h create mode 100644 drivers/net/ethernet/atheros/alx/main.c create mode 100644 drivers/net/ethernet/atheros/alx/reg.h
drivers/net/ethernet/atheros/Kconfig +18 -0
@@ -67,4 +67,22 @@ config ATL1C To compile this driver as a module, choose M here. The module will be called atl1c. +config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_CORE + select MDIO + help + This driver supports the Qualcomm Atheros L1F ethernet adapter, + i.e. the following chipsets: + + 1969:1091 - AR8161 Gigabit Ethernet + 1969:1090 - AR8162 Fast Ethernet + 1969:10A1 - AR8171 Gigabit Ethernet + 1969:10A0 - AR8172 Fast Ethernet + + To compile this driver as a module, choose M here. The module + will be called alx. + endif # NET_VENDOR_ATHEROS
drivers/net/ethernet/atheros/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_ATL1) += atlx/ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ +obj-$(CONFIG_ALX) += alx/
drivers/net/ethernet/atheros/alx/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ALX) += alx.o +alx-objs := main.o ethtool.o hw.o +ccflags-y += -D__CHECK_ENDIAN__
drivers/net/ethernet/atheros/alx/alx.h new file +107 -0
107 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/ethtool.c new file +273 -0
273 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.c new file +1253 -0
1,253 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.h new file +506 -0
506 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/main.c new file +1590 -0
832 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/reg.h new file +813 -0
813 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Johannes Berg <[email protected]> :
[...]
Quoted 7 lines
I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
- The bitops for alx->int_mask in alx_check_link and alx_poll race. ALX_ISR_{TX/RX}_Q0 may end disabled if alx_check_link wins.
- dev_alloc_skb is a bit legacy. You may netdev_alloc_skb (_ip_align ?).
- no spin_lock_init ?
- budget may not be honored in alx_clean_rx_irq
Signature · 1 line
Ueimor
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
On Wed, 2013-06-12 at 00:23 +0200, Francois Romieu wrote:
Thanks for looking!
Quoted 2 lines
- The bitops for
alx->int_maskinalx_check_linkandalx_pollrace. ALX_ISR_{TX/RX}_Q0 may end disabled ifalx_check_linkwins.
Ahrg, yes, I saw this before but forgot, sorry :-(
Quoted 1 line
-
dev_alloc_skbis a bit legacy. You maynetdev_alloc_skb(_ip_align?).
Hmm, ok? This was new to me, I'll check it out as well as alignment.
Quoted 1 line
- no
spin_lock_init?
Ouch.
Quoted 1 line
- budget may not be honored in
alx_clean_rx_irq
Hmm, I'll take another look. I thought only the TX part wasn't doing this properly, but this was my first foray into real NAPI usage so I'm not surprised I got it wrong :-)
johannes
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergQuoted 9 lines · Johannes Berg
This is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously. I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
[...]
drivers/net/ethernet/atheros/Kconfig config ATL1C · line 74
Quoted 11 lines
drivers/net/ethernet/atheros/Kconfig +5
-0@@ -67,4 +67,22 @@ config ATL1C To compile this driver as a module, choose M here. The module will be called atl1c. +config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_CORE
Why NET_CORE? It looks like a lot of drivers are selecting it because MII depends on it, but this doesn't select MII. (Actually, it's ridiculous that MII depends on NET_CORE. I'll see what I can do about that.)
[...]
Quoted 2 lines
drivers/net/ethernet/atheros/alx/alx.h new file +0
-0
[...]
Quoted 7 lines
drivers/net/ethernet/atheros/alx/alx.h new file +7
-0+struct alx_priv { +struct net_device *dev; + +struct alx_hw hw; + +/* all descriptor memory */ +struct {
drivers/net/ethernet/atheros/alx/alx.h line 90
Quoted 10 lines
drivers/net/ethernet/atheros/alx/alx.h new file +10
-0+dma_addr_t dma; +void *virt; +int size; + } descmem; + +u32 int_mask; + +int tx_ringsz; +int rx_ringsz; +int rxbuf_size;
Sizes could all be unsigned?
[...]
Quoted 2 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +0
-0
[...]
Quoted 26 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +26
-0+static int alx_get_settings (struct net_device *netdev,struct ethtool_cmd *ecmd) +{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; + + ecmd->supported = SUPPORTED_10baseT_Half | + SUPPORTED_10baseT_Full | + SUPPORTED_100baseT_Half | + SUPPORTED_100baseT_Full | + SUPPORTED_Autoneg | +SUPPORTED_TP | + SUPPORTED_Pause; +if (alx_hw_giga (hw)) + ecmd->supported |= SUPPORTED_1000baseT_Full; + + ecmd->advertising =ADVERTISED_TP ; +if (hw->adv_cfg & ADVERTISED_Autoneg) + ecmd->advertising |= hw->adv_cfg; + + ecmd->port =PORT_TP ; + ecmd->phy_address =0 ; +if (hw->adv_cfg & ADVERTISED_Autoneg) + ecmd->autoneg =AUTONEG_ENABLE ; +else + ecmd->autoneg =AUTONEG_DISABLE ; + ecmd->transceiver =XCVR_INTERNAL ;
drivers/net/ethernet/atheros/alx/ethtool.c line 85
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+ +if (hw->flowctrl &ALX_FC_ANEG && hw->adv_cfg & ADVERTISED_Autoneg) { +if (hw->flowctrl &ALX_FC_RX ) { + ecmd->advertising |= ADVERTISED_Pause; + +if (!(hw->flowctrl &ALX_FC_TX )) + ecmd->advertising |= ADVERTISED_Asym_Pause; + }else if (hw->flowctrl &ALX_FC_TX ) { + ecmd->advertising |= ADVERTISED_Asym_Pause; + }
If Asym_Pause can be advertised then it should be in the supported mask too...
drivers/net/ethernet/atheros/alx/ethtool.c line 91
Quoted 6 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +6
-0+ } + +if (hw->link_speed !=SPEED_UNKNOWN ) { +ethtool_cmd_speed_set (ecmd, + hw->link_speed - hw->link_speed %10 ); + ecmd->duplex = hw->link_speed %10 ;
Please use separate fields for speed and duplex.
Quoted 9 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +9
-0+ }else { +ethtool_cmd_speed_set (ecmd,SPEED_UNKNOWN ); + ecmd->duplex =DUPLEX_UNKNOWN ; + } + +return 0 ; +} + +static int alx_set_settings (struct net_device *netdev,struct ethtool_cmd *ecmd)
drivers/net/ethernet/atheros/alx/ethtool.c line 110
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; +u32 adv_cfg; + +ASSERT_RTNL (); + +if (ecmd->autoneg ==AUTONEG_ENABLE ) { +if (ecmd->advertising & ADVERTISED_1000baseT_Half) +return -EINVAL ;
Now what about 10000, 40000, etc... You should break out the code that sets ecmd->supported from alx_get_settings() and then do something like:
if (ecmd->advertising & ~alx_get_supported_mask()) return -EINVAL;
here.
Quoted 27 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +27
-0+ adv_cfg = ecmd->advertising | ADVERTISED_Autoneg; + }else { +int speed =ethtool_cmd_speed (ecmd); + +switch (speed + ecmd->duplex) { +case SPEED_10 +DUPLEX_HALF : + adv_cfg = ADVERTISED_10baseT_Half; +break ; +case SPEED_10 +DUPLEX_FULL : + adv_cfg = ADVERTISED_10baseT_Full; +break ; +case SPEED_100 +DUPLEX_HALF : + adv_cfg = ADVERTISED_100baseT_Half; +break ; +case SPEED_100 +DUPLEX_FULL : + adv_cfg = ADVERTISED_100baseT_Full; +break ; +default : +return -EINVAL ; + } + } + + hw->adv_cfg = adv_cfg; +return alx_setup_speed_duplex (hw, adv_cfg, hw->flowctrl); +} + +static void alx_get_pauseparam(struct net_device *netdev,
drivers/net/ethernet/atheros/alx/ethtool.c line 147
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+ struct ethtool_pauseparam *pause) +{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; + +if (hw->flowctrl &ALX_FC_ANEG && + hw->adv_cfg & ADVERTISED_Autoneg) + pause->autoneg =AUTONEG_ENABLE ; +else + pause->autoneg =AUTONEG_DISABLE ;
Those macros are meant for ethtool_cmd::autoneg, not ethtool_pauseparam::autoneg. (Not that it makes the slightest difference in practice.)
drivers/net/ethernet/atheros/alx/ethtool.c line 157
Quoted 9 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +9
-0+if (hw->flowctrl &ALX_FC_TX ) + pause->tx_pause =1 ; +else + pause->tx_pause =0 ; + +if (hw->flowctrl &ALX_FC_RX ) + pause->rx_pause =1 ; +else + pause->rx_pause =0 ;
Could be written more concisely as pause->tx_pause = !!(hw_flowtrl & ALX_FC_TX) etc.
Quoted 30 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +30
-0+} + + +static int alx_set_pauseparam (struct net_device *netdev, +struct ethtool_pauseparam *pause) +{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; +int err =0 ; +bool reconfig_phy = false; +u8 fc =0 ; + +if (pause->tx_pause) + fc |=ALX_FC_TX ; +if (pause->rx_pause) + fc |=ALX_FC_RX ; +if (pause->autoneg) + fc |=ALX_FC_ANEG ; + +ASSERT_RTNL (); + +/* restart auto-neg for auto-mode */ +if (hw->adv_cfg & ADVERTISED_Autoneg) { +if (!((fc ^ hw->flowctrl) &ALX_FC_ANEG )) + reconfig_phy = true; +if (fc & hw->flowctrl &ALX_FC_ANEG && + (fc ^ hw->flowctrl) & (ALX_FC_RX |ALX_FC_TX )) + reconfig_phy = true; + } +
drivers/net/ethernet/atheros/alx/ethtool.c line 197
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+if (reconfig_phy) { + err =alx_setup_speed_duplex (hw, hw->adv_cfg, fc); +return err; + } + +/* flow control on mac */ +if ((fc ^ hw->flowctrl) & (ALX_FC_RX |ALX_FC_TX )) +alx_cfg_mac_flowcontrol (hw, fc); + + hw->flowctrl = fc;
This assignment is needed in the autoneg case too.
Quoted 2 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +2
-0+return 0 ; +}
[...]
Quoted 12 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +12
-0+static void alx_get_wol (struct net_device *netdev,struct ethtool_wolinfo *wol) +{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; + + wol->supported =WAKE_MAGIC |WAKE_PHY ; + wol->wolopts =0 ; + +if (hw->sleep_ctrl &ALX_SLEEP_WOL_MAGIC ) + wol->wolopts |=WAKE_MAGIC ; +if (hw->sleep_ctrl &ALX_SLEEP_WOL_PHY ) + wol->wolopts |=WAKE_PHY ;
drivers/net/ethernet/atheros/alx/ethtool.c line 237
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+} + +static int alx_set_wol (struct net_device *netdev,struct ethtool_wolinfo *wol) +{ +struct alx_priv *alx =netdev_priv (netdev); +struct alx_hw *hw = &alx->hw; + +if (wol->wolopts & (WAKE_ARP |WAKE_MAGICSECURE | +WAKE_UCAST |WAKE_BCAST |WAKE_MCAST )) +return -EOPNOTSUPP ;
What if we define a new WOL mode? And the operation is supported, just not with the given mode. So:
if (wol->wolopts & ~(WAKE_MAGIC | WAKE_PHY)) return -EINVAL;
Quoted 12 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +12
-0+ hw->sleep_ctrl =0 ; + +if (wol->wolopts &WAKE_MAGIC ) + hw->sleep_ctrl |=ALX_SLEEP_WOL_MAGIC ; +if (wol->wolopts &WAKE_PHY ) + hw->sleep_ctrl |=ALX_SLEEP_WOL_PHY ; + +device_set_wakeup_enable (&alx->hw.pdev->dev, hw->sleep_ctrl); + +return 0 ; +} +
drivers/net/ethernet/atheros/alx/ethtool.c line 260
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+static void alx_get_drvinfo (struct net_device *netdev, +struct ethtool_drvinfo *drvinfo) +{ +struct alx_priv *alx =netdev_priv (netdev); + +strlcpy (drvinfo->driver, alx_drv_name,sizeof (drvinfo->driver)); +strlcpy (drvinfo->fw_version,"N/A" ,sizeof (drvinfo->fw_version)); +strlcpy (drvinfo->bus_info,pci_name (alx->hw.pdev), +sizeof (drvinfo->bus_info)); +}
There is no need to implement get_drvinfo, as the ethtool core provides this information by default.
[...]
Quoted 2 lines
drivers/net/ethernet/atheros/alx/hw.c new file +0
-0
[...]
drivers/net/ethernet/atheros/alx/hw.c line 271
Quoted 13 lines
drivers/net/ethernet/atheros/alx/hw.c new file +13
-0+int alx_get_perm_macaddr (struct alx_hw *hw,u8 *addr) +{ +u32 val, mac0, mac1; +u16 i; +bool loaded_intn = false, loaded_extn = false; + +read_mcadr: +/* try to get it from register first */ + mac0 =alx_read_mem32 (hw,ALX_STAD0 ); + mac1 =alx_read_mem32 (hw,ALX_STAD1 ); + +/* addr should be big-endian */ + *(__be32 *)(addr +2 ) =cpu_to_be32 (mac0);
This is a potential alignment error. Better to break out the bytes one by one, I think.
Quoted 4 lines
drivers/net/ethernet/atheros/alx/hw.c new file +4
-0+ *(__be16 *)addr =cpu_to_be16 (mac1); + +if (is_valid_ether_addr (addr)) +return 0 ;
[...]
drivers/net/ethernet/atheros/alx/hw.c line 336
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+void alx_set_macaddr (struct alx_hw *hw,const u8 *addr) +{ +u32 val; + +/* for example: 00-0B-6A-F6-00-DC * STAD0=6AF600DC, STAD1=000B */ + val =be32_to_cpu (*(__be32 *)(addr +2 ));
Again here.
Quoted 4 lines
drivers/net/ethernet/atheros/alx/hw.c new file +4
-0+alx_write_mem32 (hw,ALX_STAD0 , val); + val =be16_to_cpu (*(__be16 *)addr); +alx_write_mem32 (hw,ALX_STAD1 , val); +}
[...]
drivers/net/ethernet/atheros/alx/hw.c line 353
Quoted 12 lines
drivers/net/ethernet/atheros/alx/hw.c new file +12
-0+void alx_add_mc_addr (struct alx_hw *hw,const u8 *addr) +{ +u32 crc32, bit, reg; + + crc32 =ether_crc (ETH_ALEN , addr); + +/* The HASH Table is a register array of 2 32-bit registers. +* It is treated like an array of 64 bits. We want to set +* bit BitArray[hash_value]. So we figure out what register +* the bit is in, read it, OR in the new bit, then write +* back the new value. The register is determined by the +* upper 7 bits of the hash value and the bit within that
Just bit 5, not the upper 7 bits!
Quoted 7 lines
drivers/net/ethernet/atheros/alx/hw.c new file +7
-0+* register are determined by the lower 5 bits of the value. +*/ + reg = (crc32 >>31 ) &0x1 ; + bit = (crc32 >>26 ) &0x1F ; + + hw->mc_hash[reg] |=BIT (bit); +}
[...]
drivers/net/ethernet/atheros/alx/hw.c line 608
Quoted 12 lines
drivers/net/ethernet/atheros/alx/hw.c new file +12
-0+void alx_reset_pcie (struct alx_hw *hw) +{ +u8 rev =alx_hw_revision (hw); +u32 val; +u16 val16; + +/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */ +pci_read_config_word (hw->pdev,PCI_COMMAND , &val16); +if (!(val16 &ALX_PCI_CMD ) || (val16 &PCI_COMMAND_INTX_DISABLE )) { + val16 = (val16 |ALX_PCI_CMD ) & ~PCI_COMMAND_INTX_DISABLE ; +pci_write_config_word (hw->pdev,PCI_COMMAND , val16); + }
[...]
I don't understand what this is trying to work around but it looks extremely dodgy. The driver already appears to be doing pci_{save,restore}_state() in suspend/resume which is the right thing to do.
I haven't looked at main.c but might spend some time on that later.
I couldn't find where auto-negotiated flow control is programmed after the link comes up. Maybe it isn't?
Ben.
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
(+Johannes, I have a question for you almost at the end of this email)
Quoted 10 lines · Ben Hutchings
drivers/net/ethernet/atheros/Kconfig config ATL1C · line 74
Quoted 5 lines
drivers/net/ethernet/atheros/Kconfig +5
-0+config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_COREWhy
NET_CORE? It looks like a lot of drivers are selecting it because MII depends on it, but this doesn't select MII. (Actually, it's ridiculous that MII depends onNET_CORE. I'll see what I can do about that.)
Yeah, no idea, just copy/paste. Lots of drivers seem to do this, for no particular reason it seems?
What I actually need is MDIO, which is also selected.
Quoted 5 lines
Quoted 5 lines
drivers/net/ethernet/atheros/alx/alx.h new file +5
-0+struct { +dma_addr_t dma; +void *virt; +int size; + } descmem;
...
Quoted 5 lines
drivers/net/ethernet/atheros/alx/alx.h line 90
Quoted 3 lines
drivers/net/ethernet/atheros/alx/alx.h new file +3
-0+int tx_ringsz; +int rx_ringsz; +int rxbuf_size;Sizes could all be unsigned?
Yeah, not that it really matters in terms of exceeding, but still.
Quoted 2 lines
If
Asym_Pausecan be advertised then it should be in the supported mask too...
Ok I'm totally not familiar with ethtool and will admit to copying it from QCA's driver, I just tidied it up a bit ... Makes sense though, I'll add it.
Quoted 6 lines
drivers/net/ethernet/atheros/alx/ethtool.c line 91
Quoted 4 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +4
-0+if (hw->link_speed !=SPEED_UNKNOWN ) { +ethtool_cmd_speed_set (ecmd, + hw->link_speed - hw->link_speed %10 ); + ecmd->duplex = hw->link_speed %10 ;Please use separate fields for speed and duplex.
Heh, ok. I actually played with this a bit and didn't like it much either way ... There doesn't seem to be any combined enum, and if you use separate fields then one is valid only if the other has a certain value, etc... Anyway, I'll change it.
Quoted 5 lines
drivers/net/ethernet/atheros/alx/ethtool.c line 110
Quoted 3 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +3
-0+if (ecmd->autoneg ==AUTONEG_ENABLE ) { +if (ecmd->advertising & ADVERTISED_1000baseT_Half) +return -EINVAL ;Now what about 10000, 40000, etc...
Indeed, that's broken.
Quoted 7 lines
You should break out the code that
setsecmd->supportedfromalx_get_settings()and then do something like:if (ecmd->advertising & ~alx_get_supported_mask()) return -EINVAL;here.
That... seems strange? It would rely on ADVERTISED_* and SUPPORTED_* having the same value, which is probably true, but it still seems confusing?
Not a big problem to list the 5 values here though.
Quoted 5 lines
Quoted 4 lines
drivers/net/ethernet/atheros/alx/hw.c new file +4
-0+alx_write_mem32 (hw,ALX_STAD0 , val); + val =be16_to_cpu (*(__be16 *)addr); +alx_write_mem32 (hw,ALX_STAD1 , val); +}[...]
Quoted 14 lines
drivers/net/ethernet/atheros/alx/hw.c line 353
Quoted 12 lines
drivers/net/ethernet/atheros/alx/hw.c new file +12
-0+void alx_add_mc_addr (struct alx_hw *hw,const u8 *addr) +{ +u32 crc32, bit, reg; + + crc32 =ether_crc (ETH_ALEN , addr); + +/* The HASH Table is a register array of 2 32-bit registers. +* It is treated like an array of 64 bits. We want to set +* bit BitArray[hash_value]. So we figure out what register +* the bit is in, read it, OR in the new bit, then write +* back the new value. The register is determined by the +* upper 7 bits of the hash value and the bit within that Just bit 5, not the upper 7 bits!
I'd actually removed the comment already ... the few lines below seemed really obvious to me.
Quoted 8 lines
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */ +pci_read_config_word (hw->pdev,PCI_COMMAND , &val16); +if (!(val16 &ALX_PCI_CMD ) || (val16 &PCI_COMMAND_INTX_DISABLE )) { + val16 = (val16 |ALX_PCI_CMD ) & ~PCI_COMMAND_INTX_DISABLE ; +pci_write_config_word (hw->pdev,PCI_COMMAND , val16); + }[...]
Quoted 4 lines
I don't understand what this is trying to work around but it looks extremely dodgy. The driver already appears to be doing pci_{save,restore}_state() in suspend/resume which is the right thing to do.
I have no idea, but ~PCI_COMMAND_INTX_DISABLE seems really just like what we do with PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG... maybe this was some sort of workaround for that.
Johannes, can you try to remove this chunk of code and see if your device still works? If so I'd just kill it.
Quoted 1 line
I haven't looked at
main.cbut might spend some time on that later.
Thanks.
Quoted 2 lines
I couldn't find where auto-negotiated flow control is programmed after the link comes up. Maybe it isn't?
No idea, sorry. I clearly have a lot to learn about how ethernet devices typically work, should it be programmed?
Thanks,
johannes
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 15 lines · Johannes Berg
(+Johannes, I have a question for you almost at the end of this email)
Quoted 10 lines · Ben Hutchings
drivers/net/ethernet/atheros/Kconfig config ATL1C · line 74
Quoted 5 lines
drivers/net/ethernet/atheros/Kconfig +5
-0+config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_COREWhy
NET_CORE? It looks like a lot of drivers are selecting it because MII depends on it, but this doesn't select MII. (Actually, it's ridiculous that MII depends onNET_CORE. I'll see what I can do about that.)
Quoted 2 lines
Yeah, no idea, just copy/paste. Lots of drivers seem to do this, for no particular reason it seems?
As I said, most of them select MII which depended on NET_CORE, so they really did need to select NET_CORE too. I've now fixed that.
[...]
Quoted 11 lines
Quoted 6 lines
drivers/net/ethernet/atheros/alx/ethtool.c line 91
Quoted 4 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +4
-0+if (hw->link_speed !=SPEED_UNKNOWN ) { +ethtool_cmd_speed_set (ecmd, + hw->link_speed - hw->link_speed %10 ); + ecmd->duplex = hw->link_speed %10 ;Please use separate fields for speed and duplex.
Heh, ok. I actually played with this a bit and didn't like it much either way ... There doesn't seem to be any combined enum, and if you use separate fields then one is valid only if the other has a certain value, etc... Anyway, I'll change it.
It seems to be a widely used trick, but it means that you may accept silly settings like speed = 99 duplex = 1.
[...]
Quoted 11 lines
Quoted 7 lines
You should break out the code that
setsecmd->supportedfromalx_get_settings()and then do something like:if (ecmd->advertising & ~alx_get_supported_mask()) return -EINVAL;here.
That... seems strange? It would rely on ADVERTISED_* and SUPPORTED_* having the same value, which is probably true, but it still seems confusing?
It is true and should remain true. I don't know why they were ever defined separately in the first place.
[...]
Quoted 5 lines
Quoted 2 lines
I couldn't find where auto-negotiated flow control is programmed after the link comes up. Maybe it isn't?
No idea, sorry. I clearly have a lot to learn about how ethernet devices typically work, should it be programmed?
When autoneg is enabled, the PHY should perform autonegotiation whenever it detects an electrical link; if successful it will configure itself for the negotiated link speed and duplex, and trigger a link interrupt. But unless there is firmware running on the controller, the driver usually has to read PHY registers to get the result and then configure the MAC speed, duplex and flow control accordingly.
Ben.
Signature · 3 lines
Ben Hutchings
Lowery's Law:
If it jams, force it. If it breaks, it needed replacing anyway.Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 5 lines · Ben Hutchings
Quoted 2 lines
Yeah, no idea, just copy/paste. Lots of drivers seem to do this, for no particular reason it seems?
As I said, most of them select MII which depended on
NET_CORE, so they really did need to selectNET_COREtoo. I've now fixed that.
Ok, I can kick out the 'select NET_CORE' here anyway as MDIO doesn't need it. Or did you want to do a more general cleanup on this, then I'll leave it to you?
Quoted 7 lines
Quoted 4 lines
Heh, ok. I actually played with this a bit and didn't like it much either way ... There doesn't seem to be any combined enum, and if you use separate fields then one is valid only if the other has a certain value, etc... Anyway, I'll change it.
It seems to be a widely used trick, but it means that you may accept silly settings like speed = 99 duplex = 1.
Yes, though here it was really used only internally... Anyway, I killed it, makes some code nicer and some a bit more awkward (more parameters)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
You should break out the code that
setsecmd->supportedfromalx_get_settings()and then do something like:if (ecmd->advertising & ~alx_get_supported_mask()) return -EINVAL;
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
here.
That... seems strange? It would rely on ADVERTISED_* and SUPPORTED_* having the same value, which is probably true, but it still seems confusing?
It is true and should remain true. I don't know why they were ever defined separately in the first place.
Hmm, ok. I'll do it that way.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
I couldn't find where auto-negotiated flow control is programmed after the link comes up. Maybe it isn't?
No idea, sorry. I clearly have a lot to learn about how ethernet devices typically work, should it be programmed?
Quoted 6 lines
When autoneg is enabled, the PHY should perform autonegotiation whenever it detects an electrical link; if successful it will configure itself for the negotiated link speed and duplex, and trigger a link interrupt. But unless there is firmware running on the controller, the driver usually has to read PHY registers to get the result and then configure the MAC speed, duplex and flow control accordingly.
Ok, makes sense. I guess a bunch of these things are done in alx_post_phy_link() or so, but yeah I don't see flow control either.
How would I even test that? Find random devices that have flow control? I don't think I have anything that would be programmable, unless I don't know about it being so :-)
johannes
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 11 lines · Johannes Berg
Quoted 5 lines · Ben Hutchings
Quoted 2 lines
Yeah, no idea, just copy/paste. Lots of drivers seem to do this, for no particular reason it seems?
As I said, most of them select MII which depended on
NET_CORE, so they really did need to selectNET_COREtoo. I've now fixed that.Ok, I can kick out the 'select
NET_CORE' here anyway as MDIO doesn't need it. Or did you want to do a more general cleanup on this, then I'll leave it to you?
See commit a1606c7dc64d8449676d7e840dd2cd0c4e0a0c57.
[...]
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
I couldn't find where auto-negotiated flow control is programmed after the link comes up. Maybe it isn't?
No idea, sorry. I clearly have a lot to learn about how ethernet devices typically work, should it be programmed?
Quoted 6 lines
When autoneg is enabled, the PHY should perform autonegotiation whenever it detects an electrical link; if successful it will configure itself for the negotiated link speed and duplex, and trigger a link interrupt. But unless there is firmware running on the controller, the driver usually has to read PHY registers to get the result and then configure the MAC speed, duplex and flow control accordingly.
Quoted 6 lines
Ok, makes sense. I guess a bunch of these things are done in
alx_post_phy_link()or so, but yeah I don't see flow control either.How would I even test that? Find random devices that have flow control? I don't think I have anything that would be programmable, unless I don't know about it being so :-)
Most Ethernet controllers seem to support flow control. Though, in a quick test, the e1000e driver on my laptop never seems to turn off Pause advertising!
Ben.
Signature · 3 lines
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
A fail-safe circuit will destroy others.Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 5 lines · Ben Hutchings
Quoted 3 lines
Ok, I can kick out the 'select
NET_CORE' here anyway as MDIO doesn't need it. Or did you want to do a more general cleanup on this, then I'll leave it to you?See commit
a1606c7dc64d8449676d7e840dd2cd0c4e0a0c57.
Ok, I'll remove it from alx.
Quoted 7 lines
Quoted 3 lines
How would I even test that? Find random devices that have flow control? I don't think I have anything that would be programmable, unless I don't know about it being so :-)
Most Ethernet controllers seem to support flow control. Though, in a quick test, the e1000e driver on my laptop never seems to turn off Pause advertising!
Hah! And how did you determine that? :)
johannes
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 14 lines · Johannes Berg
Quoted 5 lines · Ben Hutchings
Quoted 3 lines
Ok, I can kick out the 'select
NET_CORE' here anyway as MDIO doesn't need it. Or did you want to do a more general cleanup on this, then I'll leave it to you?See commit
a1606c7dc64d8449676d7e840dd2cd0c4e0a0c57.Ok, I'll remove it from alx.
Quoted 4 lines
Quoted 3 lines
How would I even test that? Find random devices that have flow control? I don't think I have anything that would be programmable, unless I don't know about it being so :-)
Quoted 5 lines
Quoted 3 lines
Most Ethernet controllers seem to support flow control. Though, in a quick test, the e1000e driver on my laptop never seems to turn off Pause advertising!
Hah! And how did you determine that? :)
Turned pause autoneg on/off and looked at the PHY registers with mii-tool (Debian version, which I think has some patches that never went upstream).
Ben.
Signature · 3 lines
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
A fail-safe circuit will destroy others.Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergQuoted 16 lines · Johannes Berg
Quoted 8 lines · Ben Hutchings
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */ +pci_read_config_word (hw->pdev,PCI_COMMAND , &val16); +if (!(val16 &ALX_PCI_CMD ) || (val16 &PCI_COMMAND_INTX_DISABLE )) { + val16 = (val16 |ALX_PCI_CMD ) & ~PCI_COMMAND_INTX_DISABLE ; +pci_write_config_word (hw->pdev,PCI_COMMAND , val16); + }[...]
Quoted 4 lines
I don't understand what this is trying to work around but it looks extremely dodgy. The driver already appears to be doing pci_{save,restore}_state() in suspend/resume which is the right thing to do.
Quoted 6 lines
I have no idea, but ~PCI_COMMAND_INTX_DISABLE seems really just like what we do with
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG... maybe this was some sort of workaround for that.Johannes, can you try to remove this chunk of code and see if your device still works? If so I'd just kill it.
I removed it and did a full power cycle, alx still works. Also tried suspend-to-RAM and alx still works. However, since the comment for this code is about BIOS bugs it might be that it is required on some other machine? Not sure if it is wise to remove it...
Another thing: When testing suspend-to-RAM my machine immediately woke up. ethtool said wol is enabled by default:
Supports Wake-on: pg
Wake-on: pg
but even after "ethtool -s eth0 wol d" it still woke up. I did a few experiments, it seems that once the alx driver is loaded, even when the interface is down, the other end of the link (laptop with e1000e) reports the link goes into 10Mbit/s speed during suspend (actually it goes
1G -> down -> 10M), I have to unplug the cable to prevent the wakeup. Even after "ifconfig eth down"
and "rmmod alx" the link is still up.
# ethtool -s eth0 wol d
# ifconfig eth0 down
# ethtool eth0
...
Wake-on: d
Link detected: noBut the link LEDs are still on and the other side says "Link detected: yes" and it can't get some sleep.
I think hw->sleep_ctrl should be initialized to 0 in alx_init_sw(), but I cannot find why the link stays up after "ifconfig eth0 down".
Thanks,
Johannes
Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
Quoted 30 lines · Johannes Stezenbach
Quoted 16 lines · Johannes Berg
Quoted 8 lines · Ben Hutchings
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */ +pci_read_config_word (hw->pdev,PCI_COMMAND , &val16); +if (!(val16 &ALX_PCI_CMD ) || (val16 &PCI_COMMAND_INTX_DISABLE )) { + val16 = (val16 |ALX_PCI_CMD ) & ~PCI_COMMAND_INTX_DISABLE ; +pci_write_config_word (hw->pdev,PCI_COMMAND , val16); + }[...]
Quoted 4 lines
I don't understand what this is trying to work around but it looks extremely dodgy. The driver already appears to be doing pci_{save,restore}_state() in suspend/resume which is the right thing to do.
Quoted 6 lines
I have no idea, but ~PCI_COMMAND_INTX_DISABLE seems really just like what we do with
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG... maybe this was some sort of workaround for that.Johannes, can you try to remove this chunk of code and see if your device still works? If so I'd just kill it.
I removed it and did a full power cycle, alx still works. Also tried suspend-to-RAM and alx still works. However, since the comment for this code is about BIOS bugs it might be that it is required on some other machine? Not sure if it is wise to remove it...
Quoted 10 lines
Another thing: When testing suspend-to-RAM my machine immediately woke up. ethtool said wol is enabled by default:
Supports Wake-on: pg
Wake-on: pg
but even after "ethtool -s eth0 wol d" it still woke up. I did a few experiments, it seems that once the alx driver is loaded, even when the interface is down, the other end of the link (laptop with e1000e) reports the link goes into 10Mbit/s speed during suspend (actually it goes
1G -> down -> 10M),
[...]
Yes, the driver explicitly selects a lower link speed to save power (alx_select_powersaving_speed()). If WAKE_PHY is enabled, I think alx_pre_suspend() needs to wait for link-up before returning. Not sure though.
Ben.
Signature · 3 lines
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
A fail-safe circuit will destroy others.Re: [PATCH v2 1/1] alx: add a simple AR816x/AR817x device driver
In reply to Johannes StezenbachQuoted 21 lines · Johannes Stezenbach
Quoted 20 lines · Johannes Berg
Quoted 8 lines · Ben Hutchings
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */ +pci_read_config_word (hw->pdev,PCI_COMMAND , &val16); +if (!(val16 &ALX_PCI_CMD ) || (val16 &PCI_COMMAND_INTX_DISABLE )) { + val16 = (val16 |ALX_PCI_CMD ) & ~PCI_COMMAND_INTX_DISABLE ; +pci_write_config_word (hw->pdev,PCI_COMMAND , val16); + }[...]
Quoted 4 lines
I don't understand what this is trying to work around but it looks extremely dodgy. The driver already appears to be doing pci_{save,restore}_state() in suspend/resume which is the right thing to do.
I have no idea, but ~PCI_COMMAND_INTX_DISABLE seems really just like what we do with
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG... maybe this was some sort of workaround for that.
Quoted 8 lines
Quoted 2 lines
Johannes, can you try to remove this chunk of code and see if your device still works? If so I'd just kill it.
I removed it and did a full power cycle, alx still works. Also tried suspend-to-RAM and alx still works. However, since the comment for this code is about BIOS bugs it might be that it is required on some other machine? Not sure if it is wise to remove it...
I dunno ... it seems to me we should just try, absent other information? It really does look a lot like what PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG does ...
Quoted 5 lines
Another thing: When testing suspend-to-RAM my machine immediately woke up. ethtool said wol is enabled by default:
Supports Wake-on: pg
Wake-on: pg
but even after "ethtool -s eth0 wol d" it still woke up.
Hmm, yeah, I can reproduce that :-/ I'll try to fix it. Or maybe just kill WoWLAN code ...
johannes
Quoted 11 lines · Johannes Berg
So ... I was stupid enough to not research drivers for this device before buying a board that included one, I figured in 2013 it wasn't really possible for such a simple gigabit ethernet device to not have a driver in Linux.
Boy was I wrong.
The vendor driver was previously posted on netdev, and subsequently somewhat cleaned up, but ... it still had useless hand-rolled locks (with test_and_set_bit/msleep!), horrible macros, and was generally quite a mess.
I had the same unpleasant experience about missing alx driver for my Asus P8H77-V board. I found this:
http://www.linuxfoundation.org/collaborate/workgroups/networking/alx
https://github.com/qca/alx
And this mail talks about upstreaming:
http://lists.infradead.org/pipermail/unified-drivers/2013-April/000064.html
Johannes
Quoted 13 lines · Johannes Stezenbach
Quoted 11 lines · Johannes Berg
So ... I was stupid enough to not research drivers for this device before buying a board that included one, I figured in 2013 it wasn't really possible for such a simple gigabit ethernet device to not have a driver in Linux.
Boy was I wrong.
The vendor driver was previously posted on netdev, and subsequently somewhat cleaned up, but ... it still had useless hand-rolled locks (with test_and_set_bit/msleep!), horrible macros, and was generally quite a mess.
Quoted 7 lines
I had the same unpleasant experience about missing alx driver for my Asus P8H77-V board. I found this:
http://www.linuxfoundation.org/collaborate/workgroups/networking/alx
https://github.com/qca/alxAnd this mail talks about upstreaming:
http://lists.infradead.org/pipermail/unified-drivers/2013-April/000064.html
There as been lots of talk, and they even submitted a driver once, but it was pretty crappy ... I decided that cleaning it up now, while liberally and deliberately removing features I don't want to worry about right now, was going to be easier than using their out of tree driver for my system forever, because I have little hope that they'll actually manage to put something upstreamable together.
Anyway, it's a completely spare-time effort for me, so contributions to the driver are clearly welcome.
johannes
PATCH 1/1 alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergThis is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously. I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
---
v3:
* fix budget in RX handling (thanks Francois)
* add spinlock for interrupt handling (ditto)
* use __netdev_alloc_skb_ip_align (ditto)
* add missing spin_lock_init (ditto)
* clean up indentation in reg.h
--- drivers/net/ethernet/atheros/Kconfig | 18 + drivers/net/ethernet/atheros/Makefile | 1 + drivers/net/ethernet/atheros/alx/Makefile | 3 + drivers/net/ethernet/atheros/alx/alx.h | 110 ++ drivers/net/ethernet/atheros/alx/ethtool.c | 273 +++++ drivers/net/ethernet/atheros/alx/hw.c | 1253 ++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/hw.h | 506 +++++++++ drivers/net/ethernet/atheros/alx/main.c | 1608 ++++++++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/reg.h | 809 ++++++++++++++ 9 files changed, 4581 insertions(+) create mode 100644 drivers/net/ethernet/atheros/alx/Makefile create mode 100644 drivers/net/ethernet/atheros/alx/alx.h create mode 100644 drivers/net/ethernet/atheros/alx/ethtool.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.h create mode 100644 drivers/net/ethernet/atheros/alx/main.c create mode 100644 drivers/net/ethernet/atheros/alx/reg.h
drivers/net/ethernet/atheros/Kconfig +18 -0
@@ -67,4 +67,22 @@ config ATL1C To compile this driver as a module, choose M here. The module will be called atl1c. +config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_CORE + select MDIO + help + This driver supports the Qualcomm Atheros L1F ethernet adapter, + i.e. the following chipsets: + + 1969:1091 - AR8161 Gigabit Ethernet + 1969:1090 - AR8162 Fast Ethernet + 1969:10A1 - AR8171 Gigabit Ethernet + 1969:10A0 - AR8172 Fast Ethernet + + To compile this driver as a module, choose M here. The module + will be called alx. + endif # NET_VENDOR_ATHEROS
drivers/net/ethernet/atheros/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_ATL1) += atlx/ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ +obj-$(CONFIG_ALX) += alx/
drivers/net/ethernet/atheros/alx/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ALX) += alx.o +alx-objs := main.o ethtool.o hw.o +ccflags-y += -D__CHECK_ENDIAN__
drivers/net/ethernet/atheros/alx/alx.h new file +110 -0
110 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/ethtool.c new file +273 -0
273 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.c new file +1253 -0
1,253 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.h new file +506 -0
506 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/main.c new file +1608 -0
829 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/reg.h new file +809 -0
809 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
pci_error_handlers should be const.
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 1 line · Stephen Hemminger
pci_error_handlersshould be const.
Indeed, thanks Stephen. I'll repost later (in the next couple of days.)
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergJohannes Berg <[email protected]> :
[...]
Quoted 5 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +0
-0
[...]
drivers/net/ethernet/atheros/alx/ethtool.c line 257
Quoted 7 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +7
-0+static void alx_get_drvinfo (struct net_device *netdev, +struct ethtool_drvinfo *drvinfo) +{ +struct alx_priv *alx =netdev_priv (netdev); + +strlcpy (drvinfo->driver, alx_drv_name,sizeof (drvinfo->driver)); +strlcpy (drvinfo->fw_version,"N/A" ,sizeof (drvinfo->fw_version));
See 84b405011166e663fe9ef56c29b1d76f59b35568.
Quoted 5 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +5
-0+strlcpy (drvinfo->bus_info,pci_name (alx->hw.pdev), +sizeof (drvinfo->bus_info)); +} + +const struct ethtool_ops alx_ethtool_ops = {
drivers/net/ethernet/atheros/alx/ethtool.c line 272
Quoted 10 lines
drivers/net/ethernet/atheros/alx/ethtool.c new file +10
-0+ .get_settings = alx_get_settings, + .set_settings = alx_set_settings, + .get_pauseparam = alx_get_pauseparam, + .set_pauseparam = alx_set_pauseparam, + .get_drvinfo = alx_get_drvinfo, + .get_msglevel = alx_get_msglevel, + .set_msglevel = alx_set_msglevel, + .get_wol = alx_get_wol, + .set_wol = alx_set_wol, + .get_link = ethtool_op_get_link,
Please use tabs before =
Quoted 5 lines
drivers/net/ethernet/atheros/alx/hw.c new file +0
-0
[...]
drivers/net/ethernet/atheros/alx/hw.c line 157
Quoted 9 lines
drivers/net/ethernet/atheros/alx/hw.c new file +9
-0+static int __alx_read_phy_dbg (struct alx_hw *hw,u16 reg,u16 *pdata) +{ +int err; + + err =__alx_write_phy_reg (hw,ALX_MII_DBG_ADDR , reg); +if (err) +return err; + +return __alx_read_phy_reg (hw,ALX_MII_DBG_DATA , pdata);
return err ? err : __alx_read_phy_reg(hw, ALX_MII_DBG_DATA, pdata);
[...]
drivers/net/ethernet/atheros/alx/hw.c line 177
Quoted 7 lines
drivers/net/ethernet/atheros/alx/hw.c new file +7
-0+int alx_read_phy_reg (struct alx_hw *hw,u16 reg,u16 *phy_data) +{ +int err; + +spin_lock (&hw->mdio_lock); + err =__alx_read_phy_reg (hw, reg, phy_data); +spin_unlock (&hw->mdio_lock);
Isn't it possible to remove the phy ops from any irq / napi / tasklet context ?
If you only need it in user / workqueue context you'll be able to trade the spinlock for a mutex (and push it in the common core methods ?).
[...]
Quoted 19 lines
drivers/net/ethernet/atheros/alx/hw.c new file +19
-0+read_mcadr: +/* try to get it from register first */ + mac0 =alx_read_mem32 (hw,ALX_STAD0 ); + mac1 =alx_read_mem32 (hw,ALX_STAD1 ); + +/* addr should be big-endian */ + *(__be32 *)(addr +2 ) =cpu_to_be32 (mac0); + *(__be16 *)addr =cpu_to_be16 (mac1); + +if (is_valid_ether_addr (addr)) +return 0 ; + +if (!loaded_intn) { +/* try to load from efuse */ +for (i =0 ; i <ALX_SLD_MAX_TO ; i++) { + val =alx_read_mem32 (hw,ALX_SLD ); +if ((val & (ALX_SLD_STAT |ALX_SLD_START )) ==0 ) +break ; +mdelay (1 );
drivers/net/ethernet/atheros/alx/hw.c line 293
Quoted 10 lines
drivers/net/ethernet/atheros/alx/hw.c new file +10
-0+ } +if (i ==ALX_SLD_MAX_TO ) +return -EIO ; +alx_write_mem32 (hw,ALX_SLD , val |ALX_SLD_START ); +for (i =0 ; i <ALX_SLD_MAX_TO ; i++) { +mdelay (1 ); + val =alx_read_mem32 (hw,ALX_SLD ); +if ((val &ALX_SLD_START ) ==0 ) +break ; + }
You may add an helper for the loops above.
drivers/net/ethernet/atheros/alx/hw.c line 297
Quoted 4 lines
drivers/net/ethernet/atheros/alx/hw.c new file +4
-0+if (i ==ALX_SLD_MAX_TO ) +return -EIO ; + loaded_intn = true; + goto read_mcadr;
(I don't dislike it but it verges on goto fetishismi :o) )
[...]
Quoted 5 lines
drivers/net/ethernet/atheros/alx/main.c new file +0
-0
[...]
drivers/net/ethernet/atheros/alx/main.c line 287
Quoted 6 lines
drivers/net/ethernet/atheros/alx/main.c new file +6
-0+static irqreturn_t alx_intr_handle (struct alx_priv *alx,u32 intr) +{ +struct alx_hw *hw = &alx->hw; +bool write_int_mask = false; + +spin_lock (&alx->irq_lock);
Do yourself a favor: avoid any work in the irq handler.
Forget the lock. Mask irqs, insert mmiowb and memory barrier, then schedule napi if there is any event.
In the napi handler, enable napi polling then irq.
[...]
drivers/net/ethernet/atheros/alx/main.c line 1588
Quoted 5 lines
drivers/net/ethernet/atheros/alx/main.c new file +5
-0+static DEFINE_PCI_DEVICE_TABLE (alx_pci_tbl) = { + {PCI_DEVICE (PCI_VENDOR_ID_ATTANSIC ,ALX_DEV_ID_AR8161 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_ATTANSIC ,ALX_DEV_ID_AR8162 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_ATTANSIC ,ALX_DEV_ID_AR8171 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_ATTANSIC ,ALX_DEV_ID_AR8172 ) },
{ PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_...Signature · 1 line
Ueimor
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 2 lines · Francois Romieu
Johannes Berg <[email protected]> :
drivers/net/ethernet/atheros/alx/hw.c
Quoted 1 line
drivers/net/ethernet/atheros/alx/hw.c +0
-0
[]
Quoted 11 lines
drivers/net/ethernet/atheros/alx/hw.c line 157
Quoted 9 lines
drivers/net/ethernet/atheros/alx/hw.c +9
-0+static int __alx_read_phy_dbg (struct alx_hw *hw,u16 reg,u16 *pdata) +{ +int err; + + err =__alx_write_phy_reg (hw,ALX_MII_DBG_ADDR , reg); +if (err) +return err; + +return __alx_read_phy_reg (hw,ALX_MII_DBG_DATA , pdata);return err ? err : __alx_read_phy_reg(hw, ALX_MII_DBG_DATA, pdata);
I think that's far poorer style.
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Joe Perches <[email protected]> :
Quoted 1 line · Francois Romieu
[...]
Quoted 3 lines
Quoted 1 line
return err ? err : __alx_read_phy_reg(hw, ALX_MII_DBG_DATA, pdata);I think that's far poorer style.
Nevermind. The change is bogus.
Signature · 1 line
Ueimor
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
In reply to Francois RomieuThanks again :-)
Quoted 10 lines
drivers/net/ethernet/atheros/alx/hw.c line 177
Quoted 7 lines
drivers/net/ethernet/atheros/alx/hw.c new file +7
-0+int alx_read_phy_reg (struct alx_hw *hw,u16 reg,u16 *phy_data) +{ +int err; + +spin_lock (&hw->mdio_lock); + err =__alx_read_phy_reg (hw, reg, phy_data); +spin_unlock (&hw->mdio_lock);Isn't it possible to remove the phy ops from any irq / napi / tasklet context ?
I don't think they're actually called there.
Quoted 2 lines
If you only need it in user / workqueue context you'll be able to trade the spinlock for a mutex (and push it in the common core methods ?).
Yes, I suppose I could, but is it worth it? It's held only for a very short amount of time to get the indirect register access correct. I don't really see any reason to prefer a mutex here?
Not sure what you mean by "push it in the common core methods"? I actually suspect that this lock can't ever be contended because the callers hold the RTNL anyway, but I don't really want to rely on just that.
Quoted 9 lines
drivers/net/ethernet/atheros/alx/hw.c line 293
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c new file +6
-0+for (i =0 ; i <ALX_SLD_MAX_TO ; i++) { +mdelay (1 ); + val =alx_read_mem32 (hw,ALX_SLD ); +if ((val &ALX_SLD_START ) ==0 ) +break ; + }You may add an helper for the loops above.
Quoted 6 lines
drivers/net/ethernet/atheros/alx/hw.c line 297
Quoted 4 lines
drivers/net/ethernet/atheros/alx/hw.c new file +4
-0+if (i ==ALX_SLD_MAX_TO ) +return -EIO ; + loaded_intn = true; + goto read_mcadr;(I don't dislike it but it verges on goto fetishismi :o) )
It is pretty ugly ... I've now rewritten it using two helper functions.
Quoted 9 lines
drivers/net/ethernet/atheros/alx/main.c line 287
Quoted 6 lines
drivers/net/ethernet/atheros/alx/main.c new file +6
-0+static irqreturn_t alx_intr_handle (struct alx_priv *alx,u32 intr) +{ +struct alx_hw *hw = &alx->hw; +bool write_int_mask = false; + +spin_lock (&alx->irq_lock);Do yourself a favor: avoid any work in the irq handler.
Quoted 4 lines
Forget the lock. Mask irqs, insert mmiowb and memory barrier, then schedule napi if there is any event.
In the napi handler, enable napi polling then irq.
Hmm, yeah, I'll have to think about that. I don't really care about the performance all that much ... just want the device to work :-)
Would I really want to rely on NAPI for error interrupts and the like though? I thought NAPI could potentially be deferred due to budget etc.
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Johannes Berg <[email protected]> :
[...]
Quoted 3 lines
Yes, I suppose I could, but is it worth it? It's held only for a very short amount of time to get the indirect register access correct. I don't really see any reason to prefer a mutex here?
Neither a spinlock nor a mutex should be needed but I have to sleep before figuring it.
Quoted 4 lines
Not sure what you mean by "push it in the common core methods"? I actually suspect that this lock can't ever be contended because the callers hold the RTNL anyway, but I don't really want to rely on just that.
Don't be shy :o)
[...]
Quoted 2 lines
Hmm, yeah, I'll have to think about that. I don't really care about the performance all that much ... just want the device to work :-)
Ok. It's fine.
Quoted 2 lines
Would I really want to rely on NAPI for error interrupts and the like though? I thought NAPI could potentially be deferred due to budget etc.
It will have to wait for ksoftirqd once its budget is exhausted.
If the irq and napi handlers don't share a lock, either they are racing or the napi handler will be kicked on irq return.
I'll admit a bias towards some extra latency if it can buy user context comfort.
Signature · 1 line
Ueimor
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 8 lines · Francois Romieu
Johannes Berg <[email protected]> :
[...]Quoted 3 lines
Yes, I suppose I could, but is it worth it? It's held only for a very short amount of time to get the indirect register access correct. I don't really see any reason to prefer a mutex here?
Neither a spinlock nor a mutex should be needed but I have to sleep before figuring it.
I totally think you're right, I'm just not a big fan of making the locking difficult to understand :-)
OTOH, I could stick an ASSERT_RTNL() in there and not worry about it. I'm fairly sure that everything here is under rtnl (work struct I lock myself, configuration ops will be, and ethtool should be too ...) but does removing that lock really make the driver better? I'm not really sure about that.
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergQuoted 11 lines · Johannes Berg
This is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously. I have heavily reworked the driver to be a bit saner, and in the process removed a number of features: TSO/GSO, VLAN acceleration and multiqueue. I've also ruthlessly stripped things not useful to me, e.g. register access support.
Right now it only supports a single TX and RX queue and no special features other than checksum offload.
Signed-off-by Johannes Berg <[email protected]>
I tried your driver with v3.9.6 and got this on boot:
[ 0.939189] INFO: trying to register non-static key. [ 0.939787] the code is fine but needs lockdep annotation. [ 0.940387] turning off the locking correctness validator. [ 0.940992] Pid: 1, comm: swapper/0 Not tainted 3.9.6 #2 [ 0.941589] Call Trace: [ 0.942179] [<ffffffff8108cead>] __lock_acquire.isra.24+0x710/0xa47 [ 0.942781] [<ffffffff8108d87f>] lock_acquire+0xc0/0x142 [ 0.943379] [<ffffffff814414b1>] ? alx_write_phy_dbg+0x25/0x69 [ 0.943980] [<ffffffff8108b624>] ? lock_release_holdtime.part.18+0x93/0x98 [ 0.944587] [<ffffffff816620ae>] _raw_spin_lock+0x3e/0x70 [ 0.945193] [<ffffffff814414b1>] ? alx_write_phy_dbg+0x25/0x69 [ 0.945798] [<ffffffff814414b1>] alx_write_phy_dbg+0x25/0x69 [ 0.946399] [<ffffffff81441bcc>] alx_reset_phy+0x78/0x223 [ 0.946991] [<ffffffff814424b5>] ? alx_phy_configured+0x1a/0x7f [ 0.947577] [<ffffffff8144000b>] alx_probe+0x30f/0x635 [ 0.948162] [<ffffffff812d54a8>] pci_device_probe+0x6e/0xb2 [ 0.948757] [<ffffffff813efab0>] driver_probe_device+0x11a/0x2ef [ 0.949350] [<ffffffff813efd23>] __driver_attach+0x61/0x83 [ 0.949936] [<ffffffff813efcc2>] ? __device_attach+0x3d/0x3d [ 0.950513] [<ffffffff813ede40>] bus_for_each_dev+0x7d/0x87 [ 0.951089] [<ffffffff813ef4e8>] driver_attach+0x1e/0x20 [ 0.951661] [<ffffffff813ef0b6>] bus_add_driver+0x136/0x23e [ 0.952228] [<ffffffff81f0cf63>] ? atl1e_init_module+0x1b/0x1b [ 0.952782] [<ffffffff813f0268>] driver_register+0x8c/0xfd [ 0.953321] [<ffffffff81f0cf63>] ? atl1e_init_module+0x1b/0x1b [ 0.953855] [<ffffffff812d5319>] __pci_register_driver+0x5d/0x60 [ 0.954387] [<ffffffff81f0cf7c>] alx_driver_init+0x19/0x1b [ 0.954906] [<ffffffff8100026c>] do_one_initcall+0x7f/0x13e [ 0.955420] [<ffffffff81ee0e96>] kernel_init_freeable+0x115/0x196 [ 0.955922] [<ffffffff81ee0738>] ? do_early_param+0x88/0x88 [ 0.956436] [<ffffffff81648389>] ? rest_init+0xbd/0xbd [ 0.956955] [<ffffffff81648397>] kernel_init+0xe/0xd6 [ 0.957472] [<ffffffff8166962c>] ret_from_fork+0x7c/0xb0 [ 0.958000] [<ffffffff81648389>] ? rest_init+0xbd/0xbd
and after "ifconfig eth0 up":
[ 539.482153] alx 0000:03:00.0: irq 45 for MSI/MSI-X [ 539.482249] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 539.483169] alx 0000:03:00.0 eth0: NIC Up: 1 Gbps Full [ 539.483354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 544.801438] ------------[ cut here ]------------ [ 544.801458] WARNING: at net/sched/sch_generic.c:255 dev_watchdog+0x19b/0x201() [ 544.801462] Hardware name: System Product Name [ 544.801464] NETDEV WATCHDOG: eth0 (alx): transmit queue 0 timed out [ 544.801466] Modules linked in: ath9k_htc ath9k_common ath9k_hw kvm_intel ath mac80211 kvm cfg80211 ehci_pci ehci_hcd xhci_hcd [ 544.801483] Pid: 0, comm: swapper/2 Not tainted 3.9.6 #2 [ 544.801486] Call Trace: [ 544.801488] <IRQ> [<ffffffff8155e600>] ? dev_watchdog+0x118/0x201 [ 544.801499] [<ffffffff8103f68c>] warn_slowpath_common+0x81/0x9b [ 544.801513] [<ffffffff8103f6f2>] warn_slowpath_fmt+0x4c/0x4e [ 544.801525] [<ffffffff8155e683>] dev_watchdog+0x19b/0x201 [ 544.801530] [<ffffffff8155e4e8>] ? dev_graft_qdisc+0x6b/0x6b [ 544.801536] [<ffffffff8104cbb1>] call_timer_fn+0xa1/0x1b7 [ 544.801540] [<ffffffff8104cb15>] ? call_timer_fn+0x5/0x1b7 [ 544.801545] [<ffffffff8104d4eb>] run_timer_softirq+0x1f2/0x253 [ 544.801550] [<ffffffff8155e4e8>] ? dev_graft_qdisc+0x6b/0x6b [ 544.801555] [<ffffffff81046902>] __do_softirq+0x106/0x28e [ 544.801560] [<ffffffff81046bb4>] irq_exit+0x66/0xaa [ 544.801572] [<ffffffff8166b0ad>] smp_apic_timer_interrupt+0x8a/0x98 [ 544.801585] [<ffffffff8166a2f2>] apic_timer_interrupt+0x72/0x80 [ 544.801587] <EOI> [<ffffffff814cdc09>] ? cpuidle_wrap_enter+0x4f/0x87 [ 544.801602] [<ffffffff814cd3f5>] cpuidle_enter_tk+0x10/0x12 [ 544.801618] [<ffffffff814cd7d1>] cpuidle_enter_state+0x13/0x39 [ 544.801626] [<ffffffff814cd8f6>] cpuidle_idle_call+0xff/0x1f5 [ 544.801634] [<ffffffff8100920c>] cpu_idle+0xb5/0xf3 [ 544.801643] [<ffffffff816519cc>] start_secondary+0x266/0x26a [ 544.801650] ---[ end trace bf3b629fdf5b91ce ]--- [ 544.803253] alx 0000:03:00.0 eth0: NIC Up: 1 Gbps Full
lspci -vvvn:
03:00.0 Ethernet controller: Qualcomm Atheros AR8161 Gigabit Ethernet (rev 08)
03:00.0 0200: 1969:1091 (rev 08)
Subsystem: 1043:8507
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx+
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 45
Region 0: Memory at f7c00000 (64-bit, non-prefetchable) [size=256K]
Region 2: I/O ports at e000 [size=128]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [58] Express (v1) Endpoint, MSI 00
DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
ExtTag- AttnBtn+ AttnInd+ PwrInd+ RBE+ FLReset-
DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 unlimited, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
Capabilities: [c0] MSI: Enable+ Count=1/16 Maskable+ 64bit+
Address: 00000000fee0f00c Data: 41e1
Masking: 0000fffe Pending: 00000000
Capabilities: [d8] MSI-X: Enable- Count=16 Masked-
Vector table: BAR=0 offset=00002000
PBA: BAR=0 offset=00003000
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP- SDES+ TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Capabilities: [180 v1] Device Serial Number ff-*
Kernel driver in use: alx
grep eth0 /proc/interrupts
45: 0 0 0 0 PCI-MSI-edge eth0
Any idea what to try?
Thanks,
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 7 lines · Johannes Stezenbach
[ 0.939189] INFO: trying to register non-static key. [ 0.939787] the code is fine but needs lockdep annotation. [ 0.940387] turning off the locking correctness validator. [ 0.940992] Pid: 1, comm: swapper/0 Not tainted 3.9.6 #2 [ 0.941589] Call Trace: [ 0.942179] [<ffffffff8108cead>] __lock_acquire.isra.24+0x710/0xa47 [ 0.942781] [<ffffffff8108d87f>] lock_acquire+0xc0/0x142
I *think* this is probably the missing spin_lock_init I had forgotten.
Quoted 10 lines
and after "ifconfig eth0 up":
[ 539.482153] alx 0000:03:00.0: irq 45 for MSI/MSI-X [ 539.482249] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 539.483169] alx 0000:03:00.0 eth0: NIC Up: 1 Gbps Full [ 539.483354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 544.801438] ------------[ cut here ]------------ [ 544.801458] WARNING: at net/sched/sch_generic.c:255 dev_watchdog+0x19b/0x201() [ 544.801462] Hardware name: System Product Name [ 544.801464] NETDEV WATCHDOG: eth0 (alx): transmit queue 0 timed out
Hmm, this is odd. I might just be forgetting to set something.
Quoted 1 line
03:00.0 Ethernet controller: Qualcomm Atheros AR8161 Gigabit Ethernet (rev 08)
OTOH, I have a 8171, so maybe I messed up with my simplifications or it simply doesn't work.
Quoted 1 line
Any idea what to try?
Does it still pass traffic after that? Or is it actually dead?
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 15 lines · Johannes Berg
Quoted 10 lines · Johannes Stezenbach
and after "ifconfig eth0 up":
[ 539.482153] alx 0000:03:00.0: irq 45 for MSI/MSI-X [ 539.482249] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 539.483169] alx 0000:03:00.0 eth0: NIC Up: 1 Gbps Full [ 539.483354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 544.801438] ------------[ cut here ]------------ [ 544.801458] WARNING: at net/sched/sch_generic.c:255 dev_watchdog+0x19b/0x201() [ 544.801462] Hardware name: System Product Name [ 544.801464] NETDEV WATCHDOG: eth0 (alx): transmit queue 0 timed outHmm, this is odd. I might just be forgetting to set something.
Quoted 8 lines
Quoted 1 line
03:00.0 Ethernet controller: Qualcomm Atheros AR8161 Gigabit Ethernet (rev 08)
OTOH, I have a 8171, so maybe I messed up with my simplifications or it simply doesn't work.
Quoted 1 line
Any idea what to try?
Does it still pass traffic after that? Or is it actually dead?
It is dead. Not interrupts, I tried ping from both ends of the link (link LED flashes on RX).
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 4 lines · Johannes Stezenbach
Quoted 1 line
Does it still pass traffic after that? Or is it actually dead?
It is dead. Not interrupts, I tried ping from both ends of the link (link LED flashes on RX).
Can you check if one of RX actually works? It seems TX doesn't, at least given the message, but it'd be good to know if RX actually worked? Just trying ping obviously wouldn't determine that, maybe try tcpdump?
I don't see any difference between 8171 and 8161 in the TX code though ...
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Johannes Stezenbach
Quoted 1 line
Does it still pass traffic after that? Or is it actually dead?
It is dead. Not interrupts, I tried ping from both ends of the link (link LED flashes on RX).
Quoted 6 lines
Can you check if one of RX actually works? It seems TX doesn't, at least given the message, but it'd be good to know if RX actually worked? Just trying ping obviously wouldn't determine that, maybe try tcpdump?
I don't see any difference between 8171 and 8161 in the TX code though ...
FWIW I tried again on my device against 3.9.6, and it works fine :-/
Latest code is here: http://p.sipsolutions.net/c2e7235ba77373f0.txt in case you want to retry that.
I'm assuming you did try the QCA driver and it works?
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Johannes Berg
Quoted 4 lines · Johannes Stezenbach
Quoted 1 line
Does it still pass traffic after that? Or is it actually dead?
It is dead. Not interrupts, I tried ping from both ends of the link (link LED flashes on RX).
Can you check if one of RX actually works? It seems TX doesn't, at least given the message, but it'd be good to know if RX actually worked? Just trying ping obviously wouldn't determine that, maybe try tcpdump?
I tried it but no packets are received, and no irqs generated.
Quoted 9 lines
Quoted 2 lines
I don't see any difference between 8171 and 8161 in the TX code though ...
FWIW I tried again on my device against 3.9.6, and it works fine :-/
Latest code is here: http://p.sipsolutions.net/c2e7235ba77373f0.txt in case you want to retry that.
I'm assuming you did try the QCA driver and it works?
It worked at some time in the past, but I just tried again and now it doesn't work, it spits a large register dump periodically and then does task:alx_reinit. I'll try to backtrack to find the working version, but give me some time.
(Usually I don't use eth on this maching except for doing bulk data copies to my laptop, which happens very rarely. For the most time I'm using ath9k_htc WLAN USB dongle.)
Another thing: suspend to disk fails (also happened with QCA driver):
Jun 16 00:54:32 abc kernel: [93820.564582] Suspending console(s) (use no_console_suspend to debug) Jun 16 00:54:32 abc kernel: [93820.568633] serial 00:0a: disabled Jun 16 00:54:32 abc kernel: [93820.568644] serial 00:0a: System wakeup disabled by ACPI Jun 16 00:54:32 abc kernel: [93820.569407] alx 0000:03:00.0: PHY SPD/DPLX unresolved: 0xffff Jun 16 00:54:32 abc kernel: [93820.569410] alx 0000:03:00.0: shutdown fail in suspend -22 Jun 16 00:54:32 abc kernel: [93820.569417] pci_pm_freeze(): alx_suspend+0x0/0x75 returns -22 Jun 16 00:54:32 abc kernel: [93820.569421] dpm_run_callback(): pci_pm_freeze+0x0/0x8f returns -22 Jun 16 00:54:32 abc kernel: [93820.569427] PM: Device 0000:03:00.0 failed to freeze async: error -22
(I think it worked the first time but failed on second suspend)
Thanks,
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 5 lines · Johannes Stezenbach
Quoted 3 lines
Quoted 3 lines
Can you check if one of RX actually works? It seems TX doesn't, at least given the message, but it'd be good to know if RX actually worked? Just trying ping obviously wouldn't determine that, maybe try tcpdump?
I tried it but no packets are received, and no irqs generated.
Ok.
Quoted 7 lines
Quoted 1 line
I'm assuming you did try the QCA driver and it works?
It worked at some time in the past, but I just tried again and now it doesn't work, it spits a large register dump periodically and then does task:alx_reinit. I'll try to backtrack to find the working version, but give me some time.
Ouch. Which tree are you testing there, btw? I found a handful of trees on github.
Quoted 15 lines
(Usually I don't use eth on this maching except for doing bulk data copies to my laptop, which happens very rarely. For the most time I'm using
ath9k_htcWLAN USB dongle.)Another thing: suspend to disk fails (also happened with QCA driver):
Jun 16 00:54:32 abc kernel: [93820.564582] Suspending console(s) (use no_console_suspend to debug) Jun 16 00:54:32 abc kernel: [93820.568633] serial 00:0a: disabled Jun 16 00:54:32 abc kernel: [93820.568644] serial 00:0a: System wakeup disabled by ACPI Jun 16 00:54:32 abc kernel: [93820.569407] alx 0000:03:00.0: PHY SPD/DPLX unresolved: 0xffff Jun 16 00:54:32 abc kernel: [93820.569410] alx 0000:03:00.0: shutdown fail in suspend -22 Jun 16 00:54:32 abc kernel: [93820.569417] pci_pm_freeze(): alx_suspend+0x0/0x75 returns -22 Jun 16 00:54:32 abc kernel: [93820.569421] dpm_run_callback(): pci_pm_freeze+0x0/0x8f returns -22 Jun 16 00:54:32 abc kernel: [93820.569427] PM: Device 0000:03:00.0 failed to freeze async: error -22
Quoted 1 line
(I think it worked the first time but failed on second suspend)
Hmm. I don't really have a use for suspend/resume here, I'll poke at it but ... maybe I should just remove WOL and kill the chip in suspend. :)
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 4 lines · Johannes Berg
Quoted 2 lines · Johannes Stezenbach
Quoted 1 line
I'm assuming you did try the QCA driver and it works?
Quoted 8 lines
Quoted 5 lines
It worked at some time in the past, but I just tried again and now it doesn't work, it spits a large register dump periodically and then does task:alx_reinit. I'll try to backtrack to find the working version, but give me some time.
Ouch. Which tree are you testing there, btw? I found a handful of trees on github.
I was using https://github.com/qca/alx.git but after testing my previous 3.8.13 kernel it seems it doesn't work. Maybe I compiled it but never got around to really test it...
The last version which worked was in compat-wireless-3.6.8-1-snpc.tar.bz2 from http://wireless.kernel.org/en/users/Download/stable#compat-wireless_3.6_stable_releases
which I had compiled for linux-3.7.6.
Thanks,
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 14 lines · Johannes Stezenbach
Quoted 4 lines · Johannes Berg
Quoted 2 lines · Johannes Stezenbach
Quoted 1 line
I'm assuming you did try the QCA driver and it works?
Quoted 8 lines
Quoted 5 lines
It worked at some time in the past, but I just tried again and now it doesn't work, it spits a large register dump periodically and then does task:alx_reinit. I'll try to backtrack to find the working version, but give me some time.
Ouch. Which tree are you testing there, btw? I found a handful of trees on github.
Quoted 7 lines
I was using https://github.com/qca/alx.git but after testing my previous 3.8.13 kernel it seems it doesn't work. Maybe I compiled it but never got around to really test it...
The last version which worked was in compat-wireless-3.6.8-1-snpc.tar.bz2 from http://wireless.kernel.org/en/users/Download/stable#compat-wireless_3.6_stable_releases
which I had compiled for linux-3.7.6.
FWIW, these are the messages printed when loading it:
[ 61.972473] Compat-wireless backport release: compat-wireless-v3.6.8-1-snpc [ 61.972479] Backport based on linux-stable.git v3.6.8 [ 61.972481] compat.git: linux-stable.git [ 61.976397] Qualcomm Atheros(R) AR813x/AR815x/AR816x PCI-E Ethernet Network Driver [ 61.976460] alx 0000:03:00.0: DMA to 64-BIT addresses [ 61.976667] alx 0000:03:00.0: (unregistered net_device): HW Flags = 0x415 [ 61.977192] alx 0000:03:00.0: (unregistered net_device): reset PHY, pws = 1, az = 0, ptp = 0 [ 61.978402] alx 0000:03:00.0: (unregistered net_device): speed = 0x2f, autoneg = 1 [ 61.979494] alx 0000:03:00.0: irq 45 for MSI/MSI-X [ 61.979880] alx: Atheros Gigabit Network Connection
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
In reply to Johannes StezenbachQuoted 4 lines · Johannes Stezenbach
The last version which worked was in compat-wireless-3.6.8-1-snpc.tar.bz2 from http://wireless.kernel.org/en/users/Download/stable#compat-wireless_3.6_stable_releases
which I had compiled for linux-3.7.6.
I got it working with this change:
drivers/net/ethernet/atheros/alx/main.c renamed from drivers/net/ethernet/atheros/alx/main.c.orig +1 -0
@@ -722,6 +722,7 @@ static int alx_init_sw(struct alx_priv *ALX_MAC_CTRL_TXFC_EN |7 <<ALX_MAC_CTRL_PRMBLEN_SHIFT ; + pdev->dev_flags |=PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG ;return err; }
The compat-wireless-3.6.8-1-snpc driver applied this flag for AR8161 and AR8162 if I got it correctly.
Thanks
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
drivers/net/ethernet/atheros/alx/main.c static int alx_init_sw(struct alx_priv * · line 725
Quoted 8 lines
drivers/net/ethernet/atheros/alx/main.c renamed from drivers/net/ethernet/atheros/alx/main.c.orig +1
-0@@ -722,6 +722,7 @@ static int alx_init_sw(struct alx_priv *ALX_MAC_CTRL_TXFC_EN |7 <<ALX_MAC_CTRL_PRMBLEN_SHIFT ; + pdev->dev_flags |=PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG ;
Heh, ok.
Quoted 2 lines
The compat-wireless-3.6.8-1-snpc driver applied this flag for AR8161 and AR8162 if I got it correctly.
I can't download that any more it seems.
I think it should be like this then:
drivers/net/ethernet/atheros/alx/alx.h +4 -0
@@ -72,6 +72,10 @@ struct alx_tx_queue {#define ALX_DEFAULT_TX_WORK 128 +enum alx_device_quirks { +ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG =BIT (0 ), +}; +struct alx_priv {struct net_device *dev;
drivers/net/ethernet/atheros/alx/main.c +9 -3
@@ -1322,6 +1322,9 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->irq = pdev->irq; netdev->watchdog_timeo =ALX_WATCHDOG_TIME ; +if (ent->driver_data &ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG ) + pdev->dev_flags |=PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG ; + err =alx_init_sw (alx);if (err) {dev_err (&pdev->dev,"net device private data init failed\n" );
@@ -1592,9 +1595,12 @@ static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);#endif static DEFINE_PCI_DEVICE_TABLE (alx_pci_tbl) = { - {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8161 ) }, - {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_E2200 ) }, - {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8162 ) }, + {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8161 ), + .driver_data =ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, + {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_E2200 ), + .driver_data =ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, + {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8162 ), + .driver_data =ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8171 ) }, {PCI_VDEVICE (ATTANSIC ,ALX_DEV_ID_AR8172 ) }, {}
Can you try that? Full driver patch here:
http://p.sipsolutions.net/f8e6f95ff0894d89.txt
johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
Quoted 3 lines · Johannes Berg
Can you try that? Full driver patch here:
http://p.sipsolutions.net/f8e6f95ff0894d89.txt
It works.
Thanks
Johannes
Re: [PATCH] alx: add a simple AR816x/AR817x device driver
In reply to Johannes StezenbachQuoted 10 lines · Johannes Stezenbach
Another thing: suspend to disk fails (also happened with QCA driver):
Jun 16 00:54:32 abc kernel: [93820.564582] Suspending console(s) (use no_console_suspend to debug) Jun 16 00:54:32 abc kernel: [93820.568633] serial 00:0a: disabled Jun 16 00:54:32 abc kernel: [93820.568644] serial 00:0a: System wakeup disabled by ACPI Jun 16 00:54:32 abc kernel: [93820.569407] alx 0000:03:00.0: PHY SPD/DPLX unresolved: 0xffff Jun 16 00:54:32 abc kernel: [93820.569410] alx 0000:03:00.0: shutdown fail in suspend -22 Jun 16 00:54:32 abc kernel: [93820.569417] pci_pm_freeze(): alx_suspend+0x0/0x75 returns -22 Jun 16 00:54:32 abc kernel: [93820.569421] dpm_run_callback(): pci_pm_freeze+0x0/0x8f returns -22 Jun 16 00:54:32 abc kernel: [93820.569427] PM: Device 0000:03:00.0 failed to freeze async: error -22
It failed differently for me, which I've fixed. However, it doesn't resume properly (device doesn't actually work until you down/up cycle it), I'll poke at that later.
http://p.sipsolutions.net/04bb9ce0a6586437.txt
johannes
PATCH v4 1/1 alx: add a simple AR816x/AR817x device driver
In reply to Johannes BergThis is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously, but reworked to make the code saner. However, it also lost a number of features (TSO/GSO, VLAN acceleration and multi- queue support) in the process, as well as debugging support features I didn't have any use for. The only thing I left is checksum offload.
More features can obviously be added, but this seemed like a good start for having a driver in mainline at all.
Johannes Stezenbach has verified that the driver works on AR8161, I have a AR8171 myself. The E2200 device ID I found on github in somebody's repository.
---
v4:
* make pci_error_handlers const (thanks Stephen)
* get rid of N/A version in ethtool (Francois)
* line up ethtool_ops (ditto)
* use PCI_VDEVICE (ditto)
* move multicast hashing into main
* rewrite alx_get_perm_macaddr
* remove duplicate struct names
* remove some dead segmentation offload code
* use better TX descriptor struct
* fix some indentation
* add another PCI ID
* use __netdev_alloc_skb, alignment restrictions
* reorganise code a bit
* fix alx_get_phy_link return value usage
* use PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG for ar8161 devices
--- drivers/net/ethernet/atheros/Kconfig | 18 + drivers/net/ethernet/atheros/Makefile | 1 + drivers/net/ethernet/atheros/alx/Makefile | 3 + drivers/net/ethernet/atheros/alx/alx.h | 114 ++ drivers/net/ethernet/atheros/alx/ethtool.c | 272 +++++ drivers/net/ethernet/atheros/alx/hw.c | 1226 +++++++++++++++++++++ drivers/net/ethernet/atheros/alx/hw.h | 499 +++++++++ drivers/net/ethernet/atheros/alx/main.c | 1625 ++++++++++++++++++++++++++++ drivers/net/ethernet/atheros/alx/reg.h | 810 ++++++++++++++ 9 files changed, 4568 insertions(+) create mode 100644 drivers/net/ethernet/atheros/alx/Makefile create mode 100644 drivers/net/ethernet/atheros/alx/alx.h create mode 100644 drivers/net/ethernet/atheros/alx/ethtool.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.c create mode 100644 drivers/net/ethernet/atheros/alx/hw.h create mode 100644 drivers/net/ethernet/atheros/alx/main.c create mode 100644 drivers/net/ethernet/atheros/alx/reg.h
drivers/net/ethernet/atheros/Kconfig +18 -0
@@ -67,4 +67,22 @@ config ATL1C To compile this driver as a module, choose M here. The module will be called atl1c. +config ALX + tristate "Qualcomm Atheros AR816x/AR817x support" + depends on PCI + select CRC32 + select NET_CORE + select MDIO + help + This driver supports the Qualcomm Atheros L1F ethernet adapter, + i.e. the following chipsets: + + 1969:1091 - AR8161 Gigabit Ethernet + 1969:1090 - AR8162 Fast Ethernet + 1969:10A1 - AR8171 Gigabit Ethernet + 1969:10A0 - AR8172 Fast Ethernet + + To compile this driver as a module, choose M here. The module + will be called alx. + endif # NET_VENDOR_ATHEROS
drivers/net/ethernet/atheros/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_ATL1) += atlx/ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ +obj-$(CONFIG_ALX) += alx/
drivers/net/ethernet/atheros/alx/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ALX) += alx.o +alx-objs := main.o ethtool.o hw.o +ccflags-y += -D__CHECK_ENDIAN__
drivers/net/ethernet/atheros/alx/alx.h new file +114 -0
114 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/ethtool.c new file +272 -0
272 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.c new file +1226 -0
1,226 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/hw.h new file +499 -0
499 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/main.c new file +1625 -0
860 lines not on this page · raw message
drivers/net/ethernet/atheros/alx/reg.h new file +810 -0
810 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v4] alx: add a simple AR816x/AR817x device driver
From: Johannes Berg <[email protected]>
Date: Mon, 17 Jun 2013 22:44:02 +0200
Quoted 8 lines
This is a very simple driver, based on the original vendor driver that Qualcomm/Atheros published/submitted previously, but reworked to make the code saner. However, it also lost a number of features (TSO/GSO, VLAN acceleration and multi- queue support) in the process, as well as debugging support features I didn't have any use for. The only thing I left is checksum offload.
Quoted 8 lines
More features can obviously be added, but this seemed like a good start for having a driver in mainline at all.
Johannes Stezenbach has verified that the driver works on AR8161, I have a AR8171 myself. The E2200 device ID I found on github in somebody's repository.
Signed-off-by Johannes Berg <[email protected]>
I've applied this to 'net', thanks Johannes. There might be some fixups still needed, but for people who have these devices this is a huge improvement for them.
Thanks!