From patchwork Sun Aug 12 09:47:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 143981 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892322ljj; Sun, 12 Aug 2018 02:48:37 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxsLVe4e7uoIBxRAkiPtuQ2+G4oesZYPJv2SbGDEKpgcbYkgw2zAB/D1uqr5UKvTAlptBK1 X-Received: by 2002:a62:1314:: with SMTP id b20-v6mr14421667pfj.230.1534067317775; Sun, 12 Aug 2018 02:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067317; cv=none; d=google.com; s=arc-20160816; b=DmdNvn+Lq1TMMpyhgx13iEPx27oJvrosgM6wd1QfRS9NSFIvEuP8iOhh4qZsSTwaTv /Y1jK/+nshwLA4wZ5PF2JsQGaDiB+mAXwvbnma535bfe1FXAe8wvNPH1HOS9qFmBBMmS xcoFcjUexZvnPQN3oAgulwRTSJQ5X+Z7IObvU0tum2AJFgv1lHgCQaA1eouTSAHq5yz0 R2LmiofkNg7RZYGyEuARD2dqo5XiyyhqWd97d5tK2N+I5FdE8sF20KrNy8VbY195TDYx lxsgB9jP+gOmt3h3T1b28JdL1SAWVG5XRFRUUuMQUmV050XEYA4aIaCT8/HuHQe53CeA KstA== 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=tqrtv9zhLstv3f6+pHBOgNmWTgfaHqSzjwXtS4+lvC0=; b=OEUkGXi1K99+r/LBvt9kqF67k6rqTGS6P/2ae1TMoWz37A6Oq20Z7lYQTxckPHwYxH U4hycPbKW+RV0IkbT5/+UZErbKnw/h5qvI5kN9GlBCLgDlvDbb6BtB8azizlfvVbzrRw a82yqtRaLEwPUWrFAuUqi4BJzv2r2Nb4B59rLzMuCraoFtxcOMQMha6Snq6tEs4z+EQg pXfvBCp7inPfMK6sHuGhy8ENW01kSZTUPy8yasWbynnk8MkmrRrhiswhqWalvogkFM9e om75aVzqy8xBsySD+cqFYJmB8OVLoJqeKunfzc1JhrygB1e0cOxTNF0ftJliDGUpanvu my/Q== 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 l190-v6si14787395pgd.375.2018.08.12.02.48.37; Sun, 12 Aug 2018 02:48:37 -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 S1727988AbeHLM0A (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10701 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727736AbeHLM0A (ORCPT ); Sun, 12 Aug 2018 08:26:00 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6AD562A85657A; Sun, 12 Aug 2018 17:48:29 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:23 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 1/9] net: hns3: Add support for serdes loopback selftest Date: Sun, 12 Aug 2018 10:47:30 +0100 Message-ID: <20180812094738.14852-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 serdes loopback selftest in hns3 driver. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 7 ++- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 12 +++++ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 57 +++++++++++++++++++++- 3 files changed, 73 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 80ba95d76260..f4710e498c59 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_TPYE_NUM 1 +#define HNS3_SELF_TEST_TPYE_NUM 2 #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,6 +78,7 @@ 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: ret = h->ae_algo->ops->set_loopback(h, loop, en); break; @@ -303,6 +304,10 @@ static void hns3_self_test(struct net_device *ndev, st_param[HNAE3_MAC_INTER_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] = + h->flags & HNAE3_SUPPORT_SERDES_LOOPBACK; + if (if_running) dev_close(ndev); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index cd0a4f228470..821d4c2f84bd 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -94,6 +94,7 @@ enum hclge_opcode_type { HCLGE_OPC_QUERY_LINK_STATUS = 0x0307, HCLGE_OPC_CONFIG_MAX_FRM_SIZE = 0x0308, HCLGE_OPC_CONFIG_SPEED_DUP = 0x0309, + HCLGE_OPC_SERDES_LOOPBACK = 0x0315, /* PFC/Pause commands */ HCLGE_OPC_CFG_MAC_PAUSE_EN = 0x0701, @@ -775,6 +776,17 @@ struct hclge_reset_cmd { u8 fun_reset_vfid; u8 rsv[22]; }; + +#define HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B BIT(0) +#define HCLGE_CMD_SERDES_DONE_B BIT(0) +#define HCLGE_CMD_SERDES_SUCCESS_B BIT(1) +struct hclge_serdes_lb_cmd { + u8 mask; + u8 enable; + u8 result; + u8 rsv[21]; +}; + #define HCLGE_DEFAULT_TX_BUF 0x4000 /* 16k bytes */ #define HCLGE_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */ #define HCLGE_DEFAULT_DV 0xA000 /* 40k byte */ diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index fc813b7f20e8..99dda5051f5f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -787,9 +787,10 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset) hdev->hw.mac.speed == HCLGE_MAC_SPEED_1G) { count += 1; handle->flags |= HNAE3_SUPPORT_MAC_LOOPBACK; - } else { - count = -EOPNOTSUPP; } + + count ++; + handle->flags |= HNAE3_SUPPORT_SERDES_LOOPBACK; } else if (stringset == ETH_SS_STATS) { count = ARRAY_SIZE(g_mac_stats_string) + ARRAY_SIZE(g_all_32bit_stats_string) + @@ -3670,6 +3671,55 @@ static int hclge_set_mac_loopback(struct hclge_dev *hdev, bool en) return ret; } +static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en) +{ +#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; + + req = (struct hclge_serdes_lb_cmd *)&desc.data[0]; + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SERDES_LOOPBACK, false); + + if (en) { + req->enable = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + req->mask = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + } else { + req->mask = HCLGE_CMD_SERDES_SERIAL_INNER_LOOP_B; + } + + ret = hclge_cmd_send(&hdev->hw, &desc, 1); + if (ret) { + dev_err(&hdev->pdev->dev, + "serdes loopback set fail, ret = %d\n", ret); + return ret; + } + + do { + msleep(HCLGE_SERDES_RETRY_MS); + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SERDES_LOOPBACK, + true); + ret = hclge_cmd_send(&hdev->hw, &desc, 1); + if (ret) { + dev_err(&hdev->pdev->dev, + "serdes loopback get, ret = %d\n", ret); + return ret; + } + } while (++i < HCLGE_SERDES_RETRY_NUM && + !(req->result & HCLGE_CMD_SERDES_DONE_B)); + + if (!(req->result & HCLGE_CMD_SERDES_DONE_B)) { + dev_err(&hdev->pdev->dev, "serdes loopback set timeout\n"); + return -EBUSY; + } else if (!(req->result & HCLGE_CMD_SERDES_SUCCESS_B)) { + dev_err(&hdev->pdev->dev, "serdes loopback set failed in fw\n"); + return -EIO; + } + + return 0; +} + static int hclge_set_loopback(struct hnae3_handle *handle, enum hnae3_loop loop_mode, bool en) { @@ -3681,6 +3731,9 @@ static int hclge_set_loopback(struct hnae3_handle *handle, case HNAE3_MAC_INTER_LOOP_MAC: ret = hclge_set_mac_loopback(hdev, en); break; + case HNAE3_MAC_INTER_LOOP_SERDES: + ret = hclge_set_serdes_loopback(hdev, en); + break; default: ret = -ENOTSUPP; dev_err(&hdev->pdev->dev, From patchwork Sun Aug 12 09:47: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: 143982 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892385ljj; Sun, 12 Aug 2018 02:48:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwXyUAfbvZBzY6S+6jOL96ewrzC7+aiWgQWSziA9PbdbIjzoE9GXfF9ItsXAc1vDnaTHZ60 X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr12821140plt.288.1534067321490; Sun, 12 Aug 2018 02:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067321; cv=none; d=google.com; s=arc-20160816; b=wavOqYM6S3dvpA8YJ/TxSel2Ghus9V47w5G42+55dDkkG7+P+Rt0WjHNUgSpozh6AR XmTv/S2Fy3Un40M0kTgxgN9ITTixDX5xyFvqKDsUQmzUk1BVYMn0G7AGpYpQWVKE+59P CXO2DdBLc4dM2qncgkZxRRBGr5LUFQ4jaZgPRLy6VC3leBBaMg4OD4081jgh5O1omXf2 gzoz4cPxinur9iKxut0Nqis/B+aiGpCM3aDn0PjHuII/I2S7l3LbbkZXNL1wL7qp/WoD jPixnFyVNmvNVA7V3rjyCFCGxifBM/Ps3SY5KdiD1loDIOyrqN4l7WhwQF4cu0XhPXWO YiBw== 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=n7AA9S1UIfAVlVWOhLC/c2yfg/yyQ0soRM+o2QFKNh8=; b=dgbOZm5p0XsyLJ9SnrYiQKRM3elgTR4tj3UBPdvI8w/9JV88fEMkMZ0SlnYN4pJQhg UNMyiN1+ZxKawzuUFBaQ3/CuG+w15eFWkV9CJBzQMw7YszkzV9ES3BQcdicQ/IK8TtQh BPM6OiDZcklwl5CqT/HJTysbLGhJHr6uG1vrHJTKdcICtnAOMC8LqS5kySbMWwDYZCCA RlT/8fJkYX5HLJIAjfuktSa6fNOXeOe3J3g5ZDPzoNENEAmsObyJPB5OoB0kKNNDhBSX c3+Ni8q2oTrWpW1l2qYyXPRInW2XdqdsP/Wn5EuWtDWOkFqomgYAR/+7DnGkTds6zEd+ FwyQ== 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 t1-v6si16342477pfb.208.2018.08.12.02.48.41; Sun, 12 Aug 2018 02:48:41 -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 S1728046AbeHLM0F (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:05 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10704 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727990AbeHLM0E (ORCPT ); Sun, 12 Aug 2018 08:26:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 784E0D2BD17F6; Sun, 12 Aug 2018 17:48:34 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:26 +0800 From: Salil Mehta To: CC: , , , , , , , Xi Wang Subject: [PATCH net-next 2/9] net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero Date: Sun, 12 Aug 2018 10:47:31 +0100 Message-ID: <20180812094738.14852-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xi Wang According to the functional specification of hardward, the first descriptor of response from command 'lookup vlan talbe' is not valid. Currently, the first descriptor is parsed as normal value, which will cause an expected error. This patch fixes this problem by skipping the first descriptor. Signed-off-by: Xi Wang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 99dda5051f5f..18ae11d8de73 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3930,7 +3930,7 @@ static bool hclge_is_all_function_id_zero(struct hclge_desc *desc) #define HCLGE_FUNC_NUMBER_PER_DESC 6 int i, j; - for (i = 0; i < HCLGE_DESC_NUMBER; i++) + for (i = 1; i < HCLGE_DESC_NUMBER; i++) for (j = 0; j < HCLGE_FUNC_NUMBER_PER_DESC; j++) if (desc[i].data[j]) return false; From patchwork Sun Aug 12 09:47: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: 143989 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1893047ljj; Sun, 12 Aug 2018 02:49:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyG20Yknh8liJU1wNZ+VPPyisECaw5La8AXj+H2+tPHem8TEjNl/1FcewZae6ihdPrjgeHx X-Received: by 2002:a63:e318:: with SMTP id f24-v6mr12633170pgh.175.1534067371987; Sun, 12 Aug 2018 02:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067371; cv=none; d=google.com; s=arc-20160816; b=aRxPfApd0r68RRhjV0OGCl/mzjv/uGJjmwWfC7u97LnGO3iWeP7H/E1WP/YP425BDE eDXFDVvsvqbj9bhFrQRRzmSvc7Q2C7wyD/BjWZgAw+zD0GmPuXX0nbf8Ehdg5/kc9I8/ fizM9FWYEPkdVmQ8iPGt/xpATj9j2SZ8DYuGYgoV7cZDJZlquRd04D8nCX7bg2KbJpxC DvHtSCI3Lq6ZvzXSRJcGSaZwQXK11Ti3hGkNuvL3Ct1hnu+JKV143oe/h7qQ2HoERMGT BsAc1HSXYn29FZITsuWVWoH28Rv35u2DYQB+3jg2hgrrdESE+YKkzp+jkaCEwvp35N6W 7GXQ== 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=BD/3kPoxmB7Hm1JLZc9oK+8/wALIlpHsKpUOyM7XFyg=; b=0JKkdYfzMjUFSayomKyrvUlKQ46l26FwB8AuSdUFbgC8Gv8DPkeCzTDyHwMwKcULh1 x0L+PIRQIMNdbEcFAOxjRKO/rkWM0oUYBfsWj2lK5OUuCll4D2Gim7SKPSKySH62W4EC /VovXKjech0rPDdX+ZKdL6pPCPrO2KeBdao2IInsQwqUOfqwf4NkXdKBCRcZvD/BZvkJ Gy4CrNdIJgGiRKZptdem4UOtj4VdEyRUdJNEOxwJxmA1vKoE1aHq5SXDAzXnncnQxPSO wuyyKTYs5IUcdf0+TeBRwz3i36Ga7wd2F2FsESVBicYl7FtAKKgTtnGZWVkPXoUWungc iLaw== 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 y141-v6si16563406pfb.331.2018.08.12.02.49.31; Sun, 12 Aug 2018 02:49:31 -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 S1728015AbeHLM0E (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10703 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727736AbeHLM0E (ORCPT ); Sun, 12 Aug 2018 08:26:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7C3F5F70A7DC4; Sun, 12 Aug 2018 17:48:34 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:29 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 3/9] net: hns3: Fix for information of phydev lost problem when down/up Date: Sun, 12 Aug 2018 10:47:32 +0100 Message-ID: <20180812094738.14852-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 Function call of phy_connect_direct will reinitialize phydev. Some information like advertising will be lost. Phy_connect_direct only needs to be called once. And driver can run well. This patch adds some functions to ensure that phy_connect_direct is called only once to solve the information of phydev lost problem occurring when we stop the net and open it again. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 24 +++++++++++++++++---- .../ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 25 ++++++++++++++++++---- .../ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h | 4 +++- 3 files changed, 44 insertions(+), 9 deletions(-) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 18ae11d8de73..3b7cd6744280 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3782,7 +3782,7 @@ static int hclge_ae_start(struct hnae3_handle *handle) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - int i, ret; + int i; for (i = 0; i < vport->alloc_tqps; i++) hclge_tqp_enable(hdev, i, 0, true); @@ -3796,9 +3796,7 @@ static int hclge_ae_start(struct hnae3_handle *handle) /* reset tqp stats */ hclge_reset_tqp_stats(handle); - ret = hclge_mac_start_phy(hdev); - if (ret) - return ret; + hclge_mac_start_phy(hdev); return 0; } @@ -5417,6 +5415,16 @@ static void hclge_get_mdix_mode(struct hnae3_handle *handle, *tp_mdix = ETH_TP_MDI; } +static int hclge_init_instance_hw(struct hclge_dev *hdev) +{ + return hclge_mac_connect_phy(hdev); +} + +static void hclge_uninit_instance_hw(struct hclge_dev *hdev) +{ + hclge_mac_disconnect_phy(hdev); +} + static int hclge_init_client_instance(struct hnae3_client *client, struct hnae3_ae_dev *ae_dev) { @@ -5436,6 +5444,13 @@ static int hclge_init_client_instance(struct hnae3_client *client, if (ret) return ret; + ret = hclge_init_instance_hw(hdev); + if (ret) { + client->ops->uninit_instance(&vport->nic, + 0); + return ret; + } + if (hdev->roce_client && hnae3_dev_roce_supported(hdev)) { struct hnae3_client *rc = hdev->roce_client; @@ -5498,6 +5513,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client, if (client->type == HNAE3_CLIENT_ROCE) return; if (client->ops->uninit_instance) { + hclge_uninit_instance_hw(hdev); client->ops->uninit_instance(&vport->nic, 0); hdev->nic_client = NULL; vport->nic.client = NULL; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c index 2065ee2fd358..85a123d40e8b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c @@ -193,7 +193,7 @@ static void hclge_mac_adjust_link(struct net_device *netdev) netdev_err(netdev, "failed to configure flow control.\n"); } -int hclge_mac_start_phy(struct hclge_dev *hdev) +int hclge_mac_connect_phy(struct hclge_dev *hdev) { struct net_device *netdev = hdev->vport[0].nic.netdev; struct phy_device *phydev = hdev->hw.mac.phydev; @@ -213,11 +213,29 @@ int hclge_mac_start_phy(struct hclge_dev *hdev) phydev->supported &= HCLGE_PHY_SUPPORTED_FEATURES; phydev->advertising = phydev->supported; - phy_start(phydev); - return 0; } +void hclge_mac_disconnect_phy(struct hclge_dev *hdev) +{ + struct phy_device *phydev = hdev->hw.mac.phydev; + + if (!phydev) + return; + + phy_disconnect(phydev); +} + +void hclge_mac_start_phy(struct hclge_dev *hdev) +{ + struct phy_device *phydev = hdev->hw.mac.phydev; + + if (!phydev) + return; + + phy_start(phydev); +} + void hclge_mac_stop_phy(struct hclge_dev *hdev) { struct net_device *netdev = hdev->vport[0].nic.netdev; @@ -227,5 +245,4 @@ void hclge_mac_stop_phy(struct hclge_dev *hdev) return; phy_stop(phydev); - phy_disconnect(phydev); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h index bb3ce35e0d66..5fbf7dddb5d9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h @@ -5,7 +5,9 @@ #define __HCLGE_MDIO_H int hclge_mac_mdio_config(struct hclge_dev *hdev); -int hclge_mac_start_phy(struct hclge_dev *hdev); +int hclge_mac_connect_phy(struct hclge_dev *hdev); +void hclge_mac_disconnect_phy(struct hclge_dev *hdev); +void hclge_mac_start_phy(struct hclge_dev *hdev); void hclge_mac_stop_phy(struct hclge_dev *hdev); #endif From patchwork Sun Aug 12 09:47: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: 143983 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892444ljj; Sun, 12 Aug 2018 02:48:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPztQQoO5TR9PaUEZKm0vVND2jt7PkeCbpyGTfuOPnP6X4q7nZSY3clcRKsfUTXdhYUS6nEQ X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr12665768plb.80.1534067326007; Sun, 12 Aug 2018 02:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067325; cv=none; d=google.com; s=arc-20160816; b=D/Evs15NfDc/+vX8HA9wIbcMiyNh9EEsc03nFFHeSJFQZjgYW1PWsx9UDilQai1DQ2 Qt7E5IgdXTUCTzWONdZyznSY+OI+SKDNwvu8t6JN5z0wtNosqByBARND4sAa4B2BrhcI HKgn/qlTnXXt6twPOs1eAI5FVy541qQQCIbypWLCtSmWN8kvvUiE6HdMo0L0AWhRJEvT PAJp8+nisYgOapP5/1G3eG+JYKC2LUhkEbwNn+R0X/YKlgK/fOYsD04uhtmhLnRqJ1Nu NquuCXkYAQGl8qpTS/6XJWi0NCAmwzbIpTytGOSIfGR0hwo4YV7TVwTv+3KrmdqznpXH IvhQ== 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=2YGrKF5QrvOY8KuFV+wJbEUvl2Qj62bWLgaG3hpPzCk=; b=v9zMbzLxRM7XfkPYmZytxrLETMFXmUMsvUpy8rZlb8tnJQY2clpcNr+AazOPd46N+p PFW16ThjP9aJsi3ee3vG2KmN1tRm3xD+ecGZEVFUZedgV3HCB96jPQ3HsAYGZVfqG2+X DpwbCy/j94Qq2W5AiNNbqL5B0LdT40W3D2DrLBTczjnlDTA1XyyMworctrjGQ3GdChuR GpWNiyfW0gMpOUljRAlRC3O/seNWt1jbbdRtgpBFALQNWklB8IQFhgKi7wzAty8myHIE BVE6JP7DZc254+GRa9JYdpw/eRN1UM8IJbYNccDo3kBXFZKE9ng9Utp+hH8IqUcAsl1H hapQ== 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 61-v6si6299474plz.447.2018.08.12.02.48.45; Sun, 12 Aug 2018 02:48: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 S1728078AbeHLM0J (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:09 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10657 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727990AbeHLM0J (ORCPT ); Sun, 12 Aug 2018 08:26:09 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 00D6168A60A95; Sun, 12 Aug 2018 17:48:40 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:33 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 4/9] net: hns3: Fix for phy link issue when using marvell phy driver Date: Sun, 12 Aug 2018 10:47:33 +0100 Message-ID: <20180812094738.14852-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen For marvell phy m88e1510, bit SUPPORTED_FIBRE of phydev->supported is default on. Both phy_resume() and phy_suspend() will check the SUPPORTED_FIBRE bit and write register of fibre page. Currently in hns3 driver, the SUPPORTED_FIBRE bit will be cleared after phy_connect_direct() finished. Because phy_resume() is called in phy_connect_direct(), and phy_suspend() is called when disconnect phy device, so the operation for fibre page register is not symmetrical. It will cause phy link issue when reload hns3 driver. This patch fixes it by disable the SUPPORTED_FIBRE before connecting phy. This is a temporary scheme for DTS2018050311542. I'm contacking with the FAE of marvell phy, wish to get a better way to deal with it. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c index 85a123d40e8b..398971a062f4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c @@ -202,6 +202,8 @@ int hclge_mac_connect_phy(struct hclge_dev *hdev) if (!phydev) return 0; + phydev->supported &= ~SUPPORTED_FIBRE; + ret = phy_connect_direct(netdev, phydev, hclge_mac_adjust_link, PHY_INTERFACE_MODE_SGMII); From patchwork Sun Aug 12 09:47: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: 143988 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892861ljj; Sun, 12 Aug 2018 02:49:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx3n8VJD16drPno5eAj2HH/ld7H7aNTv5qNc8p+RRSdzfY32wUx5kBn5jLCA8s+H8IrblLG X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr12530219plp.18.1534067361368; Sun, 12 Aug 2018 02:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067361; cv=none; d=google.com; s=arc-20160816; b=S/NheT9vDhx3rIdL+Vgi33b8P4kTyTELidbmHhtB6y1iPkJeVilHAI64gpDIgkLzju 45b9s0VXIQhoQVsGHFDeUhOHsOiH93kUYBqIVapfC4UEII+cAPJS83ArX+8taE0vR+2/ xbUhATahXBk8ouCuqwbJuOgJLYQNlpGS9ovLQkM3wQCAnv6eTOLQd/Nw7DcXgjhe40fa vbNLwnQlZkbiDjhp93ve4kmUFjg1wt9zKdfiBJnh4ckap3L8LBfWGdV0nWJlT3Nv6NXU K253+gErwh/jJ0MVU0Y0LZxdS3L3XXPUVNJ1vTQbAB1a8/ubmT0bk2ZBnI8UVfWXO4W4 D/qQ== 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=4jrM8K8CnCODMMCGjhg7/FdWQgwXfZKHW4FnC+QNk3o=; b=HnL8FWhVpHl7jDagIWUoZgPOkHo+RXuMxpKRWhz2rjLqYhtCNR1pK2itVbAg+LpJp8 6x2FOQd9WuB0O95kAxyScymvLHrTel06F1eJQqeKrUXOeUN+n5nKuKvZXceyeA8tP5w/ vF/tobopXgXDO5EGiTC+4xE9BQoRCA9/cL8KprmnkOzs4aEz3Grxhv1Mly7mRSfbq3RX pT1YJzoxYiUeSgAzpxidfGeTX27UtB+mflTxXr2yesF7muASKXfTNnHhoaN+DTHtz7VB 9e4diAlbDNp/zgqFhNW8c7ORqbwcjuDNsD2sRhS75wm4xwfrB7xPzPfZx7OFzpJ5Pg5b 8Vzw== 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 c192-v6si14794389pfg.347.2018.08.12.02.49.21; Sun, 12 Aug 2018 02:49:21 -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 S1728196AbeHLM0p (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:45 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10659 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728084AbeHLM0P (ORCPT ); Sun, 12 Aug 2018 08:26:15 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0EB28DF8384A; Sun, 12 Aug 2018 17:48:45 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:39 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 6/9] net: hns3: Fix desc num set to default when setting channel Date: Sun, 12 Aug 2018 10:47:35 +0100 Message-ID: <20180812094738.14852-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 When user set the channel num using "ethtool -L ethX", the desc num of BD will set to default value, which will cause desc num set by user lost problem. This patch fixes it by restoring the desc num set by user when setting channel num. Fixes: 09f2af6405b8 ("net: hns3: add support to modify tqps number") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index c88f5e6a9b77..8510245705cc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1267,35 +1267,37 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id, return ret; } -static int hclge_assign_tqp(struct hclge_vport *vport, - struct hnae3_queue **tqp, u16 num_tqps) +static int hclge_assign_tqp(struct hclge_vport *vport) { + struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; struct hclge_dev *hdev = vport->back; int i, alloced; for (i = 0, alloced = 0; i < hdev->num_tqps && - alloced < num_tqps; i++) { + alloced < kinfo->num_tqps; i++) { if (!hdev->htqp[i].alloced) { hdev->htqp[i].q.handle = &vport->nic; hdev->htqp[i].q.tqp_index = alloced; - tqp[alloced] = &hdev->htqp[i].q; + hdev->htqp[i].q.desc_num = kinfo->num_desc; + kinfo->tqp[alloced] = &hdev->htqp[i].q; hdev->htqp[i].alloced = true; alloced++; } } - vport->alloc_tqps = num_tqps; + vport->alloc_tqps = kinfo->num_tqps; return 0; } -static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps) +static int hclge_knic_setup(struct hclge_vport *vport, + u16 num_tqps, u16 num_desc) { struct hnae3_handle *nic = &vport->nic; struct hnae3_knic_private_info *kinfo = &nic->kinfo; struct hclge_dev *hdev = vport->back; int i, ret; - kinfo->num_desc = hdev->num_desc; + kinfo->num_desc = num_desc; kinfo->rx_buf_len = hdev->rx_buf_len; kinfo->num_tc = min_t(u16, num_tqps, hdev->tm_info.num_tc); kinfo->rss_size @@ -1322,7 +1324,7 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps) if (!kinfo->tqp) return -ENOMEM; - ret = hclge_assign_tqp(vport, kinfo->tqp, kinfo->num_tqps); + ret = hclge_assign_tqp(vport); if (ret) dev_err(&hdev->pdev->dev, "fail to assign TQPs %d.\n", ret); @@ -1388,7 +1390,7 @@ static int hclge_vport_setup(struct hclge_vport *vport, u16 num_tqps) nic->numa_node_mask = hdev->numa_node_mask; if (hdev->ae_dev->dev_type == HNAE3_DEV_KNIC) { - ret = hclge_knic_setup(vport, num_tqps); + ret = hclge_knic_setup(vport, num_tqps, hdev->num_desc); if (ret) { dev_err(&hdev->pdev->dev, "knic setup failed %d\n", ret); @@ -5944,7 +5946,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num) /* Free old tqps, and reallocate with new tqp number when nic setup */ hclge_release_tqp(vport); - ret = hclge_knic_setup(vport, new_tqps_num); + ret = hclge_knic_setup(vport, new_tqps_num, kinfo->num_desc); if (ret) { dev_err(&hdev->pdev->dev, "setup nic fail, ret =%d\n", ret); return ret; From patchwork Sun Aug 12 09:47: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: 143985 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892552ljj; Sun, 12 Aug 2018 02:48:57 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy67ukIKFbYrP94fvbzsLcvq2G6ZpOohaO5QRKL+jv5eWpX3bn4IpQI3jHFmC75BzespNHc X-Received: by 2002:a63:7a43:: with SMTP id j3-v6mr12739345pgn.363.1534067337034; Sun, 12 Aug 2018 02:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067337; cv=none; d=google.com; s=arc-20160816; b=NoMIP7NGvCYyhFcTnx5ATxgBbLNDKNE93aracjIEJSzUJ5qWuJzyLpMbAXMzbBM2qN Vq1lSmHlDMyRKMy/19As9CtJjqHGbQj10h29pU6GK35gVBGjdevunmYPBQi6EERghOHz KIAO8cn6mD12o5I2YwENeOFnl6IFlC+OL0ebe43cix02uWeHyBEYRA9sggOah/aaQFIy oCu2MvUECUgHcDHNIHimLstnZGoekUpBYNSHjikX7A4ynlgA0CzEmaggPIJOQaS2WoUw Uk2/GR/U50ulQGplJKJt+u7HjhuOmL7FjHcucUhQA8pWvRqyGLNDMD5AcAhSDu6LNTRt ZFeg== 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=0K8xPWQh1NG2jTUPbNuFYNpi+u6A2k0xNYE7hgWe1KI=; b=hCjAascg0WJ4R5P64FyYQFM3uMhj3bfxgyjCVs9PXHkjPSjuW4CyIBvZWNxZ48vvfB I5sqQWyWonyzERunn1fhT8Vp+HR8YDIO88PzCfZR6TfebJw9Hb81lrb39Dlh1ZtlaToC tLmJGSD/LUVMFc3cOqi//ViMEmLMRaT2QBkVgc61IYogHmJ9PCl7rfcCHzNoM4GI1rTF oFf4mvXw8UY2GeXu7Ev6vUE+tSRsg7hMw5xuL3t1wMzTzB6vXTKoDdNAsVgdrW2fQo6m mf3243Cbo8fUa9v7GZe3WrmcDi+FGVT9B6W32GBu/XEMcXJqgbO4T+Ia1sIt3O3bJL/I /sMw== 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 h65-v6si17174868pfb.70.2018.08.12.02.48.56; Sun, 12 Aug 2018 02:48:57 -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 S1728126AbeHLM0U (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10705 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727580AbeHLM0U (ORCPT ); Sun, 12 Aug 2018 08:26:20 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id AD5931F89F38C; Sun, 12 Aug 2018 17:48:49 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:42 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 7/9] net: hns3: Remove tx ring BD len register in hns3_enet Date: Sun, 12 Aug 2018 10:47:36 +0100 Message-ID: <20180812094738.14852-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 There is no HNS3_RING_TX_RING_BD_LEN_REG register according to UM, so this patch removes it. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 -- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 1 - 2 files changed, 3 deletions(-) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index a64d69c87f13..b7b9ee3f4d20 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2969,8 +2969,6 @@ static void hns3_init_ring_hw(struct hns3_enet_ring *ring) hns3_write_dev(q, HNS3_RING_TX_RING_BASEADDR_H_REG, (u32)((dma >> 31) >> 1)); - hns3_write_dev(q, HNS3_RING_TX_RING_BD_LEN_REG, - hns3_buf_size2type(ring->buf_size)); hns3_write_dev(q, HNS3_RING_TX_RING_BD_NUM_REG, ring->desc_num / 8 - 1); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index e4b4a8f2ceaa..0f071a0f4ff9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -37,7 +37,6 @@ enum hns3_nic_state { #define HNS3_RING_TX_RING_BASEADDR_L_REG 0x00040 #define HNS3_RING_TX_RING_BASEADDR_H_REG 0x00044 #define HNS3_RING_TX_RING_BD_NUM_REG 0x00048 -#define HNS3_RING_TX_RING_BD_LEN_REG 0x0004C #define HNS3_RING_TX_RING_TAIL_REG 0x00058 #define HNS3_RING_TX_RING_HEAD_REG 0x0005C #define HNS3_RING_TX_RING_FBDNUM_REG 0x00060 From patchwork Sun Aug 12 09:47: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: 143986 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892587ljj; Sun, 12 Aug 2018 02:49:01 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxEU0L1AMoQukIsoXqsDqA8kSWBMLucGp/IaNQK89xMeE4TuppWBlxqGLwn38booFll04t/ X-Received: by 2002:a63:7558:: with SMTP id f24-v6mr13189829pgn.314.1534067341261; Sun, 12 Aug 2018 02:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067341; cv=none; d=google.com; s=arc-20160816; b=ZFQwzAl+FV8Jl22Urkgr2rxm/Ttv8y6NBNEdMesS8m7Clr+5wQReHlkJAdi7MIz7n6 AGdFAAyzjFlVYFHIPlFaVGlRXUKnQD4PYKiOppmUGnA0NgzWY9uK3x9wgFGzqApZK5qI uGZbgOY6Ck5hSlhgIQyqRHu2iWjoxxlNS4cTNGgfutw8fjA/JGQB1jnWFGGRM9cf/iM/ ZHxQ6fibbpYUlcGYQIJV6IaBp78f4vN/1sw5EO+juD/C5R+rwIQ88pTUh3XEtKe+6bRL o04pRi9yBYDmeHHD68cAiwh+2y74leBwFIG26ChVRs/UPq9agLwcGz8mz7ivfAha0U7m HXJQ== 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=jIYHyC75yVa01JoUoxYRwWBe8ty7UsbLv+mbqS+8eKY=; b=vihNH3mWtOBV9r5EU3ipfYN94ONZsQqziZccD0vwLIhtQ+o61kdmHFntyIAcTETG/9 tek49+ug+Ze0Y+HBTzmxabNM1QZVAms6Mev25FS+b2HhZyAU6pI5aLKDFcuBzxHk1J8l z3I7tyo4OJzqIHFj8fvmTWu80xys8iZ3tyDgQg37NSL2cRvsfIPMe+1LackVvTAZVwP/ HWuKZvrxzSqUZPQEFTb1AOW5DaLtLJLekZ04WSg2rO3RW9lh/uSAV2zD15fJYhsd6X3h vqU9/QZ8aRHX1eIJh9WpYNYXF/xKv2KmZRJEAoMik2ClLrzLxA7kPfBrDgwGoeeoa67U jSgA== 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 t89-v6si15784334pfe.59.2018.08.12.02.49.01; Sun, 12 Aug 2018 02:49:01 -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 S1728149AbeHLM0Z (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:25 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36887 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727826AbeHLM0Z (ORCPT ); Sun, 12 Aug 2018 08:26:25 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CFC9CA68CA49D; Sun, 12 Aug 2018 17:48:54 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:46 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 8/9] net: hns3: Set tx ring' tc info when netdev is up Date: Sun, 12 Aug 2018 10:47:37 +0100 Message-ID: <20180812094738.14852-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 HNS3_RING_TX_RING_TC_REG register is used to map tx ring to specific tc, the tx queue to tc mapping is needed by the hardware to do the correct tx schedule. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 24 ++++++++++++++++++++++++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 1 + 2 files changed, 25 insertions(+) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b7b9ee3f4d20..b28c7e142308 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2974,6 +2974,28 @@ static void hns3_init_ring_hw(struct hns3_enet_ring *ring) } } +static void hns3_init_tx_ring_tc(struct hns3_nic_priv *priv) +{ + struct hnae3_knic_private_info *kinfo = &priv->ae_handle->kinfo; + int i; + + for (i = 0; i < HNAE3_MAX_TC; i++) { + struct hnae3_tc_info *tc_info = &kinfo->tc_info[i]; + int j; + + if (!tc_info->enable) + continue; + + for (j = 0; j < tc_info->tqp_count; j++) { + struct hnae3_queue *q; + + q = priv->ring_data[tc_info->tqp_offset + j].ring->tqp; + hns3_write_dev(q, HNS3_RING_TX_RING_TC_REG, + tc_info->tc); + } + } +} + int hns3_init_all_ring(struct hns3_nic_priv *priv) { struct hnae3_handle *h = priv->ae_handle; @@ -3385,6 +3407,8 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) rx_ring->next_to_use = 0; } + hns3_init_tx_ring_tc(priv); + return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 0f071a0f4ff9..a02a96aee2a2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -37,6 +37,7 @@ enum hns3_nic_state { #define HNS3_RING_TX_RING_BASEADDR_L_REG 0x00040 #define HNS3_RING_TX_RING_BASEADDR_H_REG 0x00044 #define HNS3_RING_TX_RING_BD_NUM_REG 0x00048 +#define HNS3_RING_TX_RING_TC_REG 0x00050 #define HNS3_RING_TX_RING_TAIL_REG 0x00058 #define HNS3_RING_TX_RING_HEAD_REG 0x0005C #define HNS3_RING_TX_RING_FBDNUM_REG 0x00060 From patchwork Sun Aug 12 09:47: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: 143987 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892678ljj; Sun, 12 Aug 2018 02:49:09 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwA0388S5JeBedMSf5lq7IvKniqHWOu8b/JQEM6iL4/IiAfq+z/1gPsXTGLW+w0YILuTdAO X-Received: by 2002:a17:902:e28b:: with SMTP id cf11-v6mr12703410plb.86.1534067349167; Sun, 12 Aug 2018 02:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067349; cv=none; d=google.com; s=arc-20160816; b=eLBzlXwmOIw2b0iNeGyNjy4KwOWBhWOJ9yjzNJ2s2wY4QKBsv1/bUb68KthiAqWJ5R Y5b0tWQLwNFUzDot02QU2rllyDxM6swepvU8AkOA9HO0/uEmEtHIY563E7ZFxLpn5kfT 3LU+UJXexFqcUJDQwLLZ/5wjUSwT3X4Ttxg2wkpvZYjqyyqQTVRTFTacLDbFCTkd8c4s SeeQ6SfEPe5jqaYfLDsZk3apvLTbvSJEv3OHoqIudktUEz+TLk7wXrui75ASQfIp4yxJ yZoXIGxx/CIEUaZQsPLfPEXhdu0g9gSFe2Lfd+EPDWM5qD0vxHi179FLN9g1eD/UjALg BEEg== 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=TDchybwhI9/l9sSvXs7rOhSQZjnlYL/OOblYG409ibw=; b=VK3wDyjwMmH6l18sd9G/Mbe7CWeHdStzt0tYUN+B4JMdYUJdb3ARDCNLTZtebcFfUr R88D+DTFgqNK93iFvjRQ3kDbPqAtVVuep/EoBaW0k2yMU5R1iKai2w/pUAoLr2eel2NL OsAxDSfMaSLNSQPM4walepth8Nzr9ht2u+781lHBi8mMGaYQfNFuUt6VGepbIk2lPrww GpDM3I0B8PfUXm3DkHQPl0HwcjuaXp/DjL5BUr7sQ3p42EnYs2KRpg8PaVzyHm862YlD kMYbJi1yiJo48uzYhahzTmobLWCAlQdTA9NPyXX+KCSNqU0PRO+yvkRcRRlsNHPq/qaw WfKQ== 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 t89-v6si15784334pfe.59.2018.08.12.02.49.08; Sun, 12 Aug 2018 02:49:09 -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 S1728172AbeHLM0d (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:33 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36886 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727580AbeHLM0Z (ORCPT ); Sun, 12 Aug 2018 08:26:25 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D453AD213CF66; Sun, 12 Aug 2018 17:48:54 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:49 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH net-next 9/9] net: hns3: Add vlan filter setting by ethtool command -K Date: Sun, 12 Aug 2018 10:47:38 +0100 Message-ID: <20180812094738.14852-10-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 Revision(0x20) HW does not support enabling or disabling individual netdev's HW_VLAN_CTAG_FILTER feature, and Revision(0x21) supports enabling or disabling individual netdev's HW_VLAN_CTAG_FILTER feature. Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b28c7e142308..3554dca7a680 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1673,6 +1673,9 @@ static struct pci_driver hns3_driver = { /* set default feature to hns3 */ static void hns3_set_default_feature(struct net_device *netdev) { + struct hnae3_handle *h = hns3_get_handle(netdev); + struct pci_dev *pdev = h->pdev; + netdev->priv_flags |= IFF_UNICAST_FLT; netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -1706,6 +1709,9 @@ static void hns3_set_default_feature(struct net_device *netdev) 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; + + if (pdev->revision != 0x20) + netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; } static int hns3_alloc_buffer(struct hns3_enet_ring *ring,