Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: airoha: Add missing cleanup bits in airoha_qdma_cleanup_rx_queue()

In order to properly cleanup hw rx QDMA queues and bring the device to
the initial state, reset rx DMA queue head/tail index. Moreover, reset
queued DMA descriptor fields.

Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Tested-by: Madhur Agrawal <Madhur.Agrawal@airoha.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260327-airoha_qdma_cleanup_rx_queue-fix-v1-1-369d6ab1511a@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Lorenzo Bianconi and committed by
Jakub Kicinski
514aac35 fd63f185

+17 -1
+17 -1
drivers/net/ethernet/airoha/airoha_eth.c
··· 794 794 795 795 static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q) 796 796 { 797 - struct airoha_eth *eth = q->qdma->eth; 797 + struct airoha_qdma *qdma = q->qdma; 798 + struct airoha_eth *eth = qdma->eth; 799 + int qid = q - &qdma->q_rx[0]; 798 800 799 801 while (q->queued) { 800 802 struct airoha_queue_entry *e = &q->entry[q->tail]; 803 + struct airoha_qdma_desc *desc = &q->desc[q->tail]; 801 804 struct page *page = virt_to_head_page(e->buf); 802 805 803 806 dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len, 804 807 page_pool_get_dma_dir(q->page_pool)); 805 808 page_pool_put_full_page(q->page_pool, page, false); 809 + /* Reset DMA descriptor */ 810 + WRITE_ONCE(desc->ctrl, 0); 811 + WRITE_ONCE(desc->addr, 0); 812 + WRITE_ONCE(desc->data, 0); 813 + WRITE_ONCE(desc->msg0, 0); 814 + WRITE_ONCE(desc->msg1, 0); 815 + WRITE_ONCE(desc->msg2, 0); 816 + WRITE_ONCE(desc->msg3, 0); 817 + 806 818 q->tail = (q->tail + 1) % q->ndesc; 807 819 q->queued--; 808 820 } 821 + 822 + q->head = q->tail; 823 + airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK, 824 + FIELD_PREP(RX_RING_DMA_IDX_MASK, q->tail)); 809 825 } 810 826 811 827 static int airoha_qdma_init_rx(struct airoha_qdma *qdma)