Re: [PATCH 3/4] ath10k: Fix no-ack frame status

2014-12-15 Thread Kalle Valo
Sujith Manoharan suj...@msujith.org writes:

 Kalle Valo wrote:
 Johannes, are you planning to take this? Or should I take this once the
 corresponding mac80211 patch trickles down to my tree?

 Kalle, can you please pick this one ? I'll rebase and send the ath9k patch
 to John once he starts merging patches.

Yes, I'll take this patch once I have the mac80211 dependency in my
tree. I marked the patch as Awaiting Upstream in patchwork so that I
don't forget, hopefully :)

https://patchwork.kernel.org/patch/5470621/

-- 
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] staging: rtl8723au: os_dep: usb_intf.c: Fix for possible null pointer dereference

2014-12-15 Thread Dan Carpenter
On Sun, Dec 14, 2014 at 11:39:14PM +0100, Rickard Strandqvist wrote:
 There is otherwise a risk of a possible null pointer dereference.
 
 Was largely found by using a static code analysis program called cppcheck.
 
 Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
 ---
  drivers/staging/rtl8723au/os_dep/usb_intf.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c 
 b/drivers/staging/rtl8723au/os_dep/usb_intf.c
 index 865743e..71a6330 100644
 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c
 +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c
 @@ -351,10 +351,11 @@ error_exit:
  int rtw_hw_resume23a(struct rtw_adapter *padapter)

That's weird.  Is this function even called?

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


[PATCH v9 0/2] Stop scheduled scan if netlink client disappears

2014-12-15 Thread Jukka Rissanen
Hi,

v9:
- switched the patch order, now RCU fixes are done before the scheduled
  scan tweaks
- fix the RCU code according to comments from v8

v8:
- reworked the RCU code and placed it in patch 2

v7:
- convert the cfg80211_sched_scan_request to __rcu pointer in order
  to avoid races when accessing it
- reverting the patch v6, the port id is back in request struct

v6:
- moved owner netlink port id from cfg80211_sched_scan_request to
  rdev in order to avoid possible races

v5:
- discarded the locking changes in v4
- instead of trying to schedule sched_scan_stop worker from
  struct cfg80211_sched_scan_request, move the worker to wiphy
  as that makes it easier to manage the sched_scan_stop worker.
  There are also one scheduled scan / wiphy so it is also logical
  to do it like this.

v4:
- rtnl locking issues fixed in patch 2

v3:
- backward compatibility define tweaked in patch 1
- added missing signed-off-by:

v2:
- split the patch
- In patch 1, use a generic NL80211_ATTR_SOCKET_OWNER attribute and
  convert the old code that uses NL80211_ATTR_IFACE_SOCKET_OWNER to
  use the new value. A define is provided for backward compatibility.
- Any pending schedule scan stop worker is cancelled when interface is
  taken down in patch 2


Jukka Rissanen (2):
  nl80211: Convert sched_scan_req pointer to RCU pointer
  nl80211: Stop scheduled scan if netlink client disappears

 include/net/cfg80211.h   |  2 ++
 include/uapi/linux/nl80211.h |  3 +++
 net/wireless/core.c  | 26 +++---
 net/wireless/core.h  |  4 +++-
 net/wireless/nl80211.c   | 35 +++
 net/wireless/scan.c  | 13 -
 6 files changed, 66 insertions(+), 17 deletions(-)

-- 
1.8.3.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 v9 1/2] nl80211: Convert sched_scan_req pointer to RCU pointer

2014-12-15 Thread Jukka Rissanen
Because of possible races when accessing sched_scan_req pointer in
rdev, the sched_scan_req is converted to RCU pointer.

Signed-off-by: Jukka Rissanen jukka.rissa...@linux.intel.com
---
 include/net/cfg80211.h |  1 +
 net/wireless/core.c| 10 +++---
 net/wireless/core.h|  2 +-
 net/wireless/nl80211.c | 19 +++
 net/wireless/scan.c| 13 -
 5 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb748c4..8ea8b94 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1537,6 +1537,7 @@ struct cfg80211_sched_scan_request {
struct wiphy *wiphy;
struct net_device *dev;
unsigned long scan_start;
+   struct rcu_head rcu_head;
 
/* keep last */
struct ieee80211_channel *channels[0];
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 4c2e501..9b43438 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -844,6 +844,7 @@ void __cfg80211_leave(struct cfg80211_registered_device 
*rdev,
  struct wireless_dev *wdev)
 {
struct net_device *dev = wdev-netdev;
+   struct cfg80211_sched_scan_request *sched_scan_req;
 
ASSERT_RTNL();
ASSERT_WDEV_LOCK(wdev);
@@ -854,7 +855,8 @@ void __cfg80211_leave(struct cfg80211_registered_device 
*rdev,
break;
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
-   if (rdev-sched_scan_req  dev == rdev-sched_scan_req-dev)
+   sched_scan_req = rtnl_dereference(rdev-sched_scan_req);
+   if (sched_scan_req  dev == sched_scan_req-dev)
__cfg80211_stop_sched_scan(rdev, false);
 
 #ifdef CONFIG_CFG80211_WEXT
@@ -929,6 +931,7 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct wireless_dev *wdev = dev-ieee80211_ptr;
struct cfg80211_registered_device *rdev;
+   struct cfg80211_sched_scan_request *sched_scan_req;
 
if (!wdev)
return NOTIFY_DONE;
@@ -993,8 +996,9 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
___cfg80211_scan_done(rdev, false);
}
 
-   if (WARN_ON(rdev-sched_scan_req 
-   rdev-sched_scan_req-dev == wdev-netdev)) {
+   sched_scan_req = rtnl_dereference(rdev-sched_scan_req);
+   if (WARN_ON(sched_scan_req 
+   sched_scan_req-dev == wdev-netdev)) {
__cfg80211_stop_sched_scan(rdev, false);
}
 
diff --git a/net/wireless/core.h b/net/wireless/core.h
index faa5b16..6cded4d 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -63,7 +63,7 @@ struct cfg80211_registered_device {
u32 bss_generation;
struct cfg80211_scan_request *scan_req; /* protected by RTNL */
struct sk_buff *scan_msg;
-   struct cfg80211_sched_scan_request *sched_scan_req;
+   struct cfg80211_sched_scan_request __rcu *sched_scan_req;
unsigned long suspend_at;
struct work_struct scan_done_wk;
struct work_struct sched_scan_results_wk;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b5e3c48..be2654b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6068,6 +6068,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
struct cfg80211_registered_device *rdev = info-user_ptr[0];
struct net_device *dev = info-user_ptr[1];
struct wireless_dev *wdev = dev-ieee80211_ptr;
+   struct cfg80211_sched_scan_request *sched_scan_req;
int err;
 
if (!(rdev-wiphy.flags  WIPHY_FLAG_SUPPORTS_SCHED_SCAN) ||
@@ -6077,27 +6078,29 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
if (rdev-sched_scan_req)
return -EINPROGRESS;
 
-   rdev-sched_scan_req = nl80211_parse_sched_scan(rdev-wiphy, wdev,
-   info-attrs);
-   err = PTR_ERR_OR_ZERO(rdev-sched_scan_req);
+   sched_scan_req = nl80211_parse_sched_scan(rdev-wiphy, wdev,
+ info-attrs);
+
+   err = PTR_ERR_OR_ZERO(sched_scan_req);
if (err)
goto out_err;
 
-   err = rdev_sched_scan_start(rdev, dev, rdev-sched_scan_req);
+   err = rdev_sched_scan_start(rdev, dev, sched_scan_req);
if (err)
goto out_free;
 
-   rdev-sched_scan_req-dev = dev;
-   rdev-sched_scan_req-wiphy = rdev-wiphy;
+   sched_scan_req-dev = dev;
+   sched_scan_req-wiphy = rdev-wiphy;
+
+   rcu_assign_pointer(rdev-sched_scan_req, sched_scan_req);
 
nl80211_send_sched_scan(rdev, dev,
NL80211_CMD_START_SCHED_SCAN);
return 0;
 
 out_free:
-   kfree(rdev-sched_scan_req);
+   

[PATCH] mac80211: ask driver to look at power level when starting AP

2014-12-15 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

The power level might have been set, but as the interface was idle
it might not have taken effect yet. Ask the driver to check the
power level when starting up an AP so that in this case the correct
power level is used in case the device/driver can only set it when
the interface is actually active.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 net/mac80211/cfg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e75d5c53e97b..169665835b6c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -678,7 +678,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct 
net_device *dev,
  BSS_CHANGED_BEACON_ENABLED |
  BSS_CHANGED_BEACON |
  BSS_CHANGED_SSID |
- BSS_CHANGED_P2P_PS;
+ BSS_CHANGED_P2P_PS |
+ BSS_CHANGED_TXPOWER;
int err;
 
old = sdata_dereference(sdata-u.ap.beacon, sdata);
-- 
2.1.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 v9 2/2] nl80211: Stop scheduled scan if netlink client disappears

2014-12-15 Thread Jukka Rissanen
An attribute NL80211_ATTR_SOCKET_OWNER can be set by the scan initiator.
If present, the attribute will cause the scan to be stopped if the client
dies.

Signed-off-by: Jukka Rissanen jukka.rissa...@linux.intel.com
---
 include/net/cfg80211.h   |  1 +
 include/uapi/linux/nl80211.h |  3 +++
 net/wireless/core.c  | 16 
 net/wireless/core.h  |  2 ++
 net/wireless/nl80211.c   | 16 
 5 files changed, 38 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8ea8b94..4ba9790 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1538,6 +1538,7 @@ struct cfg80211_sched_scan_request {
struct net_device *dev;
unsigned long scan_start;
struct rcu_head rcu_head;
+   u32 owner_nlportid;
 
/* keep last */
struct ieee80211_channel *channels[0];
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d775245..a0e3b32 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1655,6 +1655,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
  * creation then the new interface will be owned by the netlink socket
  * that created it and will be destroyed when the socket is closed.
+ * If set during scheduled scan start then the new scan req will be
+ * owned by the netlink socket that created it and the scheduled scan will
+ * be stopped when the socket is closed.
  *
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  * the TDLS link initiator.
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 9b43438..b612b71 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -320,6 +320,20 @@ static void cfg80211_destroy_iface_wk(struct work_struct 
*work)
rtnl_unlock();
 }
 
+static void cfg80211_sched_scan_stop_wk(struct work_struct *work)
+{
+   struct cfg80211_registered_device *rdev;
+
+   rdev = container_of(work, struct cfg80211_registered_device,
+  sched_scan_stop_wk);
+
+   rtnl_lock();
+
+   __cfg80211_stop_sched_scan(rdev, false);
+
+   rtnl_unlock();
+}
+
 /* exported functions */
 
 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
@@ -406,6 +420,7 @@ use_default_name:
INIT_LIST_HEAD(rdev-destroy_list);
spin_lock_init(rdev-destroy_list_lock);
INIT_WORK(rdev-destroy_work, cfg80211_destroy_iface_wk);
+   INIT_WORK(rdev-sched_scan_stop_wk, cfg80211_sched_scan_stop_wk);
 
 #ifdef CONFIG_CFG80211_DEFAULT_PS
rdev-wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
@@ -764,6 +779,7 @@ void wiphy_unregister(struct wiphy *wiphy)
flush_work(rdev-event_work);
cancel_delayed_work_sync(rdev-dfs_update_channels_wk);
flush_work(rdev-destroy_work);
+   flush_work(rdev-sched_scan_stop_wk);
 
 #ifdef CONFIG_PM
if (rdev-wiphy.wowlan_config  rdev-ops-set_wakeup)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 6cded4d..4e3630b 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -84,6 +84,8 @@ struct cfg80211_registered_device {
struct list_head destroy_list;
struct work_struct destroy_work;
 
+   struct work_struct sched_scan_stop_wk;
+
/* must be last because of the way we do wiphy_priv(),
 * and it should at least be aligned to NETDEV_ALIGN */
struct wiphy wiphy __aligned(NETDEV_ALIGN);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index be2654b..18d0d6f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6092,6 +6092,9 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
sched_scan_req-dev = dev;
sched_scan_req-wiphy = rdev-wiphy;
 
+   if (info-attrs[NL80211_ATTR_SOCKET_OWNER])
+   sched_scan_req-owner_nlportid = info-snd_portid;
+
rcu_assign_pointer(rdev-sched_scan_req, sched_scan_req);
 
nl80211_send_sched_scan(rdev, dev,
@@ -12474,6 +12477,13 @@ static int nl80211_netlink_notify(struct 
notifier_block * nb,
 
list_for_each_entry_rcu(rdev, cfg80211_rdev_list, list) {
bool schedule_destroy_work = false;
+   bool schedule_scan_stop = false;
+   struct cfg80211_sched_scan_request *sched_scan_req =
+   rcu_dereference(rdev-sched_scan_req);
+
+   if (sched_scan_req  notify-portid 
+   sched_scan_req-owner_nlportid == notify-portid)
+   schedule_scan_stop = true;
 
list_for_each_entry_rcu(wdev, rdev-wdev_list, list) {
cfg80211_mlme_unregister_socket(wdev, notify-portid);
@@ -12504,6 +12514,12 @@ static int nl80211_netlink_notify(struct 
notifier_block * nb,
spin_unlock(rdev-destroy_list_lock);
schedule_work(rdev-destroy_work);

[PATCH] mac80211: move U-APSD enablement to vif flags

2014-12-15 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

In order to let drivers have more dynamic U-APSD support,
move the enablement flag to the virtual interface driver
flags. This lets drivers not only set it up differently
for different interfaces, but also enable/disable on the
fly if needed.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 drivers/net/wireless/ath/ath10k/mac.c   |  3 ++-
 drivers/net/wireless/cw1200/main.c  |  1 -
 drivers/net/wireless/cw1200/sta.c   |  1 +
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 13 ++---
 drivers/net/wireless/ti/wl1251/main.c   |  5 ++---
 drivers/net/wireless/ti/wlcore/main.c   |  2 +-
 include/net/mac80211.h  | 15 +++
 net/mac80211/debugfs.c  |  2 --
 net/mac80211/main.c |  4 
 net/mac80211/mlme.c |  7 ++-
 10 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index c4005670cba2..2619db1e3e74 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2871,6 +2871,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
int bit;
u32 vdev_param;
 
+   vif-driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
+
mutex_lock(ar-conf_mutex);
 
memset(arvif, 0, sizeof(*arvif));
@@ -5024,7 +5026,6 @@ int ath10k_mac_register(struct ath10k *ar)
ar-hw-flags = IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
-   IEEE80211_HW_SUPPORTS_UAPSD |
IEEE80211_HW_MFP_CAPABLE |
IEEE80211_HW_REPORTS_TX_ACK_STATUS |
IEEE80211_HW_HAS_RATE_CONTROL |
diff --git a/drivers/net/wireless/cw1200/main.c 
b/drivers/net/wireless/cw1200/main.c
index 3e78cc3ccb78..0da6e423da63 100644
--- a/drivers/net/wireless/cw1200/main.c
+++ b/drivers/net/wireless/cw1200/main.c
@@ -282,7 +282,6 @@ static struct ieee80211_hw *cw1200_init_common(const u8 
*macaddr,
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
IEEE80211_HW_REPORTS_TX_ACK_STATUS |
-   IEEE80211_HW_SUPPORTS_UAPSD |
IEEE80211_HW_CONNECTION_MONITOR |
IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_TX_AMPDU_SETUP_IN_HW |
diff --git a/drivers/net/wireless/cw1200/sta.c 
b/drivers/net/wireless/cw1200/sta.c
index 5b84664db13b..a1e3237c0be8 100644
--- a/drivers/net/wireless/cw1200/sta.c
+++ b/drivers/net/wireless/cw1200/sta.c
@@ -213,6 +213,7 @@ int cw1200_add_interface(struct ieee80211_hw *dev,
/* __le32 auto_calibration_mode = __cpu_to_le32(1); */
 
vif-driver_flags |= IEEE80211_VIF_BEACON_FILTER |
+IEEE80211_VIF_SUPPORTS_UAPSD |
 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
 
mutex_lock(priv-conf_mutex);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 31a5b3f4266c..346331d3c696 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -326,6 +326,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
hw-radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC |
IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED;
hw-rate_control_algorithm = iwl-mvm-rs;
+   hw-uapsd_queues = IWL_MVM_UAPSD_QUEUES;
+   hw-uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
 
/*
 * Enable 11w if advertised by firmware and software crypto
@@ -336,13 +338,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
!iwlwifi_mod_params.sw_crypto)
hw-flags |= IEEE80211_HW_MFP_CAPABLE;
 
-   if (mvm-fw-ucode_capa.flags  IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT 
-   !iwlwifi_mod_params.uapsd_disable) {
-   hw-flags |= IEEE80211_HW_SUPPORTS_UAPSD;
-   hw-uapsd_queues = IWL_MVM_UAPSD_QUEUES;
-   hw-uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
-   }
-
if (mvm-fw-ucode_capa.api[0]  IWL_UCODE_TLV_API_LMAC_SCAN ||
mvm-fw-ucode_capa.capa[0]  IWL_UCODE_TLV_CAPA_UMAC_SCAN) {
hw-flags |= IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS;
@@ -1147,6 +1142,10 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw 
*hw,
mvm-bf_allowed_vif = mvmvif;
vif-driver_flags |= IEEE80211_VIF_BEACON_FILTER |
 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
+   if (mvm-fw-ucode_capa.flags 
+   IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT 
+   !iwlwifi_mod_params.uapsd_disable)
+   vif-driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
}
 
  

[RFC] ath10k: allow to use HT rates when IBSS

2014-12-15 Thread Janusz Dziedzic
This fix TX problem when IBSS connected and
enabled HT rates. Before we used 6Mbps all the
time.

Reported-by: Yeoh Chun-Yeow yeohchuny...@gmail.com
Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5475f0f..d358dab 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1408,6 +1408,7 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
}
break;
case WMI_VDEV_TYPE_STA:
+   case WMI_VDEV_TYPE_IBSS:
if (vif-bss_conf.qos)
arg-peer_flags |= WMI_PEER_QOS;
break;
@@ -1635,6 +1636,17 @@ static int ath10k_station_assoc(struct ath10k *ar,
return ret;
}
 
+   if (arvif-vdev_type == WMI_VDEV_TYPE_IBSS) {
+   ret = ath10k_wmi_peer_set_param(ar, arvif-vdev_id, sta-addr,
+   WMI_PEER_NSS, sta-rx_nss);
+   if (ret) {
+   ath10k_warn(ar, failed to set nss param %d for STA %pM 
vdet %i: %d\n,
+   sta-rx_nss, sta-addr,
+   arvif-vdev_id, ret);
+   return ret;
+   }
+   }
+
/* Re-assoc is run only to update supported rates for given station. It
 * doesn't make much sense to reconfigure the peer completely.
 */
-- 
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 v4] mac80211: keep sending peer candidate events while in listen state

2014-12-15 Thread Johannes Berg
On Fri, 2014-12-12 at 11:47 -0500, Bob Copeland (m...@bobcopeland.com)
wrote:
 On Fri, Dec 12, 2014 at 12:41:30PM +0100, Johannes Berg wrote:
  On Fri, 2014-11-21 at 11:24 +, Nishikawa, Kenzoh wrote:
   Instead of sending peer candidate events just once, send them 
   as long as the peer remains in the LISTEN state in the peering 
   state machine, when userspace is implementing the peering manager.
   Userspace may silence the events from a peer by progressing 
   the state machine or by setting the link state to BLOCKED.
   
   Fixes the problem that a mesh peering process won't be fired 
   again after the previous first peering trial fails due to 
   like air propagation error if the peering is managed by 
   user space such as wpa_supplicant.
   
   This patch works with another patch for wpa_supplicant described 
   here which fires a peering process again triggered by the notice 
   from kernel.
   http://lists.shmoo.com/pipermail/hostap/2014-November/031235.html
  
  Can any of the mesh folks comment on this?
 
 I think it's fine.  It's not strictly necessary: userspace could
 run its own timers to restart peering with any unpeered candidates
 periodically, but doing it based on beacon arrival is a little better
 since it indicates the peer is still alive, and this is also exactly
 how the in-kernel MPM operates.

Great, thanks.

johannes

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


Re: [PATCH v4] mac80211: keep sending peer candidate events while in listen state

2014-12-15 Thread Johannes Berg
On Fri, 2014-11-21 at 11:24 +, Nishikawa, Kenzoh wrote:

 + cfg80211_notify_new_peer_candidate(sdata-dev, hw_addr,
 +elems-ie_start,
 +elems-total_len,
 +GFP_ATOMIC);

Please indent properly (to align after the opening parenthesis)

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: [PATCHv2] mac80211: enable TPC through mac80211 stack

2014-12-15 Thread Lorenzo Bianconi
 On Fri, 2014-12-12 at 15:16 +0100, Lorenzo Bianconi wrote:

 In multi-vif scenario, TPC could be enabled just on given interfaces,
 but driver TPC registers should be configured anyway (so I used a glob
 flag). However I can move that logic in driver code, what do you
 suggest?

 It seems strange that a driver would look at both bss_conf and hw conf
 for the same thing - so seems it might be more understandable if it was
 in the driver?


In pending driver (ath9k) patches TPC related info in hw conf and
bss_conf are not used for the same purpose. The first one is used to
configure HW TPC registers, since TPC should be enabled in hw if there
is at least one interface where TPC has been configured, whereas the
latter it use to figure out if the transmitted frame belongs to a vif
where TPC has been previously enabled. If I do not set TPC info in hw
conf I have to loop over all vif every time TPC configuration is
applied from mac80211, since ath9k uses just hw conf structure to set
TX power info. Maybe that solution is a little bit tricky. What do you
think? Sorry if in previous emails I was not so clear :)

 johannes


Regards,
Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
--
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] staging: rtl8723au: Fix sparse warnings

2014-12-15 Thread Krzysztof Konopko
Some struct fields in wifi.h are meant to be __le16 but were declared as
unsigned short.  This was reported by sparse:

  rtw_wlan_util.c:538:24: warning: cast to restricted __le16
  rtw_wlan_util.c:1544:29: warning: cast to restricted __le16
  rtw_wlan_util.c:1546:25: warning: cast to restricted __le16

This patch updates the types of the fields in `AC_param` and
`ADDBA_request` structs to be consistent with relevant structs in
include/linux/ieee80211.h.

Signed-off-by: Krzysztof Konopko k...@konagma.com
---
 drivers/staging/rtl8723au/include/wifi.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/include/wifi.h 
b/drivers/staging/rtl8723au/include/wifi.h
index fd3da3b..25d573c 100644
--- a/drivers/staging/rtl8723au/include/wifi.h
+++ b/drivers/staging/rtl8723au/include/wifi.h
@@ -26,9 +26,9 @@
 
--*/
 
 struct AC_param {
-   unsigned char   ACI_AIFSN;
-   unsigned char   CW;
-   unsigned short  TXOP_limit;
+   u8  ACI_AIFSN;
+   u8  CW;
+   __le16  TXOP_limit;
 }  __packed;
 
 struct WMM_para_element {
@@ -38,10 +38,10 @@ struct WMM_para_element {
 }  __packed;
 
 struct ADDBA_request {
-   unsigned char   dialog_token;
-   unsigned short  BA_para_set;
-   unsigned short  BA_timeout_value;
-   unsigned short  BA_starting_seqctrl;
+   u8  dialog_token;
+   __le16  BA_para_set;
+   __le16  BA_timeout_value;
+   __le16  BA_starting_seqctrl;
 }  __packed;
 
 
-- 
2.1.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


Issue with iwlwifi in Wi-Fi N mode on ThinkPad x201 (Debian Testing)

2014-12-15 Thread Jonathan Marcille

Hello,

I have an issue with iwlwifi driver.

I installed iwlwifi-6000-ucode-9.193.4.1 on my ThinkPad x201 (Intel® 
Centrino® Advanced-N 6200) running Debian Testing (Jessie)

It works fine in b/g mode but not in N mode.

Is there something I need to do to make it work in N mode ? Or is it a 
driver issue with N mode ?


Thanks for the help.
--
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] staging: rtl8723au: Fix sparse warnings

2014-12-15 Thread Jes Sorensen
Krzysztof Konopko k...@konagma.com writes:
 On 12/12/14 19:52, Jes Sorensen wrote:
 Larry Finger larry.fin...@lwfinger.net writes:
 On 12/12/2014 05:35 AM, Krzysztof Konopko wrote:
 I was hunting particularly for inconsistencies with `sparse` and came
 across this one.  But I dug a bit further and I wonder why the driver is
 not using standard stuff like the one in `include/linux/ieee80211.h`
 where any data wider than one byte is clearly declared as __lenn?

 That is a good question. One possibility is that those definitions do
 not exist on some of the older kernels that Realtek supports. They
 generally work with 2.6.18 and newer.
 
 The reason the 8723au driver doesn't use the defines from there is that
 in ieee80211.h they are part of struct ieee80211_mgmt, while the 8723au
 driver access the addba etc. elements without the full struct in place.
 

 And why is that the case?
 (I'm trying to understand, not debunk)

 Looks to me that this driver has been kept out of the tree for quite a
 while (by Realtek) and now suffers from locally invented stuff.  I
 understand this is a lot of work to unify the codebase with ieee80211.h,
 but are there any technical hurdles?  I'm just curious.

The main issue is that the RTL driver maintains a partial copy of the
management frame, ie. without the front block containing the MAC
addresses. Switching this over to carry a full copy of the frame is
extremely intrusive as it's mixed in pretty much everywhere in the
driver.

The driver is derived from Realtek's multi-OS vendor driver, which
included code for pretty much every OS on the planet. If you want to see
how it looked initially, check out Larry's github tree and go back to
the initial checkins  Realtek seem to copy it into a new tree and
devel from there whenever they do a new chip, so the legacy in this
codebase is huge.

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


Re: [PATCH] staging: rtl8723au: Fix sparse warnings

2014-12-15 Thread Jes Sorensen
Krzysztof Konopko k...@konagma.com writes:
 Some struct fields in wifi.h are meant to be __le16 but were declared as
 unsigned short.  This was reported by sparse:

   rtw_wlan_util.c:538:24: warning: cast to restricted __le16
   rtw_wlan_util.c:1544:29: warning: cast to restricted __le16
   rtw_wlan_util.c:1546:25: warning: cast to restricted __le16

 This patch changes the types of the struct fields involved to be
 little-endian which is what is received over the air and consistent with
 relevant structs in include/linux/ieee80211.h.

 Signed-off-by: Krzysztof Konopko k...@konagma.com
 ---
  drivers/staging/rtl8723au/include/wifi.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

Looks OK

Signed-off-by: Jes Sorensen jes.soren...@redhat.com



 diff --git a/drivers/staging/rtl8723au/include/wifi.h 
 b/drivers/staging/rtl8723au/include/wifi.h
 index fd3da3b..266c43e 100644
 --- a/drivers/staging/rtl8723au/include/wifi.h
 +++ b/drivers/staging/rtl8723au/include/wifi.h
 @@ -28,7 +28,7 @@
  struct AC_param {
   unsigned char   ACI_AIFSN;
   unsigned char   CW;
 - unsigned short  TXOP_limit;
 + __le16  TXOP_limit;
  }  __packed;
  
  struct WMM_para_element {
 @@ -39,9 +39,9 @@ struct WMM_para_element {
  
  struct ADDBA_request {
   unsigned char   dialog_token;
 - unsigned short  BA_para_set;
 - unsigned short  BA_timeout_value;
 - unsigned short  BA_starting_seqctrl;
 + __le16  BA_para_set;
 + __le16  BA_timeout_value;
 + __le16  BA_starting_seqctrl;
  }  __packed;
--
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] staging: rtl8723au: Fix sparse warnings

2014-12-15 Thread Jes Sorensen
Krzysztof Konopko k...@konagma.com writes:
 Some struct fields in wifi.h are meant to be __le16 but were declared as
 unsigned short.  This was reported by sparse:

   rtw_wlan_util.c:538:24: warning: cast to restricted __le16
   rtw_wlan_util.c:1544:29: warning: cast to restricted __le16
   rtw_wlan_util.c:1546:25: warning: cast to restricted __le16

 This patch updates the types of the fields in `AC_param` and
 `ADDBA_request` structs to be consistent with relevant structs in
 include/linux/ieee80211.h.

 Signed-off-by: Krzysztof Konopko k...@konagma.com
 ---
  drivers/staging/rtl8723au/include/wifi.h | 14 +++---
  1 file changed, 7 insertions(+), 7 deletions(-)

Well the u8 change is really in the nit picking space, but I am fine
with that too.

Signed-off-by: Jes Sorensen jes.soren...@redhat.com


 diff --git a/drivers/staging/rtl8723au/include/wifi.h 
 b/drivers/staging/rtl8723au/include/wifi.h
 index fd3da3b..25d573c 100644
 --- a/drivers/staging/rtl8723au/include/wifi.h
 +++ b/drivers/staging/rtl8723au/include/wifi.h
 @@ -26,9 +26,9 @@
  
 --*/
  
  struct AC_param {
 - unsigned char   ACI_AIFSN;
 - unsigned char   CW;
 - unsigned short  TXOP_limit;
 + u8  ACI_AIFSN;
 + u8  CW;
 + __le16  TXOP_limit;
  }  __packed;
  
  struct WMM_para_element {
 @@ -38,10 +38,10 @@ struct WMM_para_element {
  }  __packed;
  
  struct ADDBA_request {
 - unsigned char   dialog_token;
 - unsigned short  BA_para_set;
 - unsigned short  BA_timeout_value;
 - unsigned short  BA_starting_seqctrl;
 + u8  dialog_token;
 + __le16  BA_para_set;
 + __le16  BA_timeout_value;
 + __le16  BA_starting_seqctrl;
  }  __packed;
--
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] iw: support multiple regdom print

2014-12-15 Thread Arik Nemtsov
When a phy is given, print only its regdomain. Otherwise, use the newly
implement dump functionality to print all regdomains in the system.

Signed-off-by: Arik Nemtsov a...@wizery.com
---
v2: fix reg get for older kernels

 reg.c | 40 
 1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/reg.c b/reg.c
index a02c982..0aef7ba 100644
--- a/reg.c
+++ b/reg.c
@@ -114,7 +114,6 @@ COMMAND(reg, set, ISO/IEC 3166-1 alpha2,
Notify the kernel about the current regulatory domain.);
 
 static int print_reg_handler(struct nl_msg *msg, void *arg)
-
 {
 #define PARSE_FLAG(nl_flag, string_value)  do { \
if ((flags  nl_flag)) { \
@@ -150,6 +149,13 @@ static int print_reg_handler(struct nl_msg *msg, void *arg)
return NL_SKIP;
}
 
+   if (tb_msg[NL80211_ATTR_WIPHY])
+   printf(phy#%d%s\n, nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]),
+  tb_msg[NL80211_ATTR_WIPHY_SELF_MANAGED_REG] ?
+   (self-managed) : );
+   else
+   printf(global\n);
+
if (tb_msg[NL80211_ATTR_DFS_REGION])
dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
else
@@ -216,18 +222,44 @@ static int print_reg_handler(struct nl_msg *msg, void 
*arg)
 
printf(\n);
}
-   return NL_OK;
+
+   printf(\n);
+   return NL_SKIP;
 #undef PARSE_FLAG
 }
 
+static int handle_reg_dump(struct nl80211_state *state,
+  struct nl_cb *cb,
+  struct nl_msg *msg,
+  int argc, char **argv,
+  enum id_input id)
+{
+   nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler, NULL);
+   return 0;
+}
+
 static int handle_reg_get(struct nl80211_state *state,
  struct nl_cb *cb,
  struct nl_msg *msg,
  int argc, char **argv,
  enum id_input id)
 {
-   nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler, NULL);
-   return 0;
+   char *dump_args[] = { reg, dump };
+   int err;
+
+   err = handle_cmd(state, CIB_NONE, 2, dump_args);
+   /* dump might fail since it's not supported on older kernels */
+   if (err == -EOPNOTSUPP) {
+   nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler,
+ NULL);
+   return 0;
+   }
+
+   return err;
 }
 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get,
Print out the kernel's current regulatory domain information.);
+COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_get,
+   Print out the devices' current regulatory domain information.);
+HIDDEN(reg, dump, NULL, NL80211_CMD_GET_REG, NLM_F_DUMP, CIB_NONE,
+   handle_reg_dump);
-- 
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 v8 1/4] cfg80211: allow usermode to query wiphy specific regdom

2014-12-15 Thread Arik Nemtsov
On Fri, Dec 12, 2014 at 2:37 PM, Johannes Berg
johan...@sipsolutions.net wrote:
 On Wed, 2014-12-03 at 18:08 +0200, Arik Nemtsov wrote:

   * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
 - *   regulatory domain.
 + *   regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
 + *   has a private regulatory domain, it will be returned. Otherwise, the
 + *   global regdomain will be returned.
 + *   A device will have a private regulatory domain if it uses the
 + *   regulatory_hint() API. Even when a private regdomain is used the 
 channel
 + *   information will still be mended according to further hints from
 + *   the regulatory core to help with compliance.

 I think you need to document the new availability of the dump version of
 this now.

Sure.


 + if (!regdom  !cfg80211_regdomain) {

 I'm not sure why sparse doesn't warn here, but I think that should
 probably use rcu_access_pointer(cfg80211_regdomain).

 More realistically, the regdomain can never be NULL I think, so is that
 even needed? OTOH, if it can be NULL, then you must make this check
 after the rcu_dereference, which would make this code easier to follow.

You're right. I'll remove the check. I don't see a way where it can be
set to NULL at any point.

Arik
--
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 v8 2/4] cfg80211: allow wiphy specific regdomain management

2014-12-15 Thread Arik Nemtsov
On Fri, Dec 12, 2014 at 2:39 PM, Johannes Berg
johan...@sipsolutions.net wrote:
 On Wed, 2014-12-03 at 18:08 +0200, Arik Nemtsov wrote:

 +void nl80211_send_reg_change_event(struct regulatory_request *request)
 +{
 + nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request);
 +}
 +
 +void nl80211_send_wiphy_reg_change_event(struct regulatory_request *request)
 +{
 + nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, request);
 +}

 These are trivial wrappers, I'd make them inlines.

You mean inline here or in the header header? I'll do it here..

Arik
--
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 v9 1/4] cfg80211: allow usermode to query wiphy specific regdom

2014-12-15 Thread Arik Nemtsov
If a wiphy-idx is specified, the kernel will return the wiphy specific
regdomain, if such exists. Otherwise return the global regdom.

When no wiphy-idx is specified, return the global regdomain as well as
all wiphy-specific regulatory domains in the system, via a new nested
list of attributes.

Add a new attribute for each wiphy-specific regdomain, for usermode to
identify it as such.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
---
 include/uapi/linux/nl80211.h |  10 ++-
 net/wireless/nl80211.c   | 173 ++-
 net/wireless/reg.c   |   2 +-
 net/wireless/reg.h   |   1 +
 4 files changed, 151 insertions(+), 35 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b37bd5a..2d384d0 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -252,7 +252,15 @@
  * %NL80211_ATTR_IFINDEX.
  *
  * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
- * regulatory domain.
+ * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
+ * has a private regulatory domain, it will be returned. Otherwise, the
+ * global regdomain will be returned.
+ * A device will have a private regulatory domain if it uses the
+ * regulatory_hint() API. Even when a private regdomain is used the channel
+ * information will still be mended according to further hints from
+ * the regulatory core to help with compliance. A dump version of this API
+ * is now available which will returns the global regdomain as well as
+ * all private regdomains of present wiphys (for those that have it).
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  * after being queried by the kernel. CRDA replies by sending a regulatory
  * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a17d6bc..2d5dc42 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5327,42 +5327,20 @@ static int nl80211_update_mesh_config(struct sk_buff 
*skb,
return err;
 }
 
-static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info)
+static int nl80211_put_regdom(const struct ieee80211_regdomain *regdom,
+ struct sk_buff *msg)
 {
-   const struct ieee80211_regdomain *regdom;
-   struct sk_buff *msg;
-   void *hdr = NULL;
struct nlattr *nl_reg_rules;
unsigned int i;
 
-   if (!cfg80211_regdomain)
-   return -EINVAL;
-
-   msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
-   if (!msg)
-   return -ENOBUFS;
-
-   hdr = nl80211hdr_put(msg, info-snd_portid, info-snd_seq, 0,
-NL80211_CMD_GET_REG);
-   if (!hdr)
-   goto put_failure;
-
-   if (reg_last_request_cell_base() 
-   nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE,
-   NL80211_USER_REG_HINT_CELL_BASE))
-   goto nla_put_failure;
-
-   rcu_read_lock();
-   regdom = rcu_dereference(cfg80211_regdomain);
-
if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, regdom-alpha2) ||
(regdom-dfs_region 
 nla_put_u8(msg, NL80211_ATTR_DFS_REGION, regdom-dfs_region)))
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES);
if (!nl_reg_rules)
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
for (i = 0; i  regdom-n_reg_rules; i++) {
struct nlattr *nl_reg_rule;
@@ -5377,7 +5355,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct 
genl_info *info)
 
nl_reg_rule = nla_nest_start(msg, i);
if (!nl_reg_rule)
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
max_bandwidth_khz = freq_range-max_bandwidth_khz;
if (!max_bandwidth_khz)
@@ -5398,13 +5376,64 @@ static int nl80211_get_reg(struct sk_buff *skb, struct 
genl_info *info)
power_rule-max_eirp) ||
nla_put_u32(msg, NL80211_ATTR_DFS_CAC_TIME,
reg_rule-dfs_cac_ms))
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
nla_nest_end(msg, nl_reg_rule);
}
-   rcu_read_unlock();
 
nla_nest_end(msg, nl_reg_rules);
+   return 0;
+
+nla_put_failure:
+   return -EMSGSIZE;
+}
+
+static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
+{
+   const struct ieee80211_regdomain *regdom = NULL;
+   struct cfg80211_registered_device *rdev;
+   struct wiphy *wiphy = NULL;
+   struct sk_buff *msg;
+   void *hdr;
+
+   msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);

[PATCH v9 3/4] cfg80211: return private regdom for self-managed devices

2014-12-15 Thread Arik Nemtsov
If a device has self-managed regulatory, insist on returning the wiphy
specific regdomain if a wiphy-idx is specified. The global regdomain is
meaningless for such devices.

Also add an attribute for self-managed devices, so usermode can
distinguish them as such.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
Reviewed-by: Luis R. Rodriguez mcg...@suse.com
---
 include/uapi/linux/nl80211.h | 10 ++
 net/wireless/nl80211.c   | 24 
 2 files changed, 34 insertions(+)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fb58e65..b3ada0b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -261,6 +261,9 @@
  * the regulatory core to help with compliance. A dump version of this API
  * is now available which will returns the global regdomain as well as
  * all private regdomains of present wiphys (for those that have it).
+ * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then
+ * its private regdomain is the only valid one for it. The regulatory
+ * core is not used to help with compliance in this case.
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  * after being queried by the kernel. CRDA replies by sending a regulatory
  * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
@@ -1702,6 +1705,11 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_MAC_MASK: MAC address mask
  *
+ * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device
+ * is self-managing its regulatory information and any regulatory domain
+ * obtained from it is coming from the device's wiphy and not the global
+ * cfg80211 regdomain.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2059,6 +2067,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_MAC_MASK,
 
+   NL80211_ATTR_WIPHY_SELF_MANAGED_REG,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c04a934..3d972c2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -396,6 +396,7 @@ static const struct nla_policy 
nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
[NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
[NL80211_ATTR_MAC_MASK] = { .len = ETH_ALEN },
+   [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG },
 };
 
 /* policy for the key attributes */
@@ -1701,6 +1702,10 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
   rdev-wiphy.max_num_csa_counters))
goto nla_put_failure;
 
+   if (rdev-wiphy.regulatory_flags  
REGULATORY_WIPHY_SELF_MANAGED 
+   nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
+   goto nla_put_failure;
+
/* done */
state-split_start = 0;
break;
@@ -5406,6 +5411,8 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct 
genl_info *info)
goto put_failure;
 
if (info-attrs[NL80211_ATTR_WIPHY]) {
+   bool self_managed;
+
rdev = cfg80211_get_dev_from_info(genl_info_net(info), info);
if (IS_ERR(rdev)) {
nlmsg_free(msg);
@@ -5413,8 +5420,16 @@ static int nl80211_get_reg_do(struct sk_buff *skb, 
struct genl_info *info)
}
 
wiphy = rdev-wiphy;
+   self_managed = wiphy-regulatory_flags 
+  REGULATORY_WIPHY_SELF_MANAGED;
regdom = get_wiphy_regdom(wiphy);
 
+   /* a self-managed-reg device must have a private regdom */
+   if (WARN_ON(!regdom  self_managed)) {
+   nlmsg_free(msg);
+   return -EINVAL;
+   }
+
if (regdom 
nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)))
goto nla_put_failure;
@@ -5471,6 +5486,10 @@ static int nl80211_send_regdom(struct sk_buff *msg, 
struct netlink_callback *cb,
nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)))
goto nla_put_failure;
 
+   if (wiphy  wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED 
+   nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
+   goto nla_put_failure;
+
return genlmsg_end(msg, hdr);
 
 nla_put_failure:
@@ -11076,6 +11095,11 @@ static bool nl80211_reg_change_event_fill(struct 
sk_buff *msg,
if (wiphy 
nla_put_u32(msg, NL80211_ATTR_WIPHY, request-wiphy_idx))
goto nla_put_failure;
+
+   if (wiphy 
+ 

[PATCH v9 4/4] cfg80211: avoid intersection when applying self-managed reg

2014-12-15 Thread Arik Nemtsov
The custom-reg handling function can currently only add flags to a given
channel. This results in stale flags being left applied. In some cases
a channel was disabled and even the orig_flags were changed to reflect
this.

Previously the API was designed for a single invocation before wiphy
registration, so this didn't matter. The previous approach doesn't scale
well to self-managed regulatory devices, particularly when a more
permissive regdom is applied after a restrictive one.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
---
 net/wireless/reg.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 87ef745..8aaff02 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1686,8 +1686,12 @@ static void handle_channel_custom(struct wiphy *wiphy,
if (IS_ERR(reg_rule)) {
REG_DBG_PRINT(Disabling freq %d MHz as custom regd has no rule 
that fits it\n,
  chan-center_freq);
-   chan-orig_flags |= IEEE80211_CHAN_DISABLED;
-   chan-flags = chan-orig_flags;
+   if (wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED) {
+   chan-flags |= IEEE80211_CHAN_DISABLED;
+   } else {
+   chan-orig_flags |= IEEE80211_CHAN_DISABLED;
+   chan-flags = chan-orig_flags;
+   }
return;
}
 
@@ -1712,7 +1716,13 @@ static void handle_channel_custom(struct wiphy *wiphy,
chan-dfs_state = NL80211_DFS_USABLE;
 
chan-beacon_found = false;
-   chan-flags |= map_regdom_flags(reg_rule-flags) | bw_flags;
+
+   if (wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED)
+   chan-flags = chan-orig_flags | bw_flags |
+ map_regdom_flags(reg_rule-flags);
+   else
+   chan-flags |= map_regdom_flags(reg_rule-flags) | bw_flags;
+
chan-max_antenna_gain = (int) MBI_TO_DBI(power_rule-max_antenna_gain);
chan-max_reg_power = chan-max_power =
(int) MBM_TO_DBM(power_rule-max_eirp);
-- 
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 v9 2/4] cfg80211: allow wiphy specific regdomain management

2014-12-15 Thread Arik Nemtsov
From: Jonathan Doron j...@wizery.com

Add a new regulatory flag that allows a driver to manage regdomain
changes/updates for its own wiphy.
A self-managed wiphys only employs regulatory information obtained from
the FW and driver and does not use other cfg80211 sources like
beacon-hints, country-code IEs and hints from other devices on the same
system. Conversely, a self-managed wiphy does not share its regulatory
hints with other devices in the system. If a system contains several
devices, one or more of which are self-managed, there might be
contradictory regulatory settings between them. Usage of flag is
generally discouraged. Only use it if the FW/driver is incompatible
with non-locally originated hints.

A new API lets the driver send a complete regdomain, to be applied on
its wiphy only.

After a wiphy-specific regdomain change takes place, usermode will get
a new type of change notification. The regulatory core also takes care
enforce regulatory restrictions, in case some interfaces are on
forbidden channels.

Signed-off-by: Jonathan Doron jonathanx.do...@intel.com
Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
Reviewed-by: Luis R. Rodriguez mcg...@suse.com
---
 include/net/cfg80211.h   | 14 +++
 include/net/regulatory.h | 19 ++
 include/uapi/linux/nl80211.h |  6 +++
 net/wireless/core.c  |  8 
 net/wireless/core.h  |  7 
 net/wireless/nl80211.c   | 60 +-
 net/wireless/nl80211.h   |  1 +
 net/wireless/reg.c   | 88 
 8 files changed, 185 insertions(+), 18 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 4ebb816..4bc1fc9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3808,6 +3808,20 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 
oui_type,
 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
 
 /**
+ * regulatory_set_wiphy_regd - set regdom info for self managed drivers
+ * @wiphy: the wireless device we want to process the regulatory domain on
+ * @rd: the regulatory domain informatoin to use for this wiphy
+ *
+ * Set the regulatory domain information for self-managed wiphys, only they
+ * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
+ * information.
+ *
+ * Return: 0 on success. -EINVAL, -EPERM
+ */
+int regulatory_set_wiphy_regd(struct wiphy *wiphy,
+ struct ieee80211_regdomain *rd);
+
+/**
  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  * @wiphy: the wireless device we want to process the regulatory domain on
  * @regd: the custom regulatory domain to use for this wiphy
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index b776d72..ebc5a2e 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -147,6 +147,24 @@ struct regulatory_request {
  * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
  * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
  * includes any modes unsupported for enforcement checking.
+ * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
+ * regdom management. These devices will ignore all regdom changes not
+ * originating from their own wiphy.
+ * A self-managed wiphys only employs regulatory information obtained from
+ * the FW and driver and does not use other cfg80211 sources like
+ * beacon-hints, country-code IEs and hints from other devices on the same
+ * system. Conversely, a self-managed wiphy does not share its regulatory
+ * hints with other devices in the system. If a system contains several
+ * devices, one or more of which are self-managed, there might be
+ * contradictory regulatory settings between them. Usage of flag is
+ * generally discouraged. Only use it if the FW/driver is incompatible
+ * with non-locally originated hints.
+ * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG,
+ * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER,
+ * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS.
+ * Mixing any of the above flags with this flag will result in a failure
+ * to register the wiphy. This flag implies
+ * %REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE.
  */
 enum ieee80211_regulatory_flags {
REGULATORY_CUSTOM_REG   = BIT(0),
@@ -156,6 +174,7 @@ enum ieee80211_regulatory_flags {
REGULATORY_COUNTRY_IE_IGNORE= BIT(4),
REGULATORY_ENABLE_RELAX_NO_IR   = BIT(5),
REGULATORY_IGNORE_STALE_KICKOFF = BIT(6),
+   REGULATORY_WIPHY_SELF_MANAGED   = BIT(7),
 };
 
 struct ieee80211_freq_range {
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 2d384d0..fb58e65 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -782,6 

[PATCH v10 1/4] cfg80211: allow usermode to query wiphy specific regdom

2014-12-15 Thread Arik Nemtsov
If a wiphy-idx is specified, the kernel will return the wiphy specific
regdomain, if such exists. Otherwise return the global regdom.

When no wiphy-idx is specified, return the global regdomain as well as
all wiphy-specific regulatory domains in the system, via a new nested
list of attributes.

Add a new attribute for each wiphy-specific regdomain, for usermode to
identify it as such.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
---
 include/uapi/linux/nl80211.h |  10 ++-
 net/wireless/nl80211.c   | 173 ++-
 net/wireless/reg.c   |   2 +-
 net/wireless/reg.h   |   1 +
 4 files changed, 151 insertions(+), 35 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b37bd5a..2d384d0 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -252,7 +252,15 @@
  * %NL80211_ATTR_IFINDEX.
  *
  * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
- * regulatory domain.
+ * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
+ * has a private regulatory domain, it will be returned. Otherwise, the
+ * global regdomain will be returned.
+ * A device will have a private regulatory domain if it uses the
+ * regulatory_hint() API. Even when a private regdomain is used the channel
+ * information will still be mended according to further hints from
+ * the regulatory core to help with compliance. A dump version of this API
+ * is now available which will returns the global regdomain as well as
+ * all private regdomains of present wiphys (for those that have it).
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  * after being queried by the kernel. CRDA replies by sending a regulatory
  * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a17d6bc..2d5dc42 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5327,42 +5327,20 @@ static int nl80211_update_mesh_config(struct sk_buff 
*skb,
return err;
 }
 
-static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info)
+static int nl80211_put_regdom(const struct ieee80211_regdomain *regdom,
+ struct sk_buff *msg)
 {
-   const struct ieee80211_regdomain *regdom;
-   struct sk_buff *msg;
-   void *hdr = NULL;
struct nlattr *nl_reg_rules;
unsigned int i;
 
-   if (!cfg80211_regdomain)
-   return -EINVAL;
-
-   msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
-   if (!msg)
-   return -ENOBUFS;
-
-   hdr = nl80211hdr_put(msg, info-snd_portid, info-snd_seq, 0,
-NL80211_CMD_GET_REG);
-   if (!hdr)
-   goto put_failure;
-
-   if (reg_last_request_cell_base() 
-   nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE,
-   NL80211_USER_REG_HINT_CELL_BASE))
-   goto nla_put_failure;
-
-   rcu_read_lock();
-   regdom = rcu_dereference(cfg80211_regdomain);
-
if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, regdom-alpha2) ||
(regdom-dfs_region 
 nla_put_u8(msg, NL80211_ATTR_DFS_REGION, regdom-dfs_region)))
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES);
if (!nl_reg_rules)
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
for (i = 0; i  regdom-n_reg_rules; i++) {
struct nlattr *nl_reg_rule;
@@ -5377,7 +5355,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct 
genl_info *info)
 
nl_reg_rule = nla_nest_start(msg, i);
if (!nl_reg_rule)
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
max_bandwidth_khz = freq_range-max_bandwidth_khz;
if (!max_bandwidth_khz)
@@ -5398,13 +5376,64 @@ static int nl80211_get_reg(struct sk_buff *skb, struct 
genl_info *info)
power_rule-max_eirp) ||
nla_put_u32(msg, NL80211_ATTR_DFS_CAC_TIME,
reg_rule-dfs_cac_ms))
-   goto nla_put_failure_rcu;
+   goto nla_put_failure;
 
nla_nest_end(msg, nl_reg_rule);
}
-   rcu_read_unlock();
 
nla_nest_end(msg, nl_reg_rules);
+   return 0;
+
+nla_put_failure:
+   return -EMSGSIZE;
+}
+
+static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
+{
+   const struct ieee80211_regdomain *regdom = NULL;
+   struct cfg80211_registered_device *rdev;
+   struct wiphy *wiphy = NULL;
+   struct sk_buff *msg;
+   void *hdr;
+
+   msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);

[PATCH v10 4/4] cfg80211: avoid intersection when applying self-managed reg

2014-12-15 Thread Arik Nemtsov
The custom-reg handling function can currently only add flags to a given
channel. This results in stale flags being left applied. In some cases
a channel was disabled and even the orig_flags were changed to reflect
this.

Previously the API was designed for a single invocation before wiphy
registration, so this didn't matter. The previous approach doesn't scale
well to self-managed regulatory devices, particularly when a more
permissive regdom is applied after a restrictive one.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
---
 net/wireless/reg.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 87ef745..8aaff02 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1686,8 +1686,12 @@ static void handle_channel_custom(struct wiphy *wiphy,
if (IS_ERR(reg_rule)) {
REG_DBG_PRINT(Disabling freq %d MHz as custom regd has no rule 
that fits it\n,
  chan-center_freq);
-   chan-orig_flags |= IEEE80211_CHAN_DISABLED;
-   chan-flags = chan-orig_flags;
+   if (wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED) {
+   chan-flags |= IEEE80211_CHAN_DISABLED;
+   } else {
+   chan-orig_flags |= IEEE80211_CHAN_DISABLED;
+   chan-flags = chan-orig_flags;
+   }
return;
}
 
@@ -1712,7 +1716,13 @@ static void handle_channel_custom(struct wiphy *wiphy,
chan-dfs_state = NL80211_DFS_USABLE;
 
chan-beacon_found = false;
-   chan-flags |= map_regdom_flags(reg_rule-flags) | bw_flags;
+
+   if (wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED)
+   chan-flags = chan-orig_flags | bw_flags |
+ map_regdom_flags(reg_rule-flags);
+   else
+   chan-flags |= map_regdom_flags(reg_rule-flags) | bw_flags;
+
chan-max_antenna_gain = (int) MBI_TO_DBI(power_rule-max_antenna_gain);
chan-max_reg_power = chan-max_power =
(int) MBM_TO_DBM(power_rule-max_eirp);
-- 
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 v10 3/4] cfg80211: return private regdom for self-managed devices

2014-12-15 Thread Arik Nemtsov
If a device has self-managed regulatory, insist on returning the wiphy
specific regdomain if a wiphy-idx is specified. The global regdomain is
meaningless for such devices.

Also add an attribute for self-managed devices, so usermode can
distinguish them as such.

Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
Reviewed-by: Luis R. Rodriguez mcg...@suse.com
---
 include/uapi/linux/nl80211.h | 10 ++
 net/wireless/nl80211.c   | 24 
 2 files changed, 34 insertions(+)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fb58e65..b3ada0b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -261,6 +261,9 @@
  * the regulatory core to help with compliance. A dump version of this API
  * is now available which will returns the global regdomain as well as
  * all private regdomains of present wiphys (for those that have it).
+ * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then
+ * its private regdomain is the only valid one for it. The regulatory
+ * core is not used to help with compliance in this case.
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  * after being queried by the kernel. CRDA replies by sending a regulatory
  * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
@@ -1702,6 +1705,11 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_MAC_MASK: MAC address mask
  *
+ * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device
+ * is self-managing its regulatory information and any regulatory domain
+ * obtained from it is coming from the device's wiphy and not the global
+ * cfg80211 regdomain.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2059,6 +2067,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_MAC_MASK,
 
+   NL80211_ATTR_WIPHY_SELF_MANAGED_REG,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eebb7e4..5b1907f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -396,6 +396,7 @@ static const struct nla_policy 
nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
[NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
[NL80211_ATTR_MAC_MASK] = { .len = ETH_ALEN },
+   [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG },
 };
 
 /* policy for the key attributes */
@@ -1701,6 +1702,10 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
   rdev-wiphy.max_num_csa_counters))
goto nla_put_failure;
 
+   if (rdev-wiphy.regulatory_flags  
REGULATORY_WIPHY_SELF_MANAGED 
+   nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
+   goto nla_put_failure;
+
/* done */
state-split_start = 0;
break;
@@ -5406,6 +5411,8 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct 
genl_info *info)
goto put_failure;
 
if (info-attrs[NL80211_ATTR_WIPHY]) {
+   bool self_managed;
+
rdev = cfg80211_get_dev_from_info(genl_info_net(info), info);
if (IS_ERR(rdev)) {
nlmsg_free(msg);
@@ -5413,8 +5420,16 @@ static int nl80211_get_reg_do(struct sk_buff *skb, 
struct genl_info *info)
}
 
wiphy = rdev-wiphy;
+   self_managed = wiphy-regulatory_flags 
+  REGULATORY_WIPHY_SELF_MANAGED;
regdom = get_wiphy_regdom(wiphy);
 
+   /* a self-managed-reg device must have a private regdom */
+   if (WARN_ON(!regdom  self_managed)) {
+   nlmsg_free(msg);
+   return -EINVAL;
+   }
+
if (regdom 
nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)))
goto nla_put_failure;
@@ -5471,6 +5486,10 @@ static int nl80211_send_regdom(struct sk_buff *msg, 
struct netlink_callback *cb,
nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)))
goto nla_put_failure;
 
+   if (wiphy  wiphy-regulatory_flags  REGULATORY_WIPHY_SELF_MANAGED 
+   nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
+   goto nla_put_failure;
+
return genlmsg_end(msg, hdr);
 
 nla_put_failure:
@@ -11076,6 +11095,11 @@ static bool nl80211_reg_change_event_fill(struct 
sk_buff *msg,
if (wiphy 
nla_put_u32(msg, NL80211_ATTR_WIPHY, request-wiphy_idx))
goto nla_put_failure;
+
+   if (wiphy 
+ 

[PATCH v10 2/4] cfg80211: allow wiphy specific regdomain management

2014-12-15 Thread Arik Nemtsov
From: Jonathan Doron j...@wizery.com

Add a new regulatory flag that allows a driver to manage regdomain
changes/updates for its own wiphy.
A self-managed wiphys only employs regulatory information obtained from
the FW and driver and does not use other cfg80211 sources like
beacon-hints, country-code IEs and hints from other devices on the same
system. Conversely, a self-managed wiphy does not share its regulatory
hints with other devices in the system. If a system contains several
devices, one or more of which are self-managed, there might be
contradictory regulatory settings between them. Usage of flag is
generally discouraged. Only use it if the FW/driver is incompatible
with non-locally originated hints.

A new API lets the driver send a complete regdomain, to be applied on
its wiphy only.

After a wiphy-specific regdomain change takes place, usermode will get
a new type of change notification. The regulatory core also takes care
enforce regulatory restrictions, in case some interfaces are on
forbidden channels.

Signed-off-by: Jonathan Doron jonathanx.do...@intel.com
Signed-off-by: Arik Nemtsov arikx.nemt...@intel.com
Reviewed-by: Luis R. Rodriguez mcg...@suse.com
---
v10: making the functions inline in the header ;)

 include/net/cfg80211.h   | 14 +++
 include/net/regulatory.h | 19 ++
 include/uapi/linux/nl80211.h |  6 +++
 net/wireless/core.c  |  8 
 net/wireless/core.h  |  7 
 net/wireless/nl80211.c   | 49 +++-
 net/wireless/nl80211.h   | 16 +++-
 net/wireless/reg.c   | 88 
 8 files changed, 188 insertions(+), 19 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 4ebb816..4bc1fc9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3808,6 +3808,20 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 
oui_type,
 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
 
 /**
+ * regulatory_set_wiphy_regd - set regdom info for self managed drivers
+ * @wiphy: the wireless device we want to process the regulatory domain on
+ * @rd: the regulatory domain informatoin to use for this wiphy
+ *
+ * Set the regulatory domain information for self-managed wiphys, only they
+ * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
+ * information.
+ *
+ * Return: 0 on success. -EINVAL, -EPERM
+ */
+int regulatory_set_wiphy_regd(struct wiphy *wiphy,
+ struct ieee80211_regdomain *rd);
+
+/**
  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  * @wiphy: the wireless device we want to process the regulatory domain on
  * @regd: the custom regulatory domain to use for this wiphy
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index b776d72..ebc5a2e 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -147,6 +147,24 @@ struct regulatory_request {
  * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
  * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
  * includes any modes unsupported for enforcement checking.
+ * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
+ * regdom management. These devices will ignore all regdom changes not
+ * originating from their own wiphy.
+ * A self-managed wiphys only employs regulatory information obtained from
+ * the FW and driver and does not use other cfg80211 sources like
+ * beacon-hints, country-code IEs and hints from other devices on the same
+ * system. Conversely, a self-managed wiphy does not share its regulatory
+ * hints with other devices in the system. If a system contains several
+ * devices, one or more of which are self-managed, there might be
+ * contradictory regulatory settings between them. Usage of flag is
+ * generally discouraged. Only use it if the FW/driver is incompatible
+ * with non-locally originated hints.
+ * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG,
+ * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER,
+ * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS.
+ * Mixing any of the above flags with this flag will result in a failure
+ * to register the wiphy. This flag implies
+ * %REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE.
  */
 enum ieee80211_regulatory_flags {
REGULATORY_CUSTOM_REG   = BIT(0),
@@ -156,6 +174,7 @@ enum ieee80211_regulatory_flags {
REGULATORY_COUNTRY_IE_IGNORE= BIT(4),
REGULATORY_ENABLE_RELAX_NO_IR   = BIT(5),
REGULATORY_IGNORE_STALE_KICKOFF = BIT(6),
+   REGULATORY_WIPHY_SELF_MANAGED   = BIT(7),
 };
 
 struct ieee80211_freq_range {
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 2d384d0..fb58e65 100644
--- a/include/uapi/linux/nl80211.h

Re: pull request: bluetooth 2014-12-12

2014-12-15 Thread John W. Linville
On Fri, Dec 12, 2014 at 07:44:35PM +0200, Johan Hedberg wrote:
 Hi John,
 
 These fixes are intended for 3.19, note that the tree to pull from is
 bluetooth-next (unlike the subject implies). I'd have normally done a
 pull request from bluetooth.git, but since these fixes for 3.19 is all
 we have so far I thought it's simpler if you just pull from our -next
 tree. The patches consist of:
 
  - Coccinelle warning fix
  - hci_dev_lock/unlock fixes
  - Fixes for pending mgmt command handling
  - Fixes for properly following the force_lesc_support switch
  - Fix for a Microsoft branded Broadcom adapter
  - New device id for Atheros AR3012
  - Fix for BR/EDR Secure Connections enabling
 
 Please let me know if there are any issues pulling. Thanks.
 
 Johan
 
 ---
 The following changes since commit 5a34bd5f5d8119def4feb1d2b4e3906b71059416:
 
   Bluetooth: Enable events for P-256 Public Key and DHKey commands 
 (2014-12-05 18:17:49 +0200)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git 
 for-upstream
 
 for you to fetch changes up to 9845904fd489288bcf693642c1b31cc463c0b660:
 
   Bluetooth: Fix mgmt response status when removing adapter (2014-12-12 
 13:20:12 +0100)

Pulling now...

-- 
John W. LinvilleSomeday the world will need a hero, and you
linvi...@tuxdriver.com  might be all we have.  Be ready.
--
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 v8 2/4] cfg80211: allow wiphy specific regdomain management

2014-12-15 Thread Johannes Berg
On Mon, 2014-12-15 at 19:12 +0200, Arik Nemtsov wrote:
 On Fri, Dec 12, 2014 at 2:39 PM, Johannes Berg
 johan...@sipsolutions.net wrote:
  On Wed, 2014-12-03 at 18:08 +0200, Arik Nemtsov wrote:
 
  +void nl80211_send_reg_change_event(struct regulatory_request *request)
  +{
  + nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request);
  +}
  +
  +void nl80211_send_wiphy_reg_change_event(struct regulatory_request 
  *request)
  +{
  + nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, 
  request);
  +}
 
  These are trivial wrappers, I'd make them inlines.
 
 You mean inline here or in the header header? I'll do it here..

Inline here makes no sense since it's declared in the header - it'd have
to be in the header.

johannes

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


Re: [PATCH] ath: fix incorrect PPB on FCC radar type 5

2014-12-15 Thread Felix Fietkau
On 2014-12-15 19:55, Peter Oh wrote:
 The minimum number of pulses per burst on FCC radar type 5 is 1.
 Use this number for correct radar detection.
 
 Signed-off-by: Peter Oh p...@qca.qualcomm.com
 ---
  drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c 
 b/drivers/net/wireless/ath/dfs_pattern_detector.c
 index cfd0554..3d57f87 100644
 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c
 +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
 @@ -86,7 +86,7 @@ static const struct radar_detector_specs 
 fcc_radar_ref_types[] = {
   FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
   FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
   FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
 - FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20),
 + FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 1),
Won't that significantly increase the false positive rate?
Here's the previous change on that pattern:

commit 562930f8baee7a1cb5b9f382b4338c9b6fbf1139
Author: Vivek Natarajan natar...@qti.qualcomm.com
Date:   Mon Nov 24 17:26:22 2014 +0530

ath: Fix a false radar detection pattern

For FCC and JP, in one of the radar patterns, PPB and PRF seems to be
interchanged leading to frequent incorrect radar detections.

Signed-off-by: Vivek Natarajan natar...@qti.qualcomm.com
Signed-off-by: John W. Linville linvi...@tuxdriver.com

diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c 
b/drivers/net/wireless/ath/dfs_pattern_detector.c
index 650be79..cfd0554 100644
--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
@@ -86,7 +86,7 @@ static const struct radar_detector_specs 
fcc_radar_ref_types[] = {
FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
-   FCC_PATTERN(4, 50, 100, 1000, 2000, 20, 1),
+   FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20),
FCC_PATTERN(5, 0, 1, 333, 333, 1, 9),
 };
 
@@ -105,7 +105,7 @@ static const struct radar_detector_specs 
jp_radar_ref_types[] = {
JP_PATTERN(4, 0, 5, 150, 230, 1, 23),
JP_PATTERN(5, 6, 10, 200, 500, 1, 16),
JP_PATTERN(6, 11, 20, 200, 500, 1, 12),
-   JP_PATTERN(7, 50, 100, 1000, 2000, 20, 1),
+   JP_PATTERN(7, 50, 100, 1000, 2000, 1, 20),
JP_PATTERN(5, 0, 1, 333, 333, 1, 9),
 };
--
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] staging: rtl8723au: os_dep: usb_intf.c: Fix for possible null pointer dereference

2014-12-15 Thread Rickard Strandqvist
Hi

No the rtw_hw_resume23a() is not used anywhere.
I also do a check of all functions that are not used, but not in the
drivers/staging, I suspected that these might be under development and
used in the future.

What do you want to do, who decides?


Kind regards
Rickard Strandqvist


2014-12-15 16:48 GMT+01:00 Jes Sorensen jes.soren...@redhat.com:
 Dan Carpenter dan.carpen...@oracle.com writes:
 On Sun, Dec 14, 2014 at 11:39:14PM +0100, Rickard Strandqvist wrote:
 There is otherwise a risk of a possible null pointer dereference.

 Was largely found by using a static code analysis program called cppcheck.

 Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
 ---
  drivers/staging/rtl8723au/os_dep/usb_intf.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c
 b/drivers/staging/rtl8723au/os_dep/usb_intf.c
 index 865743e..71a6330 100644
 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c
 +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c
 @@ -351,10 +351,11 @@ error_exit:
  int rtw_hw_resume23a(struct rtw_adapter *padapter)

 That's weird.  Is this function even called?

 [jes@ultrasam jes.git]$ find drivers/staging/rtl8723au -name \*.[ch] |xargs 
 grep rtw_hw_resume
 drivers/staging/rtl8723au/include/osdep_intf.h:int rtw_hw_resume23a(struct 
 rtw_adapter *padapter);
 drivers/staging/rtl8723au/os_dep/usb_intf.c:int rtw_hw_resume23a(struct 
 rtw_adapter *padapter)
 drivers/staging/rtl8723au/os_dep/usb_intf.c:DBG_8723A(== 
 rtw_hw_resume23a\n);
 [jes@ultrasam jes.git]$ find drivers/staging/rtl8723au -name \*.[ch] |xargs 
 grep rtw_hw_suspend
 drivers/staging/rtl8723au/include/osdep_intf.h:int rtw_hw_suspend23a(struct 
 rtw_adapter *padapter);
 drivers/staging/rtl8723au/os_dep/usb_intf.c:int rtw_hw_suspend23a(struct 
 rtw_adapter *padapter)
 drivers/staging/rtl8723au/os_dep/usb_intf.c:DBG_8723A(== 
 rtw_hw_suspend23a\n);

 A more useful patch would be one removing those two functions IMHO.

 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] mac80211: add an intermediate software queue implementation

2014-12-15 Thread Bartosz Szczepanek
As for drv_wake_tx_queue and ieee80211_tx_dequeue - is it really
necessary? There are ieee80211_tx_status and ieee80211_free_txskb
already, which can be used to decide from mac80211 level when to
dequeue packet. It could be used even in case of drivers that are not
aware of new mechanism at all. We could compute difference between
drv_tx and tx_status/free_txskb calls, therefore getting number of
frames in HW. What could help us to keep queues short.

I've already written some code. This http://pastebin.com/dSd1zWt7 is
patch that implements counter of frames in hardware in the way
described above. It was necessary to differentiate between free_txskb
and free_txskb. Information about frames in HW is exported to debugfs.
I thought I could submit it, but just now did I found this thread, so
I hope that it's adequate place to propose that. I tested it on ath5k
and brcmsmac.

One more thing - why not to use local-pending for holding packets?
There is tx_pending tasklet already. I'm not sure if I understand the
idea of local-pending queues correctly, but it seems to be a bit
incoherent to have both pending and proposed ieee80211_txq.

(It's my first post on linux kernel mailing list. Please, let me know
if I did something wrong.)

Best regards.

2014-12-15 13:00 GMT+01:00 Johannes Berg johan...@sipsolutions.net:
 On Fri, 2014-12-12 at 15:28 +0100, Felix Fietkau wrote:

  Management (and maybe control) frames can have different priorities as
  well, this is only used for something with TDLS now I think though.
 With my implementation, those would go through the normal tx codepath,
 bypassing the software tx queues. Can you think of anything else that
 would need per-AC vif queues?

 Not off the top of my head. I just didn't even quite understand that you
 were still using the normal tx path

 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
--
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] ath: fix incorrect PPB on FCC radar type 5

2014-12-15 Thread Peter Oh


On 12/15/2014 12:42 PM, Felix Fietkau wrote:

On 2014-12-15 19:55, Peter Oh wrote:

The minimum number of pulses per burst on FCC radar type 5 is 1.
Use this number for correct radar detection.

Signed-off-by: Peter Oh p...@qca.qualcomm.com
---
  drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c 
b/drivers/net/wireless/ath/dfs_pattern_detector.c
index cfd0554..3d57f87 100644
--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
@@ -86,7 +86,7 @@ static const struct radar_detector_specs 
fcc_radar_ref_types[] = {
FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
-   FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20),
+   FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 1),

Won't that significantly increase the false positive rate?
No. FCC type 5 radar's PPB is in between 1~3 and DFS simulators such as 
VeriWave machine pick one among the number (typically 1), hence to 
detect the type 5 radar we should pick the minimum number which is 1 
unless we won't detect the radar if pulse comes only once.

Here's the previous change on that pattern:

Actually their assumption (?) on FCC is incorrect.
PPB and PRF was not interchanged, the previous parameters simply picked 
wrong PRF for FCC instead (FCC type 5 radar's PRF is 1).
For Japan those parameters look quite different from what I've seen from 
Japan's Communications Ministry (MIC, 
www.tele.soumu.go.jp/e/sys/equ/tech/5ghz/5ghz.htm), but I couldn't say 
if it's correct or not at this moment since I haven't run DFS on Japan yet.

commit 562930f8baee7a1cb5b9f382b4338c9b6fbf1139
Author: Vivek Natarajan natar...@qti.qualcomm.com
Date:   Mon Nov 24 17:26:22 2014 +0530

 ath: Fix a false radar detection pattern
 
 For FCC and JP, in one of the radar patterns, PPB and PRF seems to be

 interchanged leading to frequent incorrect radar detections.
 
 Signed-off-by: Vivek Natarajan natar...@qti.qualcomm.com

 Signed-off-by: John W. Linville linvi...@tuxdriver.com

diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c 
b/drivers/net/wireless/ath/dfs_pattern_detector.c
index 650be79..cfd0554 100644
--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
@@ -86,7 +86,7 @@ static const struct radar_detector_specs 
fcc_radar_ref_types[] = {
 FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
 FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
 FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
-   FCC_PATTERN(4, 50, 100, 1000, 2000, 20, 1),
+   FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20),
 FCC_PATTERN(5, 0, 1, 333, 333, 1, 9),
  };
  
@@ -105,7 +105,7 @@ static const struct radar_detector_specs jp_radar_ref_types[] = {

 JP_PATTERN(4, 0, 5, 150, 230, 1, 23),
 JP_PATTERN(5, 6, 10, 200, 500, 1, 16),
 JP_PATTERN(6, 11, 20, 200, 500, 1, 12),
-   JP_PATTERN(7, 50, 100, 1000, 2000, 20, 1),
+   JP_PATTERN(7, 50, 100, 1000, 2000, 1, 20),
 JP_PATTERN(5, 0, 1, 333, 333, 1, 9),
  };


--
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] Staging: rtl8723au: core: rtw_ap: checkpatch.pl fixes

2014-12-15 Thread Greg KH
On Mon, Dec 15, 2014 at 06:26:09PM -0500, Joe Borg wrote:
 Fixing errors found with checkpatch.pl.

What exact errors?  Please be specific here and describe what you are
doing.

thanks,

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


Re: [PATCH] staging: rtl8723au: os_dep: usb_intf.c: Fix for possible null pointer dereference

2014-12-15 Thread Larry Finger

On 12/15/2014 05:01 PM, Rickard Strandqvist wrote:

Hi

No the rtw_hw_resume23a() is not used anywhere.
I also do a check of all functions that are not used, but not in the
drivers/staging, I suspected that these might be under development and
used in the future.

What do you want to do, who decides?


The original developers of this code do not include any of the Linux 
maintainers. If you see an unused routine, submit a patch to delete it. If a 
maintainer thinks it should be kept, your patch will be NACKed, but that is pnot 
likely.


Larry


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


[PATCH v5] mac80211: keep sending peer candidate events while in listen state

2014-12-15 Thread Nishikawa, Kenzoh
Instead of sending peer candidate events just once, send them as long as the 
peer remains in the LISTEN state in the peering state machine, when userspace 
is implementing the peering manager.
Userspace may silence the events from a peer by progressing the state machine 
or by setting the link state to BLOCKED.

Fixes the problem that a mesh peering process won't be fired again after the 
previous first peering trial fails due to like air propagation error if the 
peering is managed by user space such as wpa_supplicant.

This patch works with another patch for wpa_supplicant described here which 
fires a peering process again triggered by the notice from kernel.
http://lists.shmoo.com/pipermail/hostap/2014-November/031235.html

Signed-off-by: Kenzoh Nishikawa Kenzoh.Nishikawa at jp.sony.com
---
net/mac80211/mesh_plink.c |7 +++
1 file changed, 7 insertions(+)

diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 
32c7bd0..dfc429b 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -524,6 +524,13 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data 
*sdata,
sdata-u.mesh.mshcfg.auto_open_plinks 
rssi_threshold_check(sta, sdata))
changed = mesh_plink_open(sta);
+   else if (sta-plink_state == NL80211_PLINK_LISTEN 
+(sdata-u.mesh.user_mpm ||
+ sdata-u.mesh.security  IEEE80211_MESH_SEC_AUTHED))
+   cfg80211_notify_new_peer_candidate(sdata-dev, hw_addr,
+  elems-ie_start,
+  elems-total_len,
+  GFP_ATOMIC);
 
ieee80211_mps_frame_release(sta, elems);
 out:

--
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: unregister and remove frag_threshold callback

2014-12-15 Thread Kalle Valo
Peter Oh p...@qca.qualcomm.com writes:

 Setting fragmentation threshold has not been supported by
 any of firmware versions, hence unregister the callback and
 remove the function.

 Signed-off-by: Peter Oh p...@qca.qualcomm.com

Thanks, applied.

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


Re: [PATCH v2 0/5] ath10k: a bunch of STA-related fixes

2014-12-15 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Michal Kazior (5):
   ath10k: improve 11b coex
   ath10k: fix STA u-APSD
   ath10k: prevent invalid ps timeout config
   ath10k: enable per-vif sta powersave
   ath10k: advertise p2p dev support

Thanks, all five patches applied.

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


Re: [PATCH 3/5] ath10k: add thermal cooling device support

2014-12-15 Thread Kalle Valo
A heads up for the backports project:

Rajkumar Manoharan rmano...@qti.qualcomm.com writes:

 Thermal cooling device support is added to control the temperature
 by throttling the data transmission for the given duration. Throttling
 is done using hw MAC quiet time setting. Period, duration and offset
 from TBTT can be set up to quiet the MAC transmits for the required duty
 cycle (% of quiet duration). The thermal device allows user to configure
 duty cycle.

 The quiet params are derived as follows.
   period = max(25TU, beacon interval / number of bss)
   duration = period * duty cycle / 100

 Quiet mode can be disabled by setting the duty cycle to 0. The cooling
 device can be found under /sys/class/thermal/cooling_deviceX/.
 Corresponding soft link to this device can be found under phy folder.

 /sys/class/ieee80211/phy*/device/cooling_device.

 To set duty cycle as 40%,

 echo 40 /sys/class/ieee80211/phy*/device/cooling_device/cur_state

 Signed-off-by: Rajkumar Manoharan rmano...@qti.qualcomm.com

[...]

 +int ath10k_thermal_register(struct ath10k *ar)
 +{
 + struct thermal_cooling_device *cdev;
 + int ret;
 +
 + cdev = thermal_cooling_device_register(ath10k_thermal, ar,
 +ath10k_thermal_ops);
 +
 + if (IS_ERR(cdev)) {
 + ath10k_err(ar, failed to setup thermal device result: %ld\n,
 +PTR_ERR(cdev));
 + return -EINVAL;
 + }

Will this break the backports build? We have the below in Makefile, is
it enough or what's the best way to handle this?

+ath10k_core-$(CONFIG_THERMAL) += thermal.o


-- 
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 1/5] ath10k: add 10.2.4 firmware support

2014-12-15 Thread Kalle Valo
Rajkumar Manoharan rmano...@qti.qualcomm.com writes:

 10.2.4 firmware uses bitmask in wmi_resource_config to configure
 10.2 firmware features like airtime fairness and rx batch mode instead
 of maintaining separete bool entry. This allows new features that can be
 configure during init time without breaking backward compatibility.

 Signed-off-by: Rajkumar Manoharan rmano...@qti.qualcomm.com

Few comments. I'll deal with these and send v2.

 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -387,6 +387,11 @@ enum ath10k_fw_features {
*/
   ATH10K_FW_FEATURE_WMI_10_2 = 4,
  
 + /* Firmware 10.2.4 supports bitmask in resource config to configure
 +  * Airtime fairness and rx batch mode
 +  */
 + ATH10K_FW_FEATURE_WMI_10_2_4 = 5,

When we add new value to enum ath10k_fw_wmi_op_version this flag is not
needed.

   /* keep last */
   ATH10K_FW_FEATURE_COUNT,
  };
 diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
 b/drivers/net/wireless/ath/ath10k/hw.h
 index 809c252..892b6f0 100644
 --- a/drivers/net/wireless/ath/ath10k/hw.h
 +++ b/drivers/net/wireless/ath/ath10k/hw.h
 @@ -72,6 +72,7 @@ enum ath10k_fw_wmi_op_version {
   ATH10K_FW_WMI_OP_VERSION_10_1 = 2,
   ATH10K_FW_WMI_OP_VERSION_10_2 = 3,
   ATH10K_FW_WMI_OP_VERSION_TLV = 4,
 + ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5,
  
   /* keep last */
   ATH10K_FW_WMI_OP_VERSION_MAX,
 diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
 b/drivers/net/wireless/ath/ath10k/wmi.c
 index fa486f6..c42382c 100644
 --- a/drivers/net/wireless/ath/ath10k/wmi.c
 +++ b/drivers/net/wireless/ath/ath10k/wmi.c
 @@ -4748,6 +4748,7 @@ static const struct wmi_ops wmi_10_2_ops = {
  int ath10k_wmi_attach(struct ath10k *ar)
  {
   switch (ar-wmi.op_version) {
 + case ATH10K_FW_WMI_OP_VERSION_10_2_4:
   case ATH10K_FW_WMI_OP_VERSION_10_2:
   ar-wmi.cmd = wmi_10_2_cmd_map;
   ar-wmi.ops = wmi_10_2_ops;

I think it's better to not share cmd_map/ops and instead create new ones
for 10_2_4.

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