On Sat,  1 Feb 2025 00:10:21 +0100
Ariel Otilibili <ariel.otilib...@6wind.com> wrote:

> @ -559,21 +582,12 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, 
> uint16_t nb_pkts)
>               mbuf = bufs[i];
>  
>               if (mbuf->pool == umem->mb_pool) {
> -                     if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {
> +                     if (!(desc = reserve_and_fill(txq, mbuf, umem))) {
>                               kick_tx(txq, cq);
> -                             if (!xsk_ring_prod__reserve(&txq->tx, 1,
> -                                                         &idx_tx))
> +                             if (!(desc = reserve_and_fill(txq, mbuf, umem)))
>                                       goto out;
>                       }

Please avoid doing assignment in a conditional statement, can be error prone.
Surprised checkpatch doesn't complain about it.

Better as:
                        desc = reserve_and_fill(txq, mbuf, umem);
                        if (!desc) {
                                kick_tx(txq, cq);
                                desc = reserve_and_fill(txq, mbuf, umem);
                                if (!desc)
                                        goto out;

Reply via email to