From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 48F241B11F for ; Wed, 21 Nov 2018 17:49:55 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9BC52C0587F5; Wed, 21 Nov 2018 16:49:54 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E9095C21E; Wed, 21 Nov 2018 16:49:53 +0000 (UTC) From: Kevin Traynor To: Qi Zhang Cc: Beilei Xing , dpdk stable Date: Wed, 21 Nov 2018 16:47:30 +0000 Message-Id: <20181121164828.32249-16-ktraynor@redhat.com> In-Reply-To: <20181121164828.32249-1-ktraynor@redhat.com> References: <20181121164828.32249-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 21 Nov 2018 16:49:54 +0000 (UTC) Subject: [dpdk-stable] patch 'net/i40e/base: fix partition id calculation for X722' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 16:49:55 -0000 Hi, FYI, your patch has been queued to stable release 18.08.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 11/27/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 83f1981872079ddcbabea275df2e13a55f536c09 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Tue, 25 Sep 2018 10:34:24 +0800 Subject: [PATCH] net/i40e/base: fix partition id calculation for X722 [ upstream commit 188d0bda2bac473a1c49987265ebd33c95c63456 ] This patch overwrites number of ports for X722 devices with support for OCP PHY mezzanine. The old method with checking if port is disabled in the PRTGEN_CNF register cannot be used in this case. When the OCP is removed, ports were seen as disabled, which resulted in wrong calculation of partition id, that caused WoL to be disabled on certain ports. Fixes: 3c89193a36fd ("i40e/base: support WOL config for X722") Signed-off-by: Qi Zhang Acked-by: Beilei Xing --- drivers/net/i40e/base/i40e_common.c | 23 ++++++++++++++++++++++- drivers/net/i40e/base/i40e_type.h | 4 +++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index e0a5be14c..6fbba01d3 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -3709,7 +3709,8 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, u32 number, logical_id, phys_id; struct i40e_hw_capabilities *p; + enum i40e_status_code status; + u16 id, ocp_cfg_word0; u8 major_rev; u32 i = 0; - u16 id; cap = (struct i40e_aqc_list_capabilities_element_resp *) buff; @@ -4003,4 +4004,24 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, } + /* OCP cards case: if a mezz is removed the ethernet port is at + * disabled state in PRTGEN_CNF register. Additional NVM read is + * needed in order to check if we are dealing with OCP card. + * Those cards have 4 PFs at minimum, so using PRTGEN_CNF for counting + * physical ports results in wrong partition id calculation and thus + * not supporting WoL. + */ + if (hw->mac.type == I40E_MAC_X722) { + if (i40e_acquire_nvm(hw, I40E_RESOURCE_READ) == I40E_SUCCESS) { + status = i40e_aq_read_nvm(hw, I40E_SR_EMP_MODULE_PTR, + 2 * I40E_SR_OCP_CFG_WORD0, + sizeof(ocp_cfg_word0), + &ocp_cfg_word0, true, NULL); + if (status == I40E_SUCCESS && + (ocp_cfg_word0 & I40E_SR_OCP_ENABLED)) + hw->num_ports = 4; + i40e_release_nvm(hw); + } + } + valid_functions = p->valid_functions; num_functions = 0; diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 006a11a8a..39275074e 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -1542,5 +1542,7 @@ struct i40e_hw_port_stats { #define I40E_SR_CONTROL_WORD_1_NVM_BANK_VALID BIT(5) #define I40E_SR_NVM_MAP_STRUCTURE_TYPE BIT(12) -#define I40E_PTR_TYPE BIT(15) +#define I40E_PTR_TYPE BIT(15) +#define I40E_SR_OCP_CFG_WORD0 0x2B +#define I40E_SR_OCP_ENABLED BIT(15) /* Shadow RAM related */ -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-21 16:44:31.368233730 +0000 +++ 0016-net-i40e-base-fix-partition-id-calculation-for-X722.patch 2018-11-21 16:44:30.000000000 +0000 @@ -1,8 +1,10 @@ -From 188d0bda2bac473a1c49987265ebd33c95c63456 Mon Sep 17 00:00:00 2001 +From 83f1981872079ddcbabea275df2e13a55f536c09 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Tue, 25 Sep 2018 10:34:24 +0800 Subject: [PATCH] net/i40e/base: fix partition id calculation for X722 +[ upstream commit 188d0bda2bac473a1c49987265ebd33c95c63456 ] + This patch overwrites number of ports for X722 devices with support for OCP PHY mezzanine. The old method with checking if port is disabled in the PRTGEN_CNF register cannot be used in this case. When the OCP is @@ -10,7 +12,6 @@ of partition id, that caused WoL to be disabled on certain ports. Fixes: 3c89193a36fd ("i40e/base: support WOL config for X722") -Cc: stable@dpdk.org Signed-off-by: Qi Zhang Acked-by: Beilei Xing @@ -20,10 +21,10 @@ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c -index dce5c3965..ee117bd5e 100644 +index e0a5be14c..6fbba01d3 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c -@@ -3679,7 +3679,8 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, +@@ -3709,7 +3709,8 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, u32 number, logical_id, phys_id; struct i40e_hw_capabilities *p; + enum i40e_status_code status; @@ -33,7 +34,7 @@ - u16 id; cap = (struct i40e_aqc_list_capabilities_element_resp *) buff; -@@ -3973,4 +3974,24 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, +@@ -4003,4 +4004,24 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, } + /* OCP cards case: if a mezz is removed the ethernet port is at @@ -59,10 +60,10 @@ valid_functions = p->valid_functions; num_functions = 0; diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h -index 55acc147e..7dde3bfd2 100644 +index 006a11a8a..39275074e 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h -@@ -1513,5 +1513,7 @@ struct i40e_hw_port_stats { +@@ -1542,5 +1542,7 @@ struct i40e_hw_port_stats { #define I40E_SR_CONTROL_WORD_1_NVM_BANK_VALID BIT(5) #define I40E_SR_NVM_MAP_STRUCTURE_TYPE BIT(12) -#define I40E_PTR_TYPE BIT(15)