Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4332282img; Tue, 26 Mar 2019 07:29:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsKpVDC1+5PEkPuyIZ4Xkw5ZOzaEDn6Ct83VLZJudIqbStU1IB8XXn7JlNBpMWHPPpswD4 X-Received: by 2002:a17:902:b217:: with SMTP id t23mr32003875plr.184.1553610587553; Tue, 26 Mar 2019 07:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553610587; cv=none; d=google.com; s=arc-20160816; b=AAH440y5P00ZhuN6qPvd7toBUm5OGcgs5O28akHkESYA6AfjjamzU/lF0KEOO+Y1jv QUp8OnTe1U5KVx7wg78UfmsTar+aJNb30x/eEYJ40QGYI1akFEqKYl/ZwNu46e21gyp8 KGvY1Dy3tzJ2CSKXVb3UskZIlXdTRVo0kffGNTvyEzSFG9sN4jrPLfIsehvUAEvGAUQw 3qiefNKbJZ3v2gBcruXbiafGgnfFP09hMWnFJYgdnCSATU4CEX+Ak4y6k2cYl088D3RI HgHOTOCc9F4BJ1hHNRMvg+/C5rUWUtJxpG1S7xuXXe0I33iYEa66puqVJIkjxH0D+Y+x zR5g== 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=Tm+ERH+7z9YVvdCMtLpFkYagfK8GYTmUb4NMEDy5TJr6a9JL9AaRxXrggNfJrX9MCz Jp+JV1Mphj7QZhzZusNQRpxP6nq/IiZ21EeX+Q5egSR+6uWNeqMW35UsN+ttRn6pO7nN P6Q5zaNCAaRH5TyhUARfiqXBb2G+4MbFFHLdwBqVaBMCRIsiIJFDGEIaibcIoDYCig9H wmu2eENqA9Xs5t0bu6irW1oY3hjc1I0NLY6SOGBBq4TwUs5RaDnUtlV9IZyD19cevqyj v3clD6ZmsfPdgDWkBYEfAymNokOV3FHEY02YSKJYOdojbrE5ozk2+xS/6AS1PJKsZQxQ TIEA== 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 t19si16635192plr.402.2019.03.26.07.29.32; Tue, 26 Mar 2019 07:29:47 -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 S1731850AbfCZO2d (ORCPT + 99 others); Tue, 26 Mar 2019 10:28:33 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:27787 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731475AbfCZO2U (ORCPT ); Tue, 26 Mar 2019 10:28:20 -0400 X-UUID: 5f85ea2dd4ba4c28b3777424eeff3904-20190326 X-UUID: 5f85ea2dd4ba4c28b3777424eeff3904-20190326 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1194350895; Tue, 26 Mar 2019 22:28:14 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 26 Mar 2019 22:28:13 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 26 Mar 2019 22:28:13 +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 , , , , Ryder Lee Subject: [PATCH 2/4] mt76: add unlikely() for dma_mapping_error() check Date: Tue, 26 Mar 2019 22:28:08 +0800 Message-ID: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain 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