[PATCH v2 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Punit Vara
This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

-Unneeded variable: "ret". Return "0" on line 1733

Remove unneccesary variable ret created to return zero.

Signed-off-by: Punit Vara 
---
 drivers/net/wireless/ath/ath5k/eeprom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c 
b/drivers/net/wireless/ath/ath5k/eeprom.c
index 94d34ee..0c82ea5 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1707,8 +1707,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
struct ath5k_eeprom_info *ee = >ah_capabilities.cap_eeprom;
u32 offset;
u16 val;
-   int ret = 0, i;
-
+   int i;
offset = AR5K_EEPROM_CTL(ee->ee_version) +
AR5K_EEPROM_N_CTLS(ee->ee_version);
 
@@ -1730,7 +1729,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
}
}
 
-   return ret;
+   return 0;
 }
 
 
-- 
2.5.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


Re: [RFC v3 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-22 Thread Grumbach, Emmanuel


On 10/22/2015 05:27 AM, Eric Dumazet wrote:
> On Thu, 2015-10-22 at 00:14 +, Grumbach, Emmanuel wrote:
> 
>>
>> Well. I guess I should at least check, but even with very small MSS, our
>> device supports up to 20 pointers for the same 802.11 packet: 2 are for
>> metadata. So basically, so leaves me only 18 pointers. for each MSS I
>> need at least 2 (one for the headers and one for the payload), so I will
>> have at most 9 of these for one packet, even with a tiny MSS.
>>
> 
> I did not see in your patch where you made the checks about 18 segs in a
> TSO packet ?

It is in the other patch: iwlwifi: mvm: send large SKBs to the transport
mvm is the op_mode and the op_mode needs to make sure that the payload
fits in one 802.11 packet AND it doesn't exhaust the number of pointers.
I'll add a comment here.

> 
>> I agree that all this should be added to the code in a comment.
>> Speaking of which...
>> int tso_count_descs(struct sk_buff *skb)
>> {
>> /* The Marvell Way */
>> return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags;
>> }
>>
>> What if there is some payload in the header?
>> To me it sounds safer to return:
>>
>> skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags + 1;
>>
>> or maybe to test if there is some payload in the header and then add 1?
>> If there is payload in the header, it should be considered as another
>> frag, shouldn't it?
> 
> Minimal count is gso_segs (one per MSS)
> 
> Then you have to add extra for the cases we have a mss spanning a frag
> in skb.
> 
> Thats a max of (skb_shinfo(skb)->nr_frags - 1) + (data_in_head() ? 1 :
> 0);
> So I believe formula would be correct.
> 

I needed a piece of paper and a few drawings to understand you are
right... :)
--
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: QCA6174, is it ath6kl or ath10k?

2015-10-22 Thread Kalle Valo
Yan Bellavance  writes:

> I would like to know if the QCA6174 should be driven by ath6kl driver or
> ath10k.  I'm working with snapdragon 810 devkit and it looks like it's using
> ath6kl based driver but official linux documentation and github point out that
> it should be driven by ath10k.

What makes you think you should use ath6kl with QCA6174? Please provide
details.

> Could someone explain to me what are the differences between the two(briefly
> and in the context of QCA61x4) and if there are drawbacks to using the ath6kl
> one?

ath10k and ath6kl are drivers for different chipsets, you cannot just
choose with one to use. I don't understand why you think you can choose
as you can't.

> Why are we not using ath10k driver?

With QCA6174 you have to use ath10k.

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


Re: [PATCH v2 05/15] net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate

2015-10-22 Thread Eliad Peller
On Wed, Oct 21, 2015 at 10:07 PM, Punit Vara  wrote:
> Remove int ret suggested by kbuild test robot
>
> This patch is to the wlcore/acx.c file that fixes up warning
> reported by coccicheck:
>
> WARNING: end returns can be simplified if negative or 0 value
>
> Prefer direct return value instead of writing 2-3 more sentence.
>
> Signed-off-by: Punit Vara 
> ---
>  drivers/net/wireless/ti/wlcore/acx.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/acx.c 
> b/drivers/net/wireless/ti/wlcore/acx.c
> index f28fa3b..6b566d9 100644
> --- a/drivers/net/wireless/ti/wlcore/acx.c
> +++ b/drivers/net/wireless/ti/wlcore/acx.c
> @@ -158,16 +158,11 @@ out:
>  int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
>size_t len)
>  {
> -   int ret;
>
> wl1271_debug(DEBUG_ACX, "acx mem map");
>
> -   ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
> +   return wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
>  sizeof(struct acx_header), len);
> -   if (ret < 0)
> -   return ret;
> -
> -   return 0;
>  }
>
this changes the return value in case of positive values.
have you verified it can't happen / won't affect the code flow?
i'm not sure you really want to blindly patch it...

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


[PATCH v4 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Punit Vara
Remove black line suggested by Sergei

This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

Unneeded variable: "ret". Return "0" on line 980

Remove unneeded variable ret created to return zero.

Signed-off-by: Punit Vara 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 900e72a..94bcc08 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -935,8 +935,6 @@ static const struct ieee80211_ops wcn36xx_ops = {
 
 static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
 {
-   int ret = 0;
-
static const u32 cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
WLAN_CIPHER_SUITE_WEP104,
@@ -977,7 +975,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
wcn->hw->sta_data_size = sizeof(struct wcn36xx_sta);
wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
 
-   return ret;
+   return 0;
 }
 
 static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
-- 
2.5.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


[PATCH v3 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Punit Vara
This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

-Unneeded variable: "ret". Return "0" on line 1733

Remove unneccesary variable ret created to return zero.

Also removed empty line suggested by Sergei
 
Signed-off-by: Punit Vara 
---
 drivers/net/wireless/ath/ath5k/eeprom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c 
b/drivers/net/wireless/ath/ath5k/eeprom.c
index 94d34ee..0c82ea5 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1707,8 +1707,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
struct ath5k_eeprom_info *ee = >ah_capabilities.cap_eeprom;
u32 offset;
u16 val;
-   int ret = 0, i;
-
+   int i;
offset = AR5K_EEPROM_CTL(ee->ee_version) +
AR5K_EEPROM_N_CTLS(ee->ee_version);
 
@@ -1730,7 +1729,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
}
}
 
-   return ret;
+   return 0;
 }
 
 
-- 
2.5.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


Re: [PATCH v3 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread punit vara
On Fri, Oct 23, 2015 at 12:05 AM, Sergei Shtylyov
 wrote:
> Hello.
>
> On 10/22/2015 09:26 PM, Punit Vara wrote:
>
>> This patch is to the ath5k/eeprom.c that fixes up warning caught by
>> coccicheck:
>>
>> -Unneeded variable: "ret". Return "0" on line 1733
>>
>> Remove unneccesary variable ret created to return zero.
>>
>> Also removed empty line suggested by Sergei
>>
>> Signed-off-by: Punit Vara 
>> ---
>>   drivers/net/wireless/ath/ath5k/eeprom.c | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c
>> b/drivers/net/wireless/ath/ath5k/eeprom.c
>> index 94d34ee..0c82ea5 100644
>> --- a/drivers/net/wireless/ath/ath5k/eeprom.c
>> +++ b/drivers/net/wireless/ath/ath5k/eeprom.c
>> @@ -1707,8 +1707,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
>> struct ath5k_eeprom_info *ee = >ah_capabilities.cap_eeprom;
>> u32 offset;
>> u16 val;
>> -   int ret = 0, i;
>> -
>
>
>No, this one shouldn't have been removed. There should an empty line
> between the declarations and the statements.
>
>> +   int i;
>> offset = AR5K_EEPROM_CTL(ee->ee_version) +
>> AR5K_EEPROM_N_CTLS(ee->ee_version);
>>
>
> MBR, Sergei
>

I have resent patch with update but I cant see it in my mailbox I dont
know Why.. Sorry if You are getting mail more time. I am sending final
version v5 as last.Please sorry for inconvenience
--
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 v5 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Punit Vara
Remove empty line suggested by Sergei

This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

Unneeded variable: "ret". Return "0" on line 980

Remove unneeded variable ret created to return zero.

Signed-off-by: Punit Vara 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 900e72a..94bcc08 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -935,8 +935,6 @@ static const struct ieee80211_ops wcn36xx_ops = {
 
 static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
 {
-   int ret = 0;
-
static const u32 cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
WLAN_CIPHER_SUITE_WEP104,
@@ -977,7 +975,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
wcn->hw->sta_data_size = sizeof(struct wcn36xx_sta);
wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
 
-   return ret;
+   return 0;
 }
 
 static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
-- 
2.5.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


[PATCH 1/2] cfg80211: Add missing tracing to cfg80211

2015-10-22 Thread Emmanuel Grumbach
From: Ilan Peer 

Add missing tracing for:

1. start_radar_detection()
2. set_mcast_rates()
3. set_coalesce()

Signed-off-by: Ilan Peer 
Signed-off-by: Emmanuel Grumbach 
---
 net/wireless/nl80211.c  |  9 
 net/wireless/rdev-ops.h | 43 ++
 net/wireless/trace.h| 61 +
 3 files changed, 108 insertions(+), 5 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d693c9d..205b659 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6498,8 +6498,7 @@ static int nl80211_start_radar_detection(struct sk_buff 
*skb,
if (WARN_ON(!cac_time_ms))
cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS;
 
-   err = rdev->ops->start_radar_detection(>wiphy, dev, ,
-  cac_time_ms);
+   err = rdev_start_radar_detection(rdev, dev, , cac_time_ms);
if (!err) {
wdev->chandef = chandef;
wdev->cac_started = true;
@@ -7562,7 +7561,7 @@ static int nl80211_set_mcast_rate(struct sk_buff *skb, 
struct genl_info *info)
if (!nl80211_parse_mcast_rate(rdev, mcast_rate, nla_rate))
return -EINVAL;
 
-   err = rdev->ops->set_mcast_rate(>wiphy, dev, mcast_rate);
+   err = rdev_set_mcast_rate(rdev, dev, mcast_rate);
 
return err;
 }
@@ -9707,7 +9706,7 @@ static int nl80211_set_coalesce(struct sk_buff *skb, 
struct genl_info *info)
 
if (!info->attrs[NL80211_ATTR_COALESCE_RULE]) {
cfg80211_rdev_free_coalesce(rdev);
-   rdev->ops->set_coalesce(>wiphy, NULL);
+   rdev_set_coalesce(rdev, NULL);
return 0;
}
 
@@ -9735,7 +9734,7 @@ static int nl80211_set_coalesce(struct sk_buff *skb, 
struct genl_info *info)
i++;
}
 
-   err = rdev->ops->set_coalesce(>wiphy, _coalesce);
+   err = rdev_set_coalesce(rdev, _coalesce);
if (err)
goto error;
 
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index c23516d..b8cc594 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1020,4 +1020,47 @@ rdev_tdls_cancel_channel_switch(struct 
cfg80211_registered_device *rdev,
trace_rdev_return_void(>wiphy);
 }
 
+static inline int
+rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
+  struct net_device *dev,
+  struct cfg80211_chan_def *chandef,
+  u32 cac_time_ms)
+{
+   int ret = -ENOTSUPP;
+
+   trace_rdev_start_radar_detection(>wiphy, dev, chandef,
+cac_time_ms);
+   if (rdev->ops->start_radar_detection)
+   ret = rdev->ops->start_radar_detection(>wiphy, dev,
+  chandef, cac_time_ms);
+   trace_rdev_return_int(>wiphy, ret);
+   return ret;
+}
+
+static inline int
+rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
+   struct net_device *dev,
+   int mcast_rate[IEEE80211_NUM_BANDS])
+{
+   int ret = -ENOTSUPP;
+
+   trace_rdev_set_mcast_rate(>wiphy, dev, mcast_rate);
+   if (rdev->ops->set_mcast_rate)
+   ret = rdev->ops->set_mcast_rate(>wiphy, dev, mcast_rate);
+   trace_rdev_return_int(>wiphy, ret);
+   return ret;
+}
+
+static inline int
+rdev_set_coalesce(struct cfg80211_registered_device *rdev,
+ struct cfg80211_coalesce *coalesce)
+{
+   int ret = -ENOTSUPP;
+
+   trace_rdev_set_coalesce(>wiphy, coalesce);
+   if (rdev->ops->set_coalesce)
+   ret = rdev->ops->set_coalesce(>wiphy, coalesce);
+   trace_rdev_return_int(>wiphy, ret);
+   return ret;
+}
 #endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 0c392d3..62d9b96 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2818,6 +2818,67 @@ TRACE_EVENT(cfg80211_stop_iface,
  WIPHY_PR_ARG, WDEV_PR_ARG)
 );
 
+TRACE_EVENT(rdev_start_radar_detection,
+   TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+struct cfg80211_chan_def *chandef,
+u32 cac_time_ms),
+   TP_ARGS(wiphy, netdev, chandef, cac_time_ms),
+   TP_STRUCT__entry(
+   WIPHY_ENTRY
+   NETDEV_ENTRY
+   CHAN_DEF_ENTRY
+   __field(u32, cac_time_ms)
+   ),
+   TP_fast_assign(
+   WIPHY_ASSIGN;
+   NETDEV_ASSIGN;
+   CHAN_DEF_ASSIGN(chandef);
+   __entry->cac_time_ms = cac_time_ms;
+   ),
+   TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT
+ ", cac_time_ms=%u",
+ WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG,
+ __entry->cac_time_ms)
+);

[PATCH 2/2] cfg80211: add complete data to station add/change tracing

2015-10-22 Thread Emmanuel Grumbach
From: Johannes Berg 

Complete the tracepoint with the missing data - it's not printed
by default (a lot of it is dynamic arrays) but will be recorded
and be available during post-processing.

Signed-off-by: Johannes Berg 
---
 net/wireless/trace.h | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 62d9b96..5b9139e 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -623,12 +623,24 @@ DECLARE_EVENT_CLASS(station_add_change,
__field(u32, sta_flags_set)
__field(u32, sta_modify_mask)
__field(int, listen_interval)
+   __field(u16, capability)
__field(u16, aid)
__field(u8, plink_action)
__field(u8, plink_state)
__field(u8, uapsd_queues)
+   __field(u8, max_sp)
+   __field(u8, opmode_notif)
+   __field(bool, opmode_notif_used)
__array(u8, ht_capa, (int)sizeof(struct ieee80211_ht_cap))
+   __array(u8, vht_capa, (int)sizeof(struct ieee80211_vht_cap))
__array(char, vlan, IFNAMSIZ)
+   __dynamic_array(u8, supported_rates,
+   params->supported_rates_len)
+   __dynamic_array(u8, ext_capab, params->ext_capab_len)
+   __dynamic_array(u8, supported_channels,
+   params->supported_channels_len)
+   __dynamic_array(u8, supported_oper_classes,
+   params->supported_oper_classes_len)
),
TP_fast_assign(
WIPHY_ASSIGN;
@@ -646,9 +658,35 @@ DECLARE_EVENT_CLASS(station_add_change,
if (params->ht_capa)
memcpy(__entry->ht_capa, params->ht_capa,
   sizeof(struct ieee80211_ht_cap));
+   memset(__entry->vht_capa, 0, sizeof(struct ieee80211_vht_cap));
+   if (params->vht_capa)
+   memcpy(__entry->vht_capa, params->vht_capa,
+  sizeof(struct ieee80211_vht_cap));
memset(__entry->vlan, 0, sizeof(__entry->vlan));
if (params->vlan)
memcpy(__entry->vlan, params->vlan->name, IFNAMSIZ);
+   if (params->supported_rates && params->supported_rates_len)
+   memcpy(__get_dynamic_array(supported_rates),
+  params->supported_rates,
+  params->supported_rates_len);
+   if (params->ext_capab && params->ext_capab_len)
+   memcpy(__get_dynamic_array(ext_capab),
+  params->ext_capab,
+  params->ext_capab_len);
+   if (params->supported_channels &&
+   params->supported_channels_len)
+   memcpy(__get_dynamic_array(supported_channels),
+  params->supported_channels,
+  params->supported_channels_len);
+   if (params->supported_oper_classes &&
+   params->supported_oper_classes_len)
+   memcpy(__get_dynamic_array(supported_oper_classes),
+  params->supported_oper_classes,
+  params->supported_oper_classes_len);
+   __entry->max_sp = params->max_sp;
+   __entry->capability = params->capability;
+   __entry->opmode_notif = params->opmode_notif;
+   __entry->opmode_notif_used = params->opmode_notif_used;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT
  ", station flags mask: %u, station flags set: %u, "
-- 
2.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


Re: [PATCH v3 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Sergei Shtylyov

Hello.

On 10/22/2015 09:26 PM, Punit Vara wrote:


This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

-Unneeded variable: "ret". Return "0" on line 1733

Remove unneccesary variable ret created to return zero.

Also removed empty line suggested by Sergei

Signed-off-by: Punit Vara 
---
  drivers/net/wireless/ath/ath5k/eeprom.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c 
b/drivers/net/wireless/ath/ath5k/eeprom.c
index 94d34ee..0c82ea5 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1707,8 +1707,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
struct ath5k_eeprom_info *ee = >ah_capabilities.cap_eeprom;
u32 offset;
u16 val;
-   int ret = 0, i;
-


   No, this one shouldn't have been removed. There should an empty line 
between the declarations and the statements.



+   int i;
offset = AR5K_EEPROM_CTL(ee->ee_version) +
AR5K_EEPROM_N_CTLS(ee->ee_version);



MBR, Sergei

--
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 v4 14/15] net: wireless: ath: Remove unneeded variable ret returning 0

2015-10-22 Thread Sergei Shtylyov

On 10/22/2015 09:47 PM, Punit Vara wrote:


Remove black line suggested by Sergei


   Such kind of comments should be under the --- tear line.



This patch is to the ath5k/eeprom.c that fixes up warning caught by
coccicheck:

Unneeded variable: "ret". Return "0" on line 980

Remove unneeded variable ret created to return zero.

Signed-off-by: Punit Vara 

[...]

MBR, Sergei

--
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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-22 Thread Bruno Randolf
On 10/22/2015 12:13 AM, Jes Sorensen wrote:
> Bruno Randolf  writes:
>> mac80211 documentation says, the ieee80211_ops.start callback "must turn on
>> frame reception (for possibly enabled monitor interfaces.)". If not a single
>> monitor interface does not receive data frames.
>>
>> Similarly we should not change the data reception based on the association
>> state.
>>
>> Signed-off-by: Bruno Randolf 
>> ---
>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 12 ++--
>>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> Bruno,
> 
> Thanks - I am not 100% convinced about this one. I don't think we should
> tell the firmware to pass up data frames before we have negotiated the
> connection.
> 
> It's true that for monitor mode, we need to enable it if all packets
> are requested. Looking at iw there is an option where it only requests
> control packets, and one for all, etc. However for non monitor mode, we
> shouldn't pass all data packets up to the stack, resulting and have
> mac80211 parse them all.

But mac80211 requests us to do so - please see include/net/mac80211.h
line 2576 or
https://www.kernel.org/doc/htmldocs/80211/API-struct-ieee80211-ops.html

I know you are focusing on STA mode at the moment, but
enabling/disabling data reception on association is not correct for most
other modes.

Also don't be afraid of too many frames being passed. In the initial
setting (without a monitor interface) the RCR RCR_ACCEPT_AP bit is not
set and the RCR_CHECK_BSSID_* bits are set as well.

bruno

--
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] rtl8xxxu: Document REG_RXFLTMAP registers

2015-10-22 Thread Bruno Randolf
Add comments describing how REG_RXFLTMAP0, REG_RXFLTMAP1 and REG_RXFLTMAP2
work.

Signed-off-by: Bruno Randolf 
---
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h  | 26 +-
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
index 865bc31..38b13ae 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
@@ -559,9 +559,12 @@
 (Rx beacon, probe rsp) */
 #define  RCR_ACCEPT_CRC32  BIT(8)  /* Accept CRC32 error packet */
 #define  RCR_ACCEPT_ICVBIT(9)  /* Accept ICV error 
packet */
-#define  RCR_ACCEPT_DATA_FRAME BIT(11)
-#define  RCR_ACCEPT_CTRL_FRAME BIT(12)
-#define  RCR_ACCEPT_MGMT_FRAME BIT(13)
+#define  RCR_ACCEPT_DATA_FRAME BIT(11) /* Accept all data pkt or use
+  REG_RXFLTMAP2 */
+#define  RCR_ACCEPT_CTRL_FRAME BIT(12) /* Accept all control pkt or use
+  REG_RXFLTMAP1 */
+#define  RCR_ACCEPT_MGMT_FRAME BIT(13) /* Accept all mgmt pkt or use
+  REG_RXFLTMAP0 */
 #define  RCR_HTC_LOC_CTRL  BIT(14) /* MFC<--HTC=1 MFC-->HTC=0 */
 #define  RCR_UC_DATA_PKT_INT_ENABLEBIT(16) /* Enable unicast data packet
   interrupt */
@@ -641,9 +644,20 @@
 #define REG_LPNAV_CTRL 0x0694
 #define REG_WKFMCAM_CMD0x0698
 #define REG_WKFMCAM_RWD0x069c
-#define REG_RXFLTMAP0  0x06a0
-#define REG_RXFLTMAP1  0x06a2
-#define REG_RXFLTMAP2  0x06a4
+
+/*
+ * RX Filters: each bit corresponds to the numerical value of the subtype.
+ * If it is set the subtype frame type is passed. The filter is only used when
+ * the RCR_ACCEPT_DATA_FRAME, RCR_ACCEPT_CTRL_FRAME, RCR_ACCEPT_MGMT_FRAME bit
+ * in the RCR are low.
+ *
+ * Example: Beacon subtype is binary 1000 which is decimal 8 so we have to set
+ * bit 8 (0x100) in REG_RXFLTMAP0 to enable reception.
+ */
+#define REG_RXFLTMAP0  0x06a0  /* Management frames */
+#define REG_RXFLTMAP1  0x06a2  /* Control frames */
+#define REG_RXFLTMAP2  0x06a4  /* Data frames */
+
 #define REG_BCN_PSR_RPT0x06a8
 #define REG_CALB32K_CTRL   0x06ac
 #define REG_PKT_MON_CTRL   0x06b4
-- 
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 03/12] staging: wilc1000: rename strInterfaceInfo in the sturct wilc

2015-10-22 Thread Dan Carpenter
On Tue, Oct 20, 2015 at 02:26:47PM +0900, Tony Cho wrote:
> This patch renames strInterfaceInfo in the struct wilc to the vif. In
> addition, unnecessary print statements around it are removed in this patch.
> 
> Signed-off-by: Tony Cho 
> ---
>  drivers/staging/wilc1000/linux_wlan.c | 91 
> +++
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +-
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
>  3 files changed, 80 insertions(+), 85 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index 2bea103..971b99a 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -366,24 +366,21 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
>   Bssid  = pMacHeader + 10;
>   Bssid1 = pMacHeader + 4;
>  
> - for (i = 0; i < g_linux_wlan->vif_num; i++) {
> - if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
> ETH_ALEN) ||
> - !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
> ETH_ALEN)) {
> - return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
> - }
> - }
> + for (i = 0; i < g_linux_wlan->vif_num; i++)
> + if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
> + !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
> + return g_linux_wlan->vif[i].wilc_netdev;
> +

Removing the curly braces was wrong.  Multi-line indents get curly
braces for readability even though the compiler does not insist on them.

regards,
dan carpenter

--
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 03/12] staging: wilc1000: rename strInterfaceInfo in the sturct wilc

2015-10-22 Thread Dan Carpenter
Don't resend the series though.  Please fix it in a later patch.

regards,
dan carpenter
--
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: [RFC v3 2/2] iwlwifi: mvm: send large SKBs to the transport

2015-10-22 Thread Grumbach, Emmanuel
> 
> On Wed, 2015-10-21 at 21:34 +0300, Emmanuel Grumbach wrote:
> > +
> > +   if (skb->protocol == htons(ETH_P_IP)) {
> > +   ip_hdr(tmp)->id = ip_hdr(skb)->id;
> 
> Too late, you already called consume_skb(skb).
> So this is a potential use after free.

Ouch - thanks for catching this!

> 
> > +   be16_add_cpu(_hdr(tmp)->id, i *
> num_subframes);
> > +   }
> > +
> 
> 
> I would use
> base_id = ip_hdr(skb)->id; // before the consume_skb(skb)
> ip_hdr(tmp)->id = htons(base_id + i * num_subframes);
> 
Sure - I will.

I will send a v4 with the fixes.


Re: [RFC v3 2/2] iwlwifi: mvm: send large SKBs to the transport

2015-10-22 Thread Eric Dumazet
On Wed, 2015-10-21 at 21:34 +0300, Emmanuel Grumbach wrote:
> +
> + if (skb->protocol == htons(ETH_P_IP)) {
> + ip_hdr(tmp)->id = ip_hdr(skb)->id;

Too late, you already called consume_skb(skb).
So this is a potential use after free.

> + be16_add_cpu(_hdr(tmp)->id, i * num_subframes);
> + }
> +


I would use 

base_id = ip_hdr(skb)->id; // before the consume_skb(skb)

ip_hdr(tmp)->id = htons(base_id + i * num_subframes);


--
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: hostapd mailinglist gone?

2015-10-22 Thread Jouni Malinen
On Tue, Oct 20, 2015 at 11:39:34AM +0200, Matthias May wrote:
> Is the hostapd mailinglist gone?
> It used to be at http://lists.shmoo.com/mailman/listinfo/hostap
> One is currently greeted with the message: "No such list hostap"

I don't know what exactly happened to the previously used mailing
list on Friday, but in any case, it seems to have disappeared and
I have not received any response to my question on what happened
and whether the list could be fixed. As such, there is now a new
mailing list that replaces the old one. Please note that I do not
have access to the subscriber list from the old server, so no
subscribers were transferred to the new mailing list and whoever wants
to remain on the list will need to subscribe again.

The new subscription page is here:
http://lists.infradead.org/mailman/listinfo/hostap

Messages sent to this address will get delivered to the list:
hos...@lists.infradead.org

Any messages sent after October 16 did not make it to the old list and
as such, may need to be resend to the new list.
 
-- 
Jouni MalinenPGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: QCA6174, is it ath6kl or ath10k?

2015-10-22 Thread Yan Bellavance
Hello Kalle,

Thanks for prompt reply.  Frankly, I'm still trying to figure what driver we 
have really.  It's called qcaqcld2.0 but I see references to ath6kl in the 
various folders relating to the wifi. So that is why I presumed it was based on 
a ath6kl driver. What exactly is the qcaqcld2.0 driver?



1) Here is the list of files and folders in 

/msm8994-la-1-3_amss_oem_standard/LINUX/android/kernel/drivers/net/wireless/ath:

drwxrwxr-x ar5523
drwxrwxr-x ath5k
drwxrwxr-x ath6kl
drwxrwxr-x ath9k
-rw-rw-r-- ath.h
drwxrwxr-x carl9170
-rw-rw-r-- debug.c
-rw-rw-r-- hw.c
-rw-rw-r-- Kconfig
-rw-rw-r-- key.c
-rw-rw-r-- main.c
-rw-rw-r-- Makefile
-rw-rw-r-- regd.c
-rw-rw-r-- regd_common.h
-rw-rw-r-- regd.h
-rw-rw-r-- reg.h
drwxrwxr-x wil6210

As you can see there is no ath10k folder.



2) Here is the list of folders in 

/msm8994-la-1-3_amss_oem_standard/LINUX/android/vendor/qcom/proprietary/wlan

drwxrwxr-x ath6kl-utils
drwxrwxr-x cnss-daemon
drwxrwxr-x utils

As you can see it contains an ath6kl-utils folder.



3) When I look in

/msm8994-la-1-3_amss_oem_standard/LINUX/android/vendor/qcom/proprietary/ftm/Android.mk

I see references to BOARD_HAS_ATH_WLAN_AR6320 only, which is 
useless to us.



4) When I look at athdiag.c, a file inside the qcacld2.0 tools folder, I get 
the following target info for the register set:

/LINUX/android/vendor/qcom/opensource/wlan/qcacld-2.0/tools/athdiag

static const struct ath_target_info target_info[] = {
{"AR9888_v2", reg_ar9888_v2},
{"AR6320_v1", reg_ar6320_v1},
{"AR6320_v2", reg_ar6320_v2},
{"AR6320_v3", reg_ar6320_v3},
};

5) I will spare you the list of all the other details I have found which raises 
questions.

I know support for ath10k starts with kernel 4.0 and we have kernel 3.10 but I 
don't see anything that would tell me that a backport has been applied.  And 
we've been having some issues so that is how I got here.


Regards,

Yan


From: Kalle Valo 
Sent: Thursday, October 22, 2015 2:34 AM
To: Yan Bellavance
Cc: ath6kl-de...@qca.qualcomm.com; c_man...@qca.qualcomm.com; Bartosz 
Markowski; Janusz Dziedzic; Marek Kwaczynski; Marek Puzyniak; Michal Kazior; 
ath...@lists.infradead.org; linux-wireless@vger.kernel.org
Subject: Re: QCA6174, is it ath6kl or ath10k?

Yan Bellavance  writes:

> I would like to know if the QCA6174 should be driven by ath6kl driver or
> ath10k.  I'm working with snapdragon 810 devkit and it looks like it's using
> ath6kl based driver but official linux documentation and github point out that
> it should be driven by ath10k.

What makes you think you should use ath6kl with QCA6174? Please provide
details.

> Could someone explain to me what are the differences between the two(briefly
> and in the context of QCA61x4) and if there are drawbacks to using the ath6kl
> one?

ath10k and ath6kl are drivers for different chipsets, you cannot just
choose with one to use. I don't understand why you think you can choose
as you can't.

> Why are we not using ath10k driver?

With QCA6174 you have to use ath10k.

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


Re: [PATCH V2 03/12] staging: wilc1000: rename strInterfaceInfo in the sturct wilc

2015-10-22 Thread Tony Cho

Thanks for your review.
I will do it later as you mentioned.
Tony.

On 2015년 10월 22일 20:19, Dan Carpenter wrote:

Don't resend the series though.  Please fix it in a later patch.

regards,
dan carpenter


--
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 00/19] staging/wilc1000 cleanups

2015-10-22 Thread glen lee


On 2015년 10월 22일 21:23, Arnd Bergmann wrote:

On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl instead of 
wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data
and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now
to rename the symbols to wilc_* and to remove most but not all references to
g_linux_wlan (or wilc_dev after my rename). Do you want me to post those
so you can integrate them, or should I have a look at what you sent first
(please send me a copy then).


Hi arnd,

I have tested with all the patches you have posted but it does not works. 
firmware start timed out
in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, but it 
shows
Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure
and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
( The patches posted by tony@atmel.com )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but not yet 
accepted.

Thank you.
Glen.


Arnd


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


[PATCH v4 10/10] nfc: Add Intel Fields Peak NFC solution driver

2015-10-22 Thread Robert Dolca
Fields Peak complies with the ISO/IEC 14443A/B, 15693, 18092,
and JIS X 6319-4. It is an NCI based controller.

RF Protocols supported:
 - NFC Forum Type 1 Tags (Jewel, Topaz)
 - NFC Forum Type 2 Tags (Mifare UL)
 - NFC Forum Type 3 Tags (FeliCa)
 - NFC Forum Type 4A (ISO/IEC 14443 A-4 106kbps to 848kbps)
 - NFC Forum Type 4B (ISO/IEC 14443 B-4 106kbps to 848kbps)
 - NFCIP in passive and active modes (ISO/IEC 18092 106kbps to 424kbps)
 - B’ (based on ISO/IEC 14443 B-2)
 - iCLASS (based on ISO/IEC 15693-2)
 - Vicinity cards (ISO/IEC 15693-3)
 - Kovio tags (NFC Forum Type 2)

The device can be enumerated using ACPI using the id INT339A.
The 1st GPIO is the IRQ and the 2nd is the RESET pin.

Signed-off-by: Robert Dolca 
---
 drivers/nfc/Kconfig  |   1 +
 drivers/nfc/Makefile |   1 +
 drivers/nfc/fdp/Kconfig  |  23 ++
 drivers/nfc/fdp/Makefile |   9 +
 drivers/nfc/fdp/fdp.c| 817 +++
 drivers/nfc/fdp/fdp.h|  38 +++
 drivers/nfc/fdp/i2c.c| 388 ++
 7 files changed, 1277 insertions(+)
 create mode 100644 drivers/nfc/fdp/Kconfig
 create mode 100644 drivers/nfc/fdp/Makefile
 create mode 100644 drivers/nfc/fdp/fdp.c
 create mode 100644 drivers/nfc/fdp/fdp.h
 create mode 100644 drivers/nfc/fdp/i2c.c

diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig
index 6639cd1..0d6003d 100644
--- a/drivers/nfc/Kconfig
+++ b/drivers/nfc/Kconfig
@@ -68,6 +68,7 @@ config NFC_PORT100
 
  If unsure, say N.
 
+source "drivers/nfc/fdp/Kconfig"
 source "drivers/nfc/pn544/Kconfig"
 source "drivers/nfc/microread/Kconfig"
 source "drivers/nfc/nfcmrvl/Kconfig"
diff --git a/drivers/nfc/Makefile b/drivers/nfc/Makefile
index 2757fe1..e362141 100644
--- a/drivers/nfc/Makefile
+++ b/drivers/nfc/Makefile
@@ -2,6 +2,7 @@
 # Makefile for nfc devices
 #
 
+obj-$(CONFIG_NFC_FDP)  += fdp/
 obj-$(CONFIG_NFC_PN544)+= pn544/
 obj-$(CONFIG_NFC_MICROREAD)+= microread/
 obj-$(CONFIG_NFC_PN533)+= pn533.o
diff --git a/drivers/nfc/fdp/Kconfig b/drivers/nfc/fdp/Kconfig
new file mode 100644
index 000..fbccd9d
--- /dev/null
+++ b/drivers/nfc/fdp/Kconfig
@@ -0,0 +1,23 @@
+config NFC_FDP
+   tristate "Intel FDP NFC driver"
+   depends on NFC_NCI
+   select CRC_CCITT
+   default n
+   ---help---
+ Intel Fields Peak NFC controller core driver.
+ This is a driver based on the NCI NFC kernel layers.
+
+ To compile this driver as a module, choose m here. The module will
+ be called fdp.
+ Say N if unsure.
+
+config NFC_FDP_I2C
+   tristate "NFC FDP i2c support"
+   depends on NFC_FDP && I2C
+   ---help---
+ This module adds support for the Intel Fields Peak NFC controller
+ i2c interface.
+ Select this if your platform is using the i2c bus.
+
+ If you choose to build a module, it'll be called fdp_i2c.
+ Say N if unsure.
diff --git a/drivers/nfc/fdp/Makefile b/drivers/nfc/fdp/Makefile
new file mode 100644
index 000..e79d51b
--- /dev/null
+++ b/drivers/nfc/fdp/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for FDP NCI based NFC driver
+#
+
+obj-$(CONFIG_NFC_FDP) += fdp.o
+obj-$(CONFIG_NFC_FDP_I2C) += fdp_i2c.o
+
+fdp_i2c-objs  = i2c.o
+
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
new file mode 100644
index 000..ccb07a1
--- /dev/null
+++ b/drivers/nfc/fdp/fdp.c
@@ -0,0 +1,817 @@
+/* -
+ * Copyright (C) 2014-2016, Intel Corporation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * -
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fdp.h"
+
+#define FDP_OTP_PATCH_NAME "otp.bin"
+#define FDP_RAM_PATCH_NAME "ram.bin"
+#define FDP_FW_HEADER_SIZE 576
+#define FDP_FW_UPDATE_SLEEP1000
+
+#define NCI_GET_VERSION_TIMEOUT8000
+#define NCI_PATCH_REQUEST_TIMEOUT  8000
+#define FDP_PATCH_CONN_DEST0xC2
+#define FDP_PATCH_CONN_PARAM_TYPE  0xA0
+
+#define NCI_PATCH_TYPE_RAM 0x00
+#define NCI_PATCH_TYPE_OTP 0x01
+#define NCI_PATCH_TYPE_EOT 0xFF
+
+#define NCI_PARAM_ID_FW_RAM_VERSION0xA0
+#define NCI_PARAM_ID_FW_OTP_VERSION

[PATCH v4 09/10] nfc: nci: add nci_get_conn_info_by_id function

2015-10-22 Thread Robert Dolca
This functin takes as a parameter a pointer to the nci_dev struct and
the first byte from the values of the first domain specific parameter that
was used for the connection creation.

Signed-off-by: Robert Dolca 
---
 include/net/nfc/nci_core.h |  1 +
 net/nfc/nci/core.c | 13 +
 2 files changed, 14 insertions(+)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 5daf004..0569cb2 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -374,6 +374,7 @@ void nci_clear_target_list(struct nci_dev *ndev);
 void nci_req_complete(struct nci_dev *ndev, int result);
 struct nci_conn_info *nci_get_conn_info_by_conn_id(struct nci_dev *ndev,
   int conn_id);
+int nci_get_conn_info_by_id(struct nci_dev *ndev, u8 id);
 
 /* - NCI status code - */
 int nci_to_errno(__u8 code);
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 9d5f7a2..75bda34 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -64,6 +64,19 @@ struct nci_conn_info *nci_get_conn_info_by_conn_id(struct 
nci_dev *ndev,
return NULL;
 }
 
+int nci_get_conn_info_by_id(struct nci_dev *ndev, u8 id)
+{
+   struct nci_conn_info *conn_info;
+
+   list_for_each_entry(conn_info, >conn_info_list, list) {
+   if (conn_info->id == id)
+   return conn_info->conn_id;
+   }
+
+   return -EINVAL;
+}
+EXPORT_SYMBOL(nci_get_conn_info_by_id);
+
 /*  NCI requests  */
 
 void nci_req_complete(struct nci_dev *ndev, int result)
-- 
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 v4 05/10] nfc: nci: Introduce nci_core_cmd

2015-10-22 Thread Robert Dolca
This allows sending core commands from the driver. The driver should be
able to send NCI core commands like CORE_GET_CONFIG_CMD.

Signed-off-by: Robert Dolca 
---
 include/net/nfc/nci_core.h |  1 +
 net/nfc/nci/core.c | 24 +++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index aaada20..4ca1b6d 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -278,6 +278,7 @@ int nci_request(struct nci_dev *ndev,
unsigned long opt),
unsigned long opt, __u32 timeout);
 int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload);
+int nci_core_cmd(struct nci_dev *ndev, __u16 opcode, size_t len, __u8 
*payload);
 int nci_core_reset(struct nci_dev *ndev);
 int nci_core_init(struct nci_dev *ndev);
 
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 5362d8f..5b4f48a 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -325,32 +325,46 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, 
unsigned long opt)
 sizeof(struct nci_rf_deactivate_cmd), );
 }
 
-struct nci_prop_cmd_param {
+struct nci_cmd_param {
__u16 opcode;
size_t len;
__u8 *payload;
 };
 
-static void nci_prop_cmd_req(struct nci_dev *ndev, unsigned long opt)
+static void nci_generic_req(struct nci_dev *ndev, unsigned long opt)
 {
-   struct nci_prop_cmd_param *param = (struct nci_prop_cmd_param *)opt;
+   struct nci_cmd_param *param =
+   (struct nci_cmd_param *)opt;
 
nci_send_cmd(ndev, param->opcode, param->len, param->payload);
 }
 
 int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload)
 {
-   struct nci_prop_cmd_param param;
+   struct nci_cmd_param param;
 
param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid);
param.len = len;
param.payload = payload;
 
-   return __nci_request(ndev, nci_prop_cmd_req, (unsigned long),
+   return __nci_request(ndev, nci_generic_req, (unsigned long),
 msecs_to_jiffies(NCI_CMD_TIMEOUT));
 }
 EXPORT_SYMBOL(nci_prop_cmd);
 
+int nci_core_cmd(struct nci_dev *ndev, __u16 opcode, size_t len, __u8 *payload)
+{
+   struct nci_cmd_param param;
+
+   param.opcode = opcode;
+   param.len = len;
+   param.payload = payload;
+
+   return __nci_request(ndev, nci_generic_req, (unsigned long),
+msecs_to_jiffies(NCI_CMD_TIMEOUT));
+}
+EXPORT_SYMBOL(nci_core_cmd);
+
 int nci_core_reset(struct nci_dev *ndev)
 {
return __nci_request(ndev, nci_reset_req, 0,
-- 
1.9.1

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


[PATCH v4 03/10] nfc: nci: Introduce new core opcodes

2015-10-22 Thread Robert Dolca
Add NCI_OP_CORE_GET_CONFIG_CMD, NCI_OP_CORE_GET_CONFIG_RSP
and NCI_OP_CORE_RESET_NTF.

Signed-off-by: Robert Dolca 
---
 include/net/nfc/nci.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 75d2e18..b495825 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -315,6 +315,8 @@ struct nci_nfcee_mode_set_cmd {
__u8nfcee_mode;
 } __packed;
 
+#define NCI_OP_CORE_GET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x03)
+
 /* --- */
 /*  NCI Responses  */
 /* --- */
@@ -375,6 +377,9 @@ struct nci_nfcee_discover_rsp {
 } __packed;
 
 #define NCI_OP_NFCEE_MODE_SET_RSP nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x01)
+
+#define NCI_OP_CORE_GET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x03)
+
 /* --- */
 /*  NCI Notifications  */
 /* --- */
@@ -528,4 +533,6 @@ struct nci_nfcee_discover_ntf {
struct nci_nfcee_information_tlvinformation_tlv;
 } __packed;
 
+#define NCI_OP_CORE_RESET_NTF  nci_opcode_pack(NCI_GID_CORE, 0x00)
+
 #endif /* __NCI_H */
-- 
1.9.1

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


[PATCH v4 02/10] nfc: nci: Add function to get max packet size for conn

2015-10-22 Thread Robert Dolca
FDP driver needs to send the firmware as regular packets
(not fragmented). The driver should have a way to
get the max packet size for a given connection.

Signed-off-by: Robert Dolca 
---
 include/net/nfc/nci_core.h |  1 +
 net/nfc/nci/data.c | 12 
 2 files changed, 13 insertions(+)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d0d0f1e..aaada20 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -351,6 +351,7 @@ int nci_prop_ntf_packet(struct nci_dev *ndev, __u16 opcode,
 void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb);
 int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
 int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
+int nci_conn_max_data_pkt_payload_size(struct nci_dev *ndev, __u8 conn_id);
 void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
__u8 conn_id, int err);
 void nci_hci_data_received_cb(void *context, struct sk_buff *skb, int err);
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 83acd18..dbd2425 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -90,6 +90,18 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev,
nci_pbf_set((__u8 *)hdr, pbf);
 }
 
+int nci_conn_max_data_pkt_payload_size(struct nci_dev *ndev, __u8 conn_id)
+{
+   struct nci_conn_info *conn_info;
+
+   conn_info = nci_get_conn_info_by_conn_id(ndev, conn_id);
+   if (!conn_info)
+   return -EPROTO;
+
+   return conn_info->max_pkt_payload_len;
+}
+EXPORT_SYMBOL(nci_conn_max_data_pkt_payload_size);
+
 static int nci_queue_tx_data_frags(struct nci_dev *ndev,
   __u8 conn_id,
   struct sk_buff *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 v4 07/10] nfc: nci: rename nci_prop_ops to nci_driver_ops

2015-10-22 Thread Robert Dolca
Initially it was used to create hooks in the driver for proprietary
operations. Currently it is being used for hooks for both proprietary
and generic operations.

Signed-off-by: Robert Dolca 
---
 drivers/nfc/s3fwrn5/nci.c  |  4 ++--
 drivers/nfc/st-nci/core.c  |  2 +-
 include/net/nfc/nci_core.h |  6 +++---
 net/nfc/nci/core.c | 16 
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/nfc/s3fwrn5/nci.c b/drivers/nfc/s3fwrn5/nci.c
index ace0071..075e4e8 100644
--- a/drivers/nfc/s3fwrn5/nci.c
+++ b/drivers/nfc/s3fwrn5/nci.c
@@ -31,7 +31,7 @@ static int s3fwrn5_nci_prop_rsp(struct nci_dev *ndev, struct 
sk_buff *skb)
return 0;
 }
 
-static struct nci_prop_ops s3fwrn5_nci_prop_ops[] = {
+static struct nci_driver_ops s3fwrn5_nci_prop_ops[] = {
{
.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY,
NCI_PROP_AGAIN),
@@ -79,7 +79,7 @@ static struct nci_prop_ops s3fwrn5_nci_prop_ops[] = {
},
 };
 
-void s3fwrn5_nci_get_prop_ops(struct nci_prop_ops **ops, size_t *n)
+void s3fwrn5_nci_get_prop_ops(struct nci_driver_ops **ops, size_t *n)
 {
*ops = s3fwrn5_nci_prop_ops;
*n = ARRAY_SIZE(s3fwrn5_nci_prop_ops);
diff --git a/drivers/nfc/st-nci/core.c b/drivers/nfc/st-nci/core.c
index c419d39..dd7b1c14 100644
--- a/drivers/nfc/st-nci/core.c
+++ b/drivers/nfc/st-nci/core.c
@@ -98,7 +98,7 @@ static int st_nci_prop_rsp_packet(struct nci_dev *ndev,
return 0;
 }
 
-static struct nci_prop_ops st_nci_prop_ops[] = {
+static struct nci_driver_ops st_nci_prop_ops[] = {
{
.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY,
  ST_NCI_CORE_PROP),
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d5a1caa..5daf004 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -67,7 +67,7 @@ enum nci_state {
 
 struct nci_dev;
 
-struct nci_prop_ops {
+struct nci_driver_ops {
__u16 opcode;
int (*rsp)(struct nci_dev *dev, struct sk_buff *skb);
int (*ntf)(struct nci_dev *dev, struct sk_buff *skb);
@@ -94,10 +94,10 @@ struct nci_ops {
void  (*hci_cmd_received)(struct nci_dev *ndev, u8 pipe, u8 cmd,
  struct sk_buff *skb);
 
-   struct nci_prop_ops *prop_ops;
+   struct nci_driver_ops *prop_ops;
size_t n_prop_ops;
 
-   struct nci_prop_ops *core_ops;
+   struct nci_driver_ops *core_ops;
size_t n_core_ops;
 };
 
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 30c2708..f66a5da 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -1242,12 +1242,12 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, 
__u8 plen, void *payload)
 }
 
 /* Proprietary commands API */
-static struct nci_prop_ops *ops_cmd_lookup(struct nci_prop_ops *ops,
-  size_t n_ops,
-  __u16 opcode)
+static struct nci_driver_ops *ops_cmd_lookup(struct nci_driver_ops *ops,
+size_t n_ops,
+__u16 opcode)
 {
size_t i;
-   struct nci_prop_ops *op;
+   struct nci_driver_ops *op;
 
if (!ops || !n_ops)
return NULL;
@@ -1262,10 +1262,10 @@ static struct nci_prop_ops *ops_cmd_lookup(struct 
nci_prop_ops *ops,
 }
 
 static int nci_op_rsp_packet(struct nci_dev *ndev, __u16 rsp_opcode,
-struct sk_buff *skb, struct nci_prop_ops *ops,
+struct sk_buff *skb, struct nci_driver_ops *ops,
 size_t n_ops)
 {
-   struct nci_prop_ops *op;
+   struct nci_driver_ops *op;
 
op = ops_cmd_lookup(ops, n_ops, rsp_opcode);
if (!op || !op->rsp)
@@ -1275,10 +1275,10 @@ static int nci_op_rsp_packet(struct nci_dev *ndev, 
__u16 rsp_opcode,
 }
 
 static int nci_op_ntf_packet(struct nci_dev *ndev, __u16 ntf_opcode,
-struct sk_buff *skb, struct nci_prop_ops *ops,
+struct sk_buff *skb, struct nci_driver_ops *ops,
 size_t n_ops)
 {
-   struct nci_prop_ops *op;
+   struct nci_driver_ops *op;
 
op = ops_cmd_lookup(ops, n_ops, ntf_opcode);
if (!op || !op->ntf)
-- 
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 v4 00/10] Add Intel FieldsPeak NFC solution driver

2015-10-22 Thread Robert Dolca
These patches add support for Intel's FieldsPeak NFC solution.

Fields Peak complies with the ISO/IEC 14443A/B, 15693, 18092,
and JIS X 6319-4. It is an NCI based controller.

RF Protocols supported:
 - NFC Forum Type 1 Tags (Jewel, Topaz)
 - NFC Forum Type 2 Tags (Mifare UL)
 - NFC Forum Type 3 Tags (FeliCa)
 - NFC Forum Type 4A (ISO/IEC 14443 A-4 106kbps to 848kbps)
 - NFC Forum Type 4B (ISO/IEC 14443 B-4 106kbps to 848kbps)
 - NFCIP in passive and active modes (ISO/IEC 18092 106kbps to 424kbps)
 - B’ (based on ISO/IEC 14443 B-2)
 - iCLASS (based on ISO/IEC 15693-2)
 - Vicinity cards (ISO/IEC 15693-3)
 - Kovio tags (NFC Forum Type 2)

The device can be enumerated using ACPI using the id INT339A.
The 1st GPIO is the IRQ and the 2nd is the RESET pin.


Changes since v3:
 - replace u32 with le32 where appropriate
 - make nci_prop_ops struct instances static
 - simplify return for fdp_nci_setup and fdp_nci_post_setup
 - change return type from u8 to int for nci_conn_max_data_pkt_payload_size
 - set FDP_NCI_I2C_MAX_PAYLOAD to 261 (255 + NCI header (3) + lrc(2) + size 
byte)
 - add sleep during patching to make sure that the NFCC processed the last data 
packet
 - patch droped "nfc: nci: Use a separate mutex for nci open and close"
 - patch droped "nfc: nci: Add a parameter to get the new connection id"
 - add patch "nfc: nci: fix possible crash in nci_core_conn_create"
 - add patch "nfc: nci: add nci_get_conn_info_by_id function"
 - add patch "nfc: nci: rename nci_prop_ops to nci_driver_ops"
 - edit "ecee665 nfc: nci: Allow the driver to set handler for core nci ops" to
   add wrappers for core ops and prop ops in order to simplify the code
 - removed "atomic_t intercept;" from fdp_nci_info struct
 - make functions inline: fdp_nci_get_versions, fdp_nci_patch_cmd, 
fdp_nci_set_production_data
 - moved otp and ram patching to separate functions that are called from 
fdp_nci_post_setup

Changes since v2:
 - rename reset gpio to power gpio because it really is a power switch
 - use named gpio for power with fallback to the indexed gpio 0
 - use device managed gpio for power
 - rely on the i2c subsystem to fill in the irq field of the i2c_client struct
 - remove the internal driver state (the nfc subsystem takes care of what
   we need)
 - removed the power status field (not needed any more)
 - change i2c / device tree id name s/INT339A/int339a
 - make clock type and clock frequency configurable with device properties
   (use defauls if not set)
 - firmware vendor specific commands configurable with device properties
   (default none)
 - other small fixes

Changes since v1:
 - removed .owner
 - made local functions static
 - droped "NFC: NCI: Adds NCI init and reset API for drivers"
 - replaced nfc_info with dev_dbg
 - make controller setup possible without OTP patch
 - retoved the commint that was adding nci_init/reset and using
   the newly added functions nci_core_init/reset
 - fixed typo and use full controller name instead of abreviation in Kconfig
 - added more info about the controller in the commit message
 - moved NCI_OP_CORE_RESET_NTF, NCI_OP_CORE_GET_CONFIG_RSP and
   NCI_OP_CORE_GET_CONFIG_CMD into the core header files
 - added MODULE_DEVICE_TABLE for ACPI
 - defined FDP_FW_UPDATE_DEST 0xC2
 - release the firmware buffers
 - settings the vendor configuration and clock on post setup
 - platform data enumerations removed (ACPI enumeration left)
 - packet reception intercept logic remove
 - nci: removed nci_send_cmd symbol export
 - nci: removed nci_request_driver and nci_req_complete_driver
 - removed mutex from driver (no need for it)
 - nci: check the setup return code before callig post_setup
 - nci: add function to allow sending core commands from driver
 - nci: Use a separate mutex for nci open and close
 - nci: mutex for: Adds a way to get the new connection ID
 - nci: Allow the driver to set handler for core nci ops


Robert Dolca (10):
  nfc: nci: Export nci data send API
  nfc: nci: Add function to get max packet size for conn
  nfc: nci: Introduce new core opcodes
  nfc: nci: Do not call post_setup when setup fails
  nfc: nci: Introduce nci_core_cmd
  nfc: nci: Allow the driver to set handler for core nci ops
  nfc: nci: rename nci_prop_ops to nci_driver_ops
  nfc: nci: fix possible crash in nci_core_conn_create
  nfc: nci: add nci_get_conn_info_by_id function
  nfc: Add Intel Fields Peak NFC solution driver

 drivers/nfc/Kconfig|   1 +
 drivers/nfc/Makefile   |   1 +
 drivers/nfc/fdp/Kconfig|  23 ++
 drivers/nfc/fdp/Makefile   |   9 +
 drivers/nfc/fdp/fdp.c  | 817 +
 drivers/nfc/fdp/fdp.h  |  38 +++
 drivers/nfc/fdp/i2c.c  | 388 +
 drivers/nfc/s3fwrn5/nci.c  |   4 +-
 drivers/nfc/st-nci/core.c  |   2 +-
 include/net/nfc/nci.h  |   7 +
 include/net/nfc/nci_core.h |  18 +-
 net/nfc/nci/core.c | 120 +--
 net/nfc/nci/data.c |  13 +
 net/nfc/nci/ntf.c  |   3 +-
 

[PATCH v4 01/10] nfc: nci: Export nci data send API

2015-10-22 Thread Robert Dolca
For the firmware update the driver may use nci_send_data.

Signed-off-by: Robert Dolca 
---
 net/nfc/nci/data.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 566466d..83acd18 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -203,6 +203,7 @@ free_exit:
 exit:
return rc;
 }
+EXPORT_SYMBOL(nci_send_data);
 
 /* - NCI RX 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


Re: [PATCH] wireless-regdb: Update regulatory rules for Croatia (HR)

2015-10-22 Thread Seth Forshee
On Sun, Oct 18, 2015 at 09:44:19PM +0200, Andrej Vlašić wrote:
> On 15 October 2015 at 20:04, Seth Forshee  wrote:
> > On Tue, Oct 13, 2015 at 08:31:24PM +0200, Andrej Vlasic wrote:
> >> Update frequency allocation rules to mach data from table [1].
> >>
> >> Also increase allowed power limit for range 5150-5250 Mhz to 200mW.
> >>
> >> [1] http://tablice.hakom.hr:8280/vis?lang=en
> >>
> >> Signed-off-by: Andrej Vlasic 
> >> ---
> >>  db.txt | 14 ++
> >>  1 file changed, 10 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/db.txt b/db.txt
> >> index d57ea84..3b36616 100644
> >> --- a/db.txt
> >> +++ b/db.txt
> >> @@ -504,11 +504,17 @@ country HN: DFS-FCC
> >>   (5490 - 5730 @ 160), (24), DFS
> >>   (5735 - 5835 @ 80), (30)
> >>
> >> +# Data from table of frequency allocations: 
> >> http://tablice.hakom.hr:8280/vis?lang=en
> >> +# For 5ghz range see 
> >> http://www.hakom.hr/UserDocsImages/op%C4%87e%20dozvole%20prosinac%202009.g/Opca_dozvola_85.pdf
> >> +# and 
> >> http://www.hakom.hr/UserDocsImages/op%C4%87e%20dozvole%20prosinac%202009.g/Opca_dozvola_86.pdf
> >> +# and 
> >> http://www.hakom.hr/UserDocsImages/op%C4%87e%20dozvole%20prosinac%202009.g/Opca_dozvola_87.pdf
> >> +# TPC devices on range 5250-5350 can use 200mW, and 1W on range 5470-5725.
> >> +
> >>  country HR: DFS-ETSI
> >> - (2402 - 2482 @ 40), (20)
> >> - (5170 - 5250 @ 80), (20), AUTO-BW
> >> - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
> >> - (5490 - 5710 @ 160), (27), DFS
> >> + (2400 - 2483.5 @ 40), (100 mW)
> >> + (5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW
> >> + (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
> >> + (5470 - 5725 @ 160), (500 mW), DFS
> >>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> >>   (57000 - 66000 @ 2160), (40)
> >
> > In general the changes look okay to me and in line with the published
> > regulations (I couldn't read some of the documents you linked to, but
> > the limits do look to be in line with ERC/DEC/(01)07 and ECC/DEC/(04)08
> > which are referenced by the frequency allocation table).
> >
> > It seems pretty arbitrary to change from dBm to mW however, especially
> > for those rules whose power limit isn't actually changing. I'd prefer we
> > leave them in dBm for consistency, in which case I think we end up with:
> >
> > country HR: DFS-ETSI
> > (2400 - 2483.5 @ 40), (20)
> > (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
> > (5250 - 5350 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
> > (5470 - 5725 @ 160), (27), DFS
> > # 60 gHz band channels 1-4, ref: Etsi En 302 567
> > (57000 - 66000 @ 2160), (40)
> >
> > If that looks fine to you then I can fix it up when I apply the patch.
> 
> It's fine with me too like that.

Applied with the discussed changes. Thanks!
--
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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-22 Thread Jes Sorensen
Bruno Randolf  writes:
> On 10/22/2015 02:10 PM, Jes Sorensen wrote:
 Thanks - I am not 100% convinced about this one. I don't think we should
 tell the firmware to pass up data frames before we have negotiated the
 connection.

 It's true that for monitor mode, we need to enable it if all packets
 are requested. Looking at iw there is an option where it only requests
 control packets, and one for all, etc. However for non monitor mode, we
 shouldn't pass all data packets up to the stack, resulting and have
 mac80211 parse them all.
>>>
>>> But mac80211 requests us to do so - please see include/net/mac80211.h
>>> line 2576 or
>>> https://www.kernel.org/doc/htmldocs/80211/API-struct-ieee80211-ops.html
>>>
>>> I know you are focusing on STA mode at the moment, but
>>> enabling/disabling data reception on association is not correct for most
>>> other modes.
>>>
>>> Also don't be afraid of too many frames being passed. In the initial
>>> setting (without a monitor interface) the RCR RCR_ACCEPT_AP bit is not
>>> set and the RCR_CHECK_BSSID_* bits are set as well.
>> 
>> I realize the different modes require different behavior, and we
>> obviously need to deal with this. However we shouldn't downgrade STA
>> mode in order to be able to handle other modes. Passing too many frames
>> unncessarily is bad, it adds unnecessary load to the USB bus as well as
>> the stack.
>> 
>> Remember that mac80211 is designed to handle completely dumb devices
>> too, where it needs to process everything.
>> 
>> So I am not against making changes, I just want them done right.
>
> Well, I'd say that for a mac80211 driver the right thing to do is to
> follow the documented specifications of mac80211. Also I don't see how
> this would downgrade STA mode, and I explained to you above how in STA
> mode that does not pass more data frames to mac80211 than before.

As I said, I don't mind changing things, but passing frames
unnecessarily is to downgrade the STA mode driver's performance.

If mac80211 requires this for some reason, then I agree, make the
change, otherwise lets find a solution that works for both modes.

> BTW that also fixes the "endless scanning" problem I reported to you
> before, and makes the driver work with the slightly older mac80211
> version of OpenWRT 15.05. Care to explain what's not right with this?
>
> But maybe a more credible mac80211 developer can can comment?

Making things work against random kernel versions of OpenWRT is not
particularly "credible". If the driver needs hacks to work with older
kernels, then they should be applied for the older kernels. Linux does
not have a history of carrying hacks in current drivers to accommodate
older kernels.

I am not sure what endless scanning problem you are talking about?
I know you had issues with duplicate MAC addresses due to
NetworkMangler, but I do not remember issues with endless scanning.

Basically we should only be receiving mgmt frames until we are
connected, while in STA mode. It reduces power draing and load on the
USB bus.

In monitor mode we obviously want to receive them all - Johannes Berg
just reminded me of @IEEE80211_CONF_MONITOR. We may be able to use this
to determine when to enable things early, and when to do it on
association.

Jes
--
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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-22 Thread Bruno Randolf
On 10/22/2015 02:42 PM, Jes Sorensen wrote:
> Making things work against random kernel versions of OpenWRT is not
> particularly "credible". If the driver needs hacks to work with older
> kernels, then they should be applied for the older kernels. Linux does
> not have a history of carrying hacks in current drivers to accommodate
> older kernels.

Well forget OpenWRT. The point is that this is not a hack - it's the
behavior that mac80211 expects and documents and moreover it does NOT
pass more data frames than before.

It does not pass more data frames before association because the RCR
RCR_ACCEPT_AP bit is not set and the RCR_CHECK_BSSID_* bits are set.

bruno
--
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: pull-request: mac80211-next 2015-10-21

2015-10-22 Thread David Miller
From: Johannes Berg 
Date: Wed, 21 Oct 2015 17:07:06 +0200

> Here's another, likely final, pull request for -next. I finally caved
> in and cleaned up the regulatory code a bit, which is the bulk of the
> changes.
> 
> There's a new Kconfig which allows turning off CRDA, but it's hidden
> behind having the internal regdb enabled, which in turn is hidden
> behind EXPERT, so hopefully you won't even see that :) (although I am
> hoping to get rid of the internal regdb sooner rather than later)
> 
> Let me know if you see any problems.

Pulled, thanks a lot 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: [RFC v4 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-22 Thread Grumbach, Emmanuel


On 10/22/2015 04:08 PM, Grumbach, Emmanuel wrote:
> When the op_mode sends an skb whose payload is bigger than
> MSS, PCIe will create an A-MSDU out of it. PCIe assumes
> that the skb that is coming from the op_mode can fit in one
> A-MSDU. It is the op_mode's responsibility to make sure
> that this guarantee holds.
> 
> Additional headers need to be built for the subframes.
> The TSO core code takes care of the IP / TCP headers and
> the driver takes care of the 802.11 subframe headers.
> 
> These headers are stored on a per-cpu page that is re-used
> for all the packets handled on that same CPU. Each skb
> holds a reference to that page and releases the page when
> it is reclaimed. When the page gets full, it is released
> and a new one is allocated.
> 
> Since any SKB that doesn't go through the fast-xmit path
> of mac80211 will be segmented, we can assume here that the
> packet is not WEP / TKIP and has a proper SNAP header.
> 
> Signed-off-by: Emmanuel Grumbach 
> ---
> v4: * Create a helper to free the skb's ref to the hdr page
> * add comment on that clarifies that the headers fit in a page
> * return -ENOMEM if the per_cpu variable allocation failed
> * don't zero the per_cpu struct after allocation
> ---

Meh... Someone internally founds a few bugs... Don't waste your time on
this one. V5 will come later tonight.
--
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] ath10k: Adjust the RX packet pad offset at QCA99X0 4addr mode

2015-10-22 Thread Yanbo Li
The QCA99X0 4 addresses RX packets pad 2 bytes at the beginning of
MSDU instead the end of ieee80211 header to keep align. The currently
RX data path can't parse the header correctly in this case. This
patch fixes it for QCA99X0

Signed-off-by: Yanbo Li 

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 13de3617d5ab..3c1d07c191d5 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -58,6 +58,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
.fw = {
.dir = QCA988X_HW_2_0_FW_DIR,
.fw = QCA988X_HW_2_0_FW_FILE,
@@ -75,6 +76,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
.fw = QCA6174_HW_2_1_FW_FILE,
@@ -92,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
.fw = {
.dir = QCA6174_HW_3_0_FW_DIR,
.fw = QCA6174_HW_3_0_FW_FILE,
@@ -109,6 +112,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
.fw = {
/* uses same binaries as hw3.0 */
.dir = QCA6174_HW_3_0_FW_DIR,
@@ -128,6 +132,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.continuous_frag_desc = true,
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
+   .loc_4addr_pad = ATH10K_4ADDR_PAD_PRE,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 7cc7cdd56c95..b4db8bbf85ce 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -646,6 +646,9 @@ struct ath10k {
 */
u32 max_probe_resp_desc_thres;
 
+   /* The padding bytes's location is different on various chips */
+   enum ath10k_loc_4addr_pad loc_4addr_pad;
+
struct ath10k_hw_params_fw {
const char *dir;
const char *fw;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6060dda4e910..f25f1d7a3edf 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1114,7 +1114,19 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k 
*ar,
 */
 
/* pull decapped header and copy SA & DA */
-   hdr = (struct ieee80211_hdr *)msdu->data;
+   if ((ar->hw_params.loc_4addr_pad  == ATH10K_4ADDR_PAD_PRE) &&
+   ieee80211_has_a4(((struct ieee80211_hdr 
*)first_hdr)->frame_control)) {
+   /* The QCA99X0 4 address mode pad 2 bytes at the
+* beginning of MSDU
+*/
+   hdr = (struct ieee80211_hdr *)(msdu->data + 2);
+   /* The skb length need be extended 2 as the 2 bytes at the tail
+* be excluded due to the padding
+*/
+   skb_put(msdu, 2);
+   } else
+   hdr = (struct ieee80211_hdr *)(msdu->data);
+
hdr_len = ath10k_htt_rx_nwifi_hdrlen(ar, hdr);
ether_addr_copy(da, ieee80211_get_DA(hdr));
ether_addr_copy(sa, ieee80211_get_SA(hdr));
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 2d87737e35ff..efbe6fa1f356 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -282,6 +282,11 @@ enum ath10k_hw_rate_cck {
ATH10K_HW_RATE_CCK_SP_2M,
 };
 
+enum ath10k_loc_4addr_pad {
+   ATH10K_4ADDR_PAD_AFT,
+   ATH10K_4ADDR_PAD_PRE,
+};
+
 /* Target specific defines for MAIN firmware */
 #define TARGET_NUM_VDEVS   8
 #define TARGET_NUM_PEER_AST2
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a 

Re: QCA6174, is it ath6kl or ath10k?

2015-10-22 Thread Kalle Valo
Yan Bellavance  writes:

> Thanks for prompt reply.  Frankly, I'm still trying to figure what
> driver we have really.  It's called qcaqcld2.0 but I see references to
> ath6kl in the various folders relating to the wifi. So that is why I
> presumed it was based on a ath6kl driver. What exactly is the
> qcaqcld2.0 driver?

That's the vendor driver. In these lists we don't give any support to
that, we only support upstream drivers like ath10k.

> I know support for ath10k starts with kernel 4.0 and we have kernel
> 3.10 but I don't see anything that would tell me that a backport has
> been applied. And we've been having some issues so that is how I got
> here.

You can always use backports project to get latest ath10k to an older
kernel.

https://wireless.wiki.kernel.org/en/users/drivers/ath10k/backports

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


Re: [PATCH] ath10k: Adjust the RX packet pad offset at QCA99X0 4addr mode

2015-10-22 Thread Kalle Valo
Yanbo Li  writes:

> The QCA99X0 4 addresses RX packets pad 2 bytes at the beginning of
> MSDU instead the end of ieee80211 header to keep align. The currently
> RX data path can't parse the header correctly in this case. This
> patch fixes it for QCA99X0
>
> Signed-off-by: Yanbo Li 
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> b/drivers/net/wireless/ath/ath10k/core.c
> index 13de3617d5ab..3c1d07c191d5 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -58,6 +58,7 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   .otp_exe_param = 0,
>   .channel_counters_freq_hz = 88000,
>   .max_probe_resp_desc_thres = 0,
> + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
>   .fw = {
>   .dir = QCA988X_HW_2_0_FW_DIR,
>   .fw = QCA988X_HW_2_0_FW_FILE,
> @@ -75,6 +76,7 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   .otp_exe_param = 0,
>   .channel_counters_freq_hz = 88000,
>   .max_probe_resp_desc_thres = 0,
> + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
>   .fw = {
>   .dir = QCA6174_HW_2_1_FW_DIR,
>   .fw = QCA6174_HW_2_1_FW_FILE,
> @@ -92,6 +94,7 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   .otp_exe_param = 0,
>   .channel_counters_freq_hz = 88000,
>   .max_probe_resp_desc_thres = 0,
> + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
>   .fw = {
>   .dir = QCA6174_HW_3_0_FW_DIR,
>   .fw = QCA6174_HW_3_0_FW_FILE,
> @@ -109,6 +112,7 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   .otp_exe_param = 0,
>   .channel_counters_freq_hz = 88000,
>   .max_probe_resp_desc_thres = 0,
> + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT,
>   .fw = {
>   /* uses same binaries as hw3.0 */
>   .dir = QCA6174_HW_3_0_FW_DIR,
> @@ -128,6 +132,7 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   .continuous_frag_desc = true,
>   .channel_counters_freq_hz = 15,
>   .max_probe_resp_desc_thres = 24,
> + .loc_4addr_pad = ATH10K_4ADDR_PAD_PRE,
>   .fw = {
>   .dir = QCA99X0_HW_2_0_FW_DIR,
>   .fw = QCA99X0_HW_2_0_FW_FILE,
> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> b/drivers/net/wireless/ath/ath10k/core.h
> index 7cc7cdd56c95..b4db8bbf85ce 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -646,6 +646,9 @@ struct ath10k {
>*/
>   u32 max_probe_resp_desc_thres;
>  
> + /* The padding bytes's location is different on various chips */
> + enum ath10k_loc_4addr_pad loc_4addr_pad;

I think that loc prefix is a bit misleading, it reminds me of
locationing/positioning etc. What about ath10k_hw_4addr_pad?

-- 
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 06/28] staging: wilc1000: wilc_wlan_handle_isr_ext: add argument struct wilc

2015-10-22 Thread Glen Lee
This patch adds argument struct wilc and pass wilc to the function.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index be6f631..5141fe0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1260,7 +1260,7 @@ static void wilc_sleeptimer_isr_ext(u32 int_stats1)
 #endif
 }
 
-static void wilc_wlan_handle_isr_ext(u32 int_status)
+static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 {
wilc_wlan_dev_t *p = _wlan;
 #ifdef MEMORY_STATIC
@@ -1364,7 +1364,7 @@ void wilc_handle_isr(void *wilc)
wilc_pllupdate_isr_ext(int_status);
 
if (int_status & DATA_INT_EXT) {
-   wilc_wlan_handle_isr_ext(int_status);
+   wilc_wlan_handle_isr_ext(wilc, int_status);
#ifndef WILC_OPTIMIZE_SLEEP_INT
/* Chip is up and talking*/
genuChipPSstate = CHIP_WAKEDUP;
-- 
1.9.1

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


[PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc

2015-10-22 Thread Glen Lee
Use netdev private member wilc instead of g_linux_wlan and Change argument wilc
with dev in the function request_threaded_irq to pass back to handler
the function isr_uh_routine.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b036b96..7b0614d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -229,10 +229,15 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
 #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(usedata);
+   wl = nic->wilc;
PRINT_D(INT_DBG, "Interrupt received UH\n");
 
/*While mac is closing cacncel the handling of any interrupts received*/
-   if (g_linux_wlan->close) {
+   if (wl->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
@@ -284,7 +289,7 @@ static int init_irq(struct net_device *dev)
 
if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, 
isr_uh_routine, isr_bh_routine,
  IRQF_TRIGGER_LOW | 
IRQF_ONESHOT,   /*Without IRQF_ONESHOT the uh will remain kicked in 
and dont gave a chance to bh*/
- "WILC_IRQ", wl)) < 0) {
+ "WILC_IRQ", dev)) < 0) {
 
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
-- 
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: [RFC 00/16] rtl8xxxu: eFUSE parsing for RTL8188EU chips

2015-10-22 Thread Jakub Sitnicki
On Wed, Oct 21, 2015 at 02:29 AM CEST, Jes Sorensen  
wrote:
> Jakub Sitnicki  writes:
>> Hi Jes,
>>
>> I'm posting this patch set to show in what direction the work is
>> going.  Hopefully any changes (e.g. renames) which you wouldn't see
>> fit for this driver can be identified early this way.
>>
>> The work is nowhere near the end.  These changes only get me past the
>> parse_efuse() step in the probe() routine.
>>
>> I've structured the patch set in such a way that changes that are not
>> RTL8188EU-specific (preparatory work) come first.  All but the last
>> two patches (tagged "rtl8188eu:") fall into this category.  If you
>> were considering to apply any of them, note that they were not tested
>> with any device that is known to work with rtl8xxxu, only a TP-Link
>> TL-WN725N (RTL8188EU) dongle.
>>
>> The corresponding git branch for this patch set is at:
>>
>> git https://github.com/jsitnicki/linux.git branch rtl8xxxu-rtl8188eu
>
> Jakub,
>
> Thanks for the feedback - some of these patches are good, some of them I
> dislike, and some of them will conflict with work I have been doing
> since I posted the patch. I have been working on adding 8723bu and
> 8192eu support and some of those changes should also benefit your work.
>
> I have pushed my current nextgen tree to git, so if you checkout the
> rtl8xxxu-nextgen branch you will see it.
>
> I'll respond to the individual patches here.

Thanks for the prompt review and the feedback.  I'll rebase the
RTL8188EU-related patches onto the -nextgen branch, and will be watching
it.

Cheers,
Jakub

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


[RFC v4 2/2] iwlwifi: mvm: send large SKBs to the transport

2015-10-22 Thread Emmanuel Grumbach
Now that PCIe knows how to create A-MSDUs, use this
capability and prepare SKBs that are large enough to
build an A-MSDU.
Advertise TSO support towards the network stack and
segment the packet with gso_size set to be the maximal
A-MSDU length (after having taken the headers to be added
into account) to make sure that the skb that is passed
down to the transport are not longer than the maximal
A-MSDU allowed.

Signed-off-by: Emmanuel Grumbach 
---
v4: Don't use the original skb after it has been consumed
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 143 --
 1 file changed, 135 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index be9d7e4..d325de4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "iwl-trans.h"
 #include "iwl-eeprom-parse.h"
@@ -181,7 +182,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
tx_cmd->tx_flags = cpu_to_le32(tx_flags);
/* Total # bytes to be transmitted */
-   tx_cmd->len = cpu_to_le16((u16)skb->len);
+   tx_cmd->len = cpu_to_le16((u16)skb->len +
+   (uintptr_t)info->driver_data[0]);
tx_cmd->next_frame_len = 0;
tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
tx_cmd->sta_id = sta_id;
@@ -356,7 +358,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
memset(>status, 0, sizeof(info->status));
 
-   info->driver_data[0] = NULL;
info->driver_data[1] = dev_cmd;
 
return dev_cmd;
@@ -379,6 +380,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
  info->hw_queue != info->control.vif->cab_queue)))
return -1;
 
+   /* This holds the amsdu headers length */
+   info->driver_data[0] = (void *)(uintptr_t)0;
+
/*
 * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used
 * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel
@@ -435,29 +439,148 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
return 0;
 }
 
-static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb_gso,
+static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
  struct ieee80211_sta *sta,
  struct sk_buff_head *mpdus_skb)
 {
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (void *)skb->data;
+   unsigned int mss = skb_shinfo(skb)->gso_size;
struct sk_buff *tmp, *next;
-   char cb[sizeof(skb_gso->cb)];
+   char cb[sizeof(skb->cb)];
+   unsigned int num_subframes, tcp_payload_len, subf_len;
+   u16 amsdu_add, snap_ip_tcp, pad, i = 0;
+   /* Not used in IPv6 */
+   u16 ip_base_id = ntohs(ip_hdr(skb)->id);
+
+   snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
+   tcp_hdrlen(skb);
+
+   if (!sta->max_amsdu_len ||
+   !ieee80211_is_data_qos(hdr->frame_control)) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /*
+* Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not
+* supported. This is a spec requirement (IEEE 802.11-2015
+* section 8.7.3 NOTE 3).
+*/
+
+   /* TODO: for now, disable A-MSDU inside AMPDU */
+   if (info->flags & IEEE80211_TX_CTL_AMPDU) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /* Sub frame header + SNAP + IP header + TCP header + MSS */
+   subf_len = sizeof(struct ethhdr) + snap_ip_tcp + mss;
+   pad = (4 - subf_len) & 0x3;
+
+   /*
+* If we have N subframes in the A-MSDU, then the A-MSDU's size is
+* N * subf_len + (N - 1) * pad.
+*/
+   num_subframes = (sta->max_amsdu_len + pad) / (subf_len + pad);
+   if (num_subframes > 1) {
+   u8 *qc = ieee80211_get_qos_ctl((void *)skb->data);
+
+   *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+   }
+
+   tcp_payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
+   tcp_hdrlen(skb) + skb->data_len;
 
-   memcpy(cb, skb_gso->cb, sizeof(cb));
-   next = skb_gso_segment(skb_gso, 0);
-   if (IS_ERR(next))
+   /*
+* Make sure we have enough TBs for the A-MSDU:
+*  2 for each subframe
+*  1 more for each fragment
+*  1 more for the potential data in the header
+*/
+   num_subframes =
+   min_t(unsigned int, num_subframes,
+ (mvm->trans->max_skb_frags - 1 -
+

Re: [PATCH] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-22 Thread Bruno Randolf
On 10/22/2015 02:10 PM, Jes Sorensen wrote:
>>> Thanks - I am not 100% convinced about this one. I don't think we should
>>> tell the firmware to pass up data frames before we have negotiated the
>>> connection.
>>>
>>> It's true that for monitor mode, we need to enable it if all packets
>>> are requested. Looking at iw there is an option where it only requests
>>> control packets, and one for all, etc. However for non monitor mode, we
>>> shouldn't pass all data packets up to the stack, resulting and have
>>> mac80211 parse them all.
>>
>> But mac80211 requests us to do so - please see include/net/mac80211.h
>> line 2576 or
>> https://www.kernel.org/doc/htmldocs/80211/API-struct-ieee80211-ops.html
>>
>> I know you are focusing on STA mode at the moment, but
>> enabling/disabling data reception on association is not correct for most
>> other modes.
>>
>> Also don't be afraid of too many frames being passed. In the initial
>> setting (without a monitor interface) the RCR RCR_ACCEPT_AP bit is not
>> set and the RCR_CHECK_BSSID_* bits are set as well.
> 
> I realize the different modes require different behavior, and we
> obviously need to deal with this. However we shouldn't downgrade STA
> mode in order to be able to handle other modes. Passing too many frames
> unncessarily is bad, it adds unnecessary load to the USB bus as well as
> the stack.
> 
> Remember that mac80211 is designed to handle completely dumb devices
> too, where it needs to process everything.
> 
> So I am not against making changes, I just want them done right.

Well, I'd say that for a mac80211 driver the right thing to do is to
follow the documented specifications of mac80211. Also I don't see how
this would downgrade STA mode, and I explained to you above how in STA
mode that does not pass more data frames to mac80211 than before.

BTW that also fixes the "endless scanning" problem I reported to you
before, and makes the driver work with the slightly older mac80211
version of OpenWRT 15.05. Care to explain what's not right with this?

But maybe a more credible mac80211 developer can can comment?

bruno

--
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 00/19] staging/wilc1000 cleanups

2015-10-22 Thread Arnd Bergmann
On Wednesday 21 October 2015 19:06:52 glen lee wrote:
> Hi arnd,
> 
> Thanks for the all the patches. 
> About the patch ( use proper naming for global symbols ),
> We are planning to use this driver not only for wilc1000 but also for
> other atmel wireless driver. I'd appreciate if you could use wl instead of 
> wilc1000.
> 
> And the global variable g_linux_wlan will be placed in netdevice private data
> and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now
to rename the symbols to wilc_* and to remove most but not all references to
g_linux_wlan (or wilc_dev after my rename). Do you want me to post those
so you can integrate them, or should I have a look at what you sent first
(please send me a copy then).

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


[RFC v4 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-22 Thread Emmanuel Grumbach
When the op_mode sends an skb whose payload is bigger than
MSS, PCIe will create an A-MSDU out of it. PCIe assumes
that the skb that is coming from the op_mode can fit in one
A-MSDU. It is the op_mode's responsibility to make sure
that this guarantee holds.

Additional headers need to be built for the subframes.
The TSO core code takes care of the IP / TCP headers and
the driver takes care of the 802.11 subframe headers.

These headers are stored on a per-cpu page that is re-used
for all the packets handled on that same CPU. Each skb
holds a reference to that page and releases the page when
it is reclaimed. When the page gets full, it is released
and a new one is allocated.

Since any SKB that doesn't go through the fast-xmit path
of mac80211 will be segmented, we can assume here that the
packet is not WEP / TKIP and has a proper SNAP header.

Signed-off-by: Emmanuel Grumbach 
---
v4: * Create a helper to free the skb's ref to the hdr page
* add comment on that clarifies that the headers fit in a page
* return -ENOMEM if the per_cpu variable allocation failed
* don't zero the per_cpu struct after allocation
---
 drivers/net/wireless/iwlwifi/iwl-devtrace-data.h |  16 ++
 drivers/net/wireless/iwlwifi/iwl-trans.h |   6 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h |   7 +
 drivers/net/wireless/iwlwifi/pcie/trans.c|  15 ++
 drivers/net/wireless/iwlwifi/pcie/tx.c   | 287 ++-
 5 files changed, 326 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h 
b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
index 71a78ce..59d9edf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
@@ -51,6 +51,22 @@ TRACE_EVENT(iwlwifi_dev_tx_data,
TP_printk("[%s] TX frame data", __get_str(dev))
 );
 
+TRACE_EVENT(iwlwifi_dev_tx_tso_chunk,
+   TP_PROTO(const struct device *dev,
+u8 *data_src, size_t data_len),
+   TP_ARGS(dev, data_src, data_len),
+   TP_STRUCT__entry(
+   DEV_ENTRY
+
+   __dynamic_array(u8, data, data_len)
+   ),
+   TP_fast_assign(
+   DEV_ASSIGN;
+   memcpy(__get_dynamic_array(data), data_src, data_len);
+   ),
+   TP_printk("[%s] TX frame data", __get_str(dev))
+);
+
 TRACE_EVENT(iwlwifi_dev_rx_data,
TP_PROTO(const struct device *dev,
 const struct iwl_trans *trans,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 0ceff69..6919243 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -379,7 +379,11 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer 
*r)
 }
 
 #define MAX_NO_RECLAIM_CMDS6
-
+/*
+ * The first entry in driver_data array in ieee80211_tx_info
+ * that can be used by the transport.
+ */
+#define IWL_FIRST_DRIVER_DATA 2
 #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo
 
 /*
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/iwlwifi/pcie/internal.h
index be168d1..7da5643 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -295,6 +295,11 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
   sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
 }
 
+struct iwl_tso_hdr_page {
+   struct page *page;
+   u8 *pos;
+};
+
 /**
  * struct iwl_trans_pcie - PCIe transport specific data
  * @rxq: all the RX queue data
@@ -332,6 +337,8 @@ struct iwl_trans_pcie {
struct net_device napi_dev;
struct napi_struct napi;
 
+   struct __percpu iwl_tso_hdr_page *tso_hdr_page;
+
/* INT ICT Table */
__le32 *ict_tbl;
dma_addr_t ict_tbl_dma;
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index a275318..f03c3e1 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1601,6 +1601,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans 
*trans,
 void iwl_trans_pcie_free(struct iwl_trans *trans)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+   int i;
 
 #ifdef CPTCFG_IWLWIFI_PLATFORM_DATA
/* Make sure the device is on before calling pci functions again.
@@ -1631,6 +1632,15 @@ void iwl_trans_pcie_free(struct iwl_trans *trans)
 
iwl_pcie_free_fw_monitor(trans);
 
+   for_each_possible_cpu(i) {
+   struct iwl_tso_hdr_page *p =
+   per_cpu_ptr(trans_pcie->tso_hdr_page, i);
+
+   if (p->page)
+   __free_pages(p->page, 0);
+   }
+
+   free_percpu(trans_pcie->tso_hdr_page);
iwl_trans_free(trans);
 }
 
@@ -2839,6 +2849,11 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev 
*pdev,

Re: [PATCH] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-22 Thread Jes Sorensen
Bruno Randolf  writes:
> On 10/22/2015 12:13 AM, Jes Sorensen wrote:
>> Bruno Randolf  writes:
>>> mac80211 documentation says, the ieee80211_ops.start callback "must turn on
>>> frame reception (for possibly enabled monitor interfaces.)". If not a single
>>> monitor interface does not receive data frames.
>>>
>>> Similarly we should not change the data reception based on the association
>>> state.
>>>
>>> Signed-off-by: Bruno Randolf 
>>> ---
>>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 12 ++--
>>>  1 file changed, 2 insertions(+), 10 deletions(-)
>> 
>> Bruno,
>> 
>> Thanks - I am not 100% convinced about this one. I don't think we should
>> tell the firmware to pass up data frames before we have negotiated the
>> connection.
>> 
>> It's true that for monitor mode, we need to enable it if all packets
>> are requested. Looking at iw there is an option where it only requests
>> control packets, and one for all, etc. However for non monitor mode, we
>> shouldn't pass all data packets up to the stack, resulting and have
>> mac80211 parse them all.
>
> But mac80211 requests us to do so - please see include/net/mac80211.h
> line 2576 or
> https://www.kernel.org/doc/htmldocs/80211/API-struct-ieee80211-ops.html
>
> I know you are focusing on STA mode at the moment, but
> enabling/disabling data reception on association is not correct for most
> other modes.
>
> Also don't be afraid of too many frames being passed. In the initial
> setting (without a monitor interface) the RCR RCR_ACCEPT_AP bit is not
> set and the RCR_CHECK_BSSID_* bits are set as well.

I realize the different modes require different behavior, and we
obviously need to deal with this. However we shouldn't downgrade STA
mode in order to be able to handle other modes. Passing too many frames
unncessarily is bad, it adds unnecessary load to the USB bus as well as
the stack.

Remember that mac80211 is designed to handle completely dumb devices
too, where it needs to process everything.

So I am not against making changes, I just want them done right.

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


[PATCH 16/28] staging: wilc1000: WILC_WFI_mgmt_rx: add argument wilc and use it

2015-10-22 Thread Glen Lee
This patch add new argument wilc and use wilc instead of g_wlan_linux.
Declare the function in wilc_wfi_netdevice.h.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 10 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c  |  3 +--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2f1543d..fef6664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1604,25 +1604,25 @@ void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
}
 }
 
-void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 {
int i = 0;
perInterface_wlan_t *nic;
 
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   nic = netdev_priv(g_linux_wlan->vif[i].ndev);
+   for (i = 0; i < wilc->vif_num; i++) {
+   nic = netdev_priv(wilc->vif[i].ndev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
 
-   nic = netdev_priv(g_linux_wlan->vif[1].ndev); /* p2p0 */
+   nic = netdev_priv(wilc->vif[1].ndev); /* p2p0 */
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && 
nic->g_struct_frame_reg[0].reg) ||
(buff[0] == nic->g_struct_frame_reg[1].frame_type && 
nic->g_struct_frame_reg[1].reg))
-   WILC_WFI_p2p_rx(g_linux_wlan->vif[1].ndev, buff, size);
+   WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
 }
 
 void wl_wlan_cleanup(void)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index a828fab..8ba69ee 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -216,4 +216,5 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout);
 void wl_wlan_cleanup(void);
 int wilc_netdev_init(struct wilc **wilc);
 void wilc1000_wlan_deinit(struct net_device *dev);
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index ae4b01f..531d342 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -18,7 +18,6 @@
  /
 extern wilc_hif_func_t hif_sdio;
 extern wilc_hif_func_t hif_spi;
-extern void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
 u32 wilc_get_chipid(u8 update);
 u16 Set_machw_change_vir_if(bool bValue);
 
@@ -1178,7 +1177,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
/* reset mgmt indicator bit, to use pkt_offeset 
in furthur calculations */
pkt_offset &= ~(IS_MANAGMEMENT | 
IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES);
 
-   WILC_WFI_mgmt_rx([offset + 
HOST_HDR_OFFSET], pkt_len);
+   WILC_WFI_mgmt_rx(wilc, [offset + 
HOST_HDR_OFFSET], pkt_len);
}
else
{
-- 
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 17/28] staging: wilc1000: wlan_deinitialize_threads: change argument and use wilc

2015-10-22 Thread Glen Lee
This patch changes function parameter type struct wilc with struct net_device
and use netdev private data member wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index fef6664..75dad3e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -96,7 +96,7 @@ static struct notifier_block g_dev_notifier = {
 static struct semaphore close_exit_sync;
 
 static int wlan_deinit_locks(struct wilc *wilc);
-static void wlan_deinitialize_threads(struct wilc *nic);
+static void wlan_deinitialize_threads(struct net_device *dev);
 extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
 extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 
@@ -918,7 +918,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
up(>txq_event);
 
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
-   wlan_deinitialize_threads(wl);
+   wlan_deinitialize_threads(dev);
 
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);
@@ -1046,18 +1046,23 @@ _fail_2:
return ret;
 }
 
-static void wlan_deinitialize_threads(struct wilc *nic)
+static void wlan_deinitialize_threads(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
-   g_linux_wlan->close = 1;
+   wl->close = 1;
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
 
-   if (_linux_wlan->txq_event != NULL)
-   up(_linux_wlan->txq_event);
+   if (>txq_event != NULL)
+   up(>txq_event);
 
-   if (g_linux_wlan->txq_thread != NULL) {
-   kthread_stop(g_linux_wlan->txq_thread);
-   g_linux_wlan->txq_thread = NULL;
+   if (wl->txq_thread != NULL) {
+   kthread_stop(wl->txq_thread);
+   wl->txq_thread = NULL;
}
 }
 
@@ -1164,7 +1169,7 @@ _fail_irq_init_:
deinit_irq(dev);
 
 #endif
-   wlan_deinitialize_threads(wl);
+   wlan_deinitialize_threads(dev);
 _fail_wilc_wlan_:
wilc_wlan_cleanup();
 _fail_locks_:
-- 
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 15/28] staging: wilc1000: wlan_deinit_locks: rename argument name and use it

2015-10-22 Thread Glen Lee
This patch renames nic to wilc and use it instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4f9663d..2f1543d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -95,7 +95,7 @@ static struct notifier_block g_dev_notifier = {
  */
 static struct semaphore close_exit_sync;
 
-static int wlan_deinit_locks(struct wilc *nic);
+static int wlan_deinit_locks(struct wilc *wilc);
 static void wlan_deinitialize_threads(struct wilc *nic);
 extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
 extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
@@ -977,14 +977,14 @@ int wlan_init_locks(struct net_device *dev)
return 0;
 }
 
-static int wlan_deinit_locks(struct wilc *nic)
+static int wlan_deinit_locks(struct wilc *wilc)
 {
PRINT_D(INIT_DBG, "De-Initializing Locks\n");
 
-   if (_linux_wlan->hif_cs != NULL)
+   if (>hif_cs != NULL)
mutex_destroy(_linux_wlan->hif_cs);
 
-   if (_linux_wlan->rxq_cs != NULL)
+   if (>rxq_cs != NULL)
mutex_destroy(_linux_wlan->rxq_cs);
 
return 0;
-- 
1.9.1

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


[PATCH 12/28] staging: wilc1000: wilc_wlan_handle_txq: add argument and use wilc

2015-10-22 Thread Glen Lee
This patch adds argument net_device dev and use netdev private data memeber
wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 11 ---
 drivers/staging/wilc1000/wilc_wlan.h  |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9c4fecb..4f9663d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -475,10 +475,10 @@ static int linux_wlan_txq_task(void *vp)
}
PRINT_D(TX_DBG, "txq_task handle the sending packet and let me 
go to sleep.\n");
 #if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
-   ret = wilc_wlan_handle_txq(_count);
+   ret = wilc_wlan_handle_txq(dev, _count);
 #else
do {
-   ret = wilc_wlan_handle_txq(_count);
+   ret = wilc_wlan_handle_txq(dev, _count);
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && 
netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4fa956a..f694f2e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -814,7 +814,7 @@ void chip_sleep_manually(u32 u32SleepTime)
  *  Tx, Rx queue handle functions
  *
  /
-int wilc_wlan_handle_txq(u32 *pu32TxqCount)
+int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
 {
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)_wlan;
int i, entries = 0;
@@ -828,13 +828,18 @@ int wilc_wlan_handle_txq(u32 *pu32TxqCount)
int counter;
int timeout;
u32 vmm_table[WILC_VMM_TBL_SIZE];
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
p->txq_exit = 0;
do {
if (p->quit)
break;
 
-   linux_wlan_lock_timeout(_linux_wlan->txq_add_to_head_cs,
+   linux_wlan_lock_timeout(>txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
 #ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack();
@@ -1098,7 +1103,7 @@ _end_:
if (ret != 1)
break;
} while (0);
-   up(_linux_wlan->txq_add_to_head_cs);
+   up(>txq_add_to_head_cs);
 
p->txq_exit = 1;
PRINT_D(TX_DBG, "THREAD: Exiting txq\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index a07375b..79b35e6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -300,7 +300,7 @@ int wilc_wlan_start(void);
 int wilc_wlan_stop(void);
 int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
  wilc_tx_complete_func_t func);
-int wilc_wlan_handle_txq(u32 *pu32TxqCount);
+int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
 void wilc_handle_isr(void *wilc);
 void wilc_wlan_cleanup(void);
 int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
-- 
1.9.1

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


[PATCH 11/28] staging: wilc1000: linux_wlan_txq_task: use wilc instead of g_linux_wlan

2015-10-22 Thread Glen Lee
Pass argument dev instead of wilc from kthread_run and use netdev private data
member wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 27 ---
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f6862d5..9c4fecb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -439,7 +439,9 @@ int linux_wlan_get_num_conn_ifcs(void)
 static int linux_wlan_txq_task(void *vp)
 {
int ret, txq_count;
-
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+   struct net_device *dev = vp;
 #if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
 #define TX_BACKOFF_WEIGHT_INCR_STEP (1)
 #define TX_BACKOFF_WEIGHT_DECR_STEP (1)
@@ -449,18 +451,21 @@ static int linux_wlan_txq_task(void *vp)
int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
 #endif
 
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
/* inform wilc1000_wlan_init that TXQ task is started. */
-   up(_linux_wlan->txq_thread_started);
+   up(>txq_thread_started);
while (1) {
 
PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
-   down(_linux_wlan->txq_event);
+   down(>txq_event);
/* wait_for_completion(>txq_event); */
PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");
 
-   if (g_linux_wlan->close) {
+   if (wl->close) {
/*Unlock the mutex in the mac_close function to 
indicate the exiting of the TX thread */
-   up(_linux_wlan->txq_thread_started);
+   up(>txq_thread_started);
 
while (!kthread_should_stop())
schedule();
@@ -477,10 +482,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && 
netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
-   if 
(netif_queue_stopped(g_linux_wlan->vif[0].ndev))
-   
netif_wake_queue(g_linux_wlan->vif[0].ndev);
-   if 
(netif_queue_stopped(g_linux_wlan->vif[1].ndev))
-   
netif_wake_queue(g_linux_wlan->vif[1].ndev);
+   if (netif_queue_stopped(wl->vif[0].ndev))
+   netif_wake_queue(wl->vif[0].ndev);
+   if (netif_queue_stopped(wl->vif[1].ndev))
+   netif_wake_queue(wl->vif[1].ndev);
}
 
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate 
buffers in chip. */
@@ -502,7 +507,7 @@ static int linux_wlan_txq_task(void *vp)
}
}
/*TODO: drop packets after a certain time/number of 
retry count. */
-   } while (ret == WILC_TX_ERR_NO_BUF && !g_linux_wlan->close); /* 
retry sending packets if no more buffers in chip. */
+   } while (ret == WILC_TX_ERR_NO_BUF && !wl->close); /* retry 
sending packets if no more buffers in chip. */
 #endif
}
return 0;
@@ -1023,7 +1028,7 @@ int wlan_initialize_threads(struct net_device *dev)
 
/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
-   wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wl,
+   wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
 "K_TXQ_TASK");
if (!wl->txq_thread) {
PRINT_ER("couldn't create TXQ thread\n");
-- 
1.9.1

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


Re: [RFC 05/16] rtl8xxxu: Unbreak a user-visible string

2015-10-22 Thread Jakub Sitnicki
On Wed, Oct 21, 2015 at 03:46 AM CEST, Jes Sorensen  
wrote:
> Jakub Sitnicki  writes:
>> Signed-off-by: Jakub Sitnicki 
>> ---
>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> index cfb18db..e892fde 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> @@ -2002,8 +2002,8 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv 
>> *priv)
>>  /* We have 8 bits to indicate validity */
>>  map_addr = offset * 8;
>>  if (map_addr >= EFUSE_MAP_LEN_8723A) {
>> -dev_warn(dev, "%s: Illegal map_addr (%04x), "
>> - "efuse corrupt!\n",
>> +dev_warn(dev,
>> + "%s: Illegal map_addr (%04x), efuse 
>> corrupt!\n",
>
> This would make the line longer than 80 characters - so no.
>
> NAK

Oh, okay.  In my defense, Your Honor, Documentation/CodingStyle made me
do it ;-)

  [...] However, never break user-visible strings such as printk
  messages, because that breaks the ability to grep for them.

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


[PATCH 07/28] staging: wilc1000: wilc_wlan_handle_rxq: add new argument and use wilc

2015-10-22 Thread Glen Lee
This patch adds new argument struct *wilc and use it instead of g_linux_wlan.
Pass wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 5141fe0..4fc88ef 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1107,7 +1107,7 @@ _end_:
return ret;
 }
 
-static void wilc_wlan_handle_rxq(void)
+static void wilc_wlan_handle_rxq(struct wilc *wilc)
 {
wilc_wlan_dev_t *p = _wlan;
int offset = 0, size, has_packet = 0;
@@ -1122,7 +1122,7 @@ static void wilc_wlan_handle_rxq(void)
do {
if (p->quit) {
PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP 
function\n");
-   up(_linux_wlan->cfg_event);
+   up(>cfg_event);
break;
}
rqe = wilc_wlan_rxq_remove();
@@ -1194,7 +1194,7 @@ static void wilc_wlan_handle_rxq(void)
 **/
PRINT_D(RX_DBG, "p->cfg_seq_no 
= %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no);
if (p->cfg_seq_no == rsp.seq_no)
-   
up(_linux_wlan->cfg_event);
+   up(>cfg_event);
} else if (rsp.type == 
WILC_CFG_RSP_STATUS) {
/**
 *  Call back to indicate 
status...
@@ -1350,7 +1350,7 @@ _end_:
 #endif
}
}
-   wilc_wlan_handle_rxq();
+   wilc_wlan_handle_rxq(wilc);
 }
 
 void wilc_handle_isr(void *wilc)
-- 
1.9.1

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


[PATCH 09/28] staging: wilc1000: linux_wlan_set_bssid: use wilc instead of g_linux_wlan

2015-10-22 Thread Glen Lee
This patch use netdev private data memeber wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index af7e844..b8fd4ae 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -404,10 +404,15 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, 
u8 *pBSSID)
 {
int i = 0;
int ret = -1;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
 
-   for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (g_linux_wlan->vif[i].ndev == wilc_netdev) {
-   memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
+   nic = netdev_priv(wilc_netdev);
+   wl = nic->wilc;
+
+   for (i = 0; i < wl->vif_num; i++)
+   if (wl->vif[i].ndev == wilc_netdev) {
+   memcpy(wl->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
-- 
1.9.1

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


[PATCH 04/28] staging: wilc1000: deinit_irq: use wilc instead of g_linux_wlan

2015-10-22 Thread Glen Lee
This patch changes function parameter linux_wlan_t nic with net_dev dev and
use wilc instead of nic and g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e31760e..75cbacf 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -309,12 +309,18 @@ static int init_irq(struct net_device *dev)
 }
 #endif
 
-static void deinit_irq(struct wilc *nic)
+static void deinit_irq(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
 #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
/* Deintialize IRQ */
-   if (>dev_irq_num != 0) {
-   free_irq(nic->dev_irq_num, g_linux_wlan);
+   if (>dev_irq_num != 0) {
+   free_irq(wl->dev_irq_num, wl);
 
gpio_free(GPIO_NUM);
}
@@ -906,7 +912,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wlan_deinitialize_threads(wl);
 
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
-   deinit_irq(wl);
+   deinit_irq(dev);
 
wilc_wlan_stop();
 
@@ -1143,7 +1149,7 @@ _fail_irq_enable_:
 _fail_irq_init_:
 #endif
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   deinit_irq(wl);
+   deinit_irq(dev);
 
 #endif
wlan_deinitialize_threads(wl);
-- 
1.9.1

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


[PATCH 05/28] staging: wilc1000: wilc_handle_isr: add argument wilc to wilc_handle_isr

2015-10-22 Thread Glen Lee
This patch add new argument wilc to wilc_handle_isr and pass wilc to
the function.
It is void type for now because wilc_wlan.c was implemented platform
independently at the beginning (linux_wlan.c is implementation of LINUX part)
so the struct wilc header file cannot be included at this moment,
but this driver is dedicated to LINUX so wilc_wlan.c and linux_wlan.c will be
merged. After that, this void type will be changed with struct wilc as well as
other functions which are using void type in wilc_wlan.h.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c  | 2 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c | 7 +--
 drivers/staging/wilc1000/wilc_wlan.c   | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h   | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 75cbacf..3f5ae55 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -260,7 +260,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
}
 
PRINT_D(INT_DBG, "Interrupt received BH\n");
-   wilc_handle_isr();
+   wilc_handle_isr(wl);
 
return IRQ_HANDLED;
 }
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f8d874..4aff953 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -27,7 +27,6 @@ struct wilc_sdio {
 };
 
 struct sdio_func *local_sdio_func;
-extern void wilc_handle_isr(void);
 
 static unsigned int sdio_default_speed;
 
@@ -42,9 +41,13 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
+   struct wilc_sdio *wl_sdio;
+
+   wl_sdio = sdio_get_drvdata(func);
+
 #ifndef WILC_SDIO_IRQ_GPIO
sdio_release_host(func);
-   wilc_handle_isr();
+   wilc_handle_isr(wl_sdio->wilc);
sdio_claim_host(func);
 #endif
 }
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 67b0c52..be6f631 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1353,7 +1353,7 @@ _end_:
wilc_wlan_handle_rxq();
 }
 
-void wilc_handle_isr(void)
+void wilc_handle_isr(void *wilc)
 {
u32 int_status;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index bd89689..a07375b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -301,7 +301,7 @@ int wilc_wlan_stop(void);
 int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
  wilc_tx_complete_func_t func);
 int wilc_wlan_handle_txq(u32 *pu32TxqCount);
-void wilc_handle_isr(void);
+void wilc_handle_isr(void *wilc);
 void wilc_wlan_cleanup(void);
 int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
  int commit, u32 drvHandler);
-- 
1.9.1

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


[PATCH 10/28] staging: wilc1000: wlan_initialize_threads: change argument with net_device

2015-10-22 Thread Glen Lee
This patch changes function argument with net_device dev and use netdev private
data member wilc instead of g_linux_wlan. And there are assignment code with
different value continuously. Take last code.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b8fd4ae..f6862d5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1010,31 +1010,34 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc 
*nic)
 #endif
 }
 
-int wlan_initialize_threads(perInterface_wlan_t *nic)
+int wlan_initialize_threads(struct net_device *dev)
 {
-
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
int ret = 0;
 
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
PRINT_D(INIT_DBG, "Initializing Threads ...\n");
 
/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
-   g_linux_wlan->txq_thread = kthread_run(linux_wlan_txq_task, (void 
*)g_linux_wlan, "K_TXQ_TASK");
-   if (g_linux_wlan->txq_thread == NULL) {
+   wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wl,
+"K_TXQ_TASK");
+   if (!wl->txq_thread) {
PRINT_ER("couldn't create TXQ thread\n");
ret = -ENOBUFS;
goto _fail_2;
}
/* wait for TXQ task to start. */
-   down(_linux_wlan->txq_thread_started);
+   down(>txq_thread_started);
 
return 0;
 
 _fail_2:
/*De-Initialize 2nd thread*/
-   g_linux_wlan->close = 1;
-
-   g_linux_wlan->close = 0;
+   wl->close = 0;
return ret;
 }
 
@@ -1083,7 +1086,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 #endif
 
-   ret = wlan_initialize_threads(nic);
+   ret = wlan_initialize_threads(dev);
if (ret < 0) {
PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
-- 
1.9.1

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


[PATCH 01/28] staging: wilc1000: isr_bh_routine: remove unused variable nic

2015-10-22 Thread Glen Lee
This patch removes unused variable nic.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ce2bd53..b036b96 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -242,10 +242,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
-   struct wilc *nic;
-
-   nic = (struct wilc *)userdata;
-
/*While mac is closing cacncel the handling of any interrupts received*/
if (g_linux_wlan->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
-- 
1.9.1

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


[PATCH 03/28] staging: wilc1000: isr_bh_routine: use wilc instead of g_linux_wlan

2015-10-22 Thread Glen Lee
Use netdev private member wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7b0614d..e31760e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -247,8 +247,14 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(userdata);
+   wl = nic->wilc;
+
/*While mac is closing cacncel the handling of any interrupts received*/
-   if (g_linux_wlan->close) {
+   if (wl->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
-- 
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 08/28] staging: wilc1000: linux_wlan_mac_indicate: add argument and use wilc

2015-10-22 Thread Glen Lee
This patch adds argument wilc and pass the function wilc. Use wilc instead of
g_linux_wlan and pd.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 13 ++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  4 ++--
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3f5ae55..af7e844 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -347,24 +347,23 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout)
return error;
 }
 
-void linux_wlan_mac_indicate(int flag)
+void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
 {
/*I have to do it that way becuase there is no mean to encapsulate 
device pointer
 * as a parameter
 */
-   struct wilc *pd = g_linux_wlan;
int status;
 
if (flag == WILC_MAC_INDICATE_STATUS) {
wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *), 4);
-   if (pd->mac_status == WILC_MAC_STATUS_INIT) {
-   pd->mac_status = status;
-   up(>sync_event);
+   if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+   wilc->mac_status = status;
+   up(>sync_event);
} else {
-   pd->mac_status = status;
+   wilc->mac_status = status;
}
 
-   if (pd->mac_status == WILC_MAC_STATUS_CONNECT) {/* 
Connect */
+   if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) {/* 
Connect */
}
 
} else if (flag == WILC_MAC_INDICATE_SCAN) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8aa3355..a828fab 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -209,7 +209,7 @@ struct WILC_WFI_mon_priv {
 extern struct wilc *g_linux_wlan;
 extern struct net_device *WILC_WFI_devs[];
 void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
-void linux_wlan_mac_indicate(int flag);
+void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
 void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
 int linux_wlan_lock_timeout(void *vp, u32 timeout);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4fc88ef..4fa956a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1199,10 +1199,10 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
/**
 *  Call back to indicate 
status...
 **/
-   
linux_wlan_mac_indicate(WILC_MAC_INDICATE_STATUS);
+   linux_wlan_mac_indicate(wilc, 
WILC_MAC_INDICATE_STATUS);
 
} else if (rsp.type == 
WILC_CFG_RSP_SCAN) {
-   
linux_wlan_mac_indicate(WILC_MAC_INDICATE_SCAN);
+   linux_wlan_mac_indicate(wilc, 
WILC_MAC_INDICATE_SCAN);
}
}
}
-- 
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 24/28] staging: wilc1000: wilc_wlan_rxq_add: add argument wilc and use it

2015-10-22 Thread Glen Lee
This patch adds new argument struct wilc and use it instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8cc533a..5393b6f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -586,14 +586,14 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct 
txq_entry_t *tqe)
return tqe;
 }
 
-static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
+static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
 {
wilc_wlan_dev_t *p = _wlan;
 
if (p->quit)
return 0;
 
-   mutex_lock(_linux_wlan->rxq_cs);
+   mutex_lock(>rxq_cs);
if (p->rxq_head == NULL) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
@@ -607,7 +607,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
}
p->rxq_entries += 1;
PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries);
-   mutex_unlock(_linux_wlan->rxq_cs);
+   mutex_unlock(>rxq_cs);
return p->rxq_entries;
 }
 
@@ -1349,7 +1349,7 @@ _end_:
rqe->buffer = buffer;
rqe->buffer_size = size;
PRINT_D(RX_DBG, "rxq entery Size= %d - Address 
= %p\n", rqe->buffer_size, rqe->buffer);
-   wilc_wlan_rxq_add(rqe);
+   wilc_wlan_rxq_add(wilc, rqe);
}
} else {
 #ifndef MEMORY_STATIC
-- 
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 23/28] staging: wilc1000: Set_machw_change_vir_if: add argument dev

2015-10-22 Thread Glen Lee
Add new argument net_device *dev and use netdev private data member wilc
instead of g_linux_wlan. Pass argument dev to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c |  3 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  7 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c  | 12 
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9d03235..a2d8053 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -46,7 +46,6 @@
 #endif
 
 extern bool g_obtainingIP;
-extern u16 Set_machw_change_vir_if(bool bValue);
 extern void resolve_disconnect_aberration(void *drvHandler);
 extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 extern struct timer_list hDuringIpTimer;
@@ -1237,7 +1236,7 @@ int mac_open(struct net_device *ndev)
return ret;
}
 
-   Set_machw_change_vir_if(false);
+   Set_machw_change_vir_if(ndev, false);
 
host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7b21bea..624ad15 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -22,7 +22,6 @@
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
 extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern u16 Set_machw_change_vir_if(bool bValue);
 
 extern int mac_open(struct net_device *ndev);
 extern int mac_close(struct net_device *ndev);
@@ -1413,7 +1412,7 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
g_key_gtk_params.seq = NULL;
 
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue 
keys to CE H/W*/
-   Set_machw_change_vir_if(false);
+   Set_machw_change_vir_if(netdev, false);
}
 
if (key_index >= 0 && key_index <= 3) {
@@ -2562,7 +2561,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
/*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to 
CE H/W*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
-   Set_machw_change_vir_if(true);
+   Set_machw_change_vir_if(dev, true);
}
 
switch (type) {
@@ -2724,7 +2723,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 
/*Refresh scan, to refresh the scan results to the 
wpa_supplicant. Set MachHw to false to enable further key installments*/
refresh_scan(priv, 1, true);
-   Set_machw_change_vir_if(false);
+   Set_machw_change_vir_if(dev, false);
 
if (wl->initialized){
for (i = 0; i < num_reg_frame; i++) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index bca3e25..0bfe762 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,4 +217,5 @@ void wl_wlan_cleanup(void);
 int wilc_netdev_init(struct wilc **wilc);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
+u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index e197c88..8cc533a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -19,7 +19,6 @@
 extern wilc_hif_func_t hif_sdio;
 extern wilc_hif_func_t hif_spi;
 u32 wilc_get_chipid(u8 update);
-u16 Set_machw_change_vir_if(bool bValue);
 
 
 
@@ -2033,13 +2032,18 @@ _fail_:
 
 }
 
-u16 Set_machw_change_vir_if(bool bValue)
+u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue)
 {
u16 ret;
u32 reg;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE 
H/W*/
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
ret = (_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, );
if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -2054,7 +2058,7 @@ u16 Set_machw_change_vir_if(bool bValue)
if (!ret)
PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n");
 
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
 
return ret;
 

[PATCH 26/28] staging: wilc1000: mac_xmit: use netdev private wilc instead of g_linux_wlan

2015-10-22 Thread Glen Lee
This patch uses netdev private data member wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index a2d8053..7a2599a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1359,8 +1359,10 @@ int mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
char *pu8UdpBuffer;
struct iphdr *ih;
struct ethhdr *eth_h;
+   struct wilc *wl;
 
nic = netdev_priv(ndev);
+   wl = nic->wilc;
 
PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
 
@@ -1403,14 +1405,14 @@ int mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
-   tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].bssid;
+   tx_data->pBssid = wl->vif[nic->u8IfIdx].bssid;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
   tx_data->size,
   linux_wlan_tx_complete);
 
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
-   netif_stop_queue(g_linux_wlan->vif[0].ndev);
-   netif_stop_queue(g_linux_wlan->vif[1].ndev);
+   netif_stop_queue(wl->vif[0].ndev);
+   netif_stop_queue(wl->vif[1].ndev);
}
 
return 0;
-- 
1.9.1

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


[PATCH 28/28] staging: wilc1000: tcp_process: add argument dev and get private from it

2015-10-22 Thread Glen Lee
This patch adds new argument net_device *dev and use netdev private data member
wilc instead of g_linux_wlan. Pass argument dev to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 6c4fef2..68a2fd4 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -341,7 +341,7 @@ static inline int remove_TCP_related(void)
return 0;
 }
 
-static inline int tcp_process(struct txq_entry_t *tqe)
+static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
int ret;
u8 *eth_hdr_ptr;
@@ -350,8 +350,13 @@ static inline int tcp_process(struct txq_entry_t *tqe)
int i;
wilc_wlan_dev_t *p = _wlan;
unsigned long flags;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
 
-   spin_lock_irqsave(_linux_wlan->txq_spinlock, flags);
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
+   spin_lock_irqsave(>txq_spinlock, flags);
 
eth_hdr_ptr = [0];
h_proto = ntohs(*((unsigned short *)_hdr_ptr[12]));
@@ -399,7 +404,7 @@ static inline int tcp_process(struct txq_entry_t *tqe)
} else {
ret = 0;
}
-   spin_unlock_irqrestore(_linux_wlan->txq_spinlock, flags);
+   spin_unlock_irqrestore(>txq_spinlock, flags);
return ret;
 }
 
@@ -525,7 +530,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
 #ifdef TCP_ACK_FILTER
tqe->tcp_PendingAck_index = NOT_TCP_ACK;
if (is_TCP_ACK_Filter_Enabled())
-   tcp_process(tqe);
+   tcp_process(dev, tqe);
 #endif
wilc_wlan_txq_add_to_tail(tqe);
/*return number of itemes in the queue*/
-- 
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: [RFC 02/16] rtl8xxxu: Use REG_EFUSE_TEST register only on multifunctional devices

2015-10-22 Thread Jakub Sitnicki
On Wed, Oct 21, 2015 at 02:57 AM CEST, Jes Sorensen  
wrote:
> Jakub Sitnicki  writes:
>> rtl8192cu driver doesn't read/write the REG_EFUSE_TEST register.
>> Neither does the rtl8188eu driver.  Do it only for RTL8192CU-based
>> devices.
>>
>> Signed-off-by: Jakub Sitnicki 
>> ---
>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 9 ++---
>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 +
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> This looks a reasonable change - I verified the 8723BU does this as
> well, but 8192EU doesn't.
>
> I did modify you commit message slightly since it said "Do it only for
> RTL8192CU-based devices" and I am sure you meant 8723AU (and now
> 8723BU).
>
> If you dislike the change to the message, let me know and I'll pull the
> patch or change it.

You're right.  It should say "RTL8723AU-based devices".  Must have had a
brain-fart there.  Thanks for fixing the message.

-Jakub

>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> index 5f90261..a8d7e0a 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> @@ -1704,6 +1704,7 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv 
>> *priv)
>>  priv->has_bluetooth = 1;
>>  if (val32 & MULTI_GPS_FUNC_EN)
>>  priv->has_gps = 1;
>> +priv->is_multi_func = 1;
>>  } else if (val32 & SYS_CFG_TYPE_ID) {
>>  bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
>>  bonding &= HPON_FSM_BONDING_MASK;
>> @@ -1934,9 +1935,11 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv 
>> *priv)
>>  if (val8 & EEPROM_BOOT)
>>  priv->boot_eeprom = 1;
>>  
>> -val32 = rtl8xxxu_read32(priv, REG_EFUSE_TEST);
>> -val32 = (val32 & ~EFUSE_SELECT_MASK) | EFUSE_WIFI_SELECT;
>> -rtl8xxxu_write32(priv, REG_EFUSE_TEST, val32);
>> +if (priv->is_multi_func) {
>> +val32 = rtl8xxxu_read32(priv, REG_EFUSE_TEST);
>> +val32 = (val32 & ~EFUSE_SELECT_MASK) | EFUSE_WIFI_SELECT;
>> +rtl8xxxu_write32(priv, REG_EFUSE_TEST, val32);
>> +}
>>  
>>  dev_dbg(dev, "Booting from %s\n",
>>  priv->boot_eeprom ? "EEPROM" : "EFUSE");
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h 
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
>> index f2a1bac..622e6f5 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
>> @@ -597,6 +597,7 @@ struct rtl8xxxu_priv {
>>  struct rtl8723au_idx ht20_max_power_offset[3];
>>  u32 chip_cut:4;
>>  u32 rom_rev:4;
>> +u32 is_multi_func:1;
>>  u32 has_wifi:1;
>>  u32 has_bluetooth:1;
>>  u32 enable_bluetooth:1;
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/28] staging: wilc1000: mac_ioctl: use private data instead of g_linux_wlan

2015-10-22 Thread Glen Lee
Use netdev private data member wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 75dad3e..05cb442 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1489,11 +1489,13 @@ int mac_ioctl(struct net_device *ndev, struct ifreq 
*req, int cmd)
perInterface_wlan_t *nic;
struct wilc_priv *priv;
s32 s32Error = 0;
+   struct wilc *wl;
 
/* struct iwreq *wrq = (struct iwreq *) req;// tony moved to case 
SIOCSIWPRIV */
nic = netdev_priv(ndev);
+   wl = nic->wilc;
 
-   if (!g_linux_wlan->initialized)
+   if (!wl->initialized)
return 0;
 
switch (cmd) {
-- 
1.9.1

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


[PATCH 21/28] staging: wilc1000: frmw_to_linux: add argument struct wilc

2015-10-22 Thread Glen Lee
This patch adds new argument struct wilc and use it instead of
g_linux_wlan. Pass argument wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index a73fe19..fb12835c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1550,7 +1550,7 @@ done:
return s32Error;
 }
 
-void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
 {
 
unsigned int frame_len = 0;
@@ -1579,8 +1579,8 @@ void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
return;
}
 
-   if (g_linux_wlan == NULL || wilc_netdev == NULL)
-   PRINT_ER("wilc_netdev in g_linux_wlan is NULL");
+   if (wilc == NULL || wilc_netdev == NULL)
+   PRINT_ER("wilc_netdev in wilc is NULL");
skb->dev = wilc_netdev;
 
if (skb->dev == NULL)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8ba69ee..bca3e25 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -208,7 +208,7 @@ struct WILC_WFI_mon_priv {
 
 extern struct wilc *g_linux_wlan;
 extern struct net_device *WILC_WFI_devs[];
-void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
 void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 44f2e60..e197c88 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1184,7 +1184,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
if (!is_cfg_packet) {
if (pkt_len > 0) {
-   frmw_to_linux([offset],
+   frmw_to_linux(wilc,
+ [offset],
  pkt_len,
  pkt_offset);
has_packet = 1;
-- 
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 20/28] staging: wilc1000: wilc_wlan_rxq_remove: add argument wilc and use it

2015-10-22 Thread Glen Lee
This patch adds new argument struct wilc and use it instead of
g_linux_wlan. Pass struct wilc to wilc_wlan_rxq_remove.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 43df5f1..44f2e60 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -612,7 +612,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
return p->rxq_entries;
 }
 
-static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
+static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 {
wilc_wlan_dev_t *p = _wlan;
 
@@ -620,12 +620,12 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
if (p->rxq_head) {
struct rxq_entry_t *rqe;
 
-   mutex_lock(_linux_wlan->rxq_cs);
+   mutex_lock(>rxq_cs);
rqe = p->rxq_head;
p->rxq_head = p->rxq_head->next;
p->rxq_entries -= 1;
PRINT_D(RX_DBG, "RXQ entries decreased\n");
-   mutex_unlock(_linux_wlan->rxq_cs);
+   mutex_unlock(>rxq_cs);
return rqe;
}
PRINT_D(RX_DBG, "Nothing to get from Q\n");
@@ -1132,7 +1132,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
up(>cfg_event);
break;
}
-   rqe = wilc_wlan_rxq_remove();
+   rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL) {
PRINT_D(RX_DBG, "nothing in the queue - exit 1st 
do-while\n");
break;
@@ -1654,6 +1654,11 @@ void wilc_wlan_cleanup(struct net_device *dev)
struct rxq_entry_t *rqe;
u32 reg = 0;
int ret;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
p->quit = 1;
do {
@@ -1666,7 +1671,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
} while (1);
 
do {
-   rqe = wilc_wlan_rxq_remove();
+   rqe = wilc_wlan_rxq_remove(wl);
if (rqe == NULL)
break;
 #ifndef MEMORY_STATIC
-- 
1.9.1

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


[PATCH 13/28] staging: wilc1000: wilc_wlan_txq_filter_dup_tcp_ack: add argument and use wilc

2015-10-22 Thread Glen Lee
This patch add argument net_device dev and use netdev private data member wilc
instead of g_linux_wlan. Pass argument dev to the function.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index f694f2e..ae4b01f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -406,14 +406,18 @@ static inline int tcp_process(struct txq_entry_t *tqe)
 }
 
 
-static int wilc_wlan_txq_filter_dup_tcp_ack(void)
+static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
-
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
u32 i = 0;
u32 Dropped = 0;
wilc_wlan_dev_t *p = _wlan;
 
-   spin_lock_irqsave(_linux_wlan->txq_spinlock, p->txq_spinlock_flags);
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
+   spin_lock_irqsave(>txq_spinlock, p->txq_spinlock_flags);
for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); 
i++) {
if (Pending_Acks_info[i].ack_num < 
Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) {
struct txq_entry_t *tqe;
@@ -440,12 +444,11 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
PendingAcks_arrBase = 0;
 
 
-   spin_unlock_irqrestore(_linux_wlan->txq_spinlock,
-  p->txq_spinlock_flags);
+   spin_unlock_irqrestore(>txq_spinlock, p->txq_spinlock_flags);
 
while (Dropped > 0) {
/*consume the semaphore count of the removed packet*/
-   linux_wlan_lock_timeout(_linux_wlan->txq_event, 1);
+   linux_wlan_lock_timeout(>txq_event, 1);
Dropped--;
}
 
@@ -842,7 +845,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
linux_wlan_lock_timeout(>txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
 #ifdef TCP_ACK_FILTER
-   wilc_wlan_txq_filter_dup_tcp_ack();
+   wilc_wlan_txq_filter_dup_tcp_ack(dev);
 #endif
/**
 *  build the vmm list
-- 
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 14/28] staging: wilc1000: host_int_init: add argument net_device

2015-10-22 Thread Glen Lee
This patch add argument net_device *dev and pass it to kthread_run.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 646e7e9..2fc0ce8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4127,7 +4127,7 @@ void host_int_send_network_info_to_host
 {
 }
 
-s32 host_int_init(struct host_if_drv **hif_drv_handler)
+s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 {
s32 result = 0;
struct host_if_drv *hif_drv;
@@ -4177,7 +4177,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
goto _fail_;
}
 
-   hif_thread_handler = kthread_run(hostIFthread, NULL, 
"WILC_kthread");
+   hif_thread_handler = kthread_run(hostIFthread, dev, 
"WILC_kthread");
 
if (IS_ERR(hif_thread_handler)) {
PRINT_ER("Failed to creat Thread\n");
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 146a60f..f1de52e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -911,7 +911,7 @@ void host_int_send_network_info_to_host
  *  @date  8 March 2012
  *  @version   1.0
  */
-s32 host_int_init(struct host_if_drv **phWFIDrv);
+s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 
 /**
  *  @brief  host interface initialization function
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 5559aa6..7b21bea 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3464,7 +3464,7 @@ int wilc_init_host_int(struct net_device *net)
priv->bInP2PlistenState = false;
 
sema_init(&(priv->hSemScanReq), 1);
-   s32Error = host_int_init(>hWILCWFIDrv);
+   s32Error = host_int_init(net, >hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
 
-- 
1.9.1

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


[PATCH 27/28] staging: wilc1000: wilc_wlan_txq_add_net_pkt: add argument struct net_device

2015-10-22 Thread Glen Lee
This patch add new argument struct net_device *dev and pass net_device to
wilc_wlan_txq_add_net_pkt.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.h  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7a2599a..0dce242 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1406,8 +1406,8 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
tx_data->pBssid = wl->vif[nic->u8IfIdx].bssid;
-   QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
-  tx_data->size,
+   QueueCount = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
+  tx_data->buff, tx_data->size,
   linux_wlan_tx_complete);
 
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index e4e9c72..6c4fef2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -502,8 +502,8 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 
buffer_size)
return 1;
 }
 
-int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
- wilc_tx_complete_func_t func)
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
+ u32 buffer_size, wilc_tx_complete_func_t func)
 {
wilc_wlan_dev_t *p = _wlan;
struct txq_entry_t *tqe;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index d0b2448..57e1d51 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -298,8 +298,8 @@ typedef struct {
 int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
 int wilc_wlan_start(void);
 int wilc_wlan_stop(void);
-int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
- wilc_tx_complete_func_t func);
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
+ u32 buffer_size, wilc_tx_complete_func_t func);
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
 void wilc_handle_isr(void *wilc);
 void wilc_wlan_cleanup(struct net_device *dev);
-- 
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 25/28] staging: wilc1000: wilc_wlan_txq_get_next: add argument wilc

2015-10-22 Thread Glen Lee
This patch adds new argument struct wilc and use wilc instead of g_linux_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 5393b6f..e4e9c72 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -574,13 +574,14 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
return tqe;
 }
 
-static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe)
+static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc,
+ struct txq_entry_t *tqe)
 {
unsigned long flags;
-   spin_lock_irqsave(_linux_wlan->txq_spinlock, flags);
+   spin_lock_irqsave(>txq_spinlock, flags);
 
tqe = tqe->next;
-   spin_unlock_irqrestore(_linux_wlan->txq_spinlock, flags);
+   spin_unlock_irqrestore(>txq_spinlock, flags);
 
 
return tqe;
@@ -887,7 +888,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
i++;
sum += vmm_sz;
PRINT_D(TX_DBG, "sum = %d\n", sum);
-   tqe = wilc_wlan_txq_get_next(tqe);
+   tqe = wilc_wlan_txq_get_next(wl, tqe);
} else {
break;
}
-- 
1.9.1

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


[PATCH 22/28] staging: wilc1000: GetIfHandler: add argument struct wilc and use it

2015-10-22 Thread Glen Lee
This patch adds new argument struct wilc and use it instead of
g_linux_wlan. And also pass wilc to the function.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index fb12835c..9d03235 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -373,7 +373,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
 
 }
 
-struct net_device *GetIfHandler(u8 *pMacHeader)
+struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader)
 {
u8 *Bssid, *Bssid1;
int i = 0;
@@ -381,20 +381,20 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid  = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
 
-   for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
-   return g_linux_wlan->vif[i].ndev;
+   for (i = 0; i < wilc->vif_num; i++)
+   if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+   return wilc->vif[i].ndev;
 
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid  = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
-   for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
-   return g_linux_wlan->vif[i].ndev;
+   for (i = 0; i < wilc->vif_num; i++)
+   if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+   return wilc->vif[i].ndev;
 
PRINT_INFO(INIT_DBG, "\n");
return NULL;
@@ -1560,7 +1560,7 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, 
u32 pkt_offset)
struct net_device *wilc_netdev;
perInterface_wlan_t *nic;
 
-   wilc_netdev = GetIfHandler(buff);
+   wilc_netdev = GetIfHandler(wilc, buff);
if (wilc_netdev == NULL)
return;
 
-- 
1.9.1

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


[PATCH 19/28] staging: wilc1000: wilc_wlan_cleanup: add parameter net_device *dev

2015-10-22 Thread Glen Lee
This patch adds new function parameter net_device *dev and pass dev to
the functions.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 05cb442..a73fe19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -926,7 +926,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wilc_wlan_stop();
 
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
-   wilc_wlan_cleanup();
+   wilc_wlan_cleanup(dev);
 #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
   #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
@@ -1171,7 +1171,7 @@ _fail_irq_init_:
 #endif
wlan_deinitialize_threads(dev);
 _fail_wilc_wlan_:
-   wilc_wlan_cleanup();
+   wilc_wlan_cleanup(dev);
 _fail_locks_:
wlan_deinit_locks(wl);
PRINT_ER("WLAN Iinitialization FAILED\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 531d342..43df5f1 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1647,7 +1647,7 @@ int wilc_wlan_stop(void)
return ret;
 }
 
-void wilc_wlan_cleanup(void)
+void wilc_wlan_cleanup(struct net_device *dev)
 {
wilc_wlan_dev_t *p = _wlan;
struct txq_entry_t *tqe;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 79b35e6..d0b2448 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -302,7 +302,7 @@ int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 
buffer_size,
  wilc_tx_complete_func_t func);
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
 void wilc_handle_isr(void *wilc);
-void wilc_wlan_cleanup(void);
+void wilc_wlan_cleanup(struct net_device *dev);
 int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
  int commit, u32 drvHandler);
 int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
-- 
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: [RFC 01/16] rtl8xxxu: Treat REG_9346CR as an 8-bit wide register

2015-10-22 Thread Jakub Sitnicki
On Wed, Oct 21, 2015 at 02:29 AM CEST, Jes Sorensen  
wrote:
> Jakub Sitnicki  writes:
>> rtl8723au driver treats REG_9346CR register as either 8- or 16-bit wide,
>> while rtl8192cu driver treats it as 8-bit wide, and so does rtl8188eu
>> driver.  Use the lowest common denominator strategy.
>>
>> Signed-off-by: Jakub Sitnicki 
>> ---
>>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> NACK - this is a 16 bit register and the vendor drivers take the lazy
> approach of just reading/writing the lower 8 bits when they feel like
> it.
>
> My code is more consistent, so this one is not going in.

Makes sense.  It didn't occur to me to refer to register offset
definitions and check if REG_9346CR really is 16-bit wide.  Now that you
pointed it out I see it:

#define REG_9346CR  0x000A
#define REG_EE_VPD  0x000C

-Jakub

>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> index 11fcfda..5f90261 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
>> @@ -1928,10 +1928,10 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv 
>> *priv)
>>  u16 val16, efuse_addr, offset;
>>  u32 val32;
>>  
>> -val16 = rtl8xxxu_read16(priv, REG_9346CR);
>> -if (val16 & EEPROM_ENABLE)
>> +val8 = rtl8xxxu_read8(priv, REG_9346CR);
>> +if (val8 & EEPROM_ENABLE)
>>  priv->has_eeprom = 1;
>> -if (val16 & EEPROM_BOOT)
>> +if (val8 & EEPROM_BOOT)
>>  priv->boot_eeprom = 1;
>>  
>>  val32 = rtl8xxxu_read32(priv, REG_EFUSE_TEST);
--
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/4] ath10k: remove shadow copy engine descriptors

2015-10-22 Thread Rajkumar Manoharan
Below series remove shadow copy of CE descriptors for source ring.
Removing the shadow copy should reduce d-cache pressure and memory
usage of the driver.

Rajkumar Manoharan (4):
  ath10k: use local memory instead of shadow descriptor in ce_send
  ath10k: remove send completion validation in diag read/write
  ath10k: cleanup copy engine send completion
  ath10k: remove shadow copy of CE descriptors for source ring

 drivers/net/wireless/ath/ath10k/ce.c  | 57 +--
 drivers/net/wireless/ath/ath10k/ce.h  | 16 ++
 drivers/net/wireless/ath/ath10k/pci.c | 53 +---
 3 files changed, 17 insertions(+), 109 deletions(-)

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


[ANN] wireless-regdb: master-2015-10-22

2015-10-22 Thread Seth Forshee
A new release of wireless-regdb (master-2015-10-22) is available at:

https://www.kernel.org/pub/software/network/wireless-regdb/wireless-regdb-2015.10.22.tar.gz

The short log of changes since the 2015-10-13 release is below.

Thanks,
Seth

---

Andrej Vlasic (1):
  wireless-regdb: Update regulatory rules for Croatia (HR)

Johannes Berg (1):
  wireless-regdb: fix gHz to GHz

Jouni Malinen (1):
  wireless-regdb: Add 160 MHz channel bandwidth for Greenland (GL)

Seth Forshee (1):
  wireless-regdb: update regulatory.bin based on preceding changes

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


[PATCH 2/4] ath10k: remove send completion validation in diag read/write

2015-10-22 Thread Rajkumar Manoharan
CE diag window access is serialized (it has to be by design) so
there's no way to get a different send completion. so there's no
need for post completion validation.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/pci.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 5c05b0c..6f3c3e0 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -920,16 +920,6 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 
address, void *data,
}
}
 
-   if (nbytes != completed_nbytes) {
-   ret = -EIO;
-   goto done;
-   }
-
-   if (buf != (u32)address) {
-   ret = -EIO;
-   goto done;
-   }
-
i = 0;
while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, ,
_nbytes,
@@ -1094,16 +1084,6 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, 
u32 address,
}
}
 
-   if (nbytes != completed_nbytes) {
-   ret = -EIO;
-   goto done;
-   }
-
-   if (buf != ce_data) {
-   ret = -EIO;
-   goto done;
-   }
-
i = 0;
while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, ,
_nbytes,
-- 
2.6.1

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


[PATCH 1/4] ath10k: use local memory instead of shadow descriptor in ce_send

2015-10-22 Thread Rajkumar Manoharan
Currently to avoid uncached memory access while filling up copy engine
descriptors, shadow descriptors are used. This can be optimized further
by removing shadow descriptors. To achieve that first shadow ring
dependency in ce_send is removed by creating local copy of the
descriptor on stack and make a one-shot copy into the "uncached"
descriptor.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/ce.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 84220c3..d9fba1d 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -274,7 +274,7 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 {
struct ath10k *ar = ce_state->ar;
struct ath10k_ce_ring *src_ring = ce_state->src_ring;
-   struct ce_desc *desc, *sdesc;
+   struct ce_desc *desc, sdesc;
unsigned int nentries_mask = src_ring->nentries_mask;
unsigned int sw_index = src_ring->sw_index;
unsigned int write_index = src_ring->write_index;
@@ -294,7 +294,6 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 
desc = CE_SRC_RING_TO_DESC(src_ring->base_addr_owner_space,
   write_index);
-   sdesc = CE_SRC_RING_TO_DESC(src_ring->shadow_base, write_index);
 
desc_flags |= SM(transfer_id, CE_DESC_FLAGS_META_DATA);
 
@@ -303,11 +302,11 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
if (flags & CE_SEND_FLAG_BYTE_SWAP)
desc_flags |= CE_DESC_FLAGS_BYTE_SWAP;
 
-   sdesc->addr   = __cpu_to_le32(buffer);
-   sdesc->nbytes = __cpu_to_le16(nbytes);
-   sdesc->flags  = __cpu_to_le16(desc_flags);
+   sdesc.addr   = __cpu_to_le32(buffer);
+   sdesc.nbytes = __cpu_to_le16(nbytes);
+   sdesc.flags  = __cpu_to_le16(desc_flags);
 
-   *desc = *sdesc;
+   *desc = sdesc;
 
src_ring->per_transfer_context[write_index] = per_transfer_context;
 
-- 
2.6.1

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


[PATCH 3/4] ath10k: cleanup copy engine send completion

2015-10-22 Thread Rajkumar Manoharan
The physical address necessary to unmap DMA ('bufferp') is stored
in ath10k_skb_cb as 'paddr'. ath10k doesn't rely on the meta/transfer_id
when handling send completion (htc ep id is stored in sk_buff control
buffer). So the unused output arguments {bufferp, nbytesp and transfer_idp}
are removed from CE send completion. This change is needed before removing
the shadow copy of copy engine (CE) descriptors in follow up patch.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/ce.c  | 24 +++-
 drivers/net/wireless/ath/ath10k/ce.h  | 10 ++
 drivers/net/wireless/ath/ath10k/pci.c | 28 +++-
 3 files changed, 12 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index d9fba1d..52021a9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -578,17 +578,13 @@ int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe 
*ce_state,
  * The caller takes responsibility for any necessary locking.
  */
 int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
-void **per_transfer_contextp,
-u32 *bufferp,
-unsigned int *nbytesp,
-unsigned int *transfer_idp)
+void **per_transfer_contextp)
 {
struct ath10k_ce_ring *src_ring = ce_state->src_ring;
u32 ctrl_addr = ce_state->ctrl_addr;
struct ath10k *ar = ce_state->ar;
unsigned int nentries_mask = src_ring->nentries_mask;
unsigned int sw_index = src_ring->sw_index;
-   struct ce_desc *sdesc, *sbase;
unsigned int read_index;
 
if (src_ring->hw_index == sw_index) {
@@ -613,15 +609,6 @@ int ath10k_ce_completed_send_next_nolock(struct 
ath10k_ce_pipe *ce_state,
if (read_index == sw_index)
return -EIO;
 
-   sbase = src_ring->shadow_base;
-   sdesc = CE_SRC_RING_TO_DESC(sbase, sw_index);
-
-   /* Return data from completed source descriptor */
-   *bufferp = __le32_to_cpu(sdesc->addr);
-   *nbytesp = __le16_to_cpu(sdesc->nbytes);
-   *transfer_idp = MS(__le16_to_cpu(sdesc->flags),
-  CE_DESC_FLAGS_META_DATA);
-
if (per_transfer_contextp)
*per_transfer_contextp =
src_ring->per_transfer_context[sw_index];
@@ -696,10 +683,7 @@ int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe 
*ce_state,
 }
 
 int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state,
- void **per_transfer_contextp,
- u32 *bufferp,
- unsigned int *nbytesp,
- unsigned int *transfer_idp)
+ void **per_transfer_contextp)
 {
struct ath10k *ar = ce_state->ar;
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
@@ -707,9 +691,7 @@ int ath10k_ce_completed_send_next(struct ath10k_ce_pipe 
*ce_state,
 
spin_lock_bh(_pci->ce_lock);
ret = ath10k_ce_completed_send_next_nolock(ce_state,
-  per_transfer_contextp,
-  bufferp, nbytesp,
-  transfer_idp);
+  per_transfer_contextp);
spin_unlock_bh(_pci->ce_lock);
 
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index dbb94fd..67f90ec 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -192,16 +192,10 @@ int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe 
*ce_state,
  * Pops 1 completed send buffer from Source ring.
  */
 int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state,
- void **per_transfer_contextp,
- u32 *bufferp,
- unsigned int *nbytesp,
- unsigned int *transfer_idp);
+ void **per_transfer_contextp);
 
 int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
-void **per_transfer_contextp,
-u32 *bufferp,
-unsigned int *nbytesp,
-unsigned int *transfer_idp);
+void **per_transfer_contextp);
 
 /*==CE Engine Initialization===*/
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 6f3c3e0..8100025 100644
--- 

[PATCH 4/4] ath10k: remove shadow copy of CE descriptors for source ring

2015-10-22 Thread Rajkumar Manoharan
For the messages from host to target, shadow copy of CE descriptors
are maintained in source ring. Before writing actual CE descriptor,
first shadow copy is filled and then it is copied to CE address space.
To optimize in download path and to reduce d-cache pressure, removing
shadow copy of CE descriptors. This will also reduce driver memory
consumption by 33KB during on device probing.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/ce.c  | 22 --
 drivers/net/wireless/ath/ath10k/ce.h  |  6 --
 drivers/net/wireless/ath/ath10k/pci.c |  5 -
 3 files changed, 33 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 52021a9..edf3629 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -921,27 +921,6 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int 
ce_id,
src_ring->base_addr_ce_space_unaligned,
CE_DESC_RING_ALIGN);
 
-   /*
-* Also allocate a shadow src ring in regular
-* mem to use for faster access.
-*/
-   src_ring->shadow_base_unaligned =
-   kmalloc((nentries * sizeof(struct ce_desc) +
-CE_DESC_RING_ALIGN), GFP_KERNEL);
-   if (!src_ring->shadow_base_unaligned) {
-   dma_free_coherent(ar->dev,
- (nentries * sizeof(struct ce_desc) +
-  CE_DESC_RING_ALIGN),
- src_ring->base_addr_owner_space,
- src_ring->base_addr_ce_space);
-   kfree(src_ring);
-   return ERR_PTR(-ENOMEM);
-   }
-
-   src_ring->shadow_base = PTR_ALIGN(
-   src_ring->shadow_base_unaligned,
-   CE_DESC_RING_ALIGN);
-
return src_ring;
 }
 
@@ -1120,7 +1099,6 @@ void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id)
struct ath10k_ce_pipe *ce_state = _pci->ce_states[ce_id];
 
if (ce_state->src_ring) {
-   kfree(ce_state->src_ring->shadow_base_unaligned);
dma_free_coherent(ar->dev,
  (ce_state->src_ring->nentries *
   sizeof(struct ce_desc) +
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index 67f90ec..47b734c 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -100,12 +100,6 @@ struct ath10k_ce_ring {
 
/* CE address space */
u32 base_addr_ce_space;
-   /*
-* Start of shadow copy of descriptors, within regular memory.
-* Aligned to descriptor-size boundary.
-*/
-   void *shadow_base_unaligned;
-   struct ce_desc *shadow_base;
 
/* keep last */
void *per_transfer_context[0];
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 8100025..4a65385 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1594,7 +1594,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
struct ath10k_pci *ar_pci;
struct ath10k_ce_pipe *ce_pipe;
struct ath10k_ce_ring *ce_ring;
-   struct ce_desc *ce_desc;
struct sk_buff *skb;
int i;
 
@@ -1609,10 +1608,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
if (!pci_pipe->buf_sz)
return;
 
-   ce_desc = ce_ring->shadow_base;
-   if (WARN_ON(!ce_desc))
-   return;
-
for (i = 0; i < ce_ring->nentries; i++) {
skb = ce_ring->per_transfer_context[i];
if (!skb)
-- 
2.6.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] mac80211: allow driver to prevent two stations w/ same address

2015-10-22 Thread Johannes Berg
From: Johannes Berg 

Some devices or drivers cannot deal with having the same station
address for different virtual interfaces, say as a client to two
virtual AP interfaces. Rather than requiring each driver with a
limitation like that to enforce it, add a hardware flag for it.

Signed-off-by: Johannes Berg 
---
 include/net/mac80211.h  |  6 ++
 net/mac80211/debugfs.c  |  1 +
 net/mac80211/sta_info.c | 18 --
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dac575c55c62..b6f9c39ae0c7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1901,6 +1901,11 @@ struct ieee80211_txq {
  * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status
  * for sent beacons.
  *
+ * @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each
+ * station has a unique address, i.e. each station entry can be identified
+ * by just its MAC address; this prevents, for example, the same station
+ * from connecting to two virtual AP interfaces at the same time.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -1936,6 +1941,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_TDLS_WIDER_BW,
IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
IEEE80211_HW_BEACON_TX_STATUS,
+   IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
 
/* keep last, obviously */
NUM_IEEE80211_HW_FLAGS
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 3636b45440ab..78fe7f611d6a 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -125,6 +125,7 @@ static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS + 
1] = {
FLAG(TDLS_WIDER_BW),
FLAG(SUPPORTS_AMSDU_IN_AMPDU),
FLAG(BEACON_TX_STATUS),
+   FLAG(NEEDS_UNIQUE_STA_ADDR),
 
/* keep last for the build bug below */
(void *)0x1
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f91d1873218c..8f630f51d9bd 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -435,6 +435,19 @@ static int sta_info_insert_check(struct sta_info *sta)
is_multicast_ether_addr(sta->sta.addr)))
return -EINVAL;
 
+   /* Strictly speaking this isn't necessary as we hold the mutex, but
+* the rhashtable code can't really deal with that distinction. We
+* do require the mutex for correctness though.
+*/
+   rcu_read_lock();
+   lockdep_assert_held(>local->sta_mtx);
+   if (ieee80211_hw_check(>local->hw, NEEDS_UNIQUE_STA_ADDR) &&
+   ieee80211_find_sta_by_ifaddr(>local->hw, sta->addr, NULL)) {
+   rcu_read_unlock();
+   return -ENOTUNIQ;
+   }
+   rcu_read_unlock();
+
return 0;
 }
 
@@ -554,14 +567,15 @@ int sta_info_insert_rcu(struct sta_info *sta) 
__acquires(RCU)
 
might_sleep();
 
+   mutex_lock(>sta_mtx);
+
err = sta_info_insert_check(sta);
if (err) {
+   mutex_unlock(>sta_mtx);
rcu_read_lock();
goto out_free;
}
 
-   mutex_lock(>sta_mtx);
-
err = sta_info_insert_finish(sta);
if (err)
goto out_free;
-- 
2.5.1

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


[PATCH 3/3] mac80211: treat bad WMM parameters more gracefully

2015-10-22 Thread Johannes Berg
From: Johannes Berg 

As WMM is required for HT/VHT operation, treat bad WMM parameters
more gracefully by falling back to default parameters instead of
not using WMM assocation. This makes it possible to still use HT
or VHT, although potentially with reduced quality of service due
to unintended WMM parameters.

Signed-off-by: Johannes Berg 
---
 net/mac80211/mlme.c | 142 ++--
 1 file changed, 48 insertions(+), 94 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0aaac951a32c..5daf4c92c87f 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1744,10 +1744,10 @@ static bool ieee80211_sta_wmm_params(struct 
ieee80211_local *local,
 struct ieee80211_sub_if_data *sdata,
 const u8 *wmm_param, size_t wmm_param_len)
 {
-   struct ieee80211_tx_queue_params params;
+   struct ieee80211_tx_queue_params params[IEEE80211_NUM_ACS];
struct ieee80211_if_managed *ifmgd = >u.mgd;
size_t left;
-   int count;
+   int count, ac;
const u8 *pos;
u8 uapsd_queues = 0;
 
@@ -1781,25 +1781,24 @@ static bool ieee80211_sta_wmm_params(struct 
ieee80211_local *local,
int aci = (pos[0] >> 5) & 0x03;
int acm = (pos[0] >> 4) & 0x01;
bool uapsd = false;
-   int queue;
 
switch (aci) {
case 1: /* AC_BK */
-   queue = 3;
+   ac = IEEE80211_AC_BK;
if (acm)
sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */
if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
uapsd = true;
break;
case 2: /* AC_VI */
-   queue = 1;
+   ac = IEEE80211_AC_VI;
if (acm)
sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */
if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI)
uapsd = true;
break;
case 3: /* AC_VO */
-   queue = 0;
+   ac = IEEE80211_AC_VO;
if (acm)
sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */
if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
@@ -1807,7 +1806,7 @@ static bool ieee80211_sta_wmm_params(struct 
ieee80211_local *local,
break;
case 0: /* AC_BE */
default:
-   queue = 2;
+   ac = IEEE80211_AC_BE;
if (acm)
sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */
if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE)
@@ -1815,32 +1814,41 @@ static bool ieee80211_sta_wmm_params(struct 
ieee80211_local *local,
break;
}
 
-   params.aifs = pos[0] & 0x0f;
+   params[ac].aifs = pos[0] & 0x0f;
 
-   if (params.aifs < 2) {
+   if (params[ac].aifs < 2) {
sdata_info(sdata,
   "AP has invalid WMM params (AIFSN=%d for ACI 
%d), will use 2\n",
-  params.aifs, aci);
-   params.aifs = 2;
+  params[ac].aifs, aci);
+   params[ac].aifs = 2;
}
-   params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
-   params.cw_min = ecw2cw(pos[1] & 0x0f);
-   params.txop = get_unaligned_le16(pos + 2);
-   params.acm = acm;
-   params.uapsd = uapsd;
+   params[ac].cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
+   params[ac].cw_min = ecw2cw(pos[1] & 0x0f);
+   params[ac].txop = get_unaligned_le16(pos + 2);
+   params[ac].acm = acm;
+   params[ac].uapsd = uapsd;
 
+   if (params[ac].cw_min > params[ac].cw_max) {
+   sdata_info(sdata,
+  "AP has invalid WMM params (CWmin/max=%d/%d 
for ACI %d), using defaults\n",
+  params[ac].cw_min, params[ac].cw_max, aci);
+   return false;
+   }
+   }
+
+   for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
mlme_dbg(sdata,
-"WMM queue=%d aci=%d acm=%d aifs=%d cWmin=%d cWmax=%d 
txop=%d uapsd=%d, downgraded=%d\n",
-queue, aci, acm,
-params.aifs, params.cw_min, params.cw_max,
-params.txop, params.uapsd,
-

[PATCH 1/3] mac80211: make enable_qos parameter to ieee80211_set_wmm_default()

2015-10-22 Thread Johannes Berg
From: Johannes Berg 

The function currently determines this value, for use in bss_info.qos,
based on the interface type itself. Make it a parameter instead and
set it with the same logic for now.

Signed-off-by: Johannes Berg 
---
 net/mac80211/ibss.c|  2 +-
 net/mac80211/ieee80211_i.h |  2 +-
 net/mac80211/iface.c   |  8 +---
 net/mac80211/mlme.c|  4 ++--
 net/mac80211/util.c| 11 ++-
 5 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 2001555d49cb..8549dc272b16 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -356,7 +356,7 @@ static void __ieee80211_sta_join_ibss(struct 
ieee80211_sub_if_data *sdata,
else
sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
 
-   ieee80211_set_wmm_default(sdata, true);
+   ieee80211_set_wmm_default(sdata, true, false);
 
sdata->vif.bss_conf.ibss_joined = true;
sdata->vif.bss_conf.ibss_creator = creator;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 62f2a97cd2a6..6f39ed0c4074 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1769,7 +1769,7 @@ int ieee80211_frame_duration(enum ieee80211_band band, 
size_t len,
 int rate, int erp, int short_preamble,
 int shift);
 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
-  bool bss_notify);
+  bool bss_notify, bool enable_qos);
 void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta, struct sk_buff *skb);
 
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index f848c75518a2..d0dc1bfaeec2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -661,11 +661,13 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool 
coming_up)
}
 
/*
-* set default queue parameters so drivers don't
+* Set default queue parameters so drivers don't
 * need to initialise the hardware if the hardware
-* doesn't start up with sane defaults
+* doesn't start up with sane defaults.
+* Enable QoS for anything but station interfaces.
 */
-   ieee80211_set_wmm_default(sdata, true);
+   ieee80211_set_wmm_default(sdata, true,
+   sdata->vif.type != NL80211_IFTYPE_STATION);
}
 
set_bit(SDATA_STATE_RUNNING, >state);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index ded4b976bb48..0d0ce5cc371d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2077,7 +2077,7 @@ static void ieee80211_set_disassoc(struct 
ieee80211_sub_if_data *sdata,
ieee80211_bss_info_change_notify(sdata, changed);
 
/* disassociated - set to defaults now */
-   ieee80211_set_wmm_default(sdata, false);
+   ieee80211_set_wmm_default(sdata, false, false);
 
del_timer_sync(>u.mgd.conn_mon_timer);
del_timer_sync(>u.mgd.bcn_mon_timer);
@@ -3048,7 +3048,7 @@ static bool ieee80211_assoc_success(struct 
ieee80211_sub_if_data *sdata,
ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
 elems.wmm_param_len);
else
-   ieee80211_set_wmm_default(sdata, false);
+   ieee80211_set_wmm_default(sdata, false, false);
changed |= BSS_CHANGED_QOS;
 
/* set AID and assoc capability,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 8274c86296f9..b4093e38665a 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1104,13 +1104,13 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t 
len, bool action,
 }
 
 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
-  bool bss_notify)
+  bool bss_notify, bool enable_qos)
 {
struct ieee80211_local *local = sdata->local;
struct ieee80211_tx_queue_params qparam;
struct ieee80211_chanctx_conf *chanctx_conf;
int ac;
-   bool use_11b, enable_qos;
+   bool use_11b;
bool is_ocb; /* Use another EDCA parameters if dot11OCBActivated=true */
int aCWmin, aCWmax;
 
@@ -1129,13 +1129,6 @@ void ieee80211_set_wmm_default(struct 
ieee80211_sub_if_data *sdata,
 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
rcu_read_unlock();
 
-   /*
-* By default disable QoS in STA mode for old access points, which do
-* not support 802.11e. New APs will provide proper queue parameters,
-* that we will configure later.
-*/
-   enable_qos = (sdata->vif.type != NL80211_IFTYPE_STATION);
-
is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB);
 
/* Set defaults according to 

[PATCH 2/3] mac80211: fixup AIFSN instead of disabling WMM

2015-10-22 Thread Johannes Berg
From: Emmanuel Grumbach 

Disabling WMM has a huge impact these days. It implies that
HT and VHT will be disabled which means that the throughput
will be drammatically reduced.
Since the AIFSN is a transmission parameter, we can play a
bit and fix it up to make it compliant with the 802.11
specification which requires it to be at least 2.
Increasing it from 1 to 2 will slightly reduce the
likelyhood to get a transmission opportunity compared to
other clients that would accept to set AIFSN=1, but at
least it will allow HT and VHT which is a huge gain.

Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
---
 net/mac80211/mlme.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0d0ce5cc371d..0aaac951a32c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1816,6 +1816,13 @@ static bool ieee80211_sta_wmm_params(struct 
ieee80211_local *local,
}
 
params.aifs = pos[0] & 0x0f;
+
+   if (params.aifs < 2) {
+   sdata_info(sdata,
+  "AP has invalid WMM params (AIFSN=%d for ACI 
%d), will use 2\n",
+  params.aifs, aci);
+   params.aifs = 2;
+   }
params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
params.cw_min = ecw2cw(pos[1] & 0x0f);
params.txop = get_unaligned_le16(pos + 2);
@@ -4559,17 +4566,10 @@ static bool ieee80211_usable_wmm_params(struct 
ieee80211_sub_if_data *sdata,
left = len - 8;
 
for (; left >= 4; left -= 4, pos += 4) {
-   u8 aifsn = pos[0] & 0x0f;
u8 ecwmin = pos[1] & 0x0f;
u8 ecwmax = (pos[1] & 0xf0) >> 4;
int aci = (pos[0] >> 5) & 0x03;
 
-   if (aifsn < 2) {
-   sdata_info(sdata,
-  "AP has invalid WMM params (AIFSN=%d for ACI 
%d), disabling WMM\n",
-  aifsn, aci);
-   return false;
-   }
if (ecwmin > ecwmax) {
sdata_info(sdata,
   "AP has invalid WMM params (ECWmin/max=%d/%d 
for ACI %d), disabling WMM\n",
-- 
2.5.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 2/2] ath6k: implement ethtool stats.

2015-10-22 Thread greearb
From: Ben Greear 

This supports a way to get target stats through normal
ethtool stats API.

For instance:
# ethtool -S wlan1
NIC statistics:
 tx_pkts_nic: 353
 tx_bytes_nic: 25142
 rx_pkts_nic: 6
 rx_bytes_nic: 996
 d_tx_ucast_pkts: 89
 d_tx_bcast_pkts: 264
 d_tx_ucast_bytes: 3020
 d_tx_bcast_bytes: 22122
...

Signed-off-by: Ben Greear 
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c | 123 +
 1 file changed, 123 insertions(+)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c 
b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 6fcb39b..5e982e2 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3645,6 +3645,127 @@ void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif)
ar->num_vif--;
 }
 
+static const char ath6k_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
+   /* Common stats names used by many drivers. */
+   "tx_pkts_nic", "tx_bytes_nic", "rx_pkts_nic", "rx_bytes_nic",
+
+   /* TX stats. */
+   "d_tx_ucast_pkts", "d_tx_bcast_pkts",
+   "d_tx_ucast_bytes", "d_tx_bcast_bytes",
+   "d_tx_rts_ok", "d_tx_error", "d_tx_fail",
+   "d_tx_retry", "d_tx_multi_retry", "d_tx_rts_fail",
+   "d_tx_tkip_counter_measures",
+
+   /* RX Stats. */
+   "d_rx_ucast_pkts", "d_rx_ucast_rate", "d_rx_bcast_pkts",
+   "d_rx_ucast_bytes", "d_rx_bcast_bytes", "d_rx_frag_pkt",
+   "d_rx_error", "d_rx_crc_err", "d_rx_keycache_miss",
+   "d_rx_decrypt_crc_err", "d_rx_duplicate_frames",
+   "d_rx_mic_err", "d_rx_tkip_format_err", "d_rx_ccmp_format_err",
+   "d_rx_ccmp_replay_err",
+
+   /* Misc stats. */
+   "d_beacon_miss", "d_num_connects", "d_num_disconnects",
+   "d_beacon_avg_rssi", "d_arp_received", "d_arp_matched",
+   "d_arp_replied"
+};
+
+#define ATH6K_STATS_LENARRAY_SIZE(ath6k_gstrings_sta_stats)
+
+static int ath6k_get_sset_count(struct net_device *dev, int sset)
+{
+   int rv = 0;
+
+   if (sset == ETH_SS_STATS)
+   rv += ATH6K_STATS_LEN;
+
+   if (rv == 0)
+   return -EOPNOTSUPP;
+   return rv;
+}
+
+static void ath6k_get_stats(struct net_device *dev,
+   struct ethtool_stats *stats,
+   u64 *data)
+{
+   struct ath6kl_vif *vif = netdev_priv(dev);
+   struct ath6kl *ar = vif->ar;
+   int i = 0;
+   struct target_stats *tgt_stats;
+
+   memset(data, 0, sizeof(u64) * ATH6K_STATS_LEN);
+
+   ath6k_read_tgt_stats(ar, vif);
+
+   tgt_stats = >target_stats;
+
+   data[i++] = tgt_stats->tx_ucast_pkt + tgt_stats->tx_bcast_pkt;
+   data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte;
+   data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt;
+   data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte;
+
+   data[i++] = tgt_stats->tx_ucast_pkt;
+   data[i++] = tgt_stats->tx_bcast_pkt;
+   data[i++] = tgt_stats->tx_ucast_byte;
+   data[i++] = tgt_stats->tx_bcast_byte;
+   data[i++] = tgt_stats->tx_rts_success_cnt;
+   data[i++] = tgt_stats->tx_err;
+   data[i++] = tgt_stats->tx_fail_cnt;
+   data[i++] = tgt_stats->tx_retry_cnt;
+   data[i++] = tgt_stats->tx_mult_retry_cnt;
+   data[i++] = tgt_stats->tx_rts_fail_cnt;
+   data[i++] = tgt_stats->tkip_cnter_measures_invoked;
+
+   data[i++] = tgt_stats->rx_ucast_pkt;
+   data[i++] = tgt_stats->rx_ucast_rate;
+   data[i++] = tgt_stats->rx_bcast_pkt;
+   data[i++] = tgt_stats->rx_ucast_byte;
+   data[i++] = tgt_stats->rx_bcast_byte;
+   data[i++] = tgt_stats->rx_frgment_pkt;
+   data[i++] = tgt_stats->rx_err;
+   data[i++] = tgt_stats->rx_crc_err;
+   data[i++] = tgt_stats->rx_key_cache_miss;
+   data[i++] = tgt_stats->rx_decrypt_err;
+   data[i++] = tgt_stats->rx_dupl_frame;
+   data[i++] = tgt_stats->tkip_local_mic_fail;
+   data[i++] = tgt_stats->tkip_fmt_err;
+   data[i++] = tgt_stats->ccmp_fmt_err;
+   data[i++] = tgt_stats->ccmp_replays;
+
+   data[i++] = tgt_stats->cs_bmiss_cnt;
+   data[i++] = tgt_stats->cs_connect_cnt;
+   data[i++] = tgt_stats->cs_discon_cnt;
+   data[i++] = tgt_stats->cs_ave_beacon_rssi;
+   data[i++] = tgt_stats->arp_received;
+   data[i++] = tgt_stats->arp_matched;
+   data[i++] = tgt_stats->arp_replied;
+
+   if (i !=  ATH6K_STATS_LEN) {
+   WARN_ON_ONCE(1);
+   ath6kl_err("ethtool stats error, i: %d  STATS_LEN: %d\n",
+  i, (int)ATH6K_STATS_LEN);
+   }
+}
+
+/* These stats are per NIC, not really per vdev, so we just ignore dev. */
+static void ath6k_get_strings(struct net_device *dev, u32 sset, u8 *data)
+{
+   int sz_sta_stats = 0;
+
+   if (sset == ETH_SS_STATS) {
+   sz_sta_stats = sizeof(ath6k_gstrings_sta_stats);
+   

[PATCH-v2 1/2] ath6k: break stats gathering code into separate method.

2015-10-22 Thread greearb
From: Ben Greear 

This will allow us to call it from elsewhere when implementing
ethtool stats.

Signed-off-by: Ben Greear 
---

v2:  Make ethtool ops static per kbuild test robot suggestion.

 drivers/net/wireless/ath/ath6kl/debug.c | 55 +++--
 drivers/net/wireless/ath/ath6kl/debug.h |  2 ++
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c 
b/drivers/net/wireless/ath/ath6kl/debug.c
index 81ba48d..91ff6a5 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -98,6 +98,33 @@ void ath6kl_warn(const char *fmt, ...)
 }
 EXPORT_SYMBOL(ath6kl_warn);
 
+int ath6k_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif)
+{
+   long left;
+
+   if (down_interruptible(>sem))
+   return -EBUSY;
+
+   set_bit(STATS_UPDATE_PEND, >flags);
+
+   if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
+   up(>sem);
+   return -EIO;
+   }
+
+   left = wait_event_interruptible_timeout(ar->event_wq,
+   !test_bit(STATS_UPDATE_PEND,
+   >flags), WMI_TIMEOUT);
+
+   up(>sem);
+
+   if (left <= 0)
+   return -ETIMEDOUT;
+
+   return 0;
+}
+EXPORT_SYMBOL(ath6k_read_tgt_stats);
+
 #ifdef CONFIG_ATH6KL_DEBUG
 
 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
@@ -544,42 +571,24 @@ static ssize_t read_file_tgt_stats(struct file *file, 
char __user *user_buf,
char *buf;
unsigned int len = 0, buf_len = 1500;
int i;
-   long left;
ssize_t ret_cnt;
+   int rv;
 
vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;
 
-   tgt_stats = >target_stats;
-
buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
-   if (down_interruptible(>sem)) {
+   rv = ath6k_read_tgt_stats(ar, vif);
+   if (rv < 0) {
kfree(buf);
-   return -EBUSY;
+   return rv;
}
 
-   set_bit(STATS_UPDATE_PEND, >flags);
-
-   if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
-   up(>sem);
-   kfree(buf);
-   return -EIO;
-   }
-
-   left = wait_event_interruptible_timeout(ar->event_wq,
-   !test_bit(STATS_UPDATE_PEND,
-   >flags), WMI_TIMEOUT);
-
-   up(>sem);
-
-   if (left <= 0) {
-   kfree(buf);
-   return -ETIMEDOUT;
-   }
+   tgt_stats = >target_stats;
 
len += scnprintf(buf + len, buf_len - len, "\n");
len += scnprintf(buf + len, buf_len - len, "%25s\n",
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h 
b/drivers/net/wireless/ath/ath6kl/debug.h
index 19106ed..be54f19 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -59,6 +59,8 @@ enum ath6kl_war {
ATH6KL_WAR_INVALID_RATE,
 };
 
+int ath6k_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif);
+
 #ifdef CONFIG_ATH6KL_DEBUG
 
 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...);
-- 
2.4.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


[PATCH 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-22 Thread Emmanuel Grumbach
When the op_mode sends an skb whose payload is bigger than
MSS, PCIe will create an A-MSDU out of it. PCIe assumes
that the skb that is coming from the op_mode can fit in one
A-MSDU. It is the op_mode's responsibility to make sure
that this guarantee holds.

Additional headers need to be built for the subframes.
The TSO core code takes care of the IP / TCP headers and
the driver takes care of the 802.11 subframe headers.

These headers are stored on a per-cpu page that is re-used
for all the packets handled on that same CPU. Each skb
holds a reference to that page and releases the page when
it is reclaimed. When the page gets full, it is released
and a new one is allocated.

Since any SKB that doesn't go through the fast-xmit path
of mac80211 will be segmented, we can assume here that the
packet is not WEP / TKIP and has a proper SNAP header.

Signed-off-by: Emmanuel Grumbach 
---
Changes since RFCv4, addressing Eliad's comments:
 * free trans_pcie->tso_hdr_page in the failure path of iwl_trans_pcie_alloc
 * s/alloc_pages(gfp, 0)/alloc_page(gfp)
 * make sure that get_page_hdr's allocation didn't fail
 * use data_left instead of mss for the subframe header's length field
 * free csum_skb in the failure paths
 * identation
---
 drivers/net/wireless/iwlwifi/iwl-devtrace-data.h |  16 ++
 drivers/net/wireless/iwlwifi/iwl-trans.h |   6 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h |   7 +
 drivers/net/wireless/iwlwifi/pcie/trans.c|  16 ++
 drivers/net/wireless/iwlwifi/pcie/tx.c   | 295 ++-
 5 files changed, 334 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h 
b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
index 71a78ce..59d9edf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
@@ -51,6 +51,22 @@ TRACE_EVENT(iwlwifi_dev_tx_data,
TP_printk("[%s] TX frame data", __get_str(dev))
 );
 
+TRACE_EVENT(iwlwifi_dev_tx_tso_chunk,
+   TP_PROTO(const struct device *dev,
+u8 *data_src, size_t data_len),
+   TP_ARGS(dev, data_src, data_len),
+   TP_STRUCT__entry(
+   DEV_ENTRY
+
+   __dynamic_array(u8, data, data_len)
+   ),
+   TP_fast_assign(
+   DEV_ASSIGN;
+   memcpy(__get_dynamic_array(data), data_src, data_len);
+   ),
+   TP_printk("[%s] TX frame data", __get_str(dev))
+);
+
 TRACE_EVENT(iwlwifi_dev_rx_data,
TP_PROTO(const struct device *dev,
 const struct iwl_trans *trans,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 0ceff69..6919243 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -379,7 +379,11 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer 
*r)
 }
 
 #define MAX_NO_RECLAIM_CMDS6
-
+/*
+ * The first entry in driver_data array in ieee80211_tx_info
+ * that can be used by the transport.
+ */
+#define IWL_FIRST_DRIVER_DATA 2
 #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo
 
 /*
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/iwlwifi/pcie/internal.h
index be168d1..7da5643 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -295,6 +295,11 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
   sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
 }
 
+struct iwl_tso_hdr_page {
+   struct page *page;
+   u8 *pos;
+};
+
 /**
  * struct iwl_trans_pcie - PCIe transport specific data
  * @rxq: all the RX queue data
@@ -332,6 +337,8 @@ struct iwl_trans_pcie {
struct net_device napi_dev;
struct napi_struct napi;
 
+   struct __percpu iwl_tso_hdr_page *tso_hdr_page;
+
/* INT ICT Table */
__le32 *ict_tbl;
dma_addr_t ict_tbl_dma;
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index a275318..93e488f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1601,6 +1601,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans 
*trans,
 void iwl_trans_pcie_free(struct iwl_trans *trans)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+   int i;
 
 #ifdef CPTCFG_IWLWIFI_PLATFORM_DATA
/* Make sure the device is on before calling pci functions again.
@@ -1631,6 +1632,15 @@ void iwl_trans_pcie_free(struct iwl_trans *trans)
 
iwl_pcie_free_fw_monitor(trans);
 
+   for_each_possible_cpu(i) {
+   struct iwl_tso_hdr_page *p =
+   per_cpu_ptr(trans_pcie->tso_hdr_page, i);
+
+   if (p->page)
+   __free_pages(p->page, 0);
+   }
+
+   free_percpu(trans_pcie->tso_hdr_page);

[PATCH 2/2] iwlwifi: mvm: send large SKBs to the transport

2015-10-22 Thread Emmanuel Grumbach
Now that PCIe knows how to create A-MSDUs, use this
capability and prepare SKBs that are large enough to
build an A-MSDU.
Advertise TSO support towards the network stack and
segment the packet with gso_size set to be the maximal
A-MSDU length (after having taken the headers to be added
into account) to make sure that the skb that is passed
down to the transport are not longer than the maximal
A-MSDU allowed.

Signed-off-by: Emmanuel Grumbach 
---
No change since RFCv4
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 143 --
 1 file changed, 135 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index be9d7e4..d325de4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "iwl-trans.h"
 #include "iwl-eeprom-parse.h"
@@ -181,7 +182,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
tx_cmd->tx_flags = cpu_to_le32(tx_flags);
/* Total # bytes to be transmitted */
-   tx_cmd->len = cpu_to_le16((u16)skb->len);
+   tx_cmd->len = cpu_to_le16((u16)skb->len +
+   (uintptr_t)info->driver_data[0]);
tx_cmd->next_frame_len = 0;
tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
tx_cmd->sta_id = sta_id;
@@ -356,7 +358,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
memset(>status, 0, sizeof(info->status));
 
-   info->driver_data[0] = NULL;
info->driver_data[1] = dev_cmd;
 
return dev_cmd;
@@ -379,6 +380,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
  info->hw_queue != info->control.vif->cab_queue)))
return -1;
 
+   /* This holds the amsdu headers length */
+   info->driver_data[0] = (void *)(uintptr_t)0;
+
/*
 * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used
 * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel
@@ -435,29 +439,148 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
return 0;
 }
 
-static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb_gso,
+static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
  struct ieee80211_sta *sta,
  struct sk_buff_head *mpdus_skb)
 {
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (void *)skb->data;
+   unsigned int mss = skb_shinfo(skb)->gso_size;
struct sk_buff *tmp, *next;
-   char cb[sizeof(skb_gso->cb)];
+   char cb[sizeof(skb->cb)];
+   unsigned int num_subframes, tcp_payload_len, subf_len;
+   u16 amsdu_add, snap_ip_tcp, pad, i = 0;
+   /* Not used in IPv6 */
+   u16 ip_base_id = ntohs(ip_hdr(skb)->id);
+
+   snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
+   tcp_hdrlen(skb);
+
+   if (!sta->max_amsdu_len ||
+   !ieee80211_is_data_qos(hdr->frame_control)) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /*
+* Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not
+* supported. This is a spec requirement (IEEE 802.11-2015
+* section 8.7.3 NOTE 3).
+*/
+
+   /* TODO: for now, disable A-MSDU inside AMPDU */
+   if (info->flags & IEEE80211_TX_CTL_AMPDU) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /* Sub frame header + SNAP + IP header + TCP header + MSS */
+   subf_len = sizeof(struct ethhdr) + snap_ip_tcp + mss;
+   pad = (4 - subf_len) & 0x3;
+
+   /*
+* If we have N subframes in the A-MSDU, then the A-MSDU's size is
+* N * subf_len + (N - 1) * pad.
+*/
+   num_subframes = (sta->max_amsdu_len + pad) / (subf_len + pad);
+   if (num_subframes > 1) {
+   u8 *qc = ieee80211_get_qos_ctl((void *)skb->data);
+
+   *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+   }
+
+   tcp_payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
+   tcp_hdrlen(skb) + skb->data_len;
 
-   memcpy(cb, skb_gso->cb, sizeof(cb));
-   next = skb_gso_segment(skb_gso, 0);
-   if (IS_ERR(next))
+   /*
+* Make sure we have enough TBs for the A-MSDU:
+*  2 for each subframe
+*  1 more for each fragment
+*  1 more for the potential data in the header
+*/
+   num_subframes =
+   min_t(unsigned int, num_subframes,
+ (mvm->trans->max_skb_frags - 1 -
+  skb_shinfo(skb)->nr_frags) / 2);