From patchwork Sat Feb 25 13:37:52 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: 9591707 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 76FF96042C for ; Sat, 25 Feb 2017 13:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6738328541 for ; Sat, 25 Feb 2017 13:40:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C2DF28601; Sat, 25 Feb 2017 13:40:21 +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 F27CE285A7 for ; Sat, 25 Feb 2017 13:40:19 +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=3QqaUYoLpNpYhq4LG729dmPIFLKZcMr0CZbyVi+AJgU=; b=guz3PDc6NfFMlt TdA0+aXuFYxZjyJg/UeJ3ukObvOCL4Z3fost58vRQLfriHa+HvJFCbqylDJslqJWxgyGRuyXXPXnP JGJUkOt2pW+3g7VsDAdpDxax8hTrLLM8yP03gC8tBnLLbo1BTaqCiSUSSAvkUixQ3ZA8HgTaCUBGx wkJxjtFOj3oFhJFbqHRUSH6dzJGr5wg4h3W/7Dngu33OCf5K4r+r2l2ZpUhsiXT48htbDnbpDAz3e 2zwnE5SfGECowS6yUt3FegUUv89HdIWP5kjImefir1Qi5Xv+jt1c4Bca8v22mR2i9yCZa5ApmLu+U n0ceQC/Wzi2YBief1yGg==; 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 1chca6-00072Q-B4; Sat, 25 Feb 2017 13:40:14 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1chcZz-0005qq-EL for ath10k@lists.infradead.org; Sat, 25 Feb 2017 13:40:11 +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=1488030007; x=1519566007; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=XdKRmllXe2btzpeE8ETiT2D83Sx1i27Ul8XzdWzXitY=; b=NIEIgL+C7zNIGJZJYuFKRl6Q+qdYXSLneQn9b3z1fVwuxU+VZ0cDOszb Q3toeH2DpJsOnBPGdhR9mIpf78uMiyMt03t05fLn8+ECztg1jYK0sKV4P 3m11W8luegpyjz8lLdEDwUVnfkO75X+VenWcywRlrDPSFI684z3rahYUS E=; X-IronPort-AV: E=Sophos;i="5.35,203,1484035200"; d="scan'208";a="361575854" Received: from unknown (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by wolverine02.qualcomm.com with ESMTP; 25 Feb 2017 05:40:07 -0800 X-IronPort-AV: E=McAfee;i="5800,7501,8449"; a="907825314" X-MGA-submission: =?us-ascii?q?MDEd1NRyLHxkQTDjnGdGC2OAZ/R06Iforh1JXD?= =?us-ascii?q?4OQmxLmzgIEmPgDNKyLxnSpZsUwPRczkV8E+iQTujOY6K/nVi371JtWL?= =?us-ascii?q?diXuqH99jDGCbblXSrSOYbVsM0ttcNyl4+/qJfA3ayDoRcA+62LiUc0G?= =?us-ascii?q?ok?= Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 25 Feb 2017 05:40:06 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 25 Feb 2017 05:40:05 -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:10:00 +0530 From: To: Subject: [PATCHv2 3/4] cfg80211: Add Support set btcoex priority value Date: Sat, 25 Feb 2017 19:07:52 +0530 Message-ID: <1488029873-14600-4-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: NASANEXM01F.na.qualcomm.com (10.85.0.32) 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_054007_754539_E7BECC48 X-CRM114-Status: GOOD ( 15.10 ) 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 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 = &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,