From patchwork Fri May 25 18:43:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136979 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3943341lji; Fri, 25 May 2018 11:45:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtwKfzQrHfZkrGt9IJqyTKJ9xImXfFlwWAQLN5ODTi5zdd+192KhWrPENzfhtFqbKUWjCb X-Received: by 2002:a17:902:7283:: with SMTP id d3-v6mr3822853pll.192.1527273902551; Fri, 25 May 2018 11:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527273902; cv=none; d=google.com; s=arc-20160816; b=ovIIXd+6azHQdhgpp3W1B7dVYYBLj9Cgxop7iQRyvjRKHffIvDRY8SfNbjmeEV9u97 jhut2Ns+Xyis/EafaZUyAfYxuEnOzv+ty74EMdHsdHMxEE0+7uVE4/Ra2TlPZI3XSHnk 2kIVvCcXhDrg8UAPKEYcbhq/UWM9vn32mjq6mjwwHbHHqZcyM8Q2DXB6lnNXed+73lHl jbmKlotFsf6LQmvaZb/IVcDCqEmAZmrp3RipygW+uDvyPFJyzO2ZW8iTCAgLL94QocK0 Q7EoAx8NOveRk/h540gz57b3ZsoUmjgxQ9csoE7AtSd8OAdfsb5rt8fsJ1gUeORIJp6i PzTw== 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 5-v6si24142171pfi.285.2018.05.25.11.45.02; Fri, 25 May 2018 11:45:02 -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 S968077AbeEYSpA (ORCPT + 30 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 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(-) -- 2.7.4 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