Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2643418rbb; Wed, 28 Feb 2024 08:07:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGYFZxUt2hiEBkLsIsxs7/PphTk0MDaAxNUkWHu4if5K0VNhBHC4iQ7EmwTeHClS5/yi3qRMQpg89zegYM+9PNO1tNHHpUU4npECRAIA== X-Google-Smtp-Source: AGHT+IGih+kwD+GokK6bUvNYkHHq1wynSjBlfw5yMior0EH01LPfJqyP4kzTqF/DQvD1ZsAYGRub X-Received: by 2002:a05:6102:5f43:b0:470:3a61:8f9 with SMTP id il3-20020a0561025f4300b004703a6108f9mr2224707vsb.14.1709136469462; Wed, 28 Feb 2024 08:07:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709136469; cv=pass; d=google.com; s=arc-20160816; b=Lxh0eDugI8fjL+6M6uEDkzO4MFRndbB7OMkIli9fmAjqflFpXVJJg0gptptqOVwWHU 8ewW1bx1d8TinPFIh7u48rfcQJJRaPVS9uHUsSmwisvaWuFB8p+YsPdmZiVYGvTRTnCK /4mPqgixufYhiO4sWbsLdK6MFc4RVcNjKyvGxgqYLi2SKiZjCZpEg4NOZwpv6iZMBSqO togm2Ugjh5fkUHct0pPtTeGQg1Ad8y0bTRV1vk03p7TrHL3FWKhGah/W5Yxr6wLkk6V0 S30nRUyY+zZj/pLkWVIemyQ4+w7OTrMGk2g94XhFJcR3FsavSDRgAUlCEQwUsPxI9UWW Clnw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dh10-20020a056102578a00b0046d33eceab8si1492272vsb.798.2024.02.28.08.07.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:07:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85321-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85321-linux.lists.archive=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 351131C21B51 for ; Wed, 28 Feb 2024 16:07:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AE4D15D5D8; Wed, 28 Feb 2024 16:07:41 +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 Content-Transfer-Encoding: 8bit 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 { -- 2.39.2