linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryder Lee <ryder.lee@mediatek.com>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
	Felix Fietkau <nbd@nbd.name>
Cc: Roy Luo <royluo@google.com>, Sean Wang <sean.wang@mediatek.com>,
	Nelson Chang <nelson.chang@mediatek.com>,
	YF Luo <yf.luo@mediatek.com>, Kai Lin <kai.lin@mediatek.com>,
	Rorscha Yang <rorscha.yang@mediatek.com>,
	Kyle Lee <kyle.lee@mediatek.com>,
	Miller Shen <miller.shen@mediatek.com>,
	Haipin Liang <haipin.liang@mediatek.com>,
	<linux-wireless@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>
Subject: [PATCH 2/4] mt76: add unlikely() for dma_mapping_error() check
Date: Tue, 26 Mar 2019 22:28:08 +0800	[thread overview]
Message-ID: <ebd07347cc26a2e7dd7d7e1e1d213d80fc9d0940.1553607739.git.ryder.lee@mediatek.com> (raw)
In-Reply-To: <cover.1553607739.git.ryder.lee@mediatek.com>

In the tx/rx fastpath, the funciton dma_map_single() rarely fails.
This adds unlikely() optimization to this error check conditional.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 8a4b935..6f3ef09 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -272,7 +272,7 @@
 
 	addr = dma_map_single(dev->dev, skb->data, skb->len,
 			      DMA_TO_DEVICE);
-	if (dma_mapping_error(dev->dev, addr))
+	if (unlikely(dma_mapping_error(dev->dev, addr)))
 		return -ENOMEM;
 
 	buf.addr = addr;
@@ -315,7 +315,7 @@
 
 	len = skb_headlen(skb);
 	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;
 
 	tx_info.buf[n].addr = t->dma_addr;
@@ -329,7 +329,7 @@
 
 		addr = dma_map_single(dev->dev, iter->data, iter->len,
 				      DMA_TO_DEVICE);
-		if (dma_mapping_error(dev->dev, addr))
+		if (unlikely(dma_mapping_error(dev->dev, addr)))
 			goto unmap;
 
 		tx_info.buf[n].addr = addr;
@@ -386,7 +386,7 @@
 			break;
 
 		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);
 			break;
 		}
-- 
1.9.1


  parent reply	other threads:[~2019-03-26 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 14:28 [PATCH 0/4] Add support for MediaTek MT7615 wireless chipsets Ryder Lee
2019-03-26 14:28 ` [PATCH 1/4] mt76: add mac80211 driver for MT7615 PCIe-based chipsets Ryder Lee
2019-03-30  6:08   ` Kalle Valo
2019-03-31  8:52     ` Ryder Lee
2019-04-01  9:46     ` Stanislaw Gruszka
2019-03-26 14:28 ` Ryder Lee [this message]
2019-03-26 14:28 ` [PATCH 3/4] mt76: use macro for sn and seq_ctrl conversion Ryder Lee
2019-03-26 14:28 ` [PATCH 4/4] MAINTAINERS: update entry for mt76 wireless driver Ryder Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ebd07347cc26a2e7dd7d7e1e1d213d80fc9d0940.1553607739.git.ryder.lee@mediatek.com \
    --to=ryder.lee@mediatek.com \
    --cc=haipin.liang@mediatek.com \
    --cc=kai.lin@mediatek.com \
    --cc=kyle.lee@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=miller.shen@mediatek.com \
    --cc=nbd@nbd.name \
    --cc=nelson.chang@mediatek.com \
    --cc=rorscha.yang@mediatek.com \
    --cc=royluo@google.com \
    --cc=sean.wang@mediatek.com \
    --cc=yf.luo@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).