Message ID | 20240112-netdev_queue-v1-1-102c2d57e20a@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp282608dyc; Fri, 12 Jan 2024 08:18:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3nuN5ZZAAMRChMFQVQ44ZCYkCfG/FUKE3FiG2GqY5GA8GCd6i3R6XwMm6JZUQJywIsUXj X-Received: by 2002:a05:620a:90f:b0:783:4dfb:1117 with SMTP id v15-20020a05620a090f00b007834dfb1117mr322667qkv.7.1705076295692; Fri, 12 Jan 2024 08:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705076295; cv=none; d=google.com; s=arc-20160816; b=C4Z71FzNoJdpHps+l4ktUXlO/WLAlUdFDLReb5o/HdG5cfaSAGQcAzRaE3dA3Lv46G Tzl9B96X5u/5BP7rJYURf52h4mO8UKzY0d9+C2XAaHctKm++BVbB0/j3NG32SGjBjkiQ TLb5W9ewwbjqOoQNtgtEBeG3s8OuencLwuPgZG4FgMdGPgl84ecU7tNSXC3nZDD9+hqY bu2hdaUjRLnPfb+Bz1lHsl65Pd6W2MPkFvAVTvP5N7btYa5pID7AXdp26Iyx32tbZnhR J3tfa9SHnXuWAgx2WIYX8gOE+xnxH4NP4Cd8+7+c+4ZzhskYMdNoBsg+WybzLnegCxK3 O2Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from; bh=MSMunPl+uthj1e7ApRmhDFETn+eydL48bsoNlHcAMEk=; fh=CdaCNZY8CDbrsldssQwjthO5l56aCgX8TlPDRf+Zurk=; b=l+5Wqd+dOUupjZeJP/WVGSbraDbkcKaxbk0M+cQsl6zrDaP//IDjfDKpukYdac8qkX NCulYoKvTHNtcjhCpiDEfkg4pRbRzrDgt6Ye3L2SYreA9DFjtmOMxDpObT7mBGqMLBk6 EFhQklnN67xmlqOO4llh4IYoR2FRRfhMAJGGUL9IEt3wPCJ9byTJeDfOljEJ3n/bjNUF ysIUEutRn8NMUmq/2xaLTIq4y3Gl/VLK1oeUc3NNbIQ81Yl6LWSFQ7ySpoyADJsB6eBv g/2q/BJ7yh02TDiqx6f1MrnHKIsglCzGQMLyRTx0u3FVG0MV/s5/phhZQZYUrOaSmUx+ 4m0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d1-20020a05620a166100b007833c5d6b6csi3140262qko.713.2024.01.12.08.18.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 08:18:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24850-ouuuleilei=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7BEC31C224B0 for <ouuuleilei@gmail.com>; Fri, 12 Jan 2024 16:18:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF2B9745E5; Fri, 12 Jan 2024 16:17:55 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 2310E7319F for <linux-kernel@vger.kernel.org>; Fri, 12 Jan 2024 16:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <mkl@pengutronix.de>) id 1rOKE8-0000I0-0A for linux-kernel@vger.kernel.org; Fri, 12 Jan 2024 17:17:48 +0100 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <mkl@pengutronix.de>) id 1rOKE7-002Bnl-Im for linux-kernel@vger.kernel.org; Fri, 12 Jan 2024 17:17:47 +0100 Received: from dspam.blackshift.org (localhost [127.0.0.1]) by bjornoya.blackshift.org (Postfix) with SMTP id 16FF5275222 for <linux-kernel@vger.kernel.org>; Fri, 12 Jan 2024 16:13:20 +0000 (UTC) Received: from hardanger.blackshift.org (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by bjornoya.blackshift.org (Postfix) with ESMTPS id 28927275213; Fri, 12 Jan 2024 16:13:18 +0000 (UTC) Received: from [172.20.34.65] (localhost [::1]) by hardanger.blackshift.org (OpenSMTPD) with ESMTP id d9b81a73; Fri, 12 Jan 2024 16:13:17 +0000 (UTC) From: Marc Kleine-Budde <mkl@pengutronix.de> Date: Fri, 12 Jan 2024 17:13:14 +0100 Subject: [PATCH] net: netdev_queue: netdev_txq_completed_mb(): fix wake condition Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240112-netdev_queue-v1-1-102c2d57e20a@pengutronix.de> X-B4-Tracking: v=1; b=H4sIABlloWUC/x3MQQqAIBRF0a3EHyeoVFRbiYjIZ/2JlWYE0t6Th mdwb6IAzwjUF4k8bg68uwxVFrRss1sh2GSTlrqSSmnhcBnc0xkRIdCppm1sbbGAcnJ4WH7+3TC +7wchRTDoXgAAAA== To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Herbert Xu <herbert@gondor.apana.org.au> Cc: kernel@pengutronix.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de> X-Mailer: b4 0.13-dev-f0463 X-Developer-Signature: v=1; a=openpgp-sha256; l=1364; i=mkl@pengutronix.de; h=from:subject:message-id; bh=CkEKs9/ASN2pww0g0ug4I7HYAiq8bIX4Yqwzznlyw/4=; b=owEBbQGS/pANAwAKAb5QHEoqigToAcsmYgBloWUa98YtsGRxO4OY7nG90d2rMUTs9xKV9hUp4 YoKoQPLipmJATMEAAEKAB0WIQQOzYG9qPI0qV/1MlC+UBxKKooE6AUCZaFlGgAKCRC+UBxKKooE 6KeICACY3D2klvan6Q4R965DSPSOZiScSg3DoNHPLut+48r26NGzmPwepHnGUvxExCKWShF8O9I 55Q5qMSQO8dFKIoNoyrn8sitRwUWP/tJQFpg8kTwJBfcLySxyL58BVHccxbsovVPont8s9oc1Ev WWtYQ+gu/1RFbkuetQJF9QegiSmiqpVZD9wZkHW9nPJPWGuKTFGwHqwuPFSP/y6yOtsjzBwXmXi 2VogySlyZSSdaTiyZ3jeKuCWEOfS/KQsAIo5Bx5+Y/LYpEolrZks8G5obTYJJOWEC+1PX/ZvVwz Nr6PDmdONeeBuiTwRnOGFhM9BsWzyKP+auS1SeSDhjVpH7u0 X-Developer-Key: i=mkl@pengutronix.de; a=openpgp; fpr=C1400BA0B3989E6FBC7D5B5C2B5EE211C58AEA54 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787902082037683938 X-GMAIL-MSGID: 1787902082037683938 |
Series |
net: netdev_queue: netdev_txq_completed_mb(): fix wake condition
|
|
Commit Message
Marc Kleine-Budde
Jan. 12, 2024, 4:13 p.m. UTC
netif_txq_try_stop() uses "get_desc >= start_thrs" as the check for
the call to netif_tx_start_queue().
Use ">=" i netdev_txq_completed_mb(), too.
Fixes: c91c46de6bbc ("net: provide macros for commonly copied lockless queue stop/wake code")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Hello,
I'm currently converting a networking driver with a TX-FIFO depth of
1 (CAN device with lots of errata :/) to the netdev_queue.h helpers
and stumbled over an off-by-one error on __netif_txq_completed_wake().
regards,
Marc
---
include/net/netdev_queues.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 907ee6681788556b9ade3ad0a1f6f4aea192399c
change-id: 20240112-netdev_queue-e91686f5fece
Best regards,
Comments
On Fri, 12 Jan 2024 17:13:14 +0100 Marc Kleine-Budde wrote: > netif_txq_try_stop() uses "get_desc >= start_thrs" as the check for > the call to netif_tx_start_queue(). > > Use ">=" i netdev_txq_completed_mb(), too. > > Fixes: c91c46de6bbc ("net: provide macros for commonly copied lockless queue stop/wake code") > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > --- > I'm currently converting a networking driver with a TX-FIFO depth of > 1 (CAN device with lots of errata :/) to the netdev_queue.h helpers > and stumbled over an off-by-one error on __netif_txq_completed_wake(). Makes sense, could be copy'n'paste from one of the drivers this is based on. A bit unsure if it deserves the Fixes tag and net as we don't know of any current user that would be suffering. start_thrs == ring size is a bit of an extreme use case indeed :) Either way: Acked-by: Jakub Kicinski <kuba@kernel.org>
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Fri, 12 Jan 2024 17:13:14 +0100 you wrote: > netif_txq_try_stop() uses "get_desc >= start_thrs" as the check for > the call to netif_tx_start_queue(). > > Use ">=" i netdev_txq_completed_mb(), too. > > Fixes: c91c46de6bbc ("net: provide macros for commonly copied lockless queue stop/wake code") > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > > [...] Here is the summary with links: - net: netdev_queue: netdev_txq_completed_mb(): fix wake condition https://git.kernel.org/netdev/net/c/894d7508316e You are awesome, thank you!
diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index d68b0a483431..8b8ed4e13d74 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -128,7 +128,7 @@ netdev_txq_completed_mb(struct netdev_queue *dev_queue, netdev_txq_completed_mb(txq, pkts, bytes); \ \ _res = -1; \ - if (pkts && likely(get_desc > start_thrs)) { \ + if (pkts && likely(get_desc >= start_thrs)) { \ _res = 1; \ if (unlikely(netif_tx_queue_stopped(txq)) && \ !(down_cond)) { \