Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1415045pxy; Sun, 15 Aug 2021 20:44:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze/tZpVae2d6/+TySj4X0/8zc/FZezg0wD0QZXL01P45uUwn7zckbvPi3vYuqo4eji688Z X-Received: by 2002:a92:6e08:: with SMTP id j8mr10179132ilc.239.1629085443960; Sun, 15 Aug 2021 20:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629085443; cv=none; d=google.com; s=arc-20160816; b=AH7xkaVI6pE1OQQieOx6pecp/nYMydaBUvbDjpQnlxLskWS1ohDMTm07lJAPdsfER1 MmtxdfjfM4xiGWRSX7/VHp9oIR17K5QunXpDo2BxXmYIHVbEBdyOQ3/dlPBFiPIY/L6q GFlPkzGgb6PT/5330J577SXUAh/yGvlOcuSUzh0p4T+2zeVLdXCXymDtqzIMuEyDuuZr 6+362ob4NSSgjss4KZL6yMuZ4tux/YUXU5N/IL+WLrx3eSOkzttgFqUf9jFM920H2kj4 Z7tohaX78tEFIthW9Z+0MVRYHRySrkxQVcObZmgW6BPk8WNKw7iE19GZcHsJb1iRIHUY WxRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=gLX8b5l+dHNadjOvEGxrQjdJKd4tTad+RlzrlCuHR4Y=; b=dZgTLOCy+dzsm69UIDE3Qg/PPjxnjV/O1eUnjmdkJ0nvpHYrvf2EUtk3UeVAOxyK/C u77vgo1vsCDqHRcJGvrYNnAtQp8vXvHELE7EzuEyz7E5C4PJYlZClIiRqNH/nBsdiJ2Y ZAymI79bfmplKkqg7vMWRl0MwQpnjbD1ZRW+ov4pXHuRxd1d8ouvaEpiSH2cQBM0cn98 3GAppXVbyPRIoEyqRliF6hG/Q/oPplFDM3RrO7sBJ0soQZ8XDEKM/5YQH2gzRndxc1eK eP25PP+4aLRKqHSG0IVM6zi8qLx/zTGaL81TFzVbknV3NQXNxDIl1sx50IfsmcV3jUkO R8OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si14646321iov.62.2021.08.15.20.43.50; Sun, 15 Aug 2021 20:44:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232203AbhHPDoM (ORCPT + 99 others); Sun, 15 Aug 2021 23:44:12 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:8416 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231680AbhHPDoI (ORCPT ); Sun, 15 Aug 2021 23:44:08 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Gp0K14mQ7z87qB; Mon, 16 Aug 2021 11:39:33 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 11:43:34 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 11:43:34 +0800 From: Yufeng Mo To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC V4 net-next 1/4] ethtool: add two coalesce attributes for CQE mode Date: Mon, 16 Aug 2021 11:39:43 +0800 Message-ID: <1629085186-8622-2-git-send-email-moyufeng@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629085186-8622-1-git-send-email-moyufeng@huawei.com> References: <1629085186-8622-1-git-send-email-moyufeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Currently, there many drivers who support CQE mode configuration, some configure it as a fixed when initialized, some provide an interface to change it by ethtool private flags. In order make it more generic, add two new 'ETHTOOL_A_COALESCE_USE_CQE_TX' and 'ETHTOOL_A_COALESCE_USE_CQE_RX' coalesce attributes, then these parameters can be accessed by ethtool netlink coalesce uAPI. Signed-off-by: Yufeng Mo Signed-off-by: Huazhong Tan Signed-off-by: Jakub Kicinski --- Documentation/networking/ethtool-netlink.rst | 15 +++++++++++++++ include/linux/ethtool.h | 6 +++++- include/uapi/linux/ethtool_netlink.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index c86628e..5f62d27 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -939,12 +939,25 @@ Kernel response contents: ``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx ``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval + ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx + ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx =========================================== ====== ======================= Attributes are only included in reply if their value is not zero or the corresponding bit in ``ethtool_ops::supported_coalesce_params`` is set (i.e. they are declared as supported by driver). +Timer reset mode (``ETHTOOL_A_COALESCE_USE_CQE_TX`` and +``ETHTOOL_A_COALESCE_USE_CQE_RX``) controls the interaction between packet +arrival and the various time based delay parameters. By default timers are +expected to limit the max delay between any packet arrival/departure and a +corresponding interrupt. In this mode timer should be started by packet +arrival (sometimes delivery of previous interrupt) and reset when interrupt +is delivered. +Setting the appropriate attribute to 1 will enable ``CQE`` mode, where +each packet event resets the timer. In this mode timer is used to force +the interrupt if queue goes idle, while busy queues depend on the packet +limit to trigger interrupts. COALESCE_SET ============ @@ -977,6 +990,8 @@ Request contents: ``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx ``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval + ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx + ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx =========================================== ====== ======================= Request is rejected if it attributes declared as unsupported by driver (i.e. diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 4711b96..bad4c7a 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -211,7 +211,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, #define ETHTOOL_COALESCE_TX_USECS_HIGH BIT(19) #define ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH BIT(20) #define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21) -#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(21, 0) +#define ETHTOOL_COALESCE_USE_CQE_RX BIT(22) +#define ETHTOOL_COALESCE_USE_CQE_TX BIT(23) +#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(23, 0) #define ETHTOOL_COALESCE_USECS \ (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS) @@ -237,6 +239,8 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \ ETHTOOL_COALESCE_PKT_RATE_LOW | ETHTOOL_COALESCE_PKT_RATE_HIGH | \ ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL) +#define ETHTOOL_COALESCE_USE_CQE \ + (ETHTOOL_COALESCE_USE_CQE_RX | ETHTOOL_COALESCE_USE_CQE_TX) #define ETHTOOL_STAT_NOT_SET (~0ULL) diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index b3b9371..5545f1c 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -377,6 +377,8 @@ enum { ETHTOOL_A_COALESCE_TX_USECS_HIGH, /* u32 */ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH, /* u32 */ ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */ + ETHTOOL_A_COALESCE_USE_CQE_MODE_TX, /* u8 */ + ETHTOOL_A_COALESCE_USE_CQE_MODE_RX, /* u8 */ /* add new constants above here */ __ETHTOOL_A_COALESCE_CNT, -- 2.8.1