Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7115709imm; Wed, 27 Jun 2018 20:45:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3Q9wa/wJNJND7img/ddl/2JDjthDc1QyM9PR7Y0Fw/79xUAlm3rYtqW6V9CiwI5h/ogfV X-Received: by 2002:a62:6941:: with SMTP id e62-v6mr8523095pfc.56.1530157512326; Wed, 27 Jun 2018 20:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530157512; cv=none; d=google.com; s=arc-20160816; b=DMaokUT7EMcCsJscIczsbJw+fqwQuw9PLEb1jzdbU/BmI2Zua6vZNBgpSc+mC9HHXy IH09scMSxt0fD2IAkq6xIsFiBAlZRR/oxo9ZdlaLyjIJqZQSwU5OBqA0ByEotDWdXKBr k4NhI2wn+NcFmLcL+tZz+lNpfSJW11HQDzMYGCTgvfQonCCgEnPyP3OMrkLK7WnScv5F l5bSOjju9KnC8UcrQ8BrU+QqDlc1e9fQY8tSjBu77OKJgEPvtpQPM6+tTFearIcKHzJC ZCSL3qQjk9iF8h9AwGR6vs2xmPaAuak+k00WSf3KZyxjWU+1lXzvuOW1/E6QeqHe3PeU 8Wrw== 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:arc-authentication-results; bh=0Nsg5D55+OFPym0OpzEDuTJunbT1zH39UqVqLIal5XE=; b=fxRF7lLIawq0ZBimZ4oCD5iJ718Cq7p/i6rOyeXMh1y3utHkHYEXdjeJgFoSydSYBL wIjAlvk99H8krWWT3BMC1TzaJg3RE47qO8ej6U8tP2+T6+pWYvpbFG8y/kVeTC8Vxchz 2O2qcCg8AJUPxvfWkl/sVRN0UWadApBY6qYzBdb6ZxPUB1MJRJx73A1/eAx9cGt2tFmG m1ARNcqCeXGiAsyMXx8JW3SodrBgAcB1j28qvHRCfN7Jx4o84crPCZFeZVw/8RJ55Cgq SlOdeSNjqTnCmy4kvqgf2YcWMs0mTctV00dp35Lt/oz+E4nhX/J3qjFKpofwfcZWzrBY 4+YQ== 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 x14-v6si2021301pgt.402.2018.06.27.20.44.57; Wed, 27 Jun 2018 20:45:12 -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 S932962AbeF1Dnu (ORCPT + 99 others); Wed, 27 Jun 2018 23:43:50 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8741 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753024AbeF1DlM (ORCPT ); Wed, 27 Jun 2018 23:41:12 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 53FB5B1248E14; Thu, 28 Jun 2018 11:40:58 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Thu, 28 Jun 2018 11:40:53 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH net-next 05/11] net: hns3: add unlikely for error check Date: Thu, 28 Jun 2018 12:12:23 +0800 Message-ID: <1530159149-122284-6-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530159149-122284-1-git-send-email-lipeng321@huawei.com> References: <1530159149-122284-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first bd of a packet is invalid and invalid ring head for tx IRQ is not offen, they may occur when there is error, Add unlikely for error check branch is better for performance. Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 99bb6a8..1a68952 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1917,7 +1917,7 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) if (is_ring_empty(ring) || head == ring->next_to_clean) return true; /* no data to poll */ - if (!is_valid_clean_head(ring, head)) { + if (unlikely(!is_valid_clean_head(ring, head))) { netdev_err(netdev, "wrong head (%d, %d-%d)\n", head, ring->next_to_use, ring->next_to_clean); @@ -2174,7 +2174,7 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, bd_base_info = le32_to_cpu(desc->rx.bd_base_info); /* Check valid BD */ - if (!hnae_get_bit(bd_base_info, HNS3_RXD_VLD_B)) + if (unlikely(!hnae_get_bit(bd_base_info, HNS3_RXD_VLD_B))) return -EFAULT; va = (unsigned char *)desc_cb->buf + desc_cb->page_offset; -- 2.9.3