[PATCH] ath10k: Increase buffer len to print all wmi services.

2017-07-02 Thread c_traja
From: Tamizh chelvam 

All wmi_services are not printing when we give below command.

cat /sys/kernel/debug/ieee80211/phyX/ath10k/wmi_services

This patch increases the buffer_len to 8192 to print all the wmi_services.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/debug.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 389fcb7..56404fe 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -237,7 +237,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 {
struct ath10k *ar = file->private_data;
char *buf;
-   size_t len = 0, buf_len = 4096;
+   size_t len = 0, buf_len = 8192;
const char *name;
ssize_t ret_cnt;
bool enabled;
-- 
1.7.9.5



[PATCHv4 1/2] cfg80211: Add support to enable or disable btcoex and set btcoex_priority

2017-04-11 Thread c_traja
From: Tamizh chelvam 

This patch introduces NL80211_CMD_SET_BTCOEX command and
NL80211_ATTR_BTCOEX_OP attribute to enable or disable btcoex.
And this change enables user to set btcoex priority by using
NL80211_ATTR_BTCOEX_PRIORITY attribute for the driver which
has the btcoex priority capability. Driver should expose such
capability and make use of this priority to decide whom to share the radio
(either bluetooth or WLAN). When the high priority wlan frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise this support by setting
NL80211_EXT_FEATURE_BTCOEX_PRIORITY nl80211 extended feature.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |6 +
 include/uapi/linux/nl80211.h |   50 ++
 net/wireless/nl80211.c   |   45 +
 net/wireless/rdev-ops.h  |   13 +++
 net/wireless/trace.h |   17 ++
 5 files changed, 131 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 273b1dc..c280c7d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2856,6 +2856,10 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  *
  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex and use this callback to set wlan high priority
+ * over bluetooth. When BTCOEX enabled, the high priority wlan frames
+ * will have more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3144,6 +3148,8 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled,
+ u32 btcoex_priority);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6095a6c..404b74e 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -944,6 +944,8 @@
  * BSS selection. This command can be issued only while connected and it
  * does not result in a change for the current association. Currently,
  * only the %NL80211_ATTR_IE data is used and updated with this command.
+ * @NL80211_CMD_SET_BTCOEX: Enable/Disable btcoex using %NL80211_ATTR_BTCOEX_OP
+ * and set/modify btcoex priority using %NL80211_ATTR_BTCOEX_PRIORITY.
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1144,6 +1146,8 @@ enum nl80211_commands {
 
NL80211_CMD_UPDATE_CONNECT_PARAMS,
 
+   NL80211_CMD_SET_BTCOEX,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -2081,6 +2085,16 @@ enum nl80211_commands {
  * @NL80211_ATTR_PMK: PMK for the PMKSA identified by %NL80211_ATTR_PMKID.
  * This is used with @NL80211_CMD_SET_PMKSA.
  *
+ * @NL80211_ATTR_BTCOEX_OP: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_BTCOEX it contains
+ * either 0 for disable or 1 for enable btcoex.
+ *
+ * @NL80211_ATTR_BTCOEX_PRIORITY: This is for the driver which support
+ * btcoex priority feature. It used with %NL80211_CMD_SET_BTCOEX.
+ * This will have u32 BITMAP value which represents
+ * frame(bk, be, vi, vo, mgmt, beacon) type and that will have more
+ * priority than a BT traffic.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2500,6 +2514,9 @@ enum nl80211_attrs {
 
NL80211_ATTR_PMK,
 
+   NL80211_ATTR_BTCOEX_OP,
+   NL80211_ATTR_BTCOEX_PRIORITY,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
@@ -4838,6 +4855,8 @@ enum nl80211_feature_flags {
  * RSSI threshold values to monitor rather than exactly one threshold.
  * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS shared key
  * authentication with %NL80211_CMD_CONNECT.
+ * @NL80211_EXT_FEATURE_BTCOEX_PRIORITY: Driver supports btcoex priority
+ * feature with %NL80211_ATTR_BTCOEX_PRIORITY.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4858,6 +4877,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
NL80211_EXT_FEATURE_CQM_RSSI_LIST,
NL80211_EXT_FEATURE_FILS_SK_OFFLOAD,
+   NL80211_EXT_FEATURE_BTCOEX_PRIORITY,
 
/* add new features before the definition below */

[PATCHv4 2/2] mac80211: Add support to enable or disable btcoex and set btcoex priority value

2017-04-11 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex.
This API will pass user space value to driver to
enable or disabe btcoex and set or modify the btcoex priority value.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|5 +
 net/mac80211/cfg.c|9 +
 net/mac80211/driver-ops.h |   15 +++
 net/mac80211/trace.h  |   20 
 4 files changed, 49 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b1ac872..865eb7f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3453,6 +3453,9 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ * @set_btcoex: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex and use this callback to
+ * set btcoex_priority. BTCOEX should be enabled to set this priority.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3734,6 +3737,8 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled,
+ u32 btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8bc3d366..512e5f7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3617,6 +3617,14 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
return 0;
 }
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled,
+   u32 btcoex_priority)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled, btcoex_priority);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3709,4 +3717,5 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..c420da5 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,19 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled, u32 btcoex_priority)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled, btcoex_priority);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(>hw, enabled,
+btcoex_priority);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 0d645bc..3a4621e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,26 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled,
+u32 btcoex_priority),
+   TP_ARGS(local, enabled, btcoex_priority),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   __field(u32, btcoex_priority)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   __entry->btcoex_priority = btcoex_priority;
+   ),
+   TP_printk(
+   LOCAL_PR_FMT " enabled:%d btcoex_priority :%u",
+   LOCAL_PR_ARG, __entry->enabled, __entry->btcoex_priority
+   )
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCHv4 0/2] cfg80211: mac80211: BTCOEX feature support

2017-04-11 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable and
modifying btcoex priority value via nl80211

Tamizh chelvam (2):
  cfg80211: Add support to enable or disable btcoex and set
btcoex_priority
  mac80211: Add support to enable or disable btcoex and set btcoex
priority value

v4 :
  * Moved btcoex_priority_support_flag enum to nl80211.h and renamed it.
  * fixed typo.

v3 :
  * Introduced NL80211_EXT_FEATURE_BTCOEX_PRIORITY to expose
btcoex priority support and removed bool variable.

v2 :
  * Introduced NL80211_CMD_SET_BTCOEX to enable/disable btcoex and
to set/modify btcoex_priority.
  * Added bool variable in wiphy structure to advertise btcoex_priority
feature and removed BITMAP calculation for btcoex_priority value.

 include/net/cfg80211.h   |6 +
 include/net/mac80211.h   |5 +
 include/uapi/linux/nl80211.h |   50 ++
 net/mac80211/cfg.c   |9 
 net/mac80211/driver-ops.h|   15 +
 net/mac80211/trace.h |   20 +
 net/wireless/nl80211.c   |   45 +
 net/wireless/rdev-ops.h  |   13 +++
 net/wireless/trace.h |   17 ++
 9 files changed, 180 insertions(+)

-- 
1.7.9.5



[PATCHv3 1/2] cfg80211: Add support to enable or disable btcoex and set btcoex_priority

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patch introduces NL80211_CMD_SET_BTCOEX command and
NL80211_ATTR_BTCOEX_OP attribute to enable or disable btcoex.
And this change enables user to set btcoex priority by using
NL80211_ATTR_BTCOEX_PRIORITY attribute for the driver which
has the btcoex priority capability. Driver should expose such
capability and make use of this priority to decide whom to share the radio
(either bluetooth or WLAN). When the high priority wlan frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise this support by setting
NL80211_EXT_FEATURE_BTCOEX_PRIORITY nl80211 extended feature.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   35 
 include/uapi/linux/nl80211.h |   20 +++
 net/wireless/nl80211.c   |   45 ++
 net/wireless/rdev-ops.h  |   13 
 net/wireless/trace.h |   17 
 5 files changed, 130 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 273b1dc..b144998 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2856,6 +2856,10 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  *
  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex and use this callback to set wlan high priority
+ * over bluetooth. When BTCOEX enabled, the high priority wlan frames
+ * will have more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3144,6 +3148,8 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled,
+ u32 btcoex_priority);
 };
 
 /*
@@ -3488,6 +3494,35 @@ struct wiphy_iftype_ext_capab {
 };
 
 /**
+ * enum btcoex_priority_support_flag - btcoex priority supported frame types 
and
+ * its bitmap values.
+ * @WIPHY_BTCOEX_SUPPORTS_BE_PREF - BE wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_BK_PREF - BK wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_VI_PREF - VI wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_VO_PREF - VO wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_BEACON_PREF - BEACON wlan frame takes more preference
+ * than  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_MGMT_PREF - MGMT wlan frame takes more preference 
than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_MAX_PREF - MAX supported value for btcoex priority
+ * feature.
+ */
+
+enum btcoex_priority_support_flag {
+   WIPHY_BTCOEX_SUPPORTS_BE_PREF = BIT(0),
+   WIPHY_BTCOEX_SUPPORTS_BK_PREF = BIT(1),
+   WIPHY_BTCOEX_SUPPORTS_VI_PREF = BIT(2),
+   WIPHY_BTCOEX_SUPPORTS_VO_PREF = BIT(3),
+   WIPHY_BTCOEX_SUPPORTS_BEACON_PREF = BIT(4),
+   WIPHY_BTCOEX_SUPPORTS_MGMT_PREF = BIT(5),
+   WIPHY_BTCOEX_SUPPORTS_MAX_PREF  = BIT(6) - 1,
+};
+
+/**
  * struct wiphy - wireless hardware description
  * @reg_notifier: the driver's regulatory notification callback,
  * note that if your driver uses wiphy_apply_custom_regulatory()
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6095a6c..e6b2647 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -944,6 +944,8 @@
  * BSS selection. This command can be issued only while connected and it
  * does not result in a change for the current association. Currently,
  * only the %NL80211_ATTR_IE data is used and updated with this command.
+ * @NL80211_CMD_SET_BTCOEX: Enable/Disable btcoex using
+ * %NL80211_ATTR_SET_BTCOEX
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1144,6 +1146,8 @@ enum nl80211_commands {
 
NL80211_CMD_UPDATE_CONNECT_PARAMS,
 
+   NL80211_CMD_SET_BTCOEX,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -2081,6 +2085,16 @@ enum nl80211_commands {
  * @NL80211_ATTR_PMK: PMK for the PMKSA identified by %NL80211_ATTR_PMKID.
  * This is used with @NL80211_CMD_SET_PMKSA.
  *
+ * @NL80211_ATTR_BTCOEX_OP: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_BTCOEX it contains
+ * either 0 for disable or 1 for enable btcoex.
+ *
+ * @NL80211_ATTR_BTCOEX_PRIORITY: This is for the driver which supprot
+ * btcoex priority feature. It used with %NL80211_CMD_SET_BTCOEX.
+ * This will have 

[PATCHv3 2/2] mac80211: Add support to enable or disable btcoex and set btcoex priority value

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex.
This API will pass user space value to driver to
enable or disabe btcoex and set or modify the btcoex priority value.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|5 +
 net/mac80211/cfg.c|9 +
 net/mac80211/driver-ops.h |   15 +++
 net/mac80211/trace.h  |   20 
 4 files changed, 49 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b1ac872..7d0f1dd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3453,6 +3453,9 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ * @set_btcoex_: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex and use this callback to
+ * set btcoex_priority. BTCOEX should be enabled to set this priority.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3734,6 +3737,8 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled,
+ u32 btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8bc3d366..512e5f7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3617,6 +3617,14 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
return 0;
 }
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled,
+   u32 btcoex_priority)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled, btcoex_priority);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3709,4 +3717,5 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..c420da5 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,19 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled, u32 btcoex_priority)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled, btcoex_priority);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(>hw, enabled,
+btcoex_priority);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 0d645bc..3a4621e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,26 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled,
+u32 btcoex_priority),
+   TP_ARGS(local, enabled, btcoex_priority),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   __field(u32, btcoex_priority)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   __entry->btcoex_priority = btcoex_priority;
+   ),
+   TP_printk(
+   LOCAL_PR_FMT " enabled:%d btcoex_priority :%u",
+   LOCAL_PR_ARG, __entry->enabled, __entry->btcoex_priority
+   )
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCHv3 0/2] cfg80211: mac80211: BTCOEX feature support

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable and
modifying btcoex priority value via nl80211

Tamizh chelvam (2):
  cfg80211: Add support to enable or disable btcoex and  set
btcoex_priority
  mac80211: Add support to enable or disable btcoex and set btcoex
priority value

v3 :
  * Introduced NL80211_EXT_FEATURE_BTCOEX_PRIORITY to expose
btcoex priority support and removed bool variable.

v2 :
  * Introduced NL80211_CMD_SET_BTCOEX to enable/disable btcoex and
to set/modify btcoex_priority.
  * Added bool variable in wiphy structure to advertise btcoex_priority
feature and removed BITMAP calculation for btcoex_priority value.

 include/net/cfg80211.h   |   35 
 include/net/mac80211.h   |5 +
 include/uapi/linux/nl80211.h |   20 +++
 net/mac80211/cfg.c   |9 +
 net/mac80211/driver-ops.h|   15 ++
 net/mac80211/trace.h |   20 +++
 net/wireless/nl80211.c   |   45 ++
 net/wireless/rdev-ops.h  |   13 
 net/wireless/trace.h |   17 
 9 files changed, 179 insertions(+)

-- 
1.7.9.5



[PATCHv2 1/4] cfg80211: Add support to enable or disable btcoex

2017-02-25 Thread c_traja
From: Tamizh chelvam 

This patch introduces NL80211_CMD_SET_BTCOEX command and
NL80211_ATTR_BTCOEX_OP attribute to enable or disable btcoex.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |3 +++
 include/uapi/linux/nl80211.h |9 +
 net/wireless/nl80211.c   |   31 +++
 net/wireless/rdev-ops.h  |   11 +++
 net/wireless/trace.h |   15 +++
 5 files changed, 69 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c92dc03..a9aae03 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2816,6 +2816,8 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  *
  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3100,6 +3102,7 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5ed257c..30d691f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -900,6 +900,8 @@
  * BSS selection. This command can be issued only while connected and it
  * does not result in a change for the current association. Currently,
  * only the %NL80211_ATTR_IE data is used and updated with this command.
+ * @NL80211_CMD_SET_BTCOEX: Enable/Disable btcoex using
+ * %NL80211_ATTR_SET_BTCOEX
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1100,6 +1102,8 @@ enum nl80211_commands {
 
NL80211_CMD_UPDATE_CONNECT_PARAMS,
 
+   NL80211_CMD_SET_BTCOEX,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -2011,6 +2015,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_TIMEOUT_REASON: The reason for which an operation timed out.
  * u32 attribute with an  nl80211_timeout_reason value. This is used,
  * e.g., with %NL80211_CMD_CONNECT event.
+ * @NL80211_ATTR_BTCOEX_OP: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_BTCOEX it contains
+ * either 0 for disable or 1 for enable btcoex.
  *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2423,6 +2430,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_TIMEOUT_REASON,
 
+   NL80211_ATTR_BTCOEX_OP,
+
/* 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 d7f8be4..bd203c2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -410,6 +410,7 @@ enum nl80211_multicast_groups {
.len = sizeof(struct nl80211_bss_select_rssi_adjust)
},
[NL80211_ATTR_TIMEOUT_REASON] = { .type = NLA_U32 },
+   [NL80211_ATTR_BTCOEX_OP] = { .type = NLA_U8 },
 };
 
 /* policy for the key attributes */
@@ -11966,6 +11967,28 @@ static int nl80211_set_multicast_to_unicast(struct 
sk_buff *skb,
return rdev_set_multicast_to_unicast(rdev, dev, enabled);
 }
 
+static int nl80211_set_btcoex(struct sk_buff *skb, struct genl_info *info)
+{
+   struct cfg80211_registered_device *rdev = info->user_ptr[0];
+   u8 val = 0;
+
+   if (!rdev->ops->set_btcoex)
+   return -ENOTSUPP;
+
+   if(!(info->attrs[NL80211_ATTR_BTCOEX_OP]))
+   goto set_btcoex;
+
+   if (info->attrs[NL80211_ATTR_BTCOEX_OP])
+   val = nla_get_u8(info->attrs[NL80211_ATTR_BTCOEX_OP]);
+
+   if (val > 1)
+   return -EINVAL;
+
+
+set_btcoex:
+   return rdev_set_btcoex(rdev, val);
+}
+
 #define NL80211_FLAG_NEED_WIPHY0x01
 #define NL80211_FLAG_NEED_NETDEV   0x02
 #define NL80211_FLAG_NEED_RTNL 0x04
@@ -12841,6 +12864,14 @@ static void nl80211_post_doit(const struct genl_ops 
*ops, struct sk_buff *skb,
.internal_flags = NL80211_FLAG_NEED_NETDEV |
  NL80211_FLAG_NEED_RTNL,
},
+   {
+   .cmd = NL80211_CMD_SET_BTCOEX,
+   .doit = nl80211_set_btcoex,
+   .policy = nl80211_policy,
+   .flags = GENL_UNS_ADMIN_PERM,
+   .internal_flags = NL80211_FLAG_NEED_WIPHY |
+ NL80211_FLAG_NEED_RTNL,
+   },
 };
 
 static struct genl_family nl80211_fam __ro_after_init = {
diff --git a/net/wireless/rdev-ops.h 

[PATCHv2 2/4] mac80211: Add support to enable or disable btcoex

2017-02-25 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex
This API will pass user space value to driver to
enable or disabe btcoex.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|3 +++
 net/mac80211/cfg.c|8 
 net/mac80211/driver-ops.h |   14 ++
 net/mac80211/trace.h  |   14 ++
 4 files changed, 39 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b9a08cd..57717f1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3447,6 +3447,8 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ * @set_btcoex_: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3728,6 +3730,7 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ac879bb..7e17eff 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3574,6 +3574,13 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
return 0;
 }
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3665,4 +3672,5 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..16d9c98 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,18 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(>hw, enabled);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 0d645bc..0d9b5a0 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,20 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled),
+   TP_ARGS(local, enabled),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   ),
+   TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCHv2 0/4] cfg80211: mac80211: BTCOEX feature support

2017-02-25 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable and
modifying btcoex priority value via nl80211

Tamizh chelvam (4):
  ath10k: Add support to enable or disable btcoex via nl80211
  ath10k: Add support to update btcoex priority value via nl80211
  dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
  ath10k: Add support to read btcoex related data from DT

v2 :
  * Introduced NL80211_CMD_SET_BTCOEX to enable/disable btcoex and
to set/modify btcoex_priority.
  * Added bool variable in wiphy structure to advertise btcoex_priority
feature and removed BITMAP calculation for btcoex_priority value.
 
 .../bindings/net/wireless/qcom,ath10k.txt  |4 +
 drivers/net/wireless/ath/ath10k/core.c |   44 -
 drivers/net/wireless/ath/ath10k/core.h |9 ++
 drivers/net/wireless/ath/ath10k/debug.c|   40 ++---
 drivers/net/wireless/ath/ath10k/mac.c  |   94 +++-
 drivers/net/wireless/ath/ath10k/mac.h  |1 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h  |   19 
 drivers/net/wireless/ath/ath10k/wmi.c  |   20 +
 drivers/net/wireless/ath/ath10k/wmi.h  |   20 +
 9 files changed, 215 insertions(+), 36 deletions(-)

-- 
1.7.9.5



[PATCHv2 4/4] mac80211: Add support to set/update btcoex priority value

2017-02-25 Thread c_traja
From: Tamizh chelvam 

This patch add support to set or modify the btcoex priority value
for the driver which has btcoex priority feature support.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|6 --
 net/mac80211/cfg.c|5 +++--
 net/mac80211/driver-ops.h |7 ---
 net/mac80211/trace.h  |   12 +---
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 57717f1..33890b4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3448,7 +3448,8 @@ enum ieee80211_reconfig_type {
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
  * @set_btcoex_: Called when BTCOEX is enabled/disabled, use
- * this callback to enable or disable btcoex.
+ * this callback to enable or disable btcoex and use this callback to
+ * set btcoex_priority. BTCOEX should be enabled to set this priority.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3730,7 +3731,8 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
-   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled,
+ int btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7e17eff..c640e7d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3574,11 +3574,12 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
return 0;
 }
 
-static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled)
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled,
+   int btcoex_priority)
 {
struct ieee80211_local *local = wiphy_priv(wiphy);
 
-   return drv_set_btcoex(local, enabled);
+   return drv_set_btcoex(local, enabled, btcoex_priority);
 }
 
 const struct cfg80211_ops mac80211_config_ops = {
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 16d9c98..3826202 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1249,13 +1249,14 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
 }
 
 static inline int drv_set_btcoex(struct ieee80211_local *local,
-bool enabled)
+bool enabled, int btcoex_priority)
 {
int ret = -EOPNOTSUPP;
 
-   trace_drv_set_btcoex(local, enabled);
+   trace_drv_set_btcoex(local, enabled, btcoex_priority);
if (local->ops->set_btcoex)
-   ret = local->ops->set_btcoex(>hw, enabled);
+   ret = local->ops->set_btcoex(>hw, enabled,
+btcoex_priority);
 
trace_drv_return_int(local, ret);
 
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 0d9b5a0..c3efca9 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -743,17 +743,23 @@
 );
 
 TRACE_EVENT(drv_set_btcoex,
-   TP_PROTO(struct ieee80211_local *local, bool enabled),
-   TP_ARGS(local, enabled),
+   TP_PROTO(struct ieee80211_local *local, bool enabled,
+int btcoex_priority),
+   TP_ARGS(local, enabled, btcoex_priority),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(bool, enabled)
+   __field(int, btcoex_priority)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->enabled = enabled;
+   __entry->btcoex_priority = btcoex_priority;
),
-   TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
+   TP_printk(
+   LOCAL_PR_FMT " enabled:%d btcoex_priority :%d",
+   LOCAL_PR_ARG, __entry->enabled, __entry->btcoex_priority
+   )
 );
 
 TRACE_EVENT(drv_set_coverage_class,
-- 
1.7.9.5



[PATCHv2 3/4] cfg80211: Add Support set btcoex priority value

2017-02-25 Thread c_traja
From: Tamizh chelvam 

This change enables user to set btcoex priority by using
NL80211_ATTR_BTCOEX_PRIORITY attribute for the driver which
has the btcoex priority capability. Driver should expose such
capability and make use of this priority to decide whom to share the radio
(either bluetooth or WLAN). When the high priority wlan frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise this support through
btcoex_priority_support.

This will be useful to avoid connection lost or packet drop
issue when BT is active on long time.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   10 --
 include/uapi/linux/nl80211.h |7 +++
 net/wireless/nl80211.c   |   16 +++-
 net/wireless/rdev-ops.h  |8 +---
 net/wireless/trace.h |   10 ++
 5 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a9aae03..3f44aac 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2817,7 +2817,10 @@ struct cfg80211_nan_func {
  *
  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
  * @set_btcoex: Use this callback to call driver API when user wants to
- * enable/disable btcoex.
+ * enable/disable btcoex and use this callback to set wlan high priority 
over
+ * Bluetooth. This capability will be exposed by the driver using
+ * btcoex_priority_support boolean flag. When BTCOEX enabled,
+ * the high priority wlan frames will have more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3102,7 +3105,8 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
-   int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled,
+ int btcoex_priority);
 };
 
 /*
@@ -3738,6 +3742,8 @@ struct wiphy {
 
u8 nan_supported_bands;
 
+   bool btcoex_priority_support;
+
char priv[0] __aligned(NETDEV_ALIGN);
 };
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 30d691f..94b6eff 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2019,6 +2019,12 @@ enum nl80211_commands {
  * the btcoex feature. When used with %NL80211_CMD_SET_BTCOEX it contains
  * either 0 for disable or 1 for enable btcoex.
  *
+ * @NL80211_ATTR_BTCOEX_PRIORITY: This is for the driver which
+ * support btcoex priority feature. It used with %NL80211_CMD_SET_BTCOEX.
+ * This will have u32 BITMAP value which represents
+ * frame(bk, be, vi, vo, mgmt, beacon) type and that will have more
+ * priority than a BT traffic.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2431,6 +2437,7 @@ enum nl80211_attrs {
NL80211_ATTR_TIMEOUT_REASON,
 
NL80211_ATTR_BTCOEX_OP,
+   NL80211_ATTR_BTCOEX_PRIORITY,
 
/* add attributes here, update the policy in nl80211.c */
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index bd203c2..56518c4 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -411,6 +411,7 @@ enum nl80211_multicast_groups {
},
[NL80211_ATTR_TIMEOUT_REASON] = { .type = NLA_U32 },
[NL80211_ATTR_BTCOEX_OP] = { .type = NLA_U8 },
+   [NL80211_ATTR_BTCOEX_PRIORITY] = { .type = NLA_U32 },
 };
 
 /* policy for the key attributes */
@@ -11970,7 +11971,9 @@ static int nl80211_set_multicast_to_unicast(struct 
sk_buff *skb,
 static int nl80211_set_btcoex(struct sk_buff *skb, struct genl_info *info)
 {
struct cfg80211_registered_device *rdev = info->user_ptr[0];
+   struct wiphy *wiphy = >wiphy;
u8 val = 0;
+   int btcoex_priority = -1;
 
if (!rdev->ops->set_btcoex)
return -ENOTSUPP;
@@ -11984,9 +11987,20 @@ static int nl80211_set_btcoex(struct sk_buff *skb, 
struct genl_info *info)
if (val > 1)
return -EINVAL;
 
+   if (wiphy->btcoex_priority_support)
+   btcoex_priority = 0;
+
+   if (info->attrs[NL80211_ATTR_BTCOEX_PRIORITY]) {
+   if (!wiphy->btcoex_priority_support)
+   return -EOPNOTSUPP;
+
+   btcoex_priority =
+   nla_get_u32(info->attrs[NL80211_ATTR_BTCOEX_PRIORITY]);
+
+   }
 
 set_btcoex:
-   return rdev_set_btcoex(rdev, val);
+   return rdev_set_btcoex(rdev, val, btcoex_priority);
 }
 
 #define NL80211_FLAG_NEED_WIPHY0x01
diff --git a/net/wireless/rdev-ops.h 

[PATCHv2] ath10k: Update available channel list for 5G radio

2017-02-23 Thread c_traja
From: Tamizh chelvam 

If a 5 GHz radio is calibrated for operation in both
the low band (channels 36 to 64) and high band(channels 100 to 169),
hardware allows operations in all the listed channels. However,
if the chip has been calibrated only for the low/high band and
a high/low band channel is configured, due to lack of calibration
there will be potentially invalid signal on those non calibrated channels.
To avoid this problem this patch sets IEEE80211_CHAN_DISABLED flag for
those non calibrated channels by using low_5ghz_chan and high_5ghz_chan
values which we get from target through wmi service ready event.

Driver initialized flags are getting re initialized in handle_channel
in cfg80211. So calling the function to disable the non supported channel
from reg_notifier().

Signed-off-by: Tamizh chelvam 
---
v2:
  * Removed two separate arrays for channel list, and changed logic
to disable non calibrated channels.

 drivers/net/wireless/ath/ath10k/core.h |2 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |6 ++
 drivers/net/wireless/ath/ath10k/wmi.h  |2 ++
 4 files changed, 29 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 88d14be..d4b9a0e 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -775,6 +775,8 @@ struct ath10k {
u32 num_rf_chains;
u32 max_spatial_stream;
/* protected by conf_mutex */
+   u32 low_5ghz_chan;
+   u32 high_5ghz_chan;
bool ani_enabled;
 
bool p2p;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index abc291d..c5b6c2a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3126,6 +3126,21 @@ static void ath10k_regd_update(struct ath10k *ar)
ath10k_warn(ar, "failed to set pdev regdomain: %d\n", ret);
 }
 
+void ath10k_mac_update_channel_list(struct ath10k *ar,
+   struct ieee80211_supported_band *band)
+{
+   int i;
+
+   if (ar->low_5ghz_chan && ar->high_5ghz_chan) {
+   for (i = 0; i < band->n_channels; i++) {
+   if (band->channels[i].center_freq < ar->low_5ghz_chan ||
+   band->channels[i].center_freq > ar->high_5ghz_chan)
+   band->channels[i].flags |=
+   IEEE80211_CHAN_DISABLED;
+   }
+   }
+}
+
 static void ath10k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
 {
@@ -3149,6 +3164,10 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
if (ar->state == ATH10K_STATE_ON)
ath10k_regd_update(ar);
mutex_unlock(>conf_mutex);
+
+   if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY)
+   ath10k_mac_update_channel_list(ar,
+   ar->hw->wiphy->bands[NL80211_BAND_5GHZ]);
 }
 
 /***/
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 2f1743e..b31c4f7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4593,6 +4593,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
+   arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
+   arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
arg->num_mem_reqs = ev->num_mem_reqs;
arg->service_map = ev->wmi_service_bitmap;
arg->service_map_len = sizeof(ev->wmi_service_bitmap);
@@ -4629,6 +4631,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
+   arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
+   arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
arg->num_mem_reqs = ev->num_mem_reqs;
arg->service_map = ev->wmi_service_bitmap;
arg->service_map_len = sizeof(ev->wmi_service_bitmap);
@@ -4682,6 +4686,8 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
ar->phy_capability = __le32_to_cpu(arg.phy_capab);
ar->num_rf_chains = __le32_to_cpu(arg.num_rf_chains);
ar->hw_eeprom_rd = __le32_to_cpu(arg.eeprom_rd);
+   ar->low_5ghz_chan = __le32_to_cpu(arg.low_5ghz_chan);
+   ar->high_5ghz_chan = __le32_to_cpu(arg.high_5ghz_chan);
 
ath10k_dbg_dump(ar, ATH10K_DBG_WMI, NULL, "wmi svc: ",
arg.service_map, arg.service_map_len);

[PATCH] ath10k: Update available channel list for 5G radio

2017-02-19 Thread c_traja
From: Tamizh chelvam 

If a 5 GHz radio is calibrated for operation in both
the low band (channels 36 to 64) and
high band(channels 100 to 169), hardware allows operations
in all the listed channels. However, if the chip has been
calibrated only for the low/high band and a high/low band
channel is configured, due to lack of calibration there will
be potentially invalid signal on those non calibrated channels.
To avoid this problem this patch introduces ath10k_low_5ghz_channel
and ath10k_high_5ghz_channel lists as separate arrays.
The channel list will be initialized depending on the low_5ghz_chan
and high_5ghz_chan values which we get from target through
wmi service ready event.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.h |2 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   55 +---
 drivers/net/wireless/ath/ath10k/wmi.c  |6 
 drivers/net/wireless/ath/ath10k/wmi.h  |2 ++
 4 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 88d14be..d07d567 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -774,6 +774,8 @@ struct ath10k {
u32 vht_cap_info;
u32 num_rf_chains;
u32 max_spatial_stream;
+   u32 low_5ghz_chan;
+   u32 high_5ghz_chan;
/* protected by conf_mutex */
bool ani_enabled;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 3029f25..0840efb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7623,6 +7623,38 @@ static void ath10k_mac_op_sta_pre_rcu_remove(struct 
ieee80211_hw *hw,
CHAN2G(14, 2484, 0),
 };
 
+static const struct ieee80211_channel ath10k_low_5ghz_channels[] = {
+   CHAN5G(36, 5180, 0),
+   CHAN5G(40, 5200, 0),
+   CHAN5G(44, 5220, 0),
+   CHAN5G(48, 5240, 0),
+   CHAN5G(52, 5260, 0),
+   CHAN5G(56, 5280, 0),
+   CHAN5G(60, 5300, 0),
+   CHAN5G(64, 5320, 0),
+};
+
+static const struct ieee80211_channel ath10k_high_5ghz_channels[] = {
+   CHAN5G(100, 5500, 0),
+   CHAN5G(104, 5520, 0),
+   CHAN5G(108, 5540, 0),
+   CHAN5G(112, 5560, 0),
+   CHAN5G(116, 5580, 0),
+   CHAN5G(120, 5600, 0),
+   CHAN5G(124, 5620, 0),
+   CHAN5G(128, 5640, 0),
+   CHAN5G(132, 5660, 0),
+   CHAN5G(136, 5680, 0),
+   CHAN5G(140, 5700, 0),
+   CHAN5G(144, 5720, 0),
+   CHAN5G(149, 5745, 0),
+   CHAN5G(153, 5765, 0),
+   CHAN5G(157, 5785, 0),
+   CHAN5G(161, 5805, 0),
+   CHAN5G(165, 5825, 0),
+   CHAN5G(169, 5845, 0),
+};
+
 static const struct ieee80211_channel ath10k_5ghz_channels[] = {
CHAN5G(36, 5180, 0),
CHAN5G(40, 5200, 0),
@@ -8014,6 +8046,7 @@ int ath10k_mac_register(struct ath10k *ar)
};
struct ieee80211_supported_band *band;
void *channels;
+   int n_channels;
int ret;
 
SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr);
@@ -8049,16 +8082,30 @@ int ath10k_mac_register(struct ath10k *ar)
}
 
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
-   channels = kmemdup(ath10k_5ghz_channels,
-  sizeof(ath10k_5ghz_channels),
-  GFP_KERNEL);
+   if (ar->high_5ghz_chan <= 5350) {
+   channels = kmemdup(ath10k_low_5ghz_channels,
+  sizeof(ath10k_low_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_low_5ghz_channels);
+   } else if (ar->low_5ghz_chan >= 5490 &&
+  ar->high_5ghz_chan <= 5885) {
+   channels = kmemdup(ath10k_high_5ghz_channels,
+  sizeof(ath10k_high_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_high_5ghz_channels);
+   } else {
+   channels = kmemdup(ath10k_5ghz_channels,
+  sizeof(ath10k_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
+   }
if (!channels) {
ret = -ENOMEM;
goto err_free;
}
 
band = >mac.sbands[NL80211_BAND_5GHZ];
-   band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
+   band->n_channels = n_channels;
band->channels = channels;
band->n_bitrates = ath10k_a_rates_size;
band->bitrates = ath10k_a_rates;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 

[PATCHv2] ath10k: Update available channel list for 5G radio

2017-02-19 Thread c_traja
From: Tamizh chelvam 

If a 5 GHz radio is calibrated for operation in both
the low band (channels 36 to 64) and
high band(channels 100 to 169), hardware allows operations
in all the listed channels. However, if the chip has been
calibrated only for the low/high band and a high/low band
channel is configured, due to lack of calibration there will
be potentially invalid signal on those non calibrated channels.
To avoid this problem this patch introduces ath10k_low_5ghz_channel
and ath10k_high_5ghz_channel lists as separate arrays.
The channel list will be initialized depending on the low_5ghz_chan
and high_5ghz_chan values which we get from target through
wmi service ready event.

Signed-off-by: Tamizh chelvam 
---
v2:
  * Addressed Jouni and Kalle's comments

 drivers/net/wireless/ath/ath10k/core.h |2 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   55 +---
 drivers/net/wireless/ath/ath10k/wmi.c  |6 
 drivers/net/wireless/ath/ath10k/wmi.h  |2 ++
 4 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 88d14be..d07d567 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -774,6 +774,8 @@ struct ath10k {
u32 vht_cap_info;
u32 num_rf_chains;
u32 max_spatial_stream;
+   u32 low_5ghz_chan;
+   u32 high_5ghz_chan;
/* protected by conf_mutex */
bool ani_enabled;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 3029f25..0840efb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7623,6 +7623,38 @@ static void ath10k_mac_op_sta_pre_rcu_remove(struct 
ieee80211_hw *hw,
CHAN2G(14, 2484, 0),
 };
 
+static const struct ieee80211_channel ath10k_low_5ghz_channels[] = {
+   CHAN5G(36, 5180, 0),
+   CHAN5G(40, 5200, 0),
+   CHAN5G(44, 5220, 0),
+   CHAN5G(48, 5240, 0),
+   CHAN5G(52, 5260, 0),
+   CHAN5G(56, 5280, 0),
+   CHAN5G(60, 5300, 0),
+   CHAN5G(64, 5320, 0),
+};
+
+static const struct ieee80211_channel ath10k_high_5ghz_channels[] = {
+   CHAN5G(100, 5500, 0),
+   CHAN5G(104, 5520, 0),
+   CHAN5G(108, 5540, 0),
+   CHAN5G(112, 5560, 0),
+   CHAN5G(116, 5580, 0),
+   CHAN5G(120, 5600, 0),
+   CHAN5G(124, 5620, 0),
+   CHAN5G(128, 5640, 0),
+   CHAN5G(132, 5660, 0),
+   CHAN5G(136, 5680, 0),
+   CHAN5G(140, 5700, 0),
+   CHAN5G(144, 5720, 0),
+   CHAN5G(149, 5745, 0),
+   CHAN5G(153, 5765, 0),
+   CHAN5G(157, 5785, 0),
+   CHAN5G(161, 5805, 0),
+   CHAN5G(165, 5825, 0),
+   CHAN5G(169, 5845, 0),
+};
+
 static const struct ieee80211_channel ath10k_5ghz_channels[] = {
CHAN5G(36, 5180, 0),
CHAN5G(40, 5200, 0),
@@ -8014,6 +8046,7 @@ int ath10k_mac_register(struct ath10k *ar)
};
struct ieee80211_supported_band *band;
void *channels;
+   int n_channels;
int ret;
 
SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr);
@@ -8049,16 +8082,30 @@ int ath10k_mac_register(struct ath10k *ar)
}
 
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
-   channels = kmemdup(ath10k_5ghz_channels,
-  sizeof(ath10k_5ghz_channels),
-  GFP_KERNEL);
+   if (ar->high_5ghz_chan <= 5350) {
+   channels = kmemdup(ath10k_low_5ghz_channels,
+  sizeof(ath10k_low_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_low_5ghz_channels);
+   } else if (ar->low_5ghz_chan >= 5490 &&
+  ar->high_5ghz_chan <= 5885) {
+   channels = kmemdup(ath10k_high_5ghz_channels,
+  sizeof(ath10k_high_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_high_5ghz_channels);
+   } else {
+   channels = kmemdup(ath10k_5ghz_channels,
+  sizeof(ath10k_5ghz_channels),
+  GFP_KERNEL);
+   n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
+   }
if (!channels) {
ret = -ENOMEM;
goto err_free;
}
 
band = >mac.sbands[NL80211_BAND_5GHZ];
-   band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
+   band->n_channels = n_channels;
band->channels = channels;
band->n_bitrates = ath10k_a_rates_size;
band->bitrates = ath10k_a_rates;
diff --git 

[PATCHv3] ath10k: fix boot failure in UTF mode/testmode

2017-01-30 Thread c_traja
From: Tamizh chelvam 

Rx filter reset and the dynamic tx switch mode (EXT_RESOURCE_CFG)
configuration are causing the following errors when UTF firmware
is loaded to the target.

Error message 1:
[ 598.015629] ath10k_pci 0001:01:00.0: failed to ping firmware: -110
[ 598.020828] ath10k_pci 0001:01:00.0: failed to reset rx filter: -110
[ 598.141556] ath10k_pci 0001:01:00.0: failed to start core (testmode): -110

Error message 2:
[ 668.615839] ath10k_ahb a00.wifi: failed to send ext resource cfg command 
: -95
[ 668.618902] ath10k_ahb a00.wifi: failed to start core (testmode): -95

Avoiding these configurations while bringing the target in
testmode is solving the problem.

Cc: sta...@vger.kernel.org
Signed-off-by: Tamizh chelvam 
---
v3:
   *Added Cc:sta...@vger.kernel.org in commit log

 drivers/net/wireless/ath/ath10k/core.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index c2afcca..c27e7ea 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1996,7 +1996,8 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
ath10k_dbg(ar, ATH10K_DBG_BOOT, "firmware %s booted\n",
   ar->hw->wiphy->fw_version);
 
-   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map)) {
+   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map) &&
+   mode == ATH10K_FIRMWARE_MODE_NORMAL) {
val = 0;
if (ath10k_peer_stats_enabled(ar))
val = WMI_10_4_PEER_STATS;
@@ -2049,10 +2050,13 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
 * possible to implicitly make it correct by creating a dummy vdev and
 * then deleting it.
 */
-   status = ath10k_core_reset_rx_filter(ar);
-   if (status) {
-   ath10k_err(ar, "failed to reset rx filter: %d\n", status);
-   goto err_hif_stop;
+   if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
+   status = ath10k_core_reset_rx_filter(ar);
+   if (status) {
+   ath10k_err(ar,
+  "failed to reset rx filter: %d\n", status);
+   goto err_hif_stop;
+   }
}
 
/* If firmware indicates Full Rx Reorder support it must be used in a
-- 
1.7.9.5



[PATCHv2] ath10k: fix boot failure in UTF mode/testmode

2017-01-30 Thread c_traja
From: Tamizh chelvam 

Rx filter reset and the dynamic tx switch mode (EXT_RESOURCE_CFG)
configuration are causing the following errors when UTF firmware
is loaded to the target.

Error message 1:
[ 598.015629] ath10k_pci 0001:01:00.0: failed to ping firmware: -110
[ 598.020828] ath10k_pci 0001:01:00.0: failed to reset rx filter: -110
[ 598.141556] ath10k_pci 0001:01:00.0: failed to start core (testmode): -110

Error message 2:
[ 668.615839] ath10k_ahb a00.wifi: failed to send ext resource cfg command 
: -95
[ 668.618902] ath10k_ahb a00.wifi: failed to start core (testmode): -95

Avoiding these configurations while bringing the target in
testmode is solving the problem.

Signed-off-by: Tamizh chelvam 
---
v2:
   *Added sta...@vger.kernel.org in cc list

 drivers/net/wireless/ath/ath10k/core.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 874c2a7..0d12761 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1922,7 +1922,8 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
ath10k_dbg(ar, ATH10K_DBG_BOOT, "firmware %s booted\n",
   ar->hw->wiphy->fw_version);
 
-   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map)) {
+   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map) &&
+   mode == ATH10K_FIRMWARE_MODE_NORMAL) {
val = 0;
if (ath10k_peer_stats_enabled(ar))
val = WMI_10_4_PEER_STATS;
@@ -1975,10 +1976,13 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
 * possible to implicitly make it correct by creating a dummy vdev and
 * then deleting it.
 */
-   status = ath10k_core_reset_rx_filter(ar);
-   if (status) {
-   ath10k_err(ar, "failed to reset rx filter: %d\n", status);
-   goto err_hif_stop;
+   if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
+   status = ath10k_core_reset_rx_filter(ar);
+   if (status) {
+   ath10k_err(ar,
+  "failed to reset rx filter: %d\n", status);
+   goto err_hif_stop;
+   }
}
 
/* If firmware indicates Full Rx Reorder support it must be used in a
-- 
1.7.9.5



[PATCH] ath10k: fix boot failure in UTF mode/testmode

2017-01-27 Thread c_traja
From: Tamizh chelvam 

Rx filter reset and the dynamic tx switch mode (EXT_RESOURCE_CFG)
configuration are causing the following errors when UTF firmware
is loaded to the target.

Error message 1:
[ 598.015629] ath10k_pci 0001:01:00.0: failed to ping firmware: -110
[ 598.020828] ath10k_pci 0001:01:00.0: failed to reset rx filter: -110
[ 598.141556] ath10k_pci 0001:01:00.0: failed to start core (testmode): -110

Error message 2:
[ 668.615839] ath10k_ahb a00.wifi: failed to send ext resource cfg command 
: -95
[ 668.618902] ath10k_ahb a00.wifi: failed to start core (testmode): -95

Avoiding these configurations while bringing the target in
testmode is solving the problem.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 874c2a7..0d12761 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1922,7 +1922,8 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
ath10k_dbg(ar, ATH10K_DBG_BOOT, "firmware %s booted\n",
   ar->hw->wiphy->fw_version);
 
-   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map)) {
+   if (test_bit(WMI_SERVICE_EXT_RES_CFG_SUPPORT, ar->wmi.svc_map) &&
+   mode == ATH10K_FIRMWARE_MODE_NORMAL) {
val = 0;
if (ath10k_peer_stats_enabled(ar))
val = WMI_10_4_PEER_STATS;
@@ -1975,10 +1976,13 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
 * possible to implicitly make it correct by creating a dummy vdev and
 * then deleting it.
 */
-   status = ath10k_core_reset_rx_filter(ar);
-   if (status) {
-   ath10k_err(ar, "failed to reset rx filter: %d\n", status);
-   goto err_hif_stop;
+   if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
+   status = ath10k_core_reset_rx_filter(ar);
+   if (status) {
+   ath10k_err(ar,
+  "failed to reset rx filter: %d\n", status);
+   goto err_hif_stop;
+   }
}
 
/* If firmware indicates Full Rx Reorder support it must be used in a
-- 
1.7.9.5



[PATCHv2 1/4] ath10k: Add support to enable or disable btcoex via nl80211

2016-11-17 Thread c_traja
From: Tamizh chelvam 

This patch add support to enable or disable btcoex via nl80211.
The firmware support this feature since 10.2.4.54 on 2G-only board,
dual band or 5G boards don't support this. WMI service
WMI_SERVICE_COEX_GPIO is used to identify the firmware support of this
feature.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/debug.c |   37 ++--
 drivers/net/wireless/ath/ath10k/mac.c   |   58 +++
 drivers/net/wireless/ath/ath10k/mac.h   |1 +
 3 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 82a4c67..ea30fbe 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -26,6 +26,7 @@
 #include "debug.h"
 #include "hif.h"
 #include "wmi-ops.h"
+#include "mac.h"
 
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
@@ -2138,7 +2139,6 @@ static ssize_t ath10k_write_btcoex(struct file *file,
size_t buf_size;
int ret;
bool val;
-   u32 pdev_param;
 
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, ubuf, buf_size))
@@ -2150,40 +2150,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
return -EINVAL;
 
mutex_lock(>conf_mutex);
-
-   if (ar->state != ATH10K_STATE_ON &&
-   ar->state != ATH10K_STATE_RESTARTED) {
-   ret = -ENETDOWN;
-   goto exit;
-   }
-
-   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val)) {
+   ret = ath10k_mac_set_btcoex(ar, val);
+   if (!ret)
ret = count;
-   goto exit;
-   }
-
-   pdev_param = ar->wmi.pdev_param->enable_btcoex;
-   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features)) {
-   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
-   if (ret) {
-   ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
-   ret = count;
-   goto exit;
-   }
-   } else {
-   ath10k_info(ar, "restarting firmware due to btcoex change");
-   queue_work(ar->workqueue, >restart_work);
-   }
-
-   if (val)
-   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-   else
-   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-
-   ret = count;
-
-exit:
mutex_unlock(>conf_mutex);
 
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 717b2fa..e7131b9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7445,6 +7445,63 @@ struct ath10k_mac_change_chanctx_arg {
return 0;
 }
 
+static inline void ath10k_mac_update_btcoex_flag(struct ath10k *ar, bool val)
+{
+   if (val)
+   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+   else
+   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+}
+
+int ath10k_mac_set_btcoex(struct ath10k *ar, bool val)
+{
+   u32 pdev_param;
+   int ret;
+
+   lockdep_assert_held(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED)
+   return -ENETDOWN;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
+   return 0;
+
+   pdev_param = ar->wmi.pdev_param->enable_btcoex;
+   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
+ar->running_fw->fw_file.fw_features)) {
+   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
+
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to modify btcoex state: %d\n", ret);
+   return ret;
+   }
+   ath10k_mac_update_btcoex_flag(ar, val);
+   } else {
+   ath10k_info(ar, "restarting firmware due to btcoex change");
+   ath10k_mac_update_btcoex_flag(ar, val);
+   queue_work(ar->workqueue, >restart_work);
+   }
+
+   return 0;
+}
+
+static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
+{
+   int ret;
+   struct ath10k *ar = hw->priv;
+
+   if (!test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
+   return -EOPNOTSUPP;
+
+   mutex_lock(>conf_mutex);
+   ret = ath10k_mac_set_btcoex(ar, enabled);
+   mutex_unlock(>conf_mutex);
+
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7486,6 +7543,7 @@ struct ath10k_mac_change_chanctx_arg {
.assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
.unassign_vif_chanctx   = 

[PATCHv2 0/4] ath10k: Add support for BTCOEX feature.

2016-11-17 Thread c_traja
From: Tamizh chelvam 

This patch set add support to enable/disable BTCOEX via nl80211,
also support to update BTCOEX priority value for 10.4 based firmware.
Document the dt entry in qcom,ath10k.txt and reads btcoex support
flag and btcoex gpio pin detail from dt.

Tamizh chelvam (4):
  ath10k: Add support to enable or disable btcoex via nl80211
  ath10k: Add support to update btcoex priority value via nl80211
  dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
  ath10k: Add support to read btcoex related data from DT

V2:

 * Added device tree list in CC
 * fixed mutex unlock issue in 
   "ath10k: Add support to update btcoex priority value via nl80211"

 .../bindings/net/wireless/qcom,ath10k.txt  |4 +
 drivers/net/wireless/ath/ath10k/core.c |   44 +-
 drivers/net/wireless/ath/ath10k/core.h |9 ++
 drivers/net/wireless/ath/ath10k/debug.c|   40 +-
 drivers/net/wireless/ath/ath10k/mac.c  |  140 +++-
 drivers/net/wireless/ath/ath10k/mac.h  |1 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h  |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   20 +++
 drivers/net/wireless/ath/ath10k/wmi.h  |   20 +++
 9 files changed, 261 insertions(+), 36 deletions(-)

-- 
1.7.9.5



[PATCHv2 2/4] ath10k: Add support to update btcoex priority value via nl80211

2016-11-17 Thread c_traja
From: Tamizh chelvam 

This patch adds support to update btcoex priority value via nl80211.
Here driver will be exposing the supported frame format for this
feature via btcoex_support_flags which is a member of
wiphy structure. 10.4 based firmware support this feature.
WMI service WMI_SERVICE_BTCOEX is used to identify the firmware support
of this feature. BTCOEX needs to enable to modify this value.

This patch has dependency of
"cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX"
patch.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/mac.c |   78 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.c |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.h |   18 +++
 4 files changed, 134 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index e7131b9..ce5d529 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7502,6 +7502,71 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
return ret;
 }
 
+u32
+ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio = 0;
+
+   if (btcoex_priority->wlan_be_preferred)
+   btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
+
+   if (btcoex_priority->wlan_bk_preferred)
+   btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
+
+   if (btcoex_priority->wlan_vi_preferred)
+   btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
+
+   if (btcoex_priority->wlan_vo_preferred)
+   btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
+
+   if (btcoex_priority->wlan_beacon_preferred)
+   btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
+
+   if (btcoex_priority->wlan_mgmt_preferred)
+   btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
+
+   return btcoex_prio;
+}
+
+static int ath10k_mac_op_set_btcoex_priority(struct ieee80211_hw *hw,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio;
+   struct ath10k *ar = hw->priv;
+   int ret;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags))) {
+   ret = -EINVAL;
+   goto exit;
+   }
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED) {
+   ret = -ENETDOWN;
+   goto exit;
+   }
+
+   btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
+
+   if (btcoex_prio > 0x3f) {
+   ret = -E2BIG;
+   goto exit;
+   }
+
+   ret = ath10k_wmi_set_coex_param(ar, btcoex_prio);
+
+   if (ret) {
+   ath10k_warn(ar, "failed to set btcoex priority: %d\n", ret);
+   goto exit;
+   }
+
+exit:
+   mutex_unlock(>conf_mutex);
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7544,6 +7609,7 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
.unassign_vif_chanctx   = ath10k_mac_op_unassign_vif_chanctx,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.set_btcoex = ath10k_mac_op_set_btcoex,
+   .set_btcoex_priority= ath10k_mac_op_set_btcoex_priority,
 
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
 
@@ -8134,6 +8200,18 @@ int ath10k_mac_register(struct ath10k *ar)
 */
ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
 
+   if (test_bit(WMI_SERVICE_BTCOEX, ar->wmi.svc_map)) {
+   ar->hw->wiphy->btcoex_support_flags =
+   WIPHY_WLAN_BE_PREFERRED |
+   WIPHY_WLAN_BK_PREFERRED |
+   WIPHY_WLAN_VI_PREFERRED |
+   WIPHY_WLAN_VO_PREFERRED |
+   WIPHY_WLAN_BEACON_PREFERRED |
+   WIPHY_WLAN_MGMT_PREFERRED;
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex supported mask :%u\n",
+  ar->hw->wiphy->btcoex_support_flags);
+   }
+
switch (ar->running_fw->fw_file.wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->hw->wiphy->iface_combinations = ath10k_if_comb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index c9a8bb1..90c8390 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -197,6 +197,8 @@ struct wmi_ops {
(struct ath10k *ar,
 enum wmi_bss_survey_req_type type);
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 

[PATCHv2 4/4] ath10k: Add support to read btcoex related data from DT

2016-11-17 Thread c_traja
From: Tamizh chelvam 

BTCOEX feature is not supported by all qca40xx chipsets.
Since btcoex enabled by default in firmware, host needs to
enable COEX support depends on the hardware. This patch is
used to read btcoex_support flag and btcoex gpio pin
number from DT. Depends on the btcoex_support flag value
host will expose BTCOEX support and btcoex gpio pin
number to target.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c  |   44 ++-
 drivers/net/wireless/ath/ath10k/core.h  |9 +++
 drivers/net/wireless/ath/ath10k/debug.c |3 +++
 drivers/net/wireless/ath/ath10k/mac.c   |4 ++-
 drivers/net/wireless/ath/ath10k/wmi.c   |1 +
 drivers/net/wireless/ath/ath10k/wmi.h   |2 ++
 6 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 7005e2a..eec2436 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1439,6 +1439,39 @@ static int ath10k_download_cal_data(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+   struct device_node *node;
+   u32 btcoex_support = 0;
+   int ret;
+
+   node = ar->dev->of_node;
+   if (!node)
+   goto out;
+
+   ret = of_property_read_u32(node, "btcoex_support", _support);
+   if (ret) {
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_FOUND;
+   goto out;
+   }
+
+   if (btcoex_support)
+   ar->btcoex_support = ATH10K_DT_BTCOEX_SUPPORTED;
+   else
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_SUPPORTED;
+
+   ret = of_property_read_u32(node, "btcoex_gpio_pin",
+  >btcoex_gpio_pin);
+   if (ret) {
+   ar->btcoex_gpio_pin = -1;
+   goto out;
+   }
+
+out:
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex support flag :%d gpio %d\n",
+  ar->btcoex_support, ar->btcoex_gpio_pin);
+}
+
 static int ath10k_init_uart(struct ath10k *ar)
 {
int ret;
@@ -1920,14 +1953,23 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
val |= WMI_10_4_BSS_CHANNEL_INFO_64;
 
+   ath10k_core_fetch_btcoex_dt(ar);
+
/* 10.4 firmware supports BT-Coex without reloading firmware
 * via pdev param. To support Bluetooth coexistence pdev param,
 * WMI_COEX_GPIO_SUPPORT of extended resource config should be
 * enabled always.
 */
+
+   /* we can still enable BTCOEX if firmware has the support
+* eventhough btceox_support value is
+* ATH10K_DT_BTCOEX_NOT_FOUND
+*/
+
if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features))
+ar->running_fw->fw_file.fw_features) &&
+   ar->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED)
val |= WMI_10_4_COEX_GPIO_SUPPORT;
 
status = ath10k_mac_ext_resource_config(ar, val);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index e8decfa..440e41c 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -656,6 +656,12 @@ enum ath10k_tx_pause_reason {
ATH10K_TX_PAUSE_MAX,
 };
 
+enum ath10k_dt_btcoex_support_flag {
+   ATH10K_DT_BTCOEX_NOT_FOUND,
+   ATH10K_DT_BTCOEX_SUPPORTED,
+   ATH10K_DT_BTCOEX_NOT_SUPPORTED,
+};
+
 struct ath10k_fw_file {
const struct firmware *firmware;
 
@@ -924,6 +930,9 @@ struct ath10k {
u32 reg_ack_cts_timeout_orig;
} fw_coverage;
 
+   enum ath10k_dt_btcoex_support_flag btcoex_support;
+   int btcoex_gpio_pin;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index ea30fbe..e0e316c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2149,6 +2149,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
if (strtobool(buf, ) != 0)
return -EINVAL;
 
+   if (ar->btcoex_support == ATH10K_DT_BTCOEX_NOT_SUPPORTED)
+   return -EOPNOTSUPP;
+
mutex_lock(>conf_mutex);
ret = ath10k_mac_set_btcoex(ar, val);
if (!ret)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ce5d529..25d6c0a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ 

[PATCHv2 3/4] dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt

2016-11-17 Thread c_traja
From: Tamizh chelvam 

There two things done in this patch.

1) 'btcoex_support' flag for BTCOEX feature support by the hardware.
2) 'wlan_btcoex_gpio' is used to fill wlan priority pin number for
   BTCOEX priority feature support.

Signed-off-by: Tamizh chelvam 
---
 .../bindings/net/wireless/qcom,ath10k.txt  |4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 74d7f0a..08150e2d 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -46,6 +46,10 @@ Optional properties:
 hw versions.
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
+- btcoex_support  : should contain eithr "0" or "1" to indicate btcoex
+   support by the hardware.
+- btcoex_gpio_pin :  btcoex gpio pin number for the device which
+supports BTCOEX.
 
 Example (to supply the calibration data alone):
 
-- 
1.7.9.5



[PATCH 4/4] ath10k: Add support to read btcoex related data from DT

2016-11-08 Thread c_traja
From: Tamizh chelvam 

BTCOEX feature is not supported by all qca40xx chipsets.
Since btcoex enabled by default in firmware, host needs to
enable COEX support depends on the hardware. This patch is
used to read btcoex_support flag and btcoex gpio pin
number from DT. Depends on the btcoex_support flag value
host will expose BTCOEX support and btcoex gpio pin
number to target.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c  |   44 ++-
 drivers/net/wireless/ath/ath10k/core.h  |9 +++
 drivers/net/wireless/ath/ath10k/debug.c |3 +++
 drivers/net/wireless/ath/ath10k/mac.c   |4 ++-
 drivers/net/wireless/ath/ath10k/wmi.c   |1 +
 drivers/net/wireless/ath/ath10k/wmi.h   |2 ++
 6 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 7005e2a..eec2436 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1439,6 +1439,39 @@ static int ath10k_download_cal_data(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+   struct device_node *node;
+   u32 btcoex_support = 0;
+   int ret;
+
+   node = ar->dev->of_node;
+   if (!node)
+   goto out;
+
+   ret = of_property_read_u32(node, "btcoex_support", _support);
+   if (ret) {
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_FOUND;
+   goto out;
+   }
+
+   if (btcoex_support)
+   ar->btcoex_support = ATH10K_DT_BTCOEX_SUPPORTED;
+   else
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_SUPPORTED;
+
+   ret = of_property_read_u32(node, "btcoex_gpio_pin",
+  >btcoex_gpio_pin);
+   if (ret) {
+   ar->btcoex_gpio_pin = -1;
+   goto out;
+   }
+
+out:
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex support flag :%d gpio %d\n",
+  ar->btcoex_support, ar->btcoex_gpio_pin);
+}
+
 static int ath10k_init_uart(struct ath10k *ar)
 {
int ret;
@@ -1920,14 +1953,23 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
val |= WMI_10_4_BSS_CHANNEL_INFO_64;
 
+   ath10k_core_fetch_btcoex_dt(ar);
+
/* 10.4 firmware supports BT-Coex without reloading firmware
 * via pdev param. To support Bluetooth coexistence pdev param,
 * WMI_COEX_GPIO_SUPPORT of extended resource config should be
 * enabled always.
 */
+
+   /* we can still enable BTCOEX if firmware has the support
+* eventhough btceox_support value is
+* ATH10K_DT_BTCOEX_NOT_FOUND
+*/
+
if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features))
+ar->running_fw->fw_file.fw_features) &&
+   ar->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED)
val |= WMI_10_4_COEX_GPIO_SUPPORT;
 
status = ath10k_mac_ext_resource_config(ar, val);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index b7067cc..66824c73 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -658,6 +658,12 @@ enum ath10k_tx_pause_reason {
ATH10K_TX_PAUSE_MAX,
 };
 
+enum ath10k_dt_btcoex_support_flag {
+   ATH10K_DT_BTCOEX_NOT_FOUND,
+   ATH10K_DT_BTCOEX_SUPPORTED,
+   ATH10K_DT_BTCOEX_NOT_SUPPORTED,
+};
+
 struct ath10k_fw_file {
const struct firmware *firmware;
 
@@ -926,6 +932,9 @@ struct ath10k {
u32 reg_ack_cts_timeout_orig;
} fw_coverage;
 
+   enum ath10k_dt_btcoex_support_flag btcoex_support;
+   int btcoex_gpio_pin;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index ea30fbe..e0e316c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2149,6 +2149,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
if (strtobool(buf, ) != 0)
return -EINVAL;
 
+   if (ar->btcoex_support == ATH10K_DT_BTCOEX_NOT_SUPPORTED)
+   return -EOPNOTSUPP;
+
mutex_lock(>conf_mutex);
ret = ath10k_mac_set_btcoex(ar, val);
if (!ret)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6b0f1ea..e021951 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ 

[PATCH 3/4] dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt

2016-11-08 Thread c_traja
From: Tamizh chelvam 

There two things done in this patch.

1) 'btcoex_support' flag for BTCOEX feature support by the hardware.
2) 'wlan_btcoex_gpio' is used to fill wlan priority pin number for
   BTCOEX priority feature support.

Signed-off-by: Tamizh chelvam 
---
 .../bindings/net/wireless/qcom,ath10k.txt  |4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 74d7f0a..08150e2d 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -46,6 +46,10 @@ Optional properties:
 hw versions.
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
+- btcoex_support  : should contain eithr "0" or "1" to indicate btcoex
+   support by the hardware.
+- btcoex_gpio_pin :  btcoex gpio pin number for the device which
+supports BTCOEX.
 
 Example (to supply the calibration data alone):
 
-- 
1.7.9.5



[PATCH 1/4] ath10k: Add support to enable or disable btcoex via nl80211

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch add support to enable or disable btcoex via nl80211.
The firmware support this feature since 10.2.4.54 on 2G-only board,
dual band or 5G boards don't support this. WMI service
WMI_SERVICE_COEX_GPIO is used to identify the firmware support of this
feature.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/debug.c |   37 ++--
 drivers/net/wireless/ath/ath10k/mac.c   |   58 +++
 drivers/net/wireless/ath/ath10k/mac.h   |1 +
 3 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 82a4c67..ea30fbe 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -26,6 +26,7 @@
 #include "debug.h"
 #include "hif.h"
 #include "wmi-ops.h"
+#include "mac.h"
 
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
@@ -2138,7 +2139,6 @@ static ssize_t ath10k_write_btcoex(struct file *file,
size_t buf_size;
int ret;
bool val;
-   u32 pdev_param;
 
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, ubuf, buf_size))
@@ -2150,40 +2150,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
return -EINVAL;
 
mutex_lock(>conf_mutex);
-
-   if (ar->state != ATH10K_STATE_ON &&
-   ar->state != ATH10K_STATE_RESTARTED) {
-   ret = -ENETDOWN;
-   goto exit;
-   }
-
-   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val)) {
+   ret = ath10k_mac_set_btcoex(ar, val);
+   if (!ret)
ret = count;
-   goto exit;
-   }
-
-   pdev_param = ar->wmi.pdev_param->enable_btcoex;
-   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features)) {
-   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
-   if (ret) {
-   ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
-   ret = count;
-   goto exit;
-   }
-   } else {
-   ath10k_info(ar, "restarting firmware due to btcoex change");
-   queue_work(ar->workqueue, >restart_work);
-   }
-
-   if (val)
-   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-   else
-   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-
-   ret = count;
-
-exit:
mutex_unlock(>conf_mutex);
 
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index a1a9ba1..f276391 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7447,6 +7447,63 @@ struct ath10k_mac_change_chanctx_arg {
return 0;
 }
 
+static inline void ath10k_mac_update_btcoex_flag(struct ath10k *ar, bool val)
+{
+   if (val)
+   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+   else
+   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+}
+
+int ath10k_mac_set_btcoex(struct ath10k *ar, bool val)
+{
+   u32 pdev_param;
+   int ret;
+
+   lockdep_assert_held(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED)
+   return -ENETDOWN;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
+   return 0;
+
+   pdev_param = ar->wmi.pdev_param->enable_btcoex;
+   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
+ar->running_fw->fw_file.fw_features)) {
+   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
+
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to modify btcoex state: %d\n", ret);
+   return ret;
+   }
+   ath10k_mac_update_btcoex_flag(ar, val);
+   } else {
+   ath10k_info(ar, "restarting firmware due to btcoex change");
+   ath10k_mac_update_btcoex_flag(ar, val);
+   queue_work(ar->workqueue, >restart_work);
+   }
+
+   return 0;
+}
+
+static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
+{
+   int ret;
+   struct ath10k *ar = hw->priv;
+
+   if (!test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
+   return -EOPNOTSUPP;
+
+   mutex_lock(>conf_mutex);
+   ret = ath10k_mac_set_btcoex(ar, enabled);
+   mutex_unlock(>conf_mutex);
+
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7488,6 +7545,7 @@ struct ath10k_mac_change_chanctx_arg {
.assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
.unassign_vif_chanctx   = 

[PATCH 2/4] ath10k: Add support to update btcoex priority value via nl80211

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch adds support to update btcoex priority value via nl80211.
Here driver will be exposing the supported frame format for this
feature via btcoex_support_flags which is a member of
wiphy structure. 10.4 based firmware support this feature.
WMI service WMI_SERVICE_BTCOEX is used to identify the firmware support
of this feature. BTCOEX needs to enable to modify this value.

This patch has dependency of
"cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX"
patch.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/mac.c |   76 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   19 
 drivers/net/wireless/ath/ath10k/wmi.c |   19 
 drivers/net/wireless/ath/ath10k/wmi.h |   18 +++
 4 files changed, 132 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f276391..6b0f1ea 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7504,6 +7504,69 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
return ret;
 }
 
+u32
+ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio = 0;
+
+   if (btcoex_priority->wlan_be_preferred)
+   btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
+
+   if (btcoex_priority->wlan_bk_preferred)
+   btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
+
+   if (btcoex_priority->wlan_vi_preferred)
+   btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
+
+   if (btcoex_priority->wlan_vo_preferred)
+   btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
+
+   if (btcoex_priority->wlan_beacon_preferred)
+   btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
+
+   if (btcoex_priority->wlan_mgmt_preferred)
+   btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
+
+   return btcoex_prio;
+}
+
+static int ath10k_mac_op_set_btcoex_priority(struct ieee80211_hw *hw,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio;
+   struct ath10k *ar = hw->priv;
+   int ret;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags))) {
+   ret = -EINVAL;
+   goto exit;
+   }
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED) {
+   ret = -ENETDOWN;
+   goto exit;
+   }
+
+   btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
+
+   if (btcoex_prio > 0x3f)
+   return -E2BIG;
+
+   ret = ath10k_wmi_set_coex_param(ar, btcoex_prio);
+
+   if (ret) {
+   ath10k_warn(ar, "failed to set btcoex priority: %d\n", ret);
+   goto exit;
+   }
+
+exit:
+   mutex_unlock(>conf_mutex);
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7546,6 +7609,7 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
.unassign_vif_chanctx   = ath10k_mac_op_unassign_vif_chanctx,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.set_btcoex = ath10k_mac_op_set_btcoex,
+   .set_btcoex_priority= ath10k_mac_op_set_btcoex_priority,
 
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
 
@@ -8136,6 +8200,18 @@ int ath10k_mac_register(struct ath10k *ar)
 */
ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
 
+   if (test_bit(WMI_SERVICE_BTCOEX, ar->wmi.svc_map)) {
+   ar->hw->wiphy->btcoex_support_flags =
+   WIPHY_WLAN_BE_PREFERRED |
+   WIPHY_WLAN_BK_PREFERRED |
+   WIPHY_WLAN_VI_PREFERRED |
+   WIPHY_WLAN_VO_PREFERRED |
+   WIPHY_WLAN_BEACON_PREFERRED |
+   WIPHY_WLAN_MGMT_PREFERRED;
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex supported mask :%u\n",
+  ar->hw->wiphy->btcoex_support_flags);
+   }
+
switch (ar->running_fw->fw_file.wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->hw->wiphy->iface_combinations = ath10k_if_comb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index c9a8bb1..90c8390 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -197,6 +197,8 @@ struct wmi_ops {
(struct ath10k *ar,
 enum wmi_bss_survey_req_type type);
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
+   struct sk_buff 

[PATCH 0/4] ath10k: Add support for BTCOEX feature.

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch set add support to enable/disable BTCOEX via nl80211,
also support to update BTCOEX priority value for 10.4 based firmware.
Document the dt entry in qcom,ath10k.txt and reads btcoex support
flag and btcoex gpio pin detail from dt.

Tamizh chelvam (4):
  ath10k: Add support to enable or disable btcoex via nl80211
  ath10k: Add support to update btcoex priority value via nl80211
  dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
  ath10k: Add support to read btcoex related data from DT

 .../bindings/net/wireless/qcom,ath10k.txt  |4 +
 drivers/net/wireless/ath/ath10k/core.c |   44 ++-
 drivers/net/wireless/ath/ath10k/core.h |9 ++
 drivers/net/wireless/ath/ath10k/debug.c|   40 +-
 drivers/net/wireless/ath/ath10k/mac.c  |  138 +++-
 drivers/net/wireless/ath/ath10k/mac.h  |1 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h  |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   20 +++
 drivers/net/wireless/ath/ath10k/wmi.h  |   20 +++
 9 files changed, 259 insertions(+), 36 deletions(-)

-- 
1.7.9.5



[PATCH 2/4] cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This change enables user to set high priority for driver supported wlan
frames when BTCOEX enabled. The drivers that expose such capability make
use of this priority table to decide to whom the radio should be shared
(either bluetooth or WLAN). When the high priority frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise the frame type for which it supports
BTCOEX priority configuration through btcoex_support_flags.
This will be useful when wlan needs to transfer packet to avoid
connection lost or packet drop issue when BT is active on long time.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   65 +++
 include/uapi/linux/nl80211.h |   37 
 net/wireless/nl80211.c   |  101 ++
 net/wireless/rdev-ops.h  |   13 ++
 net/wireless/trace.h |   43 ++
 5 files changed, 259 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 919ed1d..d52d76b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2434,6 +2434,27 @@ struct cfg80211_nan_func {
 };
 
 /**
+ * struct cfg80211_btcoex_priority - BTCOEX support frame type
+ *
+ * This structure defines the driver supporting frame types for BTCOEX
+ *
+ * @wlan_be_preferred: best effort frames preferred over bt traffic
+ * @wlan_bk_preferred: background frames preferred over bt traffic
+ * @wlan_vi_preferred: video frames preferred over bt traffic
+ * @wlan_vo_preferred: voice frames preferred over bt traffic
+ * @wlan_beacon_preferred: beacon preferred over bt traffic
+ * @wlan_mgmt_preferred: management frames preferred ovet bt traffic
+ */
+struct cfg80211_btcoex_priority {
+   bool wlan_be_preferred;
+   bool wlan_bk_preferred;
+   bool wlan_vi_preferred;
+   bool wlan_vo_preferred;
+   bool wlan_beacon_preferred;
+   bool wlan_mgmt_preferred;
+};
+
+/**
  * struct cfg80211_ops - backend description for wireless configuration
  *
  * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2737,6 +2758,11 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  * @set_btcoex: Use this callback to call driver API when user wants to
  * enable/disable btcoex.
+ * @set_btcoex_priority: Use this callback to set wlan high
+ * priority frames over bluetooth. Driver supported wlan frames
+ * for the BTCOEX is exposed by btcoex_support_flags.
+ * When BTCOEX enabled, the high priority wlan frames will have
+ * more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3014,6 +3040,8 @@ struct cfg80211_ops {
   struct cfg80211_nan_conf *conf,
   u32 changes);
int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
+   int (*set_btcoex_priority)(struct wiphy *wiphy,
+   struct cfg80211_btcoex_priority *btcoex_priority);
 };
 
 /*
@@ -3253,6 +3281,38 @@ struct wiphy_wowlan_support {
 };
 
 /**
+ * wiphy_btcoex_support_flags
+ * This enum has the driver supported frame types for BTCOEX.
+ * @WIPHY_WLAN_BE_PREFERRED - Supports Best Effort frame for BTCOEX
+ * @WIPHY_WLAN_BK_PREFERRED - supports Background frame for BTCOEX
+ * @WIPHY_WLAN_VI_PREFERRED - supports Video frame for BTCOEX
+ * @WIPHY_WLAN_VO_PREFERRED - supports Voice frame for BTCOEX
+ * @WIPHY_WLAN_BEACON_PREFERRED - supports Beacon frame for BTCOEX
+ * @WIPHY_WLAN_MGMT_PREFERRED - supports Management frames for BTCOEX.
+ */
+
+enum wiphy_btcoex_support_flags {
+   WIPHY_WLAN_BE_PREFERRED = BIT(0),
+   WIPHY_WLAN_BK_PREFERRED = BIT(1),
+   WIPHY_WLAN_VI_PREFERRED = BIT(2),
+   WIPHY_WLAN_VO_PREFERRED = BIT(3),
+   WIPHY_WLAN_BEACON_PREFERRED = BIT(4),
+   WIPHY_WLAN_MGMT_PREFERRED   = BIT(5),
+};
+
+/**
+ * enum wiphy_btcoex_priority - BTCOEX priority level
+ * This enum defines priority level for BTCOEX
+ * WIPHY_WLAN_PREFERRED_LOW - low priority frames over BT traffic
+ * WIPHY_WLAN_PREFERRED_HIGH - high priority frames over BT traffic
+ */
+
+enum wiphy_btcoex_priority {
+   WIPHY_WLAN_PREFERRED_LOW = false,
+   WIPHY_WLAN_PREFERRED_HIGH = true,
+};
+
+/**
  * struct wiphy_coalesce_support - coalesce support data
  * @n_rules: maximum number of coalesce rules
  * @max_delay: maximum supported coalescing delay in msecs
@@ -3430,6 +3490,10 @@ struct wiphy_iftype_ext_capab {
  * used since access to it is necessarily racy, use the parameter passed
  * to the suspend() operation instead.
  *
+ * @btcoex_support_flags: This will have the driver supported
+ * frame types for BTCOEX. This value filled by using
+ * %enum wiphy_btcoex_support_flags while driver
+ * 

[PATCH 4/4] mac80211: Add support to update btcoex priority value

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver callback drv_set_btcoex_priority
to pass the priority value to driver.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|7 +++
 net/mac80211/cfg.c|9 +
 net/mac80211/driver-ops.h |   12 
 3 files changed, 28 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e7db763..3c61015 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3456,6 +3456,11 @@ enum ieee80211_reconfig_type {
  *
  * @set_btcoex_: set_btcoex: Called when BTCOEX is enabled/disabled, use
  * this callback to enable or disable btcoex.
+ * @set_btcoex_priority: Use this callback to set wlan high
+ * priority frames over bluetooth. Driver supported wlan frames
+ * for the BTCOEX is exposed by btcoex_support_flags.
+ * When BTCOEX enabled, the high priority wlan frames will have
+ * more priority than BT.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3709,6 +3714,8 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
u8 instance_id);
int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
+   int (*set_btcoex_priority)(struct ieee80211_hw *hw,
+   struct cfg80211_btcoex_priority *btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a687056..d75cf97 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3569,6 +3569,14 @@ static int ieee80211_set_btcoex(struct wiphy *wiphy, 
bool enabled)
return drv_set_btcoex(local, enabled);
 }
 
+static int ieee80211_set_btcoex_priority(struct wiphy *wiphy,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex_priority(local, btcoex_priority);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3660,4 +3668,5 @@ static int ieee80211_set_btcoex(struct wiphy *wiphy, bool 
enabled)
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_btcoex = ieee80211_set_btcoex,
+   .set_btcoex_priority = ieee80211_set_btcoex_priority,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 16d9c98..75ac3ed 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1262,4 +1262,16 @@ static inline int drv_set_btcoex(struct ieee80211_local 
*local,
return ret;
 }
 
+static inline int drv_set_btcoex_priority(struct ieee80211_local *local,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   int ret = -EOPNOTSUPP;
+
+   if (local->ops->set_btcoex_priority)
+   ret = local->ops->set_btcoex_priority(>hw,
+ btcoex_priority);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
-- 
1.7.9.5



[PATCH 1/4] cfg80211: Add support to enable or disable btcoex

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch adds support to enable or disable btcoex by
adding NL80211_ATTR_WIPHY_BTCOEX_ENABLE attribute in
NL80211_CMD_SET_WIPHY command. By default BTCOEX disabled in driver.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |3 +++
 include/uapi/linux/nl80211.h |6 ++
 net/wireless/nl80211.c   |   18 ++
 net/wireless/rdev-ops.h  |   11 +++
 net/wireless/trace.h |5 +
 5 files changed, 43 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9390365..919ed1d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2735,6 +2735,8 @@ struct cfg80211_nan_func {
  * @nan_change_conf: changes NAN configuration. The changed parameters must
  * be specified in @changes (using  cfg80211_nan_conf_changes);
  * All other parameters must be ignored.
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3011,6 +3013,7 @@ struct cfg80211_ops {
   struct wireless_dev *wdev,
   struct cfg80211_nan_conf *conf,
   u32 changes);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1362d24..c47fe6c8 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1937,6 +1937,10 @@ enum nl80211_commands {
  * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
  * See  nl80211_nan_match_attributes.
  *
+ * @NL80211_ATTR_WIPHY_BTCOEX_ENABLE: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_WIPHY it contains
+ * either 0 for disable or 1 for enable btcoex.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2336,6 +2340,8 @@ enum nl80211_attrs {
NL80211_ATTR_NAN_FUNC,
NL80211_ATTR_NAN_MATCH,
 
+   NL80211_ATTR_WIPHY_BTCOEX_ENABLE,
+
/* 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 46cd489..5b77a41 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -414,6 +414,7 @@ enum nl80211_multicast_groups {
[NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 },
[NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 },
[NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED },
+   [NL80211_ATTR_WIPHY_BTCOEX_ENABLE] = { .type = NLA_U8 },
 };
 
 /* policy for the key attributes */
@@ -2356,6 +2357,23 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
return result;
}
 
+   if (info->attrs[NL80211_ATTR_WIPHY_BTCOEX_ENABLE]) {
+   u8 val;
+
+   if (!rdev->ops->set_btcoex)
+   return -ENOTSUPP;
+
+   val = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_BTCOEX_ENABLE]);
+
+   if (val > 1)
+   return -EINVAL;
+
+   result = rdev_set_btcoex(rdev, val);
+
+   if (result)
+   return result;
+   }
+
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
u32 tx_ant, rx_ant;
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 11cf83c..2e547c3 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1129,4 +1129,15 @@ static inline int rdev_set_qos_map(struct 
cfg80211_registered_device *rdev,
trace_rdev_return_int(>wiphy, ret);
return ret;
 }
+
+static inline int
+rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled)
+{
+   int ret;
+
+   trace_rdev_set_btcoex(>wiphy, enabled);
+   ret = rdev->ops->set_btcoex(>wiphy, enabled);
+   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 a3d0a91b..c9c6579 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3026,6 +3026,11 @@
  WIPHY_PR_ARG, __entry->n_rules)
 );
 
+DEFINE_EVENT(wiphy_enabled_evt, rdev_set_btcoex,
+   TP_PROTO(struct wiphy *wiphy, bool enabled),
+   TP_ARGS(wiphy, enabled)
+);
+
 DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
-- 
1.7.9.5



[PATCH 3/4] mac80211: Add support to enable or disable btcoex

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex
This API will pass user space value to driver to
enable or disabe btcoex.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|4 
 net/mac80211/cfg.c|8 
 net/mac80211/driver-ops.h |   14 ++
 net/mac80211/trace.h  |   14 ++
 4 files changed, 40 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b9b24ab..e7db763 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3453,6 +3453,9 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ *
+ * @set_btcoex_: set_btcoex: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3705,6 +3708,7 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index eb68add..a687056 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3562,6 +3562,13 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL(ieee80211_nan_func_match);
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3652,4 +3659,5 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
.nan_change_conf = ieee80211_nan_change_conf,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..16d9c98 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,18 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(>hw, enabled);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 92a47af..760dfb6 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,20 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled),
+   TP_ARGS(local, enabled),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   ),
+   TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCH 0/4] cfg80211: mac80211: BTCOEX feature support

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable btcoex
and modifying btcoex priority value via nl80211.

Tamizh chelvam (4):
  cfg80211: Add support to enable or disable btcoex
  cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX
  mac80211: Add support to enable or disable btcoex
  mac80211: Add support to update btcoex priority value

 include/net/cfg80211.h   |   68 
 include/net/mac80211.h   |   11 
 include/uapi/linux/nl80211.h |   43 +++
 net/mac80211/cfg.c   |   17 ++
 net/mac80211/driver-ops.h|   26 +
 net/mac80211/trace.h |   14 +
 net/wireless/nl80211.c   |  119 ++
 net/wireless/rdev-ops.h  |   24 +
 net/wireless/trace.h |   48 +
 9 files changed, 370 insertions(+)

-- 
1.7.9.5



[PATCH] ath10k: Add WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT wmi service

2016-08-02 Thread c_traja
From: Tamizh chelvam 

WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT service has missed in
the commit 7e247a9e88dc ("ath10k: add dynamic tx mode switch
config support for qca4019"). This patch adds the service to
avoid mismatch between host and target.

Fixes:7e247a9e88dc ("ath10k: add dynamic tx mode switch config support for 
qca4019")
Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/wmi.h |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 3ef4688..f67cc19 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -180,6 +180,7 @@ enum wmi_service {
WMI_SERVICE_MESH_NON_11S,
WMI_SERVICE_PEER_STATS,
WMI_SERVICE_RESTRT_CHNL_SUPPORT,
+   WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
WMI_SERVICE_TX_MODE_PUSH_ONLY,
WMI_SERVICE_TX_MODE_PUSH_PULL,
WMI_SERVICE_TX_MODE_DYNAMIC,
@@ -305,6 +306,7 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
WMI_10_4_SERVICE_PEER_STATS,
WMI_10_4_SERVICE_MESH_11S,
+   WMI_10_4_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
@@ -402,6 +404,7 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_MESH_NON_11S);
SVCSTR(WMI_SERVICE_PEER_STATS);
SVCSTR(WMI_SERVICE_RESTRT_CHNL_SUPPORT);
+   SVCSTR(WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT);
SVCSTR(WMI_SERVICE_TX_MODE_PUSH_ONLY);
SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL);
SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC);
@@ -652,6 +655,8 @@ static inline void wmi_10_4_svc_map(const __le32 *in, 
unsigned long *out,
   WMI_SERVICE_PEER_STATS, len);
SVCMAP(WMI_10_4_SERVICE_MESH_11S,
   WMI_SERVICE_MESH_11S, len);
+   SVCMAP(WMI_10_4_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
+  WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT, len);
SVCMAP(WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
   WMI_SERVICE_TX_MODE_PUSH_ONLY, len);
SVCMAP(WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
-- 
1.7.9.5

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


[PATCHv3] dts: Add btcoex_support flag in device tree

2016-07-01 Thread c_traja
From: Tamizh chelvam 

BTCOEX feature is not available in all qca40xx chipsets.
To expose the btcoex support, this patch add btcoex_support
flag in device tree. If this value is 1 then the hardware
supports btcoex and 0 for not support.

Signed-off-by: Tamizh chelvam 
---
v3:
  * separated from ath10k patch.

v2:
  * Used CAF address.

 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi 
b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
index b9457dd..f2a2345 100644
--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
@@ -91,6 +91,14 @@
};
};
 
+   wifi0: wifi@a00 {
+   btcoex_support = <0x1>;
+   }
+
+   wifi1: wifi@a80 {
+   btcoex_support = <0x0>;
+   }
+
serial@78af000 {
pinctrl-0 = <_pins>;
pinctrl-names = "default";
-- 
1.7.9.5

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


[PATCHv3 3/3] ath10k: add testmode support for 10.4 firmware

2016-07-01 Thread c_traja
From: Tamizh chelvam 

This patch adds testmode support for 10.4 based chipsets
and added code swap support for UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/testmode.c 
b/drivers/net/wireless/ath/ath10k/testmode.c
index 120f423..7b8e33b 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -23,6 +23,7 @@
 #include "wmi.h"
 #include "hif.h"
 #include "hw.h"
+#include "core.h"
 
 #include "testmode_i.h"
 
@@ -240,6 +241,18 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, 
struct nlattr *tb[])
goto err;
}
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len) {
+   ret = ath10k_swap_code_seg_init(ar,
+   >testmode.utf_mode_fw.fw_file);
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to init utf code swap segment: %d\n",
+   ret);
+   goto err_release_utf_mode_fw;
+   }
+   }
+
spin_lock_bh(>data_lock);
ar->testmode.utf_monitor = true;
spin_unlock_bh(>data_lock);
@@ -279,6 +292,11 @@ err_power_down:
ath10k_hif_power_down(ar);
 
 err_release_utf_mode_fw:
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+>testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
@@ -301,6 +319,11 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
 
spin_unlock_bh(>data_lock);
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+>testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
-- 
1.7.9.5

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


[PATCHv3 2/3] ath10k: handle testmode events for 10.2 and 10.4 based firmware

2016-07-01 Thread c_traja
From: Tamizh chelvam 

Currently testmode events for 10.x firmware are processed from
10.1 wmi event processing. This patch is used to handle testmode
events in 10.2 and 10.4 based firmware.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/wmi.c |   26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 12a4347..6c82a89 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5097,6 +5097,7 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 {
struct wmi_cmd_hdr *cmd_hdr;
enum wmi_10_2_event_id id;
+   bool consumed;
 
cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
@@ -5106,6 +5107,18 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 
trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
+   consumed = ath10k_tm_event_wmi(ar, id, skb);
+
+   /* Ready event must be handled normally also in UTF mode so that we
+* know the UTF firmware has booted, others we are just bypass WMI
+* events to testmode.
+*/
+   if (consumed && id != WMI_10_2_READY_EVENTID) {
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "wmi testmode consumed 0x%x\n", id);
+   goto out;
+   }
+
switch (id) {
case WMI_10_2_MGMT_RX_EVENTID:
ath10k_wmi_event_mgmt_rx(ar, skb);
@@ -5221,6 +5234,7 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 {
struct wmi_cmd_hdr *cmd_hdr;
enum wmi_10_4_event_id id;
+   bool consumed;
 
cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
@@ -5230,6 +5244,18 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 
trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
+   consumed = ath10k_tm_event_wmi(ar, id, skb);
+
+   /* Ready event must be handled normally also in UTF mode so that we
+* know the UTF firmware has booted, others we are just bypass WMI
+* events to testmode.
+*/
+   if (consumed && id != WMI_10_4_READY_EVENTID) {
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "wmi testmode consumed 0x%x\n", id);
+   goto out;
+   }
+
switch (id) {
case WMI_10_4_MGMT_RX_EVENTID:
ath10k_wmi_event_mgmt_rx(ar, skb);
-- 
1.7.9.5

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


[PATCHv3 1/3] ath10k: move firmware_swap_code_seg_info to ath10k_fw_file

2016-07-01 Thread c_traja
From: Tamizh chelvam 

Preparation to make use of firmware_swap_code_seg_info for UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 4 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index dfb3db0..0a1946b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -723,7 +723,7 @@ static int ath10k_download_fw(struct ath10k *ar)
data = ar->running_fw->fw_file.firmware_data;
data_len = ar->running_fw->fw_file.firmware_len;
 
-   ret = ath10k_swap_code_seg_configure(ar);
+   ret = ath10k_swap_code_seg_configure(ar, >running_fw->fw_file);
if (ret) {
ath10k_err(ar, "failed to configure fw code swap: %d\n",
   ret);
@@ -765,7 +765,7 @@ static void ath10k_core_free_firmware_files(struct ath10k 
*ar)
if (!IS_ERR(ar->pre_cal_file))
release_firmware(ar->pre_cal_file);
 
-   ath10k_swap_code_seg_release(ar);
+   ath10k_swap_code_seg_release(ar, >normal_mode_fw.fw_file);
 
ar->normal_mode_fw.fw_file.otp_data = NULL;
ar->normal_mode_fw.fw_file.otp_len = 0;
@@ -2009,7 +2009,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_free_firmware_files;
}
 
-   ret = ath10k_swap_code_seg_init(ar);
+   ret = ath10k_swap_code_seg_init(ar, >normal_mode_fw.fw_file);
if (ret) {
ath10k_err(ar, "failed to initialize code swap segment: %d\n",
   ret);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3da18c9..e69e7e7 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -654,6 +654,8 @@ struct ath10k_fw_file {
 
const void *codeswap_data;
size_t codeswap_len;
+   /* FIXME: add a comment */
+   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
 };
 
 struct ath10k_fw_components {
@@ -765,10 +767,6 @@ struct ath10k {
const struct firmware *cal_file;
 
struct {
-   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
-   } swap;
-
-   struct {
u32 vendor;
u32 device;
u32 subsystem_vendor;
diff --git a/drivers/net/wireless/ath/ath10k/swap.c 
b/drivers/net/wireless/ath/ath10k/swap.c
index 0c5f586..adf4592 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -134,17 +134,18 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t 
swap_bin_len)
return seg_info;
 }
 
-int ath10k_swap_code_seg_configure(struct ath10k *ar)
+int ath10k_swap_code_seg_configure(struct ath10k *ar,
+  const struct ath10k_fw_file *fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info = NULL;
 
-   if (!ar->swap.firmware_swap_code_seg_info)
+   if (!fw_file->firmware_swap_code_seg_info)
return 0;
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot found firmware code swap 
binary\n");
 
-   seg_info = ar->swap.firmware_swap_code_seg_info;
+   seg_info = fw_file->firmware_swap_code_seg_info;
 
ret = ath10k_bmi_write_memory(ar, seg_info->target_addr,
  _info->seg_hw_info,
@@ -158,28 +159,29 @@ int ath10k_swap_code_seg_configure(struct ath10k *ar)
return 0;
 }
 
-void ath10k_swap_code_seg_release(struct ath10k *ar)
+void ath10k_swap_code_seg_release(struct ath10k *ar,
+ struct ath10k_fw_file *fw_file)
 {
-   ath10k_swap_code_seg_free(ar, ar->swap.firmware_swap_code_seg_info);
+   ath10k_swap_code_seg_free(ar, fw_file->firmware_swap_code_seg_info);
 
/* FIXME: these two assignments look to bein wrong place! Shouldn't
 * they be in ath10k_core_free_firmware_files() like the rest?
 */
-   ar->normal_mode_fw.fw_file.codeswap_data = NULL;
-   ar->normal_mode_fw.fw_file.codeswap_len = 0;
+   fw_file->codeswap_data = NULL;
+   fw_file->codeswap_len = 0;
 
-   ar->swap.firmware_swap_code_seg_info = NULL;
+   fw_file->firmware_swap_code_seg_info = NULL;
 }
 
-int ath10k_swap_code_seg_init(struct ath10k *ar)
+int ath10k_swap_code_seg_init(struct ath10k *ar, struct ath10k_fw_file 
*fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info;
const void *codeswap_data;
size_t codeswap_len;
 
-   codeswap_data = ar->normal_mode_fw.fw_file.codeswap_data;
-   codeswap_len = ar->normal_mode_fw.fw_file.codeswap_len;

[PATCHv3 0/3]ath10k: Add testmode support for 10.4

2016-07-01 Thread c_traja
From: Tamizh chelvam 

* The below patches add testmode support for 10.4.

* Some of the codeswap related code in ath10k for example code which 
  initializes the code swap segment works only on normal fw, below patches 
  make such code generic so that it can be used for utf binary as well.

Tamizh chelvam (3):
  ath10k: move firmware_swap_code_seg_info to ath10k_fw_file
  ath10k: handle testmode events for 10.2 and 10.4 based firmware
  ath10k: add testmode support for 10.4 firmware

v3:
  * Fixed crash reported by Kalle.

v2:
  * changed author and signed off mail id.

 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   26 ++
 6 files changed, 76 insertions(+), 22 deletions(-)

-- 
1.7.9.5

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


[PATCHV2 3/3] ath10k: add testmode support for 10.4 firmware

2016-06-27 Thread c_traja
From: Tamizh chelvam 

This patch adds testmode support for QCA99X0 chipsets which uses
10.4 firmware and added code swap support for UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/testmode.c 
b/drivers/net/wireless/ath/ath10k/testmode.c
index 120f423..2c10c0e 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -23,6 +23,7 @@
 #include "wmi.h"
 #include "hif.h"
 #include "hw.h"
+#include "core.h"
 
 #include "testmode_i.h"
 
@@ -240,6 +241,18 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, 
struct nlattr *tb[])
goto err;
}
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len) {
+   ret = ath10k_swap_code_seg_init(ar,
+   >testmode.utf_mode_fw.fw_file);
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to init utf code swap segment: %d\n",
+   ret);
+   goto err_release_utf_mode_fw;
+   }
+   }
+
spin_lock_bh(>data_lock);
ar->testmode.utf_monitor = true;
spin_unlock_bh(>data_lock);
@@ -279,6 +292,11 @@ err_power_down:
ath10k_hif_power_down(ar);
 
 err_release_utf_mode_fw:
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+   >testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
@@ -301,6 +319,11 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
 
spin_unlock_bh(>data_lock);
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+   >testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
-- 
1.7.9.5

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


[PATCHV2 0/3] Add testmode support for 10.4

2016-06-27 Thread c_traja
From: Tamizh chelvam 

*The below patches add testmode support for 10.4.

*Some of the codeswap related code in ath10k for example code
which  initializes the code swap segment works only on normal fw,
below patches  make such code generic so that it can be used
for utf binary as well.

Tamizh chelvam (3):
  ath10k: move firmware_swap_code_seg_info to ath10k_fw_file
  ath10k: handle testmode events for 10.2 and 10.4 based firmware
  ath10k: add testmode support for 10.4 firmware

V2:
  * changed author and signed off mail id.

 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   26 ++
 6 files changed, 76 insertions(+), 22 deletions(-)

-- 
1.7.9.5

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


[PATCHV2 1/3] ath10k: move firmware_swap_code_seg_info to ath10k_fw_file

2016-06-27 Thread c_traja
From: Tamizh chelvam 

Preparation to make use of firmware_swap_code_seg_info for
UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 4 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index dfb3db0..0a1946b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -723,7 +723,7 @@ static int ath10k_download_fw(struct ath10k *ar)
data = ar->running_fw->fw_file.firmware_data;
data_len = ar->running_fw->fw_file.firmware_len;
 
-   ret = ath10k_swap_code_seg_configure(ar);
+   ret = ath10k_swap_code_seg_configure(ar, >running_fw->fw_file);
if (ret) {
ath10k_err(ar, "failed to configure fw code swap: %d\n",
   ret);
@@ -765,7 +765,7 @@ static void ath10k_core_free_firmware_files(struct ath10k 
*ar)
if (!IS_ERR(ar->pre_cal_file))
release_firmware(ar->pre_cal_file);
 
-   ath10k_swap_code_seg_release(ar);
+   ath10k_swap_code_seg_release(ar, >normal_mode_fw.fw_file);
 
ar->normal_mode_fw.fw_file.otp_data = NULL;
ar->normal_mode_fw.fw_file.otp_len = 0;
@@ -2009,7 +2009,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_free_firmware_files;
}
 
-   ret = ath10k_swap_code_seg_init(ar);
+   ret = ath10k_swap_code_seg_init(ar, >normal_mode_fw.fw_file);
if (ret) {
ath10k_err(ar, "failed to initialize code swap segment: %d\n",
   ret);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3da18c9..e69e7e7 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -654,6 +654,8 @@ struct ath10k_fw_file {
 
const void *codeswap_data;
size_t codeswap_len;
+   /* FIXME: add a comment */
+   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
 };
 
 struct ath10k_fw_components {
@@ -765,10 +767,6 @@ struct ath10k {
const struct firmware *cal_file;
 
struct {
-   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
-   } swap;
-
-   struct {
u32 vendor;
u32 device;
u32 subsystem_vendor;
diff --git a/drivers/net/wireless/ath/ath10k/swap.c 
b/drivers/net/wireless/ath/ath10k/swap.c
index 0c5f586..c904a41 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -134,17 +134,18 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t 
swap_bin_len)
return seg_info;
 }
 
-int ath10k_swap_code_seg_configure(struct ath10k *ar)
+int ath10k_swap_code_seg_configure(struct ath10k *ar,
+  const struct ath10k_fw_file *fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info = NULL;
 
-   if (!ar->swap.firmware_swap_code_seg_info)
+   if (fw_file->firmware_swap_code_seg_info)
return 0;
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot found firmware code swap 
binary\n");
 
-   seg_info = ar->swap.firmware_swap_code_seg_info;
+   seg_info = fw_file->firmware_swap_code_seg_info;
 
ret = ath10k_bmi_write_memory(ar, seg_info->target_addr,
  _info->seg_hw_info,
@@ -158,28 +159,29 @@ int ath10k_swap_code_seg_configure(struct ath10k *ar)
return 0;
 }
 
-void ath10k_swap_code_seg_release(struct ath10k *ar)
+void ath10k_swap_code_seg_release(struct ath10k *ar,
+ struct ath10k_fw_file *fw_file)
 {
-   ath10k_swap_code_seg_free(ar, ar->swap.firmware_swap_code_seg_info);
+   ath10k_swap_code_seg_free(ar, fw_file->firmware_swap_code_seg_info);
 
/* FIXME: these two assignments look to bein wrong place! Shouldn't
 * they be in ath10k_core_free_firmware_files() like the rest?
 */
-   ar->normal_mode_fw.fw_file.codeswap_data = NULL;
-   ar->normal_mode_fw.fw_file.codeswap_len = 0;
+   fw_file->codeswap_data = NULL;
+   fw_file->codeswap_len = 0;
 
-   ar->swap.firmware_swap_code_seg_info = NULL;
+   fw_file->firmware_swap_code_seg_info = NULL;
 }
 
-int ath10k_swap_code_seg_init(struct ath10k *ar)
+int ath10k_swap_code_seg_init(struct ath10k *ar, struct ath10k_fw_file 
*fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info;
const void *codeswap_data;
size_t codeswap_len;
 
-   codeswap_data = ar->normal_mode_fw.fw_file.codeswap_data;
-   codeswap_len = ar->normal_mode_fw.fw_file.codeswap_len;
+ 

[PATCH 3/3] ath10k: add testmode support for 10.4 firmware

2016-06-27 Thread c_traja
From: Tamizh chelvam 

This patch adds testmode support for QCA99X0 chipsets which uses
10.4 firmware and added code swap support for UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/testmode.c 
b/drivers/net/wireless/ath/ath10k/testmode.c
index 120f423..2c10c0e 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -23,6 +23,7 @@
 #include "wmi.h"
 #include "hif.h"
 #include "hw.h"
+#include "core.h"
 
 #include "testmode_i.h"
 
@@ -240,6 +241,18 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, 
struct nlattr *tb[])
goto err;
}
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len) {
+   ret = ath10k_swap_code_seg_init(ar,
+   >testmode.utf_mode_fw.fw_file);
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to init utf code swap segment: %d\n",
+   ret);
+   goto err_release_utf_mode_fw;
+   }
+   }
+
spin_lock_bh(>data_lock);
ar->testmode.utf_monitor = true;
spin_unlock_bh(>data_lock);
@@ -279,6 +292,11 @@ err_power_down:
ath10k_hif_power_down(ar);
 
 err_release_utf_mode_fw:
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+   >testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
@@ -301,6 +319,11 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
 
spin_unlock_bh(>data_lock);
 
+   if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+   ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+   ath10k_swap_code_seg_release(ar,
+   >testmode.utf_mode_fw.fw_file);
+
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
-- 
1.7.9.5

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


[PATCH 2/3] ath10k: handle testmode events for 10.2 and 10.4 based firmware

2016-06-27 Thread c_traja
From: Tamizh chelvam 

Currently testmode events for 10.x firmware are processed from
10.1 wmi event processing. This patch is used to handle testmode
events in 10.2 and 10.4 based firmware.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/wmi.c |   26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6279ab4..72b5483 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5095,6 +5095,7 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 {
struct wmi_cmd_hdr *cmd_hdr;
enum wmi_10_2_event_id id;
+   bool consumed;
 
cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
@@ -5104,6 +5105,18 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 
trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
+   consumed = ath10k_tm_event_wmi(ar, id, skb);
+
+   /* Ready event must be handled normally also in UTF mode so that we
+* know the UTF firmware has booted, others we are just bypass WMI
+* events to testmode.
+*/
+   if (consumed && id != WMI_10_2_READY_EVENTID) {
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "wmi testmode consumed 0x%x\n", id);
+   goto out;
+   }
+
switch (id) {
case WMI_10_2_MGMT_RX_EVENTID:
ath10k_wmi_event_mgmt_rx(ar, skb);
@@ -5219,6 +5232,7 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 {
struct wmi_cmd_hdr *cmd_hdr;
enum wmi_10_4_event_id id;
+   bool consumed;
 
cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
@@ -5228,6 +5242,18 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
 
trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
+   consumed = ath10k_tm_event_wmi(ar, id, skb);
+
+   /* Ready event must be handled normally also in UTF mode so that we
+* know the UTF firmware has booted, others we are just bypass WMI
+* events to testmode.
+*/
+   if (consumed && id != WMI_10_4_READY_EVENTID) {
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "wmi testmode consumed 0x%x\n", id);
+   goto out;
+   }
+
switch (id) {
case WMI_10_4_MGMT_RX_EVENTID:
ath10k_wmi_event_mgmt_rx(ar, skb);
-- 
1.7.9.5

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


[PATCH 0/3] Add testmode support for 10.4

2016-06-27 Thread c_traja
From: Tamizh chelvam 

*The below patches add testmode support for 10.4.

*Some of the codeswap related code in ath10k for example code
which  initializes the code swap segment works only on normal fw,
below patches  make such code generic so that it can be used
for utf binary as well.

Tamizh chelvam (3):
  ath10k: move firmware_swap_code_seg_info to ath10k_fw_file
  ath10k: handle testmode events for 10.2 and 10.4 based firmware
  ath10k: add testmode support for 10.4 firmware

 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   26 ++
 6 files changed, 76 insertions(+), 22 deletions(-)

-- 
1.7.9.5

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


[PATCH 1/3] ath10k: move firmware_swap_code_seg_info to ath10k_fw_file

2016-06-27 Thread c_traja
From: Tamizh chelvam 

Preparation to make use of firmware_swap_code_seg_info for
UTF binary.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 4 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index dfb3db0..0a1946b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -723,7 +723,7 @@ static int ath10k_download_fw(struct ath10k *ar)
data = ar->running_fw->fw_file.firmware_data;
data_len = ar->running_fw->fw_file.firmware_len;
 
-   ret = ath10k_swap_code_seg_configure(ar);
+   ret = ath10k_swap_code_seg_configure(ar, >running_fw->fw_file);
if (ret) {
ath10k_err(ar, "failed to configure fw code swap: %d\n",
   ret);
@@ -765,7 +765,7 @@ static void ath10k_core_free_firmware_files(struct ath10k 
*ar)
if (!IS_ERR(ar->pre_cal_file))
release_firmware(ar->pre_cal_file);
 
-   ath10k_swap_code_seg_release(ar);
+   ath10k_swap_code_seg_release(ar, >normal_mode_fw.fw_file);
 
ar->normal_mode_fw.fw_file.otp_data = NULL;
ar->normal_mode_fw.fw_file.otp_len = 0;
@@ -2009,7 +2009,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_free_firmware_files;
}
 
-   ret = ath10k_swap_code_seg_init(ar);
+   ret = ath10k_swap_code_seg_init(ar, >normal_mode_fw.fw_file);
if (ret) {
ath10k_err(ar, "failed to initialize code swap segment: %d\n",
   ret);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3da18c9..e69e7e7 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -654,6 +654,8 @@ struct ath10k_fw_file {
 
const void *codeswap_data;
size_t codeswap_len;
+   /* FIXME: add a comment */
+   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
 };
 
 struct ath10k_fw_components {
@@ -765,10 +767,6 @@ struct ath10k {
const struct firmware *cal_file;
 
struct {
-   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
-   } swap;
-
-   struct {
u32 vendor;
u32 device;
u32 subsystem_vendor;
diff --git a/drivers/net/wireless/ath/ath10k/swap.c 
b/drivers/net/wireless/ath/ath10k/swap.c
index 0c5f586..c904a41 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -134,17 +134,18 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t 
swap_bin_len)
return seg_info;
 }
 
-int ath10k_swap_code_seg_configure(struct ath10k *ar)
+int ath10k_swap_code_seg_configure(struct ath10k *ar,
+  const struct ath10k_fw_file *fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info = NULL;
 
-   if (!ar->swap.firmware_swap_code_seg_info)
+   if (fw_file->firmware_swap_code_seg_info)
return 0;
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot found firmware code swap 
binary\n");
 
-   seg_info = ar->swap.firmware_swap_code_seg_info;
+   seg_info = fw_file->firmware_swap_code_seg_info;
 
ret = ath10k_bmi_write_memory(ar, seg_info->target_addr,
  _info->seg_hw_info,
@@ -158,28 +159,29 @@ int ath10k_swap_code_seg_configure(struct ath10k *ar)
return 0;
 }
 
-void ath10k_swap_code_seg_release(struct ath10k *ar)
+void ath10k_swap_code_seg_release(struct ath10k *ar,
+ struct ath10k_fw_file *fw_file)
 {
-   ath10k_swap_code_seg_free(ar, ar->swap.firmware_swap_code_seg_info);
+   ath10k_swap_code_seg_free(ar, fw_file->firmware_swap_code_seg_info);
 
/* FIXME: these two assignments look to bein wrong place! Shouldn't
 * they be in ath10k_core_free_firmware_files() like the rest?
 */
-   ar->normal_mode_fw.fw_file.codeswap_data = NULL;
-   ar->normal_mode_fw.fw_file.codeswap_len = 0;
+   fw_file->codeswap_data = NULL;
+   fw_file->codeswap_len = 0;
 
-   ar->swap.firmware_swap_code_seg_info = NULL;
+   fw_file->firmware_swap_code_seg_info = NULL;
 }
 
-int ath10k_swap_code_seg_init(struct ath10k *ar)
+int ath10k_swap_code_seg_init(struct ath10k *ar, struct ath10k_fw_file 
*fw_file)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info;
const void *codeswap_data;
size_t codeswap_len;
 
-   codeswap_data = ar->normal_mode_fw.fw_file.codeswap_data;
-   codeswap_len = ar->normal_mode_fw.fw_file.codeswap_len;
+ 

[PATCH 0/3] Add testmode support for 10.4

2016-06-27 Thread c_traja
From: Tamizh chelvam 

*The below patches add testmode support for 10.4.

*Some of the codeswap related code in ath10k for example code
which  initializes the code swap segment works only on normal fw,
below patches  make such code generic so that it can be used
for utf binary as well.

Tamizh chelvam (3):
  ath10k: move firmware_swap_code_seg_info to ath10k_fw_file
  ath10k: handle testmode events for 10.2 and 10.4 based firmware
  ath10k: add testmode support for 10.4 firmware

 drivers/net/wireless/ath/ath10k/core.c |6 +++---
 drivers/net/wireless/ath/ath10k/core.h |6 ++
 drivers/net/wireless/ath/ath10k/swap.c |   26 ++
 drivers/net/wireless/ath/ath10k/swap.h |   11 ---
 drivers/net/wireless/ath/ath10k/testmode.c |   23 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   26 ++
 6 files changed, 76 insertions(+), 22 deletions(-)

-- 
1.7.9.5

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


[PATCH] ath10k: add dynamic tx mode switch config support for qca4019

2016-04-12 Thread c_traja
From: Raja Mani 

push-pull mode needs certain amount the host driver involvement for
managing queues in the host memory and packet delivery to firmware.
qca4019 wifi firmware has an option to stay in push mode for less
number of active traffic flow and then switch to push-pull mode when
the active traffic flow goes beyond the certain limit.

The advantage of staying in push mode for less active traffic is, the
host cpu consumption is reduced. qca4019 firmware supports this
flexibility of the mode switch. It takes the host driver interest
(LOW_PERF/HIGH_PERF) via WMI_EXT_RESOURCE_CFG_CMDID,

 LOW_PERF  - fw would stay in push mode and switch to push-pull
   based on demand.
 HIGH_PERF - fw would stay in push-pull mode from the boot.

To make this configuration generic, new WMI services
WMI_SERVICE_TX_MODE_PUSH_ONLY, WMI_SERVICE_TX_MODE_PUSH_PULL,
WMI_SERVICE_TX_MODE_DYNAMIC are introduced to take dynamic tx mode
switch support availability in firmware.
Based on WMI_SERVICE_TX_MODE_DYNAMIC, LOW_PERF or HIGHT_PERF is
configured to the firmware.

Signed-off-by: Raja Mani 
Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |  3 +--
 drivers/net/wireless/ath/ath10k/mac.c  | 20 
 drivers/net/wireless/ath/ath10k/mac.h  |  1 +
 drivers/net/wireless/ath/ath10k/wmi.h  | 15 +++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b2c7fe3..1c4106b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1787,8 +1787,7 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
if (ath10k_peer_stats_enabled(ar))
val = WMI_10_4_PEER_STATS;
 
-   status = ath10k_wmi_ext_resource_config(ar,
-   
WMI_HOST_PLATFORM_HIGH_PERF, val);
+   status = ath10k_mac_ext_resource_config(ar, val);
if (status) {
ath10k_err(ar,
   "failed to send ext resource cfg command : 
%d\n",
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index b0e613b..de6d1a8 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -157,6 +157,26 @@ ath10k_mac_max_vht_nss(const u16 
vht_mcs_mask[NL80211_VHT_NSS_MAX])
return 1;
 }
 
+int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val)
+{
+   enum wmi_host_platform_type platform_type;
+   int ret;
+
+   if (test_bit(WMI_SERVICE_TX_MODE_DYNAMIC, ar->wmi.svc_map))
+   platform_type = WMI_HOST_PLATFORM_LOW_PERF;
+   else
+   platform_type = WMI_HOST_PLATFORM_HIGH_PERF;
+
+   ret = ath10k_wmi_ext_resource_config(ar, platform_type, val);
+
+   if (ret && ret != -EOPNOTSUPP) {
+   ath10k_warn(ar, "failed to configure ext resource: %d\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 /**/
 /* Crypto */
 /**/
diff --git a/drivers/net/wireless/ath/ath10k/mac.h 
b/drivers/net/wireless/ath/ath10k/mac.h
index 2c3327b..1bd29ec 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -81,6 +81,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
 struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar,
u16 peer_id,
u8 tid);
+int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val);
 
 static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index feebd19..a3f1534 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -180,6 +180,9 @@ enum wmi_service {
WMI_SERVICE_MESH_NON_11S,
WMI_SERVICE_PEER_STATS,
WMI_SERVICE_RESTRT_CHNL_SUPPORT,
+   WMI_SERVICE_TX_MODE_PUSH_ONLY,
+   WMI_SERVICE_TX_MODE_PUSH_PULL,
+   WMI_SERVICE_TX_MODE_DYNAMIC,
 
/* keep last */
WMI_SERVICE_MAX,
@@ -302,6 +305,9 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
WMI_10_4_SERVICE_PEER_STATS,
WMI_10_4_SERVICE_MESH_11S,
+   WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
+   WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
+   WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
 };
 
 static inline char *wmi_service_name(int service_id)
@@ -396,6 +402,9 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_MESH_NON_11S);
SVCSTR(WMI_SERVICE_PEER_STATS);
SVCSTR(WMI_SERVICE_RESTRT_CHNL_SUPPORT);
+   SVCSTR(WMI_SERVICE_TX_MODE_PUSH_ONLY);
+   

[PATCH] ath10k: Add thermal throttling support for 10.4 firmware.

2015-10-29 Thread c_traja
From: Tamizh chelvam 

This patch enables thermal throttling support for 10.4 firmware.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/thermal.c |2 +-
 drivers/net/wireless/ath/ath10k/wmi.c |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/thermal.c 
b/drivers/net/wireless/ath/ath10k/thermal.c
index 60fe562..444b52c 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -187,7 +187,7 @@ int ath10k_thermal_register(struct ath10k *ar)
/* Do not register hwmon device when temperature reading is not
 * supported by firmware
 */
-   if (ar->wmi.op_version != ATH10K_FW_WMI_OP_VERSION_10_2_4)
+   if (!(ar->wmi.ops->gen_pdev_get_temperature))
return 0;
 
/* Avoid linking error on devm_hwmon_device_register_with_groups, I
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 2b32f02..3e45770 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4935,6 +4935,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
ath10k_dbg(ar, ATH10K_DBG_WMI,
   "received event id %d not implemented\n", id);
break;
+   case WMI_10_4_PDEV_TEMPERATURE_EVENTID:
+   ath10k_wmi_event_temperature(ar, skb);
+   break;
default:
ath10k_warn(ar, "Unknown eventid: %d\n", id);
break;
@@ -7344,6 +7347,7 @@ static const struct wmi_ops wmi_10_4_ops = {
 
/* shared with 10.2 */
.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
+   .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)
-- 
1.7.9.5

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


[PATCH v3] ath10k: add fw_stats support to 10.4 firmware

2015-10-20 Thread c_traja
From: Manikanta Pubbisetty 

This patch adds support for getting firmware debug stats in 10.4 fw.

Signed-off-by: Manikanta Pubbisetty 
Signed-off-by: Tamizh chelvam 
---
v3:
>Fixed the parsing error for client's mac address.

 drivers/net/wireless/ath/ath10k/core.h |  12 ++
 drivers/net/wireless/ath/ath10k/wmi.c  | 211 +
 drivers/net/wireless/ath/ath10k/wmi.h  | 135 +
 3 files changed, 358 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 7cc7cdd..c1970ae 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -214,6 +214,7 @@ struct ath10k_fw_stats_pdev {
s32 hw_queued;
s32 hw_reaped;
s32 underrun;
+   u32 hw_paused;
s32 tx_abort;
s32 mpdus_requed;
u32 tx_ko;
@@ -226,6 +227,16 @@ struct ath10k_fw_stats_pdev {
u32 pdev_resets;
u32 phy_underrun;
u32 txop_ovf;
+   u32 seq_posted;
+   u32 seq_failed_queueing;
+   u32 seq_completed;
+   u32 seq_restarted;
+   u32 mu_seq_posted;
+   u32 mpdus_sw_flush;
+   u32 mpdus_hw_filter;
+   u32 mpdus_truncated;
+   u32 mpdus_ack_failed;
+   u32 mpdus_expired;
 
/* PDEV RX stats */
s32 mid_ppdu_route_change;
@@ -242,6 +253,7 @@ struct ath10k_fw_stats_pdev {
s32 phy_errs;
s32 phy_err_drop;
s32 mpdu_errs;
+   s32 rx_ovfl_errs;
 };
 
 struct ath10k_fw_stats {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e7d7a7..1b97fef 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2475,6 +2475,47 @@ void ath10k_wmi_pull_pdev_stats_tx(const struct 
wmi_pdev_stats_tx *src,
dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
 }
 
+static void
+ath10k_wmi_10_4_pull_pdev_stats_tx(const struct wmi_10_4_pdev_stats_tx *src,
+  struct ath10k_fw_stats_pdev *dst)
+{
+   dst->comp_queued = __le32_to_cpu(src->comp_queued);
+   dst->comp_delivered = __le32_to_cpu(src->comp_delivered);
+   dst->msdu_enqued = __le32_to_cpu(src->msdu_enqued);
+   dst->mpdu_enqued = __le32_to_cpu(src->mpdu_enqued);
+   dst->wmm_drop = __le32_to_cpu(src->wmm_drop);
+   dst->local_enqued = __le32_to_cpu(src->local_enqued);
+   dst->local_freed = __le32_to_cpu(src->local_freed);
+   dst->hw_queued = __le32_to_cpu(src->hw_queued);
+   dst->hw_reaped = __le32_to_cpu(src->hw_reaped);
+   dst->underrun = __le32_to_cpu(src->underrun);
+   dst->tx_abort = __le32_to_cpu(src->tx_abort);
+   dst->mpdus_requed = __le32_to_cpu(src->mpdus_requed);
+   dst->tx_ko = __le32_to_cpu(src->tx_ko);
+   dst->data_rc = __le32_to_cpu(src->data_rc);
+   dst->self_triggers = __le32_to_cpu(src->self_triggers);
+   dst->sw_retry_failure = __le32_to_cpu(src->sw_retry_failure);
+   dst->illgl_rate_phy_err = __le32_to_cpu(src->illgl_rate_phy_err);
+   dst->pdev_cont_xretry = __le32_to_cpu(src->pdev_cont_xretry);
+   dst->pdev_tx_timeout = __le32_to_cpu(src->pdev_tx_timeout);
+   dst->pdev_resets = __le32_to_cpu(src->pdev_resets);
+   dst->phy_underrun = __le32_to_cpu(src->phy_underrun);
+   dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
+   dst->hw_paused = __le32_to_cpu(src->hw_paused);
+   dst->seq_posted = __le32_to_cpu(src->seq_posted);
+   dst->seq_failed_queueing =
+   __le32_to_cpu(src->seq_failed_queueing);
+   dst->seq_completed = __le32_to_cpu(src->seq_completed);
+   dst->seq_restarted = __le32_to_cpu(src->seq_restarted);
+   dst->mu_seq_posted = __le32_to_cpu(src->mu_seq_posted);
+   dst->mpdus_sw_flush = __le32_to_cpu(src->mpdus_sw_flush);
+   dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
+   dst->mpdus_truncated = __le32_to_cpu(src->mpdus_truncated);
+   dst->mpdus_ack_failed = __le32_to_cpu(src->mpdus_ack_failed);
+   dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
+   dst->mpdus_expired = __le32_to_cpu(src->mpdus_expired);
+}
+
 void ath10k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src,
   struct ath10k_fw_stats_pdev *dst)
 {
@@ -2785,6 +2826,86 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct 
ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
+   struct sk_buff *skb,
+   struct ath10k_fw_stats *stats)
+{
+   const struct wmi_10_2_stats_event *ev = (void *)skb->data;
+   u32 num_pdev_stats;
+   u32 num_pdev_ext_stats;
+   u32 num_vdev_stats;
+   u32 num_peer_stats;
+   int i;
+
+   if (!skb_pull(skb, sizeof(*ev)))
+

[PATCH 2/2 v2] ath10k: add fw_stats support to 10.4 firmware

2015-10-14 Thread c_traja
From: Manikanta 

This patch adds support for getting firmware debug stats in 10.4 fw.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.h |   12 ++
 drivers/net/wireless/ath/ath10k/wmi.c  |  211 
 drivers/net/wireless/ath/ath10k/wmi.h  |  134 
 3 files changed, 357 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 002de71..355a18f 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -214,6 +214,7 @@ struct ath10k_fw_stats_pdev {
s32 hw_queued;
s32 hw_reaped;
s32 underrun;
+   u32 hw_paused;
s32 tx_abort;
s32 mpdus_requed;
u32 tx_ko;
@@ -226,6 +227,16 @@ struct ath10k_fw_stats_pdev {
u32 pdev_resets;
u32 phy_underrun;
u32 txop_ovf;
+   u32 seq_posted;
+   u32 seq_failed_queueing;
+   u32 seq_completed;
+   u32 seq_restarted;
+   u32 mu_seq_posted;
+   u32 mpdus_sw_flush;
+   u32 mpdus_hw_filter;
+   u32 mpdus_truncated;
+   u32 mpdus_ack_failed;
+   u32 mpdus_expired;
 
/* PDEV RX stats */
s32 mid_ppdu_route_change;
@@ -242,6 +253,7 @@ struct ath10k_fw_stats_pdev {
s32 phy_errs;
s32 phy_err_drop;
s32 mpdu_errs;
+   s32 rx_ovfl_errs;
 };
 
 struct ath10k_fw_stats {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index db25b727..5af1516 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2475,6 +2475,47 @@ void ath10k_wmi_pull_pdev_stats_tx(const struct 
wmi_pdev_stats_tx *src,
dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
 }
 
+static void
+ath10k_wmi_10_4_pull_pdev_stats_tx(const struct wmi_10_4_pdev_stats_tx *src,
+  struct ath10k_fw_stats_pdev *dst)
+{
+   dst->comp_queued = __le32_to_cpu(src->comp_queued);
+   dst->comp_delivered = __le32_to_cpu(src->comp_delivered);
+   dst->msdu_enqued = __le32_to_cpu(src->msdu_enqued);
+   dst->mpdu_enqued = __le32_to_cpu(src->mpdu_enqued);
+   dst->wmm_drop = __le32_to_cpu(src->wmm_drop);
+   dst->local_enqued = __le32_to_cpu(src->local_enqued);
+   dst->local_freed = __le32_to_cpu(src->local_freed);
+   dst->hw_queued = __le32_to_cpu(src->hw_queued);
+   dst->hw_reaped = __le32_to_cpu(src->hw_reaped);
+   dst->underrun = __le32_to_cpu(src->underrun);
+   dst->tx_abort = __le32_to_cpu(src->tx_abort);
+   dst->mpdus_requed = __le32_to_cpu(src->mpdus_requed);
+   dst->tx_ko = __le32_to_cpu(src->tx_ko);
+   dst->data_rc = __le32_to_cpu(src->data_rc);
+   dst->self_triggers = __le32_to_cpu(src->self_triggers);
+   dst->sw_retry_failure = __le32_to_cpu(src->sw_retry_failure);
+   dst->illgl_rate_phy_err = __le32_to_cpu(src->illgl_rate_phy_err);
+   dst->pdev_cont_xretry = __le32_to_cpu(src->pdev_cont_xretry);
+   dst->pdev_tx_timeout = __le32_to_cpu(src->pdev_tx_timeout);
+   dst->pdev_resets = __le32_to_cpu(src->pdev_resets);
+   dst->phy_underrun = __le32_to_cpu(src->phy_underrun);
+   dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
+   dst->hw_paused = __le32_to_cpu(src->hw_paused);
+   dst->seq_posted = __le32_to_cpu(src->seq_posted);
+   dst->seq_failed_queueing =
+   __le32_to_cpu(src->seq_failed_queueing);
+   dst->seq_completed = __le32_to_cpu(src->seq_completed);
+   dst->seq_restarted = __le32_to_cpu(src->seq_restarted);
+   dst->mu_seq_posted = __le32_to_cpu(src->mu_seq_posted);
+   dst->mpdus_sw_flush = __le32_to_cpu(src->mpdus_sw_flush);
+   dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
+   dst->mpdus_truncated = __le32_to_cpu(src->mpdus_truncated);
+   dst->mpdus_ack_failed = __le32_to_cpu(src->mpdus_ack_failed);
+   dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
+   dst->mpdus_expired = __le32_to_cpu(src->mpdus_expired);
+}
+
 void ath10k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src,
   struct ath10k_fw_stats_pdev *dst)
 {
@@ -2785,6 +2826,86 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct 
ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
+   struct sk_buff *skb,
+   struct ath10k_fw_stats *stats)
+{
+   const struct wmi_10_2_stats_event *ev = (void *)skb->data;
+   u32 num_pdev_stats;
+   u32 num_pdev_ext_stats;
+   u32 num_vdev_stats;
+   u32 num_peer_stats;
+   int i;
+
+   if (!skb_pull(skb, sizeof(*ev)))
+   return -EPROTO;
+
+   num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
+   num_pdev_ext_stats = 

[PATCH 1/2 v2] ath10k: Make fw stats prints specific to firmware version

2015-10-14 Thread c_traja
From: Manikanta 

The patch makes debug stats prints fw specific by adding a new member
in wmi_ops

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/debug.c   |  267 +---
 drivers/net/wireless/ath/ath10k/debug.h   |3 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   13 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |1 +
 drivers/net/wireless/ath/ath10k/wmi.c |  377 +
 drivers/net/wireless/ath/ath10k/wmi.h |   10 +
 6 files changed, 412 insertions(+), 259 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index f316efd..b3453c7 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -285,28 +285,6 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
spin_unlock_bh(>data_lock);
 }
 
-static size_t ath10k_debug_fw_stats_num_peers(struct list_head *head)
-{
-   struct ath10k_fw_stats_peer *i;
-   size_t num = 0;
-
-   list_for_each_entry(i, head, list)
-   ++num;
-
-   return num;
-}
-
-static size_t ath10k_debug_fw_stats_num_vdevs(struct list_head *head)
-{
-   struct ath10k_fw_stats_vdev *i;
-   size_t num = 0;
-
-   list_for_each_entry(i, head, list)
-   ++num;
-
-   return num;
-}
-
 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 {
struct ath10k_fw_stats stats = {};
@@ -343,8 +321,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
goto free;
}
 
-   num_peers = ath10k_debug_fw_stats_num_peers(>debug.fw_stats.peers);
-   num_vdevs = ath10k_debug_fw_stats_num_vdevs(>debug.fw_stats.vdevs);
+   num_peers = ath10k_wmi_fw_stats_num_peers(>debug.fw_stats.peers);
+   num_vdevs = ath10k_wmi_fw_stats_num_vdevs(>debug.fw_stats.vdevs);
is_start = (list_empty(>debug.fw_stats.pdevs) &&
!list_empty());
is_end = (!list_empty(>debug.fw_stats.pdevs) &&
@@ -429,240 +407,6 @@ static int ath10k_debug_fw_stats_request(struct ath10k 
*ar)
return 0;
 }
 
-/* FIXME: How to calculate the buffer size sanely? */
-#define ATH10K_FW_STATS_BUF_SIZE (1024*1024)
-
-static void ath10k_fw_stats_fill(struct ath10k *ar,
-struct ath10k_fw_stats *fw_stats,
-char *buf)
-{
-   unsigned int len = 0;
-   unsigned int buf_len = ATH10K_FW_STATS_BUF_SIZE;
-   const struct ath10k_fw_stats_pdev *pdev;
-   const struct ath10k_fw_stats_vdev *vdev;
-   const struct ath10k_fw_stats_peer *peer;
-   size_t num_peers;
-   size_t num_vdevs;
-   int i;
-
-   spin_lock_bh(>data_lock);
-
-   pdev = list_first_entry_or_null(_stats->pdevs,
-   struct ath10k_fw_stats_pdev, list);
-   if (!pdev) {
-   ath10k_warn(ar, "failed to get pdev stats\n");
-   goto unlock;
-   }
-
-   num_peers = ath10k_debug_fw_stats_num_peers(_stats->peers);
-   num_vdevs = ath10k_debug_fw_stats_num_vdevs(_stats->vdevs);
-
-   len += scnprintf(buf + len, buf_len - len, "\n");
-   len += scnprintf(buf + len, buf_len - len, "%30s\n",
-"ath10k PDEV stats");
-   len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
-"=");
-
-   len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
-"Channel noise floor", pdev->ch_noise_floor);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"Channel TX power", pdev->chan_tx_power);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"TX frame count", pdev->tx_frame_count);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"RX frame count", pdev->rx_frame_count);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"RX clear count", pdev->rx_clear_count);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"Cycle count", pdev->cycle_count);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"PHY error count", pdev->phy_err_count);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"RTS bad count", pdev->rts_bad);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"RTS good count", pdev->rts_good);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"FCS bad count", pdev->fcs_bad);
-   len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
-"No beacon count", pdev->no_beacons);
-   len += scnprintf(buf + len, buf_len - len, "%30s 

[PATCH 0/2 v2] ath10k: print firwmare stats specific to firmware version

2015-10-14 Thread c_traja
From: Tamizh chelvam 

Currently printing fw stats in ath10k is common to all firmware versions.
Printing all the stats might lead to confusion because some of the stats
are firmware specific and when printed will have 0's.
Below patchset prints firmware stats specific to firmware.

v2:
> All the filtered functions moved to wmi.c
> Added firmware stats support for 10.4 firmware.

Manikanta (2):
  ath10k: Make fw stats prints specific to firmware version
  ath10k: add fw_stats support to 10.4 firmware

 drivers/net/wireless/ath/ath10k/core.h|   12 +
 drivers/net/wireless/ath/ath10k/debug.c   |  267 +
 drivers/net/wireless/ath/ath10k/debug.h   |3 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   13 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |1 +
 drivers/net/wireless/ath/ath10k/wmi.c |  588 +
 drivers/net/wireless/ath/ath10k/wmi.h |  144 +++
 7 files changed, 769 insertions(+), 259 deletions(-)

-- 
1.7.9.5

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


[PATCH 1/2] ath10k: Add abstraction layer for peer flags

2015-10-06 Thread c_traja
From: Tamizh chelvam 

Abstraction layer for peer flags is added to fix ABI breakage.

Signed-off-by: Tamizh chelvam 
Signed-off-by: SenthilKumar Jegadeesan 
---
 drivers/net/wireless/ath/ath10k/core.h|1 +
 drivers/net/wireless/ath/ath10k/mac.c |   33 +--
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   19 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   18 ++
 drivers/net/wireless/ath/ath10k/wmi.c |   60 
 drivers/net/wireless/ath/ath10k/wmi.h |   88 -
 6 files changed, 188 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 04e040a..3e4668e 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -151,6 +151,7 @@ struct ath10k_wmi {
struct wmi_vdev_param_map *vdev_param;
struct wmi_pdev_param_map *pdev_param;
const struct wmi_ops *ops;
+   const struct wmi_peer_flags_map *peer_flags;
 
u32 num_mem_chunks;
u32 rx_decap_mode;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 79490ad..dc80d0b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1960,7 +1960,7 @@ static void ath10k_peer_assoc_h_basic(struct ath10k *ar,
ether_addr_copy(arg->addr, sta->addr);
arg->vdev_id = arvif->vdev_id;
arg->peer_aid = aid;
-   arg->peer_flags |= WMI_PEER_AUTH;
+   arg->peer_flags |= arvif->ar->wmi.peer_flags->auth;
arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif);
arg->peer_num_spatial_streams = 1;
arg->peer_caps = vif->bss_conf.assoc_capability;
@@ -2002,12 +2002,12 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k 
*ar,
/* FIXME: base on RSN IE/WPA IE is a correct idea? */
if (rsnie || wpaie) {
ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: rsn ie found\n", __func__);
-   arg->peer_flags |= WMI_PEER_NEED_PTK_4_WAY;
+   arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way;
}
 
if (wpaie) {
ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: wpa ie found\n", __func__);
-   arg->peer_flags |= WMI_PEER_NEED_GTK_2_WAY;
+   arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way;
}
 }
 
@@ -2103,7 +2103,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
ath10k_peer_assoc_h_vht_masked(vht_mcs_mask))
return;
 
-   arg->peer_flags |= WMI_PEER_HT;
+   arg->peer_flags |= ar->wmi.peer_flags->ht;
arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
ht_cap->ampdu_factor)) - 1;
 
@@ -2114,10 +2114,10 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
arg->peer_rate_caps |= WMI_RC_HT_FLAG;
 
if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING)
-   arg->peer_flags |= WMI_PEER_LDPC;
+   arg->peer_flags |= ar->wmi.peer_flags->ldbc;
 
if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) {
-   arg->peer_flags |= WMI_PEER_40MHZ;
+   arg->peer_flags |= ar->wmi.peer_flags->bw40;
arg->peer_rate_caps |= WMI_RC_CW40_FLAG;
}
 
@@ -2131,7 +2131,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
 
if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) {
arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG;
-   arg->peer_flags |= WMI_PEER_STBC;
+   arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
 
if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) {
@@ -2139,7 +2139,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
stbc = stbc >> IEEE80211_HT_CAP_RX_STBC_SHIFT;
stbc = stbc << WMI_RC_RX_STBC_FLAG_S;
arg->peer_rate_caps |= stbc;
-   arg->peer_flags |= WMI_PEER_STBC;
+   arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
 
if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2])
@@ -2320,10 +2320,10 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
if (ath10k_peer_assoc_h_vht_masked(vht_mcs_mask))
return;
 
-   arg->peer_flags |= WMI_PEER_VHT;
+   arg->peer_flags |= ar->wmi.peer_flags->vht;
 
if (def.chan->band == IEEE80211_BAND_2GHZ)
-   arg->peer_flags |= WMI_PEER_VHT_2G;
+   arg->peer_flags |= ar->wmi.peer_flags->vht_2g;
 
arg->peer_vht_caps = vht_cap->cap;
 
@@ -2340,7 +2340,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
ampdu_factor)) - 1);
 
if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
-   arg->peer_flags |= WMI_PEER_80MHZ;
+   arg->peer_flags |= ar->wmi.peer_flags->bw80;
 

[PATCH 2/2] ath10k: set peer MFP flag in peer assoc command

2015-10-06 Thread c_traja
From: Tamizh chelvam 

Set peer's management frame protection flag in peer assoc command,
this setting will enable/disable encrytion of management frames in fw.

Setting of this flag is based on whether MFP is enabled/disabled at STA
and a firmware feature flag ATH10K_FW_FEATURE_MFP_SUPPORT. This is because
only firmwares 10.1.561 and above have support for MFP.

Signed-off-by: Tamizh chelvam 
Signed-off-by: Manikanta pubbisetty 
---
Notes:
This patch has dependency of following patch.
Revert "mac80211: remove exposing 'mfp' to drivers"

 drivers/net/wireless/ath/ath10k/core.c   |1 +
 drivers/net/wireless/ath/ath10k/core.h   |3 +++
 drivers/net/wireless/ath/ath10k/htt_tx.c |7 +++
 drivers/net/wireless/ath/ath10k/mac.c|8 +++-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 879625a..6a2dd34 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -151,6 +151,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
[ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING] = "no-4addr-pad",
[ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT] = "skip-clock-init",
[ATH10K_FW_FEATURE_RAW_MODE_SUPPORT] = "raw-mode",
+   [ATH10K_FW_FEATURE_MFP_SUPPORT] = "mfp",
 };
 
 static unsigned int ath10k_core_get_fw_feature_str(char *buf,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3e4668e..0e23400 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -469,6 +469,9 @@ enum ath10k_fw_features {
 */
ATH10K_FW_FEATURE_RAW_MODE_SUPPORT = 10,
 
+   /* Firmware supports management frame protection */
+   ATH10K_FW_FEATURE_MFP_SUPPORT = 11,
+
/* keep last */
ATH10K_FW_FEATURE_COUNT,
 };
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index eb5ba9b..cd72860 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -459,6 +459,13 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct 
sk_buff *msdu)
}
msdu_id = res;
 
+   if ((ieee80211_is_action(hdr->frame_control) ||
+ieee80211_is_deauth(hdr->frame_control) ||
+ieee80211_is_disassoc(hdr->frame_control)) &&
+ieee80211_has_protected(hdr->frame_control)) {
+   skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+   }
+
txdesc = ath10k_htc_alloc_skb(ar, len);
if (!txdesc) {
res = -ENOMEM;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index dc80d0b..71cba8c 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1968,6 +1968,7 @@ static void ath10k_peer_assoc_h_basic(struct ath10k *ar,
 
 static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,
   struct ieee80211_vif *vif,
+  struct ieee80211_sta *sta,
   struct wmi_peer_assoc_complete_arg *arg)
 {
struct ieee80211_bss_conf *info = >bss_conf;
@@ -2009,6 +2010,11 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,
ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: wpa ie found\n", __func__);
arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way;
}
+
+   if (sta->mfp &&
+   test_bit(ATH10K_FW_FEATURE_MFP_SUPPORT, ar->fw_features)) {
+   arg->peer_flags |= ar->wmi.peer_flags->pmf;
+   }
 }
 
 static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
@@ -2479,7 +2485,7 @@ static int ath10k_peer_assoc_prepare(struct ath10k *ar,
memset(arg, 0, sizeof(*arg));
 
ath10k_peer_assoc_h_basic(ar, vif, sta, arg);
-   ath10k_peer_assoc_h_crypto(ar, vif, arg);
+   ath10k_peer_assoc_h_crypto(ar, vif, sta, arg);
ath10k_peer_assoc_h_rates(ar, vif, sta, arg);
ath10k_peer_assoc_h_ht(ar, vif, sta, arg);
ath10k_peer_assoc_h_vht(ar, vif, sta, arg);
-- 
1.7.9.5

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


[PATCH] Revert "mac80211: remove exposing 'mfp' to drivers"

2015-10-06 Thread c_traja
From: Tamizh chelvam 

This reverts commit 5c48f1201744233d4f235c7dd916d5196ed20716.

Some device drivers (ath10k) offload part of aggregation including AddBA/DelBA
negotiations to firmware. In such scenario, the PMF configuration of
the station needs to be provided to driver to enable encryption of
AddBA/DelBA action frames.

Signed-off-by: Tamizh chelvam 
---
Notes:
> ath10k change using this mfp configuration will follow.

 include/net/mac80211.h |2 ++
 net/mac80211/cfg.c |1 +
 net/mac80211/mlme.c|6 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4ec6fed..1bb2a2b 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1683,6 +1683,7 @@ struct ieee80211_sta_rates {
  * @tdls: indicates whether the STA is a TDLS peer
  * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  * valid if the STA is a TDLS peer in the first place.
+ * @mfp: indicates whether the STA uses management frame protection or not.
  * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  */
 struct ieee80211_sta {
@@ -1700,6 +1701,7 @@ struct ieee80211_sta {
struct ieee80211_sta_rates __rcu *rates;
bool tdls;
bool tdls_initiator;
+   bool mfp;
 
struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 68e551e..63d03da 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1138,6 +1138,7 @@ static int sta_apply_parameters(struct ieee80211_local 
*local,
}
 
if (mask & BIT(NL80211_STA_FLAG_MFP)) {
+   sta->sta.mfp = !!(set & BIT(NL80211_STA_FLAG_MFP));
if (set & BIT(NL80211_STA_FLAG_MFP))
set_sta_flag(sta, WLAN_STA_MFP);
else
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 56ef9a8..9c450ff 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3044,8 +3044,12 @@ static bool ieee80211_assoc_success(struct 
ieee80211_sub_if_data *sdata,
 
rate_control_rate_init(sta);
 
-   if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED)
+   if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) {
set_sta_flag(sta, WLAN_STA_MFP);
+   sta->sta.mfp = true;
+   } else {
+   sta->sta.mfp = false;
+   }
 
sta->sta.wme = elems.wmm_param && local->hw.queues >= IEEE80211_NUM_ACS;
 
-- 
1.7.9.5

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


[PATCH] ath10k: Disable PCI power save for QCA99X0

2015-09-01 Thread c_traja
From: Tamizh chelvam 

Frequent failures in waking up the target is observed during
interface (mostly observed with AP and Monitor mode) bring up
on x86, this failures lead to firmware crash. Disabling PCI
power save fixes this issue. Disabling ASPM also does not help,
as a work around disable PCI power save for QCA99X0.

The following kernel log is seen when this issue happens

kworker/dying (667) used greatest stack depth: 12208 bytes left
ath10k_pci :07:00.0: failed to wake target for read32 at 0x00040050: -110
ath10k_pci :07:00.0: failed to wake target for read32 at 0x0004a02c: -110
ath10k_pci :07:00.0: failed to wake target for write32 of 0xfffe at 
0x0004a02c: -110
ath10k_pci :07:00.0: failed to wake target for read32 at 0x0004a034: -110
ath10k_pci :07:00.0: failed to wake target for write32 of 0xf81f at 
0x0004a034: -110
ath10k_pci :07:00.0: failed to wake target for read32 at 0x0004a02c: -110
ath10k_pci :07:00.0: failed to wake target for write32 of 0xffe1 at 
0x0004a02c: -110
ath10k_pci :07:00.0: failed to wake target for read32 at 0x0004a42c: -110
ath10k_pci :07:00.0: failed to wake target for write32 of 0xfffe at 
0x0004a42c: -110
ath10k_pci :07:00.0: failed to wake target for read32 at 0x0004a434: -110
ath10k_pci :07:00.0: firmware crashed! (uuid 
40b345f1-db3d-4b97-bc54-6572994e02d5)

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/pci.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 1046ab6..1ab4ee7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1640,6 +1640,10 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
ath10k_pci_safe_chip_reset(ar);
 
ath10k_pci_irq_disable(ar);
+
+   if (QCA_REV_99X0(ar))
+   ath10k_pci_sleep(ar);
+
ath10k_pci_irq_sync(ar);
ath10k_pci_flush(ar);
 
@@ -2315,6 +2319,14 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power up\n");
 
+   if (QCA_REV_99X0(ar)) {
+   ret = ath10k_pci_wake(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to wake target for qca99x0: 
%d\n", ret);
+   return ret;
+   }
+   }
+
pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL,
  _pci->link_ctl);
pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL,
-- 
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