Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp10042yba; Mon, 1 Apr 2019 00:17:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqy239Zqjxfl5k6P3sOJk7oenoW40GmeFCbx2ic6aIK3OzOouPFQ5l63GnZ6PZOFS/TODDVm X-Received: by 2002:a17:902:266:: with SMTP id 93mr63756043plc.161.1554103079106; Mon, 01 Apr 2019 00:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554103079; cv=none; d=google.com; s=arc-20160816; b=FkNT9mY7FgFpsRXSgJtv2qvgPchZAVGPZoEVgVZ94sKW1erO+0eq3akquYZdvlVaH2 VGRfp8FJ/D8k5QpLiqldNKJc33eohMnuP42U2UUpc2Jv96IoMvraiXQFP2oJEkzvwVyI nSm2UmiaGb29AWV9nu2AD4Vj8YIxIg6L1ZvhpJZmT1t2Revp94vp9dvE9500jhbRfecs AEBuLF7Z8FHuzaceKU8+anczOIS/+z1rbWs1n40BuYx/P1m23TdMsMM45avkPlDMGzlq YFlIrEhrzbBpg8CUiYTWz/XES2/6iZEPrC1CsjmI7tt7G3UBDSYi+vrjqRqFlJLgdwd5 vKTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=9T7cBgncgC1/YMggqy0KBOSnnd/Na0ur35hR14988r0=; b=tk2YC4Z+vSTdG2MvO07xkeK0+NpGsK4ytiBnkizbyvEP6+cenVl8u+ytmKPUG9aLJc U4AYllmNxb3O2W2Jl5adg9+GoZvGNruVl1AJIl3hAatWLgwivcs11+5p5OaHGsEmqm6Z URXVPSxxUJ0npz8TdalyAStRVpsjuSag2nAl4UdQCs1BV05QExdqFFFbNU67MbJAiJ3U RuMGSawzBOTz03wjj808LS+ZMob77hxqzyk0AodxjSoRvIyvEuLtVqQWXOBaRCmNdZou E0XJJ1lH4VpelLCBH7m2mdGfT/YlMpjO0yK8hwuUo9Fk0QS+ooXikZfL9GjfEbs7K3Vc Ttmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l33si8327645pld.309.2019.04.01.00.17.43; Mon, 01 Apr 2019 00:17:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731941AbfDAHQ4 (ORCPT + 99 others); Mon, 1 Apr 2019 03:16:56 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:14710 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731160AbfDAHQz (ORCPT ); Mon, 1 Apr 2019 03:16:55 -0400 X-UUID: 36b3c62d12604a38a66536433460e54f-20190401 X-UUID: 36b3c62d12604a38a66536433460e54f-20190401 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1279938848; Mon, 01 Apr 2019 15:16:48 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 1 Apr 2019 15:16:46 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 1 Apr 2019 15:16:45 +0800 From: Ryder Lee To: Lorenzo Bianconi , Felix Fietkau CC: Roy Luo , Sean Wang , Nelson Chang , YF Luo , Kai Lin , Rorscha Yang , Kyle Lee , Miller Shen , Haipin Liang , KL Huang , YH chen , , , , Ryder Lee Subject: [PATCH v3 2/4] mt76: add unlikely() for dma_mapping_error() check Date: Mon, 1 Apr 2019 15:16:42 +0800 Message-ID: <87b458bb8525f3fe31cc96fef71df8542a01e1ab.1554102584.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 31F39429F309C95AA95E268EB98C07749231EDFB59A6AB140917A7A3AA7BD1232000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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