From patchwork Wed Mar 10 16:10:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent MAILHOL X-Patchwork-Id: 397210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DACAC4360C for ; Wed, 10 Mar 2021 16:12:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E987964EB3 for ; Wed, 10 Mar 2021 16:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233455AbhCJQLj (ORCPT ); Wed, 10 Mar 2021 11:11:39 -0500 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:55054 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233414AbhCJQLY (ORCPT ); Wed, 10 Mar 2021 11:11:24 -0500 Received: from localhost.localdomain ([153.202.107.157]) by mwinf5d63 with ME id egAx2400D3PnFJp03gBFtw; Wed, 10 Mar 2021 17:11:20 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Wed, 10 Mar 2021 17:11:20 +0100 X-ME-IP: 153.202.107.157 From: Vincent Mailhol To: Marc Kleine-Budde , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Eric Dumazet , Dave Taht Cc: Peter Zijlstra , Randy Dunlap , "David S . Miller" , Jakub Kicinski , Vincent Mailhol Subject: [RFC PATCH v2 1/1] netdev: add netdev_queue_set_dql_min_limit() Date: Thu, 11 Mar 2021 01:10:51 +0900 Message-Id: <20210310161051.23826-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310161051.23826-1-mailhol.vincent@wanadoo.fr> References: <20210310161051.23826-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a function to set the dynamic queue limit minimum value. This function is to be used by network drivers which are able to prove, at least through empirical tests on several environment (with other applications, heavy context switching, virtualization...), that they constantly reach better performances with a specific predefined dql.min_limit value with no noticeable latency impact. Signed-off-by: Vincent Mailhol --- include/linux/netdevice.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ddf4cfc12615..7fceea9a202d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3389,6 +3389,23 @@ netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue) return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN; } +/** + * netdev_queue_set_dql_min_limit - set dql minimum limit + * @dev_queue: pointer to transmit queue + * @min_limit: dql minimum limit + * + * Forces xmit_more() to return true until the minimum threshold + * defined by @min_limit is reached. Warning: to be use with care, + * misuse will impact the latency. + */ +static inline void netdev_queue_set_dql_min_limit(struct netdev_queue *q, + unsigned int min_limit) +{ +#ifdef CONFIG_BQL + q->dql.min_limit = min_limit; +#endif +} + /** * netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write * @dev_queue: pointer to transmit queue