Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1143756yba; Sun, 31 Mar 2019 23:57:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7jmpR6bI3tEhamJwIMndyFQWmMTMt+NYTqJCS0Lz0j0t6nH5uFHkqTnSdY4Z+GoZ7u+hU X-Received: by 2002:a17:902:b210:: with SMTP id t16mr39065581plr.84.1554101850371; Sun, 31 Mar 2019 23:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554101850; cv=none; d=google.com; s=arc-20160816; b=o0oCPxIhL3MDv/mXGRWSKK2jewb8UOToRD5/A2Omh581OOIDSR+T7Ax083ulb5JOS8 4Rgga1QFTDnsxVDo4Us6AT9fcOb7XgC5ahw5ZnNB2E1i6TkD6+1eWgdHgwkcA4+SNB3y QYwAXufgnRCRNFEAzqo1HNjBPr4EAogdy7EreGKUOH4J3EYgiJoNNfIAkTLiFoRJlMYo p67jYKEp5yx3Rd5mTAsJ0XxUjoPSy4bhVioznL++r+g6YJXa73+WA+gHddaVcYnaJAIK ssXX/TEdgFu6eQpIDJFYg0Z0Pi4nShSXwzEFwOhbsOjtHccet1NflEyzHPfjfntb1fM1 zSww== 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=mxpIsUzNWobrCXWPupvmeh/LmXNiVqD3QsgHYUZRMjomMSci4Dm5X2J+5xKYaHoWA0 EhkuCR0kmdy1NjgrrWH5VeK8Xu1YqankEEvK+BXByWTdrNkQf6yoOlbRVovCkbMYonuQ RqZCHBIXTvKU7to7jbj2Nswaz4f+CBdLqAQlmJvMtwwq3N1nSxE9A7qiLO9kqoE3auBs l6KxwxyYpnIJJP0pzpyIG/h7RwQcMLT0h9bTVB58Xkbhg0hjtlXoHrOjjfDRjt+7exXJ geKS4XTWgsnmlBkp2tDuDBbcuNip9GfWDByDajo7vCOjuV71NbxnPY2sebLkn+qGviPA b8Tw== 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 l40si8569758plb.164.2019.03.31.23.57.12; Sun, 31 Mar 2019 23:57:30 -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 S1731819AbfDAG4g (ORCPT + 99 others); Mon, 1 Apr 2019 02:56:36 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:51576 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725867AbfDAG4g (ORCPT ); Mon, 1 Apr 2019 02:56:36 -0400 X-UUID: 42525c55dd284c4bae42b98f6b8bb3a8-20190401 X-UUID: 42525c55dd284c4bae42b98f6b8bb3a8-20190401 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 50836532; Mon, 01 Apr 2019 14:56:29 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 1 Apr 2019 14:56:27 +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; Mon, 1 Apr 2019 14:56:27 +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 v2 2/4] mt76: add unlikely() for dma_mapping_error() check Date: Mon, 1 Apr 2019 14:56:23 +0800 Message-ID: <3a9f54e6a5bbbdab2a3129b1b541a951e8b695fa.1554100584.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-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