From patchwork Fri May 15 08:33:09 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: 219197 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=ham 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 B97E1C433E3 for ; Fri, 15 May 2020 08:34:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 880B220657 for ; Fri, 15 May 2020 08:34:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="YjiIkmVJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728083AbgEOIeE (ORCPT ); Fri, 15 May 2020 04:34:04 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:6138 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728015AbgEOIeD (ORCPT ); Fri, 15 May 2020 04:34:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TpkibvZ71J4dIkCBQJhw3yWeGefBLq1nNS/VPhhOO4g/vIfBUDYpxfWmIK57STWUxBwNHhXkHPYnl0IM9tl0CiIIqQau8F5mFAYi5eJ5toXPUxudzzMFPjb7/2m0SuOpRRwfSWYC6COmnipOKoITh59P2CoKMtDW9gPURU2VqvoUfNkn6hFZ/fDL5hpizxeB+FUjq6MuJ/O4wfrG0rDWBtZp3ekEzfmsnWyTRxXhwu0AXklDpggW2eCXOb+E3Xad/GJBOhNM0QdRRZKN0aJRdIrIABz8uUKRP7pdz1u4t3rj7cFI2K8rVH0uX+PvaxPu6SB79sFp2ZGMU30CL5M28A== 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=gUUFM756JXmxwyceH0imV4Uq4UE4xaRnUvhSWgljqwY=; b=es8L4ZNb0Zj0SvlyJPFPNtlSRnpmLvGvAv5zX4EV8IMrtSsKiKqWZwf7/220HaE2IAD1DtgiRhIGAUIubZFPcITjwQ+WXHFXa1D+fQhjArdZrfQTPmpgilozmVWzr/7X7fyCkYLf/b77KnJlgRGTlNz4J1fKcuj9taLaqtbFIyOPZ1ovazf0+kjR8L0O95xVgIcNY1N7+zACLWwoCFbaO1Pg1k3A6XB1bygxIF5OgyLCgqlzwXzb7hEFgJ43z8P88/o+aBTVF9dn6jcAzaJ6ODhu/AbJxHh9KW2bIRmfjjThO3xzheBbcu5vgdTo8dtboghX1ixYn6WG/tn16OmqLg== 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=gUUFM756JXmxwyceH0imV4Uq4UE4xaRnUvhSWgljqwY=; b=YjiIkmVJIM5Uv9WWiF4EGceAt1g21Yz8CRU1gJOrA5okJJa+mNloAqqGPLcRsv1ieit/P8/WOSk2IbCAfQpP//O37HjWKcsLHi4wWDrJ4q2wghgewlCT7MEorax+ckBHIIMa6DJqlWTTZMjq4V4WqNJKGHnLcwHRHljPCCkrLNs= 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:33:54 +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:33:54 +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=?= , Dan Carpenter Subject: [PATCH 03/19] staging: wfx: check pointers returned by allocations Date: Fri, 15 May 2020 10:33:09 +0200 Message-Id: <20200515083325.378539-4-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:33:52 +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: 25e9ad93-f6aa-477b-a8d6-08d7f8aab3bc X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:109; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FLRmaPrFR66IoO0pAxMYHXEZCjzcX/QrAXudOW1o8Hn7wuW/enUF0PYhhs1N88iEJTi7MasXm8ghdSfo4J13SZW27WuEGVkpFDAkK8/ftG4/P2khXM5ZPo26vqFhGKFhLX0eRrhwMoWRAEzt8wfFGJZtGf93INxDXFyyARBHbpsuMwHjZ00nix7Wmuihl3Upg+UZLfjoj7WvaSD77ZHAZIABEOBtRcnoG5Cp0bXc5mm9A61qG+2ypbxfNxtWDDiANss3NQkBARiKLDZTVV4eVbAPIFPHThObvjMxrGEmNvh9CmJZuWXD6XF9R3VnxG/OzSHOf0voKhxv/8qIEXIVrc3H4E4ExaEdtjce9jlpp9EDB9iR8exlb5zMAl/0om+7EYWZF0gCtyqXsBe0jnMsFQ+dSwD14963gY/BHBnkWHjc/wdsAXbeg4NWbuWwj5zrAElybfE1NhuWlkgD+rEw7QiDQvyBBVY1Hs8t9GK37TewIyAV2xD7LLwnYnCEqx42WwuQZKRJtQSzFiMO6Ja5UQ== 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)(966005)(6506007)(36756003)(316002)(66476007)(26005)(52116002)(16526019)(6666004)(54906003)(2906002)(2616005)(478600001)(66574014)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Qgr5o1s4VthL720BE1UX9vjTTrHrVy2iWQQ+bEb0wBnCf9AEDtKCtduoMzQKnj/GoLAhpLBO3TcWVpxVE6ImNTKJ6mOBNCLpNOJRkqIMtiSwvO+D8rcuuCwWnaw+Aj+UgyVM9leips5HJbdhSH6ToM22OWzTlj6Sm5/KVbI0T3N8+ExBBOP0hK7dsh9Mf2nybrWSOTan691ixYEiukUuQ6y04PmNPuD2IE2nCcRc8Mv3n4G4SCxmuguOUh5U4PVYf9bV7RWwoeyIqUZ2HuMsZfIlaeGda3EEm4p6TjEcIbFkw8mos0m52V44OPkKWhzOiyjfoXrVLGE8wC4oWcFjYqfvpLFRejoFKEUTxB0lapULZ3/ycIzdJznU68uT2hvzjnngF1XN7cn9IJtkea2HrC2ENrAlU7SK6iKVbScFU3v+kmBb3K3Navanmdv5HN15cRuIVkUMHloyvQWQHTOKCYQi6geplIduEQPejVycQ64= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25e9ad93-f6aa-477b-a8d6-08d7f8aab3bc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:33:54.0988 (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: N3RxXwmsGbRVC4kGAv/lAtFC2bJNvuEr2EZ6s2UEx7klkVU/NlSzmFZcQ96JDhqUyFux5U3GjmOGYxXmj7yQNA== 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 Until now, the driver did not always check if the allocations success. The issue was discussed here: https://lore.kernel.org/netdev/2026476.QLiXXEGFCf@pc-42/ Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 43 ++++++++++++++++++++++++++++++++ drivers/staging/wfx/hif_tx_mib.c | 2 ++ 2 files changed, 45 insertions(+) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 58adfaf8066d..1cb71f0ad804 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -134,6 +134,8 @@ int hif_shutdown(struct wfx_dev *wdev) if (wdev->chip_frozen) return 0; wfx_alloc_hif(0, &hif); + if (!hif) + return -ENOMEM; wfx_fill_header(hif, -1, HIF_REQ_ID_SHUT_DOWN, 0); ret = wfx_cmd_send(wdev, hif, NULL, 0, true); // After this command, chip won't reply. Be sure to give enough time to @@ -157,6 +159,8 @@ int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) struct hif_msg *hif; struct hif_req_configuration *body = wfx_alloc_hif(buf_len, &hif); + if (!hif) + return -ENOMEM; body->length = cpu_to_le16(len); memcpy(body->pds_data, conf, len); wfx_fill_header(hif, -1, HIF_REQ_ID_CONFIGURATION, buf_len); @@ -171,6 +175,8 @@ int hif_reset(struct wfx_vif *wvif, bool reset_stat) struct hif_msg *hif; struct hif_req_reset *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; body->reset_flags.reset_stat = reset_stat; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_RESET, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); @@ -187,6 +193,10 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, struct hif_req_read_mib *body = wfx_alloc_hif(sizeof(*body), &hif); struct hif_cnf_read_mib *reply = kmalloc(buf_len, GFP_KERNEL); + if (!body || !reply) { + ret = -ENOMEM; + goto out; + } body->mib_id = cpu_to_le16(mib_id); wfx_fill_header(hif, vif_id, HIF_REQ_ID_READ_MIB, sizeof(*body)); ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); @@ -204,6 +214,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); else memset(val, 0xFF, val_len); +out: kfree(hif); kfree(reply); return ret; @@ -217,6 +228,8 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, int buf_len = sizeof(struct hif_req_write_mib) + val_len; struct hif_req_write_mib *body = wfx_alloc_hif(buf_len, &hif); + if (!hif) + return -ENOMEM; body->mib_id = cpu_to_le16(mib_id); body->length = cpu_to_le16(val_len); memcpy(&body->mib_data, val, val_len); @@ -241,6 +254,8 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, compiletime_assert(IEEE80211_MAX_SSID_LEN == HIF_API_SSID_SIZE, "API inconsistency"); + if (!hif) + return -ENOMEM; for (i = 0; i < req->n_ssids; i++) { memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, IEEE80211_MAX_SSID_LEN); @@ -288,6 +303,8 @@ int hif_stop_scan(struct wfx_vif *wvif) // body associated to HIF_REQ_ID_STOP_SCAN is empty wfx_alloc_hif(0, &hif); + if (!hif) + return -ENOMEM; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_STOP_SCAN, 0); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); @@ -305,6 +322,8 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, WARN_ON(!conf->basic_rates); WARN_ON(sizeof(body->ssid) < ssidlen); WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); + if (!hif) + return -ENOMEM; body->infrastructure_bss_mode = !conf->ibss_joined; body->short_preamble = conf->use_short_preamble; if (channel && channel->flags & IEEE80211_CHAN_NO_IR) @@ -333,6 +352,8 @@ int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) struct hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; body->aid = cpu_to_le16(aid); body->beacon_lost_count = beacon_lost_count; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, @@ -349,6 +370,8 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) // FIXME: only send necessary bits struct hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; // FIXME: swap bytes as necessary in body memcpy(body, arg, sizeof(*body)); if (wfx_api_older_than(wdev, 1, 5)) @@ -369,6 +392,8 @@ int hif_remove_key(struct wfx_dev *wdev, int idx) struct hif_msg *hif; struct hif_req_remove_key *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; body->entry_index = idx; wfx_fill_header(hif, -1, HIF_REQ_ID_REMOVE_KEY, sizeof(*body)); ret = wfx_cmd_send(wdev, hif, NULL, 0, false); @@ -388,6 +413,8 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, return -ENOMEM; WARN_ON(arg->aifs > 255); + if (!hif) + return -ENOMEM; body->aifsn = arg->aifs; body->cw_min = cpu_to_le16(arg->cw_min); body->cw_max = cpu_to_le16(arg->cw_max); @@ -414,6 +441,8 @@ int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) if (!body) return -ENOMEM; + if (!hif) + return -ENOMEM; if (ps) { body->pm_mode.enter_psm = 1; // Firmware does not support more than 128ms @@ -435,6 +464,8 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); WARN_ON(!conf->beacon_int); + if (!hif) + return -ENOMEM; body->dtim_period = conf->dtim_period; body->short_preamble = conf->use_short_preamble; body->channel_number = channel->hw_value; @@ -456,6 +487,8 @@ int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; body->enable_beaconing = enable ? 1 : 0; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, sizeof(*body)); @@ -470,6 +503,8 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) struct hif_msg *hif; struct hif_req_map_link *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; if (mac_addr) ether_addr_copy(body->mac_addr, mac_addr); body->map_link_flags = *(struct hif_map_link_flags *)&flags; @@ -487,6 +522,8 @@ int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) int buf_len = sizeof(struct hif_req_update_ie) + ies_len; struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); + if (!hif) + return -ENOMEM; body->ie_flags.beacon = 1; body->num_ies = cpu_to_le16(1); memcpy(body->ie, ies, ies_len); @@ -504,6 +541,8 @@ int hif_sl_send_pub_keys(struct wfx_dev *wdev, struct hif_req_sl_exchange_pub_keys *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; body->algorithm = HIF_SL_CURVE25519; memcpy(body->host_pub_key, pubkey, sizeof(body->host_pub_key)); memcpy(body->host_pub_key_mac, pubkey_hmac, @@ -524,6 +563,8 @@ int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap) struct hif_msg *hif; struct hif_req_sl_configure *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; memcpy(body->encr_bmp, bitmap, sizeof(body->encr_bmp)); wfx_fill_header(hif, -1, HIF_REQ_ID_SL_CONFIGURE, sizeof(*body)); ret = wfx_cmd_send(wdev, hif, NULL, 0, false); @@ -538,6 +579,8 @@ int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination) struct hif_req_set_sl_mac_key *body = wfx_alloc_hif(sizeof(*body), &hif); + if (!hif) + return -ENOMEM; memcpy(body->key_value, slk_key, sizeof(body->key_value)); body->otp_or_ram = destination; wfx_fill_header(hif, -1, HIF_REQ_ID_SET_SL_MAC_KEY, sizeof(*body)); diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 567c61d1fe2e..1689cb42acc0 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -222,6 +222,8 @@ int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int ret; arg = kzalloc(size, GFP_KERNEL); + if (!arg) + return -ENOMEM; arg->num_tx_rate_policies = 1; arg->tx_rate_retry_policy[0].policy_index = policy_index; arg->tx_rate_retry_policy[0].short_retry_count = 255; From patchwork Fri May 15 08:33:11 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: 219189 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 50822C433E0 for ; Fri, 15 May 2020 08:35:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24D9E2054F for ; Fri, 15 May 2020 08:35:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="OXn1dTlK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbgEOIeM (ORCPT ); Fri, 15 May 2020 04:34:12 -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 S1727853AbgEOIeK (ORCPT ); Fri, 15 May 2020 04:34:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSfMXlm+XHr6iBmbFfwq+qyJ3zF5vUoLIHEkT2tSFKNVmbeH/8BYBycHk8PZXRj/zRjpNKZa8TQhf1GMM03zi50OyqIIHUmH8d8YzJ/yQwoU1fJxBW4UPAWMd6E0XQIsJb3NKkc8fzcmNsSrxaUGZd1iYo4YoB1QOcuPO9wvEmpiKIptGPxtC8aWlYJLYE/mr0d6vpC34fQuQZIDhhNXFtAOYyJGJUS/sy7YmIBqOUNntRZhxahNb2K3o/XnDfgccgP4Hp8hF7b72LLZLOmCWnMnw2rvG2HKT+mQ1Sk+m2bXjdGyKrrtuL7WRfisRrYi/2sCwsmvAio0GFVJqumBJQ== 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=yRGzSAKxWDeKco+3lbUM824AhIj80UEP/NKfp2lWdm4=; b=BRCE+N5L79vZl5CRZbcu8orQ73h5gb3Pfk9ZA/yujsIw8IsPK0KxSRbsvQggg9wlXpoQSaA8T90ok4oPPRaDSpGCrNuScSveFs1q0IcFMzDM/RVKRnDM5WPMojormI2EJyzLpYZnzwSmrmjnGDzOVksO/5qo18hzztxrMLpDSCJbL5Jsy9iBSgVkIgW/141nArfFVIaZtTIfaPrs36ASFZqPq+Uw6UbSkHcgR8QISuFoU55UIXYyqQt2y0c0oQcjttkno26oE1nhFTHy/k+JNmwZWKEnLYxVeg35qiFc4JZGmVWTMCIOvSAFZGIWKtVTQrI2/j/D3oQHq0Xd0SjOyg== 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=yRGzSAKxWDeKco+3lbUM824AhIj80UEP/NKfp2lWdm4=; b=OXn1dTlK3W+hOtqQ1x5hzK6LlfHaYt7rzNdq2zmtA/PQB4G3uXGXjWzkMk6WCi0tw91aOKGkFA8bpEPPM31zFdP5TI8zCWDwRksc7wa3jUDz1HsN+LFuw5AWp4Rd9x4fjLI2duQs8Du7k13DEPtdgyY/6HTAcXsDNExALWCOK0c= 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:33:58 +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:33:58 +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 05/19] staging: wfx: fix coherency of hif_scan() prototype Date: Fri, 15 May 2020 10:33:11 +0200 Message-Id: <20200515083325.378539-6-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:33:56 +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: 9f408363-c6a3-47d4-0518-08d7f8aab5ed X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uhDt7bKbqQFpQLDTfRV0T9/JMYa9czxGdItWY3j34w0SfCMA23zSHs58BtzHwELPtT6iYuVnRJBdGidqiMgHWrf8Yh6+fSCzbFWCWsuuuKAz2MtFzM44OQga0tk14/bThABYk4TzCj8crJpqfsVVhbTd3DjT6YF6VbCQJ+jMVKZOJrE/yqUYQ2wTmqJiUM5g0ahU2nqHXjctL8MMZkw1PvGzXTSgDCj+kmIdH8kr77TandDOtdppk3YsgF6TQ0d/Jmgyth+9mo4x7J4GeSbcxBO+aAOGkrktrFhmoyRovoxFMEiFN/mgo42miiB745bNCAWx30nbyTCPRyZ4ZUDTkBngr3xgcXvVnvZ+0rY4op5Kjbi2dvtGlCWh6/C1rginKRgkleOveTbNq3SyfXBueOpevj/ltHfXSh0n8ie1vzVTupyshldUzx1eVR2+TSPV 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: b3nfpVl0OMkTslIA80A1d61DuTeknEQTnnypTlZswfUFoPhOGZ8v0NheP4c2dMebDDQzgEv00x2rTavrA+ZnAb83JHJrwWHfm8ViP1bVefBfz8s5KL4Qi6jp36isBZrOM51WNVz5E03AjDdlYN8+janh46lU0UJPwWey7tVxxMtbizcA7Ig/akx8+Dd/TYLw8gGeS/CMHnAFDR2zRbCDJTFsYugrhk4RUSUBux9yJboxHb0H636QrDPXESDl1MNs8GBEDl8YHDJaWBQwp3Kxnf3EsTWs9HWc9nL92guOd5vFNnYbs0w6IS2jsQEMIIFRNSUixR7y7N3ftulgljjHbLurMp7TwRp43rr297AH/nkmWdqfjcGIz9j3AezLX/A/EOLA5F2nSdqjQxoYiTFnT2h1vo9XexaOyJlRULi2yAfxL8Kjyji9WFvfwCpnMyzXbgqq+uKEiARh7TjakO96JDkYZ1BSR0TjAbiTFvzz8fM= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f408363-c6a3-47d4-0518-08d7f8aab5ed X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:33:57.8142 (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: Wus/aBxObzoCubdhe5csx7JmUqZySVwHAZPfnayKB0g7V7y2LMse4jDiT8P+OWUcPles4FP8taKWnHyyCsgyRQ== 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 hif_scan() return the timeout for the completion of the scan request. It is the only function from hif_tx.c that return another thing than just an error code. This behavior is not coherent with the rest of file. Worse, if value returned is positive, the caller can't make say if it is a timeout or the value returned by the hardware. Uniformize API with other HIF functions, only return the error code and pass timeout with parameters. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 6 ++++-- drivers/staging/wfx/hif_tx.h | 2 +- drivers/staging/wfx/scan.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 893b67f2f792..6db41587cc7a 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -240,7 +240,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, } int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, - int chan_start_idx, int chan_num) + int chan_start_idx, int chan_num, int *timeout) { int ret, i; struct hif_msg *hif; @@ -289,11 +289,13 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; tmo_chan_fg *= body->num_of_probe_requests; tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; + if (*timeout) + *timeout = usecs_to_jiffies(tmo); wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); - return ret ? ret : usecs_to_jiffies(tmo); + return ret; } int hif_stop_scan(struct wfx_vif *wvif) diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e9eca9330178..e1da28aef706 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -42,7 +42,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size); int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, - int chan_start, int chan_num); + int chan_start, int chan_num, int *timeout); int hif_stop_scan(struct wfx_vif *wvif); int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index eff1be9fb28f..bf7ddc75c7db 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -56,10 +56,10 @@ static int send_scan_req(struct wfx_vif *wvif, wfx_tx_lock_flush(wvif->wdev); wvif->scan_abort = false; reinit_completion(&wvif->scan_complete); - timeout = hif_scan(wvif, req, start_idx, i - start_idx); - if (timeout < 0) { + ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout); + if (ret) { wfx_tx_unlock(wvif->wdev); - return timeout; + return -EIO; } ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) From patchwork Fri May 15 08:33:14 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: 219191 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 29EA5C433E0 for ; Fri, 15 May 2020 08:35:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECC6A205CB for ; Fri, 15 May 2020 08:35:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="miUz132H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728512AbgEOIfg (ORCPT ); Fri, 15 May 2020 04:35:36 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:6138 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727933AbgEOIeV (ORCPT ); Fri, 15 May 2020 04:34:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhN9UbX9rOv+zpZhoik9l5cXmWcHORVkkCAqbh+frcsZrGNoZAdeawnqjBjWmSb4Jh2/PqlUkVGkzWlVL7/FZ4uRTkLNRrblW88IX74CepJrCj8Kz3sAijb5y0gRaDu/gZsSmqf0EeW7dkYl8+z/bI3cUSoaCBE1TpiORXdG3d4EyOKOr7k1Lu5Qm5VSW5LogNocggIIN33Wi3np/A/vTIhTN68Lf90kLgCipt52wC+jlng7+nnzRvy/BGfJvEUm5EZcJaDoKWMjZPXoVpsRTo+A7pt9YIEI+cdxlNiCWOdyoGJcdhbd4FqlsUnGtoDPWz/wN+ctnldtSUMhGu4lyA== 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=OaB0UFVIoYEzFguJtxWqBX+2H/2ue9JH00Y1UEApzv0=; b=gaOkm64v2ZSUFkuJI1bbvwqhGTT6cxBYDyhEZpLQcnvqXHqzWtU3Z4umo1VYY1zeJD1ilBT9VAuoHuLVrKNL3e/0XJo3dpjQ31mIqYSnqvSZK+O3VRXyKM/ViEnnbtq/mLv8h2U+plP9n4x273L0Y0uyTdODPsXP8WdKjUT3STFGfHOOJeTkF6LglleydxeeDvV72/rAWMzhyZFruIA+hcMMaCeAnOJdyj5U8d60V6KhzC+OjfxzbC314YKNZceSWLWeRnQiSKyc4t59y/WeFV04hxq/shq/jkhwA1qfpO7Nv8zsRiKfR4aKSETaXSQmKooIvJ+PbXmPTSt7hPmNiA== 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=OaB0UFVIoYEzFguJtxWqBX+2H/2ue9JH00Y1UEApzv0=; b=miUz132HXUBK9ZbvYlhWLjY9UT8zIoEFuaoy3z4enoYb5R/O5mMQDwxXE/9eVeBtMGAcXu3rDLwjNjkZQZRTAvQ9u8+IOlwxMyCotYX+x9TeIcsLQ+cvBaA2cvrsB3HcSCcPRe6pTISZF9lWR0VapzV5CagZiVSjHeS2I9k/T4k= 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:03 +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:03 +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 08/19] staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb() Date: Fri, 15 May 2020 10:33:14 +0200 Message-Id: <20200515083325.378539-9-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:02 +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: 5d2077c5-c18c-4ec6-f5b4-08d7f8aab968 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gk9sYNxX8oco7y/0gXwNJxz6cwn+XeOCh3K2okCzgzGwAYk2otweCz3EyXbhW1QmuyUbUEbGjLHj7Ky/jaf3kIFkalOCB3ScLSYx5HoEIzNhGDJWHV1xzzJwQhPtEMqm5wLGc7xYksFGUdZzb8AQN38h81vxUTfW9LL3PdUFUbgBMXcEaw+uhC2ZOjIWHB7rN+zCP7zDM7MCsl2kvhxUX4Siyo+cn9mDg7IDJHQUfhNcxB/uoNHrDqIx4H9ORTxC4fZVFPSatpMy/hRvCx3/fCiNAFdVNnsS7BtWsRrYfgg0jyMzyAZHFMEu1dRNdSkOAWb3z4rfv0JKF2ThR4/01eMuQvMH6JWMx3erCK+Lx50YNEv+PWoS8Gw7oDqTlyPanSZucMCNK9FPKsyn2FuRqj8AfUPG77ixw0Zrs+rfToIqrEnndANxlx83F3iS/e6q 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: z6YYEb69G7SfCJzoaQXj9pu+msjJoa5k8BGPV0qSqbgkUgIrCdyjZGPivY1QbC+8HzxZp18OtGdBCBln/mf2KrVuG7mG9SPIp7Kk1zq30We1b2TuAqPtGcYLB/TctiBGD5qZ6CsYWZEzVgLrMN95BNYO3V3FQEuMmNR+9GoAm5FrWGYwQtbtmBajwlluGx9d3sEdXG4H7TOU8KTKbvy+TShssCxJ5S6DA99IggjEBtqskpO4BGx0ZLSt32ym13Xv/E8LJGwC1pzX3zqCJG/w9w5Dytg0OevVWJFgXjYx2A0GZS5XqLKpy7WyRWmY0X/Qou6C1QZwHh7O4p2UOBZU5UGhD+/imAO1yOUErmvM9LOFKvlIQkfgtzf27dpQXru0BH33k76ArOnk7mLtxqcBTQ6srI+1k/v/6WI8QDkPwLn3wrK8SNczEnge/8+rbGlYETxVi1x8Qb0mZ3B9M9Sx+vZpoQSaM0k3JiknnNhf0NQ= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2077c5-c18c-4ec6-f5b4-08d7f8aab968 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:03.6366 (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: cer+YkG+bkNDh6QhpNkTMz98D5PZmvAALlcp2P3QNVeCuj2ZPCRLzYPunQQZEyju+5VZ5Wf3DoevY96c65tJzg== 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 wfx_tx_confirm_cb() is a big function. A big part of its body aims to fill the rates list. So, create a new function wfx_tx_fill_rates() and make wfx_tx_confirm_cb() smaller. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 63 ++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 5d029b0718e9..2ba3b5c3d1a7 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -496,30 +496,14 @@ static void wfx_skb_dtor(struct wfx_dev *wdev, ieee80211_tx_status_irqsafe(wdev->hw, skb); } -void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) +static void wfx_tx_fill_rates(struct wfx_dev *wdev, + struct ieee80211_tx_info *tx_info, + const struct hif_cnf_tx *arg) { - int i; - int tx_count; - struct sk_buff *skb; struct ieee80211_tx_rate *rate; - struct ieee80211_tx_info *tx_info; - const struct wfx_tx_priv *tx_priv; - bool has_sta; + int tx_count; + int i; - skb = wfx_pending_get(wvif->wdev, arg->packet_id); - if (!skb) { - dev_warn(wvif->wdev->dev, - "received unknown packet_id (%#.8x) from chip\n", - arg->packet_id); - return; - } - 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. tx_count = arg->ack_failures; if (!arg->status || arg->ack_failures) tx_count += 1; // Also report success @@ -530,15 +514,12 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) if (tx_count < rate->count && arg->status == HIF_STATUS_TX_FAIL_RETRIES && arg->ack_failures) - dev_dbg(wvif->wdev->dev, - "all retries were not consumed: %d != %d\n", + dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n", rate->count, tx_count); if (tx_count <= rate->count && tx_count && - arg->txed_rate != wfx_get_hw_rate(wvif->wdev, rate)) - dev_dbg(wvif->wdev->dev, - "inconsistent tx_info rates: %d != %d\n", - arg->txed_rate, - wfx_get_hw_rate(wvif->wdev, rate)); + arg->txed_rate != wfx_get_hw_rate(wdev, rate)) + dev_dbg(wdev->dev, "inconsistent tx_info rates: %d != %d\n", + arg->txed_rate, wfx_get_hw_rate(wdev, rate)); if (tx_count > rate->count) { tx_count -= rate->count; } else if (!tx_count) { @@ -550,8 +531,30 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) } } if (tx_count) - dev_dbg(wvif->wdev->dev, "%d more retries than expected\n", - tx_count); + dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count); +} + +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) { + dev_warn(wvif->wdev->dev, "received unknown packet_id (%#.8x) from chip\n", + arg->packet_id); + return; + } + 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); 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 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: 219196 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 5E524C433E0 for ; Fri, 15 May 2020 08:34:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F2F420657 for ; Fri, 15 May 2020 08:34:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="nGhD6maT" 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); } } From patchwork Fri May 15 08:33:18 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: 219190 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 DB3CBC433E0 for ; Fri, 15 May 2020 08:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B613E205CB for ; Fri, 15 May 2020 08:35:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Rkl7lXQg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728198AbgEOIeT (ORCPT ); Fri, 15 May 2020 04:34:19 -0400 Received: from mail-bn8nam11on2054.outbound.protection.outlook.com ([40.107.236.54]:18393 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728128AbgEOIeO (ORCPT ); Fri, 15 May 2020 04:34:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hcw2KaPzYOoryk/Kfs5LezrsFfsTsO6mLtLntzSUs6yJnEn3kwY+0pzzeDTIKUfJEr0/GexxT8KyNGj+hkvvN5cdywaHxPIHR0E5RZJCfzupja0eT1PCPY+OHz1csjRrJdUH7lmFsjwn+MaPBsTb+fdJUrPrKYVKtW7Z9enAtLHuE6vJthOOVsWVxu7f+GT+pBAJl2fvrtM/IshnpPRQYg9d2PIRun5cCi5IzKHH/MmOMxdYxvx0cplvvrfQAJrD5yCAHErR1sgJ/d/FLggjgAVqiegJY+aTzIsQODc55Ha5brxD/cX6fwgMhyKhm0jRSuCke1fVD/J+hk996QQ4Mg== 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=LD2oN55t8Dw8tcBb5rw07q4iSwGuyj0sgAKW/og9I5o=; b=ntp3sDqTaMQKYVec60Rm28UfbkSeWIZ1hQxtNxpJyeaFb3riy94Ipn7joPGe+7soxgYwg9DlLtjWEOHtIIuPNzCHjd5ai0vGlIehNZZNT8JNCPCcIRY1ctw/sKKnI3N6TquXQgH/17wOYFmG/ECgcd+gxdKlybVrL/7pohEtjC2Gda/2ozW2JvEWRQolh9+2pZcmEGwxp0lB19wHJ22Fdp4pvjjz6QgWK4NfjWZJTelqzCd238vc0wlFYiqw2vO2T6k/fkgqXGTL+cUUZn1eEX63Kz7g85juLPkagMrb8QpYT3rRn9b37dDCuq1/cjczhk6LP5auVDMdw4AITa6nDw== 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=LD2oN55t8Dw8tcBb5rw07q4iSwGuyj0sgAKW/og9I5o=; b=Rkl7lXQg57nd1NLFleLwBi7YF7SH2dxsRUoy42pX/JytL6Ln0+WBKHlpHGBBuPYDPnSxzlhUtjl/Eg+fquNeOHxqO8Nr0G5jnXpvNEus+epkE3Cn/lrJbo8xsahBHhFilppYhuuo4W1AxBip0z4Fuyt9xjBoHJUkLrdKIaPdmmM= 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 MWHPR11MB2030.namprd11.prod.outlook.com (2603:10b6:300:28::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 08:34:11 +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:11 +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 12/19] staging: wfx: merge wfx_stop_ap() with wfx_reset() Date: Fri, 15 May 2020 10:33:18 +0200 Message-Id: <20200515083325.378539-13-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:09 +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: 75d432f8-6dc5-41af-66ac-08d7f8aabe04 X-MS-TrafficTypeDiagnostic: MWHPR11MB2030: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:741; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h6dct3yAmSgqA5MSPoUEgTcNtUE9ppfVWCS9H/b2S2U/henzi3g1XDARZQI6cm8Mn41DSr3FTh6YCdZzZuQ1es8doMwh83WjNfZ7e5z6CXKb8X7KrhnQhrb325t8nz7DUorz3egEvQ4FUbyRgNmDfIxYAhxHCLotI9NFqKT1D6BEnHUFPrkCzt/KEky/XRKuNyysUoEjxg9DPgiRagS0sd/Yn1NLMY/pM/C26dENmmDV0QKoa0xPb5nILJBLIdADgbajGw5RTPOmaD4W1WepZrQqfhC7o4KXOl/mh9LbUyRcTD6ERxHdNYf1HfSRZeMVeYao+yKgJl0TAFO48AvK0t+FiBtLIC80pBQm/5KxUJT6zbMW9GJX8pBB+gr0Y+1JuCdp2MBiJ/SDDkbZrcwSE7sknx6lefxdmAE2vSYZoCmlvIdSw006aBdXnQnLBSrl 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)(346002)(366004)(376002)(39850400004)(396003)(6486002)(8936002)(2906002)(6506007)(4744005)(316002)(52116002)(8676002)(956004)(2616005)(16526019)(54906003)(86362001)(26005)(186003)(4326008)(478600001)(1076003)(66946007)(36756003)(5660300002)(66556008)(6512007)(107886003)(66476007)(6666004)(8886007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Wy5A5xhnoqq0k7XPVhSvZpOqZMvUS8IAIyiPaTZ+d5lZpK4S/rvWv0Oh1rfsOsQr1cPfA1Xm8TwtDTpSVOaviS7cLKHv66av4JEXPMWZskIQHnQiB8kG1cufD3mxpPrU3KEgS4ufFyjNV5SX3fosmqWQTZlpQv11Ww8fV2INeAoj/e0CZG3uye3PuG72OyvsV4EaSKx0mGaLSl+bgvCIbh37kch+uq3Xo3cCXaY/yg4JnYCEcyMm88birXx44q20aIbLWOrEq+zpvswogKY2lU4Uk7kyUAv6LyyZpKCfPSMZfIVUGrW3Tk2iEc0YbKmfY+fWlo2VcYmvziLQH+7Uc/u+rfYXMs+n5X6dpi2OHtDDIpPm2A75Div6Z7CIWcpap8n7fjPMGNyK1uCbL7ouex/OKjM1Q0j0FxCUCde5N8qdcsVbdu8RukgRsLu9RiEfhLNSMYkgTPxDqeTRK8yCQ7g28kblsaCqBCov3s2c8Ag= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75d432f8-6dc5-41af-66ac-08d7f8aabe04 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:11.5081 (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: 25Vevilr/bA3LTZ5qh7bFqo6OTLO9Nn0Xxs2E9MQQIqUR7/z95KPLBzOU9UlqAN4V4PR8lJpiNaFlExzw0F7TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB2030 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller wfx_stop_ap() and wfx_reset() do the same thing. Merge them. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index e077f42b62dc..7d9f680ca53a 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -479,11 +479,7 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - hif_reset(wvif, false); - wfx_tx_policy_init(wvif); - if (wvif_count(wvif->wdev) <= 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wvif->bss_not_support_ps_poll = false; + wfx_reset(wvif); } static void wfx_join_finalize(struct wfx_vif *wvif, From patchwork Fri May 15 08:33:19 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: 219192 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 3966AC433DF for ; Fri, 15 May 2020 08:35:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10811205CB for ; Fri, 15 May 2020 08:35:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Owso4xi7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728474AbgEOIfT (ORCPT ); Fri, 15 May 2020 04:35:19 -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 S1728272AbgEOIeZ (ORCPT ); Fri, 15 May 2020 04:34:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxzeQpgfV/FLNtZ+A1nAcxYQFDLud27TTmhjIDpkgu+H0jUglnzq6bob3slIGmeaqH5uTysB2ngZhZTj+6deIf8H+7ES1sr5kM4ltN/6liq0sxVEurnNuz2RMqxhcQO7uWJnPiEpTatnmWe39GJC0paLVrLIQUF0XBwqWPYUqSsMckq7HrE0zyiEpEXrUMYEo8bwI0ajzPE5SIiJhkoSq1KMXYhm43MJBF4cJ9Pa4FPWoVeOzHhVtFzLM5EomQTdGcWrkTyNX9NOoOOhpQ/LA8ATVJvJgjHRpALbn0INjx8zx0mxXKA6sVFwk7Il2/FxNRR6UslpZBJVTHBCgr0dwg== 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=nIdi0OfIf4U/a1I4T0zQSQJkaEp77HTnXw31zXyAl6Y=; b=TQ8SZFTPyfOdsCl5OM6dnXSgI6MHvz88HD7pbuiyzq+bG3kGvMow6RxTcBvhECxuEjiHXZ5EVICSYYg09nk8YaU27A6f6ARBXSUoVF/b/9NTYOxhd+GsbIou2m2zEOTneWGqxtSTCKtSkx4aEClojQaUclddfEPTsoKYKZ5SYZ3ip9HFIG7rP9Anoisgy49IlcHJ5niYBfth7iah0pI6IaG1L5FSK9mJcuVQnxuYfYs1b++xldyHJj3NZfjijYUEH8h5p/09L7pII191Y92JfAvBlozUYMAuwPg98tf9iJfnb1R2Et7/Pp7XJmOCIjtO/Re+g3RUHnmrVXxgykGUzQ== 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=nIdi0OfIf4U/a1I4T0zQSQJkaEp77HTnXw31zXyAl6Y=; b=Owso4xi7af8KgRQK3yTraa4M+f7RT7vVdmDizkRsL1C+/OmA1TzTHDsxRDABHrPm33t9MZm7LqNFiwLdBN6rAYTxFITiCvSNCpZBMBsEq06rZYFwP0G6VxNdoXTUL2dsPx1lplCkEO9vFrf5O8ZqCBEGrYfLlE2NLjRBsJl6JlM= 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:13 +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:13 +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 13/19] staging: wfx: fix potential dead lock between join and scan Date: Fri, 15 May 2020 10:33:19 +0200 Message-Id: <20200515083325.378539-14-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:11 +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: b11781d8-7919-44bc-8b4b-08d7f8aabf32 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jvYECiRVwMPGmjp/uCCqfoyHw9gxC/TrBgMFfgnjC1ktH9Se16XhGx5ZXSrgPzg5ySeWEaNQOPSrcaAeKwoOe40UVzhb3U1NJFJjy9Md+F3k3RtWqbAaO7dKJPO5VS8Tba6EJ/C0keI+z2p3AY0n+St2d0ush0NX4sQhy5YuywpKHBngVnF75+t6d4j02bV6FeSha106ZmuyqJnmF27LYhjhxxilgWrAf8Ks27JC+bA5EluGQkcTztCeJqezTNfl2paFXdtNAlfwQowt4SuQw39tE2utqYn3qrNgm7b4uXFZdgc/GM4VBHWaNP7X4JsTHfWjQmyIr/TLbAM3c2x0pztU48n50XAvXoYkdkUvy+G4qHQn5AR7paPgjk9z47cAprSl0vswW20HIwrDenSRmsOaBB3xKyWHe3Dz5dc3qIDhGss14d4bcE7eP+mihy9p 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)(54906003)(2906002)(2616005)(478600001)(66574014)(107886003)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Azbewu1Tyn/YS8cETNK9/rwn2mgG9UDW/leibxhhQsd0JKLr5U/D/7qQS+mKxbDU/JCst0+HHkcW+sMJQtPj4wz0/FYsc+cFc+v5gVhWRc9+LhdKKnrMKfKeUFv3EJOX5R1t+86CuPtkfGEd+UF7soNHe1g3LPX/7c5O7R93ZF2I92RrZS99p+R6kpBxt+sl0qJnChsMJ5SbtxWhuZcBEQ5KWpa0wCUjQQ9T+1mIE6A7fBfj3WwWPNwUFGOixKgR5AN2Mvdnogu0tWcKqk8IhaYWplXFC8spRd0s57u5BQV5tgM0+uXIg/Kcus8WmnZDsqtUBIaIqF5sruHaiLxEZJYPrkFLjdkzezBin143f5JGj66fhu6woALyOsVA4ZBp7fmjC2g846Fd2ydGF2NVHM/3oIEtL2Pj6jHbVqPLAG1K91jGMu8mJDY+7Fi3UiqgAKdOm4Suk9ooat2otucRbHQqQSIdvBwpTeFXnu+n1go= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: b11781d8-7919-44bc-8b4b-08d7f8aabf32 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:13.3273 (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: wrRaQEDS8bQUhJGgrxFz0OpJcxXQYC9vc+qYhQR7Wri/+wUO37PQKapRgDa30K8YyYddBHLOQbFgeL0FaoPPnw== 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 device disallows to start a scan request between hif_join() and hif_set_bss_params(). The driver is not protected against that. The worst case happens when association is aborted and hif_set_bss_params() never happens. mac80211 would never ask for scan during the association process. So, this patch just aborts the association in progress when scan is requested. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/scan.c | 5 +++++ drivers/staging/wfx/sta.c | 3 +++ drivers/staging/wfx/wfx.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index bf7ddc75c7db..e9de19784865 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -90,6 +90,11 @@ void wfx_hw_scan_work(struct work_struct *work) mutex_lock(&wvif->wdev->conf_mutex); mutex_lock(&wvif->scan_lock); + if (wvif->join_in_progress) { + dev_info(wvif->wdev->dev, "%s: abort in-progress REQ_JOIN", + __func__); + wfx_reset(wvif); + } update_probe_tmpl(wvif, &hw_req->req); chan_cur = 0; do { diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 7d9f680ca53a..6e9f38d051ab 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -353,6 +353,7 @@ void wfx_reset(struct wfx_vif *wvif) if (wvif_count(wvif->wdev) <= 1) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); wfx_tx_unlock(wvif->wdev); + wvif->join_in_progress = false; wvif->bss_not_support_ps_poll = false; cancel_delayed_work_sync(&wvif->beacon_loss_work); } @@ -390,6 +391,7 @@ static void wfx_do_join(struct wfx_vif *wvif) wfx_set_mfp(wvif, bss); cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); + wvif->join_in_progress = true; ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); if (ret) { ieee80211_connection_loss(wvif->vif); @@ -485,6 +487,7 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { + wvif->join_in_progress = false; hif_set_association_mode(wvif, info); hif_keep_alive_period(wvif, 0); // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 09a24561f092..cc9f7d16ee8b 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -69,6 +69,8 @@ struct wfx_vif { u32 link_id_map; bool after_dtim_tx_allowed; + bool join_in_progress; + struct delayed_work beacon_loss_work; struct tx_policy_cache tx_policy_cache; From patchwork Fri May 15 08:33:20 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: 219193 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 25BBEC433E3 for ; Fri, 15 May 2020 08:35:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED3E420657 for ; Fri, 15 May 2020 08:35:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="FNKPYNu1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728359AbgEOIei (ORCPT ); Fri, 15 May 2020 04:34:38 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:6138 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728303AbgEOIed (ORCPT ); Fri, 15 May 2020 04:34:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GTSx5UFlK9EToNKOfD9CJiEi3v4bUe7IbYqig09FcpoaKf3FHaYw1KqdZEqXmIys14WVf7Xw/zupMVzrR6NUR6V4cIzhWW7FiZYV+dYkzKOCOoPtdAZSzqaazIgU/3+Uk3TsDDtJwxAyPSOcX4OGSalNGBOragkyZG1FVulM1JKyaxZDI0cmg2zg6cS723jCcDR7TrRkBBXAsUx5Y+FLj2huw+XMpENGlvUPSHKYdBFc7EOzf1bPKWvAJxJ6eNrEGsheFp1Dehxu/AOM44iysAIJtivs9jHGalawKkp7LiQq5Lt9TRh45UKaEwMj715dQZMHMRTiDX08GPMOFcob+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=/iAr3L+Z/U5t5GrzA6d9+xJ7lD8R0AItbO5PmLu8DFE=; b=JCl2U09O841AbPYfZZIuZWmYq1DcUA+vHh/JMiIPRMRbxwAG5OIkAOe4Qm1mWLEkJZLrcyNiBFDx9n9x0wJmwb+60OiF0lW/e6D+PBrX1u9wURp5C88/xwlsiR1+lkQjqiB9VP4ekAbnfN+J54Guz2eu1rs1dwtbcg0N9wdalYcyounRbIx6gXMDGdP22jkBTaBfkArtVQYEndxhmJsyCxx0fXQ1nBLndyrNey4YlT/x7j+2iVngedfJTKczPDH7h0vuNC+mtn6g4c/rzM1NMWY8lxBFQ0w5HleUtXNodIAV48ld+3iEDaJpiiYwE9SoQE1N8srKHLm/6zRtxdtOZA== 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=/iAr3L+Z/U5t5GrzA6d9+xJ7lD8R0AItbO5PmLu8DFE=; b=FNKPYNu1Z1Xmj3brbHsmZxlI/iBRuIHL342Agrgg1VXvCMBnYXvTWUHfc/oBHQY13IWhs93xCqekjJcMuOWRSU/eRrKBu8fbrB6zym7Fe4/JTj22UEhEiRgHkAGh50cy5lu3qVS8uirFQdsTAYCtE1HVKvocyhCaSu+oKR/DMqY= 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:15 +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:15 +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 14/19] staging: wfx: fix PS parameters when multiple vif are in use Date: Fri, 15 May 2020 10:33:20 +0200 Message-Id: <20200515083325.378539-15-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:13 +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: e8d50d96-1e6d-44cf-62dc-08d7f8aac045 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bzGvCb1WQ/RubSBUK5pd+SmW2W2vDmXBstshyO5aVG6s3vCLHrw+BjSDRVMWTRmD86HVcD6JpzXh7GlUdsi78+j9QRghcPu6iuTfat1uVgZgsSrNqlxf8ZZk2rfJZPGCgjJmZ9574UYnMmgSPS95PvwIN+gIDbP8ah0vhSVoOVZ/8KZ9zwp8Ls6hhvdOgasBHjNCDnahWyujWFr0/PGIuswc6NgtWLrzjHKmiEnRuAfz0uJWX95yjd/h0fsWGWFjCNuqK/PamGe02zyQSatvftsVXKxmjRw09i6RbhqyjlspVI6IADIfQKMVO/J+sGpO3R8+UZzhSX/J18diHBXgR+T6f7yXk565NHLylEku9OX1S7dRFURd63eBmGwtIODpOfy8m3pvqXGn7m5FnS41DGo/ya+3R39xevv28eKxS2vu0Hw1AKVcYth++AFJawHW 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: /t9FMCg6CBlr7DuEMuwdg+cebTy0uAgKfF75CBYXIA0E0exf3Ts0Z6x9Dj+rhN5+5a70r4utN86bN6nJ9u6NRBUrKMCbt1y0Ubwynl4ehEl8hmJIvMj5eeovI7wjQu77L7jkDgWtrmLWZ2GbJp5/dkPpTgshTcxK6zsvwSMYbZdX58d6jc3tNO4xvEFlv8hBFK+wFIARzNEkOiU5p5EcJ7/d+oBJMzed+giOOz68/RQR9BPpvlA1dHp24AMvhGY0BHPU0dRwBbuWDwhrVZplLpRodc6gOOz+RMjA86dkI7jIZjPbBIrp+WG+/VJcDOgIYxb4TQg6cx/7ALwtcRYyyJAM8qIIo1zkKwo6kcBSkLdadw/crfhZh/FLH5v4zGy0EQwfVSIRX5dFzA0y1HeD1tf45eQbuq82AbcUH/qomKoqh7kKm/sGLjcSspPEp1+ER4++wWVFNf/TWkjPV1qp178+O99nFNYmZVKiqBhi60A= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8d50d96-1e6d-44cf-62dc-08d7f8aac045 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:15.1055 (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: zTZBDplFjlO2dV+FPKiSfWAhrfuzYwLo/b+22W4kBvYxz8z02zFVBDVFe4IUX7H0n99V6yHVw50mMoeDF4itkQ== 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 When multiple vif are in use (= one access point and one station), and when the channels are different, it is necessary to enable power save on station. The firmware check that steps are done in the correct order: - AP can't start if PS is not enable on the station - PS can't set on the station before the association has finished (= before the call set_bss_params) Obviously, in add, when one of the interface disappears, it is necessary to restore the power save status. wfx_update_pm() is able to set the correct PS configuration. But it has to be called at the right time: 1. before hif_start(), but after the channel configuration is known 2. after hif_set_bss_params() 3. after hif_reset() Therefore, the call to wfx_update_pm() from wfx_add_interface() is too early to address 1. The call after hif_set_bss_params() already exists. For the symmetry, the call from wfx_remove_interface() (that handle 3.) is also relocated. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 6e9f38d051ab..0cb7315bb050 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -347,15 +347,20 @@ static void wfx_set_mfp(struct wfx_vif *wvif, void wfx_reset(struct wfx_vif *wvif) { - wfx_tx_lock_flush(wvif->wdev); + struct wfx_dev *wdev = wvif->wdev; + + wfx_tx_lock_flush(wdev); hif_reset(wvif, false); wfx_tx_policy_init(wvif); - if (wvif_count(wvif->wdev) <= 1) + if (wvif_count(wdev) <= 1) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wfx_tx_unlock(wvif->wdev); + wfx_tx_unlock(wdev); wvif->join_in_progress = false; wvif->bss_not_support_ps_poll = false; cancel_delayed_work_sync(&wvif->beacon_loss_work); + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); } static void wfx_do_join(struct wfx_vif *wvif) @@ -471,7 +476,12 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct wfx_dev *wdev = wvif->wdev; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + wvif = (struct wfx_vif *)vif->drv_priv; wfx_upload_ap_templates(wvif); hif_start(wvif, &vif->bss_conf, wvif->channel); return 0; @@ -786,8 +796,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else hif_set_block_ack_policy(wvif, 0x00, 0x00); - // Combo force powersave mode. We can re-enable it now - ret = wfx_update_pm(wvif); } return ret; } @@ -818,8 +826,6 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else hif_set_block_ack_policy(wvif, 0x00, 0x00); - // Combo force powersave mode. We can re-enable it now - wfx_update_pm(wvif); } } From patchwork Fri May 15 08:33:23 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: 219195 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 0F448C433DF for ; Fri, 15 May 2020 08:34:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2AB5206F4 for ; Fri, 15 May 2020 08:34:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="fK2cOhFH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbgEOIek (ORCPT ); Fri, 15 May 2020 04:34:40 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:6138 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728329AbgEOIeh (ORCPT ); Fri, 15 May 2020 04:34:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hWtqyw7OvG5ftZl1C0XP4XTKLOHDiLvz0CuBcAfu3DzRKN4LImU6AS5eE+naT+1NNwW11RFehVCE9v7bJcxVOxp9q9AGfjic1xUaT5cE3M4CuLIlfhCcMda9DdFqv9lgK/Ob75audjfv9UJOW2luuvIrX1ilK3JtcuMPkQ+snxU2VD+4pZqZ+5TeppOC1KQoYCSckoVemw/lzdKh9yn1wyKzvwUe8Nq6hH+t/LoyXz8n4JUAKwlUPYBjryk1woWz/jpqFV0ILg55QOBAzxRrScmPi+p3gjllhOMDfvUPIxTXt6LfqN2tfdrfp8IwPZd8TvHgJA3swJR9LdPKatvqWA== 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=gA6OR2oUdWaDAB+nq0jkFBd0As9cc8QT1KEc72rsWyI=; b=MXDflFDbTZYSKFTtxQ455I/NoPena4MJvhW9fWddVaqsI1BtFztnpEBYa5+22AnWAfzt6ZxeEvzrdafiAlEcuBTec9vSUhI9fs3YlWoVd5eAtsASjGIDkTRhxbqNEDpbUQZPq4sBc++7CTdrg2QV51Pp2QbV/GoINB/DomOtSU5SllhpHv2xJNp2bk0O60efOsZ0p/P1fvbvlJRmtfUdhVx51t+C7/OQNs8R4w7QMkzplyylmcvrdUG7emZ1Jktyg9vBMQBhDUhtFY9MHw3TQ3vVKzeG+zA+zJ6Fq1I+leFC6+oPPLgUCDNIZvnjKszyMB43Tr2p4Qh22Yebae4tUg== 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=gA6OR2oUdWaDAB+nq0jkFBd0As9cc8QT1KEc72rsWyI=; b=fK2cOhFHvMI/w+md359s94GT4tK6+C/GDcFNUzWDXjLSVrbpAEffxY3pmnLlmvMcaZ2AKpE24fc5z7cwO21CyKZvPvZtxY2HFE0YNqc6+CpuOgTH6+rlArBtpaKbDWemIvLuoJ6bI1pCxIlY6mmQ3dzNHFyIAU6Uu4unqP40t0U= 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:20 +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:20 +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 17/19] staging: wfx: remove false-positive WARN() Date: Fri, 15 May 2020 10:33:23 +0200 Message-Id: <20200515083325.378539-18-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:19 +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: fca40e28-9172-474d-31d1-08d7f8aac3a4 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kxc2GBEh10E5AJW0iZM2sKa/aAboNACW5nEFI7ZU541QOQas0dJxZr2MVqnwmoMl+33iwg2InHhTUNCEzIiQ3mjrzZxozg0A1WiaOEfjLvZzfevxSYE++jbes1SLh7eEXxUzly4buSnOvKyY/Cr74j6t31PG1uaxNhEGwsonIAG2NGAGNEIIk65HFyMFGBO5GjYBuDWYUHbuoGGddasi9VQau4EX+GQl2Ppp/s73/S0XmBgl0cUwstKE2jBpkIEaFX3AihlxiXV1MqccRNBXEAheQX+ka9VGKW8mAtovGK3pQrA1d0vfqtCiRZThk7C+mWw558C1ZZYoFhON8L/urW2grE0+hP2OSRvyHPVY9nXKcuGbNiYig/OlYBuBhza7GXQWXWMUqP3o6BfGvqhJR4igY6UW/dW9I1PQILE78Yie1bZ13gmM9w/jHnNPvSDS 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: bWwi66Q7D7gg5SHogjpjj51ZFAbIHFjzY7yjT4Bd7ydF66bOBFnQTqeD5NXDPw9foPRVpPvuXqe4HwBndo5mBdKKycgD+2ne9czKwNkhOMicx3Ij8EZE5J5Fyk1tgh0C26y+g9k19mSrCmBKi4ih/io2amd2Ol3SUqTBFr5KsIvy8l8KjsBLHSIidZIFnzhe0Z4RrOF69xoYsha0bazGQSrO2oGy9PEQAFt+gnyhh4Vqs+0JLQqhZmLr3vsuUe5BM8StCpYukZMjP+kPUlqSPuZLb4v6kzNdky3yZtpJSiyLe1axOW9XGxioaLdKbJGxZKHBPmIs19cTRS+7VoxTgm0be2bBCx76PBZFJxjtwMMpTPzXlmamBI+Qdlgekq+PcJ8bW1HPbuqSIBgCYFXDkIZcn3k723J+DH6T5YX01XLiRF0jGQobdI/4j00MzrjIXfQm5RZ7gQZJwMqpPCATQXhy0LovPTHYPUysLR/5SxI= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: fca40e28-9172-474d-31d1-08d7f8aac3a4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:20.7670 (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: gBFOxPy+qeww3kRKJnJBRhsyotDZp5GaMNTJ6aNuwNUO3W0tkPSmKC3nTUoPkgICeXWTfy+HF1GJtvZklA3Gww== 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_tx_flush() wait for there is no more queued frames in hardware queue. Then, for the sanity, it checks that there is no more pending frame on any AC queue. However, there is a race here. It may happens that hardware queues are empty, but the counters of the AC queues are not yet updated. So, it may produce false-positive warning. The easiest way to solve the problem is just to remove the sanity check. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 0c799cedd101..26b141cbd303 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -30,7 +30,6 @@ void wfx_tx_unlock(struct wfx_dev *wdev) void wfx_tx_flush(struct wfx_dev *wdev) { int ret; - int i; // Do not wait for any reply if chip is frozen if (wdev->chip_frozen) @@ -41,12 +40,6 @@ void wfx_tx_flush(struct wfx_dev *wdev) ret = wait_event_timeout(wdev->hif.tx_buffers_empty, !wdev->hif.tx_buffers_used, msecs_to_jiffies(3000)); - if (ret) { - for (i = 0; i < IEEE80211_NUM_ACS; i++) - WARN(atomic_read(&wdev->tx_queue[i].pending_frames), - "there are still %d pending frames on queue %d", - atomic_read(&wdev->tx_queue[i].pending_frames), i); - } if (!ret) { dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", wdev->hif.tx_buffers_used); From patchwork Fri May 15 08:33: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: 219194 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 74927C433E0 for ; Fri, 15 May 2020 08:34:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4941B206F4 for ; Fri, 15 May 2020 08:34:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="gBCBY2Ph" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbgEOIez (ORCPT ); Fri, 15 May 2020 04:34:55 -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 S1728344AbgEOIei (ORCPT ); Fri, 15 May 2020 04:34:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=krHkc+fWyHE6nOwxoR+k7/MmYtQoP2+bE/d0GFaK+HjRXISzhHDp1hQFjmvABCtcSINgjyqXxoY06KN/qXg1zEF9PiB5OH/mgPXo7YWezA74JtJH1asNR0lH1KrHioTuesq8mDYqVZrrfPLwS4MKPxli0wKndvB9zPED1/IjrSbeVZkitqJKolpqF/GLzp3JBCNQ4xA4PQMZpP63ky3irpPOVvkjZcZAhnQgWikBValSpuq93SfB5sFjPzKm8Oz/zbZqVLzSRgZ3R7pQp9Pg0+rfHLALMzTW+N+WEavHUJe5JCtywpjitSBj09zQzyqgOenWYjCDELuFcIglJI4K+A== 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=lSbIlKTe3enIqg9YTCmAByx5NCD0EeouBjtUegseYYU=; b=EH7fqbfCraRuto5q7MFisH7iztjz8qEpJc/FUrQhe4Z9bncPBjJbuy4D6AIi8GRfy5ADbYrZ3yF5Zv2RsztLZZT0VYCeBAJjC0BhMvIvoyfAwNMA6O3QDrpftGwj++17SrrQCtbtHePH0+O6vjuutXxNZcLr8BWz+6dGKJ6Po3ZUJJEU6EhtZMvpOq7jxvLOM9jTmfXKLkU5uCEqNk8cmmc1ocUfSz/emYRAWuQqdVJ9YjBp+vCOxWs+xxdZO9T3gRSrHE0DGpSxetaGUEsQLBFlLsjcD0hCOyaDEOoAmqL5o8LbcuW1Xv9O9lcW6d9vHvaL40RZqUDUvEsw+XAekQ== 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=lSbIlKTe3enIqg9YTCmAByx5NCD0EeouBjtUegseYYU=; b=gBCBY2Ph8Fa2tj0PWz0Ytuz88QUyxq6oahaTIlyjq99S2+Y1u4HcWEBv0AQKRGe09kN02BIFkAMwKITIHdqnDemvJt1PybMirjWbbvLtxSYOfXOw1KiNY+IuoTfq673i8vqScWzCvvKq9sMU+DarBzNWtj+CH6dIyBF61tPCXPU= 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:22 +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:22 +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 18/19] staging: wfx: trace acknowledges not linked to any stations Date: Fri, 15 May 2020 10:33:24 +0200 Message-Id: <20200515083325.378539-19-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:21 +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: 43c43a91-d1fb-49d1-5773-08d7f8aac4b7 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eYb2UtXedCp75ekRa6RPesk76BXq/5yaxjDmXuTXbTEZugF2FYqWwM3L/E60VX891Mxu07xcjrtWvrQv0XumCYzzAiqyq6FKhdLfig4k5U2u+daYRWHjed5RKrlehhnGc8+JIjA9V1+01XY/oiFM/fEbuL3ZOnQPuVT1/CjRAlQUBUAlrWJP3d8+i4BlxZ41zLf0hi5cBMl6tWlYGzjxCA4OHLFUIMP0creovKlatZyIruIOQwF2wwe5ACRSVVYxSnKG1H9+gCE0lMIII28jyseeB5LpLYw12janyAYt9Sdk+RlfuN64+Z3C7h2a18sHge6ewxkpaGQ1OZghFeIjD9zX0/0wjKJh6ZslO8LsGU7ePSrtMizx95yURx4Ac7r1KibJknMop3IEefmNJFDXSg3l7xMC1IDxW/DYrIjmU2qZHM8Lj7u/gVzwXtj1R0ym 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)(4744005)(66946007)(6506007)(36756003)(316002)(66476007)(26005)(52116002)(16526019)(54906003)(2906002)(2616005)(478600001)(66574014)(107886003)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: n5TnXYb/si5hi1eG4/zNN8NPvKeew/p+dQnqWqH874TiIlNS0PT+4nFMQarO6y5H1BhB40buBa74hU5ov0ggXFXb23pIl7tikju0AsMWklbdHqVj8c701UUp/Re10QUWIVODgemomE2/A5/LVZnrtbiWMoJkmMC2VXgNlLhFTwevqHTFWC+HcZqlW0e1CwcvnVSgZ1mMA5fGOicdNm8gRdN+sRA1q7RTZNfAqxwhUbBqrqdcLhuwI4Zafs2/nQfrPRLBYZBAowMlzaLsyr8tXsrXyAhYmz+1DE4OS/2H04IKXrU/laMLZiuCX2pNY1+0bYciUONolvj2ngI3anw59vH6UBqRALbJY8yDD/Lehg3kliYLj7tT8p7plY7bXV/y924H20sAJwFZHZyrGCQ5HvMlkSUmojkGce8a38YuLcyWKwmkIDGeM3FA0eYqVe11/Rl7ik3xuAx5H5xXdLZKGa3GGBSHJTh7WEN5AqPPiow= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43c43a91-d1fb-49d1-5773-08d7f8aac4b7 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:22.7461 (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: KnoYlfXH466jUDuA8tuom+8LYDB6DD3Bd+TA8grh6/TllKm4wbVlAcXufCsFjGEdMgEiIhOR0vSLB1UTO39o1w== 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 Some resources are associated to the outgoing of the stations. To avoid any resource leaks. It is important to understand why an acknowledge is not associated to any station. Add a trace for that purpose. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index d01e679b0880..a82f00f8f17b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -481,6 +481,9 @@ static void wfx_tx_update_sta(struct wfx_vif *wvif, struct ieee80211_hdr *hdr) if (!sta_priv->buffered[tid]) ieee80211_sta_set_buffered(sta, tid, false); spin_unlock_bh(&sta_priv->lock); + } else { + dev_dbg(wvif->wdev->dev, "%s: sta does not exist anymore\n", + __func__); } rcu_read_unlock(); }