Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [PATCH -next] wcn36xx: fix missing unlock on error in wcn36xx_smd_update_proberesp_tmpl()
From: Eugene Krasnikov @ 2013-10-30  7:12 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: John Linville, yongjun_wei, wcn36xx, linux-wireless
In-Reply-To: <CAPgLHd9HRb_o+hac5_RjKhK1K-jJFtQmrv9P2iy7zegQv=WOcw@mail.gmail.com>

Looks good to me! I assume this patch is the result of running smatch?
I made the same patch, just did not have time to send it out.

On Wed, Oct 30, 2013 at 5:30 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add the missing unlock before return from function
> wcn36xx_smd_update_proberesp_tmpl() in the error
> handling case.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/net/wireless/ath/wcn36xx/smd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index f8c3a10..04df70b 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -1327,7 +1327,8 @@ int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
>         if (skb->len > BEACON_TEMPLATE_SIZE) {
>                 wcn36xx_warn("probe response template is too big: %d\n",
>                              skb->len);
> -               return -E2BIG;
> +               ret = -E2BIG;
> +               goto out;
>         }
>
>         msg.probe_resp_template_len = skb->len;
>



-- 
Best regards,
Eugene

^ permalink raw reply

* [PATCH] ath9k: Use correct PCIE initvals for AR9485
From: Sujith Manoharan @ 2013-10-30  6:34 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

Currently, the PLL is turned off for AR9485 when
switching to a low power state, but AR9485 has an issue
where the card will become unresponsive if left idle
for a long time without any traffic. To fix this,
force the PLL to always be on using a different initval
array, ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ar9003_hw.c       | 11 ++------
 drivers/net/wireless/ath/ath9k/ar9485_initvals.h | 35 +++++-------------------
 2 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 42daea5..b054dee 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -187,17 +187,10 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
 		INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
 			       ar9485_1_1_baseband_core_txfir_coeff_japan_2484);
 
-		/* Load PCIE SERDES settings from INI */
-
-		/* Awake Setting */
-
 		INIT_INI_ARRAY(&ah->iniPcieSerdes,
-				ar9485_1_1_pcie_phy_clkreq_disable_L1);
-
-		/* Sleep Setting */
-
+			       ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
 		INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
-				ar9485_1_1_pcie_phy_clkreq_disable_L1);
+			       ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
 	} else if (AR_SREV_9462_21(ah)) {
 		INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
 			       ar9462_2p1_mac_core);
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
index 6f899c6..93b18ce 100644
--- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
@@ -32,13 +32,6 @@ static const u32 ar9485_1_1_mac_postamble[][5] = {
 	{0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440},
 };
 
-static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = {
-	/* Addr      allmodes  */
-	{0x00018c00, 0x18012e5e},
-	{0x00018c04, 0x000801d8},
-	{0x00018c08, 0x0000080c},
-};
-
 static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = {
 	/* Addr      allmodes  */
 	{0x00009e00, 0x037216a0},
@@ -1101,20 +1094,6 @@ static const u32 ar9485_common_rx_gain_1_1[][2] = {
 	{0x0000a1fc, 0x00000296},
 };
 
-static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = {
-	/* Addr      allmodes  */
-	{0x00018c00, 0x18052e5e},
-	{0x00018c04, 0x000801d8},
-	{0x00018c08, 0x0000080c},
-};
-
-static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = {
-	/* Addr      allmodes  */
-	{0x00018c00, 0x18053e5e},
-	{0x00018c04, 0x000801d8},
-	{0x00018c08, 0x0000080c},
-};
-
 static const u32 ar9485_1_1_soc_preamble[][2] = {
 	/* Addr      allmodes  */
 	{0x00004014, 0xba280400},
@@ -1173,13 +1152,6 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = {
 	{0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
 };
 
-static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = {
-	/* Addr      allmodes  */
-	{0x00018c00, 0x18013e5e},
-	{0x00018c04, 0x000801d8},
-	{0x00018c08, 0x0000080c},
-};
-
 static const u32 ar9485_1_1_radio_postamble[][2] = {
 	/* Addr      allmodes  */
 	{0x0001609c, 0x0b283f31},
@@ -1358,4 +1330,11 @@ static const u32 ar9485_1_1_baseband_core_txfir_coeff_japan_2484[][2] = {
 	{0x0000a3a0, 0xca9228ee},
 };
 
+static const u32 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1[][2] = {
+	/* Addr      allmodes  */
+	{0x00018c00, 0x1801265e},
+	{0x00018c04, 0x000801d8},
+	{0x00018c08, 0x0000080c},
+};
+
 #endif /* INITVALS_9485_H */
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH -next] wcn36xx: fix missing unlock on error in wcn36xx_smd_update_proberesp_tmpl()
From: Wei Yongjun @ 2013-10-30  5:30 UTC (permalink / raw)
  To: k.eugene.e, linville; +Cc: yongjun_wei, wcn36xx, linux-wireless

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing unlock before return from function
wcn36xx_smd_update_proberesp_tmpl() in the error
handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index f8c3a10..04df70b 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1327,7 +1327,8 @@ int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
 	if (skb->len > BEACON_TEMPLATE_SIZE) {
 		wcn36xx_warn("probe response template is too big: %d\n",
 			     skb->len);
-		return -E2BIG;
+		ret = -E2BIG;
+		goto out;
 	}
 
 	msg.probe_resp_template_len = skb->len;


^ permalink raw reply related

* [PATCH -next] NFC: port100: convert to use le16_add_cpu()
From: Wei Yongjun @ 2013-10-30  5:26 UTC (permalink / raw)
  To: lauro.venancio, aloisio.almeida, sameo
  Cc: yongjun_wei, linux-wireless, linux-nfc

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/nfc/port100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
index 8a0571e..ab7afe3 100644
--- a/drivers/nfc/port100.c
+++ b/drivers/nfc/port100.c
@@ -493,7 +493,7 @@ static void port100_tx_update_payload_len(void *_frame, int len)
 {
 	struct port100_frame *frame = _frame;
 
-	frame->datalen = cpu_to_le16(le16_to_cpu(frame->datalen) + len);
+	le16_add_cpu(&frame->datalen, len);
 }
 
 static bool port100_rx_frame_is_valid(void *_frame)


^ permalink raw reply related

* [PATCH -next] ath10k: fix possible memory leak in ath10k_pci_probe()
From: Wei Yongjun @ 2013-10-30  5:24 UTC (permalink / raw)
  To: kvalo, linville; +Cc: yongjun_wei, ath10k, linux-wireless

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

memory is malloced in ath10k_pci_probe() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/wireless/ath/ath10k/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index dff23d9..af01631 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2470,7 +2470,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 	ret = ath10k_do_pci_wake(ar);
 	if (ret) {
 		ath10k_err("Failed to get chip id: %d\n", ret);
-		return ret;
+		goto err_iomap;
 	}
 
 	chip_id = ath10k_pci_read32(ar,


^ permalink raw reply related

* [PATCH -next] libertas: fix error return code in if_cs_probe()
From: Wei Yongjun @ 2013-10-30  5:22 UTC (permalink / raw)
  To: linville, hsweeten, gregkh, dcbw
  Cc: yongjun_wei, libertas-dev, linux-wireless

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return -ENODEV in the unknown model error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/wireless/libertas/if_cs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index ef8c98e..f499efc 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -902,6 +902,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
 	if (card->model == MODEL_UNKNOWN) {
 		pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
 		       p_dev->manf_id, p_dev->card_id);
+		ret = -ENODEV;
 		goto out2;
 	}
 


^ permalink raw reply related

* Re: iwlegacy (4965) - what would 0x8000 as the completed TX rate indicate?
From: Adrian Chadd @ 2013-10-30  3:59 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1383033823.14377.1.camel@jlt4.sipsolutions.net>

On 29 October 2013 01:03, Johannes Berg <johannes@sipsolutions.net> wrote:

>> Well, what's rate=0 mean?
>>
>> And 0x8000 is bit 11 set, which is HT40. I definitely don't have HT40 enabled.
>
> 0x8000 is bit 15 set, which means "antenna B", I think?

Duh, sorry. was tired. :(

> But then I can't seem to figure out what rate=0 means either. Should be
> an OFDM rate (bit 9 not set) but 0 isn't a valid OFDM rate value. Hmm.

That's why I'm confused too.

I'm seeing some odd behaviour here where sometimes the NIC behaves
fine, and sometimes it just gets long transmit failures on OFDM frames
but is fine with CCK frames. That's why I'm digging into this.

I also see the sensitivity tuning code lose the plot over time as OFDM
errors are returned by the receiver and it keeps trying to compensate
until it's maxed out the sensitivity tuning parameters. If I restart
the NIC, it all comes back to normal for a while.

Do any of these ring a bell?

Thanks,


-adrian

^ permalink raw reply

* Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
From: Luis R. Rodriguez @ 2013-10-29 23:10 UTC (permalink / raw)
  To: Joe Perches; +Cc: John W. Linville, Johannes Berg, linux-wireless
In-Reply-To: <1383087091.12439.33.camel@joe-AO722>

On Tue, Oct 29, 2013 at 11:51 PM, Joe Perches <joe@perches.com> wrote:
> Missing break?

Bug, that's what I get for working until midnight, I should know
better to balance my work.... damn it. Thanks for the review.

  Luis

^ permalink raw reply

* [PATCH v2 3/3] ath: fix dynamic user regulatory domain support
From: Luis R. Rodriguez @ 2013-10-29 23:10 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

As it stands dynamic user regulatory domain support is
only possible for a few programmed regulatory domains as
a few countries do not allow for this.

The existing code however only would take advantage of
the feature if a custom world regulatory domain is used
though as that's when we clear beconing flags. We need
to lift this restriction as otherwise this feature is
pointless.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---

This fixes the issues spotted by Joe.

 drivers/net/wireless/ath/regd.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 5790aa2..3480201 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -296,6 +296,7 @@ static void ath_force_no_ir_freq(struct wiphy *wiphy, u16 center_freq)
 
 static void
 __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
+				struct ath_regulatory *reg,
 				enum nl80211_reg_initiator initiator,
 				struct ieee80211_channel *ch)
 {
@@ -307,6 +308,10 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
 	case NL80211_REGDOM_SET_BY_COUNTRY_IE:
 		ath_force_clear_no_ir_chan(wiphy, ch);
 		break;
+	case NL80211_REGDOM_SET_BY_USER:
+		if (ath_reg_dyn_country_user_allow(reg))
+			ath_force_clear_no_ir_chan(wiphy, ch);
+		break;
 	default:
 		if (ch->beacon_found)
 			ch->flags &= ~IEEE80211_CHAN_NO_IR;
@@ -322,6 +327,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
  */
 static void
 ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
+			      struct ath_regulatory *reg,
 			      enum nl80211_reg_initiator initiator)
 {
 	enum ieee80211_band band;
@@ -335,8 +341,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
 		sband = wiphy->bands[band];
 		for (i = 0; i < sband->n_channels; i++) {
 			ch = &sband->channels[i];
-			__ath_reg_apply_beaconing_flags(wiphy, initiator, ch);
-
+			__ath_reg_apply_beaconing_flags(wiphy, reg,
+							initiator, ch);
 		}
 	}
 }
@@ -357,7 +363,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
  */
 static void
 ath_reg_apply_ir_flags(struct wiphy *wiphy,
-				enum nl80211_reg_initiator initiator)
+		       struct ath_regulatory *reg,
+		       enum nl80211_reg_initiator initiator)
 {
 	struct ieee80211_supported_band *sband;
 
@@ -370,6 +377,12 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
 		ath_force_clear_no_ir_freq(wiphy, 2467);
 		ath_force_clear_no_ir_freq(wiphy, 2472);
 		break;
+	case NL80211_REGDOM_SET_BY_USER:
+		if (!ath_reg_dyn_country_user_allow(reg))
+			break;
+		ath_force_clear_no_ir_freq(wiphy, 2467);
+		ath_force_clear_no_ir_freq(wiphy, 2472);
+		break;
 	default:
 		ath_force_no_ir_freq(wiphy, 2467);
 		ath_force_no_ir_freq(wiphy, 2472);
@@ -418,12 +431,15 @@ static void ath_reg_apply_world_flags(struct wiphy *wiphy,
 	case 0x66:
 	case 0x67:
 	case 0x6C:
-		ath_reg_apply_beaconing_flags(wiphy, initiator);
+		ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
 		break;
 	case 0x68:
-		ath_reg_apply_beaconing_flags(wiphy, initiator);
-		ath_reg_apply_ir_flags(wiphy, initiator);
+		ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
+		ath_reg_apply_ir_flags(wiphy, reg, initiator);
 		break;
+	default:
+		if (ath_reg_dyn_country_user_allow(reg))
+			ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
 	}
 }
 
-- 
1.8.4.rc3


^ permalink raw reply related

* Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
From: Joe Perches @ 2013-10-29 22:51 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, johannes, linux-wireless
In-Reply-To: <1383086346-2096-4-git-send-email-mcgrof@do-not-panic.com>

On Tue, 2013-10-29 at 23:39 +0100, Luis R. Rodriguez wrote:
> As it stands dynamic user regulatory domain support is
> only possible for a few programmed regulatory domains as
> a few countries do not allow for this.
[]
> diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
][
> @@ -296,6 +296,7 @@ static void ath_force_no_ir_freq(struct wiphy *wiphy, u16 center_freq)
>  
>  static void
>  __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
> +				struct ath_regulatory *reg,
>  				enum nl80211_reg_initiator initiator,
>  				struct ieee80211_channel *ch)
>  {
> @@ -307,6 +308,9 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
>  	case NL80211_REGDOM_SET_BY_COUNTRY_IE:
>  		ath_force_clear_no_ir_chan(wiphy, ch);
>  		break;
> +	case NL80211_REGDOM_SET_BY_USER:
> +		if (ath_reg_dyn_country_user_allow(reg))
> +			ath_force_clear_no_ir_chan(wiphy, ch);

Nicer to add explicit /* fallthrough */

>  	default:
>  		if (ch->beacon_found)
>  			ch->flags &= ~IEEE80211_CHAN_NO_IR;

> @@ -370,6 +376,11 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
>  		ath_force_clear_no_ir_freq(wiphy, 2467);
>  		ath_force_clear_no_ir_freq(wiphy, 2472);
>  		break;
> +	case NL80211_REGDOM_SET_BY_USER:
> +		if (!ath_reg_dyn_country_user_allow(reg))
> +			break;
> +		ath_force_clear_no_ir_freq(wiphy, 2467);
> +		ath_force_clear_no_ir_freq(wiphy, 2472);

Missing break?

>  	default:
>  		ath_force_no_ir_freq(wiphy, 2467);
>  		ath_force_no_ir_freq(wiphy, 2472);



^ permalink raw reply

* [PATCH 3/3] ath: fix dynamic user regulatory domain support
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez
In-Reply-To: <1383086346-2096-1-git-send-email-mcgrof@do-not-panic.com>

As it stands dynamic user regulatory domain support is
only possible for a few programmed regulatory domains as
a few countries do not allow for this.

The existing code however only would take advantage of
the feature if a custom world regulatory domain is used
though as that's when we clear beconing flags. We need
to lift this restriction as otherwise this feature is
pointless.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 5790aa2..b2c5e41 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -296,6 +296,7 @@ static void ath_force_no_ir_freq(struct wiphy *wiphy, u16 center_freq)
 
 static void
 __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
+				struct ath_regulatory *reg,
 				enum nl80211_reg_initiator initiator,
 				struct ieee80211_channel *ch)
 {
@@ -307,6 +308,9 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
 	case NL80211_REGDOM_SET_BY_COUNTRY_IE:
 		ath_force_clear_no_ir_chan(wiphy, ch);
 		break;
+	case NL80211_REGDOM_SET_BY_USER:
+		if (ath_reg_dyn_country_user_allow(reg))
+			ath_force_clear_no_ir_chan(wiphy, ch);
 	default:
 		if (ch->beacon_found)
 			ch->flags &= ~IEEE80211_CHAN_NO_IR;
@@ -322,6 +326,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
  */
 static void
 ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
+			      struct ath_regulatory *reg,
 			      enum nl80211_reg_initiator initiator)
 {
 	enum ieee80211_band band;
@@ -335,8 +340,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
 		sband = wiphy->bands[band];
 		for (i = 0; i < sband->n_channels; i++) {
 			ch = &sband->channels[i];
-			__ath_reg_apply_beaconing_flags(wiphy, initiator, ch);
-
+			__ath_reg_apply_beaconing_flags(wiphy, reg,
+							initiator, ch);
 		}
 	}
 }
@@ -357,7 +362,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
  */
 static void
 ath_reg_apply_ir_flags(struct wiphy *wiphy,
-				enum nl80211_reg_initiator initiator)
+		       struct ath_regulatory *reg,
+		       enum nl80211_reg_initiator initiator)
 {
 	struct ieee80211_supported_band *sband;
 
@@ -370,6 +376,11 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
 		ath_force_clear_no_ir_freq(wiphy, 2467);
 		ath_force_clear_no_ir_freq(wiphy, 2472);
 		break;
+	case NL80211_REGDOM_SET_BY_USER:
+		if (!ath_reg_dyn_country_user_allow(reg))
+			break;
+		ath_force_clear_no_ir_freq(wiphy, 2467);
+		ath_force_clear_no_ir_freq(wiphy, 2472);
 	default:
 		ath_force_no_ir_freq(wiphy, 2467);
 		ath_force_no_ir_freq(wiphy, 2472);
@@ -418,12 +429,15 @@ static void ath_reg_apply_world_flags(struct wiphy *wiphy,
 	case 0x66:
 	case 0x67:
 	case 0x6C:
-		ath_reg_apply_beaconing_flags(wiphy, initiator);
+		ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
 		break;
 	case 0x68:
-		ath_reg_apply_beaconing_flags(wiphy, initiator);
-		ath_reg_apply_ir_flags(wiphy, initiator);
+		ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
+		ath_reg_apply_ir_flags(wiphy, reg, initiator);
 		break;
+	default:
+		if (ath_reg_dyn_country_user_allow(reg))
+			ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
 	}
 }
 
-- 
1.8.4.rc3


^ permalink raw reply related

* [PATCH 2/3] ath: dynamic user allow check helper to the top
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez
In-Reply-To: <1383086346-2096-1-git-send-email-mcgrof@do-not-panic.com>

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index e27027c..5790aa2 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -185,6 +185,15 @@ static bool dynamic_country_user_possible(struct ath_regulatory *reg)
 	return true;
 }
 
+static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
+{
+	if (!config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS))
+		return false;
+	if (!dynamic_country_user_possible(reg))
+		return false;
+	return true;
+}
+
 static inline bool is_wwr_sku(u16 regd)
 {
 	return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) &&
@@ -466,17 +475,6 @@ static void ath_reg_dyn_country(struct wiphy *wiphy,
 	       reg_initiator_name(request->initiator));
 }
 
-static void ath_reg_dyn_country_user(struct wiphy *wiphy,
-				     struct ath_regulatory *reg,
-				     struct regulatory_request *request)
-{
-	if (!config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS))
-		return;
-	if (!dynamic_country_user_possible(reg))
-		return;
-	ath_reg_dyn_country(wiphy, reg, request);
-}
-
 void ath_reg_notifier_apply(struct wiphy *wiphy,
 			    struct regulatory_request *request,
 			    struct ath_regulatory *reg)
@@ -509,7 +507,8 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
 	case NL80211_REGDOM_SET_BY_DRIVER:
 		break;
 	case NL80211_REGDOM_SET_BY_USER:
-		ath_reg_dyn_country_user(wiphy, reg, request);
+		if (ath_reg_dyn_country_user_allow(reg))
+			ath_reg_dyn_country(wiphy, reg, request);
 		break;
 	case NL80211_REGDOM_SET_BY_COUNTRY_IE:
 		ath_reg_dyn_country(wiphy, reg, request);
-- 
1.8.4.rc3


^ permalink raw reply related

* [PATCH 1/3] ath: move dynamic_country_user_possible() to the top
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez
In-Reply-To: <1383086346-2096-1-git-send-email-mcgrof@do-not-panic.com>

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 144 ++++++++++++++++++++--------------------
 1 file changed, 72 insertions(+), 72 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index bc9ba78..e27027c 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -113,6 +113,78 @@ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = {
 	}
 };
 
+static bool dynamic_country_user_possible(struct ath_regulatory *reg)
+{
+	if (config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
+		return true;
+
+	switch (reg->country_code) {
+	case CTRY_UNITED_STATES:
+	case CTRY_JAPAN1:
+	case CTRY_JAPAN2:
+	case CTRY_JAPAN3:
+	case CTRY_JAPAN4:
+	case CTRY_JAPAN5:
+	case CTRY_JAPAN6:
+	case CTRY_JAPAN7:
+	case CTRY_JAPAN8:
+	case CTRY_JAPAN9:
+	case CTRY_JAPAN10:
+	case CTRY_JAPAN11:
+	case CTRY_JAPAN12:
+	case CTRY_JAPAN13:
+	case CTRY_JAPAN14:
+	case CTRY_JAPAN15:
+	case CTRY_JAPAN16:
+	case CTRY_JAPAN17:
+	case CTRY_JAPAN18:
+	case CTRY_JAPAN19:
+	case CTRY_JAPAN20:
+	case CTRY_JAPAN21:
+	case CTRY_JAPAN22:
+	case CTRY_JAPAN23:
+	case CTRY_JAPAN24:
+	case CTRY_JAPAN25:
+	case CTRY_JAPAN26:
+	case CTRY_JAPAN27:
+	case CTRY_JAPAN28:
+	case CTRY_JAPAN29:
+	case CTRY_JAPAN30:
+	case CTRY_JAPAN31:
+	case CTRY_JAPAN32:
+	case CTRY_JAPAN33:
+	case CTRY_JAPAN34:
+	case CTRY_JAPAN35:
+	case CTRY_JAPAN36:
+	case CTRY_JAPAN37:
+	case CTRY_JAPAN38:
+	case CTRY_JAPAN39:
+	case CTRY_JAPAN40:
+	case CTRY_JAPAN41:
+	case CTRY_JAPAN42:
+	case CTRY_JAPAN43:
+	case CTRY_JAPAN44:
+	case CTRY_JAPAN45:
+	case CTRY_JAPAN46:
+	case CTRY_JAPAN47:
+	case CTRY_JAPAN48:
+	case CTRY_JAPAN49:
+	case CTRY_JAPAN50:
+	case CTRY_JAPAN51:
+	case CTRY_JAPAN52:
+	case CTRY_JAPAN53:
+	case CTRY_JAPAN54:
+	case CTRY_JAPAN55:
+	case CTRY_JAPAN56:
+	case CTRY_JAPAN57:
+	case CTRY_JAPAN58:
+	case CTRY_JAPAN59:
+		return false;
+	}
+
+	return true;
+}
+
 static inline bool is_wwr_sku(u16 regd)
 {
 	return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) &&
@@ -394,78 +466,6 @@ static void ath_reg_dyn_country(struct wiphy *wiphy,
 	       reg_initiator_name(request->initiator));
 }
 
-static bool dynamic_country_user_possible(struct ath_regulatory *reg)
-{
-	if (config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
-		return true;
-
-	switch (reg->country_code) {
-	case CTRY_UNITED_STATES:
-	case CTRY_JAPAN1:
-	case CTRY_JAPAN2:
-	case CTRY_JAPAN3:
-	case CTRY_JAPAN4:
-	case CTRY_JAPAN5:
-	case CTRY_JAPAN6:
-	case CTRY_JAPAN7:
-	case CTRY_JAPAN8:
-	case CTRY_JAPAN9:
-	case CTRY_JAPAN10:
-	case CTRY_JAPAN11:
-	case CTRY_JAPAN12:
-	case CTRY_JAPAN13:
-	case CTRY_JAPAN14:
-	case CTRY_JAPAN15:
-	case CTRY_JAPAN16:
-	case CTRY_JAPAN17:
-	case CTRY_JAPAN18:
-	case CTRY_JAPAN19:
-	case CTRY_JAPAN20:
-	case CTRY_JAPAN21:
-	case CTRY_JAPAN22:
-	case CTRY_JAPAN23:
-	case CTRY_JAPAN24:
-	case CTRY_JAPAN25:
-	case CTRY_JAPAN26:
-	case CTRY_JAPAN27:
-	case CTRY_JAPAN28:
-	case CTRY_JAPAN29:
-	case CTRY_JAPAN30:
-	case CTRY_JAPAN31:
-	case CTRY_JAPAN32:
-	case CTRY_JAPAN33:
-	case CTRY_JAPAN34:
-	case CTRY_JAPAN35:
-	case CTRY_JAPAN36:
-	case CTRY_JAPAN37:
-	case CTRY_JAPAN38:
-	case CTRY_JAPAN39:
-	case CTRY_JAPAN40:
-	case CTRY_JAPAN41:
-	case CTRY_JAPAN42:
-	case CTRY_JAPAN43:
-	case CTRY_JAPAN44:
-	case CTRY_JAPAN45:
-	case CTRY_JAPAN46:
-	case CTRY_JAPAN47:
-	case CTRY_JAPAN48:
-	case CTRY_JAPAN49:
-	case CTRY_JAPAN50:
-	case CTRY_JAPAN51:
-	case CTRY_JAPAN52:
-	case CTRY_JAPAN53:
-	case CTRY_JAPAN54:
-	case CTRY_JAPAN55:
-	case CTRY_JAPAN56:
-	case CTRY_JAPAN57:
-	case CTRY_JAPAN58:
-	case CTRY_JAPAN59:
-		return false;
-	}
-
-	return true;
-}
-
 static void ath_reg_dyn_country_user(struct wiphy *wiphy,
 				     struct ath_regulatory *reg,
 				     struct regulatory_request *request)
-- 
1.8.4.rc3


^ permalink raw reply related

* [PATCH 0/3] ath: a few enhancements for dynamic user selection
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

John, Johannes,

here's a few enhancements for the dynamic user selection stuff.
I think this will depend on application on the no-ir flag patches
so not sure what route to go.

Luis R. Rodriguez (3):
  ath: move dynamic_country_user_possible() to the top
  ath: dynamic user allow check helper to the top
  ath: fix dynamic user regulatory domain support

 drivers/net/wireless/ath/regd.c | 193 +++++++++++++++++++++-------------------
 1 file changed, 103 insertions(+), 90 deletions(-)

-- 
1.8.4.rc3


^ permalink raw reply

* [PATCH] Revert "mac80211: allow disable power save in mesh"
From: Bob Copeland @ 2013-10-29 22:11 UTC (permalink / raw)
  To: johannes, Chun-Yeow Yeoh; +Cc: linux-wireless, Bob Copeland

This reverts commit ee1f668136b2fb6640ee2d54c2a525ea41f98211.

The aformentioned commit added a check to allow
'iw wlan0 set power_save off' to work for mesh interfaces.

However, this is problematic because it also allows
'iw wlan0 set power_save on', which will crash in short order
because all of the subsequent code manipulates sdata->u.mgd.

The power-saving states for mesh interfaces can be manipulated
through the mesh config, e.g:
'iw wlan0 set mesh_param mesh_power_save=active' (which,
despite the name, actualy disables power saving since the
setting refers to the type of sleep the interface undergoes).

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
Chun-Yeow, I ran into the above mentioned crash when playing with
mesh PS.  Can you clarify how the original patch helped?

 net/mac80211/cfg.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ed1e9a8..478211c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2488,8 +2488,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 
-	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+	if (sdata->vif.type != NL80211_IFTYPE_STATION)
 		return -EOPNOTSUPP;
 
 	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
-- 
1.7.10.4


^ permalink raw reply related

* [ANN] backports stable releases based on kernel 3.10.17, 3.11.6 and 3.12-rc7 released
From: Hauke Mehrtens @ 2013-10-29 22:08 UTC (permalink / raw)
  To: backports@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel
In-Reply-To: <526D6A5E.5000100@hauke-m.de>

As promised, here are the backports releases based on recent stable
kernel versions.

Based on 3.10.17:
https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.10.17/backports-3.10.17-2.tar.bz2

Based on 3.11.6:
https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.11.6/backports-3.11.6-1.tar.bz2

Based on 3.12-rc7:
https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.12-rc7/backports-3.12-rc7-1.tar.bz2


The source code can temporary be found here:
https://github.com/hauke/backports

More information can be found in our wiki:
https://backports.wiki.kernel.org/index.php/Main_Page

Hauke

^ permalink raw reply

* [PATCH NEXT] rtl8187: Increase RX queue depth
From: Larry Finger @ 2013-10-29 22:06 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Larry Finger, netdev

Under heavy load, the relatively small number of RX queue entries are
completely filled. With an increase from 16 to 32 entries, this condition
rarely happens.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 9a6edb0..ec9aa5b 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -416,7 +416,7 @@ static int rtl8187_init_urbs(struct ieee80211_hw *dev)
 	struct rtl8187_rx_info *info;
 	int ret = 0;
 
-	while (skb_queue_len(&priv->rx_queue) < 16) {
+	while (skb_queue_len(&priv->rx_queue) < 32) {
 		skb = __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL);
 		if (!skb) {
 			ret = -ENOMEM;
-- 
1.8.4


^ permalink raw reply related

* Re: [PATCH NEXT] rtlwifi: Fix endian error in extracting packet type
From: Larry Finger @ 2013-10-29 20:16 UTC (permalink / raw)
  To: Bjørn Mork, Ben Hutchings
  Cc: linville, linux-wireless, Mark Cave-Ayland, netdev, Stable
In-Reply-To: <87y55cf8yq.fsf@nemi.mork.no>

On 10/29/2013 09:27 AM, Bjørn Mork wrote:
>
> It's not validating the upper 8 bits of the port numbers either, so it
> will hit random UDP traffic in addition to DHCP.
>
> But it was good to see this function now. I was wondering how to support
> some buggy 3G modem firmware without ugly hacks. Seems there will always
> be worse hacks in drivers/net, no matter what I do :-)

I'm happy that Realtek and I could make your day. The next version is checking 
the full 16-bit port numbers.

Thanks,

Larry



^ permalink raw reply

* Re: [patch] libertas: potential oops in debugfs
From: Dan Carpenter @ 2013-10-29 20:09 UTC (permalink / raw)
  To: John W. Linville
  Cc: libertas-dev, linux-wireless, netdev, security, Nico Golde,
	Fabian Yamaguchi
In-Reply-To: <20131029190641.GB21820@longonot.mountain>

On Tue, Oct 29, 2013 at 10:06:41PM +0300, Dan Carpenter wrote:
> If we do a zero size write then it will oops.  This can only be
> triggered by root.
> 

This one isn't right...  Sorry for that.  We do need to fix the while
loop.  I wasn't thinking.

I will resend.

regards,
dan carpenter


^ permalink raw reply

* [patch] libertas: potential oops in debugfs
From: Dan Carpenter @ 2013-10-29 19:06 UTC (permalink / raw)
  To: John W. Linville
  Cc: libertas-dev, linux-wireless, netdev, security, Nico Golde,
	Fabian Yamaguchi
In-Reply-To: <20131025144452.GA28451@ngolde.de>

If we do a zero size write then it will oops.  This can only be
triggered by root.

Reported-by: Nico Golde <nico@ngolde.de>
Reported-by: Fabian Yamaguchi <fabs@goesec.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 668dd27..a148f14 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -913,6 +913,9 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
 	char *p2;
 	struct debug_data *d = f->private_data;
 
+	if (cnt == 0)
+		return 0;
+
 	pdata = kmalloc(cnt, GFP_KERNEL);
 	if (pdata == NULL)
 		return 0;

^ permalink raw reply related

* Re: [PATCH 3/3] rtlwifi: fix usage of freq_reg_info()
From: Larry Finger @ 2013-10-29 18:56 UTC (permalink / raw)
  To: Luis R. Rodriguez, linville, johannes
  Cc: linux-wireless, Julia Lawall, Peter Senna Tschudin
In-Reply-To: <1383071666-26817-4-git-send-email-mcgrof@do-not-panic.com>

On 10/29/2013 01:34 PM, Luis R. Rodriguez wrote:
> freq_reg_info() expects KHz and not MHz, fix this. In
> this case we'll now be getting the no-ir flags cleared
> on channels for any channel when the country IE trusts
> that channel.
>
> @@
> struct ieee80211_channel *ch;
> struct wiphy *wiphy;
> const struct ieee80211_reg_rule *rule;
> @@
>
> -rule = freq_reg_info(wiphy, ch->center_freq);
> +rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
>
> Generated-by: Coccinelle SmPL
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Peter Senna Tschudin <peter.senna@gmail.com>
> Cc: Larry Finger <Larry.Finger@lwfinger.net>
> Reported-by: Mihir Shete <smihir@qti.qualcomm.com>
> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
> ---

This patch got some fuzz on my system in hunks 2 & 3 and failed "git am". With 
patch, it yielded correct code despite the fuzz.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Larry

>   drivers/net/wireless/rtlwifi/regd.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c
> index 2e1642c..29d2813 100644
> --- a/drivers/net/wireless/rtlwifi/regd.c
> +++ b/drivers/net/wireless/rtlwifi/regd.c
> @@ -169,7 +169,8 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy,
>   			    (ch->flags & IEEE80211_CHAN_RADAR))
>   				continue;
>   			if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) {
> -				reg_rule = freq_reg_info(wiphy, ch->center_freq);
> +				reg_rule = freq_reg_info(wiphy,
> +							 MHZ_TO_KHZ(ch->center_freq));
>   				if (IS_ERR(reg_rule))
>   					continue;
>
> @@ -228,7 +229,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
>   	 */
>
>   	ch = &sband->channels[11];	/* CH 12 */
> -	reg_rule = freq_reg_info(wiphy, ch->center_freq);
> +	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
>   	if (!IS_ERR(reg_rule)) {
>   		if (!(reg_rule->flags & NL80211_RRF_NO_IR))
>   			if (ch->flags & IEEE80211_CHAN_NO_IR)
> @@ -236,7 +237,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
>   	}
>
>   	ch = &sband->channels[12];	/* CH 13 */
> -	reg_rule = freq_reg_info(wiphy, ch->center_freq);
> +	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
>   	if (!IS_ERR(reg_rule)) {
>   		if (!(reg_rule->flags & NL80211_RRF_NO_IR))
>   			if (ch->flags & IEEE80211_CHAN_NO_IR)
>


^ permalink raw reply

* Re: [PATCH 2/5] ath: clean up ath_reg_apply_active_scan_flags()
From: Luis R. Rodriguez @ 2013-10-29 18:34 UTC (permalink / raw)
  To: Shete, Mihir
  Cc: linville@tuxdriver.com, johannes@sipsolutions.net,
	linux-wireless@vger.kernel.org, janusz.dziedzic@tieto.com,
	Bhattacharyya, Tushnim, Julia Lawall, Peter Senna Tschudin
In-Reply-To: <5311DA48427A8F44AF96B64A3AF0074D06DCDF69@aphydexd01a>

On Tue, Oct 29, 2013 at 5:19 PM, Shete, Mihir <smihir@qti.qualcomm.com> wrote:
>
>
>> -----Original Message-----
>> From: Luis R. Rodriguez [mailto:mcgrof@gmail.com] On Behalf Of Luis R.
>> Rodriguez
>> Sent: Monday, October 21, 2013 10:45 PM
>> To: linville@tuxdriver.com; johannes@sipsolutions.net
>> Cc: linux-wireless@vger.kernel.org; janusz.dziedzic@tieto.com; Shete, Mihir;
>> Bhattacharyya, Tushnim; Luis R. Rodriguez
>> Subject: [PATCH 2/5] ath: clean up ath_reg_apply_active_scan_flags()
>>
>> The routine ath_reg_apply_active_scan_flags() can be a bit hard to read, this
>> cleans it up by adding helpers for the two cases of clearing IR flags or adding
>> them. This approach also makes no assumptions on the index of channels 12
>> and 13 so it should be portable accross different drivers.
>>
>> Cc: smihir@qti.qualcomm.com
>> Cc: tushnimb@qca.qualcomm.com
>> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
>> ---
>>  drivers/net/wireless/ath/regd.c | 101 +++++++++++++++++++++++++-------
>> --------
>>  1 file changed, 63 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/regd.c
>> b/drivers/net/wireless/ath/regd.c index 1b4a532..48e2368 100644
>> --- a/drivers/net/wireless/ath/regd.c
>> +++ b/drivers/net/wireless/ath/regd.c
>> @@ -177,6 +177,47 @@ static bool ath_is_radar_freq(u16 center_freq)
>>       return (center_freq >= 5260 && center_freq <= 5700);  }
>>
>> +static void ath_force_clear_no_ir_chan(struct wiphy *wiphy,
>> +                                    struct ieee80211_channel *ch) {
>> +     const struct ieee80211_reg_rule *reg_rule;
>> +
>> +     reg_rule = freq_reg_info(wiphy, ch->center_freq);
>
> Do we not require to provide the frequency in KHZ here?

Good catch! This has been beautifully broken for eons. And guess, what
all those other drivers that copied the code also have this broken.
I'll just send a follow up patch to fix this on top of this patch for
each driver as they're all broken. In a way this seems to be begging
to just share a reg_notifier between drivers as a few drivers copied
the same behaviour from ath9k.

  Luis

^ permalink raw reply

* [PATCH 3/3] rtlwifi: fix usage of freq_reg_info()
From: Luis R. Rodriguez @ 2013-10-29 18:34 UTC (permalink / raw)
  To: linville, johannes
  Cc: linux-wireless, Luis R. Rodriguez, Julia Lawall,
	Peter Senna Tschudin, Larry Finger
In-Reply-To: <1383071666-26817-1-git-send-email-mcgrof@do-not-panic.com>

freq_reg_info() expects KHz and not MHz, fix this. In
this case we'll now be getting the no-ir flags cleared
on channels for any channel when the country IE trusts
that channel.

@@
struct ieee80211_channel *ch;
struct wiphy *wiphy;
const struct ieee80211_reg_rule *rule;
@@

-rule = freq_reg_info(wiphy, ch->center_freq);
+rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));

Generated-by: Coccinelle SmPL
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Mihir Shete <smihir@qti.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/rtlwifi/regd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c
index 2e1642c..29d2813 100644
--- a/drivers/net/wireless/rtlwifi/regd.c
+++ b/drivers/net/wireless/rtlwifi/regd.c
@@ -169,7 +169,8 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy,
 			    (ch->flags & IEEE80211_CHAN_RADAR))
 				continue;
 			if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) {
-				reg_rule = freq_reg_info(wiphy, ch->center_freq);
+				reg_rule = freq_reg_info(wiphy,
+							 MHZ_TO_KHZ(ch->center_freq));
 				if (IS_ERR(reg_rule))
 					continue;
 
@@ -228,7 +229,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
 	 */
 
 	ch = &sband->channels[11];	/* CH 12 */
-	reg_rule = freq_reg_info(wiphy, ch->center_freq);
+	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
 	if (!IS_ERR(reg_rule)) {
 		if (!(reg_rule->flags & NL80211_RRF_NO_IR))
 			if (ch->flags & IEEE80211_CHAN_NO_IR)
@@ -236,7 +237,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
 	}
 
 	ch = &sband->channels[12];	/* CH 13 */
-	reg_rule = freq_reg_info(wiphy, ch->center_freq);
+	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
 	if (!IS_ERR(reg_rule)) {
 		if (!(reg_rule->flags & NL80211_RRF_NO_IR))
 			if (ch->flags & IEEE80211_CHAN_NO_IR)
-- 
1.8.4.rc3


^ permalink raw reply related

* [PATCH 2/3] brcm80211: fix usage of freq_reg_info()
From: Luis R. Rodriguez @ 2013-10-29 18:34 UTC (permalink / raw)
  To: linville, johannes
  Cc: linux-wireless, Luis R. Rodriguez, Julia Lawall,
	Peter Senna Tschudin, Seth Forshee, Arend van Spriel
In-Reply-To: <1383071666-26817-1-git-send-email-mcgrof@do-not-panic.com>

freq_reg_info() expects KHz and not MHz, fix this. In
this case we'll now be getting the no-ir flags cleared
on channels for any channel when the country IE trusts
that channel.

@@
struct ieee80211_channel *ch;
struct wiphy *wiphy;
const struct ieee80211_reg_rule *rule;
@@

-rule = freq_reg_info(wiphy, ch->center_freq);
+rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));

Generated-by: Coccinelle SmPL
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: Arend van Spriel <arend@broadcom.com>
Reported-by: Mihir Shete <smihir@qti.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/brcm80211/brcmsmac/channel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
index c99364f..8272570 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -678,7 +678,8 @@ brcms_reg_apply_beaconing_flags(struct wiphy *wiphy,
 				continue;
 
 			if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) {
-				rule = freq_reg_info(wiphy, ch->center_freq);
+				rule = freq_reg_info(wiphy,
+						     MHZ_TO_KHZ(ch->center_freq));
 				if (IS_ERR(rule))
 					continue;
 
-- 
1.8.4.rc3


^ permalink raw reply related

* [PATCH 1/3] ath: fix usage of freq_reg_info()
From: Luis R. Rodriguez @ 2013-10-29 18:34 UTC (permalink / raw)
  To: linville, johannes
  Cc: linux-wireless, Luis R. Rodriguez, Julia Lawall,
	Peter Senna Tschudin
In-Reply-To: <1383071666-26817-1-git-send-email-mcgrof@do-not-panic.com>

freq_reg_info() expects KHz and not MHz, fix this. In
this case we'll now be getting the no-ir flags cleared
on channels for any channel when the country IE trusts
that channel.

@@
struct ieee80211_channel *ch;
struct wiphy *wiphy;
const struct ieee80211_reg_rule *rule;
@@

-rule = freq_reg_info(wiphy, ch->center_freq);
+rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));

Generated-by: Coccinelle SmPL
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Reported-by: Mihir Shete <smihir@qti.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index a258283..bc9ba78 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -182,7 +182,7 @@ static void ath_force_clear_no_ir_chan(struct wiphy *wiphy,
 {
 	const struct ieee80211_reg_rule *reg_rule;
 
-	reg_rule = freq_reg_info(wiphy, ch->center_freq);
+	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));
 	if (IS_ERR(reg_rule))
 		return;
 
-- 
1.8.4.rc3


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox