[PATCH 2/2] net/mana: optimize completion queue polling by processing a batch at a time
Ferruh Yigit
ferruh.yigit at amd.com
Tue May 2 20:23:22 CEST 2023
On 3/17/2023 11:32 PM, longli at linuxonhyperv.com wrote:
> - while (pkt_received < pkts_n &&
> - gdma_poll_completion_queue(&rxq->gdma_cq, &comp) == 1) {
> - struct mana_rxq_desc *desc;
> - struct mana_rx_comp_oob *oob =
> - (struct mana_rx_comp_oob *)&comp.completion_data[0];
> -
> - if (comp.work_queue_number != rxq->gdma_rq.id) {
> - DRV_LOG(ERR, "rxq comp id mismatch wqid=0x%x rcid=0x%x",
> - comp.work_queue_number, rxq->gdma_rq.id);
> - rxq->stats.errors++;
> - break;
> - }
> + num_pkts = gdma_poll_completion_queue(&rxq->gdma_cq, rxq->gdma_comp_buf, pkts_n);
> + for (uint32_t i = 0; i < num_pkts; i++) {
> + struct mana_rx_comp_oob *oob = (struct mana_rx_comp_oob *)
> + rxq->gdma_comp_buf[i].cqe_data;
> + struct mana_rxq_desc *desc =
> + &rxq->desc_ring[rxq->desc_ring_tail];
Checkpatch complains about defining variable inside for() [1], but as we
are switching to C99 standard, I don't see any reason to prevent this usage.
I can see relevant checkpatch commit mentions about compiler warning [2]
but not sure if that is still valid with C99 switch, I will send a patch
to discuss this on.
[1]
Warning in drivers/net/mana/rx.c:
Declaring a variable inside for()
[2]
43e73483a4b8 ("devtools: forbid variable declaration inside for")
More information about the stable
mailing list