From patchwork Wed Feb 28 16:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 207908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3443607dyb; Wed, 28 Feb 2024 08:07:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYvL6AOxu5OyYxa6ZzOn4MRANtfiQZ4CShcQBfU8v7OP701ruaMtynkQOlvU9srnB6X7mAkp+waZOwcKcwk+qoTDBcZw== X-Google-Smtp-Source: AGHT+IHlUq60+XdJm1NZBk+OXZHcX7DzoCepvFi4v6l+p5TacR71HYQHNYS6pV5wJ47vt3bFvMoO X-Received: by 2002:a05:622a:1751:b0:42e:250d:45b6 with SMTP id l17-20020a05622a175100b0042e250d45b6mr4133845qtk.12.1709136478541; Wed, 28 Feb 2024 08:07:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709136478; cv=pass; d=google.com; s=arc-20160816; b=m1WspdRwbzs7uieJN6GjO8l4HnqYSPG0qlXSwate5XhH3eMEgeonkEmrxlVJAtz9Uw 0Ff5lhFbtM/HESKYtsokt2JqOQ5hL5qngKVhMJemE9WHiH7vqiOoVU3gJWFYP6I0P5Y3 G4bFC5spad0c9RqDZFr0k5BpwSnYJYHVp9bZhPA1moXCyvhaOFZyt5qqRaTt/nF4ffQf et5oEvDCt8QzEynuw0wKy6Kki5S8wDqmFK1GcVySWCcHYXapohECi6PhrBeZ9EDDa5y0 J30Q7ANn3zKv+vYSfHeRnA1mix3MrJvizPWy9Lja0tB2lPATbnwmyZBch5q+nfLAPbCv 4idQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=RUNkfx0/kIsNJigFs+UEZ297MEtBNYWolCnQP1h3x18=; fh=0MDomSxFZvGHhzUcqLYXKXvZGf0Nl7mkyT0e8PiKZ6I=; b=HkL0W6aSsOAQgF1YebOELMlyM88tLmGHF5lXamFplmUp6K5t/jEGeLL4zWMp5sKAm8 99q6WM7oBTg2FmBe08Qp0zob4yR55S3bcXCTxJPdeDdQpCOBSS26825u7+YJItCBuQDD V5OLpsckw9SaO+OWk7M/nG2EYLti1ehcEhdJh9Yi5uF6t9rsHSXr25tGNIVT7V6YGTwK 1/S+pwWHZ6k5k78NMSOnUpHPbbLo90r//Wlp4KPh9qthZlUDLp48ikPMCdzbvDek9h+Z kDw+OpmGyz2qbHqgpqjSLCQ9GjRtfA65lzISHs3xd2dkZo86GS59g6rt8Dcksks0peXG Zb+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IjvtbXn9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85321-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85321-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e20-20020ac845d4000000b0042e5bf8bd26si9444414qto.519.2024.02.28.08.07.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:07:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85321-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IjvtbXn9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85321-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85321-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 559391C2192B for ; Wed, 28 Feb 2024 16:07:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A93115DBC1; Wed, 28 Feb 2024 16:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IjvtbXn9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 746CE15B98B; Wed, 28 Feb 2024 16:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136460; cv=none; b=BrKTy96pXjgiT2MHDMzBTpdmsBbkKAr4FktT9VKxFh5R07CmacAu0yYtjPMYEROWxhg/pO7nq4xvuKOezW1doKgYZLX0t/7olPZYRaHjPqfNZBXylabTO/w6VS2F59Yg5hvsuBFFXSTkEKYkVzwqCd3+Umcp51CwUINS0NKfUJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136460; c=relaxed/simple; bh=GdUbV1NGoO5EFJmeAqLlDDgJzYkjRPcGGbPikMTrOuk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=b0IPhSTnH39sla1MMV93uLJeO5cn9pRxJREvfUwI3yxFwSMripTbdh8VeXoUkf2nGOaDq6h3oQE695T3hb3E1bNDmk7dPksDEasFU5uI7CRrJir+PQ0oTp72jSkK0CYt4aQG/nMZTr9LpXx4ICbkzlrupIMdZQ9kParBnWezLMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IjvtbXn9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8746C433C7; Wed, 28 Feb 2024 16:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709136459; bh=GdUbV1NGoO5EFJmeAqLlDDgJzYkjRPcGGbPikMTrOuk=; h=From:To:Cc:Subject:Date:From; b=IjvtbXn9OIoPe9Zco0Mr3HF5gXrsyY29g6QuTIhVhLvnTokyeeiNb0sJLMeaKSN2B Rx/MkVsP/53qUL7WG4NED611I01o6ZEJBYYeW6C/yijAMQdL/d2D0L1/jcwcht2aBf Q6TNB+Nz9i66axzLbqkoG8VVMEaZWS0tYvM61T4EnRfTI5udDELbb2V4gqDmUxVN1c gZ2xhk7O4HtRug47spGO6iTceRWcXRaUnjQdic2CL01wh9LhJmR1QdpDtA7zw19jx0 DS93j8vta8rPRRQ9WziZilZ1nOH52eV0I+SSdv9u+LgvIP7l/IAO9XNxe3NrhJfr5I fPcgoW35Xsf5A== From: Arnd Bergmann To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Breno Leitao Cc: Arnd Bergmann , Siddharth Vadapalli , Roger Quadros , Grygorii Strashko , Dan Carpenter , Simon Horman , Daniel Borkmann , Christian Marangi , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] net: bql: fix building with BQL disabled Date: Wed, 28 Feb 2024 17:06:56 +0100 Message-Id: <20240228160732.1662287-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792159492040067302 X-GMAIL-MSGID: 1792159492040067302 From: Arnd Bergmann It is now possible to disable BQL, but that causes the cpsw driver to break: drivers/net/ethernet/ti/am65-cpsw-nuss.c:297:28: error: no member named 'dql' in 'struct netdev_queue' 297 | dql_avail(&netif_txq->dql), There is already a helper function in net/sch_generic.h that could be used to help here. Move its implementation into the common linux/netdevice.h along with the other bql interfaces and change both users over to the new interface. Fixes: ea7f3cfaa588 ("net: bql: allow the config to be disabled") Signed-off-by: Arnd Bergmann --- v2: merge the two identical implementations --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- include/linux/netdevice.h | 10 ++++++++++ include/net/sch_generic.h | 7 +------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 9d2f4ac783e4..2939a21ca74f 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -294,7 +294,7 @@ static void am65_cpsw_nuss_ndo_host_tx_timeout(struct net_device *ndev, txqueue, netif_tx_queue_stopped(netif_txq), jiffies_to_msecs(jiffies - trans_start), - dql_avail(&netif_txq->dql), + netdev_queue_dql_avail(netif_txq), k3_cppi_desc_pool_avail(tx_chn->desc_pool)); if (netif_tx_queue_stopped(netif_txq)) { diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4236debc79a7..cd6fdc2e6948 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3493,6 +3493,16 @@ static inline void netdev_queue_set_dql_min_limit(struct netdev_queue *dev_queue #endif } +static inline int netdev_queue_dql_avail(const struct netdev_queue *txq) +{ +#ifdef CONFIG_BQL + /* Non-BQL migrated drivers will return 0, too. */ + return dql_avail(&txq->dql); +#else + return 0; +#endif +} + /** * netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write * @dev_queue: pointer to transmit queue diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 934fdb977551..cefe0c4bdae3 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -238,12 +238,7 @@ static inline bool qdisc_may_bulk(const struct Qdisc *qdisc) static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq) { -#ifdef CONFIG_BQL - /* Non-BQL migrated drivers will return 0, too. */ - return dql_avail(&txq->dql); -#else - return 0; -#endif + return netdev_queue_dql_avail(txq); } struct Qdisc_class_ops {