From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C7F1A0524 for ; Fri, 5 Feb 2021 12:21:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 456091606C7; Fri, 5 Feb 2021 12:21:14 +0100 (CET) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mails.dpdk.org (Postfix) with ESMTP id 560B71606C3 for ; Fri, 5 Feb 2021 12:21:13 +0100 (CET) Received: by mail-wr1-f52.google.com with SMTP id p15so7232231wrq.8 for ; Fri, 05 Feb 2021 03:21:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ixzo7ZBM4VZtRfS9Rk6GtP0SHCEexvnqPK86CCAi7ew=; b=kIIK/y80Ge3ec2gZ9PlEQBIUebAwIRM98fvMd7Zd67qVINkpWPyVfeDpnT8M3jwEZP 7MofdKL4//9ETa7WJSREzJIZQESJoscxzi208khnBxaCqxWOeBPNKVtAnVmE9az5/5Ch o7WjIBsmFjjNGuv/SvCz+Dtpkpd563aJD4gQB9WyZsz/2umUICzhKNIwpc9knwu4Lzeq tvgeeM09J294Qyn8mms/WRkZyIpiMXdhXBIuNJYXYb2qyNQDz8X5btMIhsSN2InH28Lo gWmxtnUP8m30vzHatP32gN/Z0lGHoPBxiqt2gH2vHYPrNndV7CQXpH/fusujLlNVTBCC QvSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ixzo7ZBM4VZtRfS9Rk6GtP0SHCEexvnqPK86CCAi7ew=; b=hPzK5D9TErz9KinYlbUYrDmAQO031bNDT5155kkGwl30Efs5QUrDTlEWFWGlqfJuGj NQJA00V3wZLJvamsc4cgOYNMVzIN3FENAnR6EhOC4opTlYLDGCGqk4AzLrtp6rwHBfmh L8Q3Gtt9uG+ruweZ4ukSFq+G6+8XwpVyFvgSzw0VnP7z8bhRaRC6gliDmoq8vToyNmz5 UFkizXBcXmLQpKWkgefPoZCuWLji3va2U1E0a7YbZqzVps9OpfknPod8+NKMuSBX/wNH lRQz2mTp2D+Vy6B30O4ervuQaWdUJalcBDcSi8U/P7sfRteXtoFR8Xn37pgubTDuVnJI PPGw== X-Gm-Message-State: AOAM5301BiFe5lgaYrqidPdf0KhQYYbPMe7ILIHU7vq/FbwgShllTa+D YlQC4IMU+kucIXexsYPaPzIdKxmmtRYI2Cl+ X-Google-Smtp-Source: ABdhPJxtwRaEgEAAHrLydnaYd1oNZ1uW+dCcS+5EleZ2wGCIxlgOlJSV2Q8Ogfgf5q4xg0Bn9vSVHg== X-Received: by 2002:a5d:68c4:: with SMTP id p4mr4672473wrw.62.1612524073118; Fri, 05 Feb 2021 03:21:13 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y18sm11866402wrt.19.2021.02.05.03.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:21:12 -0800 (PST) From: luca.boccassi@gmail.com To: "Min Hu (Connor)" Cc: Lijun Ou , dpdk stable Date: Fri, 5 Feb 2021 11:15:20 +0000 Message-Id: <20210205111920.1272063-34-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix FEC state query' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/f5c23c81806c9ff09e5f4246bf5f2bf3cbe26a36 Thanks. Luca Boccassi --- >From f5c23c81806c9ff09e5f4246bf5f2bf3cbe26a36 Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Thu, 10 Dec 2020 20:48:43 +0800 Subject: [PATCH] net/hns3: fix FEC state query [ upstream commit 2390bf217f4df0228f238d4ba4b57097feef1d0e ] As FEC is not supported below 10 Gbps, CMD(HNS3_OPC_CONFIG_FEC_MODE) offered from Firmware read will return fail in 10 Gbps device. This patch will prevent read this CMD when below 10 Gbps, as this is non-sense. Fixes: 9bf2ea8dbc65 ("net/hns3: support FEC") Signed-off-by: Min Hu (Connor) Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_ethdev.c | 40 ++++++++++++++++++++++------------ drivers/net/hns3/hns3_ethdev.h | 2 ++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 2011378879..c94a325d25 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -100,7 +100,7 @@ static int hns3_add_mc_addr(struct hns3_hw *hw, static int hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr); static int hns3_restore_fec(struct hns3_hw *hw); -static int hns3_query_dev_fec_info(struct rte_eth_dev *dev); +static int hns3_query_dev_fec_info(struct hns3_hw *hw); static void hns3_pf_disable_irq0(struct hns3_hw *hw) @@ -3001,13 +3001,6 @@ hns3_get_capability(struct hns3_hw *hw) device_id == HNS3_DEV_ID_200G_RDMA) hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); - ret = hns3_query_dev_fec_info(eth_dev); - if (ret) { - PMD_INIT_LOG(ERR, - "failed to query FEC information, ret = %d", ret); - return ret; - } - /* Get PCI revision id */ ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, HNS3_PCI_REVISION_ID); @@ -3139,8 +3132,15 @@ hns3_get_configuration(struct hns3_hw *hw) } ret = hns3_get_board_configuration(hw); - if (ret) + if (ret) { PMD_INIT_LOG(ERR, "failed to get board configuration: %d", ret); + return ret; + } + + ret = hns3_query_dev_fec_info(hw); + if (ret) + PMD_INIT_LOG(ERR, + "failed to query FEC information, ret = %d", ret); return ret; } @@ -5788,6 +5788,16 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) struct hns3_cmd_desc desc; int ret; + /* + * CMD(HNS3_OPC_CONFIG_FEC_MODE) read is not supported + * in device of link speed + * below 10 Gbps. + */ + if (hw->mac.link_speed < ETH_SPEED_NUM_10G) { + *state = 0; + return 0; + } + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CONFIG_FEC_MODE, true); req = (struct hns3_config_fec_cmd *)desc.data; ret = hns3_cmd_send(hw, &desc, 1); @@ -5994,14 +6004,14 @@ hns3_restore_fec(struct hns3_hw *hw) } static int -hns3_query_dev_fec_info(struct rte_eth_dev *dev) +hns3_query_dev_fec_info(struct hns3_hw *hw) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); - struct hns3_pf *pf = &hns->pf; + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(hns); + struct rte_eth_dev *eth_dev = hns->eth_dev; int ret; - ret = hns3_fec_get(dev, &pf->fec_mode); + ret = hns3_fec_get(eth_dev, &pf->fec_mode); if (ret) hns3_err(hw, "query device FEC info failed, ret = %d", ret); @@ -6087,6 +6097,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); + hns->eth_dev = eth_dev; + eth_dev->process_private = (struct hns3_process_private *) rte_zmalloc_socket("hns3_filter_list", sizeof(struct hns3_process_private), diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 4c40df1cbb..d59418b8c8 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -743,6 +743,8 @@ struct hns3_adapter { struct hns3_vf vf; }; + struct rte_eth_dev *eth_dev; + bool rx_simple_allowed; bool rx_vec_allowed; bool tx_simple_allowed; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:30.817272548 +0000 +++ 0034-net-hns3-fix-FEC-state-query.patch 2021-02-05 11:18:28.670688522 +0000 @@ -1 +1 @@ -From 2390bf217f4df0228f238d4ba4b57097feef1d0e Mon Sep 17 00:00:00 2001 +From f5c23c81806c9ff09e5f4246bf5f2bf3cbe26a36 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2390bf217f4df0228f238d4ba4b57097feef1d0e ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index d6d3f03e5c..7c34e382fb 100644 +index 2011378879..c94a325d25 100644 @@ -34,3 +35,3 @@ - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr) -@@ -3010,13 +3010,6 @@ hns3_get_capability(struct hns3_hw *hw) + static void + hns3_pf_disable_irq0(struct hns3_hw *hw) +@@ -3001,13 +3001,6 @@ hns3_get_capability(struct hns3_hw *hw) @@ -50 +51 @@ -@@ -3148,8 +3141,15 @@ hns3_get_configuration(struct hns3_hw *hw) +@@ -3139,8 +3132,15 @@ hns3_get_configuration(struct hns3_hw *hw) @@ -67 +68 @@ -@@ -5797,6 +5797,16 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) +@@ -5788,6 +5788,16 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) @@ -84 +85 @@ -@@ -6003,14 +6013,14 @@ hns3_restore_fec(struct hns3_hw *hw) +@@ -5994,14 +6004,14 @@ hns3_restore_fec(struct hns3_hw *hw) @@ -104 +105 @@ -@@ -6096,6 +6106,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) +@@ -6087,6 +6097,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) @@ -114 +115 @@ -index 31f78a175d..8d6b8cdbbc 100644 +index 4c40df1cbb..d59418b8c8 100644