Re: [PATCH v2 7/8] cfg80211: Add Kconfig option for ITS-G5 band (5.9 GHz)

2015-11-27 Thread Johannes Berg
On Thu, 2015-11-26 at 22:10 +0100, Michal Sojka wrote:
> 
> Because in [1] Jouni said that
> 
>    "kernel config option + custom regdb would certainly be much
> closer to what I'd like to see from the regulatory enforcement view
> point"
> 
> I also like the fact that the help text mentions the relevant
> regulatory documents. I guess the users would appreciate that.
> 

Fair enough, but I'm not really convinced that the Kconfig option is
needed for what Jouni really required.

In any case, I spoke with him yesterday and we don't think that your
patches are going to work as is - we'll need to change the regulatory
flags it seems. I'll comment more specifically on the patches.

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 v7] Add new mac80211 driver mwlwifi.

2015-11-27 Thread Johannes Berg
On Fri, 2015-11-27 at 02:00 +, David Lin wrote:
> > Ditto - you're allowed to modify mac80211. We actually have a patch
> > like this
> > already:
> > https://git.kernel.org/cgit/linux/kernel/git/jberg/mac80211-
> > next.git/commit/?id=99e7ca44bb910f0cbfda5d9008e8517df0ebc939
> > 
> 
> Once if this patch is ready, I will modify mwlwifi to use it. Thanks.

The patch is ready now and in the tree, but that wasn't my point. My
point is that you shouldn't try to hack around mac80211 like with the
action frame interception and the mesh-amsdu-reimplementation, but
actually go fix it.

If you have issues with mac80211 like this you can ask how to fix them,
or just fix them and suggest changes/patches, but just working around
it in the driver isn't the right approach.

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 v2 5/8] cfg80211: Add support for OCB-only channels

2015-11-27 Thread Johannes Berg
On Mon, 2015-11-23 at 19:27 +0100, Michal Sojka wrote:

>  #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> index 59cabc9..b1ab77a 100644
> --- a/net/wireless/chan.c
> +++ b/net/wireless/chan.c
> @@ -804,7 +804,8 @@ static bool _cfg80211_reg_can_beacon(struct wiphy
> *wiphy,
>  {
>   bool res;
>   u32 prohibited_flags = IEEE80211_CHAN_DISABLED |
> -    IEEE80211_CHAN_RADAR;
> +    IEEE80211_CHAN_RADAR |
> +    IEEE80211_CHAN_OCB_ONLY;

So ... for the kernel, I don't *like* this approach, because it
requires touching every single driver, and every single person who
writes code in the future must be aware of the special handling for
this flag.

For userspace, however, this approach is simply impossible. Consider an
older version of wpa_supplicant, that queries the channel list and
isn't aware of the OCB_ONLY flag. This version would take the channel
list and build a scan request with it, only to get the scan rejected
since some channels it picked were only usable for OCB, as far as I can
tell.

I think the solution to this would be to redefine the CHAN_DISABLED
flag to mean "channel disabled for non-ocb mode" and add a
CHAN_OCB_ENABLED flag.

Then code that knows about OCB would simply not test CHAN_DISABLED, but
would instead test CHAN_OCB_ENABLED instead - and if that's clear OCB
would not be permitted.

However, this would have the side effect of enabling OCB *only* on OCB
channels, which might not be a good idea, for testing purposes one
might want to use the regular 2.4 or 5 GHz channels? If so, OCB could
still be made to do something like

ocb_usable = (flags & OCB_ENABLED) || !(flags & DISABLED);

or we could even make the channel list internally maintain a
CHAN_OCB_USABLE flag that essentially encodes the logic above.

In any case, this would collapse the patch down to modifying only OCB
code and nothing else, which is nice, and would keep existing userspace
working since it would just see disabled channels while ignoring the
OCB flag.

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 v2 6/8] cfg80211: reg: Add NL80211_RRF_USER_REGD_NEEDED flag

2015-11-27 Thread Johannes Berg
On Mon, 2015-11-23 at 19:27 +0100, Michal Sojka wrote:
> 
> The NL80211_RRF_USER_REGD_NEEDED flag introduced in this commit
> allows
> drivers to specify that certain band is enabled only if it is
> additionally enabled in user-supplied regulatory database. If the
> band
> is not present there, the channels are simply disabled.

I can see why you'd want this flag internally (although it'll require
rework given the comments on the previous patch) - but is there a
reason to export it in nl80211? Then again, perhaps it *would* be good
to show this information in userspace?

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 v2 02/13] ath9k: print real timer value

2015-11-27 Thread Janusz Dziedzic
In case of low HZ before this patch we saw wrong
values in debug message. Print real timeout value.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/channel.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 35802c9..dddaaea 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -356,14 +356,16 @@ static void ath_chanctx_setup_timer(struct ath_softc *sc, 
u32 tsf_time)
 {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
+   unsigned long timeout;
 
ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, tsf_time, 100);
tsf_time -= ath9k_hw_gettsf32(ah);
-   tsf_time = msecs_to_jiffies(tsf_time / 1000) + 1;
-   mod_timer(&sc->sched.timer, jiffies + tsf_time);
+   timeout = msecs_to_jiffies(tsf_time / 1000) + 1;
+   mod_timer(&sc->sched.timer, jiffies + timeout);
 
ath_dbg(common, CHAN_CTX,
-   "Setup chanctx timer with timeout: %d ms\n", 
jiffies_to_msecs(tsf_time));
+   "Setup chanctx timer with timeout: %d (%d) ms\n",
+   tsf_time / 1000, jiffies_to_msecs(timeout));
 }
 
 static void ath_chanctx_handle_bmiss(struct ath_softc *sc,
-- 
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 v2 04/13] ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear

2015-11-27 Thread Janusz Dziedzic
AP/GO will aprear after NOA, wait 1ms to be sure AP
could receive/answer this frames.

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

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index dddaaea..5640e88 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1417,6 +1417,8 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc 
*sc, struct ath_vif *avp)
target_tsf = avp->noa.next_tsf;
if (!avp->noa.absent)
target_tsf -= ATH_P2P_PS_STOP_TIME;
+   else
+   target_tsf += ATH_P2P_PS_STOP_TIME;
 
if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
@@ -1543,6 +1545,8 @@ void ath9k_p2p_ps_timer(void *priv)
tsf = ath9k_hw_gettsf32(sc->sc_ah);
if (!avp->noa.absent)
tsf += ATH_P2P_PS_STOP_TIME;
+   else
+   tsf -= ATH_P2P_PS_STOP_TIME;
 
if (!avp->noa.has_next_tsf ||
avp->noa.next_tsf - tsf > BIT(31))
-- 
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 v2 03/13] ath9k: queue null frames in case of MCC

2015-11-27 Thread Janusz Dziedzic
While mac80211 using null frames when connection polling,
we should queue this frames while NOA could be there, and
AP, P2P_GO could be not present.

Without this patch, with no traffic we often saw disconnections
while we try to send nullfunc when AP/GO wasn't present.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/xmit.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c 
b/drivers/net/wireless/ath/ath9k/xmit.c
index 26698a6..82fc76f 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2331,6 +2331,12 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff 
*skb,
 
queue = ieee80211_is_data_present(hdr->frame_control);
 
+   /* If chanctx, queue all null frames while NOA could be there */
+   if (ath9k_is_chanctx_enabled() &&
+   ieee80211_is_nullfunc(hdr->frame_control) &&
+   !txctl->force_channel)
+   queue = true;
+
/* Force queueing of all frames that belong to a virtual interface on
 * a different channel context, to ensure that they are sent on the
 * correct channel.
-- 
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 v2 01/13] ath9k: add debug messages to aggr/chanctx funcs

2015-11-27 Thread Janusz Dziedzic
Add/extend debug messages when chanctx used.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/channel.c | 11 ---
 drivers/net/wireless/ath/ath9k/hw.c  |  8 
 drivers/net/wireless/ath/ath9k/xmit.c| 15 +++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 90f5773..35802c9 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -403,7 +403,7 @@ static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
avp->offchannel_duration = sc->sched.offchannel_duration;
 
ath_dbg(common, CHAN_CTX,
-   "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
+   "offchannel noa_duration: %d, noa_start: %u, noa_index: %d\n",
avp->offchannel_duration,
avp->offchannel_start,
avp->noa_index);
@@ -443,7 +443,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc 
*sc,
avp->periodic_noa = true;
 
ath_dbg(common, CHAN_CTX,
-   "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: 
%d\n",
+   "noa_duration: %d, noa_start: %u, noa_index: %d, periodic: 
%d\n",
avp->noa_duration,
avp->noa_start,
avp->noa_index,
@@ -464,7 +464,7 @@ static void ath_chanctx_set_oneshot_noa(struct ath_softc 
*sc,
avp->noa_duration = duration + sc->sched.channel_switch_time;
 
ath_dbg(common, CHAN_CTX,
-   "oneshot noa_duration: %d, noa_start: %d, noa_index: %d, 
periodic: %d\n",
+   "oneshot noa_duration: %d, noa_start: %u, noa_index: %d, 
periodic: %d\n",
avp->noa_duration,
avp->noa_start,
avp->noa_index,
@@ -1401,6 +1401,7 @@ void ath9k_chanctx_wake_queues(struct ath_softc *sc, 
struct ath_chanctx *ctx)
 
 static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif 
*avp)
 {
+   struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
s32 tsf, target_tsf;
 
@@ -1418,6 +1419,10 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc 
*sc, struct ath_vif *avp)
if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
 
+   ath_dbg(common, CHAN_CTX, "%s absent %d tsf 0x%08X next_tsf 0x%08X 
(%dms)\n",
+   __func__, avp->noa.absent, tsf, target_tsf,
+   (target_tsf - tsf) / 1000);
+
ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, (u32) target_tsf, 
100);
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index bdfff46..4af19e4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2299,10 +2299,10 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
else
nextTbtt = bs->bs_nexttbtt;
 
-   ath_dbg(common, BEACON, "next DTIM %d\n", bs->bs_nextdtim);
-   ath_dbg(common, BEACON, "next beacon %d\n", nextTbtt);
-   ath_dbg(common, BEACON, "beacon period %d\n", beaconintval);
-   ath_dbg(common, BEACON, "DTIM period %d\n", dtimperiod);
+   ath_dbg(common, BEACON, "next DTIM %u\n", bs->bs_nextdtim);
+   ath_dbg(common, BEACON, "next beacon %u\n", nextTbtt);
+   ath_dbg(common, BEACON, "beacon period %u\n", beaconintval);
+   ath_dbg(common, BEACON, "DTIM period %u\n", dtimperiod);
 
ENABLE_REGWRITE_BUFFER(ah);
 
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c 
b/drivers/net/wireless/ath/ath9k/xmit.c
index 3e3dac3..26698a6 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1473,11 +1473,14 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, 
struct ath_txq *txq,
 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
  u16 tid, u16 *ssn)
 {
+   struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_atx_tid *txtid;
struct ath_txq *txq;
struct ath_node *an;
u8 density;
 
+   ath_dbg(common, XMIT, "%s called\n", __func__);
+
an = (struct ath_node *)sta->drv_priv;
txtid = ATH_AN_2_TID(an, tid);
txq = txtid->txq;
@@ -1512,10 +1515,13 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct 
ieee80211_sta *sta,
 
 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 {
+   struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_node *an = (struct ath_node *)sta->drv_priv;
struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
struct ath_txq *txq = txtid->txq;
 
+   ath_dbg(common, XMIT, "%s called\n", __func__);
+
ath_txq_lock(sc, txq);
txtid->active = false;
ath_tx_flush_tid(sc, txtid);
@@ -1526,11 +1532,14 @@ void ath_tx_ag

[PATCH v2 06/13] ath9k: setup correct skb priority for nullfunc

2015-11-27 Thread Janusz Dziedzic
After queue nullfunc for MCC case, we hit WARN_ON
in xmit.c:2398 while skb priority wasn't set.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/channel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 28bbbef..2afb8da 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1101,6 +1101,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, 
struct ath_vif *avp,
nullfunc->frame_control |=
cpu_to_le16(IEEE80211_FCTL_PM);
 
+   skb->priority = 7;
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, &sta)) {
dev_kfree_skb_any(skb);
-- 
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 v2 13/13] ath9k: remove ath9k_mod_tsf64_tu

2015-11-27 Thread Janusz Dziedzic
Remove ath9k_mod_tsf64_tu() function while we could
use div_u64_rem() function.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/common-beacon.c | 22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c 
b/drivers/net/wireless/ath/ath9k/common-beacon.c
index 6ad4447..01d6d32 100644
--- a/drivers/net/wireless/ath/ath9k/common-beacon.c
+++ b/drivers/net/wireless/ath/ath9k/common-beacon.c
@@ -18,30 +18,16 @@
 
 #define FUDGE 2
 
-/* Calculate the modulo of a 64 bit TSF snapshot with a TU divisor */
-static u32 ath9k_mod_tsf64_tu(u64 tsf, u32 div_tu)
-{
-   u32 tsf_mod, tsf_hi, tsf_lo, mod_hi, mod_lo;
-
-   tsf_mod = tsf & (BIT(10) - 1);
-   tsf_hi = tsf >> 32;
-   tsf_lo = ((u32) tsf) >> 10;
-
-   mod_hi = tsf_hi % div_tu;
-   mod_lo = ((mod_hi << 22) + tsf_lo) % div_tu;
-
-   return (mod_lo << 10) | tsf_mod;
-}
-
 static u32 ath9k_get_next_tbtt(struct ath_hw *ah, u64 tsf,
   unsigned int interval)
 {
-   unsigned int offset;
+   unsigned int offset, divisor;
 
tsf += TU_TO_USEC(FUDGE + ah->config.sw_beacon_response_time);
-   offset = ath9k_mod_tsf64_tu(tsf, interval);
+   divisor = TU_TO_USEC(interval);
+   div_u64_rem(tsf, divisor, &offset);
 
-   return (u32) tsf + TU_TO_USEC(interval) - offset;
+   return (u32) tsf + divisor - offset;
 }
 
 /*
-- 
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 v2 12/13] ath9k: MCC, print time elapsed between events

2015-11-27 Thread Janusz Dziedzic
This is useful for MCC debugging and bug fixing.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 19 +--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4616229..952a467 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -983,6 +983,7 @@ struct ath_softc {
struct ath_offchannel offchannel;
struct ath_chanctx *next_chan;
struct completion go_beacon;
+   struct timespec last_event_time;
 #endif
 
unsigned long driver_data;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 8ab856c..65ad7be 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -226,6 +226,20 @@ static const char *chanctx_state_string(enum 
ath_chanctx_state state)
}
 }
 
+static const u32 chanctx_event_delta(struct ath_softc *sc)
+{
+   u64 ms;
+   struct timespec ts, *old;
+
+   getrawmonotonic(&ts);
+   old = &sc->last_event_time;
+   ms = ts.tv_sec * 1000 + ts.tv_nsec / 100;
+   ms -= old->tv_sec * 1000 + old->tv_nsec / 100;
+   sc->last_event_time = ts;
+
+   return (u32)ms;
+}
+
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -507,10 +521,11 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
 
spin_lock_bh(&sc->chan_lock);
 
-   ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s\n",
+   ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s, 
delta: %u ms\n",
sc->cur_chan->chandef.center_freq1,
chanctx_event_string(ev),
-   chanctx_state_string(sc->sched.state));
+   chanctx_state_string(sc->sched.state),
+   chanctx_event_delta(sc));
 
switch (ev) {
case ATH_CHANCTX_EVENT_BEACON_PREPARE:
-- 
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 v2 09/13] ath9k: request NOA update when chanctx active

2015-11-27 Thread Janusz Dziedzic
Request NOA update when chanctx active, also in case
of STA.

Signed-off-by: Janusz Dziedzic 
---
This depends on:
mac80211: add new IEEE80211_VIF_GET_NOA_UPDATE flag

 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 drivers/net/wireless/ath/ath9k/main.c| 5 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 5a1ede6..c94d7d9 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1439,7 +1439,7 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, 
struct ieee80211_vif *vif)
if (!sc->p2p_ps_timer)
return;
 
-   if (vif->type != NL80211_IFTYPE_STATION || !vif->p2p)
+   if (vif->type != NL80211_IFTYPE_STATION)
return;
 
sc->p2p_ps_vif = avp;
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index d184e68..ab46a4d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -974,7 +974,7 @@ static void ath9k_update_bssid_mask(struct ath_softc *sc,
if (ctx->nvifs_assigned != 1)
continue;
 
-   if (!avp->vif->p2p || !iter_data->has_hw_macaddr)
+   if (!iter_data->has_hw_macaddr)
continue;
 
ether_addr_copy(common->curbssid, avp->bssid);
@@ -1251,6 +1251,9 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
sc->cur_chan->nvifs++;
 
+   if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled())
+   vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
+
if (ath9k_uses_beacons(vif->type))
ath9k_beacon_assign_slot(sc, vif);
 
-- 
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 v2 11/13] ath9k: MCC add sta_ap_ratio module param

2015-11-27 Thread Janusz Dziedzic
In case of MCC we can setup STA/AP(GO) ratio.
Eg. setting sta_ap_ratio=80
STA will get 80% of time, while AP(GO) 20%.
Setup correct ctwindow.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  2 +
 drivers/net/wireless/ath/ath9k/channel.c | 69 +---
 drivers/net/wireless/ath/ath9k/hw.h  |  1 +
 drivers/net/wireless/ath/ath9k/init.c|  3 ++
 4 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index b42f4a9..4616229 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -37,6 +37,7 @@ extern int ath9k_modparam_nohwcrypt;
 extern int ath9k_led_blink;
 extern bool is_ath9k_unloaded;
 extern int ath9k_use_chanctx;
+extern int ath9k_sta_ap_ratio;
 
 /*/
 /* Descriptor Management */
@@ -335,6 +336,7 @@ struct ath_chanctx {
struct timespec tsf_ts;
u64 tsf_val;
u32 last_beacon;
+   u32 ctwindow;
 
int flush_timeout;
u16 txpower;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index c94d7d9..8ab856c 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -313,11 +313,21 @@ ath_chanctx_get_next(struct ath_softc *sc, struct 
ath_chanctx *ctx)
return &sc->chanctx[!idx];
 }
 
+static u32 get_ratio(u32 beacon_int)
+{
+   if (ath9k_sta_ap_ratio < 20 ||
+   ath9k_sta_ap_ratio > 80)
+   return beacon_int / 2;
+
+   return (beacon_int * ath9k_sta_ap_ratio) / 100;
+}
+
 static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
 {
+   struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *prev, *cur;
struct timespec ts;
-   u32 cur_tsf, prev_tsf, beacon_int;
+   u32 cur_tsf, prev_tsf, beacon_int, diff;
s32 offset;
 
beacon_int = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);
@@ -344,7 +354,14 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc 
*sc)
if (offset < 0 || offset > 3 * beacon_int)
return;
 
-   offset = beacon_int / 2 - (offset % beacon_int);
+   diff = 2 * prev->ctwindow;
+   diff += sc->sched.channel_switch_time;
+   if (diff > beacon_int / 2)
+   diff = beacon_int / 2;
+
+   ath_dbg(common, CHAN_CTX, "Setup beacon interval offset %u ms\n",
+   diff / 1000);
+   offset = diff - (offset % beacon_int);
prev->tsf_val += offset;
 }
 
@@ -435,7 +452,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc 
*sc,
sc->sched.channel_switch_time;
else
avp->noa_duration =
-   TU_TO_USEC(cur_conf->beacon_interval) / 2 +
+   TU_TO_USEC(get_ratio(cur_conf->beacon_interval)) +
sc->sched.channel_switch_time;
 
if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
@@ -481,7 +498,8 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
struct ath_beacon_config *cur_conf;
struct ath_vif *avp = NULL;
struct ath_chanctx *ctx;
-   u32 tsf_time;
+   u32 tsf_time, defer_time;
+   u32 beacon_resp_time = ah->config.sw_beacon_response_time;
u32 beacon_int;
 
if (vif)
@@ -565,10 +583,26 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
cur_conf = &sc->cur_chan->beacon;
beacon_int = TU_TO_USEC(cur_conf->beacon_interval);
 
-   /* defer channel switch by a quarter beacon interval */
-   tsf_time = sc->sched.next_tbtt + beacon_int / 4;
+   /* defer channel switch */
+   defer_time = beacon_int - get_ratio(beacon_int);
+   defer_time -= sc->sched.channel_switch_time;
+   defer_time /= 2;
+
+   if (defer_time < TU_TO_USEC(2 + beacon_resp_time)) {
+   defer_time *= 2;
+   if (defer_time > TU_TO_USEC(3 + beacon_resp_time))
+   defer_time -= TU_TO_USEC(3 + beacon_resp_time);
+   else
+   defer_time = 1000;
+   }
+
+   ath_dbg(common, CHAN_CTX, "Setup defer_time %u (%u ms)\n",
+   defer_time, defer_time / 1000);
+
+   tsf_time = sc->sched.next_tbtt + defer_time;
sc->sched.switch_start_time = tsf_time;
sc->cur_chan->last_beacon = sc->sched.next_tbtt;
+   sc->cur_chan->ctwindow = defer_time;
 
/*
 * If an offchannel switch is scheduled to happen after
@@ -707,7 +741,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_TIMER;

[PATCH v2 05/13] ath9k: use u32 when calculate tsf

2015-11-27 Thread Janusz Dziedzic
Use u32 while ath9k_hw_gettsf32() and
ath9k_hw_gen_timer_start() require u32.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 5640e88..28bbbef 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1405,7 +1405,7 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc 
*sc, struct ath_vif *avp)
 {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
-   s32 tsf, target_tsf;
+   u32 tsf, target_tsf;
 
if (!avp || !avp->noa.has_next_tsf)
return;
@@ -1427,7 +1427,7 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc 
*sc, struct ath_vif *avp)
__func__, avp->noa.absent, tsf, target_tsf,
(target_tsf - tsf) / 1000);
 
-   ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, (u32) target_tsf, 
100);
+   ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, target_tsf, 100);
 }
 
 static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif 
*vif)
-- 
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 v2 08/13] ath9k: P2P_CLIENT, get/set NOA correctly

2015-11-27 Thread Janusz Dziedzic
In case we get BSS_CHANGED_P2P_PS early, from
mac80211, we didn't set NOA timer correctly,
while p2p_ps_vif was NULL.

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

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 31b4d0e..5a1ede6 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1443,6 +1443,10 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, 
struct ieee80211_vif *vif)
return;
 
sc->p2p_ps_vif = avp;
+
+   if (sc->ps_flags & PS_BEACON_SYNC)
+   return;
+
tsf = ath9k_hw_gettsf32(sc->sc_ah);
ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
ath9k_update_p2p_ps_timer(sc, avp);
@@ -1585,8 +1589,7 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
 
spin_lock_bh(&sc->sc_pcu_lock);
spin_lock_irqsave(&sc->sc_pm_lock, flags);
-   if (!(sc->ps_flags & PS_BEACON_SYNC))
-   ath9k_update_p2p_ps(sc, vif);
+   ath9k_update_p2p_ps(sc, vif);
spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
spin_unlock_bh(&sc->sc_pcu_lock);
 }
-- 
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 v2 10/13] ath9k: MCC, add NOA also in case of an AP

2015-11-27 Thread Janusz Dziedzic
In case of MCC and AP interface, add also NOA attr
that will inform stations about absence of an AP.
There is a chance that some stations will handle
this NOA attr correctly and will know exactly when
AP is present/absent.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/beacon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/beacon.c 
b/drivers/net/wireless/ath/ath9k/beacon.c
index f50a6bc..5cf0cd7 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -148,7 +148,8 @@ static struct ath_buf *ath9k_beacon_generate(struct 
ieee80211_hw *hw,
 
ath_assign_seq(common, skb);
 
-   if (vif->p2p)
+   /* Always assign NOA attr when MCC enabled */
+   if (ath9k_is_chanctx_enabled())
ath9k_beacon_add_noa(sc, avp, skb);
 
bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
-- 
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 v2 07/13] ath9k: MCC enable Opportunistic Power Save

2015-11-27 Thread Janusz Dziedzic
When adding NOA attr enable Opportunistic Power Save.
Before we calculate ctwindow but didn't enable oppps.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 2afb8da..31b4d0e 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1505,6 +1505,8 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct 
ath_vif *avp,
 
noa->index = avp->noa_index;
noa->oppps_ctwindow = ath9k_get_ctwin(sc, avp);
+   if (noa->oppps_ctwindow)
+   noa->oppps_ctwindow |= BIT(7);
 
if (avp->noa_duration) {
if (avp->periodic_noa) {
-- 
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 v2 7/8] cfg80211: Add Kconfig option for ITS-G5 band (5.9 GHz)

2015-11-27 Thread Michal Sojka
On Fri, Nov 27 2015, Johannes Berg wrote:
> On Thu, 2015-11-26 at 22:10 +0100, Michal Sojka wrote:
>> 
>> Because in [1] Jouni said that
>> 
>>    "kernel config option + custom regdb would certainly be much
>> closer to what I'd like to see from the regulatory enforcement view
>> point"
>> 
>> I also like the fact that the help text mentions the relevant
>> regulatory documents. I guess the users would appreciate that.
>> 
>
> Fair enough, but I'm not really convinced that the Kconfig option is
> needed for what Jouni really required.
>
> In any case, I spoke with him yesterday and we don't think that your
> patches are going to work as is - we'll need to change the regulatory
> flags it seems. I'll comment more specifically on the patches.

OK. I'll wait for that.

-Michal
--
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 5/8] cfg80211: Add support for OCB-only channels

2015-11-27 Thread Michal Sojka
On Fri, Nov 27 2015, Johannes Berg wrote:
> On Mon, 2015-11-23 at 19:27 +0100, Michal Sojka wrote:
>
>>  #define NL80211_RRF_PASSIVE_SCANNL80211_RRF_NO_IR
>> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
>> index 59cabc9..b1ab77a 100644
>> --- a/net/wireless/chan.c
>> +++ b/net/wireless/chan.c
>> @@ -804,7 +804,8 @@ static bool _cfg80211_reg_can_beacon(struct wiphy
>> *wiphy,
>>  {
>>  bool res;
>>  u32 prohibited_flags = IEEE80211_CHAN_DISABLED |
>> -   IEEE80211_CHAN_RADAR;
>> +   IEEE80211_CHAN_RADAR |
>> +   IEEE80211_CHAN_OCB_ONLY;
>
> So ... for the kernel, I don't *like* this approach, because it
> requires touching every single driver, and every single person who
> writes code in the future must be aware of the special handling for
> this flag.
>
> For userspace, however, this approach is simply impossible. Consider an
> older version of wpa_supplicant, that queries the channel list and
> isn't aware of the OCB_ONLY flag. This version would take the channel
> list and build a scan request with it, only to get the scan rejected
> since some channels it picked were only usable for OCB, as far as I can
> tell.
>
> I think the solution to this would be to redefine the CHAN_DISABLED
> flag to mean "channel disabled for non-ocb mode" and add a
> CHAN_OCB_ENABLED flag.
>
> Then code that knows about OCB would simply not test CHAN_DISABLED, but
> would instead test CHAN_OCB_ENABLED instead - and if that's clear OCB
> would not be permitted.
>
> However, this would have the side effect of enabling OCB *only* on OCB
> channels, which might not be a good idea, for testing purposes one
> might want to use the regular 2.4 or 5 GHz channels? If so, OCB could
> still be made to do something like
>
>   ocb_usable = (flags & OCB_ENABLED) || !(flags & DISABLED);
>
> or we could even make the channel list internally maintain a
> CHAN_OCB_USABLE flag that essentially encodes the logic above.
>
> In any case, this would collapse the patch down to modifying only OCB
> code and nothing else, which is nice, and would keep existing userspace
> working since it would just see disabled channels while ignoring the
> OCB flag.

Yes, this makes perfect sense. I'll rework the patch.

-Michal
--
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: [1/9] brcmfmac: Add support for the BCM4359 11ac RSDB PCIE device.

2015-11-27 Thread Arend van Spriel

On 11/26/2015 12:57 PM, Kalle Valo wrote:



From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 


Thanks, 9 patches applied to wireless-drivers-next.git:

2aff030355b5 brcmfmac: Add support for the BCM4359 11ac RSDB PCIE device.
c9c0043894cf brcmfmac: Simplify and fix usage of brcmf_ifname.
31fa86cb342b brcmfmac: Remove unnecessary check from start_xmit.
da402c56bc91 brcmfmac: Remove unncessary variable irq_requested.
dc1a272ec440 brcmfmac: Disable runtime pm for USB.
8abffd8173a1 brcmfmac: Add RSDB support.
37a869ec8593 brcmfmac: Use consistent naming for bsscfgidx.
c2a43a6ba5e5 brcmfmac: Use new methods for pcie Power Management.


Hi Kalle,

Actually, the patch above should have been submitted to wireless-drivers 
as it solves a suspend/hibernate issue with 4350 device which we added 
in 4.4. How should I handle that? This is what I was thinking:


1. submit revert for wireless-drivers-next.
2. submit patch of c2a43a6ba5e5 for wireless-drivers.

Regards,
Arend


aeb64225aa8e brcmfmac: Add wowl wake indication report.

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] iw:Fix memory leak if nla_put fails

2015-11-27 Thread Rahul Jain
From: Amit Khatri 

Avoid memory leak because of nla_put_failure

Signed-off-by: Rahul Jain 
Signed-off-by: Amit Khatri 
---
 coalesce.c |  7 ++-
 wowlan.c   | 33 +++--
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/coalesce.c b/coalesce.c
index 36dcaef..822da4f 100644
--- a/coalesce.c
+++ b/coalesce.c
@@ -124,7 +124,8 @@ static int handle_coalesce_enable(struct nl80211_state 
*state,
nla_nest_end(msg, nl_pat);
free(mask);
free(pat);
-
+   pat = NULL;
+   mask = NULL;
if (!next_pat)
break;
cur_pat = next_pat;
@@ -155,6 +156,10 @@ static int handle_coalesce_enable(struct nl80211_state 
*state,
err = 1;
goto close;
 nla_put_failure:
+   if (pat)
+   free(pat);
+   if (mask)
+   free(mask);
err = -ENOBUFS;
 close:
fclose(f);
diff --git a/wowlan.c b/wowlan.c
index e0cf316..c674e2c 100644
--- a/wowlan.c
+++ b/wowlan.c
@@ -89,7 +89,11 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, const 
char *fn)
 
if (!pkt)
goto close;
-   NLA_PUT(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD, len, pkt);
+   if (nla_put(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD, len,
+   pkt) < 0) {
+   free(pkt);
+   goto nla_put_failure;
+   }
free(pkt);
} else if (strncmp(buf, "data.interval=", 14) == 0) {
NLA_PUT_U32(msg, NL80211_WOWLAN_TCP_DATA_INTERVAL,
@@ -97,13 +101,24 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, const 
char *fn)
} else if (strncmp(buf, "wake=", 5) == 0) {
unsigned char *pat, *mask;
size_t patlen;
-
if (parse_hex_mask(buf + 5, &pat, &patlen, &mask))
goto close;
-   NLA_PUT(msg, NL80211_WOWLAN_TCP_WAKE_MASK,
-   DIV_ROUND_UP(patlen, 8), mask);
-   NLA_PUT(msg, NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
-   patlen, pat);
+   if (nla_put(msg, NL80211_WOWLAN_TCP_WAKE_MASK,
+   DIV_ROUND_UP(patlen, 8), mask) < 0) {
+   free(mask);
+   free(pat);
+   mask = NULL;
+   pat = NULL;
+   goto nla_put_failure;
+   }
+   if (nla_put(msg, NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
+   patlen, pat) < 0){
+   free(pat);
+   free(mask);
+   pat = NULL;
+   mask = NULL;
+   goto nla_put_failure;
+   }
free(mask);
free(pat);
} else if (strncmp(buf, "data.seq=", 9) == 0) {
@@ -300,6 +315,8 @@ static int handle_wowlan_enable(struct nl80211_state *state,
nla_nest_end(patterns, pattern);
free(mask);
free(pat);
+   pat = NULL;
+   mask = NULL;
break;
}
argv++;
@@ -313,6 +330,10 @@ static int handle_wowlan_enable(struct nl80211_state 
*state,
nla_nest_end(msg, wowlan);
err = 0;
  nla_put_failure:
+   if (pat)
+   free(pat);
+   if (mask)
+   free(mask);
nlmsg_free(patterns);
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: [PATCH v2 6/8] cfg80211: reg: Add NL80211_RRF_USER_REGD_NEEDED flag

2015-11-27 Thread Michal Sojka
On Fri, Nov 27 2015, Johannes Berg wrote:
> On Mon, 2015-11-23 at 19:27 +0100, Michal Sojka wrote:
>> 
>> The NL80211_RRF_USER_REGD_NEEDED flag introduced in this commit
>> allows
>> drivers to specify that certain band is enabled only if it is
>> additionally enabled in user-supplied regulatory database. If the
>> band
>> is not present there, the channels are simply disabled.
>
> I can see why you'd want this flag internally (although it'll require
> rework given the comments on the previous patch) - but is there a
> reason to export it in nl80211?

I don't see any reason either. Only all regulatory rule flags
(nl80211_reg_rule_flags) happen to be "exported". Shall I add new field
(e.g. internal_flags) to struct ieee80211_reg_rule and define new enum
for it?

> Then again, perhaps it *would* be good to show this information in
> userspace?

What do you mean by "show"? nl80211_put_regdom() already sends regdom
flags to userspace. Or do you mean introducing a new channel attribute
and send it in nl80211_msg_put_channel()?

-Michal
--
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 6/8] cfg80211: reg: Add NL80211_RRF_USER_REGD_NEEDED flag

2015-11-27 Thread Johannes Berg
On Fri, 2015-11-27 at 10:43 +0100, Michal Sojka wrote:

> What do you mean by "show"? nl80211_put_regdom() already sends regdom
> flags to userspace. Or do you mean introducing a new channel
> attribute and send it in nl80211_msg_put_channel()?
> 

No, I meant keeping the flag - so that people can know with "iw list"
or something that they need a special regdomain to enable the channels?

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 1/1] wireless: airo: re-use mac_pton()

2015-11-27 Thread Andy Shevchenko
On Thu, 2015-11-26 at 15:32 +0200, Kalle Valo wrote:
> Andy Shevchenko  writes:
> 
> > mac_pton() converts 6-byte MAC / BSSID to binary format. Change an
> > open coded
> > variant by the generic one.
> > 
> > Signed-off-by: Andy Shevchenko 
> 
> This breaks compilation:
> 
>   CC [M]  drivers/net/wireless/cisco/airo.o
> drivers/net/wireless/cisco/airo.c: In function
> ‘proc_APList_on_close’:
> drivers/net/wireless/cisco/airo.c:5141:49: error: request for member
> ‘ap’ in something not a structure or union

Sorry for that, seems rebase issue since it was an old fix in my local
tree.

Seems it should be
  mac_pton(data->wbuffer + i * 6 * 3, APList_rid->ap[i]);

I will send updated version later.

-- 
Andy Shevchenko 
Intel Finland Oy

--
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] mwifiex: parse hscfg_gpio info from device tree

2015-11-27 Thread Amitkumar Karwar
From: Xinming Hu 

This patch reads hscfg_gpio from device tree and update
internal variable

Signed-off-by: Xinming Hu 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c 
b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index e486867..d28a53f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -1459,10 +1459,21 @@ int mwifiex_dnld_dt_cfgdata(struct mwifiex_private 
*priv,
 #ifdef CONFIG_OF
struct property *prop;
size_t len = strlen(prefix);
+   u32 data;
int ret;
 
/* look for all matching property names */
for_each_property_of_node(node, prop) {
+   if (!strncmp(prop->name, "marvell,hscfg_gpio",
+strlen("marvell,hscfg_gpio"))) {
+   if (!of_property_read_u32(priv->adapter->dt_node,
+ prop->name, &data)) {
+   dev_dbg(priv->adapter->dev,
+   "hscfg gpio = 0x%x\n", data);
+   priv->adapter->hs_cfg.gpio = data;
+   }
+   }
+
if (len > strlen(prop->name) ||
strncmp(prop->name, prefix, len))
continue;
-- 
1.8.1.4

--
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 0/2] brcm: firmware for new device and update

2015-11-27 Thread Arend van Spriel
This series add firmware for new BCM4371 device and an update
for the BCM43602 which solves hibernate issue.

The series applies to the master branch of the linux-firmware
repository.

Arend van Spriel (2):
  brcm: update firmware for bcm43602 device
  brcm: add initial firmware for bcm4371 11ac wifi device

 WHENCE  |   1 +
 brcm/brcmfmac43602-pcie.bin | Bin 634267 -> 635449 bytes
 brcm/brcmfmac4371-pcie.bin  | Bin 0 -> 623448 bytes
 3 files changed, 1 insertion(+)
 create mode 100755 brcm/brcmfmac4371-pcie.bin

-- 
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] mac80211_hwsim: Advertise support for VHT IBSS

2015-11-27 Thread Johannes Berg
On Thu, 2015-11-26 at 20:51 +0200, Jouni Malinen wrote:
> VHT can be used with IBSS without needing any additional changes in
> mac80211_hwsim, so start claiming support for this to increase test
> coverage.
> 

Applied all the three, thanks.

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] brcm80211: fix error code in brcmf_pcie_exit_download_state()

2015-11-27 Thread Dan Carpenter
The original code returns 1 on failure and 0 on success but the caller
was expecting an error code on failure.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 83d8042..e149541 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -622,7 +622,9 @@ static int brcmf_pcie_exit_download_state(struct 
brcmf_pciedev_info *devinfo,
brcmf_chip_resetcore(core, 0, 0, 0);
}
 
-   return !brcmf_chip_set_active(devinfo->ci, resetintr);
+   if (!brcmf_chip_set_active(devinfo->ci, resetintr))
+   return -EINVAL;
+   return 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: [PATCH] mac80211_hwsim: stop using pointers as cookies

2015-11-27 Thread Johannes Berg
On Sun, 2015-11-08 at 18:49 -0500, Bob Copeland wrote:
> On Fri, Nov 06, 2015 at 11:57:23AM +0100, Johannes Berg wrote:
> > Instead of using pointers, use sequentially assigned cookies.
> > This is easier to understand while debugging and also avoids
> > problems when the pointer is reused for the next allocation.
> 
> I tested this out in wmediumd and it didn't go so well...
> 
> > +   info->rate_driver_data[0] = (void *)cookie;
> 
> [...]
> 
> > +   skb_cookie = (u64)(uintptr_t)txi->driver_data[0];
> 
> rate_driver_data vs driver_data?

Yep, that fixes it. I've applied the patch with that fix.

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] iwlwifi: fix compare_const_fl.cocci warnings

2015-11-27 Thread Julia Lawall
Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Fengguang Wu 
Signed-off-by: Julia Lawall 
---

This looks a bit nicer around the other way, in my opinion.

 calib.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
@@ -311,7 +311,7 @@ static int iwl_sens_energy_cck(struct iw
/* If previous beacon had too many false alarms,
 *   give it some extra margin by reducing sensitivity again
 *   (but don't go below measured energy of desired Rx) */
-   if (IWL_FA_TOO_MANY == data->nrg_prev_state) {
+   if (data->nrg_prev_state == IWL_FA_TOO_MANY) {
IWL_DEBUG_CALIB(priv, "... increasing margin\n");
if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN))
data->nrg_th_cck -= NRG_MARGIN;
--
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 1/1] wireless: airo: re-use mac_pton()

2015-11-27 Thread Andy Shevchenko
mac_pton() converts 6-byte MAC / BSSID to binary format. Change an open coded
variant by the generic one.

Signed-off-by: Andy Shevchenko 
---
 drivers/net/wireless/cisco/airo.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/cisco/airo.c 
b/drivers/net/wireless/cisco/airo.c
index 17c40f0..d2353f6 100644
--- a/drivers/net/wireless/cisco/airo.c
+++ b/drivers/net/wireless/cisco/airo.c
@@ -5137,21 +5137,9 @@ static void proc_APList_on_close( struct inode *inode, 
struct file *file ) {
memset(APList_rid, 0, sizeof(*APList_rid));
APList_rid->len = cpu_to_le16(sizeof(*APList_rid));
 
-   for( i = 0; i < 4 && data->writelen >= (i+1)*6*3; i++ ) {
-   int j;
-   for( j = 0; j < 6*3 && data->wbuffer[j+i*6*3]; j++ ) {
-   switch(j%3) {
-   case 0:
-   APList_rid->ap[i][j/3]=
-   hex_to_bin(data->wbuffer[j+i*6*3])<<4;
-   break;
-   case 1:
-   APList_rid->ap[i][j/3]|=
-   hex_to_bin(data->wbuffer[j+i*6*3]);
-   break;
-   }
-   }
-   }
+   for (i = 0; i < 4 && data->writelen >= (i + 1) * 6 * 3; i++)
+   mac_pton(data->wbuffer + i * 6 * 3, APList_rid->ap[i]);
+
disable_MAC(ai, 1);
writeAPListRid(ai, APList_rid, 1);
enable_MAC(ai, 1);
-- 
2.6.2

--
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: Fix check for !THERMAL case

2015-11-27 Thread kbuild test robot
Hi Mark,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.4-rc2]
[cannot apply to next-20151127]

url:
https://github.com/0day-ci/linux/commits/Mark-Brown/ath10k-Fix-check-for-THERMAL-case/20151126-201844
config: m68k-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

>> ERROR: "ath10k_thermal_event_temperature" 
>> [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!
>> ERROR: "ath10k_thermal_set_throttling" 
>> [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!
>> ERROR: "ath10k_thermal_register" 
>> [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!
>> ERROR: "ath10k_thermal_unregister" 
>> [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 0/2] brcm: firmware for new device and update

2015-11-27 Thread Ben Hutchings
On Fri, 2015-11-27 at 11:13 +0100, Arend van Spriel wrote:
> This series add firmware for new BCM4371 device and an update
> for the BCM43602 which solves hibernate issue.
> 
> The series applies to the master branch of the linux-firmware
> repository.

Applied, thanks.

Ben.

> Arend van Spriel (2):
>   brcm: update firmware for bcm43602 device
>   brcm: add initial firmware for bcm4371 11ac wifi device
> 
>  WHENCE  |   1 +
>  brcm/brcmfmac43602-pcie.bin | Bin 634267 -> 635449 bytes
>  brcm/brcmfmac4371-pcie.bin  | Bin 0 -> 623448 bytes
>  3 files changed, 1 insertion(+)
>  create mode 100755 brcm/brcmfmac4371-pcie.bin
> 
-- 
Ben Hutchings
Power corrupts.  Absolute power is kind of neat.
   - John Lehman, Secretary of the US Navy 1981-1987


signature.asc
Description: This is a digitally signed message part


[PATCH] mac80211: fix off-channel mgmt-tx unintialized variable usage

2015-11-27 Thread Johannes Berg
From: Johannes Berg 

In the previous commit, I neglected to update the cookie in one code
path: when a mgmt-tx has no real cookie sent to userspace as it doesn't
wait for a response, but is off-channel. The original code used the SKB
pointer as the cookie and always assigned the cookie to the TX SKB in
ieee80211_start_roc_work(), but my change turned this around and made
the code rely on a valid cookie being passed in.

Unfortunately, the off-channel no-wait TX path wasn't assigning one at
all, resulting in an uninitialized stack value being used. This wasn't
handed back to userspace as a cookie (since in the no-wait case there
isn't a cookie), but it was tested for non-zero to distinguish between
mgmt-tx and off-channel.

Fix this by assigning a dummy non-zero cookie unconditionally, and get
rid of a misleading comment and some dead code while at it. I'll clean
up the ACK SKB handling separately later.

Fixes: 3b79af973cf4 ("mac80211: stop using pointers as userspace cookies")
Signed-off-by: Johannes Berg 
---
 net/mac80211/cfg.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c2bd1b6a6922..df7550bf196e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3454,8 +3454,12 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
goto out_unlock;
}
} else {
-   /* for cookie below */
-   ack_skb = skb;
+   /* assign a dummy non-zero cookie, it's not sent to
+* userspace in this case but we rely on its value
+* internally in the need_offchan case to distinguish
+* mgmt-tx from remain-on-channel;
+*/
+   *cookie = 0x;
}
 
if (!need_offchan) {
-- 
2.6.2

--
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/19] NFC: nci: Remove dead code

2015-11-27 Thread Peter Hurley
The N_NCI ldisc does not define a flush_buffer() ldisc method, so
the check when opening the ldisc is always false.

Cc: Lauro Ramos Venancio 
Cc: Aloisio Almeida Jr 
Cc: Samuel Ortiz 
Cc: "David S. Miller" 
Cc: 
Signed-off-by: Peter Hurley 
---
 net/nfc/nci/uart.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index 21d8875..c468eab 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -171,14 +171,7 @@ static int nci_uart_tty_open(struct tty_struct *tty)
tty->disc_data = NULL;
tty->receive_room = 65536;
 
-   /* Flush any pending characters in the driver and line discipline. */
-
-   /* FIXME: why is this needed. Note don't use ldisc_ref here as the
-* open path is before the ldisc is referencable.
-*/
-
-   if (tty->ldisc->ops->flush_buffer)
-   tty->ldisc->ops->flush_buffer(tty);
+   /* Flush any pending characters in the driver */
tty_driver_flush_buffer(tty);
 
return 0;
-- 
2.6.3

--
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