From patchwork Wed Sep 27 16:32:56 2023 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: 146387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3711700vqu; Thu, 28 Sep 2023 18:22:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEt/HRUMNtq5cb+Od90yngpI97UShCpco96KH1lGxOVIJIMNEVj/4NHZvtyjHEz3D0qr3Uv X-Received: by 2002:a05:6808:1c3:b0:3ae:1675:700e with SMTP id x3-20020a05680801c300b003ae1675700emr2571659oic.36.1695950569991; Thu, 28 Sep 2023 18:22:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695950569; cv=pass; d=google.com; s=arc-20160816; b=lCOqXdFvRDLYx3nxueSs4j/v3zX/zN2uZ3BQKMg5kpPpURl00h/IbLoqw7v0ZSQzSX 8fZpiVxOY1m3kn9aO6kynG/F6tJnE4BAf8qX3itqVe/yvmVCpm4c4T+286wl/RgCvnS+ LJTwpF0NJLPNQYhA0t+EWVpuCB6gfrTCnkxCwlg9batCohgbga9CyWQnoKBSZx8VVbcO lU6KGIU16QVppX30+4ZEI4H1zIzb1VmsqLmMZWNzkOl4jeo3byzXvm05/E/3cznApB16 xVLQkWEKo1U0Wpm+iqcSdmB3S0d3x42DbB2ClxVchBXxZAloJlYwRfRadPyZKXK6r7XN 9Ppw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lWc8E8CMbVgT7TANNR/8TdPGoMSnLO96cJPktBpnkXU=; fh=l0GbbulFVEGIByrdVk2PDAYC0467jisoj0AJEvNmoTE=; b=jsztZTCCu4DQfsUuZbxuZiyDiaOe9ONlMg7kofjPaYPfDB9Q46RWsw+ZEOxU3Lh4Im jBl/s/Ny31mmBJfpcajRjILBT0RKQfMiSsT/t1Upi35OavgTaFcs90I5nlbf6q/1r8Wj CVOH/wC1eFc205PVwcTfsC1JRD1L0BE4V5DnrWkNdYbwjg5ZWqQ8iutI3yMQAsQkpkNB wzPVTIO1hJCcwD1Us3GYyw96Wt71dEG9kAlklLXrRV/J/1AFya+0lMzuVg+qgNPAXter UxCImCNxkiyT2M7WgupNT4TINwYYAzC3pWbBbvXthrbSM8ZBp/aVVXLeb1uCdcAOkssy OBZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=nlGA+udS; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id 36-20020a631564000000b00565617189e2si20230694pgv.839.2023.09.28.18.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 18:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=nlGA+udS; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 89AF080DB9E7; Wed, 27 Sep 2023 09:34:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232019AbjI0Qdt (ORCPT + 19 others); Wed, 27 Sep 2023 12:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231966AbjI0Qdl (ORCPT ); Wed, 27 Sep 2023 12:33:41 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2077.outbound.protection.outlook.com [40.107.93.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4163AF4; Wed, 27 Sep 2023 09:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lpELk2KNHmZKh5JJMfKgPn8PmAfK5r7iJaNS2moStgzm9wF5/u3mbBbapkyluXAIFqHzVmZNcMFJ8vXFNm8QEF0tY4bivXTfub7/QGjnnVrfxlh6WP6SSBBDZA7kesJ9R2xSqEd9t3drYgJ7XhBjcgMeoh2Yr9x14YCFxFDF5RZnlVIrWIb3rsI0bIsrIDOp64SMSUjxZ8z5PJ/6CRcZn9fxqKcjvfF5xxUbZy19ZsKlj5eANsyzw0MloiKsAq67UPJ6ryPehDDMoqrcKFYa50zxlbUFAZ67J+JxRQRC0K5I2KxYzANa/QjLRpyb6RN5lITC+k2vU58pwMUt8t8vCA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lWc8E8CMbVgT7TANNR/8TdPGoMSnLO96cJPktBpnkXU=; b=mQIJMyPAmjrs/MF1PdhMdEZ3wHnhCeMN0mrCvqmSoKU99hTaY7uKboVGX4tnGog1G+ClvnUyeIZxk2rDVJyxP4j+FWndHVhSm9iGYAUf7owvO2/+hXrSJ1l8q5UPUHnhTEQPXVbBsEcOycVU9MQVvxi7g7A0yQmR6y/yEbZYcLLYY797kFA+v2KKhTp0wqEymAONk3ekjcKA/WK/eMR4VMIVjo+AV6rjQXgZx4WzrsUIrqMl5ZyHcAc7NUHWTccbT0UKWA4im5sU1LNKzhQqqyMHHNJm2GA7yhtg5w+OKJfKEVfY+7TlXl0Z+NRASlszXoTOqUg1fM0vteMKlw3J9Q== 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=lWc8E8CMbVgT7TANNR/8TdPGoMSnLO96cJPktBpnkXU=; b=nlGA+udS0PDn21uITccIx8uV/TcmKiqkFDo/05wU77XWtAWMdlSLtR5KsChqrYORFwa/zYSf/1IgBRFZJxLrdY9x+lBlaOSnXLhG4FasDPwjL5qMsFQVe2j58He03hId+uoqYwcDN1U5gVlPT5mhS468HuIdZNI3FCBNrsb2/u8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) by SA1PR11MB6781.namprd11.prod.outlook.com (2603:10b6:806:25d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.21; Wed, 27 Sep 2023 16:33:28 +0000 Received: from IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3]) by IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3%4]) with mapi id 15.20.6813.027; Wed, 27 Sep 2023 16:33:28 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= To: Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 8/9] wifi: wfx: scan_lock is global to the device Date: Wed, 27 Sep 2023 18:32:56 +0200 Message-Id: <20230927163257.568496-9-jerome.pouiller@silabs.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927163257.568496-1-jerome.pouiller@silabs.com> References: <20230927163257.568496-1-jerome.pouiller@silabs.com> X-ClientProxiedBy: DS7PR06CA0052.namprd06.prod.outlook.com (2603:10b6:8:54::30) To IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7773:EE_|SA1PR11MB6781:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f0d3edb-924d-441d-5285-08dbbf777a4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RNHZwuDX1xdrqSk3M5kfh5GTvDMI05FM8f9Plok1OeCjhsIAWmPJzQwCfGGAFABAU1cd6g2NBOMqyRPSeiAsLa7lT/+fPneTw3SCVJ/WplHkN1d4hIRu5gEMvWr/XGmUdwVvyYB8d5uCp4w6Sexcgx8GaVnrLy287Sv6QUAdoUQ1syQaz76aW7EzikUxpdzsoZ8MJgoixDBfWuckrScf4+0aNYptJiGUCSwryfy4/F7DBFjBFB5PiMJez9yabXxwU+26I1n/mbCKaYn6rx1r0IfWsLX1uekjVO8FGCKg5zfoBcqCT9VLheDfViNTYOQfFRkjiBhw8+fjmUpyRWDx02i46SblSfQ0WGD4tePzF/UfaaZDHra+zrvcOYO3ErGmDWAAbb6yWTmkkTThzy3lAfJET9LUy8N/u/0O9sZ6jsJ4V0OhzUQtd9fXgrb2CvlvoFpzcE2M1FHUQxMfk46uku2ttfAEhzkDtvH3e42Uh/iVHpqZbfytE05AoQ8vVwGRmirWkzq4pkhgwDa723na+gvFepQC5jV2pXPhqonD/sv6htu6xFPtdghrs16BIxRP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB7773.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(136003)(346002)(39850400004)(376002)(230922051799003)(451199024)(186009)(1800799009)(36756003)(86362001)(8936002)(107886003)(6486002)(8676002)(2906002)(38100700002)(4326008)(6512007)(41300700001)(83380400001)(66556008)(5660300002)(1076003)(66574015)(2616005)(52116002)(6506007)(6916009)(66476007)(66946007)(316002)(478600001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+2SVksEa4WY9Uw8EC+zpJiMXbB3o?= =?utf-8?q?1Cn/RRL9mfrSIsqIHAoQd3Bo4hUu3rYIZso9E42VW5MnexmCCu5m1BonjP+gxH3I3?= =?utf-8?q?Zcu8hUPG6BI9siVMweNTSzELm5VInpzGAYBeFbYbbIpjMQsBhPzxBxQb0k8Jv3JOI?= =?utf-8?q?+WE/wNnIZlTrcJPi4L0bQa6xRZ8JvryWfsI6TDGYECVuKH6oFsEHFdsKZhGlIb70w?= =?utf-8?q?BkOkao2He00q0sRWiAdH9mlVz0luIpTgo8lne9qjawFvIq2fvpyOR3+57Dl/Mu4fh?= =?utf-8?q?k1mKbKgvaIqJjdTNK6VNuDBC//yFlc/eH67ZlXF/Q/JJqAV+6taKef9E+wLuyvR3r?= =?utf-8?q?AN2Ybfd+A0fC47S0SAY6HosjkTlIjOL7vObhItqE1GRwNezuMmrk8WMq7Ea8qoHKN?= =?utf-8?q?Dzmp14Dd2I5euF7B4BE1Xya6xsXDuLvE5GTkp33UXnIET/PkfxuftbqvyjEmEP1MU?= =?utf-8?q?kx6AdvQx5Vkywrn6IXM4Mrq/AF3kKbTFKXcT71SbeEEOnk10Nqhp4c0Rs76Cc1C7k?= =?utf-8?q?Tj3xGjOwOPAiyu6bqT+vNGtW2yGOL0eXgEVtLRBazrFYPF3fl44T8I7ZGChYAYpBa?= =?utf-8?q?kJPo3FCqL/YndSgPSx1Zi3bUGXd7ITKMuFUxyklbmegR6TFOKn9ZvO9p4/0BlqoVH?= =?utf-8?q?3hVeGZQ/Lio+0MNf+8hvEoeaJG7g/3V61Fz2TENIOFqw6yYdJBNDYPHH+NoNdnkdc?= =?utf-8?q?mO4FiprKw4LBsALpe2AmhxR9fLOZZmCt8AOSadH879XVE2NXEQnpqSXtblCjBrG6I?= =?utf-8?q?NdggPEXnVSL/K/onpg7DvkHjqbLwp64OmIctOHSaqQ4FAJPPTCaCcoacrHA9LxZJV?= =?utf-8?q?xen8BLOVwgtM27wLX4djkclY9U8TbCYMZRNAotzXGrsInZ4UcBge3mKx80Is0nC61?= =?utf-8?q?rhsgTBP0PjcB+LPzT00tMTmMXvEghsMSP4ztQpPCvisJdQPrhH0I9wU3fQfuBmRlX?= =?utf-8?q?gQNiHt9P/KVh7XQjT5czDwovV1oAKeGr4Mq9OfMl7/moHHzfMhgukwFMu++GTyJ2i?= =?utf-8?q?jnV2HyPsrbq0MRM8D/n7qKZaWv7lu4GwwvWhLy6UYWloHWRtdsrMZTUKunu0k8R8q?= =?utf-8?q?fQtBjFXL/5JnTLmGFvQwyKylYL0Ym1fDz7gblKUZbw6C8Srh/pb7g6v03EfMM3Sg8?= =?utf-8?q?92t65ln1JHVPi6LFlTlTFNanJGGoeDOx7CdgeTU1uWq2DB7B5x5Pxi5ainFQEtHJ3?= =?utf-8?q?yP6VhoVjLxumsaXqDUgoaS71sk5KKY6M57N1Fd9Qw3RbC/4uMIfPuUZDkgQvOtt0A?= =?utf-8?q?BLUzGYv+of3HHeBOVk7S3NTb53ueukUeL/KhF/e68jtJK8tGQkKshzqtEmq57axa5?= =?utf-8?q?++D9Wuv7DjARlxn4K5K/njTexFLIoEPLTsiDA4Ydykl1ELyMe1QB9au0y0k9Ue5sI?= =?utf-8?q?1RW9/ZEf9bESWzjD1uqiTDGCF5A89uOm12Q6eM7r7EmeExeWmiAxCIalj5bHA1Azh?= =?utf-8?q?gRB8+yP3fzD1t97LcK9RnjMfXGTNyNTAhHLc3OpT38+DQfZ60Y5Gm7eWIywDHDLAc?= =?utf-8?q?m7vzBA5ZgbeA6hjy+pToY4QUDmGtm/v2AiLMvXpNLTQo0GsJUjVXq9KMdGceVaahy?= =?utf-8?q?xJfMqmphDaz?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f0d3edb-924d-441d-5285-08dbbf777a4d X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7773.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 16:33:27.9536 (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: pPD1v/0t2Qy8oROJcBdsSmzRxTUA8waaQcYkDB8kyKsYt4PFmQi5CRrVKNieamdBcwM6ySqy+3U2sG1ay/fLvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6781 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 09:34:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778333064551191563 X-GMAIL-MSGID: 1778333064551191563 Currently, one scan_lock is associated to each vif. However, concurrent scan on vifs is explicitly prohitibed by the device. Currently, scan_lock is associated with conf_mutex that ensure that concurrent scan on vifs cannot happen. In the only case where conf_mutex is not associated to scan_lock, the scan_lock is tested on all interfaces. So, this patch relocate scan_lock to the device and simplify the code. Signed-off-by: Jérôme Pouiller --- drivers/net/wireless/silabs/wfx/main.c | 2 ++ drivers/net/wireless/silabs/wfx/queue.c | 6 ++---- drivers/net/wireless/silabs/wfx/scan.c | 8 ++++---- drivers/net/wireless/silabs/wfx/sta.c | 15 ++++----------- drivers/net/wireless/silabs/wfx/wfx.h | 3 +-- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c index 31f6e0d3dc089..e7198520bdffc 100644 --- a/drivers/net/wireless/silabs/wfx/main.c +++ b/drivers/net/wireless/silabs/wfx/main.c @@ -248,6 +248,7 @@ static void wfx_free_common(void *data) mutex_destroy(&wdev->tx_power_loop_info_lock); mutex_destroy(&wdev->rx_stats_lock); + mutex_destroy(&wdev->scan_lock); mutex_destroy(&wdev->conf_mutex); ieee80211_free_hw(wdev->hw); } @@ -317,6 +318,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup"); mutex_init(&wdev->conf_mutex); + mutex_init(&wdev->scan_lock); mutex_init(&wdev->rx_stats_lock); mutex_init(&wdev->tx_power_loop_info_lock); init_completion(&wdev->firmware_ready); diff --git a/drivers/net/wireless/silabs/wfx/queue.c b/drivers/net/wireless/silabs/wfx/queue.c index b5975d18f09b4..e61b86f211e53 100644 --- a/drivers/net/wireless/silabs/wfx/queue.c +++ b/drivers/net/wireless/silabs/wfx/queue.c @@ -267,10 +267,8 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) } } - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - if (mutex_is_locked(&wvif->scan_lock)) - return NULL; + if (mutex_is_locked(&wdev->scan_lock)) + return NULL; wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { diff --git a/drivers/net/wireless/silabs/wfx/scan.c b/drivers/net/wireless/silabs/wfx/scan.c index 817eeb3aa8bff..c3c103ff88cce 100644 --- a/drivers/net/wireless/silabs/wfx/scan.c +++ b/drivers/net/wireless/silabs/wfx/scan.c @@ -95,7 +95,7 @@ void wfx_hw_scan_work(struct work_struct *work) int chan_cur, ret, err; mutex_lock(&wvif->wdev->conf_mutex); - mutex_lock(&wvif->scan_lock); + mutex_lock(&wvif->wdev->scan_lock); if (wvif->join_in_progress) { dev_info(wvif->wdev->dev, "abort in-progress REQ_JOIN"); wfx_reset(wvif); @@ -116,7 +116,7 @@ void wfx_hw_scan_work(struct work_struct *work) ret = -ETIMEDOUT; } } while (ret >= 0 && chan_cur < hw_req->req.n_channels); - mutex_unlock(&wvif->scan_lock); + mutex_unlock(&wvif->wdev->scan_lock); mutex_unlock(&wvif->wdev->conf_mutex); wfx_ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); } @@ -155,7 +155,7 @@ void wfx_remain_on_channel_work(struct work_struct *work) /* Hijack scan request to implement Remain-On-Channel */ mutex_lock(&wvif->wdev->conf_mutex); - mutex_lock(&wvif->scan_lock); + mutex_lock(&wvif->wdev->scan_lock); if (wvif->join_in_progress) { dev_info(wvif->wdev->dev, "abort in-progress REQ_JOIN"); wfx_reset(wvif); @@ -178,7 +178,7 @@ void wfx_remain_on_channel_work(struct work_struct *work) dev_err(wvif->wdev->dev, "roc didn't stop\n"); ieee80211_remain_on_channel_expired(wvif->wdev->hw); end: - mutex_unlock(&wvif->scan_lock); + mutex_unlock(&wvif->wdev->scan_lock); mutex_unlock(&wvif->wdev->conf_mutex); wfx_bh_request_tx(wvif->wdev); } diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c index f42341c2baffb..496b93de3ee58 100644 --- a/drivers/net/wireless/silabs/wfx/sta.c +++ b/drivers/net/wireless/silabs/wfx/sta.c @@ -97,9 +97,8 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, FIF_PROBE_REQ | FIF_PSPOLL; mutex_lock(&wdev->conf_mutex); + mutex_lock(&wdev->scan_lock); while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - mutex_lock(&wvif->scan_lock); - /* Note: FIF_BCN_PRBRESP_PROMISC covers probe response and * beacons from other BSS */ @@ -126,9 +125,8 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, else filter_prbreq = true; wfx_hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); - - mutex_unlock(&wvif->scan_lock); } + mutex_unlock(&wdev->scan_lock); mutex_unlock(&wdev->conf_mutex); } @@ -621,18 +619,14 @@ int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) { - struct wfx_vif *wvif_it; - if (notify_cmd != STA_NOTIFY_AWAKE) return; /* Device won't be able to honor CAB if a scan is in progress on any interface. Prefer to * skip this DTIM and wait for the next one. */ - wvif_it = NULL; - while ((wvif_it = wvif_iterate(wvif->wdev, wvif_it)) != NULL) - if (mutex_is_locked(&wvif_it->scan_lock)) - return; + if (mutex_is_locked(&wvif->wdev->scan_lock)) + return; if (!wfx_tx_queues_has_cab(wvif) || wvif->after_dtim_tx_allowed) dev_warn(wvif->wdev->dev, "incorrect sequence (%d CAB in queue)", @@ -730,7 +724,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) complete(&wvif->set_pm_mode_complete); INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); - mutex_init(&wvif->scan_lock); init_completion(&wvif->scan_complete); INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); INIT_WORK(&wvif->remain_on_channel_work, wfx_remain_on_channel_work); diff --git a/drivers/net/wireless/silabs/wfx/wfx.h b/drivers/net/wireless/silabs/wfx/wfx.h index 5fd80c423d6f6..bd0df2e1ea990 100644 --- a/drivers/net/wireless/silabs/wfx/wfx.h +++ b/drivers/net/wireless/silabs/wfx/wfx.h @@ -43,6 +43,7 @@ struct wfx_dev { struct delayed_work cooling_timeout_work; bool poll_irq; bool chip_frozen; + struct mutex scan_lock; struct mutex conf_mutex; struct wfx_hif_cmd hif_cmd; @@ -81,8 +82,6 @@ struct wfx_vif { unsigned long uapsd_mask; - /* avoid some operations in parallel with scan */ - struct mutex scan_lock; struct work_struct scan_work; struct completion scan_complete; int scan_nb_chan_done;