From patchwork Mon Apr 27 13:40:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 220496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5033CAB362 for ; Mon, 27 Apr 2020 13:42:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C1C0206B6 for ; Mon, 27 Apr 2020 13:42:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="L0j6BhRP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728130AbgD0Nle (ORCPT ); Mon, 27 Apr 2020 09:41:34 -0400 Received: from mail-mw2nam12on2085.outbound.protection.outlook.com ([40.107.244.85]:27104 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728091AbgD0Nla (ORCPT ); Mon, 27 Apr 2020 09:41:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AB4+yeYtRwBzvo0O7f/4Hkg8GeF/FB1HKslCgzbmPWmC12R7KUGlscVR85enPWGfXLnd1nKwwDozfp9/sSeFGHeitNzGR3XQ5AgD2TA746fvyYqfuwos3z4/X8DymC3+HkyntDzEDQ7JX4np2/gz9TIjpX6naTbKBQiQzvarCCSIexVq85jRgeTAymgU8HeMylz7XSpOVHTjsa6OFiBhmSJHTZdizcJStiRjAZbCBeYQb8d8bAU9i7GEyXOXic7CkfUjx3rFhPel6oHbd132Ktbu4IdfhXLE+6IqzmRq5NAqY6C6UHVaBABzbf0t+WJc7Nkbr0qaChsKt2xu7eM6UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GOXpCjXjNn0vmAehZaXxc39KhoDaQOMwOW0WJM7VOCQ=; b=kKwlFnqz4d8y4wOzNEvuA57GlF4bcvdNUiqUMa6kL9H1wv4Pa8TAXfUnL9HjzDEi7o+nnx640a7Fq5TWqQFb6s3mUpzseO/hy1ISMtWpyE8Lx3ZnWHyLLXQF8x9bSW8wvYwpilwnzb6J4Pc/ZO1VtoiChmfGqn41Qkh4swTI4Ww4uWLpN+Lgpf1GbfMrcs2ciLFxBYbUnEOZ8bL8jBGOJ5Y3phLasBwgpzDmHZnYk4E9RzdDUDjeDWFkiFn1xqVhCexw6p6kLYszHcvlxWG+Cvm+5YHrljfXDyv8hvkvlPJtx4g/ThqN89VEiN9W+0xqmTKp+RnMXaUstQBzFmWeoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GOXpCjXjNn0vmAehZaXxc39KhoDaQOMwOW0WJM7VOCQ=; b=L0j6BhRPAr0S1PbvR2/NZ4A3F5qKIV6aON407Y3NA3UobdXoTxUgAPrzgihD8wqH6M5SDaCOYB9n5Nk5HBhZsUP5/gGWq/URRBykkvPBawVVBhlVs3AiyYgzxu2TnSfNlAbRpLSRnYvJwsSchnzKHSFi2RY0pSt5F7Afe+Pd68Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1424.namprd11.prod.outlook.com (2603:10b6:300:26::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Mon, 27 Apr 2020 13:41:25 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe%10]) with mapi id 15.20.2937.023; Mon, 27 Apr 2020 13:41:25 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 10/17] staging: wfx: fix the warning "inconsistent notification" Date: Mon, 27 Apr 2020 15:40:24 +0200 Message-Id: <20200427134031.323403-11-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200427134031.323403-1-Jerome.Pouiller@silabs.com> References: <20200427134031.323403-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0232.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1e::28) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by PR0P264CA0232.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Mon, 27 Apr 2020 13:41:23 +0000 X-Mailer: git-send-email 2.26.1 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d5508f0-71a5-474e-f200-08d7eab0ae01 X-MS-TrafficTypeDiagnostic: MWHPR11MB1424: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0386B406AA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(136003)(39850400004)(376002)(346002)(396003)(366004)(8886007)(66476007)(66556008)(4326008)(81156014)(86362001)(45080400002)(8936002)(15650500001)(6486002)(52116002)(6506007)(5660300002)(16526019)(6512007)(1076003)(478600001)(8676002)(36756003)(186003)(2616005)(54906003)(107886003)(66574012)(2906002)(316002)(66946007); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wo+XuBYqeRLJV39h2Gxgx1QHIgaOrzmChEArGUtUS9sk97s9q9b9Acdd43ibWmXozuKIhJJMDqfZtw+sTZHXgjSGqdpBB47xlNufauaoirEbZwjCe8FmR5kAxTXXOqqApN8+FZJZAf0Urr8ZPTr8DPfaSmI/UusZCsRASQQUDof81A1PhJAokTCFF12spdvsLhcOCqFuyiuUnzgqdaEsShBYo6vgwrRAhLJuW4lZbyWRPaTPOQ6RYXVxWHUUTtoCakUHUSs5Ihhpk2OtHKN7jXHJE0Bkf4ughdY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Network-Message-Id: 3d5508f0-71a5-474e-f200-08d7eab0ae01 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2020 13:41:25.3869 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H/ZG6wSBb7jx/ALmUujQm/0WZgj4D6A7DRWFubEj83zliRFQlh7eOrDjCV2Fw0DUtQNBxNooSjz9Bi5FpdYLVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1424 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller In some circumstances, Tx traffic is sent without associated station but the station exists when the Tx status is received. Beside that, the driver keep a counter associated to each station. So, in this case, the counter is not incremented, but is decremented. In this case a warning "inconsistent notification" appears: ------------[ cut here ]------------ WARNING: CPU: 3 PID: 82 at /home/jerome/wfx/data_tx.c:469 wfx_skb_dtor+0x1a4/0x1d4 [wfx] inconsistent notification Modules linked in: [...] CPU: 3 PID: 82 Comm: kworker/3:1H Tainted: G C O 4.19.57-v7l+ #1244 Hardware name: BCM2835 Workqueue: events_highpri bh_work [wfx] [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0xd4/0x118) [] (dump_stack) from [] (__warn+0x104/0x11c) [] (__warn) from [] (warn_slowpath_fmt+0x58/0x74) [] (warn_slowpath_fmt) from [] (wfx_skb_dtor+0x1a4/0x1d4 [wfx]) [] (wfx_skb_dtor [wfx]) from [] (wfx_tx_confirm_cb+0x198/0x2f0 [wfx]) [] (wfx_tx_confirm_cb [wfx]) from [] (hif_tx_confirm+0x50/0x70 [wfx]) [] (hif_tx_confirm [wfx]) from [] (wfx_handle_rx+0x128/0x22c [wfx]) [] (wfx_handle_rx [wfx]) from [] (bh_work+0x3cc/0x964 [wfx]) [] (bh_work [wfx]) from [] (process_one_work+0x170/0x458) [] (process_one_work) from [] (worker_thread+0x5c/0x5a4) [] (worker_thread) from [] (kthread+0x138/0x168) [] (kthread) from [] (ret_from_fork+0x14/0x28) Exception stack(0xee199fb0 to 0xee199ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 64b9e754e12ef7de ]--- This patch fix this race between the station creation and the Tx data. Fixes: 7d2d2bfdeb82 ("staging: wfx: relocate "buffered" information to sta_priv") Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 18 +++++++++++++----- drivers/staging/wfx/data_tx.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 9c1a91207dd8..f8812079d801 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -224,6 +224,7 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, int tid = ieee80211_get_tid(hdr); if (sta) { + tx_priv->has_sta = true; sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; spin_lock_bh(&sta_priv->lock); sta_priv->buffered[tid]++; @@ -469,7 +470,8 @@ static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb) rcu_read_unlock(); } -static void wfx_skb_dtor(struct wfx_dev *wdev, struct sk_buff *skb) +static void wfx_skb_dtor(struct wfx_dev *wdev, + struct sk_buff *skb, bool has_sta) { struct hif_msg *hif = (struct hif_msg *)skb->data; struct hif_req_tx *req = (struct hif_req_tx *)hif->body; @@ -480,7 +482,8 @@ static void wfx_skb_dtor(struct wfx_dev *wdev, struct sk_buff *skb) WARN_ON(!wvif); skb_pull(skb, offset); - wfx_notify_buffered_tx(wvif, skb); + if (has_sta) + wfx_notify_buffered_tx(wvif, skb); wfx_tx_policy_put(wvif, req->tx_flags.retry_policy_index); ieee80211_tx_status_irqsafe(wdev->hw, skb); } @@ -493,6 +496,7 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) struct ieee80211_tx_rate *rate; struct ieee80211_tx_info *tx_info; const struct wfx_tx_priv *tx_priv; + bool has_sta; skb = wfx_pending_get(wvif->wdev, arg->packet_id); if (!skb) { @@ -503,6 +507,7 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) } tx_info = IEEE80211_SKB_CB(skb); tx_priv = wfx_skb_tx_priv(skb); + has_sta = tx_priv->has_sta; _trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wvif->wdev, skb)); @@ -561,12 +566,13 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) } tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; } - wfx_skb_dtor(wvif->wdev, skb); + wfx_skb_dtor(wvif->wdev, skb, has_sta); } void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop) { + const struct wfx_tx_priv *tx_priv; struct wfx_dev *wdev = hw->priv; struct sk_buff_head dropped; struct wfx_queue *queue; @@ -593,7 +599,9 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_tx_flush(wdev); if (wdev->chip_frozen) wfx_pending_drop(wdev, &dropped); - while ((skb = skb_dequeue(&dropped)) != NULL) - wfx_skb_dtor(wdev, skb); + while ((skb = skb_dequeue(&dropped)) != NULL) { + tx_priv = wfx_skb_tx_priv(skb); + wfx_skb_dtor(wdev, skb, tx_priv->has_sta); + } } diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index a308af3d68ad..54fff24508fb 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -36,6 +36,7 @@ struct tx_policy_cache { struct wfx_tx_priv { ktime_t xmit_timestamp; struct ieee80211_key_conf *hw_key; + bool has_sta; } __packed; void wfx_tx_policy_init(struct wfx_vif *wvif);