All of lore.kernel.org
 help / color / mirror / Atom feed
From: <c_traja@qti.qualcomm.com>
To: <linux-wireless@vger.kernel.org>
Cc: <johannes@sipsolutions.net>, <ath10k@lists.infradead.org>,
	Tamizh chelvam <c_traja@qti.qualcomm.com>
Subject: [PATCHv2 3/4] cfg80211: Add Support set btcoex priority value
Date: Sat, 25 Feb 2017 19:07:52 +0530	[thread overview]
Message-ID: <1488029873-14600-4-git-send-email-c_traja@qti.qualcomm.com> (raw)
In-Reply-To: <1488029873-14600-1-git-send-email-c_traja@qti.qualcomm.com>

From: Tamizh chelvam <c_traja@qti.qualcomm.com>

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 <c_traja@qti.qualcomm.com>
---
 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 = &rdev->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_WIPHY		0x01
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 6592f14..7c0c139 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1155,13 +1155,15 @@ static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
 }
 
 static inline int
-rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled)
+rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled,
+		int btcoex_priority)
 {
 	int ret = -ENOTSUPP;
 
-	trace_rdev_set_btcoex(&rdev->wiphy, enabled);
-	ret = rdev->ops->set_btcoex(&rdev->wiphy, enabled);
+	trace_rdev_set_btcoex(&rdev->wiphy, enabled, btcoex_priority);
+	ret = rdev->ops->set_btcoex(&rdev->wiphy, enabled, btcoex_priority);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
+
 #endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index c3970b1..4f88f50 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3048,18 +3048,20 @@
 );
 
 TRACE_EVENT(rdev_set_btcoex,
-	TP_PROTO(struct wiphy *wiphy, bool enabled),
-	TP_ARGS(wiphy, enabled),
+	TP_PROTO(struct wiphy *wiphy, bool enabled, int btcoex_priority),
+	TP_ARGS(wiphy, enabled, btcoex_priority),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		__field(bool, enabled)
+		__field(int, btcoex_priority)
 	),
 	TP_fast_assign(
 		WIPHY_ASSIGN;
 		__entry->enabled = enabled;
+		__entry->btcoex_priority = btcoex_priority;
 	),
-	TP_printk(WIPHY_PR_FMT, ", enabled=%d",
-		  WIPHY_PR_ARG, __entry->enabled)
+	TP_printk(WIPHY_PR_FMT, ", enabled=%d btcoex_priority :%d",
+		  WIPHY_PR_ARG, __entry->enabled, __entry->btcoex_priority)
 );
 
 DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: <c_traja@qti.qualcomm.com>
To: linux-wireless@vger.kernel.org
Cc: Tamizh chelvam <c_traja@qti.qualcomm.com>,
	johannes@sipsolutions.net, ath10k@lists.infradead.org
Subject: [PATCHv2 3/4] cfg80211: Add Support set btcoex priority value
Date: Sat, 25 Feb 2017 19:07:52 +0530	[thread overview]
Message-ID: <1488029873-14600-4-git-send-email-c_traja@qti.qualcomm.com> (raw)
In-Reply-To: <1488029873-14600-1-git-send-email-c_traja@qti.qualcomm.com>

From: Tamizh chelvam <c_traja@qti.qualcomm.com>

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 <c_traja@qti.qualcomm.com>
---
 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 = &rdev->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_WIPHY		0x01
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 6592f14..7c0c139 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1155,13 +1155,15 @@ static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
 }
 
 static inline int
-rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled)
+rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled,
+		int btcoex_priority)
 {
 	int ret = -ENOTSUPP;
 
-	trace_rdev_set_btcoex(&rdev->wiphy, enabled);
-	ret = rdev->ops->set_btcoex(&rdev->wiphy, enabled);
+	trace_rdev_set_btcoex(&rdev->wiphy, enabled, btcoex_priority);
+	ret = rdev->ops->set_btcoex(&rdev->wiphy, enabled, btcoex_priority);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
+
 #endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index c3970b1..4f88f50 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3048,18 +3048,20 @@
 );
 
 TRACE_EVENT(rdev_set_btcoex,
-	TP_PROTO(struct wiphy *wiphy, bool enabled),
-	TP_ARGS(wiphy, enabled),
+	TP_PROTO(struct wiphy *wiphy, bool enabled, int btcoex_priority),
+	TP_ARGS(wiphy, enabled, btcoex_priority),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		__field(bool, enabled)
+		__field(int, btcoex_priority)
 	),
 	TP_fast_assign(
 		WIPHY_ASSIGN;
 		__entry->enabled = enabled;
+		__entry->btcoex_priority = btcoex_priority;
 	),
-	TP_printk(WIPHY_PR_FMT, ", enabled=%d",
-		  WIPHY_PR_ARG, __entry->enabled)
+	TP_printk(WIPHY_PR_FMT, ", enabled=%d btcoex_priority :%d",
+		  WIPHY_PR_ARG, __entry->enabled, __entry->btcoex_priority)
 );
 
 DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
-- 
1.7.9.5


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  parent reply	other threads:[~2017-02-25 13:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 13:37 [PATCHv2 0/4] cfg80211: mac80211: BTCOEX feature support c_traja
2017-02-25 13:37 ` c_traja
2017-02-25 13:37 ` [PATCHv2 1/4] cfg80211: Add support to enable or disable btcoex c_traja
2017-02-25 13:37   ` c_traja
2017-02-25 14:48   ` kbuild test robot
2017-02-25 14:48     ` kbuild test robot
2017-02-25 14:48   ` kbuild test robot
2017-02-25 14:48     ` kbuild test robot
2017-03-02  8:45   ` Johannes Berg
2017-03-02  8:45     ` Johannes Berg
2017-03-02 11:49     ` Raja, Tamizh Chelvam
2017-03-02 11:49       ` Raja, Tamizh Chelvam
2017-02-25 13:37 ` [PATCHv2 2/4] mac80211: " c_traja
2017-02-25 13:37   ` c_traja
2017-02-25 13:37 ` c_traja [this message]
2017-02-25 13:37   ` [PATCHv2 3/4] cfg80211: Add Support set btcoex priority value c_traja
2017-02-25 15:12   ` kbuild test robot
2017-02-25 15:12     ` kbuild test robot
2017-03-02  8:50   ` Johannes Berg
2017-03-02  8:50     ` Johannes Berg
2017-03-02 11:48     ` Raja, Tamizh Chelvam
2017-03-02 11:48       ` Raja, Tamizh Chelvam
2017-03-02 12:15       ` Johannes Berg
2017-03-02 12:15         ` Johannes Berg
2017-03-02 13:08         ` Raja, Tamizh Chelvam
2017-03-02 13:08           ` Raja, Tamizh Chelvam
2017-03-02 13:43           ` Johannes Berg
2017-03-02 13:43             ` Johannes Berg
2017-03-02  8:51   ` Johannes Berg
2017-03-02  8:51     ` Johannes Berg
2017-02-25 13:37 ` [PATCHv2 4/4] mac80211: Add support to set/update " c_traja
2017-02-25 13:37   ` c_traja
2017-02-25 14:41 ` [PATCHv2 0/4] cfg80211: mac80211: BTCOEX feature support Arend Van Spriel
2017-02-25 14:41   ` Arend Van Spriel
2017-02-27 10:33   ` Raja, Tamizh Chelvam
2017-02-27 10:33     ` Raja, Tamizh Chelvam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488029873-14600-4-git-send-email-c_traja@qti.qualcomm.com \
    --to=c_traja@qti.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.