Commit 6edf0747 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: add unlikely() for dma_mapping_error() check

In the tx/rx fastpath, the funciton dma_map_single() rarely fails.
This adds unlikely() optimization to this error check conditional.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 04b8e659
...@@ -272,7 +272,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid, ...@@ -272,7 +272,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid,
addr = dma_map_single(dev->dev, skb->data, skb->len, addr = dma_map_single(dev->dev, skb->data, skb->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (dma_mapping_error(dev->dev, addr)) if (unlikely(dma_mapping_error(dev->dev, addr)))
return -ENOMEM; return -ENOMEM;
buf.addr = addr; buf.addr = addr;
...@@ -315,7 +315,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid, ...@@ -315,7 +315,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
len = skb_headlen(skb); len = skb_headlen(skb);
addr = dma_map_single(dev->dev, skb->data, len, DMA_TO_DEVICE); addr = dma_map_single(dev->dev, skb->data, len, DMA_TO_DEVICE);
if (dma_mapping_error(dev->dev, addr)) if (unlikely(dma_mapping_error(dev->dev, addr)))
goto free; goto free;
tx_info.buf[n].addr = t->dma_addr; tx_info.buf[n].addr = t->dma_addr;
...@@ -329,7 +329,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid, ...@@ -329,7 +329,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
addr = dma_map_single(dev->dev, iter->data, iter->len, addr = dma_map_single(dev->dev, iter->data, iter->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (dma_mapping_error(dev->dev, addr)) if (unlikely(dma_mapping_error(dev->dev, addr)))
goto unmap; goto unmap;
tx_info.buf[n].addr = addr; tx_info.buf[n].addr = addr;
...@@ -386,7 +386,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -386,7 +386,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
break; break;
addr = dma_map_single(dev->dev, buf, len, DMA_FROM_DEVICE); addr = dma_map_single(dev->dev, buf, len, DMA_FROM_DEVICE);
if (dma_mapping_error(dev->dev, addr)) { if (unlikely(dma_mapping_error(dev->dev, addr))) {
skb_free_frag(buf); skb_free_frag(buf);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment