[PATCH v6 2/2] net/af_xdp: Refactor af_xdp_tx_zc
Stephen Hemminger
stephen at networkplumber.org
Mon Feb 24 20:25:34 CET 2025
On Sat, 1 Feb 2025 00:10:21 +0100
Ariel Otilibili <ariel.otilibili at 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;
More information about the stable
mailing list