From patchwork Sat Feb 25 13:37:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: c_traja@qti.qualcomm.com X-Patchwork-Id: 9591709 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD5D66042C for ; Sat, 25 Feb 2017 13:40:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD8E428541 for ; Sat, 25 Feb 2017 13:40:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A261D28601; Sat, 25 Feb 2017 13:40:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 35FCE28541 for ; Sat, 25 Feb 2017 13:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7LSj64Lfu8UhM1xTtYHmfA1oq/2EJiptb7q7xY8ptz4=; b=UQvdvS0E65zTJ6 /gub0h4C/7SHx8Zukd7+yUEPFg983cWWGPySqegDouQChaUmUOrbDYqoUC6+yNcsT/I3gCg3JlcG0 SeZop5/Kja7o3KgGhhZFO9Ha2K5urGv6kPEONUN1h/WsIxJmkQ0NN+TBwWZnW06yYzAHXD/AS0w3k ao8585Q8zuhs1HBNMbYBiMiDOtYnB4wYKByAD9tnQth+4uciwkSrq2Jh+c0e8YCUigiJrK6OjeYe4 BS+wfjUTjk2bmDOATgD4fLlWBvfCw7psmMw6bpjtBfEpTJ7hi5lOjmaVFok1Rsrw9cUMdh+CWziWz Oh8bk6s9mCnG1a/b+xtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1chca9-0007Aa-PX; Sat, 25 Feb 2017 13:40:17 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1chca2-0005r5-CD for ath10k@lists.infradead.org; Sat, 25 Feb 2017 13:40:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1488030010; x=1519566010; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ThpnLwUjfhZcMyuItHG1uuOZlEVg9zp3Sa3uyB/+bM8=; b=fwDNEyR08cRaabQy/08X6axjMomCXmmY3E35ew2hI/AfvgO0McBn0izl 6PWnSHTWf9rla131Ln3A8PUHwn+4dTWWXtlCKxkLy1lyus2YacUcZhPnu 1hnGcDI5NX7W4t2PCGvI4r9YAlHoeitbTmXpCJxELQ6TQXIkJlKLtTRpV 0=; X-IronPort-AV: E=Sophos;i="5.35,203,1484035200"; d="scan'208";a="266172043" Received: from unknown (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by wolverine01.qualcomm.com with ESMTP; 25 Feb 2017 05:39:49 -0800 X-IronPort-AV: E=McAfee;i="5800,7501,8450"; a="1316502437" X-MGA-submission: =?us-ascii?q?MDHv67MfpK96/4RQA3ckoWgq+m44P5mD2qDx8k?= =?us-ascii?q?Ssx7pt94wdqvM2CuH/l81Olhzklq/jwcgnIYkeSxnWv9q8XIb86wAhqb?= =?us-ascii?q?xdZZSqt1S935ihEHZVG9tsSBj5E0djRh4giWx0ZyuuUipEoUmkFduR/e?= =?us-ascii?q?Sw?= Received: from nasanexm02d.na.qualcomm.com ([10.85.0.44]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 25 Feb 2017 05:39:48 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by NASANEXM02D.na.qualcomm.com (10.85.0.44) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 25 Feb 2017 05:39:47 -0800 Received: from localhost (10.80.80.8) by aphydexm01f.ap.qualcomm.com (10.252.127.15) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 25 Feb 2017 19:09:42 +0530 From: To: Subject: [PATCHv2 1/4] cfg80211: Add support to enable or disable btcoex Date: Sat, 25 Feb 2017 19:07:50 +0530 Message-ID: <1488029873-14600-2-git-send-email-c_traja@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1488029873-14600-1-git-send-email-c_traja@qti.qualcomm.com> References: <1488029873-14600-1-git-send-email-c_traja@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To aphydexm01f.ap.qualcomm.com (10.252.127.15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170225_054010_553178_9F473F89 X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tamizh chelvam , johannes@sipsolutions.net, ath10k@lists.infradead.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 &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)