> -----Original Message-----
> From: Haiyang Zhang <[email protected]>
> Sent: Friday, March 6, 2026 6:19 PM
> To: [email protected]; [email protected]; KY Srinivasan
> <[email protected]>; Haiyang Zhang <[email protected]>; Wei Liu
> <[email protected]>; Dexuan Cui <[email protected]>; Long Li
> <[email protected]>; Andrew Lunn <[email protected]>; David S.
> Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Konstantin
> Taranov <[email protected]>; Simon Horman <[email protected]>; Erni
> Sri Satya Vennela <[email protected]>; Shradha Gupta
> <[email protected]>; Dipayaan Roy
> <[email protected]>; Shiraz Saleem
> <[email protected]>; Kees Cook <[email protected]>; Subbaraya
> Sundeep <[email protected]>; Breno Leitao <[email protected]>; Aditya
> Garg <[email protected]>; [email protected];
> [email protected]
> Cc: Paul Rosswurm <[email protected]>
> Subject: [PATCH net-next,V3, 2/3] net: mana: Add support for RX CQE
> Coalescing
> 
> From: Haiyang Zhang <[email protected]>

> @@ -2112,13 +2122,16 @@ static void mana_process_rx_cqe(struct mana_rxq
> *rxq, struct mana_cq *cq,
>               ++ndev->stats.rx_dropped;
>               rxbuf_oob = &rxq->rx_oobs[rxq->buf_index];
>               netdev_warn_once(ndev, "Dropped a truncated packet\n");
> -             goto drop;
> 
> -     case CQE_RX_COALESCED_4:
> -             netdev_err(ndev, "RX coalescing is unsupported\n");
> -             apc->eth_stats.rx_coalesced_err++;
> +             mana_move_wq_tail(rxq->gdma_rq,
> +                               rxbuf_oob->wqe_inf.wqe_size_in_bu);
> +             mana_post_pkt_rxq(rxq);
>               return;
> 
> +     case CQE_RX_COALESCED_4:
> +             coalesced = true;
> +             break;
> +
>       case CQE_RX_OBJECT_FENCE:
>               complete(&rxq->fence_event);
>               return;
> @@ -2130,30 +2143,36 @@ static void mana_process_rx_cqe(struct mana_rxq
> *rxq, struct mana_cq *cq,
>               return;
>       }
> 
> -     pktlen = oob->ppi[0].pkt_len;
> +     for (i = 0; i < MANA_RXCOMP_OOB_NUM_PPI; i++) {
> +             pktlen = oob->ppi[i].pkt_len;
> +             if (pktlen == 0) {
> +                     if (i == 0)
> +                             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;
> +             }
> 
> -     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);
> -             return;
> -     }
> +             curr = rxq->buf_index;
> +             rxbuf_oob = &rxq->rx_oobs[curr];
> +             WARN_ON_ONCE(rxbuf_oob->wqe_inf.wqe_size_in_bu != 1);
> 
> -     curr = rxq->buf_index;
> -     rxbuf_oob = &rxq->rx_oobs[curr];
> -     WARN_ON_ONCE(rxbuf_oob->wqe_inf.wqe_size_in_bu != 1);
> +             mana_refill_rx_oob(dev, rxq, rxbuf_oob, &old_buf, &old_fp);
> 
> -     mana_refill_rx_oob(dev, rxq, rxbuf_oob, &old_buf, &old_fp);
> +             /* 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, i);
> 
> -     /* 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_move_wq_tail(rxq->gdma_rq,
> +                               rxbuf_oob->wqe_inf.wqe_size_in_bu);

I will fix this pointed out by AI review:

> The comment says "Unsuccessful refill will have old_buf == NULL" but this is
> only true for the first iteration.
> Should old_buf be set to NULL at the top of the loop, before calling
> mana_refill_rx_oob()?




Reply via email to