Re: [PATCH net-next 1/2] net: airoha: Add the capability to consume out-of-order DMA tx descriptors

Jakub Kicinski
2025-11-05T02:30:36Z

On Mon, 03 Nov 2025 11:27:55 +0100 Lorenzo Bianconi wrote:
> + __list_del_entry(&e->list);
> + list_add_tail(&e->list, &tx_list);

list_move_tail()

> + e->skb = i ? NULL : skb;
> + e->dma_addr = addr;
> + e->dma_len = len;
> +
> + e = list_first_entry(&q->tx_list, struct airoha_queue_entry,
> + list);
> + index = e - q->entry;
>
> val = FIELD_PREP(QDMA_DESC_LEN_MASK, len);
> if (i < nr_frags - 1)

> @@ -2029,10 +2020,14 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
> return NETDEV_TX_OK;
>
> error_unmap:
> - for (i--; i >= 0; i--) {
> - index = (q->head + i) % q->ndesc;
> - dma_unmap_single(dev->dev.parent, q->entry[index].dma_addr,
> - q->entry[index].dma_len, DMA_TO_DEVICE);
> + while (!list_empty(&tx_list)) {
> + e = list_first_entry(&tx_list, struct airoha_queue_entry,
> + list);
> + __list_del_entry(&e->list);
> + dma_unmap_single(dev->dev.parent, e->dma_addr, e->dma_len,
> + DMA_TO_DEVICE);
> + e->dma_addr = 0;
> + list_add_tail(&e->list, &q->tx_list);

and here