[PATCH] b43: HT-PHY: Set MAC frequency to correct values

2014-09-10 Thread Rafał Miłecki
I misunderstood original Broadcom comment and used wrong values.

Signed-off-by: Rafał Miłecki 
---
Comment in original brcm80211 patch was like this:
+ * HTPHY Formula is 2^26/freq(MHz) e.g.
+ * For spuron2 - 126MHz -> 2^26/126 = 532610.0
+ *  - 532610 = 0x82082 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x2082
+ * For spuron: 123MHz -> 2^26/123= 545600.5
+ *  - 545601 = 0x85341 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x5341
+ * For spur off: 120MHz -> 2^26/120= 559240.5
+ *  - 559241 = 0x9 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x8889

But it appears BCM4331 uses 168, 164 and 160 MHz freqs. MMIO dump proof:

[spuravoid == 0]
write32 0xf7c03660 <- 0x
write32 0xf7c03664 <- 0x11100014 ← this means spuravoid 0
write32 0xf7c03660 <- 0x0002
write32 0xf7c03664 <- 0x03000a08 ← this means spuravoid 0
(...)
write16 0xf7c0062e <- 0xB43_MMIO_TSF_CLK_FRAC_LOW
write16 0xf7c00630 <- 0x0006B43_MMIO_TSF_CLK_FRAC_HIGH

[spuravoid == 1]
write32 0xf7c03660 <- 0x
write32 0xf7c03664 <- 0x11500014 ← this means spuravoid 1 or 2
write32 0xf7c03660 <- 0x0002
write32 0xf7c03664 <- 0x0f600a08 ← this means spuravoid 1
 (...)
write16 0xf7c0062e <- 0x3e70B43_MMIO_TSF_CLK_FRAC_LOW
write16 0xf7c00630 <- 0x0006B43_MMIO_TSF_CLK_FRAC_HIGH
---
 drivers/net/wireless/b43/main.c   | 17 -
 drivers/net/wireless/b43/phy_ht.c | 16 +---
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 66ff718..165dbc3 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2985,7 +2985,22 @@ void b43_mac_switch_freq(struct b43_wldev *dev, u8 
spurmode)
 {
u16 chip_id = dev->dev->chip_id;
 
-   if (chip_id == BCMA_CHIP_ID_BCM43131 ||
+   if (chip_id == BCMA_CHIP_ID_BCM4331) {
+   switch (spurmode) {
+   case 2: /* 168 Mhz: 2^26/168 = 0x61862 */
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x1862);
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x6);
+   break;
+   case 1: /* 164 Mhz: 2^26/164 = 0x63e70 */
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x3e70);
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x6);
+   break;
+   default: /* 160 Mhz: 2^26/160 = 0x6 */
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x);
+   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x6);
+   break;
+   }
+   } else if (chip_id == BCMA_CHIP_ID_BCM43131 ||
chip_id == BCMA_CHIP_ID_BCM43217 ||
chip_id == BCMA_CHIP_ID_BCM43222 ||
chip_id == BCMA_CHIP_ID_BCM43224 ||
diff --git a/drivers/net/wireless/b43/phy_ht.c 
b/drivers/net/wireless/b43/phy_ht.c
index de52d48..a379602 100644
--- a/drivers/net/wireless/b43/phy_ht.c
+++ b/drivers/net/wireless/b43/phy_ht.c
@@ -728,7 +728,6 @@ static void b43_phy_ht_spur_avoid(struct b43_wldev *dev,
 {
struct bcma_device *core = dev->dev->bdev;
int spuravoid = 0;
-   u16 tmp;
 
/* Check for 13 and 14 is just a guess, we don't have enough logs. */
if (new_channel->hw_value == 13 || new_channel->hw_value == 14)
@@ -741,20 +740,7 @@ static void b43_phy_ht_spur_avoid(struct b43_wldev *dev,
  B43_BCMA_CLKCTLST_80211_PLL_ST |
  B43_BCMA_CLKCTLST_PHY_PLL_ST, false);
 
-   /* Values has been taken from wlc_bmac_switch_macfreq comments */
-   switch (spuravoid) {
-   case 2: /* 126MHz */
-   tmp = 0x2082;
-   break;
-   case 1: /* 123MHz */
-   tmp = 0x5341;
-   break;
-   default: /* 120MHz */
-   tmp = 0x8889;
-   }
-
-   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, tmp);
-   b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8);
+   b43_mac_switch_freq(dev, spuravoid);
 
/* TODO: reset PLL */
 
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 4/5] ath9k: Fix channel switch time duration

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

Since the NoA duration is the maximum time the GO interface
can be offline, it needs to include the time take to
switch channels in the HW.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 09ff8a6..a42fd85 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -419,7 +419,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
avp->noa_index++;
avp->noa_start = tsf_time;
avp->noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 -
+   TU_TO_USEC(cur_conf->beacon_interval) / 2 +
sc->sched.channel_switch_time;
 
if (test_bit(ATH_OP_SCANNING, &common->op_flags))
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 1/5] ath9k: Assign offchannel duration properly

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

In multi-channel mode, an offchannel request will
be deferred if both contexts are active. The duration
of the offchannel operation is calculated but is
not stored in the scheduler state. Fix this.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 522894b..ae575cb 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -588,10 +588,15 @@ static void ath_chanctx_switch(struct ath_softc *sc, 
struct ath_chanctx *ctx,
 
if (test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags) &&
(sc->cur_chan != ctx) && (ctx == &sc->offchannel.chan)) {
-   sc->sched.offchannel_pending = true;
-   sc->sched.wait_switch = true;
if (chandef)
ctx->chandef = *chandef;
+
+   sc->sched.offchannel_pending = true;
+   sc->sched.wait_switch = true;
+   sc->sched.offchannel_duration =
+   jiffies_to_usecs(sc->offchannel.duration) +
+   sc->sched.channel_switch_time;
+
spin_unlock_bh(&sc->chan_lock);
ath_dbg(common, CHAN_CTX,
"Set offchannel_pending to true\n");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 3/5] ath9k: Clear offchannel duration properly

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

Clearing the offchannel duration value in the
scheduler unconditionally breaks NoA when
multiple contexts are active and an offchannel
request is deferred, for example, in a scan run.

Fix this by clearing the duration only if there
is no pending offchannel request.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index ab3d29d..09ff8a6 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1065,7 +1065,10 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool 
force)
sc->cur_chan = sc->next_chan;
sc->cur_chan->stopped = false;
sc->next_chan = NULL;
-   sc->sched.offchannel_duration = 0;
+
+   if (!sc->sched.offchannel_pending)
+   sc->sched.offchannel_duration = 0;
+
if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE)
sc->sched.state = ATH_CHANCTX_STATE_IDLE;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 2/5] ath9k: Fix Notice of Absence issues

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

* The index has to incremented only when advertising
  a new NoA schedule.

* Switch to non-periodic NoA when starting a scan operation
  and multiple channel contexts are active.

* Make sure that periodic NoA is advertised again when
  scan ends. Since the offchannel timer moves the offchannel
  state to IDLE after the GO operating channel becomes
  active, use a flag "force_noa_update" to update the
  NoA contents.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |   7 ++-
 drivers/net/wireless/ath/ath9k/channel.c | 105 ---
 2 files changed, 75 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 0c071b0..305db1a 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -379,6 +379,7 @@ struct ath_chanctx_sched {
bool beacon_pending;
bool offchannel_pending;
bool wait_switch;
+   bool force_noa_update;
enum ath_chanctx_state state;
u8 beacon_miss;
 
@@ -595,8 +596,10 @@ struct ath_vif {
u32 offchannel_start;
u32 offchannel_duration;
 
-   u32 periodic_noa_start;
-   u32 periodic_noa_duration;
+   /* These are used for both periodic and one-shot */
+   u32 noa_start;
+   u32 noa_duration;
+   bool periodic_noa;
 };
 
 struct ath9k_vif_iter_data {
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index ae575cb..ab3d29d 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -310,7 +310,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
struct ath_chanctx *ctx;
u32 tsf_time;
u32 beacon_int;
-   bool noa_changed = false;
 
if (vif)
avp = (struct ath_vif *) vif->drv_priv;
@@ -372,22 +371,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.switch_start_time = tsf_time;
sc->cur_chan->last_beacon = sc->sched.next_tbtt;
 
-   /* Prevent wrap-around issues */
-   if (avp->periodic_noa_duration &&
-   tsf_time - avp->periodic_noa_start > BIT(30))
-   avp->periodic_noa_duration = 0;
-
-   if (ctx->active) {
-   avp->periodic_noa_start = tsf_time;
-   avp->periodic_noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 -
-   sc->sched.channel_switch_time;
-   noa_changed = true;
-   } else if (!ctx->active) {
-   avp->periodic_noa_duration = 0;
-   noa_changed = true;
-   }
-
/* If at least two consecutive beacons were missed on the STA
 * chanctx, stay on the STA channel for one extra beacon period,
 * to resync the timer properly.
@@ -395,21 +378,65 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
if (ctx->active && sc->sched.beacon_miss >= 2)
sc->sched.offchannel_duration = 3 * beacon_int / 2;
 
-   if (sc->sched.offchannel_duration) {
-   noa_changed = true;
+   /*
+* If an offchannel switch is scheduled to happen after
+* a beacon transmission, update the NoA with one-shot
+* values and increment the index.
+*/
+   if (sc->next_chan == &sc->offchannel.chan) {
+   avp->noa_index++;
avp->offchannel_start = tsf_time;
-   avp->offchannel_duration =
-   sc->sched.offchannel_duration;
+   avp->offchannel_duration = 
sc->sched.offchannel_duration;
+
+   ath_dbg(common, CHAN_CTX,
+   "offchannel noa_duration: %d, noa_start: %d, 
noa_index: %d\n",
+   avp->offchannel_duration,
+   avp->offchannel_start,
+   avp->noa_index);
+
+   /*
+* When multiple contexts are active, the NoA
+* has to be recalculated and advertised after
+* an offchannel operation.
+*/
+   if (ctx->active && avp->noa_duration)
+   avp->noa_duration = 0;
+
+   break;
}
 
-   if (noa_changed)
+   /* Prevent wrap-around issues */
+   if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
+   avp->noa_duration = 0;
+
+   /*
+   

[RFC 5/5] ath9k: Fix beacon miss handling

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

The NoA duration for a GO is half the beacon interval
and a concurrent context like a STA can be active only
for that duration, before switching back to the GO's
operating channel.

Currently, when multiple beacons are missed, the dwell
time for the STA context is extended to improve the
chances of receiving a beacon. But the NoA is not updated
and this will cause problems since the GO is offline
for a period that is longer than the advertised duration.

Fix this by ensuring that the NoA is updated first before
extending the time slot for the STA context. Also make
sure that non-periodic NoA is used for a one-time, longer
absence period.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 44 +++-
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 305db1a..660c151 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -380,6 +380,7 @@ struct ath_chanctx_sched {
bool offchannel_pending;
bool wait_switch;
bool force_noa_update;
+   bool extend_absence;
enum ath_chanctx_state state;
u8 beacon_miss;
 
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index a42fd85..a1b3282 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -371,13 +371,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.switch_start_time = tsf_time;
sc->cur_chan->last_beacon = sc->sched.next_tbtt;
 
-   /* If at least two consecutive beacons were missed on the STA
-* chanctx, stay on the STA channel for one extra beacon period,
-* to resync the timer properly.
-*/
-   if (ctx->active && sc->sched.beacon_miss >= 2)
-   sc->sched.offchannel_duration = 3 * beacon_int / 2;
-
/*
 * If an offchannel switch is scheduled to happen after
 * a beacon transmission, update the NoA with one-shot
@@ -405,6 +398,26 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
break;
}
 
+
+   /*
+* Clear the extend_absence flag if it had been
+* set during the previous beacon transmission,
+* since we need to revert to the normal NoA
+* schedule.
+*/
+   if (ctx->active && sc->sched.extend_absence) {
+   avp->noa_duration = 0;
+   sc->sched.extend_absence = false;
+   }
+
+   /* If at least two consecutive beacons were missed on the STA
+* chanctx, stay on the STA channel for one extra beacon period,
+* to resync the timer properly.
+*/
+   if (ctx->active && sc->sched.beacon_miss >= 2) {
+   avp->noa_duration = 0;
+   sc->sched.extend_absence = true;
+   }
/* Prevent wrap-around issues */
if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
avp->noa_duration = 0;
@@ -418,11 +431,17 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
(!avp->noa_duration || sc->sched.force_noa_update)) {
avp->noa_index++;
avp->noa_start = tsf_time;
-   avp->noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 +
-   sc->sched.channel_switch_time;
 
-   if (test_bit(ATH_OP_SCANNING, &common->op_flags))
+   if (sc->sched.extend_absence)
+   avp->noa_duration = (3 * beacon_int / 2) +
+   sc->sched.channel_switch_time;
+   else
+   avp->noa_duration =
+   TU_TO_USEC(cur_conf->beacon_interval) / 
2 +
+   sc->sched.channel_switch_time;
+
+   if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
+   sc->sched.extend_absence)
avp->periodic_noa = false;
else
avp->periodic_noa = true;
@@ -520,7 +539,8 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.wait_switch = false;
 
tsf_time = TU_TO_USEC(cur_conf->beacon_interval) / 2;
-   if (sc->sched.beacon_miss >= 2) {
+
+

[RFC 0/5] ath9k patches

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

MCC fixes. Please review.

Sujith Manoharan (5):
  ath9k: Assign offchannel duration properly
  ath9k: Fix Notice of Absence issues
  ath9k: Clear offchannel duration properly
  ath9k: Fix channel switch time duration
  ath9k: Fix beacon miss handling

 drivers/net/wireless/ath/ath9k/ath9k.h   |   8 +-
 drivers/net/wireless/ath/ath9k/channel.c | 143 ++-
 2 files changed, 109 insertions(+), 42 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


P2P_DEVICE support in Android KitKat

2014-09-10 Thread Arend van Spriel

Hi Jouni,

I am running some tests on a haswell target with Android KitKat (3.10.20 
kernel). In this configuration our brcmfmac driver is used with driver 
param 'p2p_device=1'. So we end up with wlan0 and p2p-dev-wlan0 
interfaces (can blame myself for that). The configuration has a network 
configured, but I did not expect wpa_supplicant to start association 
using the p2p device interface. The wlan0 interface is already connected 
to the AP. How can I fix this to assure p2p-dev-wlan0 is only used for 
p2p management scenarios.


Regards,
Arend

---8<--
D/wpa_supplicant( 2613): p2p-dev-wlan0: 12: c0:c1:c0:04:b8:2c 
ssid='NSN24' wpa_ie_len=0 rsn_ie_len=0 caps=0x401 level=-36 wps

D/wpa_supplicant( 2613): p2p-dev-wlan0:allow in non-WPA/WPA2
D/wpa_supplicant( 2613): p2p-dev-wlan0:selected BSS 
c0:c1:c0:04:b8:2c ssid='NSN24'
D/wpa_supplicant( 2613): p2p-dev-wlan0: Considering connect request: 
reassociate: 0  selected: c0:c1:c0:04:b8:2c  bssid: 00:00:00:00:00:00 
pending: 00:00:00:00:00:00  wpa_state: SCANNING  ssid=0xf9074cd0 
current_ssid=0x0
D/wpa_supplicant( 2613): p2p-dev-wlan0: Request association with 
c0:c1:c0:04:b8:2c
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=7): 00 05 4e 53 4e 32 34
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=3): 03 01 0b
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=6): 05 04 00 01 00 00
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=3): 2a 01 00
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=3): 2f 01 00
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=24): 3d 16 0b 0f 04 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00
D/wpa_supplicant( 2613): WPA: Unrecognized EAPOL-Key Key Data IE - 
hexdump(len=16): 4a 0e 14 00 0a 00 2c 01 c8 00 14 00 05 00 19 00

D/wpa_supplicant( 2613): TDLS: TDLS is allowed in the target BSS
I/wpa_supplicant( 2613): p2p-dev-wlan0: Trying to associate with SSID 
'NSN24'
D/wpa_supplicant( 2613): CTRL_IFACE monitor send - hexdump(len=40): 2f 
64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 
70 61 5f 63 74 72 6c ...

D/wpa_supplicant( 2613): p2p-dev-wlan0: Cancelling scan request
D/wpa_supplicant( 2613): p2p-dev-wlan0: P2P: Station mode scan operation 
not pending anymore (sta_scan_pending=0 p2p_cb_on_scan_complete=0)

D/wpa_supplicant( 2613): p2p-dev-wlan0: WPA: clearing own WPA/RSN IE
D/wpa_supplicant( 2613): p2p-dev-wlan0: Automatic auth_alg selection: 0x1
D/wpa_supplicant( 2613): p2p-dev-wlan0: WPA: clearing AP WPA IE
D/wpa_supplicant( 2613): p2p-dev-wlan0: WPA: clearing AP RSN IE
D/wpa_supplicant( 2613): p2p-dev-wlan0: WPA: clearing own WPA/RSN IE
D/wpa_supplicant( 2613): p2p-dev-wlan0: No keys have been configured - 
skip key clearing

D/wpa_supplicant( 2613): p2p-dev-wlan0: State: SCANNING -> ASSOCIATING
D/wpa_supplicant( 2613): wpa_driver_nl80211_set_operstate: operstate 
0->0 (DORMANT)

D/wpa_supplicant( 2613): netlink: Operstate: linkmode=-1, operstate=5
D/wpa_supplicant( 2613): CTRL_IFACE monitor send - hexdump(len=40): 2f 
64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 
70 61 5f 63 74 72 6c ...

D/wpa_supplicant( 2613): nl80211: Set mode ifindex 0 iftype 2 (STATION)
D/wpa_supplicant( 2613): nl80211: Failed to set interface 0 to mode 2: 
-22 (Invalid argument)
D/wpa_supplicant( 2613): nl80211: Try mode change after setting 
interface down
D/wpa_supplicant( 2613): nl80211: Stop P2P Device p2p-dev-wlan0 (0x2): 
Success

D/wpa_supplicant( 2613): nl80211: Set mode ifindex 0 iftype 2 (STATION)
D/wpa_supplicant( 2613): nl80211: Failed to set interface 0 to mode 2: 
-22 (Invalid argument)
D/wpa_supplicant( 2613): nl80211: Start P2P Device p2p-dev-wlan0 (0x2): 
Success

D/wpa_supplicant( 2613): nl80211: Interface mode change to 2 from 10 failed
I/wpa_supplicant( 2613): p2p-dev-wlan0: Association request to the 
driver failed
D/wpa_supplicant( 2613): CTRL_IFACE monitor send - hexdump(len=40): 2f 
64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 
70 61 5f 63 74 72 6c ...

D/wpa_supplicant( 2613): Added BSSID 00:00:00:00:00:00 into blacklist
D/wpa_supplicant( 2613): p2p-dev-wlan0: Blacklist count 1 --> request 
scan in 100 ms
D/wpa_supplicant( 2613): p2p-dev-wlan0: Setting scan request: 0 sec 
10 usec
D/wpa_supplicant( 2613): p2p-dev-wlan0: P2P: Station mode scan operation 
not pending anymore (sta_scan_pending=0 p2p_cb_on_scan_complete=0)

D/wpa_supplicant( 2613): p2p-dev-wlan0: State: ASSOCIATING -> DISCONNECTED
D/wpa_supplicant( 2613): wpa_driver_nl80211_set_operstate: operstate 
0->0 (DORMANT)

D/wpa_supplicant( 2613): netlink: Operstate: linkmode=-1, operstate=5
D/wpa_supplicant( 2613): CTRL_IFACE monitor send - hexdump(len=40): 2f 
64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 

Re: iwlwifi no authentication with AP - Re: pull request: wireless-next 2014-09-08

2014-09-10 Thread Emmanuel Grumbach
On Wed, Sep 10, 2014 at 8:01 AM, Oliver Hartkopp  wrote:
> On 10.09.2014 00:07, Vadim Kochan wrote:
>> I have the same issue with iwlwifi.
>
> I tried an old zd1211 wireless USB stick to check if this problem is 80211
> related. But the USB stick works fine (I'm using it right now).
> So its definitely looks like an iwlwifi issue.
>
>> iwlwifi :02:00.0: fail to flush all tx fifo queues Q 0
>
> Wasn't there any change in the iwlwifi tx path recently??

Can you please try the patch attached? It works for me.

>
> Regards,
> Oliver
>
>>
From 42bfcf93e18cb850d0b5f5e0a4b99a239e0e57ab Mon Sep 17 00:00:00 2001
From: Emmanuel Grumbach 
Date: Wed, 10 Sep 2014 11:16:41 +0300
Subject: [PATCH] iwlwifi: trans: don't configure the set_active in SCD for dvm

This configuration is not needed for dvm, and it actually
broke it.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/iwl-trans.h | 2 ++
 drivers/net/wireless/iwlwifi/mvm/ops.c   | 1 +
 drivers/net/wireless/iwlwifi/pcie/internal.h | 2 ++
 drivers/net/wireless/iwlwifi/pcie/trans.c| 1 +
 drivers/net/wireless/iwlwifi/pcie/tx.c   | 6 --
 5 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 36275b4..c87b452 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -382,6 +382,7 @@ enum iwl_trans_status {
  *	if unset 4k will be the RX buffer size
  * @bc_table_dword: set to true if the BC table expects the byte count to be
  *	in DWORD (as opposed to bytes)
+ * @scd_set_active: should the transport configure the SCD for HCMD queue
  * @queue_watchdog_timeout: time (in ms) after which queues
  *	are considered stuck and will trigger device restart
  * @command_names: array of command names, must be 256 entries
@@ -397,6 +398,7 @@ struct iwl_trans_config {
 
 	bool rx_buf_size_8k;
 	bool bc_table_dword;
+	bool scd_set_active;
 	unsigned int queue_watchdog_timeout;
 	const char *const *command_names;
 };
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 77b0b48..ed82547 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -504,6 +504,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 
 	trans_cfg.cmd_queue = IWL_MVM_CMD_QUEUE;
 	trans_cfg.cmd_fifo = IWL_MVM_TX_FIFO_CMD;
+	trans_cfg.scd_set_active = true;
 
 	snprintf(mvm->hw->wiphy->fw_version,
 		 sizeof(mvm->hw->wiphy->fw_version),
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index 5bca9a6..e6129af 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -257,6 +257,7 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
  * @cmd_queue - command queue number
  * @rx_buf_size_8k: 8 kB RX buffer size
  * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
+ * @scd_set_active: should the transport configure the SCD for HCMD queue
  * @rx_page_order: page order for receive buffer size
  * @wd_timeout: queue watchdog timeout (jiffies)
  * @reg_lock: protect hw register access
@@ -306,6 +307,7 @@ struct iwl_trans_pcie {
 
 	bool rx_buf_size_8k;
 	bool bc_table_dword;
+	bool scd_set_active;
 	u32 rx_page_order;
 
 	const char *const *command_names;
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 0f4a4c1..a215624 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1177,6 +1177,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
 
 	trans_pcie->command_names = trans_cfg->command_names;
 	trans_pcie->bc_table_dword = trans_cfg->bc_table_dword;
+	trans_pcie->scd_set_active = trans_cfg->scd_set_active;
 
 	/* Initialize NAPI here - it should be before registering to mac80211
 	 * in the opmode but after the HW struct is allocated.
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index f4df951..d69f2e9 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1085,7 +1085,8 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, u16 ssn,
 		fifo = cfg->fifo;
 
 		/* Disable the scheduler prior configuring the cmd queue */
-		if (txq_id == trans_pcie->cmd_queue)
+		if (txq_id == trans_pcie->cmd_queue &&
+		trans_pcie->scd_set_active)
 			iwl_scd_enable_set_active(trans, 0);
 
 		/* Stop this Tx queue before configuring it */
@@ -1147,7 +1148,8 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, u16 ssn,
 			   SCD_QUEUE_STTS_REG_MSK);
 
 		/* enable the scheduler for this queue (only) */
-		if (txq_id == trans_pcie->cmd_queue)
+		if (txq_id == trans_pcie->cmd_queue &&
+		trans_pcie->scd_set_active)
 			iwl_scd_enable_set_active(tra

Re: Not reaching optimum speeds with IEEE 802.11n

2014-09-10 Thread Arend van Spriel

On 09/10/14 03:26, Sourav wrote:

Hi All,
We are using Ralink chip Rt3072L (using rt2800usb drivers rt2800usb.c),
mac80211, and hostapd in our routers.
root:~# lsmod
Module Size Used by Tainted: P
rt2800usb 15371 0
rt2800lib 74214 1 rt2800usb
rt2x00usb 9718 1 rt2800usb
rt2x00lib 39328 3 rt2800usb,rt2800lib,rt2x00usb
mac80211 266596 3 rt2800lib,rt2x00usb,rt2x00lib
cfg80211 214073 2 rt2x00lib,mac80211
compat 17406 4 rt2800usb,rt2x00lib,mac80211,cfg80211

When we are measuring performance using iperf, we see ~20Mbps, using
Channel 11 of 2.4GHZ, using 802.11n. The following is the iperf stats
with iperf client running on the router and iperf server running on a
laptop with IEEE802.11n adapter.

root:~# iperf -c 192.168.1.194 -p 5001 -i1 -fk -w146k -t100

Client connecting to 192.168.1.194, TCP port 5001
TCP window size: 292 KByte (WARNING: requested 146 KByte)

[ 3] local 192.168.1.1 port 42520 connected with 192.168.1.194 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 1560 KBytes 12780 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 1.0- 2.0 sec 2672 KBytes 21889 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 2.0- 3.0 sec 2800 KBytes 22938 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 3.0- 4.0 sec 2624 KBytes 21496 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 4.0- 5.0 sec 2712 KBytes 22217 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 5.0- 6.0 sec 2664 KBytes 21823 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 6.0- 7.0 sec 2424 KBytes 19857 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 7.0- 8.0 sec 2424 KBytes 19857 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 8.0- 9.0 sec 2592 KBytes 21234 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 9.0-10.0 sec 2752 KBytes 22544 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 10.0-11.0 sec 3024 KBytes 24773 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 11.0-12.0 sec 2568 KBytes 21037 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 12.0-13.0 sec 2832 KBytes 23200 Kbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 13.0-14.0 sec 2624 KBytes 21496 Kbits/sec

We are expecting speeds of upto 300Mbps(as per 802.11n specs), though
those speeds are achievable using channel bonding over 5GHZ?


First of all, the speeds in the 802.11n specs are phy rates. This rate 
is what is used for individual frames. So you are comparing apples and 
beans (not in the fruit department) by looking at TCP throughput. You 
will need to determine the actual phy rate during the test using iw. 
This depends on condition in the environment. 300Mbps requires two 
streams (2x2) and 40MHz bandwidth.


Regards,
Arend


However at 2.4GHZ also we believe the speeds we are seeing are far too
lowwhat are the maximum achievable speeds that we can expect in our
setup and how to achieve them.are there
any performance tuning techniques that we can useplease reply asap
as this is very urgent.



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Arend van Spriel

On 09/10/14 01:10, Marcel Holtmann wrote:

Hi Bastien,


What specific Baytrail tablet do you have?


The Onda v975w. It came with Windows 8.1 32-bit.

I guess that the device is probably a PCI one, but the enumeration is
done through ACPI instead of "normal" PCI.


In 
http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
 someone is specifically looking for an RTL8723BS driver.


That's helpful.


I will see if my contact at Realtek knows who has worked on drivers for this 
device, and if it would be possible to use rtl8723be if we were to supply an 
SDIO frontend.


I'm not sure why the device doesn't show up in the sysfs tree, but maybe it 
needs a driver bound to it to show up.


I just booted up my Baytrail based Minnowboard Max in ACPI enumeration and then 
the SDIO host controller is enumerated via ACPI. This is compared to PCI 
enumeration where the SDIO controller shows up in lspci.

So can you try to install sdhci-acpi and see if that starts showing SDIO 
devices. If the SDIO host controllers loads, then it start SDIO enumeration and 
you would see the cards.


You may need to look in /sys/bus/mmc/devices/ instead of sdio.

Gr. AvS


Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 802.11p rate control

2014-09-10 Thread Johannes Berg
On Mon, 2014-09-08 at 18:30 +0200, Rostislav Lisovy wrote:

> The possible (first implementation) solution might be either to
> implement some "dummy" rate control algorithm that will set a fixed
> datarate only once (during "ocb join" command) or to use the Minstrel
> while limiting the allowed datarate to be the lowest one; i.e.
> mand_rates = ieee80211_mandatory_rates(sband, scan_width);
> sta->sta.supp_rates[band] =
> find_first_bit(&mand_rates, sizeof(u32));

That's pretty much already done anyway since you'd restrict the
supported rates to the ones that are, well, supported :)

So I don't think you need to do anything here except set up the station
correctly.


> If I am not mistaken, it is not possible to live without an in-kernel
> rate_control algorithm?
> One interesting idea I got from one colleague is to implement the
> algorithm logic in the user-space -- kernel would contain just a thin
> shell controlled from the user-space (via netlink?). This is probably
> not as insane as it may sound since the purpose of the rate-control
> algorithm for 802.11p (at least for ITS-G5) is not to "maximize the
> immediate throughput" but more like "shared medium congestion control",
> which may require much slower frequency of a control loop.

I'm not really convinced this is feasible, but in any case - are you
even communicating long enough with a single peer to make rate control
feasible?


Anyway - it seems to me that you're getting ahead of yourself. Shouldn't
you actually have a functioning datapath before worrying about rate
control? And for that you'll need station handling in mac80211, etc.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [RESEND] ath5k: Remove AHB bus support

2014-09-10 Thread Paul Bolle
AHB bus support was added in v2.6.38, through commit a0b907ee2a71
("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 
---
First sent in https://lkml.org/lkml/2013/5/13/303 . Updated on top of
next-20140909.

Build tested only (no access to this hardware).

 drivers/net/wireless/ath/ath5k/Kconfig  |  14 +-
 drivers/net/wireless/ath/ath5k/Makefile |   1 -
 drivers/net/wireless/ath/ath5k/ahb.c| 234 
 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(+), 294 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 c9f81a388f15..93caf8e68901 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 1b3a34f7f224..51e2d8668041 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 79bffe165cab..
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2008-2009 Atheros Communications Inc.
- * Copyright (c) 2009 Gabor Juhos 
- * Copyright (c) 2009 Imre Kaloz 
- *
- * 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 
-#include 
-#include 
-#include 
-#include 
-#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 = dev_get_platdata(&pdev->dev);
-   u16 *eeprom, *eeprom_end;
-
-   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 =

Re: iwlwifi no authentication with AP - Re: pull request: wireless-next 2014-09-08

2014-09-10 Thread Vadim Kochan
Hi,

Your patch works for me.

On Wed, Sep 10, 2014 at 11:24 AM, Emmanuel Grumbach  wrote:
> On Wed, Sep 10, 2014 at 8:01 AM, Oliver Hartkopp  
> wrote:
>> On 10.09.2014 00:07, Vadim Kochan wrote:
>>> I have the same issue with iwlwifi.
>>
>> I tried an old zd1211 wireless USB stick to check if this problem is 80211
>> related. But the USB stick works fine (I'm using it right now).
>> So its definitely looks like an iwlwifi issue.
>>
>>> iwlwifi :02:00.0: fail to flush all tx fifo queues Q 0
>>
>> Wasn't there any change in the iwlwifi tx path recently??
>
> Can you please try the patch attached? It works for me.
>
>>
>> Regards,
>> Oliver
>>
>>>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iwlwifi no authentication with AP - Re: pull request: wireless-next 2014-09-08

2014-09-10 Thread Oliver Hartkopp
Hi all,

yes for me too.

Although I only could test it here with my mobile hotspot which only supports
WEP ... but before that hotspot was not working too.

I'll check with my WPA2 setup again when I'm back home (if it's still needed).

So far feel free to add my

Reported-by: Oliver Hartkopp 
Tested-by: Oliver Hartkopp 

Many thanks for your quick reaction!

Best regards,
Oliver

On 10.09.2014 11:16, Vadim Kochan wrote:
> Hi,
> 
> Your patch works for me.
> 
> On Wed, Sep 10, 2014 at 11:24 AM, Emmanuel Grumbach  
> wrote:
>> On Wed, Sep 10, 2014 at 8:01 AM, Oliver Hartkopp  
>> wrote:
>>> On 10.09.2014 00:07, Vadim Kochan wrote:
 I have the same issue with iwlwifi.
>>>
>>> I tried an old zd1211 wireless USB stick to check if this problem is 80211
>>> related. But the USB stick works fine (I'm using it right now).
>>> So its definitely looks like an iwlwifi issue.
>>>
 iwlwifi :02:00.0: fail to flush all tx fifo queues Q 0
>>>
>>> Wasn't there any change in the iwlwifi tx path recently??
>>
>> Can you please try the patch attached? It works for me.
>>
>>>
>>> Regards,
>>> Oliver
>>>

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 802.11p rate control

2014-09-10 Thread Emmanuel Thierry

Le 10 sept. 2014 à 10:50, Johannes Berg a écrit :

> On Mon, 2014-09-08 at 18:30 +0200, Rostislav Lisovy wrote:
> 
>> If I am not mistaken, it is not possible to live without an in-kernel
>> rate_control algorithm?
>> One interesting idea I got from one colleague is to implement the
>> algorithm logic in the user-space -- kernel would contain just a thin
>> shell controlled from the user-space (via netlink?). This is probably
>> not as insane as it may sound since the purpose of the rate-control
>> algorithm for 802.11p (at least for ITS-G5) is not to "maximize the
>> immediate throughput" but more like "shared medium congestion control",
>> which may require much slower frequency of a control loop.
> 
> I'm not really convinced this is feasible, but in any case - are you
> even communicating long enough with a single peer to make rate control
> feasible?
> 

The way i understand the problem, and as far as it is feasible, the 
rate-control wouldn't be done on the basis of a single peer-to-peer 
communication but globally according to the congestion of the shared media.

Most of messages on such link would be multicast or broadcast, in the typical 
use case where a vehicle/roadside station announces an accident or another 
danger to neighboring listeners. As a consequence, the main purpose of rate 
adaptation in this case would not be to ensure the delivery to a particular 
target, but the delivery to most available targets.


> 
> Anyway - it seems to me that you're getting ahead of yourself. Shouldn't
> you actually have a functioning datapath before worrying about rate
> control? And for that you'll need station handling in mac80211, etc.
> 

I don't know what is the exact status of the patchset in linux wireless. 
However we performed tests on the complete patchset published on github and 
didn't see major problems in terms of packet delivery.

Best regards.
Emmanuel Thierry

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Bastien Nocera
On Tue, 2014-09-09 at 16:10 -0700, Marcel Holtmann wrote:
> Hi Bastien,
> 
>  What specific Baytrail tablet do you have?
> >>> 
> >>> The Onda v975w. It came with Windows 8.1 32-bit.
> >>> 
> >>> I guess that the device is probably a PCI one, but the enumeration is
> >>> done through ACPI instead of "normal" PCI.
> >> 
> >> In 
> >> http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
> >>  someone is specifically looking for an RTL8723BS driver.
> > 
> > That's helpful.
> > 
> >> I will see if my contact at Realtek knows who has worked on drivers for 
> >> this device, and if it would be possible to use rtl8723be if we were to 
> >> supply an SDIO frontend.
> > 
> > I'm not sure why the device doesn't show up in the sysfs tree, but maybe it 
> > needs a driver bound to it to show up.
> 
> I just booted up my Baytrail based Minnowboard Max in ACPI enumeration
> and then the SDIO host controller is enumerated via ACPI. This is
> compared to PCI enumeration where the SDIO controller shows up in
> lspci.
> 
> So can you try to install sdhci-acpi and see if that starts showing
> SDIO devices. If the SDIO host controllers loads, then it start SDIO
> enumeration and you would see the cards.

That was already loaded (thankfully, as it's a dependency of mmc_core,
which drives the builtin storage).

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Bastien Nocera
On Wed, 2014-09-10 at 10:46 +0200, Arend van Spriel wrote:
> On 09/10/14 01:10, Marcel Holtmann wrote:
> > Hi Bastien,
> >
> > What specific Baytrail tablet do you have?
> 
>  The Onda v975w. It came with Windows 8.1 32-bit.
> 
>  I guess that the device is probably a PCI one, but the enumeration is
>  done through ACPI instead of "normal" PCI.
> >>>
> >>> In 
> >>> http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
> >>>  someone is specifically looking for an RTL8723BS driver.
> >>
> >> That's helpful.
> >>
> >>> I will see if my contact at Realtek knows who has worked on drivers for 
> >>> this device, and if it would be possible to use rtl8723be if we were to 
> >>> supply an SDIO frontend.
> >>
> >> I'm not sure why the device doesn't show up in the sysfs tree, but maybe 
> >> it needs a driver bound to it to show up.
> >
> > I just booted up my Baytrail based Minnowboard Max in ACPI enumeration and 
> > then the SDIO host controller is enumerated via ACPI. This is compared to 
> > PCI enumeration where the SDIO controller shows up in lspci.
> >
> > So can you try to install sdhci-acpi and see if that starts showing SDIO 
> > devices. If the SDIO host controllers loads, then it start SDIO enumeration 
> > and you would see the cards.
> 
> You may need to look in /sys/bus/mmc/devices/ instead of sdio.

Indeed. That did the trick.

mmc0:0001 is the builtin storage, mmc1:0001:1 however is an unbound
device with vendor 0x024c and device 0xb723 (modalias:
sdio:c07v024CdB723). More interestingly class is 0x07, which udev
interprets as "WLAN interface".

Cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Arend van Spriel

On 09/10/14 11:50, Bastien Nocera wrote:

On Wed, 2014-09-10 at 10:46 +0200, Arend van Spriel wrote:

On 09/10/14 01:10, Marcel Holtmann wrote:

Hi Bastien,


What specific Baytrail tablet do you have?


The Onda v975w. It came with Windows 8.1 32-bit.

I guess that the device is probably a PCI one, but the enumeration is
done through ACPI instead of "normal" PCI.


In 
http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
 someone is specifically looking for an RTL8723BS driver.


That's helpful.


I will see if my contact at Realtek knows who has worked on drivers for this 
device, and if it would be possible to use rtl8723be if we were to supply an 
SDIO frontend.


I'm not sure why the device doesn't show up in the sysfs tree, but maybe it 
needs a driver bound to it to show up.


I just booted up my Baytrail based Minnowboard Max in ACPI enumeration and then 
the SDIO host controller is enumerated via ACPI. This is compared to PCI 
enumeration where the SDIO controller shows up in lspci.

So can you try to install sdhci-acpi and see if that starts showing SDIO 
devices. If the SDIO host controllers loads, then it start SDIO enumeration and 
you would see the cards.


You may need to look in /sys/bus/mmc/devices/ instead of sdio.


Indeed. That did the trick.

mmc0:0001 is the builtin storage, mmc1:0001:1 however is an unbound
device with vendor 0x024c and device 0xb723 (modalias:
sdio:c07v024CdB723). More interestingly class is 0x07, which udev
interprets as "WLAN interface".


Now you have to find and load the right driver.

Gr. AvS
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/28] Remove ATHEROS_AR231X

2014-09-10 Thread Sergey Ryazanov
2014-09-09 22:27 GMT+04:00, John W. Linville :
> On Fri, Sep 05, 2014 at 04:02:10PM +0400, Sergey Ryazanov wrote:
>> 2014-09-05 15:33 GMT+04:00 Paul Bolle :
>> > Hi Sergey,
>> >
>> > On Fri, 2014-09-05 at 15:12 +0400, Sergey Ryazanov wrote:
>> >> 2014-09-05 14:10 GMT+04:00, Paul Bolle :
>> >> > On Wed, 2014-06-18 at 13:46 +0200, Paul Bolle wrote:
>> >> >> Having this conversation every rc1 is getting a bit silly. Could
>> >> >> Jiri
>> >> >> e.a. perhaps set some specific deadline for ATHEROS_AR231X to be
>> >> >> submitted?
>> >> >
>> >> > I waited until rc3. Have you seen any activity on this front? If
>> >> > not,
>> >> > should I resend the patch that removes the code in mainline that
>> >> > depends
>> >> > on ATHEROS_AR231X (ie, AHB bus support)?
>> >> >
>> >> Recent activity always could be found in [1]. Now I finish another one
>> >> round of cleanups and have a plan to fix several things (you can
>> >> always find something that you really want to improve). But if you
>> >> insist I could immediately switch to "send upstream" mode. And seems
>> >> that this would be better approach.
>> >>
>> >> 1. https://dev.openwrt.org/log/trunk/target/linux/atheros
>> >
>> > And where can the related PULL requests or patch submissions be found?
>> >
>> I have not sent patches yet, since I thought that it would be easier
>> to cleanup them in openwrt tree and then send them upstream.
>
> That excuse has worn a bit thin.  Perhaps Paul should repost his
> removal and you can add a revert to the start of your patch series?
>
As for me, I do not like such flapping, but you have a final say in
this discussion as a maintainer.

-- 
BR,
Sergey
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] mac80211: clear key material when freeing keys

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

When freeing the key, clear the memory to avoid having the
key material stick around in memory "forever".

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 net/mac80211/key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index f320a04..4712150 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -422,7 +422,7 @@ static void ieee80211_key_free_common(struct ieee80211_key 
*key)
ieee80211_aes_key_free(key->u.ccmp.tfm);
if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
-   kfree(key);
+   kzfree(key);
 }
 
 static void __ieee80211_key_destroy(struct ieee80211_key *key,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] cfg80211: clear connect keys when freeing them

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

When freeing the connect keys, clear the memory to avoid
having the key material stick around in memory "forever".

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 net/wireless/ibss.c | 4 ++--
 net/wireless/nl80211.c  | 8 
 net/wireless/sme.c  | 6 +++---
 net/wireless/util.c | 2 +-
 net/wireless/wext-sme.c | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 7b87843..49a70c9 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -115,7 +115,7 @@ static int __cfg80211_join_ibss(struct 
cfg80211_registered_device *rdev,
}
 
if (WARN_ON(wdev->connect_keys))
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = connkeys;
 
wdev->ibss_fixed = params->channel_fixed;
@@ -161,7 +161,7 @@ static void __cfg80211_clear_ibss(struct net_device *dev, 
bool nowext)
 
ASSERT_WDEV_LOCK(wdev);
 
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = NULL;
 
rdev_set_qos_map(rdev, dev, NULL);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f87e335..f4194af 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6938,7 +6938,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct 
genl_info *info)
 
err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys);
if (err)
-   kfree(connkeys);
+   kzfree(connkeys);
return err;
 }
 
@@ -7310,7 +7310,7 @@ static int nl80211_connect(struct sk_buff *skb, struct 
genl_info *info)
 
if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) {
-   kfree(connkeys);
+   kzfree(connkeys);
return -EINVAL;
}
memcpy(&connect.ht_capa,
@@ -7328,7 +7328,7 @@ static int nl80211_connect(struct sk_buff *skb, struct 
genl_info *info)
 
if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) {
if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) {
-   kfree(connkeys);
+   kzfree(connkeys);
return -EINVAL;
}
memcpy(&connect.vht_capa,
@@ -7348,7 +7348,7 @@ static int nl80211_connect(struct sk_buff *skb, struct 
genl_info *info)
err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL);
wdev_unlock(dev->ieee80211_ptr);
if (err)
-   kfree(connkeys);
+   kzfree(connkeys);
return err;
 }
 
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 7fb5063..f365a0c 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -641,7 +641,7 @@ void __cfg80211_connect_result(struct net_device *dev, 
const u8 *bssid,
}
 
if (status != WLAN_STATUS_SUCCESS) {
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = NULL;
wdev->ssid_len = 0;
if (bss) {
@@ -918,7 +918,7 @@ int cfg80211_connect(struct cfg80211_registered_device 
*rdev,
ASSERT_WDEV_LOCK(wdev);
 
if (WARN_ON(wdev->connect_keys)) {
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = NULL;
}
 
@@ -978,7 +978,7 @@ int cfg80211_disconnect(struct cfg80211_registered_device 
*rdev,
 
ASSERT_WDEV_LOCK(wdev);
 
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = NULL;
 
if (wdev->conn)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index a8b2816..5e233a5 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -797,7 +797,7 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
netdev_err(dev, "failed to set mgtdef %d\n", i);
}
 
-   kfree(wdev->connect_keys);
+   kzfree(wdev->connect_keys);
wdev->connect_keys = NULL;
 }
 
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index c7e5c8e..368611c 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -57,7 +57,7 @@ int cfg80211_mgd_wext_connect(struct 
cfg80211_registered_device *rdev,
err = cfg80211_connect(rdev, wdev->netdev,
   &wdev->wext.connect, ck, prev_bssid);
if (err)
-   kfree(ck);
+   kzfree(ck);
 
return err;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] cfg80211: clear wext keys when freeing and removing them

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

When freeing the keys stored for wireless extensions, clear the memory
to avoid having the key material stick around in memory "forever".
Similarly, when userspace overwrites a key, actually clear it instead
of just setting the key length to zero.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 net/wireless/core.c| 2 +-
 net/wireless/wext-compat.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 6030ecc..052870f 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1036,7 +1036,7 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
rdev->devlist_generation++;
cfg80211_mlme_purge_registrations(wdev);
 #ifdef CPTCFG_CFG80211_WEXT
-   kfree(wdev->wext.keys);
+   kzfree(wdev->wext.keys);
 #endif
}
/*
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 11120bb..f067e64 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -496,6 +496,8 @@ static int __cfg80211_set_encryption(struct 
cfg80211_registered_device *rdev,
err = 0;
if (!err) {
if (!addr) {
+   memset(wext->wext.keys->params[idx].data, 0,
+  
sizeof(wext->wext.keys->params[idx].data));
wdev->wext.keys->params[idx].key_len = 0;
wdev->wext.keys->params[idx].cipher = 0;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] cfg80211: clear rekey data on stack

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

Clear the rekey data on the stack to avoid leaving it there
in case another place might leak some stack bytes.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 net/wireless/nl80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f4194af..51eb526 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9062,6 +9062,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, 
struct genl_info *info)
err = rdev_set_rekey_data(rdev, dev, &rekey_data);
  out:
wdev_unlock(wdev);
+   memset(&rekey_data, 0, sizeof(rekey_data));
return err;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: P2P_DEVICE support in Android KitKat

2014-09-10 Thread Jouni Malinen
On Wed, Sep 10, 2014 at 09:30:05AM +0200, Arend van Spriel wrote:
> I am running some tests on a haswell target with Android KitKat
> (3.10.20 kernel). In this configuration our brcmfmac driver is used
> with driver param 'p2p_device=1'. So we end up with wlan0 and
> p2p-dev-wlan0 interfaces (can blame myself for that). The
> configuration has a network configured, but I did not expect
> wpa_supplicant to start association using the p2p device interface.
> The wlan0 interface is already connected to the AP. How can I fix
> this to assure p2p-dev-wlan0 is only used for p2p management
> scenarios.

Hmm.. Can you please show the wpa_supplicant command line that is used
here and describe how that network block gets configured for the
p2p-dev-wlan0 "interface"? I would have expected that there would never
be a configuration with an enabled network block being passed for the
P2P management interface.. Internally, wpa_supplicant should not add
such for P2P groups, but I don't think there is any filtering on
configuration if something is externally trying to make wpa_supplicant
use that management interface for a station mode connection.

-- 
Jouni MalinenPGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] mac80211: set smps_mode according to ap params

2014-09-10 Thread Emmanuel Grumbach
From: Eliad Peller 

Take the requested smps mode from the ap params
(instead of always starting with SMPS_OFF)

Signed-off-by: Eliad Peller 
Signed-off-by: Emmanuel Grumbach 
---
 net/mac80211/cfg.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 101ae6c..fb6a150 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -683,8 +683,19 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (old)
return -EALREADY;
 
-   /* TODO: make hostapd tell us what it wants */
-   sdata->smps_mode = IEEE80211_SMPS_OFF;
+   switch (params->smps_mode) {
+   case NL80211_SMPS_OFF:
+   sdata->smps_mode = IEEE80211_SMPS_OFF;
+   break;
+   case NL80211_SMPS_STATIC:
+   sdata->smps_mode = IEEE80211_SMPS_STATIC;
+   break;
+   case NL80211_SMPS_DYNAMIC:
+   sdata->smps_mode = IEEE80211_SMPS_DYNAMIC;
+   break;
+   default:
+   return -EINVAL;
+   }
sdata->needed_rx_chains = sdata->local->rx_chains;
 
mutex_lock(&local->mtx);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] mac80211: replace SMPS hw flags with wiphy feature bits

2014-09-10 Thread Emmanuel Grumbach
From: Eliad Peller 

Use the new static_smps / dynamic_smps feature bits
instead of mac80211-internal hw flags.

Signed-off-by: Eliad Peller 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/ath/ath10k/mac.c   |  5 +++--
 drivers/net/wireless/iwlegacy/4965-mac.c|  5 ++---
 drivers/net/wireless/iwlwifi/dvm/mac80211.c |  4 ++--
 drivers/net/wireless/iwlwifi/mvm/mac80211.c |  8 
 drivers/net/wireless/mac80211_hwsim.c   |  8 
 include/net/mac80211.h  | 13 +
 net/mac80211/debugfs.c  |  5 -
 net/mac80211/debugfs_netdev.c   |  4 ++--
 net/mac80211/mlme.c |  2 +-
 9 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 9d61bb1..4b5f001 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4759,7 +4759,6 @@ int ath10k_mac_register(struct ath10k *ar)
IEEE80211_HW_MFP_CAPABLE |
IEEE80211_HW_REPORTS_TX_ACK_STATUS |
IEEE80211_HW_HAS_RATE_CONTROL |
-   IEEE80211_HW_SUPPORTS_STATIC_SMPS |
IEEE80211_HW_AP_LINK_PS |
IEEE80211_HW_SPECTRUM_MGMT;
 
@@ -4767,8 +4766,10 @@ int ath10k_mac_register(struct ath10k *ar)
 * bytes is used for padding/alignment if necessary. */
ar->hw->extra_tx_headroom += sizeof(struct htt_data_tx_desc_frag)*2 + 4;
 
+   ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS;
+
if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS)
-   ar->hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS;
+   ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
 
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) {
ar->hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c 
b/drivers/net/wireless/iwlegacy/4965-mac.c
index 3dcbe2c..9f930a0 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -5757,9 +5757,8 @@ il4965_mac_setup_register(struct il_priv *il, u32 
max_probe_length)
IEEE80211_HW_REPORTS_TX_ACK_STATUS | IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
if (il->cfg->sku & IL_SKU_N)
-   hw->flags |=
-   IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
-   IEEE80211_HW_SUPPORTS_STATIC_SMPS;
+   hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS |
+  NL80211_FEATURE_STATIC_SMPS;
 
hw->sta_data_size = sizeof(struct il_station_priv);
hw->vif_data_size = sizeof(struct il_vif_priv);
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index afb98f4..2364a3c 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -125,8 +125,8 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
 */
 
if (priv->nvm_data->sku_cap_11n_enable)
-   hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
-IEEE80211_HW_SUPPORTS_STATIC_SMPS;
+   hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS |
+  NL80211_FEATURE_STATIC_SMPS;
 
/*
 * Enable 11w if advertised by firmware and software crypto
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 7c87965..395fc05 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -301,9 +301,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_TIMING_BEACON_ONLY |
IEEE80211_HW_CONNECTION_MONITOR |
-   IEEE80211_HW_CHANCTX_STA_CSA |
-   IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
-   IEEE80211_HW_SUPPORTS_STATIC_SMPS;
+   IEEE80211_HW_CHANCTX_STA_CSA;
 
hw->queues = mvm->first_agg_queue;
hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
@@ -405,7 +403,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 
hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
   NL80211_FEATURE_LOW_PRIORITY_SCAN |
-  NL80211_FEATURE_P2P_GO_OPPPS;
+  NL80211_FEATURE_P2P_GO_OPPPS |
+  NL80211_FEATURE_DYNAMIC_SMPS |
+  NL80211_FEATURE_STATIC_SMPS;
 
mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
 
diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index 1326f61..babbdc1 100644
--- a/drivers/net/wireless/mac80211_hwsim.c

[PATCH 1/3] cfg80211: allow requesting SMPS mode on ap start

2014-09-10 Thread Emmanuel Grumbach
From: Eliad Peller 

Add feature bits to indicate device support for
static-smps and dynamic-smps modes.

Add a new NL80211_ATTR_SMPS_MODE attribue to allow
configuring the smps mode to be used by the ap
(e.g. configuring to ap to dynamic smps mode will
reduce power consumption while having minor effect
on throughput)

Signed-off-by: Eliad Peller 
Signed-off-by: Emmanuel Grumbach 
---
WARNING: this will probably conflict with other patches I have sent earlier
This is based on your current mac80211-next.
---
 include/net/cfg80211.h   |  2 ++
 include/uapi/linux/nl80211.h | 33 +
 net/wireless/nl80211.c   | 24 
 3 files changed, 59 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0d17ec9..d2aa555 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -664,6 +664,7 @@ struct cfg80211_acl_data {
  * @crypto: crypto settings
  * @privacy: the BSS uses privacy
  * @auth_type: Authentication type (algorithm)
+ * @smps_mode: SMPS mode
  * @inactivity_timeout: time in seconds to determine station's inactivity.
  * @p2p_ctwindow: P2P CT Window
  * @p2p_opp_ps: P2P opportunistic PS
@@ -682,6 +683,7 @@ struct cfg80211_ap_settings {
struct cfg80211_crypto_settings crypto;
bool privacy;
enum nl80211_auth_type auth_type;
+   enum nl80211_smps_mode smps_mode;
int inactivity_timeout;
u8 p2p_ctwindow;
bool p2p_opp_ps;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 29c4399..cca29f7 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1611,6 +1611,9 @@ enum nl80211_commands {
  * drivers to indicate dynack capability. Dynack is automatically disabled
  * setting valid value for coverage class.
  *
+ * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
+ * &enum nl80211_smps_mode.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1957,6 +1960,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_WIPHY_DYN_ACK,
 
+   NL80211_ATTR_SMPS_MODE,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
@@ -4002,6 +4007,13 @@ enum nl80211_ap_sme_features {
  * @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout
  * estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used
  * to enable dynack.
+ * @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial
+ * multiplexing powersave, ie. can turn off all but one chain
+ * even on HT connections that should be using more chains.
+ * @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial
+ * multiplexing powersave, ie. can turn off all but one chain
+ * and then wake the rest up as required after, for example,
+ * rts/cts handshake.
  */
 enum nl80211_feature_flags {
NL80211_FEATURE_SK_TX_STATUS= 1 << 0,
@@ -4028,6 +4040,8 @@ enum nl80211_feature_flags {
NL80211_FEATURE_QUIET   = 1 << 21,
NL80211_FEATURE_TX_POWER_INSERTION  = 1 << 22,
NL80211_FEATURE_ACKTO_ESTIMATION= 1 << 23,
+   NL80211_FEATURE_STATIC_SMPS = 1 << 24,
+   NL80211_FEATURE_DYNAMIC_SMPS= 1 << 25,
 };
 
 /**
@@ -4102,6 +4116,25 @@ enum nl80211_acl_policy {
 };
 
 /**
+ * enum nl80211_smps_mode - SMPS mode
+ *
+ * Requested SMPS mode (for AP mode)
+ *
+ * @NL80211_SMPS_OFF: SMPS off (use all antennas).
+ * @NL80211_SMPS_STATIC: static SMPS (use a single antenna)
+ * @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and
+ * turn on other antennas after CTS/RTS).
+ */
+enum nl80211_smps_mode {
+   NL80211_SMPS_OFF,
+   NL80211_SMPS_STATIC,
+   NL80211_SMPS_DYNAMIC,
+
+   __NL80211_SMPS_AFTER_LAST,
+   NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_radar_event - type of radar event for DFS operation
  *
  * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cf178d2..00ccfb2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -391,6 +391,7 @@ static const struct nla_policy 
nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_IFACE_SOCKET_OWNER] = { .type = NLA_FLAG },
[NL80211_ATTR_CSA_C_OFFSETS_TX] = { .type = NLA_BINARY },
[NL80211_ATTR_USE_RRM] = { .type = NLA_FLAG },
+   [NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
 };
 
 /* policy for the key attributes */
@@ -3339,6 +3340,29 @@ static int nl80211_start_ap(struct sk_buff *skb, struct 
genl_info *info)
return PTR_ERR(params.acl);
}
 
+   if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
+   params.smps_mode =
+   nla_get_u8(info->attrs

Re: [PATCH] ath10k: move fw_crash_dump allocation

2014-09-10 Thread Kalle Valo
Michal Kazior  writes:

> The fw_crash_data was allocated too late. Upon
> early firmware crash, before registering to
> mac80211, it was possible to crash the whole
> system:
>
>  ath10k_pci :00:05.0: device has crashed during init
>  BUG: unable to handle kernel NULL pointer dereference at   (null)

[...]

>  ---[ end Kernel panic - not syncing: Fatal exception in interrupt
>
> To prevent that split debug functions and allocate
> fw_crash_data earlier.
>
> Signed-off-by: Michal Kazior 

Thanks, applied.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: use proper service bitmap size

2014-09-10 Thread Kalle Valo
Michal Kazior  writes:

> On 32bit systems the bitmap was too small and it
> was overwritten partially by the stat completion
> structure. This was visible with 10.2 firmware
> only due to it using a few of the last service
> ids.
>
> Signed-off-by: Michal Kazior 

Thanks, applied.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: ATH10K_DEBUGFS depends on DEBUG_FS

2014-09-10 Thread Kalle Valo
Matteo Croce  writes:

> ATH10K_DEBUGFS must depend on DEBUG_FS, otherwise
> ath10k will generate an invalid pointer on module load
>
> Signed-off-by: Matteo Croce 

Thanks, applied.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Bastien Nocera
On Wed, 2014-09-10 at 12:21 +0200, Arend van Spriel wrote:
> On 09/10/14 11:50, Bastien Nocera wrote:
> > On Wed, 2014-09-10 at 10:46 +0200, Arend van Spriel wrote:
> >> On 09/10/14 01:10, Marcel Holtmann wrote:
> >>> Hi Bastien,
> >>>
> >>> What specific Baytrail tablet do you have?
> >>
> >> The Onda v975w. It came with Windows 8.1 32-bit.
> >>
> >> I guess that the device is probably a PCI one, but the enumeration is
> >> done through ACPI instead of "normal" PCI.
> >
> > In 
> > http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
> >  someone is specifically looking for an RTL8723BS driver.
> 
>  That's helpful.
> 
> > I will see if my contact at Realtek knows who has worked on drivers for 
> > this device, and if it would be possible to use rtl8723be if we were to 
> > supply an SDIO frontend.
> 
>  I'm not sure why the device doesn't show up in the sysfs tree, but maybe 
>  it needs a driver bound to it to show up.
> >>>
> >>> I just booted up my Baytrail based Minnowboard Max in ACPI enumeration 
> >>> and then the SDIO host controller is enumerated via ACPI. This is 
> >>> compared to PCI enumeration where the SDIO controller shows up in lspci.
> >>>
> >>> So can you try to install sdhci-acpi and see if that starts showing SDIO 
> >>> devices. If the SDIO host controllers loads, then it start SDIO 
> >>> enumeration and you would see the cards.
> >>
> >> You may need to look in /sys/bus/mmc/devices/ instead of sdio.
> >
> > Indeed. That did the trick.
> >
> > mmc0:0001 is the builtin storage, mmc1:0001:1 however is an unbound
> > device with vendor 0x024c and device 0xb723 (modalias:
> > sdio:c07v024CdB723). More interestingly class is 0x07, which udev
> > interprets as "WLAN interface".
> 
> Now you have to find and load the right driver.

Right. I'll have to defer to Larry's inquiry about this with Realtek, to
check whether it's the same interface as the PCI RTL8723be.

Cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/28] Remove ATHEROS_AR231X

2014-09-10 Thread Jiri Slaby
On 09/10/2014, 12:33 PM, Sergey Ryazanov wrote:
> 2014-09-09 22:27 GMT+04:00, John W. Linville :
>> On Fri, Sep 05, 2014 at 04:02:10PM +0400, Sergey Ryazanov wrote:
>>> 2014-09-05 15:33 GMT+04:00 Paul Bolle :
 Hi Sergey,

 On Fri, 2014-09-05 at 15:12 +0400, Sergey Ryazanov wrote:
> 2014-09-05 14:10 GMT+04:00, Paul Bolle :
>> On Wed, 2014-06-18 at 13:46 +0200, Paul Bolle wrote:
>>> Having this conversation every rc1 is getting a bit silly. Could
>>> Jiri
>>> e.a. perhaps set some specific deadline for ATHEROS_AR231X to be
>>> submitted?
>>
>> I waited until rc3. Have you seen any activity on this front? If
>> not,
>> should I resend the patch that removes the code in mainline that
>> depends
>> on ATHEROS_AR231X (ie, AHB bus support)?
>>
> Recent activity always could be found in [1]. Now I finish another one
> round of cleanups and have a plan to fix several things (you can
> always find something that you really want to improve). But if you
> insist I could immediately switch to "send upstream" mode. And seems
> that this would be better approach.
>
> 1. https://dev.openwrt.org/log/trunk/target/linux/atheros

 And where can the related PULL requests or patch submissions be found?

>>> I have not sent patches yet, since I thought that it would be easier
>>> to cleanup them in openwrt tree and then send them upstream.
>>
>> That excuse has worn a bit thin.  Perhaps Paul should repost his
>> removal and you can add a revert to the start of your patch series?
>>
> As for me, I do not like such flapping

Agreed in case what you have is in a good enough shape. You (and also
others) can still clean up the code in upstream too. So, if it is
mergeable, send it for upstream inclusion now, otherwise I am all for
John to apply the Paul's patch. The unused code has been a way too long
in the tree now.

thanks,
-- 
js
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cfg80211: clear nl80211 messages carrying keys after processing

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

Clear any nl80211 messages that might contain keys after
processing them to avoid leaving their data in memory
"forever" after they've been freed.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 net/wireless/nl80211.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 51eb526..1dea517 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9587,6 +9587,7 @@ static int nl80211_del_tx_ts(struct sk_buff *skb, struct 
genl_info *info)
 /* If a netdev is associated, it must be UP, P2P must be started */
 #define NL80211_FLAG_NEED_WDEV_UP  (NL80211_FLAG_NEED_WDEV |\
 NL80211_FLAG_CHECK_NETDEV_UP)
+#define NL80211_FLAG_CLEAR_SKB 0x20
 
 static int nl80211_pre_doit(__genl_const struct genl_ops *ops, struct sk_buff 
*skb,
struct genl_info *info)
@@ -9676,8 +9677,20 @@ static void nl80211_post_doit(__genl_const struct 
genl_ops *ops, struct sk_buff
dev_put(info->user_ptr[1]);
}
}
+
if (ops->internal_flags & NL80211_FLAG_NEED_RTNL)
rtnl_unlock();
+
+   /* If needed, clear the netlink message payload from the SKB
+* as it might contain key data that shouldn't stick around on
+* the heap after the SKB is freed. The netlink message header
+* is still needed for further processing, so leave it intact.
+*/
+   if (ops->internal_flags & NL80211_FLAG_CLEAR_SKB) {
+   struct nlmsghdr *nlh = nlmsg_hdr(skb);
+
+   memset(nlmsg_data(nlh), 0, nlmsg_len(nlh));
+   }
 }
 
 static __genl_const struct genl_ops nl80211_ops[] = {
@@ -9745,7 +9758,8 @@ static __genl_const struct genl_ops nl80211_ops[] = {
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
- NL80211_FLAG_NEED_RTNL,
+ NL80211_FLAG_NEED_RTNL |
+ NL80211_FLAG_CLEAR_SKB,
},
{
.cmd = NL80211_CMD_NEW_KEY,
@@ -9753,7 +9767,8 @@ static __genl_const struct genl_ops nl80211_ops[] = {
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
- NL80211_FLAG_NEED_RTNL,
+ NL80211_FLAG_NEED_RTNL |
+ NL80211_FLAG_CLEAR_SKB,
},
{
.cmd = NL80211_CMD_DEL_KEY,
@@ -9931,7 +9946,8 @@ static __genl_const struct genl_ops nl80211_ops[] = {
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
- NL80211_FLAG_NEED_RTNL,
+ NL80211_FLAG_NEED_RTNL |
+ NL80211_FLAG_CLEAR_SKB,
},
{
.cmd = NL80211_CMD_ASSOCIATE,
@@ -10165,7 +10181,8 @@ static __genl_const struct genl_ops nl80211_ops[] = {
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
- NL80211_FLAG_NEED_RTNL,
+ NL80211_FLAG_NEED_RTNL |
+ NL80211_FLAG_CLEAR_SKB,
},
{
.cmd = NL80211_CMD_TDLS_MGMT,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/28] Remove ATHEROS_AR231X

2014-09-10 Thread Sergey Ryazanov
2014-09-10 15:36 GMT+04:00, Jiri Slaby :
> On 09/10/2014, 12:33 PM, Sergey Ryazanov wrote:
>> 2014-09-09 22:27 GMT+04:00, John W. Linville :
>>> On Fri, Sep 05, 2014 at 04:02:10PM +0400, Sergey Ryazanov wrote:
 2014-09-05 15:33 GMT+04:00 Paul Bolle :
> Hi Sergey,
>
> On Fri, 2014-09-05 at 15:12 +0400, Sergey Ryazanov wrote:
>> 2014-09-05 14:10 GMT+04:00, Paul Bolle :
>>> On Wed, 2014-06-18 at 13:46 +0200, Paul Bolle wrote:
 Having this conversation every rc1 is getting a bit silly. Could
 Jiri
 e.a. perhaps set some specific deadline for ATHEROS_AR231X to be
 submitted?
>>>
>>> I waited until rc3. Have you seen any activity on this front? If
>>> not,
>>> should I resend the patch that removes the code in mainline that
>>> depends
>>> on ATHEROS_AR231X (ie, AHB bus support)?
>>>
>> Recent activity always could be found in [1]. Now I finish another
>> one
>> round of cleanups and have a plan to fix several things (you can
>> always find something that you really want to improve). But if you
>> insist I could immediately switch to "send upstream" mode. And seems
>> that this would be better approach.
>>
>> 1. https://dev.openwrt.org/log/trunk/target/linux/atheros
>
> And where can the related PULL requests or patch submissions be found?
>
 I have not sent patches yet, since I thought that it would be easier
 to cleanup them in openwrt tree and then send them upstream.
>>>
>>> That excuse has worn a bit thin.  Perhaps Paul should repost his
>>> removal and you can add a revert to the start of your patch series?
>>>
>> As for me, I do not like such flapping
>
> Agreed in case what you have is in a good enough shape. You (and also
> others) can still clean up the code in upstream too. So, if it is
> mergeable, send it for upstream inclusion now, otherwise I am all for
> John to apply the Paul's patch.

Two days is the last deadline :)

> The unused code has been a way too long
> in the tree now.

Code actively used in owrt firmware and its forks.

-- 
BR,
Sergey
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/22] wil6210 patches

2014-09-10 Thread Vladimir Kondratiev
Really big item is firmware download. It is still
experimental, and there is no firmware ready for
public release yet; but we are getting close.

Another item worth mentioning is provisioning for
platform specific code.

The rest is bug fixes and small improvements

Dedy Lansky (6):
  wil6210: fix for memory corruption while insmod
  wil6210: fix for memory corruption upon rmmod
  wil6210: fix race condition of disconnect while BACK event
  wil6210: modify confusing printout
  wil6210: fix race condition between BACK event and Rx data
  wil6210: introduce separate completion for WMI

Vladimir Kondratiev (16):
  wil6210: firmware download
  wil6210: debug prints for vring de-allocation
  wil6210: print more information when connecting
  wil6210: some more debug for the WMI mechanism
  wil6210: coding style fixes
  wil6210: platform specific module
  wil6210: add more debug printouts
  wil6210: fix usage of print_hex_dump_debug
  wil6210: send connect request IEs to FW also for non-secure connection
  wil6210: add change_beacon() driver callback
  wil6210: enlarge TX/RX buffer length
  wil6210: specify max. IE length
  wil6210: fix typo in comment
  wil6210: rename [en|dis]able irq to [un]mask
  wil6210: fix for oops while stopping interface
  wil6210: fix PTR_ERR() usage after initialization to constant

 drivers/net/wireless/ath/wil6210/Kconfig   |   9 +
 drivers/net/wireless/ath/wil6210/Makefile  |   3 +
 drivers/net/wireless/ath/wil6210/cfg80211.c| 126 --
 drivers/net/wireless/ath/wil6210/debugfs.c |  60 ++-
 drivers/net/wireless/ath/wil6210/fw.c  |  45 ++
 drivers/net/wireless/ath/wil6210/fw.h  | 149 +++
 drivers/net/wireless/ath/wil6210/fw_inc.c  | 495 +
 drivers/net/wireless/ath/wil6210/interrupt.c   |  31 +-
 drivers/net/wireless/ath/wil6210/main.c| 185 +---
 drivers/net/wireless/ath/wil6210/netdev.c  |  17 +-
 drivers/net/wireless/ath/wil6210/pcie_bus.c|  39 +-
 drivers/net/wireless/ath/wil6210/rx_reorder.c  |  13 +-
 drivers/net/wireless/ath/wil6210/txrx.c|  66 ++-
 drivers/net/wireless/ath/wil6210/txrx.h|   9 +-
 drivers/net/wireless/ath/wil6210/wil6210.h |  43 +-
 drivers/net/wireless/ath/wil6210/wil_platform.c|  49 ++
 drivers/net/wireless/ath/wil6210/wil_platform.h|  34 ++
 .../net/wireless/ath/wil6210/wil_platform_msm.c| 257 +++
 .../net/wireless/ath/wil6210/wil_platform_msm.h|  24 +
 drivers/net/wireless/ath/wil6210/wmi.c |  40 +-
 drivers/net/wireless/ath/wil6210/wmi.h |  18 +-
 21 files changed, 1540 insertions(+), 172 deletions(-)
 create mode 100644 drivers/net/wireless/ath/wil6210/fw.c
 create mode 100644 drivers/net/wireless/ath/wil6210/fw.h
 create mode 100644 drivers/net/wireless/ath/wil6210/fw_inc.c
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform.c
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform.h
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.c
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.h

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] wil6210: fix usage of print_hex_dump_debug

2014-09-10 Thread Vladimir Kondratiev
When CONFIG_DYNAMIC_DEBUG is not defined, print_hex_dump_debug
is mapped directly to print_hex_dump which might cause
printout to exist all the time

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/wil6210.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index d2e710e..e51531b 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -468,6 +468,7 @@ int wil_info(struct wil6210_priv *wil, const char *fmt, 
...);
 #define wil_dbg_wmi(wil, fmt, arg...) wil_dbg(wil, "DBG[ WMI]" fmt, ##arg)
 #define wil_dbg_misc(wil, fmt, arg...) wil_dbg(wil, "DBG[MISC]" fmt, ##arg)
 
+#if defined(CONFIG_DYNAMIC_DEBUG)
 #define wil_hex_dump_txrx(prefix_str, prefix_type, rowsize,\
  groupsize, buf, len, ascii)   \
  print_hex_dump_debug("DBG[TXRX]" prefix_str,\
@@ -479,6 +480,12 @@ int wil_info(struct wil6210_priv *wil, const char *fmt, 
...);
 print_hex_dump_debug("DBG[ WMI]" prefix_str,\
prefix_type, rowsize,   \
groupsize, buf, len, ascii)
+#else
+#define wil_hex_dump_txrx(prefix_str, prefix_type, rowsize,\
+ groupsize, buf, len, ascii)
+#define wil_hex_dump_wmi(prefix_str, prefix_type, rowsize, \
+groupsize, buf, len, ascii)
+#endif
 
 void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src,
  size_t count);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/22] wil6210: fix typo in comment

2014-09-10 Thread Vladimir Kondratiev
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/interrupt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index 58ddcc9..7d319d9 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -506,7 +506,8 @@ free0:
 
return rc;
 }
-/* can't use wil_ioread32_and_clear because ICC value is not ser yet */
+
+/* can't use wil_ioread32_and_clear because ICC value is not set yet */
 static inline void wil_clear32(void __iomem *addr)
 {
u32 x = ioread32(addr);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/22] wil6210: fix PTR_ERR() usage after initialization to constant

2014-09-10 Thread Vladimir Kondratiev
Reported by coccinelle:

tree:   
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
head:   6a5d088a923854569e20eac4f3f569926d5911ec
commit: b7cde47009640b88cb3629ee7078a43bc2642459 [18/80] wil6210: convert 
debugfs to the table mode

coccinelle warnings: (new ones prefixed by >>)

>> drivers/net/wireless/ath/wil6210/debugfs.c:327:17-24: ERROR: PTR_ERR applied 
>> after initialization to constant on line 304

vim +327 drivers/net/wireless/ath/wil6210/debugfs.c

   298  struct dentry *dbg, void *base,
   299  const struct dbg_off * const 
tbl)
   300  {
   301  int i;
   302
   303  for (i = 0; tbl[i].name; i++) {

 > 304  struct dentry *f = NULL;
   305
   306  switch (tbl[i].type) {
   307  case doff_u32:
   308  f = debugfs_create_u32(tbl[i].name, 
tbl[i].mode, dbg,
   309 base + tbl[i].off);
   310  break;
   311  case doff_x32:
   312  f = debugfs_create_x32(tbl[i].name, 
tbl[i].mode, dbg,
   313 base + tbl[i].off);
   314  break;
   315  case doff_ulong:
   316  f = wil_debugfs_create_ulong(tbl[i].name, 
tbl[i].mode,
   317   dbg, base + 
tbl[i].off);
   318  break;
   319  case doff_io32:
   320  f = wil_debugfs_create_iomem_x32(tbl[i].name,
   321   tbl[i].mode, 
dbg,
   322   base + 
tbl[i].off);
   323  break;
   324  }
   325  if (IS_ERR_OR_NULL(f))
   326  wil_err(wil, "Create file \"%s\": err %ld\n",

 > 327  tbl[i].name, PTR_ERR(f));
   328  }
   329  }
   330

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 21dc437..eb2204e 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -308,7 +308,7 @@ static void wil6210_debugfs_init_offset(struct wil6210_priv 
*wil,
int i;
 
for (i = 0; tbl[i].name; i++) {
-   struct dentry *f = NULL;
+   struct dentry *f;
 
switch (tbl[i].type) {
case doff_u32:
@@ -328,6 +328,8 @@ static void wil6210_debugfs_init_offset(struct wil6210_priv 
*wil,
 tbl[i].mode, dbg,
 base + tbl[i].off);
break;
+   default:
+   f = ERR_PTR(-EINVAL);
}
if (IS_ERR_OR_NULL(f))
wil_err(wil, "Create file \"%s\": err %ld\n",
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/22] wil6210: fix race condition of disconnect while BACK event

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

This race condition was causing double free of tid_ampdu_rx structures

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/wmi.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index 97909f0..c71657b 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -597,16 +597,18 @@ static void wmi_evt_ba_status(struct wil6210_priv *wil, 
int id, void *d,
return;
}
 
+   mutex_lock(&wil->mutex);
+
cid = wil->vring2cid_tid[evt->ringid][0];
if (cid >= WIL6210_MAX_CID) {
wil_err(wil, "invalid CID %d for vring %d\n", cid, evt->ringid);
-   return;
+   goto out;
}
 
sta = &wil->sta[cid];
if (sta->status == wil_sta_unused) {
wil_err(wil, "CID %d unused\n", cid);
-   return;
+   goto out;
}
 
wil_dbg_wmi(wil, "BACK for CID %d %pM\n", cid, sta->addr);
@@ -618,6 +620,9 @@ static void wmi_evt_ba_status(struct wil6210_priv *wil, int 
id, void *d,
sta->tid_rx[i] = wil_tid_ampdu_rx_alloc(wil,
evt->agg_wsize, 0);
}
+
+out:
+   mutex_unlock(&wil->mutex);
 }
 
 static const struct {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/22] wil6210: fix for oops while stopping interface

2014-09-10 Thread Vladimir Kondratiev
When interface stopped while running intensive Rx traffic, the following oops
observed:

[89846.734683] Call trace:
[89846.737117] [] dev_gro_receive+0xac/0x358
[89846.742674] [] napi_gro_receive+0x24/0xa4
[89846.748251] [] $x+0xec/0x1f8 [wil6210] 
wil_netif_rx_any
[89846.753547] [] $x+0x34/0x54 [wil6210]  
wil_release_reorder_frame
[89846.758755] [] wil_release_reorder_frames+0x5c/0x78 
[wil6210]
[89846.766044] [] wil_tid_ampdu_rx_free+0x20/0x48 [wil6210]
[89846.772901] [] $x+0x190/0x1e8 [wil6210]
[89846.778285] [] wmi_event_worker+0x230/0x2f8 [wil6210]
[89846.784865] [] process_one_work+0x278/0x3fc
[89846.790591] [] worker_thread+0x200/0x330
[89846.796060] [] kthread+0xac/0xb8
[89846.800836] Code: b940c661 f9406a62 8b010041 f9400026 (f8636882)
[89846.807008] ---[ end trace d6fdc17cd27d18f6 ]---

Reason is the following: when removing Rx vring
(wil_netdev_ops.ndo_stop -> wil_stop -> wil_down -> __wil_down -> wil_rx_fini),
Rx interrupt occurs. It trigger Rx NAPI, calling wil_rx_handle() that reaps
(already cleaned) buffer, causing skb referring to garbage memory being set 
into reorder buffer.
Then, network stack trying to access this buffer and fails.

Prevent Rx NAPI from being scheduled if device going to stop. Bit 
wil_status_napi_en reflects
NAPI enablement state, check it when triggering Rx NAPI.

Testing shows that check for wil_status_napi_en sometimes gets negative, and 
new error message
get printed - in this case kernel oops would be observed. Original oops is no 
more reproducible.

This change requires also changes in the AP flows.
Properly enable/disable NAPI for the AP. Make sure Rx VRING is disabled
when resetting target.

For this, promote __wil_up() and __wil_down() to the module scope, and use it
in the relevant flows.

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c  | 19 ---
 drivers/net/wireless/ath/wil6210/interrupt.c |  9 +++--
 drivers/net/wireless/ath/wil6210/main.c  | 25 +
 drivers/net/wireless/ath/wil6210/pcie_bus.c  | 23 +++
 drivers/net/wireless/ath/wil6210/wil6210.h   |  4 
 5 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 6119ecb..f3a31e8 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -730,12 +730,8 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
 
mutex_lock(&wil->mutex);
 
-   rc = wil_reset(wil);
-   if (rc)
-   goto out;
-
-   /* Rx VRING. */
-   rc = wil_rx_init(wil);
+   __wil_down(wil);
+   rc = __wil_up(wil);
if (rc)
goto out;
 
@@ -743,9 +739,6 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
if (rc)
goto out;
 
-   /* MAC address - pre-requisite for other commands */
-   wmi_set_mac_address(wil, ndev->dev_addr);
-
/* IE's */
/* bcon 'head IE's are not relevant for 60g band */
/*
@@ -777,7 +770,7 @@ out:
 static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
struct net_device *ndev)
 {
-   int rc = 0;
+   int rc, rc1;
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
 
wil_dbg_misc(wil, "%s()\n", __func__);
@@ -786,8 +779,12 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
 
rc = wmi_pcp_stop(wil);
 
+   __wil_down(wil);
+   rc1 = __wil_up(wil);
+
mutex_unlock(&wil->mutex);
-   return rc;
+
+   return min(rc, rc1);
 }
 
 static int wil_cfg80211_del_station(struct wiphy *wiphy,
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index d265e7c..7269bac 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -196,8 +196,13 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
wil_dbg_irq(wil, "RX done\n");
isr &= ~BIT_DMA_EP_RX_ICR_RX_DONE;
if (test_bit(wil_status_reset_done, &wil->status)) {
-   wil_dbg_txrx(wil, "NAPI(Rx) schedule\n");
-   napi_schedule(&wil->napi_rx);
+   if (test_bit(wil_status_napi_en, &wil->status)) {
+   wil_dbg_txrx(wil, "NAPI(Rx) schedule\n");
+   napi_schedule(&wil->napi_rx);
+   } else {
+   wil_err(wil, "Got Rx interrupt while "
+   "stopping interface\n");
+   }
} else {
wil_err(wil, "Got Rx interrupt while in reset\n");
}
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 8443d82..21667e0 100644
--- a/drivers/net/wireless/ath/wil6210

[PATCH 06/22] wil6210: platform specific module

2014-09-10 Thread Vladimir Kondratiev
New module (wil_platform) for handling platform specific tasks

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/Kconfig   |   9 +
 drivers/net/wireless/ath/wil6210/Makefile  |   2 +
 drivers/net/wireless/ath/wil6210/main.c|   7 +
 drivers/net/wireless/ath/wil6210/pcie_bus.c|   8 +
 drivers/net/wireless/ath/wil6210/wil6210.h |   7 +
 drivers/net/wireless/ath/wil6210/wil_platform.c|  49 
 drivers/net/wireless/ath/wil6210/wil_platform.h|  34 +++
 .../net/wireless/ath/wil6210/wil_platform_msm.c| 257 +
 .../net/wireless/ath/wil6210/wil_platform_msm.h|  24 ++
 9 files changed, 397 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform.c
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform.h
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.c
 create mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.h

diff --git a/drivers/net/wireless/ath/wil6210/Kconfig 
b/drivers/net/wireless/ath/wil6210/Kconfig
index ce8c038..481680a 100644
--- a/drivers/net/wireless/ath/wil6210/Kconfig
+++ b/drivers/net/wireless/ath/wil6210/Kconfig
@@ -39,3 +39,12 @@ config WIL6210_TRACING
  option if you are interested in debugging the driver.
 
  If unsure, say Y to make it easier to debug problems.
+
+config WIL6210_PLATFORM_MSM
+   bool "wil6210 MSM platform specific support"
+   depends on WIL6210
+   depends on ARCH_MSM
+   default y
+   ---help---
+ Say Y here to enable wil6210 driver support for MSM
+ platform specific features
diff --git a/drivers/net/wireless/ath/wil6210/Makefile 
b/drivers/net/wireless/ath/wil6210/Makefile
index dc788a1..a471d74 100644
--- a/drivers/net/wireless/ath/wil6210/Makefile
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -12,6 +12,8 @@ wil6210-y += debug.o
 wil6210-y += rx_reorder.o
 wil6210-y += fw.o
 wil6210-$(CONFIG_WIL6210_TRACING) += trace.o
+wil6210-y += wil_platform.o
+wil6210-$(CONFIG_WIL6210_PLATFORM_MSM) += wil_platform_msm.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 4a884b4..8afd8a2 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -603,6 +603,10 @@ static int __wil_up(struct wil6210_priv *wil)
napi_enable(&wil->napi_tx);
set_bit(wil_status_napi_en, &wil->status);
 
+   if (wil->platform_ops.bus_request)
+   wil->platform_ops.bus_request(wil->platform_handle,
+ WIL_MAX_BUS_REQUEST_KBPS);
+
return 0;
 }
 
@@ -621,6 +625,9 @@ static int __wil_down(struct wil6210_priv *wil)
 {
WARN_ON(!mutex_is_locked(&wil->mutex));
 
+   if (wil->platform_ops.bus_request)
+   wil->platform_ops.bus_request(wil->platform_handle, 0);
+
clear_bit(wil_status_napi_en, &wil->status);
napi_disable(&wil->napi_rx);
napi_disable(&wil->napi_tx);
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c 
b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index 38dcbea..968f0d6 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -180,6 +180,10 @@ static int wil_pcie_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
wil->board = board;
 
wil6210_clear_irq(wil);
+
+   wil->platform_handle =
+   wil_platform_init(&pdev->dev, &wil->platform_ops);
+
/* FW should raise IRQ when ready */
rc = wil_if_pcie_enable(wil);
if (rc) {
@@ -204,6 +208,8 @@ static int wil_pcie_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
  bus_disable:
wil_if_pcie_disable(wil);
  if_free:
+   if (wil->platform_ops.uninit)
+   wil->platform_ops.uninit(wil->platform_handle);
wil_if_free(wil);
  err_iounmap:
pci_iounmap(pdev, csr);
@@ -223,6 +229,8 @@ static void wil_pcie_remove(struct pci_dev *pdev)
wil6210_debugfs_remove(wil);
wil_if_pcie_disable(wil);
wil_if_remove(wil);
+   if (wil->platform_ops.uninit)
+   wil->platform_ops.uninit(wil->platform_handle);
wil_if_free(wil);
pci_iounmap(pdev, csr);
pci_release_region(pdev, 0);
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 5f20fab..d2e710e 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -21,10 +21,14 @@
 #include 
 #include 
 #include 
+#include "wil_platform.h"
+
 
 #define WIL_NAME "wil6210"
 #define WIL_FW_NAME "wil6210.fw"
 
+#define WIL_MAX_BUS_REQUEST_KBPS 80 /* ~6.1Gbps */
+
 struct wil_board {
int board;
 #define WIL_BOARD_MARLON   (1)
@@ -437,6 +441,9 @@ struct

[PATCH 20/22] wil6210: rename [en|dis]able irq to [un]mask

2014-09-10 Thread Vladimir Kondratiev
To better reflect real action performed, rename:
s/wil6210_disable_irq/wil_mask_irq/
s/wil6210_enable_irq/wil_unmask_irq/

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/interrupt.c | 6 +++---
 drivers/net/wireless/ath/wil6210/main.c  | 4 ++--
 drivers/net/wireless/ath/wil6210/wil6210.h   | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index 7d319d9..d265e7c 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -135,7 +135,7 @@ static void wil6210_unmask_irq_pseudo(struct wil6210_priv 
*wil)
  HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW));
 }
 
-void wil6210_disable_irq(struct wil6210_priv *wil)
+void wil_mask_irq(struct wil6210_priv *wil)
 {
wil_dbg_irq(wil, "%s()\n", __func__);
 
@@ -145,7 +145,7 @@ void wil6210_disable_irq(struct wil6210_priv *wil)
wil6210_mask_irq_pseudo(wil);
 }
 
-void wil6210_enable_irq(struct wil6210_priv *wil)
+void wil_unmask_irq(struct wil6210_priv *wil)
 {
wil_dbg_irq(wil, "%s()\n", __func__);
 
@@ -546,7 +546,7 @@ void wil6210_fini_irq(struct wil6210_priv *wil, int irq)
 {
wil_dbg_misc(wil, "%s()\n", __func__);
 
-   wil6210_disable_irq(wil);
+   wil_mask_irq(wil);
free_irq(irq, wil);
if (wil->n_msi == 3) {
free_irq(irq + 1, wil);
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 0857853..8443d82 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -496,7 +496,7 @@ int wil_reset(struct wil6210_priv *wil)
wil->scan_request = NULL;
}
 
-   wil6210_disable_irq(wil);
+   wil_mask_irq(wil);
 
wmi_event_flush(wil);
 
@@ -539,7 +539,7 @@ int wil_reset(struct wil6210_priv *wil)
reinit_completion(&wil->wmi_ready);
reinit_completion(&wil->wmi_call);
 
-   wil6210_enable_irq(wil);
+   wil_unmask_irq(wil);
 
/* we just started MAC, wait for FW ready */
rc = wil_wait_for_fw_ready(wil);
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index f8f9988..a540781 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -532,8 +532,8 @@ int wmi_disconnect_sta(struct wil6210_priv *wil, const u8 
*mac, u16 reason);
 void wil6210_clear_irq(struct wil6210_priv *wil);
 int wil6210_init_irq(struct wil6210_priv *wil, int irq);
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq);
-void wil6210_disable_irq(struct wil6210_priv *wil);
-void wil6210_enable_irq(struct wil6210_priv *wil);
+void wil_mask_irq(struct wil6210_priv *wil);
+void wil_unmask_irq(struct wil6210_priv *wil);
 int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 struct cfg80211_mgmt_tx_params *params,
 u64 *cookie);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/22] wil6210: firmware download

2014-09-10 Thread Vladimir Kondratiev
Firmware download implemented but is still experimental feature;
flag controlling it added, no_fw_load. It is true by default,
use no_fw_load=N to activate feature.

Reset flows also got some adjustment for the fw download to work

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/Makefile|   1 +
 drivers/net/wireless/ath/wil6210/fw.c|  45 +++
 drivers/net/wireless/ath/wil6210/fw.h| 149 
 drivers/net/wireless/ath/wil6210/fw_inc.c| 495 +++
 drivers/net/wireless/ath/wil6210/interrupt.c |   1 +
 drivers/net/wireless/ath/wil6210/main.c  |  93 +++--
 drivers/net/wireless/ath/wil6210/wil6210.h   |  12 +
 7 files changed, 764 insertions(+), 32 deletions(-)
 create mode 100644 drivers/net/wireless/ath/wil6210/fw.c
 create mode 100644 drivers/net/wireless/ath/wil6210/fw.h
 create mode 100644 drivers/net/wireless/ath/wil6210/fw_inc.c

diff --git a/drivers/net/wireless/ath/wil6210/Makefile 
b/drivers/net/wireless/ath/wil6210/Makefile
index c7a3465..dc788a1 100644
--- a/drivers/net/wireless/ath/wil6210/Makefile
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -10,6 +10,7 @@ wil6210-y += interrupt.o
 wil6210-y += txrx.o
 wil6210-y += debug.o
 wil6210-y += rx_reorder.o
+wil6210-y += fw.o
 wil6210-$(CONFIG_WIL6210_TRACING) += trace.o
 
 # for tracing framework to find trace.h
diff --git a/drivers/net/wireless/ath/wil6210/fw.c 
b/drivers/net/wireless/ath/wil6210/fw.c
new file mode 100644
index 000..8c6f3b0
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/fw.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014 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 
+#include 
+#include 
+#include 
+#include "wil6210.h"
+#include "fw.h"
+
+MODULE_FIRMWARE(WIL_FW_NAME);
+
+/* target operations */
+/* register read */
+#define R(a) ioread32(wil->csr + HOSTADDR(a))
+/* register write. wmb() to make sure it is completed */
+#define W(a, v) do { iowrite32(v, wil->csr + HOSTADDR(a)); wmb(); } while (0)
+/* register set = read, OR, write */
+#define S(a, v) W(a, R(a) | v)
+/* register clear = read, AND with inverted, write */
+#define C(a, v) W(a, R(a) & ~v)
+
+static
+void wil_memset_toio_32(volatile void __iomem *dst, u32 val,
+   size_t count)
+{
+   volatile u32 __iomem *d = dst;
+
+   for (count += 4; count > 4; count -= 4)
+   __raw_writel(val, d++);
+}
+
+#include "fw_inc.c"
diff --git a/drivers/net/wireless/ath/wil6210/fw.h 
b/drivers/net/wireless/ath/wil6210/fw.h
new file mode 100644
index 000..7a2c6c1
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/fw.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+#define WIL_FW_SIGNATURE (0x36323130) /* '0126' */
+#define WIL_FW_FMT_VERSION (1) /* format version driver supports */
+
+enum wil_fw_record_type {
+   wil_fw_type_comment = 1,
+   wil_fw_type_data = 2,
+   wil_fw_type_fill = 3,
+   wil_fw_type_action = 4,
+   wil_fw_type_verify = 5,
+   wil_fw_type_file_header = 6,
+   wil_fw_type_direct_write = 7,
+   wil_fw_type_gateway_data = 8,
+   wil_fw_type_gateway_data4 = 9,
+};
+
+struct wil_fw_record_head {
+   __le16 type; /* enum wil_fw_record_type */
+   __le16 flags; /* to be defined */
+   __le32 size; /* whole record, bytes after head */
+} __packed;
+
+/* data block. write starting from @addr
+ * data_size inferred from the @head.size. For this case,
+ * data_size = @head.size - offsetof(struct wil_fw_record_data, data)
+ 

[PATCH 15/22] wil6210: add change_beacon() driver callback

2014-09-10 Thread Vladimir Kondratiev
This allows updating IEs (e.g. from hostapd) when AP is already started

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 40 +
 1 file changed, 40 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index c1ff330..61eaf20 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -640,6 +640,45 @@ static int wil_fix_bcon(struct wil6210_priv *wil,
return rc;
 }
 
+static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
+ struct net_device *ndev,
+ struct cfg80211_beacon_data *bcon)
+{
+   struct wil6210_priv *wil = wiphy_to_wil(wiphy);
+   int rc;
+
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
+   if (wil_fix_bcon(wil, bcon)) {
+   wil_dbg_misc(wil, "Fixed bcon\n");
+   wil_print_bcon_data(bcon);
+   }
+
+   /* FW do not form regular beacon, so bcon IE's are not set
+* For the DMG bcon, when it will be supported, bcon IE's will
+* be reused; add something like:
+* wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
+* bcon->beacon_ies);
+*/
+   rc = wmi_set_ie(wil, WMI_FRAME_PROBE_RESP,
+   bcon->proberesp_ies_len,
+   bcon->proberesp_ies);
+   if (rc) {
+   wil_err(wil, "set_ie(PROBE_RESP) failed\n");
+   return rc;
+   }
+
+   rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP,
+   bcon->assocresp_ies_len,
+   bcon->assocresp_ies);
+   if (rc) {
+   wil_err(wil, "set_ie(ASSOC_RESP) failed\n");
+   return rc;
+   }
+
+   return 0;
+}
+
 static int wil_cfg80211_start_ap(struct wiphy *wiphy,
 struct net_device *ndev,
 struct cfg80211_ap_settings *info)
@@ -764,6 +803,7 @@ static struct cfg80211_ops wil_cfg80211_ops = {
.del_key = wil_cfg80211_del_key,
.set_default_key = wil_cfg80211_set_default_key,
/* AP mode */
+   .change_beacon = wil_cfg80211_change_beacon,
.start_ap = wil_cfg80211_start_ap,
.stop_ap = wil_cfg80211_stop_ap,
.del_station = wil_cfg80211_del_station,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/22] wil6210: some more debug for the WMI mechanism

2014-09-10 Thread Vladimir Kondratiev
Log worker thread start/stop; as well as every handler invocation

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/wmi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index b1aaaee..490c278 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -1128,6 +1128,9 @@ static void wmi_event_handle(struct wil6210_priv *wil,
struct wil6210_mbox_hdr_wmi *wmi = (void *)(&hdr[1]);
void *evt_data = (void *)(&wmi[1]);
u16 id = le16_to_cpu(wmi->id);
+
+   wil_dbg_wmi(wil, "Handle WMI 0x%04x (reply_id 0x%04x)\n",
+   id, wil->reply_id);
/* check if someone waits for this event */
if (wil->reply_id && wil->reply_id == id) {
if (wil->reply_buf) {
@@ -1184,9 +1187,11 @@ void wmi_event_worker(struct work_struct *work)
struct pending_wmi_event *evt;
struct list_head *lh;
 
+   wil_dbg_wmi(wil, "Start %s\n", __func__);
while ((lh = next_wmi_ev(wil)) != NULL) {
evt = list_entry(lh, struct pending_wmi_event, list);
wmi_event_handle(wil, &evt->event.hdr);
kfree(evt);
}
+   wil_dbg_wmi(wil, "Finished %s\n", __func__);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/22] wil6210: add more debug printouts

2014-09-10 Thread Vladimir Kondratiev
added misc printouts in some init/uninit functions for better traceability

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c  |  8 ++--
 drivers/net/wireless/ath/wil6210/interrupt.c |  5 +
 drivers/net/wireless/ath/wil6210/main.c  | 10 ++
 drivers/net/wireless/ath/wil6210/netdev.c| 12 
 drivers/net/wireless/ath/wil6210/pcie_bus.c  |  6 ++
 drivers/net/wireless/ath/wil6210/txrx.c  | 10 ++
 6 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index cba04e5..c8c9852 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -782,8 +782,8 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 */
wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
-   dev_warn(wiphy_dev(wiphy), "%s : flags = 0x%08x\n",
-__func__, wiphy->flags);
+   dev_dbg(wiphy_dev(wiphy), "%s : flags = 0x%08x\n",
+   __func__, wiphy->flags);
wiphy->probe_resp_offload =
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
@@ -804,6 +804,8 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev)
int rc = 0;
struct wireless_dev *wdev;
 
+   dev_dbg(dev, "%s()\n", __func__);
+
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
return ERR_PTR(-ENOMEM);
@@ -836,6 +838,8 @@ void wil_wdev_free(struct wil6210_priv *wil)
 {
struct wireless_dev *wdev = wil_to_wdev(wil);
 
+   dev_dbg(wil_to_dev(wil), "%s()\n", __func__);
+
if (!wdev)
return;
 
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index 6411651..331d0dc 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -528,6 +528,9 @@ void wil6210_clear_irq(struct wil6210_priv *wil)
 int wil6210_init_irq(struct wil6210_priv *wil, int irq)
 {
int rc;
+
+   wil_dbg_misc(wil, "%s() n_msi=%d\n", __func__, wil->n_msi);
+
if (wil->n_msi == 3)
rc = wil6210_request_3msi(wil, irq);
else
@@ -545,6 +548,8 @@ int wil6210_init_irq(struct wil6210_priv *wil, int irq)
 
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq)
 {
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
wil6210_disable_irq(wil);
free_irq(irq, wil);
if (wil->n_msi == 3) {
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 8afd8a2..696be3e 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -301,12 +301,16 @@ int wil_priv_init(struct wil6210_priv *wil)
 
 void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid)
 {
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
del_timer_sync(&wil->connect_timer);
_wil6210_disconnect(wil, bssid);
 }
 
 void wil_priv_deinit(struct wil6210_priv *wil)
 {
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
del_timer_sync(&wil->scan_timer);
cancel_work_sync(&wil->disconnect_worker);
cancel_work_sync(&wil->fw_error_worker);
@@ -457,6 +461,8 @@ int wil_reset(struct wil6210_priv *wil)
 {
int rc;
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
WARN_ON(!mutex_is_locked(&wil->mutex));
 
cancel_work_sync(&wil->disconnect_worker);
@@ -614,6 +620,8 @@ int wil_up(struct wil6210_priv *wil)
 {
int rc;
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
mutex_lock(&wil->mutex);
rc = __wil_up(wil);
mutex_unlock(&wil->mutex);
@@ -650,6 +658,8 @@ int wil_down(struct wil6210_priv *wil)
 {
int rc;
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
mutex_lock(&wil->mutex);
rc = __wil_down(wil);
mutex_unlock(&wil->mutex);
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c 
b/drivers/net/wireless/ath/wil6210/netdev.c
index a44c2b6..a995d9d 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -22,6 +22,8 @@ static int wil_open(struct net_device *ndev)
 {
struct wil6210_priv *wil = ndev_to_wil(ndev);
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
return wil_up(wil);
 }
 
@@ -29,6 +31,8 @@ static int wil_stop(struct net_device *ndev)
 {
struct wil6210_priv *wil = ndev_to_wil(ndev);
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
return wil_down(wil);
 }
 
@@ -121,6 +125,8 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr)
wil->csr = csr;
wil->wdev = wdev;
 
+   wil_dbg_misc(wil, "%s()\n", __func__);
+
rc = wil_priv_init(wil);
if (rc) {
dev_err(dev, "wil

[PATCH 14/22] wil6210: send connect request IEs to FW also for non-secure connection

2014-09-10 Thread Vladimir Kondratiev
Driver is sending connect request IEs to FW only for secure connection and
ignores them for non-secure connection.
This is fixed by always sending the IEs to FW upon connect request

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 22 +++---
 drivers/net/wireless/ath/wil6210/wmi.c  |  2 ++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index c8c9852..c1ff330 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -379,22 +379,22 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
sme->ie_len);
goto out;
}
-   /*
-* For secure assoc, send:
-* (1) WMI_DELETE_CIPHER_KEY_CMD
-* (2) WMI_SET_APPIE_CMD
-*/
+   /* For secure assoc, send WMI_DELETE_CIPHER_KEY_CMD */
rc = wmi_del_cipher_key(wil, 0, bss->bssid);
if (rc) {
wil_err(wil, "WMI_DELETE_CIPHER_KEY_CMD failed\n");
goto out;
}
-   /* WMI_SET_APPIE_CMD */
-   rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie);
-   if (rc) {
-   wil_err(wil, "WMI_SET_APPIE_CMD failed\n");
-   goto out;
-   }
+   }
+
+   /* WMI_SET_APPIE_CMD. ie may contain rsn info as well as other info
+* elements. Send it also in case it's empty, to erase previously set
+* ies in FW.
+*/
+   rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie);
+   if (rc) {
+   wil_err(wil, "WMI_SET_APPIE_CMD failed\n");
+   goto out;
}
 
/* WMI_CONNECT_CMD */
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index c3682c3a..789c316 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -972,6 +972,8 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 
ie_len, const void *ie)
 
if (!cmd)
return -ENOMEM;
+   if (!ie)
+   ie_len = 0;
 
cmd->mgmt_frm_type = type;
/* BUG: FW API define ieLen as u8. Will fix FW */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/22] wil6210: fix race condition between BACK event and Rx data

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

While handling Rx packet, BACK event arrives and frees tid_ampdu_rx array.
This causes kernel panic while accessing already freed spinlock

The fix is to remove tid_ampdu_rx[]'s spinlock and instead use single
sta's spinlock to guard the whole tid_ampdu_rx array.

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/debugfs.c|  3 +++
 drivers/net/wireless/ath/wil6210/main.c   | 13 -
 drivers/net/wireless/ath/wil6210/rx_reorder.c | 12 +++-
 drivers/net/wireless/ath/wil6210/wil6210.h|  7 +--
 drivers/net/wireless/ath/wil6210/wmi.c| 10 +-
 5 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index e1f9276..21dc437 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1059,6 +1059,7 @@ static int wil_sta_debugfs_show(struct seq_file *s, void 
*data)
 {
struct wil6210_priv *wil = s->private;
int i, tid;
+   unsigned long flags;
 
for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
struct wil_sta_info *p = &wil->sta[i];
@@ -1079,6 +1080,7 @@ static int wil_sta_debugfs_show(struct seq_file *s, void 
*data)
   (p->data_port_open ? " data_port_open" : ""));
 
if (p->status == wil_sta_connected) {
+   spin_lock_irqsave(&p->tid_rx_lock, flags);
for (tid = 0; tid < WIL_STA_TID_NUM; tid++) {
struct wil_tid_ampdu_rx *r = p->tid_rx[tid];
 
@@ -1087,6 +1089,7 @@ static int wil_sta_debugfs_show(struct seq_file *s, void 
*data)
wil_print_rxtid(s, r);
}
}
+   spin_unlock_irqrestore(&p->tid_rx_lock, flags);
}
}
 
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 22e9b8a..d2f2c1e 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -95,9 +95,16 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, int 
cid)
}
 
for (i = 0; i < WIL_STA_TID_NUM; i++) {
-   struct wil_tid_ampdu_rx *r = sta->tid_rx[i];
+   struct wil_tid_ampdu_rx *r;
+   unsigned long flags;
+
+   spin_lock_irqsave(&sta->tid_rx_lock, flags);
+
+   r = sta->tid_rx[i];
sta->tid_rx[i] = NULL;
wil_tid_ampdu_rx_free(wil, r);
+
+   spin_unlock_irqrestore(&sta->tid_rx_lock, flags);
}
for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
if (wil->vring2cid_tid[i][0] == cid)
@@ -267,9 +274,13 @@ static void wil_connect_worker(struct work_struct *work)
 
 int wil_priv_init(struct wil6210_priv *wil)
 {
+   uint i;
+
wil_dbg_misc(wil, "%s()\n", __func__);
 
memset(wil->sta, 0, sizeof(wil->sta));
+   for (i = 0; i < WIL6210_MAX_CID; i++)
+   spin_lock_init(&wil->sta[i].tid_rx_lock);
 
mutex_init(&wil->mutex);
mutex_init(&wil->wmi_mutex);
diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c 
b/drivers/net/wireless/ath/wil6210/rx_reorder.c
index 2b57069..489cb73 100644
--- a/drivers/net/wireless/ath/wil6210/rx_reorder.c
+++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c
@@ -98,22 +98,25 @@ void wil_rx_reorder(struct wil6210_priv *wil, struct 
sk_buff *skb)
int mid = wil_rxdesc_mid(d);
u16 seq = wil_rxdesc_seq(d);
struct wil_sta_info *sta = &wil->sta[cid];
-   struct wil_tid_ampdu_rx *r = sta->tid_rx[tid];
+   struct wil_tid_ampdu_rx *r;
u16 hseq;
int index;
+   unsigned long flags;
 
wil_dbg_txrx(wil, "MID %d CID %d TID %d Seq 0x%03x\n",
 mid, cid, tid, seq);
 
+   spin_lock_irqsave(&sta->tid_rx_lock, flags);
+
+   r = sta->tid_rx[tid];
if (!r) {
+   spin_unlock_irqrestore(&sta->tid_rx_lock, flags);
wil_netif_rx_any(skb, ndev);
return;
}
 
hseq = r->head_seq_num;
 
-   spin_lock(&r->reorder_lock);
-
/** Due to the race between WMI events, where BACK establishment
 * reported, and data Rx, few packets may be pass up before reorder
 * buffer get allocated. Catch up by pretending SSN is what we
@@ -176,7 +179,7 @@ void wil_rx_reorder(struct wil6210_priv *wil, struct 
sk_buff *skb)
wil_reorder_release(wil, r);
 
 out:
-   spin_unlock(&r->reorder_lock);
+   spin_unlock_irqrestore(&sta->tid_rx_lock, flags);
 }
 
 struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil,
@@ -198,7 +201,6 @@ struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct 
wil6210_priv *wil,
return NULL;
}
 
- 

[PATCH 08/22] wil6210: fix for memory corruption while insmod

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

After setting interrupt handler, driver enabled interrupts.
This caused stale (old) HW interrupts to fire before driver is
fully initialized.
The fix is to enable interrupts only when driver is fully initialized
and after FW/HW reset (to prevent any stale interrupts)

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/interrupt.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index 331d0dc..58ddcc9 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -538,12 +538,7 @@ int wil6210_init_irq(struct wil6210_priv *wil, int irq)
  wil6210_thread_irq,
  wil->n_msi ? 0 : IRQF_SHARED,
  WIL_NAME, wil);
-   if (rc)
-   return rc;
-
-   wil6210_enable_irq(wil);
-
-   return 0;
+   return rc;
 }
 
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/22] wil6210: modify confusing printout

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

When WMI event received when driver not ready to accept it, the printed error
message is misleading and hints that HW is stuck. Modify the error message
to make it clearer

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index c71657b..ad48f14 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -660,7 +660,7 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
unsigned n;
 
if (!test_bit(wil_status_reset_done, &wil->status)) {
-   wil_err(wil, "Reset not completed\n");
+   wil_err(wil, "Reset in progress. Cannot handle WMI event\n");
return;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/22] wil6210: debug prints for vring de-allocation

2014-09-10 Thread Vladimir Kondratiev
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/txrx.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 9bd920d..2cc3569 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -143,6 +143,18 @@ static void wil_vring_free(struct wil6210_priv *wil, 
struct vring *vring,
struct device *dev = wil_to_dev(wil);
size_t sz = vring->size * sizeof(vring->va[0]);
 
+   if (tx) {
+   int vring_index = vring - wil->vring_tx;
+
+   wil_dbg_misc(wil, "free Tx vring %d [%d] 0x%p:%pad 0x%p\n",
+vring_index, vring->size, vring->va,
+&vring->pa, vring->ctx);
+   } else {
+   wil_dbg_misc(wil, "free Rx vring [%d] 0x%p:%pad 0x%p\n",
+vring->size, vring->va,
+&vring->pa, vring->ctx);
+   }
+
while (!wil_vring_is_empty(vring)) {
dma_addr_t pa;
u16 dmalen;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/22] wil6210: print more information when connecting

2014-09-10 Thread Vladimir Kondratiev
when connecting, print some info about BSS

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index a00f318..df77711 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -319,6 +319,22 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
return rc;
 }
 
+static void wil_print_connect_params(struct wil6210_priv *wil,
+struct cfg80211_connect_params *sme)
+{
+   wil_info(wil, "Connecting to:\n");
+   if (sme->channel) {
+   wil_info(wil, "  Channel: %d freq %d\n",
+sme->channel->hw_value, sme->channel->center_freq);
+   }
+   if (sme->bssid)
+   wil_info(wil, "  BSSID: %pM\n", sme->bssid);
+   if (sme->ssid)
+   print_hex_dump(KERN_INFO, "  SSID: ", DUMP_PREFIX_OFFSET,
+  16, 1, sme->ssid, sme->ssid_len, true);
+   wil_info(wil, "  Privacy: %s\n", sme->privacy ? "secure" : "open");
+}
+
 static int wil_cfg80211_connect(struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_connect_params *sme)
@@ -335,6 +351,8 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
test_bit(wil_status_fwconnected, &wil->status))
return -EALREADY;
 
+   wil_print_connect_params(wil, sme);
+
bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid,
   sme->ssid, sme->ssid_len,
   WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/22] wil6210: enlarge TX/RX buffer length

2014-09-10 Thread Vladimir Kondratiev
HW supports upto 2304 packet size on the air.
HW is responsible for adding (Tx) or removing (Rx) the following headers:
802.11 hdr: 26B
SNAP: 8B
CRC: 4B
Security (optional): 24B
HW adds max 62B to the payload passed from driver. It means driver can use
max packet size of 2304-62 = 2242B

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/netdev.c | 5 -
 drivers/net/wireless/ath/wil6210/txrx.c   | 3 ++-
 drivers/net/wireless/ath/wil6210/txrx.h   | 6 +++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/netdev.c 
b/drivers/net/wireless/ath/wil6210/netdev.c
index a995d9d..1c0c77d 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -17,6 +17,7 @@
 #include 
 
 #include "wil6210.h"
+#include "txrx.h"
 
 static int wil_open(struct net_device *ndev)
 {
@@ -40,8 +41,10 @@ static int wil_change_mtu(struct net_device *ndev, int 
new_mtu)
 {
struct wil6210_priv *wil = ndev_to_wil(ndev);
 
-   if (new_mtu < 68 || new_mtu > IEEE80211_MAX_DATA_LEN_DMG)
+   if (new_mtu < 68 || new_mtu > (TX_BUF_LEN - ETH_HLEN)) {
+   wil_err(wil, "invalid MTU %d\n", new_mtu);
return -EINVAL;
+   }
 
wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu);
ndev->mtu = new_mtu;
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 02fd43d..2936ef0 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -668,7 +668,8 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int 
size,
struct vring *vring = &wil->vring_tx[id];
struct vring_tx_data *txdata = &wil->vring_tx_data[id];
 
-   wil_dbg_misc(wil, "%s()\n", __func__);
+   wil_dbg_misc(wil, "%s() max_mpdu_size %d\n", __func__,
+cmd.vring_cfg.tx_sw_ring.max_mpdu_size);
 
if (vring->va) {
wil_err(wil, "Tx ring [%d] already allocated\n", id);
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h 
b/drivers/net/wireless/ath/wil6210/txrx.h
index 979edf2..de04671 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.h
+++ b/drivers/net/wireless/ath/wil6210/txrx.h
@@ -20,9 +20,9 @@
 #define BUF_SW_OWNED(1)
 #define BUF_HW_OWNED(0)
 
-/* size of max. Rx packet */
-#define RX_BUF_LEN  (2048)
-#define TX_BUF_LEN  (2048)
+/* size of max. Tx/Rx buffers, as supported by FW */
+#define RX_BUF_LEN  (2242)
+#define TX_BUF_LEN  (2242)
 /* how many bytes to reserve for rtap header? */
 #define WIL6210_RTAP_SIZE (128)
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/22] wil6210: fix for memory corruption upon rmmod

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

Driver disabled PCI master before making sure HW is idle.
This caused memory corruption in case HW access system memory after
PCI master got disabled.
The fix is to change uninit sequence. Make sure FW/HW is idle before
disabling PCI

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c | 26 +-
 drivers/net/wireless/ath/wil6210/pcie_bus.c |  2 +-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 696be3e..22e9b8a 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -20,6 +20,10 @@
 
 #include "wil6210.h"
 #include "txrx.h"
+#include "wmi.h"
+
+#define WAIT_FOR_DISCONNECT_TIMEOUT_MS 2000
+#define WAIT_FOR_DISCONNECT_INTERVAL_MS 10
 
 static bool no_fw_recovery;
 module_param(no_fw_recovery, bool, S_IRUGO | S_IWUSR);
@@ -631,6 +635,9 @@ int wil_up(struct wil6210_priv *wil)
 
 static int __wil_down(struct wil6210_priv *wil)
 {
+   int iter = WAIT_FOR_DISCONNECT_TIMEOUT_MS /
+   WAIT_FOR_DISCONNECT_INTERVAL_MS;
+
WARN_ON(!mutex_is_locked(&wil->mutex));
 
if (wil->platform_ops.bus_request)
@@ -648,7 +655,24 @@ static int __wil_down(struct wil6210_priv *wil)
wil->scan_request = NULL;
}
 
-   wil6210_disconnect(wil, NULL);
+   if (test_bit(wil_status_fwconnected, &wil->status) ||
+   test_bit(wil_status_fwconnecting, &wil->status))
+   wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0);
+
+   /* make sure wil is idle (not connected) */
+   mutex_unlock(&wil->mutex);
+   while (iter--) {
+   int idle = !test_bit(wil_status_fwconnected, &wil->status) &&
+  !test_bit(wil_status_fwconnecting, &wil->status);
+   if (idle)
+   break;
+   msleep(WAIT_FOR_DISCONNECT_INTERVAL_MS);
+   }
+   mutex_lock(&wil->mutex);
+
+   if (!iter)
+   wil_err(wil, "timeout waiting for idle FW/HW\n");
+
wil_rx_fini(wil);
 
return 0;
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c 
b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index d2a1ca2..264c0f0 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -233,8 +233,8 @@ static void wil_pcie_remove(struct pci_dev *pdev)
wil_dbg_misc(wil, "%s()\n", __func__);
 
wil6210_debugfs_remove(wil);
-   wil_if_pcie_disable(wil);
wil_if_remove(wil);
+   wil_if_pcie_disable(wil);
if (wil->platform_ops.uninit)
wil->platform_ops.uninit(wil->platform_handle);
wil_if_free(wil);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/22] wil6210: coding style fixes

2014-09-10 Thread Vladimir Kondratiev
- parentheses, indentation, typos
- seq_puts() instead of seq_printf() with single argument
- sizeof(var) vs. sizeof(type)

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c   |  4 +-
 drivers/net/wireless/ath/wil6210/debugfs.c| 53 +--
 drivers/net/wireless/ath/wil6210/main.c   |  7 ++--
 drivers/net/wireless/ath/wil6210/rx_reorder.c |  1 +
 drivers/net/wireless/ath/wil6210/txrx.c   | 43 --
 drivers/net/wireless/ath/wil6210/txrx.h   |  3 --
 drivers/net/wireless/ath/wil6210/wil6210.h|  1 +
 drivers/net/wireless/ath/wil6210/wmi.c|  4 ++
 drivers/net/wireless/ath/wil6210/wmi.h| 18 +
 9 files changed, 72 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index df77711..cba04e5 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -296,6 +296,7 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
n = min(request->n_channels, 4U);
for (i = 0; i < n; i++) {
int ch = request->channels[i]->hw_value;
+
if (ch == 0) {
wil_err(wil,
"Scan requested for unknown frequency %dMhz\n",
@@ -713,7 +714,6 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
if (rc)
goto out;
 
-
netif_carrier_on(ndev);
 
 out:
@@ -804,7 +804,7 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev)
int rc = 0;
struct wireless_dev *wdev;
 
-   wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
+   wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index b1c6a72..e1f9276 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -61,20 +61,22 @@ static void wil_print_vring(struct seq_file *s, struct 
wil6210_priv *wil,
if (x)
seq_printf(s, "0x%08x\n", ioread32(x));
else
-   seq_printf(s, "???\n");
+   seq_puts(s, "???\n");
 
if (vring->va && (vring->size < 1025)) {
uint i;
+
for (i = 0; i < vring->size; i++) {
volatile struct vring_tx_desc *d = &vring->va[i].tx;
+
if ((i % 64) == 0 && (i != 0))
-   seq_printf(s, "\n");
+   seq_puts(s, "\n");
seq_printf(s, "%c", (d->dma.status & BIT(0)) ?
_s : (vring->ctx[i].skb ? _h : 'h'));
}
-   seq_printf(s, "\n");
+   seq_puts(s, "\n");
}
-   seq_printf(s, "}\n");
+   seq_puts(s, "}\n");
 }
 
 static int wil_vring_debugfs_show(struct seq_file *s, void *data)
@@ -85,7 +87,7 @@ static int wil_vring_debugfs_show(struct seq_file *s, void 
*data)
wil_print_vring(s, wil, "rx", &wil->vring_rx, 'S', '_');
 
for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
-   struct vring *vring = &(wil->vring_tx[i]);
+   struct vring *vring = &wil->vring_tx[i];
struct vring_tx_data *txdata = &wil->vring_tx_data[i];
 
if (vring->va) {
@@ -163,7 +165,7 @@ static void wil_print_ring(struct seq_file *s, const char 
*prefix,
if (!wmi_addr(wil, r.base) ||
!wmi_addr(wil, r.tail) ||
!wmi_addr(wil, r.head)) {
-   seq_printf(s, "  ??? pointers are garbage?\n");
+   seq_puts(s, "  ??? pointers are garbage?\n");
goto out;
}
 
@@ -182,6 +184,7 @@ static void wil_print_ring(struct seq_file *s, const char 
*prefix,
   le32_to_cpu(d.addr));
if (0 == wmi_read_hdr(wil, d.addr, &hdr)) {
u16 len = le16_to_cpu(hdr.len);
+
seq_printf(s, " -> %04x %04x %04x %02x\n",
   le16_to_cpu(hdr.seq), len,
   le16_to_cpu(hdr.type), hdr.flags);
@@ -199,6 +202,7 @@ static void wil_print_ring(struct seq_file *s, const char 
*prefix,
wil_memcpy_fromio_32(databuf, src, len);
while (n < len) {
int l = min(len - n, 16);
+
hex_dump_to_buffer(databuf + n, l,
   16, 1, printbuf,
   sizeof(printbuf),
@@ -208,11 +212,11 @@ static void wil_print_ring(struct seq_file *s, const char 
*prefix,
}
}
} else {
-  

[PATCH 17/22] wil6210: introduce separate completion for WMI

2014-09-10 Thread Vladimir Kondratiev
From: Dedy Lansky 

re-use of wmi_ready for both FW ready event and for wmi_call was causing
false "FW not ready" indication in case wmi_call() was invoked while reset
took place.
add wmi_call completion variable instead of re-using wmi_ready.

Signed-off-by: Dedy Lansky 
Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c| 2 ++
 drivers/net/wireless/ath/wil6210/wil6210.h | 1 +
 drivers/net/wireless/ath/wil6210/wmi.c | 8 
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index d2f2c1e..0857853 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -286,6 +286,7 @@ int wil_priv_init(struct wil6210_priv *wil)
mutex_init(&wil->wmi_mutex);
 
init_completion(&wil->wmi_ready);
+   init_completion(&wil->wmi_call);
 
wil->pending_connect_cid = -1;
setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil);
@@ -536,6 +537,7 @@ int wil_reset(struct wil6210_priv *wil)
/* init after reset */
wil->pending_connect_cid = -1;
reinit_completion(&wil->wmi_ready);
+   reinit_completion(&wil->wmi_call);
 
wil6210_enable_irq(wil);
 
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 1b11934..f8f9988 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -399,6 +399,7 @@ struct wil6210_priv {
struct mutex wmi_mutex;
struct wil6210_mbox_ctl mbox_ctl;
struct completion wmi_ready;
+   struct completion wmi_call;
u16 wmi_seq;
u16 reply_id; /**< wait for this WMI event */
void *reply_buf;
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index 789c316..bd781c7 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -300,7 +300,7 @@ static void wmi_evt_fw_ready(struct wil6210_priv *wil, int 
id, void *d,
wil_dbg_wmi(wil, "WMI: got FW ready event\n");
 
set_bit(wil_status_fwready, &wil->status);
-   /* reuse wmi_ready for the firmware ready indication */
+   /* let the reset sequence continue */
complete(&wil->wmi_ready);
 }
 
@@ -764,8 +764,8 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void 
*buf, u16 len,
wil->reply_id = reply_id;
wil->reply_buf = reply;
wil->reply_size = reply_size;
-   remain = wait_for_completion_timeout(&wil->wmi_ready,
-   msecs_to_jiffies(to_msec));
+   remain = wait_for_completion_timeout(&wil->wmi_call,
+msecs_to_jiffies(to_msec));
if (0 == remain) {
wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n",
cmdid, reply_id, to_msec);
@@ -1160,7 +1160,7 @@ static void wmi_event_handle(struct wil6210_priv *wil,
 len - sizeof(*wmi));
}
wil_dbg_wmi(wil, "Complete WMI 0x%04x\n", id);
-   complete(&wil->wmi_ready);
+   complete(&wil->wmi_call);
return;
}
/* unsolicited event */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/22] wil6210: specify max. IE length

2014-09-10 Thread Vladimir Kondratiev
Expose firmware limit for the max_scan_ie_len;
also do actually set IE's for the probe request

max_scan_ie_len used to be 0, this blocks scan requests with non-zero IE's

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 61eaf20..6119ecb 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -309,9 +309,23 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
 request->channels[i]->center_freq);
}
 
+   if (request->ie_len)
+   print_hex_dump_bytes("Scan IE ", DUMP_PREFIX_OFFSET,
+request->ie, request->ie_len);
+   else
+   wil_dbg_misc(wil, "Scan has no IE's\n");
+
+   rc = wmi_set_ie(wil, WMI_FRAME_PROBE_REQ, request->ie_len,
+   request->ie);
+   if (rc) {
+   wil_err(wil, "Aborting scan, set_ie failed: %d\n", rc);
+   goto out;
+   }
+
rc = wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) +
cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0]));
 
+out:
if (rc) {
del_timer_sync(&wil->scan_timer);
wil->scan_request = NULL;
@@ -813,6 +827,7 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 {
/* TODO: set real value */
wiphy->max_scan_ssids = 10;
+   wiphy->max_scan_ie_len = WMI_MAX_IE_LEN;
wiphy->max_num_pmkids = 0 /* TODO: */;
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 BIT(NL80211_IFTYPE_AP) |
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] ath9k: Clear offchannel duration properly

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

Clearing the offchannel duration value in the
scheduler unconditionally breaks NoA when
multiple contexts are active and an offchannel
request is deferred, for example, in a scan run.

Fix this by clearing the duration only if there
is no pending offchannel request.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index ab3d29d..09ff8a6 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1065,7 +1065,10 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool 
force)
sc->cur_chan = sc->next_chan;
sc->cur_chan->stopped = false;
sc->next_chan = NULL;
-   sc->sched.offchannel_duration = 0;
+
+   if (!sc->sched.offchannel_pending)
+   sc->sched.offchannel_duration = 0;
+
if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE)
sc->sched.state = ATH_CHANCTX_STATE_IDLE;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] ath9k: Fix Notice of Absence issues

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

* The index has to incremented only when advertising
  a new NoA schedule.

* Switch to non-periodic NoA when starting a scan operation
  and multiple channel contexts are active.

* Make sure that periodic NoA is advertised again when
  scan ends. Since the offchannel timer moves the offchannel
  state to IDLE after the GO operating channel becomes
  active, use a flag "force_noa_update" to update the
  NoA contents.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |   7 ++-
 drivers/net/wireless/ath/ath9k/channel.c | 105 ---
 2 files changed, 75 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 0c071b0..305db1a 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -379,6 +379,7 @@ struct ath_chanctx_sched {
bool beacon_pending;
bool offchannel_pending;
bool wait_switch;
+   bool force_noa_update;
enum ath_chanctx_state state;
u8 beacon_miss;
 
@@ -595,8 +596,10 @@ struct ath_vif {
u32 offchannel_start;
u32 offchannel_duration;
 
-   u32 periodic_noa_start;
-   u32 periodic_noa_duration;
+   /* These are used for both periodic and one-shot */
+   u32 noa_start;
+   u32 noa_duration;
+   bool periodic_noa;
 };
 
 struct ath9k_vif_iter_data {
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index ae575cb..ab3d29d 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -310,7 +310,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
struct ath_chanctx *ctx;
u32 tsf_time;
u32 beacon_int;
-   bool noa_changed = false;
 
if (vif)
avp = (struct ath_vif *) vif->drv_priv;
@@ -372,22 +371,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.switch_start_time = tsf_time;
sc->cur_chan->last_beacon = sc->sched.next_tbtt;
 
-   /* Prevent wrap-around issues */
-   if (avp->periodic_noa_duration &&
-   tsf_time - avp->periodic_noa_start > BIT(30))
-   avp->periodic_noa_duration = 0;
-
-   if (ctx->active) {
-   avp->periodic_noa_start = tsf_time;
-   avp->periodic_noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 -
-   sc->sched.channel_switch_time;
-   noa_changed = true;
-   } else if (!ctx->active) {
-   avp->periodic_noa_duration = 0;
-   noa_changed = true;
-   }
-
/* If at least two consecutive beacons were missed on the STA
 * chanctx, stay on the STA channel for one extra beacon period,
 * to resync the timer properly.
@@ -395,21 +378,65 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
if (ctx->active && sc->sched.beacon_miss >= 2)
sc->sched.offchannel_duration = 3 * beacon_int / 2;
 
-   if (sc->sched.offchannel_duration) {
-   noa_changed = true;
+   /*
+* If an offchannel switch is scheduled to happen after
+* a beacon transmission, update the NoA with one-shot
+* values and increment the index.
+*/
+   if (sc->next_chan == &sc->offchannel.chan) {
+   avp->noa_index++;
avp->offchannel_start = tsf_time;
-   avp->offchannel_duration =
-   sc->sched.offchannel_duration;
+   avp->offchannel_duration = 
sc->sched.offchannel_duration;
+
+   ath_dbg(common, CHAN_CTX,
+   "offchannel noa_duration: %d, noa_start: %d, 
noa_index: %d\n",
+   avp->offchannel_duration,
+   avp->offchannel_start,
+   avp->noa_index);
+
+   /*
+* When multiple contexts are active, the NoA
+* has to be recalculated and advertised after
+* an offchannel operation.
+*/
+   if (ctx->active && avp->noa_duration)
+   avp->noa_duration = 0;
+
+   break;
}
 
-   if (noa_changed)
+   /* Prevent wrap-around issues */
+   if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
+   avp->noa_duration = 0;
+
+   /*
+   

[PATCH 0/5] ath9k patches

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

MCC fixes for 3.18.

Sujith Manoharan (5):
  ath9k: Assign offchannel duration properly
  ath9k: Fix Notice of Absence issues
  ath9k: Clear offchannel duration properly
  ath9k: Fix channel switch time duration
  ath9k: Fix beacon miss handling

 drivers/net/wireless/ath/ath9k/ath9k.h   |   8 +-
 drivers/net/wireless/ath/ath9k/channel.c | 143 ++-
 2 files changed, 109 insertions(+), 42 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Larry Finger

On 09/10/2014 05:21 AM, Arend van Spriel wrote:

On 09/10/14 11:50, Bastien Nocera wrote:


Indeed. That did the trick.

mmc0:0001 is the builtin storage, mmc1:0001:1 however is an unbound
device with vendor 0x024c and device 0xb723 (modalias:
sdio:c07v024CdB723). More interestingly class is 0x07, which udev
interprets as "WLAN interface".


Now you have to find and load the right driver.


In response to a question from me, my contact at Realtek sent me such a driver 
last night. I have forwarded it to Bastien and he should be in business soon.


Larry


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] ath9k: Fix beacon miss handling

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

The NoA duration for a GO is half the beacon interval
and a concurrent context like a STA can be active only
for that duration, before switching back to the GO's
operating channel.

Currently, when multiple beacons are missed, the dwell
time for the STA context is extended to improve the
chances of receiving a beacon. But the NoA is not updated
and this will cause problems since the GO is offline
for a period that is longer than the advertised duration.

Fix this by ensuring that the NoA is updated first before
extending the time slot for the STA context. Also make
sure that non-periodic NoA is used for a one-time, longer
absence period.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 44 +++-
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 305db1a..660c151 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -380,6 +380,7 @@ struct ath_chanctx_sched {
bool offchannel_pending;
bool wait_switch;
bool force_noa_update;
+   bool extend_absence;
enum ath_chanctx_state state;
u8 beacon_miss;
 
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index a42fd85..a1b3282 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -371,13 +371,6 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.switch_start_time = tsf_time;
sc->cur_chan->last_beacon = sc->sched.next_tbtt;
 
-   /* If at least two consecutive beacons were missed on the STA
-* chanctx, stay on the STA channel for one extra beacon period,
-* to resync the timer properly.
-*/
-   if (ctx->active && sc->sched.beacon_miss >= 2)
-   sc->sched.offchannel_duration = 3 * beacon_int / 2;
-
/*
 * If an offchannel switch is scheduled to happen after
 * a beacon transmission, update the NoA with one-shot
@@ -405,6 +398,26 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
break;
}
 
+
+   /*
+* Clear the extend_absence flag if it had been
+* set during the previous beacon transmission,
+* since we need to revert to the normal NoA
+* schedule.
+*/
+   if (ctx->active && sc->sched.extend_absence) {
+   avp->noa_duration = 0;
+   sc->sched.extend_absence = false;
+   }
+
+   /* If at least two consecutive beacons were missed on the STA
+* chanctx, stay on the STA channel for one extra beacon period,
+* to resync the timer properly.
+*/
+   if (ctx->active && sc->sched.beacon_miss >= 2) {
+   avp->noa_duration = 0;
+   sc->sched.extend_absence = true;
+   }
/* Prevent wrap-around issues */
if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
avp->noa_duration = 0;
@@ -418,11 +431,17 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
(!avp->noa_duration || sc->sched.force_noa_update)) {
avp->noa_index++;
avp->noa_start = tsf_time;
-   avp->noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 +
-   sc->sched.channel_switch_time;
 
-   if (test_bit(ATH_OP_SCANNING, &common->op_flags))
+   if (sc->sched.extend_absence)
+   avp->noa_duration = (3 * beacon_int / 2) +
+   sc->sched.channel_switch_time;
+   else
+   avp->noa_duration =
+   TU_TO_USEC(cur_conf->beacon_interval) / 
2 +
+   sc->sched.channel_switch_time;
+
+   if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
+   sc->sched.extend_absence)
avp->periodic_noa = false;
else
avp->periodic_noa = true;
@@ -520,7 +539,8 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.wait_switch = false;
 
tsf_time = TU_TO_USEC(cur_conf->beacon_interval) / 2;
-   if (sc->sched.beacon_miss >= 2) {
+
+

[PATCH 1/5] ath9k: Assign offchannel duration properly

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

In multi-channel mode, an offchannel request will
be deferred if both contexts are active. The duration
of the offchannel operation is calculated but is
not stored in the scheduler state. Fix this.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 522894b..ae575cb 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -588,10 +588,15 @@ static void ath_chanctx_switch(struct ath_softc *sc, 
struct ath_chanctx *ctx,
 
if (test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags) &&
(sc->cur_chan != ctx) && (ctx == &sc->offchannel.chan)) {
-   sc->sched.offchannel_pending = true;
-   sc->sched.wait_switch = true;
if (chandef)
ctx->chandef = *chandef;
+
+   sc->sched.offchannel_pending = true;
+   sc->sched.wait_switch = true;
+   sc->sched.offchannel_duration =
+   jiffies_to_usecs(sc->offchannel.duration) +
+   sc->sched.channel_switch_time;
+
spin_unlock_bh(&sc->chan_lock);
ath_dbg(common, CHAN_CTX,
"Set offchannel_pending to true\n");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] ath9k: Fix channel switch time duration

2014-09-10 Thread Sujith Manoharan
From: Sujith Manoharan 

Since the NoA duration is the maximum time the GO interface
can be offline, it needs to include the time take to
switch channels in the HW.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 09ff8a6..a42fd85 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -419,7 +419,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
avp->noa_index++;
avp->noa_start = tsf_time;
avp->noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 -
+   TU_TO_USEC(cur_conf->beacon_interval) / 2 +
sc->sched.channel_switch_time;
 
if (test_bit(ATH_OP_SCANNING, &common->op_flags))
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: P2P_DEVICE support in Android KitKat

2014-09-10 Thread Peer, Ilan
Hi Arend,

We've encountered this issue in the past, and resolved it by passing the 
wpa_supplicant a P2P specific configuration file using the -m option. Try using 
-m but do not populate it with any network blocks that are not P2P groups.

Hope this helps,

Ilan.

> -Original Message-
> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
> ow...@vger.kernel.org] On Behalf Of Jouni Malinen
> Sent: Wednesday, September 10, 2014 14:11
> To: Arend van Spriel
> Cc: linux-wireless@vger.kernel.org; brcm80211 development;
> hos...@lists.shmoo.com
> Subject: Re: P2P_DEVICE support in Android KitKat
> 
> On Wed, Sep 10, 2014 at 09:30:05AM +0200, Arend van Spriel wrote:
> > I am running some tests on a haswell target with Android KitKat
> > (3.10.20 kernel). In this configuration our brcmfmac driver is used
> > with driver param 'p2p_device=1'. So we end up with wlan0 and
> > p2p-dev-wlan0 interfaces (can blame myself for that). The
> > configuration has a network configured, but I did not expect
> > wpa_supplicant to start association using the p2p device interface.
> > The wlan0 interface is already connected to the AP. How can I fix this
> > to assure p2p-dev-wlan0 is only used for p2p management scenarios.
> 
> Hmm.. Can you please show the wpa_supplicant command line that is used
> here and describe how that network block gets configured for the
> p2p-dev-wlan0 "interface"? I would have expected that there would never
> be a configuration with an enabled network block being passed for the P2P
> management interface.. Internally, wpa_supplicant should not add such for
> P2P groups, but I don't think there is any filtering on configuration if
> something is externally trying to make wpa_supplicant use that management
> interface for a station mode connection.
> 
> --
> Jouni MalinenPGP id EFC895FA
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in 
> the
> body of a message to majord...@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: P2P_DEVICE support in Android KitKat

2014-09-10 Thread Arend van Spriel

On 09/10/14 13:10, Jouni Malinen wrote:

On Wed, Sep 10, 2014 at 09:30:05AM +0200, Arend van Spriel wrote:

I am running some tests on a haswell target with Android KitKat
(3.10.20 kernel). In this configuration our brcmfmac driver is used
with driver param 'p2p_device=1'. So we end up with wlan0 and
p2p-dev-wlan0 interfaces (can blame myself for that). The
configuration has a network configured, but I did not expect
wpa_supplicant to start association using the p2p device interface.
The wlan0 interface is already connected to the AP. How can I fix
this to assure p2p-dev-wlan0 is only used for p2p management
scenarios.


Hmm.. Can you please show the wpa_supplicant command line that is used
here and describe how that network block gets configured for the
p2p-dev-wlan0 "interface"? I would have expected that there would never
be a configuration with an enabled network block being passed for the
P2P management interface.. Internally, wpa_supplicant should not add
such for P2P groups, but I don't think there is any filtering on
configuration if something is externally trying to make wpa_supplicant
use that management interface for a station mode connection.


Hi Jouni,

Jithu informed me about the '-m' command line option so digging in git 
revision history I found the commit from Ilan which kind of describes 
what I am seeing


c16a759 wpa_supplicant: Add a configuration file for the P2P_DEVICE 
parameters


Here is p2p_supplicant service instantiating the wpa_supplicant.

service p2p_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0 \
  -g@android:wpa_wlan0 -c/data/misc/wifi/p2p_supplicant.conf -dt

The p2p_supplicant.conf has update_config=1 set which is also mentioned 
in the commit message. Without -m option p2p-dev-wlan0 is created using 
the same config file as for wlan0 so some filtering would be required 
(or use -m).


Regards,
Arend
ctrl_interface=/data/misc/wifi/sockets
update_config=1
driver_param=use_p2p_group_interface=1p2p_device=1
eapol_version=1
ap_scan=1
fast_reauth=1
device_name=BRIX-t1
device_type=10-0050F204-1
config_methods=keypad display push_button



Re: Not reaching optimum speeds with IEEE 802.11n

2014-09-10 Thread Helmut Schaa
On Wed, Sep 10, 2014 at 10:42 AM, Arend van Spriel  wrote:
> On 09/10/14 03:26, Sourav wrote:
>> We are using Ralink chip Rt3072L (using rt2800usb drivers rt2800usb.c),

The Ralink USB hardware is quite bad in reporting TX status and as
such minstrel_ht cannot do proper rate selection.
If you watch the rc stats at
/sys/kernel/debug/ieee80211/phy0/netdev\:wlan0-0/stations/xx:xx:xx:xx:xx:xx/rc_stats
you might see a lot of rate selection "hopping".

Regards.
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: P2P_DEVICE support in Android KitKat

2014-09-10 Thread Arend van Spriel

On 09/10/14 16:00, Peer, Ilan wrote:

Hi Arend,

We've encountered this issue in the past, and resolved it by passing the 
wpa_supplicant a P2P specific configuration file using the -m option. Try using 
-m but do not populate it with any network blocks that are not P2P groups.

Hope this helps,


Thanks, Ilan

Got the hint from brcm colleague as well.

Regards,
Arend


Ilan.


-Original Message-
From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
ow...@vger.kernel.org] On Behalf Of Jouni Malinen
Sent: Wednesday, September 10, 2014 14:11
To: Arend van Spriel
Cc: linux-wireless@vger.kernel.org; brcm80211 development;
hos...@lists.shmoo.com
Subject: Re: P2P_DEVICE support in Android KitKat

On Wed, Sep 10, 2014 at 09:30:05AM +0200, Arend van Spriel wrote:

I am running some tests on a haswell target with Android KitKat
(3.10.20 kernel). In this configuration our brcmfmac driver is used
with driver param 'p2p_device=1'. So we end up with wlan0 and
p2p-dev-wlan0 interfaces (can blame myself for that). The
configuration has a network configured, but I did not expect
wpa_supplicant to start association using the p2p device interface.
The wlan0 interface is already connected to the AP. How can I fix this
to assure p2p-dev-wlan0 is only used for p2p management scenarios.


Hmm.. Can you please show the wpa_supplicant command line that is used
here and describe how that network block gets configured for the
p2p-dev-wlan0 "interface"? I would have expected that there would never
be a configuration with an enabled network block being passed for the P2P
management interface.. Internally, wpa_supplicant should not add such for
P2P groups, but I don't think there is any filtering on configuration if
something is externally trying to make wpa_supplicant use that management
interface for a station mode connection.

--
Jouni MalinenPGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the
body of a message to majord...@vger.kernel.org More majordomo info at
http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 2/2] ath10k: add testmode

2014-09-10 Thread Kalle Valo
Michal Kazior  writes:

> (On 4 September 2014 15:56, Kalle Valo  wrote:
>> Add testmode interface for starting and using UTF firmware which is used to 
>> run
>> factory tests. This is implemented by adding new state ATH10K_STATE_UTF and 
>> user
>> space can enable this state with ATH10K_TM_CMD_UTF_START command. To go back 
>> to
>> normal mode user space can send ATH10K_TM_CMD_UTF_STOP.
>>
>> Signed-off-by: Kalle Valo 
>> ---
> [...]
>> +bool ath10k_tm_event_wmi(struct ath10k *ar, u32 cmd_id, struct sk_buff *skb)
>> +{
>> +   struct sk_buff *nl_skb;
>> +   bool consumed;
>> +   int ret;
>> +
>> +   ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
>> +  "testmode event wmi cmd_id %d skb %p skb->len %d\n",
>> +  cmd_id, skb, skb->len);
>> +
>> +   ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, 
>> skb->len);
>> +
>> +   spin_lock_bh(&ar->data_lock);
>> +
>> +   if (!ar->testmode.utf_monitor) {
>> +   consumed = false;
>> +   goto out;
>> +   }
>> +
>> +   /* Only testmode.c should be handling events from utf firmware,
>> +* otherwise all sort of problems will arise as mac80211 operations
>> +* are not initialised. */
>
> Comment style.

Argh, will I ever learn :) Fixed now.

>> +static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
>> +{
>> +   char filename[100];
>> +   int ret;
>> +
>> +   ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode cmd utf start\n");
>> +
>> +   mutex_lock(&ar->conf_mutex);
>> +
>> +   if (ar->state == ATH10K_STATE_UTF) {
>> +   ret = -EALREADY;
>> +   goto err;
>> +   }
>> +
>> +   /* start utf only when the driver is not in use  */
>> +   if (ar->state != ATH10K_STATE_OFF) {
>> +   ret = -EBUSY;
>> +   goto err;
>> +   }
>> +
>> +   if (ar->testmode.utf != NULL)
>> +   /* utf image is already downloaded */
>> +   goto power_up;
>
> I believe this shouldn't happen with the current code. We should
> probably treat it with a if (WARN_ON(utf != NULL)) goto err;

Yeah, I'll add that.

>> +void ath10k_testmode_destroy(struct ath10k *ar)
>> +{
>> +   mutex_lock(&ar->conf_mutex);
>> +
>> +   release_firmware(ar->testmode.utf);
>> +   ar->testmode.utf = NULL;
>> +
>> +   if (ar->state != ATH10K_STATE_UTF) {
>> +   /* utf firmware is not running, nothing to do */
>> +   goto out;
>> +   }
>> +
>> +   ath10k_core_stop(ar);
>
> Hmm, you don't call power_down here. This isn't a problem from a
> practical point of view after my recent changes but hey.
>
> How about we split out guts from ath10k_tm_cmd_utf_stop() to
> __ath10k_tm_cmd_utf_stop() (which assumes conf_mutex is already held)
> and call it here like this:
>
>  mutex_lock(conf_mutex);
>  if (ar->state==UTF)
>__ath10k_tm_cmd_utf_stop(ar);
>  mutex_unlock(conf_mutex);

Good idea, I'll do that.

>> @@ -2488,6 +2490,17 @@ static void ath10k_wmi_10x_process_rx(struct ath10k 
>> *ar, struct sk_buff *skb)
>>
>> trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
>>
>> +   consumed = ath10k_tm_event_wmi(ar, id, skb);
>> +
>> +   /* Ready event must be handled normally also in UTF mode so that we
>> +* know the UTF firmware has booted, others we are just bypass WMI
>> +* events to testmode. */
>
> Comment style.

Fixed.

Thanks for the review! I'll send v4 soon.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Realtek GPIO chipset, for Baytrail?

2014-09-10 Thread Marcel Holtmann
Hi Bastien,

>>> What specific Baytrail tablet do you have?
>> 
>> The Onda v975w. It came with Windows 8.1 32-bit.
>> 
>> I guess that the device is probably a PCI one, but the enumeration is
>> done through ACPI instead of "normal" PCI.
> 
> In 
> http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-retina-screen-ram-2gb-wifi-32gb.html,
>  someone is specifically looking for an RTL8723BS driver.
 
 That's helpful.
 
> I will see if my contact at Realtek knows who has worked on drivers for 
> this device, and if it would be possible to use rtl8723be if we were to 
> supply an SDIO frontend.
 
 I'm not sure why the device doesn't show up in the sysfs tree, but maybe 
 it needs a driver bound to it to show up.
>>> 
>>> I just booted up my Baytrail based Minnowboard Max in ACPI enumeration and 
>>> then the SDIO host controller is enumerated via ACPI. This is compared to 
>>> PCI enumeration where the SDIO controller shows up in lspci.
>>> 
>>> So can you try to install sdhci-acpi and see if that starts showing SDIO 
>>> devices. If the SDIO host controllers loads, then it start SDIO enumeration 
>>> and you would see the cards.
>> 
>> You may need to look in /sys/bus/mmc/devices/ instead of sdio.
> 
> Indeed. That did the trick.
> 
> mmc0:0001 is the builtin storage, mmc1:0001:1 however is an unbound
> device with vendor 0x024c and device 0xb723 (modalias:
> sdio:c07v024CdB723). More interestingly class is 0x07, which udev
> interprets as "WLAN interface".

I started creating a hwdb/sdio.ids in systemd. However vendor 0x024c is not 
listed at the moment. If we figure out which one that is, then that should also 
be added to udev. After that it can annotate these devices properly.

Also if this is a single SDIO interface, then the Bluetooth part might be 
exposed as serial port. I have seen Realtek devices that run H:5 UART protocol.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Not reaching optimum speeds with IEEE 802.11n

2014-09-10 Thread Andreas Hartmann
Sourav wrote:
> Hi All,
> We are using Ralink chip Rt3072L (using rt2800usb drivers rt2800usb.c),
> mac80211, and hostapd in our routers.
> root:~# lsmod
> Module  Size  Used byTainted: P
> rt2800usb  15371  0
> rt2800lib  74214  1 rt2800usb
> rt2x00usb   9718  1 rt2800usb
> rt2x00lib  39328  3 rt2800usb,rt2800lib,rt2x00usb
> mac80211  266596  3 rt2800lib,rt2x00usb,rt2x00lib
> cfg80211  214073  2 rt2x00lib,mac80211
> compat 17406  4 rt2800usb,rt2x00lib,mac80211,cfg80211
> 
> When we are measuring performance using iperf, we see  ~20Mbps, using
> Channel 11 of 2.4GHZ, using 802.11n.

Known problem of rt2800usb. You might try the original vendor driver[1]
if you want to use the device as STA. Are you running this test on ARM?
rt2800usb runs *extremely* poor with Raspi, e.g.

With the vendor driver rt5572..., I'm getting > 100MBit/s (measured w/
netperf) running at 2.4 GHz and 40 MHz even through reinforced concrete
floor using a rt5372 chip, e.g. - even w/ Raspberry Pi.

[1] http://www.mediatek.com/en/downloads/



Kind regards,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Not reaching optimum speeds with IEEE 802.11n

2014-09-10 Thread Andreas Hartmann
Hello Helmut!

Helmut Schaa wrote:
> On Wed, Sep 10, 2014 at 10:42 AM, Arend van Spriel  wrote:
>> On 09/10/14 03:26, Sourav wrote:
>>> We are using Ralink chip Rt3072L (using rt2800usb drivers rt2800usb.c),
> 
> The Ralink USB hardware is quite bad in reporting TX status and as
> such minstrel_ht cannot do proper rate selection.

Rate control of the vendor driver seems to work just fine (or at least
better as minstrel_ht).

Iow: minstrel_ht doesn't meet the requirements of ralink chipsets :-).

But this is not the only problem of rt2800usb. As long as a driver has
the ability to damage a device [1], there is something more basically
broken!


[1] http://thread.gmane.org/gmane.linux.kernel.wireless.general/126856


Regards,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] ath10k: make ath10k_wmi_cmd_send() public

2014-09-10 Thread Kalle Valo
We need this function to send wmi packets from testmode.c.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/wmi.c |5 ++---
 drivers/net/wireless/ath/ath10k/wmi.h |4 
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index e7edc89cfcd0..67af370012f9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -624,7 +624,7 @@ int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
return ret;
 }
 
-static struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)
+struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)
 {
struct sk_buff *skb;
u32 round_len = roundup(len, 4);
@@ -725,8 +725,7 @@ static void ath10k_wmi_op_ep_tx_credits(struct ath10k *ar)
wake_up(&ar->wmi.tx_credits_wq);
 }
 
-static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
-  u32 cmd_id)
+int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id)
 {
int ret = -EOPNOTSUPP;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index bdb2e6cc0f4c..f8c1afbdb442 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -4737,6 +4737,10 @@ int ath10k_wmi_wait_for_service_ready(struct ath10k *ar);
 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar);
 
 int ath10k_wmi_connect(struct ath10k *ar);
+
+struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len);
+int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
+
 int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
const struct wmi_channel_arg *);
 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt);

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/2] ath10k: testmode support

2014-09-10 Thread Kalle Valo
Hi,

latest version of my testmode patches. Getting closer, more or less cosmetic
changes this time :)

v4:

* fix comment style (Michal)

* add extra checks for at->testmode.utf (Michal)

* add __ath10k_tm_cmd_utf_stop() and call it from
  ath10k_testmode_destroy() (Michal)

v3:

* remove false "fall through" comment in ath10k_start() (Michal)

* fix multiline comment style (Michal)

* put testmode interface definitions to testmode_uapi.h (or similar) (Johannes)

* document __set_bit(ar->fw_features) better (Michal)

* ath10k_tm_cmd_utf_start(): return ar->fw_feature value if there's an error

* free firmware in ath10k_tm_cmd_utf_start() when an error happens (Michal)

* ath10k_tm_cmd_utf_start(): move hif_power_down() to err_power_down label


v2:

* check error from ath10k_wmi_alloc_skb() (Michal)

* int err -> int ret (Michal)

* fix conflicts in core.c

* add ar->testmode.utf_monitor to check if ath10k_tm_event_wmi()
  should deliver WMI events or not

* print mode in ath10k_download_fw() log messages

* set ar->testmode.utf to NULL after it's released (Michal)

* release ar->testmode.utf also in ath10k_tm_cmd_utf_stop()

* rename ath10k_testmode_unregister() to ath10k_testmode_destroy()

* call ath10k_core_stop() in ath10k_testmode_destroy() (Michal)

* document wmi packet format in testmode commands (Michal)

* consume WMI packets so that mac80211 calls are not made in UTF mode (Michal)

* force to use 10x WMI interface with UTF firmware

* API change: remove ATH10K_TM_CMD_EVENT_WMI, use ATH10K_TM_CMD_WMI also for 
events

* API change: add major and minor version numbers to
  ATH10K_TM_CMD_GET_VERSION for the user space more easily to detect
  interface changes

* use conf_mutex in ath10k_tm_cmd_wmi()

* print "UTF firmware started" and "UTF firmware stopped"

* print "testmode %d" in ath10k_print_driver_info()

* don't call ath10k_wait_for_suspend() in UTF mode

---

Kalle Valo (2):
  ath10k: make ath10k_wmi_cmd_send() public
  ath10k: add testmode


 drivers/net/wireless/ath/ath10k/Makefile |1 
 drivers/net/wireless/ath/ath10k/core.c   |   88 --
 drivers/net/wireless/ath/ath10k/core.h   |   22 +-
 drivers/net/wireless/ath/ath10k/debug.c  |5 
 drivers/net/wireless/ath/ath10k/debug.h  |1 
 drivers/net/wireless/ath/ath10k/hw.h |2 
 drivers/net/wireless/ath/ath10k/mac.c|9 +
 drivers/net/wireless/ath/ath10k/testmode.c   |  381 ++
 drivers/net/wireless/ath/ath10k/testmode.h   |   46 +++
 drivers/net/wireless/ath/ath10k/testmode_i.h |   70 +
 drivers/net/wireless/ath/ath10k/wmi.c|   23 +-
 drivers/net/wireless/ath/ath10k/wmi.h|4 
 12 files changed, 619 insertions(+), 33 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode.c
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode.h
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode_i.h

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/2] ath10k: add testmode

2014-09-10 Thread Kalle Valo
Add testmode interface for starting and using UTF firmware which is used to run
factory tests. This is implemented by adding new state ATH10K_STATE_UTF and user
space can enable this state with ATH10K_TM_CMD_UTF_START command. To go back to
normal mode user space can send ATH10K_TM_CMD_UTF_STOP.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/Makefile |1 
 drivers/net/wireless/ath/ath10k/core.c   |   88 --
 drivers/net/wireless/ath/ath10k/core.h   |   22 +-
 drivers/net/wireless/ath/ath10k/debug.c  |5 
 drivers/net/wireless/ath/ath10k/debug.h  |1 
 drivers/net/wireless/ath/ath10k/hw.h |2 
 drivers/net/wireless/ath/ath10k/mac.c|9 +
 drivers/net/wireless/ath/ath10k/testmode.c   |  381 ++
 drivers/net/wireless/ath/ath10k/testmode.h   |   46 +++
 drivers/net/wireless/ath/ath10k/testmode_i.h |   70 +
 drivers/net/wireless/ath/ath10k/wmi.c|   18 +
 11 files changed, 613 insertions(+), 30 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode.c
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode.h
 create mode 100644 drivers/net/wireless/ath/ath10k/testmode_i.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index 2cfb63ca9327..8b1b1adb477a 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -11,6 +11,7 @@ ath10k_core-y += mac.o \
 bmi.o
 
 ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
+ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
 ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
 
 obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index eadb22519912..cee18c89d7f2 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -26,6 +26,7 @@
 #include "bmi.h"
 #include "debug.h"
 #include "htt.h"
+#include "testmode.h"
 
 unsigned int ath10k_debug_mask;
 static bool uart_print;
@@ -257,21 +258,42 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
return 0;
 }
 
-static int ath10k_download_fw(struct ath10k *ar)
+static int ath10k_download_fw(struct ath10k *ar, enum ath10k_firmware_mode 
mode)
 {
-   u32 address;
+   u32 address, data_len;
+   const char *mode_name;
+   const void *data;
int ret;
 
address = ar->hw_params.patch_load_addr;
 
-   ret = ath10k_bmi_fast_download(ar, address, ar->firmware_data,
-  ar->firmware_len);
+   switch (mode) {
+   case ATH10K_FIRMWARE_MODE_NORMAL:
+   data = ar->firmware_data;
+   data_len = ar->firmware_len;
+   mode_name = "normal";
+   break;
+   case ATH10K_FIRMWARE_MODE_UTF:
+   data = ar->testmode.utf->data;
+   data_len = ar->testmode.utf->size;
+   mode_name = "utf";
+   break;
+   default:
+   ath10k_err(ar, "unknown firmware mode: %d\n", mode);
+   return -EINVAL;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "boot uploading firmware image %p len %d mode %s\n",
+  data, data_len, mode_name);
+
+   ret = ath10k_bmi_fast_download(ar, address, data, data_len);
if (ret) {
-   ath10k_err(ar, "could not write fw (%d)\n", ret);
-   goto exit;
+   ath10k_err(ar, "failed to download %s firmware: %d\n",
+  mode_name, ret);
+   return ret;
}
 
-exit:
return ret;
 }
 
@@ -567,7 +589,8 @@ success:
return 0;
 }
 
-static int ath10k_init_download_firmware(struct ath10k *ar)
+static int ath10k_init_download_firmware(struct ath10k *ar,
+enum ath10k_firmware_mode mode)
 {
int ret;
 
@@ -583,7 +606,7 @@ static int ath10k_init_download_firmware(struct ath10k *ar)
return ret;
}
 
-   ret = ath10k_download_fw(ar);
+   ret = ath10k_download_fw(ar, mode);
if (ret) {
ath10k_err(ar, "failed to download firmware: %d\n", ret);
return ret;
@@ -685,12 +708,15 @@ static void ath10k_core_restart(struct work_struct *work)
case ATH10K_STATE_WEDGED:
ath10k_warn(ar, "device is wedged, will not restart\n");
break;
+   case ATH10K_STATE_UTF:
+   ath10k_warn(ar, "firmware restart in UTF mode not supported\n");
+   break;
}
 
mutex_unlock(&ar->conf_mutex);
 }
 
-int ath10k_core_start(struct ath10k *ar)
+int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode)
 {
int status;
 
@@ -703,7 +729,7 @@ int ath10k_core_start(struct ath10k *ar)
goto err;
}
 
-   status = ath10k_init_download_firmware(ar);
+ 

Re: [PATCH] ath10k: Support firmware crash-by-assert.

2014-09-10 Thread Kalle Valo
gree...@candelatech.com writes:

> From: Ben Greear 
>
> 10.1 firmware does not have an official way to
> cause assert on purpose, but it can be done with
> carefully crafted WMI command.  This is a different
> kind of crash from the 'hard' crash, which is
> a bad memory dereference.
>
> Different crashes decode in different manners, so
> this will help the crash-report testing as well as
> offer better ways to test firmware failure and
> recovery.
>
> Signed-off-by: Ben Greear 

[...]

> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -3725,6 +3725,26 @@ int ath10k_wmi_vdev_install_key(struct ath10k *ar,
>  ar->wmi.cmd->vdev_install_key_cmdid);
>  }
>  
> +int ath10k_wmi_vdev_assert(struct ath10k *ar, u32 crashme)
> +{
> + struct wmi_vdev_install_key_cmd *cmd;
> + struct sk_buff *skb;
> +
> + skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
> + if (!skb)
> + return -ENOMEM;
> +
> + cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
> + memset(cmd, 0, sizeof(*cmd));
> + cmd->vdev_id = __cpu_to_le32(crashme);
> +
> + ath10k_info(ar,
> + "simulating firmware ASSERT with bad install_key vdev-id: 
> 0x%x\n",
> + cmd->vdev_id);

cmd->vdev_id is in little endian here.

> + return ath10k_wmi_cmd_send(ar, skb,
> +ar->wmi.cmd->vdev_install_key_cmdid);
> +}

As this is not a real WMI command, I would actually prefer to have this
in debug.c. With my patch "ath10k: make ath10k_wmi_cmd_send() public"
that's possible now.

I can do the changes and will send v2 shortly. Just need to test it
first.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ath10k: support firmware crash-by-assert

2014-09-10 Thread Kalle Valo
From: Ben Greear 

10.1 firmware does not have an official way to
cause assert on purpose, but it can be done with
carefully crafted WMI command.  This is a different
kind of crash from the 'hard' crash, which is
a bad memory dereference.

Different crashes decode in different manners, so
this will help the crash-report testing as well as
offer better ways to test firmware failure and
recovery.

kvalo: move the wmi command creation to debug.c, modify
the info print

Signed-off-by: Ben Greear 
Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/debug.c |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index f948a4d8ee59..c5d01058c2a3 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
.llseek = default_llseek,
 };
 
+/* This is a clean assert crash in firmware. */
+static int ath10k_debug_fw_assert(struct ath10k *ar)
+{
+   struct wmi_vdev_install_key_cmd *cmd;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
+   if (!skb)
+   return -ENOMEM;
+
+   cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
+   memset(cmd, 0, sizeof(*cmd));
+
+   /* big enough number so that firmware asserts */
+   cmd->vdev_id = __cpu_to_le32(0x7ffe);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+  ar->wmi.cmd->vdev_install_key_cmdid);
+}
+
 static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
@@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file 
*file,
   " WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
   " supports that command.\n `hard` - this will send"
   " to firmware command with illegal parameters"
-  " causing firmware crash.\n";
+  " causing firmware crash.\n"
+  "`assert` - this will send special illegal parameter"
+  " to firmware to cause assert failure"
+  " and crash.\n";
 
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
 }
@@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file 
*file,
 */
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
ar->wmi.vdev_param->rts_threshold, 0);
+   } else if (!strcmp(buf, "assert")) {
+   ath10k_info(ar, "simulating firmware assert crash\n");
+   ret = ath10k_debug_fw_assert(ar);
} else {
ret = -EINVAL;
goto exit;

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ath10k: fix debugfs_create_dir() checking

2014-09-10 Thread Kalle Valo
Michal Kazior  writes:

> The function may return an -ENODEV if debugfs is
> disabled in kernel. This should originally be
> guarded by ath10k's Kconfig but it still makes
> sense to check for the non-NULL errno return
> value.
>

[...]

> Reported-by: Matteo Croce 
> Signed-off-by: Michal Kazior 
> ---
>
> Notes:
> v2:
>  * fix commit subject (sorry for the noise!)
> 
> v3:
>  * remove Kconfig patch (I accidentally amended something I shouldn't 
> have,
>sorry for the noise again! I guess I need a break..)
>
> @Kalle:
>
>  - this patch prevents kernel oops but ath10k will
>fail to load
>
>  - Matteo's patch prevents kernel oops and ath10k
>will load fine
>
> Since mine is just an extra precaution feel free
> to drop all but the first paragraph of my commit
> message if you want to.

Thanks, I just left the first paragraph like you recommended. Also I had
a conflict with this patch, please double check my resolution in
ath-next-test:

https://github.com/kvalo/ath/commit/bee6d655eefe488b76998c9c0018a4e6b0828de6

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iwlwifi no authentication with AP - Re: pull request: wireless-next 2014-09-08

2014-09-10 Thread Oliver Hartkopp
On 10.09.2014 11:23, Oliver Hartkopp wrote:
> Hi all,
> 
> yes for me too.
> 
> Although I only could test it here with my mobile hotspot which only supports
> WEP ... but before that hotspot was not working too.
> 
> I'll check with my WPA2 setup again when I'm back home (if it's still needed).
> 

Just fyi - it also works @home with WPA2.
Tnx, Oliver

> So far feel free to add my
> 
> Reported-by: Oliver Hartkopp 
> Tested-by: Oliver Hartkopp 
> 
> Many thanks for your quick reaction!
> 
> Best regards,
> Oliver
> 
> On 10.09.2014 11:16, Vadim Kochan wrote:
>> Hi,
>>
>> Your patch works for me.
>>
>> On Wed, Sep 10, 2014 at 11:24 AM, Emmanuel Grumbach  
>> wrote:
>>> On Wed, Sep 10, 2014 at 8:01 AM, Oliver Hartkopp  
>>> wrote:
 On 10.09.2014 00:07, Vadim Kochan wrote:
> I have the same issue with iwlwifi.

 I tried an old zd1211 wireless USB stick to check if this problem is 80211
 related. But the USB stick works fine (I'm using it right now).
 So its definitely looks like an iwlwifi issue.

> iwlwifi :02:00.0: fail to flush all tx fifo queues Q 0

 Wasn't there any change in the iwlwifi tx path recently??
>>>
>>> Can you please try the patch attached? It works for me.
>>>

 Regards,
 Oliver

>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ath10k: support firmware crash-by-assert

2014-09-10 Thread Ben Greear

On 09/10/2014 08:59 AM, Kalle Valo wrote:

From: Ben Greear 

10.1 firmware does not have an official way to
cause assert on purpose, but it can be done with
carefully crafted WMI command.  This is a different
kind of crash from the 'hard' crash, which is
a bad memory dereference.

Different crashes decode in different manners, so
this will help the crash-report testing as well as
offer better ways to test firmware failure and
recovery.

kvalo: move the wmi command creation to debug.c, modify
the info print


This looks fine to me.  I have not tested this version.

Thanks,
Ben



Signed-off-by: Ben Greear 
Signed-off-by: Kalle Valo 
---
  drivers/net/wireless/ath/ath10k/debug.c |   28 +++-
  1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index f948a4d8ee59..c5d01058c2a3 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
.llseek = default_llseek,
  };

+/* This is a clean assert crash in firmware. */
+static int ath10k_debug_fw_assert(struct ath10k *ar)
+{
+   struct wmi_vdev_install_key_cmd *cmd;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
+   if (!skb)
+   return -ENOMEM;
+
+   cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
+   memset(cmd, 0, sizeof(*cmd));
+
+   /* big enough number so that firmware asserts */
+   cmd->vdev_id = __cpu_to_le32(0x7ffe);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+  ar->wmi.cmd->vdev_install_key_cmdid);
+}
+
  static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
 char __user *user_buf,
 size_t count, loff_t *ppos)
@@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file 
*file,
   " WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
   " supports that command.\n `hard` - this will send"
   " to firmware command with illegal parameters"
-  " causing firmware crash.\n";
+  " causing firmware crash.\n"
+  "`assert` - this will send special illegal parameter"
+  " to firmware to cause assert failure"
+  " and crash.\n";

return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
  }
@@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file 
*file,
 */
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
ar->wmi.vdev_param->rts_threshold, 0);
+   } else if (!strcmp(buf, "assert")) {
+   ath10k_info(ar, "simulating firmware assert crash\n");
+   ret = ath10k_debug_fw_assert(ar);
} else {
ret = -EINVAL;
goto exit;

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




--
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cfg80211: don't put kek/kck/replay counter on the stack

2014-09-10 Thread Emmanuel Grumbach
From: Johannes Berg 

There's no need to put the values on the stack, just pass a
pointer to the data in the nl80211 message. This reduces stack
usage and avoids potential issues with putting sensitive data
on the stack.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 include/net/cfg80211.h | 10 --
 net/wireless/nl80211.c | 10 +++---
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 825ffd0..fd24cac 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1980,14 +1980,12 @@ struct cfg80211_wowlan_wakeup {
 
 /**
  * struct cfg80211_gtk_rekey_data - rekey data
- * @kek: key encryption key
- * @kck: key confirmation key
- * @replay_ctr: replay counter
+ * @kek: key encryption key (NL80211_KEK_LEN bytes)
+ * @kck: key confirmation key (NL80211_KCK_LEN bytes)
+ * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
  */
 struct cfg80211_gtk_rekey_data {
-   u8 kek[NL80211_KEK_LEN];
-   u8 kck[NL80211_KCK_LEN];
-   u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
+   const u8 *kek, *kck, *replay_ctr;
 };
 
 /**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 75e81be..5c6e54b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8959,13 +8959,9 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, 
struct genl_info *info)
if (nla_len(tb[NL80211_REKEY_DATA_KCK]) != NL80211_KCK_LEN)
return -ERANGE;
 
-   memcpy(rekey_data.kek, nla_data(tb[NL80211_REKEY_DATA_KEK]),
-  NL80211_KEK_LEN);
-   memcpy(rekey_data.kck, nla_data(tb[NL80211_REKEY_DATA_KCK]),
-  NL80211_KCK_LEN);
-   memcpy(rekey_data.replay_ctr,
-  nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]),
-  NL80211_REPLAY_CTR_LEN);
+   rekey_data.kek = nla_data(tb[NL80211_REKEY_DATA_KEK]);
+   rekey_data.kck = nla_data(tb[NL80211_REKEY_DATA_KCK]);
+   rekey_data.replay_ctr = nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]);
 
wdev_lock(wdev);
if (!wdev->current_bss) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cfg80211/mac80211: add wmm info to assoc event

2014-09-10 Thread Emmanuel Grumbach
From: Eliad Peller 

Userspace might need to know what queues are configured
for uapsd (e.g. for setting proper default values in tspecs).

Add this bitmap to the association event (inside wmm
nested attribute)

Add additional parameter to cfg80211_rx_assoc_resp,
and update its callers.

Signed-off-by: Eliad Peller 
Signed-off-by: Emmanuel Grumbach 
---
 include/net/cfg80211.h |  4 +++-
 net/mac80211/mlme.c|  9 -
 net/wireless/mlme.c|  4 ++--
 net/wireless/nl80211.c | 28 +---
 net/wireless/nl80211.h |  3 ++-
 5 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0d17ec9..825ffd0 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3925,6 +3925,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const 
u8 *addr);
  * moves to cfg80211 in this call
  * @buf: authentication frame (header + body)
  * @len: length of the frame data
+ * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
  *
  * After being asked to associate via cfg80211_ops::assoc() the driver must
  * call either this function or cfg80211_auth_timeout().
@@ -3933,7 +3934,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const 
u8 *addr);
  */
 void cfg80211_rx_assoc_resp(struct net_device *dev,
struct cfg80211_bss *bss,
-   const u8 *buf, size_t len);
+   const u8 *buf, size_t len,
+   int uapsd_queues);
 
 /**
  * cfg80211_assoc_timeout - notification of timed out association
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a7b92f5..efa41fc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2817,6 +2817,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct 
ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data;
u16 capab_info, status_code, aid;
struct ieee802_11_elems elems;
+   int ac, uapsd_queues = -1;
u8 *pos;
bool reassoc;
struct cfg80211_bss *bss;
@@ -2886,9 +2887,15 @@ static void ieee80211_rx_mgmt_assoc_resp(struct 
ieee80211_sub_if_data *sdata,
 * is set can cause the interface to go idle
 */
ieee80211_destroy_assoc_data(sdata, true);
+
+   /* get uapsd queues configuration */
+   uapsd_queues = 0;
+   for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
+   if (sdata->tx_conf[ac].uapsd)
+   uapsd_queues |= BIT(ac);
}
 
-   cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len);
+   cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len, uapsd_queues);
 }
 
 static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 369fc33..2c52b59 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -19,7 +19,7 @@
 
 
 void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
-   const u8 *buf, size_t len)
+   const u8 *buf, size_t len, int uapsd_queues)
 {
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -43,7 +43,7 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct 
cfg80211_bss *bss,
return;
}
 
-   nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL);
+   nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL, uapsd_queues);
/* update current_bss etc., consumes the bss reference */
__cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs,
  status_code,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cf178d2..75e81be 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10402,7 +10402,8 @@ nla_put_failure:
 static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev,
struct net_device *netdev,
const u8 *buf, size_t len,
-   enum nl80211_commands cmd, gfp_t gfp)
+   enum nl80211_commands cmd, gfp_t gfp,
+   int uapsd_queues)
 {
struct sk_buff *msg;
void *hdr;
@@ -10422,6 +10423,19 @@ static void nl80211_send_mlme_event(struct 
cfg80211_registered_device *rdev,
nla_put(msg, NL80211_ATTR_FRAME, len, buf))
goto nla_put_failure;
 
+   if (uapsd_queues >= 0) {
+   struct nlattr *nla_wmm =
+   nla_nest_start(msg, NL80211_ATTR_STA_WME);
+   if (!nla_wmm)
+   goto nla_put_failure;
+
+   if (nla_put_u8(msg, NL80211_STA_WME_UAPSD_QUEUES,
+  uapsd_queues))
+   goto nla_put_failure

[PATCH net-next] mac80211: Check correct skb for shared states before freeing original

2014-09-10 Thread Alexander Duyck
The code for cloning the skb for an acknowledgement was checking to see if
the cloned skb was shared and if it was it was then freeing the original
skb.  Since a clone should never really be shared I suspect that the
intention was to avoid freeing the clone if the original was shared.  As
such I am updating the code so that if the original is shared we free the
original and use the clone.  This avoids unnecessary work in the next
section where we would be cloning the skb if the original is shared.

Signed-off-by: Alexander Duyck 
---
 net/mac80211/tx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 925c39f..e527cd3 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2087,7 +2087,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff 
*skb,
if (id >= 0) {
info_id = id;
info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-   } else if (skb_shared(skb)) {
+   } else if (skb_shared(orig_skb)) {
kfree_skb(orig_skb);
} else {
kfree_skb(skb);

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] mac80211: Check correct skb for shared states before freeing original

2014-09-10 Thread Johannes Berg
On Wed, 2014-09-10 at 16:06 -0400, Alexander Duyck wrote:
> The code for cloning the skb for an acknowledgement was checking to see if
> the cloned skb was shared and if it was it was then freeing the original
> skb.  Since a clone should never really be shared I suspect that the
> intention was to avoid freeing the clone if the original was shared.  As
> such I am updating the code so that if the original is shared we free the
> original and use the clone.  This avoids unnecessary work in the next
> section where we would be cloning the skb if the original is shared.

Thanks, yeah, I admit that this is clearly fishy.

> @@ -2087,7 +2087,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff 
> *skb,
>   if (id >= 0) {
>   info_id = id;
>   info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;

Luckily, we practically always go into this path.

> - } else if (skb_shared(skb)) {
> + } else if (skb_shared(orig_skb)) {
>   kfree_skb(orig_skb);
>   } else {
>   kfree_skb(skb);

We have a clone already so we could just remove the whole "else if" I
think, but I'm guessing my intent was to keep it accounted to the socket
where possible rather than freeing the original in all cases.

So yeah, I think this makes sense. Maybe we should add a comment to the
if though to explain this?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] mac80211: Check correct skb for shared states before freeing original

2014-09-10 Thread Alexander Duyck
On 09/10/2014 01:33 PM, Johannes Berg wrote:
> On Wed, 2014-09-10 at 16:06 -0400, Alexander Duyck wrote:
>> The code for cloning the skb for an acknowledgement was checking to see if
>> the cloned skb was shared and if it was it was then freeing the original
>> skb.  Since a clone should never really be shared I suspect that the
>> intention was to avoid freeing the clone if the original was shared.  As
>> such I am updating the code so that if the original is shared we free the
>> original and use the clone.  This avoids unnecessary work in the next
>> section where we would be cloning the skb if the original is shared.
> 
> Thanks, yeah, I admit that this is clearly fishy.
> 
>> @@ -2087,7 +2087,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff 
>> *skb,
>>  if (id >= 0) {
>>  info_id = id;
>>  info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
> 
> Luckily, we practically always go into this path.
> 
>> -} else if (skb_shared(skb)) {
>> +} else if (skb_shared(orig_skb)) {
>>  kfree_skb(orig_skb);
>>  } else {
>>  kfree_skb(skb);
> 
> We have a clone already so we could just remove the whole "else if" I
> think, but I'm guessing my intent was to keep it accounted to the socket
> where possible rather than freeing the original in all cases.
> 
> So yeah, I think this makes sense. Maybe we should add a comment to the
> if though to explain this?
> 
> johannes

Actually I think we may need to take a different approach.  The reason I
was in this code was to take a look at a possible refcount issue.

I'll be submitting another patch in a few minutes and will probably be
dropping some of this code anyway.

Thanks,

Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 0/2] Address reference counting issues with sock_queue_err_skb

2014-09-10 Thread Alexander Duyck
After looking over the code for skb_clone_sk after some comments made by
Eric Dumazet I have come to the conclusion that skb_clone_sk is taking the
correct approach in how to handle the sk_refcnt when creating a buffer that
is eventually meant to be returned to the socket via the sock_queue_err_skb
function.

However upon review of other callers I found what I believe to be a
possible reference count issue in the path for handling "wifi ack" packets.
To address this I have applied the same logic that is currently in place so
that the sk_refcnt will be forced to stay at least 1, or we will not
provide an skb to return in the sk_error_queue.

---

Alexander Duyck (2):
  skb: Add documentation for skb_clone_sk
  mac80211: Resolve sk_refcnt/sk_wmem_alloc issue in wifi ack path


 net/core/skbuff.c |   18 ++
 net/mac80211/tx.c |   15 ---
 2 files changed, 22 insertions(+), 11 deletions(-)

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 1/2] skb: Add documentation for skb_clone_sk

2014-09-10 Thread Alexander Duyck
This change adds some documentation to the call skb_clone_sk.  This is
meant to help clarify the purpose of the function for other developers.

Signed-off-by: Alexander Duyck 
---

v2: Updated comments to specifically call out need for sock_hold/sock_put

 net/core/skbuff.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index a18dfb0..c9da77a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3511,6 +3511,19 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
 }
 EXPORT_SYMBOL(sock_dequeue_err_skb);
 
+/**
+ * skb_clone_sk - create clone of skb, and take reference to socket
+ * @skb: the skb to clone
+ *
+ * This function creates a clone of a buffer that holds a reference on
+ * sk_refcnt.  Buffers created via this function are meant to be
+ * returned using sock_queue_err_skb, or free via kfree_skb.
+ *
+ * When passing buffers allocated with this function to sock_queue_err_skb
+ * it is necessary to wrap the call with sock_hold/sock_put in order to
+ * prevent the socket from being released prior to being enqueued on
+ * the sk_error_queue.
+ */
 struct sk_buff *skb_clone_sk(struct sk_buff *skb)
 {
struct sock *sk = skb->sk;

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/2] mac80211: Resolve sk_refcnt/sk_wmem_alloc issue in wifi ack path

2014-09-10 Thread Alexander Duyck
There is a possible issue with the use, or lack thereof of sk_refcnt and
sk_wmem_alloc in the wifi ack status functionality.

Specifically if a socket were to request acknowledgements, and the socket
were to have sk_refcnt drop to 0 resulting in it waiting on sk_wmem_alloc
to reach 0 it would be possible to have sock_queue_err_skb orphan the last
buffer, resulting in __sk_free being called on the socket.  After this the
buffer is enqueued on sk_error_queue, however the queue has already been
flushed resulting in at least a memory leak, if not a data corruption.

Signed-off-by: Alexander Duyck 
---
 net/core/skbuff.c |5 +
 net/mac80211/tx.c |   15 ---
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c9da77a..c8259ac 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3628,9 +3628,14 @@ void skb_complete_wifi_ack(struct sk_buff *skb, bool 
acked)
serr->ee.ee_errno = ENOMSG;
serr->ee.ee_origin = SO_EE_ORIGIN_TXSTATUS;
 
+   /* take a reference to prevent skb_orphan() from freeing the socket */
+   sock_hold(sk);
+
err = sock_queue_err_skb(sk, skb);
if (err)
kfree_skb(skb);
+
+   sock_put(sk);
 }
 EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);
 
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 925c39f..cf71414 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2072,30 +2072,23 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff 
*skb,
 
if (unlikely(!multicast && skb->sk &&
 skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) {
-   struct sk_buff *orig_skb = skb;
+   struct sk_buff *ack_skb = skb_clone_sk(skb);
 
-   skb = skb_clone(skb, GFP_ATOMIC);
-   if (skb) {
+   if (ack_skb) {
unsigned long flags;
int id;
 
spin_lock_irqsave(&local->ack_status_lock, flags);
-   id = idr_alloc(&local->ack_status_frames, orig_skb,
+   id = idr_alloc(&local->ack_status_frames, ack_skb,
   1, 0x1, GFP_ATOMIC);
spin_unlock_irqrestore(&local->ack_status_lock, flags);
 
if (id >= 0) {
info_id = id;
info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-   } else if (skb_shared(skb)) {
-   kfree_skb(orig_skb);
} else {
-   kfree_skb(skb);
-   skb = orig_skb;
+   kfree_skb(ack_skb);
}
-   } else {
-   /* couldn't clone -- lose tx status ... */
-   skb = orig_skb;
}
}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] zd1211rw: replace ZD_ASSERT with lockdep_assert_held()

2014-09-10 Thread Sharma, Sanjeev
-Original Message-
From: Johannes Berg [mailto:johan...@sipsolutions.net] 
Sent: Friday, August 22, 2014 5:01 PM
To: Sharma, Sanjeev
Cc: d...@gentoo.org; k...@deine-taler.de; linvi...@tuxdriver.com; 
linux-wireless@vger.kernel.org; net...@vger.kernel.org; 
linux-ker...@vger.kernel.org
Subject: Re: [PATCH] zd1211rw: replace ZD_ASSERT with lockdep_assert_held()

On Tue, 2014-08-19 at 06:39 +, Sharma, Sanjeev wrote:
> Ping for review the patch.

> Make sure it compiles ...

Any update on this patch ?

Regards
Sanjeev Sharma



Re: [PATCH v3] ath10k: fix debugfs_create_dir() checking

2014-09-10 Thread Michal Kazior
On 10 September 2014 18:14, Kalle Valo  wrote:
> Michal Kazior  writes:
[...]
>> Since mine is just an extra precaution feel free
>> to drop all but the first paragraph of my commit
>> message if you want to.
>
> Thanks, I just left the first paragraph like you recommended. Also I had
> a conflict with this patch, please double check my resolution in
> ath-next-test:
>
> https://github.com/kvalo/ath/commit/bee6d655eefe488b76998c9c0018a4e6b0828de6

Looks good, thanks!


Michał
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


CSA broken with !use_chanctx drivers?

2014-09-10 Thread Luca Coelho
Hi Michal,

Johannes and I were checking the channel switch code (namely to see if
implementing the drv_channel_switch op was fine in our case) and we saw
that CSA with non-chanctx drivers seems to be broken.

In commit 4c3ebc56 (mac80211: use chanctx reservation for STA CSA) we
lost this piece of code:

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index eccc849..931330b 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -940,52 +940,70 @@ static void ieee80211_chswitch_work(struct work_struct 
*work)
[...] 
-   if (!local->use_chanctx) {
-   local->_oper_chandef = sdata->csa_chandef;
-   /* Call "hw_config" only if doing sw channel switch.
-* Otherwise update the channel directly
-*/
-   if (!local->ops->channel_switch)
-   ieee80211_hw_config(local, 0);
-   else
-   local->hw.conf.chandef = local->_oper_chandef;
-   }
-

It seems that we're not updating the chandef in non-chanctx drivers.  Or
are we missing something?

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] zd1211rw: replace ZD_ASSERT with lockdep_assert_held()

2014-09-10 Thread Johannes Berg
On Thu, 2014-09-11 at 04:02 +, Sharma, Sanjeev wrote:
> -Original Message-
> From: Johannes Berg [mailto:johan...@sipsolutions.net] 
> Sent: Friday, August 22, 2014 5:01 PM
> To: Sharma, Sanjeev
> Cc: d...@gentoo.org; k...@deine-taler.de; linvi...@tuxdriver.com; 
> linux-wireless@vger.kernel.org; net...@vger.kernel.org; 
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH] zd1211rw: replace ZD_ASSERT with lockdep_assert_held()
> 
> On Tue, 2014-08-19 at 06:39 +, Sharma, Sanjeev wrote:
> > Ping for review the patch.
> 
> > Make sure it compiles ...
> 
> Any update on this patch ?

I don't know, do you have any update for us?

Since your patch hasn't changed, it still cannot be compiled (when
lockdep is enabled). Make sure you test your patch before you submit it
again please.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html