[PATCH net] net: airoha: Move entries to queue head in case of DMA mapping failure in airoha_dev_xmit()

Lorenzo Bianconi lorenzo at kernel.org
Tue Apr 28 07:27:48 PDT 2026


> On 4/28/26 10:44 AM, Lorenzo Bianconi wrote:
> > In order to respect the original descriptor order and avoid any
> > potential IOMMU fault or memory corruption, move pending queue entries
> > to the head of hw queue tx_list if the DMA mapping of current inflight
> > packet fails in airoha_dev_xmit routine.
> > 
> > Fixes: 3f47e67dff1f7 ("net: airoha: Add the capability to consume out-of-order DMA tx descriptors")
> > Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>
> > ---
> >  drivers/net/ethernet/airoha/airoha_eth.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> > index 5effb4a4ae84..82018a085e46 100644
> > --- a/drivers/net/ethernet/airoha/airoha_eth.c
> > +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> > @@ -2123,14 +2123,14 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
> >  	return NETDEV_TX_OK;
> >  
> >  error_unmap:
> > -	while (!list_empty(&tx_list)) {
> > +	list_for_each_entry(e, &tx_list, list) {
> >  		e = list_first_entry(&tx_list, struct airoha_queue_entry,
> >  				     list);
> 
> Coccinelle says:
> 
> +/srv/nipa-builds-contest/testing/wt-cocci/drivers/net/ethernet/airoha/airoha_eth.c:2123:1-20:
> iterator with update on line 2124
> 
> I guess you should additionally drop the statement above.

ack, sorry. I will fix it in v2.

Regards,
Lorenzo

> 
> /P
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20260428/f36b5453/attachment.sig>


More information about the Linux-mediatek mailing list