From patchwork Wed May 10 20:12:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 92284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3892573vqo; Wed, 10 May 2023 13:14:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4exJZxj0xnLpy0Xn6ZUjaED1j9C1zMXZMPYsDU+smAPdS0w9aDrZzvA/Mmp/Uj8lME1wbP X-Received: by 2002:a17:902:aa8d:b0:1a6:db0a:8003 with SMTP id d13-20020a170902aa8d00b001a6db0a8003mr18749672plr.23.1683749652641; Wed, 10 May 2023 13:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683749652; cv=none; d=google.com; s=arc-20160816; b=xAtEkCwLw+SUNLVyGEBDwVBXkdzvmV/LjcuZxbSWQtr/BmC1Y77ClwwoIQ2KSNtVX6 wUgQm8CVjtUT0UrWSZAfClsXTcLc4DcndN7gYWW1rJEws5r76WRDGgU5Mb+t1Z5RAgBk ADKZ4sasVD0pmdcEYWOf1mV+6td6W0gqceJ3fMxTeZMc8+5NcnSjrre7TAZYw9ZU/dDp 9cuBsRfqOUgEcstecqhPp/nPunq+wmfZGKOPxlxHmBIrX68IvrhqzCX/m+vavLIFE2SZ bS2+gQf2nxgrEytFY83LRz+47clgUyRBKFUJrQePCRENhy1wl4ZxhuseIhjqOq7RvjWF FBQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u2CIbnDR2mlWnb5GGVQtIzdYj1rfoIFL22kSR9dz4nw=; b=KSMRItcUOZHAZBIsDipPrdMYSQhx6Mq99KsUpvxhMawSvfTrZKKmdnbRiN9g6cHYT7 ne0R34cJbUb4aEEpC7YApKcUNFT7Irf4z5wU49UeHoo8jCP5DJ/mUK/bvchNa2f2R8Yl ZB3OzqgozZPMvfOF5q1qZRt+TtUsrMyozJ8VtO28vJzXQ4qFsNwyAcKLNHxy/yOf46YZ 5kBBOUxI2UGm7quRAUMGvVQROe9lnXIGX6IvMjXk76BQZLqgQpSmQrr51vx+vpVGWhm0 lVJKe1xsOFBKGcwRfYZdWvBzjSF+2Lm48dbHDJSYybn7r4lGOu/Q1HfFI7mRZvROscVU A8XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="x7Dt9lq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a17090a72c700b00246d164fd7asi16729949pjk.159.2023.05.10.13.14.00; Wed, 10 May 2023 13:14:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="x7Dt9lq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236290AbjEJUMS (ORCPT + 99 others); Wed, 10 May 2023 16:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236101AbjEJUMO (ORCPT ); Wed, 10 May 2023 16:12:14 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D0EE6B; Wed, 10 May 2023 13:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=u2CIbnDR2mlWnb5GGVQtIzdYj1rfoIFL22kSR9dz4nw=; t=1683749533; x=1684959133; b=x7Dt9lq/aYk/y2FjQxCO3TbBlarht37dXcpGS+rtHYAYLm+ R7BlcEhaOgEk4AeeQwo6tATQ6nrV8GMWJ+ft0ug/7le/5OEQyf8bqsmbIoBhDl7ZcK+CX2iw3vbNj dOu64P+XpNFVJpjyJBe4iZaWVGF1CLd9XSaD111kp5t67NDc2KsACthaxA89WfLJ8HapqHhrg8Pc0 Ka7WmEPm7PxBFOlr4RRj3viwHQCP2OZgFZ4tbjh0+ah5JhF76sz1KJsEDohmKRivNnX2fkFlUh60K t08LwkN7mkQbMRCvO02qMBAyYY8/5fpYPfeKKg9pIP9S4Dmielkw9FYThKjFZdEg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1pwqAT-005aH5-25; Wed, 10 May 2023 22:12:09 +0200 From: Johannes Berg To: linux-kernel@vger.kernel.org Cc: linux-wireless@vger.kernel.org, Tejun Heo , Lai Jiangshan , Johannes Berg Subject: [RFC PATCH v2 3/3] wifi: cfg80211: move scan done work to cfg80211 workqueue Date: Wed, 10 May 2023 22:12:05 +0200 Message-Id: <20230510220918.dceb0eba07bb.I0490b5768769e62db2448e3f439cdf8a3c2df892@changeid> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230510201205.308542-1-johannes@sipsolutions.net> References: <20230510201205.308542-1-johannes@sipsolutions.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765539476134837654?= X-GMAIL-MSGID: =?utf-8?q?1765539476134837654?= From: Johannes Berg Now that we have the cfg80211 workqueue, move the scan_done work to it as an example. Signed-off-by: Johannes Berg --- v2: - use the new version of the cfg80211 patch --- net/wireless/core.c | 3 +-- net/wireless/core.h | 4 ++-- net/wireless/scan.c | 14 ++++---------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/net/wireless/core.c b/net/wireless/core.c index 357fd5425bff..3671a50796c2 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -517,7 +517,7 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, spin_lock_init(&rdev->bss_lock); INIT_LIST_HEAD(&rdev->bss_list); INIT_LIST_HEAD(&rdev->sched_scan_req_list); - INIT_WORK(&rdev->scan_done_wk, __cfg80211_scan_done); + wiphy_work_init(&rdev->scan_done_wk, __cfg80211_scan_done); INIT_DELAYED_WORK(&rdev->dfs_update_channels_wk, cfg80211_dfs_channels_update_work); #ifdef CONFIG_CFG80211_WEXT @@ -1106,7 +1106,6 @@ void wiphy_unregister(struct wiphy *wiphy) */ flush_workqueue(rdev->wq); - flush_work(&rdev->scan_done_wk); cancel_work_sync(&rdev->conn_work); flush_work(&rdev->event_work); cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); diff --git a/net/wireless/core.h b/net/wireless/core.h index adb45fa38acb..cbd864224856 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -75,7 +75,7 @@ struct cfg80211_registered_device { struct sk_buff *scan_msg; struct list_head sched_scan_req_list; time64_t suspend_at; - struct work_struct scan_done_wk; + struct wiphy_work scan_done_wk; struct genl_info *cur_cmd_info; @@ -441,7 +441,7 @@ bool cfg80211_valid_key_idx(struct cfg80211_registered_device *rdev, int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, struct key_params *params, int key_idx, bool pairwise, const u8 *mac_addr); -void __cfg80211_scan_done(struct work_struct *wk); +void __cfg80211_scan_done(struct wiphy *wiphy, struct wiphy_work *wk); void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool send_message); void cfg80211_add_sched_scan_req(struct cfg80211_registered_device *rdev, diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 790bc31cf82e..752eae5e0a00 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1000,16 +1000,9 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, nl80211_send_scan_msg(rdev, msg); } -void __cfg80211_scan_done(struct work_struct *wk) +void __cfg80211_scan_done(struct wiphy *wiphy, struct wiphy_work *wk) { - struct cfg80211_registered_device *rdev; - - rdev = container_of(wk, struct cfg80211_registered_device, - scan_done_wk); - - wiphy_lock(&rdev->wiphy); - ___cfg80211_scan_done(rdev, true); - wiphy_unlock(&rdev->wiphy); + ___cfg80211_scan_done(wiphy_to_rdev(wiphy), true); } void cfg80211_scan_done(struct cfg80211_scan_request *request, @@ -1035,7 +1028,8 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, } request->notified = true; - queue_work(cfg80211_wq, &wiphy_to_rdev(request->wiphy)->scan_done_wk); + wiphy_work_queue(request->wiphy, + &wiphy_to_rdev(request->wiphy)->scan_done_wk); } EXPORT_SYMBOL(cfg80211_scan_done);