From patchwork Wed Feb 5 01:23:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan periyasamy X-Patchwork-Id: 11365675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 690D4138D for ; Wed, 5 Feb 2020 01:24:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46F72214AF for ; Wed, 5 Feb 2020 01:24:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c4wWuAu3"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="sCVHb4az" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46F72214AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=HXBiT60LzuV4mXy78FO2skk13JcYDwy+b6XxyOWd/qw=; b=c4w WuAu3VwGXTkUvk4pai/2HlQWkbP09A2vz9EGGD64iuBN3zUsG8ZMiJAbXEoTsLhBZG/4LSuc5Oc+S gj6SGkAnYM0YeSTSbfxQLGH8Jj6P5m8fEe8EQFSFif9JtCZTzUsCJgDzYhGV7OqC9J9jZdx3osE9E S67MqFIVmM8mtfU1KCvUtffUnpjtaAdF+8mPkjtMVdyQfEnnWWXLUbtrDC0mQzurcCdYYB8eLDivb ec+kiWcRxREWbVagsLhLCyLc7duT66CyHgrHTYLHOP5xDuiuC4qOlyL7cEU/L7Ve5tExvC2oRpN3Y EXlXFKp2kTmJMfW1urufuIaFUnCM4Mw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iz9QF-0006O3-Uv; Wed, 05 Feb 2020 01:24:07 +0000 Received: from mail26.static.mailgun.info ([104.130.122.26]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iz9QD-0006Nk-1D for ath11k@lists.infradead.org; Wed, 05 Feb 2020 01:24:07 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1580865845; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=0RYLqjb9oi5D3Mt5uUDS9TmjJKL6DXjoYPpbN1inX/U=; b=sCVHb4azBwY5brCOcerdxPs+vyty+mS9gbEX6WxBR5467fhQ/AATFw/gm+roK5CONH6jN7DG P/koEJ5xnff+aGIhxhrS/Pqpi2SmDwMRmbruUz88bG7LLfmP7/548Th7CuHkSqVI0cDShf9G bKGPSBShVcNoYikI4YiswaxK86Y= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyJmOGQ2ZiIsICJhdGgxMWtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e3a1931.7f0a48f7df48-smtp-out-n01; Wed, 05 Feb 2020 01:24:01 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 23DF0C433A2; Wed, 5 Feb 2020 01:24:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from CHECSTP284781-LIN.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: periyasa) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2F498C43383; Wed, 5 Feb 2020 01:23:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2F498C43383 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=periyasa@codeaurora.org From: Karthikeyan Periyasamy To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: fix warn-on in disassociation Date: Wed, 5 Feb 2020 06:53:48 +0530 Message-Id: <1580865828-31330-1-git-send-email-periyasa@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200204_172405_704323_734C1F94 X-CRM114-Status: GOOD ( 15.56 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.26 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [104.130.122.26 listed in wl.mailspike.net] X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Karthikeyan Periyasamy , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org In multi AP VAP scenario, when user bring down the interfaces. mac80211 mark the interface down for the duplicated VAP and removed from the local->interfaces list. ath11k_mac_get_arvif() is dependent on ieee80211_iterate_active_interfaces_atomic() API to find the vdev id in a given radio. In disassociation path, ath11k_mac_get_arvif() not able to find the given vdev id since that VAP is removed from the local->interfaces list. since sta_state callback throws error, mac80211 log the below WARN_ON_ONCE message. Fixed it by storing the allocated_vdev_map in each radio structure to maintain the created vdev id bits. so that we can directly mask this against the given vdev_id to find out the ar from the vdev_id. WARN LOG: WARNING: at net/mac80211/sta_info.c:1008 CPU: 2 PID: 2135 Comm: hostapd Not tainted #1 Hardware name: Qualcomm Technologies, Inc. IPQ807x/AP-HK01-C1 (DT) task: ffffffc03a43d800 ti: ffffffc03a43d800 task.ti: ffffffc03a43d800 PC is at sta_set_sinfo+0x9dc/0xad4 [mac80211] LR is at sta_set_sinfo+0x9cc/0xad4 [mac80211] pc : [] lr : [] pstate: 20000145 sp : ffffffc02cedb5f0 x29: ffffffc02cedb5f0 x28: ffffffc03a43d800 x27: 0000000000000014 x26: 0000000000000001 x25: ffffffc02cfc4000 x24: ffffffc036905508 x23: 0000000000000012 x22: ffffffc02cedb670 x21: ffffffc03bc64880 x20: ffffffc036904f80 x19: ffffffc02ae31000 x18: 00000000b019f3a1 x17: 0000000057f30331 x16: 00000000d8d1998e x15: 0000000000000066 x14: 393a35383a36343a x13: 6337203a6e6f6974 x12: 6174732065746169 x11: 636f737361736964 x10: 206f742064656c69 x9 : 6146203a31696669 x8 : 6337203a6e6f6974 x7 : 6174732065746169 x6 : ffffffc0008c33f6 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 00000000ffffff92 x1 : 0000000000000000 x0 : ffffffbffcea1091 ---[ end trace 63c4b1c527345d5a ]--- Call trace: [] sta_set_sinfo+0x9dc/0xad4 [mac80211] [] __sta_info_flush+0xec/0x130 [mac80211] [] ieee80211_nan_func_match+0x1a34/0x23e4 [mac80211] [] __cfg80211_stop_ap+0x60/0xf0 [cfg80211] [] __cfg80211_leave+0x110/0x150 [cfg80211] [] cfg80211_leave+0x30/0x48 [cfg80211] [] cfg80211_init_wdev+0x22c/0x808 [cfg80211] [] notifier_call_chain+0x50/0x84 [] raw_notifier_call_chain+0x14/0x1c [] call_netdevice_notifiers_info+0x5c/0x6c [] call_netdevice_notifiers+0x10/0x18 [] __dev_close_many+0x54/0xc0 [] dev_close_many+0x64/0xdc [] rollback_registered_many+0x138/0x2f4 [] rollback_registered+0x20/0x34 [] unregister_netdevice_queue+0x68/0xa8 [] ieee80211_if_remove+0x84/0xc0 [mac80211] [] ieee80211_nan_func_match+0x2374/0x23e4 [mac80211] [] cfg80211_wext_giwscan+0x1000/0x1140 [cfg80211] [] backport_genlmsg_multicast_allns+0x158/0x1b4 [compat] [] genl_family_rcv_msg+0x258/0x2c0 [] genl_rcv_msg+0x48/0x6c [] netlink_rcv_skb+0x5c/0xc4 [] genl_rcv+0x34/0x48 [] netlink_unicast+0x12c/0x1e0 [] netlink_sendmsg+0x2bc/0x2dc [] sock_sendmsg+0x18/0x2c [] ___sys_sendmsg+0x1bc/0x248 [] __sys_sendmsg+0x40/0x68 [] SyS_sendmsg+0x10/0x20 [] el0_svc_naked+0x24/0x28 Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 18 +++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 9e82305..6a30601 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -607,6 +607,7 @@ void ath11k_core_halt(struct ath11k *ar) lockdep_assert_held(&ar->conf_mutex); ar->num_created_vdevs = 0; + ar->allocated_vdev_map = 0; ath11k_mac_scan_finish(ar); ath11k_mac_peer_cleanup_all(ar); diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 25cdcf7..987f62b 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -486,6 +486,7 @@ struct ath11k { int max_num_peers; u32 num_started_vdevs; u32 num_created_vdevs; + unsigned long long allocated_vdev_map; struct idr txmgmt_idr; /* protects txmgmt_idr data */ diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 6640662..78f20ba 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -369,8 +369,10 @@ struct ath11k_vif *ath11k_mac_get_arvif(struct ath11k *ar, u32 vdev_id) flags, ath11k_get_arvif_iter, &arvif_iter); - if (!arvif_iter.arvif) + if (!arvif_iter.arvif) { + ath11k_warn(ar->ab, "No VIF found for vdev %d\n", vdev_id); return NULL; + } return arvif_iter.arvif; } @@ -398,14 +400,12 @@ struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab, u32 vdev_id) { int i; struct ath11k_pdev *pdev; - struct ath11k_vif *arvif; for (i = 0; i < ab->num_radios; i++) { pdev = rcu_dereference(ab->pdevs_active[i]); if (pdev && pdev->ar) { - arvif = ath11k_mac_get_arvif(pdev->ar, vdev_id); - if (arvif) - return arvif->ar; + if (pdev->ar->allocated_vdev_map & (1LL << vdev_id)) + return pdev->ar; } } @@ -3874,6 +3874,7 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw) ar->num_started_vdevs = 0; ar->num_created_vdevs = 0; ar->num_peers = 0; + ar->allocated_vdev_map = 0; /* Configure monitor status ring with default rx_filter to get rx status * such as rssi, rx_duration. @@ -4112,8 +4113,9 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, } ar->num_created_vdevs++; - + ar->allocated_vdev_map |= 1LL << arvif->vdev_id; ab->free_vdev_map &= ~(1LL << arvif->vdev_id); + spin_lock_bh(&ar->data_lock); list_add(&arvif->list, &ar->arvifs); spin_unlock_bh(&ar->data_lock); @@ -4227,6 +4229,7 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, err_vdev_del: ath11k_wmi_vdev_delete(ar, arvif->vdev_id); ar->num_created_vdevs--; + ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); ab->free_vdev_map |= 1LL << arvif->vdev_id; spin_lock_bh(&ar->data_lock); list_del(&arvif->list); @@ -4263,7 +4266,6 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw, ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n", arvif->vdev_id); - ab->free_vdev_map |= 1LL << (arvif->vdev_id); spin_lock_bh(&ar->data_lock); list_del(&arvif->list); spin_unlock_bh(&ar->data_lock); @@ -4281,6 +4283,8 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw, arvif->vdev_id, ret); ar->num_created_vdevs--; + ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); + ab->free_vdev_map |= 1LL << (arvif->vdev_id); ath11k_peer_cleanup(ar, arvif->vdev_id);