Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3797540imm; Fri, 25 May 2018 11:49:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrj4yAarWPyiUvAPcCI3looGG+f2Etn7NXC9rv2bpe7WWEjWZcGr0RIfuJOWCQZ49aufS/h X-Received: by 2002:a62:230b:: with SMTP id j11-v6mr3672688pfj.177.1527274172697; Fri, 25 May 2018 11:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527274172; cv=none; d=google.com; s=arc-20160816; b=DXups1uWoSm/EhtVV6JNCsB69R3QlOPlD328VC8wcmjEg5OEj7v+DspFaXjRHFcCQ7 BdB3HwspC3Z8otAcXLrmSmt7bdNhaHMpn8Jq2cbgZeFi47QAL0NE+UuN+5Xrw6ELaWox WXlX8jnOOqRB0ki5ofU+ANeuMF4jsF8DAm242tSIP3KM7+WOaMXaosPZUhupuPo/wZC6 I7exO+d2jm3+lnGMTKdyrsqx9UvmlNDDEXvsR5TdXJMtaNsJRLQzG+Gd1HWYZZnvSMRv TwklTLoYpyQ9Rj22Fz2AKzlOMfzrEq93p7gSbA4+5Oxw2jih7kljXY0txdYJ+l7U8UA7 LJ7A== 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=uJyrVHDa5n8Mwj01A9YPk9lzu1gcbBG36wdBdYLjeb0=; b=GAvMGculL5RocJwUajk1B8OeIWNtqdyuQLwRA5Z9x047F3hgM6p+o7o22lKqCbBxyK QkmEcEHafc61TWfwBXA9Pw5mMrOawNFaBDe+udrd6wRgFgGUf3fo6eVuR+SaW+gtwLNq wHmvVyQZk5crQVqZ3wfhHIO85IZ+xvTMXVWgRCXRYFV335MCN+gLOc6X+yH8p5mkAHlj 0uvGfwFmUz/Z8H/yXuFrpe/FvajJEJCu3bMP3A8MapOISlTq7liNffiLNGd9JJtP6z3X 1Z34AjblIQJNJdmst1xtuvR9VLjrnbATeHLY/P8V4o+nYRkdFalTWdmFioHto4SI+cAR E9yQ== 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 p11-v6si23681148pfh.249.2018.05.25.11.48.48; Fri, 25 May 2018 11:49:32 -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 S968070AbeEYSpA (ORCPT + 99 others); Fri, 25 May 2018 14:45:00 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:60905 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S967835AbeEYSoy (ORCPT ); Fri, 25 May 2018 14:44:54 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B3AC85737ED4B; Sat, 26 May 2018 02:44:51 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Sat, 26 May 2018 02:44:45 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 08/12] net: hns3: Removes unnecessary check when clearing TX/RX rings Date: Fri, 25 May 2018 19:43:03 +0100 Message-ID: <20180525184307.36288-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180525184307.36288-1-salil.mehta@huawei.com> References: <20180525184307.36288-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang Our code will ensure that hns3_clear_tx_ring is not used to cleared RX rings and hns3_clear_rx_ring is not used to cleared TX rings. So the ring type check is unnecessary. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index d1ef104..4c13c52 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3217,9 +3217,6 @@ static void hns3_recover_hw_addr(struct net_device *ndev) static void hns3_clear_tx_ring(struct hns3_enet_ring *ring) { - if (!HNAE3_IS_TX_RING(ring)) - return; - while (ring->next_to_clean != ring->next_to_use) { hns3_free_buffer_detach(ring, ring->next_to_clean); ring_ptr_move_fw(ring, next_to_clean); @@ -3228,9 +3225,6 @@ static void hns3_clear_tx_ring(struct hns3_enet_ring *ring) static void hns3_clear_rx_ring(struct hns3_enet_ring *ring) { - if (HNAE3_IS_TX_RING(ring)) - return; - while (ring->next_to_use != ring->next_to_clean) { /* When a buffer is not reused, it's memory has been * freed in hns3_handle_rx_bd or will be freed by -- 2.7.4