* Re: [PATCH] ath5k: Remove AHB bus support.
From: Oleksij Rempel @ 2013-05-13 15:20 UTC (permalink / raw)
To: Paul Bolle
Cc: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, John W. Linville,
Bob Copeland, Wojciech Dubowik, nbd, ath5k-devel, linux-wireless,
netdev, linux-kernel
In-Reply-To: <1368457391.1350.67.camel@x61.thuisdomein>
Hmm... i'm working right now to make ar231x device work with upstream
sources. First think is boot loader. There are is a ar231x fork of
redboot, but i decided to go barebox. See:
https://github.com/olerem/barebox/commits/atheros
there one more barebox dev on it, so i think we will get it.
Next step will be to check why ar231x patches are not in upstream
kernel. After i ported ar231x-eth driver to barebox, i can assume why it
is not included - it need some more work. Or may be there are other reasons.
Currently i do not know how AHB bus related to ATHEROS_AR231X.
Am 13.05.2013 17:03, schrieb Paul Bolle:
> AHB bus support was added in v2.6.38, through commit a0b907ee2a ("ath5k:
> Add AHB bus support."). That code can only be build if the Kconfig
> symbol ATHEROS_AR231X is set. But that symbol has never been added to
> the tree. So AHB bus support has always been dead code.
>
> Let's remove all code that depends on ATHEROS_AR231X. If that symbol
> ever gets added to the tree the AHB bus support can be re-added too.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> ---
> 0) Compile tested (I do not think I have hardware that use the ath5k
> driver).
>
> 1) I mentioned the missing ATHEROS_AR231X symbol three times before (in
> August 2011, in July 2012 and in March 2103). Nobody stepped forward to
> tell me they were actually working on adding that symbol somehow. So
> let's see how people react when I submit a patch to remove the (dead)
> AHB bus support.
>
> drivers/net/wireless/ath/ath5k/Kconfig | 14 +-
> drivers/net/wireless/ath/ath5k/Makefile | 1 -
> drivers/net/wireless/ath/ath5k/ahb.c | 239 --------------------------------
> drivers/net/wireless/ath/ath5k/ath5k.h | 28 ----
> drivers/net/wireless/ath/ath5k/base.c | 14 --
> drivers/net/wireless/ath/ath5k/led.c | 6 -
> 6 files changed, 3 insertions(+), 299 deletions(-)
> delete mode 100644 drivers/net/wireless/ath/ath5k/ahb.c
>
> diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
> index c9f81a3..93caf8e68 100644
> --- a/drivers/net/wireless/ath/ath5k/Kconfig
> +++ b/drivers/net/wireless/ath/ath5k/Kconfig
> @@ -1,13 +1,12 @@
> config ATH5K
> tristate "Atheros 5xxx wireless cards support"
> - depends on (PCI || ATHEROS_AR231X) && MAC80211
> + depends on PCI && MAC80211
> select ATH_COMMON
> select MAC80211_LEDS
> select LEDS_CLASS
> select NEW_LEDS
> select AVERAGE
> - select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
> - select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
> + select ATH5K_PCI
> ---help---
> This module adds support for wireless adapters based on
> Atheros 5xxx chipset.
> @@ -52,16 +51,9 @@ config ATH5K_TRACER
>
> If unsure, say N.
>
> -config ATH5K_AHB
> - bool "Atheros 5xxx AHB bus support"
> - depends on (ATHEROS_AR231X && !PCI)
> - ---help---
> - This adds support for WiSoC type chipsets of the 5xxx Atheros
> - family.
> -
> config ATH5K_PCI
> bool "Atheros 5xxx PCI bus support"
> - depends on (!ATHEROS_AR231X && PCI)
> + depends on PCI
> ---help---
> This adds support for PCI type chipsets of the 5xxx Atheros
> family.
> diff --git a/drivers/net/wireless/ath/ath5k/Makefile b/drivers/net/wireless/ath/ath5k/Makefile
> index 1b3a34f..51e2d86 100644
> --- a/drivers/net/wireless/ath/ath5k/Makefile
> +++ b/drivers/net/wireless/ath/ath5k/Makefile
> @@ -17,6 +17,5 @@ ath5k-y += ani.o
> ath5k-y += sysfs.o
> ath5k-y += mac80211-ops.o
> ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o
> -ath5k-$(CONFIG_ATH5K_AHB) += ahb.o
> ath5k-$(CONFIG_ATH5K_PCI) += pci.o
> obj-$(CONFIG_ATH5K) += ath5k.o
> diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
> deleted file mode 100644
> index 8e8bcc7a..0000000
> --- a/drivers/net/wireless/ath/ath5k/ahb.c
> +++ /dev/null
> @@ -1,239 +0,0 @@
> -/*
> - * Copyright (c) 2008-2009 Atheros Communications Inc.
> - * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
> - * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
> - *
> - * Permission to use, copy, modify, and/or distribute this software for any
> - * purpose with or without fee is hereby granted, provided that the above
> - * copyright notice and this permission notice appear in all copies.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> - */
> -
> -#include <linux/nl80211.h>
> -#include <linux/platform_device.h>
> -#include <linux/etherdevice.h>
> -#include <linux/export.h>
> -#include <ar231x_platform.h>
> -#include "ath5k.h"
> -#include "debug.h"
> -#include "base.h"
> -#include "reg.h"
> -
> -/* return bus cachesize in 4B word units */
> -static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
> -{
> - *csz = L1_CACHE_BYTES >> 2;
> -}
> -
> -static bool
> -ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
> -{
> - struct ath5k_hw *ah = common->priv;
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - u16 *eeprom, *eeprom_end;
> -
> -
> -
> - bcfg = pdev->dev.platform_data;
> - eeprom = (u16 *) bcfg->radio;
> - eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
> -
> - eeprom += off;
> - if (eeprom > eeprom_end)
> - return false;
> -
> - *data = *eeprom;
> - return true;
> -}
> -
> -int ath5k_hw_read_srev(struct ath5k_hw *ah)
> -{
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - ah->ah_mac_srev = bcfg->devid;
> - return 0;
> -}
> -
> -static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
> -{
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - u8 *cfg_mac;
> -
> - if (to_platform_device(ah->dev)->id == 0)
> - cfg_mac = bcfg->config->wlan0_mac;
> - else
> - cfg_mac = bcfg->config->wlan1_mac;
> -
> - memcpy(mac, cfg_mac, ETH_ALEN);
> - return 0;
> -}
> -
> -static const struct ath_bus_ops ath_ahb_bus_ops = {
> - .ath_bus_type = ATH_AHB,
> - .read_cachesize = ath5k_ahb_read_cachesize,
> - .eeprom_read = ath5k_ahb_eeprom_read,
> - .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
> -};
> -
> -/*Initialization*/
> -static int ath_ahb_probe(struct platform_device *pdev)
> -{
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - struct ath5k_hw *ah;
> - struct ieee80211_hw *hw;
> - struct resource *res;
> - void __iomem *mem;
> - int irq;
> - int ret = 0;
> - u32 reg;
> -
> - if (!pdev->dev.platform_data) {
> - dev_err(&pdev->dev, "no platform data specified\n");
> - ret = -EINVAL;
> - goto err_out;
> - }
> -
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "no memory resource found\n");
> - ret = -ENXIO;
> - goto err_out;
> - }
> -
> - mem = ioremap_nocache(res->start, resource_size(res));
> - if (mem == NULL) {
> - dev_err(&pdev->dev, "ioremap failed\n");
> - ret = -ENOMEM;
> - goto err_out;
> - }
> -
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "no IRQ resource found\n");
> - ret = -ENXIO;
> - goto err_iounmap;
> - }
> -
> - irq = res->start;
> -
> - hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
> - if (hw == NULL) {
> - dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
> - ret = -ENOMEM;
> - goto err_iounmap;
> - }
> -
> - ah = hw->priv;
> - ah->hw = hw;
> - ah->dev = &pdev->dev;
> - ah->iobase = mem;
> - ah->irq = irq;
> - ah->devid = bcfg->devid;
> -
> - if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
> - /* Enable WMAC AHB arbitration */
> - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> -
> - /* Enable global WMAC swapping */
> - reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
> - reg |= AR5K_AR2315_BYTESWAP_WMAC;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
> - } else {
> - /* Enable WMAC DMA access (assuming 5312 or 231x*/
> - /* TODO: check other platforms */
> - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
> - if (to_platform_device(ah->dev)->id == 0)
> - reg |= AR5K_AR5312_ENABLE_WLAN0;
> - else
> - reg |= AR5K_AR5312_ENABLE_WLAN1;
> - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
> -
> - /*
> - * On a dual-band AR5312, the multiband radio is only
> - * used as pass-through. Disable 2 GHz support in the
> - * driver for it
> - */
> - if (to_platform_device(ah->dev)->id == 0 &&
> - (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
> - (BD_WLAN1 | BD_WLAN0))
> - ah->ah_capabilities.cap_needs_2GHz_ovr = true;
> - else
> - ah->ah_capabilities.cap_needs_2GHz_ovr = false;
> - }
> -
> - ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
> - if (ret != 0) {
> - dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
> - ret = -ENODEV;
> - goto err_free_hw;
> - }
> -
> - platform_set_drvdata(pdev, hw);
> -
> - return 0;
> -
> - err_free_hw:
> - ieee80211_free_hw(hw);
> - platform_set_drvdata(pdev, NULL);
> - err_iounmap:
> - iounmap(mem);
> - err_out:
> - return ret;
> -}
> -
> -static int ath_ahb_remove(struct platform_device *pdev)
> -{
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> - struct ath5k_hw *ah;
> - u32 reg;
> -
> - if (!hw)
> - return 0;
> -
> - ah = hw->priv;
> -
> - if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
> - /* Disable WMAC AHB arbitration */
> - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - } else {
> - /*Stop DMA access */
> - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
> - if (to_platform_device(ah->dev)->id == 0)
> - reg &= ~AR5K_AR5312_ENABLE_WLAN0;
> - else
> - reg &= ~AR5K_AR5312_ENABLE_WLAN1;
> - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
> - }
> -
> - ath5k_deinit_ah(ah);
> - iounmap(ah->iobase);
> - platform_set_drvdata(pdev, NULL);
> - ieee80211_free_hw(hw);
> -
> - return 0;
> -}
> -
> -static struct platform_driver ath_ahb_driver = {
> - .probe = ath_ahb_probe,
> - .remove = ath_ahb_remove,
> - .driver = {
> - .name = "ar231x-wmac",
> - .owner = THIS_MODULE,
> - },
> -};
> -
> -module_platform_driver(ath_ahb_driver);
> diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
> index 2d691b8..deaedb8 100644
> --- a/drivers/net/wireless/ath/ath5k/ath5k.h
> +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
> @@ -1645,32 +1645,6 @@ static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
> return &(ath5k_hw_common(ah)->regulatory);
> }
>
> -#ifdef CONFIG_ATHEROS_AR231X
> -#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000)
> -
> -static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
> -{
> - /* On AR2315 and AR2317 the PCI clock domain registers
> - * are outside of the WMAC register space */
> - if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
> - (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
> - return AR5K_AR2315_PCI_BASE + reg;
> -
> - return ah->iobase + reg;
> -}
> -
> -static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
> -{
> - return ioread32(ath5k_ahb_reg(ah, reg));
> -}
> -
> -static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
> -{
> - iowrite32(val, ath5k_ahb_reg(ah, reg));
> -}
> -
> -#else
> -
> static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
> {
> return ioread32(ah->iobase + reg);
> @@ -1681,8 +1655,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
> iowrite32(val, ah->iobase + reg);
> }
>
> -#endif
> -
> static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
> {
> return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 9b20d9e..654cc3d 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -97,15 +97,6 @@ static int ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
>
> /* Known SREVs */
> static const struct ath5k_srev_name srev_names[] = {
> -#ifdef CONFIG_ATHEROS_AR231X
> - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 },
> - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 },
> - { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 },
> - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 },
> - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 },
> - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 },
> - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 },
> -#else
> { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 },
> { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 },
> { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A },
> @@ -124,7 +115,6 @@ static const struct ath5k_srev_name srev_names[] = {
> { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 },
> { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 },
> { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 },
> -#endif
> { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN },
> { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 },
> { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 },
> @@ -140,10 +130,6 @@ static const struct ath5k_srev_name srev_names[] = {
> { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 },
> { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 },
> { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 },
> -#ifdef CONFIG_ATHEROS_AR231X
> - { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
> - { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
> -#endif
> { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
> };
>
> diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
> index f77ef36..dbf2483 100644
> --- a/drivers/net/wireless/ath/ath5k/led.c
> +++ b/drivers/net/wireless/ath/ath5k/led.c
> @@ -162,20 +162,14 @@ int ath5k_init_leds(struct ath5k_hw *ah)
> {
> int ret = 0;
> struct ieee80211_hw *hw = ah->hw;
> -#ifndef CONFIG_ATHEROS_AR231X
> struct pci_dev *pdev = ah->pdev;
> -#endif
> char name[ATH5K_LED_MAX_NAME_LEN + 1];
> const struct pci_device_id *match;
>
> if (!ah->pdev)
> return 0;
>
> -#ifdef CONFIG_ATHEROS_AR231X
> - match = NULL;
> -#else
> match = pci_match_id(&ath5k_led_devices[0], pdev);
> -#endif
> if (match) {
> __set_bit(ATH_STAT_LEDSOFT, ah->status);
> ah->led_pin = ATH_PIN(match->driver_data);
>
--
Regards,
Oleksij
^ permalink raw reply
* Re: [PATCH] ath5k: Remove AHB bus support.
From: Adrian Chadd @ 2013-05-13 15:11 UTC (permalink / raw)
To: Paul Bolle
Cc: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, John W. Linville,
Bob Copeland, Wojciech Dubowik, nbd, ath5k-devel, linux-wireless,
netdev, linux-kernel
In-Reply-To: <1368457391.1350.67.camel@x61.thuisdomein>
... is anyone using this on openwrt?
Adrian
On 13 May 2013 08:03, Paul Bolle <pebolle@tiscali.nl> wrote:
> AHB bus support was added in v2.6.38, through commit a0b907ee2a ("ath5k:
> Add AHB bus support."). That code can only be build if the Kconfig
> symbol ATHEROS_AR231X is set. But that symbol has never been added to
> the tree. So AHB bus support has always been dead code.
>
> Let's remove all code that depends on ATHEROS_AR231X. If that symbol
> ever gets added to the tree the AHB bus support can be re-added too.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> ---
> 0) Compile tested (I do not think I have hardware that use the ath5k
> driver).
>
> 1) I mentioned the missing ATHEROS_AR231X symbol three times before (in
> August 2011, in July 2012 and in March 2103). Nobody stepped forward to
> tell me they were actually working on adding that symbol somehow. So
> let's see how people react when I submit a patch to remove the (dead)
> AHB bus support.
>
> drivers/net/wireless/ath/ath5k/Kconfig | 14 +-
> drivers/net/wireless/ath/ath5k/Makefile | 1 -
> drivers/net/wireless/ath/ath5k/ahb.c | 239 --------------------------------
> drivers/net/wireless/ath/ath5k/ath5k.h | 28 ----
> drivers/net/wireless/ath/ath5k/base.c | 14 --
> drivers/net/wireless/ath/ath5k/led.c | 6 -
> 6 files changed, 3 insertions(+), 299 deletions(-)
> delete mode 100644 drivers/net/wireless/ath/ath5k/ahb.c
>
> diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
> index c9f81a3..93caf8e68 100644
> --- a/drivers/net/wireless/ath/ath5k/Kconfig
> +++ b/drivers/net/wireless/ath/ath5k/Kconfig
> @@ -1,13 +1,12 @@
> config ATH5K
> tristate "Atheros 5xxx wireless cards support"
> - depends on (PCI || ATHEROS_AR231X) && MAC80211
> + depends on PCI && MAC80211
> select ATH_COMMON
> select MAC80211_LEDS
> select LEDS_CLASS
> select NEW_LEDS
> select AVERAGE
> - select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
> - select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
> + select ATH5K_PCI
> ---help---
> This module adds support for wireless adapters based on
> Atheros 5xxx chipset.
> @@ -52,16 +51,9 @@ config ATH5K_TRACER
>
> If unsure, say N.
>
> -config ATH5K_AHB
> - bool "Atheros 5xxx AHB bus support"
> - depends on (ATHEROS_AR231X && !PCI)
> - ---help---
> - This adds support for WiSoC type chipsets of the 5xxx Atheros
> - family.
> -
> config ATH5K_PCI
> bool "Atheros 5xxx PCI bus support"
> - depends on (!ATHEROS_AR231X && PCI)
> + depends on PCI
> ---help---
> This adds support for PCI type chipsets of the 5xxx Atheros
> family.
> diff --git a/drivers/net/wireless/ath/ath5k/Makefile b/drivers/net/wireless/ath/ath5k/Makefile
> index 1b3a34f..51e2d86 100644
> --- a/drivers/net/wireless/ath/ath5k/Makefile
> +++ b/drivers/net/wireless/ath/ath5k/Makefile
> @@ -17,6 +17,5 @@ ath5k-y += ani.o
> ath5k-y += sysfs.o
> ath5k-y += mac80211-ops.o
> ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o
> -ath5k-$(CONFIG_ATH5K_AHB) += ahb.o
> ath5k-$(CONFIG_ATH5K_PCI) += pci.o
> obj-$(CONFIG_ATH5K) += ath5k.o
> diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
> deleted file mode 100644
> index 8e8bcc7a..0000000
> --- a/drivers/net/wireless/ath/ath5k/ahb.c
> +++ /dev/null
> @@ -1,239 +0,0 @@
> -/*
> - * Copyright (c) 2008-2009 Atheros Communications Inc.
> - * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
> - * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
> - *
> - * Permission to use, copy, modify, and/or distribute this software for any
> - * purpose with or without fee is hereby granted, provided that the above
> - * copyright notice and this permission notice appear in all copies.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> - */
> -
> -#include <linux/nl80211.h>
> -#include <linux/platform_device.h>
> -#include <linux/etherdevice.h>
> -#include <linux/export.h>
> -#include <ar231x_platform.h>
> -#include "ath5k.h"
> -#include "debug.h"
> -#include "base.h"
> -#include "reg.h"
> -
> -/* return bus cachesize in 4B word units */
> -static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
> -{
> - *csz = L1_CACHE_BYTES >> 2;
> -}
> -
> -static bool
> -ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
> -{
> - struct ath5k_hw *ah = common->priv;
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - u16 *eeprom, *eeprom_end;
> -
> -
> -
> - bcfg = pdev->dev.platform_data;
> - eeprom = (u16 *) bcfg->radio;
> - eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
> -
> - eeprom += off;
> - if (eeprom > eeprom_end)
> - return false;
> -
> - *data = *eeprom;
> - return true;
> -}
> -
> -int ath5k_hw_read_srev(struct ath5k_hw *ah)
> -{
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - ah->ah_mac_srev = bcfg->devid;
> - return 0;
> -}
> -
> -static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
> -{
> - struct platform_device *pdev = to_platform_device(ah->dev);
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - u8 *cfg_mac;
> -
> - if (to_platform_device(ah->dev)->id == 0)
> - cfg_mac = bcfg->config->wlan0_mac;
> - else
> - cfg_mac = bcfg->config->wlan1_mac;
> -
> - memcpy(mac, cfg_mac, ETH_ALEN);
> - return 0;
> -}
> -
> -static const struct ath_bus_ops ath_ahb_bus_ops = {
> - .ath_bus_type = ATH_AHB,
> - .read_cachesize = ath5k_ahb_read_cachesize,
> - .eeprom_read = ath5k_ahb_eeprom_read,
> - .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
> -};
> -
> -/*Initialization*/
> -static int ath_ahb_probe(struct platform_device *pdev)
> -{
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - struct ath5k_hw *ah;
> - struct ieee80211_hw *hw;
> - struct resource *res;
> - void __iomem *mem;
> - int irq;
> - int ret = 0;
> - u32 reg;
> -
> - if (!pdev->dev.platform_data) {
> - dev_err(&pdev->dev, "no platform data specified\n");
> - ret = -EINVAL;
> - goto err_out;
> - }
> -
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "no memory resource found\n");
> - ret = -ENXIO;
> - goto err_out;
> - }
> -
> - mem = ioremap_nocache(res->start, resource_size(res));
> - if (mem == NULL) {
> - dev_err(&pdev->dev, "ioremap failed\n");
> - ret = -ENOMEM;
> - goto err_out;
> - }
> -
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "no IRQ resource found\n");
> - ret = -ENXIO;
> - goto err_iounmap;
> - }
> -
> - irq = res->start;
> -
> - hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
> - if (hw == NULL) {
> - dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
> - ret = -ENOMEM;
> - goto err_iounmap;
> - }
> -
> - ah = hw->priv;
> - ah->hw = hw;
> - ah->dev = &pdev->dev;
> - ah->iobase = mem;
> - ah->irq = irq;
> - ah->devid = bcfg->devid;
> -
> - if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
> - /* Enable WMAC AHB arbitration */
> - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> -
> - /* Enable global WMAC swapping */
> - reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
> - reg |= AR5K_AR2315_BYTESWAP_WMAC;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
> - } else {
> - /* Enable WMAC DMA access (assuming 5312 or 231x*/
> - /* TODO: check other platforms */
> - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
> - if (to_platform_device(ah->dev)->id == 0)
> - reg |= AR5K_AR5312_ENABLE_WLAN0;
> - else
> - reg |= AR5K_AR5312_ENABLE_WLAN1;
> - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
> -
> - /*
> - * On a dual-band AR5312, the multiband radio is only
> - * used as pass-through. Disable 2 GHz support in the
> - * driver for it
> - */
> - if (to_platform_device(ah->dev)->id == 0 &&
> - (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
> - (BD_WLAN1 | BD_WLAN0))
> - ah->ah_capabilities.cap_needs_2GHz_ovr = true;
> - else
> - ah->ah_capabilities.cap_needs_2GHz_ovr = false;
> - }
> -
> - ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
> - if (ret != 0) {
> - dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
> - ret = -ENODEV;
> - goto err_free_hw;
> - }
> -
> - platform_set_drvdata(pdev, hw);
> -
> - return 0;
> -
> - err_free_hw:
> - ieee80211_free_hw(hw);
> - platform_set_drvdata(pdev, NULL);
> - err_iounmap:
> - iounmap(mem);
> - err_out:
> - return ret;
> -}
> -
> -static int ath_ahb_remove(struct platform_device *pdev)
> -{
> - struct ar231x_board_config *bcfg = pdev->dev.platform_data;
> - struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> - struct ath5k_hw *ah;
> - u32 reg;
> -
> - if (!hw)
> - return 0;
> -
> - ah = hw->priv;
> -
> - if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
> - /* Disable WMAC AHB arbitration */
> - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
> - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
> - } else {
> - /*Stop DMA access */
> - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
> - if (to_platform_device(ah->dev)->id == 0)
> - reg &= ~AR5K_AR5312_ENABLE_WLAN0;
> - else
> - reg &= ~AR5K_AR5312_ENABLE_WLAN1;
> - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
> - }
> -
> - ath5k_deinit_ah(ah);
> - iounmap(ah->iobase);
> - platform_set_drvdata(pdev, NULL);
> - ieee80211_free_hw(hw);
> -
> - return 0;
> -}
> -
> -static struct platform_driver ath_ahb_driver = {
> - .probe = ath_ahb_probe,
> - .remove = ath_ahb_remove,
> - .driver = {
> - .name = "ar231x-wmac",
> - .owner = THIS_MODULE,
> - },
> -};
> -
> -module_platform_driver(ath_ahb_driver);
> diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
> index 2d691b8..deaedb8 100644
> --- a/drivers/net/wireless/ath/ath5k/ath5k.h
> +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
> @@ -1645,32 +1645,6 @@ static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
> return &(ath5k_hw_common(ah)->regulatory);
> }
>
> -#ifdef CONFIG_ATHEROS_AR231X
> -#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000)
> -
> -static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
> -{
> - /* On AR2315 and AR2317 the PCI clock domain registers
> - * are outside of the WMAC register space */
> - if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
> - (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
> - return AR5K_AR2315_PCI_BASE + reg;
> -
> - return ah->iobase + reg;
> -}
> -
> -static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
> -{
> - return ioread32(ath5k_ahb_reg(ah, reg));
> -}
> -
> -static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
> -{
> - iowrite32(val, ath5k_ahb_reg(ah, reg));
> -}
> -
> -#else
> -
> static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
> {
> return ioread32(ah->iobase + reg);
> @@ -1681,8 +1655,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
> iowrite32(val, ah->iobase + reg);
> }
>
> -#endif
> -
> static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
> {
> return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 9b20d9e..654cc3d 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -97,15 +97,6 @@ static int ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
>
> /* Known SREVs */
> static const struct ath5k_srev_name srev_names[] = {
> -#ifdef CONFIG_ATHEROS_AR231X
> - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 },
> - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 },
> - { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 },
> - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 },
> - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 },
> - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 },
> - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 },
> -#else
> { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 },
> { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 },
> { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A },
> @@ -124,7 +115,6 @@ static const struct ath5k_srev_name srev_names[] = {
> { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 },
> { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 },
> { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 },
> -#endif
> { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN },
> { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 },
> { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 },
> @@ -140,10 +130,6 @@ static const struct ath5k_srev_name srev_names[] = {
> { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 },
> { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 },
> { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 },
> -#ifdef CONFIG_ATHEROS_AR231X
> - { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
> - { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
> -#endif
> { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
> };
>
> diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
> index f77ef36..dbf2483 100644
> --- a/drivers/net/wireless/ath/ath5k/led.c
> +++ b/drivers/net/wireless/ath/ath5k/led.c
> @@ -162,20 +162,14 @@ int ath5k_init_leds(struct ath5k_hw *ah)
> {
> int ret = 0;
> struct ieee80211_hw *hw = ah->hw;
> -#ifndef CONFIG_ATHEROS_AR231X
> struct pci_dev *pdev = ah->pdev;
> -#endif
> char name[ATH5K_LED_MAX_NAME_LEN + 1];
> const struct pci_device_id *match;
>
> if (!ah->pdev)
> return 0;
>
> -#ifdef CONFIG_ATHEROS_AR231X
> - match = NULL;
> -#else
> match = pci_match_id(&ath5k_led_devices[0], pdev);
> -#endif
> if (match) {
> __set_bit(ATH_STAT_LEDSOFT, ah->status);
> ah->led_pin = ATH_PIN(match->driver_data);
> --
> 1.7.11.7
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] ath5k: Remove AHB bus support.
From: Paul Bolle @ 2013-05-13 15:03 UTC (permalink / raw)
To: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, John W. Linville
Cc: Bob Copeland, Wojciech Dubowik, nbd, ath5k-devel, linux-wireless,
netdev, linux-kernel
In-Reply-To: <1362999998.3137.60.camel@x61.thuisdomein>
AHB bus support was added in v2.6.38, through commit a0b907ee2a ("ath5k:
Add AHB bus support."). That code can only be build if the Kconfig
symbol ATHEROS_AR231X is set. But that symbol has never been added to
the tree. So AHB bus support has always been dead code.
Let's remove all code that depends on ATHEROS_AR231X. If that symbol
ever gets added to the tree the AHB bus support can be re-added too.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) Compile tested (I do not think I have hardware that use the ath5k
driver).
1) I mentioned the missing ATHEROS_AR231X symbol three times before (in
August 2011, in July 2012 and in March 2103). Nobody stepped forward to
tell me they were actually working on adding that symbol somehow. So
let's see how people react when I submit a patch to remove the (dead)
AHB bus support.
drivers/net/wireless/ath/ath5k/Kconfig | 14 +-
drivers/net/wireless/ath/ath5k/Makefile | 1 -
drivers/net/wireless/ath/ath5k/ahb.c | 239 --------------------------------
drivers/net/wireless/ath/ath5k/ath5k.h | 28 ----
drivers/net/wireless/ath/ath5k/base.c | 14 --
drivers/net/wireless/ath/ath5k/led.c | 6 -
6 files changed, 3 insertions(+), 299 deletions(-)
delete mode 100644 drivers/net/wireless/ath/ath5k/ahb.c
diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
index c9f81a3..93caf8e68 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -1,13 +1,12 @@
config ATH5K
tristate "Atheros 5xxx wireless cards support"
- depends on (PCI || ATHEROS_AR231X) && MAC80211
+ depends on PCI && MAC80211
select ATH_COMMON
select MAC80211_LEDS
select LEDS_CLASS
select NEW_LEDS
select AVERAGE
- select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
- select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
+ select ATH5K_PCI
---help---
This module adds support for wireless adapters based on
Atheros 5xxx chipset.
@@ -52,16 +51,9 @@ config ATH5K_TRACER
If unsure, say N.
-config ATH5K_AHB
- bool "Atheros 5xxx AHB bus support"
- depends on (ATHEROS_AR231X && !PCI)
- ---help---
- This adds support for WiSoC type chipsets of the 5xxx Atheros
- family.
-
config ATH5K_PCI
bool "Atheros 5xxx PCI bus support"
- depends on (!ATHEROS_AR231X && PCI)
+ depends on PCI
---help---
This adds support for PCI type chipsets of the 5xxx Atheros
family.
diff --git a/drivers/net/wireless/ath/ath5k/Makefile b/drivers/net/wireless/ath/ath5k/Makefile
index 1b3a34f..51e2d86 100644
--- a/drivers/net/wireless/ath/ath5k/Makefile
+++ b/drivers/net/wireless/ath/ath5k/Makefile
@@ -17,6 +17,5 @@ ath5k-y += ani.o
ath5k-y += sysfs.o
ath5k-y += mac80211-ops.o
ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o
-ath5k-$(CONFIG_ATH5K_AHB) += ahb.o
ath5k-$(CONFIG_ATH5K_PCI) += pci.o
obj-$(CONFIG_ATH5K) += ath5k.o
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
deleted file mode 100644
index 8e8bcc7a..0000000
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 2008-2009 Atheros Communications Inc.
- * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
- * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <linux/nl80211.h>
-#include <linux/platform_device.h>
-#include <linux/etherdevice.h>
-#include <linux/export.h>
-#include <ar231x_platform.h>
-#include "ath5k.h"
-#include "debug.h"
-#include "base.h"
-#include "reg.h"
-
-/* return bus cachesize in 4B word units */
-static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
-{
- *csz = L1_CACHE_BYTES >> 2;
-}
-
-static bool
-ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
-{
- struct ath5k_hw *ah = common->priv;
- struct platform_device *pdev = to_platform_device(ah->dev);
- struct ar231x_board_config *bcfg = pdev->dev.platform_data;
- u16 *eeprom, *eeprom_end;
-
-
-
- bcfg = pdev->dev.platform_data;
- eeprom = (u16 *) bcfg->radio;
- eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
-
- eeprom += off;
- if (eeprom > eeprom_end)
- return false;
-
- *data = *eeprom;
- return true;
-}
-
-int ath5k_hw_read_srev(struct ath5k_hw *ah)
-{
- struct platform_device *pdev = to_platform_device(ah->dev);
- struct ar231x_board_config *bcfg = pdev->dev.platform_data;
- ah->ah_mac_srev = bcfg->devid;
- return 0;
-}
-
-static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
-{
- struct platform_device *pdev = to_platform_device(ah->dev);
- struct ar231x_board_config *bcfg = pdev->dev.platform_data;
- u8 *cfg_mac;
-
- if (to_platform_device(ah->dev)->id == 0)
- cfg_mac = bcfg->config->wlan0_mac;
- else
- cfg_mac = bcfg->config->wlan1_mac;
-
- memcpy(mac, cfg_mac, ETH_ALEN);
- return 0;
-}
-
-static const struct ath_bus_ops ath_ahb_bus_ops = {
- .ath_bus_type = ATH_AHB,
- .read_cachesize = ath5k_ahb_read_cachesize,
- .eeprom_read = ath5k_ahb_eeprom_read,
- .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
-};
-
-/*Initialization*/
-static int ath_ahb_probe(struct platform_device *pdev)
-{
- struct ar231x_board_config *bcfg = pdev->dev.platform_data;
- struct ath5k_hw *ah;
- struct ieee80211_hw *hw;
- struct resource *res;
- void __iomem *mem;
- int irq;
- int ret = 0;
- u32 reg;
-
- if (!pdev->dev.platform_data) {
- dev_err(&pdev->dev, "no platform data specified\n");
- ret = -EINVAL;
- goto err_out;
- }
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "no memory resource found\n");
- ret = -ENXIO;
- goto err_out;
- }
-
- mem = ioremap_nocache(res->start, resource_size(res));
- if (mem == NULL) {
- dev_err(&pdev->dev, "ioremap failed\n");
- ret = -ENOMEM;
- goto err_out;
- }
-
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "no IRQ resource found\n");
- ret = -ENXIO;
- goto err_iounmap;
- }
-
- irq = res->start;
-
- hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
- if (hw == NULL) {
- dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
- ret = -ENOMEM;
- goto err_iounmap;
- }
-
- ah = hw->priv;
- ah->hw = hw;
- ah->dev = &pdev->dev;
- ah->iobase = mem;
- ah->irq = irq;
- ah->devid = bcfg->devid;
-
- if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
- /* Enable WMAC AHB arbitration */
- reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
- reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
- iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
-
- /* Enable global WMAC swapping */
- reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
- reg |= AR5K_AR2315_BYTESWAP_WMAC;
- iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
- } else {
- /* Enable WMAC DMA access (assuming 5312 or 231x*/
- /* TODO: check other platforms */
- reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
- if (to_platform_device(ah->dev)->id == 0)
- reg |= AR5K_AR5312_ENABLE_WLAN0;
- else
- reg |= AR5K_AR5312_ENABLE_WLAN1;
- iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
-
- /*
- * On a dual-band AR5312, the multiband radio is only
- * used as pass-through. Disable 2 GHz support in the
- * driver for it
- */
- if (to_platform_device(ah->dev)->id == 0 &&
- (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
- (BD_WLAN1 | BD_WLAN0))
- ah->ah_capabilities.cap_needs_2GHz_ovr = true;
- else
- ah->ah_capabilities.cap_needs_2GHz_ovr = false;
- }
-
- ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
- if (ret != 0) {
- dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
- ret = -ENODEV;
- goto err_free_hw;
- }
-
- platform_set_drvdata(pdev, hw);
-
- return 0;
-
- err_free_hw:
- ieee80211_free_hw(hw);
- platform_set_drvdata(pdev, NULL);
- err_iounmap:
- iounmap(mem);
- err_out:
- return ret;
-}
-
-static int ath_ahb_remove(struct platform_device *pdev)
-{
- struct ar231x_board_config *bcfg = pdev->dev.platform_data;
- struct ieee80211_hw *hw = platform_get_drvdata(pdev);
- struct ath5k_hw *ah;
- u32 reg;
-
- if (!hw)
- return 0;
-
- ah = hw->priv;
-
- if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
- /* Disable WMAC AHB arbitration */
- reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
- reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
- iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
- } else {
- /*Stop DMA access */
- reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
- if (to_platform_device(ah->dev)->id == 0)
- reg &= ~AR5K_AR5312_ENABLE_WLAN0;
- else
- reg &= ~AR5K_AR5312_ENABLE_WLAN1;
- iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
- }
-
- ath5k_deinit_ah(ah);
- iounmap(ah->iobase);
- platform_set_drvdata(pdev, NULL);
- ieee80211_free_hw(hw);
-
- return 0;
-}
-
-static struct platform_driver ath_ahb_driver = {
- .probe = ath_ahb_probe,
- .remove = ath_ahb_remove,
- .driver = {
- .name = "ar231x-wmac",
- .owner = THIS_MODULE,
- },
-};
-
-module_platform_driver(ath_ahb_driver);
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 2d691b8..deaedb8 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1645,32 +1645,6 @@ static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
return &(ath5k_hw_common(ah)->regulatory);
}
-#ifdef CONFIG_ATHEROS_AR231X
-#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000)
-
-static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
-{
- /* On AR2315 and AR2317 the PCI clock domain registers
- * are outside of the WMAC register space */
- if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
- (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
- return AR5K_AR2315_PCI_BASE + reg;
-
- return ah->iobase + reg;
-}
-
-static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
-{
- return ioread32(ath5k_ahb_reg(ah, reg));
-}
-
-static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
-{
- iowrite32(val, ath5k_ahb_reg(ah, reg));
-}
-
-#else
-
static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
{
return ioread32(ah->iobase + reg);
@@ -1681,8 +1655,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
iowrite32(val, ah->iobase + reg);
}
-#endif
-
static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
{
return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9b20d9e..654cc3d 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -97,15 +97,6 @@ static int ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
/* Known SREVs */
static const struct ath5k_srev_name srev_names[] = {
-#ifdef CONFIG_ATHEROS_AR231X
- { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 },
- { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 },
- { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 },
- { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 },
- { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 },
- { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 },
- { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 },
-#else
{ "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 },
{ "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 },
{ "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A },
@@ -124,7 +115,6 @@ static const struct ath5k_srev_name srev_names[] = {
{ "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 },
{ "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 },
{ "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 },
-#endif
{ "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN },
{ "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 },
{ "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 },
@@ -140,10 +130,6 @@ static const struct ath5k_srev_name srev_names[] = {
{ "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 },
{ "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 },
{ "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 },
-#ifdef CONFIG_ATHEROS_AR231X
- { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
- { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
-#endif
{ "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
};
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
index f77ef36..dbf2483 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -162,20 +162,14 @@ int ath5k_init_leds(struct ath5k_hw *ah)
{
int ret = 0;
struct ieee80211_hw *hw = ah->hw;
-#ifndef CONFIG_ATHEROS_AR231X
struct pci_dev *pdev = ah->pdev;
-#endif
char name[ATH5K_LED_MAX_NAME_LEN + 1];
const struct pci_device_id *match;
if (!ah->pdev)
return 0;
-#ifdef CONFIG_ATHEROS_AR231X
- match = NULL;
-#else
match = pci_match_id(&ath5k_led_devices[0], pdev);
-#endif
if (match) {
__set_bit(ATH_STAT_LEDSOFT, ah->status);
ah->led_pin = ATH_PIN(match->driver_data);
--
1.7.11.7
^ permalink raw reply related
* [PATCH 3.10] mac80211: fix AP-mode frame matching
From: Johannes Berg @ 2013-05-13 14:56 UTC (permalink / raw)
To: linux-wireless; +Cc: j, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
In AP mode, ignore frames with mis-matched BSSID that aren't
multicast or sent to the correct destination. This fixes
reporting public action frames to userspace multiple times
on multiple virtual AP interfaces.
Cc: stable@vger.kernel.org
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/rx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6e2c8c5..3194172 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3050,6 +3050,9 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
* and location updates. Note that mac80211
* itself never looks at these frames.
*/
+ if (!multicast &&
+ !ether_addr_equal(sdata->vif.addr, hdr->addr1))
+ return 0;
if (ieee80211_is_public_action(hdr, skb->len))
return 1;
if (!ieee80211_is_beacon(hdr->frame_control))
--
1.8.0
^ permalink raw reply related
* wireless-testing rebased on 3.10-rc1
From: John W. Linville @ 2013-05-13 14:27 UTC (permalink / raw)
To: linux-wireless
FYI...the wireless-testing tree has been rebased upon v3.10-rc1
as of this morning. I also pulled the pending fixes from
the wireless-tree on top of it, as well as the venerable old
localversion-wireless patch we all love. The head commit is
de71a9b7484a7fb6a91303370a20a55f3069eb96.
It may be a few days before I resume merging into wireless-next.
I will be traveling and I want to give Dave M. a chance to settle-out
his trees.
Thanks,
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: Linux summit this year ?
From: John W. Linville @ 2013-05-13 14:07 UTC (permalink / raw)
To: Matt Chen
Cc: Seth Forshee, Johannes Berg, Marcel Holtmann, Larry Finger,
joeyli, linux-wireless
In-Reply-To: <CALx5=V_4LOmZ=dkhtKmZ3FdgzEq6t4jSBogzoPn+KyFTBZ6Zvw@mail.gmail.com>
On Mon, May 13, 2013 at 02:01:16PM +0800, Matt Chen wrote:
> Hi all,
> Forget my stupid question. Where I can register in LinuxConn ?
http://events.linuxfoundation.org/events/linuxcon
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* RE: [PATCH] mac80211: Fix driver crash when STA_NOTIFY_AWAKE occures
From: voncken @ 2013-05-13 12:45 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes
In-Reply-To: <1366363242-29481-1-git-send-email-cedric.voncken@acksys.fr>
This default occurs when I set a mesh interface with HT mode and SAE user
daemon from cozibit.
I have put more information in thread "ath9k null pointer with mesh network"
in the linux-wireless mailing list.
Cedric Voncken
-----Message d'origine-----
De : linux-wireless-owner@vger.kernel.org
[mailto:linux-wireless-owner@vger.kernel.org] De la part de cedric voncken
Envoyé : vendredi 19 avril 2013 11:21
À : linux-wireless@vger.kernel.org
Cc : cedric voncken
Objet : [PATCH] mac80211: Fix driver crash when STA_NOTIFY_AWAKE occures
If the device uses the HT mode and receives a frame from a sta whith state <
IEEE80211_STA_ASSOC then the null pointer exception crashes the Linnux
kernel.
In the case of ath9k, the function ath_tx_node_init is indirectly called by
drv_sta_state (in net/mac80211/driver-ops.h) only when the sta_state goes to
IEEE80211_STA_ASSOC from IEEE80211_STA_AUTH.
Signed-off-by: cedric VONCKEN <cedric.voncken@acksys.fr>
---
net/mac80211/sta_info.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index
11216bc..bcfd7b0 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1040,7 +1040,8 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info
*sta)
BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
sta->driver_buffered_tids = 0;
- if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
+ if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS &&
+ sta->sta_state >= IEEE80211_STA_ASSOC))
drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
skb_queue_head_init(&pending);
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org More majordomo info at
http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [RFC 0/4] add master channel switch announcement support
From: Johannes Berg @ 2013-05-13 10:09 UTC (permalink / raw)
To: Simon Wunderlich; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1367867635-3459-1-git-send-email-siwu@hrz.tu-chemnitz.de>
On Mon, 2013-05-06 at 21:13 +0200, Simon Wunderlich wrote:
> This is an early RFC of a possible channel switch announcement infrastructure.
> It adds CSA/ECSA handling support for AP. This is required for DFS operation
> (e.g. Wi-Fi Alliance requires this for 802.11h certification). This will also
> be required for IBSS-DFS later.
>
> I'd like to discuss if this design approach is going in the right direction.
> What is currently working:
>
> * channels are announced by adding IEs (CSA and Extended CSA) in beacons
> * after some (configurable) time, the channel is switched
> * with the channel switch, CSA/ECSA IEs are removed and channel information
> is updated.
> * Userspace calls a new command NL80211_CMD_CHANNEL_SWITCH along with channel info
> (freq + width), whether traffic should be blocked and timing information
> * it currently works for me [TM] on my ath9k based machine
I don't really like your approach of building all the IEs in the kernel.
There are some things, like the country-after-switch in the CSA wrapper
(introduced in 11ac), that would be really awkward this way.
> * We already have NL80211_CMD_CH_SWITCH_NOTIFY which is only used for notification.
> Maybe we can rename that and re-use it instead of adding a new command
> NL80211_CMD_CHANNEL_SWITCH?
Sure, I don't really care though.
> * Changes from HT20/NOHT to HT20/NOHT are handled with normal Channel Switch
> Announcements, everything else (for 40 MHz) is done with Extended Channel Switch
> Announcements. As far as I read the spec, we can't use the secondary channel
> offset IE in beacons, but maybe I'm wrong here?
No, you're right and I was wrong :-)
> * could other drivers (next to ath9k) work with this API?
Probably not easily. Any TI folks reading this?
Anyway I think it'd be better to try to provide
(a) the "during-switch IEs", maybe with an offset to the counter so
mac80211,
driver or the device itself can count down
(b) the "after-switch beacon" IEs (and maybe probe response for
offload)
johannes
^ permalink raw reply
* Re: [PATCH v3 1/2] cfg80211: Userspace may inform kernel of mesh auth method.
From: Johannes Berg @ 2013-05-13 9:44 UTC (permalink / raw)
To: Colleen Twitty; +Cc: open80211s, linux-wirelss
In-Reply-To: <1368038760-17752-1-git-send-email-colleen@cozybit.com>
On Wed, 2013-05-08 at 11:45 -0700, Colleen Twitty wrote:
> Authentication takes place in userspace, but the beacon is
> generated in the kernel. Allow userspace to inform the
> kernel of the authentication method so the appropriate
> mesh config IE can be set prior to beacon generation when
> joining the MBSS.
Applied, thanks.
johannes
^ permalink raw reply
* Re: [PATCH 2/3] cfg80211: Allow ieee80211g mandatory rate sets in 2.4GHz band
From: Johannes Berg @ 2013-05-13 9:42 UTC (permalink / raw)
To: Ashok Nagarajan; +Cc: linux-wireless, linville, devel
In-Reply-To: <1368233453-10581-2-git-send-email-ashok@cozybit.com>
On Fri, 2013-05-10 at 17:50 -0700, Ashok Nagarajan wrote:
> This patch assumes 11g support
> implies a 11g operation and returns the appropriate mandatory rates.
Which is a problem, because it means that by default we'll create IBSS
networks that are not compatible with 11b devices.
johannes
^ permalink raw reply
* [PATCH] nl80211: Add wdev identifier to some nl80211 notifications
From: Johannes Berg @ 2013-05-13 9:01 UTC (permalink / raw)
To: linux-wireless; +Cc: Ilan Peer
From: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/wireless/nl80211.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9cdcd9e..0dcc4e5 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10008,6 +10008,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
netdev->ifindex)) ||
+ nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
(sig_dbm &&
nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
@@ -10048,6 +10049,7 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
netdev->ifindex)) ||
+ nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) ||
nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie) ||
(ack && nla_put_flag(msg, NL80211_ATTR_ACK)))
--
1.8.0
^ permalink raw reply related
* Re: [RFC 4/4] cfg80211/mac80211: use cfg80211 wdev mutex in mac80211
From: Johannes Berg @ 2013-05-13 7:09 UTC (permalink / raw)
To: Arend van Spriel; +Cc: linux-wireless, greearb
In-Reply-To: <518E6FA9.3060205@broadcom.com>
> > I don't think so.
>
> I am asking because I noticed the following documentation change:
>
> - * @mtx: mutex used to lock data in this struct
> + * @mtx: mutex used to lock data in this struct, may be used by drivers
> + * and some API functions require it held
>
> I did not look at the individual API functions, but I guess to be sure I
> should check whether we are using any of them.
Yes, but these API functions are all only used with userspace SME
(auth/assoc calls and similar.)
johannes
^ permalink raw reply
* Re: Using compat-drivers conflicts with kernel mac80211 and cfg80211
From: Luis R. Rodriguez @ 2013-05-13 4:55 UTC (permalink / raw)
To: Hauke Mehrtens, Julia Lawall, backports@vger.kernel.org,
Paul Stewart
Cc: Arend van Spriel, JoSH Lehan, linux-wireless
In-Reply-To: <518E0CD6.3040501@hauke-m.de>
On Sat, May 11, 2013 at 2:18 AM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> On 05/11/2013 09:35 AM, Arend van Spriel wrote:
>> On 05/11/2013 02:52 AM, JoSH Lehan wrote:
>>> It seems I can choose to use the mac80211/cfg80211 that came with the
>>> kernel,*or*, the mac80211/cfg80211 that come with compat-drivers. Is
>>> this correct? I'll have to maintain these two mac80211/cfg80211
>>> drivers in separate directories, since they have the same name, and it
>>> will complicate my detection/loading script, but if there's no other
>>> way, then this is what needs to be done.
>>
>> Luis may correct me, but I think you are correct. compat-drivers
>> provides a compat.ko which is the glue between new drivers and your
>> kernel. With the new drivers you get new features provided you have new
>> mac80211/cfg80211 as well. Hence the glue is between wireless modules
>> (including mac80211/cfg80211) and rest of your kernel. On a non-embedded
>> system the compat-driver modules are installed in a separate folder
>> /lib/modules/<your_kernel_version/updates. depmod is run during the
>> install in which this folder takes precedence.
>>
>> Not sure what your use-case is. You have a system in which different
>> wireless devices may be plugged in or ...?
>
> You can only use mac80211/cfg80211 from compat-driver *or* the kernel.
> There was a plan to rename all exported symbols and make it possible to
> use both at the same time, but no one fully implemented it.
I ended up renaming as many exported symbols as I could when and only
when we were not providing a full subsystem backport for where that
exported symbol lived. You can find these pegged with a
LINUX_BACKPORT() macro. If a subsystem is backported fully we don't do
the mapping name change. I still looked at an option to provide what
you describe though and simply rename all exported symbols with a the
LINUX_BACKPORT() prefix, ie, backport_ -- and the best lead I found
was work done by Andi Kleen a while ago on introducing module
namespaces but this work got rejected. We could try to port that
ourselves somehow for backports. For details see this commit which
talks about it:
https://git.kernel.org/cgit/linux/kernel/git/mcgrof/compat.git/commit/?id=8ae967309876a9297dedfdf64dfcca406639686f
Under the new backports tree though we now use Python for some code
mangling to help us with our backport, this will specially be useful
later when we start using SmPL for patch treatment where the hunks
don't line up anymore or simply always with SmPL. Anyway, apart from
that - we also use the python script to do some mangling of Kconfig
entries for us. Given that -- it should then also be possible for us
to then treat all EXPORT_SYMBOL_GPL() (note on backports all symbols
are EXPORT_SYMBOL_GPL() or at least that was the intent, we should fix
if anything has leaked) to add the LINUX_BACKPORT() prefix for us --
but note that it still does not address the head file changes. I
suppose you could first scrape for all exported symbols and then go
also address headers.
So these are the two options I see right now, Andi's work or Python
magic. Both are projects in themselves. Patches welcomed.
I should note the compat-drivers git tree will be renamed to backports
where it now has compat and compat-drivers merged and I'll soon make
it available on kernel.org, as soon as I get all delta merged that
gets us to backport a v3.10 release. I the meantime interested
developers should look at the instructions I provided another
developer here:
http://marc.info/?l=linux-backports&m=136838721415310&w=2
As for kernel integration of backports -- that is not possible today
but I welcome such changes. I provided a hint as to how this could be
possible to do here:
http://marc.info/?l=linux-backports&m=136823203813610&w=2
Patches welcomed.
Luis
^ permalink raw reply
* Re: Using compat-drivers conflicts with kernel mac80211 and cfg80211
From: JoSH Lehan @ 2013-05-13 3:56 UTC (permalink / raw)
To: Adrian Chadd; +Cc: Arend van Spriel, linux-wireless, Luis R. Rodriguez
In-Reply-To: <CAJ-VmonOuhBgXa3-LkspaCgAAh8Y9Jxejn-McVourzgE-ajHTw@mail.gmail.com>
On Sat, May 11, 2013 at 5:46 PM, Adrian Chadd <adrian@freebsd.org> wrote:
> No, you or the vendor should forward port it to linux-next, then you
> can just pick up the whole driver/framework set from compat-wireless.
For my needs, I can use the entire set of wireless drivers from
compat-drivers, plus the vt6656 and rtl8712 drivers.
If I were to undertake the task of porting the vt6656/rtl8712 vendor
tarballs to linux-next, so that I could integrate them into
compat-drivers and then build everything compatibly, I wonder if it
would be worth trying to improve what's in staging?
Ideally, I'd need to do some big three-way merge: the current contents
of staging, the original code drop that went into staging, and the
current versions of vendor tarballs. Would such a thing be practical?
It would be quite a project, and I would be hoping the results of it
would be accepted into staging. It might help others, as well. Since
compat-drivers only pulls from the regular kernel driver directory and
not from staging, it wouldn't help get them into compat-drivers,
though.
Josh Lehan
^ permalink raw reply
* Re: Using compat-drivers conflicts with kernel mac80211 and cfg80211
From: JoSH Lehan @ 2013-05-13 3:29 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Adrian Chadd, linux-wireless, Luis R. Rodriguez
In-Reply-To: <518F701B.2080900@broadcom.com>
On Sun, May 12, 2013 at 3:34 AM, Arend van Spriel <arend@broadcom.com> wrote:
> On 05/12/2013 02:46 AM, Adrian Chadd wrote:
>> No, you or the vendor should forward port it to linux-next, then you
>> can just pick up the whole driver/framework set from compat-wireless.
>
> That is indeed the approach. So integrate your vendor provided driver into
> your local linux-next tree and create you own compat-drivers package using
> that tree (see [1]). You have to tinker the framework to include that
> driver.
Thanks to both of you for the advice, on what best to do long-term.
Better yet, I should look into the feasibility of upgrading my
embedded system's kernel to something more recent (so that I wouldn't
need to use compat-drivers at all then).
Josh Lehan
^ permalink raw reply
* [PATCH V3.10] rtlwifi: rtl8188ee: Fix warning when building on big-endian systems
From: Larry Finger @ 2013-05-13 2:43 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Larry Finger, netdev
In http://lkml.indiana.edu/hypermail/linux/kernel/1305.1/index.html,
Geert Uytterhoeven reports a new warning when building 3.10-rc1 in
this driver. This is caused by using a "#if" test to see if __LITTLE_ENDIAN
is set, which fails for all big-endian systems. Change to "ifdef".
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
John,
As noted above, please add to 3.10.
Larry
---
drivers/net/wireless/rtlwifi/rtl8188ee/trx.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
index d3a02e7..21ca33a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
@@ -550,7 +550,7 @@ do { \
rxmcs == DESC92C_RATE11M)
struct phy_rx_agc_info_t {
- #if __LITTLE_ENDIAN
+ #ifdef __LITTLE_ENDIAN
u8 gain:7, trsw:1;
#else
u8 trsw:1, gain:7;
@@ -574,7 +574,7 @@ struct phy_status_rpt {
u8 stream_target_csi[2];
u8 sig_evm;
u8 rsvd_3;
-#if __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/
u8 sgi_en:1;
u8 rxsc:2;
--
1.8.1.4
^ permalink raw reply related
* Re: [PATCH] NFC: remove commented out Makefile line
From: Samuel Ortiz @ 2013-05-12 21:39 UTC (permalink / raw)
To: Paul Bolle
Cc: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz,
David S. Miller, linux-wireless, linux-nfc, netdev, linux-kernel
In-Reply-To: <1368393684.1350.16.camel@x61.thuisdomein>
Hi Paul,
On Sun, 2013-05-12 at 23:21 +0200, Paul Bolle wrote:
> The Kconfig symbol NFC_LLCP was removed in commit 30cc458765 ("NFC: Move
> LLCP code to the NFC top level diirectory"). But the reference to its
> macro in this Makefile was only commented out. Remove it now.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> ---
> Untested.
>
> net/nfc/Makefile | 1 -
> 1 file changed, 1 deletion(-)
Applied to my nfc-fixes tree, thanks.
Cheers,
Samuel.
^ permalink raw reply
* [PATCH] NFC: remove commented out Makefile line
From: Paul Bolle @ 2013-05-12 21:21 UTC (permalink / raw)
To: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz,
David S. Miller
Cc: linux-wireless, linux-nfc, netdev, linux-kernel
The Kconfig symbol NFC_LLCP was removed in commit 30cc458765 ("NFC: Move
LLCP code to the NFC top level diirectory"). But the reference to its
macro in this Makefile was only commented out. Remove it now.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
Untested.
net/nfc/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/nfc/Makefile b/net/nfc/Makefile
index fb799de..a76f453 100644
--- a/net/nfc/Makefile
+++ b/net/nfc/Makefile
@@ -5,7 +5,6 @@
obj-$(CONFIG_NFC) += nfc.o
obj-$(CONFIG_NFC_NCI) += nci/
obj-$(CONFIG_NFC_HCI) += hci/
-#obj-$(CONFIG_NFC_LLCP) += llcp/
nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \
llcp_sock.o
--
1.7.11.7
^ permalink raw reply related
* [PATCH 7/7] wil6210: do not stop Tx queue on packet drop
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
Packet drop may be caused by various flows, like disconnect
while Tx packets was queued; this should not lead to stopping
of the Tx queue, or all Tx get stalled.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/txrx.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 5a0657c..8b8405d 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -793,7 +793,6 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
break; /* goto drop; */
}
drop:
- netif_tx_stop_all_queues(ndev);
ndev->stats.tx_dropped++;
dev_kfree_skb_any(skb);
--
1.8.1.2
^ permalink raw reply related
* [PATCH 6/7] wil6210: fix remaining use of non-cached copy of tx/rx descriptors
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
- Introduce common code for Tx/Rx descriptor physical address set/parse
- Fix endianness for address fields
- consistent descriptor naming: '_d' for non-cached memory, 'd' for cached copy
- wil_tx_desc_map now modify cached copy, no need for 'volatile'
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/txrx.c | 106 ++++++++++++++++++--------------
drivers/net/wireless/ath/wil6210/txrx.h | 28 +++++++--
2 files changed, 84 insertions(+), 50 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 109f9bd..5a0657c 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -92,8 +92,8 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
* we can use any
*/
for (i = 0; i < vring->size; i++) {
- volatile struct vring_tx_desc *d = &(vring->va[i].tx);
- d->dma.status = TX_DMA_STATUS_DU;
+ volatile struct vring_tx_desc *_d = &(vring->va[i].tx);
+ _d->dma.status = TX_DMA_STATUS_DU;
}
wil_dbg_misc(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size,
@@ -109,14 +109,19 @@ static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
size_t sz = vring->size * sizeof(vring->va[0]);
while (!wil_vring_is_empty(vring)) {
+ dma_addr_t pa;
+ struct sk_buff *skb;
u16 dmalen;
+
if (tx) {
- volatile struct vring_tx_desc *d =
+ struct vring_tx_desc dd, *d = ⅆ
+ volatile struct vring_tx_desc *_d =
&vring->va[vring->swtail].tx;
- dma_addr_t pa = d->dma.addr_low |
- ((u64)d->dma.addr_high << 32);
- struct sk_buff *skb = vring->ctx[vring->swtail];
+
+ *d = *_d;
+ pa = wil_desc_addr(&d->dma.addr);
dmalen = le16_to_cpu(d->dma.length);
+ skb = vring->ctx[vring->swtail];
if (skb) {
dma_unmap_single(dev, pa, dmalen,
DMA_TO_DEVICE);
@@ -128,12 +133,14 @@ static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
}
vring->swtail = wil_vring_next_tail(vring);
} else { /* rx */
- volatile struct vring_rx_desc *d =
+ struct vring_rx_desc dd, *d = ⅆ
+ volatile struct vring_rx_desc *_d =
&vring->va[vring->swtail].rx;
- dma_addr_t pa = d->dma.addr_low |
- ((u64)d->dma.addr_high << 32);
- struct sk_buff *skb = vring->ctx[vring->swhead];
+
+ *d = *_d;
+ pa = wil_desc_addr(&d->dma.addr);
dmalen = le16_to_cpu(d->dma.length);
+ skb = vring->ctx[vring->swhead];
dma_unmap_single(dev, pa, dmalen, DMA_FROM_DEVICE);
kfree_skb(skb);
wil_vring_advance_head(vring, 1);
@@ -156,7 +163,8 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
{
struct device *dev = wil_to_dev(wil);
unsigned int sz = RX_BUF_LEN;
- volatile struct vring_rx_desc *d = &(vring->va[i].rx);
+ struct vring_rx_desc dd, *d = ⅆ
+ volatile struct vring_rx_desc *_d = &(vring->va[i].rx);
dma_addr_t pa;
/* TODO align */
@@ -174,13 +182,13 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
}
d->dma.d0 = BIT(9) | RX_DMA_D0_CMD_DMA_IT;
- d->dma.addr_low = lower_32_bits(pa);
- d->dma.addr_high = (u16)upper_32_bits(pa);
+ wil_desc_addr_set(&d->dma.addr, pa);
/* ip_length don't care */
/* b11 don't care */
/* error don't care */
d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
d->dma.length = cpu_to_le16(sz);
+ *_d = *d;
vring->ctx[i] = skb;
return 0;
@@ -326,8 +334,8 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
{
struct device *dev = wil_to_dev(wil);
struct net_device *ndev = wil_to_ndev(wil);
- volatile struct vring_rx_desc *d;
- struct vring_rx_desc *d1;
+ volatile struct vring_rx_desc *_d;
+ struct vring_rx_desc *d;
struct sk_buff *skb;
dma_addr_t pa;
unsigned int sz = RX_BUF_LEN;
@@ -340,20 +348,27 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
if (wil_vring_is_empty(vring))
return NULL;
- d = &(vring->va[vring->swhead].rx);
- if (!(d->dma.status & RX_DMA_STATUS_DU)) {
+ _d = &(vring->va[vring->swhead].rx);
+ if (!(_d->dma.status & RX_DMA_STATUS_DU)) {
/* it is not error, we just reached end of Rx done area */
return NULL;
}
- pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
skb = vring->ctx[vring->swhead];
+ d = wil_skb_rxdesc(skb);
+ *d = *_d;
+ pa = wil_desc_addr(&d->dma.addr);
+ vring->ctx[vring->swhead] = NULL;
+ wil_vring_advance_head(vring, 1);
+
dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE);
+ dmalen = le16_to_cpu(d->dma.length);
+
+ trace_wil6210_rx(vring->swhead, d);
+ wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, dmalen);
+ wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
+ (const void *)d, sizeof(*d), false);
- d1 = wil_skb_rxdesc(skb);
- *d1 = *d;
- wil_vring_advance_head(vring, 1);
- dmalen = le16_to_cpu(d1->dma.length);
if (dmalen > sz) {
wil_err(wil, "Rx size too large: %d bytes!\n", dmalen);
kfree(skb);
@@ -365,18 +380,12 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
skb->data, skb_headlen(skb), false);
- wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1);
+ wil->stats.last_mcs_rx = wil_rxdesc_mcs(d);
/* use radiotap header only if required */
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)
wil_rx_add_radiotap_header(wil, skb);
- trace_wil6210_rx(vring->swhead, d1);
- wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead,
- d1->dma.length);
- wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
- (const void *)d1, sizeof(*d1), false);
-
/* no extra checks if in sniffer mode */
if (ndev->type != ARPHRD_ETHER)
return skb;
@@ -385,7 +394,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
* Driver should recognize it by frame type, that is found
* in Rx descriptor. If type is not data, it is 802.11 frame as is
*/
- ftype = wil_rxdesc_ftype(d1) << 2;
+ ftype = wil_rxdesc_ftype(d) << 2;
if (ftype != IEEE80211_FTYPE_DATA) {
wil_dbg_txrx(wil, "Non-data frame ftype 0x%08x\n", ftype);
/* TODO: process it */
@@ -400,7 +409,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
return NULL;
}
- ds_bits = wil_rxdesc_ds_bits(d1);
+ ds_bits = wil_rxdesc_ds_bits(d);
if (ds_bits == 1) {
/*
* HW bug - in ToDS mode, i.e. Rx on AP side,
@@ -614,11 +623,9 @@ static struct vring *wil_find_tx_vring(struct wil6210_priv *wil,
return NULL;
}
-static int wil_tx_desc_map(volatile struct vring_tx_desc *d,
- dma_addr_t pa, u32 len)
+static int wil_tx_desc_map(struct vring_tx_desc *d, dma_addr_t pa, u32 len)
{
- d->dma.addr_low = lower_32_bits(pa);
- d->dma.addr_high = (u16)upper_32_bits(pa);
+ wil_desc_addr_set(&d->dma.addr, pa);
d->dma.ip_length = 0;
/* 0..6: mac_length; 7:ip_version 0-IP6 1-IP4*/
d->dma.b11 = 0/*14 | BIT(7)*/;
@@ -644,7 +651,8 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
struct sk_buff *skb)
{
struct device *dev = wil_to_dev(wil);
- volatile struct vring_tx_desc *d;
+ struct vring_tx_desc dd, *d = ⅆ
+ volatile struct vring_tx_desc *_d;
u32 swhead = vring->swhead;
int avail = wil_vring_avail_tx(vring);
int nr_frags = skb_shinfo(skb)->nr_frags;
@@ -662,7 +670,7 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
1 + nr_frags);
return -ENOMEM;
}
- d = &(vring->va[i].tx);
+ _d = &(vring->va[i].tx);
/* FIXME FW can accept only unicast frames for the peer */
memcpy(skb->data, wil->dst_addr[vring_index], ETH_ALEN);
@@ -681,25 +689,30 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
wil_tx_desc_map(d, pa, skb_headlen(skb));
d->mac.d[2] |= ((nr_frags + 1) <<
MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS);
+ if (nr_frags)
+ *_d = *d;
+
/* middle segments */
for (f = 0; f < nr_frags; f++) {
const struct skb_frag_struct *frag =
&skb_shinfo(skb)->frags[f];
int len = skb_frag_size(frag);
i = (swhead + f + 1) % vring->size;
- d = &(vring->va[i].tx);
+ _d = &(vring->va[i].tx);
pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, pa)))
goto dma_error;
wil_tx_desc_map(d, pa, len);
vring->ctx[i] = NULL;
+ *_d = *d;
}
/* for the last seg only */
d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_EOP_POS);
d->dma.d0 |= BIT(9); /* BUG: undocumented bit */
d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS);
d->dma.d0 |= (vring_index << DMA_CFG_DESC_TX_0_QID_POS);
+ *_d = *d;
wil_hex_dump_txrx("Tx ", DUMP_PREFIX_NONE, 32, 4,
(const void *)d, sizeof(*d), false);
@@ -723,9 +736,10 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
u16 dmalen;
i = (swhead + f) % vring->size;
- d = &(vring->va[i].tx);
- d->dma.status = TX_DMA_STATUS_DU;
- pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
+ _d = &(vring->va[i].tx);
+ *d = *_d;
+ _d->dma.status = TX_DMA_STATUS_DU;
+ pa = wil_desc_addr(&d->dma.addr);
dmalen = le16_to_cpu(d->dma.length);
if (vring->ctx[i])
dma_unmap_single(dev, pa, dmalen, DMA_TO_DEVICE);
@@ -808,14 +822,14 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid);
while (!wil_vring_is_empty(vring)) {
- volatile struct vring_tx_desc *d1 =
+ volatile struct vring_tx_desc *_d =
&vring->va[vring->swtail].tx;
struct vring_tx_desc dd, *d = ⅆ
dma_addr_t pa;
struct sk_buff *skb;
u16 dmalen;
- dd = *d1;
+ *d = *_d;
if (!(d->dma.status & TX_DMA_STATUS_DU))
break;
@@ -830,7 +844,7 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
wil_hex_dump_txrx("TxC ", DUMP_PREFIX_NONE, 32, 4,
(const void *)d, sizeof(*d), false);
- pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
+ pa = wil_desc_addr(&d->dma.addr);
skb = vring->ctx[vring->swtail];
if (skb) {
if (d->dma.error == 0) {
@@ -846,8 +860,8 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
} else {
dma_unmap_page(dev, pa, dmalen, DMA_TO_DEVICE);
}
- d->dma.addr_low = 0;
- d->dma.addr_high = 0;
+ d->dma.addr.addr_low = 0;
+ d->dma.addr.addr_high = 0;
d->dma.length = 0;
d->dma.status = TX_DMA_STATUS_DU;
vring->swtail = wil_vring_next_tail(vring);
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h
index a40aa0b..23c0781 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.h
+++ b/drivers/net/wireless/ath/wil6210/txrx.h
@@ -27,6 +27,28 @@
#define WIL6210_RTAP_SIZE (128)
/* Tx/Rx path */
+
+/*
+ * Common representation of physical address in Vring
+ */
+struct vring_dma_addr {
+ __le32 addr_low;
+ __le16 addr_high;
+} __packed;
+
+static inline dma_addr_t wil_desc_addr(struct vring_dma_addr *addr)
+{
+ return le32_to_cpu(addr->addr_low) |
+ ((u64)le16_to_cpu(addr->addr_high) << 32);
+}
+
+static inline void wil_desc_addr_set(struct vring_dma_addr *addr,
+ dma_addr_t pa)
+{
+ addr->addr_low = cpu_to_le32(lower_32_bits(pa));
+ addr->addr_high = cpu_to_le16((u16)upper_32_bits(pa));
+}
+
/*
* Tx descriptor - MAC part
* [dword 0]
@@ -216,8 +238,7 @@ struct vring_tx_mac {
struct vring_tx_dma {
u32 d0;
- u32 addr_low;
- u16 addr_high;
+ struct vring_dma_addr addr;
u8 ip_length;
u8 b11; /* 0..6: mac_length; 7:ip_version */
u8 error; /* 0..2: err; 3..7: reserved; */
@@ -315,8 +336,7 @@ struct vring_rx_mac {
struct vring_rx_dma {
u32 d0;
- u32 addr_low;
- u16 addr_high;
+ struct vring_dma_addr addr;
u8 ip_length;
u8 b11;
u8 error;
--
1.8.1.2
^ permalink raw reply related
* [PATCH 5/7] wil6210: use NAPI
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
Introduce NAPI for Rx and Tx completion.
This fixes packet reordering that happens when Rx handled right in
the IRQ: netif_rx puts packet in 'percpu' queue, then network stack
fetches packets from 'percpu' queues for processing, with different
pattern of queue switching. As result, network stack see packets
in different order. This causes hard to understand TCP throughput
degradation in about 30min
Complete polling if only one packet was processed - this eliminates
empty polls that would be otherwise done at the end of each burst
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/interrupt.c | 23 +++++-------
drivers/net/wireless/ath/wil6210/main.c | 6 ++++
drivers/net/wireless/ath/wil6210/netdev.c | 54 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/wil6210/txrx.c | 23 +++++++-----
drivers/net/wireless/ath/wil6210/wil6210.h | 16 ++++++---
5 files changed, 94 insertions(+), 28 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index 5fe985c..8205d3e 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -104,14 +104,14 @@ static void wil6210_mask_irq_pseudo(struct wil6210_priv *wil)
clear_bit(wil_status_irqen, &wil->status);
}
-static void wil6210_unmask_irq_tx(struct wil6210_priv *wil)
+void wil6210_unmask_irq_tx(struct wil6210_priv *wil)
{
iowrite32(WIL6210_IMC_TX, wil->csr +
HOSTADDR(RGF_DMA_EP_TX_ICR) +
offsetof(struct RGF_ICR, IMC));
}
-static void wil6210_unmask_irq_rx(struct wil6210_priv *wil)
+void wil6210_unmask_irq_rx(struct wil6210_priv *wil)
{
iowrite32(WIL6210_IMC_RX, wil->csr +
HOSTADDR(RGF_DMA_EP_RX_ICR) +
@@ -182,13 +182,14 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
if (isr & BIT_DMA_EP_RX_ICR_RX_DONE) {
wil_dbg_irq(wil, "RX done\n");
isr &= ~BIT_DMA_EP_RX_ICR_RX_DONE;
- wil_rx_handle(wil);
+ wil_dbg_txrx(wil, "NAPI schedule\n");
+ napi_schedule(&wil->napi_rx);
}
if (isr)
wil_err(wil, "un-handled RX ISR bits 0x%08x\n", isr);
- wil6210_unmask_irq_rx(wil);
+ /* Rx IRQ will be enabled when NAPI processing finished */
return IRQ_HANDLED;
}
@@ -211,23 +212,17 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
wil6210_mask_irq_tx(wil);
if (isr & BIT_DMA_EP_TX_ICR_TX_DONE) {
- uint i;
wil_dbg_irq(wil, "TX done\n");
+ napi_schedule(&wil->napi_tx);
isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE;
- for (i = 0; i < 24; i++) {
- u32 mask = BIT_DMA_EP_TX_ICR_TX_DONE_N(i);
- if (isr & mask) {
- isr &= ~mask;
- wil_dbg_irq(wil, "TX done(%i)\n", i);
- wil_tx_complete(wil, i);
- }
- }
+ /* clear also all VRING interrupts */
+ isr &= ~(BIT(25) - 1UL);
}
if (isr)
wil_err(wil, "un-handled TX ISR bits 0x%08x\n", isr);
- wil6210_unmask_irq_tx(wil);
+ /* Tx IRQ will be enabled when NAPI processing finished */
return IRQ_HANDLED;
}
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index a0478e2..ea49c8a 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -365,6 +365,9 @@ static int __wil_up(struct wil6210_priv *wil)
/* Rx VRING. After MAC and beacon */
wil_rx_init(wil);
+ napi_enable(&wil->napi_rx);
+ napi_enable(&wil->napi_tx);
+
return 0;
}
@@ -381,6 +384,9 @@ int wil_up(struct wil6210_priv *wil)
static int __wil_down(struct wil6210_priv *wil)
{
+ napi_disable(&wil->napi_rx);
+ napi_disable(&wil->napi_tx);
+
if (wil->scan_request) {
cfg80211_scan_done(wil->scan_request, true);
wil->scan_request = NULL;
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
index 098a8ec..29dd1e5 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -40,6 +40,55 @@ static const struct net_device_ops wil_netdev_ops = {
.ndo_validate_addr = eth_validate_addr,
};
+static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget)
+{
+ struct wil6210_priv *wil = container_of(napi, struct wil6210_priv,
+ napi_rx);
+ int quota = budget;
+ int done;
+
+ wil_rx_handle(wil, "a);
+ done = budget - quota;
+
+ if (done <= 1) { /* burst ends - only one packet processed */
+ napi_complete(napi);
+ wil6210_unmask_irq_rx(wil);
+ wil_dbg_txrx(wil, "NAPI RX complete\n");
+ }
+
+ wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done);
+
+ return done;
+}
+
+static int wil6210_netdev_poll_tx(struct napi_struct *napi, int budget)
+{
+ struct wil6210_priv *wil = container_of(napi, struct wil6210_priv,
+ napi_tx);
+ int tx_done = 0;
+ uint i;
+
+ /* always process ALL Tx complete, regardless budget - it is fast */
+ for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) {
+ struct vring *vring = &wil->vring_tx[i];
+
+ if (!vring->va)
+ continue;
+
+ tx_done += wil_tx_complete(wil, i);
+ }
+
+ if (tx_done <= 1) { /* burst ends - only one packet processed */
+ napi_complete(napi);
+ wil6210_unmask_irq_tx(wil);
+ wil_dbg_txrx(wil, "NAPI TX complete\n");
+ }
+
+ wil_dbg_txrx(wil, "NAPI TX poll(%d) done %d\n", budget, tx_done);
+
+ return min(tx_done, budget);
+}
+
void *wil_if_alloc(struct device *dev, void __iomem *csr)
{
struct net_device *ndev;
@@ -81,6 +130,11 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr)
SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
wdev->netdev = ndev;
+ netif_napi_add(ndev, &wil->napi_rx, wil6210_netdev_poll_rx,
+ WIL6210_NAPI_BUDGET);
+ netif_napi_add(ndev, &wil->napi_tx, wil6210_netdev_poll_tx,
+ WIL6210_NAPI_BUDGET);
+
wil_link_off(wil);
return wil;
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index dfd9848..109f9bd 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -442,6 +442,7 @@ static int wil_rx_refill(struct wil6210_priv *wil, int count)
/*
* Pass Rx packet to the netif. Update statistics.
+ * Called in softirq context (NAPI poll).
*/
static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
{
@@ -450,10 +451,7 @@ static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
skb_orphan(skb);
- if (in_interrupt())
- rc = netif_rx(skb);
- else
- rc = netif_rx_ni(skb);
+ rc = netif_receive_skb(skb);
if (likely(rc == NET_RX_SUCCESS)) {
ndev->stats.rx_packets++;
@@ -467,9 +465,9 @@ static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
/**
* Proceed all completed skb's from Rx VRING
*
- * Safe to call from IRQ
+ * Safe to call from NAPI poll, i.e. softirq with interrupts enabled
*/
-void wil_rx_handle(struct wil6210_priv *wil)
+void wil_rx_handle(struct wil6210_priv *wil, int *quota)
{
struct net_device *ndev = wil_to_ndev(wil);
struct vring *v = &wil->vring_rx;
@@ -480,7 +478,8 @@ void wil_rx_handle(struct wil6210_priv *wil)
return;
}
wil_dbg_txrx(wil, "%s()\n", __func__);
- while (NULL != (skb = wil_vring_reap_rx(wil, v))) {
+ while ((*quota > 0) && (NULL != (skb = wil_vring_reap_rx(wil, v)))) {
+ (*quota)--;
if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
skb->dev = ndev;
@@ -790,17 +789,20 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
/**
* Clean up transmitted skb's from the Tx VRING
*
+ * Return number of descriptors cleared
+ *
* Safe to call from IRQ
*/
-void wil_tx_complete(struct wil6210_priv *wil, int ringid)
+int wil_tx_complete(struct wil6210_priv *wil, int ringid)
{
struct net_device *ndev = wil_to_ndev(wil);
struct device *dev = wil_to_dev(wil);
struct vring *vring = &wil->vring_tx[ringid];
+ int done = 0;
if (!vring->va) {
wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid);
- return;
+ return 0;
}
wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid);
@@ -849,7 +851,10 @@ void wil_tx_complete(struct wil6210_priv *wil, int ringid)
d->dma.length = 0;
d->dma.status = TX_DMA_STATUS_DU;
vring->swtail = wil_vring_next_tail(vring);
+ done++;
}
if (wil_vring_avail_tx(vring) > vring->size/4)
netif_tx_wake_all_queues(wil_to_ndev(wil));
+
+ return done;
}
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 484446e..2e3c26e 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -34,9 +34,11 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
#define WIL6210_MEM_SIZE (2*1024*1024UL)
-#define WIL6210_RX_RING_SIZE (128)
-#define WIL6210_TX_RING_SIZE (128)
-#define WIL6210_MAX_TX_RINGS (24)
+#define WIL6210_RX_RING_SIZE (128)
+#define WIL6210_TX_RING_SIZE (128)
+#define WIL6210_MAX_TX_RINGS (24) /* HW limit */
+#define WIL6210_MAX_CID (8) /* HW limit */
+#define WIL6210_NAPI_BUDGET (16) /* arbitrary */
/* Hardware definitions begin */
@@ -239,6 +241,8 @@ struct wil6210_priv {
* - consumed in thread by wmi_event_worker
*/
spinlock_t wmi_ev_lock;
+ struct napi_struct napi_rx;
+ struct napi_struct napi_tx;
/* DMA related */
struct vring vring_rx;
struct vring vring_tx[WIL6210_MAX_TX_RINGS];
@@ -360,10 +364,12 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
void wil_vring_fini_tx(struct wil6210_priv *wil, int id);
netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev);
-void wil_tx_complete(struct wil6210_priv *wil, int ringid);
+int wil_tx_complete(struct wil6210_priv *wil, int ringid);
+void wil6210_unmask_irq_tx(struct wil6210_priv *wil);
/* RX API */
-void wil_rx_handle(struct wil6210_priv *wil);
+void wil_rx_handle(struct wil6210_priv *wil, int *quota);
+void wil6210_unmask_irq_rx(struct wil6210_priv *wil);
int wil_iftype_nl2wmi(enum nl80211_iftype type);
--
1.8.1.2
^ permalink raw reply related
* [PATCH 4/7] wil6210: trace support
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
Trace the following:
- WMI cmd/event
- log events
- interrupts
- Tx/Rx
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/Kconfig | 12 ++
drivers/net/wireless/ath/wil6210/Makefile | 21 ++-
drivers/net/wireless/ath/wil6210/debug.c | 70 ++++++++
drivers/net/wireless/ath/wil6210/interrupt.c | 6 +
drivers/net/wireless/ath/wil6210/trace.c | 20 +++
drivers/net/wireless/ath/wil6210/trace.h | 235 +++++++++++++++++++++++++++
drivers/net/wireless/ath/wil6210/txrx.c | 10 +-
drivers/net/wireless/ath/wil6210/wil6210.h | 10 +-
drivers/net/wireless/ath/wil6210/wmi.c | 8 +-
9 files changed, 377 insertions(+), 15 deletions(-)
create mode 100644 drivers/net/wireless/ath/wil6210/debug.c
create mode 100644 drivers/net/wireless/ath/wil6210/trace.c
create mode 100644 drivers/net/wireless/ath/wil6210/trace.h
diff --git a/drivers/net/wireless/ath/wil6210/Kconfig b/drivers/net/wireless/ath/wil6210/Kconfig
index bac3d98..5644ac5 100644
--- a/drivers/net/wireless/ath/wil6210/Kconfig
+++ b/drivers/net/wireless/ath/wil6210/Kconfig
@@ -27,3 +27,15 @@ config WIL6210_ISR_COR
self-clear when accessed for debug purposes, it makes
such monitoring impossible.
Say y unless you debug interrupts
+
+config ATH6KL_TRACING
+ bool "wil6210 tracing support"
+ depends on WIL6210
+ depends on EVENT_TRACING
+ default y
+ ---help---
+ Say Y here to enable tracepoints for the wil6210 driver
+ using the kernel tracing infrastructure. Select this
+ option if you are interested in debugging the driver.
+
+ If unsure, say Y to make it easier to debug problems.
diff --git a/drivers/net/wireless/ath/wil6210/Makefile b/drivers/net/wireless/ath/wil6210/Makefile
index d288eea..f891d51 100644
--- a/drivers/net/wireless/ath/wil6210/Makefile
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -1,15 +1,20 @@
obj-$(CONFIG_WIL6210) += wil6210.o
-wil6210-objs := main.o
-wil6210-objs += netdev.o
-wil6210-objs += cfg80211.o
-wil6210-objs += pcie_bus.o
-wil6210-objs += debugfs.o
-wil6210-objs += wmi.o
-wil6210-objs += interrupt.o
-wil6210-objs += txrx.o
+wil6210-y := main.o
+wil6210-y += netdev.o
+wil6210-y += cfg80211.o
+wil6210-y += pcie_bus.o
+wil6210-y += debugfs.o
+wil6210-y += wmi.o
+wil6210-y += interrupt.o
+wil6210-y += txrx.o
+wil6210-y += debug.o
+wil6210-$(CONFIG_WIL6210_TRACING) += trace.o
ifeq (, $(findstring -W,$(EXTRA_CFLAGS)))
subdir-ccflags-y += -Werror
endif
+# for tracing framework to find trace.h
+CFLAGS_trace.o := -I$(src)
+
subdir-ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/ath/wil6210/debug.c b/drivers/net/wireless/ath/wil6210/debug.c
new file mode 100644
index 0000000..5f20b4a
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/debug.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "wil6210.h"
+#include "trace.h"
+
+int wil_err(struct wil6210_priv *wil, const char *fmt, ...)
+{
+ struct net_device *ndev = wil_to_ndev(wil);
+ struct va_format vaf = {
+ .fmt = fmt,
+ };
+ va_list args;
+ int ret;
+
+ va_start(args, fmt);
+ vaf.va = &args;
+ ret = netdev_err(ndev, "%pV", &vaf);
+ trace_wil6210_log_err(&vaf);
+ va_end(args);
+
+ return ret;
+}
+
+int wil_info(struct wil6210_priv *wil, const char *fmt, ...)
+{
+ struct net_device *ndev = wil_to_ndev(wil);
+ struct va_format vaf = {
+ .fmt = fmt,
+ };
+ va_list args;
+ int ret;
+
+ va_start(args, fmt);
+ vaf.va = &args;
+ ret = netdev_info(ndev, "%pV", &vaf);
+ trace_wil6210_log_info(&vaf);
+ va_end(args);
+
+ return ret;
+}
+
+int wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...)
+{
+ struct va_format vaf = {
+ .fmt = fmt,
+ };
+ va_list args;
+
+ va_start(args, fmt);
+ vaf.va = &args;
+ trace_wil6210_log_dbg(&vaf);
+ va_end(args);
+
+ return 0;
+}
+
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index e3c1e76..5fe985c 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -17,6 +17,7 @@
#include <linux/interrupt.h>
#include "wil6210.h"
+#include "trace.h"
/**
* Theory of operation:
@@ -168,6 +169,7 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
HOSTADDR(RGF_DMA_EP_RX_ICR) +
offsetof(struct RGF_ICR, ICR));
+ trace_wil6210_irq_rx(isr);
wil_dbg_irq(wil, "ISR RX 0x%08x\n", isr);
if (!isr) {
@@ -198,6 +200,7 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
HOSTADDR(RGF_DMA_EP_TX_ICR) +
offsetof(struct RGF_ICR, ICR));
+ trace_wil6210_irq_tx(isr);
wil_dbg_irq(wil, "ISR TX 0x%08x\n", isr);
if (!isr) {
@@ -256,6 +259,7 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
HOSTADDR(RGF_DMA_EP_MISC_ICR) +
offsetof(struct RGF_ICR, ICR));
+ trace_wil6210_irq_misc(isr);
wil_dbg_irq(wil, "ISR MISC 0x%08x\n", isr);
if (!isr) {
@@ -301,6 +305,7 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
struct wil6210_priv *wil = cookie;
u32 isr = wil->isr_misc;
+ trace_wil6210_irq_misc_thread(isr);
wil_dbg_irq(wil, "Thread ISR MISC 0x%08x\n", isr);
if (isr & ISR_MISC_FW_ERROR) {
@@ -408,6 +413,7 @@ static irqreturn_t wil6210_hardirq(int irq, void *cookie)
if (wil6210_debug_irq_mask(wil, pseudo_cause))
return IRQ_NONE;
+ trace_wil6210_irq_pseudo(pseudo_cause);
wil_dbg_irq(wil, "Pseudo IRQ 0x%08x\n", pseudo_cause);
wil6210_mask_irq_pseudo(wil);
diff --git a/drivers/net/wireless/ath/wil6210/trace.c b/drivers/net/wireless/ath/wil6210/trace.c
new file mode 100644
index 0000000..cd2534b
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/trace.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/module.h>
+
+#define CREATE_TRACE_POINTS
+#include "trace.h"
diff --git a/drivers/net/wireless/ath/wil6210/trace.h b/drivers/net/wireless/ath/wil6210/trace.h
new file mode 100644
index 0000000..eff1239
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/trace.h
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM wil6210
+#if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define WIL6210_TRACE_H
+
+#include <linux/tracepoint.h>
+#include "wil6210.h"
+#include "txrx.h"
+
+/* create empty functions when tracing is disabled */
+#if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
+
+#undef TRACE_EVENT
+#define TRACE_EVENT(name, proto, ...) \
+static inline void trace_ ## name(proto) {}
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(...)
+#undef DEFINE_EVENT
+#define DEFINE_EVENT(evt_class, name, proto, ...) \
+static inline void trace_ ## name(proto) {}
+#endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
+
+DECLARE_EVENT_CLASS(wil6210_wmi,
+ TP_PROTO(u16 id, void *buf, u16 buf_len),
+
+ TP_ARGS(id, buf, buf_len),
+
+ TP_STRUCT__entry(
+ __field(u16, id)
+ __field(u16, buf_len)
+ __dynamic_array(u8, buf, buf_len)
+ ),
+
+ TP_fast_assign(
+ __entry->id = id;
+ __entry->buf_len = buf_len;
+ memcpy(__get_dynamic_array(buf), buf, buf_len);
+ ),
+
+ TP_printk(
+ "id 0x%04x len %d",
+ __entry->id, __entry->buf_len
+ )
+);
+
+DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
+ TP_PROTO(u16 id, void *buf, u16 buf_len),
+ TP_ARGS(id, buf, buf_len)
+);
+
+DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
+ TP_PROTO(u16 id, void *buf, u16 buf_len),
+ TP_ARGS(id, buf, buf_len)
+);
+
+#define WIL6210_MSG_MAX (200)
+
+DECLARE_EVENT_CLASS(wil6210_log_event,
+ TP_PROTO(struct va_format *vaf),
+ TP_ARGS(vaf),
+ TP_STRUCT__entry(
+ __dynamic_array(char, msg, WIL6210_MSG_MAX)
+ ),
+ TP_fast_assign(
+ WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
+ WIL6210_MSG_MAX,
+ vaf->fmt,
+ *vaf->va) >= WIL6210_MSG_MAX);
+ ),
+ TP_printk("%s", __get_str(msg))
+);
+
+DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
+ TP_PROTO(struct va_format *vaf),
+ TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
+ TP_PROTO(struct va_format *vaf),
+ TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
+ TP_PROTO(struct va_format *vaf),
+ TP_ARGS(vaf)
+);
+
+#define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
+ {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
+ {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
+ {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
+
+TRACE_EVENT(wil6210_irq_pseudo,
+ TP_PROTO(u32 x),
+ TP_ARGS(x),
+ TP_STRUCT__entry(
+ __field(u32, x)
+ ),
+ TP_fast_assign(
+ __entry->x = x;
+ ),
+ TP_printk("cause 0x%08x : %s", __entry->x,
+ wil_pseudo_irq_cause(__entry->x))
+);
+
+DECLARE_EVENT_CLASS(wil6210_irq,
+ TP_PROTO(u32 x),
+ TP_ARGS(x),
+ TP_STRUCT__entry(
+ __field(u32, x)
+ ),
+ TP_fast_assign(
+ __entry->x = x;
+ ),
+ TP_printk("cause 0x%08x", __entry->x)
+);
+
+DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
+ TP_PROTO(u32 x),
+ TP_ARGS(x)
+);
+
+DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
+ TP_PROTO(u32 x),
+ TP_ARGS(x)
+);
+
+DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
+ TP_PROTO(u32 x),
+ TP_ARGS(x)
+);
+
+DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
+ TP_PROTO(u32 x),
+ TP_ARGS(x)
+);
+
+TRACE_EVENT(wil6210_rx,
+ TP_PROTO(u16 index, struct vring_rx_desc *d),
+ TP_ARGS(index, d),
+ TP_STRUCT__entry(
+ __field(u16, index)
+ __field(unsigned int, len)
+ __field(u8, mid)
+ __field(u8, cid)
+ __field(u8, tid)
+ __field(u8, type)
+ __field(u8, subtype)
+ __field(u16, seq)
+ __field(u8, mcs)
+ ),
+ TP_fast_assign(
+ __entry->index = index;
+ __entry->len = d->dma.length;
+ __entry->mid = wil_rxdesc_mid(d);
+ __entry->cid = wil_rxdesc_cid(d);
+ __entry->tid = wil_rxdesc_tid(d);
+ __entry->type = wil_rxdesc_ftype(d);
+ __entry->subtype = wil_rxdesc_subtype(d);
+ __entry->seq = wil_rxdesc_seq(d);
+ __entry->mcs = wil_rxdesc_mcs(d);
+ ),
+ TP_printk("index %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x"
+ " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
+ __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
+ __entry->seq, __entry->type, __entry->subtype)
+);
+
+TRACE_EVENT(wil6210_tx,
+ TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
+ TP_ARGS(vring, index, len, frags),
+ TP_STRUCT__entry(
+ __field(u8, vring)
+ __field(u8, frags)
+ __field(u16, index)
+ __field(unsigned int, len)
+ ),
+ TP_fast_assign(
+ __entry->vring = vring;
+ __entry->frags = frags;
+ __entry->index = index;
+ __entry->len = len;
+ ),
+ TP_printk("vring %d index %d len %d frags %d",
+ __entry->vring, __entry->index, __entry->len, __entry->frags)
+);
+
+TRACE_EVENT(wil6210_tx_done,
+ TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
+ TP_ARGS(vring, index, len, err),
+ TP_STRUCT__entry(
+ __field(u8, vring)
+ __field(u8, err)
+ __field(u16, index)
+ __field(unsigned int, len)
+ ),
+ TP_fast_assign(
+ __entry->vring = vring;
+ __entry->index = index;
+ __entry->len = len;
+ __entry->err = err;
+ ),
+ TP_printk("vring %d index %d len %d err 0x%02x",
+ __entry->vring, __entry->index, __entry->len,
+ __entry->err)
+);
+
+#endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
+
+#if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
+/* we don't want to use include/trace/events */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
+#endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index d060511..dfd9848 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -22,6 +22,7 @@
#include "wil6210.h"
#include "wmi.h"
#include "txrx.h"
+#include "trace.h"
static bool rtap_include_phy_info;
module_param(rtap_include_phy_info, bool, S_IRUGO);
@@ -370,9 +371,11 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)
wil_rx_add_radiotap_header(wil, skb);
- wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length);
+ trace_wil6210_rx(vring->swhead, d1);
+ wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead,
+ d1->dma.length);
wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
- (const void *)d, sizeof(*d), false);
+ (const void *)d1, sizeof(*d1), false);
/* no extra checks if in sniffer mode */
if (ndev->type != ARPHRD_ETHER)
@@ -705,6 +708,7 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
/* advance swhead */
wil_vring_advance_head(vring, nr_frags + 1);
wil_dbg_txrx(wil, "Tx swhead %d -> %d\n", swhead, vring->swhead);
+ trace_wil6210_tx(vring_index, swhead, skb->len, nr_frags);
iowrite32(vring->swhead, wil->csr + HOSTADDR(vring->hwtail));
/* hold reference to skb
* to prevent skb release before accounting
@@ -815,6 +819,8 @@ void wil_tx_complete(struct wil6210_priv *wil, int ringid)
break;
dmalen = le16_to_cpu(d->dma.length);
+ trace_wil6210_tx_done(ringid, vring->swtail, dmalen,
+ d->dma.error);
wil_dbg_txrx(wil,
"Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n",
vring->swtail, dmalen, d->dma.status,
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 8f76ecd..484446e 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -267,9 +267,13 @@ struct wil6210_priv {
#define wil_to_ndev(i) (wil_to_wdev(i)->netdev)
#define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr))
-#define wil_dbg(wil, fmt, arg...) netdev_dbg(wil_to_ndev(wil), fmt, ##arg)
-#define wil_info(wil, fmt, arg...) netdev_info(wil_to_ndev(wil), fmt, ##arg)
-#define wil_err(wil, fmt, arg...) netdev_err(wil_to_ndev(wil), fmt, ##arg)
+int wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...);
+int wil_err(struct wil6210_priv *wil, const char *fmt, ...);
+int wil_info(struct wil6210_priv *wil, const char *fmt, ...);
+#define wil_dbg(wil, fmt, arg...) do { \
+ netdev_dbg(wil_to_ndev(wil), fmt, ##arg); \
+ wil_dbg_trace(wil, fmt, ##arg); \
+} while (0)
#define wil_dbg_irq(wil, fmt, arg...) wil_dbg(wil, "DBG[ IRQ]" fmt, ##arg)
#define wil_dbg_txrx(wil, fmt, arg...) wil_dbg(wil, "DBG[TXRX]" fmt, ##arg)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 45b04e3..5e01f4e 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -20,6 +20,7 @@
#include "wil6210.h"
#include "txrx.h"
#include "wmi.h"
+#include "trace.h"
/**
* WMI event receiving - theory of operations
@@ -246,6 +247,8 @@ static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len)
iowrite32(r->head = next_head, wil->csr + HOST_MBOX +
offsetof(struct wil6210_mbox_ctl, tx.head));
+ trace_wil6210_wmi_cmd(cmdid, buf, len);
+
/* interrupt to FW */
iowrite32(SW_INT_MBOX, wil->csr + HOST_SW_INT);
@@ -635,8 +638,9 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
hdr.flags);
if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) &&
(len >= sizeof(struct wil6210_mbox_hdr_wmi))) {
- wil_dbg_wmi(wil, "WMI event 0x%04x\n",
- evt->event.wmi.id);
+ u16 id = le16_to_cpu(evt->event.wmi.id);
+ wil_dbg_wmi(wil, "WMI event 0x%04x\n", id);
+ trace_wil6210_wmi_event(id, &evt->event.wmi, len);
}
wil_hex_dump_wmi("evt ", DUMP_PREFIX_OFFSET, 16, 1,
&evt->event.hdr, sizeof(hdr) + len, true);
--
1.8.1.2
^ permalink raw reply related
* [PATCH 3/7] wil6210: debug dump packet content right after DMA
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
Move packet dump to the earliest location where it is known to have
valid data.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/txrx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 6506b76..d060511 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -360,6 +360,10 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
}
skb_trim(skb, dmalen);
+ wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
+ skb->data, skb_headlen(skb), false);
+
+
wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1);
/* use radiotap header only if required */
@@ -474,8 +478,6 @@ void wil_rx_handle(struct wil6210_priv *wil)
}
wil_dbg_txrx(wil, "%s()\n", __func__);
while (NULL != (skb = wil_vring_reap_rx(wil, v))) {
- wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
- skb->data, skb_headlen(skb), false);
if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
skb->dev = ndev;
--
1.8.1.2
^ permalink raw reply related
* [PATCH 2/7] wil6210: Sanity check for reported DMA length
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
If Rx descriptor contains garbage, it is possible to access memory beyond
allocated buffer.
Check this condition and drop Rx if reported length is
unreasonable large
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/txrx.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index b9cac7d..6506b76 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -351,7 +351,13 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
d1 = wil_skb_rxdesc(skb);
*d1 = *d;
+ wil_vring_advance_head(vring, 1);
dmalen = le16_to_cpu(d1->dma.length);
+ if (dmalen > sz) {
+ wil_err(wil, "Rx size too large: %d bytes!\n", dmalen);
+ kfree(skb);
+ return NULL;
+ }
skb_trim(skb, dmalen);
wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1);
@@ -364,8 +370,6 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
(const void *)d, sizeof(*d), false);
- wil_vring_advance_head(vring, 1);
-
/* no extra checks if in sniffer mode */
if (ndev->type != ARPHRD_ETHER)
return skb;
--
1.8.1.2
^ permalink raw reply related
* [PATCH 1/7] wil6210: 'length' in Tx/Rx descriptors is little endian
From: Vladimir Kondratiev @ 2013-05-12 11:43 UTC (permalink / raw)
To: John W . Linville; +Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez
In-Reply-To: <1368359018-20870-1-git-send-email-qca_vkondrat@qca.qualcomm.com>
Hardware uses little endian for the Tx/Rx descriptors field 'length',
do appropriate conversions
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 8 +++++++-
drivers/net/wireless/ath/wil6210/txrx.c | 33 +++++++++++++++++++-----------
drivers/net/wireless/ath/wil6210/txrx.h | 4 ++--
3 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 4be07f5..b32c58e 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -418,9 +418,15 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
if (skb) {
unsigned char printbuf[16 * 3 + 2];
int i = 0;
- int len = skb_headlen(skb);
+ int len = le16_to_cpu(d->dma.length);
void *p = skb->data;
+ if (len != skb_headlen(skb)) {
+ seq_printf(s, "!!! len: desc = %d skb = %d\n",
+ len, skb_headlen(skb));
+ len = min_t(int, len, skb_headlen(skb));
+ }
+
seq_printf(s, " len = %d\n", len);
while (i < len) {
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 91454a4..b9cac7d 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -108,19 +108,21 @@ static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
size_t sz = vring->size * sizeof(vring->va[0]);
while (!wil_vring_is_empty(vring)) {
+ u16 dmalen;
if (tx) {
volatile struct vring_tx_desc *d =
&vring->va[vring->swtail].tx;
dma_addr_t pa = d->dma.addr_low |
((u64)d->dma.addr_high << 32);
struct sk_buff *skb = vring->ctx[vring->swtail];
+ dmalen = le16_to_cpu(d->dma.length);
if (skb) {
- dma_unmap_single(dev, pa, d->dma.length,
+ dma_unmap_single(dev, pa, dmalen,
DMA_TO_DEVICE);
dev_kfree_skb_any(skb);
vring->ctx[vring->swtail] = NULL;
} else {
- dma_unmap_page(dev, pa, d->dma.length,
+ dma_unmap_page(dev, pa, dmalen,
DMA_TO_DEVICE);
}
vring->swtail = wil_vring_next_tail(vring);
@@ -130,8 +132,8 @@ static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
dma_addr_t pa = d->dma.addr_low |
((u64)d->dma.addr_high << 32);
struct sk_buff *skb = vring->ctx[vring->swhead];
- dma_unmap_single(dev, pa, d->dma.length,
- DMA_FROM_DEVICE);
+ dmalen = le16_to_cpu(d->dma.length);
+ dma_unmap_single(dev, pa, dmalen, DMA_FROM_DEVICE);
kfree_skb(skb);
wil_vring_advance_head(vring, 1);
}
@@ -177,7 +179,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
/* b11 don't care */
/* error don't care */
d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
- d->dma.length = sz;
+ d->dma.length = cpu_to_le16(sz);
vring->ctx[i] = skb;
return 0;
@@ -328,6 +330,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
struct sk_buff *skb;
dma_addr_t pa;
unsigned int sz = RX_BUF_LEN;
+ u16 dmalen;
u8 ftype;
u8 ds_bits;
@@ -345,10 +348,11 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
skb = vring->ctx[vring->swhead];
dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE);
- skb_trim(skb, d->dma.length);
d1 = wil_skb_rxdesc(skb);
*d1 = *d;
+ dmalen = le16_to_cpu(d1->dma.length);
+ skb_trim(skb, dmalen);
wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1);
@@ -612,7 +616,7 @@ static int wil_tx_desc_map(volatile struct vring_tx_desc *d,
d->dma.b11 = 0/*14 | BIT(7)*/;
d->dma.error = 0;
d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
- d->dma.length = len;
+ d->dma.length = cpu_to_le16((u16)len);
d->dma.d0 = 0;
d->mac.d[0] = 0;
d->mac.d[1] = 0;
@@ -707,14 +711,17 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
/* unmap what we have mapped */
/* Note: increment @f to operate with positive index */
for (f++; f > 0; f--) {
+ u16 dmalen;
+
i = (swhead + f) % vring->size;
d = &(vring->va[i].tx);
d->dma.status = TX_DMA_STATUS_DU;
pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
+ dmalen = le16_to_cpu(d->dma.length);
if (vring->ctx[i])
- dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
+ dma_unmap_single(dev, pa, dmalen, DMA_TO_DEVICE);
else
- dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
+ dma_unmap_page(dev, pa, dmalen, DMA_TO_DEVICE);
}
return -EINVAL;
@@ -794,15 +801,17 @@ void wil_tx_complete(struct wil6210_priv *wil, int ringid)
struct vring_tx_desc dd, *d = ⅆ
dma_addr_t pa;
struct sk_buff *skb;
+ u16 dmalen;
dd = *d1;
if (!(d->dma.status & TX_DMA_STATUS_DU))
break;
+ dmalen = le16_to_cpu(d->dma.length);
wil_dbg_txrx(wil,
"Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n",
- vring->swtail, d->dma.length, d->dma.status,
+ vring->swtail, dmalen, d->dma.status,
d->dma.error);
wil_hex_dump_txrx("TxC ", DUMP_PREFIX_NONE, 32, 4,
(const void *)d, sizeof(*d), false);
@@ -817,11 +826,11 @@ void wil_tx_complete(struct wil6210_priv *wil, int ringid)
ndev->stats.tx_errors++;
}
- dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
+ dma_unmap_single(dev, pa, dmalen, DMA_TO_DEVICE);
dev_kfree_skb_any(skb);
vring->ctx[vring->swtail] = NULL;
} else {
- dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
+ dma_unmap_page(dev, pa, dmalen, DMA_TO_DEVICE);
}
d->dma.addr_low = 0;
d->dma.addr_high = 0;
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h
index adef12f..a40aa0b 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.h
+++ b/drivers/net/wireless/ath/wil6210/txrx.h
@@ -222,7 +222,7 @@ struct vring_tx_dma {
u8 b11; /* 0..6: mac_length; 7:ip_version */
u8 error; /* 0..2: err; 3..7: reserved; */
u8 status; /* 0: used; 1..7; reserved */
- u16 length;
+ __le16 length;
} __packed;
/*
@@ -321,7 +321,7 @@ struct vring_rx_dma {
u8 b11;
u8 error;
u8 status;
- u16 length;
+ __le16 length;
} __packed;
struct vring_tx_desc {
--
1.8.1.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox