DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: helin.zhang@intel.com
Cc: dev@dpdk.org, jingjing.wu@intel.com
Subject: [dpdk-dev] [PATCH 07/10] net/i40e/base: report supported link modes
Date: Sat, 27 May 2017 11:47:43 +0800	[thread overview]
Message-ID: <1495856866-89539-8-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1495856866-89539-1-git-send-email-jingjing.wu@intel.com>

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 20 ++++++++++++++++++--
 drivers/net/i40e/base/i40e_common.c     | 18 +++++++++++++++---
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 70079a0..03a7b28 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1831,6 +1831,8 @@ enum i40e_aq_phy_type {
 	I40E_PHY_TYPE_10GBASE_CR1_CU		= 0xB,
 	I40E_PHY_TYPE_10GBASE_AOC		= 0xC,
 	I40E_PHY_TYPE_40GBASE_AOC		= 0xD,
+	I40E_PHY_TYPE_UNRECOGNIZED		= 0xE,
+	I40E_PHY_TYPE_UNSUPPORTED		= 0xF,
 	I40E_PHY_TYPE_100BASE_TX		= 0x11,
 	I40E_PHY_TYPE_1000BASE_T		= 0x12,
 	I40E_PHY_TYPE_10GBASE_T			= 0x13,
@@ -1851,6 +1853,8 @@ enum i40e_aq_phy_type {
 	I40E_PHY_TYPE_25GBASE_LR		= 0x22,
 	I40E_PHY_TYPE_25GBASE_AOC		= 0x23,
 	I40E_PHY_TYPE_25GBASE_ACC		= 0x24,
+	I40E_PHY_TYPE_EMPTY			= 0xFE,
+	I40E_PHY_TYPE_DEFAULT			= 0xFF,
 	I40E_PHY_TYPE_MAX
 };
 
@@ -2039,19 +2043,31 @@ struct i40e_aqc_get_link_status {
 #define I40E_AQ_25G_SERDES_UCODE_ERR	0X04
 #define I40E_AQ_25G_NIMB_UCODE_ERR	0X05
 	u8	loopback; /* use defines from i40e_aqc_set_lb_mode */
+/* Since firmware API 1.7 loopback field keeps power class info as well */
+#define I40E_AQ_LOOPBACK_MASK		0x07
+#define I40E_AQ_PWR_CLASS_SHIFT_LB	6
+#define I40E_AQ_PWR_CLASS_MASK_LB	(0x03 << I40E_AQ_PWR_CLASS_SHIFT_LB)
 	__le16	max_frame_size;
 	u8	config;
 #define I40E_AQ_CONFIG_FEC_KR_ENA	0x01
 #define I40E_AQ_CONFIG_FEC_RS_ENA	0x02
 #define I40E_AQ_CONFIG_CRC_ENA		0x04
 #define I40E_AQ_CONFIG_PACING_MASK	0x78
-	u8	power_desc;
+	union {
+		struct {
+			u8	power_desc;
 #define I40E_AQ_LINK_POWER_CLASS_1	0x00
 #define I40E_AQ_LINK_POWER_CLASS_2	0x01
 #define I40E_AQ_LINK_POWER_CLASS_3	0x02
 #define I40E_AQ_LINK_POWER_CLASS_4	0x03
 #define I40E_AQ_PWR_CLASS_MASK		0x03
-	u8	reserved[4];
+			u8	reserved[4];
+		};
+		struct {
+			u8	link_type[4];
+			u8	link_type_ext;
+		};
+	};
 };
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 004c062..bb4b7eb 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1692,8 +1692,14 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
 		status = I40E_ERR_UNKNOWN_PHY;
 
 	if (report_init) {
-		hw->phy.phy_types = LE32_TO_CPU(abilities->phy_type);
-		hw->phy.phy_types |= ((u64)abilities->phy_type_ext << 32);
+		if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
+		    hw->aq.api_min_ver >= 7) {
+			status = i40e_aq_get_link_info(hw, true, NULL, NULL);
+		} else {
+			hw->phy.phy_types = LE32_TO_CPU(abilities->phy_type);
+			hw->phy.phy_types |=
+					((u64)abilities->phy_type_ext << 32);
+		}
 	}
 
 	return status;
@@ -1955,7 +1961,7 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw,
 	hw_link_info->fec_info = resp->config & (I40E_AQ_CONFIG_FEC_KR_ENA |
 						 I40E_AQ_CONFIG_FEC_RS_ENA);
 	hw_link_info->ext_info = resp->ext_info;
-	hw_link_info->loopback = resp->loopback;
+	hw_link_info->loopback = resp->loopback & I40E_AQ_LOOPBACK_MASK;
 	hw_link_info->max_frame_size = LE16_TO_CPU(resp->max_frame_size);
 	hw_link_info->pacing = resp->config & I40E_AQ_CONFIG_PACING_MASK;
 
@@ -1986,6 +1992,12 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw,
 	     hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE)
 		hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU;
 
+	if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
+	    hw->aq.api_min_ver >= 7) {
+		hw->phy.phy_types = LE32_TO_CPU(*(__le32 *)resp->link_type);
+		hw->phy.phy_types |= ((u64)resp->link_type_ext << 32);
+	}
+
 	/* save link status information */
 	if (link)
 		i40e_memcpy(link, hw_link_info, sizeof(*hw_link_info),
-- 
2.4.11

  parent reply	other threads:[~2017-05-27  3:52 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27  3:47 [dpdk-dev] [PATCH 00/10] net/i40e: base code update Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 01/10] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 02/10] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 03/10] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 04/10] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 05/10] net/i40e/base: store the requested FEC information Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 06/10] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-05-27  3:47 ` Jingjing Wu [this message]
2017-05-27  3:47 ` [dpdk-dev] [PATCH 08/10] net/i40e/base: track id can be 0 Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 09/10] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-05-27  3:47 ` [dpdk-dev] [PATCH 10/10] net/i40e/base: update base code info Jingjing Wu
2017-05-30 11:10 ` [dpdk-dev] [PATCH 00/10] net/i40e: base code update Ferruh Yigit
2017-06-02  2:24   ` Wu, Jingjing
2017-06-26  9:48 ` [dpdk-dev] [PATCH v2 00/16] " Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 01/16] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 02/16] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 03/16] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 04/16] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 05/16] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 06/16] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 07/16] net/i40e/base: report supported link modes Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 08/16] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 09/16] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 10/16] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 11/16] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 12/16] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 13/16] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 14/16] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 15/16] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-26 13:18     ` Ferruh Yigit
2017-06-26  9:48   ` [dpdk-dev] [PATCH v2 16/16] net/i40e: use set switch aq instead of register setting Jingjing Wu
2017-06-26 13:20     ` Ferruh Yigit
2017-06-27 13:29   ` [dpdk-dev] [PATCH v3 00/17] net/i40e: base code update Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 01/17] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 02/17] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 03/17] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 04/17] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 05/17] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 06/17] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 07/17] net/i40e/base: report supported link modes Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 08/17] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 09/17] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 10/17] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 11/17] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 12/17] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 13/17] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 14/17] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 15/17] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 16/17] net/i40e: use set switch aq instead of register setting Jingjing Wu
2017-06-27 13:29     ` [dpdk-dev] [PATCH v3 17/17] net/i40e/base: update base code info Jingjing Wu
2017-06-27 14:00     ` [dpdk-dev] [PATCH v4 00/17] net/i40e: base code update Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 01/17] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 02/17] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 03/17] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 04/17] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 05/17] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 06/17] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 07/17] net/i40e/base: report supported link modes Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 08/17] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 09/17] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 10/17] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 11/17] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 12/17] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 13/17] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 14/17] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 15/17] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 16/17] net/i40e: use set switch aq instead of register setting Jingjing Wu
2017-06-27 14:00       ` [dpdk-dev] [PATCH v4 17/17] net/i40e/base: update base code info Jingjing Wu
2017-06-27 14:25       ` [dpdk-dev] [PATCH v4 00/17] net/i40e: base code update Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495856866-89539-8-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).