From patchwork Tue Nov 8 13:15:29 2016 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: 9417341 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 647316022E for ; Tue, 8 Nov 2016 13:15:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55FE928B76 for ; Tue, 8 Nov 2016 13:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AFB828DB0; Tue, 8 Nov 2016 13:15:36 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EFAB828B76 for ; Tue, 8 Nov 2016 13:15:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c46FP-0000LT-GD; Tue, 08 Nov 2016 13:15:31 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c46FN-0008ST-5P for ath10k@lists.infradead.org; Tue, 08 Nov 2016 13:15:30 +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=1478610929; x=1510146929; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=p4gHb5uLdRR/uSskl5TdBXPE23pQZ85oimShnPVyRyM=; b=KwebIBGGR4LbkF+xYx5QtDATimeezo87bSZYbzpbPqbxthW64oZ0xTIm aCOf5gre1lB/2PZ30mI64htJDyHVPPSxPfUcoGABR0AaRWgYqCMvBzNdM Ew2QHFlGrA2q0a0b9KAw/r8tQ3JVapvVosTAD9cFZhY7O3N6kCFn36enU M=; X-IronPort-AV: E=Sophos;i="5.31,462,1473145200"; d="scan'208";a="333663424" Received: from unknown (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by wolverine02.qualcomm.com with ESMTP; 08 Nov 2016 05:15:05 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8342"; a="1252930343" Received: from nasanexm01g.na.qualcomm.com ([10.85.0.33]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 08 Nov 2016 05:15:02 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by NASANEXM01G.na.qualcomm.com (10.85.0.33) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 8 Nov 2016 05:15:01 -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; Tue, 8 Nov 2016 18:44:55 +0530 From: To: Subject: [PATCH 1/4] cfg80211: Add support to enable or disable btcoex Date: Tue, 8 Nov 2016 18:45:29 +0530 Message-ID: <1478610932-21954-2-git-send-email-c_traja@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1478610932-21954-1-git-send-email-c_traja@qti.qualcomm.com> References: <1478610932-21954-1-git-send-email-c_traja@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) 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-20161108_051529_416387_3A694063 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tamizh chelvam , johannes@sipsolutions.net, tamizhchelvam@codeaurora.org, 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 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 &enum 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 &enum 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(&rdev->wiphy, ret); return ret; } + +static inline int +rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled) +{ + int ret; + + 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 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)