From patchwork Thu Feb 15 15:36:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 201568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp482951dyb; Thu, 15 Feb 2024 07:38:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgFXx59N4ysdMQL58Et1sbqeT9wjMfYfvVaLPm8kr+r4YsCBPE4+E3/SkS2UltJT0MZfcCBGpTdil/t3mRIUwpZyf9VA== X-Google-Smtp-Source: AGHT+IHZM/xb0iiy6/AtGgXRZgOUMwplqRHo8DxnMkv7d15iynNb0MhlyndzqhjuuiW9xOBdAeBU X-Received: by 2002:a05:6402:2cd:b0:561:f236:a480 with SMTP id b13-20020a05640202cd00b00561f236a480mr1534764edx.7.1708011491883; Thu, 15 Feb 2024 07:38:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011491; cv=pass; d=google.com; s=arc-20160816; b=zWjfqIoVVxigFXRyvUXPIS6Qn9FzUPeUzTOgQajkWay7ZXhwfdl4uLh2Y9vw5gvZqy XnskuZMyTvq656IRlPos44pVOOJEY/p8zvQ64O5vqPbXLOsjzs7KB7+LBt+G3PQZ4LvS s3M39ikKTqY2C76YtN4nmF3ajYBZwCe7AK3mw6LIcQ+7g/L+n9oIGORz7bP7mmUo1b9s LgV2yBocMCO2UzbhwXE52yriPdZDFscnjUszc8/F/UKggwCN6MDXkek1tw+XvJNpRACy UuVkwkjcu72Mb5tVK5X2qoeNuliB5SoASDe9rVN7oAGlN+S7Pkf1tqNO7w2N1t4BCljn Sc/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=+VdOMGdhUfnRqC84Ds5qac0THeFNjbkMbQFO9qc5HW0=; fh=hf7yt6gAq86lBfLhZUgknSIsFJxesf1c5mfeIKl6aZk=; b=kiPk5KnY9ePROJ3aeXdBdKiRgCUjvQObx7gL2rFkfEqX5s9l7RRx1gyHzTEPQLfwbH xK98Kf2VNPO9D3vM+iWStAJpzKTt7q98iWFvFpVUM6KP4LqS0vN9F7A6xBoKoud4wmU4 30ndcrLN4RWNzQwLpMTXnGAQJhgeR10f0qz4S7jc23cJL+bQrw/R8xtP2QXUcUzucT5b z2pDo9Enbdc7s5Y9iHlzzxrxgXjrxlw6bfSe1chEz1spfdht4tcQYFyjFEHN1bm35xTI Z9ovm6r3butL5g2ZBh3ZRPhOiLQAI0kaJg3UkqMTrAfAff3ZsSDvaSOSefVDeL0AAjdI tnCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CRUEGZFA; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67203-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67203-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q23-20020a50c357000000b00563718a08a2si755580edb.166.2024.02.15.07.38.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:38:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67203-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CRUEGZFA; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67203-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67203-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7BE651F2F1CC for ; Thu, 15 Feb 2024 15:38:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4A251350D2; Thu, 15 Feb 2024 15:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="CRUEGZFA" Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F01133413; Thu, 15 Feb 2024 15:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011408; cv=none; b=Tgmo59HoFSX85eqaDajWjBNaABrB+NuZO+iw3NEfkWrSQvcRuESCAf8zzT2vzHUnZHOSZFRoN/zlsfbUK+21vfGsxBpZ+l15l1C4/64GbVtRxlKb831MESCc4ZuwojWleBX/7YgMUI5olSR0YRLSwyewV8JMMLcXIzAOW6tF1mQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011408; c=relaxed/simple; bh=8WF6UR9eF6nZvmRireCrz2oeCtLoHCVzVebIRGr2RAo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YOdY2rjouqBXcUQm9q23JgWBTsYvY0XXUHgFfJbh6zPmVody05P5VE+K2fHYLlYGhcqQJ8Zls1FZre2/CXJ5Oa+fKKY0y3zTmn1M1oEs23vwcQIzPf7o4imJ4Y2VI4Qp9QkvCA4eoq5UXWiWxGKdJSgm2nK44xz3iFO1yvFlcY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=CRUEGZFA; arc=none smtp.client-ip=217.70.178.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: from relay9-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::229]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 28449C8768; Thu, 15 Feb 2024 15:36:39 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id F2AD1FF809; Thu, 15 Feb 2024 15:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708011391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+VdOMGdhUfnRqC84Ds5qac0THeFNjbkMbQFO9qc5HW0=; b=CRUEGZFAXDgeTHu5kecJXNIKhz+bUdJmbxnNGF5IbvVOjnsmfTe46lk6qelri2fgmCdKq+ 2Jh6vqUVAIrheNpl12a3Dj7k+iabPy6JR1FZJG8FhvJ83X3CPI+UjhYbx/nbWIxdcpDbOO aL2znWcb6ADFHg82PPNcN3cplGUcwcfFjli+xinRpHFGoADaoDSOxAXhqyoCvy9aODs6o1 0u9ltZK/fg0pzqJL39yt7+dFVzMkx6SwlJZgKgK8AikZIRIb2KZ7Z4k7Wh8UzptJjcB3SJ 3/p4WQP2ABd7a2rUQUDGRfJCkchtZSeL+gcSPb/ImFH8j1aMuNqmbeivhCUPfw== From: =?utf-8?q?Alexis_Lothor=C3=A9?= Date: Thu, 15 Feb 2024 16:36:18 +0100 Subject: [PATCH 1/4] wifi: wilc1000: split deeply nested RCU list traversal in dedicated helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240215-wilc_fix_rcu_usage-v1-1-f610e46c6f82@bootlin.com> References: <20240215-wilc_fix_rcu_usage-v1-0-f610e46c6f82@bootlin.com> In-Reply-To: <20240215-wilc_fix_rcu_usage-v1-0-f610e46c6f82@bootlin.com> To: linux-wireless@vger.kernel.org Cc: Ajay Singh , Claudiu Beznea , Kalle Valo , Thomas Petazzoni , linux-kernel@vger.kernel.org, =?utf-8?q?Alexis_Lothor=C3=A9?= X-Mailer: b4 0.12.4 X-GND-Sasl: alexis.lothore@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790979858497149348 X-GMAIL-MSGID: 1790979858497149348 Move netif_wake_queue and its surrounding RCU operations in a dedicated function to clarify wilc_txq_task and ease refactoring Signed-off-by: Alexis Lothoré --- drivers/net/wireless/microchip/wilc1000/netdev.c | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 22f461f477f1..62414ab8846e 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -140,6 +140,19 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) return ret_val; } +static void wilc_wake_tx_queues(struct wilc *wl) +{ + int srcu_idx; + struct wilc_vif *ifc; + + srcu_idx = srcu_read_lock(&wl->srcu); + list_for_each_entry_rcu(ifc, &wl->vif_list, list) { + if (ifc->mac_opened && netif_queue_stopped(ifc->ndev)) + netif_wake_queue(ifc->ndev); + } + srcu_read_unlock(&wl->srcu, srcu_idx); +} + static int wilc_txq_task(void *vp) { int ret; @@ -160,17 +173,7 @@ static int wilc_txq_task(void *vp) do { ret = wilc_wlan_handle_txq(wl, &txq_count); if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) { - int srcu_idx; - struct wilc_vif *ifc; - - srcu_idx = srcu_read_lock(&wl->srcu); - list_for_each_entry_rcu(ifc, &wl->vif_list, - list) { - if (ifc->mac_opened && - netif_queue_stopped(ifc->ndev)) - netif_wake_queue(ifc->ndev); - } - srcu_read_unlock(&wl->srcu, srcu_idx); + wilc_wake_tx_queues(wl); } if (ret != WILC_VMM_ENTRY_FULL_RETRY) break;