On Mon, Mar 09, 2026 at 02:20:45PM -0700, Haiyang Zhang wrote:
> From: Haiyang Zhang <[email protected]>
> 
> For RX CQEs with type CQE_RX_COALESCED_4, to measure the coalescing
> efficiency, add counters to count how many contains 2, 3, 4 packets
> respectively.
> Also, add a counter for the error case of first packet with length == 0.
> 
> Reviewed-by: Long Li <[email protected]>
> Signed-off-by: Haiyang Zhang <[email protected]>
> ---
>  drivers/net/ethernet/microsoft/mana/mana_en.c | 21 ++++++++++++++++++-
>  .../ethernet/microsoft/mana/mana_ethtool.c    | 15 +++++++++++--
>  include/net/mana/mana.h                       |  9 +++++---
>  3 files changed, 39 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c 
> b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index fa30046dcd3d..85f7a56d0d90 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -2148,11 +2148,23 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, 
> struct mana_cq *cq,
>               old_buf = NULL;
>               pktlen = oob->ppi[i].pkt_len;
>               if (pktlen == 0) {
> -                     if (i == 0)
> +                     /* Collect coalesced CQE count based on packets 
> processed.
> +                      * Coalesced CQEs have at least 2 packets, so index is 
> i - 2.
> +                      */
> +                     if (i > 1) {
> +                             u64_stats_update_begin(&rxq->stats.syncp);
> +                             rxq->stats.coalesced_cqe[i - 2]++;
> +                             u64_stats_update_end(&rxq->stats.syncp);
> +                     } else if (i == 0) {
> +                             /* Error case stat */
> +                             u64_stats_update_begin(&rxq->stats.syncp);
> +                             rxq->stats.pkt_len0_err++;
> +                             u64_stats_update_end(&rxq->stats.syncp);
>                               netdev_err_once(
>                                       ndev,
>                                       "RX pkt len=0, rq=%u, cq=%u, 
> rxobj=0x%llx\n",
>                                       rxq->gdma_id, cq->gdma_id, rxq->rxobj);
> +                     }
>                       break;

Hi Haiyang Zhang,

As there is a break here, can the accounting logic above be move out of the
loop, and merged with the "Coalesced CQE with all 4 packets" accounting
logic that is already there?

As is, accounting seems split between and slightly duplicated in two locations.


>               }
>  
> @@ -2175,6 +2187,13 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, 
> struct mana_cq *cq,
>               if (!coalesced)
>                       break;
>       }
> +
> +     /* Coalesced CQE with all 4 packets */
> +     if (coalesced && i == MANA_RXCOMP_OOB_NUM_PPI) {
> +             u64_stats_update_begin(&rxq->stats.syncp);
> +             rxq->stats.coalesced_cqe[MANA_RXCOMP_OOB_NUM_PPI - 2]++;
> +             u64_stats_update_end(&rxq->stats.syncp);
> +     }
>  }
>  
>  static void mana_poll_rx_cq(struct mana_cq *cq)

...

Reply via email to