Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A671C156F45 for ; Tue, 24 Feb 2026 12:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771934493; cv=none; b=bXveUCmHPxfCotm2nxVi21IDtkhVFgGVfT0Ss1zj+v7+jmcp3kFCnqQ2FzMD1eExxIep82nlEjIKWR31PJ8B62QregmhR80S/Pz0ADuyPKPVgF5N4ycvszW/MLZRku1A+VqVCIg+EvQVCvvz9Bjbg9VQUXqEV0eMs3i1/0UlUsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771934493; c=relaxed/simple; bh=qVcOp5MnvlONbLG06msjRU6TJXzRsaX/t8tfbP70eys=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YlZ/e9dEnU/ro8jkbH7E7cJgHLUu2HE6E3Mbx/6nvx9imt+taZ8/xQ3zI0VmprOPmA228lFy/gEPa0LjIjAIpG/3eZikZtMP7oWyf4Dqp7tKMmXWLep7YtGF1fd9OVUQ6NAsCv1RY8e9HSyNPQFaavZmBehg0U1JKIa16iKNYTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I4YlLsYD; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I4YlLsYD" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b8fbb24a9a9so925721766b.0 for ; Tue, 24 Feb 2026 04:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771934490; x=1772539290; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bZ4fv5w72iR4alZnfS3RK7xFl8sWnyZEZWYM2yXruBI=; b=I4YlLsYD+ULwXxaAN/TuLC3cw1aZVB1RzMfspIr3KDxN6eFuOQ/2T6UR2/IEU4CK4y tCtjRfMzLR1s8t2+AtbyQ23UoYq/NYZuLtNkYJYwtlvVC8j/Vp41yz3Q6b2eUuULBnaL eH1/e2m69eIrAxKan2k+53YsMO6sgUimgwBYEAtUpj5eeGA1kfM/oHr5f7iOfkti1wsj GFpHZPOBdZRcTVc4IiaOOqNmpotROj2tgmvfpmrWR34bd0t7DMalY6vPjHNX2GWVCGPg +7lDyuwzB0wMxbcBgfM82i+cLJwegFjMucbWQ9fdG/eeS/BQmeEyvRkKoksnV95+oTux z85g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771934490; x=1772539290; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bZ4fv5w72iR4alZnfS3RK7xFl8sWnyZEZWYM2yXruBI=; b=dvp0+OcLhfkZRYixLlsSzljmLrhBdeNeS6/KcBG4VOzonaY36ApGjkbtMIWbhoZ3pL fUzG/1X8MbuY9oDqOiuRKsZEALd7EC+jOrzuEWhOQKKvKtED7qQQK5aALTLe64W9Ezis /TO5v4VbpbaNzGl/+DoaHqpk3gpV8uWI44VSp3i1/kpOGwQOCcf5xGPnZn/bKWb4VBL/ Ns/hIrxnSgEt9ItHYU0a8vryp9g9JnDBLyEQXLk1aDpJ67uxyKWonAm1uGTWqARMRWTm cMG9LLCDYFEAWW6JJmnIHLLvcLtRLMIAxkdn+GfnttIMDTSWA12tm22tN2jKlul2Vhen GZjg== X-Forwarded-Encrypted: i=1; AJvYcCWbk3+m0s2nAwxzKVSWrNYU+4tgB8LsZFGOtTIEOr9xgGdcyS+1MI8VCpVDGIxomWNMi8ddxeHob5BrPFQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwQOBKbo+ZaI646EbQIVgbmeEnVUCQlS/Buo148gEyMbw7Ega8K Je6gmXF7xRjWdf3eIgLbuvAaKQ53v9L7J6/r1YmYbeo3F+HhtRfUiC3Ktaa+7g== X-Gm-Gg: ATEYQzz1jA6sftKU6R5/ZCh6dFEX9NxFJ6bOppwxnu7Q18tkLr4VOi2dhoSHLRloHxB tJgcgf0qGbzvdW82xNx6cwDZ0ar7lPao1PhbxOiFlx6RrLhspkLlDpCq5DUQ9zi5JHOxoJt3j3C z/WLfQhy3qHUZwlwMARtnQbqJecc3F6mJx7HVNWi6rHUeemPZd3BvcSbf2tDX1/sF6k0bkIwR2B Vj4wug49dLEQxMRTn3Ceih/zXFZ/N0MY2LaOqo+dXC3r3CesmTIJO4KrOQpCtJmQ6Zi4xmmH8XS Glfy2GrXsN2eT2pz0+wF8Nd0QNRT1DY6eE4sJEMp/nm4L4Z4esHh7+Rog0qbPgytx9rhUD+6ZmY b9ZUkr1cDrKKsUxs+lQdovqnMykIp5bkD3wC1pII3bZadWuP5TsbYAkz8xiq7GDPT6Mt066Sttz Ti+0FGy8kkzQhkFHYmdRh9Qg4bpbGk3D+W8eZN4eT89hLnakg= X-Received: by 2002:adf:e3c3:0:b0:439:8bb9:db03 with SMTP id ffacd0b85a97d-4398bb9dedemr632589f8f.3.1771928510821; Tue, 24 Feb 2026 02:21:50 -0800 (PST) Received: from [10.221.199.249] ([165.85.126.46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970c09897sm26186806f8f.17.2026.02.24.02.21.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Feb 2026 02:21:49 -0800 (PST) Message-ID: <9ed3ade5-717d-4f03-ac13-40614a0f093c@gmail.com> Date: Tue, 24 Feb 2026 12:21:47 +0200 Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] net: ethtool: add COALESCE_RX_CQE_FRAMES/NSECS parameters To: Haiyang Zhang , linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, Andrew Lunn , Jakub Kicinski , Donald Hunter , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , "Kory Maincent (Dent Project)" , Gal Pressman , Oleksij Rempel , Vadim Fedorenko , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: haiyangz@microsoft.com, paulros@microsoft.com References: <20260222212328.736628-1-haiyangz@linux.microsoft.com> Content-Language: en-US From: Tariq Toukan In-Reply-To: <20260222212328.736628-1-haiyangz@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 22/02/2026 23:23, Haiyang Zhang wrote: > From: Haiyang Zhang > > Add two parameters for drivers supporting Rx CQE Coalescing. > > ETHTOOL_A_COALESCE_RX_CQE_FRAMES: > Maximum number of frames that can be coalesced into a CQE. > > ETHTOOL_A_COALESCE_RX_CQE_NSECS: > Time out value in nanoseconds after the first packet arrival in a > coalesced CQE to be sent. > > Signed-off-by: Haiyang Zhang > --- > Documentation/netlink/specs/ethtool.yaml | 8 ++++++++ > Documentation/networking/ethtool-netlink.rst | 10 ++++++++++ > include/linux/ethtool.h | 6 +++++- > include/uapi/linux/ethtool_netlink_generated.h | 2 ++ > net/ethtool/coalesce.c | 14 +++++++++++++- > 5 files changed, 38 insertions(+), 2 deletions(-) > > diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml > index 0a2d2343f79a..951d98f6bb12 100644 > --- a/Documentation/netlink/specs/ethtool.yaml > +++ b/Documentation/netlink/specs/ethtool.yaml > @@ -861,6 +861,12 @@ attribute-sets: > name: tx-profile > type: nest > nested-attributes: profile > + - > + name: rx-cqe-frames > + type: u32 > + - > + name: rx-cqe-nsecs > + type: u32 > > - > name: pause-stat > @@ -2244,6 +2250,8 @@ operations: > - tx-aggr-time-usecs > - rx-profile > - tx-profile > + - rx-cqe-frames > + - rx-cqe-nsecs > dump: *coalesce-get-op > - > name: coalesce-set > diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst > index af56c304cef4..a3e78b69fd07 100644 > --- a/Documentation/networking/ethtool-netlink.rst > +++ b/Documentation/networking/ethtool-netlink.rst > @@ -1072,6 +1072,8 @@ Kernel response contents: > ``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` u32 time (us), aggr, Tx > ``ETHTOOL_A_COALESCE_RX_PROFILE`` nested profile of DIM, Rx > ``ETHTOOL_A_COALESCE_TX_PROFILE`` nested profile of DIM, Tx > + ``ETHTOOL_A_COALESCE_RX_CQE_FRAMES`` u32 max packets, Rx CQE > + ``ETHTOOL_A_COALESCE_RX_CQE_NSECS`` u32 delay (ns), Rx CQE > =========================================== ====== ======================= > > Attributes are only included in reply if their value is not zero or the > @@ -1105,6 +1107,12 @@ well with frequent small-sized URBs transmissions. > to DIM parameters, see `Generic Network Dynamic Interrupt Moderation (Net DIM) > `_. > > +Rx CQE coalescing allows multiple received packets to be coalesced into a single > +Completion Queue Entry (CQE). ``ETHTOOL_A_COALESCE_RX_CQE_FRAMES`` describes the > +maximum number of frames that can be coalesced into a CQE. > +``ETHTOOL_A_COALESCE_RX_CQE_NSECS`` describes max time in nanoseconds after the > +first packet arrival in a coalesced CQE to be sent. > + I am trying to understand how generic this feature/API is. Can you please elaborate on the feature you want to configure here? A single CQE to describe several packets? What is the price? What per-packet information/hw offloads do you lose in the process? For comparison, in mlx5 we have RX CQE compression, which can be applied on multiple near-identical completions that share/match several fields. Still, there is a per-packet mini-cqe with distinctive per-packet fields like csum. > COALESCE_SET > ============ > > @@ -1143,6 +1151,8 @@ Request contents: > ``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` u32 time (us), aggr, Tx > ``ETHTOOL_A_COALESCE_RX_PROFILE`` nested profile of DIM, Rx > ``ETHTOOL_A_COALESCE_TX_PROFILE`` nested profile of DIM, Tx > + ``ETHTOOL_A_COALESCE_RX_CQE_FRAMES`` u32 max packets, Rx CQE > + ``ETHTOOL_A_COALESCE_RX_CQE_NSECS`` u32 delay (ns), Rx CQE > =========================================== ====== ======================= > > 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 798abec67a1b..25ccd2d5d4dc 100644 > --- a/include/linux/ethtool.h > +++ b/include/linux/ethtool.h > @@ -332,6 +332,8 @@ struct kernel_ethtool_coalesce { > u32 tx_aggr_max_bytes; > u32 tx_aggr_max_frames; > u32 tx_aggr_time_usecs; > + u32 rx_cqe_frames; > + u32 rx_cqe_nsecs; > }; > > /** > @@ -380,7 +382,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, > #define ETHTOOL_COALESCE_TX_AGGR_TIME_USECS BIT(26) > #define ETHTOOL_COALESCE_RX_PROFILE BIT(27) > #define ETHTOOL_COALESCE_TX_PROFILE BIT(28) > -#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(28, 0) > +#define ETHTOOL_COALESCE_RX_CQE_FRAMES BIT(29) > +#define ETHTOOL_COALESCE_RX_CQE_NSECS BIT(30) > +#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(30, 0) > > #define ETHTOOL_COALESCE_USECS \ > (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS) > diff --git a/include/uapi/linux/ethtool_netlink_generated.h b/include/uapi/linux/ethtool_netlink_generated.h > index 556a0c834df5..efc6e4ade77b 100644 > --- a/include/uapi/linux/ethtool_netlink_generated.h > +++ b/include/uapi/linux/ethtool_netlink_generated.h > @@ -371,6 +371,8 @@ enum { > ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS, > ETHTOOL_A_COALESCE_RX_PROFILE, > ETHTOOL_A_COALESCE_TX_PROFILE, > + ETHTOOL_A_COALESCE_RX_CQE_FRAMES, > + ETHTOOL_A_COALESCE_RX_CQE_NSECS, > > __ETHTOOL_A_COALESCE_CNT, > ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1) > diff --git a/net/ethtool/coalesce.c b/net/ethtool/coalesce.c > index 3e18ca1ccc5e..349bb02c517a 100644 > --- a/net/ethtool/coalesce.c > +++ b/net/ethtool/coalesce.c > @@ -118,6 +118,8 @@ static int coalesce_reply_size(const struct ethnl_req_info *req_base, > nla_total_size(sizeof(u32)) + /* _TX_AGGR_MAX_BYTES */ > nla_total_size(sizeof(u32)) + /* _TX_AGGR_MAX_FRAMES */ > nla_total_size(sizeof(u32)) + /* _TX_AGGR_TIME_USECS */ > + nla_total_size(sizeof(u32)) + /* _RX_CQE_FRAMES */ > + nla_total_size(sizeof(u32)) + /* _RX_CQE_NSECS */ > total_modersz * 2; /* _{R,T}X_PROFILE */ > } > > @@ -269,7 +271,11 @@ static int coalesce_fill_reply(struct sk_buff *skb, > coalesce_put_u32(skb, ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES, > kcoal->tx_aggr_max_frames, supported) || > coalesce_put_u32(skb, ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS, > - kcoal->tx_aggr_time_usecs, supported)) > + kcoal->tx_aggr_time_usecs, supported) || > + coalesce_put_u32(skb, ETHTOOL_A_COALESCE_RX_CQE_FRAMES, > + kcoal->rx_cqe_frames, supported) || > + coalesce_put_u32(skb, ETHTOOL_A_COALESCE_RX_CQE_NSECS, > + kcoal->rx_cqe_nsecs, supported)) > return -EMSGSIZE; > > if (!req_base->dev || !req_base->dev->irq_moder) > @@ -338,6 +344,8 @@ const struct nla_policy ethnl_coalesce_set_policy[] = { > [ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES] = { .type = NLA_U32 }, > [ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES] = { .type = NLA_U32 }, > [ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS] = { .type = NLA_U32 }, > + [ETHTOOL_A_COALESCE_RX_CQE_FRAMES] = { .type = NLA_U32 }, > + [ETHTOOL_A_COALESCE_RX_CQE_NSECS] = { .type = NLA_U32 }, > [ETHTOOL_A_COALESCE_RX_PROFILE] = > NLA_POLICY_NESTED(coalesce_profile_policy), > [ETHTOOL_A_COALESCE_TX_PROFILE] = > @@ -570,6 +578,10 @@ __ethnl_set_coalesce(struct ethnl_req_info *req_info, struct genl_info *info, > tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES], &mod); > ethnl_update_u32(&kernel_coalesce.tx_aggr_time_usecs, > tb[ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS], &mod); > + ethnl_update_u32(&kernel_coalesce.rx_cqe_frames, > + tb[ETHTOOL_A_COALESCE_RX_CQE_FRAMES], &mod); > + ethnl_update_u32(&kernel_coalesce.rx_cqe_nsecs, > + tb[ETHTOOL_A_COALESCE_RX_CQE_NSECS], &mod); > > if (dev->irq_moder && dev->irq_moder->profile_flags & DIM_PROFILE_RX) { > ret = ethnl_update_profile(dev, &dev->irq_moder->rx_profile,