Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp168178pxj; Wed, 26 May 2021 19:27:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx8Y78O+p1PuGMBLyYDmJYTm0EjkqsGmbPG90a9w3Vxm2eX0mbghE1GGgWtBVz1+LCebDs X-Received: by 2002:aa7:d843:: with SMTP id f3mr1466680eds.270.1622082451787; Wed, 26 May 2021 19:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622082451; cv=none; d=google.com; s=arc-20160816; b=w49uCrNG32BX9hLndIvDE18zOb1mC6jgXvWM03Y+cT//3e4uf1e0NmyAK+Z7HVGkQ/ qRJo2229p+ru4A8pKmRNec1duEVWAMhbWHXRflYHmkWWZ0143MvG9dTksFzn2h4q4bn9 QbhhCuEKoLYgrtOj6qHFn5BPx+eyx9MVn+30R9/erGrjIMoG0csBdAQyG166VGrjrY6h 9GrFmz/BJvyWKil2HtfRRjPRifdBruGuDOHCwV4CRdRIFmo8vbbdqIFp6BUsPO6bIRmL pK4kk5+6v8ZX3mdD9cXlfW4vxPspdN79jI7NIcZwHzRJpD6r4eF/Qv9+mnh1Hd1i5euK deZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2cln4ujeGIVw7b7cL07+Nm4rReuL4SV6EvBWDagHwuI=; b=sHj5wA6J1faf69JDtet55MuLErFkhW5WrNqzcb1t7u09sF3MrmjQdtomTv+gP2wISl yWsZG4v1VrF4NoWi4YmtAjUVW4FH8ghwVIs8ZqwZAho3SQ64UlxjCVmeuiFhD8g6vlJz mTF1SUMRak5gbDlm1FDK6/lalxVjnADdJTOHYITu/eMYZAFe+avfZM0oGsDQauiYLxtJ iApxqidD1U7Zw2nMz7v/SYBCp2UQvTxpLyBSH+tRiaJcSK/R6zVmhS1hWqi55lRPIUwO pCwm3zvVjxzrMl9R6AkIyUrHPvEbgtpQftF9mUg25X8B6JxbokscDesnbTsmn/gDqgBT itJA== 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 f6si686023edt.368.2021.05.26.19.27.06; Wed, 26 May 2021 19:27:31 -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 S234099AbhE0CCZ (ORCPT + 99 others); Wed, 26 May 2021 22:02:25 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6644 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhE0CCU (ORCPT ); Wed, 26 May 2021 22:02:20 -0400 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fr9v52czhz1CF0C; Thu, 27 May 2021 09:57:53 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 27 May 2021 10:00:45 +0800 Received: from [127.0.0.1] (10.69.26.252) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 27 May 2021 10:00:45 +0800 Subject: Re: [RFC net-next 2/4] ethtool: extend coalesce setting uAPI with CQE mode To: Jakub Kicinski CC: , , , , , , , , , , , , , , , , , , , , , , , , , , References: <1622021262-8881-1-git-send-email-tanhuazhong@huawei.com> <1622021262-8881-3-git-send-email-tanhuazhong@huawei.com> <20210526170033.62c8e6eb@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Huazhong Tan Message-ID: Date: Thu, 27 May 2021 10:00:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210526170033.62c8e6eb@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.69.26.252] X-ClientProxiedBy: dggeme709-chm.china.huawei.com (10.1.199.105) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2021/5/27 8:00, Jakub Kicinski wrote: > On Wed, 26 May 2021 17:27:40 +0800 Huazhong Tan wrote: >> 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 'ETHTOOL_A_COALESCE_USE_CQE_TX' and >> 'ETHTOOL_A_COALESCE_USE_CQE_RX' attribute and expand struct >> kernel_ethtool_coalesce with use_cqe_mode_tx and use_cqe_mode_rx, >> then these parameters can be accessed by ethtool netlink coalesce >> uAPI. >> >> Signed-off-by: Huazhong Tan >> diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst >> index 25131df..975394e 100644 >> --- a/Documentation/networking/ethtool-netlink.rst >> +++ b/Documentation/networking/ethtool-netlink.rst >> @@ -937,6 +937,8 @@ 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 Tx CQE mode >> + ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool Rx CQE mode >> =========================================== ====== ======================= >> >> Attributes are only included in reply if their value is not zero or the >> @@ -975,6 +977,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 Tx CQE mode >> + ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool Rx CQE mode >> =========================================== ====== ======================= >> >> Request is rejected if it attributes declared as unsupported by driver (i.e. > You need to thoroughly document the semantics. Can you point us to > which drivers/devices implement similar modes of operation (if they > exist we need to make sure semantics match)? Ok, will complement the semantics. Currently, only mlx5 provides a interface to update this mode through ethtool priv-flag. other drivers like broadcom and ice just use a fixed EQE and do not have update interface. >> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h >> index 1030540..9d0a386 100644 >> --- a/include/linux/ethtool.h >> +++ b/include/linux/ethtool.h >> @@ -179,6 +179,8 @@ __ethtool_get_link_ksettings(struct net_device *dev, >> >> struct kernel_ethtool_coalesce { >> struct ethtool_coalesce base; >> + __u32 use_cqe_mode_tx; >> + __u32 use_cqe_mode_rx; > No __ in front, this is not a user space structure. > Why not bool or a bitfield? bool is enough, __u32 is used here to be consistent with fields in struct ethtool_coalesce. This seems unnecessary? >> }; >> >> /** >> @@ -216,6 +223,8 @@ const struct nla_policy ethnl_coalesce_set_policy[] = { >> [ETHTOOL_A_COALESCE_TX_USECS_HIGH] = { .type = NLA_U32 }, >> [ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH] = { .type = NLA_U32 }, >> [ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL] = { .type = NLA_U32 }, >> + [ETHTOOL_A_COALESCE_USE_CQE_MODE_TX] = { .type = NLA_U8 }, >> + [ETHTOOL_A_COALESCE_USE_CQE_MODE_RX] = { .type = NLA_U8 }, > This needs a policy to make sure values are <= 1. > > .