From patchwork Fri May 15 08:33:15 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: 1290939 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=nGhD6maT; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49NhXc2Bcsz9sTM for ; Fri, 15 May 2020 18:34:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbgEOIeX (ORCPT ); Fri, 15 May 2020 04:34:23 -0400 Received: from mail-dm6nam11on2053.outbound.protection.outlook.com ([40.107.223.53]:55808 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728186AbgEOIeU (ORCPT ); Fri, 15 May 2020 04:34:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HaAOfY9BPxFQAsTE30zdP81KxH5y8KizUjavcG8cuW8LKCM4T6kSk9ATfPtUGzBJRivAgVIBLBuflV7k+RsS5rl9fRGD0sVnczBxbL6QBhguythskZLiUPteJxlWjv+jWX1tVRLvKbqtpKv5FUvL/9C0cQdkY4dQI3kMmFcH1eDTiMiAEK5Z53VmsXUcuKZsVg/WsIUXfydxOtfnbyTFG01xIWvFrklyFIYxdpwl3hBQY316yEuo0KUUAYJV/MZGKeOgR1KJXyLlaHwWhB7G/zzXIRHhGwlhElTIArnThlHh2Nq3hgIGCj9wbYAtHD+JrUKEFSFms/7eG4LXFmgO+Q== 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=VTo4cUJpViSIE4IqsjGU0hc18B2rO5LsQoDQfmx4mLU=; b=IrRMqUM+wn4mB3DYL90NBQuJ+dOT/5Qg0lBNte295NukKDxqPTuu2C3Z0PznKu6NA3am803dvgcPOsBTIBOlsmpd7XPE5Iup1uIl2bY+6F1YEuLjJ8qtrriaB/wxvDcCot6usKAbRn46MwY2uEFzCJBNeQDwljfxEqQdGX8IKJzDNssyQWSmH0vJj9GNOxpSoUF05gCT+OICTNaujG3v0JP1syBLfPtmU8CKCIVnw9BGPKSK4r6vyhHMYmdIUpHOux925hi06hM7o+EMZK+nSW3Zff5bMzxTwhf3gcQ2i+Ul13PGcMNIGtFZVSZftd532KpsVxPhKKaEXxHR59YJdA== 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=VTo4cUJpViSIE4IqsjGU0hc18B2rO5LsQoDQfmx4mLU=; b=nGhD6maTSxIY5B8vI8NU7UeVMsvk/cmXPMcgvaDqWiE2RclRpTIykAsEtvuaT1gJjhMV79IPGwGDd04SquVdh9yHYym1uQsP7kNJcm/oTsBfpU++dERmTv81XRo5x7Gcnt/3PaZE9XzteOM6H8lWL3CtVqViVrq3WkMDfTojZtE= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none;driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1310.namprd11.prod.outlook.com (2603:10b6:300:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Fri, 15 May 2020 08:34:05 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da%5]) with mapi id 15.20.3000.022; Fri, 15 May 2020 08:34:05 +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 09/19] staging: wfx: call wfx_tx_update_sta() before to destroy tx_priv Date: Fri, 15 May 2020 10:33:15 +0200 Message-Id: <20200515083325.378539-10-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> References: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) 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 (82.67.86.106) by PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 08:34:03 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [82.67.86.106] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad575a6d-5dc4-444a-4a92-08d7f8aaba8a X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KIXb0fza1REQJSw49v05XSb5RFd21mqpjv26HTND9gt+HEPqi0PHr+Txgqg9jSKByYdHbst0t3RLVbDO4qNVrnYoOS40tPAQ4jyxdF3CQIsyPwBg1Y5XbQ7nswlG8XcOkB5CjgXtO/VQF9iQQ2m8qzASEJRnVp5LF/xluxaNWVORyBdkt7gypALU67R9uz5VtV8gTBUiBSl4ssiquwXCoNoqGWK07RBof79DhqX/QxcdOU5wTkExieJexZHgFbAXQu8wrqEpxp83vyJFDnZoTaQ++n40kn5+tuWWuLKiMBHzuP6FpO6X/uGgNpIABqxj8B9qEinPttAy1dQMPSYdRc942jQ9jpX5EoNj9UtRWSGwjkRwxHv3O4ft8Y1zWlxqADsZq1AdcCERFz9ctvVXN4bUx77UELAvjxPIIK8+WlP1x+6OjkeLStm8SRSsfNzU 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:(346002)(136003)(376002)(366004)(39850400004)(396003)(8886007)(66556008)(186003)(6512007)(66946007)(6506007)(36756003)(316002)(66476007)(26005)(52116002)(16526019)(6666004)(54906003)(2906002)(2616005)(478600001)(66574014)(107886003)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E39t5VB7e4JilvqR+cuU+uI8gRs6nObxkNlBg1fhimhtWzzOvlma9Ym20tFAHrrvhwm+MhOZcOp5PB/rtrM/+bThBs3nCDY9SVEh5/CmwKjR9ttl0Pmv0cjfoMF2HuyAWyc2ysNQq36ZPBkwvZJkgMnXN3jG0TvfFVLQrUiodeyqVQ7/INbQXysy1fVSZkLj/KOBhpqDbw+di4aNAIjIsc2XHS0gn7Jw0rxs9PkS3HxlOHCvK5cJ4h/MaMqP4mI1nFCTpFuGhfwgo6wzXoLu1jMM8sOmf1MskFRaLgnQoiYR3gKoooaoV7dDaex3gqvQRXlNvqUTLF5+n5ZpO0Ln78jxN+KeEX7obLjVjPIJ1QRZkOVaPrXlBdlgUZJXsV5hX/hVZkRRAZBQ/IP88QurR4ezxGfu97RvanJ7awcYpToJ9fod/B/4U5q7VkwdHQEHl/HU/tCFpocFzUs2ILl7qDjhuVpcWXj8JjIjJlOiXWQ= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad575a6d-5dc4-444a-4a92-08d7f8aaba8a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:05.5098 (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: PHNnhWREid43/nhX+ciMP8vGWMMrnGweWCGZv1sFBTvFYktq9cOCdMMFHLJPF08nN0DVnzC7urCQxmCH+KSIYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1310 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller The function wfx_notify_buffered_tx() need to know if the frame was associated to a station. This information is available in the Control Buffer (CB) of the skb. However, when wfx_notify_buffered_tx() is called, the CB is no more available. Thus, the caller has to take care of this information. wfx_notify_buffered_tx() is a specific case. All the other function are called before the destruction of the CB. So, this patch align the API of wfx_notify_buffered_tx() with the other functions. Call it before the CB was destroyed and drop the extra argument 'has_sta'. It is also the right time to rename it into wfx_tx_update_sta() (which is closer to the behavior of the function). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 39 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 2ba3b5c3d1a7..314cc2743a2b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -457,12 +457,19 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, ieee80211_tx_status_irqsafe(wdev->hw, skb); } -static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb) +static struct ieee80211_hdr *wfx_skb_hdr80211(struct sk_buff *skb) { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct hif_msg *hif = (struct hif_msg *)skb->data; + struct hif_req_tx *req = (struct hif_req_tx *)hif->body; + + return (struct ieee80211_hdr *)(req->frame + req->data_flags.fc_offset); +} + +static void wfx_tx_update_sta(struct wfx_vif *wvif, struct ieee80211_hdr *hdr) +{ + int tid = ieee80211_get_tid(hdr); + struct wfx_sta_priv *sta_priv; struct ieee80211_sta *sta; - struct wfx_sta_priv *sta_priv; - int tid = ieee80211_get_tid(hdr); rcu_read_lock(); // protect sta sta = ieee80211_find_sta(wvif->vif, hdr->addr1); @@ -478,22 +485,18 @@ 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, bool has_sta) +static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) { struct hif_msg *hif = (struct hif_msg *)skb->data; struct hif_req_tx *req = (struct hif_req_tx *)hif->body; - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); unsigned int offset = sizeof(struct hif_msg) + sizeof(struct hif_req_tx) + req->data_flags.fc_offset; WARN_ON(!wvif); skb_pull(skb, offset); - 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); + ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); } static void wfx_tx_fill_rates(struct wfx_dev *wdev, @@ -539,7 +542,6 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) struct ieee80211_tx_info *tx_info; const struct wfx_tx_priv *tx_priv; struct sk_buff *skb; - bool has_sta; skb = wfx_pending_get(wvif->wdev, arg->packet_id); if (!skb) { @@ -549,12 +551,13 @@ 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)); // You can touch to tx_priv, but don't touch to tx_info->status. wfx_tx_fill_rates(wvif->wdev, tx_info, arg); + if (tx_priv->has_sta) + wfx_tx_update_sta(wvif, wfx_skb_hdr80211(skb)); skb_trim(skb, skb->len - wfx_tx_get_icv_len(tx_priv->hw_key)); // From now, you can touch to tx_info->status, but do not touch to @@ -580,16 +583,17 @@ 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, has_sta); + wfx_skb_dtor(wvif, skb); } 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; + struct wfx_vif *wvif; + struct hif_msg *hif; struct sk_buff *skb; int vif_id = -1; int i; @@ -615,9 +619,12 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (wdev->chip_frozen) wfx_pending_drop(wdev, &dropped); while ((skb = skb_dequeue(&dropped)) != NULL) { - tx_priv = wfx_skb_tx_priv(skb); + hif = (struct hif_msg *)skb->data; + wvif = wdev_to_wvif(wdev, hif->interface); + if (wfx_skb_tx_priv(skb)->has_sta) + wfx_tx_update_sta(wvif, wfx_skb_hdr80211(skb)); ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); - wfx_skb_dtor(wdev, skb, tx_priv->has_sta); + wfx_skb_dtor(wvif, skb); } }