diff mbox

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

Message ID 1488029873-14600-2-git-send-email-c_traja@qti.qualcomm.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

c_traja@qti.qualcomm.com Feb. 25, 2017, 1:37 p.m. UTC
From: Tamizh chelvam <c_traja@qti.qualcomm.com>

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

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
---
 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(+)

Comments

kernel test robot Feb. 25, 2017, 2:48 p.m. UTC | #1
Hi Tamizh,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20170224]
[cannot apply to v4.10]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/cfg80211-mac80211-BTCOEX-feature-support/20170225-215733
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:95:0,
                    from net/wireless/trace.h:3116,
                    from net/wireless/trace.c:5:
   net/wireless/./trace.h: In function 'trace_raw_output_rdev_set_btcoex':
>> include/trace/trace_events.h:323:9: warning: too many arguments for format [-Wformat-extra-args]
     struct trace_event_raw_##call *field;    \
            ^
   include/trace/trace_events.h:60:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^
   net/wireless/./trace.h:3072:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(rdev_set_btcoex,
    ^

vim +323 include/trace/trace_events.h

6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  307  #undef __print_array
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  308  #define __print_array(array, count, el_size)				\
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  309  	({								\
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  310  		BUILD_BUG_ON(el_size != 1 && el_size != 2 &&		\
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  311  			     el_size != 4 && el_size != 8);		\
645df987 include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-04  312) 		trace_print_array_seq(p, array, count, el_size);	\
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  313  	})
6ea22486 include/trace/ftrace.h       Dave Martin              2015-01-28  314  
091ad365 include/trace/ftrace.h       Ingo Molnar              2009-11-26  315  #undef DECLARE_EVENT_CLASS
091ad365 include/trace/ftrace.h       Ingo Molnar              2009-11-26  316  #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
83f0d539 include/trace/ftrace.h       Steven Rostedt           2010-02-16  317  static notrace enum print_line_t					\
892c505a include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-05  318) trace_raw_output_##call(struct trace_iterator *iter, int flags,		\
80decc70 include/trace/ftrace.h       Steven Rostedt           2010-04-23  319  			struct trace_event *trace_event)		\
f42c85e7 include/trace/ftrace.h       Steven Rostedt           2009-04-13  320  {									\
f42c85e7 include/trace/ftrace.h       Steven Rostedt           2009-04-13  321  	struct trace_seq *s = &iter->seq;				\
f71130de include/trace/ftrace.h       Li Zefan                 2013-02-21  322  	struct trace_seq __maybe_unused *p = &iter->tmp_seq;		\
a7237765 include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-13 @323) 	struct trace_event_raw_##call *field;				\
f42c85e7 include/trace/ftrace.h       Steven Rostedt           2009-04-13  324  	int ret;							\
f42c85e7 include/trace/ftrace.h       Steven Rostedt           2009-04-13  325  									\
f71130de include/trace/ftrace.h       Li Zefan                 2013-02-21  326  	field = (typeof(field))iter->ent;				\
80decc70 include/trace/ftrace.h       Steven Rostedt           2010-04-23  327  									\
892c505a include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-05  328) 	ret = trace_raw_output_prep(iter, trace_event);			\
8e2e095c include/trace/ftrace.h       Steven Rostedt (Red Hat  2014-11-14  329) 	if (ret != TRACE_TYPE_HANDLED)					\
f71130de include/trace/ftrace.h       Li Zefan                 2013-02-21  330  		return ret;						\
f71130de include/trace/ftrace.h       Li Zefan                 2013-02-21  331  									\

:::::: The code at line 323 was first introduced by commit
:::::: a7237765730a10d429736f47ac4b89779ec6c534 tracing: Rename ftrace_raw_##call event structures to trace_event_raw_##call

:::::: TO: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Feb. 25, 2017, 2:48 p.m. UTC | #2
Hi Tamizh,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20170224]
[cannot apply to v4.10]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/cfg80211-mac80211-BTCOEX-feature-support/20170225-215733
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-x003-201708 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:95:0,
                    from net/wireless/trace.h:3116,
                    from net/wireless/trace.c:5:
   net/wireless/./trace.h: In function 'trace_raw_output_rdev_set_btcoex':
>> net/wireless/./trace.h:27:22: warning: too many arguments for format [-Wformat-extra-args]
    #define WIPHY_PR_FMT "%s"
                         ^
   include/trace/trace_events.h:332:22: note: in definition of macro 'DECLARE_EVENT_CLASS'
     trace_seq_printf(s, print);     \
                         ^~~~~
   include/trace/trace_events.h:65:9: note: in expansion of macro 'PARAMS'
            PARAMS(print));         \
            ^~~~~~
>> net/wireless/./trace.h:3072:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(rdev_set_btcoex,
    ^~~~~~~~~~~
>> net/wireless/./trace.h:3083:2: note: in expansion of macro 'TP_printk'
     TP_printk(WIPHY_PR_FMT, ", enabled=%d",
     ^~~~~~~~~
>> net/wireless/./trace.h:3083:12: note: in expansion of macro 'WIPHY_PR_FMT'
     TP_printk(WIPHY_PR_FMT, ", enabled=%d",
               ^~~~~~~~~~~~

vim +27 net/wireless/./trace.h

14e8a3c4 Beni Lev      2012-07-31  11  #include <net/cfg80211.h>
14e8a3c4 Beni Lev      2012-07-31  12  #include "core.h"
14e8a3c4 Beni Lev      2012-07-31  13  
14e8a3c4 Beni Lev      2012-07-31  14  #define MAC_ENTRY(entry_mac) __array(u8, entry_mac, ETH_ALEN)
14e8a3c4 Beni Lev      2012-07-31  15  #define MAC_ASSIGN(entry_mac, given_mac) do {			     \
14e8a3c4 Beni Lev      2012-07-31  16  	if (given_mac)						     \
14e8a3c4 Beni Lev      2012-07-31  17  		memcpy(__entry->entry_mac, given_mac, ETH_ALEN);     \
14e8a3c4 Beni Lev      2012-07-31  18  	else							     \
d2beae10 Joe Perches   2015-03-02  19  		eth_zero_addr(__entry->entry_mac);		     \
14e8a3c4 Beni Lev      2012-07-31  20  	} while (0)
14e8a3c4 Beni Lev      2012-07-31  21  #define MAC_PR_FMT "%pM"
14e8a3c4 Beni Lev      2012-07-31  22  #define MAC_PR_ARG(entry_mac) (__entry->entry_mac)
14e8a3c4 Beni Lev      2012-07-31  23  
ec816087 Johannes Berg 2012-11-16  24  #define MAXNAME		32
ec816087 Johannes Berg 2012-11-16  25  #define WIPHY_ENTRY	__array(char, wiphy_name, 32)
ec816087 Johannes Berg 2012-11-16  26  #define WIPHY_ASSIGN	strlcpy(__entry->wiphy_name, wiphy_name(wiphy), MAXNAME)
ec816087 Johannes Berg 2012-11-16 @27  #define WIPHY_PR_FMT	"%s"
ec816087 Johannes Berg 2012-11-16  28  #define WIPHY_PR_ARG	__entry->wiphy_name
14e8a3c4 Beni Lev      2012-07-31  29  
14e8a3c4 Beni Lev      2012-07-31  30  #define WDEV_ENTRY	__field(u32, id)
ce1eadda Johannes Berg 2013-03-19  31  #define WDEV_ASSIGN	(__entry->id) = (!IS_ERR_OR_NULL(wdev)	\
ce1eadda Johannes Berg 2013-03-19  32  					 ? wdev->identifier : 0)
ec816087 Johannes Berg 2012-11-16  33  #define WDEV_PR_FMT	"wdev(%u)"
14e8a3c4 Beni Lev      2012-07-31  34  #define WDEV_PR_ARG	(__entry->id)
14e8a3c4 Beni Lev      2012-07-31  35  

:::::: The code at line 27 was first introduced by commit
:::::: ec816087e8978b74c1bd5fae0e335dd97d964e9f cfg80211: fix some tracing output issues

:::::: TO: Johannes Berg <johannes.berg@intel.com>
:::::: CC: Johannes Berg <johannes.berg@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Johannes Berg March 2, 2017, 8:45 a.m. UTC | #3
You need to fix the build-bot warning, it's legitimate (though hard to
spot):

> +	TP_printk(WIPHY_PR_FMT, ", enabled=%d",
> +		  WIPHY_PR_ARG, __entry->enabled)
> +);

You have a stray comma there after WIPHY_PR_FMT.

johannes
c_traja@qti.qualcomm.com March 2, 2017, 11:49 a.m. UTC | #4
Hi Johannes,

Thanks for the comments.

> You need to fix the build-bot warning, it's legitimate (though hard to

> spot):

> 

> > +	TP_printk(WIPHY_PR_FMT, ", enabled=%d",

> > +		  WIPHY_PR_ARG, __entry->enabled)

> > +);

> 

> You have a stray comma there after WIPHY_PR_FMT.

> 

[Tamizh] Yes:( Will fix it in the next version.
diff mbox

Patch

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 &enum 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_WIPHY		0x01
 #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 b/net/wireless/rdev-ops.h
index 2f42507..6592f14 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1153,4 +1153,15 @@  static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
+
+static inline int
+rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled)
+{
+	int ret = -ENOTSUPP;
+
+	trace_rdev_set_btcoex(&rdev->wiphy, enabled);
+	ret = rdev->ops->set_btcoex(&rdev->wiphy, enabled);
+	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 776e80c..c3970b1 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3047,6 +3047,21 @@ 
 		  WIPHY_PR_ARG, __entry->n_rules)
 );
 
+TRACE_EVENT(rdev_set_btcoex,
+	TP_PROTO(struct wiphy *wiphy, bool enabled),
+	TP_ARGS(wiphy, enabled),
+	TP_STRUCT__entry(
+		WIPHY_ENTRY
+		__field(bool, enabled)
+	),
+	TP_fast_assign(
+		WIPHY_ASSIGN;
+		__entry->enabled = enabled;
+	),
+	TP_printk(WIPHY_PR_FMT, ", enabled=%d",
+		  WIPHY_PR_ARG, __entry->enabled)
+);
+
 DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
 	TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
 	TP_ARGS(wiphy, wdev)