From patchwork Wed Sep 26 18:28:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147629 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1059747lji; Wed, 26 Sep 2018 11:30:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV60HJ/pFeGDTWvD3j2e7ePpAF6scHXqR1HBpSjbL2GL0euJkB7mGYAFY+gTAyKv8ybLuXUjQ X-Received: by 2002:a62:565c:: with SMTP id k89-v6mr7472331pfb.212.1537986658628; Wed, 26 Sep 2018 11:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986658; cv=none; d=google.com; s=arc-20160816; b=Wg550UTFM62Xe7yw0TywFVOEuIR4XjvhtMTSwnF65xdHoCuCNjtdTku8hNAMHfpbW2 ZzAOx6ZhdEKWPY6e/2il8p94g4KijYeoUeQfEwxNN4BGob75CTeEx6MhILoSBw9l0TFP tkV6miSZT86qP6mYmNV2vvwO6UsJ6JeP+LxHj39DVE5JM+mbLYQwZfTLDBBLEwdlF9YF izc93YgBmHMAUomwT9dO1q04vE2BckkWtGyPeCaGdA/2oLJEdYy8DqLXrPDIMJZ1saWu 9qWALfwbNBxBLYpqYcG4Ixf527GQXbGQXgf3QrsViRejNY2yD8I9G21MGMSf2WJ8JtJZ aPhA== 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=T8irkHPrH/y4SuGmpxDbfNoqesYQmhlHJkKql0JDsjQ=; b=lkvpmGJrjxHJmkAw9HFG3yI9qeOb/tWmoHIrxkNKoC/uVvJFPOW5++aVfIcgAK4HTO qDvq8RjU2uBiwTGu3DWNL48/Om3ZSozZ9U9/CAeDdJpwd2b/RY5uFRrfRqehro/q99do P50MQeRJbFzXZ45YzIRMPDR5O1WYNvjIU5jCb8Rq9K3PwPG3VXFNeJ1/nQlwKRwf/NiS z/OuUmItTBEPNqv+vmTTdbx97JMPbCS6uE5Wf7pLn2X4iu18lQLPvCftSBnHkqSKKWnU TSHNiVzpfdVBQK94onFi5EsB2AEZhFj5G9K8KC+vhSU/x+SLEUXoRbVlYusjNyoSqvFT PJGQ== 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 b7-v6si5462274pfj.245.2018.09.26.11.30.58; Wed, 26 Sep 2018 11:30:58 -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 S1728998AbeI0ApE (ORCPT + 32 others); Wed, 26 Sep 2018 20:45:04 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13129 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728674AbeI0Anr (ORCPT ); Wed, 26 Sep 2018 20:43:47 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 01117F8B83319; Thu, 27 Sep 2018 02:29:29 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:23 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 01/10] net: hns3: Add support for sctp checksum offload Date: Wed, 26 Sep 2018 19:28:31 +0100 Message-ID: <20180926182840.28392-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li This patch adds support for sctp checksum offload. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 5a4773a..3fc3822 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1740,7 +1740,7 @@ static void hns3_set_default_feature(struct net_device *netdev) NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_SCTP_CRC; netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; @@ -1752,21 +1752,21 @@ static void hns3_set_default_feature(struct net_device *netdev) NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_SCTP_CRC; netdev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_SCTP_CRC; netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_SCTP_CRC; if (pdev->revision != 0x20) netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; From patchwork Wed Sep 26 18:28:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147619 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058463lji; Wed, 26 Sep 2018 11:29:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV62VaR8FJbWQqCa0NOs3Vi1NPog+fAO6p5w3QGso4pD4f/urerwJlPED+5Xt15rSG64XzF5/ X-Received: by 2002:a63:ed07:: with SMTP id d7-v6mr6837153pgi.429.1537986579724; Wed, 26 Sep 2018 11:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986579; cv=none; d=google.com; s=arc-20160816; b=wDno59FaW2GJOyRNwz7hC5D9IQWub61FfN4tBBmSa7C89rVTpwpC5bHEuPLjqVm8yo aRACyOl/ICYyYx04wWSF4ryiowbfUgWjD+v+NZ/x6IJ1nY4Ze2j+okUh1ZuYz9HodVFw s+z6HoNmrgZtW72IKRCQFLrw5qdwLemiNHA4lQv9+sgfRN1oUiAxLUhoIn6C2/w+ylGw PJakQbObGBaDCXFCAsLftTmwsAombxueUjlu+mQIDJIi+1YFlfZ0ChKpos/tCPEPVuKI xPC8xRPbwxa4dnHox7gwvihkzTxp6MBb3FV3XQGycM9VC3FgZ3UiruOTkhGPLv/oUmdU LwmA== 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=rmZAfzboCiMI917y0IVfGHuiz7ZxpQMEOrolVhfeRBg=; b=jPc5ApVgOfQB+8Fpz13WkpUmBqP8nRuiFuQs25bmVzt0R0PFowgp075OOMf2E9u9K5 daTtr9oHB1h3+J4aC4FXXre65tMCmz1auJXKe4zk8Btxljhc3VR1jq5iT1BpE4Rt/un3 4+ovA2Y8dtrPT3ay3O9+qPXujev3CgIXL9xiud5fTPJLJW49Tpdv4BbQeSspR+FXu4l6 YoPzIwabvGUapJHuKKRROBwykha+aBA5lbKpBxCqTNQ0+3+NC9oadpYXS+cOw15yB+Wx pDyb2UMJCmCiST0GsyFRXtb/NyeF07af6oL8Db2AWv+5P7Gkr5NPBLMALsbnYYK1uDhN tcZQ== 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 r10-v6si5810002pgg.259.2018.09.26.11.29.39; Wed, 26 Sep 2018 11:29:39 -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 S1728781AbeI0Anv (ORCPT + 32 others); Wed, 26 Sep 2018 20:43:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13152 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728498AbeI0Anu (ORCPT ); Wed, 26 Sep 2018 20:43:50 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9F320FD698320; Thu, 27 Sep 2018 02:29:33 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:26 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 02/10] net: hns3: Set extra mac address of pause param for HW Date: Wed, 26 Sep 2018 19:28:32 +0100 Message-ID: <20180926182840.28392-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 The extra mac address of pause param is used to do double check for pause frame. This patch set it to HW. If we do not do that, pfc pause frame will be transferred protocol stack when normal flow control mode is enabled. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 4 ++++ 2 files changed, 5 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index 00bb394..ab7280d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -193,6 +193,7 @@ static int hclge_pause_param_cfg(struct hclge_dev *hdev, const u8 *addr, hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_MAC_PARA, false); ether_addr_copy(pause_param->mac_addr, addr); + ether_addr_copy(pause_param->mac_addr_extra, addr); pause_param->pause_trans_gap = pause_trans_gap; pause_param->pause_trans_time = cpu_to_le16(pause_trans_time); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index dd4c194..e1568b8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -106,6 +106,10 @@ struct hclge_cfg_pause_param_cmd { u8 pause_trans_gap; u8 rsvd; __le16 pause_trans_time; + u8 rsvd1[6]; + /* extra mac address to do double check for pause frame */ + u8 mac_addr_extra[ETH_ALEN]; + u16 rsvd2; }; struct hclge_pfc_stats_cmd { From patchwork Wed Sep 26 18:28:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147627 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1059421lji; Wed, 26 Sep 2018 11:30:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV63lbkfNQ1e6e7Qe+DTn7HRnqXAWwYgDMUp2bIUH5xiaiS5P3gn60ow9Zl3mmueTEHdOnwdi X-Received: by 2002:a63:2348:: with SMTP id u8-v6mr6890378pgm.122.1537986639792; Wed, 26 Sep 2018 11:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986639; cv=none; d=google.com; s=arc-20160816; b=Pfr01VxEpZXKd9UkQCkFkL4G7TYN4N1JoxVgJpKNyMev0tcmfgdaC0/elVAoEtpH2u j9nGoHp1oIDoAXQZkgKSJEoQjJydL1KwE3jNK65/nGtR/vJTqnSVC3/bOAhWWsDAEZq9 6nyApAjPwCE4lQ/I6Yez7TPY8QSkP4W8Rw5ENVPvalS5qSzddoi1YlVMe+jCdGbkL6UP DF83VJ+npNZ4uLctrcDtNUAnZ8egMOt+mCMGmDOIpyyVW5FLW62u8bGQ0A746+gVxFeN +6zIOXR7BizOa5zY/7liCK3gqBTjKPuxd/9nPiQaba726LezUhvzyHg3gBfMNC9+F1WM H1Bg== 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=IwG5v/p4EHbHm2SQxMWEe+8I8BqR15+egvLDqEcj3YY=; b=e2I1SKPV4ACRTxlVXSfFOcITKFzl00jrv18oFllblIwFFc9sSnz5Xezs6n+pyoK8t8 pvNB9ryvOKfwDhfBh5aZYc6x0raMI9bChLDMVVjbsNOuJO7c08V2258fmYbQojZkblFK 9ZgthsSE+GT6keAAsuh4ELtD/a/AAhbdIPslQKtSqk58jln2GLikPoGRqvwgtAbA8zlw f4ocWf8pMiZc3DcgjlvZGcD5HkgRT8IZc0Ug6fPQ5EuQMX+GYgpEyPknyOUBQtatOpsZ r/VRI+Ne8B951YGDy/VxxzxTeXH6C76fsFKRQK3v1p65wM/gVOyDU/97hb04mLb+l8k6 f9bA== 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 x8-v6si6095226pgh.454.2018.09.26.11.30.39; Wed, 26 Sep 2018 11:30:39 -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 S1728749AbeI0Anu (ORCPT + 32 others); Wed, 26 Sep 2018 20:43:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:43143 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728221AbeI0Anu (ORCPT ); Wed, 26 Sep 2018 20:43:50 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9E183DE1F4CE4; Thu, 27 Sep 2018 02:29:33 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:29 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 03/10] net: hns3: Rename loop mode Date: Wed, 26 Sep 2018 19:28:33 +0100 Message-ID: <20180926182840.28392-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 loop mode includes mac loop, serdes loop and phy loop. Not all of them are related with mac. This patch corrects their names. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 8 ++++---- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 12 ++++++------ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 564afd4..03d7878 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -84,10 +84,10 @@ struct hnae3_queue { /*hnae3 loop mode*/ enum hnae3_loop { - HNAE3_MAC_INTER_LOOP_MAC, - HNAE3_MAC_INTER_LOOP_SERDES, - HNAE3_MAC_INTER_LOOP_PHY, - HNAE3_MAC_LOOP_NONE, + HNAE3_LOOP_MAC, + HNAE3_LOOP_SERDES, + HNAE3_LOOP_PHY, + HNAE3_LOOP_NONE, }; enum hnae3_client_type { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 8803a87..86587cf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -78,8 +78,8 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) return -EOPNOTSUPP; switch (loop) { - case HNAE3_MAC_INTER_LOOP_SERDES: - case HNAE3_MAC_INTER_LOOP_MAC: + case HNAE3_LOOP_SERDES: + case HNAE3_LOOP_MAC: ret = h->ae_algo->ops->set_loopback(h, loop, en); break; default: @@ -286,12 +286,12 @@ static void hns3_self_test(struct net_device *ndev, if (eth_test->flags != ETH_TEST_FL_OFFLINE) return; - st_param[HNAE3_MAC_INTER_LOOP_MAC][0] = HNAE3_MAC_INTER_LOOP_MAC; - st_param[HNAE3_MAC_INTER_LOOP_MAC][1] = + st_param[HNAE3_LOOP_MAC][0] = HNAE3_LOOP_MAC; + st_param[HNAE3_LOOP_MAC][1] = h->flags & HNAE3_SUPPORT_MAC_LOOPBACK; - st_param[HNAE3_MAC_INTER_LOOP_SERDES][0] = HNAE3_MAC_INTER_LOOP_SERDES; - st_param[HNAE3_MAC_INTER_LOOP_SERDES][1] = + st_param[HNAE3_LOOP_SERDES][0] = HNAE3_LOOP_SERDES; + st_param[HNAE3_LOOP_SERDES][1] = h->flags & HNAE3_SUPPORT_SERDES_LOOPBACK; if (if_running) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 2de5a00..33e97fc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -523,19 +523,19 @@ static void hclge_get_strings(struct hnae3_handle *handle, } else if (stringset == ETH_SS_TEST) { if (handle->flags & HNAE3_SUPPORT_MAC_LOOPBACK) { memcpy(p, - hns3_nic_test_strs[HNAE3_MAC_INTER_LOOP_MAC], + hns3_nic_test_strs[HNAE3_LOOP_MAC], ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } if (handle->flags & HNAE3_SUPPORT_SERDES_LOOPBACK) { memcpy(p, - hns3_nic_test_strs[HNAE3_MAC_INTER_LOOP_SERDES], + hns3_nic_test_strs[HNAE3_LOOP_SERDES], ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } if (handle->flags & HNAE3_SUPPORT_PHY_LOOPBACK) { memcpy(p, - hns3_nic_test_strs[HNAE3_MAC_INTER_LOOP_PHY], + hns3_nic_test_strs[HNAE3_LOOP_PHY], ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } @@ -3459,10 +3459,10 @@ static int hclge_set_loopback(struct hnae3_handle *handle, int i, ret; switch (loop_mode) { - case HNAE3_MAC_INTER_LOOP_MAC: + case HNAE3_LOOP_MAC: ret = hclge_set_mac_loopback(hdev, en); break; - case HNAE3_MAC_INTER_LOOP_SERDES: + case HNAE3_LOOP_SERDES: ret = hclge_set_serdes_loopback(hdev, en); break; default: From patchwork Wed Sep 26 18:28:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147620 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058552lji; Wed, 26 Sep 2018 11:29:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YOb0s5DrmJevnMbdm0qnAlgqtl8+q/SCP1TwJFF1mCELSDdY6jSI9pXHITGpp+6ZGwC4h X-Received: by 2002:a63:a44:: with SMTP id z4-v6mr6642253pgk.209.1537986585915; Wed, 26 Sep 2018 11:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986585; cv=none; d=google.com; s=arc-20160816; b=YpFYjnXTHHVK3jR7LETCXBM9OJuguDTdlqPQ5An6SsYcevsVj38+6Hzy78hK0GrqNh Y+JBXv6ioj3bub8vs4w/xL7YIxAiOqeh7G4r+YVB/WSjp72True4UNG/Yk2ANyRd89p7 XFCwCfETo1AubdEr8ZVsc4zRFL7qJBgA9mIxyZK+OfBMXIIPV67lMc3Voim9igbRF3ws UOHnYxJVgIEfzamFYFRblqhJJGeXZQNau7XIm4kLGJxkNaI5VVS5Qz3C3ajpoaUgffZY ibjl3xx0nvtlRRYPVT8LpqiOup88mqps5rN8Y052XQ5N+2FAKbkiUn7PNeci95tWCoFF Kb/g== 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=L7Fh+6uS2Na/tNfNeRjiLaM+BuAgfMGcwYNzqoIGFT4=; b=TRokj7AgSQ+R8OmOjW3U/5yeFjXcaNvFrfovQUez0tq8BNcvI36Ae3G322GO2ylwdw NJGg528S5jeLcOvbnVB8+Gb11jIN2RLLGMZ9OB111kQdLJ4odcIxC5FW226ncKxVeGS6 1YWlOMSK47cFRv6CWTM2nyD/Bu+Pvzq0Zl87rOb8m+Lme2njdb5Hs7GgUL097qUnxs7+ 6pSht8/d+IKq/SbR8nyIdT5E7OEFpGeaItIqUpWHD1jYWlOcxtfRmwv3RiE8LtaGUvFL 4EQNnEpMvO80AFZBGCdoSAOFdDnIy2kub4SvUTSyZ4LTr0WKDhJ8tbFhhdXzxxmB6NvX 7BtQ== 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 v8-v6si5354773pff.248.2018.09.26.11.29.45; Wed, 26 Sep 2018 11:29:45 -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 S1728809AbeI0An4 (ORCPT + 32 others); Wed, 26 Sep 2018 20:43:56 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36373 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727064AbeI0An4 (ORCPT ); Wed, 26 Sep 2018 20:43:56 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 34D70149A7C34; Thu, 27 Sep 2018 02:29:39 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:32 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 04/10] net: hns3: Rename mac loopback to app loopback Date: Wed, 26 Sep 2018 19:28:34 +0100 Message-ID: <20180926182840.28392-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 In fact, our implementation of mac loopback is the implementation of app loopback now. Current name is wrong. This patch renames mac loopback to app loopback. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 ++-- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 8 ++++---- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 03d7878..27155ea 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -84,7 +84,7 @@ struct hnae3_queue { /*hnae3 loop mode*/ enum hnae3_loop { - HNAE3_LOOP_MAC, + HNAE3_LOOP_APP, HNAE3_LOOP_SERDES, HNAE3_LOOP_PHY, HNAE3_LOOP_NONE, @@ -478,7 +478,7 @@ struct hnae3_unic_private_info { struct hnae3_queue **tqp; /* array base of all TQPs of this instance */ }; -#define HNAE3_SUPPORT_MAC_LOOPBACK BIT(0) +#define HNAE3_SUPPORT_APP_LOOPBACK BIT(0) #define HNAE3_SUPPORT_PHY_LOOPBACK BIT(1) #define HNAE3_SUPPORT_SERDES_LOOPBACK BIT(2) #define HNAE3_SUPPORT_VF BIT(3) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 86587cf..75ebd2e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -79,7 +79,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) switch (loop) { case HNAE3_LOOP_SERDES: - case HNAE3_LOOP_MAC: + case HNAE3_LOOP_APP: ret = h->ae_algo->ops->set_loopback(h, loop, en); break; default: @@ -286,9 +286,9 @@ static void hns3_self_test(struct net_device *ndev, if (eth_test->flags != ETH_TEST_FL_OFFLINE) return; - st_param[HNAE3_LOOP_MAC][0] = HNAE3_LOOP_MAC; - st_param[HNAE3_LOOP_MAC][1] = - h->flags & HNAE3_SUPPORT_MAC_LOOPBACK; + st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; + st_param[HNAE3_LOOP_APP][1] = + h->flags & HNAE3_SUPPORT_APP_LOOPBACK; st_param[HNAE3_LOOP_SERDES][0] = HNAE3_LOOP_SERDES; st_param[HNAE3_LOOP_SERDES][1] = diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 33e97fc..a0f6329 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -49,7 +49,7 @@ static const struct pci_device_id ae_algo_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, ae_algo_pci_tbl); static const char hns3_nic_test_strs[][ETH_GSTRING_LEN] = { - "Mac Loopback test", + "App Loopback test", "Serdes Loopback test", "Phy Loopback test" }; @@ -493,7 +493,7 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset) hdev->hw.mac.speed == HCLGE_MAC_SPEED_100M || hdev->hw.mac.speed == HCLGE_MAC_SPEED_1G) { count += 1; - handle->flags |= HNAE3_SUPPORT_MAC_LOOPBACK; + handle->flags |= HNAE3_SUPPORT_APP_LOOPBACK; } count++; @@ -521,9 +521,9 @@ static void hclge_get_strings(struct hnae3_handle *handle, p); p = hclge_tqps_get_strings(handle, p); } else if (stringset == ETH_SS_TEST) { - if (handle->flags & HNAE3_SUPPORT_MAC_LOOPBACK) { + if (handle->flags & HNAE3_SUPPORT_APP_LOOPBACK) { memcpy(p, - hns3_nic_test_strs[HNAE3_LOOP_MAC], + hns3_nic_test_strs[HNAE3_LOOP_APP], ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } @@ -3345,7 +3345,7 @@ static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable) "mac enable fail, ret =%d.\n", ret); } -static int hclge_set_mac_loopback(struct hclge_dev *hdev, bool en) +static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en) { struct hclge_config_mac_mode_cmd *req; struct hclge_desc desc; @@ -3459,8 +3459,8 @@ static int hclge_set_loopback(struct hnae3_handle *handle, int i, ret; switch (loop_mode) { - case HNAE3_LOOP_MAC: - ret = hclge_set_mac_loopback(hdev, en); + case HNAE3_LOOP_APP: + ret = hclge_set_app_loopback(hdev, en); break; case HNAE3_LOOP_SERDES: ret = hclge_set_serdes_loopback(hdev, en); From patchwork Wed Sep 26 18:28:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147621 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058598lji; Wed, 26 Sep 2018 11:29:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV61xkfs1VqknHuUQcll3oxLDLEXzQ1wWKhptxO1yr6mOFuFOUQkASOzh+xitkbt6u67DlLNy X-Received: by 2002:a65:4b88:: with SMTP id t8-v6mr6814426pgq.239.1537986589881; Wed, 26 Sep 2018 11:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986589; cv=none; d=google.com; s=arc-20160816; b=Osbd1QT+1RYSILe6aEfcflfFC6jjSpAlK6vNB1RQ0z6MNtlF+epOdesBMrSHbl9nCi LgTZJJTwLfNOdEN8jVCT0VgcTg264VI+43/EiK1EFhVwibbQDyIo85GHlL655iK/GP1E yrf7P9MQDzz0VsXoRIGzeq1RAdANWhj0X8GDwKNmCsZlBzI0gBKkk5ASyZrT6vGatUH+ iSapsf0V8GQARDEUu6Yi2xf7Irmvm9PXeDzI/DiBdkre3kWVxQc++a8okaEHf6PEWzgP qwvhzwlIj+3XBDbDW1Ihu3nGu3Z27WYQuPneSgzbZMdgqfG5d3me5UPfceXrf64+Q0qm J0QQ== 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=FwcJlRt+zgQvj4E8zvO60s2vvU+6NxDifmYWFmKKyK4=; b=SdFmbFvIcXKTVZw8ZdUmPccBPSiKc1dUerf+7m2QyEVV7/a2eb4wtdu9NpyTo7BlBq hLSEtpnCFst6SqOdotQEF0xwhDWc1t+2fXieDVH8qjOX7b8IwNqI0t+rUoa3qUQgrwxS IBUgElmQ+dAus5N14LtyOxtxuVXgD2ZSt8u9DKPitInDs5P+raiTvaq8Y2O5ZxKV33Jf h4B5zhXWXHbXgKhc1P9Z14vnznP8Im/NarJU/qQIFA1m/BxRABW8AbLq+x8/Z2EeZIEY PzxKuOM8AoKwcipxPKqe8TVrXKwaQigJrBp1u58ZEdSBcncRINufoLEBLgMRvwnuBc0L syCA== 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 73-v6si5572110pfv.139.2018.09.26.11.29.49; Wed, 26 Sep 2018 11:29:49 -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 S1728842AbeI0AoB (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:01 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13153 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725806AbeI0AoA (ORCPT ); Wed, 26 Sep 2018 20:44:00 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 90338323B27A; Thu, 27 Sep 2018 02:29:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:34 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 05/10] net: hns3: Add serdes parallel inner loopback support Date: Wed, 26 Sep 2018 19:28:35 +0100 Message-ID: <20180926182840.28392-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 This patch adds serdes parallel inner loopback support for self test. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 6 ++- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 16 +++++-- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 1 + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 54 ++++++++++++++++------ 4 files changed, 57 insertions(+), 20 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 27155ea..8581e16 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -85,7 +85,8 @@ struct hnae3_queue { /*hnae3 loop mode*/ enum hnae3_loop { HNAE3_LOOP_APP, - HNAE3_LOOP_SERDES, + HNAE3_LOOP_SERIAL_SERDES, + HNAE3_LOOP_PARALLEL_SERDES, HNAE3_LOOP_PHY, HNAE3_LOOP_NONE, }; @@ -480,8 +481,9 @@ struct hnae3_unic_private_info { #define HNAE3_SUPPORT_APP_LOOPBACK BIT(0) #define HNAE3_SUPPORT_PHY_LOOPBACK BIT(1) -#define HNAE3_SUPPORT_SERDES_LOOPBACK BIT(2) +#define HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK BIT(2) #define HNAE3_SUPPORT_VF BIT(3) +#define HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK BIT(4) struct hnae3_handle { struct hnae3_client *client; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 75ebd2e..e959b7b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -53,7 +53,7 @@ static const struct hns3_stats hns3_rxq_stats[] = { #define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT) -#define HNS3_SELF_TEST_TYPE_NUM 2 +#define HNS3_SELF_TEST_TPYE_NUM 3 #define HNS3_NIC_LB_TEST_PKT_NUM 1 #define HNS3_NIC_LB_TEST_RING_ID 0 #define HNS3_NIC_LB_TEST_PACKET_SIZE 128 @@ -78,7 +78,8 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) return -EOPNOTSUPP; switch (loop) { - case HNAE3_LOOP_SERDES: + case HNAE3_LOOP_SERIAL_SERDES: + case HNAE3_LOOP_PARALLEL_SERDES: case HNAE3_LOOP_APP: ret = h->ae_algo->ops->set_loopback(h, loop, en); break; @@ -290,9 +291,14 @@ static void hns3_self_test(struct net_device *ndev, st_param[HNAE3_LOOP_APP][1] = h->flags & HNAE3_SUPPORT_APP_LOOPBACK; - st_param[HNAE3_LOOP_SERDES][0] = HNAE3_LOOP_SERDES; - st_param[HNAE3_LOOP_SERDES][1] = - h->flags & HNAE3_SUPPORT_SERDES_LOOPBACK; + st_param[HNAE3_LOOP_SERIAL_SERDES][0] = HNAE3_LOOP_SERIAL_SERDES; + st_param[HNAE3_LOOP_SERIAL_SERDES][1] = + h->flags & HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK; + + st_param[HNAE3_LOOP_PARALLEL_SERDES][0] = + HNAE3_LOOP_PARALLEL_SERDES; + st_param[HNAE3_LOOP_PARALLEL_SERDES][1] = + h->flags & HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK; if (if_running) ndev->netdev_ops->ndo_stop(ndev); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index 821d4c2..842dc3f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -778,6 +778,7 @@ struct hclge_reset_cmd { }; #define HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B BIT(0) +#define HCLGE_CMD_SERDES_PARALLEL_INNER_LOOP_B BIT(2) #define HCLGE_CMD_SERDES_DONE_B BIT(0) #define HCLGE_CMD_SERDES_SUCCESS_B BIT(1) struct hclge_serdes_lb_cmd { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index a0f6329..72bc8c3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -50,7 +50,8 @@ MODULE_DEVICE_TABLE(pci, ae_algo_pci_tbl); static const char hns3_nic_test_strs[][ETH_GSTRING_LEN] = { "App Loopback test", - "Serdes Loopback test", + "Serdes serial Loopback test", + "Serdes parallel Loopback test", "Phy Loopback test" }; @@ -475,7 +476,10 @@ static void hclge_update_stats(struct hnae3_handle *handle, static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset) { -#define HCLGE_LOOPBACK_TEST_FLAGS 0x7 +#define HCLGE_LOOPBACK_TEST_FLAGS (HNAE3_SUPPORT_APP_LOOPBACK |\ + HNAE3_SUPPORT_PHY_LOOPBACK |\ + HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK |\ + HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK) struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; @@ -489,15 +493,17 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset) if (stringset == ETH_SS_TEST) { /* clear loopback bit flags at first */ handle->flags = (handle->flags & (~HCLGE_LOOPBACK_TEST_FLAGS)); - if (hdev->hw.mac.speed == HCLGE_MAC_SPEED_10M || + if (hdev->pdev->revision >= HNAE3_REVISION_ID_21 || + hdev->hw.mac.speed == HCLGE_MAC_SPEED_10M || hdev->hw.mac.speed == HCLGE_MAC_SPEED_100M || hdev->hw.mac.speed == HCLGE_MAC_SPEED_1G) { count += 1; handle->flags |= HNAE3_SUPPORT_APP_LOOPBACK; } - count++; - handle->flags |= HNAE3_SUPPORT_SERDES_LOOPBACK; + count += 2; + handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK; + handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK; } else if (stringset == ETH_SS_STATS) { count = ARRAY_SIZE(g_mac_stats_string) + hclge_tqps_get_sset_count(handle, stringset); @@ -527,9 +533,15 @@ static void hclge_get_strings(struct hnae3_handle *handle, ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } - if (handle->flags & HNAE3_SUPPORT_SERDES_LOOPBACK) { + if (handle->flags & HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK) { memcpy(p, - hns3_nic_test_strs[HNAE3_LOOP_SERDES], + hns3_nic_test_strs[HNAE3_LOOP_SERIAL_SERDES], + ETH_GSTRING_LEN); + p += ETH_GSTRING_LEN; + } + if (handle->flags & HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK) { + memcpy(p, + hns3_nic_test_strs[HNAE3_LOOP_PARALLEL_SERDES], ETH_GSTRING_LEN); p += ETH_GSTRING_LEN; } @@ -3381,22 +3393,37 @@ static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en) return ret; } -static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en) +static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en, + enum hnae3_loop loop_mode) { #define HCLGE_SERDES_RETRY_MS 10 #define HCLGE_SERDES_RETRY_NUM 100 struct hclge_serdes_lb_cmd *req; struct hclge_desc desc; int ret, i = 0; + u8 loop_mode_b; req = (struct hclge_serdes_lb_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SERDES_LOOPBACK, false); + switch (loop_mode) { + case HNAE3_LOOP_SERIAL_SERDES: + loop_mode_b = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + break; + case HNAE3_LOOP_PARALLEL_SERDES: + loop_mode_b = HCLGE_CMD_SERDES_PARALLEL_INNER_LOOP_B; + break; + default: + dev_err(&hdev->pdev->dev, + "unsupported serdes loopback mode %d\n", loop_mode); + return -ENOTSUPP; + } + if (en) { - req->enable = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; - req->mask = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + req->enable = loop_mode_b; + req->mask = loop_mode_b; } else { - req->mask = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + req->mask = loop_mode_b; } ret = hclge_cmd_send(&hdev->hw, &desc, 1); @@ -3462,8 +3489,9 @@ static int hclge_set_loopback(struct hnae3_handle *handle, case HNAE3_LOOP_APP: ret = hclge_set_app_loopback(hdev, en); break; - case HNAE3_LOOP_SERDES: - ret = hclge_set_serdes_loopback(hdev, en); + case HNAE3_LOOP_SERIAL_SERDES: + case HNAE3_LOOP_PARALLEL_SERDES: + ret = hclge_set_serdes_loopback(hdev, en, loop_mode); break; default: ret = -ENOTSUPP; From patchwork Wed Sep 26 18:28:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147626 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1059229lji; Wed, 26 Sep 2018 11:30:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV61r/QmJWMhQRNJN65+f5g8CfdMWg86RMm7DJY+lzVrRT5/ElzVDIvt11zRyr83en1ZFkuVD X-Received: by 2002:a63:4b25:: with SMTP id y37-v6mr6787327pga.14.1537986627867; Wed, 26 Sep 2018 11:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986627; cv=none; d=google.com; s=arc-20160816; b=SgWsBUnmKd2B9XtMRjwVV+ommPMXp/felvSwleWbvZPnteyyweodUxmzpvKRtI1iI4 /4Wtj4iiZDf8QU/rfr5wEMbm/T/aOUxGiBvstegeVLLONtwglDmkWtVtSu5eOuIDZlO7 hpVHEYV8nLXEnIq8ZmVsQpdKXHfwI+N0UTyFCuAeSmz7wggyRXQCJHhc2jgc4aPxB0+1 YbhQAVw8hUsUWGOefEMeDCcdYgdw3YZFw55oT1UTMDg1ZeSvc58h7d6oTmRpZey+6TOd tncXCDCjkhy2tF38FcDvYkjI7JQR+E3+jp+p4mpiNYQEhWKffHU3VgIlonzaNM8uvnO0 Co6w== 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=OL1zEAi9ZBbmKQuB+DJ8oObp/txtyZ/SbCQXaosaURs=; b=gt+bMgJWh5U1Im5yDR3MXofcJ0YhX+ZSPwHY1cPR32Vj2qjkdXJ3ko0RoJ1i0gd9O4 wxbl5cp/sYaEzxw1OhoxY1Aeye3kpU8lCg2qZTMAFpipRF332OCe1nthDXzzmNxBNgBY u/j/+Hdlph2MeMFV8TH1ODxiRoeRYok8FAuL0kO4DQ2S/h2pvlTzQefJmO74ih1fQLmQ VkQYa1aJ1vzCaPkS9uNn9vOLr1f3PD6n2LjJVPvDH1BgbFXjpEMCoW0xG7IekWkJy4dG EnDzmDkc4QWfxurV3DHQHa6ocFhZ5kEKXTW+DG4tb9PAjgGiSz1bXqBBuRVeHZAFZhyD vTqg== 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 x8-v6si6095226pgh.454.2018.09.26.11.30.27; Wed, 26 Sep 2018 11:30:27 -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 S1728978AbeI0Aoj (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:39 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13154 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727064AbeI0AoB (ORCPT ); Wed, 26 Sep 2018 20:44:01 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BFDBF19CCE877; Thu, 27 Sep 2018 02:29:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:37 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 06/10] net: hns3: Fix for packet buffer setting bug Date: Wed, 26 Sep 2018 19:28:36 +0100 Message-ID: <20180926182840.28392-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin The hardware expects a unit of 128 bytes when setting packet buffer. When calculating the packet buffer size, hclge_rx_buffer_calc does not round up the size as a unit of 128 byte, which may casue packet lost problem when stress testing. This patch fixes it by rounding up packet size when calculating. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 72bc8c3..d8b0d16 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1356,11 +1356,13 @@ static int hclge_tx_buffer_calc(struct hclge_dev *hdev, static int hclge_rx_buffer_calc(struct hclge_dev *hdev, struct hclge_pkt_buf_alloc *buf_alloc) { - u32 rx_all = hdev->pkt_buf_size; +#define HCLGE_BUF_SIZE_UNIT 128 + u32 rx_all = hdev->pkt_buf_size, aligned_mps; int no_pfc_priv_num, pfc_priv_num; struct hclge_priv_buf *priv; int i; + aligned_mps = round_up(hdev->mps, HCLGE_BUF_SIZE_UNIT); rx_all -= hclge_get_tx_buff_alloced(buf_alloc); /* When DCB is not supported, rx private @@ -1379,13 +1381,13 @@ static int hclge_rx_buffer_calc(struct hclge_dev *hdev, if (hdev->hw_tc_map & BIT(i)) { priv->enable = 1; if (hdev->tm_info.hw_pfc_map & BIT(i)) { - priv->wl.low = hdev->mps; - priv->wl.high = priv->wl.low + hdev->mps; + priv->wl.low = aligned_mps; + priv->wl.high = priv->wl.low + aligned_mps; priv->buf_size = priv->wl.high + HCLGE_DEFAULT_DV; } else { priv->wl.low = 0; - priv->wl.high = 2 * hdev->mps; + priv->wl.high = 2 * aligned_mps; priv->buf_size = priv->wl.high; } } else { @@ -1417,11 +1419,11 @@ static int hclge_rx_buffer_calc(struct hclge_dev *hdev, if (hdev->tm_info.hw_pfc_map & BIT(i)) { priv->wl.low = 128; - priv->wl.high = priv->wl.low + hdev->mps; + priv->wl.high = priv->wl.low + aligned_mps; priv->buf_size = priv->wl.high + HCLGE_DEFAULT_DV; } else { priv->wl.low = 0; - priv->wl.high = hdev->mps; + priv->wl.high = aligned_mps; priv->buf_size = priv->wl.high; } } From patchwork Wed Sep 26 18:28:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147622 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058682lji; Wed, 26 Sep 2018 11:29:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV61wU3Sg63XCtQJiuGbzTQ1IT46uWw5I/pDSedo19ERAGWLNjfTyf9+l2OcZ1KDLA//LvpwC X-Received: by 2002:a63:1752:: with SMTP id 18-v6mr6817959pgx.131.1537986595094; Wed, 26 Sep 2018 11:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986595; cv=none; d=google.com; s=arc-20160816; b=uRse3aPgxoCYJpfkvn6S3vrL0SFNuiaY+WvSH2fVA4z3f8yco32R5Gb+wkIBMrykkj LNsZSE3is8d4nfbOoI2+mH2VYk4K6FONwBsxDbWa5GToZ0Uosc0W5NvMIe1zt2iIoEYj gdlMb1c05h4UEeNVrDKwaLUCoAZNqjeQHQal4f0/jMQqA6qGhQNQz8+GBNjqqW4TAV3B qwsr3dvVlaCEle1TaOikBRUOhiJ+B2yL8sG/drRUpeCE7SDllsAXeYcUDOeKAvnQxvPU C7CWz+aeInXXOx2IJukQe8HZSUQ8HVIohyzslvA1FJT25YX195oXJ/aW5YAY8QQfG6EO Bnlg== 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=X8sAeipC2Qc9Qzs8ZYAuxK4xDa55tWI+CeqAY4JTTuQ=; b=Pl7ToWKbeZjiZl+YIsdgpxoHA9dGccb1IVMqhHopGQuJRj0iCLD/SVS58Wc9jZzFuf 5ZbpAXq/gj4khyP+7zReoKs8qUvRGirF0Am0RwWm9toUPPrx25D3tVZUJMlz3o1R45sK /Hh9KX2xxvy+QnH/ckGHMj7D3yNMYUzzp08jo1R9D6gra9EpdJEotmtrmMkdiKOoQnc0 syL434ZIeAX1V8cQcWbnNMIPKIrnZuKLr2g6YghgYbhmDIW8r73yZdIZsseRFPkYz4ai +fmDJnPG5xL0Ex+PblqHfV63cGZQkDxMyAATUVrj1OFVpIqyMFsN/0yAgsoPwG7lItUu ntVA== 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 q24-v6si5936288pgb.11.2018.09.26.11.29.54; Wed, 26 Sep 2018 11:29:55 -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 S1728909AbeI0AoG (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:06 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13156 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728845AbeI0AoG (ORCPT ); Wed, 26 Sep 2018 20:44:06 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A1F2259504C68; Thu, 27 Sep 2018 02:29:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:40 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 07/10] net: hns3: Fix for netdev not up problem when setting mtu Date: Wed, 26 Sep 2018 19:28:37 +0100 Message-ID: <20180926182840.28392-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin Currently hns3_nic_change_mtu will try to down the netdev before setting mtu, and it does not up the netdev when the setting fails, which causes netdev not up problem. This patch fixes it by not returning when the setting fails. Fixes: a8e8b7ff3517 ("net: hns3: Add support to change MTU in HNS3 hardware") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 +++----- 1 file changed, 3 insertions(+), 5 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 3fc3822..545777a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1491,13 +1491,11 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) } ret = h->ae_algo->ops->set_mtu(h, new_mtu); - if (ret) { + if (ret) netdev_err(netdev, "failed to change MTU in hardware %d\n", ret); - return ret; - } - - netdev->mtu = new_mtu; + else + netdev->mtu = new_mtu; /* if the netdev was running earlier, bring it up again */ if (if_running && hns3_nic_net_open(netdev)) From patchwork Wed Sep 26 18:28:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147625 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1059040lji; Wed, 26 Sep 2018 11:30:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV63WWNRLosXdAJlUww88yu7wGZr5rIiBGTQqNkKX/2piSzqCNGUTD/PS9/378jQFBtOMhIY9 X-Received: by 2002:a17:902:d881:: with SMTP id b1-v6mr7279027plz.191.1537986617192; Wed, 26 Sep 2018 11:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986617; cv=none; d=google.com; s=arc-20160816; b=JtcxKlZbgjunuCu8cDXXiUVIFlMg1moClK9nivrIewWJeSDjNITPribnTy6Fte/9UP R5oogB1o7wNiDn1hVREt3njhm6g8f4JVZXtsTY0AIOwcq1ENYbHLvGJfcol/Ukz4f1ok l7AYSOtFY1hBmQyqF3qrdhmwm0SsS4pwM8T5ftz8//Ur9ze+tQ92o52E3rKFo2CSzKyd rS8qkCnsLb0JxDWE0tc7GQe871azQ9zG7HVjJtYJesSvg4n0XosQmgqIgZ6gOWTlWAhB bZ4Plz9J6x+UInHKBv2x65xgzlSbXa9DsZJOsRP/Mf9Yv3+AH60S4YSerYWYfcHZbYac 2zqw== 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=bHvXb2AWXnMVLItjsHjwkAaoL545NXWQDUSFdAfRqZ8=; b=T5U40rJWDT7blMztk4LnZYE9784mMMQ4Awl7rAAm3QcAnudRk5dkhl9cUPYddeUCgt E0RgvM7kdmvDvf0asFZpPiS01Ik1oLwRDnFB2N1TT8ygiabbTIXhkE4JQLyEnf6pcvSr gb9OsFD1ilFLgFmpS2D5eVxrk9QcjkGkAe3TjORqhLSq0x5jL2k0fYGk2elYdwqC0PRN ngQdqSCnuEKeMGc0qSHhGH3L+BEwDPez3A45uJX51fjVXP/MBoVA5ztMORDgqrwNdUek QDSpr7mum22whezy3JVHi1RQxMco/todoowbbAa1pVLNeNEFs7rZUdttQ1kC6q3+FUNm /6Uw== 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 s13-v6si5919865pgi.73.2018.09.26.11.30.16; Wed, 26 Sep 2018 11:30:17 -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 S1728877AbeI0AoG (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:06 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13155 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728810AbeI0AoF (ORCPT ); Wed, 26 Sep 2018 20:44:05 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9D4157D3F0272; Thu, 27 Sep 2018 02:29:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:43 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan , Yunsheng Lin Subject: [PATCH net-next 08/10] net: hns3: Change return type of hclge_tm_schd_info_update() Date: Wed, 26 Sep 2018 19:28:38 +0100 Message-ID: <20180926182840.28392-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan hclge_tm_schd_info_update should return an error when num_tc is greater than alloc_tqps. This patch changes the return type of hnae3_register_ae_algo from void to int. Signed-off-by: Huazhong Tan Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 8 ++++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 9 ++++++++- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c index 92f1938..e72f724 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -184,7 +184,9 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) if (ret) return ret; - hclge_tm_schd_info_update(hdev, num_tc); + ret = hclge_tm_schd_info_update(hdev, num_tc); + if (ret) + return ret; ret = hclge_ieee_ets_to_tm_info(hdev, ets); if (ret) @@ -310,7 +312,9 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc) return -EINVAL; } - hclge_tm_schd_info_update(hdev, tc); + ret = hclge_tm_schd_info_update(hdev, tc); + if (ret) + return ret; ret = hclge_tm_prio_tc_info_update(hdev, prio_tc); if (ret) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index ab7280d..aa5cb98 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -1280,10 +1280,15 @@ int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc) return 0; } -void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) +int hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) { u8 i, bit_map = 0; + for (i = 0; i < hdev->num_alloc_vport; i++) { + if (num_tc > hdev->vport[i].alloc_tqps) + return -EINVAL; + } + hdev->tm_info.num_tc = num_tc; for (i = 0; i < hdev->tm_info.num_tc; i++) @@ -1297,6 +1302,8 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) hdev->hw_tc_map = bit_map; hclge_tm_schd_info_init(hdev); + + return 0; } int hclge_tm_init_hw(struct hclge_dev *hdev) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index e1568b8..25eef13 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -132,7 +132,7 @@ int hclge_tm_schd_init(struct hclge_dev *hdev); int hclge_pause_setup_hw(struct hclge_dev *hdev); int hclge_tm_schd_mode_hw(struct hclge_dev *hdev); int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc); -void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc); +int hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc); int hclge_tm_dwrr_cfg(struct hclge_dev *hdev); int hclge_tm_map_cfg(struct hclge_dev *hdev); int hclge_tm_init_hw(struct hclge_dev *hdev); From patchwork Wed Sep 26 18:28:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147623 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058747lji; Wed, 26 Sep 2018 11:30:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV62w6krNhSZDuJikOygnp52yA9RZFotsYAQa4achsMVmvvC1W4HlY73MsyrKua/qK2qMv/RI X-Received: by 2002:a17:902:9893:: with SMTP id s19-v6mr7313057plp.130.1537986600144; Wed, 26 Sep 2018 11:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986600; cv=none; d=google.com; s=arc-20160816; b=FBqdAMBHPGY2VGHbDWZoUpyj3kuIcgCJpf0JQiYtF0shiHcgS5dcXdJxlQI0zJSRn3 +uK7CNvd6+DFCfL1lueqkk1hwdMUPZDFNov/UOyY64k/itVcwJ/PXYygiSr8qgQqcOuG sSeRc3MiW/+EWUWkIwTRdNH7QZe/sjW33JLccB1Yjc0PlMcX00MtHVefglPQzKcUSbGP mONBYLg8yzGU9mB1AkOPVM5ZlIUsHeNvQAsYgEd3dVReEtzAMSyQA/nooGfzX4cePBbf lzxGII7oQvL2eKXBmXRqhGtWDx8IHprIGbRwleZfp/dZXwRecQINWj9j0m1+AXTQfJzw HbUA== 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=aRFmZo0ljbUxMAHoABdRJffX55tBms7mrwLZd+xEPX4=; b=03vqaG3SpL/ywzMERjXID/7blorfef7QAH11GZGlbxcn99Nac+B6arrs0CAsh5gIGk hqewiM/oofw8anqqOmTjflAHWKJwcQOStQ1YVaBMlthi4O1GBPchmHM1KnXnTEykeH6K GlAJfOXoQEhX7LsE74EQKNrj8v5P8RL8kHILukcez7Fb+VMQEdp1Qwa+oBhgve0Q/rbn Jf23Wa/wwc8M8fanLEOwuqEL5UU3M7tdETFhZPXfkJpUtqwogqkbT3Z2SbjDaFXea967 QCBZ9NB0QcsKA/GfX+TiCicsErDm1K12cSZcWqL8jEhitssNtjFFmmWGVsS8pOQ5z7Le pvQA== 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 q24-v6si5936288pgb.11.2018.09.26.11.29.59; Wed, 26 Sep 2018 11:30:00 -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 S1728935AbeI0AoM (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:12 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13130 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726107AbeI0AoL (ORCPT ); Wed, 26 Sep 2018 20:44:11 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 26F895B8846E; Thu, 27 Sep 2018 02:29:54 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:46 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan , Yunsheng Lin Subject: [PATCH net-next 09/10] net: hns3: Modify hns3_get_max_available_channels Date: Wed, 26 Sep 2018 19:28:39 +0100 Message-ID: <20180926182840.28392-10-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan The current hns3_get_max_available_channels returns the total number of queues for the device, which makes ethtool -L set the number of queues per channel queues incorrectly, so hns3_get_max_available_channels should return the maximum available number of queues per channel, depending on the total number of queues allocated and the hardware configurations. Signed-off-by: Huazhong Tan Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 ++++++++------ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 ++-------- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++-- 4 files changed, 13 insertions(+), 17 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 8581e16..dea422c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -403,7 +403,7 @@ struct hnae3_ae_ops { void (*get_channels)(struct hnae3_handle *handle, struct ethtool_channels *ch); void (*get_tqps_and_rss_info)(struct hnae3_handle *h, - u16 *free_tqps, u16 *max_rss_size); + u16 *alloc_tqps, u16 *max_rss_size); int (*set_channels)(struct hnae3_handle *handle, u32 new_tqps_num); void (*get_flowctrl_adv)(struct hnae3_handle *handle, u32 *flowctrl_adv); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 545777a..8273c03 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -307,12 +307,12 @@ static int hns3_nic_set_real_num_queue(struct net_device *netdev) static u16 hns3_get_max_available_channels(struct hnae3_handle *h) { - u16 free_tqps, max_rss_size, max_tqps; + u16 alloc_tqps, max_rss_size, rss_size; - h->ae_algo->ops->get_tqps_and_rss_info(h, &free_tqps, &max_rss_size); - max_tqps = h->kinfo.num_tc * max_rss_size; + h->ae_algo->ops->get_tqps_and_rss_info(h, &alloc_tqps, &max_rss_size); + rss_size = alloc_tqps / h->kinfo.num_tc; - return min_t(u16, max_tqps, (free_tqps + h->kinfo.num_tqps)); + return min_t(u16, rss_size, max_rss_size); } static int hns3_nic_net_up(struct net_device *netdev) @@ -3164,12 +3164,14 @@ static void hns3_nic_set_priv_ops(struct net_device *netdev) static int hns3_client_init(struct hnae3_handle *handle) { struct pci_dev *pdev = handle->pdev; + u16 alloc_tqps, max_rss_size; struct hns3_nic_priv *priv; struct net_device *netdev; int ret; - netdev = alloc_etherdev_mq(sizeof(struct hns3_nic_priv), - hns3_get_max_available_channels(handle)); + handle->ae_algo->ops->get_tqps_and_rss_info(handle, &alloc_tqps, + &max_rss_size); + netdev = alloc_etherdev_mq(sizeof(struct hns3_nic_priv), alloc_tqps); if (!netdev) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index d8b0d16..67b131d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5659,18 +5659,12 @@ static void hclge_get_channels(struct hnae3_handle *handle, } static void hclge_get_tqps_and_rss_info(struct hnae3_handle *handle, - u16 *free_tqps, u16 *max_rss_size) + u16 *alloc_tqps, u16 *max_rss_size) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - u16 temp_tqps = 0; - int i; - for (i = 0; i < hdev->num_tqps; i++) { - if (!hdev->htqp[i].alloced) - temp_tqps++; - } - *free_tqps = temp_tqps; + *alloc_tqps = vport->alloc_tqps; *max_rss_size = hdev->rss_size_max; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 9781931..8f858cb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1975,11 +1975,11 @@ static void hclgevf_get_channels(struct hnae3_handle *handle, } static void hclgevf_get_tqps_and_rss_info(struct hnae3_handle *handle, - u16 *free_tqps, u16 *max_rss_size) + u16 *alloc_tqps, u16 *max_rss_size) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - *free_tqps = 0; + *alloc_tqps = hdev->num_tqps; *max_rss_size = hdev->rss_size_max; } From patchwork Wed Sep 26 18:28:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147624 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1058835lji; Wed, 26 Sep 2018 11:30:05 -0700 (PDT) X-Google-Smtp-Source: ACcGV60C43uHE65VTFPdp92d/u0FxmikUR9IQYfDbg6+Tp+1z1TXt0eTcNoYoBAapNHMaJGLf8/s X-Received: by 2002:a62:b286:: with SMTP id z6-v6mr7645308pfl.79.1537986605424; Wed, 26 Sep 2018 11:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986605; cv=none; d=google.com; s=arc-20160816; b=migyP05Y2iiTa9yyPSXQjSA8kAfeP7HLrQifUuNdw6QhexZkMrcg95aDvzOjiVQosw 63u+klbCn26ZwYQD1qJTqJusdQHzwoi0Imd5v+0UDhVyJB7mOwDbRfG/hDznvrWQ+kRb rvSfJxoFK/BKVrGeuUuj3nXPqj9NmiztlxRy0B4FVpkN+MypMFb2Z9CHzNRRxNob/iYA YnsGC44wqbvG4m0tU4/Etv+7QSCQhykMvkCrNIVvBRZW/diGVnyTKa0/n3RuG1yDTRiA Xju8PvKwtREUSFH6X8xFjacTIXS6dt/La/RKv3knFE1sPtugBmRtfu08VYqEvVOFEMv/ FOxQ== 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=SY77ln4ytT4E5tiID/juk8QCYduwXqPnjUS/+jepeN4=; b=sUR30K4I3p7PRQGn+PXD3aeQ/xm7z8+UwJvlcrFIL+613Ue9SVEYZRvdrSf1XKmJ3k C7jRLtYmYX5dm6yi9QLH6eBqYC+4TdrqFhqh+e4re7BxvFdoyosFcmNORbCnLtFyCd8Q 4WRjC8Oss+e5dbmN5yOQ9y/C/knrKi0fhMY5O0aW8ihKEIkdT0aW5zrb7tYJRZOZZ/zT w8LtTP+M4FgopSPhV60y2ivHuKBXMAUuSBZE/+/n8oz2ZYSVp2isU11f13DaQj9MTovA Ye6ELSBXznsutQuaClOodWBYOPYtU5lrRXz5B71ShSAScu9h09OMx+RS3+mmSfovVba/ ej+w== 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 j125-v6si5427521pfc.243.2018.09.26.11.30.05; Wed, 26 Sep 2018 11:30:05 -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 S1728965AbeI0AoR (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13131 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726107AbeI0AoQ (ORCPT ); Wed, 26 Sep 2018 20:44:16 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 39018E8D1A59A; Thu, 27 Sep 2018 02:29:59 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:49 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan , Yunsheng Lin Subject: [PATCH net-next 10/10] net: hns3: Fix loss of coal configuration while doing reset Date: Wed, 26 Sep 2018 19:28:40 +0100 Message-ID: <20180926182840.28392-11-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan The user's coal configuration will be lost after reset, so the tx_coal and rx_coal fields are added to the struct hns_nic_priv to save the coal configuration and used to restore the user's configuration after the reset is complete. Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client") Signed-off-by: Huazhong Tan Signed-off-by: Yunsheng Lin Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 71 ++++++++++++------------- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 + 2 files changed, 36 insertions(+), 37 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 8273c03..10506522 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -225,8 +225,6 @@ void hns3_set_vector_coalesce_tx_gl(struct hns3_enet_tqp_vector *tqp_vector, static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector, struct hns3_nic_priv *priv) { - struct hnae3_handle *h = priv->ae_handle; - /* initialize the configuration for interrupt coalescing. * 1. GL (Interrupt Gap Limiter) * 2. RL (Interrupt Rate Limiter) @@ -239,9 +237,6 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector, tqp_vector->tx_group.coal.int_gl = HNS3_INT_GL_50K; tqp_vector->rx_group.coal.int_gl = HNS3_INT_GL_50K; - /* Default: disable RL */ - h->kinfo.int_rl_setting = 0; - tqp_vector->int_adapt_down = HNS3_INT_ADAPT_DOWN_START; tqp_vector->rx_group.coal.flow_level = HNS3_FLOW_LOW; tqp_vector->tx_group.coal.flow_level = HNS3_FLOW_LOW; @@ -3490,6 +3485,31 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) return 0; } +static void hns3_store_coal(struct hns3_nic_priv *priv) +{ + /* ethtool only support setting and querying one coal + * configuation for now, so save the vector 0' coal + * configuation here in order to restore it. + */ + memcpy(&priv->tx_coal, &priv->tqp_vector[0].tx_group.coal, + sizeof(struct hns3_enet_coalesce)); + memcpy(&priv->rx_coal, &priv->tqp_vector[0].rx_group.coal, + sizeof(struct hns3_enet_coalesce)); +} + +static void hns3_restore_coal(struct hns3_nic_priv *priv) +{ + u16 vector_num = priv->vector_num; + int i; + + for (i = 0; i < vector_num; i++) { + memcpy(&priv->tqp_vector[i].tx_group.coal, &priv->tx_coal, + sizeof(struct hns3_enet_coalesce)); + memcpy(&priv->tqp_vector[i].rx_group.coal, &priv->rx_coal, + sizeof(struct hns3_enet_coalesce)); + } +} + static int hns3_reset_notify_down_enet(struct hnae3_handle *handle) { struct hnae3_knic_private_info *kinfo = &handle->kinfo; @@ -3536,6 +3556,8 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) /* Carrier off reporting is important to ethtool even BEFORE open */ netif_carrier_off(netdev); + hns3_restore_coal(priv); + ret = hns3_nic_init_vector_data(priv); if (ret) return ret; @@ -3563,6 +3585,8 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) return ret; } + hns3_store_coal(priv); + ret = hns3_uninit_all_ring(priv); if (ret) netdev_err(netdev, "uninit ring error\n"); @@ -3597,24 +3621,7 @@ static int hns3_reset_notify(struct hnae3_handle *handle, return ret; } -static void hns3_restore_coal(struct hns3_nic_priv *priv, - struct hns3_enet_coalesce *tx, - struct hns3_enet_coalesce *rx) -{ - u16 vector_num = priv->vector_num; - int i; - - for (i = 0; i < vector_num; i++) { - memcpy(&priv->tqp_vector[i].tx_group.coal, tx, - sizeof(struct hns3_enet_coalesce)); - memcpy(&priv->tqp_vector[i].rx_group.coal, rx, - sizeof(struct hns3_enet_coalesce)); - } -} - -static int hns3_modify_tqp_num(struct net_device *netdev, u16 new_tqp_num, - struct hns3_enet_coalesce *tx, - struct hns3_enet_coalesce *rx) +static int hns3_modify_tqp_num(struct net_device *netdev, u16 new_tqp_num) { struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev); @@ -3632,7 +3639,7 @@ static int hns3_modify_tqp_num(struct net_device *netdev, u16 new_tqp_num, if (ret) goto err_alloc_vector; - hns3_restore_coal(priv, tx, rx); + hns3_restore_coal(priv); ret = hns3_nic_init_vector_data(priv); if (ret) @@ -3664,7 +3671,6 @@ int hns3_set_channels(struct net_device *netdev, struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_knic_private_info *kinfo = &h->kinfo; - struct hns3_enet_coalesce tx_coal, rx_coal; bool if_running = netif_running(netdev); u32 new_tqp_num = ch->combined_count; u16 org_tqp_num; @@ -3696,15 +3702,7 @@ int hns3_set_channels(struct net_device *netdev, goto open_netdev; } - /* Changing the tqp num may also change the vector num, - * ethtool only support setting and querying one coal - * configuation for now, so save the vector 0' coal - * configuation here in order to restore it. - */ - memcpy(&tx_coal, &priv->tqp_vector[0].tx_group.coal, - sizeof(struct hns3_enet_coalesce)); - memcpy(&rx_coal, &priv->tqp_vector[0].rx_group.coal, - sizeof(struct hns3_enet_coalesce)); + hns3_store_coal(priv); hns3_nic_dealloc_vector_data(priv); @@ -3712,10 +3710,9 @@ int hns3_set_channels(struct net_device *netdev, hns3_put_ring_config(priv); org_tqp_num = h->kinfo.num_tqps; - ret = hns3_modify_tqp_num(netdev, new_tqp_num, &tx_coal, &rx_coal); + ret = hns3_modify_tqp_num(netdev, new_tqp_num); if (ret) { - ret = hns3_modify_tqp_num(netdev, org_tqp_num, - &tx_coal, &rx_coal); + ret = hns3_modify_tqp_num(netdev, org_tqp_num); if (ret) { /* If revert to old tqp failed, fatal error occurred */ dev_err(&netdev->dev, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 4a56c3d..27d704f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -543,6 +543,8 @@ struct hns3_nic_priv { /* Vxlan/Geneve information */ struct hns3_udp_tunnel udp_tnl[HNS3_UDP_TNL_MAX]; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; + struct hns3_enet_coalesce tx_coal; + struct hns3_enet_coalesce rx_coal; }; union l3_hdr_info {