From patchwork Fri Sep 21 15:41: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: 147288 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970767ljw; Fri, 21 Sep 2018 08:43:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZFWdms54sG7aiAMliTNeSTKGusPA7xyQqihZK6doo7PFCdjVc/4Y642clI1ZMYK8x8MrE X-Received: by 2002:a62:ba0b:: with SMTP id k11-v6mr47408970pff.171.1537544581705; Fri, 21 Sep 2018 08:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544581; cv=none; d=google.com; s=arc-20160816; b=QxU6OTUDcaQWDPZ/aBR9bdS8mMQlqVtAunYFQv80Fa1zDx1Ypp3rF7KLEqgFy9B6WY 8fSGgOgZkRGYXwvPf6+JD34bahNbBk9KcFkCPeNEWeZac9oN+kdkwyg8dA2hVT1KDTrp fN33FiRRTV5lp6+qyInqKN3WNqUiWWjP1K3YNuaHHzC7DAypB+794iTclg07l3IQzHyq OouOMTt99z8EQttrEfVMN7aR4zcGwmBRGFouPHBJeoOQuI7XGpIHwHWG1Ekbn3oz9qId jnubT9T/ebheXkQ2tErqAHNwJj5YA7OAzRNv4Kq+6/xj1eCNLrO+bGauRxHxBgoSdMdO kocQ== 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=QiV0JvhaRq6jolQbl9ZrhCK5w0bD/pveLYvLefoziQw=; b=krCU5XaDiMWFSdkklxgWRRiVBEXjw9t3JwYIg9C+CLzlw5g36u+O4LsKw1XBU8ZbuX QP5oGHmIrMPlQaHfwlAv4OaXAZjS4tB3dCdmHHKZ9dAX2x34HjB6Hd4g3AqNWZ3YRLbO 7Ps2iTbEWYmm+GosIrWg6rNDISks5+yB8sUtuUMylHFqFzvJD4J9+6YmBCPrc5Y6KGxt bL4dzqUc2LwSsgvrY/xXLnuiptc42R6w98mMleIlTsGHvB6ZjrW09oqyEisCf3su0SUQ sxpOzkWJ3QL1u51uFc5HA5M0Y/SpcRrOHdPhFczE1KKcOMTSfplf2tgS03ItzEB6ufyR l1FA== 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 g38-v6si2393882pgm.193.2018.09.21.08.42.59; Fri, 21 Sep 2018 08:43: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 S2390480AbeIUVcY (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:24 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47103 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389657AbeIUVcX (ORCPT ); Fri, 21 Sep 2018 17:32:23 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 16261455E789C; Fri, 21 Sep 2018 23:42:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:41 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 01/12] net: hns3: Fix ets validate issue Date: Fri, 21 Sep 2018 16:41:37 +0100 Message-ID: <20180921154148.26756-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen There is a defect in hclge_ets_validate(). If each member of tc_tsa is not IEEE_8021QAZ_TSA_ETS, the variable total_ets_bw won't be updated. In this case, the check for value of total_ets_bw will fail. This patch fixes it by checking total_ets_bw only after it has been updated. Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 f08ebb7..92f1938 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -73,6 +73,7 @@ static int hclge_ieee_getets(struct hnae3_handle *h, struct ieee_ets *ets) static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, u8 *tc, bool *changed) { + bool has_ets_tc = false; u32 total_ets_bw = 0; u8 max_tc = 0; u8 i; @@ -100,13 +101,14 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, *changed = true; total_ets_bw += ets->tc_tx_bw[i]; - break; + has_ets_tc = true; + break; default: return -EINVAL; } } - if (total_ets_bw != BW_PERCENT) + if (has_ets_tc && total_ets_bw != BW_PERCENT) return -EINVAL; *tc = max_tc + 1; From patchwork Fri Sep 21 15:41: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: 147289 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970779ljw; Fri, 21 Sep 2018 08:43:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbMEzelGjy1ttPOv4u3JHmIcUwul86WjqYSS4oCw5rBRuaRkAW1apscoFex/5BGc8saZL1+ X-Received: by 2002:a17:902:bc8b:: with SMTP id bb11-v6mr44322829plb.112.1537544582052; Fri, 21 Sep 2018 08:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544582; cv=none; d=google.com; s=arc-20160816; b=tqVrhSamk0ultVNRAl9MrEoQcJxGSzlfp4InEo7QZguUwm+0qpfqhAUjgPiGbtoXdU tOGprqAzli62CU8vpSpERkHDuElIlf9lk5Th6KHJAJ0ma0f0bNPQj0vvNXkHPxESUbaT 9sNZdW31OBQNlF/vun68EpPr88Yw47irMqqwDxZm2eWcbklQJnP1OiBVC8Ek6xP9HfdC VLQbFntWDN1XP5G84bD1+8stCDWhme4oEf/Y7HGZoYPgdRo438wLQEI+EFWMLc+2IfV6 bC+XMp8UCYHt8o/A8W97EqSMS1m6POkHUZXXvrUPQlNDtC813DSve/zwjDxExLf8Ap1o tPdA== 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=YJOZlXIWN7RkqwwhkdTtCJygywdS08QSMOO5kzOCM+s=; b=F0Ceg1l4KOZZ8Xkowqs4wJb/24bkwdElL6RACqOefNzyE2uycjzyiE+YYr+sEt3hNg J+W6KZsrK8UYattCTsrYl5Two2Hehb96SD2B4uXhT1Tz4ZSyE/VRWmqRhGO/+NjzPK5S n9ec8j5ft3/S8xyRiPgOQLQYuIwy0hi024CLzXumsDSROLQYIE7sjMXFCm/zlY0ggd5+ U3jMhDNHtuq/guG8jSFXJP0TqGZhkhlXMGxhjOsUiPClxuziEmZI9IzvnsZulOm1c6Lt GiflDXRxq1p0daaKgCun+hzbd2foj7wxPbh4nI/EgMEcC0QHpP/aKugta/94cGzT06iB nV2A== 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 g38-v6si2393882pgm.193.2018.09.21.08.43.01; Fri, 21 Sep 2018 08:43:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390524AbeIUVcZ (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:25 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42970 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727392AbeIUVcY (ORCPT ); Fri, 21 Sep 2018 17:32:24 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D74B3FD6494F1; Fri, 21 Sep 2018 23:42:52 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:44 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 02/12] net: hns3: Unify the type convert for desc.data Date: Fri, 21 Sep 2018 16:41:38 +0100 Message-ID: <20180921154148.26756-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen For desc.data is already point to the address of struct member "data[6]", it's unnecessary to use '&' to get its address. This patch unifies all the type convert for dest.data, using "req = (struct name *)dest.data". Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 6 +++--- 2 files changed, 5 insertions(+), 5 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 cf365d4..e9625ce 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3387,7 +3387,7 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en) struct hclge_desc desc; int ret, i = 0; - req = (struct hclge_serdes_lb_cmd *)&desc.data[0]; + req = (struct hclge_serdes_lb_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SERDES_LOOPBACK, false); if (en) { @@ -4634,7 +4634,7 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev) hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_INSERT, false); - tx_req = (struct hclge_tx_vlan_type_cfg_cmd *)&desc.data; + tx_req = (struct hclge_tx_vlan_type_cfg_cmd *)desc.data; tx_req->ot_vlan_type = cpu_to_le16(hdev->vlan_type_cfg.tx_ot_vlan_type); tx_req->in_vlan_type = cpu_to_le16(hdev->vlan_type_cfg.tx_in_vlan_type); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index 0282067..00bb394 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -172,7 +172,7 @@ static int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap, u8 pfc_bitmap) { struct hclge_desc desc; - struct hclge_pfc_en_cmd *pfc = (struct hclge_pfc_en_cmd *)&desc.data; + struct hclge_pfc_en_cmd *pfc = (struct hclge_pfc_en_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_PFC_PAUSE_EN, false); @@ -188,7 +188,7 @@ static int hclge_pause_param_cfg(struct hclge_dev *hdev, const u8 *addr, struct hclge_cfg_pause_param_cmd *pause_param; struct hclge_desc desc; - pause_param = (struct hclge_cfg_pause_param_cmd *)&desc.data; + pause_param = (struct hclge_cfg_pause_param_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_MAC_PARA, false); @@ -207,7 +207,7 @@ int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr) u8 trans_gap; int ret; - pause_param = (struct hclge_cfg_pause_param_cmd *)&desc.data; + pause_param = (struct hclge_cfg_pause_param_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_MAC_PARA, true); From patchwork Fri Sep 21 15:41: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: 147290 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970813ljw; Fri, 21 Sep 2018 08:43:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZUTCg14WBA84aFWWDe6MwexxzdXUmvTDepr4ILCsyJdd6vSaqgLhzW4B+ps1VmfH1ncIpQ X-Received: by 2002:a63:4044:: with SMTP id n65-v6mr40826843pga.90.1537544585335; Fri, 21 Sep 2018 08:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544585; cv=none; d=google.com; s=arc-20160816; b=ijsLGtSpoSIq4oYViV/l5e9I1qt1Tssh4u8VW6d3rMN2x0iOZnedN5tivF3wE46Vmj yA60+7Xlqrn+VkXaIJG9c3gMvSLvsp7vFLkVZC8630DO8dAbt0X/iTcSA6uH1oHa0Of8 aq+ZVjSefugPlYLpdHDxXUBO53TxHEbFBZEDnojD8O1J4+kCYytT1MZG+dLKqr1rk6z/ YqaNLE6T+CRxAbMo3Bsv/x1FNU0JutEg2TVCwNOtpKwA1t48Zyvtgph2moYQfwqCL04p 8ZXjjAIf/Iocxj1YiO+gmVJROJmS1TNg6lYbVAOD00D/lCDSvsudSJL51UGKmVvoIt6Y 79ng== 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=RC9VwT1E3tYRfG8lcuKq+eSTONWIpzDW0T7Dzzgid9k=; b=Zc3hDIAWRCvZDzi31Wcz/5UblTLP8fyVjkt9Z6LgVfoFEkojWBtpyCPJOCrWBS3Y/c yLaYwMnxM44pc6mc96cHt67LjSnJFEtcV2oT9Ca4K560i0roS/lqaWMPJYaP9bQHdLuC bmQx/izeMzOQQz3iD0oUGHdLe2CT8o7d2pVRRzBD02biO/+jtNYagyo+iD31OlP4q43L 1mq0xwBLDlD9WgMCrY/+RN7Vftk7H/vb79KFgSvej16rdX4GQQEiJkWRHzvAj2ltgnMD +K5r6vVod12V9riFS63AR/L53CCXYRa/rsAPOhU4GGSx7NqynFa/5ut5a88Nw9jmc/9g inyQ== 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 t25-v6si2543505pgn.56.2018.09.21.08.43.04; Fri, 21 Sep 2018 08:43: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 S2390556AbeIUVc2 (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:28 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42971 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389547AbeIUVcZ (ORCPT ); Fri, 21 Sep 2018 17:32:25 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DC7E8C761168D; Fri, 21 Sep 2018 23:42:52 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:47 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 03/12] net: hns3: Adjust prefix of tx/rx statistic names Date: Fri, 21 Sep 2018 16:41:39 +0100 Message-ID: <20180921154148.26756-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen Some prefix of tx/rx statistic names are redundant, this patch modifies these names. The new prefix looks like below: rxq#1_ -> rxq1_ txq#1_ -> txq1_ tx_dropped -> dropped tx_wake -> wake tx_busy -> busy rx_dropped -> dropped Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 10 +++++----- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 3cfb6b8..ce2e6ea 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -22,13 +22,13 @@ struct hns3_stats { static const struct hns3_stats hns3_txq_stats[] = { /* Tx per-queue statistics */ HNS3_TQP_STAT("io_err_cnt", io_err_cnt), - HNS3_TQP_STAT("tx_dropped", sw_err_cnt), + HNS3_TQP_STAT("dropped", sw_err_cnt), HNS3_TQP_STAT("seg_pkt_cnt", seg_pkt_cnt), HNS3_TQP_STAT("packets", tx_pkts), HNS3_TQP_STAT("bytes", tx_bytes), HNS3_TQP_STAT("errors", tx_err_cnt), - HNS3_TQP_STAT("tx_wake", restart_queue), - HNS3_TQP_STAT("tx_busy", tx_busy), + HNS3_TQP_STAT("wake", restart_queue), + HNS3_TQP_STAT("busy", tx_busy), }; #define HNS3_TXQ_STATS_COUNT ARRAY_SIZE(hns3_txq_stats) @@ -36,7 +36,7 @@ static const struct hns3_stats hns3_txq_stats[] = { static const struct hns3_stats hns3_rxq_stats[] = { /* Rx per-queue statistics */ HNS3_TQP_STAT("io_err_cnt", io_err_cnt), - HNS3_TQP_STAT("rx_dropped", sw_err_cnt), + HNS3_TQP_STAT("dropped", sw_err_cnt), HNS3_TQP_STAT("seg_pkt_cnt", seg_pkt_cnt), HNS3_TQP_STAT("packets", rx_pkts), HNS3_TQP_STAT("bytes", rx_bytes), @@ -369,7 +369,7 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats, data[ETH_GSTRING_LEN - 1] = '\0'; /* first, prepend the prefix string */ - n1 = snprintf(data, MAX_PREFIX_SIZE, "%s#%d_", + n1 = snprintf(data, MAX_PREFIX_SIZE, "%s%d_", prefix, i); n1 = min_t(uint, n1, MAX_PREFIX_SIZE - 1); size_left = (ETH_GSTRING_LEN - 1) - n1; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index e9625ce..86d3d8b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -354,7 +354,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data) for (i = 0; i < kinfo->num_tqps; i++) { struct hclge_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclge_tqp, q); - snprintf(buff, ETH_GSTRING_LEN, "txq#%d_pktnum_rcd", + snprintf(buff, ETH_GSTRING_LEN, "txq%d_pktnum_rcd", tqp->index); buff = buff + ETH_GSTRING_LEN; } @@ -362,7 +362,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data) for (i = 0; i < kinfo->num_tqps; i++) { struct hclge_tqp *tqp = container_of(kinfo->tqp[i], struct hclge_tqp, q); - snprintf(buff, ETH_GSTRING_LEN, "rxq#%d_pktnum_rcd", + snprintf(buff, ETH_GSTRING_LEN, "rxq%d_pktnum_rcd", tqp->index); buff = buff + ETH_GSTRING_LEN; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 166a2cf..c220d9b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -110,7 +110,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data) for (i = 0; i < hdev->num_tqps; i++) { struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp, q); - snprintf(buff, ETH_GSTRING_LEN, "txq#%d_pktnum_rcd", + snprintf(buff, ETH_GSTRING_LEN, "txq%d_pktnum_rcd", tqp->index); buff += ETH_GSTRING_LEN; } @@ -118,7 +118,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data) for (i = 0; i < hdev->num_tqps; i++) { struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp, q); - snprintf(buff, ETH_GSTRING_LEN, "rxq#%d_pktnum_rcd", + snprintf(buff, ETH_GSTRING_LEN, "rxq%d_pktnum_rcd", tqp->index); buff += ETH_GSTRING_LEN; } From patchwork Fri Sep 21 15:41: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: 147299 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp971838ljw; Fri, 21 Sep 2018 08:44:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaqkWjo+GcDzrfGAR6F6SwOPvDp6hBqzB1dxW3cCVYk243UnRl0p1wBlzKFB5VaS4Ewgtlr X-Received: by 2002:a63:91c9:: with SMTP id l192-v6mr3035738pge.433.1537544642764; Fri, 21 Sep 2018 08:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544642; cv=none; d=google.com; s=arc-20160816; b=mzc0wkRkvQQGDJdJjHSnMNfXwnt0cauNETAL2Dk0D7zdOzFiT8EKPzg2kG0xG4Wi5O tYszMI9QYkaVd3Hh0Gdz9mDxBRac8NdzzffuD1+DPk42Wo2/HW+2MQ1A5LYaejglVrH3 tx457vO+iW3E+nTVuIwTK2eF+KTEQjQs0RrByIXiEovzHptmjB2cgDSZCJt3nkOROOl2 EtqOcfMAVdOilRC27SpXx7nS46/HYVxsx3gthnK6+xzCE+IfnCS1z5F09xuO1kHMV59a Afw+3dxgt+fEUuqpqOiNBvIKPmnEGndopLE9zcPkyixfDv2XL2s9wi/kYfnLCVFxmXtC Vq4w== 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=ckLmRcwTTiRPoiSyFgQ1S2xX3fX7VHBMvtnSeht0Uqs=; b=RX/FJNt7k0ksex6wdVMka51OYaPvcH7DSp0JD0ha7IOhUSbM49M38LbcSg4HX2WPT/ 1P5iFVbBFMssM/ee0ODaYeKWKTpThxbtdVPHCiuGrvVoGNf7wmpMSdlrIwLOEF273W84 new7xA0pI9gHIlo1DszAAP04t5g9ax3xQtLeFP0OPm3oEDiTLpXj44k5MPb+N2tXtzYX 2owFNCNy35sJgvO9k3JIjd6wuuqrp4rx9OeoVU5mei5uA9InUE9xJKTz6OAYd5mYuhrr yFVmELoKERa/Bg3EI5Pn7cPRbIj7ogEYpuw/l2pmpepzcI5NqQrGl3yh6Bt8p4yPFzEK uIIw== 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 q16-v6si26279970pgm.185.2018.09.21.08.44.02; Fri, 21 Sep 2018 08:44:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390648AbeIUVce (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:34 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13098 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389547AbeIUVcd (ORCPT ); Fri, 21 Sep 2018 17:32:33 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 108CF2E2A7F50; Fri, 21 Sep 2018 23:42:58 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:51 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 04/12] net: hns3: Fix tqp array traversal condition for vf Date: Fri, 21 Sep 2018 16:41:40 +0100 Message-ID: <20180921154148.26756-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen There are two tqp_num variables "hdev->tqp_num" and "kinfo->tqp_num" used in VF. "hdev->tqp_num" is the total tqp number allocated to the VF, and "kinfo->tqp_num" indicates the tqp number being used by the VF. Usually the two variables are equal. But for the case hdev->tqp_num larger than rss_size_max, and num_tc is 1, "kinfo->tqp_num" will be less than "hdev->tqp_num". In original codes, "hdev->tqp_num" is always used to traverse the tqp array of kinfo. It may cause null pointer error when "hdev->tqp_num" is larger than "kinfo->tqp_num" Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 50 +++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index c220d9b..f7ab2eb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -31,16 +31,15 @@ static inline struct hclgevf_dev *hclgevf_ae_get_hdev( static int hclgevf_tqps_update_stats(struct hnae3_handle *handle) { + struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - struct hnae3_queue *queue; struct hclgevf_desc desc; struct hclgevf_tqp *tqp; int status; int i; - for (i = 0; i < hdev->num_tqps; i++) { - queue = handle->kinfo.tqp[i]; - tqp = container_of(queue, struct hclgevf_tqp, q); + for (i = 0; i < kinfo->num_tqps; i++) { + tqp = container_of(kinfo->tqp[i], struct hclgevf_tqp, q); hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_QUERY_RX_STATUS, true); @@ -77,17 +76,16 @@ static int hclgevf_tqps_update_stats(struct hnae3_handle *handle) static u64 *hclgevf_tqps_get_stats(struct hnae3_handle *handle, u64 *data) { struct hnae3_knic_private_info *kinfo = &handle->kinfo; - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); struct hclgevf_tqp *tqp; u64 *buff = data; int i; - for (i = 0; i < hdev->num_tqps; i++) { - tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp, q); + for (i = 0; i < kinfo->num_tqps; i++) { + tqp = container_of(kinfo->tqp[i], struct hclgevf_tqp, q); *buff++ = tqp->tqp_stats.rcb_tx_ring_pktnum_rcd; } for (i = 0; i < kinfo->num_tqps; i++) { - tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp, q); + tqp = container_of(kinfo->tqp[i], struct hclgevf_tqp, q); *buff++ = tqp->tqp_stats.rcb_rx_ring_pktnum_rcd; } @@ -96,28 +94,28 @@ static u64 *hclgevf_tqps_get_stats(struct hnae3_handle *handle, u64 *data) static int hclgevf_tqps_get_sset_count(struct hnae3_handle *handle, int strset) { - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + struct hnae3_knic_private_info *kinfo = &handle->kinfo; - return hdev->num_tqps * 2; + return kinfo->num_tqps * 2; } static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data) { - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + struct hnae3_knic_private_info *kinfo = &handle->kinfo; u8 *buff = data; int i = 0; - for (i = 0; i < hdev->num_tqps; i++) { - struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], - struct hclgevf_tqp, q); + for (i = 0; i < kinfo->num_tqps; i++) { + struct hclgevf_tqp *tqp = container_of(kinfo->tqp[i], + struct hclgevf_tqp, q); snprintf(buff, ETH_GSTRING_LEN, "txq%d_pktnum_rcd", tqp->index); buff += ETH_GSTRING_LEN; } - for (i = 0; i < hdev->num_tqps; i++) { - struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], - struct hclgevf_tqp, q); + for (i = 0; i < kinfo->num_tqps; i++) { + struct hclgevf_tqp *tqp = container_of(kinfo->tqp[i], + struct hclgevf_tqp, q); snprintf(buff, ETH_GSTRING_LEN, "rxq%d_pktnum_rcd", tqp->index); buff += ETH_GSTRING_LEN; @@ -738,14 +736,12 @@ static int hclgevf_get_queue_id(struct hnae3_queue *queue) static void hclgevf_reset_tqp_stats(struct hnae3_handle *handle) { - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - struct hnae3_queue *queue; + struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hclgevf_tqp *tqp; int i; - for (i = 0; i < hdev->num_tqps; i++) { - queue = handle->kinfo.tqp[i]; - tqp = container_of(queue, struct hclgevf_tqp, q); + for (i = 0; i < kinfo->num_tqps; i++) { + tqp = container_of(kinfo->tqp[i], struct hclgevf_tqp, q); memset(&tqp->tqp_stats, 0, sizeof(tqp->tqp_stats)); } } @@ -1420,12 +1416,13 @@ static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev) static int hclgevf_ae_start(struct hnae3_handle *handle) { + struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); int i, queue_id; - for (i = 0; i < handle->kinfo.num_tqps; i++) { + for (i = 0; i < kinfo->num_tqps; i++) { /* ring enable */ - queue_id = hclgevf_get_queue_id(handle->kinfo.tqp[i]); + queue_id = hclgevf_get_queue_id(kinfo->tqp[i]); if (queue_id < 0) { dev_warn(&hdev->pdev->dev, "Get invalid queue id, ignore it\n"); @@ -1448,14 +1445,15 @@ static int hclgevf_ae_start(struct hnae3_handle *handle) static void hclgevf_ae_stop(struct hnae3_handle *handle) { + struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); int i, queue_id; set_bit(HCLGEVF_STATE_DOWN, &hdev->state); - for (i = 0; i < hdev->num_tqps; i++) { + for (i = 0; i < kinfo->num_tqps; i++) { /* Ring disable */ - queue_id = hclgevf_get_queue_id(handle->kinfo.tqp[i]); + queue_id = hclgevf_get_queue_id(kinfo->tqp[i]); if (queue_id < 0) { dev_warn(&hdev->pdev->dev, "Get invalid queue id, ignore it\n"); From patchwork Fri Sep 21 15:41:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147292 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970918ljw; Fri, 21 Sep 2018 08:43:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZRZdhBeQWg5xN8EV138pYbPNiz/OBL+Tv62mFDkkTHu02DRF7tYBJzg3FuwRePXIkbIZ5s X-Received: by 2002:a62:ed2:: with SMTP id 79-v6mr7824936pfo.198.1537544591142; Fri, 21 Sep 2018 08:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544591; cv=none; d=google.com; s=arc-20160816; b=iMHPsAI6RanzPWNiDN0LHNuB0Sw5g5OyHmpmLD9oD/9Z38o5r8gm28dPLdK4rEOCXa WOi5St265d8FB6wayTCrU0OjOoODpfSts2srvuNB1vCBSk9jR3N3Eq9p7WEXUymlmzfJ DAQwHaLn8gJzCBlp/oSMiPw8WrSh3vuxyRjXQQa+dJCjcuSyFcoaiSCtLQz29LqMzzMG vjU/x08j9rmj+pnYOcBzllSN1z4qHRA63sB5OjxtLMpjVrLrQzhi5CBbLyV5aGLSgIGL 2AeoSpBT2M7O0I+cZyOMRLm4l5dISLPUFvX8EBTrxpvFPL+CoBOgXdnlsWvHeEVCtE4d TQZw== 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=4MQTxjQqicfgYJRm6gLNirqmJ/IqkWxhGDqRVu0bgYU=; b=lBXX2tDAh9Gv/NiH/ug6ZqkF2/K3qzrphP+rH2xjIlB5JxtqqliLDPP41CHAH0NPnU GcxbJAtPOsefOd4cy85Ce33234l0FznrUjEjv6jKlXmva5UYMPyN5HmOQDNydEXlmbC8 BoAujdalTr43XgrDDGWUPP/XNbRhFQDGHAjWcPFK9sgg5ZQBGacwjWcmJZ/lcGC4te67 1jtLQQBPdr8afdCjtwywWQCOiFZS81G8lRwUeYFvqJOABULHdjhGzGgAcXwHmkyqM6Ac VEcv4DNLVmUdVELx1MPMWcV4U6Fqv6Z95k4NvMIkHP2Gu9AvZm8+vThQCjpbBG2/c2pl Alsw== 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 f2-v6si26951528plo.206.2018.09.21.08.43.10; Fri, 21 Sep 2018 08:43:11 -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 S2390676AbeIUVce (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:34 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43003 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390560AbeIUVcd (ORCPT ); Fri, 21 Sep 2018 17:32:33 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 052A86CC555C; Fri, 21 Sep 2018 23:43:03 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:54 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 05/12] net: hns3: Unify the prefix of vf functions Date: Fri, 21 Sep 2018 16:41:41 +0100 Message-ID: <20180921154148.26756-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen The prefix of most functions for vf are hclgevf. This patch renames the function with inconsistent prefix. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index f7ab2eb..84129c5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -180,7 +180,7 @@ static int hclgevf_get_tc_info(struct hclgevf_dev *hdev) return 0; } -static int hclge_get_queue_info(struct hclgevf_dev *hdev) +static int hclgevf_get_queue_info(struct hclgevf_dev *hdev) { #define HCLGEVF_TQPS_RSS_INFO_LEN 8 u8 resp_msg[HCLGEVF_TQPS_RSS_INFO_LEN]; @@ -1341,7 +1341,7 @@ static int hclgevf_configure(struct hclgevf_dev *hdev) int ret; /* get queue configuration from PF */ - ret = hclge_get_queue_info(hdev); + ret = hclgevf_get_queue_info(hdev); if (ret) return ret; /* get tc configuration from PF */ From patchwork Fri Sep 21 15:41:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147291 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970892ljw; Fri, 21 Sep 2018 08:43:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaCApvy5HXO9uDZDj0fG8eE1I6DuISG5X0FPGZVkhcB6EjYafPiPXbn5i87agztatIQ7Dyw X-Received: by 2002:a62:89d8:: with SMTP id n85-v6mr46914580pfk.83.1537544589807; Fri, 21 Sep 2018 08:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544589; cv=none; d=google.com; s=arc-20160816; b=xsUNuNBzJrG5ssn1rqdJjtsIPNiLxD8QPy5MojWnZaK6ijw/Xe19xTinfJsIFCIYQF wjqxFju1o4tZmYE4M+/iljLeNtiGn+xTr94DjiJutHds3BdQg+9YadVDVwOO3UWVBlAC Rq5R1W4Rqtu6LKhHbE62ut/kgTLFuN4QVm0FKx9hExPTN3Mg5C1Y/4cCOCmx7NGIMwxy tHcp1fFP16HaC0j0UfayVKA7+DRvkSStoxiTdWKGDkQqguirs3L80vFQaBCS20VqEfLc QCgNnYtPTFtrRkW7Q+X7J+KGITLsA4euwqtkuJ9pwQDfnYQ4oNWEeT+gWrn/YZIiaUbK 7/AQ== 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=UFTCfqeKFggQD1fFM14Ww6YFIYTakW+MMBP6x22TmqE=; b=L8m6j6QeO90iHj8qvxxoCKLSsDUno0UmcZQdHmyJfmYdrrAS2dWBdkhsFEGgoyYC+k tjHEsYIuSrKyNUbhmE/0/FzG7VkSa1ZnTy+iS/W58q9MsbTNVhzr1K0I+1l3UUHd42a7 o9QRys8lz+AYiu/mxzt6v7rJ5FDqLna89a3xa9p3XHTUAlmUjFBZzvVl3ZAFK1fsCflc qHXCjKmsH2LucRfKDBpfgcWXltMEWmjDQDrjtPU6HS3sG0N7N7QaPmqe6aAPsH1pCOoj CoL+ukTushepfVP/h9ZplLIdNGMC3IRhhBchJLFVZ5m82rNdCCn2Vifpyxaogy7Eas6k LjLg== 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 s17-v6si5730199plq.339.2018.09.21.08.43.09; Fri, 21 Sep 2018 08:43: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 S2390621AbeIUVcc (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:32 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43008 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390218AbeIUVcc (ORCPT ); Fri, 21 Sep 2018 17:32:32 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 09A709F5F7BC0; Fri, 21 Sep 2018 23:43:03 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:56 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 06/12] net: hns3: Add handle for default case Date: Fri, 21 Sep 2018 16:41:42 +0100 Message-ID: <20180921154148.26756-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen There are a few "switch-case" codes missed handle for default case. For some abnormal case, it should return error code instead of return 0. Signed-off-by: Jian Shen 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_ethtool.c | 7 +++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 8 ++++---- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +++ 5 files changed, 20 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e404130..fc27f3f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2176,6 +2176,8 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb, l4_type == HNS3_L4_TYPE_SCTP)) skb->ip_summed = CHECKSUM_UNNECESSARY; break; + default: + break; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index ce2e6ea..46701cf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -351,9 +351,10 @@ static int hns3_get_sset_count(struct net_device *netdev, int stringset) case ETH_SS_TEST: return ops->get_sset_count(h, stringset); - } - return 0; + default: + return -EOPNOTSUPP; + } } static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats, @@ -417,6 +418,8 @@ static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data) case ETH_SS_TEST: ops->get_strings(h, stringset, data); break; + default: + break; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 86d3d8b..73d9d0d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2224,6 +2224,8 @@ static void hclge_clear_event_cause(struct hclge_dev *hdev, u32 event_type, case HCLGE_VECTOR0_EVENT_MBX: hclge_write_dev(&hdev->hw, HCLGE_VECTOR0_CMDQ_SRC_REG, regclr); break; + default: + break; } } @@ -5218,6 +5220,10 @@ static int hclge_init_client_instance(struct hnae3_client *client, hnae3_set_client_init_flag(client, ae_dev, 1); } + + break; + default: + return -EINVAL; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c index d8c0cc8..0d3b445 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c @@ -134,7 +134,7 @@ static int hclgevf_init_cmd_queue(struct hclgevf_dev *hdev, hclgevf_write_dev(hw, HCLGEVF_NIC_CSQ_HEAD_REG, 0); hclgevf_write_dev(hw, HCLGEVF_NIC_CSQ_TAIL_REG, 0); - break; + return 0; case HCLGEVF_TYPE_CRQ: reg_val = (u32)ring->desc_dma_addr; hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_BASEADDR_L_REG, reg_val); @@ -147,10 +147,10 @@ static int hclgevf_init_cmd_queue(struct hclgevf_dev *hdev, hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_HEAD_REG, 0); hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_TAIL_REG, 0); - break; + return 0; + default: + return -EINVAL; } - - return 0; } void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 84129c5..b644187 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1667,6 +1667,9 @@ static int hclgevf_init_client_instance(struct hnae3_client *client, } hnae3_set_client_init_flag(client, ae_dev, 1); + break; + default: + return -EINVAL; } return 0; From patchwork Fri Sep 21 15:41:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147294 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970979ljw; Fri, 21 Sep 2018 08:43:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdboxgkduuGA2Hceg6EDyIASKuMCJNYV5eoiH0LyWLpK6bXZfVXye5LbuFY91nCk2mA5Vkzb X-Received: by 2002:a65:5286:: with SMTP id y6-v6mr40572234pgp.65.1537544596080; Fri, 21 Sep 2018 08:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544596; cv=none; d=google.com; s=arc-20160816; b=ZZFmt9Eqa45Oq7EDHS78I0pECjYsRAW+x7sdH+OzAsolu8d6VvPTia2x4Wp+HX7Jmx 5JYURVMvXAZNbS83jBTuQynKCophUH2fsiiXyYBe8nAAeiqkv5+PgBllmxb2vlh4eBj3 LNwT2RXhsUmWbHi43Cik6PlVXLLtAVa0Z/H58LfTskmHogkNUUnOCVMF9QbeSeC9yRhG 1JNe5OrJerJCPZGT+utxgusMGv+EeymajwHuFc8aqAlrtQrZVxIz5mQuvykNaWkRgG7X XyCvU+nTxMY3Y4w01dgDRSIZdGhBb/4Vl6PJGuqhiQP1Wo5AGZYLjlASLLrZlv7Fm3TV JAYQ== 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=wIUnKLULZleBXCMzplZpJpkherUKCJQb3HA60BH8MJ4=; b=udynIqIZicUmvEf+MV1bWZjWium/7Am5PHzMc6X/BQRjl9a6E+UnkmY1S3f68AiHtR VwLyADLEhs7oWoaer6ZFtvOE83Js68SvjaY9fjlnmwRnG63nXorLHEwQk8BTNPHhIbSX cBEaLUo434kv2uMd+tXEkv7VOVbDFNj+UO6wXJXUkS4ralVDgY1yfHHC4Y6xpFRz/EFD rkZmVgTbsUN+LvfK5FYczL2+m2FnIHhbZiuZwBCQFLseOmG4xuSZimWZjWQzBAGwRes2 nxd3FGz1O9tkycGqffr2W7oaPBdvm5nZjW8ePVMbXObyVYMMYKejv98MXMUP1PFQbLAu NI1A== 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 a75-v6si27696644pfc.106.2018.09.21.08.43.15; Fri, 21 Sep 2018 08:43:16 -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 S2390735AbeIUVcj (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43037 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390678AbeIUVci (ORCPT ); Fri, 21 Sep 2018 17:32:38 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1C1662E23F5D8; Fri, 21 Sep 2018 23:43:08 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:59 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 07/12] net: hns3: Add nic state check before calling netif_tx_wake_queue Date: Fri, 21 Sep 2018 16:41:43 +0100 Message-ID: <20180921154148.26756-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen When nic down, it firstly calls netif_tx_stop_all_queues(), then calls napi_disable(). But napi_disable() will wait current napi_poll finish, it may call netif_tx_wake_queue(). This patch fixes it by add nic state checking. Fixes: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index fc27f3f..73b42d3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1973,6 +1973,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) void hns3_clean_tx_ring(struct hns3_enet_ring *ring) { struct net_device *netdev = ring->tqp->handle->kinfo.netdev; + struct hns3_nic_priv *priv = netdev_priv(netdev); struct netdev_queue *dev_queue; int bytes, pkts; int head; @@ -2018,7 +2019,8 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring) * sees the new next_to_clean. */ smp_mb(); - if (netif_tx_queue_stopped(dev_queue)) { + if (netif_tx_queue_stopped(dev_queue) && + !test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) { netif_tx_wake_queue(dev_queue); ring->stats.restart_queue++; } From patchwork Fri Sep 21 15:41:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147293 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970938ljw; Fri, 21 Sep 2018 08:43:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY2xm40SFb+Qr36rlRtzgFpZCIE6qTJ7NdEHqmbrWG0YEmxrwLd/bizbn1pOasd1YLLxrIh X-Received: by 2002:a63:9752:: with SMTP id d18-v6mr40173023pgo.405.1537544593535; Fri, 21 Sep 2018 08:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544593; cv=none; d=google.com; s=arc-20160816; b=hbDZ+swe5hwCvlWWlJBqWcDhR22mUDa4D7EkaVQfO1zeWmjgsXKBt5d4akUGVIBEBS BTEQpJ3M4hHMnC+OfkPGYjW/huLsXVjlV2v15y1/Zr52caa2Zpro6KPBQm5a2z/f6npH uxNcwAjCBmTf0s/0L5A1f7/cpPQgIyl4YCJYecwZlUJAQi5IbJGUjkOP3eILmVwVDCNf yWHnuxBQhWKDphRFD/koKTgyjIJOtMbJLfqvEv5qf07HpIkYTrp2p0oxJaYE09nnHIO0 doG8oBCijnKTVZF8X3sY1RFiQ26lvXLyRUomxttVlts3kEtXLJf3H8CpirhI1EnGrVEc 5Vvw== 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=SfCGHVefqYxOoTsYnCK4kU9IBbuaR1nF9OOFt03YhvY=; b=YQs0dR1x6YwNm2r+cjDAGWtuwm0zT2iGGfxYNQVugajQViDwQsK4aWBah33Y3lHUuQ V7Hj3YPDin1sGuFaJUaD1xQCWX0RQRJM0TKmejS4mclkliJsXpRH6FwwyOb9aUQWhHGo Rl4MUqWRqsM+c8vYbstZVpvABQlYsRXTHDe7fYNGx4hH22qkIzu33y4dBGNMRtf1/G92 HbL/klKf//SLHJ62FGpt+kaNH2lDnxL3C5Cu78dWDN2Js24dPULLm9fbRCCN6PuTX1rM GMCHkrHDem3RNQpYnd9hcudQirBwKbfit3p2u8DJhp0iER1XhhVK6+dO8HWEIplZ4//O 8u1w== 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 f2-v6si26951528plo.206.2018.09.21.08.43.13; Fri, 21 Sep 2018 08:43:13 -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 S2390705AbeIUVch (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:37 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43033 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390679AbeIUVch (ORCPT ); Fri, 21 Sep 2018 17:32:37 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1876832FC98B5; Fri, 21 Sep 2018 23:43:08 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:43:02 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 08/12] net: hns3: Add unlikely for dma_mapping_error check Date: Fri, 21 Sep 2018 16:41:44 +0100 Message-ID: <20180921154148.26756-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen For dma_mapping_error is unlikely happened, this patch adds unlikely for dma_mapping_error check. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 73b42d3..8b63707 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1807,7 +1807,7 @@ static int hns3_map_buffer(struct hns3_enet_ring *ring, struct hns3_desc_cb *cb) cb->dma = dma_map_page(ring_to_dev(ring), cb->priv, 0, cb->length, ring_to_dma_dir(ring)); - if (dma_mapping_error(ring_to_dev(ring), cb->dma)) + if (unlikely(dma_mapping_error(ring_to_dev(ring), cb->dma))) return -EIO; return 0; From patchwork Fri Sep 21 15:41:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147295 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp971109ljw; Fri, 21 Sep 2018 08:43:21 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYQrFDekWsjzxGQtqhXlcjP/vJNv6C8blnCunjDextnYLFWmJzzqcYxFOKIaAiOU5P5GavA X-Received: by 2002:a62:50c3:: with SMTP id g64-v6mr46526068pfj.244.1537544601597; Fri, 21 Sep 2018 08:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544601; cv=none; d=google.com; s=arc-20160816; b=vHyvlI6BhEXj+70bfYEck//MntRLorCJV1BBl0aefBTfdprcdTOe4s7V4q1ZJqwlxo jsxmQ0doSJM9NHvmnQfHVJTkHc6ulR+7q/kMgb1QGhmkCZ+koXFTE2kRWK0chUWfUWRs knFNcXqVBO8rZQt64ZWvPsIt6DVWk9dp67Pdze61id40wLX632ua1AA5B4DTYs353n64 R7CHcyArWiWWn9AXAc9fZRUXsyNvcrI/DrH6gA23dgbAyH8TcmjjcFTk7IEbnmMoUnZ7 QMUvHGJ5PfOh0Zkrb1Eun8eWg/RhuVhudjgTgHBm79vImPgYA4Dvidt4n5NInVkdPe9W alhw== 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=dXFdJnwUWC7XFcBwMgz/P7//BWr6h13YxYPN9VhPu8c=; b=DuHyHC9dVEXQKJAWbFYRQL6pj3ZoRo49E0Bqr2xRye3feX1VAOZXn7GnZN4eiNixCv 058AMAnGdec2dZ7U/b32ux9wY89KPDuVIxjHSIENWpsE9Iw30emuOc01EJG+kRDNrcrI kL4bfbSpbrkfjbT1x30pa6O4PXI6xK34TwZl2egzpHaWL8Ww42jLviL46fyH3Kr20BdS EWcXz9Gb3OVSEeGdfZH71GeLsCDzPklU308l2CpwQtTuCcFM2vAaN6L7hAX35d63RUUD Uzumm7iL5k6WX1DrDbMla4lKy3f7kquCbUYY1B53Ua/4+lDppiUZgCEhpwW3Nt9nVCG0 PFZg== 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 a75-v6si27696644pfc.106.2018.09.21.08.43.18; Fri, 21 Sep 2018 08:43: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 S2390755AbeIUVcn (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47207 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390678AbeIUVcm (ORCPT ); Fri, 21 Sep 2018 17:32:42 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 63CF7934E985E; Fri, 21 Sep 2018 23:43:13 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:43:06 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 09/12] net: hns3: Remove print messages for error packet Date: Fri, 21 Sep 2018 16:41:45 +0100 Message-ID: <20180921154148.26756-10-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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: Jian Shen There are already multiple types packets statistics for error packets, it's unnecessary to print them, which may affect the rx performance if print too many. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 ----- 1 file changed, 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 8b63707..5a4773a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2149,7 +2149,6 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb, hnae3_get_bit(l234info, HNS3_RXD_L4E_B) || hnae3_get_bit(l234info, HNS3_RXD_OL3E_B) || hnae3_get_bit(l234info, HNS3_RXD_OL4E_B))) { - netdev_err(netdev, "L3/L4 error pkt\n"); u64_stats_update_begin(&ring->syncp); ring->stats.l3l4_csum_err++; u64_stats_update_end(&ring->syncp); @@ -2328,8 +2327,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, } if (unlikely(!hnae3_get_bit(bd_base_info, HNS3_RXD_VLD_B))) { - netdev_err(netdev, "no valid bd,%016llx,%016llx\n", - ((u64 *)desc)[0], ((u64 *)desc)[1]); u64_stats_update_begin(&ring->syncp); ring->stats.non_vld_descs++; u64_stats_update_end(&ring->syncp); @@ -2340,7 +2337,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, if (unlikely((!desc->rx.pkt_len) || hnae3_get_bit(l234info, HNS3_RXD_TRUNCAT_B))) { - netdev_err(netdev, "truncated pkt\n"); u64_stats_update_begin(&ring->syncp); ring->stats.err_pkt_len++; u64_stats_update_end(&ring->syncp); @@ -2350,7 +2346,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, } if (unlikely(hnae3_get_bit(l234info, HNS3_RXD_L2E_B))) { - netdev_err(netdev, "L2 error pkt\n"); u64_stats_update_begin(&ring->syncp); ring->stats.l2_err++; u64_stats_update_end(&ring->syncp); From patchwork Fri Sep 21 15:41:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147297 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp971298ljw; Fri, 21 Sep 2018 08:43:30 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbtv7CwSHBdBaNvCXqCLb4EgV7vsfcck/8IP6KBrg7V66cZohzjvToR4MG3OSNUf9WTvVe5 X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr44885197plb.189.1537544610628; Fri, 21 Sep 2018 08:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544610; cv=none; d=google.com; s=arc-20160816; b=wIGrS+J/Oc17JiJOB4In7A6/mIzFK7uE3IIIkLAeohcOsXPvZ+RGcag2jOCKv6gLEQ HVM8Lpfk/KNFYiE8uWERGoS/C0ElMnb6LUdKKPtx5qPRTm0NnHUGbGIsJv4ITpdkyqQF oqG6hoTzuH7G86596fOCe5p/5Z3huREAzjLgLcmmm83dxjIEOMqJENMhjFm6inHyp459 CQbrbedhklxjj/SbD7vxnQbKuKFbqgMOTl+Gv+FdaAJtNq3kYiy/+z7Q99oz/W6GJVQy ZBbIG7lZB3CzKwccvrlFcmsz89vmfzY2NicMiAKWBagOdMJXow0PzaOWWr+iaKLwGI5Z 9A4Q== 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=/kHTPqa6fEgOL1f3dg9kLI6/K9KFgF8SouFaFCL3A4k=; b=AyThj9Mu7RtfL3h13Uch+0V5qkzujfrCxpu6NELlm7Xls1Z1BJbzEkkfuGMSXEEoJ1 R5njfcZYVW6OQDRv0XaSMer/mxgdGdbNIsHehQiZ62i68AgvUuEtvNZdCepx3n32NyKX gPn2L9Mt950MPnBO44fb7cIBSEcL1qWpRL64DVQvLf3uaTa01/LkXzv6JihABgz+5xEA IENOd0duLIpICWGOlduDezuvE1wNsDIzalzBpwXr7j8gaQY4vi0TaaRlKVm4LVDlbtAw KcUVX2PwORIjoyl3sHrLWUqYIEOQ0YP3DNjmMw6e6qKqLVaWKPKc6vgnnvO+A0w96E5j h3vA== 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 q16-v6si26279970pgm.185.2018.09.21.08.43.30; Fri, 21 Sep 2018 08:43:30 -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 S2390804AbeIUVcx (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:53 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13099 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390757AbeIUVcw (ORCPT ); Fri, 21 Sep 2018 17:32:52 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3CEDD5135832C; Fri, 21 Sep 2018 23:43:18 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:43:09 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 10/12] net: hns3: Add get_media_type ops support for VF Date: Fri, 21 Sep 2018 16:41:46 +0100 Message-ID: <20180921154148.26756-11-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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 the ops of get_media_type support for VF. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 11 +++++++++++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 1 + 3 files changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 17db631..fc87e1b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -107,6 +107,7 @@ enum hnae3_media_type { HNAE3_MEDIA_TYPE_FIBER, HNAE3_MEDIA_TYPE_COPPER, HNAE3_MEDIA_TYPE_BACKPLANE, + HNAE3_MEDIA_TYPE_NONE, }; enum hnae3_reset_notify_type { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index b644187..9781931 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1340,6 +1340,8 @@ static int hclgevf_configure(struct hclgevf_dev *hdev) { int ret; + hdev->hw.mac.media_type = HNAE3_MEDIA_TYPE_NONE; + /* get queue configuration from PF */ ret = hclgevf_get_queue_info(hdev); if (ret) @@ -2009,6 +2011,14 @@ void hclgevf_update_speed_duplex(struct hclgevf_dev *hdev, u32 speed, hdev->hw.mac.duplex = duplex; } +static void hclgevf_get_media_type(struct hnae3_handle *handle, + u8 *media_type) +{ + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + if (media_type) + *media_type = hdev->hw.mac.media_type; +} + static const struct hnae3_ae_ops hclgevf_ops = { .init_ae_dev = hclgevf_init_ae_dev, .uninit_ae_dev = hclgevf_uninit_ae_dev, @@ -2046,6 +2056,7 @@ static const struct hnae3_ae_ops hclgevf_ops = { .get_tqps_and_rss_info = hclgevf_get_tqps_and_rss_info, .get_status = hclgevf_get_status, .get_ksettings_an_result = hclgevf_get_ksettings_an_result, + .get_media_type = hclgevf_get_media_type, }; static struct hnae3_ae_algo ae_algovf = { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index b23ba17..2af01f1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -66,6 +66,7 @@ enum hclgevf_states { #define HCLGEVF_MPF_ENBALE 1 struct hclgevf_mac { + u8 media_type; u8 mac_addr[ETH_ALEN]; int link; u8 duplex; From patchwork Fri Sep 21 15:41:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147296 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp971268ljw; Fri, 21 Sep 2018 08:43:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZu36HkGeQsow3dnk/KzTG3I17ThfKMPjNME9TUNPiZKo9BpZDd7IuaHQ4M3eLdTFkRzoV X-Received: by 2002:a65:6455:: with SMTP id s21-v6mr42816824pgv.25.1537544608970; Fri, 21 Sep 2018 08:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544608; cv=none; d=google.com; s=arc-20160816; b=zulhpZvrBylUtX6uW3ZH85H2F9kAGqeeNswouVzsKfwkHF/I8DhEuN8kpglYTuZoOC r9xzQZPbgaJDoDzmn2bQUSMsiS9aVKc2vHBcfbVfZOA3GFdeMVh/ZBPh84XNtMdSN7vO ZD2GxrgtrrTQibNai7TZsjy9jZPqJO83cOCuNulk1/xs7IFyIdkmPb7R9+jzUA6lir0y zP8dwCIt2XXYOYSqPXarTAaG39v+5hOscUCGLQS4loCoruh4rHlzB7vUqerQJ5dCr0fk FA5sB6UI7S1Hpw+iaMFff/ypI7qJ61j0lIHJJo/zFo9nl65qLB0ihqZUrrnGBOPEf5pC N1vQ== 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=RaImxzNma4Ch4joJWe6PanJpPq7GaQ4PIK0Ys8UIxgA=; b=hj/uDEuy98nB2GL71Ior9HCNmv6ICg1an+1HH93rKfs5E4qU3FE9aT9reD18cvE5MM lHlAsiA8+2zEW7h1jWcaVsW22c8b2/DeYrQfXrdAEPSH5CJtbYXgL/pULoyhvWl5ufRd aa68oAhmQnJLuTynK96OLjbReTyEY/QOTJ6IyzGGGH4s9G0k+CTSNyHtQBUE8cu/3Qle COY+hzQOHohC1lpGMp8y2ETrtnSV0G5qemZtd3sMU8iu//pfSRwyD6vIEdAiERogQitr AgPf+6wP4m/SmiTvCicimXtjjwVfL9OA92xCHP147EDI6rvsYdsrTU8DEYxg7D5dL4A/ pwzg== 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 a75-v6si27696644pfc.106.2018.09.21.08.43.27; Fri, 21 Sep 2018 08:43:28 -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 S2390781AbeIUVcw (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:52 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13100 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390678AbeIUVcv (ORCPT ); Fri, 21 Sep 2018 17:32:51 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 41ED74BC6DED3; Fri, 21 Sep 2018 23:43:18 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:43:12 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 11/12] net: hns3: Fix speed/duplex information loss problem when executing ethtool ethx cmd of VF Date: Fri, 21 Sep 2018 16:41:47 +0100 Message-ID: <20180921154148.26756-12-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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 VF has not implemented the ops for get_port_type. So when we executing ethtool ethx cmd of VF, hns3_get_link_ksettings will return directly. And we can not query anything. To support get_link_ksettings for VF, this patch replaces get_port_type with get_media_type. If the media type is HNAE3_MEDIA_TYPE_NONE, hns3_get_link_ksettings will return link information of VF. Fixes: 12f46bc1d447 ("net: hns3: Refine hns3_get_link_ksettings()") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 66 +++++++++++++--------- 1 file changed, 39 insertions(+), 27 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 46701cf..8803a87 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -545,55 +545,67 @@ static int hns3_set_pauseparam(struct net_device *netdev, return -EOPNOTSUPP; } +static void hns3_get_ksettings(struct hnae3_handle *h, + struct ethtool_link_ksettings *cmd) +{ + const struct hnae3_ae_ops *ops = h->ae_algo->ops; + + /* 1.auto_neg & speed & duplex from cmd */ + if (ops->get_ksettings_an_result) + ops->get_ksettings_an_result(h, + &cmd->base.autoneg, + &cmd->base.speed, + &cmd->base.duplex); + + /* 2.get link mode*/ + if (ops->get_link_mode) + ops->get_link_mode(h, + cmd->link_modes.supported, + cmd->link_modes.advertising); + + /* 3.mdix_ctrl&mdix get from phy reg */ + if (ops->get_mdix_mode) + ops->get_mdix_mode(h, &cmd->base.eth_tp_mdix_ctrl, + &cmd->base.eth_tp_mdix); +} + static int hns3_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) { struct hnae3_handle *h = hns3_get_handle(netdev); const struct hnae3_ae_ops *ops; + u8 media_type; u8 link_stat; if (!h->ae_algo || !h->ae_algo->ops) return -EOPNOTSUPP; ops = h->ae_algo->ops; - if (ops->get_port_type) - ops->get_port_type(h, &cmd->base.port); + if (ops->get_media_type) + ops->get_media_type(h, &media_type); else return -EOPNOTSUPP; - switch (cmd->base.port) { - case PORT_FIBRE: - /* 1.auto_neg & speed & duplex from cmd */ - if (ops->get_ksettings_an_result) - ops->get_ksettings_an_result(h, - &cmd->base.autoneg, - &cmd->base.speed, - &cmd->base.duplex); - else - return -EOPNOTSUPP; - - /* 2.get link mode*/ - if (ops->get_link_mode) - ops->get_link_mode(h, - cmd->link_modes.supported, - cmd->link_modes.advertising); - - /* 3.mdix_ctrl&mdix get from phy reg */ - if (ops->get_mdix_mode) - ops->get_mdix_mode(h, &cmd->base.eth_tp_mdix_ctrl, - &cmd->base.eth_tp_mdix); - + switch (media_type) { + case HNAE3_MEDIA_TYPE_NONE: + cmd->base.port = PORT_NONE; + hns3_get_ksettings(h, cmd); + break; + case HNAE3_MEDIA_TYPE_FIBER: + cmd->base.port = PORT_FIBRE; + hns3_get_ksettings(h, cmd); break; - case PORT_TP: + case HNAE3_MEDIA_TYPE_COPPER: if (!netdev->phydev) return -EOPNOTSUPP; + cmd->base.port = PORT_TP; phy_ethtool_ksettings_get(netdev->phydev, cmd); break; default: - netdev_warn(netdev, - "Unknown port type, neither Fibre/Copper detected"); + + netdev_warn(netdev, "Unknown media type"); return 0; } From patchwork Fri Sep 21 15:41:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147298 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp971311ljw; Fri, 21 Sep 2018 08:43:31 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda25IYCdpXxYKex6cxi2hQraRDEAXTc01wWjfLas/rBU8koWRhcoLBX3eU7QYjc1fkxd6R7 X-Received: by 2002:a17:902:1001:: with SMTP id b1-v6mr45123324pla.155.1537544611432; Fri, 21 Sep 2018 08:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544611; cv=none; d=google.com; s=arc-20160816; b=cVWMaoB6kmk3g8+5CE+1agk6hvfy8f8KCAjeeW81DWF7zxC8VuhCPVORWb+uYPZCpu VtL2fe5bj/jA7L/nVlPWXR2R6BFyMmpkQSpshOZOiYsiGcc3lzBSivaGu3WMQ4auRRFK fvDCR57UAFZl4Jq7BQMVOX6eit9O4xQO53ItzD34lDAtf3P1nHywMvKRZNmtXs0Em1fx QlTXO+2AHR7M7BuzW1Ny+aPOK4+w+/e7E5qplJ56t7wmCEM7zNS4U2wl2c5G1mEQ8Mbk 66gt4DOZFX4l61OnPQlaX8ky1BEtIhmfUcZqXCDWhhLojTUhmA2noXG8yz11z4QyEa+e ngMA== 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=pKSiClFVcApFUzQZyotNAYgCR49mVLHIgITe7it1k4E=; b=s/Y6aoczyxWQ/QmwCOcs1eR3LhAoIHU4bUujapoxgc25nk9IDXIEDja7jg0j8qF3Nq vZUZdH0/IPUgHdZM6lniM9VV+ZhhH5lssjbbCioj5Rhq+Y92PpECwSyEl+zUaqhvDwSa OOFIVTQX5ZrVWZ0xqRsYpj9Tt/P3ZFbb+mFviiRl/Wp6ndd8oRPwHbJyHcKe/UaRLrcX gSIeYd1UhWvUjWDQ6ZN8f3AdqSulJRWpn3JjRrNCg8ia5TTxEm09RmzhSClh0tAZ1JNg 5nXSpAxoksb55HH8XQFrTY6wI+vTM8HiyD/WV3z1w9FxHPKv8CO8PQDpMHlOBQhN1F46 8J0w== 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 q16-v6si26279970pgm.185.2018.09.21.08.43.30; Fri, 21 Sep 2018 08:43: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 S2390829AbeIUVcy (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13101 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390678AbeIUVcy (ORCPT ); Fri, 21 Sep 2018 17:32:54 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5045A904337F8; Fri, 21 Sep 2018 23:43:23 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:43:15 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 12/12] net: hns3: Remove redundant hclge_get_port_type() Date: Fri, 21 Sep 2018 16:41:48 +0100 Message-ID: <20180921154148.26756-13-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-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 removes hclge_get_port_type which is redundant. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 - .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 22 ---------------------- 2 files changed, 23 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index fc87e1b..564afd4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -411,7 +411,6 @@ struct hnae3_ae_ops { void (*get_link_mode)(struct hnae3_handle *handle, unsigned long *supported, unsigned long *advertising); - void (*get_port_type)(struct hnae3_handle *handle, u8 *port_type); }; struct hnae3_dcb_ops { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 73d9d0d..2de5a00 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5970,27 +5970,6 @@ static void hclge_get_link_mode(struct hnae3_handle *handle, } } -static void hclge_get_port_type(struct hnae3_handle *handle, - u8 *port_type) -{ - struct hclge_vport *vport = hclge_get_vport(handle); - struct hclge_dev *hdev = vport->back; - u8 media_type = hdev->hw.mac.media_type; - - switch (media_type) { - case HNAE3_MEDIA_TYPE_FIBER: - *port_type = PORT_FIBRE; - break; - case HNAE3_MEDIA_TYPE_COPPER: - *port_type = PORT_TP; - break; - case HNAE3_MEDIA_TYPE_UNKNOWN: - default: - *port_type = PORT_OTHER; - break; - } -} - static const struct hnae3_ae_ops hclge_ops = { .init_ae_dev = hclge_init_ae_dev, .uninit_ae_dev = hclge_uninit_ae_dev, @@ -6048,7 +6027,6 @@ static const struct hnae3_ae_ops hclge_ops = { .get_regs = hclge_get_regs, .set_led_id = hclge_set_led_id, .get_link_mode = hclge_get_link_mode, - .get_port_type = hclge_get_port_type, }; static struct hnae3_ae_algo ae_algo = {