From: Jakub Kicinski <kuba@kernel.org>
To: Haiyang Zhang <haiyangz@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Long Li <longli@microsoft.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Konstantin Taranov <kotaranov@microsoft.com>,
Simon Horman <horms@kernel.org>,
Erni Sri Satya Vennela <ernis@linux.microsoft.com>,
Shradha Gupta <shradhagupta@linux.microsoft.com>,
Saurabh Sengar <ssengar@linux.microsoft.com>,
Aditya Garg <gargaditya@linux.microsoft.com>,
Dipayaan Roy <dipayanroy@linux.microsoft.com>,
Shiraz Saleem <shirazsaleem@microsoft.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
paulros@microsoft.com
Subject: Re: [PATCH V2,net-next, 1/2] net: mana: Add support for coalesced RX packets on CQE
Date: Fri, 9 Jan 2026 17:56:10 -0800 [thread overview]
Message-ID: <20260109175610.0eb69acb@kernel.org> (raw)
In-Reply-To: <1767732407-12389-2-git-send-email-haiyangz@linux.microsoft.com>
On Tue, 6 Jan 2026 12:46:46 -0800 Haiyang Zhang wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
>
> Our NIC can have up to 4 RX packets on 1 CQE. To support this feature,
> check and process the type CQE_RX_COALESCED_4. The default setting is
> disabled, to avoid possible regression on latency.
>
> And add ethtool handler to switch this feature. To turn it on, run:
> ethtool -C <nic> rx-frames 4
> To turn it off:
> ethtool -C <nic> rx-frames 1
Exposing just rx frame count, and only two values is quite unusual.
Please explain in more detail the coalescing logic of the device.
> @@ -2079,14 +2081,10 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq,
> return;
> }
>
> - pktlen = oob->ppi[0].pkt_len;
> -
> - if (pktlen == 0) {
> - /* data packets should never have packetlength of zero */
> - netdev_err(ndev, "RX pkt len=0, rq=%u, cq=%u, rxobj=0x%llx\n",
> - rxq->gdma_id, cq->gdma_id, rxq->rxobj);
> +nextpkt:
> + pktlen = oob->ppi[i].pkt_len;
> + if (pktlen == 0)
> return;
> - }
>
> curr = rxq->buf_index;
> rxbuf_oob = &rxq->rx_oobs[curr];
> @@ -2097,12 +2095,15 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq,
> /* Unsuccessful refill will have old_buf == NULL.
> * In this case, mana_rx_skb() will drop the packet.
> */
> - mana_rx_skb(old_buf, old_fp, oob, rxq);
> + mana_rx_skb(old_buf, old_fp, oob, rxq, i);
>
> drop:
> mana_move_wq_tail(rxq->gdma_rq, rxbuf_oob->wqe_inf.wqe_size_in_bu);
>
> mana_post_pkt_rxq(rxq);
> +
> + if (coalesced && (++i < MANA_RXCOMP_OOB_NUM_PPI))
> + goto nextpkt;
Please code this up as a loop. Using gotos for control flow other than
to jump to error handling epilogues is a poor coding practice (see the
kernel coding style).
> +static int mana_set_coalesce(struct net_device *ndev,
> + struct ethtool_coalesce *ec,
> + struct kernel_ethtool_coalesce *kernel_coal,
> + struct netlink_ext_ack *extack)
> +{
> + struct mana_port_context *apc = netdev_priv(ndev);
> + u8 saved_cqe_coalescing_enable;
> + int err;
> +
> + if (ec->rx_max_coalesced_frames != 1 &&
> + ec->rx_max_coalesced_frames != MANA_RXCOMP_OOB_NUM_PPI) {
> + NL_SET_ERR_MSG_FMT(extack,
> + "rx-frames must be 1 or %u, got %u",
> + MANA_RXCOMP_OOB_NUM_PPI,
> + ec->rx_max_coalesced_frames);
> + return -EINVAL;
> + }
> +
> + saved_cqe_coalescing_enable = apc->cqe_coalescing_enable;
> + apc->cqe_coalescing_enable =
> + ec->rx_max_coalesced_frames == MANA_RXCOMP_OOB_NUM_PPI;
> +
> + if (!apc->port_is_up)
> + return 0;
> +
> + err = mana_config_rss(apc, TRI_STATE_TRUE, false, false);
> +
unnecessary empty line
> + if (err) {
> + netdev_err(ndev, "Set rx-frames to %u failed:%d\n",
> + ec->rx_max_coalesced_frames, err);
> + NL_SET_ERR_MSG_FMT(extack, "Set rx-frames to %u failed",
> + ec->rx_max_coalesced_frames);
These messages are both pointless. If HW communication has failed
presumably there will already be an error in the logs. The extack
gives the user no information they wouldn't already have.
> + apc->cqe_coalescing_enable = saved_cqe_coalescing_enable;
> + }
> +
> + return err;
> +}
next prev parent reply other threads:[~2026-01-10 1:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 20:46 [PATCH V2,net-next, 0/2] net: mana: Add support for coalesced RX packets Haiyang Zhang
2026-01-06 20:46 ` [PATCH V2,net-next, 1/2] net: mana: Add support for coalesced RX packets on CQE Haiyang Zhang
2026-01-06 21:50 ` Long Li
2026-01-10 1:56 ` Jakub Kicinski [this message]
2026-01-12 21:01 ` [EXTERNAL] " Haiyang Zhang
2026-01-13 1:21 ` Jakub Kicinski
2026-01-13 15:09 ` Haiyang Zhang
2026-01-13 15:13 ` Haiyang Zhang
2026-01-14 1:09 ` Jakub Kicinski
2026-01-14 18:27 ` Haiyang Zhang
2026-01-15 2:54 ` Jakub Kicinski
2026-01-15 19:57 ` Haiyang Zhang
2026-01-16 2:14 ` Jakub Kicinski
2026-01-16 16:44 ` Haiyang Zhang
2026-01-17 16:58 ` Jakub Kicinski
2026-01-17 18:01 ` Haiyang Zhang
2026-01-17 22:48 ` Jakub Kicinski
2026-01-18 18:31 ` Haiyang Zhang
2026-02-22 21:32 ` Haiyang Zhang
2026-01-06 20:46 ` [PATCH V2,net-next, 2/2] net: mana: Add ethtool counters for RX CQEs in coalesced type Haiyang Zhang
2026-01-06 22:10 ` Long Li
2026-01-10 1:56 ` Jakub Kicinski
2026-01-12 21:03 ` [EXTERNAL] " Haiyang Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260109175610.0eb69acb@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=dipayanroy@linux.microsoft.com \
--cc=edumazet@google.com \
--cc=ernis@linux.microsoft.com \
--cc=gargaditya@linux.microsoft.com \
--cc=haiyangz@linux.microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=horms@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paulros@microsoft.com \
--cc=shirazsaleem@microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=ssengar@linux.microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox