DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/69] update for i40e base code
@ 2019-12-02  7:48 Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 01/69] net/i40e/base: add support for feature flags Xiaolong Ye
                   ` (71 more replies)
  0 siblings, 72 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  Cc: dev, Xiaolong Ye

Hi,

This series is to support FVL 7.2 release.

The main changes include:

* virtchnl updates
* add lldp support
* Flow director updates
* extend PHY access AQ cmd
* add reading LPI counters
* add support for Energy Efficient Ethernet
* A few fixes.

Thanks,
Xiaolong

Xiaolong Ye (69):
  net/i40e/base: add support for feature flags
  net/i40e/base: add ESXi support to transition to flat NVM
  net/i40e/base: increase max VSI count for VFs
  net/i40e/base: change buffer address
  net/i40e/base: change for X722 10G-T ports LED
  net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  net/i40e/base: changed FW API version to 1.8
  net/i40e/base: change misleading error message
  net/i40e/base: shadowRAM checksum calculation change
  net/i40e/base: update Fort Park FW API to 1.8
  net/i40e/base: further implementation of LLDP
  net/i40e/base: add new device ids for Carlsville
  net/i40e/base: add check for MAC type
  net/i40e/base: adding flags for PHY types
  net/i40e/base: revert ShadowRAM checksum calculation change
  net/i40e/base: improve AQ log granularity
  net/i40e/base: change condition checks
  net/i40e/base: add getter for FW LLDP agent status
  net/i40e/base: add support for Energy Efficient Ethernet
  net/i40e/base: read LPI status from external PHY
  net/i40e/base: change reading LPI state
  net/i40e/base: change for missing "link modes"
  net/i40e/base: add reading LPI counters
  net/i40e/base: update virtchnl.h
  net/i40e/base: add opcodes reserved comments
  net/i40e/base: revert Fix missing "fall through" comments
  net/i40e/base: backport style changes from upstream Linux
  net/i40e/base: update status codes
  net/i40e/base: use TX_LPI_EN bit to fully turn off EEE
  net/i40e/base: change of the incorrect Tx descriptors number
  net/i40e/base: extend PHY access AQ command
  net/i40e/base: add drop mode parameter to set MAC config
  net/i40e/base: check_recovery_mode had wrong if statement
  net/i40e/base: update FVL FW API version to 1.9
  net/i40e/base: update FPK FW API version to 1.9
  net/i40e/base: add persistent lldp support
  net/i40e/base: make i40e_set_mac_type() public
  net/i40e/base: change retrying
  net/i40e/base: revert fix for X722 10G-T ports LED
  net/i40e/base: change link flapping on 25g cards
  net/i40e/base: changeed code wrapping for CARLSVILLE_HW
  net/i40e/base: change long redundant define names
  net/i40e/base: mark additional missing bits as reserved
  net/i40e/base: change for persistent lldp support
  net/i40e/base: change wrong 'Advertised FEC modes'
  net/i40e/base: implement lpi statistics read from registers
  net/i40e/base: add Flow Director defines
  net/i40e/base: removed unreachable code
  net/i40e/base: set PHY Access flag on X722
  net/i40e/base: implement reading lpi statistics
  net/i40e/base: add MRR field defines
  net/i40e/base: exposing missing LED functionality
  net/i40e/base: introduce firmware EMP reset register offsets
  net/i40e/base: change for reading lpi statistics
  net/i40e/base: update FVL FW API version to 1.10
  net/i40e/base: add CRC stripping capability
  net/i40e/base: update virtchnl header with advanced features
  net/i40e/base: add limits for nested structures
  net/i40e/base: put the check for zero nested elements higher
  net/i40e/base: clarify requirements
  net/i40e/base: change 'Unknown bps'
  net/i40e/base: add USO offload flag for AVF
  net/i40e/base: update the interrupt mapping and negotiation
  net/i40e/base: add inline ipsec data struct and commands
  net/i40e/base: change all zero-sized arrays
  net/i40e/base: support for additional flow type
  net/i40e/base: change GET/SET_RSS_LUT valid_len check
  net/i40e/base: add missing 0 length checks
  net/i40e/base: update version

 drivers/net/i40e/base/README            |   2 +-
 drivers/net/i40e/base/i40e_adminq.c     | 105 +--
 drivers/net/i40e/base/i40e_adminq_cmd.h | 100 ++-
 drivers/net/i40e/base/i40e_common.c     | 554 +++++++++++++-
 drivers/net/i40e/base/i40e_dcb.c        | 122 ++-
 drivers/net/i40e/base/i40e_dcb.h        |  17 +-
 drivers/net/i40e/base/i40e_devids.h     |   2 +
 drivers/net/i40e/base/i40e_nvm.c        | 113 ++-
 drivers/net/i40e/base/i40e_prototype.h  |  68 +-
 drivers/net/i40e/base/i40e_register.h   |  95 +++
 drivers/net/i40e/base/i40e_type.h       |  51 +-
 drivers/net/i40e/base/virtchnl.h        | 943 +++++++++++++++++++++++-
 drivers/net/i40e/i40e_ethdev.c          |  12 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 14 files changed, 2011 insertions(+), 177 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 01/69] net/i40e/base: add support for feature flags
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 02/69] net/i40e/base: add ESXi support to transition to flat NVM Xiaolong Ye
                   ` (70 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, Xiaolong Ye, Piotr Pietruszewski, Galazka Krzysztof

Extend NVM Update API to support reporting of features
available for the tools.

This change is needed by NVM Update to determine if driver
supports changing NVM layout from structured to flat.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Arkadiusz Grubba <arkadiusz.grubba@intel.com>
Reviewed-by: Williams Mitch A <mitch.a.williams@intel.com>
Reviewed-by: Joyner Eric <eric.joyner@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 25 +++++++++++++++++
 drivers/net/i40e/base/i40e_nvm.c    | 42 ++++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_type.h   | 22 +++++++++++++++
 3 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 37911a99e..68348858d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1015,6 +1015,31 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
 			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
 
+#ifdef I40E_NVMUPD_SUPPORT
+#ifndef EXTERNAL_RELEASE
+	/* At the moment there are only two OSes where this feature
+	 * is required - FreeBSD and Linux. FreeBSD driver does
+	 * not support transition to Flat NVM. Use preprocessor
+	 * tag to ensure that this is exposed only for Linux.
+	 */
+#endif
+	/* NVMUpdate features structure initialization */
+	hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR;
+	hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR;
+	hw->nvmupd_features.size = sizeof(hw->nvmupd_features);
+	i40e_memset(hw->nvmupd_features.features, 0x0,
+		    I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN *
+		    sizeof(*hw->nvmupd_features.features),
+		    I40E_NONDMA_MEM);
+
+#ifdef LINUX_SUPPORT
+	hw->nvmupd_features.features[0] = I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT;
+#else
+	/* No features supported at the moment */
+	hw->nvmupd_features.features[0] = 0;
+#endif
+#endif /* I40E_NVMUPD_SUPPORT */
+
 	status = i40e_init_nvm(hw);
 	return status;
 }
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 6c8ca8771..c8b401cdd 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -797,6 +797,7 @@ STATIC const char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_EXEC_AQ",
 	"I40E_NVMUPD_GET_AQ_RESULT",
 	"I40E_NVMUPD_GET_AQ_EVENT",
+	"I40E_NVMUPD_GET_FEATURES",
 };
 
 /**
@@ -859,6 +860,31 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		return I40E_SUCCESS;
 	}
 
+	/*
+	 * A supported features request returns immediately
+	 * rather than going into state machine
+	 */
+	if (upd_cmd == I40E_NVMUPD_FEATURES) {
+		if (cmd->data_size < hw->nvmupd_features.size) {
+			*perrno = -EFAULT;
+			return I40E_ERR_BUF_TOO_SHORT;
+		}
+
+		/*
+		 * If buffer is bigger than i40e_nvmupd_features structure,
+		 * make sure the trailing bytes are set to 0x0.
+		 */
+		if (cmd->data_size > hw->nvmupd_features.size)
+			i40e_memset(bytes + hw->nvmupd_features.size, 0x0,
+				    cmd->data_size - hw->nvmupd_features.size,
+				    I40E_NONDMA_MEM);
+
+		i40e_memcpy(bytes, &hw->nvmupd_features,
+			    hw->nvmupd_features.size, I40E_NONDMA_MEM);
+
+		return I40E_SUCCESS;
+	}
+
 	/* Clear status even it is not read and log */
 	if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
@@ -1325,10 +1351,20 @@ STATIC enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 			upd_cmd = I40E_NVMUPD_READ_SA;
 			break;
 		case I40E_NVM_EXEC:
-			if (module == 0xf)
-				upd_cmd = I40E_NVMUPD_STATUS;
-			else if (module == 0)
+			switch (module) {
+			case I40E_NVM_EXEC_GET_AQ_RESULT:
 				upd_cmd = I40E_NVMUPD_GET_AQ_RESULT;
+				break;
+			case I40E_NVM_EXEC_FEATURES:
+				upd_cmd = I40E_NVMUPD_FEATURES;
+				break;
+			case I40E_NVM_EXEC_STATUS:
+				upd_cmd = I40E_NVMUPD_STATUS;
+				break;
+			default:
+				*perrno = -EFAULT;
+				return I40E_NVMUPD_INVALID;
+			}
 			break;
 		case I40E_NVM_AQE:
 			upd_cmd = I40E_NVMUPD_GET_AQ_EVENT;
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 06863d772..fcdf0eb29 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -478,6 +478,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_EXEC_AQ,
 	I40E_NVMUPD_GET_AQ_RESULT,
 	I40E_NVMUPD_GET_AQ_EVENT,
+	I40E_NVMUPD_FEATURES,
 };
 
 enum i40e_nvmupd_state {
@@ -513,6 +514,10 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_AQE				0xe
 #define I40E_NVM_EXEC				0xf
 
+#define I40E_NVM_EXEC_GET_AQ_RESULT		0x0
+#define I40E_NVM_EXEC_FEATURES			0xe
+#define I40E_NVM_EXEC_STATUS			0xf
+
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffffULL << I40E_NVM_ADAPT_SHIFT)
 
@@ -527,6 +532,20 @@ struct i40e_nvm_access {
 	u8 data[1];
 };
 
+/* NVMUpdate features API */
+#define I40E_NVMUPD_FEATURES_API_VER_MAJOR		0
+#define I40E_NVMUPD_FEATURES_API_VER_MINOR		14
+#define I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN	12
+
+#define I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT		BIT(0)
+
+struct i40e_nvmupd_features {
+	u8 major;
+	u8 minor;
+	u16 size;
+	u8 features[I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN];
+};
+
 /* (Q)SFP module access definitions */
 #define I40E_I2C_EEPROM_DEV_ADDR	0xA0
 #define I40E_I2C_EEPROM_DEV_ADDR2	0xA2
@@ -730,6 +749,9 @@ struct i40e_hw {
 	u16 first_tag;
 	u16 second_tag;
 
+	/* NVMUpdate features */
+	struct i40e_nvmupd_features nvmupd_features;
+
 	/* debug mask */
 	u32 debug_mask;
 	char err_str[16];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 02/69] net/i40e/base: add ESXi support to transition to flat NVM
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 01/69] net/i40e/base: add support for feature flags Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 03/69] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
                   ` (69 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel

ESXi is required to transition back to a flat NVM from structured. Adding
ifdef support for ESXi.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Reviewed-by: Stillwell Jr Paul M <paul.m.stillwell.jr@intel.com>
Reviewed-by: Williams Mitch A <mitch.a.williams@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 68348858d..ed9ad011d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1017,10 +1017,10 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 
 #ifdef I40E_NVMUPD_SUPPORT
 #ifndef EXTERNAL_RELEASE
-	/* At the moment there are only two OSes where this feature
-	 * is required - FreeBSD and Linux. FreeBSD driver does
+	/* At the moment there are only three OSes where this feature
+	 * is required - ESX, FreeBSD and Linux. FreeBSD driver does
 	 * not support transition to Flat NVM. Use preprocessor
-	 * tag to ensure that this is exposed only for Linux.
+	 * tag to ensure that this is exposed only for Linux and esx.
 	 */
 #endif
 	/* NVMUpdate features structure initialization */
@@ -1032,7 +1032,7 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 		    sizeof(*hw->nvmupd_features.features),
 		    I40E_NONDMA_MEM);
 
-#ifdef LINUX_SUPPORT
+#if defined(LINUX_SUPPORT) || defined(ESX_SUPPORT)
 	hw->nvmupd_features.features[0] = I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT;
 #else
 	/* No features supported at the moment */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 03/69] net/i40e/base: increase max VSI count for VFs
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 01/69] net/i40e/base: add support for feature flags Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 02/69] net/i40e/base: add ESXi support to transition to flat NVM Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 04/69] net/i40e/base: change buffer address Xiaolong Ye
                   ` (68 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Mitch Williams

For historical reasons, we allowed 3 VSIs per VF, but never used more
than one. Now with ADq, we can use up to 4 VSIs per VF, so change this
value to match.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index fcdf0eb29..0cbb13262 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -38,7 +38,7 @@
 #define I40E_MAX_PF_VSI			64
 #define I40E_MAX_PF_QP			128
 #define I40E_MAX_VSI_QP			16
-#define I40E_MAX_VF_VSI			3
+#define I40E_MAX_VF_VSI			4
 #define I40E_MAX_CHAINED_RX_BUFFERS	5
 #define I40E_MAX_PF_UDP_OFFLOAD_PORTS	16
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 04/69] net/i40e/base: change buffer address
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (2 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 03/69] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 05/69] net/i40e/base: change for X722 10G-T ports LED Xiaolong Ye
                   ` (67 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

The high 32-bits were being set incorrectly in the 'Set Local LLDP MIB'
AQ command (0x0A08). Change it to use the right macro to get the correct
bits.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Stillwell Jr Paul M <paul.m.stillwell.jr@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Joyner Eric <eric.joyner@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index ed9ad011d..a87d2fa6b 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4325,7 +4325,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 
 	cmd->type = mib_type;
 	cmd->length = CPU_TO_LE16(buff_size);
-	cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff));
+	cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff));
 	cmd->address_low =  CPU_TO_LE32(I40E_LO_DWORD((u64)buff));
 
 	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 05/69] net/i40e/base: change for X722 10G-T ports LED
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (3 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 04/69] net/i40e/base: change buffer address Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 06/69] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
                   ` (66 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Marczak

On some hardware LEDs would not blink after command 'ethtool -p {eth-port}'
in certain circumstances. Now, function does not care about the activity
of the LED (though still preserves its state) but forcibly executes
identification blinking and then restores the LED state.

Signed-off-by: Piotr Marczak <piotr.marczak@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 35 -----------------------------
 1 file changed, 35 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index a87d2fa6b..f6e55e3a9 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1589,7 +1589,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
  **/
 u32 i40e_led_get(struct i40e_hw *hw)
 {
-	u32 current_mode = 0;
 	u32 mode = 0;
 	int i;
 
@@ -1601,27 +1600,10 @@ u32 i40e_led_get(struct i40e_hw *hw)
 
 		if (!gpio_val)
 			continue;
-
-		/* ignore gpio LED src mode entries related to the activity
-		 *  LEDs
-		 */
-		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
-				>> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
-		switch (current_mode) {
-		case I40E_COMBINED_ACTIVITY:
-		case I40E_FILTER_ACTIVITY:
-		case I40E_MAC_ACTIVITY:
-		case I40E_LINK_ACTIVITY:
-			continue;
-		default:
-			break;
-		}
-
 		mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
 			I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT;
 		break;
 	}
-
 	return mode;
 }
 
@@ -1636,7 +1618,6 @@ u32 i40e_led_get(struct i40e_hw *hw)
  **/
 void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 {
-	u32 current_mode = 0;
 	int i;
 
 	if (mode & 0xfffffff0)
@@ -1650,22 +1631,6 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 
 		if (!gpio_val)
 			continue;
-
-		/* ignore gpio LED src mode entries related to the activity
-		 * LEDs
-		 */
-		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
-				>> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
-		switch (current_mode) {
-		case I40E_COMBINED_ACTIVITY:
-		case I40E_FILTER_ACTIVITY:
-		case I40E_MAC_ACTIVITY:
-		case I40E_LINK_ACTIVITY:
-			continue;
-		default:
-			break;
-		}
-
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 06/69] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (4 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 05/69] net/i40e/base: change for X722 10G-T ports LED Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 07/69] net/i40e/base: changed FW API version to 1.8 Xiaolong Ye
                   ` (65 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Chinh T Cao

There is a need to enable MIB change event, not at the same time as
init_dcb. This patch will serve this requirement.

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 52 +++++++++++++++++++++++---------
 drivers/net/i40e/base/i40e_dcb.h |  5 ++-
 drivers/net/i40e/i40e_ethdev.c   |  4 +--
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index a26f82b3a..832d8f3fb 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -863,22 +863,23 @@ enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw)
 /**
  * i40e_init_dcb
  * @hw: pointer to the hw struct
+ * @enable_mib_change: enable mib change event
  *
  * Update DCB configuration from the Firmware
  **/
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 {
 	enum i40e_status_code ret = I40E_SUCCESS;
 	struct i40e_lldp_variables lldp_cfg;
 	u8 adminstatus = 0;
 
 	if (!hw->func_caps.dcb)
-		return ret;
+		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
 	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
 	if (ret)
-		return ret;
+		return I40E_ERR_NOT_READY;
 
 	/* Get the LLDP AdminStatus for the current port */
 	adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
@@ -887,7 +888,7 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 	/* LLDP agent disabled */
 	if (!adminstatus) {
 		hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
-		return ret;
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Get DCBX status */
@@ -896,27 +897,48 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 		return ret;
 
 	/* Check the DCBX Status */
-	switch (hw->dcbx_status) {
-	case I40E_DCBX_STATUS_DONE:
-	case I40E_DCBX_STATUS_IN_PROGRESS:
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+	    hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
 		/* Get current DCBX configuration */
 		ret = i40e_get_dcb_config(hw);
 		if (ret)
 			return ret;
-		break;
-	case I40E_DCBX_STATUS_DISABLED:
-		return ret;
-	case I40E_DCBX_STATUS_NOT_STARTED:
-	case I40E_DCBX_STATUS_MULTIPLE_PEERS:
-	default:
-		break;
+	} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Configure the LLDP MIB change event */
-	ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
+	if (enable_mib_change)
+		ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
+
+	return ret;
+}
+
+/**
+ * i40e_cfg_lldp_mib_change
+ * @hw: pointer to the hw struct
+ * @ena_mib: enable/disable MIB change event
+ *
+ * Configure (disable/enable) MIB
+ */
+enum i40e_status_code i40e_cfg_lldp_mib_change(struct i40e_hw *hw, bool ena_mib)
+{
+	enum i40e_status_code ret = I40E_SUCCESS;
+
+	if (!hw->func_caps.dcb)
+		return I40E_NOT_SUPPORTED;
+
+	/* Get DCBX status */
+	ret = i40e_get_dcbx_status(hw, &hw->dcbx_status);
 	if (ret)
 		return ret;
 
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED)
+		return I40E_ERR_NOT_READY;
+
+	/* Configure the LLDP MIB change event */
+	ret = i40e_aq_cfg_lldp_mib_change_event(hw, ena_mib, NULL);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 85b0eed3a..f7cdc27a3 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -186,7 +186,10 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 					     u8 bridgetype,
 					     struct i40e_dcbx_config *dcbcfg);
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw);
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
+				    bool enable_mib_change);
+enum i40e_status_code i40e_cfg_lldp_mib_change(struct i40e_hw *hw,
+					       bool ena_mib);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5999c964b..ca83c56df 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11582,7 +11582,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, TRUE);
 		/* If lldp agent is stopped, the return value from
 		 * i40e_init_dcb we expect is failure with I40E_AQ_RC_EPERM
 		 * adminq status. Otherwise, it should return success.
@@ -11630,7 +11630,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, TRUE);
 		if (!ret) {
 			if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
 				PMD_INIT_LOG(ERR,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 07/69] net/i40e/base: changed FW API version to 1.8
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (5 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 06/69] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 08/69] net/i40e/base: change misleading error message Xiaolong Ye
                   ` (64 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Adam Ludkiewicz

A new FW has been released, which uses API version 1.8.

Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index b459be921..660a9af04 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -13,7 +13,7 @@
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
 #define I40E_FW_API_VERSION_MINOR_X722	0x0006
-#define I40E_FW_API_VERSION_MINOR_X710	0x0007
+#define I40E_FW_API_VERSION_MINOR_X710	0x0008
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 08/69] net/i40e/base: change misleading error message
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (6 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 07/69] net/i40e/base: changed FW API version to 1.8 Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 09/69] net/i40e/base: shadowRAM checksum calculation change Xiaolong Ye
                   ` (63 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Carolyn Wyborny

This patch changes an error code for an admin queue head overrun to use
I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 38214a373..b2fc6f590 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -835,7 +835,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	if (val >= hw->aq.num_asq_entries) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
 			   "AQTX: head overrun at %d\n", val);
-		status = I40E_ERR_QUEUE_EMPTY;
+		status = I40E_ERR_ADMIN_QUEUE_FULL;
 		goto asq_send_command_error;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 09/69] net/i40e/base: shadowRAM checksum calculation change
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (7 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 08/69] net/i40e/base: change misleading error message Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 10/69] net/i40e/base: update Fort Park FW API to 1.8 Xiaolong Ye
                   ` (62 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Maciej Paczkowski

Due to changes in FW the SW is required to perform double SR dump in
some cases.
Implementation adds two new steps to update nvm checksum function:
- recalculate checksum and check if checksum in NVM is correct
- if checksum in NVM is not correct then update it again

Signed-off-by: Maciej Paczkowski <maciej.paczkowski@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Azarewicz Piotr <piotr.azarewicz@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_nvm.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index c8b401cdd..8c94b6072 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -676,16 +676,38 @@ enum i40e_status_code i40e_calc_nvm_checksum(struct i40e_hw *hw, u16 *checksum)
 enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw)
 {
 	enum i40e_status_code ret_code = I40E_SUCCESS;
-	u16 checksum;
+	u16 checksum, checksum_sr;
 	__le16 le_sum;
 
 	DEBUGFUNC("i40e_update_nvm_checksum");
 
 	ret_code = i40e_calc_nvm_checksum(hw, &checksum);
+	if (ret_code)
+		return ret_code;
+
 	le_sum = CPU_TO_LE16(checksum);
-	if (ret_code == I40E_SUCCESS)
-		ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
+	ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
+				     1, &le_sum, true);
+	if (ret_code)
+		return ret_code;
+
+	/* Due to changes in FW the SW is required to perform double SR-dump
+	 * in some cases. SR-dump is the process when internal shadow RAM is
+	 * dumped into flash bank. It is triggered by setting "last_command"
+	 * argument in i40e_write_nvm_aq function call.
+	 * Since FW 1.8 we need to calculate SR checksum again and update it
+	 * in flash if it is not equal to previously computed checksum.
+	 * This situation would occur only in FW >= 1.8
+	 */
+	ret_code = i40e_calc_nvm_checksum(hw, &checksum_sr);
+	if (ret_code)
+		return ret_code;
+	if (checksum_sr != checksum) {
+		le_sum = CPU_TO_LE16(checksum_sr);
+		ret_code = i40e_write_nvm_aq(hw, 0x00,
+					     I40E_SR_SW_CHECKSUM_WORD,
 					     1, &le_sum, true);
+	}
 
 	return ret_code;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 10/69] net/i40e/base: update Fort Park FW API to 1.8
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (8 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 09/69] net/i40e/base: shadowRAM checksum calculation change Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 11/69] net/i40e/base: further implementation of LLDP Xiaolong Ye
                   ` (61 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Maciej Rabeda

In previous commits only FVL FW API was updated to 1.8. However, NVMs
from upcoming FVL SW7 project advertise FW API version 1.8 both for FVL
and FPK.

Signed-off-by: Maciej Rabeda <maciej.rabeda@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 660a9af04..7a980cde9 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -12,7 +12,7 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0006
+#define I40E_FW_API_VERSION_MINOR_X722	0x0008
 #define I40E_FW_API_VERSION_MINOR_X710	0x0008
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 11/69] net/i40e/base: further implementation of LLDP
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (9 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 10/69] net/i40e/base: update Fort Park FW API to 1.8 Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 12/69] net/i40e/base: add new device ids for Carlsville Xiaolong Ye
                   ` (60 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Ilgiewicz

This code implements shared code changes necessary for LLDP Agent
support.

1. Modified i40e_aq_start_lldp and i40e_aq_stop_lldp. Now Stop and Start
can also be persistent across power cycles.
2. Added new function i40e_aq_restore_lldp which restores factory
setting for LLDP Agent or gets its status.
This patch will break Linux build as functions parameters are
changed!

Signed-off-by: Jaroslaw Ilgiewicz <jaroslaw.ilgiewicz@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  5 +++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 20 +++++++--
 drivers/net/i40e/base/i40e_common.c     | 59 +++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  5 +++
 drivers/net/i40e/base/i40e_type.h       |  1 +
 drivers/net/i40e/i40e_ethdev.c          |  4 +-
 drivers/net/i40e/rte_pmd_i40e.c         |  4 +-
 7 files changed, 90 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b2fc6f590..6bd4595d0 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -682,6 +682,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	     (hw->aq.api_min_ver >= 5)))
 		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
 
+	if (hw->aq.api_maj_ver > 1 ||
+	    (hw->aq.api_maj_ver == 1 &&
+	     hw->aq.api_min_ver >= 8))
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+
 	if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7a980cde9..4454bce5a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -265,6 +265,7 @@ enum i40e_admin_queue_opc {
 	i40e_aqc_opc_get_cee_dcb_cfg	= 0x0A07,
 	i40e_aqc_opc_lldp_set_local_mib	= 0x0A08,
 	i40e_aqc_opc_lldp_stop_start_spec_agent	= 0x0A09,
+	i40e_aqc_opc_lldp_restore		= 0x0A0A,
 
 	/* Tunnel commands */
 	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
@@ -2554,18 +2555,19 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
 /* Stop LLDP (direct 0x0A05) */
 struct i40e_aqc_lldp_stop {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_STOP		0x0
-#define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
+#define I40E_AQ_LLDP_AGENT_STOP			0x0
+#define I40E_AQ_LLDP_AGENT_SHUTDOWN		0x1
+#define I40E_AQ_LLDP_AGENT_STOP_PERSIST		0x2
 	u8	reserved[15];
 };
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
 
 /* Start LLDP (direct 0x0A06) */
-
 struct i40e_aqc_lldp_start {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_START	0x1
+#define I40E_AQ_LLDP_AGENT_START		0x1
+#define I40E_AQ_LLDP_AGENT_START_PERSIST	0x2
 	u8	reserved[15];
 };
 
@@ -2685,6 +2687,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent);
 
+/* Restore LLDP Agent factory settings (direct 0x0A0A) */
+struct i40e_aqc_lldp_restore {
+	u8	command;
+#define I40E_AQ_LLDP_AGENT_RESTORE_NOT		0x0
+#define I40E_AQ_LLDP_AGENT_RESTORE		0x1
+	u8	reserved[15];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore);
+
 /* Add Udp Tunnel command and completion (direct 0x0B00) */
 struct i40e_aqc_add_udp_tunnel {
 	__le16	udp_port;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index f6e55e3a9..c77b26407 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4475,15 +4475,55 @@ enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
 	return status;
 }
 
+/**
+ * i40e_aq_restore_lldp
+ * @hw: pointer to the hw struct
+ * @setting: pointer to factory setting variable or NULL
+ * @restore: True if factory settings should be restored
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Restore LLDP Agent factory settings if @restore set to True. In other case
+ * only returns factory setting in AQ response.
+ **/
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_lldp_restore *cmd =
+		(struct i40e_aqc_lldp_restore *)&desc.params.raw;
+	enum i40e_status_code status;
+
+	if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) {
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Restore LLDP not supported by current FW version.\n");
+		return I40E_ERR_DEVICE_NOT_SUPPORTED;
+	}
+
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_restore);
+
+	if (restore)
+		cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE;
+
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+
+	if (setting)
+		*setting = cmd->command & 1;
+
+	return status;
+}
+
 /**
  * i40e_aq_stop_lldp
  * @hw: pointer to the hw struct
  * @shutdown_agent: True if LLDP Agent needs to be Shutdown
+ * @persist: True if stop of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Stop or Shutdown the embedded LLDP Agent
  **/
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4496,6 +4536,14 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 	if (shutdown_agent)
 		cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN;
 
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Stop LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
@@ -4504,11 +4552,13 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 /**
  * i40e_aq_start_lldp
  * @hw: pointer to the hw struct
+ * @persist: True if start of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Start the embedded LLDP Agent on all ports.
  **/
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4519,6 +4569,15 @@ enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
 	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_start);
 
 	cmd->command = I40E_AQ_LLDP_AGENT_START;
+
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Start LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0cf006dad..17d54e647 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -264,13 +264,18 @@ enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
 				u8 bridge_type, void *buff, u16 buff_size,
 				u16 tlv_len, u16 *mib_len,
 				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+				struct i40e_asq_cmd_details *cmd_details);
+
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
 						 bool dcb_enable,
 						 struct i40e_asq_cmd_details
 						 *cmd_details);
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
 				void *buff, u16 buff_size,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 0cbb13262..322300fa3 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -742,6 +742,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
+#define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ca83c56df..f567868da 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11577,7 +11577,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 */
 	if (sw_dcb == TRUE) {
 		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
+			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
@@ -11626,7 +11626,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 			return -ENOTSUP;
 		}
 	} else {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, TRUE, NULL);
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index fdcb1a43e..dbd2082e9 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1409,7 +1409,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Disable DCBx if it's the first time to set strict priority. */
 	if (!veb->strict_prio_tc) {
-		ret = i40e_aq_stop_lldp(hw, true, NULL);
+		ret = i40e_aq_stop_lldp(hw, true, true, NULL);
 		if (ret)
 			PMD_DRV_LOG(INFO,
 				    "Failed to disable DCBx as it's already"
@@ -1464,7 +1464,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Enable DCBx again, if all the TCs' strict priority disabled. */
 	if (!tc_map) {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, TRUE, NULL);
 		if (ret) {
 			PMD_DRV_LOG(ERR,
 				    "Failed to enable DCBx, err(%d).", ret);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 12/69] net/i40e/base: add new device ids for Carlsville
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (10 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 11/69] net/i40e/base: further implementation of LLDP Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 13/69] net/i40e/base: add check for MAC type Xiaolong Ye
                   ` (59 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

New device ids are created to support SFP+ and backplane connections on
ports 2 & 3 of the Carlsville.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 ++
 drivers/net/i40e/base/i40e_devids.h | 2 ++
 drivers/net/i40e/i40e_ethdev.c      | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c77b26407..c43baa1f5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -36,6 +36,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
 		case I40E_DEV_ID_10G_BASE_T:
 		case I40E_DEV_ID_10G_BASE_T4:
 		case I40E_DEV_ID_10G_BASE_T_BC:
+		case I40E_DEV_ID_10G_B:
+		case I40E_DEV_ID_10G_SFP:
 		case I40E_DEV_ID_20G_KR2:
 		case I40E_DEV_ID_20G_KR2_A:
 		case I40E_DEV_ID_25G_B:
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index f3c59bdea..adf62fd0f 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -25,6 +25,8 @@
 #define I40E_DEV_ID_X710_N3000      0x0CF8
 #define I40E_DEV_ID_XXV710_N3000	0x0D58
 #define I40E_DEV_ID_10G_BASE_T_BC	0x15FF
+#define I40E_DEV_ID_10G_B		0x104F
+#define I40E_DEV_ID_10G_SFP		0x104E
 #if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_VF			0x154C
 #define I40E_DEV_ID_VF_HV		0x1571
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f567868da..208a9a112 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -443,6 +443,8 @@ static const struct rte_pci_id pci_id_i40e_map[] = {
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_XXV710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_BC) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_B) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_SFP) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 13/69] net/i40e/base: add check for MAC type
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (11 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 12/69] net/i40e/base: add new device ids for Carlsville Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 14/69] net/i40e/base: adding flags for PHY types Xiaolong Ye
                   ` (58 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Galazka Krzysztof

Some features were introduced in different FW API version on XL710 and X722
MACs. Others are available only on specific MAC type. Make sure that they
are properly assigned. Also fix the style issues reported by current
check-patch.

Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 84 +++++++++++++++--------------
 1 file changed, 45 insertions(+), 39 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 6bd4595d0..b5d789ede 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -582,25 +582,24 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
  **/
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
+	struct i40e_adminq_info *aq = &hw->aq;
+	enum i40e_status_code ret_code;
 #ifdef PF_DRIVER
 	u16 cfg_ptr, oem_hi, oem_lo;
 	u16 eetrack_lo, eetrack_hi;
-#endif
-	enum i40e_status_code ret_code;
-#ifdef PF_DRIVER
 	int retry = 0;
 #endif
 
 	/* verify input for valid configuration */
-	if ((hw->aq.num_arq_entries == 0) ||
-	    (hw->aq.num_asq_entries == 0) ||
-	    (hw->aq.arq_buf_size == 0) ||
-	    (hw->aq.asq_buf_size == 0)) {
+	if (aq->num_arq_entries == 0 ||
+	    aq->num_asq_entries == 0 ||
+	    aq->arq_buf_size == 0 ||
+	    aq->asq_buf_size == 0) {
 		ret_code = I40E_ERR_CONFIG;
 		goto init_adminq_exit;
 	}
-	i40e_init_spinlock(&hw->aq.asq_spinlock);
-	i40e_init_spinlock(&hw->aq.arq_spinlock);
+	i40e_init_spinlock(&aq->asq_spinlock);
+	i40e_init_spinlock(&aq->arq_spinlock);
 
 	/* Set up register offsets */
 	i40e_adminq_init_regs(hw);
@@ -630,11 +629,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	 */
 	do {
 		ret_code = i40e_aq_get_firmware_version(hw,
-							&hw->aq.fw_maj_ver,
-							&hw->aq.fw_min_ver,
-							&hw->aq.fw_build,
-							&hw->aq.api_maj_ver,
-							&hw->aq.api_min_ver,
+							&aq->fw_maj_ver,
+							&aq->fw_min_ver,
+							&aq->fw_build,
+							&aq->api_maj_ver,
+							&aq->api_min_ver,
 							NULL);
 		if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT)
 			break;
@@ -658,36 +657,43 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 			   &oem_lo);
 	hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo;
 
-	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 7)))
-		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
-
-	if (hw->mac.type == I40E_MAC_XL710 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
-		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-	if (hw->mac.type == I40E_MAC_X722 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+	/*
+	 * Some features were introduced in different FW API version
+	 * for different MAC type.
+	 */
+	switch (hw->mac.type) {
+	case I40E_MAC_XL710:
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) {
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+			/* The ability to RX (not drop) 802.1ad frames */
+			hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
+		}
+		break;
+	case I40E_MAC_X722:
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+		/* fall through */
+	default:
+		break;
 	}
 
 	/* Newer versions of firmware require lock when reading the NVM */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 5)))
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 5))
 		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
 
-	if (hw->aq.api_maj_ver > 1 ||
-	    (hw->aq.api_maj_ver == 1 &&
-	     hw->aq.api_min_ver >= 8))
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 8))
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
 
-	if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
+	if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
 	}
@@ -710,8 +716,8 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 init_adminq_free_asq:
 	i40e_shutdown_asq(hw);
 init_adminq_destroy_spinlocks:
-	i40e_destroy_spinlock(&hw->aq.asq_spinlock);
-	i40e_destroy_spinlock(&hw->aq.arq_spinlock);
+	i40e_destroy_spinlock(&aq->asq_spinlock);
+	i40e_destroy_spinlock(&aq->arq_spinlock);
 
 init_adminq_exit:
 	return ret_code;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 14/69] net/i40e/base: adding flags for PHY types
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (12 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 13/69] net/i40e/base: add check for MAC type Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 15/69] net/i40e/base: revert ShadowRAM checksum calculation change Xiaolong Ye
                   ` (57 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Michal Litwicki

Adding bit flags to enable/disable EEE capability on Carlsville HW
for 2.5GBase-T and 5GBase-T PHY types as well as 'Set autonomous
EEE for relevant enabled PHY types' flag.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Michal Litwicki <michalx.litwicki@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 4454bce5a..9179bbe8f 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2027,12 +2027,19 @@ struct i40e_aq_get_phy_abilities_resp {
 #define I40E_AQ_PHY_FEC_ABILITY_KR	0x40
 #define I40E_AQ_PHY_FEC_ABILITY_RS	0x80
 	__le16	eee_capability;
+#ifdef CARLSVILLE_HW
+#define I40E_AQ_EEE_AUTO		0x0001
+#endif
 #define I40E_AQ_EEE_100BASE_TX		0x0002
 #define I40E_AQ_EEE_1000BASE_T		0x0004
 #define I40E_AQ_EEE_10GBASE_T		0x0008
 #define I40E_AQ_EEE_1000BASE_KX		0x0010
 #define I40E_AQ_EEE_10GBASE_KX4		0x0020
 #define I40E_AQ_EEE_10GBASE_KR		0x0040
+#ifdef CARLSVILLE_HW
+#define I40E_AQ_EEE_2_5GBASE_T		0x0100
+#define I40E_AQ_EEE_5GBASE_T		0x0200
+#endif
 	__le32	eeer_val;
 	u8	d3_lpan;
 #define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 15/69] net/i40e/base: revert ShadowRAM checksum calculation change
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (13 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 14/69] net/i40e/base: adding flags for PHY types Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 16/69] net/i40e/base: improve AQ log granularity Xiaolong Ye
                   ` (56 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Maciej Paczkowski

The reason of this revert is unexpected issue found in NVM Update tool
in Linux, ESX and FreeBSD during NVM image downgrade. The implementation
is no longer needed since the QV tools are already aware of new FW
double ShadowRAM dump mechanism.

Signed-off-by: Maciej Paczkowski <maciej.paczkowski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_nvm.c | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 8c94b6072..c8b401cdd 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -676,38 +676,16 @@ enum i40e_status_code i40e_calc_nvm_checksum(struct i40e_hw *hw, u16 *checksum)
 enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw)
 {
 	enum i40e_status_code ret_code = I40E_SUCCESS;
-	u16 checksum, checksum_sr;
+	u16 checksum;
 	__le16 le_sum;
 
 	DEBUGFUNC("i40e_update_nvm_checksum");
 
 	ret_code = i40e_calc_nvm_checksum(hw, &checksum);
-	if (ret_code)
-		return ret_code;
-
 	le_sum = CPU_TO_LE16(checksum);
-	ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
-				     1, &le_sum, true);
-	if (ret_code)
-		return ret_code;
-
-	/* Due to changes in FW the SW is required to perform double SR-dump
-	 * in some cases. SR-dump is the process when internal shadow RAM is
-	 * dumped into flash bank. It is triggered by setting "last_command"
-	 * argument in i40e_write_nvm_aq function call.
-	 * Since FW 1.8 we need to calculate SR checksum again and update it
-	 * in flash if it is not equal to previously computed checksum.
-	 * This situation would occur only in FW >= 1.8
-	 */
-	ret_code = i40e_calc_nvm_checksum(hw, &checksum_sr);
-	if (ret_code)
-		return ret_code;
-	if (checksum_sr != checksum) {
-		le_sum = CPU_TO_LE16(checksum_sr);
-		ret_code = i40e_write_nvm_aq(hw, 0x00,
-					     I40E_SR_SW_CHECKSUM_WORD,
+	if (ret_code == I40E_SUCCESS)
+		ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
 					     1, &le_sum, true);
-	}
 
 	return ret_code;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 16/69] net/i40e/base: improve AQ log granularity
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (14 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 15/69] net/i40e/base: revert ShadowRAM checksum calculation change Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 17/69] net/i40e/base: change condition checks Xiaolong Ye
                   ` (55 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Robert Konklewski

This patch makes it possible to log only AQ descriptors, without the
entire AQ message buffers being dumped too. It should greatly reduce
kernel log size in cases where a full AQ dump is not needed.
Selection is made by setting flags in hw->debug_mask.

Additionally, some debug messages that preceded an AQ dump have been
moved to I40E_DEBUG_AQ_COMMAND class, which seems more appropriate.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c |  8 ++++----
 drivers/net/i40e/base/i40e_common.c | 17 +++++++++++------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b5d789ede..2cb81ed80 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -762,7 +762,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
 	desc = I40E_ADMINQ_DESC(*asq, ntc);
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
-		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+		i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
@@ -934,7 +934,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	}
 
 	/* bump the tail */
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,
 		      buff, buff_size);
 	(hw->aq.asq.next_to_use)++;
@@ -987,7 +987,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 		hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
 	}
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 		   "AQTX: desc and buffer writeback:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);
 
@@ -1116,7 +1116,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
 			    hw->aq.arq.r.arq_bi[desc_idx].va,
 			    e->msg_len, I40E_DMA_TO_NONDMA);
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,
 		      hw->aq.arq_buf_size);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c43baa1f5..e1b95808d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -307,32 +307,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 		   void *buffer, u16 buf_len)
 {
 	struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
+	u32 effective_mask = hw->debug_mask & mask;
 	u8 *buf = (u8 *)buffer;
 	u16 len;
 	u16 i = 0;
 
-	if ((!(mask & hw->debug_mask)) || (desc == NULL))
+	if (!effective_mask || desc)
 		return;
 
 	len = LE16_TO_CPU(aq_desc->datalen);
 
-	i40e_debug(hw, mask,
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
 		   "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
 		   LE16_TO_CPU(aq_desc->opcode),
 		   LE16_TO_CPU(aq_desc->flags),
 		   LE16_TO_CPU(aq_desc->datalen),
 		   LE16_TO_CPU(aq_desc->retval));
-	i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tcookie (h,l) 0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->cookie_high),
 		   LE32_TO_CPU(aq_desc->cookie_low));
-	i40e_debug(hw, mask, "\tparam (0,1)  0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tparam (0,1)  0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.internal.param0),
 		   LE32_TO_CPU(aq_desc->params.internal.param1));
-	i40e_debug(hw, mask, "\taddr (h,l)   0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\taddr (h,l)   0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.external.addr_high),
 		   LE32_TO_CPU(aq_desc->params.external.addr_low));
 
-	if ((buffer != NULL) && (aq_desc->datalen != 0)) {
+	if (!buffer && (buf_len != 0) && (len != 0) &&
+	    (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
 		i40e_debug(hw, mask, "AQ CMD Buffer:\n");
 		if (buf_len < len)
 			len = buf_len;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 17/69] net/i40e/base: change condition checks
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (15 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 16/69] net/i40e/base: improve AQ log granularity Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 18/69] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
                   ` (54 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jeff Kirsher

Two conditional checks were checking the opposite of what was intended.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Azarewicz Piotr <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index e1b95808d..56645401c 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -312,7 +312,7 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 	u16 len;
 	u16 i = 0;
 
-	if (!effective_mask || desc)
+	if (!effective_mask || !desc)
 		return;
 
 	len = LE16_TO_CPU(aq_desc->datalen);
@@ -336,7 +336,7 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 		   LE32_TO_CPU(aq_desc->params.external.addr_high),
 		   LE32_TO_CPU(aq_desc->params.external.addr_low));
 
-	if (!buffer && (buf_len != 0) && (len != 0) &&
+	if (buffer && (buf_len != 0) && (len != 0) &&
 	    (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
 		i40e_debug(hw, mask, "AQ CMD Buffer:\n");
 		if (buf_len < len)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 18/69] net/i40e/base: add getter for FW LLDP agent status
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (16 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 17/69] net/i40e/base: change condition checks Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 19/69] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
                   ` (53 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change introduces i40e_get_fw_lldp_status() function capable of
reporting status of FW Link Layer Discovery Protocol (LLDP) agent.

Since reading LLDP configuration from NVM only gives information what
is the default state of FW LLDP agent after POR, this change introduces
more reliable method for checking if agent is enabled.

Current state of FW LLDP agent may be different if user disabled the
agent, so i40e_get_fw_lldp_status() uses LLDP MIB checking to determine
status of the agent.

This patch is a port of change introduced by Krzysztof Galazka
<krzysztof.galazka@intel.com> in 40G FreeBSD driver.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Piotr Marczak <piotr.marczak@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 50 ++++++++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_dcb.h |  7 +++++
 2 files changed, 57 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 832d8f3fb..96d2f05df 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -914,6 +914,56 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 	return ret;
 }
 
+/**
+ * i40e_get_fw_lldp_status
+ * @hw: pointer to the hw struct
+ * @lldp_status: pointer to the status enum
+ *
+ * Get status of FW Link Layer Discovery Protocol (LLDP) Agent.
+ * Status of agent is reported via @lldp_status parameter.
+ **/
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status)
+{
+	enum i40e_status_code ret;
+	struct i40e_virt_mem mem;
+	u8 *lldpmib;
+
+	if (!lldp_status)
+		return I40E_ERR_PARAM;
+
+	/* Allocate buffer for the LLDPDU */
+	ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE);
+	if (ret)
+		return ret;
+
+#ifndef EXTERNAL_RELEASE
+	/*
+	 * We just need the status code. The bridgeport and mib_type
+	 * arguments are irrelevant in this case. We have to
+	 * provide a buffer or we may get EFBIG.
+	 */
+#endif
+	lldpmib = (u8 *)mem.va;
+	ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib,
+				   I40E_LLDPDU_SIZE, NULL, NULL, NULL);
+
+	if (ret == I40E_SUCCESS) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) {
+		/* MIB is not available yet but the agent is running */
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+		ret = I40E_SUCCESS;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED;
+		ret = I40E_SUCCESS;
+	}
+
+	i40e_free_virt_mem(hw, &mem);
+	return ret;
+}
+
 /**
  * i40e_cfg_lldp_mib_change
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index f7cdc27a3..6805bc8fb 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -178,6 +178,11 @@ struct i40e_dcbx_variables {
 	u32 deftsaassignment;
 };
 
+enum i40e_get_fw_lldp_status_resp {
+	I40E_GET_FW_LLDP_STATUS_DISABLED = 0,
+	I40E_GET_FW_LLDP_STATUS_ENABLED = 1
+};
+
 enum i40e_status_code i40e_get_dcbx_status(struct i40e_hw *hw,
 					   u16 *status);
 enum i40e_status_code i40e_lldp_to_dcb_config(u8 *lldpmib,
@@ -188,6 +193,8 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
 				    bool enable_mib_change);
+enum i40e_status_code i40e_get_fw_lldp_status(struct i40e_hw *hw,
+		enum i40e_get_fw_lldp_status_resp *lldp_status);
 enum i40e_status_code i40e_cfg_lldp_mib_change(struct i40e_hw *hw,
 					       bool ena_mib);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 19/69] net/i40e/base: add support for Energy Efficient Ethernet
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (17 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 18/69] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 20/69] net/i40e/base: read LPI status from external PHY Xiaolong Ye
                   ` (52 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change adds i40e_enable_eee() function controlling advertisement
of Energy Efficient Ethernet mode (EEE).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 57 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 2 files changed, 58 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 56645401c..da7869431 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7143,6 +7143,63 @@ enum i40e_status_code i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
 	return status;
 }
 
+/**
+ * i40e_enable_eee
+ * @hw: pointer to the hardware structure
+ * @enable: state of Energy Efficient Ethernet mode to be set
+ *
+ * Enables or disables Energy Efficient Ethernet (EEE) mode
+ * accordingly to @enable parameter.
+ **/
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable)
+{
+	struct i40e_aq_get_phy_abilities_resp abilities;
+	struct i40e_aq_set_phy_config config;
+	enum i40e_status_code status;
+	__le16 eee_capability;
+
+	/* Get initial PHY capabilities */
+	status = i40e_aq_get_phy_capabilities(hw, false, true, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Check whether NIC configuration is compatible with Energy Efficient
+	 * Ethernet (EEE) mode.
+	 */
+	if (abilities.eee_capability == 0) {
+		status = I40E_ERR_CONFIG;
+		goto err;
+	}
+
+	/* Cache initial EEE capability */
+	eee_capability = abilities.eee_capability;
+
+	/* Get current configuration */
+	status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Cache current configuration */
+	config.phy_type = abilities.phy_type;
+	config.link_speed = abilities.link_speed;
+	config.abilities = abilities.abilities |
+			   I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	config.eeer = abilities.eeer_val;
+	config.low_power_ctrl = abilities.d3_lpan;
+	config.fec_config = abilities.fec_cfg_curr_mod_ext_info &
+			    I40E_AQ_PHY_FEC_CONFIG_MASK;
+
+	/* Set desired EEE state */
+	config.eee_capability = enable ? eee_capability : 0;
+
+	/* Save modified config */
+	status = i40e_aq_set_phy_config(hw, &config, NULL);
+err:
+	return status;
+}
+
 /**
  * i40e_write_rx_ctl - write to an Rx control register
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 17d54e647..406b902b3 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -428,6 +428,7 @@ void i40e_clear_pxe_mode(struct i40e_hw *hw);
 enum i40e_status_code i40e_get_link_status(struct i40e_hw *hw, bool *link_up);
 enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw);
 enum i40e_status_code i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 enum i40e_status_code i40e_read_bw_from_alt_ram(struct i40e_hw *hw,
 		u32 *max_bw, u32 *min_bw, bool *min_valid, bool *max_valid);
 enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 20/69] net/i40e/base: read LPI status from external PHY
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (18 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 19/69] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 21/69] net/i40e/base: change reading LPI state Xiaolong Ye
                   ` (51 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, Xiaolong Ye, Krzysztof Galazka, Piotr Pietruszewski

When external PHY is used, MAC register may not reflect actual
state of LPI. Add function reading it directly from PHY or MAC,
depending on what is supported by the device.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 66 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  2 +
 drivers/net/i40e/base/i40e_type.h      |  8 ++++
 3 files changed, 76 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index da7869431..51ab0c4b8 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7046,6 +7046,72 @@ enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
 	status = i40e_led_set_reg(hw, led_addr, led_ctl);
 	return status;
 }
+
+#ifdef CARLSVILLE_HW
+/**
+ * i40e_get_phy_lpi_status - read LPI status from external PHY or MAC
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ *
+ * Read LPI state directly from external PHY or MAC, depending on device ID.
+ */
+#else
+/**
+ * i40e_get_phy_lpi_status - read LPI status from MAC
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ *
+ * Read LPI state directly from MAC.
+ */
+#endif
+#ifndef EXTERNAL_RELEASE
+/*
+ * Implemented for Broadcom Orca PHY used in Carlsville.
+ * Refer to FVL DCR335 for details.
+ */
+#endif
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stat)
+{
+	enum i40e_status_code ret = I40E_SUCCESS;
+	u32 val;
+
+	stat->rx_lpi_status = 0;
+	stat->tx_lpi_status = 0;
+
+#ifdef CARLSVILLE_HW
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) {
+#ifndef EXTERNAL_RELEASE
+	/* For accessing LPI status in Broadcom PHY we're using AQ command only.
+	 * Broadcom PHY supports API >= 1.7, so there is no need for supporting
+	 * direct register access.
+	 */
+#endif
+		ret = i40e_aq_get_phy_register(hw,
+					       I40E_AQ_PHY_REG_ACCESS_EXTERNAL,
+					       I40E_BCM_PHY_PCS_STATUS1_PAGE,
+					       true,
+					       I40E_BCM_PHY_PCS_STATUS1_REG,
+					       &val, NULL);
+
+		if (ret != I40E_SUCCESS)
+			return ret;
+
+		stat->rx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_RX_LPI);
+		stat->tx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_TX_LPI);
+
+		return ret;
+	}
+
+#endif /* CARLSVILLE_HW */
+	val = rd32(hw, I40E_PRTPM_EEE_STAT);
+	stat->rx_lpi_status = (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
+	stat->tx_lpi_status = (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
+
+	return ret;
+}
 #endif /* PF_DRIVER */
 
 /**
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 406b902b3..4d1b007b8 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -74,6 +74,8 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
 
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stats);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 322300fa3..23adbbccd 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -2038,4 +2038,12 @@ struct i40e_profile_info {
 	u8 reserved[7];
 	u8 name[I40E_DDP_NAME_SIZE];
 };
+
+#ifdef CARLSVILLE_HW
+#define I40E_BCM_PHY_PCS_STATUS1_PAGE	0x3
+#define I40E_BCM_PHY_PCS_STATUS1_REG	0x0001
+#define I40E_BCM_PHY_PCS_STATUS1_RX_LPI	BIT(8)
+#define I40E_BCM_PHY_PCS_STATUS1_TX_LPI	BIT(9)
+#endif
+
 #endif /* _I40E_TYPE_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 21/69] net/i40e/base: change reading LPI state
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (19 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 20/69] net/i40e/base: read LPI status from external PHY Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 22/69] net/i40e/base: change for missing "link modes" Xiaolong Ye
                   ` (50 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Krzysztof Galazka

Special method of reading LPI state from BCM PHY has to
be used only when 2.5 or 5G speed is used. For other speeds
the state should be read from MAC register as on other devices.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed-by: Pietruszewski Piotr <piotr.pietruszewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Joyner Eric <eric.joyner@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 51ab0c4b8..02187da24 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7049,24 +7049,26 @@ enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
 
 #ifdef CARLSVILLE_HW
 /**
- * i40e_get_phy_lpi_status - read LPI status from external PHY or MAC
+ * i40e_get_phy_lpi_status - read LPI status from PHY or MAC register
  * @hw: pointer to the hw struct
  * @stat: pointer to structure with status of rx and tx lpi
  *
- * Read LPI state directly from external PHY or MAC, depending on device ID.
+ * Read LPI state directly from external PHY register or from MAC
+ * register, depending on device ID and current link speed.
  */
 #else
 /**
- * i40e_get_phy_lpi_status - read LPI status from MAC
+ * i40e_get_phy_lpi_status - read LPI status using MAC register
  * @hw: pointer to the hw struct
  * @stat: pointer to structure with status of rx and tx lpi
  *
- * Read LPI state directly from MAC.
+ * Read LPI state from MAC register.
  */
 #endif
 #ifndef EXTERNAL_RELEASE
 /*
  * Implemented for Broadcom Orca PHY used in Carlsville.
+ * It requires special handling when 2.5 or 5G speed is used.
  * Refer to FVL DCR335 for details.
  */
 #endif
@@ -7080,7 +7082,9 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 	stat->tx_lpi_status = 0;
 
 #ifdef CARLSVILLE_HW
-	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) {
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB ||
+	     hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) {
 #ifndef EXTERNAL_RELEASE
 	/* For accessing LPI status in Broadcom PHY we're using AQ command only.
 	 * Broadcom PHY supports API >= 1.7, so there is no need for supporting
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 22/69] net/i40e/base: change for missing "link modes"
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (20 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 21/69] net/i40e/base: change reading LPI state Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 23/69] net/i40e/base: add reading LPI counters Xiaolong Ye
                   ` (49 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Martyna Szapar

Fix for missing "Supported link modes" and "Advertised link modes"
info in ethtool after changed speed on X722 devices with BASE-T PHY
with FW API version >= 1.7.
The same FW API version on X710 and X722 does not mean the same
feature set so the change was needed as mac type of the device
should also be checked instead of FW API version only.

Signed-off-by: Martyna Szapar <martyna.szapar@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 02187da24..80921349a 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2022,8 +2022,7 @@ 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) {
+	if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) {
 		__le32 tmp;
 
 		i40e_memcpy(&tmp, resp->link_type, sizeof(tmp),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 23/69] net/i40e/base: add reading LPI counters
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (21 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 22/69] net/i40e/base: change for missing "link modes" Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 24/69] net/i40e/base: update virtchnl.h Xiaolong Ye
                   ` (48 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change introduces new function i40e_get_lpi_counters() reading
Low Power Idle (LPI) mode counters from Energy Efficient Ethernet (EEE)
statistics. Since reading EEE statistics requires running DNL script,
function i40e_aq_run_phy_activity() able to run it, was	implemented.

i40e_lpi_stat_update() was introduced as helper function for retrieving
LPI counters' values relative to given offsets.

This change also fixes order of fields in struct
i40e_aqc_run_phy_activity and introduces union in the struct
providing more descriptive names of fields depending on usage
(command or response).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  26 ++++--
 drivers/net/i40e/base/i40e_common.c     | 113 ++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  12 +++
 3 files changed, 145 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 9179bbe8f..7b4703449 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2276,15 +2276,29 @@ enum i40e_aq_phy_reg_type {
 	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
 };
 
+#pragma pack(1)
 /* Run PHY Activity (0x0626) */
 struct i40e_aqc_run_phy_activity {
-	__le16  activity_id;
-	u8      flags;
-	u8      reserved1;
-	__le32  control;
-	__le32  data;
-	u8      reserved2[4];
+	u8	cmd_flags;
+	__le16	activity_id;
+#define I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED	0x10
+	u8	reserved;
+	union {
+		struct {
+			__le32  dnl_opcode;
+#define I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS	0x801b
+			__le32  data;
+			u8	reserved2[4];
+		} cmd;
+		struct {
+			__le32	cmd_status;
+#define I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS		0x4
+			__le32	data0;
+			__le32	data1;
+		} resp;
+	} params;
 };
+#pragma pack()
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 80921349a..b03a6bef2 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7115,6 +7115,74 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 
 	return ret;
 }
+
+/**
+ * i40e_get_lpi_counters - read LPI counters from EEE statistics
+ * @hw: pointer to the hw struct
+ * @tx_counter: pointer to memory for TX LPI counter
+ * @rx_counter: pointer to memory for RX LPI counter
+ *
+ * Read Low Power Idle (LPI) mode counters from Energy Efficient
+ * Ethernet (EEE) statistics.
+ **/
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
+					    u32 *tx_counter, u32 *rx_counter)
+{
+	enum i40e_status_code retval;
+	u32 cmd_status;
+
+	retval = i40e_aq_run_phy_activity(hw,
+			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
+			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
+			&cmd_status, tx_counter, rx_counter, NULL);
+
+	if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
+		retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+
+	return retval;
+}
+
+/**
+ * i40e_lpi_stat_update - update LPI counters with values relative to offset
+ * @hw: pointer to the hw struct
+ * @offset_loaded: flag indicating need of writing current value to offset
+ * @tx_offset: pointer to offset of TX LPI counter
+ * @tx_stat: pointer to value of TX LPI counter
+ * @rx_offset: pointer to offset of RX LPI counter
+ * @rx_stat: pointer to value of RX LPI counter
+ *
+ * Update Low Power Idle (LPI) mode counters while having regard to passed
+ * offsets.
+ **/
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat)
+{
+	enum i40e_status_code retval;
+	u32 tx_counter, rx_counter;
+
+	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter);
+	if (retval)
+		goto err;
+
+	if (!offset_loaded) {
+		*tx_offset = tx_counter;
+		*rx_offset = rx_counter;
+	}
+
+	if (tx_counter >= *tx_offset)
+		*tx_stat = (u32)(tx_counter - *tx_offset);
+	else
+		*tx_stat = (u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+
+	if (rx_counter >= *rx_offset)
+		*rx_stat = (u32)(rx_counter - *rx_offset);
+	else
+		*rx_stat = (u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+err:
+	return retval;
+}
 #endif /* PF_DRIVER */
 
 /**
@@ -7378,6 +7446,51 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	return status;
 }
 
+/**
+ * i40e_aq_run_phy_activity
+ * @hw: pointer to the hw struct
+ * @activity_id: ID of DNL activity to run
+ * @dnl_opcode: opcode passed to DNL script
+ * @cmd_status: pointer to memory to write return value of DNL script
+ * @data0: pointer to memory for first 4 bytes of data returned by DNL script
+ * @data1: pointer to memory for last 4 bytes of data returned by DNL script
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Run DNL admin command.
+ **/
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 dnl_opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aqc_run_phy_activity *cmd;
+	enum i40e_status_code retval;
+	struct i40e_aq_desc desc;
+
+	cmd = (struct i40e_aqc_run_phy_activity *)&desc.params.raw;
+
+	if (!cmd_status || !data0 || !data1) {
+		retval = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_fill_default_direct_cmd_desc(&desc,
+					  i40e_aqc_opc_run_phy_activity);
+
+	cmd->activity_id = CPU_TO_LE16(activity_id);
+	cmd->params.cmd.dnl_opcode = CPU_TO_LE32(dnl_opcode);
+
+	retval = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+	if (retval)
+		goto err;
+
+	*cmd_status = LE32_TO_CPU(cmd->params.resp.cmd_status);
+	*data0 = LE32_TO_CPU(cmd->params.resp.data0);
+	*data1 = LE32_TO_CPU(cmd->params.resp.data1);
+err:
+	return retval;
+}
+
 #endif /* PF_DRIVER */
 #ifdef VF_DRIVER
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 4d1b007b8..eaaeb5eea 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -76,6 +76,12 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
+					    u32 *rx_counter);
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
@@ -563,6 +569,12 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 				u8 phy_select, u8 dev_addr, bool page_change,
 				u32 reg_addr, u32 *reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
+#ifdef PF_DRIVER
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details);
+#endif
 
 enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw,
 			struct i40e_aqc_arp_proxy_data *proxy_config,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 24/69] net/i40e/base: update virtchnl.h
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (22 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 23/69] net/i40e/base: add reading LPI counters Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 25/69] net/i40e/base: add opcodes reserved comments Xiaolong Ye
                   ` (47 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The major changes include:

* add virtchnl structures to support queue channels
* add eth_stats definition for OP_GET_STATS
* add filter data structure

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 162 ++++++++++++++++++++++++++++---
 1 file changed, 147 insertions(+), 15 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 88096cb45..0d7825089 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -120,16 +120,22 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,
 	VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,
 	VIRTCHNL_OP_REQUEST_QUEUES = 29,
+	VIRTCHNL_OP_ENABLE_CHANNELS = 30,
+	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
+	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
+	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
 
 };
 
-/* This macro is used to generate a compilation error if a structure
+/* This macro is used to generate a compilation error if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
- * structure is not of the correct size, otherwise it creates an enum that is
- * never used.
+ * structure/union is not of the correct size, otherwise it creates an enum
+ * that is never used.
  */
 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
 	{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}
+#define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \
+	{ virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }
 
 /* Virtual channel message descriptor. This overlays the admin queue
  * descriptor. All other data is passed in external buffers.
@@ -144,7 +150,7 @@ struct virtchnl_msg {
 
 VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
 
-/* Message descriptions and data structures.*/
+/* Message descriptions and data structures. */
 
 /* VIRTCHNL_OP_VERSION
  * VF posts its version number to the PF. PF responds with its version number
@@ -229,6 +235,9 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_ENCAP		0X00100000
 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM		0X00200000
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
+#define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
+/* Define below the capability flags that are not offloads */
+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED		0x00000080
 
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
 			       VIRTCHNL_VF_OFFLOAD_VLAN | \
@@ -457,8 +466,23 @@ VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_promisc_info);
  * the virtchnl_queue_select struct to specify the VSI. The queue_id
  * field is ignored by the PF.
  *
- * PF replies with struct eth_stats in an external buffer.
- */
+ * PF replies with struct virtchnl_eth_stats in an external buffer.
+ */
+
+struct virtchnl_eth_stats {
+	u64 rx_bytes;			/* received bytes */
+	u64 rx_unicast;			/* received unicast pkts */
+	u64 rx_multicast;		/* received multicast pkts */
+	u64 rx_broadcast;		/* received broadcast pkts */
+	u64 rx_discards;
+	u64 rx_unknown_protocol;
+	u64 tx_bytes;			/* transmitted bytes */
+	u64 tx_unicast;			/* transmitted unicast pkts */
+	u64 tx_multicast;		/* transmitted multicast pkts */
+	u64 tx_broadcast;		/* transmitted broadcast pkts */
+	u64 tx_discards;
+	u64 tx_errors;
+};
 
 /* VIRTCHNL_OP_CONFIG_RSS_KEY
  * VIRTCHNL_OP_CONFIG_RSS_LUT
@@ -498,6 +522,81 @@ struct virtchnl_rss_hena {
 
 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
 
+/* VIRTCHNL_OP_ENABLE_CHANNELS
+ * VIRTCHNL_OP_DISABLE_CHANNELS
+ * VF sends these messages to enable or disable channels based on
+ * the user specified queue count and queue offset for each traffic class.
+ * This struct encompasses all the information that the PF needs from
+ * VF to create a channel.
+ */
+struct virtchnl_channel_info {
+	u16 count; /* number of queues in a channel */
+	u16 offset; /* queues in a channel start from 'offset' */
+	u32 pad;
+	u64 max_tx_rate;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);
+
+struct virtchnl_tc_info {
+	u32	num_tc;
+	u32	pad;
+	struct	virtchnl_channel_info list[1];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
+
+/* VIRTCHNL_ADD_CLOUD_FILTER
+ * VIRTCHNL_DEL_CLOUD_FILTER
+ * VF sends these messages to add or delete a cloud filter based on the
+ * user specified match and action filters. These structures encompass
+ * all the information that the PF needs from the VF to add/delete a
+ * cloud filter.
+ */
+
+struct virtchnl_l4_spec {
+	u8	src_mac[ETH_ALEN];
+	u8	dst_mac[ETH_ALEN];
+	__be16	vlan_id;
+	__be16	pad; /* reserved for future use */
+	__be32	src_ip[4];
+	__be32	dst_ip[4];
+	__be16	src_port;
+	__be16	dst_port;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);
+
+union virtchnl_flow_spec {
+	struct	virtchnl_l4_spec tcp_spec;
+	u8	buffer[128]; /* reserved for future use */
+};
+
+VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);
+
+enum virtchnl_action {
+	/* action types */
+	VIRTCHNL_ACTION_DROP = 0,
+	VIRTCHNL_ACTION_TC_REDIRECT,
+};
+
+enum virtchnl_flow_type {
+	/* flow types */
+	VIRTCHNL_TCP_V4_FLOW = 0,
+	VIRTCHNL_TCP_V6_FLOW,
+};
+
+struct virtchnl_filter {
+	union	virtchnl_flow_spec data;
+	union	virtchnl_flow_spec mask;
+	enum	virtchnl_flow_type flow_type;
+	enum	virtchnl_action action;
+	u32	action_meta;
+	u8	field_flags;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
+
 /* VIRTCHNL_OP_EVENT
  * PF sends this message to inform the VF driver of events that may affect it.
  * No direct response is expected from the VF, though it may generate other
@@ -518,10 +617,23 @@ enum virtchnl_event_codes {
 struct virtchnl_pf_event {
 	enum virtchnl_event_codes event;
 	union {
+		/* If the PF driver does not support the new speed reporting
+		 * capabilities then use link_event else use link_event_adv to
+		 * get the speed and link information. The ability to understand
+		 * new speeds is indicated by setting the capability flag
+		 * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
+		 * in virtchnl_vf_resource struct and can be used to determine
+		 * which link event struct to use below.
+		 */
 		struct {
 			enum virtchnl_link_speed link_speed;
-			bool link_status;
+			u8 link_status;
 		} link_event;
+		struct {
+			/* link_speed provided in Mbps */
+			u32 link_speed;
+			u8 link_status;
+		} link_event_adv;
 	} event_data;
 
 	int severity;
@@ -542,14 +654,6 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
  * to a single vector.
  * PF configures interrupt mapping and returns status.
  */
-
-/* HW does not define a type value for AEQ; only for RX/TX and CEQ.
- * In order for us to keep the interface simple, SW will define a
- * unique type value for AEQ.
- */
-#define QUEUE_TYPE_PE_AEQ  0x80
-#define QUEUE_INVALID_IDX  0xFFFF
-
 struct virtchnl_iwarp_qv_info {
 	u32 v_idx; /* msix_vector */
 	u16 ceq_idx;
@@ -642,10 +746,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		}
 		break;
 	case VIRTCHNL_OP_ENABLE_QUEUES:
+		/* fall through */
 	case VIRTCHNL_OP_DISABLE_QUEUES:
 		valid_len = sizeof(struct virtchnl_queue_select);
 		break;
 	case VIRTCHNL_OP_ADD_ETH_ADDR:
+		/* fall through */
 	case VIRTCHNL_OP_DEL_ETH_ADDR:
 		valid_len = sizeof(struct virtchnl_ether_addr_list);
 		if (msglen >= valid_len) {
@@ -658,6 +764,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		}
 		break;
 	case VIRTCHNL_OP_ADD_VLAN:
+		/* fall through */
 	case VIRTCHNL_OP_DEL_VLAN:
 		valid_len = sizeof(struct virtchnl_vlan_filter_list);
 		if (msglen >= valid_len) {
@@ -723,14 +830,39 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		valid_len = sizeof(struct virtchnl_rss_hena);
 		break;
 	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
+		/* fall through */
 	case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
 		break;
 	case VIRTCHNL_OP_REQUEST_QUEUES:
 		valid_len = sizeof(struct virtchnl_vf_res_request);
 		break;
+	case VIRTCHNL_OP_ENABLE_CHANNELS:
+		valid_len = sizeof(struct virtchnl_tc_info);
+		if (msglen >= valid_len) {
+			struct virtchnl_tc_info *vti =
+				(struct virtchnl_tc_info *)msg;
+			valid_len += (vti->num_tc - 1) *
+				     sizeof(struct virtchnl_channel_info);
+			if (vti->num_tc == 0)
+				err_msg_format = true;
+		}
+		break;
+	case VIRTCHNL_OP_DISABLE_CHANNELS:
+		break;
+	case VIRTCHNL_OP_ADD_CLOUD_FILTER:
+		/* fall through */
+	case VIRTCHNL_OP_DEL_CLOUD_FILTER:
+		valid_len = sizeof(struct virtchnl_filter);
+		break;
+#ifdef VIRTCHNL_SOL_VF_SUPPORT
+	case VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG:
+		break;
+#endif
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL_OP_EVENT:
+		/* fall through */
 	case VIRTCHNL_OP_UNKNOWN:
+		/* fall through */
 	default:
 		return VIRTCHNL_ERR_PARAM;
 	}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 25/69] net/i40e/base: add opcodes reserved comments
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (23 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 24/69] net/i40e/base: update virtchnl.h Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 26/69] net/i40e/base: revert Fix missing "fall through" comments Xiaolong Ye
                   ` (46 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacob Keller

When there are opcodes wrapped behind feature flags, we should indicate
that the opcode number is reserved if the define is not set. This helps
ensure that we do not attempt to re-use an opcode number in multiple
ways, as this could break PF and VF matches.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Stillwell Jr Paul M <paul.m.stillwell.jr@intel.com>
Reviewed-by: Williams Mitch A <mitch.a.williams@intel.com>
Reviewed-by: Brandeburg Jesse <jesse.brandeburg@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 0d7825089..d0d612571 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -107,11 +107,15 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
 #ifdef VIRTCHNL_SOL_VF_SUPPORT
 	VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG = 19,
+#else
+	/* opcode 19 is reserved */
 #endif
 #ifdef VIRTCHNL_IWARP
 	VIRTCHNL_OP_IWARP = 20, /* advanced opcode */
 	VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, /* advanced opcode */
 	VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, /* advanced opcode */
+#else
+	/* opcodes 20, 21, and 22 are reserved */
 #endif
 	VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
 	VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 26/69] net/i40e/base: revert Fix missing "fall through" comments
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (24 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 25/69] net/i40e/base: add opcodes reserved comments Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 27/69] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
                   ` (45 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Alice Michael

These fall throughs are not needed by the compiler and
are more distracting.  The fall through comment is
needed when there is a block of code in a switch statement
and then falls through to the next case.  It is not
needed if it's just a case and automatically falls through
on the next line.

By reverting this patch we also line up the file with the
upstream version.

Signed-off-by: Alice Michael <alice.michael@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index d0d612571..6ca01fa05 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -750,12 +750,10 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		}
 		break;
 	case VIRTCHNL_OP_ENABLE_QUEUES:
-		/* fall through */
 	case VIRTCHNL_OP_DISABLE_QUEUES:
 		valid_len = sizeof(struct virtchnl_queue_select);
 		break;
 	case VIRTCHNL_OP_ADD_ETH_ADDR:
-		/* fall through */
 	case VIRTCHNL_OP_DEL_ETH_ADDR:
 		valid_len = sizeof(struct virtchnl_ether_addr_list);
 		if (msglen >= valid_len) {
@@ -768,7 +766,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		}
 		break;
 	case VIRTCHNL_OP_ADD_VLAN:
-		/* fall through */
 	case VIRTCHNL_OP_DEL_VLAN:
 		valid_len = sizeof(struct virtchnl_vlan_filter_list);
 		if (msglen >= valid_len) {
@@ -834,7 +831,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		valid_len = sizeof(struct virtchnl_rss_hena);
 		break;
 	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
-		/* fall through */
 	case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
 		break;
 	case VIRTCHNL_OP_REQUEST_QUEUES:
@@ -854,7 +850,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_DISABLE_CHANNELS:
 		break;
 	case VIRTCHNL_OP_ADD_CLOUD_FILTER:
-		/* fall through */
 	case VIRTCHNL_OP_DEL_CLOUD_FILTER:
 		valid_len = sizeof(struct virtchnl_filter);
 		break;
@@ -864,9 +859,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 #endif
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL_OP_EVENT:
-		/* fall through */
 	case VIRTCHNL_OP_UNKNOWN:
-		/* fall through */
 	default:
 		return VIRTCHNL_ERR_PARAM;
 	}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 27/69] net/i40e/base: backport style changes from upstream Linux
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (25 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 26/69] net/i40e/base: revert Fix missing "fall through" comments Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 28/69] net/i40e/base: update status codes Xiaolong Ye
                   ` (44 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacob Keller

The upstream virtchnl.h has a few minor style differences to what is
out-of-tree, and there is no real reason we should prefer the current
style over whats upstream.

Fix the VIRTCHNL_CHECK_STRUCT_LEN macro whitespace, and fix the comment
about "this macro is" to be "these macros are".

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 6ca01fa05..5975ff962 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -131,13 +131,13 @@ enum virtchnl_ops {
 
 };
 
-/* This macro is used to generate a compilation error if a structure/union
+/* These macros are used to generate compilation errors if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
  * structure/union is not of the correct size, otherwise it creates an enum
  * that is never used.
  */
 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
-	{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}
+	{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
 #define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \
 	{ virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 28/69] net/i40e/base: update status codes
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (26 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 27/69] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 29/69] net/i40e/base: use TX_LPI_EN bit to fully turn off EEE Xiaolong Ye
                   ` (43 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Mitch Williams

Add a few new status codes as needed by the ice driver, and rename a few
to make them more consistent. Error code are mapped to similar values as
in i40e_status.h, so as to be compatible with older VF drivers not using
this status enum.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Reviewed-by: Keller Jacob E <jacob.e.keller@intel.com>
Reviewed-by: Aggarwal Mitu <mitu.aggarwal@intel.com>
Reviewed-by: Yang Lihong <lihong.yang@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 5975ff962..f659fbcab 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -40,13 +40,19 @@
 /* Error Codes */
 enum virtchnl_status_code {
 	VIRTCHNL_STATUS_SUCCESS				= 0,
-	VIRTCHNL_ERR_PARAM				= -5,
+	VIRTCHNL_STATUS_ERR_PARAM			= -5,
+	VIRTCHNL_STATUS_ERR_NO_MEMORY			= -18,
 	VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH		= -38,
 	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
 	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
-	VIRTCHNL_STATUS_NOT_SUPPORTED			= -64,
+	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
+	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
 };
 
+/* Backward compatibility */
+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
+
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
@@ -861,7 +867,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_EVENT:
 	case VIRTCHNL_OP_UNKNOWN:
 	default:
-		return VIRTCHNL_ERR_PARAM;
+		return VIRTCHNL_STATUS_ERR_PARAM;
 	}
 	/* few more checks */
 	if (err_msg_format || valid_len != msglen)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 29/69] net/i40e/base: use TX_LPI_EN bit to fully turn off EEE
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (27 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 28/69] net/i40e/base: update status codes Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 30/69] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
                   ` (42 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Krzysztof Galazka

Changing advertised EEE capabilities using 'Set PHY Config'
admin queue command does not switch off the EEE completely.
TX_LPI_EN bit in EEER has to be also cleared.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Joyner Eric <eric.joyner@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index b03a6bef2..d080e9340 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7329,7 +7329,13 @@ enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable)
 			    I40E_AQ_PHY_FEC_CONFIG_MASK;
 
 	/* Set desired EEE state */
-	config.eee_capability = enable ? eee_capability : 0;
+	if (enable) {
+		config.eee_capability = eee_capability;
+		config.eeer |= I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	} else {
+		config.eee_capability = 0;
+		config.eeer &= ~I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	}
 
 	/* Save modified config */
 	status = i40e_aq_set_phy_config(hw, &config, NULL);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 30/69] net/i40e/base: change of the incorrect Tx descriptors number
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (28 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 29/69] net/i40e/base: use TX_LPI_EN bit to fully turn off EEE Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 31/69] net/i40e/base: extend PHY access AQ command Xiaolong Ye
                   ` (41 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Dariusz Chaberski

The existing driver allows setting the number of TX descriptors
to the value that is indivisible by 32. This is not properly
supported by x710 hardware. The patch limits the number of TX
descriptors to the whole value of 32.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Dariusz Chaberski <dariuszx.chaberski@intel.com>
Reviewed-by: Jacek Lisinski <jacekx.lisinski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 23adbbccd..6a3cf52a2 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -79,8 +79,8 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
 #define I40E_HI_BYTE(x)		((u8)(((x) >> 8) & 0xFF))
 #define I40E_LO_BYTE(x)		((u8)((x) & 0xFF))
 
-/* Number of Transmit Descriptors must be a multiple of 8. */
-#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	8
+/* Number of Transmit Descriptors must be a multiple of 32. */
+#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	32
 /* Number of Receive Descriptors must be a multiple of 32 if
  * the number of descriptors is greater than 32.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 31/69] net/i40e/base: extend PHY access AQ command
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (29 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 30/69] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 32/69] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
                   ` (40 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

Currently FW use MDIO I/F number corresponded with current PF for PHY
access. This code allow to specify used MDIO I/F number.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  5 +++
 drivers/net/i40e/base/i40e_adminq_cmd.h |  6 ++-
 drivers/net/i40e/base/i40e_common.c     | 60 ++++++++++++++++++++-----
 drivers/net/i40e/base/i40e_prototype.h  | 27 +++++++----
 drivers/net/i40e/base/i40e_type.h       |  1 +
 5 files changed, 80 insertions(+), 19 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 2cb81ed80..371a04d53 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -693,6 +693,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	     aq->api_min_ver >= 8))
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
 
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 9))
+		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED;
+
 	if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7b4703449..79762d528 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2311,7 +2311,11 @@ struct i40e_aqc_phy_register_access {
 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE	2
 	u8	dev_addres;
 	u8	cmd_flags;
-#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	1
+#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	0x01
+#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER	0x02
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT	2
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK	(0x3 << \
+		I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT)
 	u8	reserved1;
 	__le32	reg_address;
 	__le32	reg_value;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d080e9340..75bb9148b 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7376,21 +7376,51 @@ void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val)
 
 #ifdef PF_DRIVER
 /**
- * i40e_aq_set_phy_register
+ * i40e_mdio_if_number_selection - MDIO I/F number selection
+ * @hw: pointer to the hw struct
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
+ * @cmd: pointer to PHY Register command structure
+ **/
+static void
+i40e_mdio_if_number_selection(struct i40e_hw *hw, bool set_mdio, u8 mdio_num,
+			      struct i40e_aqc_phy_register_access *cmd)
+{
+	if (set_mdio && cmd->phy_interface == I40E_AQ_PHY_REG_ACCESS_EXTERNAL) {
+		if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED)
+			cmd->cmd_flags |=
+				I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER |
+				((mdio_num <<
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) &
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK);
+		else
+			i40e_debug(hw, I40E_DEBUG_PHY,
+				   "MDIO I/F number selection not supported by current FW version.\n");
+	}
+}
+
+/**
+ * i40e_aq_set_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: new register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Write the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_set_phy_register.
  **/
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7408,27 +7438,35 @@ enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
 }
 
 /**
- * i40e_aq_get_phy_register
+ * i40e_aq_get_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: read register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Read the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_get_phy_register.
  **/
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7445,6 +7483,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 	if (!status)
 		*reg_val = LE32_TO_CPU(cmd->reg_value);
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index eaaeb5eea..043bfd984 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -561,14 +561,25 @@ enum i40e_status_code i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
 				u32 reg_addr, u32 reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+
+/* Convenience wrappers for most common use case */
+#define i40e_aq_set_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_set_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+#define i40e_aq_get_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_get_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+
 #ifdef PF_DRIVER
 enum i40e_status_code
 i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 6a3cf52a2..673469929 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -743,6 +743,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
+#define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 32/69] net/i40e/base: add drop mode parameter to set MAC config
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (30 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 31/69] net/i40e/base: extend PHY access AQ command Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 33/69] net/i40e/base: check_recovery_mode had wrong if statement Xiaolong Ye
                   ` (39 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Wnuczko Sylwia

This patch adds "drop mode" parameter to set mac config AQ command.
This bit controls the behavior when a no-drop packet is blocking a TC
queue.
0 – The PF driver is notified.
1 – The blocking packet is dropped and then the PF driver is notified.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Reviewed-by: Azarewicz Piotr <piotr.azarewicz@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  4 +++-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 29 +++++++++++++------------
 drivers/net/i40e/base/i40e_common.c     | 11 ++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  1 +
 drivers/net/i40e/base/i40e_type.h       |  1 +
 drivers/net/i40e/i40e_ethdev.c          |  2 +-
 6 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 371a04d53..64b3b50b5 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -690,8 +690,10 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
-	     aq->api_min_ver >= 8))
+	     aq->api_min_ver >= 8)) {
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+		hw->flags |= I40E_HW_FLAG_DROP_MODE;
+	}
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 79762d528..1b84ba9c3 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2102,20 +2102,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
 struct i40e_aq_set_mac_config {
 	__le16	max_frame_size;
 	u8	params;
-#define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
-#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
-#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
-#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
-#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
-#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
+#define I40E_AQ_SET_MAC_CONFIG_CRC_EN			0x04
+#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK		0x78
+#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT		3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE		0x0
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX		0xF
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX		0x9
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX		0x8
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX		0x7
+#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX		0x6
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX		0x5
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX		0x4
+#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX		0x3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX		0x2
+#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX		0x1
+#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN	0x80
 	u8	tx_timer_priority; /* bitmap */
 	__le16	tx_timer_value;
 	__le16	fc_refresh_threshold;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 75bb9148b..b9bc11837 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1852,6 +1852,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
  * @max_frame_size: Maximum Frame Size to be supported by the port
  * @crc_en: Tell HW to append a CRC to outgoing frames
  * @pacing: Pacing configurations
+ * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked
  * @cmd_details: pointer to command details structure or NULL
  *
  * Configure MAC settings for frame size, jumbo frame support and the
@@ -1860,6 +1861,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size,
 				bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -1878,6 +1880,15 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 	if (crc_en)
 		cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN;
 
+	if (auto_drop_blocking_packets) {
+		if (hw->flags & I40E_HW_FLAG_DROP_MODE)
+			cmd->params |=
+				I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "This FW api version does not support drop mode.\n");
+	}
+
 #define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD	0x7FFF
 	cmd->fc_refresh_threshold =
 		CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD);
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 043bfd984..b01dff439 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -114,6 +114,7 @@ enum i40e_status_code i40e_aq_set_phy_int_mask(struct i40e_hw *hw, u16 mask,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size, bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_local_advt_reg(struct i40e_hw *hw,
 				u64 *advt_reg,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 673469929..3ac1cf6e1 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -744,6 +744,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
+#define I40E_HW_FLAG_DROP_MODE		    BIT_ULL(7)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 208a9a112..4d06788de 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1649,7 +1649,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* Set the max frame size to 0x2600 by default,
 	 * in case other drivers changed the default value.
 	 */
-	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, 0, NULL);
+	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, 0, false, NULL);
 
 	/* initialize mirror rule list */
 	TAILQ_INIT(&pf->mirror_list);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 33/69] net/i40e/base: check_recovery_mode had wrong if statement
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (31 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 32/69] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
@ 2019-12-02  7:48 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 34/69] net/i40e/base: update FVL FW API version to 1.9 Xiaolong Ye
                   ` (38 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:48 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Adrian Podlawski

Function check_recovery_mode had wrong if statement. Now we check proper
FWS1B register values, which are responsible for the recovery mode.
Recovery mode has 4 values for FVL and 2 for FPK. That's why we need 6
different flags which are defined in shared code. Now in if statement
we recognize type of mac and register value. Without those changes
driver could show wrong state.

Signed-off-by: Adrian Podlawski <adrian.podlawski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index e93ec3f58..6804aba51 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,18 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK \
+				I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK \
+				I40E_MASK(0x33, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0xB, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0xC, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_GLGEN_CLKSTAT                    0x000B8184 /* Reset: POR */
 #define I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT      0
 #define I40E_GLGEN_CLKSTAT_CLKMODE_MASK       I40E_MASK(0x1, I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 34/69] net/i40e/base: update FVL FW API version to 1.9
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (32 preceding siblings ...)
  2019-12-02  7:48 ` [dpdk-dev] [PATCH 33/69] net/i40e/base: check_recovery_mode had wrong if statement Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK " Xiaolong Ye
                   ` (37 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

Upcoming FVL FW increment API version to 1.9 due to Extend PHY access AQ
command support. SW is ready for that support as well.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 1b84ba9c3..7fd39b82e 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -13,7 +13,7 @@
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
 #define I40E_FW_API_VERSION_MINOR_X722	0x0008
-#define I40E_FW_API_VERSION_MINOR_X710	0x0008
+#define I40E_FW_API_VERSION_MINOR_X710	0x0009
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK FW API version to 1.9
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (33 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 34/69] net/i40e/base: update FVL FW API version to 1.9 Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02 19:03   ` Stillwell Jr, Paul M
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 36/69] net/i40e/base: add persistent lldp support Xiaolong Ye
                   ` (36 subsequent siblings)
  71 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

Upcoming FPK FW increment API version to 1.9, so we must bump up version
number as well.
FPK will support PHY access AQ command as FVL does.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7fd39b82e..2d1efef69 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -12,7 +12,7 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0008
+#define I40E_FW_API_VERSION_MINOR_X722	0x0009
 #define I40E_FW_API_VERSION_MINOR_X710	0x0009
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 36/69] net/i40e/base: add persistent lldp support
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (34 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK " Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 37/69] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
                   ` (35 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Wnuczko Sylwia

This patch adds a function to read nvm module data and uses it to
read current lldp agent configuration from nvm api version 1.8.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c       | 18 ++++++-
 drivers/net/i40e/base/i40e_dcb.h       |  2 +
 drivers/net/i40e/base/i40e_nvm.c       | 71 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  4 ++
 4 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 96d2f05df..38a1284c9 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -877,7 +877,23 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
-	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
+		u8 offset = 0;
+
+		if (hw->mac.type == I40E_MAC_XL710)
+			offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;
+		else if (hw->mac.type == I40E_MAC_X722)
+			offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
+		else
+			return I40E_NOT_SUPPORTED;
+
+		ret = i40e_read_nvm_module_data(hw,
+						I40E_SR_EMP_SR_SETTINGS_PTR,
+						offset, 1,
+						&lldp_cfg.adminstatus);
+	} else {
+		ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	}
 	if (ret)
 		return I40E_ERR_NOT_READY;
 
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 6805bc8fb..f33507081 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -39,6 +39,8 @@
 #define I40E_LLDP_ADMINSTATUS_ENABLED_TX	2
 #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX	3
 
+#define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET  0x2B
+#define I40E_LLDP_CURRENT_STATUS_X722_OFFSET   0x31
 /* Defines for LLDP TLV header */
 #define I40E_LLDP_MIB_HLEN		14
 #define I40E_LLDP_TLV_LEN_SHIFT		0
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index c8b401cdd..6a55d59b4 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -337,6 +337,77 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 	return ret_code;
 }
 
+/**
+ * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location
+ * @hw: pointer to the HW structure
+ * @module_ptr: Pointer to module in words with respect to NVM beginning
+ * @offset: offset in words from module start
+ * @words_data_size: Words to read from NVM
+ * @data_ptr: Pointer to memory location where resulting buffer will be stored
+ **/
+enum i40e_status_code i40e_read_nvm_module_data(struct i40e_hw *hw,
+						u8 module_ptr, u16 offset,
+						u16 words_data_size,
+						u16 *data_ptr)
+{
+	enum i40e_status_code status;
+	u16 ptr_value = 0;
+	u32 flat_offset;
+
+	if (module_ptr != 0) {
+		status = i40e_read_nvm_word(hw, module_ptr, &ptr_value);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+	}
+#define I40E_NVM_INVALID_PTR_VAL 0x7FFF
+#define I40E_NVM_INVALID_VAL 0xFFFF
+
+	/* Pointer not initialized */
+	if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
+	    ptr_value == I40E_NVM_INVALID_VAL)
+		return I40E_ERR_BAD_PTR;
+
+	/* Check whether the module is in SR mapped area or outside */
+	if (ptr_value & I40E_PTR_TYPE) {
+		/* Pointer points outside of the Shared RAM mapped area */
+		ptr_value &= ~I40E_PTR_TYPE;
+
+		/* PtrValue in 4kB units, need to convert to words */
+		ptr_value /= 2;
+		flat_offset = ((u32)ptr_value * 0x1000) + (u32)offset;
+		status = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+		if (status == I40E_SUCCESS) {
+			status = i40e_aq_read_nvm(hw, 0, 2 * flat_offset,
+						  2 * words_data_size,
+						  data_ptr, true, NULL);
+			i40e_release_nvm(hw);
+			if (status != I40E_SUCCESS) {
+				i40e_debug(hw, I40E_DEBUG_ALL,
+					   "Reading nvm aq failed.Error code: %d.\n",
+					   status);
+				return I40E_ERR_NVM;
+			}
+		} else {
+			return I40E_ERR_NVM;
+		}
+	} else {
+		/* Read from the Shadow RAM */
+		status = i40e_read_nvm_buffer(hw, ptr_value + offset,
+					      &words_data_size, data_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm buffer failed.Error code: %d.\n",
+				   status);
+		}
+	}
+
+	return status;
+}
+
 /**
  * i40e_read_nvm_buffer_srctl - Reads Shadow RAM buffer via SRCTL register
  * @hw: pointer to the HW structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index b01dff439..a85c00b3b 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -456,6 +456,10 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,
 void i40e_release_nvm(struct i40e_hw *hw);
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 					 u16 *data);
+enum i40e_status_code i40e_read_nvm_module_data(struct i40e_hw *hw,
+					       u8 module_ptr, u16 offset,
+					       u16 words_data_size,
+					       u16 *data_ptr);
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
 					   u16 *words, u16 *data);
 enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 37/69] net/i40e/base: make i40e_set_mac_type() public
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (35 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 36/69] net/i40e/base: add persistent lldp support Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 38/69] net/i40e/base: change retrying Xiaolong Ye
                   ` (34 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Kwapulinski

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type()
to be public. It is required for recovery mode handling. Without this patch
recovery mode could not be detected at probe() function.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index b9bc11837..9c2ec3bcb 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#else
-STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#endif
 {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index a85c00b3b..0ccd573f2 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -486,10 +486,8 @@ void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
 
-#if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 38/69] net/i40e/base: change retrying
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (36 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 37/69] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 39/69] net/i40e/base: revert fix for X722 10G-T ports LED Xiaolong Ye
                   ` (33 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Marcin Formela

Fixed a bug where driver was breaking out of the loop and
reporting an error without retrying first.

Signed-off-by: Marcin Formela <marcin.formela@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9c2ec3bcb..8a0daf1e2 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1693,19 +1693,22 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
 		status = i40e_asq_send_command(hw, &desc, abilities,
 					       abilities_size, cmd_details);
 
-		if (status != I40E_SUCCESS)
-			break;
-
-		if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) {
+		switch (hw->aq.asq_last_status) {
+		case I40E_AQ_RC_EIO:
 			status = I40E_ERR_UNKNOWN_PHY;
 			break;
-		} else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) {
+		case I40E_AQ_RC_EAGAIN:
 			i40e_msec_delay(1);
 			total_delay++;
 			status = I40E_ERR_TIMEOUT;
+			break;
+		/* also covers I40E_AQ_RC_OK */
+		default:
+			break;
 		}
-	} while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) &&
-		 (total_delay < max_delay));
+
+	} while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) &&
+		(total_delay < max_delay));
 
 	if (status != I40E_SUCCESS)
 		return status;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 39/69] net/i40e/base: revert fix for X722 10G-T ports LED
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (37 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 38/69] net/i40e/base: change retrying Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 40/69] net/i40e/base: change link flapping on 25g cards Xiaolong Ye
                   ` (32 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Alice Michael

After 6 months PRE-BOOT found that it interferes with their way
of using LEDs. It would be the least painful to revert this
commit to make PRE-BOOT happy and write new code not touching
theirs.

Signed-off-by: Alice Michael <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 35 +++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8a0daf1e2..4d2d86196 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1592,6 +1592,7 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
  **/
 u32 i40e_led_get(struct i40e_hw *hw)
 {
+	u32 current_mode = 0;
 	u32 mode = 0;
 	int i;
 
@@ -1603,10 +1604,27 @@ u32 i40e_led_get(struct i40e_hw *hw)
 
 		if (!gpio_val)
 			continue;
+
+		/* ignore gpio LED src mode entries related to the activity
+		 *  LEDs
+		 */
+		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
+				>> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+		switch (current_mode) {
+		case I40E_COMBINED_ACTIVITY:
+		case I40E_FILTER_ACTIVITY:
+		case I40E_MAC_ACTIVITY:
+		case I40E_LINK_ACTIVITY:
+			continue;
+		default:
+			break;
+		}
+
 		mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
 			I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT;
 		break;
 	}
+
 	return mode;
 }
 
@@ -1621,6 +1639,7 @@ u32 i40e_led_get(struct i40e_hw *hw)
  **/
 void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 {
+	u32 current_mode = 0;
 	int i;
 
 	if (mode & 0xfffffff0)
@@ -1634,6 +1653,22 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 
 		if (!gpio_val)
 			continue;
+
+		/* ignore gpio LED src mode entries related to the activity
+		 * LEDs
+		 */
+		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
+				>> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+		switch (current_mode) {
+		case I40E_COMBINED_ACTIVITY:
+		case I40E_FILTER_ACTIVITY:
+		case I40E_MAC_ACTIVITY:
+		case I40E_LINK_ACTIVITY:
+			continue;
+		default:
+			break;
+		}
+
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 40/69] net/i40e/base: change link flapping on 25g cards
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (38 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 39/69] net/i40e/base: revert fix for X722 10G-T ports LED Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW Xiaolong Ye
                   ` (31 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Aleksandr Loktionov

After NVM update on some 25g cards link start periodically flap.
The issue was fixed by adding additional check into
i40e_get_lpi_counters() which calls i40e_aq_run_phy_activity()
only for EEE capable cards.

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4d2d86196..337d62b5f 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7176,6 +7176,15 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	enum i40e_status_code retval;
 	u32 cmd_status;
 
+	/* only X710-T*L requires special handling of counters
+	 * for other devices we just read the MAC registers
+	 */
+	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC) {
+		*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+		*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+		return I40E_SUCCESS;
+	}
+
 	retval = i40e_aq_run_phy_activity(hw,
 			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
 			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (39 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 40/69] net/i40e/base: change link flapping on 25g cards Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 42/69] net/i40e/base: change long redundant define names Xiaolong Ye
                   ` (30 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jeff Kirsher

As pointed out by Arkadiusz, the code is not wrapped properly and if
CARLSVILLE_HW is not defined the code will not compile.  In addition,
noticed that the we were taking the if condition majority of the time so
flip the condition to only test for the device that requires the
workaround when updating stats.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 337d62b5f..cedec4dce 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7173,27 +7173,30 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 					    u32 *tx_counter, u32 *rx_counter)
 {
-	enum i40e_status_code retval;
-	u32 cmd_status;
-
+#ifdef CARLSVILLE_HW
 	/* only X710-T*L requires special handling of counters
 	 * for other devices we just read the MAC registers
 	 */
-	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC) {
-		*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
-		*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
-		return I40E_SUCCESS;
-	}
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) {
+		enum i40e_status_code retval;
+		u32 cmd_status;
 
-	retval = i40e_aq_run_phy_activity(hw,
+		retval = i40e_aq_run_phy_activity(hw,
 			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
 			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
 			&cmd_status, tx_counter, rx_counter, NULL);
 
-	if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
-		retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+		if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
+			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
 
-	return retval;
+		return retval;
+	}
+
+#endif /* CARLSVILLE_HW */
+	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+
+	return I40E_SUCCESS;
 }
 
 /**
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 42/69] net/i40e/base: change long redundant define names
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (40 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 43/69] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
                   ` (29 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jeff Kirsher

There is no need to create define names that are practically a full
sentence.  If you want to describe in detail what the define is for, you
a code comment.  Define name can be abbreviated and should not contain
verbs or "actions", so abbreviate as much as possible.

These defines that were abbreviated could potentially get even shorter,
but not without adequate code comments.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 6 +++---
 drivers/net/i40e/base/i40e_common.c     | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2d1efef69..d5548792f 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2282,18 +2282,18 @@ enum i40e_aq_phy_reg_type {
 struct i40e_aqc_run_phy_activity {
 	u8	cmd_flags;
 	__le16	activity_id;
-#define I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED	0x10
+#define I40E_AQ_RUN_PHY_ACT_ID_USR_DFND			0x10
 	u8	reserved;
 	union {
 		struct {
 			__le32  dnl_opcode;
-#define I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
 			__le32  data;
 			u8	reserved2[4];
 		} cmd;
 		struct {
 			__le32	cmd_status;
-#define I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
 			__le32	data0;
 			__le32	data1;
 		} resp;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index cedec4dce..91aa0f587 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7182,11 +7182,11 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 		u32 cmd_status;
 
 		retval = i40e_aq_run_phy_activity(hw,
-			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
-			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
-			&cmd_status, tx_counter, rx_counter, NULL);
+				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
+				&cmd_status, tx_counter, rx_counter, NULL);
 
-		if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
 			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
 
 		return retval;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 43/69] net/i40e/base: mark additional missing bits as reserved
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (41 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 42/69] net/i40e/base: change long redundant define names Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 44/69] net/i40e/base: change for persistent lldp support Xiaolong Ye
                   ` (28 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacob Keller

Mark bits 0xD through 0xF for the command flags of a cloud filter as
reserved. These bits are not yet defined and are considered as reserved
in the data sheet.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index d5548792f..5f36a61a7 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1402,6 +1402,9 @@ struct i40e_aqc_cloud_filters_element_data {
 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
 #define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C
+/* 0x000D reserved */
+/* 0x000E reserved */
+/* 0x000F reserved */
 /* 0x0010 to 0x0017 is for custom filters */
 #define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT		0x0010 /* Dest IP + L4 Port */
 #define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT		0x0011 /* Dest MAC + L4 Port */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 44/69] net/i40e/base: change for persistent lldp support
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (42 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 43/69] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 45/69] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
                   ` (27 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Wnuczko Sylwia

This patch fixes function to read nvm module data and uses it to
read current lldp agent configuration from nvm api version 1.8.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c       |  4 +-
 drivers/net/i40e/base/i40e_dcb.h       |  3 ++
 drivers/net/i40e/base/i40e_nvm.c       | 58 +++++++++++++-------------
 drivers/net/i40e/base/i40e_prototype.h |  8 ++--
 4 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 38a1284c9..ac3d3f3f7 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -889,7 +889,9 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 
 		ret = i40e_read_nvm_module_data(hw,
 						I40E_SR_EMP_SR_SETTINGS_PTR,
-						offset, 1,
+						offset,
+						I40E_LLDP_CURRENT_STATUS_OFFSET,
+						I40E_LLDP_CURRENT_STATUS_SIZE,
 						&lldp_cfg.adminstatus);
 	} else {
 		ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index f33507081..12fe95c79 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -41,6 +41,9 @@
 
 #define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET  0x2B
 #define I40E_LLDP_CURRENT_STATUS_X722_OFFSET   0x31
+#define I40E_LLDP_CURRENT_STATUS_OFFSET                1
+#define I40E_LLDP_CURRENT_STATUS_SIZE          1
+
 /* Defines for LLDP TLV header */
 #define I40E_LLDP_MIB_HLEN		14
 #define I40E_LLDP_TLV_LEN_SHIFT		0
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 6a55d59b4..fc24cc2ce 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -339,20 +339,21 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 
 /**
  * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location
- * @hw: pointer to the HW structure
+ * @hw: Pointer to the HW structure
  * @module_ptr: Pointer to module in words with respect to NVM beginning
- * @offset: offset in words from module start
+ * @module_offset: Offset in words from module start
+ * @data_offset: Offset in words from reading data area start
  * @words_data_size: Words to read from NVM
  * @data_ptr: Pointer to memory location where resulting buffer will be stored
  **/
-enum i40e_status_code i40e_read_nvm_module_data(struct i40e_hw *hw,
-						u8 module_ptr, u16 offset,
-						u16 words_data_size,
-						u16 *data_ptr)
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr)
 {
 	enum i40e_status_code status;
+	u16 specific_ptr = 0;
 	u16 ptr_value = 0;
-	u32 flat_offset;
+	u16 offset = 0;
 
 	if (module_ptr != 0) {
 		status = i40e_read_nvm_word(hw, module_ptr, &ptr_value);
@@ -368,36 +369,35 @@ enum i40e_status_code i40e_read_nvm_module_data(struct i40e_hw *hw,
 
 	/* Pointer not initialized */
 	if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
-	    ptr_value == I40E_NVM_INVALID_VAL)
+	    ptr_value == I40E_NVM_INVALID_VAL) {
+		i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n");
 		return I40E_ERR_BAD_PTR;
+	}
 
 	/* Check whether the module is in SR mapped area or outside */
 	if (ptr_value & I40E_PTR_TYPE) {
 		/* Pointer points outside of the Shared RAM mapped area */
-		ptr_value &= ~I40E_PTR_TYPE;
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n");
 
-		/* PtrValue in 4kB units, need to convert to words */
-		ptr_value /= 2;
-		flat_offset = ((u32)ptr_value * 0x1000) + (u32)offset;
-		status = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
-		if (status == I40E_SUCCESS) {
-			status = i40e_aq_read_nvm(hw, 0, 2 * flat_offset,
-						  2 * words_data_size,
-						  data_ptr, true, NULL);
-			i40e_release_nvm(hw);
-			if (status != I40E_SUCCESS) {
-				i40e_debug(hw, I40E_DEBUG_ALL,
-					   "Reading nvm aq failed.Error code: %d.\n",
-					   status);
-				return I40E_ERR_NVM;
-			}
-		} else {
-			return I40E_ERR_NVM;
-		}
+		return I40E_ERR_PARAM;
 	} else {
 		/* Read from the Shadow RAM */
-		status = i40e_read_nvm_buffer(hw, ptr_value + offset,
-					      &words_data_size, data_ptr);
+
+		status = i40e_read_nvm_word(hw, ptr_value + module_offset,
+					    &specific_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+
+		offset = ptr_value + module_offset + specific_ptr +
+			data_offset;
+
+		status = i40e_read_nvm_buffer(hw, offset, &words_data_size,
+					      data_ptr);
 		if (status != I40E_SUCCESS) {
 			i40e_debug(hw, I40E_DEBUG_ALL,
 				   "Reading nvm buffer failed.Error code: %d.\n",
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0ccd573f2..975fbd3ca 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -456,10 +456,10 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,
 void i40e_release_nvm(struct i40e_hw *hw);
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 					 u16 *data);
-enum i40e_status_code i40e_read_nvm_module_data(struct i40e_hw *hw,
-					       u8 module_ptr, u16 offset,
-					       u16 words_data_size,
-					       u16 *data_ptr);
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			u16 data_offset, u16 words_data_size, u16 *data_ptr);
+
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
 					   u16 *words, u16 *data);
 enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 45/69] net/i40e/base: change wrong 'Advertised FEC modes'
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (43 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 44/69] net/i40e/base: change for persistent lldp support Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 46/69] net/i40e/base: implement lpi statistics read from registers Xiaolong Ye
                   ` (26 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Gawin

Fix display of FEC settings for ethtool.
This patch change variable 'phy.link_info.req_fec_info' sent to ethtool.
Without this patch wrong FEC settings can be shown.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Slawomir Laba <slawomirx.laba@intel.com>
Reviewed-by: Formela Marcin <marcin.formela@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 91aa0f587..6ae598c95 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2924,9 +2924,16 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw)
 		if (status)
 			return status;
 
-		hw->phy.link_info.req_fec_info =
-			abilities.fec_cfg_curr_mod_ext_info &
-			(I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS);
+		if (abilities.fec_cfg_curr_mod_ext_info &
+		    I40E_AQ_ENABLE_FEC_AUTO)
+			hw->phy.link_info.req_fec_info =
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
+		else
+			hw->phy.link_info.req_fec_info =
+				abilities.fec_cfg_curr_mod_ext_info &
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
 
 		i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type,
 			sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 46/69] net/i40e/base: implement lpi statistics read from registers
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (44 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 45/69] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 47/69] net/i40e/base: add Flow Director defines Xiaolong Ye
                   ` (25 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Aleksandr Loktionov

On 1g i40e_aq_run_phy_activity() reports lpi statistics always as 0.
If phy is connected on 1g now the i40e_aq_run_phy_activity() call
is skipped and lpi statistics reading is done via direct
I40E_PRTPM_TLPIC,I40E_PRTPM_RLPIC registers read. Added new return
parameter to i40e_get_lpi_counters() because registers are clean
after read and especial if(is_clean) branch to handle statistics
increment such case also.

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Piotr  Kwapulinski <piotr.kwapulinski@intel.com>
Reviewed-by: Pietruszewski Piotr <piotr.pietruszewski@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 40 +++++++++++++++-----------
 drivers/net/i40e/base/i40e_prototype.h |  2 +-
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 6ae598c95..8763c0e65 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7173,21 +7173,25 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
  * @hw: pointer to the hw struct
  * @tx_counter: pointer to memory for TX LPI counter
  * @rx_counter: pointer to memory for RX LPI counter
+ * @is_clear:   returns true if counters are clear after read
  *
  * Read Low Power Idle (LPI) mode counters from Energy Efficient
  * Ethernet (EEE) statistics.
  **/
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
-					    u32 *tx_counter, u32 *rx_counter)
+					    u32 *tx_counter, u32 *rx_counter,
+					    bool *is_clear)
 {
 #ifdef CARLSVILLE_HW
 	/* only X710-T*L requires special handling of counters
 	 * for other devices we just read the MAC registers
 	 */
-	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) {
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    hw->phy.link_info.link_speed != I40E_LINK_SPEED_1GB) {
 		enum i40e_status_code retval;
 		u32 cmd_status;
 
+		*is_clear = false;
 		retval = i40e_aq_run_phy_activity(hw,
 				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
 				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
@@ -7200,6 +7204,7 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	}
 
 #endif /* CARLSVILLE_HW */
+	*is_clear = true;
 	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
 	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
 
@@ -7225,25 +7230,28 @@ enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 {
 	enum i40e_status_code retval;
 	u32 tx_counter, rx_counter;
+	bool is_clear;
 
-	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter);
+	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter, &is_clear);
 	if (retval)
 		goto err;
 
-	if (!offset_loaded) {
-		*tx_offset = tx_counter;
-		*rx_offset = rx_counter;
-	}
-
-	if (tx_counter >= *tx_offset)
-		*tx_stat = (u32)(tx_counter - *tx_offset);
-	else
-		*tx_stat = (u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+	if (is_clear) {
+		*tx_stat += tx_counter;
+		*rx_stat += rx_counter;
+	} else {
+		if (!offset_loaded) {
+			*tx_offset = tx_counter;
+			*rx_offset = rx_counter;
+		}
 
-	if (rx_counter >= *rx_offset)
-		*rx_stat = (u32)(rx_counter - *rx_offset);
-	else
-		*rx_stat = (u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+		*tx_stat = (tx_counter >= *tx_offset) ?
+			(u32)(tx_counter - *tx_offset) :
+			(u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+		*rx_stat = (rx_counter >= *rx_offset) ?
+			(u32)(rx_counter - *rx_offset) :
+			(u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+	}
 err:
 	return retval;
 }
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 975fbd3ca..86e320da8 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -77,7 +77,7 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
-					    u32 *rx_counter);
+					    u32 *rx_counter, bool *is_clear);
 enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 					   bool offset_loaded, u64 *tx_offset,
 					   u64 *tx_stat, u64 *rx_offset,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 47/69] net/i40e/base: add Flow Director defines
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (45 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 46/69] net/i40e/base: implement lpi statistics read from registers Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 48/69] net/i40e/base: removed unreachable code Xiaolong Ye
                   ` (24 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel

Add defines for creating Flow Director flows as defined in datasheet
section 7.1.5.4 for field vectors.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Reviewed-by: Brandeburg Jesse <jesse.brandeburg@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 6804aba51..f6b0cd585 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -5286,6 +5286,87 @@
 #define I40E_GLGEN_STAT_HALT                  0x00390000 /* Reset: CORER */
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT 0
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_MASK  I40E_MASK(0x3FFFFFFF, I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT)
+/* Flow Director */
+#define I40E_REG_INSET_L2_DMAC_SHIFT            60
+#define I40E_REG_INSET_L2_DMAC_MASK             I40E_MASK(0xEULL, I40E_REG_INSET_L2_DMAC_SHIFT)
+#define I40E_REG_INSET_L2_SMAC_SHIFT            56
+#define I40E_REG_INSET_L2_SMAC_MASK             I40E_MASK(0x1CULL, I40E_REG_INSET_L2_SMAC_SHIFT)
+#define I40E_REG_INSET_L2_OUTER_VLAN_SHIFT      26
+#define I40E_REG_INSET_L2_OUTER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_OUTER_VLAN_SHIFT)
+#define I40E_REG_INSET_L2_INNER_VLAN_SHIFT      55
+#define I40E_REG_INSET_L2_INNER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_INNER_VLAN_SHIFT)
+#define I40E_REG_INSET_TUNNEL_VLAN_SHIFT        56
+#define I40E_REG_INSET_TUNNEL_VLAN_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_VLAN_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP4_SHIFT         47
+#define I40E_REG_INSET_L3_SRC_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP4_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT    49
+#define I40E_X722_REG_INSET_L3_SRC_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_DST_IP4_SHIFT    41
+#define I40E_X722_REG_INSET_L3_DST_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT  52
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_MASK   I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT    52
+#define I40E_X722_REG_INSET_L3_IP4_TTL_MASK     I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TOS_SHIFT         54
+#define I40E_REG_INSET_L3_IP4_TOS_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TOS_SHIFT)
+#define I40E_REG_INSET_L3_IP4_PROTO_SHIFT       50
+#define I40E_REG_INSET_L3_IP4_PROTO_MASK        I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TTL_SHIFT         50
+#define I40E_REG_INSET_L3_IP4_TTL_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP6_SHIFT         43
+#define I40E_REG_INSET_L3_SRC_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_SRC_IP6_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP6_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_L3_IP6_TC_SHIFT          54
+#define I40E_REG_INSET_L3_IP6_TC_MASK           I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_TC_SHIFT)
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT    51
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT)
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT   51
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT)
+#define I40E_REG_INSET_L4_SRC_PORT_SHIFT        34
+#define I40E_REG_INSET_L4_SRC_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_SRC_PORT_SHIFT)
+#define I40E_REG_INSET_L4_DST_PORT_SHIFT        33
+#define I40E_REG_INSET_L4_DST_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_DST_PORT_SHIFT)
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT 31
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_MASK  I40E_MASK(0x3ULL, I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT  22
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT  11
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT   21
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT)
+#define I40E_REG_INSET_TUNNEL_ID_SHIFT          18
+#define I40E_REG_INSET_TUNNEL_ID_MASK           I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_ID_SHIFT)
+#define I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT    14
+#define I40E_REG_INSET_LAST_ETHER_TYPE_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT  8
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_MASK   I40E_MASK(0xFFULL, I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT 13
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT 12
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT 11
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT 10
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT 9
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT 8
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT 7
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_MASK  I40E_MASK(0xFFULL, I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT)
+#define I40E_REG_INSET_MASK_DEFAULT             0x0000000000000000ULL
+
 #endif /* PF_DRIVER */
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT       30
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_MASK        I40E_MASK(0x1, I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 48/69] net/i40e/base: removed unreachable code
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (46 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 47/69] net/i40e/base: add Flow Director defines Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 49/69] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
                   ` (23 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Dzmitry Sautsa

The result of the check is always FALSE and the code within "if"
is never executed.

Run static code analyzer.

Signed-off-by: Dzmitry Sautsa <dzmitryx.sautsa@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8763c0e65..0b989e21a 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5032,8 +5032,6 @@ enum i40e_status_code i40e_aq_add_mcast_etag(struct i40e_hw *hw, u16 pv_seid,
 	cmd->num_unicast_etags = num_tags_in_buf;
 
 	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (length > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
 
 	status = i40e_asq_send_command(hw, &desc, buf, length, cmd_details);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 49/69] net/i40e/base: set PHY Access flag on X722
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (47 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 48/69] net/i40e/base: removed unreachable code Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 50/69] net/i40e/base: implement reading lpi statistics Xiaolong Ye
                   ` (22 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Adam Ludkiewicz

The X722 FW API version 1.9 adds support for accessing PHY
registers with Admin Queue Command. This enables reading
EEPROM data from (Q)SFP+ transceivers, what was previously
possible only on X710 devices.

Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Piotr  Kwapulinski <piotr.kwapulinski@intel.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 5 +++++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 64b3b50b5..85e313e2b 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -677,6 +677,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 		    (aq->api_maj_ver == 1 &&
 		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
 			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
 		/* fall through */
 	default:
 		break;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 5f36a61a7..7e58a0ead 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -21,6 +21,8 @@
 
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */
+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 50/69] net/i40e/base: implement reading lpi statistics
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (48 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 49/69] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 51/69] net/i40e/base: add MRR field defines Xiaolong Ye
                   ` (21 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Gawin

There was no time duration statistics for LPI (Low Power Idle)
in EEE (Energy-Efficient Ethernet).
Added new procedure to get duration values from FW.
Otherwise there is no available procedure to get tx_lpi_duration
and rx_lpi_duration values.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  2 +
 drivers/net/i40e/base/i40e_common.c     | 61 +++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  3 ++
 drivers/net/i40e/base/i40e_type.h       |  2 +
 4 files changed, 68 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7e58a0ead..5879f32ff 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2292,7 +2292,9 @@ struct i40e_aqc_run_phy_activity {
 	union {
 		struct {
 			__le32  dnl_opcode;
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR	0x801a
 #define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR	0x1801b
 			__le32  data;
 			u8	reserved2[4];
 		} cmd;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 0b989e21a..c655f3359 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7209,6 +7209,67 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	return I40E_SUCCESS;
 }
 
+/**
+ * i40e_get_lpi_duration - read LPI time duration from EEE statistics
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ * @tx_duration: pointer to memory for TX LPI time duration
+ * @rx_duration: pointer to memory for RX LPI time duration
+ *
+ * Read Low Power Idle (LPI) mode time duration from Energy Efficient
+ * Ethernet (EEE) statistics.
+ */
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration)
+{
+#ifdef CARLSVILLE_HW
+	u32 tx_time_dur, rx_time_dur;
+	enum i40e_status_code retval;
+	u32 cmd_status;
+
+	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC)
+		return I40E_ERR_NOT_IMPLEMENTED;
+
+	retval = i40e_aq_run_phy_activity
+		(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+		I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR,
+		&cmd_status, &tx_time_dur, &rx_time_dur, NULL);
+
+	if (retval)
+		return retval;
+	if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+		return I40E_ERR_ADMIN_QUEUE_ERROR;
+
+	if (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB &&
+	    !tx_time_dur && !rx_time_dur &&
+	    stat->tx_lpi_status && stat->rx_lpi_status) {
+		retval = i40e_aq_run_phy_activity
+			(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+			I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR,
+			&cmd_status,
+			&tx_time_dur, &rx_time_dur, NULL);
+
+		if (retval)
+			return retval;
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			return I40E_ERR_ADMIN_QUEUE_ERROR;
+		tx_time_dur = 0;
+		rx_time_dur = 0;
+	}
+
+	*tx_duration = tx_time_dur;
+	*rx_duration = rx_time_dur;
+
+	return retval;
+#else /* CARLSVILLE_HW */
+	*tx_duration = 0;
+	*rx_duration = 0;
+
+	return I40E_SUCCESS;
+#endif /* CARLSVILLE_HW */
+}
+
 /**
  * i40e_lpi_stat_update - update LPI counters with values relative to offset
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 86e320da8..65a5d3658 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -82,6 +82,9 @@ enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 					   bool offset_loaded, u64 *tx_offset,
 					   u64 *tx_stat, u64 *rx_offset,
 					   u64 *rx_stat);
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 3ac1cf6e1..9b481ef5b 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1498,6 +1498,8 @@ struct i40e_hw_port_stats {
 	u32 rx_lpi_status;
 	u64 tx_lpi_count;		/* etlpic */
 	u64 rx_lpi_count;		/* erlpic */
+	u64 tx_lpi_duration;
+	u64 rx_lpi_duration;
 };
 
 /* Checksum and Shadow RAM pointers */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 51/69] net/i40e/base: add MRR field defines
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (49 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 50/69] net/i40e/base: implement reading lpi statistics Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality Xiaolong Ye
                   ` (20 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacek Naczyk

Add defines for Minimum Rollback Revision fields as defined in FVL DCR
378

Signed-off-by: Jacek Naczyk <jacek.naczyk@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Azarewicz Piotr <piotr.azarewicz@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 9b481ef5b..e75301534 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -2049,5 +2049,15 @@ struct i40e_profile_info {
 #define I40E_BCM_PHY_PCS_STATUS1_RX_LPI	BIT(8)
 #define I40E_BCM_PHY_PCS_STATUS1_TX_LPI	BIT(9)
 #endif
+#if defined(PREBOOT_SUPPORT) || defined(I40E_QV)
+#define I40E_SR_MINRREV_PCIE_ANALOG_LO		0x60
+#define I40E_SR_MINRREV_PCIE_ANALOG_HI		0x61
+#define I40E_SR_MINRREV_PHY_ANALOG_LO		0x62
+#define I40E_SR_MINRREV_PHY_ANALOG_HI		0x63
+#define I40E_SR_MINRREV_OPTION_ROM_LO		0x64
+#define I40E_SR_MINRREV_OPTION_ROM_HI		0x65
+#define I40E_SR_MINRREV_EMP_IMAGE_LO		0x66
+#define I40E_SR_MINRREV_EMP_IMAGE_HI		0x67
+#endif /* PREBOOT_SUPPORT || I40E_QV */
 
 #endif /* _I40E_TYPE_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (50 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 51/69] net/i40e/base: add MRR field defines Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02 19:13   ` Stillwell Jr, Paul M
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 53/69] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
                   ` (19 subsequent siblings)
  71 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Rusinski

The previous code had the LED code wrapped such that, it was
static to the file and not usable outside of it. It is now available.

Signed-off-by: Rusinski <mateusz.rusinski@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 10 ++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  7 ++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c655f3359..aebbd6004 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6950,8 +6950,13 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
  * @led_addr: LED register address
  * @reg_val: read register value
  **/
+#ifndef LINUX_SUPPORT
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val)
+#else
 static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
 					      u32 *reg_val)
+#endif
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
@@ -6979,8 +6984,13 @@ static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
  * @led_addr: LED register address
  * @reg_val: register value to write
  **/
+#ifndef LINUX_SUPPORT
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val)
+#else
 static enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
 					      u32 reg_val)
+#endif
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 65a5d3658..1b132b9b1 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -73,7 +73,12 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 				       u16 *val);
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
-
+#ifndef LINUX_SUPPORT
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val);
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val);
+#endif
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 53/69] net/i40e/base: introduce firmware EMP reset register offsets
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (51 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 54/69] net/i40e/base: change for reading lpi statistics Xiaolong Ye
                   ` (18 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Kwapulinski

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Reviewed-by: Slawomir Laba <slawomirx.laba@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index f6b0cd585..59c09c375 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 54/69] net/i40e/base: change for reading lpi statistics
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (52 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 53/69] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 55/69] net/i40e/base: update FVL FW API version to 1.10 Xiaolong Ye
                   ` (17 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Gawin

There was no values for time duration statistics for LPI in EEE.
Two byte mask has been added to filter the flags because F/W
returns the status only in two lower bytes.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Reviewed-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Slawomir Laba <slawomirx.laba@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 drivers/net/i40e/base/i40e_common.c     | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 5879f32ff..bc4aefba6 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2301,6 +2301,7 @@ struct i40e_aqc_run_phy_activity {
 		struct {
 			__le32	cmd_status;
 #define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK		0xFFFF
 			__le32	data0;
 			__le32	data1;
 		} resp;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index aebbd6004..1766214b9 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7248,7 +7248,8 @@ enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
 
 	if (retval)
 		return retval;
-	if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+	if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+	    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
 		return I40E_ERR_ADMIN_QUEUE_ERROR;
 
 	if (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB &&
@@ -7262,7 +7263,8 @@ enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
 
 		if (retval)
 			return retval;
-		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+		if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+		    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
 			return I40E_ERR_ADMIN_QUEUE_ERROR;
 		tx_time_dur = 0;
 		rx_time_dur = 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 55/69] net/i40e/base: update FVL FW API version to 1.10
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (53 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 54/69] net/i40e/base: change for reading lpi statistics Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 56/69] net/i40e/base: add CRC stripping capability Xiaolong Ye
                   ` (16 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

INTERNAL ONLY:
Upcoming FVL FW increment API version to 1.10 due to new AQ command -
Rollback Revision Update. The command is for QV SW only needed.
Details in DCR 378.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index bc4aefba6..17ac1c0c5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -13,7 +13,7 @@
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
 #define I40E_FW_API_VERSION_MINOR_X722	0x0009
-#define I40E_FW_API_VERSION_MINOR_X710	0x0009
+#define I40E_FW_API_VERSION_MINOR_X710	0x000A
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 56/69] net/i40e/base: add CRC stripping capability
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (54 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 55/69] net/i40e/base: update FVL FW API version to 1.10 Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features Xiaolong Ye
                   ` (15 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Paul M Stillwell Jr

Some VFs may want to disable CRC stripping on incoming packets
so create an offload for that. The VF already sends information
about configuring it's RX queues so use that structure to
indicate that the CRC stripping should be enabled or not.

This change is to support DCR 2685 "Enable/disable CRC
stripping for DPDK VFs"

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Keller Jacob E <jacob.e.keller@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Reviewed-by: Yang Lihong <lihong.yang@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index f659fbcab..0ea03d06b 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -238,6 +238,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040
+#define VIRTCHNL_VF_OFFLOAD_CRC			0x00000080
 #define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000
 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000
 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
@@ -289,7 +290,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
  * VF sends this message to set up parameters for one RX queue.
  * External data buffer contains one instance of virtchnl_rxq_info.
- * PF configures requested queue and returns a status code.
+ * PF configures requested queue and returns a status code. The
+ * crc_disable flag disables CRC stripping on the VF. Setting
+ * the crc_disable flag to 1 will disable CRC stripping for each
+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
+ * offload must have been set prior to sending this info or the PF
+ * will ignore the request. This flag should be set the same for
+ * all of the queues for a VF.
  */
 
 /* Rx queue config info */
@@ -301,7 +308,8 @@ struct virtchnl_rxq_info {
 	u16 splithdr_enabled; /* deprecated with AVF 1.0 */
 	u32 databuffer_size;
 	u32 max_pkt_size;
-	u32 pad1;
+	u8 crc_disable;
+	u8 pad1[3];
 	u64 dma_ring_addr;
 	enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
 	u32 pad2;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (55 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 56/69] net/i40e/base: add CRC stripping capability Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02 19:14   ` Stillwell Jr, Paul M
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 58/69] net/i40e/base: add limits for nested structures Xiaolong Ye
                   ` (14 subsequent siblings)
  71 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Phani R Burra

Updating the virtchnl header file with new interfaces. The new interfaces
will support the split queue and advanced features. These new features are
initially targeted for APF and CPF driver model. AVF also will enable the
new features in future and use the advanced interfaces.

Signed-off-by: Phani R Burra <phani.r.burra@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 511 ++++++++++++++++++++++++++++++-
 1 file changed, 509 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 0ea03d06b..c3495ab39 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -134,7 +134,34 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
 	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
 	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
-
+#ifdef VIRTCHNL_EXT_FEATURES
+	/* New major set of opcodes introduced and so leaving room for
+	* old misc opcodes to be added in future. Also these opcodes may only
+	* be used if both the PF and VF have successfully negotiated the
+	* VIRTCHNL_VF_CAP_EXT_FEATURES capability during initial capabilities
+	* exchange.
+	*/
+       VIRTCHNL_OP_GET_CAPS = 100,
+       VIRTCHNL_OP_CREATE_VPORT = 101,
+       VIRTCHNL_OP_DESTROY_VPORT = 102,
+       VIRTCHNL_OP_ENABLE_VPORT = 103,
+       VIRTCHNL_OP_DISABLE_VPORT = 104,
+       VIRTCHNL_OP_CONFIG_TX_QUEUES = 105,
+       VIRTCHNL_OP_CONFIG_RX_QUEUES = 106,
+       VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107,
+       VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108,
+       VIRTCHNL_OP_ADD_QUEUES = 109,
+       VIRTCHNL_OP_DEL_QUEUES = 110,
+       VIRTCHNL_OP_MAP_VECTOR_QUEUE = 111,
+       VIRTCHNL_OP_UNMAP_VECTOR_QUEUE = 112,
+       VIRTCHNL_OP_MAP_VECTOR_ITR = 113,
+       VIRTCHNL_OP_GET_RSS_KEY = 114,
+       VIRTCHNL_OP_GET_RSS_LUT = 115,
+       VIRTCHNL_OP_GET_RSS_HASH = 116,
+       VIRTCHNL_OP_SET_RSS_HASH = 117,
+       VIRTCHNL_OP_CREATE_VFS = 118,
+       VIRTCHNL_OP_DESTROY_VFS = 119,
+#endif /* VIRTCHNL_EXT_FEATURES */
 };
 
 /* These macros are used to generate compilation errors if a structure/union
@@ -248,8 +275,10 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
 #define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
 /* Define below the capability flags that are not offloads */
+#ifdef VIRTCHNL_EXT_FEATURES
+#define VIRTCHNL_VF_CAP_EXT_FEATURES		0x01000000
+#endif /* VIRTCHNL_EXT_FEATURES */
 #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED		0x00000080
-
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
 			       VIRTCHNL_VF_OFFLOAD_VLAN | \
 			       VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -707,6 +736,362 @@ enum virtchnl_vfr_states {
 	VIRTCHNL_VFR_VFACTIVE,
 };
 
+#ifdef VIRTCHNL_EXT_FEATURES
+/* PF capability flags
+ * VIRTCHNL_CAP_STATELESS_OFFLOADS flag indicates stateless offloads
+ * such as TX/RX Checksum offloading and TSO for non-tunneled packets. Please
+ * note that old and new capabilities are exclusive and not supposed to be
+ * mixed
+ */
+#define VIRTCHNL_CAP_STATELESS_OFFLOADS	BIT(1)
+#define VIRTCHNL_CAP_UDP_SEG_OFFLOAD	BIT(2)
+#define VIRTCHNL_CAP_RSS		BIT(3)
+#define VIRTCHNL_CAP_TCP_RSC		BIT(4)
+#define VIRTCHNL_CAP_HEADER_SPLIT	BIT(5)
+#define VIRTCHNL_CAP_RDMA		BIT(6)
+#define VIRTCHNL_CAP_SRIOV		BIT(7)
+/* Earliest Departure Time capability used for Timing Wheel */
+#define VIRTCHNL_CAP_EDT		BIT(8)
+
+/* Type of virtual port */
+enum virtchnl_vport_type {
+	VIRTCHNL_VPORT_TYPE_DEFAULT	= 0,
+};
+
+/* Type of queue model */
+enum virtchnl_queue_model {
+	VIRTCHNL_QUEUE_MODEL_SINGLE	= 0,
+	VIRTCHNL_QUEUE_MODEL_SPLIT	= 1,
+};
+
+/* TX and RX queue types are valid in legacy as well as split queue models.
+ * With Split Queue model, 2 additional types are introduced - TX_COMPLETION
+ * and RX_BUFFER. In split queue model, RX corresponds to the queue where HW
+ * posts completions.
+ */
+enum virtchnl_queue_type {
+	VIRTCHNL_QUEUE_TYPE_TX			= 0,
+	VIRTCHNL_QUEUE_TYPE_RX			= 1,
+	VIRTCHNL_QUEUE_TYPE_TX_COMPLETION	= 2,
+	VIRTCHNL_QUEUE_TYPE_RX_BUFFER		= 3,
+};
+
+/* RX Queue Feature bits */
+#define VIRTCHNL_RXQ_RSC			BIT(1)
+#define VIRTCHNL_RXQ_HDR_SPLIT			BIT(2)
+#define VIRTCHNL_RXQ_IMMEDIATE_WRITE_BACK	BIT(4)
+
+/* RX Queue Descriptor Types */
+enum virtchnl_rxq_desc_size {
+	VIRTCHNL_RXQ_DESC_SIZE_16BYTE		= 0,
+	VIRTCHNL_RXQ_DESC_SIZE_32BYTE		= 1,
+};
+
+/* TX Queue Scheduling Modes  Queue mode is the legacy type i.e. inorder
+ * and Flow mode is out of order packet processing
+ */
+enum virtchnl_txq_sched_mode {
+	VIRTCHNL_TXQ_SCHED_MODE_QUEUE		= 0,
+	VIRTCHNL_TXQ_SCHED_MODE_FLOW		= 1,
+};
+
+/* Queue Descriptor Profiles  Base mode is the legacy and Native is the
+ * flex descriptors
+ */
+enum virtchnl_desc_profile {
+	VIRTCHNL_TXQ_DESC_PROFILE_BASE		= 0,
+	VIRTCHNL_TXQ_DESC_PROFILE_NATIVE	= 1,
+};
+
+/* Type of RSS algorithm */
+enum virtchnl_rss_algorithm {
+	VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC	= 0,
+	VIRTCHNL_RSS_ALG_R_ASYMMETRIC		= 1,
+	VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC	= 2,
+	VIRTCHNL_RSS_ALG_XOR_SYMMETRIC		= 3,
+};
+
+/* VIRTCHNL_OP_GET_CAPS
+ * PF sends this message to CP to negotiate capabilities by filling
+ * in the u64 bitmap of its desired capabilities.
+ * CP responds with an updated virtchnl_get_capabilities structure
+ * with allowed capabilities and possible max number of vfs it can create.
+ */
+struct virtchnl_get_capabilities {
+	u64 cap_flags;
+	u16 max_num_vfs;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_get_capabilities);
+
+/* structure to specify a chunk of contiguous queues */
+struct virtchnl_queue_chunk {
+	enum virtchnl_queue_type type;
+	u16 start_queue_id;
+	u16 num_queues;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_queue_chunk);
+
+/* structure to specify several chunks of contiguous queues */
+struct virtchnl_queue_chunks {
+	u16 num_chunks;
+	struct virtchnl_queue_chunk chunks[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_queue_chunks);
+
+/* VIRTCHNL_OP_CREATE_VPORT
+ * PF sends this message to CP to create a vport by filling in the first 8
+ * fields of virtchnl_create_vport structure (vport type, tx, rx queue models
+ * and desired number of queues and vectors). CP responds with the updated
+ * virtchnl_create_vport structure containing the number of assigned queues,
+ * vectors, vport id, max mtu, default mac addr followed by chunks which in turn
+ * will have an array of num_chunks entries of virtchnl_queue_chunk structures.
+ */
+struct virtchnl_create_vport {
+	enum virtchnl_vport_type vport_type;
+	/* single or split */
+	enum virtchnl_queue_model txq_model;
+	/* single or split */
+	enum virtchnl_queue_model rxq_model;
+	u16 num_tx_q;
+	/* valid only if txq_model is split Q */
+	u16 num_tx_complq;
+	u16 num_rx_q;
+	/* valid only if rxq_model is split Q */
+	u16 num_rx_bufq;
+	u16 num_vectors;
+	u16 vport_id;
+	u16 max_mtu;
+	u8 default_mac_addr[ETH_ALEN];
+	enum virtchnl_rss_algorithm rss_algorithm;
+	u16 rss_key_size;
+	u16 rss_lut_size;
+	u16 qset_handle;
+	struct virtchnl_queue_chunks chunks;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_create_vport);
+
+/* VIRTCHNL_OP_DESTROY_VPORT
+ * VIRTCHNL_OP_ENABLE_VPORT
+ * VIRTCHNL_OP_DISABLE_VPORT
+ * PF sends this message to CP to destroy, enable or disable a vport by filling
+ * in the vport_id in virtchnl_vport structure.
+ * CP responds with the status of the requested operation.
+ */
+struct virtchnl_vport {
+	u16 vport_id;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(2, virtchnl_vport);
+
+/* Tx queue config info */
+struct virtchnl_txq_info_v2 {
+	u16 queue_id;
+	/* single or split */
+	enum virtchnl_queue_model model;
+	/* tx or tx_completion */
+	enum virtchnl_queue_type type;
+	/* queue or flow based */
+	enum virtchnl_txq_sched_mode sched_mode;
+	/* base or native */
+	enum virtchnl_desc_profile desc_profile;
+	u16 ring_len;
+	u64 dma_ring_addr;
+	/* valid only if queue model is split and type is tx */
+	u16 tx_compl_queue_id;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_txq_info_v2);
+
+/* VIRTCHNL_OP_CONFIG_TX_QUEUES
+ * PF sends this message to set up parameters for one or more TX queues.
+ * This message contains an array of num_qinfo instances of virtchnl_txq_info_v2
+ * structures. CP configures requested queues and returns a status code. If
+ * num_qinfo specified is greater than the number of queues associated with the
+ * vport, an error is returned and no queues are configured.
+ */
+struct virtchnl_config_tx_queues {
+	u16 vport_id;
+	u16 num_qinfo;
+	struct virtchnl_txq_info_v2 txq_info[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_tx_queues);
+
+/* Rx queue config info */
+struct virtchnl_rxq_info_v2 {
+	u16 queue_id;
+	/* single or split */
+	enum virtchnl_queue_model model;
+	/* rx or rx buffer */
+	enum virtchnl_queue_type type;
+	/* base or native */
+	enum virtchnl_desc_profile desc_profile;
+	/* rsc, header-split, immediate write back */
+	u16 queue_flags;
+	/* 16 or 32 byte */
+	enum virtchnl_rxq_desc_size desc_size;
+	u16 ring_len;
+	u16 hdr_buffer_size;
+	u32 data_buffer_size;
+	u32 max_pkt_size;
+	u64 dma_ring_addr;
+	u64 dma_head_wb_addr;
+	u16 rsc_low_watermark;
+	u8 buffer_notif_stride;
+	enum virtchnl_rx_hsplit rx_split_pos;
+	/* valid only if queue model is split and type is rx buffer*/
+	u16 rx_bufq1_id;
+	/* valid only if queue model is split and type is rx buffer*/
+	u16 rx_bufq2_id;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_rxq_info_v2);
+
+/* VIRTCHNL_OP_CONFIG_RX_QUEUES
+ * PF sends this message to set up parameters for one or more RX queues.
+ * This message contains an array of num_qinfo instances of virtchnl_rxq_info_v2
+ * structures. CP configures requested queues and returns a status code.
+ * If the number of queues specified is greater than the number of queues
+ * associated with the vport, an error is returned and no queues are configured.
+ */
+struct virtchnl_config_rx_queues {
+	u16 vport_id;
+	u16 num_qinfo;
+	struct virtchnl_rxq_info_v2 rxq_info[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_rx_queues);
+
+/* VIRTCHNL_OP_ADD_QUEUES
+ * PF sends this message to request additional TX/RX queues beyond the ones
+ * that were assigned via CREATE_VPORT request. virtchnl_add_queues structure is
+ * used to specify the number of each type of queues.
+ * CP responds with the same structure with the actual number of queues assigned
+ * followed by num_chunks of virtchnl_queue_chunk structures.
+ */
+struct virtchnl_add_queues {
+	u16 vport_id;
+	u16 num_tx_q;
+	u16 num_tx_complq;
+	u16 num_rx_q;
+	u16 num_rx_bufq;
+	struct virtchnl_queue_chunks chunks;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_add_queues);
+
+/* VIRTCHNL_OP_ENABLE_QUEUES
+ * VIRTCHNL_OP_DISABLE_QUEUES
+ * VIRTCHNL_OP_DEL_QUEUES
+ * PF sends these messages to enable, disable or delete queues specified in
+ * chunks. PF sends virtchnl_del_ena_dis_queues struct to specify the queues
+ * to be enabled/disabled/deleted. Also applicable to single queue RX or
+ * TX. CP performs requested action and returns status.
+ */
+struct virtchnl_del_ena_dis_queues {
+	u16 vport_id;
+	struct virtchnl_queue_chunks chunks;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_del_ena_dis_queues);
+
+/* Vector to Queue mapping */
+struct virtchnl_vector_queue {
+	u16 vector_id;
+	u16 queue_id;
+	enum virtchnl_queue_type queue_type;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_vector_queue);
+
+/* VIRTCHNL_OP_MAP_VECTOR_QUEUE
+ * VIRTCHNL_OP_UNMAP_VECTOR_QUEUE
+ * PF sends this message to map or unmap vectors to queues.
+ * This message contains an array of num_vector_queue_pairs instances of
+ * virtchnl_vector_queue structures. CP configures interrupt mapping and returns
+ * a status code. If the number of vectors specified is greater than the number
+ * of vectors associated with the vport, an error is returned and no vectors are
+ * mapped.
+ */
+struct virtchnl_vector_queue_pairs {
+	u16 vport_id;
+	u16 num_vector_queue_pairs;
+	struct virtchnl_vector_queue vq[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_queue_pairs);
+
+/* Vector to ITR index registers mapping */
+struct virtchnl_vector_itr {
+	u16 vector_id;
+	u16 rxitr_idx;
+	u16 txitr_idx;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vector_itr);
+
+/* VIRTCHNL_OP_MAP_VECTOR_ITR
+ * PF sends this message to map vectors to RX and TX ITR index registers.
+ * This message contains an array of num_vector_itr_pairs instances of
+ * virtchnl_vector_itr structures. CP configures requested queues and returns a
+ * status code. If the number of vectors specified is greater than the number of
+ * vectors associated with the VSI, an error is returned and no vectors are
+ * mapped.
+ */
+struct virtchnl_vector_itr_pairs {
+	u16 vport_id;
+	u16 num_vector_itr_pairs;
+	struct virtchnl_vector_itr vitr[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_itr_pairs);
+
+/* VIRTCHNL_OP_GET_RSS_LUT
+ * PF sends this message to get RSS lookup table. Only supported if
+ * both PF and CP drivers set the VIRTCHNL_CAP_RSS bit during configuration
+ * negotiation. Uses the virtchnl_rss_lut structure
+ */
+
+/* VIRTCHNL_OP_GET_RSS_KEY
+ * PF sends this message to get RSS key. Only supported if
+ * both PF and CP drivers set the VIRTCHNL_CAP_RSS bit during configuration
+ * negotiation. Used the virtchnl_rss_key structure
+ */
+
+/* VIRTCHNL_OP_GET_RSS_HASH
+ * VIRTCHNL_OP_SET_RSS_HASH
+ * PF sends these messages to get and set the hash filter enable bits for RSS.
+ * By default, the CP sets these to all possible traffic types that the
+ * hardware supports. The PF can query this value if it wants to change the
+ * traffic types that are hashed by the hardware.
+ * Only supported if both PF and CP drivers set the VIRTCHNL_CAP_RSS bit
+ * during configuration negotiation.
+ */
+struct virtchnl_rss_hash {
+	u16 vport_id;
+	u64 hash;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_rss_hash);
+
+/* VIRTCHNL_OP_CREATE_SRIOV_VFS
+ * VIRTCHNL_OP_DESTROY_SRIOV_VFS
+ * This message is used to let the CP know how many SRIOV VFs need to be
+ * created. The actual allocation of resources for the VFs in terms of VSI,
+ * Queues and Interrupts is done by CP. When this call completes, the APF driver
+ * calls pci_enable_sriov to let the OS instantiate the SRIOV PCIE devices.
+ */
+struct virtchnl_sriov_vfs_info {
+	u16 num_vfs;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(2, virtchnl_sriov_vfs_info);
+
+#endif /* VIRTCHNL_EXT_FEATURES */
 /**
  * virtchnl_vc_validate_vf_msg
  * @ver: Virtchnl version info
@@ -871,6 +1256,128 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG:
 		break;
 #endif
+#ifdef VIRTCHNL_EXT_FEATURES
+	case VIRTCHNL_OP_GET_CAPS:
+		valid_len = sizeof(struct virtchnl_get_capabilities);
+		break;
+	case VIRTCHNL_OP_CREATE_VPORT:
+		valid_len = sizeof(struct virtchnl_create_vport);
+		if (msglen >= valid_len) {
+			struct virtchnl_create_vport *cvport =
+				(struct virtchnl_create_vport *)msg;
+
+			valid_len += cvport->chunks.num_chunks *
+				      sizeof(struct virtchnl_queue_chunk);
+		}
+		break;
+	case VIRTCHNL_OP_DESTROY_VPORT:
+	case VIRTCHNL_OP_ENABLE_VPORT:
+	case VIRTCHNL_OP_DISABLE_VPORT:
+		valid_len = sizeof(struct virtchnl_vport);
+		break;
+	case VIRTCHNL_OP_CONFIG_TX_QUEUES:
+		valid_len = sizeof(struct virtchnl_config_tx_queues);
+		if (msglen >= valid_len) {
+			struct virtchnl_config_tx_queues *ctq =
+				(struct virtchnl_config_tx_queues *)msg;
+			if (ctq->num_qinfo == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += ctq->num_qinfo *
+				     sizeof(struct virtchnl_txq_info_v2);
+		}
+		break;
+	case VIRTCHNL_OP_CONFIG_RX_QUEUES:
+		valid_len = sizeof(struct virtchnl_config_rx_queues);
+		if (msglen >= valid_len) {
+			struct virtchnl_config_rx_queues *crq =
+				(struct virtchnl_config_rx_queues *)msg;
+			if (crq->num_qinfo == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += crq->num_qinfo *
+				     sizeof(struct virtchnl_rxq_info_v2);
+		}
+		break;
+	case VIRTCHNL_OP_ADD_QUEUES:
+		valid_len = sizeof(struct virtchnl_add_queues);
+		if (msglen >= valid_len) {
+			struct virtchnl_add_queues *add_q =
+				(struct virtchnl_add_queues *)msg;
+
+			valid_len += add_q->chunks.num_chunks *
+				      sizeof(struct virtchnl_queue_chunk);
+		}
+		break;
+	case VIRTCHNL_OP_ENABLE_QUEUES_V2:
+	case VIRTCHNL_OP_DISABLE_QUEUES_V2:
+	case VIRTCHNL_OP_DEL_QUEUES:
+		valid_len = sizeof(struct virtchnl_del_ena_dis_queues);
+		if (msglen >= valid_len) {
+			struct virtchnl_del_ena_dis_queues *qs =
+				(struct virtchnl_del_ena_dis_queues *)msg;
+			if (qs->chunks.num_chunks == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += qs->chunks.num_chunks *
+				      sizeof(struct virtchnl_queue_chunk);
+		}
+		break;
+	case VIRTCHNL_OP_MAP_VECTOR_QUEUE:
+	case VIRTCHNL_OP_UNMAP_VECTOR_QUEUE:
+		valid_len = sizeof(struct virtchnl_vector_queue_pairs);
+		if (msglen >= valid_len) {
+			struct virtchnl_vector_queue_pairs *v_qp =
+				(struct virtchnl_vector_queue_pairs *)msg;
+			if (v_qp->num_vector_queue_pairs == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += v_qp->num_vector_queue_pairs *
+				      sizeof(struct virtchnl_vector_queue);
+		}
+		break;
+	case VIRTCHNL_OP_MAP_VECTOR_ITR:
+		valid_len = sizeof(struct virtchnl_vector_itr_pairs);
+		if (msglen >= valid_len) {
+			struct virtchnl_vector_itr_pairs *v_itrp =
+				(struct virtchnl_vector_itr_pairs *)msg;
+			if (v_itrp->num_vector_itr_pairs == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += v_itrp->num_vector_itr_pairs *
+				      sizeof(struct virtchnl_vector_itr);
+		}
+		break;
+	case VIRTCHNL_OP_GET_RSS_KEY:
+		valid_len = sizeof(struct virtchnl_rss_key);
+		if (msglen >= valid_len) {
+			struct virtchnl_rss_key *vrk =
+				(struct virtchnl_rss_key *)msg;
+			valid_len += vrk->key_len - 1;
+		}
+		break;
+	case VIRTCHNL_OP_GET_RSS_LUT:
+		valid_len = sizeof(struct virtchnl_rss_lut);
+		if (msglen >= valid_len) {
+			struct virtchnl_rss_lut *vrl =
+				(struct virtchnl_rss_lut *)msg;
+			valid_len += vrl->lut_entries - 1;
+		}
+		break;
+	case VIRTCHNL_OP_GET_RSS_HASH:
+	case VIRTCHNL_OP_SET_RSS_HASH:
+		valid_len = sizeof(struct virtchnl_rss_hash);
+		break;
+	case VIRTCHNL_OP_CREATE_VFS:
+	case VIRTCHNL_OP_DESTROY_VFS:
+		valid_len = sizeof(struct virtchnl_sriov_vfs_info);
+		break;
+#endif /* VIRTCHNL_EXT_FEATURES */
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL_OP_EVENT:
 	case VIRTCHNL_OP_UNKNOWN:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 58/69] net/i40e/base: add limits for nested structures
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (56 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 59/69] net/i40e/base: put the check for zero nested elements higher Xiaolong Ye
                   ` (13 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Sergey Nemov

The following virtchnl opcodes operate with structures with nested
structures in them which can possible lead to overflow if number of
nested structures would be too big.

VIRTCHNL_OP_CONFIG_VSI_QUEUES
VIRTCHNL_OP_CONFIG_IRQ_MAP
VIRTCHNL_OP_ADD_ETH_ADDR
VIRTCHNL_OP_DEL_ETH_ADDR
VIRTCHNL_OP_ADD_VLAN
VIRTCHNL_OP_DEL_VLAN
VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
VIRTCHNL_OP_ENABLE_CHANNELS

Since message from VF is limited by u16, precalculate the maximum
numbers of nested structures which can possibly be sent through
virtual channel and exit with error if VF tries to send us more than the
maximum limit.

This is only a sanity check of the VF message length.
Each driver should additionally check these numbers to fit the hardware
capabilities.

Signed-off-by: Sergey Nemov <sergey.nemov@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 76 ++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c3495ab39..6384ded7d 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -719,6 +719,38 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
 
 #endif
 
+/* Since VF messages are limited by u16 size, precalculate the maximum possible
+ * values of nested elements in virtchnl structures that virtual channel can
+ * possibly handle in a single message.
+ */
+enum virtchnl_vector_limits {
+	VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX	=
+		((u16)(~0) - sizeof(struct virtchnl_vsi_queue_config_info)) /
+		sizeof(struct virtchnl_queue_pair_info),
+
+	VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX		=
+		((u16)(~0) - sizeof(struct virtchnl_irq_map_info)) /
+		sizeof(struct virtchnl_vector_map),
+
+	VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX	=
+		((u16)(~0) - sizeof(struct virtchnl_ether_addr_list)) /
+		sizeof(struct virtchnl_ether_addr),
+
+	VIRTCHNL_OP_ADD_DEL_VLAN_MAX		=
+		((u16)(~0) - sizeof(struct virtchnl_vlan_filter_list)) /
+		sizeof(u16),
+
+#ifdef VIRTCHNL_IWARP
+	VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP_MAX	=
+		((u16)(~0) - sizeof(struct virtchnl_iwarp_qvlist_info)) /
+		sizeof(struct virtchnl_iwarp_qv_info),
+#endif
+
+	VIRTCHNL_OP_ENABLE_CHANNELS_MAX		=
+		((u16)(~0) - sizeof(struct virtchnl_tc_info)) /
+		sizeof(struct virtchnl_channel_info),
+};
+
 /* VF reset states - these are written into the RSTAT register:
  * VFGEN_RSTAT on the VF
  * When the PF initiates a reset, it writes 0
@@ -1130,6 +1162,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_vsi_queue_config_info *vqc =
 			    (struct virtchnl_vsi_queue_config_info *)msg;
+
+			if (vqc->num_queue_pairs >
+			    VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			valid_len += (vqc->num_queue_pairs *
 				      sizeof(struct
 					     virtchnl_queue_pair_info));
@@ -1142,8 +1181,16 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_irq_map_info *vimi =
 			    (struct virtchnl_irq_map_info *)msg;
+
+			if (vimi->num_vectors >
+			    VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			valid_len += (vimi->num_vectors *
 				      sizeof(struct virtchnl_vector_map));
+
 			if (vimi->num_vectors == 0)
 				err_msg_format = true;
 		}
@@ -1158,6 +1205,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_ether_addr_list *veal =
 			    (struct virtchnl_ether_addr_list *)msg;
+
+			if (veal->num_elements >
+			    VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			valid_len += veal->num_elements *
 			    sizeof(struct virtchnl_ether_addr);
 			if (veal->num_elements == 0)
@@ -1170,7 +1224,15 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_vlan_filter_list *vfl =
 			    (struct virtchnl_vlan_filter_list *)msg;
+
+			if (vfl->num_elements >
+			    VIRTCHNL_OP_ADD_DEL_VLAN_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			valid_len += vfl->num_elements * sizeof(u16);
+
 			if (vfl->num_elements == 0)
 				err_msg_format = true;
 		}
@@ -1199,6 +1261,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_iwarp_qvlist_info *qv =
 				(struct virtchnl_iwarp_qvlist_info *)msg;
+
+			if (qv->num_vectors >
+			    VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			if (qv->num_vectors == 0) {
 				err_msg_format = true;
 				break;
@@ -1240,6 +1309,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_tc_info *vti =
 				(struct virtchnl_tc_info *)msg;
+
+			if (vti->num_tc >
+			    VIRTCHNL_OP_ENABLE_CHANNELS_MAX) {
+				err_msg_format = true;
+				break;
+			}
+
 			valid_len += (vti->num_tc - 1) *
 				     sizeof(struct virtchnl_channel_info);
 			if (vti->num_tc == 0)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 59/69] net/i40e/base: put the check for zero nested elements higher
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (57 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 58/69] net/i40e/base: add limits for nested structures Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements Xiaolong Ye
                   ` (12 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Sergey Nemov

Checking for == 0 on some elements resulted in unreachable code
discovered by static analyzer.

Put this check higher in the code structure to make the analyzer happy.

Signed-off-by: Sergey Nemov <sergey.nemov@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 6384ded7d..46fdca1aa 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -1163,7 +1163,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_vsi_queue_config_info *vqc =
 			    (struct virtchnl_vsi_queue_config_info *)msg;
 
-			if (vqc->num_queue_pairs >
+			if (vqc->num_queue_pairs == 0 || vqc->num_queue_pairs >
 			    VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX) {
 				err_msg_format = true;
 				break;
@@ -1172,8 +1172,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			valid_len += (vqc->num_queue_pairs *
 				      sizeof(struct
 					     virtchnl_queue_pair_info));
-			if (vqc->num_queue_pairs == 0)
-				err_msg_format = true;
 		}
 		break;
 	case VIRTCHNL_OP_CONFIG_IRQ_MAP:
@@ -1182,7 +1180,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_irq_map_info *vimi =
 			    (struct virtchnl_irq_map_info *)msg;
 
-			if (vimi->num_vectors >
+			if (vimi->num_vectors == 0 || vimi->num_vectors >
 			    VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX) {
 				err_msg_format = true;
 				break;
@@ -1190,9 +1188,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 
 			valid_len += (vimi->num_vectors *
 				      sizeof(struct virtchnl_vector_map));
-
-			if (vimi->num_vectors == 0)
-				err_msg_format = true;
 		}
 		break;
 	case VIRTCHNL_OP_ENABLE_QUEUES:
@@ -1206,7 +1201,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_ether_addr_list *veal =
 			    (struct virtchnl_ether_addr_list *)msg;
 
-			if (veal->num_elements >
+			if (veal->num_elements == 0 || veal->num_elements >
 			    VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX) {
 				err_msg_format = true;
 				break;
@@ -1214,8 +1209,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 
 			valid_len += veal->num_elements *
 			    sizeof(struct virtchnl_ether_addr);
-			if (veal->num_elements == 0)
-				err_msg_format = true;
 		}
 		break;
 	case VIRTCHNL_OP_ADD_VLAN:
@@ -1225,16 +1218,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_vlan_filter_list *vfl =
 			    (struct virtchnl_vlan_filter_list *)msg;
 
-			if (vfl->num_elements >
+			if (vfl->num_elements == 0 || vfl->num_elements >
 			    VIRTCHNL_OP_ADD_DEL_VLAN_MAX) {
 				err_msg_format = true;
 				break;
 			}
 
 			valid_len += vfl->num_elements * sizeof(u16);
-
-			if (vfl->num_elements == 0)
-				err_msg_format = true;
 		}
 		break;
 	case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
@@ -1262,16 +1252,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_iwarp_qvlist_info *qv =
 				(struct virtchnl_iwarp_qvlist_info *)msg;
 
-			if (qv->num_vectors >
+			if (qv->num_vectors == 0 || qv->num_vectors >
 			    VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP_MAX) {
 				err_msg_format = true;
 				break;
 			}
 
-			if (qv->num_vectors == 0) {
-				err_msg_format = true;
-				break;
-			}
 			valid_len += ((qv->num_vectors - 1) *
 				sizeof(struct virtchnl_iwarp_qv_info));
 		}
@@ -1310,7 +1296,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_tc_info *vti =
 				(struct virtchnl_tc_info *)msg;
 
-			if (vti->num_tc >
+			if (vti->num_tc == 0 || vti->num_tc >
 			    VIRTCHNL_OP_ENABLE_CHANNELS_MAX) {
 				err_msg_format = true;
 				break;
@@ -1318,8 +1304,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 
 			valid_len += (vti->num_tc - 1) *
 				     sizeof(struct virtchnl_channel_info);
-			if (vti->num_tc == 0)
-				err_msg_format = true;
 		}
 		break;
 	case VIRTCHNL_OP_DISABLE_CHANNELS:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (58 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 59/69] net/i40e/base: put the check for zero nested elements higher Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02 16:33   ` Williams, Mitch A
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 61/69] net/i40e/base: change 'Unknown bps' Xiaolong Ye
                   ` (11 subsequent siblings)
  71 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Mitch Williams

Add some comments to clarify driver requirements and expectations. No
code or struct changes.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 46fdca1aa..eb44134ca 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -347,11 +347,14 @@ struct virtchnl_rxq_info {
 VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
 
 /* VIRTCHNL_OP_CONFIG_VSI_QUEUES
- * VF sends this message to set parameters for all active TX and RX queues
+ * VF sends this message to set parameters for active TX and RX queues
  * associated with the specified VSI.
  * PF configures queues and returns status.
  * If the number of queues specified is greater than the number of queues
  * associated with the VSI, an error is returned and no queues are configured.
+ * NOTE: The VF is not required to configure all queues in a single request.
+ * It may send multiple messages. PF drivers must correctly handle all VF
+ * requests.
  */
 struct virtchnl_queue_pair_info {
 	/* NOTE: vsi_id and queue_id should be identical for both queues. */
@@ -389,9 +392,19 @@ struct virtchnl_vf_res_request {
  * VF uses this message to map vectors to queues.
  * The rxq_map and txq_map fields are bitmaps used to indicate which queues
  * are to be associated with the specified vector.
- * The "other" causes are always mapped to vector 0.
+ * The "other" causes are always mapped to vector 0. The VF may not request
+ * that vector 0 be used for traffic.
  * PF configures interrupt mapping and returns status.
+ * NOTE: due to hardware requirements, all active queues (both TX and RX)
+ * should be mapped to interrupts, even if the driver intends to operate
+ * only in polling mode. In this case the interrupt may be disabled, but
+ * the ITR timer will still run to trigger writebacks.
  */
+#ifndef EXTERNAL_RELEASE
+ /* See section 9.1.3.1.1 and table 9-4 in the CPK HAS for information
+  * on TX queue to vector mapping.
+  */
+#endif
 struct virtchnl_vector_map {
 	u16 vsi_id;
 	u16 vector_id;
@@ -417,6 +430,9 @@ VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
  * (Currently, we only support 16 queues per VF, but we make the field
  * u32 to allow for expansion.)
  * PF performs requested action and returns status.
+ * NOTE: The VF is not required to enable/disable all queues in a single
+ * request. It may send multiple messages.
+ * PF drivers must correctly handle all VF requests.
  */
 struct virtchnl_queue_select {
 	u16 vsi_id;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 61/69] net/i40e/base: change 'Unknown bps'
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (59 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 62/69] net/i40e/base: add USO offload flag for AVF Xiaolong Ye
                   ` (10 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Aleksandr Loktionov

This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg
for 2.5Gb/5Gb speeds. This problem is fixed by adding constants
for VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Brandeburg Jesse <jesse.brandeburg@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_prototype.h | 4 ++++
 drivers/net/i40e/base/virtchnl.h       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 1b132b9b1..974f4de64 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -521,6 +521,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
 		return VIRTCHNL_LINK_SPEED_100MB;
 	case I40E_LINK_SPEED_1GB:
 		return VIRTCHNL_LINK_SPEED_1GB;
+	case I40E_LINK_SPEED_2_5GB:
+		return VIRTCHNL_LINK_SPEED_2_5GB;
+	case I40E_LINK_SPEED_5GB:
+		return VIRTCHNL_LINK_SPEED_5GB;
 	case I40E_LINK_SPEED_10GB:
 		return VIRTCHNL_LINK_SPEED_10GB;
 	case I40E_LINK_SPEED_40GB:
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index eb44134ca..b6c0952dc 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -53,12 +53,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
 
 enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
@@ -68,6 +70,8 @@ enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_40GB	= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_20GB	= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_25GB	= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_2_5GB	= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_5GB		= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 62/69] net/i40e/base: add USO offload flag for AVF
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (60 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 61/69] net/i40e/base: change 'Unknown bps' Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 63/69] net/i40e/base: update the interrupt mapping and negotiation Xiaolong Ye
                   ` (9 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Vignesh Sridhar

Add new virtchl offload flag to indicate ability to support UDP
segmentation offload in driver

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Reviewed-by: Creeley Brett <brett.creeley@intel.com>
Reviewed-by: Aggarwal Mitu <mitu.aggarwal@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index b6c0952dc..37ca83a7d 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -278,6 +278,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM		0X00200000
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
 #define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
+#define VIRTCHNL_VF_OFFLOAD_USO			0X02000000
 /* Define below the capability flags that are not offloads */
 #ifdef VIRTCHNL_EXT_FEATURES
 #define VIRTCHNL_VF_CAP_EXT_FEATURES		0x01000000
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 63/69] net/i40e/base: update the interrupt mapping and negotiation
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (61 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 62/69] net/i40e/base: add USO offload flag for AVF Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 64/69] net/i40e/base: add inline ipsec data struct and commands Xiaolong Ye
                   ` (8 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Phani R Burra

Refactored the structures of interrupt negotiation and queue vector
mapping for the extended features. Also updated the new struct for RSS LUT

Signed-off-by: Phani R Burra <phani.r.burra@intel.com>
Reviewed-by: Pau Christopher <christopher.pau@intel.com>
Reviewed-by: Samudrala Sridhar <sridhar.samudrala@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 164 +++++++++++++++++++------------
 1 file changed, 103 insertions(+), 61 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 37ca83a7d..c701edf03 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -156,15 +156,17 @@ enum virtchnl_ops {
        VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108,
        VIRTCHNL_OP_ADD_QUEUES = 109,
        VIRTCHNL_OP_DEL_QUEUES = 110,
-       VIRTCHNL_OP_MAP_VECTOR_QUEUE = 111,
-       VIRTCHNL_OP_UNMAP_VECTOR_QUEUE = 112,
-       VIRTCHNL_OP_MAP_VECTOR_ITR = 113,
-       VIRTCHNL_OP_GET_RSS_KEY = 114,
-       VIRTCHNL_OP_GET_RSS_LUT = 115,
+       VIRTCHNL_OP_MAP_QUEUE_VECTOR = 111,
+       VIRTCHNL_OP_UNMAP_QUEUE_VECTOR = 112,
+       VIRTCHNL_OP_GET_RSS_KEY = 113,
+       VIRTCHNL_OP_GET_RSS_LUT = 114,
+       VIRTCHNL_OP_SET_RSS_LUT = 115,
        VIRTCHNL_OP_GET_RSS_HASH = 116,
        VIRTCHNL_OP_SET_RSS_HASH = 117,
        VIRTCHNL_OP_CREATE_VFS = 118,
        VIRTCHNL_OP_DESTROY_VFS = 119,
+       VIRTCHNL_OP_ALLOC_VECTORS = 120,
+       VIRTCHNL_OP_DEALLOC_VECTORS = 121,
 #endif /* VIRTCHNL_EXT_FEATURES */
 };
 
@@ -866,13 +868,23 @@ enum virtchnl_rss_algorithm {
 
 /* VIRTCHNL_OP_GET_CAPS
  * PF sends this message to CP to negotiate capabilities by filling
- * in the u64 bitmap of its desired capabilities.
+ * in the u64 bitmap of its desired capabilities, max_num_vfs and
+ * num_allocated_vectors.
  * CP responds with an updated virtchnl_get_capabilities structure
- * with allowed capabilities and possible max number of vfs it can create.
+ * with allowed capabilities and the other fields as below.
+ * If PF sets max_num_vfs as 0, CP will respond with max number of VFs
+ * that can be created by this PF. For any other value 'n', CP responds
+ * with max_num_vfs set to max(n, x) where x is the max number of VFs
+ * allowed by CP's policy.
+ * If PF sets num_allocated_vectors as 0, CP will respond with 1 which
+ * is default vector associated with the default mailbox. For any other
+ * value 'n', CP responds with a value <= n based on the CP's policy of
+ * max number of vectors for a PF.
  */
 struct virtchnl_get_capabilities {
 	u64 cap_flags;
 	u16 max_num_vfs;
+	u16 num_allocated_vectors;
 };
 
 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_get_capabilities);
@@ -914,7 +926,6 @@ struct virtchnl_create_vport {
 	u16 num_rx_q;
 	/* valid only if rxq_model is split Q */
 	u16 num_rx_bufq;
-	u16 num_vectors;
 	u16 vport_id;
 	u16 max_mtu;
 	u8 default_mac_addr[ETH_ALEN];
@@ -1052,61 +1063,82 @@ struct virtchnl_del_ena_dis_queues {
 
 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_del_ena_dis_queues);
 
-/* Vector to Queue mapping */
-struct virtchnl_vector_queue {
-	u16 vector_id;
+/* Virtchannel interrupt throttling rate index */
+enum virtchnl_itr_idx {
+	VIRTCHNL_ITR_IDX_0	= 0,
+	VIRTCHNL_ITR_IDX_1	= 1,
+	VIRTCHNL_ITR_IDX_NO_ITR	= 3,
+};
+
+/* Queue to vector mapping */
+struct virtchnl_queue_vector {
 	u16 queue_id;
+	u16 vector_id;
+	enum virtchnl_itr_idx itr_idx;
 	enum virtchnl_queue_type queue_type;
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_vector_queue);
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_vector);
 
-/* VIRTCHNL_OP_MAP_VECTOR_QUEUE
- * VIRTCHNL_OP_UNMAP_VECTOR_QUEUE
- * PF sends this message to map or unmap vectors to queues.
- * This message contains an array of num_vector_queue_pairs instances of
- * virtchnl_vector_queue structures. CP configures interrupt mapping and returns
- * a status code. If the number of vectors specified is greater than the number
- * of vectors associated with the vport, an error is returned and no vectors are
- * mapped.
+/* VIRTCHNL_OP_MAP_QUEUE_VECTOR
+ * VIRTCHNL_OP_UNMAP_QUEUE_VECTOR
+ * PF sends this message to map or unmap queues to vectors and ITR index
+ * registers. External data buffer contains virtchnl_queue_vector_maps structure
+ * that contains num_queue_vector_maps of virtchnl_queue_vector structures.
+ * CP maps the requested queue vector maps after validating the queue and vector
+ * ids and returns a status code.
  */
-struct virtchnl_vector_queue_pairs {
+struct virtchnl_queue_vector_maps {
 	u16 vport_id;
-	u16 num_vector_queue_pairs;
-	struct virtchnl_vector_queue vq[];
+	u16 num_queue_vector_maps;
+	struct virtchnl_queue_vector qv_maps[];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_queue_pairs);
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_queue_vector_maps);
 
-/* Vector to ITR index registers mapping */
-struct virtchnl_vector_itr {
-	u16 vector_id;
-	u16 rxitr_idx;
-	u16 txitr_idx;
+/* Structure to specify a chunk of contiguous interrupt vectors */
+struct virtchnl_vector_chunk {
+	u16 start_vector_id;
+	u16 num_vectors;
+};
+
+/* Structure to specify several chunks of contiguous interrupt vectors */
+struct virtchnl_vector_chunks {
+	u16 num_vector_chunks;
+	struct virtchnl_vector_chunk vchunk[];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vector_itr);
+/* VIRTCHNL_OP_ALLOC_VECTORS
+ * PF sends this message to request additional interrupt vectors beyond the
+ * ones that were assigned via GET_CAPS request. virtchnl_alloc_vectors
+ * structure is used to specify the number of vectors requested. CP responds
+ * with the same structure with the actual number of vectors assigned followed
+ * by virtchnl_vector_chunks structure identifying the vector ids.
+ */
+struct virtchnl_alloc_vectors {
+	u16 num_vectors;
+	struct virtchnl_vector_chunks vchunks;
+};
 
-/* VIRTCHNL_OP_MAP_VECTOR_ITR
- * PF sends this message to map vectors to RX and TX ITR index registers.
- * This message contains an array of num_vector_itr_pairs instances of
- * virtchnl_vector_itr structures. CP configures requested queues and returns a
- * status code. If the number of vectors specified is greater than the number of
- * vectors associated with the VSI, an error is returned and no vectors are
- * mapped.
+/* VIRTCHNL_OP_DEALLOC_VECTORS
+ * PF sends this message to release the vectors.
+ * PF sends virtchnl_vector_chunks struct to specify the vectors it is giving
+ * away. CP performs requested action and returns status.
  */
-struct virtchnl_vector_itr_pairs {
+
+struct virtchnl_rss_lut_v2 {
 	u16 vport_id;
-	u16 num_vector_itr_pairs;
-	struct virtchnl_vector_itr vitr[];
+	u16 lut_entries;
+	u16 lut[1]; /* RSS lookup table */
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_itr_pairs);
+VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut_v2);
 
 /* VIRTCHNL_OP_GET_RSS_LUT
- * PF sends this message to get RSS lookup table. Only supported if
+ * VIRTCHNL_OP_SET_RSS_LUT
+ * PF sends this message to get or set RSS lookup table. Only supported if
  * both PF and CP drivers set the VIRTCHNL_CAP_RSS bit during configuration
- * negotiation. Uses the virtchnl_rss_lut structure
+ * negotiation. Uses the virtchnl_rss_lut_v2 structure
  */
 
 /* VIRTCHNL_OP_GET_RSS_KEY
@@ -1407,31 +1439,40 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				      sizeof(struct virtchnl_queue_chunk);
 		}
 		break;
-	case VIRTCHNL_OP_MAP_VECTOR_QUEUE:
-	case VIRTCHNL_OP_UNMAP_VECTOR_QUEUE:
-		valid_len = sizeof(struct virtchnl_vector_queue_pairs);
+	case VIRTCHNL_OP_MAP_QUEUE_VECTOR:
+	case VIRTCHNL_OP_UNMAP_QUEUE_VECTOR:
+		valid_len = sizeof(struct virtchnl_queue_vector_maps);
 		if (msglen >= valid_len) {
-			struct virtchnl_vector_queue_pairs *v_qp =
-				(struct virtchnl_vector_queue_pairs *)msg;
-			if (v_qp->num_vector_queue_pairs == 0) {
+			struct virtchnl_queue_vector_maps *v_qp =
+				(struct virtchnl_queue_vector_maps *)msg;
+			if (v_qp->num_queue_vector_maps == 0) {
 				err_msg_format = true;
 				break;
 			}
-			valid_len += v_qp->num_vector_queue_pairs *
-				      sizeof(struct virtchnl_vector_queue);
+			valid_len += v_qp->num_queue_vector_maps *
+				      sizeof(struct virtchnl_queue_vector);
 		}
 		break;
-	case VIRTCHNL_OP_MAP_VECTOR_ITR:
-		valid_len = sizeof(struct virtchnl_vector_itr_pairs);
+	case VIRTCHNL_OP_ALLOC_VECTORS:
+		valid_len = sizeof(struct virtchnl_alloc_vectors);
 		if (msglen >= valid_len) {
-			struct virtchnl_vector_itr_pairs *v_itrp =
-				(struct virtchnl_vector_itr_pairs *)msg;
-			if (v_itrp->num_vector_itr_pairs == 0) {
+			struct virtchnl_alloc_vectors *v_av =
+				(struct virtchnl_alloc_vectors *)msg;
+			valid_len += v_av->vchunks.num_vector_chunks *
+				      sizeof(struct virtchnl_vector_chunk);
+		}
+		break;
+	case VIRTCHNL_OP_DEALLOC_VECTORS:
+		valid_len = sizeof(struct virtchnl_vector_chunks);
+		if (msglen >= valid_len) {
+			struct virtchnl_vector_chunks *v_chunks =
+				(struct virtchnl_vector_chunks *)msg;
+			if (v_chunks->num_vector_chunks == 0) {
 				err_msg_format = true;
 				break;
 			}
-			valid_len += v_itrp->num_vector_itr_pairs *
-				      sizeof(struct virtchnl_vector_itr);
+			valid_len += v_chunks->num_vector_chunks *
+				      sizeof(struct virtchnl_vector_chunk);
 		}
 		break;
 	case VIRTCHNL_OP_GET_RSS_KEY:
@@ -1443,10 +1484,11 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		}
 		break;
 	case VIRTCHNL_OP_GET_RSS_LUT:
-		valid_len = sizeof(struct virtchnl_rss_lut);
+	case VIRTCHNL_OP_SET_RSS_LUT:
+		valid_len = sizeof(struct virtchnl_rss_lut_v2);
 		if (msglen >= valid_len) {
-			struct virtchnl_rss_lut *vrl =
-				(struct virtchnl_rss_lut *)msg;
+			struct virtchnl_rss_lut_v2 *vrl =
+				(struct virtchnl_rss_lut_v2 *)msg;
 			valid_len += vrl->lut_entries - 1;
 		}
 		break;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 64/69] net/i40e/base: add inline ipsec data struct and commands
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (62 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 63/69] net/i40e/base: update the interrupt mapping and negotiation Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 65/69] net/i40e/base: change all zero-sized arrays Xiaolong Ye
                   ` (7 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Leyi Rong

AVF support inline ipsec. This patch add some change in
header file of virtchnl.h to support the basic command
on inline ipsec, including data struct defining and basic
command.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 35 ++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c701edf03..a6787a065 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -37,6 +37,10 @@
  * value in current and future projects
  */
 
+#ifdef VIRTCHNL_IPSEC
+#include "virtchnl_inline_ipsec.h"
+#endif
+
 /* Error Codes */
 enum virtchnl_status_code {
 	VIRTCHNL_STATUS_SUCCESS				= 0,
@@ -138,6 +142,15 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
 	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
 	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
+#ifdef VIRTCHNL_IPSEC
+	VIRTCHNL_OP_GET_IPSEC_CAP = 34,
+	VIRTCHNL_OP_IPSEC_SA_CREATE = 35,
+	VIRTCHNL_OP_IPSEC_SA_UPDATE = 36,
+	VIRTCHNL_OP_IPSEC_SA_DESTROY = 37,
+	VIRTCHNL_OP_IPSEC_SA_READ = 38,
+#else
+	/* opcodes 34, 35, 36, 37 and 38 are reserved */
+#endif /* VIRTCHNL_IPSEC */
 #ifdef VIRTCHNL_EXT_FEATURES
 	/* New major set of opcodes introduced and so leaving room for
 	* old misc opcodes to be added in future. Also these opcodes may only
@@ -281,6 +294,12 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
 #define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
 #define VIRTCHNL_VF_OFFLOAD_USO			0X02000000
+#ifdef VIRTCHNL_IPSEC
+#define VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC	0X80000000
+#else
+	/* 0X80000000 is reserved */
+#endif
+
 /* Define below the capability flags that are not offloads */
 #ifdef VIRTCHNL_EXT_FEATURES
 #define VIRTCHNL_VF_CAP_EXT_FEATURES		0x01000000
@@ -1369,6 +1388,22 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG:
 		break;
 #endif
+#ifdef VIRTCHNL_IPSEC
+	case VIRTCHNL_OP_GET_IPSEC_CAP:
+		break;
+	case VIRTCHNL_OP_IPSEC_SA_CREATE:
+		valid_len = sizeof(struct virtchnl_ipsec_sa_cfg);
+		break;
+	case VIRTCHNL_OP_IPSEC_SA_UPDATE:
+		valid_len = sizeof(struct virtchnl_ipsec_sa_update);
+		break;
+	case VIRTCHNL_OP_IPSEC_SA_DESTROY:
+		valid_len = sizeof(struct virtchnl_ipsec_sa_destroy);
+		break;
+	case VIRTCHNL_OP_IPSEC_SA_READ:
+		valid_len = sizeof(u32);
+		break;
+#endif /* VIRTCHNL_IPSEC */
 #ifdef VIRTCHNL_EXT_FEATURES
 	case VIRTCHNL_OP_GET_CAPS:
 		valid_len = sizeof(struct virtchnl_get_capabilities);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 65/69] net/i40e/base: change all zero-sized arrays
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (63 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 64/69] net/i40e/base: add inline ipsec data struct and commands Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 66/69] net/i40e/base: support for additional flow type Xiaolong Ye
                   ` (6 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Christopher Pau

C++ compilers do not allow zero-sized arrays. Convert structs to use
single element arrays.

Signed-off-by: Christopher Pau <christopher.pau@intel.com>
Reviewed-by: Joyner Eric <eric.joyner@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 77 +++++++++++++++++++++++---------
 1 file changed, 56 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index a6787a065..51b718d42 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -920,10 +920,11 @@ VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_queue_chunk);
 /* structure to specify several chunks of contiguous queues */
 struct virtchnl_queue_chunks {
 	u16 num_chunks;
-	struct virtchnl_queue_chunk chunks[];
+	u16 rsvd;
+	struct virtchnl_queue_chunk chunks[1];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_queue_chunks);
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_chunks);
 
 /* VIRTCHNL_OP_CREATE_VPORT
  * PF sends this message to CP to create a vport by filling in the first 8
@@ -955,7 +956,7 @@ struct virtchnl_create_vport {
 	struct virtchnl_queue_chunks chunks;
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_create_vport);
+VIRTCHNL_CHECK_STRUCT_LEN(56, virtchnl_create_vport);
 
 /* VIRTCHNL_OP_DESTROY_VPORT
  * VIRTCHNL_OP_ENABLE_VPORT
@@ -999,10 +1000,11 @@ VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_txq_info_v2);
 struct virtchnl_config_tx_queues {
 	u16 vport_id;
 	u16 num_qinfo;
-	struct virtchnl_txq_info_v2 txq_info[];
+	u32 rsvd;
+	struct virtchnl_txq_info_v2 txq_info[1];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_tx_queues);
+VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_config_tx_queues);
 
 /* Rx queue config info */
 struct virtchnl_rxq_info_v2 {
@@ -1044,10 +1046,10 @@ VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_rxq_info_v2);
 struct virtchnl_config_rx_queues {
 	u16 vport_id;
 	u16 num_qinfo;
-	struct virtchnl_rxq_info_v2 rxq_info[];
+	struct virtchnl_rxq_info_v2 rxq_info[1];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_rx_queues);
+VIRTCHNL_CHECK_STRUCT_LEN(80, virtchnl_config_rx_queues);
 
 /* VIRTCHNL_OP_ADD_QUEUES
  * PF sends this message to request additional TX/RX queues beyond the ones
@@ -1065,7 +1067,7 @@ struct virtchnl_add_queues {
 	struct virtchnl_queue_chunks chunks;
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_add_queues);
+VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_add_queues);
 
 /* VIRTCHNL_OP_ENABLE_QUEUES
  * VIRTCHNL_OP_DISABLE_QUEUES
@@ -1080,7 +1082,7 @@ struct virtchnl_del_ena_dis_queues {
 	struct virtchnl_queue_chunks chunks;
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_del_ena_dis_queues);
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_del_ena_dis_queues);
 
 /* Virtchannel interrupt throttling rate index */
 enum virtchnl_itr_idx {
@@ -1110,10 +1112,10 @@ VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_vector);
 struct virtchnl_queue_vector_maps {
 	u16 vport_id;
 	u16 num_queue_vector_maps;
-	struct virtchnl_queue_vector qv_maps[];
+	struct virtchnl_queue_vector qv_maps[1];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_queue_vector_maps);
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_queue_vector_maps);
 
 /* Structure to specify a chunk of contiguous interrupt vectors */
 struct virtchnl_vector_chunk {
@@ -1121,12 +1123,16 @@ struct virtchnl_vector_chunk {
 	u16 num_vectors;
 };
 
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_chunk);
+
 /* Structure to specify several chunks of contiguous interrupt vectors */
 struct virtchnl_vector_chunks {
 	u16 num_vector_chunks;
-	struct virtchnl_vector_chunk vchunk[];
+	struct virtchnl_vector_chunk vchunk[1];
 };
 
+VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vector_chunks);
+
 /* VIRTCHNL_OP_ALLOC_VECTORS
  * PF sends this message to request additional interrupt vectors beyond the
  * ones that were assigned via GET_CAPS request. virtchnl_alloc_vectors
@@ -1139,12 +1145,13 @@ struct virtchnl_alloc_vectors {
 	struct virtchnl_vector_chunks vchunks;
 };
 
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_alloc_vectors);
+
 /* VIRTCHNL_OP_DEALLOC_VECTORS
  * PF sends this message to release the vectors.
  * PF sends virtchnl_vector_chunks struct to specify the vectors it is giving
  * away. CP performs requested action and returns status.
  */
-
 struct virtchnl_rss_lut_v2 {
 	u16 vport_id;
 	u16 lut_entries;
@@ -1414,7 +1421,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_create_vport *cvport =
 				(struct virtchnl_create_vport *)msg;
 
-			valid_len += cvport->chunks.num_chunks *
+			if (cvport->chunks.num_chunks == 0) {
+				/* zero chunks is allowed as input */
+				break;
+			}
+
+			valid_len += (cvport->chunks.num_chunks - 1) *
 				      sizeof(struct virtchnl_queue_chunk);
 		}
 		break;
@@ -1432,7 +1444,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				err_msg_format = true;
 				break;
 			}
-			valid_len += ctq->num_qinfo *
+			valid_len += (ctq->num_qinfo - 1) *
 				     sizeof(struct virtchnl_txq_info_v2);
 		}
 		break;
@@ -1445,7 +1457,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				err_msg_format = true;
 				break;
 			}
-			valid_len += crq->num_qinfo *
+			valid_len += (crq->num_qinfo - 1) *
 				     sizeof(struct virtchnl_rxq_info_v2);
 		}
 		break;
@@ -1455,7 +1467,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 			struct virtchnl_add_queues *add_q =
 				(struct virtchnl_add_queues *)msg;
 
-			valid_len += add_q->chunks.num_chunks *
+			if (add_q->chunks.num_chunks == 0) {
+				/* zero chunks is allowed as input */
+				break;
+			}
+
+			valid_len += (add_q->chunks.num_chunks - 1) *
 				      sizeof(struct virtchnl_queue_chunk);
 		}
 		break;
@@ -1470,7 +1487,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				err_msg_format = true;
 				break;
 			}
-			valid_len += qs->chunks.num_chunks *
+			valid_len += (qs->chunks.num_chunks - 1) *
 				      sizeof(struct virtchnl_queue_chunk);
 		}
 		break;
@@ -1484,7 +1501,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				err_msg_format = true;
 				break;
 			}
-			valid_len += v_qp->num_queue_vector_maps *
+			valid_len += (v_qp->num_queue_vector_maps - 1) *
 				      sizeof(struct virtchnl_queue_vector);
 		}
 		break;
@@ -1493,7 +1510,13 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_alloc_vectors *v_av =
 				(struct virtchnl_alloc_vectors *)msg;
-			valid_len += v_av->vchunks.num_vector_chunks *
+
+			if (v_av->vchunks.num_vector_chunks == 0) {
+				/* zero chunks is allowed as input */
+				break;
+			}
+
+			valid_len += (v_av->vchunks.num_vector_chunks - 1) *
 				      sizeof(struct virtchnl_vector_chunk);
 		}
 		break;
@@ -1506,7 +1529,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				err_msg_format = true;
 				break;
 			}
-			valid_len += v_chunks->num_vector_chunks *
+			valid_len += (v_chunks->num_vector_chunks - 1) *
 				      sizeof(struct virtchnl_vector_chunk);
 		}
 		break;
@@ -1515,6 +1538,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_rss_key *vrk =
 				(struct virtchnl_rss_key *)msg;
+
+			if (vrk->key_len == 0) {
+				/* zero length is allowed as input */
+				break;
+			}
+
 			valid_len += vrk->key_len - 1;
 		}
 		break;
@@ -1524,6 +1553,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_rss_lut_v2 *vrl =
 				(struct virtchnl_rss_lut_v2 *)msg;
+
+			if (vrl->lut_entries == 0) {
+				/* zero entries is allowed as input */
+				break;
+			}
+
 			valid_len += vrl->lut_entries - 1;
 		}
 		break;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 66/69] net/i40e/base: support for additional flow type
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (64 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 65/69] net/i40e/base: change all zero-sized arrays Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 67/69] net/i40e/base: change GET/SET_RSS_LUT valid_len check Xiaolong Ye
                   ` (5 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, Xiaolong Ye, Parthasarathy Sarangam, Kiran Patil

This patch adds/supports following:
- Separate flow type for TCP and UDP for IPv4[6]
- added new offload capability such as ADQ_V2 which will be used
to support advanced ADQ features such as more filter types, 16 TCs,
usage of ADQ performance code

Signed-off-by: Parthasarathy Sarangam <parthasarathy.sarangam@intel.com>
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Aggarwal Mitu <mitu.aggarwal@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 51b718d42..13cd0e5ab 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -293,6 +293,16 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM		0X00200000
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
 #define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
+#ifndef EXTERNAL_RELEASE
+/* This capability is used to engage advanced ADQ features such as:
+ * - support for different filter type (e.g. TCP, UDP) simultaneously
+ * - support for filter type where L4 src + L4 dest is allowed
+ * - support upto 16 TCs
+ * - also used to indicate the engagement of performance bits if the ADQ PERF
+ *   specific code is compiled in
+ */
+#endif /* !EXTERNAL_RELEASE */
+#define VIRTCHNL_VF_OFFLOAD_ADQ_V2		0X01000000
 #define VIRTCHNL_VF_OFFLOAD_USO			0X02000000
 #ifdef VIRTCHNL_IPSEC
 #define VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC	0X80000000
@@ -611,6 +621,13 @@ struct virtchnl_rss_hena {
 
 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
 
+/* This is used by PF driver to enforce how many channels can be supported.
+ * When ADQ_V2 capability is negotiated, it will allow 16 channels otherwise
+ * PF driver will allow only max 4 channels
+ */
+#define VIRTCHNL_MAX_ADQ_CHANNELS 4
+#define VIRTCHNL_MAX_ADQ_V2_CHANNELS 16
+
 /* VIRTCHNL_OP_ENABLE_CHANNELS
  * VIRTCHNL_OP_DISABLE_CHANNELS
  * VF sends these messages to enable or disable channels based on
@@ -646,6 +663,11 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
 struct virtchnl_l4_spec {
 	u8	src_mac[ETH_ALEN];
 	u8	dst_mac[ETH_ALEN];
+	/* vlan_prio is part of this 16 bit field even from OS perspective
+	 * vlan_id:12 is actual vlan_id, then vlanid:bit14..12 is vlan_prio
+	 * in future, when decided to offload vlan_prio, pass that information
+	 * as part of the "vlan_id" field, Bit14..12
+	 */
 	__be16	vlan_id;
 	__be16	pad; /* reserved for future use */
 	__be32	src_ip[4];
@@ -673,6 +695,8 @@ enum virtchnl_flow_type {
 	/* flow types */
 	VIRTCHNL_TCP_V4_FLOW = 0,
 	VIRTCHNL_TCP_V6_FLOW,
+	VIRTCHNL_UDP_V4_FLOW,
+	VIRTCHNL_UDP_V6_FLOW,
 };
 
 struct virtchnl_filter {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 67/69] net/i40e/base: change GET/SET_RSS_LUT valid_len check
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (65 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 66/69] net/i40e/base: support for additional flow type Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 68/69] net/i40e/base: add missing 0 length checks Xiaolong Ye
                   ` (4 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Christopher Pau

Each lut entry is a u16, so fix the valid_len check using sizeof(u16)

Signed-off-by: Christopher Pau <christopher.pau@intel.com>
Reviewed-by: Shanmugam Jayaprakash <jayaprakash.shanmugam@intel.com>
Reviewed-by: Burra Phani R <phani.r.burra@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 13cd0e5ab..bc9043dde 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -1583,7 +1583,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 				break;
 			}
 
-			valid_len += vrl->lut_entries - 1;
+			valid_len += (vrl->lut_entries - 1) * sizeof(u16);
 		}
 		break;
 	case VIRTCHNL_OP_GET_RSS_HASH:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 68/69] net/i40e/base: add missing 0 length checks
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (66 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 67/69] net/i40e/base: change GET/SET_RSS_LUT valid_len check Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 69/69] net/i40e/base: update version Xiaolong Ye
                   ` (3 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Eric Joyner

Other RSS-related opcodes allow 0 as a valid length for the number of
elements in their variable-sized structs, so allow 0 for
VIRTCHNL_OP_CONFIG_RSS_KEY and VIRTCHNL_OP_CONFIG_RSS_LUT, too.

This avoids a situation where a struct with a number of elements of 0
must shrink the size of the default struct in order to pass the
virtchnl_vc_validate_vf_msg() validation.

Signed-off-by: Eric Joyner <eric.joyner@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index bc9043dde..dabeb79ba 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -1371,6 +1371,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_rss_key *vrk =
 				(struct virtchnl_rss_key *)msg;
+
+			if (vrk->key_len == 0) {
+				/* zero length is allowed as input */
+				break;
+			}
+
 			valid_len += vrk->key_len - 1;
 		}
 		break;
@@ -1379,6 +1385,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		if (msglen >= valid_len) {
 			struct virtchnl_rss_lut *vrl =
 				(struct virtchnl_rss_lut *)msg;
+
+			if (vrl->lut_entries == 0) {
+				/* zero entries is allowed as input */
+				break;
+			}
+
 			valid_len += vrl->lut_entries - 1;
 		}
 		break;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH 69/69] net/i40e/base: update version
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (67 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 68/69] net/i40e/base: add missing 0 length checks Xiaolong Ye
@ 2019-12-02  7:49 ` Xiaolong Ye
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                   ` (2 subsequent siblings)
  71 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-02  7:49 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Update version to 2019.11.14.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/README b/drivers/net/i40e/base/README
index 8a5339cff..6511f9a2f 100644
--- a/drivers/net/i40e/base/README
+++ b/drivers/net/i40e/base/README
@@ -6,7 +6,7 @@ Intel® I40E driver
 ==================
 
 This directory contains source code of FreeBSD i40e driver of version
-cid-i40e.2018.09.13.tar.gz released by the team which develops
+cid-i40e.2019.11.14.tar.gz released by the team which develops
 basic drivers for any i40e NIC. The directory of base/ contains the
 original source package.
 This driver is valid for the product(s) listed below
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements Xiaolong Ye
@ 2019-12-02 16:33   ` Williams, Mitch A
  0 siblings, 0 replies; 198+ messages in thread
From: Williams, Mitch A @ 2019-12-02 16:33 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev

NAK

Code wrapped in EXTERNAL_RELEASE must not be released publicly.

> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Sunday, December 01, 2019 11:49 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Williams, Mitch A
> <mitch.a.williams@intel.com>
> Subject: [PATCH 60/69] net/i40e/base: clarify requirements
> 
> Add some comments to clarify driver requirements and expectations. No
> code or struct changes.
> 
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/virtchnl.h | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/base/virtchnl.h
> b/drivers/net/i40e/base/virtchnl.h
> index 46fdca1aa..eb44134ca 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -347,11 +347,14 @@ struct virtchnl_rxq_info {
>  VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
> 
>  /* VIRTCHNL_OP_CONFIG_VSI_QUEUES
> - * VF sends this message to set parameters for all active TX and RX queues
> + * VF sends this message to set parameters for active TX and RX queues
>   * associated with the specified VSI.
>   * PF configures queues and returns status.
>   * If the number of queues specified is greater than the number of queues
>   * associated with the VSI, an error is returned and no queues are
> configured.
> + * NOTE: The VF is not required to configure all queues in a single request.
> + * It may send multiple messages. PF drivers must correctly handle all VF
> + * requests.
>   */
>  struct virtchnl_queue_pair_info {
>  	/* NOTE: vsi_id and queue_id should be identical for both queues. */
> @@ -389,9 +392,19 @@ struct virtchnl_vf_res_request {
>   * VF uses this message to map vectors to queues.
>   * The rxq_map and txq_map fields are bitmaps used to indicate which queues
>   * are to be associated with the specified vector.
> - * The "other" causes are always mapped to vector 0.
> + * The "other" causes are always mapped to vector 0. The VF may not request
> + * that vector 0 be used for traffic.
>   * PF configures interrupt mapping and returns status.
> + * NOTE: due to hardware requirements, all active queues (both TX and RX)
> + * should be mapped to interrupts, even if the driver intends to operate
> + * only in polling mode. In this case the interrupt may be disabled, but
> + * the ITR timer will still run to trigger writebacks.
>   */
> +#ifndef EXTERNAL_RELEASE
> + /* See section 9.1.3.1.1 and table 9-4 in the CPK HAS for information
> +  * on TX queue to vector mapping.
> +  */
> +#endif
>  struct virtchnl_vector_map {
>  	u16 vsi_id;
>  	u16 vector_id;
> @@ -417,6 +430,9 @@ VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
>   * (Currently, we only support 16 queues per VF, but we make the field
>   * u32 to allow for expansion.)
>   * PF performs requested action and returns status.
> + * NOTE: The VF is not required to enable/disable all queues in a single
> + * request. It may send multiple messages.
> + * PF drivers must correctly handle all VF requests.
>   */
>  struct virtchnl_queue_select {
>  	u16 vsi_id;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK FW API version to 1.9
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK " Xiaolong Ye
@ 2019-12-02 19:03   ` Stillwell Jr, Paul M
  0 siblings, 0 replies; 198+ messages in thread
From: Stillwell Jr, Paul M @ 2019-12-02 19:03 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z
  Cc: dev, Ye, Xiaolong, Azarewicz, Piotr

NACK, no code names in public commit messages.

Paul

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaolong Ye
> Sent: Sunday, December 1, 2019 11:49 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Azarewicz, Piotr
> <piotr.azarewicz@intel.com>
> Subject: [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK FW API
> version to 1.9
> 
> Upcoming FPK FW increment API version to 1.9, so we must bump up version
> number as well.
> FPK will support PHY access AQ command as FVL does.
> 
> Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
> Reviewed-by: Formela Marcin <marcin.formela@intel.com>
> Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
> Reviewed-by: Michael Alice <alice.michael@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h
> b/drivers/net/i40e/base/i40e_adminq_cmd.h
> index 7fd39b82e..2d1efef69 100644
> --- a/drivers/net/i40e/base/i40e_adminq_cmd.h
> +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
> @@ -12,7 +12,7 @@
>   */
> 
>  #define I40E_FW_API_VERSION_MAJOR	0x0001
> -#define I40E_FW_API_VERSION_MINOR_X722	0x0008
> +#define I40E_FW_API_VERSION_MINOR_X722	0x0009
>  #define I40E_FW_API_VERSION_MINOR_X710	0x0009
> 
>  #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type ==
> I40E_MAC_XL710 ? \
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality Xiaolong Ye
@ 2019-12-02 19:13   ` Stillwell Jr, Paul M
  0 siblings, 0 replies; 198+ messages in thread
From: Stillwell Jr, Paul M @ 2019-12-02 19:13 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z
  Cc: dev, Ye, Xiaolong, Rusinski, Mateusz

NACK, this code is not properly stripped and should not be released externally. Additionally, the commit message shouldn't mention anything about wrapping the code so if you want to include this you will need to re-write the commit message to make sense without mentioning wrapping the code.

Paul

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaolong Ye
> Sent: Sunday, December 1, 2019 11:49 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Rusinski, Mateusz
> <mateusz.rusinski@intel.com>
> Subject: [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED
> functionality
> 
> The previous code had the LED code wrapped such that, it was static to the
> file and not usable outside of it. It is now available.
> 
> Signed-off-by: Rusinski <mateusz.rusinski@intel.com>
> Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
> Reviewed-by: Michael Alice <alice.michael@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/i40e_common.c    | 10 ++++++++++
>  drivers/net/i40e/base/i40e_prototype.h |  7 ++++++-
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/base/i40e_common.c
> b/drivers/net/i40e/base/i40e_common.c
> index c655f3359..aebbd6004 100644
> --- a/drivers/net/i40e/base/i40e_common.c
> +++ b/drivers/net/i40e/base/i40e_common.c
> @@ -6950,8 +6950,13 @@ enum i40e_status_code
> i40e_blink_phy_link_led(struct i40e_hw *hw,
>   * @led_addr: LED register address
>   * @reg_val: read register value
>   **/
> +#ifndef LINUX_SUPPORT
> +enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16
> led_addr,
> +				       u32 *reg_val)
> +#else
>  static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16
> led_addr,
>  					      u32 *reg_val)
> +#endif
>  {
>  	enum i40e_status_code status;
>  	u8 phy_addr = 0;
> @@ -6979,8 +6984,13 @@ static enum i40e_status_code
> i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
>   * @led_addr: LED register address
>   * @reg_val: register value to write
>   **/
> +#ifndef LINUX_SUPPORT
> +enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16
> led_addr,
> +				       u32 reg_val)
> +#else
>  static enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16
> led_addr,
>  					      u32 reg_val)
> +#endif
>  {
>  	enum i40e_status_code status;
>  	u8 phy_addr = 0;
> diff --git a/drivers/net/i40e/base/i40e_prototype.h
> b/drivers/net/i40e/base/i40e_prototype.h
> index 65a5d3658..1b132b9b1 100644
> --- a/drivers/net/i40e/base/i40e_prototype.h
> +++ b/drivers/net/i40e/base/i40e_prototype.h
> @@ -73,7 +73,12 @@ enum i40e_status_code i40e_led_get_phy(struct
> i40e_hw *hw, u16 *led_addr,
>  				       u16 *val);
>  enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
>  					      u32 time, u32 interval);
> -
> +#ifndef LINUX_SUPPORT
> +enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16
> led_addr,
> +				       u32 *reg_val);
> +enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16
> led_addr,
> +				       u32 reg_val);
> +#endif
>  enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
>  					      struct i40e_hw_port_stats *stats);
> enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32
> *tx_counter,
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features Xiaolong Ye
@ 2019-12-02 19:14   ` Stillwell Jr, Paul M
  0 siblings, 0 replies; 198+ messages in thread
From: Stillwell Jr, Paul M @ 2019-12-02 19:14 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev, Ye, Xiaolong, Burra, Phani R

NACK, this code is not properly stripped and should not be released externally. Additionally, APF is NOT released and is only for Mt Evans and should not be in the code.

Paul

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaolong Ye
> Sent: Sunday, December 1, 2019 11:49 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Burra, Phani R
> <phani.r.burra@intel.com>
> Subject: [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header
> with advanced features
> 
> Updating the virtchnl header file with new interfaces. The new interfaces will
> support the split queue and advanced features. These new features are
> initially targeted for APF and CPF driver model. AVF also will enable the new
> features in future and use the advanced interfaces.
> 
> Signed-off-by: Phani R Burra <phani.r.burra@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Kirsher Jeffrey T <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/virtchnl.h | 511
> ++++++++++++++++++++++++++++++-
>  1 file changed, 509 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/base/virtchnl.h
> b/drivers/net/i40e/base/virtchnl.h
> index 0ea03d06b..c3495ab39 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -134,7 +134,34 @@ enum virtchnl_ops {
>  	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
>  	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
>  	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
> -
> +#ifdef VIRTCHNL_EXT_FEATURES
> +	/* New major set of opcodes introduced and so leaving room for
> +	* old misc opcodes to be added in future. Also these opcodes may
> only
> +	* be used if both the PF and VF have successfully negotiated the
> +	* VIRTCHNL_VF_CAP_EXT_FEATURES capability during initial
> capabilities
> +	* exchange.
> +	*/
> +       VIRTCHNL_OP_GET_CAPS = 100,
> +       VIRTCHNL_OP_CREATE_VPORT = 101,
> +       VIRTCHNL_OP_DESTROY_VPORT = 102,
> +       VIRTCHNL_OP_ENABLE_VPORT = 103,
> +       VIRTCHNL_OP_DISABLE_VPORT = 104,
> +       VIRTCHNL_OP_CONFIG_TX_QUEUES = 105,
> +       VIRTCHNL_OP_CONFIG_RX_QUEUES = 106,
> +       VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107,
> +       VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108,
> +       VIRTCHNL_OP_ADD_QUEUES = 109,
> +       VIRTCHNL_OP_DEL_QUEUES = 110,
> +       VIRTCHNL_OP_MAP_VECTOR_QUEUE = 111,
> +       VIRTCHNL_OP_UNMAP_VECTOR_QUEUE = 112,
> +       VIRTCHNL_OP_MAP_VECTOR_ITR = 113,
> +       VIRTCHNL_OP_GET_RSS_KEY = 114,
> +       VIRTCHNL_OP_GET_RSS_LUT = 115,
> +       VIRTCHNL_OP_GET_RSS_HASH = 116,
> +       VIRTCHNL_OP_SET_RSS_HASH = 117,
> +       VIRTCHNL_OP_CREATE_VFS = 118,
> +       VIRTCHNL_OP_DESTROY_VFS = 119,
> +#endif /* VIRTCHNL_EXT_FEATURES */
>  };
> 
>  /* These macros are used to generate compilation errors if a structure/union
> @@ -248,8 +275,10 @@ VIRTCHNL_CHECK_STRUCT_LEN(16,
> virtchnl_vsi_resource);
>  #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
>  #define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
>  /* Define below the capability flags that are not offloads */
> +#ifdef VIRTCHNL_EXT_FEATURES
> +#define VIRTCHNL_VF_CAP_EXT_FEATURES		0x01000000
> +#endif /* VIRTCHNL_EXT_FEATURES */
>  #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED		0x00000080
> -
>  #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
>  			       VIRTCHNL_VF_OFFLOAD_VLAN | \
>  			       VIRTCHNL_VF_OFFLOAD_RSS_PF)
> @@ -707,6 +736,362 @@ enum virtchnl_vfr_states {
>  	VIRTCHNL_VFR_VFACTIVE,
>  };
> 
> +#ifdef VIRTCHNL_EXT_FEATURES
> +/* PF capability flags
> + * VIRTCHNL_CAP_STATELESS_OFFLOADS flag indicates stateless offloads
> + * such as TX/RX Checksum offloading and TSO for non-tunneled packets.
> +Please
> + * note that old and new capabilities are exclusive and not supposed to
> +be
> + * mixed
> + */
> +#define VIRTCHNL_CAP_STATELESS_OFFLOADS	BIT(1)
> +#define VIRTCHNL_CAP_UDP_SEG_OFFLOAD	BIT(2)
> +#define VIRTCHNL_CAP_RSS		BIT(3)
> +#define VIRTCHNL_CAP_TCP_RSC		BIT(4)
> +#define VIRTCHNL_CAP_HEADER_SPLIT	BIT(5)
> +#define VIRTCHNL_CAP_RDMA		BIT(6)
> +#define VIRTCHNL_CAP_SRIOV		BIT(7)
> +/* Earliest Departure Time capability used for Timing Wheel */
> +#define VIRTCHNL_CAP_EDT		BIT(8)
> +
> +/* Type of virtual port */
> +enum virtchnl_vport_type {
> +	VIRTCHNL_VPORT_TYPE_DEFAULT	= 0,
> +};
> +
> +/* Type of queue model */
> +enum virtchnl_queue_model {
> +	VIRTCHNL_QUEUE_MODEL_SINGLE	= 0,
> +	VIRTCHNL_QUEUE_MODEL_SPLIT	= 1,
> +};
> +
> +/* TX and RX queue types are valid in legacy as well as split queue models.
> + * With Split Queue model, 2 additional types are introduced -
> +TX_COMPLETION
> + * and RX_BUFFER. In split queue model, RX corresponds to the queue
> +where HW
> + * posts completions.
> + */
> +enum virtchnl_queue_type {
> +	VIRTCHNL_QUEUE_TYPE_TX			= 0,
> +	VIRTCHNL_QUEUE_TYPE_RX			= 1,
> +	VIRTCHNL_QUEUE_TYPE_TX_COMPLETION	= 2,
> +	VIRTCHNL_QUEUE_TYPE_RX_BUFFER		= 3,
> +};
> +
> +/* RX Queue Feature bits */
> +#define VIRTCHNL_RXQ_RSC			BIT(1)
> +#define VIRTCHNL_RXQ_HDR_SPLIT			BIT(2)
> +#define VIRTCHNL_RXQ_IMMEDIATE_WRITE_BACK	BIT(4)
> +
> +/* RX Queue Descriptor Types */
> +enum virtchnl_rxq_desc_size {
> +	VIRTCHNL_RXQ_DESC_SIZE_16BYTE		= 0,
> +	VIRTCHNL_RXQ_DESC_SIZE_32BYTE		= 1,
> +};
> +
> +/* TX Queue Scheduling Modes  Queue mode is the legacy type i.e.
> +inorder
> + * and Flow mode is out of order packet processing  */ enum
> +virtchnl_txq_sched_mode {
> +	VIRTCHNL_TXQ_SCHED_MODE_QUEUE		= 0,
> +	VIRTCHNL_TXQ_SCHED_MODE_FLOW		= 1,
> +};
> +
> +/* Queue Descriptor Profiles  Base mode is the legacy and Native is the
> + * flex descriptors
> + */
> +enum virtchnl_desc_profile {
> +	VIRTCHNL_TXQ_DESC_PROFILE_BASE		= 0,
> +	VIRTCHNL_TXQ_DESC_PROFILE_NATIVE	= 1,
> +};
> +
> +/* Type of RSS algorithm */
> +enum virtchnl_rss_algorithm {
> +	VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC	= 0,
> +	VIRTCHNL_RSS_ALG_R_ASYMMETRIC		= 1,
> +	VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC	= 2,
> +	VIRTCHNL_RSS_ALG_XOR_SYMMETRIC		= 3,
> +};
> +
> +/* VIRTCHNL_OP_GET_CAPS
> + * PF sends this message to CP to negotiate capabilities by filling
> + * in the u64 bitmap of its desired capabilities.
> + * CP responds with an updated virtchnl_get_capabilities structure
> + * with allowed capabilities and possible max number of vfs it can create.
> + */
> +struct virtchnl_get_capabilities {
> +	u64 cap_flags;
> +	u16 max_num_vfs;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_get_capabilities);
> +
> +/* structure to specify a chunk of contiguous queues */ struct
> +virtchnl_queue_chunk {
> +	enum virtchnl_queue_type type;
> +	u16 start_queue_id;
> +	u16 num_queues;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_queue_chunk);
> +
> +/* structure to specify several chunks of contiguous queues */ struct
> +virtchnl_queue_chunks {
> +	u16 num_chunks;
> +	struct virtchnl_queue_chunk chunks[];
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_queue_chunks);
> +
> +/* VIRTCHNL_OP_CREATE_VPORT
> + * PF sends this message to CP to create a vport by filling in the
> +first 8
> + * fields of virtchnl_create_vport structure (vport type, tx, rx queue
> +models
> + * and desired number of queues and vectors). CP responds with the
> +updated
> + * virtchnl_create_vport structure containing the number of assigned
> +queues,
> + * vectors, vport id, max mtu, default mac addr followed by chunks
> +which in turn
> + * will have an array of num_chunks entries of virtchnl_queue_chunk
> structures.
> + */
> +struct virtchnl_create_vport {
> +	enum virtchnl_vport_type vport_type;
> +	/* single or split */
> +	enum virtchnl_queue_model txq_model;
> +	/* single or split */
> +	enum virtchnl_queue_model rxq_model;
> +	u16 num_tx_q;
> +	/* valid only if txq_model is split Q */
> +	u16 num_tx_complq;
> +	u16 num_rx_q;
> +	/* valid only if rxq_model is split Q */
> +	u16 num_rx_bufq;
> +	u16 num_vectors;
> +	u16 vport_id;
> +	u16 max_mtu;
> +	u8 default_mac_addr[ETH_ALEN];
> +	enum virtchnl_rss_algorithm rss_algorithm;
> +	u16 rss_key_size;
> +	u16 rss_lut_size;
> +	u16 qset_handle;
> +	struct virtchnl_queue_chunks chunks;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_create_vport);
> +
> +/* VIRTCHNL_OP_DESTROY_VPORT
> + * VIRTCHNL_OP_ENABLE_VPORT
> + * VIRTCHNL_OP_DISABLE_VPORT
> + * PF sends this message to CP to destroy, enable or disable a vport by
> +filling
> + * in the vport_id in virtchnl_vport structure.
> + * CP responds with the status of the requested operation.
> + */
> +struct virtchnl_vport {
> +	u16 vport_id;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(2, virtchnl_vport);
> +
> +/* Tx queue config info */
> +struct virtchnl_txq_info_v2 {
> +	u16 queue_id;
> +	/* single or split */
> +	enum virtchnl_queue_model model;
> +	/* tx or tx_completion */
> +	enum virtchnl_queue_type type;
> +	/* queue or flow based */
> +	enum virtchnl_txq_sched_mode sched_mode;
> +	/* base or native */
> +	enum virtchnl_desc_profile desc_profile;
> +	u16 ring_len;
> +	u64 dma_ring_addr;
> +	/* valid only if queue model is split and type is tx */
> +	u16 tx_compl_queue_id;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_txq_info_v2);
> +
> +/* VIRTCHNL_OP_CONFIG_TX_QUEUES
> + * PF sends this message to set up parameters for one or more TX queues.
> + * This message contains an array of num_qinfo instances of
> +virtchnl_txq_info_v2
> + * structures. CP configures requested queues and returns a status
> +code. If
> + * num_qinfo specified is greater than the number of queues associated
> +with the
> + * vport, an error is returned and no queues are configured.
> + */
> +struct virtchnl_config_tx_queues {
> +	u16 vport_id;
> +	u16 num_qinfo;
> +	struct virtchnl_txq_info_v2 txq_info[]; };
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_tx_queues);
> +
> +/* Rx queue config info */
> +struct virtchnl_rxq_info_v2 {
> +	u16 queue_id;
> +	/* single or split */
> +	enum virtchnl_queue_model model;
> +	/* rx or rx buffer */
> +	enum virtchnl_queue_type type;
> +	/* base or native */
> +	enum virtchnl_desc_profile desc_profile;
> +	/* rsc, header-split, immediate write back */
> +	u16 queue_flags;
> +	/* 16 or 32 byte */
> +	enum virtchnl_rxq_desc_size desc_size;
> +	u16 ring_len;
> +	u16 hdr_buffer_size;
> +	u32 data_buffer_size;
> +	u32 max_pkt_size;
> +	u64 dma_ring_addr;
> +	u64 dma_head_wb_addr;
> +	u16 rsc_low_watermark;
> +	u8 buffer_notif_stride;
> +	enum virtchnl_rx_hsplit rx_split_pos;
> +	/* valid only if queue model is split and type is rx buffer*/
> +	u16 rx_bufq1_id;
> +	/* valid only if queue model is split and type is rx buffer*/
> +	u16 rx_bufq2_id;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_rxq_info_v2);
> +
> +/* VIRTCHNL_OP_CONFIG_RX_QUEUES
> + * PF sends this message to set up parameters for one or more RX queues.
> + * This message contains an array of num_qinfo instances of
> +virtchnl_rxq_info_v2
> + * structures. CP configures requested queues and returns a status code.
> + * If the number of queues specified is greater than the number of
> +queues
> + * associated with the vport, an error is returned and no queues are
> configured.
> + */
> +struct virtchnl_config_rx_queues {
> +	u16 vport_id;
> +	u16 num_qinfo;
> +	struct virtchnl_rxq_info_v2 rxq_info[]; };
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_config_rx_queues);
> +
> +/* VIRTCHNL_OP_ADD_QUEUES
> + * PF sends this message to request additional TX/RX queues beyond the
> +ones
> + * that were assigned via CREATE_VPORT request. virtchnl_add_queues
> +structure is
> + * used to specify the number of each type of queues.
> + * CP responds with the same structure with the actual number of queues
> +assigned
> + * followed by num_chunks of virtchnl_queue_chunk structures.
> + */
> +struct virtchnl_add_queues {
> +	u16 vport_id;
> +	u16 num_tx_q;
> +	u16 num_tx_complq;
> +	u16 num_rx_q;
> +	u16 num_rx_bufq;
> +	struct virtchnl_queue_chunks chunks;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_add_queues);
> +
> +/* VIRTCHNL_OP_ENABLE_QUEUES
> + * VIRTCHNL_OP_DISABLE_QUEUES
> + * VIRTCHNL_OP_DEL_QUEUES
> + * PF sends these messages to enable, disable or delete queues
> +specified in
> + * chunks. PF sends virtchnl_del_ena_dis_queues struct to specify the
> +queues
> + * to be enabled/disabled/deleted. Also applicable to single queue RX
> +or
> + * TX. CP performs requested action and returns status.
> + */
> +struct virtchnl_del_ena_dis_queues {
> +	u16 vport_id;
> +	struct virtchnl_queue_chunks chunks;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_del_ena_dis_queues);
> +
> +/* Vector to Queue mapping */
> +struct virtchnl_vector_queue {
> +	u16 vector_id;
> +	u16 queue_id;
> +	enum virtchnl_queue_type queue_type;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_vector_queue);
> +
> +/* VIRTCHNL_OP_MAP_VECTOR_QUEUE
> + * VIRTCHNL_OP_UNMAP_VECTOR_QUEUE
> + * PF sends this message to map or unmap vectors to queues.
> + * This message contains an array of num_vector_queue_pairs instances
> +of
> + * virtchnl_vector_queue structures. CP configures interrupt mapping
> +and returns
> + * a status code. If the number of vectors specified is greater than
> +the number
> + * of vectors associated with the vport, an error is returned and no
> +vectors are
> + * mapped.
> + */
> +struct virtchnl_vector_queue_pairs {
> +	u16 vport_id;
> +	u16 num_vector_queue_pairs;
> +	struct virtchnl_vector_queue vq[];
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_queue_pairs);
> +
> +/* Vector to ITR index registers mapping */ struct virtchnl_vector_itr
> +{
> +	u16 vector_id;
> +	u16 rxitr_idx;
> +	u16 txitr_idx;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vector_itr);
> +
> +/* VIRTCHNL_OP_MAP_VECTOR_ITR
> + * PF sends this message to map vectors to RX and TX ITR index registers.
> + * This message contains an array of num_vector_itr_pairs instances of
> + * virtchnl_vector_itr structures. CP configures requested queues and
> +returns a
> + * status code. If the number of vectors specified is greater than the
> +number of
> + * vectors associated with the VSI, an error is returned and no vectors
> +are
> + * mapped.
> + */
> +struct virtchnl_vector_itr_pairs {
> +	u16 vport_id;
> +	u16 num_vector_itr_pairs;
> +	struct virtchnl_vector_itr vitr[];
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vector_itr_pairs);
> +
> +/* VIRTCHNL_OP_GET_RSS_LUT
> + * PF sends this message to get RSS lookup table. Only supported if
> + * both PF and CP drivers set the VIRTCHNL_CAP_RSS bit during
> +configuration
> + * negotiation. Uses the virtchnl_rss_lut structure  */
> +
> +/* VIRTCHNL_OP_GET_RSS_KEY
> + * PF sends this message to get RSS key. Only supported if
> + * both PF and CP drivers set the VIRTCHNL_CAP_RSS bit during
> +configuration
> + * negotiation. Used the virtchnl_rss_key structure  */
> +
> +/* VIRTCHNL_OP_GET_RSS_HASH
> + * VIRTCHNL_OP_SET_RSS_HASH
> + * PF sends these messages to get and set the hash filter enable bits for
> RSS.
> + * By default, the CP sets these to all possible traffic types that the
> + * hardware supports. The PF can query this value if it wants to change
> +the
> + * traffic types that are hashed by the hardware.
> + * Only supported if both PF and CP drivers set the VIRTCHNL_CAP_RSS
> +bit
> + * during configuration negotiation.
> + */
> +struct virtchnl_rss_hash {
> +	u16 vport_id;
> +	u64 hash;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_rss_hash);
> +
> +/* VIRTCHNL_OP_CREATE_SRIOV_VFS
> + * VIRTCHNL_OP_DESTROY_SRIOV_VFS
> + * This message is used to let the CP know how many SRIOV VFs need to
> +be
> + * created. The actual allocation of resources for the VFs in terms of
> +VSI,
> + * Queues and Interrupts is done by CP. When this call completes, the
> +APF driver
> + * calls pci_enable_sriov to let the OS instantiate the SRIOV PCIE devices.
> + */
> +struct virtchnl_sriov_vfs_info {
> +	u16 num_vfs;
> +};
> +
> +VIRTCHNL_CHECK_STRUCT_LEN(2, virtchnl_sriov_vfs_info);
> +
> +#endif /* VIRTCHNL_EXT_FEATURES */
>  /**
>   * virtchnl_vc_validate_vf_msg
>   * @ver: Virtchnl version info
> @@ -871,6 +1256,128 @@ virtchnl_vc_validate_vf_msg(struct
> virtchnl_version_info *ver, u32 v_opcode,
>  	case VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG:
>  		break;
>  #endif
> +#ifdef VIRTCHNL_EXT_FEATURES
> +	case VIRTCHNL_OP_GET_CAPS:
> +		valid_len = sizeof(struct virtchnl_get_capabilities);
> +		break;
> +	case VIRTCHNL_OP_CREATE_VPORT:
> +		valid_len = sizeof(struct virtchnl_create_vport);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_create_vport *cvport =
> +				(struct virtchnl_create_vport *)msg;
> +
> +			valid_len += cvport->chunks.num_chunks *
> +				      sizeof(struct virtchnl_queue_chunk);
> +		}
> +		break;
> +	case VIRTCHNL_OP_DESTROY_VPORT:
> +	case VIRTCHNL_OP_ENABLE_VPORT:
> +	case VIRTCHNL_OP_DISABLE_VPORT:
> +		valid_len = sizeof(struct virtchnl_vport);
> +		break;
> +	case VIRTCHNL_OP_CONFIG_TX_QUEUES:
> +		valid_len = sizeof(struct virtchnl_config_tx_queues);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_config_tx_queues *ctq =
> +				(struct virtchnl_config_tx_queues *)msg;
> +			if (ctq->num_qinfo == 0) {
> +				err_msg_format = true;
> +				break;
> +			}
> +			valid_len += ctq->num_qinfo *
> +				     sizeof(struct virtchnl_txq_info_v2);
> +		}
> +		break;
> +	case VIRTCHNL_OP_CONFIG_RX_QUEUES:
> +		valid_len = sizeof(struct virtchnl_config_rx_queues);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_config_rx_queues *crq =
> +				(struct virtchnl_config_rx_queues *)msg;
> +			if (crq->num_qinfo == 0) {
> +				err_msg_format = true;
> +				break;
> +			}
> +			valid_len += crq->num_qinfo *
> +				     sizeof(struct virtchnl_rxq_info_v2);
> +		}
> +		break;
> +	case VIRTCHNL_OP_ADD_QUEUES:
> +		valid_len = sizeof(struct virtchnl_add_queues);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_add_queues *add_q =
> +				(struct virtchnl_add_queues *)msg;
> +
> +			valid_len += add_q->chunks.num_chunks *
> +				      sizeof(struct virtchnl_queue_chunk);
> +		}
> +		break;
> +	case VIRTCHNL_OP_ENABLE_QUEUES_V2:
> +	case VIRTCHNL_OP_DISABLE_QUEUES_V2:
> +	case VIRTCHNL_OP_DEL_QUEUES:
> +		valid_len = sizeof(struct virtchnl_del_ena_dis_queues);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_del_ena_dis_queues *qs =
> +				(struct virtchnl_del_ena_dis_queues *)msg;
> +			if (qs->chunks.num_chunks == 0) {
> +				err_msg_format = true;
> +				break;
> +			}
> +			valid_len += qs->chunks.num_chunks *
> +				      sizeof(struct virtchnl_queue_chunk);
> +		}
> +		break;
> +	case VIRTCHNL_OP_MAP_VECTOR_QUEUE:
> +	case VIRTCHNL_OP_UNMAP_VECTOR_QUEUE:
> +		valid_len = sizeof(struct virtchnl_vector_queue_pairs);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_vector_queue_pairs *v_qp =
> +				(struct virtchnl_vector_queue_pairs *)msg;
> +			if (v_qp->num_vector_queue_pairs == 0) {
> +				err_msg_format = true;
> +				break;
> +			}
> +			valid_len += v_qp->num_vector_queue_pairs *
> +				      sizeof(struct virtchnl_vector_queue);
> +		}
> +		break;
> +	case VIRTCHNL_OP_MAP_VECTOR_ITR:
> +		valid_len = sizeof(struct virtchnl_vector_itr_pairs);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_vector_itr_pairs *v_itrp =
> +				(struct virtchnl_vector_itr_pairs *)msg;
> +			if (v_itrp->num_vector_itr_pairs == 0) {
> +				err_msg_format = true;
> +				break;
> +			}
> +			valid_len += v_itrp->num_vector_itr_pairs *
> +				      sizeof(struct virtchnl_vector_itr);
> +		}
> +		break;
> +	case VIRTCHNL_OP_GET_RSS_KEY:
> +		valid_len = sizeof(struct virtchnl_rss_key);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_rss_key *vrk =
> +				(struct virtchnl_rss_key *)msg;
> +			valid_len += vrk->key_len - 1;
> +		}
> +		break;
> +	case VIRTCHNL_OP_GET_RSS_LUT:
> +		valid_len = sizeof(struct virtchnl_rss_lut);
> +		if (msglen >= valid_len) {
> +			struct virtchnl_rss_lut *vrl =
> +				(struct virtchnl_rss_lut *)msg;
> +			valid_len += vrl->lut_entries - 1;
> +		}
> +		break;
> +	case VIRTCHNL_OP_GET_RSS_HASH:
> +	case VIRTCHNL_OP_SET_RSS_HASH:
> +		valid_len = sizeof(struct virtchnl_rss_hash);
> +		break;
> +	case VIRTCHNL_OP_CREATE_VFS:
> +	case VIRTCHNL_OP_DESTROY_VFS:
> +		valid_len = sizeof(struct virtchnl_sriov_vfs_info);
> +		break;
> +#endif /* VIRTCHNL_EXT_FEATURES */
>  	/* These are always errors coming from the VF. */
>  	case VIRTCHNL_OP_EVENT:
>  	case VIRTCHNL_OP_UNKNOWN:
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 00/36] update for i40e base code
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (68 preceding siblings ...)
  2019-12-02  7:49 ` [dpdk-dev] [PATCH 69/69] net/i40e/base: update version Xiaolong Ye
@ 2019-12-12 15:20 ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
                     ` (35 more replies)
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
  71 siblings, 36 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  Cc: dev, Xiaolong Ye

This series is to support FVL 7.2 release.

The main changes include:

* virtchnl updates
* add lldp support
* Flow director updates
* extend PHY access AQ cmd
* add reading LPI counters
* add support for Energy Efficient Ethernet
* A few fixes.

V2:

* strip some unnecessary code
* squash some fixes
* improve commit logs

Thanks,
Xiaolong


Xiaolong Ye (36):
  net/i40e/base: add support for feature flags
  net/i40e/base: increase max VSI count for VFs
  net/i40e/base: change buffer address
  net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  net/i40e/base: change misleading error message
  net/i40e/base: further implementation of LLDP
  net/i40e/base: add new device ids
  net/i40e/base: add check for MAC type
  net/i40e/base: adding flags for PHY types
  net/i40e/base: improve AQ log granularity
  net/i40e/base: add getter for FW LLDP agent status
  net/i40e/base: add support for Energy Efficient Ethernet
  net/i40e/base: read LPI status from external PHY
  net/i40e/base: change for missing "link modes"
  net/i40e/base: add reading LPI counters
  net/i40e/base: backport style changes from upstream Linux
  net/i40e/base: update status codes
  net/i40e/base: change of the incorrect Tx descriptors number
  net/i40e/base: extend PHY access AQ command
  net/i40e/base: add drop mode parameter to set MAC config
  net/i40e/base: add FWS1B register masks
  net/i40e/base: update FW API version
  net/i40e/base: add persistent lldp support
  net/i40e/base: make i40e_set_mac_type() public
  net/i40e/base: change retrying logic
  net/i40e/base: mark additional missing bits as reserved
  net/i40e/base: change wrong 'Advertised FEC modes'
  net/i40e/base: add Flow Director defines
  net/i40e/base: removed unreachable code
  net/i40e/base: set PHY Access flag on X722
  net/i40e/base: implement reading lpi statistics
  net/i40e/base: exposing missing LED functionality
  net/i40e/base: introduce firmware EMP reset register offsets
  net/i40e/base: add CRC stripping capability
  net/i40e/base: enable LED blinking flow
  net/i40e/base: add new link speed constants

 drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
 drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
 drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
 drivers/net/i40e/base/i40e_dcb.h        |  20 +-
 drivers/net/i40e/base/i40e_devids.h     |   4 +
 drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
 drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
 drivers/net/i40e/base/i40e_register.h   |  95 ++++
 drivers/net/i40e/base/i40e_type.h       |  39 +-
 drivers/net/i40e/base/virtchnl.h        |  32 +-
 drivers/net/i40e/i40e_ethdev.c          |  12 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 13 files changed, 1047 insertions(+), 323 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 01/36] net/i40e/base: add support for feature flags
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
                     ` (34 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Extend NVM Update API to support reporting of features
available for the tools.

This change is needed by NVM Update to determine if driver
supports changing NVM layout from structured to flat.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 11 ++++++++
 drivers/net/i40e/base/i40e_nvm.c    | 42 ++++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_type.h   | 22 +++++++++++++++
 3 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 37911a99e..cee6de2a8 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1014,6 +1014,17 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 	if (hw->mac.type == I40E_MAC_X722)
 		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
 			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+	/* NVMUpdate features structure initialization */
+	hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR;
+	hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR;
+	hw->nvmupd_features.size = sizeof(hw->nvmupd_features);
+	i40e_memset(hw->nvmupd_features.features, 0x0,
+		    I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN *
+		    sizeof(*hw->nvmupd_features.features),
+		    I40E_NONDMA_MEM);
+
+	/* No features supported at the moment */
+	hw->nvmupd_features.features[0] = 0;
 
 	status = i40e_init_nvm(hw);
 	return status;
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 6c8ca8771..c8b401cdd 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -797,6 +797,7 @@ STATIC const char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_EXEC_AQ",
 	"I40E_NVMUPD_GET_AQ_RESULT",
 	"I40E_NVMUPD_GET_AQ_EVENT",
+	"I40E_NVMUPD_GET_FEATURES",
 };
 
 /**
@@ -859,6 +860,31 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		return I40E_SUCCESS;
 	}
 
+	/*
+	 * A supported features request returns immediately
+	 * rather than going into state machine
+	 */
+	if (upd_cmd == I40E_NVMUPD_FEATURES) {
+		if (cmd->data_size < hw->nvmupd_features.size) {
+			*perrno = -EFAULT;
+			return I40E_ERR_BUF_TOO_SHORT;
+		}
+
+		/*
+		 * If buffer is bigger than i40e_nvmupd_features structure,
+		 * make sure the trailing bytes are set to 0x0.
+		 */
+		if (cmd->data_size > hw->nvmupd_features.size)
+			i40e_memset(bytes + hw->nvmupd_features.size, 0x0,
+				    cmd->data_size - hw->nvmupd_features.size,
+				    I40E_NONDMA_MEM);
+
+		i40e_memcpy(bytes, &hw->nvmupd_features,
+			    hw->nvmupd_features.size, I40E_NONDMA_MEM);
+
+		return I40E_SUCCESS;
+	}
+
 	/* Clear status even it is not read and log */
 	if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
@@ -1325,10 +1351,20 @@ STATIC enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 			upd_cmd = I40E_NVMUPD_READ_SA;
 			break;
 		case I40E_NVM_EXEC:
-			if (module == 0xf)
-				upd_cmd = I40E_NVMUPD_STATUS;
-			else if (module == 0)
+			switch (module) {
+			case I40E_NVM_EXEC_GET_AQ_RESULT:
 				upd_cmd = I40E_NVMUPD_GET_AQ_RESULT;
+				break;
+			case I40E_NVM_EXEC_FEATURES:
+				upd_cmd = I40E_NVMUPD_FEATURES;
+				break;
+			case I40E_NVM_EXEC_STATUS:
+				upd_cmd = I40E_NVMUPD_STATUS;
+				break;
+			default:
+				*perrno = -EFAULT;
+				return I40E_NVMUPD_INVALID;
+			}
 			break;
 		case I40E_NVM_AQE:
 			upd_cmd = I40E_NVMUPD_GET_AQ_EVENT;
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 06863d772..fcdf0eb29 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -478,6 +478,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_EXEC_AQ,
 	I40E_NVMUPD_GET_AQ_RESULT,
 	I40E_NVMUPD_GET_AQ_EVENT,
+	I40E_NVMUPD_FEATURES,
 };
 
 enum i40e_nvmupd_state {
@@ -513,6 +514,10 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_AQE				0xe
 #define I40E_NVM_EXEC				0xf
 
+#define I40E_NVM_EXEC_GET_AQ_RESULT		0x0
+#define I40E_NVM_EXEC_FEATURES			0xe
+#define I40E_NVM_EXEC_STATUS			0xf
+
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffffULL << I40E_NVM_ADAPT_SHIFT)
 
@@ -527,6 +532,20 @@ struct i40e_nvm_access {
 	u8 data[1];
 };
 
+/* NVMUpdate features API */
+#define I40E_NVMUPD_FEATURES_API_VER_MAJOR		0
+#define I40E_NVMUPD_FEATURES_API_VER_MINOR		14
+#define I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN	12
+
+#define I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT		BIT(0)
+
+struct i40e_nvmupd_features {
+	u8 major;
+	u8 minor;
+	u16 size;
+	u8 features[I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN];
+};
+
 /* (Q)SFP module access definitions */
 #define I40E_I2C_EEPROM_DEV_ADDR	0xA0
 #define I40E_I2C_EEPROM_DEV_ADDR2	0xA2
@@ -730,6 +749,9 @@ struct i40e_hw {
 	u16 first_tag;
 	u16 second_tag;
 
+	/* NVMUpdate features */
+	struct i40e_nvmupd_features nvmupd_features;
+
 	/* debug mask */
 	u32 debug_mask;
 	char err_str[16];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 02/36] net/i40e/base: increase max VSI count for VFs
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 03/36] net/i40e/base: change buffer address Xiaolong Ye
                     ` (33 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

For historical reasons, we allowed 3 VSIs per VF, but never used more
than one. Now with ADq, we can use up to 4 VSIs per VF, so change this
value to match.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index fcdf0eb29..0cbb13262 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -38,7 +38,7 @@
 #define I40E_MAX_PF_VSI			64
 #define I40E_MAX_PF_QP			128
 #define I40E_MAX_VSI_QP			16
-#define I40E_MAX_VF_VSI			3
+#define I40E_MAX_VF_VSI			4
 #define I40E_MAX_CHAINED_RX_BUFFERS	5
 #define I40E_MAX_PF_UDP_OFFLOAD_PORTS	16
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 03/36] net/i40e/base: change buffer address
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
                     ` (32 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The high 32-bits were being set incorrectly in the 'Set Local LLDP MIB'
AQ command (0x0A08). Change it to use the right macro to get the correct
bits.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index cee6de2a8..0b26f86c5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4311,7 +4311,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 
 	cmd->type = mib_type;
 	cmd->length = CPU_TO_LE16(buff_size);
-	cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff));
+	cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff));
 	cmd->address_low =  CPU_TO_LE32(I40E_LO_DWORD((u64)buff));
 
 	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (2 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 03/36] net/i40e/base: change buffer address Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 05/36] net/i40e/base: change misleading error message Xiaolong Ye
                     ` (31 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

There is a need to enable MIB change event, not at the same time as
init_dcb. This patch will serve this requirement.

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 28 +++++++++++-----------------
 drivers/net/i40e/base/i40e_dcb.h |  3 ++-
 drivers/net/i40e/i40e_ethdev.c   |  4 ++--
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index a26f82b3a..7cc8c83dc 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -863,22 +863,23 @@ enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw)
 /**
  * i40e_init_dcb
  * @hw: pointer to the hw struct
+ * @enable_mib_change: enable mib change event
  *
  * Update DCB configuration from the Firmware
  **/
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 {
 	enum i40e_status_code ret = I40E_SUCCESS;
 	struct i40e_lldp_variables lldp_cfg;
 	u8 adminstatus = 0;
 
 	if (!hw->func_caps.dcb)
-		return ret;
+		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
 	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
 	if (ret)
-		return ret;
+		return I40E_ERR_NOT_READY;
 
 	/* Get the LLDP AdminStatus for the current port */
 	adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
@@ -887,7 +888,7 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 	/* LLDP agent disabled */
 	if (!adminstatus) {
 		hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
-		return ret;
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Get DCBX status */
@@ -896,26 +897,19 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 		return ret;
 
 	/* Check the DCBX Status */
-	switch (hw->dcbx_status) {
-	case I40E_DCBX_STATUS_DONE:
-	case I40E_DCBX_STATUS_IN_PROGRESS:
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+	    hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
 		/* Get current DCBX configuration */
 		ret = i40e_get_dcb_config(hw);
 		if (ret)
 			return ret;
-		break;
-	case I40E_DCBX_STATUS_DISABLED:
-		return ret;
-	case I40E_DCBX_STATUS_NOT_STARTED:
-	case I40E_DCBX_STATUS_MULTIPLE_PEERS:
-	default:
-		break;
+	} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Configure the LLDP MIB change event */
-	ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
-	if (ret)
-		return ret;
+	if (enable_mib_change)
+		ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
 
 	return ret;
 }
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 85b0eed3a..253943308 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -186,7 +186,8 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 					     u8 bridgetype,
 					     struct i40e_dcbx_config *dcbcfg);
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw);
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
+				    bool enable_mib_change);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5999c964b..765d9b495 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11582,7 +11582,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
 		 * i40e_init_dcb we expect is failure with I40E_AQ_RC_EPERM
 		 * adminq status. Otherwise, it should return success.
@@ -11630,7 +11630,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		if (!ret) {
 			if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
 				PMD_INIT_LOG(ERR,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 05/36] net/i40e/base: change misleading error message
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (3 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
                     ` (30 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This patch changes an error code for an admin queue head overrun to use
I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 38214a373..b2fc6f590 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -835,7 +835,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	if (val >= hw->aq.num_asq_entries) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
 			   "AQTX: head overrun at %d\n", val);
-		status = I40E_ERR_QUEUE_EMPTY;
+		status = I40E_ERR_ADMIN_QUEUE_FULL;
 		goto asq_send_command_error;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 06/36] net/i40e/base: further implementation of LLDP
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (4 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 05/36] net/i40e/base: change misleading error message Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 07/36] net/i40e/base: add new device ids Xiaolong Ye
                     ` (29 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This code implements shared code changes necessary for LLDP Agent
support.

1. Modified i40e_aq_start_lldp and i40e_aq_stop_lldp. Now Stop and Start
can also be persistent across power cycles.
2. Added new function i40e_aq_restore_lldp which restores factory
setting for LLDP Agent or gets its status.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  19 ++-
 drivers/net/i40e/base/i40e_common.c     | 173 ++++++------------------
 drivers/net/i40e/base/i40e_prototype.h  |  18 +--
 drivers/net/i40e/base/i40e_type.h       |   1 +
 drivers/net/i40e/i40e_ethdev.c          |   4 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 6 files changed, 67 insertions(+), 152 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index b459be921..a89b88fa5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -265,6 +265,7 @@ enum i40e_admin_queue_opc {
 	i40e_aqc_opc_get_cee_dcb_cfg	= 0x0A07,
 	i40e_aqc_opc_lldp_set_local_mib	= 0x0A08,
 	i40e_aqc_opc_lldp_stop_start_spec_agent	= 0x0A09,
+	i40e_aqc_opc_lldp_restore		= 0x0A0A,
 
 	/* Tunnel commands */
 	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
@@ -2554,8 +2555,9 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
 /* Stop LLDP (direct 0x0A05) */
 struct i40e_aqc_lldp_stop {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_STOP		0x0
-#define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
+#define I40E_AQ_LLDP_AGENT_STOP			0x0
+#define I40E_AQ_LLDP_AGENT_SHUTDOWN		0x1
+#define I40E_AQ_LLDP_AGENT_STOP_PERSIST		0x2
 	u8	reserved[15];
 };
 
@@ -2565,7 +2567,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
 
 struct i40e_aqc_lldp_start {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_START	0x1
+#define I40E_AQ_LLDP_AGENT_START		0x1
+#define I40E_AQ_LLDP_AGENT_START_PERSIST	0x2
 	u8	reserved[15];
 };
 
@@ -2685,6 +2688,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent);
 
+/* Restore LLDP Agent factory settings (direct 0x0A0A) */
+struct i40e_aqc_lldp_restore {
+	u8	command;
+#define I40E_AQ_LLDP_AGENT_RESTORE_NOT		0x0
+#define I40E_AQ_LLDP_AGENT_RESTORE		0x1
+	u8	reserved[15];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore);
+
 /* Add Udp Tunnel command and completion (direct 0x0B00) */
 struct i40e_aqc_add_udp_tunnel {
 	__le16	udp_port;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 0b26f86c5..8ebf8b856 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4347,151 +4347,39 @@ enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 }
 
 /**
- * i40e_aq_add_lldp_tlv
+ * i40e_aq_restore_lldp
  * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to add
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be added
- * @mib_len: length of the LLDP MIB returned in response
+ * @setting: pointer to factory setting variable or NULL
+ * @restore: True if factory settings should be restored
  * @cmd_details: pointer to command details structure or NULL
  *
- * Add the specified TLV to LLDP Local MIB for the given bridge type,
- * it is responsibility of the caller to make sure that the TLV is not
- * already present in the LLDPDU.
- * In return firmware will write the complete LLDP MIB with the newly
- * added TLV in the response buffer.
+ * Restore LLDP Agent factory settings if @restore set to True. In other case
+ * only returns factory setting in AQ response.
  **/
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff || tlv_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_add_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->len = CPU_TO_LE16(tlv_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
-
-	return status;
-}
-
-/**
- * i40e_aq_update_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to update
- * @buff_size: size of the buffer holding original and updated TLVs
- * @old_len: Length of the Original TLV
- * @new_len: Length of the Updated TLV
- * @offset: offset of the updated TLV in the buff
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Update the specified TLV to the LLDP Local MIB for the given bridge type.
- * Firmware will place the complete LLDP MIB in response buffer with the
- * updated TLV.
- **/
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_update_tlv *cmd =
-		(struct i40e_aqc_lldp_update_tlv *)&desc.params.raw;
+	struct i40e_aqc_lldp_restore *cmd =
+		(struct i40e_aqc_lldp_restore *)&desc.params.raw;
 	enum i40e_status_code status;
 
-	if (buff_size == 0 || !buff || offset == 0 ||
-	    old_len == 0 || new_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_update_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->old_len = CPU_TO_LE16(old_len);
-	cmd->new_offset = CPU_TO_LE16(offset);
-	cmd->new_len = CPU_TO_LE16(new_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
+	if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) {
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Restore LLDP not supported by current FW version.\n");
+		return I40E_ERR_DEVICE_NOT_SUPPORTED;
 	}
 
-	return status;
-}
-
-/**
- * i40e_aq_delete_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: pointer to a user supplied buffer that has the TLV
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be deleted
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Delete the specified TLV from LLDP Local MIB for the given bridge type.
- * The firmware places the entire LLDP MIB in the response buffer.
- **/
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff)
-		return I40E_ERR_PARAM;
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_restore);
 
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_delete_tlv);
+	if (restore)
+		cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE;
 
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-	cmd->len = CPU_TO_LE16(tlv_len);
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
+	if (setting)
+		*setting = cmd->command & 1;
 
 	return status;
 }
@@ -4500,11 +4388,13 @@ enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
  * i40e_aq_stop_lldp
  * @hw: pointer to the hw struct
  * @shutdown_agent: True if LLDP Agent needs to be Shutdown
+ * @persist: True if stop of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Stop or Shutdown the embedded LLDP Agent
  **/
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4517,6 +4407,14 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 	if (shutdown_agent)
 		cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN;
 
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Stop LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
@@ -4525,11 +4423,13 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 /**
  * i40e_aq_start_lldp
  * @hw: pointer to the hw struct
+ * @persist: True if start of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Start the embedded LLDP Agent on all ports.
  **/
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4540,6 +4440,15 @@ enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
 	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_start);
 
 	cmd->command = I40E_AQ_LLDP_AGENT_START;
+
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Start LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0cf006dad..2f3e0bfee 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -251,26 +251,18 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 				bool enable_update,
 				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
 						 bool dcb_enable,
 						 struct i40e_asq_cmd_details
 						 *cmd_details);
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
 				void *buff, u16 buff_size,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 0cbb13262..322300fa3 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -742,6 +742,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
+#define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 765d9b495..26843584e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11577,7 +11577,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 */
 	if (sw_dcb == TRUE) {
 		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
+			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
@@ -11626,7 +11626,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 			return -ENOTSUP;
 		}
 	} else {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index fdcb1a43e..b64f55341 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1409,7 +1409,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Disable DCBx if it's the first time to set strict priority. */
 	if (!veb->strict_prio_tc) {
-		ret = i40e_aq_stop_lldp(hw, true, NULL);
+		ret = i40e_aq_stop_lldp(hw, true, true, NULL);
 		if (ret)
 			PMD_DRV_LOG(INFO,
 				    "Failed to disable DCBx as it's already"
@@ -1464,7 +1464,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Enable DCBx again, if all the TCs' strict priority disabled. */
 	if (!tc_map) {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret) {
 			PMD_DRV_LOG(ERR,
 				    "Failed to enable DCBx, err(%d).", ret);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 07/36] net/i40e/base: add new device ids
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (5 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
                     ` (28 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

New device ids are created to support SFP+ and backplane connections.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 ++
 drivers/net/i40e/base/i40e_devids.h | 2 ++
 drivers/net/i40e/i40e_ethdev.c      | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8ebf8b856..73d0c29fd 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -36,6 +36,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
 		case I40E_DEV_ID_10G_BASE_T:
 		case I40E_DEV_ID_10G_BASE_T4:
 		case I40E_DEV_ID_10G_BASE_T_BC:
+		case I40E_DEV_ID_10G_B:
+		case I40E_DEV_ID_10G_SFP:
 		case I40E_DEV_ID_20G_KR2:
 		case I40E_DEV_ID_20G_KR2_A:
 		case I40E_DEV_ID_25G_B:
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index f3c59bdea..1700db17a 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -36,6 +36,8 @@
 #define I40E_DEV_ID_X722_A0_VF		0x374D
 #endif
 #endif
+#define I40E_DEV_ID_10G_B		0x104F
+#define I40E_DEV_ID_10G_SFP		0x104E
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 26843584e..b93c56e46 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -443,6 +443,8 @@ static const struct rte_pci_id pci_id_i40e_map[] = {
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_XXV710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_BC) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_B) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_SFP) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 08/36] net/i40e/base: add check for MAC type
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (6 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 07/36] net/i40e/base: add new device ids Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
                     ` (27 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Some features were introduced in different FW API version on XL710 and X722
MACs. Others are available only on specific MAC type. Make sure that they
are properly assigned. Also fix the style issues reported by current
check-patch.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 68 +++++++----------------------
 1 file changed, 16 insertions(+), 52 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b2fc6f590..b8c6e30f5 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -582,25 +582,22 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
  **/
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
-#ifdef PF_DRIVER
+	struct i40e_adminq_info *aq = &hw->aq;
+	enum i40e_status_code ret_code;
 	u16 cfg_ptr, oem_hi, oem_lo;
 	u16 eetrack_lo, eetrack_hi;
-#endif
-	enum i40e_status_code ret_code;
-#ifdef PF_DRIVER
 	int retry = 0;
-#endif
 
 	/* verify input for valid configuration */
-	if ((hw->aq.num_arq_entries == 0) ||
-	    (hw->aq.num_asq_entries == 0) ||
-	    (hw->aq.arq_buf_size == 0) ||
-	    (hw->aq.asq_buf_size == 0)) {
+	if (aq->num_arq_entries == 0 ||
+	    aq->num_asq_entries == 0 ||
+	    aq->arq_buf_size == 0 ||
+	    aq->asq_buf_size == 0) {
 		ret_code = I40E_ERR_CONFIG;
 		goto init_adminq_exit;
 	}
-	i40e_init_spinlock(&hw->aq.asq_spinlock);
-	i40e_init_spinlock(&hw->aq.arq_spinlock);
+	i40e_init_spinlock(&aq->asq_spinlock);
+	i40e_init_spinlock(&aq->arq_spinlock);
 
 	/* Set up register offsets */
 	i40e_adminq_init_regs(hw);
@@ -618,23 +615,17 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_asq;
 
-#ifdef PF_DRIVER
-#ifdef INTEGRATED_VF
-	/* VF has no need of firmware */
-	if (i40e_is_vf(hw))
-		goto init_adminq_exit;
-#endif
 	/* There are some cases where the firmware may not be quite ready
 	 * for AdminQ operations, so we retry the AdminQ setup a few times
 	 * if we see timeouts in this first AQ call.
 	 */
 	do {
 		ret_code = i40e_aq_get_firmware_version(hw,
-							&hw->aq.fw_maj_ver,
-							&hw->aq.fw_min_ver,
-							&hw->aq.fw_build,
-							&hw->aq.api_maj_ver,
-							&hw->aq.api_min_ver,
+							&aq->fw_maj_ver,
+							&aq->fw_min_ver,
+							&aq->fw_build,
+							&aq->api_maj_ver,
+							&aq->api_min_ver,
 							NULL);
 		if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT)
 			break;
@@ -658,31 +649,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 			   &oem_lo);
 	hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo;
 
-	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 7)))
-		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
-
-	if (hw->mac.type == I40E_MAC_XL710 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
-		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-	if (hw->mac.type == I40E_MAC_X722 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-
-	/* Newer versions of firmware require lock when reading the NVM */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 5)))
-		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
-
-	if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
+	if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
 	}
@@ -692,21 +659,18 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	hw->nvm_release_on_done = false;
 	hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
 
-#endif /* PF_DRIVER */
 	ret_code = I40E_SUCCESS;
 
 	/* success! */
 	goto init_adminq_exit;
 
-#ifdef PF_DRIVER
 init_adminq_free_arq:
 	i40e_shutdown_arq(hw);
-#endif
 init_adminq_free_asq:
 	i40e_shutdown_asq(hw);
 init_adminq_destroy_spinlocks:
-	i40e_destroy_spinlock(&hw->aq.asq_spinlock);
-	i40e_destroy_spinlock(&hw->aq.arq_spinlock);
+	i40e_destroy_spinlock(&aq->asq_spinlock);
+	i40e_destroy_spinlock(&aq->arq_spinlock);
 
 init_adminq_exit:
 	return ret_code;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 09/36] net/i40e/base: adding flags for PHY types
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (7 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
                     ` (26 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Adding bit flags to enable/disable EEE capability for 2.5GBase-T and
5GBase-T PHY types as well as 'Set autonomous EEE for relevant enabled PHY
types' flag.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index a89b88fa5..2bd8f81f9 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2027,12 +2027,15 @@ struct i40e_aq_get_phy_abilities_resp {
 #define I40E_AQ_PHY_FEC_ABILITY_KR	0x40
 #define I40E_AQ_PHY_FEC_ABILITY_RS	0x80
 	__le16	eee_capability;
+#define I40E_AQ_EEE_AUTO		0x0001
 #define I40E_AQ_EEE_100BASE_TX		0x0002
 #define I40E_AQ_EEE_1000BASE_T		0x0004
 #define I40E_AQ_EEE_10GBASE_T		0x0008
 #define I40E_AQ_EEE_1000BASE_KX		0x0010
 #define I40E_AQ_EEE_10GBASE_KX4		0x0020
 #define I40E_AQ_EEE_10GBASE_KR		0x0040
+#define I40E_AQ_EEE_2_5GBASE_T		0x0100
+#define I40E_AQ_EEE_5GBASE_T		0x0200
 	__le32	eeer_val;
 	u8	d3_lpan;
 #define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 10/36] net/i40e/base: improve AQ log granularity
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (8 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
                     ` (25 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This patch makes it possible to log only AQ descriptors, without the
entire AQ message buffers being dumped too. It should greatly reduce
kernel log size in cases where a full AQ dump is not needed.
Selection is made by setting flags in hw->debug_mask.

Additionally, some debug messages that preceded an AQ dump have been
moved to I40E_DEBUG_AQ_COMMAND class, which seems more appropriate.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c |  8 ++++----
 drivers/net/i40e/base/i40e_common.c | 19 ++++++++++++-------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b8c6e30f5..52bea842f 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -715,7 +715,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
 	desc = I40E_ADMINQ_DESC(*asq, ntc);
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
-		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+		i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
@@ -887,7 +887,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	}
 
 	/* bump the tail */
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,
 		      buff, buff_size);
 	(hw->aq.asq.next_to_use)++;
@@ -940,7 +940,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 		hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
 	}
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 		   "AQTX: desc and buffer writeback:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);
 
@@ -1069,7 +1069,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
 			    hw->aq.arq.r.arq_bi[desc_idx].va,
 			    e->msg_len, I40E_DMA_TO_NONDMA);
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,
 		      hw->aq.arq_buf_size);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 73d0c29fd..4384a0795 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -307,32 +307,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 		   void *buffer, u16 buf_len)
 {
 	struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
+	u32 effective_mask = hw->debug_mask & mask;
 	u8 *buf = (u8 *)buffer;
 	u16 len;
-	u16 i = 0;
+	u16 i;
 
-	if ((!(mask & hw->debug_mask)) || (desc == NULL))
+	if (!effective_mask || !desc)
 		return;
 
 	len = LE16_TO_CPU(aq_desc->datalen);
 
-	i40e_debug(hw, mask,
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
 		   "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
 		   LE16_TO_CPU(aq_desc->opcode),
 		   LE16_TO_CPU(aq_desc->flags),
 		   LE16_TO_CPU(aq_desc->datalen),
 		   LE16_TO_CPU(aq_desc->retval));
-	i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tcookie (h,l) 0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->cookie_high),
 		   LE32_TO_CPU(aq_desc->cookie_low));
-	i40e_debug(hw, mask, "\tparam (0,1)  0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tparam (0,1)  0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.internal.param0),
 		   LE32_TO_CPU(aq_desc->params.internal.param1));
-	i40e_debug(hw, mask, "\taddr (h,l)   0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\taddr (h,l)   0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.external.addr_high),
 		   LE32_TO_CPU(aq_desc->params.external.addr_low));
 
-	if ((buffer != NULL) && (aq_desc->datalen != 0)) {
+	if (buffer && (buf_len != 0) && (len != 0) &&
+	    (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
 		i40e_debug(hw, mask, "AQ CMD Buffer:\n");
 		if (buf_len < len)
 			len = buf_len;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 11/36] net/i40e/base: add getter for FW LLDP agent status
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (9 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
@ 2019-12-12 15:20   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
                     ` (24 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:20 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This change introduces i40e_get_fw_lldp_status() function capable of
reporting status of FW Link Layer Discovery Protocol (LLDP) agent.

Since reading LLDP configuration from NVM only gives information what
is the default state of FW LLDP agent after POR, this change introduces
more reliable method for checking if agent is enabled.

Current state of FW LLDP agent may be different if user disabled the
agent, so i40e_get_fw_lldp_status() uses LLDP MIB checking to determine
status of the agent.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 43 ++++++++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_dcb.h |  9 +++++++
 2 files changed, 52 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 7cc8c83dc..f1465daa3 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -914,6 +914,49 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 	return ret;
 }
 
+/**
+ * i40e_get_fw_lldp_status
+ * @hw: pointer to the hw struct
+ * @lldp_status: pointer to the status enum
+ *
+ * Get status of FW Link Layer Discovery Protocol (LLDP) Agent.
+ * Status of agent is reported via @lldp_status parameter.
+ **/
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status)
+{
+	enum i40e_status_code ret;
+	struct i40e_virt_mem mem;
+	u8 *lldpmib;
+
+	if (!lldp_status)
+		return I40E_ERR_PARAM;
+
+	/* Allocate buffer for the LLDPDU */
+	ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE);
+	if (ret)
+		return ret;
+
+	lldpmib = (u8 *)mem.va;
+	ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib,
+				   I40E_LLDPDU_SIZE, NULL, NULL, NULL);
+
+	if (ret == I40E_SUCCESS) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) {
+		/* MIB is not available yet but the agent is running */
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+		ret = I40E_SUCCESS;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED;
+		ret = I40E_SUCCESS;
+	}
+
+	i40e_free_virt_mem(hw, &mem);
+	return ret;
+}
+
 /**
  * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
  * @tlv: Fill the ETS config data in IEEE format
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 253943308..88fe405d7 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -178,6 +178,12 @@ struct i40e_dcbx_variables {
 	u32 deftsaassignment;
 };
 
+
+enum i40e_get_fw_lldp_status_resp {
+	I40E_GET_FW_LLDP_STATUS_DISABLED = 0,
+	I40E_GET_FW_LLDP_STATUS_ENABLED = 1
+};
+
 enum i40e_status_code i40e_get_dcbx_status(struct i40e_hw *hw,
 					   u16 *status);
 enum i40e_status_code i40e_lldp_to_dcb_config(u8 *lldpmib,
@@ -188,6 +194,9 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
 				    bool enable_mib_change);
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 12/36] net/i40e/base: add support for Energy Efficient Ethernet
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (10 preceding siblings ...)
  2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
                     ` (23 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This change adds i40e_enable_eee() function controlling advertisement
of Energy Efficient Ethernet mode (EEE).

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 64 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 2 files changed, 65 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4384a0795..c2e7cf7d5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6306,6 +6306,70 @@ enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
 	return status;
 }
 
+
+/**
+ * i40e_enable_eee
+ * @hw: pointer to the hardware structure
+ * @enable: state of Energy Efficient Ethernet mode to be set
+ *
+ * Enables or disables Energy Efficient Ethernet (EEE) mode
+ * accordingly to @enable parameter.
+ **/
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable)
+{
+	struct i40e_aq_get_phy_abilities_resp abilities;
+	struct i40e_aq_set_phy_config config;
+	enum i40e_status_code status;
+	__le16 eee_capability;
+
+	/* Get initial PHY capabilities */
+	status = i40e_aq_get_phy_capabilities(hw, false, true, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Check whether NIC configuration is compatible with Energy Efficient
+	 * Ethernet (EEE) mode.
+	 */
+	if (abilities.eee_capability == 0) {
+		status = I40E_ERR_CONFIG;
+		goto err;
+	}
+
+	/* Cache initial EEE capability */
+	eee_capability = abilities.eee_capability;
+
+	/* Get current configuration */
+	status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Cache current configuration */
+	config.phy_type = abilities.phy_type;
+	config.link_speed = abilities.link_speed;
+	config.abilities = abilities.abilities |
+			   I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	config.eeer = abilities.eeer_val;
+	config.low_power_ctrl = abilities.d3_lpan;
+	config.fec_config = abilities.fec_cfg_curr_mod_ext_info &
+			    I40E_AQ_PHY_FEC_CONFIG_MASK;
+
+	/* Set desired EEE state */
+	if (enable) {
+		config.eee_capability = eee_capability;
+		config.eeer |= I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	} else {
+		config.eee_capability = 0;
+		config.eeer &= ~I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	}
+
+	/* Save modified config */
+	status = i40e_aq_set_phy_config(hw, &config, NULL);
+err:
+	return status;
+}
+
 /**
  * i40e_read_bw_from_alt_ram
  * @hw: pointer to the hardware structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2f3e0bfee..38beb270b 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -458,6 +458,7 @@ void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode,
 void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
 #if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 13/36] net/i40e/base: read LPI status from external PHY
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (11 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
                     ` (22 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

When external PHY is used, MAC register may not reflect actual
state of LPI. Add function reading it directly from PHY or MAC,
depending on what is supported by the device.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 45 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  2 ++
 drivers/net/i40e/base/i40e_type.h      |  6 ++++
 3 files changed, 53 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c2e7cf7d5..f256651d7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6982,6 +6982,51 @@ enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
 	return status;
 }
 #endif /* PF_DRIVER */
+/**
+ * i40e_get_phy_lpi_status - read LPI status from PHY or MAC register
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ *
+ * Read LPI state directly from external PHY register or from MAC
+ * register, depending on device ID and current link speed.
+ */
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stat)
+{
+	enum i40e_status_code ret = I40E_SUCCESS;
+	u32 val;
+
+	stat->rx_lpi_status = 0;
+	stat->tx_lpi_status = 0;
+
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB ||
+	     hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) {
+		ret = i40e_aq_get_phy_register(hw,
+					       I40E_AQ_PHY_REG_ACCESS_EXTERNAL,
+					       I40E_BCM_PHY_PCS_STATUS1_PAGE,
+					       true,
+					       I40E_BCM_PHY_PCS_STATUS1_REG,
+					       &val, NULL);
+
+		if (ret != I40E_SUCCESS)
+			return ret;
+
+		stat->rx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_RX_LPI);
+		stat->tx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_TX_LPI);
+
+		return ret;
+	}
+
+	val = rd32(hw, I40E_PRTPM_EEE_STAT);
+	stat->rx_lpi_status = (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
+	stat->tx_lpi_status = (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
+
+	return ret;
+}
+
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 38beb270b..c6c45eb5a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -74,6 +74,8 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
 
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stats);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 322300fa3..8d257e00a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -2038,4 +2038,10 @@ struct i40e_profile_info {
 	u8 reserved[7];
 	u8 name[I40E_DDP_NAME_SIZE];
 };
+
+#define I40E_BCM_PHY_PCS_STATUS1_PAGE	0x3
+#define I40E_BCM_PHY_PCS_STATUS1_REG	0x0001
+#define I40E_BCM_PHY_PCS_STATUS1_RX_LPI	BIT(8)
+#define I40E_BCM_PHY_PCS_STATUS1_TX_LPI	BIT(9)
+
 #endif /* _I40E_TYPE_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 14/36] net/i40e/base: change for missing "link modes"
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (12 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
                     ` (21 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Fix for missing "Supported link modes" and "Advertised link modes"
info in ethtool after changed speed on X722 devices with BASE-T PHY
with FW API version >= 1.7.
The same FW API version on X710 and X722 does not mean the same
feature set so the change was needed as mac type of the device
should also be checked instead of FW API version only.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index f256651d7..e0028ac4d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2043,8 +2043,8 @@ 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) {
+	if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE &&
+	    hw->mac.type != I40E_MAC_X722) {
 		__le32 tmp;
 
 		i40e_memcpy(&tmp, resp->link_type, sizeof(tmp),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 15/36] net/i40e/base: add reading LPI counters
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (13 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
                     ` (20 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This change introduces new function i40e_get_lpi_counters() reading
Low Power Idle (LPI) mode counters from Energy Efficient Ethernet (EEE)
statistics. Since reading EEE statistics requires running DNL script,
function i40e_aq_run_phy_activity() able to run it, was implemented.

i40e_lpi_stat_update() was introduced as helper function for retrieving
LPI counters' values relative to given offsets.

This change also fixes order of fields in struct
i40e_aqc_run_phy_activity and introduces union in the struct
providing more descriptive names of fields depending on usage
(command or response).

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  29 ++++--
 drivers/net/i40e/base/i40e_common.c     | 130 ++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  10 ++
 3 files changed, 163 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2bd8f81f9..d718c7326 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2272,15 +2272,32 @@ enum i40e_aq_phy_reg_type {
 	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
 };
 
+#pragma pack(1)
 /* Run PHY Activity (0x0626) */
 struct i40e_aqc_run_phy_activity {
-	__le16  activity_id;
-	u8      flags;
-	u8      reserved1;
-	__le32  control;
-	__le32  data;
-	u8      reserved2[4];
+	u8	cmd_flags;
+	__le16	activity_id;
+#define I40E_AQ_RUN_PHY_ACT_ID_USR_DFND			0x10
+	u8	reserved;
+	union {
+		struct {
+			__le32  dnl_opcode;
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR	0x801a
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR	0x1801b
+			__le32  data;
+			u8	reserved2[4];
+		} cmd;
+		struct {
+			__le32	cmd_status;
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK		0xFFFF
+			__le32	data0;
+			__le32	data1;
+		} resp;
+	} params;
 };
+#pragma pack()
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index e0028ac4d..9d76b6824 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7027,6 +7027,91 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 	return ret;
 }
 
+/**
+ * i40e_get_lpi_counters - read LPI counters from EEE statistics
+ * @hw: pointer to the hw struct
+ * @tx_counter: pointer to memory for TX LPI counter
+ * @rx_counter: pointer to memory for RX LPI counter
+ * @is_clear:   returns true if counters are clear after read
+ *
+ * Read Low Power Idle (LPI) mode counters from Energy Efficient
+ * Ethernet (EEE) statistics.
+ **/
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
+					    u32 *tx_counter, u32 *rx_counter,
+					    bool *is_clear)
+{
+	/* only X710-T*L requires special handling of counters
+	 * for other devices we just read the MAC registers
+	 */
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    hw->phy.link_info.link_speed != I40E_LINK_SPEED_1GB) {
+		enum i40e_status_code retval;
+		u32 cmd_status = 0;
+
+		*is_clear = false;
+		retval = i40e_aq_run_phy_activity(hw,
+				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
+				&cmd_status, tx_counter, rx_counter, NULL);
+
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+
+		return retval;
+	}
+
+	*is_clear = true;
+	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+
+	return I40E_SUCCESS;
+}
+
+/**
+ * i40e_lpi_stat_update - update LPI counters with values relative to offset
+ * @hw: pointer to the hw struct
+ * @offset_loaded: flag indicating need of writing current value to offset
+ * @tx_offset: pointer to offset of TX LPI counter
+ * @tx_stat: pointer to value of TX LPI counter
+ * @rx_offset: pointer to offset of RX LPI counter
+ * @rx_stat: pointer to value of RX LPI counter
+ *
+ * Update Low Power Idle (LPI) mode counters while having regard to passed
+ * offsets.
+ **/
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat)
+{
+	enum i40e_status_code retval;
+	u32 tx_counter, rx_counter;
+	bool is_clear;
+
+	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter, &is_clear);
+	if (retval)
+		goto err;
+
+	if (is_clear) {
+		*tx_stat += tx_counter;
+		*rx_stat += rx_counter;
+	} else {
+		if (!offset_loaded) {
+			*tx_offset = tx_counter;
+			*rx_offset = rx_counter;
+		}
+
+		*tx_stat = (tx_counter >= *tx_offset) ?
+			(u32)(tx_counter - *tx_offset) :
+			(u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+		*rx_stat = (rx_counter >= *rx_offset) ?
+			(u32)(rx_counter - *rx_offset) :
+			(u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+	}
+err:
+	return retval;
+}
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
@@ -7233,6 +7318,51 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 }
 
 #endif /* PF_DRIVER */
+/**
+ * i40e_aq_run_phy_activity
+ * @hw: pointer to the hw struct
+ * @activity_id: ID of DNL activity to run
+ * @dnl_opcode: opcode passed to DNL script
+ * @cmd_status: pointer to memory to write return value of DNL script
+ * @data0: pointer to memory for first 4 bytes of data returned by DNL script
+ * @data1: pointer to memory for last 4 bytes of data returned by DNL script
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Run DNL admin command.
+ **/
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 dnl_opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aqc_run_phy_activity *cmd;
+	enum i40e_status_code retval;
+	struct i40e_aq_desc desc;
+
+	cmd = (struct i40e_aqc_run_phy_activity *)&desc.params.raw;
+
+	if (!cmd_status || !data0 || !data1) {
+		retval = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_fill_default_direct_cmd_desc(&desc,
+					  i40e_aqc_opc_run_phy_activity);
+
+	cmd->activity_id = CPU_TO_LE16(activity_id);
+	cmd->params.cmd.dnl_opcode = CPU_TO_LE32(dnl_opcode);
+
+	retval = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+	if (retval)
+		goto err;
+
+	*cmd_status = LE32_TO_CPU(cmd->params.resp.cmd_status);
+	*data0 = LE32_TO_CPU(cmd->params.resp.data0);
+	*data1 = LE32_TO_CPU(cmd->params.resp.data1);
+err:
+	return retval;
+}
+
 #ifdef VF_DRIVER
 
 /**
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index c6c45eb5a..748a7a275 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -76,6 +76,12 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
+					    u32 *rx_counter, bool *is_clear);
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
@@ -550,6 +556,10 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 				u8 phy_select, u8 dev_addr, bool page_change,
 				u32 reg_addr, u32 *reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details);
 
 enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw,
 			struct i40e_aqc_arp_proxy_data *proxy_config,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 16/36] net/i40e/base: backport style changes from upstream Linux
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (14 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 17/36] net/i40e/base: update status codes Xiaolong Ye
                     ` (19 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The upstream virtchnl.h has a few minor style differences to what is
out-of-tree, and there is no real reason we should prefer the current
style over whats upstream.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 88096cb45..a8d5eaf8a 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -123,13 +123,13 @@ enum virtchnl_ops {
 
 };
 
-/* This macro is used to generate a compilation error if a structure
+/* These macros are used to generate compilation errors if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
  * structure is not of the correct size, otherwise it creates an enum that is
  * never used.
  */
 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
-	{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}
+	{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
 
 /* Virtual channel message descriptor. This overlays the admin queue
  * descriptor. All other data is passed in external buffers.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 17/36] net/i40e/base: update status codes
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (15 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
                     ` (18 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Add a few new status codes and rename a few to make them more consistent.
Error code are mapped to similar values as in i40e_status.h, so as to be
compatible with older VF drivers not using this status enum.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index a8d5eaf8a..c677d0eb5 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -40,13 +40,19 @@
 /* Error Codes */
 enum virtchnl_status_code {
 	VIRTCHNL_STATUS_SUCCESS				= 0,
-	VIRTCHNL_ERR_PARAM				= -5,
+	VIRTCHNL_STATUS_ERR_PARAM			= -5,
+	VIRTCHNL_STATUS_ERR_NO_MEMORY			= -18,
 	VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH		= -38,
 	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
 	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
-	VIRTCHNL_STATUS_NOT_SUPPORTED			= -64,
+	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
+	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
 };
 
+/* Backward compatibility */
+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
+
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
@@ -732,7 +738,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_EVENT:
 	case VIRTCHNL_OP_UNKNOWN:
 	default:
-		return VIRTCHNL_ERR_PARAM;
+		return VIRTCHNL_STATUS_ERR_PARAM;
 	}
 	/* few more checks */
 	if (err_msg_format || valid_len != msglen)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 18/36] net/i40e/base: change of the incorrect Tx descriptors number
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (16 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 17/36] net/i40e/base: update status codes Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
                     ` (17 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The existing driver allows setting the number of TX descriptors
to the value that is indivisible by 32. This is not properly
supported by x710 hardware. The patch limits the number of TX
descriptors to the whole value of 32.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 8d257e00a..f0e4b667a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -79,8 +79,8 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
 #define I40E_HI_BYTE(x)		((u8)(((x) >> 8) & 0xFF))
 #define I40E_LO_BYTE(x)		((u8)((x) & 0xFF))
 
-/* Number of Transmit Descriptors must be a multiple of 8. */
-#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	8
+/* Number of Transmit Descriptors must be a multiple of 32. */
+#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	32
 /* Number of Receive Descriptors must be a multiple of 32 if
  * the number of descriptors is greater than 32.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 19/36] net/i40e/base: extend PHY access AQ command
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (17 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
                     ` (16 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Currently FW use MDIO I/F number corresponded with current PF for PHY
access. This code allow to specify used MDIO I/F number.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 57 +++++++++++++++++++++++
 drivers/net/i40e/base/i40e_adminq_cmd.h |  6 ++-
 drivers/net/i40e/base/i40e_common.c     | 62 ++++++++++++++++++++-----
 drivers/net/i40e/base/i40e_prototype.h  | 27 +++++++----
 drivers/net/i40e/base/i40e_type.h       |  1 +
 5 files changed, 132 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 52bea842f..96e170e12 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -569,6 +569,57 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
 }
 #endif /* PF_DRIVER */
 
+/**
+ *  i40e_set_hw_flags - set HW flags
+ *  @hw: pointer to the hardware structure
+ **/
+STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
+{
+	struct i40e_adminq_info *aq = &hw->aq;
+
+	hw->flags = 0;
+
+	switch (hw->mac.type) {
+	case I40E_MAC_XL710:
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) {
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+			/* The ability to RX (not drop) 802.1ad frames */
+			hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
+		}
+		break;
+	case I40E_MAC_X722:
+		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
+			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+		/* fall through */
+	default:
+		break;
+	}
+
+	/* Newer versions of firmware require lock when reading the NVM */
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 5))
+		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 8))
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 9))
+		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED;
+}
+
 /**
  *  i40e_init_adminq - main initialization routine for Admin Queue
  *  @hw: pointer to the hardware structure
@@ -636,6 +687,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_arq;
 
+	/*
+	 * Some features were introduced in different FW API version
+	 * for different MAC type.
+	 */
+	i40e_set_hw_flags(hw);
+
 	/* get the NVM version info */
 	i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION,
 			   &hw->nvm.version);
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index d718c7326..7181e0f58 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2310,7 +2310,11 @@ struct i40e_aqc_phy_register_access {
 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE	2
 	u8	dev_addres;
 	u8	cmd_flags;
-#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	1
+#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	0x01
+#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER	0x02
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT	2
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK	(0x3 << \
+		I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT)
 	u8	reserved1;
 	__le32	reg_address;
 	__le32	reg_value;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9d76b6824..ee081d6ad 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7239,23 +7239,52 @@ void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val)
 		wr32(hw, reg_addr, reg_val);
 }
 
-#ifdef PF_DRIVER
 /**
- * i40e_aq_set_phy_register
+ * i40e_mdio_if_number_selection - MDIO I/F number selection
+ * @hw: pointer to the hw struct
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
+ * @cmd: pointer to PHY Register command structure
+ **/
+static void
+i40e_mdio_if_number_selection(struct i40e_hw *hw, bool set_mdio, u8 mdio_num,
+			      struct i40e_aqc_phy_register_access *cmd)
+{
+	if (set_mdio && cmd->phy_interface == I40E_AQ_PHY_REG_ACCESS_EXTERNAL) {
+		if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED)
+			cmd->cmd_flags |=
+				I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER |
+				((mdio_num <<
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) &
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK);
+		else
+			i40e_debug(hw, I40E_DEBUG_PHY,
+				   "MDIO I/F number selection not supported by current FW version.\n");
+	}
+}
+
+/**
+ * i40e_aq_set_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: new register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Write the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_set_phy_register.
  **/
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7273,27 +7302,35 @@ enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
 }
 
 /**
- * i40e_aq_get_phy_register
+ * i40e_aq_get_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: read register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Read the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_get_phy_register.
  **/
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7310,6 +7347,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 	if (!status)
 		*reg_val = LE32_TO_CPU(cmd->reg_value);
@@ -7317,7 +7356,6 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	return status;
 }
 
-#endif /* PF_DRIVER */
 /**
  * i40e_aq_run_phy_activity
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 748a7a275..fcfe497f1 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -548,14 +548,25 @@ enum i40e_status_code i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
 				u32 reg_addr, u32 reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+
+/* Convenience wrappers for most common use case */
+#define i40e_aq_set_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_set_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+#define i40e_aq_get_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_get_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+
 enum i40e_status_code
 i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
 			 u32 *cmd_status, u32 *data0, u32 *data1,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index f0e4b667a..b380193f7 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -743,6 +743,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
+#define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 20/36] net/i40e/base: add drop mode parameter to set MAC config
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (18 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
                     ` (15 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This patch adds "drop mode" parameter to set mac config AQ command.
This bit controls the behavior when a no-drop packet is blocking a TC
queue.
0 – The PF driver is notified.
1 – The blocking packet is dropped and then the PF driver is notified.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  4 +++-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 29 +++++++++++++------------
 drivers/net/i40e/base/i40e_common.c     | 11 ++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  1 +
 drivers/net/i40e/base/i40e_type.h       |  1 +
 drivers/net/i40e/i40e_ethdev.c          |  2 +-
 6 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 96e170e12..0676f9a25 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -611,8 +611,10 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
-	     aq->api_min_ver >= 8))
+	     aq->api_min_ver >= 8)) {
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+		hw->flags |= I40E_HW_FLAG_DROP_MODE;
+	}
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7181e0f58..f6c9d3e1a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2098,20 +2098,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
 struct i40e_aq_set_mac_config {
 	__le16	max_frame_size;
 	u8	params;
-#define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
-#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
-#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
-#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
-#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
-#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
+#define I40E_AQ_SET_MAC_CONFIG_CRC_EN			0x04
+#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK		0x78
+#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT		3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE		0x0
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX		0xF
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX		0x9
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX		0x8
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX		0x7
+#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX		0x6
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX		0x5
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX		0x4
+#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX		0x3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX		0x2
+#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX		0x1
+#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN	0x80
 	u8	tx_timer_priority; /* bitmap */
 	__le16	tx_timer_value;
 	__le16	fc_refresh_threshold;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index ee081d6ad..eddc91e36 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1873,6 +1873,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
  * @max_frame_size: Maximum Frame Size to be supported by the port
  * @crc_en: Tell HW to append a CRC to outgoing frames
  * @pacing: Pacing configurations
+ * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked
  * @cmd_details: pointer to command details structure or NULL
  *
  * Configure MAC settings for frame size, jumbo frame support and the
@@ -1881,6 +1882,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size,
 				bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -1899,6 +1901,15 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 	if (crc_en)
 		cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN;
 
+	if (auto_drop_blocking_packets) {
+		if (hw->flags & I40E_HW_FLAG_DROP_MODE)
+			cmd->params |=
+				I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "This FW api version does not support drop mode.\n");
+	}
+
 #define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD	0x7FFF
 	cmd->fc_refresh_threshold =
 		CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD);
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index fcfe497f1..43db2a6f3 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -114,6 +114,7 @@ enum i40e_status_code i40e_aq_set_phy_int_mask(struct i40e_hw *hw, u16 mask,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size, bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_local_advt_reg(struct i40e_hw *hw,
 				u64 *advt_reg,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index b380193f7..d20b0fe20 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -744,6 +744,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
+#define I40E_HW_FLAG_DROP_MODE		    BIT_ULL(7)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b93c56e46..e5f0a5572 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1649,7 +1649,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* Set the max frame size to 0x2600 by default,
 	 * in case other drivers changed the default value.
 	 */
-	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, 0, NULL);
+	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, false, 0, NULL);
 
 	/* initialize mirror rule list */
 	TAILQ_INIT(&pf->mirror_list);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 21/36] net/i40e/base: add FWS1B register masks
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (19 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 22/36] net/i40e/base: update FW API version Xiaolong Ye
                     ` (14 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Function check_recovery_mode had wrong if statement. Now we check proper
FWS1B register values, which are responsible for the recovery mode.
Recovery mode has 6 values in total. That's why we need 6 different flags.
Now in if statement we recognize type of mac and register value. Without
those changes driver could show wrong state.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index e93ec3f58..6804aba51 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,18 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK \
+				I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK \
+				I40E_MASK(0x33, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0xB, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0xC, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_GLGEN_CLKSTAT                    0x000B8184 /* Reset: POR */
 #define I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT      0
 #define I40E_GLGEN_CLKSTAT_CLKMODE_MASK       I40E_MASK(0x1, I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 22/36] net/i40e/base: update FW API version
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (20 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
                     ` (13 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Update FW API version to 1.9.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index f6c9d3e1a..0443c6361 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -12,8 +12,8 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0006
-#define I40E_FW_API_VERSION_MINOR_X710	0x0007
+#define I40E_FW_API_VERSION_MINOR_X722	0x0009
+#define I40E_FW_API_VERSION_MINOR_X710	0x0009
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 23/36] net/i40e/base: add persistent lldp support
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (21 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 22/36] net/i40e/base: update FW API version Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
                     ` (12 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This patch adds a function to read nvm module data and uses it to
read current lldp agent configuration from nvm api version 1.8.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c       | 20 +++++++-
 drivers/net/i40e/base/i40e_dcb.h       |  5 ++
 drivers/net/i40e/base/i40e_nvm.c       | 71 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 4 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index f1465daa3..2ab5021ee 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -877,7 +877,25 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
-	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
+		u8 offset = 0;
+
+		if (hw->mac.type == I40E_MAC_XL710)
+			offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;
+		else if (hw->mac.type == I40E_MAC_X722)
+			offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
+		else
+			return I40E_NOT_SUPPORTED;
+
+		ret = i40e_read_nvm_module_data(hw,
+						I40E_SR_EMP_SR_SETTINGS_PTR,
+						offset,
+						I40E_LLDP_CURRENT_STATUS_OFFSET,
+						I40E_LLDP_CURRENT_STATUS_SIZE,
+						&lldp_cfg.adminstatus);
+	} else {
+		ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	}
 	if (ret)
 		return I40E_ERR_NOT_READY;
 
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 88fe405d7..520c7db73 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -39,6 +39,11 @@
 #define I40E_LLDP_ADMINSTATUS_ENABLED_TX	2
 #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX	3
 
+#define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET	0x2B
+#define I40E_LLDP_CURRENT_STATUS_X722_OFFSET	0x31
+#define I40E_LLDP_CURRENT_STATUS_OFFSET		1
+#define I40E_LLDP_CURRENT_STATUS_SIZE		1
+
 /* Defines for LLDP TLV header */
 #define I40E_LLDP_MIB_HLEN		14
 #define I40E_LLDP_TLV_LEN_SHIFT		0
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index c8b401cdd..fc24cc2ce 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -337,6 +337,77 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 	return ret_code;
 }
 
+/**
+ * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location
+ * @hw: Pointer to the HW structure
+ * @module_ptr: Pointer to module in words with respect to NVM beginning
+ * @module_offset: Offset in words from module start
+ * @data_offset: Offset in words from reading data area start
+ * @words_data_size: Words to read from NVM
+ * @data_ptr: Pointer to memory location where resulting buffer will be stored
+ **/
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr)
+{
+	enum i40e_status_code status;
+	u16 specific_ptr = 0;
+	u16 ptr_value = 0;
+	u16 offset = 0;
+
+	if (module_ptr != 0) {
+		status = i40e_read_nvm_word(hw, module_ptr, &ptr_value);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+	}
+#define I40E_NVM_INVALID_PTR_VAL 0x7FFF
+#define I40E_NVM_INVALID_VAL 0xFFFF
+
+	/* Pointer not initialized */
+	if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
+	    ptr_value == I40E_NVM_INVALID_VAL) {
+		i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n");
+		return I40E_ERR_BAD_PTR;
+	}
+
+	/* Check whether the module is in SR mapped area or outside */
+	if (ptr_value & I40E_PTR_TYPE) {
+		/* Pointer points outside of the Shared RAM mapped area */
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n");
+
+		return I40E_ERR_PARAM;
+	} else {
+		/* Read from the Shadow RAM */
+
+		status = i40e_read_nvm_word(hw, ptr_value + module_offset,
+					    &specific_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+
+		offset = ptr_value + module_offset + specific_ptr +
+			data_offset;
+
+		status = i40e_read_nvm_buffer(hw, offset, &words_data_size,
+					      data_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm buffer failed.Error code: %d.\n",
+				   status);
+		}
+	}
+
+	return status;
+}
+
 /**
  * i40e_read_nvm_buffer_srctl - Reads Shadow RAM buffer via SRCTL register
  * @hw: pointer to the HW structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 43db2a6f3..afebf441d 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -442,6 +442,9 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,
 void i40e_release_nvm(struct i40e_hw *hw);
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 					 u16 *data);
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr);
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
 					   u16 *words, u16 *data);
 enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 24/36] net/i40e/base: make i40e_set_mac_type() public
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (22 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 25/36] net/i40e/base: change retrying logic Xiaolong Ye
                     ` (11 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type()
to be public. It is required for recovery mode handling. Without this patch
recovery mode could not be detected at probe() function.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index eddc91e36..4f87ec9fa 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#else
-STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#endif
 {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index afebf441d..2b6198985 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -472,10 +472,8 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
 enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
-#if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 25/36] net/i40e/base: change retrying logic
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (23 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
                     ` (10 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Fixed a bug where driver was breaking out of the loop and
reporting an error without retrying first.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4f87ec9fa..a37e70599 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1714,19 +1714,22 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
 		status = i40e_asq_send_command(hw, &desc, abilities,
 					       abilities_size, cmd_details);
 
-		if (status != I40E_SUCCESS)
-			break;
-
-		if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) {
+		switch (hw->aq.asq_last_status) {
+		case I40E_AQ_RC_EIO:
 			status = I40E_ERR_UNKNOWN_PHY;
 			break;
-		} else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) {
+		case I40E_AQ_RC_EAGAIN:
 			i40e_msec_delay(1);
 			total_delay++;
 			status = I40E_ERR_TIMEOUT;
+			break;
+		/* also covers I40E_AQ_RC_OK */
+		default:
+			break;
 		}
-	} while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) &&
-		 (total_delay < max_delay));
+
+	} while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) &&
+		(total_delay < max_delay));
 
 	if (status != I40E_SUCCESS)
 		return status;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 26/36] net/i40e/base: mark additional missing bits as reserved
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (24 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 25/36] net/i40e/base: change retrying logic Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
                     ` (9 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Mark bits 0xD through 0xF for the command flags of a cloud filter as
reserved. These bits are not yet defined and are considered as reserved
in the data sheet.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 0443c6361..658875a0d 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1402,6 +1402,9 @@ struct i40e_aqc_cloud_filters_element_data {
 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
 #define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C
+/* 0x000D reserved */
+/* 0x000E reserved */
+/* 0x000F reserved */
 /* 0x0010 to 0x0017 is for custom filters */
 #define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT		0x0010 /* Dest IP + L4 Port */
 #define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT		0x0011 /* Dest MAC + L4 Port */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 27/36] net/i40e/base: change wrong 'Advertised FEC modes'
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (25 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
                     ` (8 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Fix display of FEC settings for ethtool.
This patch change variable 'phy.link_info.req_fec_info' sent to ethtool.
Without this patch wrong FEC settings can be shown.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index a37e70599..9ad0dd654 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2911,9 +2911,16 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw)
 		if (status)
 			return status;
 
-		hw->phy.link_info.req_fec_info =
-			abilities.fec_cfg_curr_mod_ext_info &
-			(I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS);
+		if (abilities.fec_cfg_curr_mod_ext_info &
+		    I40E_AQ_ENABLE_FEC_AUTO)
+			hw->phy.link_info.req_fec_info =
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
+		else
+			hw->phy.link_info.req_fec_info =
+				abilities.fec_cfg_curr_mod_ext_info &
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
 
 		i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type,
 			sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 28/36] net/i40e/base: add Flow Director defines
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (26 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
                     ` (7 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Add defines for creating Flow Director flows as defined in datasheet
section 7.1.5.4 for field vectors.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 6804aba51..3a8c0ccd1 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -5287,6 +5287,87 @@
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT 0
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_MASK  I40E_MASK(0x3FFFFFFF, I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT)
 #endif /* PF_DRIVER */
+/* Flow Director */
+#define I40E_REG_INSET_L2_DMAC_SHIFT            60
+#define I40E_REG_INSET_L2_DMAC_MASK             I40E_MASK(0xEULL, I40E_REG_INSET_L2_DMAC_SHIFT)
+#define I40E_REG_INSET_L2_SMAC_SHIFT            56
+#define I40E_REG_INSET_L2_SMAC_MASK             I40E_MASK(0x1CULL, I40E_REG_INSET_L2_SMAC_SHIFT)
+#define I40E_REG_INSET_L2_OUTER_VLAN_SHIFT      26
+#define I40E_REG_INSET_L2_OUTER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_OUTER_VLAN_SHIFT)
+#define I40E_REG_INSET_L2_INNER_VLAN_SHIFT      55
+#define I40E_REG_INSET_L2_INNER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_INNER_VLAN_SHIFT)
+#define I40E_REG_INSET_TUNNEL_VLAN_SHIFT        56
+#define I40E_REG_INSET_TUNNEL_VLAN_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_VLAN_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP4_SHIFT         47
+#define I40E_REG_INSET_L3_SRC_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP4_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT    49
+#define I40E_X722_REG_INSET_L3_SRC_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_DST_IP4_SHIFT    41
+#define I40E_X722_REG_INSET_L3_DST_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT  52
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_MASK   I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT    52
+#define I40E_X722_REG_INSET_L3_IP4_TTL_MASK     I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TOS_SHIFT         54
+#define I40E_REG_INSET_L3_IP4_TOS_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TOS_SHIFT)
+#define I40E_REG_INSET_L3_IP4_PROTO_SHIFT       50
+#define I40E_REG_INSET_L3_IP4_PROTO_MASK        I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TTL_SHIFT         50
+#define I40E_REG_INSET_L3_IP4_TTL_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP6_SHIFT         43
+#define I40E_REG_INSET_L3_SRC_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_SRC_IP6_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP6_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_L3_IP6_TC_SHIFT          54
+#define I40E_REG_INSET_L3_IP6_TC_MASK           I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_TC_SHIFT)
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT    51
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT)
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT   51
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT)
+#define I40E_REG_INSET_L4_SRC_PORT_SHIFT        34
+#define I40E_REG_INSET_L4_SRC_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_SRC_PORT_SHIFT)
+#define I40E_REG_INSET_L4_DST_PORT_SHIFT        33
+#define I40E_REG_INSET_L4_DST_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_DST_PORT_SHIFT)
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT 31
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_MASK  I40E_MASK(0x3ULL, I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT  22
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT  11
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT   21
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT)
+#define I40E_REG_INSET_TUNNEL_ID_SHIFT          18
+#define I40E_REG_INSET_TUNNEL_ID_MASK           I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_ID_SHIFT)
+#define I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT    14
+#define I40E_REG_INSET_LAST_ETHER_TYPE_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT  8
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_MASK   I40E_MASK(0xFFULL, I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT 13
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT 12
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT 11
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT 10
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT 9
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT 8
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT 7
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_MASK  I40E_MASK(0xFFULL, I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT)
+#define I40E_REG_INSET_MASK_DEFAULT             0x0000000000000000ULL
+
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT       30
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_MASK        I40E_MASK(0x1, I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT)
 #define I40E_VFINT_DYN_CTLN1_WB_ON_ITR_SHIFT       30
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 29/36] net/i40e/base: removed unreachable code
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (27 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
                     ` (6 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The result of the check is always FALSE and the code within "if"
is never executed.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9ad0dd654..8144d957e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4869,8 +4869,6 @@ enum i40e_status_code i40e_aq_add_mcast_etag(struct i40e_hw *hw, u16 pv_seid,
 	cmd->num_unicast_etags = num_tags_in_buf;
 
 	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (length > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
 
 	status = i40e_asq_send_command(hw, &desc, buf, length, cmd_details);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 30/36] net/i40e/base: set PHY Access flag on X722
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (28 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
                     ` (5 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The X722 FW API version 1.9 adds support for accessing PHY
registers with Admin Queue Command. This enables reading
EEPROM data from (Q)SFP+ transceivers, what was previously
possible only on X710 devices.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 5 +++++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 0676f9a25..221c327d1 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -598,6 +598,11 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 		    (aq->api_maj_ver == 1 &&
 		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
 			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
 		/* fall through */
 	default:
 		break;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 658875a0d..d99fbbe6a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -21,6 +21,8 @@
 
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */
+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 31/36] net/i40e/base: implement reading lpi statistics
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (29 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
                     ` (4 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

There was no time duration statistics for LPI (Low Power Idle)
in EEE (Energy-Efficient Ethernet).
Added new procedure to get duration values from FW.
Otherwise there is no available procedure to get tx_lpi_duration
and rx_lpi_duration values.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 56 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 drivers/net/i40e/base/i40e_type.h      |  2 +
 3 files changed, 61 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8144d957e..d90012fd7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7083,6 +7083,62 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	return I40E_SUCCESS;
 }
 
+/**
+ * i40e_get_lpi_duration - read LPI time duration from EEE statistics
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ * @tx_duration: pointer to memory for TX LPI time duration
+ * @rx_duration: pointer to memory for RX LPI time duration
+ *
+ * Read Low Power Idle (LPI) mode time duration from Energy Efficient
+ * Ethernet (EEE) statistics.
+ */
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration)
+{
+	u32 tx_time_dur, rx_time_dur;
+	enum i40e_status_code retval;
+	u32 cmd_status;
+
+	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC)
+		return I40E_ERR_NOT_IMPLEMENTED;
+
+	retval = i40e_aq_run_phy_activity
+		(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+		I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR,
+		&cmd_status, &tx_time_dur, &rx_time_dur, NULL);
+
+	if (retval)
+		return retval;
+	if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+	    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+		return I40E_ERR_ADMIN_QUEUE_ERROR;
+
+	if (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB &&
+	    !tx_time_dur && !rx_time_dur &&
+	    stat->tx_lpi_status && stat->rx_lpi_status) {
+		retval = i40e_aq_run_phy_activity
+			(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+			I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR,
+			&cmd_status,
+			&tx_time_dur, &rx_time_dur, NULL);
+
+		if (retval)
+			return retval;
+		if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+		    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			return I40E_ERR_ADMIN_QUEUE_ERROR;
+		tx_time_dur = 0;
+		rx_time_dur = 0;
+	}
+
+	*tx_duration = tx_time_dur;
+	*rx_duration = rx_time_dur;
+
+	return retval;
+}
+
 /**
  * i40e_lpi_stat_update - update LPI counters with values relative to offset
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2b6198985..0d1adb689 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -82,6 +82,9 @@ enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 					   bool offset_loaded, u64 *tx_offset,
 					   u64 *tx_stat, u64 *rx_offset,
 					   u64 *rx_stat);
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index d20b0fe20..af9089829 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1498,6 +1498,8 @@ struct i40e_hw_port_stats {
 	u32 rx_lpi_status;
 	u64 tx_lpi_count;		/* etlpic */
 	u64 rx_lpi_count;		/* erlpic */
+	u64 tx_lpi_duration;
+	u64 rx_lpi_duration;
 };
 
 /* Checksum and Shadow RAM pointers */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 32/36] net/i40e/base: exposing missing LED functionality
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (30 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
                     ` (3 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

The previous code had the LED code wrapped such that, it was
static to the file and not usable outside of it. It is now available.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 8 ++++----
 drivers/net/i40e/base/i40e_prototype.h | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d90012fd7..d0cb53a9d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6851,8 +6851,8 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
  * @led_addr: LED register address
  * @reg_val: read register value
  **/
-static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 *reg_val)
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
@@ -6880,8 +6880,8 @@ static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
  * @led_addr: LED register address
  * @reg_val: register value to write
  **/
-static enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 reg_val)
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0d1adb689..0f06e3262 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -73,7 +73,10 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 				       u16 *val);
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
-
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val);
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val);
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 33/36] net/i40e/base: introduce firmware EMP reset register offsets
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (31 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
                     ` (2 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 3a8c0ccd1..436f48efa 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 34/36] net/i40e/base: add CRC stripping capability
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (32 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Some VFs may want to disable CRC stripping on incoming packets
so create an offload for that. The VF already sends information
about configuring it's RX queues so use that structure to
indicate that the CRC stripping should be enabled or not.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.h |  3 +--
 drivers/net/i40e/base/virtchnl.h | 12 ++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 520c7db73..60193c98d 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2018
+ * Copyright(c) 2001-2019
  */
 
 #ifndef _I40E_DCB_H_
@@ -205,5 +205,4 @@ i40e_get_fw_lldp_status(struct i40e_hw *hw,
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-
 #endif /* _I40E_DCB_H_ */
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c677d0eb5..c613d4761 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -228,6 +228,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040
+#define VIRTCHNL_VF_OFFLOAD_CRC			0x00000080
 #define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000
 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000
 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
@@ -276,7 +277,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
  * VF sends this message to set up parameters for one RX queue.
  * External data buffer contains one instance of virtchnl_rxq_info.
- * PF configures requested queue and returns a status code.
+ * PF configures requested queue and returns a status code. The
+ * crc_disable flag disables CRC stripping on the VF. Setting
+ * the crc_disable flag to 1 will disable CRC stripping for each
+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
+ * offload must have been set prior to sending this info or the PF
+ * will ignore the request. This flag should be set the same for
+ * all of the queues for a VF.
  */
 
 /* Rx queue config info */
@@ -288,7 +295,8 @@ struct virtchnl_rxq_info {
 	u16 splithdr_enabled; /* deprecated with AVF 1.0 */
 	u32 databuffer_size;
 	u32 max_pkt_size;
-	u32 pad1;
+	u8 crc_disable;
+	u8 pad1[3];
 	u64 dma_ring_addr;
 	enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
 	u32 pad2;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 35/36] net/i40e/base: enable LED blinking flow
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (33 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

Add X710T*L device specific operations (in port LED detection and
handling of GLGEN_GPIO_CTL.PIN_FUNC field) to enable LED blinking.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 28 +++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_devids.h |  2 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d0cb53a9d..84e67f285 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1544,9 +1544,9 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 	u32 gpio_val = 0;
 	u32 port;
 
-	if (!hw->func_caps.led[idx])
+	if (!I40E_IS_X710TL_DEVICE(hw->device_id) &&
+	    !hw->func_caps.led[idx])
 		return 0;
-
 	gpio_val = rd32(hw, I40E_GLGEN_GPIO_CTL(idx));
 	port = (gpio_val & I40E_GLGEN_GPIO_CTL_PRT_NUM_MASK) >>
 		I40E_GLGEN_GPIO_CTL_PRT_NUM_SHIFT;
@@ -1565,8 +1565,15 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 #define I40E_FILTER_ACTIVITY 0xE
 #define I40E_LINK_ACTIVITY 0xC
 #define I40E_MAC_ACTIVITY 0xD
+#define I40E_FW_LED BIT(4)
+#define I40E_LED_MODE_VALID (I40E_GLGEN_GPIO_CTL_LED_MODE_MASK >> \
+			     I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT)
+
 #define I40E_LED0 22
 
+#define I40E_PIN_FUNC_SDP 0x0
+#define I40E_PIN_FUNC_LED 0x1
+
 /**
  * i40e_led_get - return current on/off mode
  * @hw: pointer to the hw struct
@@ -1628,8 +1635,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 	u32 current_mode = 0;
 	int i;
 
-	if (mode & 0xfffffff0)
+	if (mode & ~I40E_LED_MODE_VALID) {
 		DEBUGOUT1("invalid mode passed in %X\n", mode);
+		return;
+	}
 
 	/* as per the documentation GPIO 22-29 are the LED
 	 * GPIO pins named LED0..LED7
@@ -1655,6 +1664,19 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 			break;
 		}
 
+		if (I40E_IS_X710TL_DEVICE(hw->device_id)) {
+			u32 pin_func = 0;
+
+			if (mode & I40E_FW_LED)
+				pin_func = I40E_PIN_FUNC_SDP;
+			else
+				pin_func = I40E_PIN_FUNC_LED;
+
+			gpio_val &= ~I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK;
+			gpio_val |= ((pin_func <<
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_SHIFT) &
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK);
+		}
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index 1700db17a..5897d38f6 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -38,6 +38,8 @@
 #endif
 #define I40E_DEV_ID_10G_B		0x104F
 #define I40E_DEV_ID_10G_SFP		0x104E
+#define I40E_IS_X710TL_DEVICE(d) \
+	((d) == I40E_DEV_ID_10G_BASE_T_BC)
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v2 36/36] net/i40e/base: add new link speed constants
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
                     ` (34 preceding siblings ...)
  2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
@ 2019-12-12 15:21   ` Xiaolong Ye
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-12 15:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye

This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg
for 2.5Gb/5Gb speeds. This problem is fixed by adding constants
for VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_prototype.h | 4 ++++
 drivers/net/i40e/base/virtchnl.h       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0f06e3262..d8ab3ea0a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -505,6 +505,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
 		return VIRTCHNL_LINK_SPEED_100MB;
 	case I40E_LINK_SPEED_1GB:
 		return VIRTCHNL_LINK_SPEED_1GB;
+	case I40E_LINK_SPEED_2_5GB:
+		return VIRTCHNL_LINK_SPEED_2_5GB;
+	case I40E_LINK_SPEED_5GB:
+		return VIRTCHNL_LINK_SPEED_5GB;
 	case I40E_LINK_SPEED_10GB:
 		return VIRTCHNL_LINK_SPEED_10GB;
 	case I40E_LINK_SPEED_40GB:
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c613d4761..92515bf34 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -53,12 +53,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
 
 enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
@@ -68,6 +70,8 @@ enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_40GB	= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_20GB	= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_25GB	= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_2_5GB	= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_5GB		= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 00/36] update for i40e base code
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (69 preceding siblings ...)
  2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
@ 2019-12-16  2:43 ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
                     ` (35 more replies)
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
  71 siblings, 36 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye

This series is to support FVL 7.2 release.

The main changes include:

* virtchnl updates
* add lldp support
* Flow director updates
* extend PHY access AQ cmd
* add reading LPI counters
* add support for Energy Efficient Ethernet
* A few fixes.

V3:

* add missing SOBs

V2:

* strip some unnecessary code
* squash some fixes
* improve commit logs

Thanks,
Xiaolong


Xiaolong Ye (36):
  net/i40e/base: add support for feature flags
  net/i40e/base: increase max VSI count for VFs
  net/i40e/base: change buffer address
  net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  net/i40e/base: change misleading error message
  net/i40e/base: further implementation of LLDP
  net/i40e/base: add new device ids
  net/i40e/base: add check for MAC type
  net/i40e/base: adding flags for PHY types
  net/i40e/base: improve AQ log granularity
  net/i40e/base: add getter for FW LLDP agent status
  net/i40e/base: add support for Energy Efficient Ethernet
  net/i40e/base: read LPI status from external PHY
  net/i40e/base: change for missing "link modes"
  net/i40e/base: add reading LPI counters
  net/i40e/base: backport style changes from upstream Linux
  net/i40e/base: update status codes
  net/i40e/base: change of the incorrect Tx descriptors number
  net/i40e/base: extend PHY access AQ command
  net/i40e/base: add drop mode parameter to set MAC config
  net/i40e/base: add FWS1B register masks
  net/i40e/base: update FW API version
  net/i40e/base: add persistent lldp support
  net/i40e/base: make i40e_set_mac_type() public
  net/i40e/base: change retrying logic
  net/i40e/base: mark additional missing bits as reserved
  net/i40e/base: change wrong 'Advertised FEC modes'
  net/i40e/base: add Flow Director defines
  net/i40e/base: removed unreachable code
  net/i40e/base: set PHY Access flag on X722
  net/i40e/base: implement reading lpi statistics
  net/i40e/base: exposing missing LED functionality
  net/i40e/base: introduce firmware EMP reset register offsets
  net/i40e/base: add CRC stripping capability
  net/i40e/base: enable LED blinking flow
  net/i40e/base: add new link speed constants

 drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
 drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
 drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
 drivers/net/i40e/base/i40e_dcb.h        |  20 +-
 drivers/net/i40e/base/i40e_devids.h     |   4 +
 drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
 drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
 drivers/net/i40e/base/i40e_register.h   |  95 ++++
 drivers/net/i40e/base/i40e_type.h       |  39 +-
 drivers/net/i40e/base/virtchnl.h        |  32 +-
 drivers/net/i40e/i40e_ethdev.c          |  12 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 13 files changed, 1047 insertions(+), 323 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 01/36] net/i40e/base: add support for feature flags
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
                     ` (34 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Pietruszewski,
	Galazka Krzysztof

Extend NVM Update API to support reporting of features
available for the tools.

This change is needed by NVM Update to determine if driver
supports changing NVM layout from structured to flat.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 11 ++++++++
 drivers/net/i40e/base/i40e_nvm.c    | 42 ++++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_type.h   | 22 +++++++++++++++
 3 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 37911a99e..cee6de2a8 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1014,6 +1014,17 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 	if (hw->mac.type == I40E_MAC_X722)
 		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
 			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+	/* NVMUpdate features structure initialization */
+	hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR;
+	hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR;
+	hw->nvmupd_features.size = sizeof(hw->nvmupd_features);
+	i40e_memset(hw->nvmupd_features.features, 0x0,
+		    I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN *
+		    sizeof(*hw->nvmupd_features.features),
+		    I40E_NONDMA_MEM);
+
+	/* No features supported at the moment */
+	hw->nvmupd_features.features[0] = 0;
 
 	status = i40e_init_nvm(hw);
 	return status;
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 6c8ca8771..c8b401cdd 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -797,6 +797,7 @@ STATIC const char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_EXEC_AQ",
 	"I40E_NVMUPD_GET_AQ_RESULT",
 	"I40E_NVMUPD_GET_AQ_EVENT",
+	"I40E_NVMUPD_GET_FEATURES",
 };
 
 /**
@@ -859,6 +860,31 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		return I40E_SUCCESS;
 	}
 
+	/*
+	 * A supported features request returns immediately
+	 * rather than going into state machine
+	 */
+	if (upd_cmd == I40E_NVMUPD_FEATURES) {
+		if (cmd->data_size < hw->nvmupd_features.size) {
+			*perrno = -EFAULT;
+			return I40E_ERR_BUF_TOO_SHORT;
+		}
+
+		/*
+		 * If buffer is bigger than i40e_nvmupd_features structure,
+		 * make sure the trailing bytes are set to 0x0.
+		 */
+		if (cmd->data_size > hw->nvmupd_features.size)
+			i40e_memset(bytes + hw->nvmupd_features.size, 0x0,
+				    cmd->data_size - hw->nvmupd_features.size,
+				    I40E_NONDMA_MEM);
+
+		i40e_memcpy(bytes, &hw->nvmupd_features,
+			    hw->nvmupd_features.size, I40E_NONDMA_MEM);
+
+		return I40E_SUCCESS;
+	}
+
 	/* Clear status even it is not read and log */
 	if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
@@ -1325,10 +1351,20 @@ STATIC enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 			upd_cmd = I40E_NVMUPD_READ_SA;
 			break;
 		case I40E_NVM_EXEC:
-			if (module == 0xf)
-				upd_cmd = I40E_NVMUPD_STATUS;
-			else if (module == 0)
+			switch (module) {
+			case I40E_NVM_EXEC_GET_AQ_RESULT:
 				upd_cmd = I40E_NVMUPD_GET_AQ_RESULT;
+				break;
+			case I40E_NVM_EXEC_FEATURES:
+				upd_cmd = I40E_NVMUPD_FEATURES;
+				break;
+			case I40E_NVM_EXEC_STATUS:
+				upd_cmd = I40E_NVMUPD_STATUS;
+				break;
+			default:
+				*perrno = -EFAULT;
+				return I40E_NVMUPD_INVALID;
+			}
 			break;
 		case I40E_NVM_AQE:
 			upd_cmd = I40E_NVMUPD_GET_AQ_EVENT;
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 06863d772..fcdf0eb29 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -478,6 +478,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_EXEC_AQ,
 	I40E_NVMUPD_GET_AQ_RESULT,
 	I40E_NVMUPD_GET_AQ_EVENT,
+	I40E_NVMUPD_FEATURES,
 };
 
 enum i40e_nvmupd_state {
@@ -513,6 +514,10 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_AQE				0xe
 #define I40E_NVM_EXEC				0xf
 
+#define I40E_NVM_EXEC_GET_AQ_RESULT		0x0
+#define I40E_NVM_EXEC_FEATURES			0xe
+#define I40E_NVM_EXEC_STATUS			0xf
+
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffffULL << I40E_NVM_ADAPT_SHIFT)
 
@@ -527,6 +532,20 @@ struct i40e_nvm_access {
 	u8 data[1];
 };
 
+/* NVMUpdate features API */
+#define I40E_NVMUPD_FEATURES_API_VER_MAJOR		0
+#define I40E_NVMUPD_FEATURES_API_VER_MINOR		14
+#define I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN	12
+
+#define I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT		BIT(0)
+
+struct i40e_nvmupd_features {
+	u8 major;
+	u8 minor;
+	u16 size;
+	u8 features[I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN];
+};
+
 /* (Q)SFP module access definitions */
 #define I40E_I2C_EEPROM_DEV_ADDR	0xA0
 #define I40E_I2C_EEPROM_DEV_ADDR2	0xA2
@@ -730,6 +749,9 @@ struct i40e_hw {
 	u16 first_tag;
 	u16 second_tag;
 
+	/* NVMUpdate features */
+	struct i40e_nvmupd_features nvmupd_features;
+
 	/* debug mask */
 	u32 debug_mask;
 	char err_str[16];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 02/36] net/i40e/base: increase max VSI count for VFs
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 03/36] net/i40e/base: change buffer address Xiaolong Ye
                     ` (33 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Mitch Williams

For historical reasons, we allowed 3 VSIs per VF, but never used more
than one. Now with ADq, we can use up to 4 VSIs per VF, so change this
value to match.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index fcdf0eb29..0cbb13262 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -38,7 +38,7 @@
 #define I40E_MAX_PF_VSI			64
 #define I40E_MAX_PF_QP			128
 #define I40E_MAX_VSI_QP			16
-#define I40E_MAX_VF_VSI			3
+#define I40E_MAX_VF_VSI			4
 #define I40E_MAX_CHAINED_RX_BUFFERS	5
 #define I40E_MAX_PF_UDP_OFFLOAD_PORTS	16
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 03/36] net/i40e/base: change buffer address
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
                     ` (32 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Azarewicz

The high 32-bits were being set incorrectly in the 'Set Local LLDP MIB'
AQ command (0x0A08). Change it to use the right macro to get the correct
bits.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index cee6de2a8..0b26f86c5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4311,7 +4311,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 
 	cmd->type = mib_type;
 	cmd->length = CPU_TO_LE16(buff_size);
-	cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff));
+	cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff));
 	cmd->address_low =  CPU_TO_LE32(I40E_LO_DWORD((u64)buff));
 
 	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (2 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 03/36] net/i40e/base: change buffer address Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 05/36] net/i40e/base: change misleading error message Xiaolong Ye
                     ` (31 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Chinh T Cao

There is a need to enable MIB change event, not at the same time as
init_dcb. This patch will serve this requirement.

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 28 +++++++++++-----------------
 drivers/net/i40e/base/i40e_dcb.h |  3 ++-
 drivers/net/i40e/i40e_ethdev.c   |  4 ++--
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index a26f82b3a..7cc8c83dc 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -863,22 +863,23 @@ enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw)
 /**
  * i40e_init_dcb
  * @hw: pointer to the hw struct
+ * @enable_mib_change: enable mib change event
  *
  * Update DCB configuration from the Firmware
  **/
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 {
 	enum i40e_status_code ret = I40E_SUCCESS;
 	struct i40e_lldp_variables lldp_cfg;
 	u8 adminstatus = 0;
 
 	if (!hw->func_caps.dcb)
-		return ret;
+		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
 	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
 	if (ret)
-		return ret;
+		return I40E_ERR_NOT_READY;
 
 	/* Get the LLDP AdminStatus for the current port */
 	adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
@@ -887,7 +888,7 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 	/* LLDP agent disabled */
 	if (!adminstatus) {
 		hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
-		return ret;
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Get DCBX status */
@@ -896,26 +897,19 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 		return ret;
 
 	/* Check the DCBX Status */
-	switch (hw->dcbx_status) {
-	case I40E_DCBX_STATUS_DONE:
-	case I40E_DCBX_STATUS_IN_PROGRESS:
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+	    hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
 		/* Get current DCBX configuration */
 		ret = i40e_get_dcb_config(hw);
 		if (ret)
 			return ret;
-		break;
-	case I40E_DCBX_STATUS_DISABLED:
-		return ret;
-	case I40E_DCBX_STATUS_NOT_STARTED:
-	case I40E_DCBX_STATUS_MULTIPLE_PEERS:
-	default:
-		break;
+	} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Configure the LLDP MIB change event */
-	ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
-	if (ret)
-		return ret;
+	if (enable_mib_change)
+		ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
 
 	return ret;
 }
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 85b0eed3a..253943308 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -186,7 +186,8 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 					     u8 bridgetype,
 					     struct i40e_dcbx_config *dcbcfg);
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw);
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
+				    bool enable_mib_change);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5999c964b..765d9b495 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11582,7 +11582,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
 		 * i40e_init_dcb we expect is failure with I40E_AQ_RC_EPERM
 		 * adminq status. Otherwise, it should return success.
@@ -11630,7 +11630,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		if (!ret) {
 			if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
 				PMD_INIT_LOG(ERR,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 05/36] net/i40e/base: change misleading error message
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (3 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
                     ` (30 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Carolyn Wyborny

This patch changes an error code for an admin queue head overrun to use
I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 38214a373..b2fc6f590 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -835,7 +835,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	if (val >= hw->aq.num_asq_entries) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
 			   "AQTX: head overrun at %d\n", val);
-		status = I40E_ERR_QUEUE_EMPTY;
+		status = I40E_ERR_ADMIN_QUEUE_FULL;
 		goto asq_send_command_error;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 06/36] net/i40e/base: further implementation of LLDP
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (4 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 05/36] net/i40e/base: change misleading error message Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 07/36] net/i40e/base: add new device ids Xiaolong Ye
                     ` (29 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Jaroslaw Ilgiewicz

This code implements changes necessary for LLDP Agent support.

1. Modified i40e_aq_start_lldp and i40e_aq_stop_lldp. Now Stop and Start
can also be persistent across power cycles.
2. Added new function i40e_aq_restore_lldp which restores factory
setting for LLDP Agent or gets its status.

Signed-off-by: Jaroslaw Ilgiewicz <jaroslaw.ilgiewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  19 ++-
 drivers/net/i40e/base/i40e_common.c     | 173 ++++++------------------
 drivers/net/i40e/base/i40e_prototype.h  |  18 +--
 drivers/net/i40e/base/i40e_type.h       |   1 +
 drivers/net/i40e/i40e_ethdev.c          |   4 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 6 files changed, 67 insertions(+), 152 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index b459be921..a89b88fa5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -265,6 +265,7 @@ enum i40e_admin_queue_opc {
 	i40e_aqc_opc_get_cee_dcb_cfg	= 0x0A07,
 	i40e_aqc_opc_lldp_set_local_mib	= 0x0A08,
 	i40e_aqc_opc_lldp_stop_start_spec_agent	= 0x0A09,
+	i40e_aqc_opc_lldp_restore		= 0x0A0A,
 
 	/* Tunnel commands */
 	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
@@ -2554,8 +2555,9 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
 /* Stop LLDP (direct 0x0A05) */
 struct i40e_aqc_lldp_stop {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_STOP		0x0
-#define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
+#define I40E_AQ_LLDP_AGENT_STOP			0x0
+#define I40E_AQ_LLDP_AGENT_SHUTDOWN		0x1
+#define I40E_AQ_LLDP_AGENT_STOP_PERSIST		0x2
 	u8	reserved[15];
 };
 
@@ -2565,7 +2567,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
 
 struct i40e_aqc_lldp_start {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_START	0x1
+#define I40E_AQ_LLDP_AGENT_START		0x1
+#define I40E_AQ_LLDP_AGENT_START_PERSIST	0x2
 	u8	reserved[15];
 };
 
@@ -2685,6 +2688,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent);
 
+/* Restore LLDP Agent factory settings (direct 0x0A0A) */
+struct i40e_aqc_lldp_restore {
+	u8	command;
+#define I40E_AQ_LLDP_AGENT_RESTORE_NOT		0x0
+#define I40E_AQ_LLDP_AGENT_RESTORE		0x1
+	u8	reserved[15];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore);
+
 /* Add Udp Tunnel command and completion (direct 0x0B00) */
 struct i40e_aqc_add_udp_tunnel {
 	__le16	udp_port;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 0b26f86c5..8ebf8b856 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4347,151 +4347,39 @@ enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 }
 
 /**
- * i40e_aq_add_lldp_tlv
+ * i40e_aq_restore_lldp
  * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to add
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be added
- * @mib_len: length of the LLDP MIB returned in response
+ * @setting: pointer to factory setting variable or NULL
+ * @restore: True if factory settings should be restored
  * @cmd_details: pointer to command details structure or NULL
  *
- * Add the specified TLV to LLDP Local MIB for the given bridge type,
- * it is responsibility of the caller to make sure that the TLV is not
- * already present in the LLDPDU.
- * In return firmware will write the complete LLDP MIB with the newly
- * added TLV in the response buffer.
+ * Restore LLDP Agent factory settings if @restore set to True. In other case
+ * only returns factory setting in AQ response.
  **/
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff || tlv_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_add_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->len = CPU_TO_LE16(tlv_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
-
-	return status;
-}
-
-/**
- * i40e_aq_update_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to update
- * @buff_size: size of the buffer holding original and updated TLVs
- * @old_len: Length of the Original TLV
- * @new_len: Length of the Updated TLV
- * @offset: offset of the updated TLV in the buff
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Update the specified TLV to the LLDP Local MIB for the given bridge type.
- * Firmware will place the complete LLDP MIB in response buffer with the
- * updated TLV.
- **/
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_update_tlv *cmd =
-		(struct i40e_aqc_lldp_update_tlv *)&desc.params.raw;
+	struct i40e_aqc_lldp_restore *cmd =
+		(struct i40e_aqc_lldp_restore *)&desc.params.raw;
 	enum i40e_status_code status;
 
-	if (buff_size == 0 || !buff || offset == 0 ||
-	    old_len == 0 || new_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_update_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->old_len = CPU_TO_LE16(old_len);
-	cmd->new_offset = CPU_TO_LE16(offset);
-	cmd->new_len = CPU_TO_LE16(new_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
+	if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) {
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Restore LLDP not supported by current FW version.\n");
+		return I40E_ERR_DEVICE_NOT_SUPPORTED;
 	}
 
-	return status;
-}
-
-/**
- * i40e_aq_delete_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: pointer to a user supplied buffer that has the TLV
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be deleted
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Delete the specified TLV from LLDP Local MIB for the given bridge type.
- * The firmware places the entire LLDP MIB in the response buffer.
- **/
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff)
-		return I40E_ERR_PARAM;
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_restore);
 
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_delete_tlv);
+	if (restore)
+		cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE;
 
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-	cmd->len = CPU_TO_LE16(tlv_len);
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
+	if (setting)
+		*setting = cmd->command & 1;
 
 	return status;
 }
@@ -4500,11 +4388,13 @@ enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
  * i40e_aq_stop_lldp
  * @hw: pointer to the hw struct
  * @shutdown_agent: True if LLDP Agent needs to be Shutdown
+ * @persist: True if stop of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Stop or Shutdown the embedded LLDP Agent
  **/
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4517,6 +4407,14 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 	if (shutdown_agent)
 		cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN;
 
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Stop LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
@@ -4525,11 +4423,13 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 /**
  * i40e_aq_start_lldp
  * @hw: pointer to the hw struct
+ * @persist: True if start of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Start the embedded LLDP Agent on all ports.
  **/
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4540,6 +4440,15 @@ enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
 	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_start);
 
 	cmd->command = I40E_AQ_LLDP_AGENT_START;
+
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Start LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0cf006dad..2f3e0bfee 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -251,26 +251,18 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 				bool enable_update,
 				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
 						 bool dcb_enable,
 						 struct i40e_asq_cmd_details
 						 *cmd_details);
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
 				void *buff, u16 buff_size,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 0cbb13262..322300fa3 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -742,6 +742,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
+#define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 765d9b495..26843584e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11577,7 +11577,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 */
 	if (sw_dcb == TRUE) {
 		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
+			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
@@ -11626,7 +11626,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 			return -ENOTSUP;
 		}
 	} else {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index fdcb1a43e..b64f55341 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1409,7 +1409,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Disable DCBx if it's the first time to set strict priority. */
 	if (!veb->strict_prio_tc) {
-		ret = i40e_aq_stop_lldp(hw, true, NULL);
+		ret = i40e_aq_stop_lldp(hw, true, true, NULL);
 		if (ret)
 			PMD_DRV_LOG(INFO,
 				    "Failed to disable DCBx as it's already"
@@ -1464,7 +1464,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Enable DCBx again, if all the TCs' strict priority disabled. */
 	if (!tc_map) {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret) {
 			PMD_DRV_LOG(ERR,
 				    "Failed to enable DCBx, err(%d).", ret);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 07/36] net/i40e/base: add new device ids
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (5 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
                     ` (28 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Azarewicz

New device ids are created to support SFP+ and backplane connections.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 ++
 drivers/net/i40e/base/i40e_devids.h | 2 ++
 drivers/net/i40e/i40e_ethdev.c      | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8ebf8b856..73d0c29fd 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -36,6 +36,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
 		case I40E_DEV_ID_10G_BASE_T:
 		case I40E_DEV_ID_10G_BASE_T4:
 		case I40E_DEV_ID_10G_BASE_T_BC:
+		case I40E_DEV_ID_10G_B:
+		case I40E_DEV_ID_10G_SFP:
 		case I40E_DEV_ID_20G_KR2:
 		case I40E_DEV_ID_20G_KR2_A:
 		case I40E_DEV_ID_25G_B:
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index f3c59bdea..1700db17a 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -36,6 +36,8 @@
 #define I40E_DEV_ID_X722_A0_VF		0x374D
 #endif
 #endif
+#define I40E_DEV_ID_10G_B		0x104F
+#define I40E_DEV_ID_10G_SFP		0x104E
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 26843584e..b93c56e46 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -443,6 +443,8 @@ static const struct rte_pci_id pci_id_i40e_map[] = {
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_XXV710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_BC) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_B) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_SFP) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 08/36] net/i40e/base: add check for MAC type
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (6 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 07/36] net/i40e/base: add new device ids Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
                     ` (27 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Galazka Krzysztof

Some features were introduced in different FW API version on XL710 and X722
MACs. Others are available only on specific MAC type. Make sure that they
are properly assigned. Also fix the style issues reported by current
check-patch.

Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 68 +++++++----------------------
 1 file changed, 16 insertions(+), 52 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b2fc6f590..b8c6e30f5 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -582,25 +582,22 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
  **/
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
-#ifdef PF_DRIVER
+	struct i40e_adminq_info *aq = &hw->aq;
+	enum i40e_status_code ret_code;
 	u16 cfg_ptr, oem_hi, oem_lo;
 	u16 eetrack_lo, eetrack_hi;
-#endif
-	enum i40e_status_code ret_code;
-#ifdef PF_DRIVER
 	int retry = 0;
-#endif
 
 	/* verify input for valid configuration */
-	if ((hw->aq.num_arq_entries == 0) ||
-	    (hw->aq.num_asq_entries == 0) ||
-	    (hw->aq.arq_buf_size == 0) ||
-	    (hw->aq.asq_buf_size == 0)) {
+	if (aq->num_arq_entries == 0 ||
+	    aq->num_asq_entries == 0 ||
+	    aq->arq_buf_size == 0 ||
+	    aq->asq_buf_size == 0) {
 		ret_code = I40E_ERR_CONFIG;
 		goto init_adminq_exit;
 	}
-	i40e_init_spinlock(&hw->aq.asq_spinlock);
-	i40e_init_spinlock(&hw->aq.arq_spinlock);
+	i40e_init_spinlock(&aq->asq_spinlock);
+	i40e_init_spinlock(&aq->arq_spinlock);
 
 	/* Set up register offsets */
 	i40e_adminq_init_regs(hw);
@@ -618,23 +615,17 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_asq;
 
-#ifdef PF_DRIVER
-#ifdef INTEGRATED_VF
-	/* VF has no need of firmware */
-	if (i40e_is_vf(hw))
-		goto init_adminq_exit;
-#endif
 	/* There are some cases where the firmware may not be quite ready
 	 * for AdminQ operations, so we retry the AdminQ setup a few times
 	 * if we see timeouts in this first AQ call.
 	 */
 	do {
 		ret_code = i40e_aq_get_firmware_version(hw,
-							&hw->aq.fw_maj_ver,
-							&hw->aq.fw_min_ver,
-							&hw->aq.fw_build,
-							&hw->aq.api_maj_ver,
-							&hw->aq.api_min_ver,
+							&aq->fw_maj_ver,
+							&aq->fw_min_ver,
+							&aq->fw_build,
+							&aq->api_maj_ver,
+							&aq->api_min_ver,
 							NULL);
 		if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT)
 			break;
@@ -658,31 +649,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 			   &oem_lo);
 	hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo;
 
-	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 7)))
-		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
-
-	if (hw->mac.type == I40E_MAC_XL710 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
-		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-	if (hw->mac.type == I40E_MAC_X722 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-
-	/* Newer versions of firmware require lock when reading the NVM */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 5)))
-		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
-
-	if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
+	if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
 	}
@@ -692,21 +659,18 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	hw->nvm_release_on_done = false;
 	hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
 
-#endif /* PF_DRIVER */
 	ret_code = I40E_SUCCESS;
 
 	/* success! */
 	goto init_adminq_exit;
 
-#ifdef PF_DRIVER
 init_adminq_free_arq:
 	i40e_shutdown_arq(hw);
-#endif
 init_adminq_free_asq:
 	i40e_shutdown_asq(hw);
 init_adminq_destroy_spinlocks:
-	i40e_destroy_spinlock(&hw->aq.asq_spinlock);
-	i40e_destroy_spinlock(&hw->aq.arq_spinlock);
+	i40e_destroy_spinlock(&aq->asq_spinlock);
+	i40e_destroy_spinlock(&aq->arq_spinlock);
 
 init_adminq_exit:
 	return ret_code;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 09/36] net/i40e/base: adding flags for PHY types
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (7 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
                     ` (26 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Doug Dziggel, Michal Litwicki

Adding bit flags to enable/disable EEE capability for 2.5GBase-T and
5GBase-T PHY types as well as 'Set autonomous EEE for relevant enabled PHY
types' flag.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Michal Litwicki <michalx.litwicki@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index a89b88fa5..2bd8f81f9 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2027,12 +2027,15 @@ struct i40e_aq_get_phy_abilities_resp {
 #define I40E_AQ_PHY_FEC_ABILITY_KR	0x40
 #define I40E_AQ_PHY_FEC_ABILITY_RS	0x80
 	__le16	eee_capability;
+#define I40E_AQ_EEE_AUTO		0x0001
 #define I40E_AQ_EEE_100BASE_TX		0x0002
 #define I40E_AQ_EEE_1000BASE_T		0x0004
 #define I40E_AQ_EEE_10GBASE_T		0x0008
 #define I40E_AQ_EEE_1000BASE_KX		0x0010
 #define I40E_AQ_EEE_10GBASE_KX4		0x0020
 #define I40E_AQ_EEE_10GBASE_KR		0x0040
+#define I40E_AQ_EEE_2_5GBASE_T		0x0100
+#define I40E_AQ_EEE_5GBASE_T		0x0200
 	__le32	eeer_val;
 	u8	d3_lpan;
 #define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 10/36] net/i40e/base: improve AQ log granularity
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (8 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
                     ` (25 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Doug Dziggel, Robert Konklewski

This patch makes it possible to log only AQ descriptors, without the
entire AQ message buffers being dumped too. It should greatly reduce
kernel log size in cases where a full AQ dump is not needed.
Selection is made by setting flags in hw->debug_mask.

Additionally, some debug messages that preceded an AQ dump have been
moved to I40E_DEBUG_AQ_COMMAND class, which seems more appropriate.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c |  8 ++++----
 drivers/net/i40e/base/i40e_common.c | 19 ++++++++++++-------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b8c6e30f5..52bea842f 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -715,7 +715,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
 	desc = I40E_ADMINQ_DESC(*asq, ntc);
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
-		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+		i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
@@ -887,7 +887,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	}
 
 	/* bump the tail */
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,
 		      buff, buff_size);
 	(hw->aq.asq.next_to_use)++;
@@ -940,7 +940,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 		hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
 	}
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 		   "AQTX: desc and buffer writeback:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);
 
@@ -1069,7 +1069,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
 			    hw->aq.arq.r.arq_bi[desc_idx].va,
 			    e->msg_len, I40E_DMA_TO_NONDMA);
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,
 		      hw->aq.arq_buf_size);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 73d0c29fd..4384a0795 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -307,32 +307,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 		   void *buffer, u16 buf_len)
 {
 	struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
+	u32 effective_mask = hw->debug_mask & mask;
 	u8 *buf = (u8 *)buffer;
 	u16 len;
-	u16 i = 0;
+	u16 i;
 
-	if ((!(mask & hw->debug_mask)) || (desc == NULL))
+	if (!effective_mask || !desc)
 		return;
 
 	len = LE16_TO_CPU(aq_desc->datalen);
 
-	i40e_debug(hw, mask,
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
 		   "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
 		   LE16_TO_CPU(aq_desc->opcode),
 		   LE16_TO_CPU(aq_desc->flags),
 		   LE16_TO_CPU(aq_desc->datalen),
 		   LE16_TO_CPU(aq_desc->retval));
-	i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tcookie (h,l) 0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->cookie_high),
 		   LE32_TO_CPU(aq_desc->cookie_low));
-	i40e_debug(hw, mask, "\tparam (0,1)  0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tparam (0,1)  0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.internal.param0),
 		   LE32_TO_CPU(aq_desc->params.internal.param1));
-	i40e_debug(hw, mask, "\taddr (h,l)   0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\taddr (h,l)   0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.external.addr_high),
 		   LE32_TO_CPU(aq_desc->params.external.addr_low));
 
-	if ((buffer != NULL) && (aq_desc->datalen != 0)) {
+	if (buffer && (buf_len != 0) && (len != 0) &&
+	    (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
 		i40e_debug(hw, mask, "AQ CMD Buffer:\n");
 		if (buf_len < len)
 			len = buf_len;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 11/36] net/i40e/base: add getter for FW LLDP agent status
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (9 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
                     ` (24 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Pietruszewski

This change introduces i40e_get_fw_lldp_status() function capable of
reporting status of FW Link Layer Discovery Protocol (LLDP) agent.

Since reading LLDP configuration from NVM only gives information what
is the default state of FW LLDP agent after POR, this change introduces
more reliable method for checking if agent is enabled.

Current state of FW LLDP agent may be different if user disabled the
agent, so i40e_get_fw_lldp_status() uses LLDP MIB checking to determine
status of the agent.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 43 ++++++++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_dcb.h |  9 +++++++
 2 files changed, 52 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 7cc8c83dc..f1465daa3 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -914,6 +914,49 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 	return ret;
 }
 
+/**
+ * i40e_get_fw_lldp_status
+ * @hw: pointer to the hw struct
+ * @lldp_status: pointer to the status enum
+ *
+ * Get status of FW Link Layer Discovery Protocol (LLDP) Agent.
+ * Status of agent is reported via @lldp_status parameter.
+ **/
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status)
+{
+	enum i40e_status_code ret;
+	struct i40e_virt_mem mem;
+	u8 *lldpmib;
+
+	if (!lldp_status)
+		return I40E_ERR_PARAM;
+
+	/* Allocate buffer for the LLDPDU */
+	ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE);
+	if (ret)
+		return ret;
+
+	lldpmib = (u8 *)mem.va;
+	ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib,
+				   I40E_LLDPDU_SIZE, NULL, NULL, NULL);
+
+	if (ret == I40E_SUCCESS) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) {
+		/* MIB is not available yet but the agent is running */
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+		ret = I40E_SUCCESS;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED;
+		ret = I40E_SUCCESS;
+	}
+
+	i40e_free_virt_mem(hw, &mem);
+	return ret;
+}
+
 /**
  * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
  * @tlv: Fill the ETS config data in IEEE format
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 253943308..88fe405d7 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -178,6 +178,12 @@ struct i40e_dcbx_variables {
 	u32 deftsaassignment;
 };
 
+
+enum i40e_get_fw_lldp_status_resp {
+	I40E_GET_FW_LLDP_STATUS_DISABLED = 0,
+	I40E_GET_FW_LLDP_STATUS_ENABLED = 1
+};
+
 enum i40e_status_code i40e_get_dcbx_status(struct i40e_hw *hw,
 					   u16 *status);
 enum i40e_status_code i40e_lldp_to_dcb_config(u8 *lldpmib,
@@ -188,6 +194,9 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
 				    bool enable_mib_change);
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 12/36] net/i40e/base: add support for Energy Efficient Ethernet
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (10 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
                     ` (23 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Pietruszewski

This change adds i40e_enable_eee() function controlling advertisement
of Energy Efficient Ethernet mode (EEE).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 64 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 2 files changed, 65 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4384a0795..c2e7cf7d5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6306,6 +6306,70 @@ enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
 	return status;
 }
 
+
+/**
+ * i40e_enable_eee
+ * @hw: pointer to the hardware structure
+ * @enable: state of Energy Efficient Ethernet mode to be set
+ *
+ * Enables or disables Energy Efficient Ethernet (EEE) mode
+ * accordingly to @enable parameter.
+ **/
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable)
+{
+	struct i40e_aq_get_phy_abilities_resp abilities;
+	struct i40e_aq_set_phy_config config;
+	enum i40e_status_code status;
+	__le16 eee_capability;
+
+	/* Get initial PHY capabilities */
+	status = i40e_aq_get_phy_capabilities(hw, false, true, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Check whether NIC configuration is compatible with Energy Efficient
+	 * Ethernet (EEE) mode.
+	 */
+	if (abilities.eee_capability == 0) {
+		status = I40E_ERR_CONFIG;
+		goto err;
+	}
+
+	/* Cache initial EEE capability */
+	eee_capability = abilities.eee_capability;
+
+	/* Get current configuration */
+	status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Cache current configuration */
+	config.phy_type = abilities.phy_type;
+	config.link_speed = abilities.link_speed;
+	config.abilities = abilities.abilities |
+			   I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	config.eeer = abilities.eeer_val;
+	config.low_power_ctrl = abilities.d3_lpan;
+	config.fec_config = abilities.fec_cfg_curr_mod_ext_info &
+			    I40E_AQ_PHY_FEC_CONFIG_MASK;
+
+	/* Set desired EEE state */
+	if (enable) {
+		config.eee_capability = eee_capability;
+		config.eeer |= I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	} else {
+		config.eee_capability = 0;
+		config.eeer &= ~I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	}
+
+	/* Save modified config */
+	status = i40e_aq_set_phy_config(hw, &config, NULL);
+err:
+	return status;
+}
+
 /**
  * i40e_read_bw_from_alt_ram
  * @hw: pointer to the hardware structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2f3e0bfee..38beb270b 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -458,6 +458,7 @@ void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode,
 void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
 #if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 13/36] net/i40e/base: read LPI status from external PHY
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (11 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
                     ` (22 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Krzysztof Galazka,
	Piotr Pietruszewski

When external PHY is used, MAC register may not reflect actual
state of LPI. Add function reading it directly from PHY or MAC,
depending on what is supported by the device.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 45 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  2 ++
 drivers/net/i40e/base/i40e_type.h      |  6 ++++
 3 files changed, 53 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c2e7cf7d5..f256651d7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6982,6 +6982,51 @@ enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
 	return status;
 }
 #endif /* PF_DRIVER */
+/**
+ * i40e_get_phy_lpi_status - read LPI status from PHY or MAC register
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ *
+ * Read LPI state directly from external PHY register or from MAC
+ * register, depending on device ID and current link speed.
+ */
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stat)
+{
+	enum i40e_status_code ret = I40E_SUCCESS;
+	u32 val;
+
+	stat->rx_lpi_status = 0;
+	stat->tx_lpi_status = 0;
+
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB ||
+	     hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) {
+		ret = i40e_aq_get_phy_register(hw,
+					       I40E_AQ_PHY_REG_ACCESS_EXTERNAL,
+					       I40E_BCM_PHY_PCS_STATUS1_PAGE,
+					       true,
+					       I40E_BCM_PHY_PCS_STATUS1_REG,
+					       &val, NULL);
+
+		if (ret != I40E_SUCCESS)
+			return ret;
+
+		stat->rx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_RX_LPI);
+		stat->tx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_TX_LPI);
+
+		return ret;
+	}
+
+	val = rd32(hw, I40E_PRTPM_EEE_STAT);
+	stat->rx_lpi_status = (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
+	stat->tx_lpi_status = (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
+
+	return ret;
+}
+
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 38beb270b..c6c45eb5a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -74,6 +74,8 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
 
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stats);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 322300fa3..8d257e00a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -2038,4 +2038,10 @@ struct i40e_profile_info {
 	u8 reserved[7];
 	u8 name[I40E_DDP_NAME_SIZE];
 };
+
+#define I40E_BCM_PHY_PCS_STATUS1_PAGE	0x3
+#define I40E_BCM_PHY_PCS_STATUS1_REG	0x0001
+#define I40E_BCM_PHY_PCS_STATUS1_RX_LPI	BIT(8)
+#define I40E_BCM_PHY_PCS_STATUS1_TX_LPI	BIT(9)
+
 #endif /* _I40E_TYPE_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 14/36] net/i40e/base: change for missing "link modes"
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (12 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
                     ` (21 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Martyna Szapar

Fix for missing "Supported link modes" and "Advertised link modes"
info in ethtool after changed speed on X722 devices with BASE-T PHY
with FW API version >= 1.7.
The same FW API version on X710 and X722 does not mean the same
feature set so the change was needed as mac type of the device
should also be checked instead of FW API version only.

Signed-off-by: Martyna Szapar <martyna.szapar@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index f256651d7..e0028ac4d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2043,8 +2043,8 @@ 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) {
+	if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE &&
+	    hw->mac.type != I40E_MAC_X722) {
 		__le32 tmp;
 
 		i40e_memcpy(&tmp, resp->link_type, sizeof(tmp),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 15/36] net/i40e/base: add reading LPI counters
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (13 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
                     ` (20 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Pietruszewski

This change introduces new function i40e_get_lpi_counters() reading
Low Power Idle (LPI) mode counters from Energy Efficient Ethernet (EEE)
statistics. Since reading EEE statistics requires running DNL script,
function i40e_aq_run_phy_activity() able to run it, was implemented.

i40e_lpi_stat_update() was introduced as helper function for retrieving
LPI counters' values relative to given offsets.

This change also fixes order of fields in struct
i40e_aqc_run_phy_activity and introduces union in the struct
providing more descriptive names of fields depending on usage
(command or response).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  29 ++++--
 drivers/net/i40e/base/i40e_common.c     | 130 ++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  10 ++
 3 files changed, 163 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2bd8f81f9..d718c7326 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2272,15 +2272,32 @@ enum i40e_aq_phy_reg_type {
 	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
 };
 
+#pragma pack(1)
 /* Run PHY Activity (0x0626) */
 struct i40e_aqc_run_phy_activity {
-	__le16  activity_id;
-	u8      flags;
-	u8      reserved1;
-	__le32  control;
-	__le32  data;
-	u8      reserved2[4];
+	u8	cmd_flags;
+	__le16	activity_id;
+#define I40E_AQ_RUN_PHY_ACT_ID_USR_DFND			0x10
+	u8	reserved;
+	union {
+		struct {
+			__le32  dnl_opcode;
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR	0x801a
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR	0x1801b
+			__le32  data;
+			u8	reserved2[4];
+		} cmd;
+		struct {
+			__le32	cmd_status;
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK		0xFFFF
+			__le32	data0;
+			__le32	data1;
+		} resp;
+	} params;
 };
+#pragma pack()
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index e0028ac4d..9d76b6824 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7027,6 +7027,91 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 	return ret;
 }
 
+/**
+ * i40e_get_lpi_counters - read LPI counters from EEE statistics
+ * @hw: pointer to the hw struct
+ * @tx_counter: pointer to memory for TX LPI counter
+ * @rx_counter: pointer to memory for RX LPI counter
+ * @is_clear:   returns true if counters are clear after read
+ *
+ * Read Low Power Idle (LPI) mode counters from Energy Efficient
+ * Ethernet (EEE) statistics.
+ **/
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
+					    u32 *tx_counter, u32 *rx_counter,
+					    bool *is_clear)
+{
+	/* only X710-T*L requires special handling of counters
+	 * for other devices we just read the MAC registers
+	 */
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    hw->phy.link_info.link_speed != I40E_LINK_SPEED_1GB) {
+		enum i40e_status_code retval;
+		u32 cmd_status = 0;
+
+		*is_clear = false;
+		retval = i40e_aq_run_phy_activity(hw,
+				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
+				&cmd_status, tx_counter, rx_counter, NULL);
+
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+
+		return retval;
+	}
+
+	*is_clear = true;
+	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+
+	return I40E_SUCCESS;
+}
+
+/**
+ * i40e_lpi_stat_update - update LPI counters with values relative to offset
+ * @hw: pointer to the hw struct
+ * @offset_loaded: flag indicating need of writing current value to offset
+ * @tx_offset: pointer to offset of TX LPI counter
+ * @tx_stat: pointer to value of TX LPI counter
+ * @rx_offset: pointer to offset of RX LPI counter
+ * @rx_stat: pointer to value of RX LPI counter
+ *
+ * Update Low Power Idle (LPI) mode counters while having regard to passed
+ * offsets.
+ **/
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat)
+{
+	enum i40e_status_code retval;
+	u32 tx_counter, rx_counter;
+	bool is_clear;
+
+	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter, &is_clear);
+	if (retval)
+		goto err;
+
+	if (is_clear) {
+		*tx_stat += tx_counter;
+		*rx_stat += rx_counter;
+	} else {
+		if (!offset_loaded) {
+			*tx_offset = tx_counter;
+			*rx_offset = rx_counter;
+		}
+
+		*tx_stat = (tx_counter >= *tx_offset) ?
+			(u32)(tx_counter - *tx_offset) :
+			(u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+		*rx_stat = (rx_counter >= *rx_offset) ?
+			(u32)(rx_counter - *rx_offset) :
+			(u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+	}
+err:
+	return retval;
+}
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
@@ -7233,6 +7318,51 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 }
 
 #endif /* PF_DRIVER */
+/**
+ * i40e_aq_run_phy_activity
+ * @hw: pointer to the hw struct
+ * @activity_id: ID of DNL activity to run
+ * @dnl_opcode: opcode passed to DNL script
+ * @cmd_status: pointer to memory to write return value of DNL script
+ * @data0: pointer to memory for first 4 bytes of data returned by DNL script
+ * @data1: pointer to memory for last 4 bytes of data returned by DNL script
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Run DNL admin command.
+ **/
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 dnl_opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aqc_run_phy_activity *cmd;
+	enum i40e_status_code retval;
+	struct i40e_aq_desc desc;
+
+	cmd = (struct i40e_aqc_run_phy_activity *)&desc.params.raw;
+
+	if (!cmd_status || !data0 || !data1) {
+		retval = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_fill_default_direct_cmd_desc(&desc,
+					  i40e_aqc_opc_run_phy_activity);
+
+	cmd->activity_id = CPU_TO_LE16(activity_id);
+	cmd->params.cmd.dnl_opcode = CPU_TO_LE32(dnl_opcode);
+
+	retval = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+	if (retval)
+		goto err;
+
+	*cmd_status = LE32_TO_CPU(cmd->params.resp.cmd_status);
+	*data0 = LE32_TO_CPU(cmd->params.resp.data0);
+	*data1 = LE32_TO_CPU(cmd->params.resp.data1);
+err:
+	return retval;
+}
+
 #ifdef VF_DRIVER
 
 /**
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index c6c45eb5a..748a7a275 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -76,6 +76,12 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
+					    u32 *rx_counter, bool *is_clear);
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
@@ -550,6 +556,10 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 				u8 phy_select, u8 dev_addr, bool page_change,
 				u32 reg_addr, u32 *reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details);
 
 enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw,
 			struct i40e_aqc_arp_proxy_data *proxy_config,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 16/36] net/i40e/base: backport style changes from upstream Linux
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (14 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 17/36] net/i40e/base: update status codes Xiaolong Ye
                     ` (19 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Jacob Keller

The upstream virtchnl.h has a few minor style differences to what is
out-of-tree, and there is no real reason we should prefer the current
style over whats upstream.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 88096cb45..a8d5eaf8a 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -123,13 +123,13 @@ enum virtchnl_ops {
 
 };
 
-/* This macro is used to generate a compilation error if a structure
+/* These macros are used to generate compilation errors if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
  * structure is not of the correct size, otherwise it creates an enum that is
  * never used.
  */
 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
-	{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}
+	{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
 
 /* Virtual channel message descriptor. This overlays the admin queue
  * descriptor. All other data is passed in external buffers.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 17/36] net/i40e/base: update status codes
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (15 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
                     ` (18 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Mitch Williams

Add a few new status codes and rename a few to make them more consistent.
Error code are mapped to similar values as in i40e_status.h, so as to be
compatible with older VF drivers not using this status enum.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index a8d5eaf8a..c677d0eb5 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -40,13 +40,19 @@
 /* Error Codes */
 enum virtchnl_status_code {
 	VIRTCHNL_STATUS_SUCCESS				= 0,
-	VIRTCHNL_ERR_PARAM				= -5,
+	VIRTCHNL_STATUS_ERR_PARAM			= -5,
+	VIRTCHNL_STATUS_ERR_NO_MEMORY			= -18,
 	VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH		= -38,
 	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
 	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
-	VIRTCHNL_STATUS_NOT_SUPPORTED			= -64,
+	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
+	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
 };
 
+/* Backward compatibility */
+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
+
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
@@ -732,7 +738,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_EVENT:
 	case VIRTCHNL_OP_UNKNOWN:
 	default:
-		return VIRTCHNL_ERR_PARAM;
+		return VIRTCHNL_STATUS_ERR_PARAM;
 	}
 	/* few more checks */
 	if (err_msg_format || valid_len != msglen)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 18/36] net/i40e/base: change of the incorrect Tx descriptors number
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (16 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 17/36] net/i40e/base: update status codes Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
                     ` (17 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Doug Dziggel, Dariusz Chaberski

The existing driver allows setting the number of TX descriptors
to the value that is indivisible by 32. This is not properly
supported by x710 hardware. The patch limits the number of TX
descriptors to the whole value of 32.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Dariusz Chaberski <dariuszx.chaberski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 8d257e00a..f0e4b667a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -79,8 +79,8 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
 #define I40E_HI_BYTE(x)		((u8)(((x) >> 8) & 0xFF))
 #define I40E_LO_BYTE(x)		((u8)((x) & 0xFF))
 
-/* Number of Transmit Descriptors must be a multiple of 8. */
-#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	8
+/* Number of Transmit Descriptors must be a multiple of 32. */
+#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	32
 /* Number of Receive Descriptors must be a multiple of 32 if
  * the number of descriptors is greater than 32.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 19/36] net/i40e/base: extend PHY access AQ command
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (17 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
                     ` (16 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Azarewicz

Currently FW use MDIO I/F number corresponded with current PF for PHY
access. This code allow to specify used MDIO I/F number.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 57 +++++++++++++++++++++++
 drivers/net/i40e/base/i40e_adminq_cmd.h |  6 ++-
 drivers/net/i40e/base/i40e_common.c     | 62 ++++++++++++++++++++-----
 drivers/net/i40e/base/i40e_prototype.h  | 27 +++++++----
 drivers/net/i40e/base/i40e_type.h       |  1 +
 5 files changed, 132 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 52bea842f..96e170e12 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -569,6 +569,57 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
 }
 #endif /* PF_DRIVER */
 
+/**
+ *  i40e_set_hw_flags - set HW flags
+ *  @hw: pointer to the hardware structure
+ **/
+STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
+{
+	struct i40e_adminq_info *aq = &hw->aq;
+
+	hw->flags = 0;
+
+	switch (hw->mac.type) {
+	case I40E_MAC_XL710:
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) {
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+			/* The ability to RX (not drop) 802.1ad frames */
+			hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
+		}
+		break;
+	case I40E_MAC_X722:
+		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
+			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+		/* fall through */
+	default:
+		break;
+	}
+
+	/* Newer versions of firmware require lock when reading the NVM */
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 5))
+		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 8))
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 9))
+		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED;
+}
+
 /**
  *  i40e_init_adminq - main initialization routine for Admin Queue
  *  @hw: pointer to the hardware structure
@@ -636,6 +687,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_arq;
 
+	/*
+	 * Some features were introduced in different FW API version
+	 * for different MAC type.
+	 */
+	i40e_set_hw_flags(hw);
+
 	/* get the NVM version info */
 	i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION,
 			   &hw->nvm.version);
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index d718c7326..7181e0f58 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2310,7 +2310,11 @@ struct i40e_aqc_phy_register_access {
 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE	2
 	u8	dev_addres;
 	u8	cmd_flags;
-#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	1
+#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	0x01
+#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER	0x02
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT	2
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK	(0x3 << \
+		I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT)
 	u8	reserved1;
 	__le32	reg_address;
 	__le32	reg_value;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9d76b6824..ee081d6ad 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7239,23 +7239,52 @@ void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val)
 		wr32(hw, reg_addr, reg_val);
 }
 
-#ifdef PF_DRIVER
 /**
- * i40e_aq_set_phy_register
+ * i40e_mdio_if_number_selection - MDIO I/F number selection
+ * @hw: pointer to the hw struct
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
+ * @cmd: pointer to PHY Register command structure
+ **/
+static void
+i40e_mdio_if_number_selection(struct i40e_hw *hw, bool set_mdio, u8 mdio_num,
+			      struct i40e_aqc_phy_register_access *cmd)
+{
+	if (set_mdio && cmd->phy_interface == I40E_AQ_PHY_REG_ACCESS_EXTERNAL) {
+		if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED)
+			cmd->cmd_flags |=
+				I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER |
+				((mdio_num <<
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) &
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK);
+		else
+			i40e_debug(hw, I40E_DEBUG_PHY,
+				   "MDIO I/F number selection not supported by current FW version.\n");
+	}
+}
+
+/**
+ * i40e_aq_set_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: new register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Write the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_set_phy_register.
  **/
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7273,27 +7302,35 @@ enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
 }
 
 /**
- * i40e_aq_get_phy_register
+ * i40e_aq_get_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: read register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Read the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_get_phy_register.
  **/
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7310,6 +7347,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 	if (!status)
 		*reg_val = LE32_TO_CPU(cmd->reg_value);
@@ -7317,7 +7356,6 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	return status;
 }
 
-#endif /* PF_DRIVER */
 /**
  * i40e_aq_run_phy_activity
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 748a7a275..fcfe497f1 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -548,14 +548,25 @@ enum i40e_status_code i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
 				u32 reg_addr, u32 reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+
+/* Convenience wrappers for most common use case */
+#define i40e_aq_set_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_set_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+#define i40e_aq_get_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_get_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+
 enum i40e_status_code
 i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
 			 u32 *cmd_status, u32 *data0, u32 *data1,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index f0e4b667a..b380193f7 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -743,6 +743,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
+#define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 20/36] net/i40e/base: add drop mode parameter to set MAC config
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (18 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
                     ` (15 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Wnuczko Sylwia

This patch adds "drop mode" parameter to set mac config AQ command.
This bit controls the behavior when a no-drop packet is blocking a TC
queue.
0 – The PF driver is notified.
1 – The blocking packet is dropped and then the PF driver is notified.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  4 +++-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 29 +++++++++++++------------
 drivers/net/i40e/base/i40e_common.c     | 11 ++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  1 +
 drivers/net/i40e/base/i40e_type.h       |  1 +
 drivers/net/i40e/i40e_ethdev.c          |  2 +-
 6 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 96e170e12..0676f9a25 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -611,8 +611,10 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
-	     aq->api_min_ver >= 8))
+	     aq->api_min_ver >= 8)) {
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+		hw->flags |= I40E_HW_FLAG_DROP_MODE;
+	}
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7181e0f58..f6c9d3e1a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2098,20 +2098,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
 struct i40e_aq_set_mac_config {
 	__le16	max_frame_size;
 	u8	params;
-#define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
-#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
-#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
-#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
-#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
-#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
+#define I40E_AQ_SET_MAC_CONFIG_CRC_EN			0x04
+#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK		0x78
+#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT		3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE		0x0
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX		0xF
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX		0x9
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX		0x8
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX		0x7
+#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX		0x6
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX		0x5
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX		0x4
+#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX		0x3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX		0x2
+#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX		0x1
+#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN	0x80
 	u8	tx_timer_priority; /* bitmap */
 	__le16	tx_timer_value;
 	__le16	fc_refresh_threshold;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index ee081d6ad..eddc91e36 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1873,6 +1873,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
  * @max_frame_size: Maximum Frame Size to be supported by the port
  * @crc_en: Tell HW to append a CRC to outgoing frames
  * @pacing: Pacing configurations
+ * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked
  * @cmd_details: pointer to command details structure or NULL
  *
  * Configure MAC settings for frame size, jumbo frame support and the
@@ -1881,6 +1882,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size,
 				bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -1899,6 +1901,15 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 	if (crc_en)
 		cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN;
 
+	if (auto_drop_blocking_packets) {
+		if (hw->flags & I40E_HW_FLAG_DROP_MODE)
+			cmd->params |=
+				I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "This FW api version does not support drop mode.\n");
+	}
+
 #define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD	0x7FFF
 	cmd->fc_refresh_threshold =
 		CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD);
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index fcfe497f1..43db2a6f3 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -114,6 +114,7 @@ enum i40e_status_code i40e_aq_set_phy_int_mask(struct i40e_hw *hw, u16 mask,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size, bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_local_advt_reg(struct i40e_hw *hw,
 				u64 *advt_reg,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index b380193f7..d20b0fe20 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -744,6 +744,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
+#define I40E_HW_FLAG_DROP_MODE		    BIT_ULL(7)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b93c56e46..e5f0a5572 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1649,7 +1649,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* Set the max frame size to 0x2600 by default,
 	 * in case other drivers changed the default value.
 	 */
-	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, 0, NULL);
+	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, false, 0, NULL);
 
 	/* initialize mirror rule list */
 	TAILQ_INIT(&pf->mirror_list);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 21/36] net/i40e/base: add FWS1B register masks
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (19 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 22/36] net/i40e/base: update FW API version Xiaolong Ye
                     ` (14 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Adrian Podlawski

Function check_recovery_mode had wrong if statement. Now we check proper
FWS1B register values, which are responsible for the recovery mode.
Recovery mode has 6 values in total. That's why we need 6 different flags.
Now in if statement we recognize type of mac and register value. Without
those changes driver could show wrong state.

Signed-off-by: Adrian Podlawski <adrian.podlawski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index e93ec3f58..6804aba51 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,18 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK \
+				I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK \
+				I40E_MASK(0x33, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0xB, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0xC, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_GLGEN_CLKSTAT                    0x000B8184 /* Reset: POR */
 #define I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT      0
 #define I40E_GLGEN_CLKSTAT_CLKMODE_MASK       I40E_MASK(0x1, I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 22/36] net/i40e/base: update FW API version
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (20 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
                     ` (13 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Azarewicz

Update FW API version to 1.9.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index f6c9d3e1a..0443c6361 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -12,8 +12,8 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0006
-#define I40E_FW_API_VERSION_MINOR_X710	0x0007
+#define I40E_FW_API_VERSION_MINOR_X722	0x0009
+#define I40E_FW_API_VERSION_MINOR_X710	0x0009
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 23/36] net/i40e/base: add persistent lldp support
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (21 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 22/36] net/i40e/base: update FW API version Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
                     ` (12 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Wnuczko Sylwia

This patch adds a function to read nvm module data and uses it to
read current lldp agent configuration from nvm api version 1.8.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c       | 20 +++++++-
 drivers/net/i40e/base/i40e_dcb.h       |  5 ++
 drivers/net/i40e/base/i40e_nvm.c       | 71 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 4 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index f1465daa3..2ab5021ee 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -877,7 +877,25 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
-	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
+		u8 offset = 0;
+
+		if (hw->mac.type == I40E_MAC_XL710)
+			offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;
+		else if (hw->mac.type == I40E_MAC_X722)
+			offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
+		else
+			return I40E_NOT_SUPPORTED;
+
+		ret = i40e_read_nvm_module_data(hw,
+						I40E_SR_EMP_SR_SETTINGS_PTR,
+						offset,
+						I40E_LLDP_CURRENT_STATUS_OFFSET,
+						I40E_LLDP_CURRENT_STATUS_SIZE,
+						&lldp_cfg.adminstatus);
+	} else {
+		ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	}
 	if (ret)
 		return I40E_ERR_NOT_READY;
 
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 88fe405d7..520c7db73 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -39,6 +39,11 @@
 #define I40E_LLDP_ADMINSTATUS_ENABLED_TX	2
 #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX	3
 
+#define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET	0x2B
+#define I40E_LLDP_CURRENT_STATUS_X722_OFFSET	0x31
+#define I40E_LLDP_CURRENT_STATUS_OFFSET		1
+#define I40E_LLDP_CURRENT_STATUS_SIZE		1
+
 /* Defines for LLDP TLV header */
 #define I40E_LLDP_MIB_HLEN		14
 #define I40E_LLDP_TLV_LEN_SHIFT		0
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index c8b401cdd..fc24cc2ce 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -337,6 +337,77 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 	return ret_code;
 }
 
+/**
+ * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location
+ * @hw: Pointer to the HW structure
+ * @module_ptr: Pointer to module in words with respect to NVM beginning
+ * @module_offset: Offset in words from module start
+ * @data_offset: Offset in words from reading data area start
+ * @words_data_size: Words to read from NVM
+ * @data_ptr: Pointer to memory location where resulting buffer will be stored
+ **/
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr)
+{
+	enum i40e_status_code status;
+	u16 specific_ptr = 0;
+	u16 ptr_value = 0;
+	u16 offset = 0;
+
+	if (module_ptr != 0) {
+		status = i40e_read_nvm_word(hw, module_ptr, &ptr_value);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+	}
+#define I40E_NVM_INVALID_PTR_VAL 0x7FFF
+#define I40E_NVM_INVALID_VAL 0xFFFF
+
+	/* Pointer not initialized */
+	if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
+	    ptr_value == I40E_NVM_INVALID_VAL) {
+		i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n");
+		return I40E_ERR_BAD_PTR;
+	}
+
+	/* Check whether the module is in SR mapped area or outside */
+	if (ptr_value & I40E_PTR_TYPE) {
+		/* Pointer points outside of the Shared RAM mapped area */
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n");
+
+		return I40E_ERR_PARAM;
+	} else {
+		/* Read from the Shadow RAM */
+
+		status = i40e_read_nvm_word(hw, ptr_value + module_offset,
+					    &specific_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+
+		offset = ptr_value + module_offset + specific_ptr +
+			data_offset;
+
+		status = i40e_read_nvm_buffer(hw, offset, &words_data_size,
+					      data_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm buffer failed.Error code: %d.\n",
+				   status);
+		}
+	}
+
+	return status;
+}
+
 /**
  * i40e_read_nvm_buffer_srctl - Reads Shadow RAM buffer via SRCTL register
  * @hw: pointer to the HW structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 43db2a6f3..afebf441d 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -442,6 +442,9 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,
 void i40e_release_nvm(struct i40e_hw *hw);
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 					 u16 *data);
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr);
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
 					   u16 *words, u16 *data);
 enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (22 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-17 10:39     ` Kwapulinski, Piotr
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 25/36] net/i40e/base: change retrying logic Xiaolong Ye
                     ` (11 subsequent siblings)
  35 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Kwapulinski

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type()
to be public. It is required for recovery mode handling. Without this patch
recovery mode could not be detected at probe() function.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index eddc91e36..4f87ec9fa 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#else
-STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#endif
 {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index afebf441d..2b6198985 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -472,10 +472,8 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
 enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
-#if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 25/36] net/i40e/base: change retrying logic
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (23 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
                     ` (10 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Marcin Formela

Fixed a bug where driver was breaking out of the loop and
reporting an error without retrying first.

Signed-off-by: Marcin Formela <marcin.formela@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4f87ec9fa..a37e70599 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1714,19 +1714,22 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
 		status = i40e_asq_send_command(hw, &desc, abilities,
 					       abilities_size, cmd_details);
 
-		if (status != I40E_SUCCESS)
-			break;
-
-		if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) {
+		switch (hw->aq.asq_last_status) {
+		case I40E_AQ_RC_EIO:
 			status = I40E_ERR_UNKNOWN_PHY;
 			break;
-		} else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) {
+		case I40E_AQ_RC_EAGAIN:
 			i40e_msec_delay(1);
 			total_delay++;
 			status = I40E_ERR_TIMEOUT;
+			break;
+		/* also covers I40E_AQ_RC_OK */
+		default:
+			break;
 		}
-	} while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) &&
-		 (total_delay < max_delay));
+
+	} while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) &&
+		(total_delay < max_delay));
 
 	if (status != I40E_SUCCESS)
 		return status;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 26/36] net/i40e/base: mark additional missing bits as reserved
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (24 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 25/36] net/i40e/base: change retrying logic Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
                     ` (9 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Jacob Keller

Mark bits 0xD through 0xF for the command flags of a cloud filter as
reserved. These bits are not yet defined and are considered as reserved
in the data sheet.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 0443c6361..658875a0d 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1402,6 +1402,9 @@ struct i40e_aqc_cloud_filters_element_data {
 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
 #define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C
+/* 0x000D reserved */
+/* 0x000E reserved */
+/* 0x000F reserved */
 /* 0x0010 to 0x0017 is for custom filters */
 #define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT		0x0010 /* Dest IP + L4 Port */
 #define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT		0x0011 /* Dest MAC + L4 Port */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 27/36] net/i40e/base: change wrong 'Advertised FEC modes'
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (25 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
                     ` (8 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Jaroslaw Gawin

Fix display of FEC settings for ethtool.
This patch change variable 'phy.link_info.req_fec_info' sent to ethtool.
Without this patch wrong FEC settings can be shown.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index a37e70599..9ad0dd654 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2911,9 +2911,16 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw)
 		if (status)
 			return status;
 
-		hw->phy.link_info.req_fec_info =
-			abilities.fec_cfg_curr_mod_ext_info &
-			(I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS);
+		if (abilities.fec_cfg_curr_mod_ext_info &
+		    I40E_AQ_ENABLE_FEC_AUTO)
+			hw->phy.link_info.req_fec_info =
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
+		else
+			hw->phy.link_info.req_fec_info =
+				abilities.fec_cfg_curr_mod_ext_info &
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
 
 		i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type,
 			sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 28/36] net/i40e/base: add Flow Director defines
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (26 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
                     ` (7 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Doug Dziggel

Add defines for creating Flow Director flows as defined in datasheet
section 7.1.5.4 for field vectors.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 6804aba51..3a8c0ccd1 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -5287,6 +5287,87 @@
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT 0
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_MASK  I40E_MASK(0x3FFFFFFF, I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT)
 #endif /* PF_DRIVER */
+/* Flow Director */
+#define I40E_REG_INSET_L2_DMAC_SHIFT            60
+#define I40E_REG_INSET_L2_DMAC_MASK             I40E_MASK(0xEULL, I40E_REG_INSET_L2_DMAC_SHIFT)
+#define I40E_REG_INSET_L2_SMAC_SHIFT            56
+#define I40E_REG_INSET_L2_SMAC_MASK             I40E_MASK(0x1CULL, I40E_REG_INSET_L2_SMAC_SHIFT)
+#define I40E_REG_INSET_L2_OUTER_VLAN_SHIFT      26
+#define I40E_REG_INSET_L2_OUTER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_OUTER_VLAN_SHIFT)
+#define I40E_REG_INSET_L2_INNER_VLAN_SHIFT      55
+#define I40E_REG_INSET_L2_INNER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_INNER_VLAN_SHIFT)
+#define I40E_REG_INSET_TUNNEL_VLAN_SHIFT        56
+#define I40E_REG_INSET_TUNNEL_VLAN_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_VLAN_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP4_SHIFT         47
+#define I40E_REG_INSET_L3_SRC_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP4_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT    49
+#define I40E_X722_REG_INSET_L3_SRC_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_DST_IP4_SHIFT    41
+#define I40E_X722_REG_INSET_L3_DST_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT  52
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_MASK   I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT    52
+#define I40E_X722_REG_INSET_L3_IP4_TTL_MASK     I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TOS_SHIFT         54
+#define I40E_REG_INSET_L3_IP4_TOS_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TOS_SHIFT)
+#define I40E_REG_INSET_L3_IP4_PROTO_SHIFT       50
+#define I40E_REG_INSET_L3_IP4_PROTO_MASK        I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TTL_SHIFT         50
+#define I40E_REG_INSET_L3_IP4_TTL_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP6_SHIFT         43
+#define I40E_REG_INSET_L3_SRC_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_SRC_IP6_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP6_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_L3_IP6_TC_SHIFT          54
+#define I40E_REG_INSET_L3_IP6_TC_MASK           I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_TC_SHIFT)
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT    51
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT)
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT   51
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT)
+#define I40E_REG_INSET_L4_SRC_PORT_SHIFT        34
+#define I40E_REG_INSET_L4_SRC_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_SRC_PORT_SHIFT)
+#define I40E_REG_INSET_L4_DST_PORT_SHIFT        33
+#define I40E_REG_INSET_L4_DST_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_DST_PORT_SHIFT)
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT 31
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_MASK  I40E_MASK(0x3ULL, I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT  22
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT  11
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT   21
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT)
+#define I40E_REG_INSET_TUNNEL_ID_SHIFT          18
+#define I40E_REG_INSET_TUNNEL_ID_MASK           I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_ID_SHIFT)
+#define I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT    14
+#define I40E_REG_INSET_LAST_ETHER_TYPE_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT  8
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_MASK   I40E_MASK(0xFFULL, I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT 13
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT 12
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT 11
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT 10
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT 9
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT 8
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT 7
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_MASK  I40E_MASK(0xFFULL, I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT)
+#define I40E_REG_INSET_MASK_DEFAULT             0x0000000000000000ULL
+
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT       30
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_MASK        I40E_MASK(0x1, I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT)
 #define I40E_VFINT_DYN_CTLN1_WB_ON_ITR_SHIFT       30
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 29/36] net/i40e/base: removed unreachable code
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (27 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
                     ` (6 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Dzmitry Sautsa

The result of the check is always FALSE and the code within "if"
is never executed.

Signed-off-by: Dzmitry Sautsa <dzmitryx.sautsa@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9ad0dd654..8144d957e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4869,8 +4869,6 @@ enum i40e_status_code i40e_aq_add_mcast_etag(struct i40e_hw *hw, u16 pv_seid,
 	cmd->num_unicast_etags = num_tags_in_buf;
 
 	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (length > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
 
 	status = i40e_asq_send_command(hw, &desc, buf, length, cmd_details);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 30/36] net/i40e/base: set PHY Access flag on X722
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (28 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
                     ` (5 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Adam Ludkiewicz

The X722 FW API version 1.9 adds support for accessing PHY
registers with Admin Queue Command. This enables reading
EEPROM data from (Q)SFP+ transceivers, what was previously
possible only on X710 devices.

Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 5 +++++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 0676f9a25..221c327d1 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -598,6 +598,11 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 		    (aq->api_maj_ver == 1 &&
 		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
 			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
 		/* fall through */
 	default:
 		break;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 658875a0d..d99fbbe6a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -21,6 +21,8 @@
 
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */
+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 31/36] net/i40e/base: implement reading lpi statistics
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (29 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
                     ` (4 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Jaroslaw Gawin

There was no time duration statistics for LPI (Low Power Idle)
in EEE (Energy-Efficient Ethernet).
Added new procedure to get duration values from FW.
Otherwise there is no available procedure to get tx_lpi_duration
and rx_lpi_duration values.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 56 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 drivers/net/i40e/base/i40e_type.h      |  2 +
 3 files changed, 61 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8144d957e..d90012fd7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7083,6 +7083,62 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	return I40E_SUCCESS;
 }
 
+/**
+ * i40e_get_lpi_duration - read LPI time duration from EEE statistics
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ * @tx_duration: pointer to memory for TX LPI time duration
+ * @rx_duration: pointer to memory for RX LPI time duration
+ *
+ * Read Low Power Idle (LPI) mode time duration from Energy Efficient
+ * Ethernet (EEE) statistics.
+ */
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration)
+{
+	u32 tx_time_dur, rx_time_dur;
+	enum i40e_status_code retval;
+	u32 cmd_status;
+
+	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC)
+		return I40E_ERR_NOT_IMPLEMENTED;
+
+	retval = i40e_aq_run_phy_activity
+		(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+		I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR,
+		&cmd_status, &tx_time_dur, &rx_time_dur, NULL);
+
+	if (retval)
+		return retval;
+	if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+	    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+		return I40E_ERR_ADMIN_QUEUE_ERROR;
+
+	if (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB &&
+	    !tx_time_dur && !rx_time_dur &&
+	    stat->tx_lpi_status && stat->rx_lpi_status) {
+		retval = i40e_aq_run_phy_activity
+			(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+			I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR,
+			&cmd_status,
+			&tx_time_dur, &rx_time_dur, NULL);
+
+		if (retval)
+			return retval;
+		if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+		    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			return I40E_ERR_ADMIN_QUEUE_ERROR;
+		tx_time_dur = 0;
+		rx_time_dur = 0;
+	}
+
+	*tx_duration = tx_time_dur;
+	*rx_duration = rx_time_dur;
+
+	return retval;
+}
+
 /**
  * i40e_lpi_stat_update - update LPI counters with values relative to offset
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2b6198985..0d1adb689 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -82,6 +82,9 @@ enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 					   bool offset_loaded, u64 *tx_offset,
 					   u64 *tx_stat, u64 *rx_offset,
 					   u64 *rx_stat);
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index d20b0fe20..af9089829 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1498,6 +1498,8 @@ struct i40e_hw_port_stats {
 	u32 rx_lpi_status;
 	u64 tx_lpi_count;		/* etlpic */
 	u64 rx_lpi_count;		/* erlpic */
+	u64 tx_lpi_duration;
+	u64 rx_lpi_duration;
 };
 
 /* Checksum and Shadow RAM pointers */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 32/36] net/i40e/base: exposing missing LED functionality
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (30 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
                     ` (3 subsequent siblings)
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Rusinski

The previous code had the LED code wrapped such that, it was
static to the file and not usable outside of it. It is now available.

Signed-off-by: Rusinski <mateusz.rusinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 8 ++++----
 drivers/net/i40e/base/i40e_prototype.h | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d90012fd7..d0cb53a9d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6851,8 +6851,8 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
  * @led_addr: LED register address
  * @reg_val: read register value
  **/
-static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 *reg_val)
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
@@ -6880,8 +6880,8 @@ static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
  * @led_addr: LED register address
  * @reg_val: register value to write
  **/
-static enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 reg_val)
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0d1adb689..0f06e3262 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -73,7 +73,10 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 				       u16 *val);
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
-
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val);
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val);
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (31 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-17 10:40     ` Kwapulinski, Piotr
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
                     ` (2 subsequent siblings)
  35 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Piotr Kwapulinski

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 3a8c0ccd1..436f48efa 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 34/36] net/i40e/base: add CRC stripping capability
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (32 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, paul.m.stillwell.jr, Xiaolong Ye

Some VFs may want to disable CRC stripping on incoming packets
so create an offload for that. The VF already sends information
about configuring it's RX queues so use that structure to
indicate that the CRC stripping should be enabled or not.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.h |  3 +--
 drivers/net/i40e/base/virtchnl.h | 12 ++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 520c7db73..60193c98d 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2018
+ * Copyright(c) 2001-2019
  */
 
 #ifndef _I40E_DCB_H_
@@ -205,5 +205,4 @@ i40e_get_fw_lldp_status(struct i40e_hw *hw,
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-
 #endif /* _I40E_DCB_H_ */
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c677d0eb5..c613d4761 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -228,6 +228,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040
+#define VIRTCHNL_VF_OFFLOAD_CRC			0x00000080
 #define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000
 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000
 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
@@ -276,7 +277,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
  * VF sends this message to set up parameters for one RX queue.
  * External data buffer contains one instance of virtchnl_rxq_info.
- * PF configures requested queue and returns a status code.
+ * PF configures requested queue and returns a status code. The
+ * crc_disable flag disables CRC stripping on the VF. Setting
+ * the crc_disable flag to 1 will disable CRC stripping for each
+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
+ * offload must have been set prior to sending this info or the PF
+ * will ignore the request. This flag should be set the same for
+ * all of the queues for a VF.
  */
 
 /* Rx queue config info */
@@ -288,7 +295,8 @@ struct virtchnl_rxq_info {
 	u16 splithdr_enabled; /* deprecated with AVF 1.0 */
 	u32 databuffer_size;
 	u32 max_pkt_size;
-	u32 pad1;
+	u8 crc_disable;
+	u8 pad1[3];
 	u64 dma_ring_addr;
 	enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
 	u32 pad2;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 35/36] net/i40e/base: enable LED blinking flow
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (33 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
  35 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Damian Milosek

Add X710T*L device specific operations (in port LED detection and
handling of GLGEN_GPIO_CTL.PIN_FUNC field) to enable LED blinking.

Signed-off-by: Damian Milosek <damian.milosek@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 28 +++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_devids.h |  2 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d0cb53a9d..84e67f285 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1544,9 +1544,9 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 	u32 gpio_val = 0;
 	u32 port;
 
-	if (!hw->func_caps.led[idx])
+	if (!I40E_IS_X710TL_DEVICE(hw->device_id) &&
+	    !hw->func_caps.led[idx])
 		return 0;
-
 	gpio_val = rd32(hw, I40E_GLGEN_GPIO_CTL(idx));
 	port = (gpio_val & I40E_GLGEN_GPIO_CTL_PRT_NUM_MASK) >>
 		I40E_GLGEN_GPIO_CTL_PRT_NUM_SHIFT;
@@ -1565,8 +1565,15 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 #define I40E_FILTER_ACTIVITY 0xE
 #define I40E_LINK_ACTIVITY 0xC
 #define I40E_MAC_ACTIVITY 0xD
+#define I40E_FW_LED BIT(4)
+#define I40E_LED_MODE_VALID (I40E_GLGEN_GPIO_CTL_LED_MODE_MASK >> \
+			     I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT)
+
 #define I40E_LED0 22
 
+#define I40E_PIN_FUNC_SDP 0x0
+#define I40E_PIN_FUNC_LED 0x1
+
 /**
  * i40e_led_get - return current on/off mode
  * @hw: pointer to the hw struct
@@ -1628,8 +1635,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 	u32 current_mode = 0;
 	int i;
 
-	if (mode & 0xfffffff0)
+	if (mode & ~I40E_LED_MODE_VALID) {
 		DEBUGOUT1("invalid mode passed in %X\n", mode);
+		return;
+	}
 
 	/* as per the documentation GPIO 22-29 are the LED
 	 * GPIO pins named LED0..LED7
@@ -1655,6 +1664,19 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 			break;
 		}
 
+		if (I40E_IS_X710TL_DEVICE(hw->device_id)) {
+			u32 pin_func = 0;
+
+			if (mode & I40E_FW_LED)
+				pin_func = I40E_PIN_FUNC_SDP;
+			else
+				pin_func = I40E_PIN_FUNC_LED;
+
+			gpio_val &= ~I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK;
+			gpio_val |= ((pin_func <<
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_SHIFT) &
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK);
+		}
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index 1700db17a..5897d38f6 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -38,6 +38,8 @@
 #endif
 #define I40E_DEV_ID_10G_B		0x104F
 #define I40E_DEV_ID_10G_SFP		0x104E
+#define I40E_IS_X710TL_DEVICE(d) \
+	((d) == I40E_DEV_ID_10G_BASE_T_BC)
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
                     ` (34 preceding siblings ...)
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
@ 2019-12-16  2:43   ` Xiaolong Ye
  2019-12-27  5:37     ` Xing, Beilei
  35 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2019-12-16  2:43 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, paul.m.stillwell.jr, Xiaolong Ye, Aleksandr Loktionov

This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg
for 2.5Gb/5Gb speeds. This problem is fixed by adding constants
for VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_prototype.h | 4 ++++
 drivers/net/i40e/base/virtchnl.h       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0f06e3262..d8ab3ea0a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -505,6 +505,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
 		return VIRTCHNL_LINK_SPEED_100MB;
 	case I40E_LINK_SPEED_1GB:
 		return VIRTCHNL_LINK_SPEED_1GB;
+	case I40E_LINK_SPEED_2_5GB:
+		return VIRTCHNL_LINK_SPEED_2_5GB;
+	case I40E_LINK_SPEED_5GB:
+		return VIRTCHNL_LINK_SPEED_5GB;
 	case I40E_LINK_SPEED_10GB:
 		return VIRTCHNL_LINK_SPEED_10GB;
 	case I40E_LINK_SPEED_40GB:
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c613d4761..92515bf34 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -53,12 +53,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
 
 enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
@@ -68,6 +70,8 @@ enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_40GB	= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_20GB	= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_25GB	= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_2_5GB	= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_5GB		= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2019-12-17 10:39     ` Kwapulinski, Piotr
  0 siblings, 0 replies; 198+ messages in thread
From: Kwapulinski, Piotr @ 2019-12-17 10:39 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev, Stillwell Jr, Paul M

ACK

-----Original Message-----
From: Ye, Xiaolong <xiaolong.ye@intel.com> 
Sent: Monday, December 16, 2019 3:43 AM
To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; Kwapulinski, Piotr <piotr.kwapulinski@intel.com>
Subject: [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type() to be public. It is required for recovery mode handling. Without this patch recovery mode could not be detected at probe() function.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index eddc91e36..4f87ec9fa 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw) -#else -STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw) -#endif  {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index afebf441d..2b6198985 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -472,10 +472,8 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);  #endif /* PF_DRIVER */  enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
-#if defined(I40E_QV) || defined(VF_DRIVER)  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
--
2.17.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2019-12-17 10:40     ` Kwapulinski, Piotr
  0 siblings, 0 replies; 198+ messages in thread
From: Kwapulinski, Piotr @ 2019-12-17 10:40 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev, Stillwell Jr, Paul M

ACK

-----Original Message-----
From: Ye, Xiaolong <xiaolong.ye@intel.com> 
Sent: Monday, December 16, 2019 3:44 AM
To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; Kwapulinski, Piotr <piotr.kwapulinski@intel.com>
Subject: [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 3a8c0ccd1..436f48efa 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, 
+I40E_GL_FWSTS_FWS1B_SHIFT) #define I40E_GL_FWSTS_FWS1B_EMPR_10 
+I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)  #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
--
2.17.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants
  2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
@ 2019-12-27  5:37     ` Xing, Beilei
  2020-01-02  9:58       ` Loktionov, Aleksandr
  0 siblings, 1 reply; 198+ messages in thread
From: Xing, Beilei @ 2019-12-27  5:37 UTC (permalink / raw)
  To: Ye, Xiaolong, Zhang, Qi Z; +Cc: dev, Stillwell Jr, Paul M, Loktionov, Aleksandr



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, December 16, 2019 10:44 AM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>; Ye,
> Xiaolong <xiaolong.ye@intel.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>
> Subject: [PATCH v3 36/36] net/i40e/base: add new link speed constants
> 
> This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg for 2.5Gb/5Gb
> speeds. This problem is fixed by adding constants for
> VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.
> 

It's a fix patch, fix line is needed? The same comment is also for patch 27/36, 25/36, 21/36, 14/36.

> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/i40e_prototype.h | 4 ++++
>  drivers/net/i40e/base/virtchnl.h       | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/i40e/base/i40e_prototype.h
> b/drivers/net/i40e/base/i40e_prototype.h
> index 0f06e3262..d8ab3ea0a 100644
> --- a/drivers/net/i40e/base/i40e_prototype.h
> +++ b/drivers/net/i40e/base/i40e_prototype.h
> @@ -505,6 +505,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed
> link_speed)
>  		return VIRTCHNL_LINK_SPEED_100MB;
>  	case I40E_LINK_SPEED_1GB:
>  		return VIRTCHNL_LINK_SPEED_1GB;
> +	case I40E_LINK_SPEED_2_5GB:
> +		return VIRTCHNL_LINK_SPEED_2_5GB;
> +	case I40E_LINK_SPEED_5GB:
> +		return VIRTCHNL_LINK_SPEED_5GB;
>  	case I40E_LINK_SPEED_10GB:
>  		return VIRTCHNL_LINK_SPEED_10GB;
>  	case I40E_LINK_SPEED_40GB:
> diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
> index c613d4761..92515bf34 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -53,12 +53,14 @@ enum virtchnl_status_code {  #define
> VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM  #define
> VIRTCHNL_STATUS_NOT_SUPPORTED
> VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
> 
> +#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
>  #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
>  #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
>  #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
>  #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
>  #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
>  #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
> +#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
> 
>  enum virtchnl_link_speed {
>  	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
> @@ -68,6 +70,8 @@ enum virtchnl_link_speed {
>  	VIRTCHNL_LINK_SPEED_40GB	=
> BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
>  	VIRTCHNL_LINK_SPEED_20GB	=
> BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
>  	VIRTCHNL_LINK_SPEED_25GB	=
> BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
> +	VIRTCHNL_LINK_SPEED_2_5GB	=
> BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
> +	VIRTCHNL_LINK_SPEED_5GB		=
> BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
>  };
> 
>  /* for hsplit_0 field of Rx HMC context */
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants
  2019-12-27  5:37     ` Xing, Beilei
@ 2020-01-02  9:58       ` Loktionov, Aleksandr
  0 siblings, 0 replies; 198+ messages in thread
From: Loktionov, Aleksandr @ 2020-01-02  9:58 UTC (permalink / raw)
  To: Xing, Beilei, Ye, Xiaolong, Zhang, Qi Z; +Cc: dev, Stillwell Jr, Paul M

Good day dear ALL

It's a new feature /*new speed display*/ but from other point of view it's a fix /*because it was found after new feature release*/

-----Original Message-----
From: Xing, Beilei <beilei.xing@intel.com> 
Sent: Friday, December 27, 2019 6:38 AM
To: Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
Subject: RE: [PATCH v3 36/36] net/i40e/base: add new link speed constants



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, December 16, 2019 10:44 AM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z 
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Stillwell Jr, Paul M 
> <paul.m.stillwell.jr@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; 
> Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
> Subject: [PATCH v3 36/36] net/i40e/base: add new link speed constants
> 
> This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg for 
> 2.5Gb/5Gb speeds. This problem is fixed by adding constants for 
> VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.
> 

It's a fix patch, fix line is needed? The same comment is also for patch 27/36, 25/36, 21/36, 14/36.

> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/base/i40e_prototype.h | 4 ++++
>  drivers/net/i40e/base/virtchnl.h       | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/i40e/base/i40e_prototype.h
> b/drivers/net/i40e/base/i40e_prototype.h
> index 0f06e3262..d8ab3ea0a 100644
> --- a/drivers/net/i40e/base/i40e_prototype.h
> +++ b/drivers/net/i40e/base/i40e_prototype.h
> @@ -505,6 +505,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed
> link_speed)
>  		return VIRTCHNL_LINK_SPEED_100MB;
>  	case I40E_LINK_SPEED_1GB:
>  		return VIRTCHNL_LINK_SPEED_1GB;
> +	case I40E_LINK_SPEED_2_5GB:
> +		return VIRTCHNL_LINK_SPEED_2_5GB;
> +	case I40E_LINK_SPEED_5GB:
> +		return VIRTCHNL_LINK_SPEED_5GB;
>  	case I40E_LINK_SPEED_10GB:
>  		return VIRTCHNL_LINK_SPEED_10GB;
>  	case I40E_LINK_SPEED_40GB:
> diff --git a/drivers/net/i40e/base/virtchnl.h 
> b/drivers/net/i40e/base/virtchnl.h
> index c613d4761..92515bf34 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -53,12 +53,14 @@ enum virtchnl_status_code {  #define 
> VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM  #define 
> VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
> 
> +#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
>  #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
>  #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
>  #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
>  #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
>  #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
>  #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
> +#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
> 
>  enum virtchnl_link_speed {
>  	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
> @@ -68,6 +70,8 @@ enum virtchnl_link_speed {
>  	VIRTCHNL_LINK_SPEED_40GB	=
> BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
>  	VIRTCHNL_LINK_SPEED_20GB	=
> BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
>  	VIRTCHNL_LINK_SPEED_25GB	=
> BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
> +	VIRTCHNL_LINK_SPEED_2_5GB	=
> BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
> +	VIRTCHNL_LINK_SPEED_5GB		=
> BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
>  };
> 
>  /* for hsplit_0 field of Rx HMC context */
> --
> 2.17.1


--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
                   ` (70 preceding siblings ...)
  2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
@ 2020-01-13  2:39 ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
                     ` (37 more replies)
  71 siblings, 38 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  Cc: dev, Xiaolong Ye

This series is to support FVL 7.2 release.

The main changes include:

* virtchnl updates
* add lldp support
* Flow director updates
* extend PHY access AQ cmd
* add reading LPI counters
* add support for Energy Efficient Ethernet
* A few fixes.

v4:

* add a few missed Fixes tags

V3:

* add missing SOBs

V2:

* strip some unnecessary code
* squash some fixes
* improve commit logs

Xiaolong Ye (36):
  net/i40e/base: add support for feature flags
  net/i40e/base: increase max VSI count for VFs
  net/i40e/base: change buffer address
  net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  net/i40e/base: change misleading error message
  net/i40e/base: further implementation of LLDP
  net/i40e/base: add new device ids
  net/i40e/base: add check for MAC type
  net/i40e/base: adding flags for PHY types
  net/i40e/base: improve AQ log granularity
  net/i40e/base: add getter for FW LLDP agent status
  net/i40e/base: add support for Energy Efficient Ethernet
  net/i40e/base: read LPI status from external PHY
  net/i40e/base: change for missing "link modes"
  net/i40e/base: add reading LPI counters
  net/i40e/base: backport style changes from upstream Linux
  net/i40e/base: update status codes
  net/i40e/base: change of the incorrect Tx descriptors number
  net/i40e/base: extend PHY access AQ command
  net/i40e/base: add drop mode parameter to set MAC config
  net/i40e/base: add FWS1B register masks
  net/i40e/base: update FW API version
  net/i40e/base: add persistent lldp support
  net/i40e/base: make i40e_set_mac_type() public
  net/i40e/base: fix retrying logic
  net/i40e/base: mark additional missing bits as reserved
  net/i40e/base: fix wrong 'Advertised FEC modes'
  net/i40e/base: add Flow Director defines
  net/i40e/base: removed unreachable code
  net/i40e/base: set PHY Access flag on X722
  net/i40e/base: implement reading lpi statistics
  net/i40e/base: exposing missing LED functionality
  net/i40e/base: introduce firmware EMP reset register offsets
  net/i40e/base: add CRC stripping capability
  net/i40e/base: enable LED blinking flow
  net/i40e/base: add new link speed constants

 drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
 drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
 drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
 drivers/net/i40e/base/i40e_dcb.h        |  20 +-
 drivers/net/i40e/base/i40e_devids.h     |   4 +
 drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
 drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
 drivers/net/i40e/base/i40e_register.h   |  95 ++++
 drivers/net/i40e/base/i40e_type.h       |  39 +-
 drivers/net/i40e/base/virtchnl.h        |  32 +-
 drivers/net/i40e/i40e_ethdev.c          |  12 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 13 files changed, 1047 insertions(+), 323 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 01/36] net/i40e/base: add support for feature flags
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
                     ` (36 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, Xiaolong Ye, Piotr Pietruszewski, Galazka Krzysztof

Extend NVM Update API to support reporting of features
available for the tools.

This change is needed by NVM Update to determine if driver
supports changing NVM layout from structured to flat.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 11 ++++++++
 drivers/net/i40e/base/i40e_nvm.c    | 42 ++++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_type.h   | 22 +++++++++++++++
 3 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 37911a99e..cee6de2a8 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1014,6 +1014,17 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
 	if (hw->mac.type == I40E_MAC_X722)
 		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
 			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+	/* NVMUpdate features structure initialization */
+	hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR;
+	hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR;
+	hw->nvmupd_features.size = sizeof(hw->nvmupd_features);
+	i40e_memset(hw->nvmupd_features.features, 0x0,
+		    I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN *
+		    sizeof(*hw->nvmupd_features.features),
+		    I40E_NONDMA_MEM);
+
+	/* No features supported at the moment */
+	hw->nvmupd_features.features[0] = 0;
 
 	status = i40e_init_nvm(hw);
 	return status;
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 6c8ca8771..c8b401cdd 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -797,6 +797,7 @@ STATIC const char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_EXEC_AQ",
 	"I40E_NVMUPD_GET_AQ_RESULT",
 	"I40E_NVMUPD_GET_AQ_EVENT",
+	"I40E_NVMUPD_GET_FEATURES",
 };
 
 /**
@@ -859,6 +860,31 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		return I40E_SUCCESS;
 	}
 
+	/*
+	 * A supported features request returns immediately
+	 * rather than going into state machine
+	 */
+	if (upd_cmd == I40E_NVMUPD_FEATURES) {
+		if (cmd->data_size < hw->nvmupd_features.size) {
+			*perrno = -EFAULT;
+			return I40E_ERR_BUF_TOO_SHORT;
+		}
+
+		/*
+		 * If buffer is bigger than i40e_nvmupd_features structure,
+		 * make sure the trailing bytes are set to 0x0.
+		 */
+		if (cmd->data_size > hw->nvmupd_features.size)
+			i40e_memset(bytes + hw->nvmupd_features.size, 0x0,
+				    cmd->data_size - hw->nvmupd_features.size,
+				    I40E_NONDMA_MEM);
+
+		i40e_memcpy(bytes, &hw->nvmupd_features,
+			    hw->nvmupd_features.size, I40E_NONDMA_MEM);
+
+		return I40E_SUCCESS;
+	}
+
 	/* Clear status even it is not read and log */
 	if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
@@ -1325,10 +1351,20 @@ STATIC enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 			upd_cmd = I40E_NVMUPD_READ_SA;
 			break;
 		case I40E_NVM_EXEC:
-			if (module == 0xf)
-				upd_cmd = I40E_NVMUPD_STATUS;
-			else if (module == 0)
+			switch (module) {
+			case I40E_NVM_EXEC_GET_AQ_RESULT:
 				upd_cmd = I40E_NVMUPD_GET_AQ_RESULT;
+				break;
+			case I40E_NVM_EXEC_FEATURES:
+				upd_cmd = I40E_NVMUPD_FEATURES;
+				break;
+			case I40E_NVM_EXEC_STATUS:
+				upd_cmd = I40E_NVMUPD_STATUS;
+				break;
+			default:
+				*perrno = -EFAULT;
+				return I40E_NVMUPD_INVALID;
+			}
 			break;
 		case I40E_NVM_AQE:
 			upd_cmd = I40E_NVMUPD_GET_AQ_EVENT;
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 06863d772..fcdf0eb29 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -478,6 +478,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_EXEC_AQ,
 	I40E_NVMUPD_GET_AQ_RESULT,
 	I40E_NVMUPD_GET_AQ_EVENT,
+	I40E_NVMUPD_FEATURES,
 };
 
 enum i40e_nvmupd_state {
@@ -513,6 +514,10 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_AQE				0xe
 #define I40E_NVM_EXEC				0xf
 
+#define I40E_NVM_EXEC_GET_AQ_RESULT		0x0
+#define I40E_NVM_EXEC_FEATURES			0xe
+#define I40E_NVM_EXEC_STATUS			0xf
+
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffffULL << I40E_NVM_ADAPT_SHIFT)
 
@@ -527,6 +532,20 @@ struct i40e_nvm_access {
 	u8 data[1];
 };
 
+/* NVMUpdate features API */
+#define I40E_NVMUPD_FEATURES_API_VER_MAJOR		0
+#define I40E_NVMUPD_FEATURES_API_VER_MINOR		14
+#define I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN	12
+
+#define I40E_NVMUPD_FEATURE_FLAT_NVM_SUPPORT		BIT(0)
+
+struct i40e_nvmupd_features {
+	u8 major;
+	u8 minor;
+	u16 size;
+	u8 features[I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN];
+};
+
 /* (Q)SFP module access definitions */
 #define I40E_I2C_EEPROM_DEV_ADDR	0xA0
 #define I40E_I2C_EEPROM_DEV_ADDR2	0xA2
@@ -730,6 +749,9 @@ struct i40e_hw {
 	u16 first_tag;
 	u16 second_tag;
 
+	/* NVMUpdate features */
+	struct i40e_nvmupd_features nvmupd_features;
+
 	/* debug mask */
 	u32 debug_mask;
 	char err_str[16];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 02/36] net/i40e/base: increase max VSI count for VFs
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 03/36] net/i40e/base: change buffer address Xiaolong Ye
                     ` (35 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Mitch Williams

For historical reasons, we allowed 3 VSIs per VF, but never used more
than one. Now with ADq, we can use up to 4 VSIs per VF, so change this
value to match.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index fcdf0eb29..0cbb13262 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -38,7 +38,7 @@
 #define I40E_MAX_PF_VSI			64
 #define I40E_MAX_PF_QP			128
 #define I40E_MAX_VSI_QP			16
-#define I40E_MAX_VF_VSI			3
+#define I40E_MAX_VF_VSI			4
 #define I40E_MAX_CHAINED_RX_BUFFERS	5
 #define I40E_MAX_PF_UDP_OFFLOAD_PORTS	16
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 03/36] net/i40e/base: change buffer address
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
                     ` (34 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

The high 32-bits were being set incorrectly in the 'Set Local LLDP MIB'
AQ command (0x0A08). Change it to use the right macro to get the correct
bits.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index cee6de2a8..0b26f86c5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4311,7 +4311,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 
 	cmd->type = mib_type;
 	cmd->length = CPU_TO_LE16(buff_size);
-	cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff));
+	cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff));
 	cmd->address_low =  CPU_TO_LE32(I40E_LO_DWORD((u64)buff));
 
 	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (2 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 03/36] net/i40e/base: change buffer address Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 05/36] net/i40e/base: change misleading error message Xiaolong Ye
                     ` (33 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Chinh T Cao

There is a need to enable MIB change event, not at the same time as
init_dcb. This patch will serve this requirement.

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 28 +++++++++++-----------------
 drivers/net/i40e/base/i40e_dcb.h |  3 ++-
 drivers/net/i40e/i40e_ethdev.c   |  4 ++--
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index a26f82b3a..7cc8c83dc 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -863,22 +863,23 @@ enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw)
 /**
  * i40e_init_dcb
  * @hw: pointer to the hw struct
+ * @enable_mib_change: enable mib change event
  *
  * Update DCB configuration from the Firmware
  **/
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 {
 	enum i40e_status_code ret = I40E_SUCCESS;
 	struct i40e_lldp_variables lldp_cfg;
 	u8 adminstatus = 0;
 
 	if (!hw->func_caps.dcb)
-		return ret;
+		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
 	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
 	if (ret)
-		return ret;
+		return I40E_ERR_NOT_READY;
 
 	/* Get the LLDP AdminStatus for the current port */
 	adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
@@ -887,7 +888,7 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 	/* LLDP agent disabled */
 	if (!adminstatus) {
 		hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
-		return ret;
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Get DCBX status */
@@ -896,26 +897,19 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw)
 		return ret;
 
 	/* Check the DCBX Status */
-	switch (hw->dcbx_status) {
-	case I40E_DCBX_STATUS_DONE:
-	case I40E_DCBX_STATUS_IN_PROGRESS:
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+	    hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
 		/* Get current DCBX configuration */
 		ret = i40e_get_dcb_config(hw);
 		if (ret)
 			return ret;
-		break;
-	case I40E_DCBX_STATUS_DISABLED:
-		return ret;
-	case I40E_DCBX_STATUS_NOT_STARTED:
-	case I40E_DCBX_STATUS_MULTIPLE_PEERS:
-	default:
-		break;
+	} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Configure the LLDP MIB change event */
-	ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
-	if (ret)
-		return ret;
+	if (enable_mib_change)
+		ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
 
 	return ret;
 }
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 85b0eed3a..253943308 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -186,7 +186,8 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 					     u8 bridgetype,
 					     struct i40e_dcbx_config *dcbcfg);
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
-enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw);
+enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
+				    bool enable_mib_change);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 86fc4f407..d63658796 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11579,7 +11579,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
 		 * i40e_init_dcb we expect is failure with I40E_AQ_RC_EPERM
 		 * adminq status. Otherwise, it should return success.
@@ -11627,7 +11627,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
-		ret = i40e_init_dcb(hw);
+		ret = i40e_init_dcb(hw, true);
 		if (!ret) {
 			if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
 				PMD_INIT_LOG(ERR,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 05/36] net/i40e/base: change misleading error message
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (3 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
                     ` (32 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Carolyn Wyborny

This patch changes an error code for an admin queue head overrun to use
I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 38214a373..b2fc6f590 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -835,7 +835,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	if (val >= hw->aq.num_asq_entries) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
 			   "AQTX: head overrun at %d\n", val);
-		status = I40E_ERR_QUEUE_EMPTY;
+		status = I40E_ERR_ADMIN_QUEUE_FULL;
 		goto asq_send_command_error;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 06/36] net/i40e/base: further implementation of LLDP
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (4 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 05/36] net/i40e/base: change misleading error message Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 07/36] net/i40e/base: add new device ids Xiaolong Ye
                     ` (31 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Ilgiewicz

This code implements changes necessary for LLDP Agent support.

1. Modified i40e_aq_start_lldp and i40e_aq_stop_lldp. Now Stop and Start
can also be persistent across power cycles.
2. Added new function i40e_aq_restore_lldp which restores factory
setting for LLDP Agent or gets its status.

Signed-off-by: Jaroslaw Ilgiewicz <jaroslaw.ilgiewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  19 ++-
 drivers/net/i40e/base/i40e_common.c     | 173 ++++++------------------
 drivers/net/i40e/base/i40e_prototype.h  |  18 +--
 drivers/net/i40e/base/i40e_type.h       |   1 +
 drivers/net/i40e/i40e_ethdev.c          |   4 +-
 drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
 6 files changed, 67 insertions(+), 152 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index b459be921..a89b88fa5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -265,6 +265,7 @@ enum i40e_admin_queue_opc {
 	i40e_aqc_opc_get_cee_dcb_cfg	= 0x0A07,
 	i40e_aqc_opc_lldp_set_local_mib	= 0x0A08,
 	i40e_aqc_opc_lldp_stop_start_spec_agent	= 0x0A09,
+	i40e_aqc_opc_lldp_restore		= 0x0A0A,
 
 	/* Tunnel commands */
 	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
@@ -2554,8 +2555,9 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
 /* Stop LLDP (direct 0x0A05) */
 struct i40e_aqc_lldp_stop {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_STOP		0x0
-#define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
+#define I40E_AQ_LLDP_AGENT_STOP			0x0
+#define I40E_AQ_LLDP_AGENT_SHUTDOWN		0x1
+#define I40E_AQ_LLDP_AGENT_STOP_PERSIST		0x2
 	u8	reserved[15];
 };
 
@@ -2565,7 +2567,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
 
 struct i40e_aqc_lldp_start {
 	u8	command;
-#define I40E_AQ_LLDP_AGENT_START	0x1
+#define I40E_AQ_LLDP_AGENT_START		0x1
+#define I40E_AQ_LLDP_AGENT_START_PERSIST	0x2
 	u8	reserved[15];
 };
 
@@ -2685,6 +2688,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent);
 
+/* Restore LLDP Agent factory settings (direct 0x0A0A) */
+struct i40e_aqc_lldp_restore {
+	u8	command;
+#define I40E_AQ_LLDP_AGENT_RESTORE_NOT		0x0
+#define I40E_AQ_LLDP_AGENT_RESTORE		0x1
+	u8	reserved[15];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore);
+
 /* Add Udp Tunnel command and completion (direct 0x0B00) */
 struct i40e_aqc_add_udp_tunnel {
 	__le16	udp_port;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 0b26f86c5..8ebf8b856 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4347,151 +4347,39 @@ enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 }
 
 /**
- * i40e_aq_add_lldp_tlv
+ * i40e_aq_restore_lldp
  * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to add
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be added
- * @mib_len: length of the LLDP MIB returned in response
+ * @setting: pointer to factory setting variable or NULL
+ * @restore: True if factory settings should be restored
  * @cmd_details: pointer to command details structure or NULL
  *
- * Add the specified TLV to LLDP Local MIB for the given bridge type,
- * it is responsibility of the caller to make sure that the TLV is not
- * already present in the LLDPDU.
- * In return firmware will write the complete LLDP MIB with the newly
- * added TLV in the response buffer.
+ * Restore LLDP Agent factory settings if @restore set to True. In other case
+ * only returns factory setting in AQ response.
  **/
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff || tlv_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_add_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->len = CPU_TO_LE16(tlv_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
-
-	return status;
-}
-
-/**
- * i40e_aq_update_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: buffer with TLV to update
- * @buff_size: size of the buffer holding original and updated TLVs
- * @old_len: Length of the Original TLV
- * @new_len: Length of the Updated TLV
- * @offset: offset of the updated TLV in the buff
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Update the specified TLV to the LLDP Local MIB for the given bridge type.
- * Firmware will place the complete LLDP MIB in response buffer with the
- * updated TLV.
- **/
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_update_tlv *cmd =
-		(struct i40e_aqc_lldp_update_tlv *)&desc.params.raw;
+	struct i40e_aqc_lldp_restore *cmd =
+		(struct i40e_aqc_lldp_restore *)&desc.params.raw;
 	enum i40e_status_code status;
 
-	if (buff_size == 0 || !buff || offset == 0 ||
-	    old_len == 0 || new_len == 0)
-		return I40E_ERR_PARAM;
-
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_update_tlv);
-
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
-	cmd->old_len = CPU_TO_LE16(old_len);
-	cmd->new_offset = CPU_TO_LE16(offset);
-	cmd->new_len = CPU_TO_LE16(new_len);
-
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
+	if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) {
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Restore LLDP not supported by current FW version.\n");
+		return I40E_ERR_DEVICE_NOT_SUPPORTED;
 	}
 
-	return status;
-}
-
-/**
- * i40e_aq_delete_lldp_tlv
- * @hw: pointer to the hw struct
- * @bridge_type: type of bridge
- * @buff: pointer to a user supplied buffer that has the TLV
- * @buff_size: length of the buffer
- * @tlv_len: length of the TLV to be deleted
- * @mib_len: length of the returned LLDP MIB
- * @cmd_details: pointer to command details structure or NULL
- *
- * Delete the specified TLV from LLDP Local MIB for the given bridge type.
- * The firmware places the entire LLDP MIB in the response buffer.
- **/
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details)
-{
-	struct i40e_aq_desc desc;
-	struct i40e_aqc_lldp_add_tlv *cmd =
-		(struct i40e_aqc_lldp_add_tlv *)&desc.params.raw;
-	enum i40e_status_code status;
-
-	if (buff_size == 0 || !buff)
-		return I40E_ERR_PARAM;
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_restore);
 
-	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_delete_tlv);
+	if (restore)
+		cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE;
 
-	/* Indirect Command */
-	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (buff_size > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
-	desc.datalen = CPU_TO_LE16(buff_size);
-	cmd->len = CPU_TO_LE16(tlv_len);
-	cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) &
-		      I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
-	status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
-	if (!status) {
-		if (mib_len != NULL)
-			*mib_len = LE16_TO_CPU(desc.datalen);
-	}
+	if (setting)
+		*setting = cmd->command & 1;
 
 	return status;
 }
@@ -4500,11 +4388,13 @@ enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
  * i40e_aq_stop_lldp
  * @hw: pointer to the hw struct
  * @shutdown_agent: True if LLDP Agent needs to be Shutdown
+ * @persist: True if stop of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Stop or Shutdown the embedded LLDP Agent
  **/
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4517,6 +4407,14 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 	if (shutdown_agent)
 		cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN;
 
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Stop LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
@@ -4525,11 +4423,13 @@ enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
 /**
  * i40e_aq_start_lldp
  * @hw: pointer to the hw struct
+ * @persist: True if start of LLDP should be persistent across power cycles
  * @cmd_details: pointer to command details structure or NULL
  *
  * Start the embedded LLDP Agent on all ports.
  **/
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -4540,6 +4440,15 @@ enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
 	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_start);
 
 	cmd->command = I40E_AQ_LLDP_AGENT_START;
+
+	if (persist) {
+		if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)
+			cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Persistent Start LLDP not supported by current FW version.\n");
+	}
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0cf006dad..2f3e0bfee 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -251,26 +251,18 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e_hw *hw,
 enum i40e_status_code i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
 				bool enable_update,
 				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type,
-				void *buff, u16 buff_size, u16 tlv_len,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_update_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 old_len, u16 new_len, u16 offset,
-				u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_delete_lldp_tlv(struct i40e_hw *hw,
-				u8 bridge_type, void *buff, u16 buff_size,
-				u16 tlv_len, u16 *mib_len,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore,
+		     struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
 						 bool dcb_enable,
 						 struct i40e_asq_cmd_details
 						 *cmd_details);
 enum i40e_status_code i40e_aq_start_lldp(struct i40e_hw *hw,
+				bool persist,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
 				void *buff, u16 buff_size,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 0cbb13262..322300fa3 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -742,6 +742,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
+#define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d63658796..1b361c0b5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11574,7 +11574,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 */
 	if (sw_dcb == TRUE) {
 		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
+			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
 		}
@@ -11623,7 +11623,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 			return -ENOTSUP;
 		}
 	} else {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
 			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index fdcb1a43e..b64f55341 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1409,7 +1409,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Disable DCBx if it's the first time to set strict priority. */
 	if (!veb->strict_prio_tc) {
-		ret = i40e_aq_stop_lldp(hw, true, NULL);
+		ret = i40e_aq_stop_lldp(hw, true, true, NULL);
 		if (ret)
 			PMD_DRV_LOG(INFO,
 				    "Failed to disable DCBx as it's already"
@@ -1464,7 +1464,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
 
 	/* Enable DCBx again, if all the TCs' strict priority disabled. */
 	if (!tc_map) {
-		ret = i40e_aq_start_lldp(hw, NULL);
+		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret) {
 			PMD_DRV_LOG(ERR,
 				    "Failed to enable DCBx, err(%d).", ret);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 07/36] net/i40e/base: add new device ids
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (5 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
                     ` (30 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

New device ids are created to support SFP+ and backplane connections.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 ++
 drivers/net/i40e/base/i40e_devids.h | 2 ++
 drivers/net/i40e/i40e_ethdev.c      | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8ebf8b856..73d0c29fd 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -36,6 +36,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
 		case I40E_DEV_ID_10G_BASE_T:
 		case I40E_DEV_ID_10G_BASE_T4:
 		case I40E_DEV_ID_10G_BASE_T_BC:
+		case I40E_DEV_ID_10G_B:
+		case I40E_DEV_ID_10G_SFP:
 		case I40E_DEV_ID_20G_KR2:
 		case I40E_DEV_ID_20G_KR2_A:
 		case I40E_DEV_ID_25G_B:
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index f3c59bdea..1700db17a 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -36,6 +36,8 @@
 #define I40E_DEV_ID_X722_A0_VF		0x374D
 #endif
 #endif
+#define I40E_DEV_ID_10G_B		0x104F
+#define I40E_DEV_ID_10G_SFP		0x104E
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1b361c0b5..81ed847d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -443,6 +443,8 @@ static const struct rte_pci_id pci_id_i40e_map[] = {
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_XXV710_N3000) },
 	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_BC) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_B) },
+	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_SFP) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 08/36] net/i40e/base: add check for MAC type
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (6 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 07/36] net/i40e/base: add new device ids Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
                     ` (29 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Galazka Krzysztof

Some features were introduced in different FW API version on XL710 and X722
MACs. Others are available only on specific MAC type. Make sure that they
are properly assigned. Also fix the style issues reported by current
check-patch.

Signed-off-by: Galazka Krzysztof <krzysztof.galazka@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c | 68 +++++++----------------------
 1 file changed, 16 insertions(+), 52 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b2fc6f590..b8c6e30f5 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -582,25 +582,22 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
  **/
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
-#ifdef PF_DRIVER
+	struct i40e_adminq_info *aq = &hw->aq;
+	enum i40e_status_code ret_code;
 	u16 cfg_ptr, oem_hi, oem_lo;
 	u16 eetrack_lo, eetrack_hi;
-#endif
-	enum i40e_status_code ret_code;
-#ifdef PF_DRIVER
 	int retry = 0;
-#endif
 
 	/* verify input for valid configuration */
-	if ((hw->aq.num_arq_entries == 0) ||
-	    (hw->aq.num_asq_entries == 0) ||
-	    (hw->aq.arq_buf_size == 0) ||
-	    (hw->aq.asq_buf_size == 0)) {
+	if (aq->num_arq_entries == 0 ||
+	    aq->num_asq_entries == 0 ||
+	    aq->arq_buf_size == 0 ||
+	    aq->asq_buf_size == 0) {
 		ret_code = I40E_ERR_CONFIG;
 		goto init_adminq_exit;
 	}
-	i40e_init_spinlock(&hw->aq.asq_spinlock);
-	i40e_init_spinlock(&hw->aq.arq_spinlock);
+	i40e_init_spinlock(&aq->asq_spinlock);
+	i40e_init_spinlock(&aq->arq_spinlock);
 
 	/* Set up register offsets */
 	i40e_adminq_init_regs(hw);
@@ -618,23 +615,17 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_asq;
 
-#ifdef PF_DRIVER
-#ifdef INTEGRATED_VF
-	/* VF has no need of firmware */
-	if (i40e_is_vf(hw))
-		goto init_adminq_exit;
-#endif
 	/* There are some cases where the firmware may not be quite ready
 	 * for AdminQ operations, so we retry the AdminQ setup a few times
 	 * if we see timeouts in this first AQ call.
 	 */
 	do {
 		ret_code = i40e_aq_get_firmware_version(hw,
-							&hw->aq.fw_maj_ver,
-							&hw->aq.fw_min_ver,
-							&hw->aq.fw_build,
-							&hw->aq.api_maj_ver,
-							&hw->aq.api_min_ver,
+							&aq->fw_maj_ver,
+							&aq->fw_min_ver,
+							&aq->fw_build,
+							&aq->api_maj_ver,
+							&aq->api_min_ver,
 							NULL);
 		if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT)
 			break;
@@ -658,31 +649,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 			   &oem_lo);
 	hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo;
 
-	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 7)))
-		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
-
-	if (hw->mac.type == I40E_MAC_XL710 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
-		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-	if (hw->mac.type == I40E_MAC_X722 &&
-	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-	    hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
-		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
-	}
-
-	/* Newer versions of firmware require lock when reading the NVM */
-	if ((hw->aq.api_maj_ver > 1) ||
-	    ((hw->aq.api_maj_ver == 1) &&
-	     (hw->aq.api_min_ver >= 5)))
-		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
-
-	if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
+	if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
 		ret_code = I40E_ERR_FIRMWARE_API_VERSION;
 		goto init_adminq_free_arq;
 	}
@@ -692,21 +659,18 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	hw->nvm_release_on_done = false;
 	hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
 
-#endif /* PF_DRIVER */
 	ret_code = I40E_SUCCESS;
 
 	/* success! */
 	goto init_adminq_exit;
 
-#ifdef PF_DRIVER
 init_adminq_free_arq:
 	i40e_shutdown_arq(hw);
-#endif
 init_adminq_free_asq:
 	i40e_shutdown_asq(hw);
 init_adminq_destroy_spinlocks:
-	i40e_destroy_spinlock(&hw->aq.asq_spinlock);
-	i40e_destroy_spinlock(&hw->aq.arq_spinlock);
+	i40e_destroy_spinlock(&aq->asq_spinlock);
+	i40e_destroy_spinlock(&aq->arq_spinlock);
 
 init_adminq_exit:
 	return ret_code;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 09/36] net/i40e/base: adding flags for PHY types
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (7 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
                     ` (28 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Michal Litwicki

Adding bit flags to enable/disable EEE capability for 2.5GBase-T and
5GBase-T PHY types as well as 'Set autonomous EEE for relevant enabled PHY
types' flag.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Michal Litwicki <michalx.litwicki@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index a89b88fa5..2bd8f81f9 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2027,12 +2027,15 @@ struct i40e_aq_get_phy_abilities_resp {
 #define I40E_AQ_PHY_FEC_ABILITY_KR	0x40
 #define I40E_AQ_PHY_FEC_ABILITY_RS	0x80
 	__le16	eee_capability;
+#define I40E_AQ_EEE_AUTO		0x0001
 #define I40E_AQ_EEE_100BASE_TX		0x0002
 #define I40E_AQ_EEE_1000BASE_T		0x0004
 #define I40E_AQ_EEE_10GBASE_T		0x0008
 #define I40E_AQ_EEE_1000BASE_KX		0x0010
 #define I40E_AQ_EEE_10GBASE_KX4		0x0020
 #define I40E_AQ_EEE_10GBASE_KR		0x0040
+#define I40E_AQ_EEE_2_5GBASE_T		0x0100
+#define I40E_AQ_EEE_5GBASE_T		0x0200
 	__le32	eeer_val;
 	u8	d3_lpan;
 #define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 10/36] net/i40e/base: improve AQ log granularity
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (8 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
                     ` (27 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Robert Konklewski

This patch makes it possible to log only AQ descriptors, without the
entire AQ message buffers being dumped too. It should greatly reduce
kernel log size in cases where a full AQ dump is not needed.
Selection is made by setting flags in hw->debug_mask.

Additionally, some debug messages that preceded an AQ dump have been
moved to I40E_DEBUG_AQ_COMMAND class, which seems more appropriate.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c |  8 ++++----
 drivers/net/i40e/base/i40e_common.c | 19 ++++++++++++-------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index b8c6e30f5..52bea842f 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -715,7 +715,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
 	desc = I40E_ADMINQ_DESC(*asq, ntc);
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
-		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+		i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
@@ -887,7 +887,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 	}
 
 	/* bump the tail */
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,
 		      buff, buff_size);
 	(hw->aq.asq.next_to_use)++;
@@ -940,7 +940,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
 		hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
 	}
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
 		   "AQTX: desc and buffer writeback:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);
 
@@ -1069,7 +1069,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
 			    hw->aq.arq.r.arq_bi[desc_idx].va,
 			    e->msg_len, I40E_DMA_TO_NONDMA);
 
-	i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
+	i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n");
 	i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,
 		      hw->aq.arq_buf_size);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 73d0c29fd..4384a0795 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -307,32 +307,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 		   void *buffer, u16 buf_len)
 {
 	struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
+	u32 effective_mask = hw->debug_mask & mask;
 	u8 *buf = (u8 *)buffer;
 	u16 len;
-	u16 i = 0;
+	u16 i;
 
-	if ((!(mask & hw->debug_mask)) || (desc == NULL))
+	if (!effective_mask || !desc)
 		return;
 
 	len = LE16_TO_CPU(aq_desc->datalen);
 
-	i40e_debug(hw, mask,
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
 		   "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
 		   LE16_TO_CPU(aq_desc->opcode),
 		   LE16_TO_CPU(aq_desc->flags),
 		   LE16_TO_CPU(aq_desc->datalen),
 		   LE16_TO_CPU(aq_desc->retval));
-	i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tcookie (h,l) 0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->cookie_high),
 		   LE32_TO_CPU(aq_desc->cookie_low));
-	i40e_debug(hw, mask, "\tparam (0,1)  0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\tparam (0,1)  0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.internal.param0),
 		   LE32_TO_CPU(aq_desc->params.internal.param1));
-	i40e_debug(hw, mask, "\taddr (h,l)   0x%08X 0x%08X\n",
+	i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
+		   "\taddr (h,l)   0x%08X 0x%08X\n",
 		   LE32_TO_CPU(aq_desc->params.external.addr_high),
 		   LE32_TO_CPU(aq_desc->params.external.addr_low));
 
-	if ((buffer != NULL) && (aq_desc->datalen != 0)) {
+	if (buffer && (buf_len != 0) && (len != 0) &&
+	    (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
 		i40e_debug(hw, mask, "AQ CMD Buffer:\n");
 		if (buf_len < len)
 			len = buf_len;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 11/36] net/i40e/base: add getter for FW LLDP agent status
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (9 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
                     ` (26 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change introduces i40e_get_fw_lldp_status() function capable of
reporting status of FW Link Layer Discovery Protocol (LLDP) agent.

Since reading LLDP configuration from NVM only gives information what
is the default state of FW LLDP agent after POR, this change introduces
more reliable method for checking if agent is enabled.

Current state of FW LLDP agent may be different if user disabled the
agent, so i40e_get_fw_lldp_status() uses LLDP MIB checking to determine
status of the agent.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 43 ++++++++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_dcb.h |  9 +++++++
 2 files changed, 52 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 7cc8c83dc..f1465daa3 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -914,6 +914,49 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 	return ret;
 }
 
+/**
+ * i40e_get_fw_lldp_status
+ * @hw: pointer to the hw struct
+ * @lldp_status: pointer to the status enum
+ *
+ * Get status of FW Link Layer Discovery Protocol (LLDP) Agent.
+ * Status of agent is reported via @lldp_status parameter.
+ **/
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status)
+{
+	enum i40e_status_code ret;
+	struct i40e_virt_mem mem;
+	u8 *lldpmib;
+
+	if (!lldp_status)
+		return I40E_ERR_PARAM;
+
+	/* Allocate buffer for the LLDPDU */
+	ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE);
+	if (ret)
+		return ret;
+
+	lldpmib = (u8 *)mem.va;
+	ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib,
+				   I40E_LLDPDU_SIZE, NULL, NULL, NULL);
+
+	if (ret == I40E_SUCCESS) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) {
+		/* MIB is not available yet but the agent is running */
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED;
+		ret = I40E_SUCCESS;
+	} else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) {
+		*lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED;
+		ret = I40E_SUCCESS;
+	}
+
+	i40e_free_virt_mem(hw, &mem);
+	return ret;
+}
+
 /**
  * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
  * @tlv: Fill the ETS config data in IEEE format
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 253943308..88fe405d7 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -178,6 +178,12 @@ struct i40e_dcbx_variables {
 	u32 deftsaassignment;
 };
 
+
+enum i40e_get_fw_lldp_status_resp {
+	I40E_GET_FW_LLDP_STATUS_DISABLED = 0,
+	I40E_GET_FW_LLDP_STATUS_ENABLED = 1
+};
+
 enum i40e_status_code i40e_get_dcbx_status(struct i40e_hw *hw,
 					   u16 *status);
 enum i40e_status_code i40e_lldp_to_dcb_config(u8 *lldpmib,
@@ -188,6 +194,9 @@ enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw,
 				    bool enable_mib_change);
+enum i40e_status_code
+i40e_get_fw_lldp_status(struct i40e_hw *hw,
+			enum i40e_get_fw_lldp_status_resp *lldp_status);
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 12/36] net/i40e/base: add support for Energy Efficient Ethernet
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (10 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
                     ` (25 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change adds i40e_enable_eee() function controlling advertisement
of Energy Efficient Ethernet mode (EEE).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 64 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 2 files changed, 65 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4384a0795..c2e7cf7d5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6306,6 +6306,70 @@ enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
 	return status;
 }
 
+
+/**
+ * i40e_enable_eee
+ * @hw: pointer to the hardware structure
+ * @enable: state of Energy Efficient Ethernet mode to be set
+ *
+ * Enables or disables Energy Efficient Ethernet (EEE) mode
+ * accordingly to @enable parameter.
+ **/
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable)
+{
+	struct i40e_aq_get_phy_abilities_resp abilities;
+	struct i40e_aq_set_phy_config config;
+	enum i40e_status_code status;
+	__le16 eee_capability;
+
+	/* Get initial PHY capabilities */
+	status = i40e_aq_get_phy_capabilities(hw, false, true, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Check whether NIC configuration is compatible with Energy Efficient
+	 * Ethernet (EEE) mode.
+	 */
+	if (abilities.eee_capability == 0) {
+		status = I40E_ERR_CONFIG;
+		goto err;
+	}
+
+	/* Cache initial EEE capability */
+	eee_capability = abilities.eee_capability;
+
+	/* Get current configuration */
+	status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
+					      NULL);
+	if (status)
+		goto err;
+
+	/* Cache current configuration */
+	config.phy_type = abilities.phy_type;
+	config.link_speed = abilities.link_speed;
+	config.abilities = abilities.abilities |
+			   I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	config.eeer = abilities.eeer_val;
+	config.low_power_ctrl = abilities.d3_lpan;
+	config.fec_config = abilities.fec_cfg_curr_mod_ext_info &
+			    I40E_AQ_PHY_FEC_CONFIG_MASK;
+
+	/* Set desired EEE state */
+	if (enable) {
+		config.eee_capability = eee_capability;
+		config.eeer |= I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	} else {
+		config.eee_capability = 0;
+		config.eeer &= ~I40E_PRTPM_EEER_TX_LPI_EN_MASK;
+	}
+
+	/* Save modified config */
+	status = i40e_aq_set_phy_config(hw, &config, NULL);
+err:
+	return status;
+}
+
 /**
  * i40e_read_bw_from_alt_ram
  * @hw: pointer to the hardware structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2f3e0bfee..38beb270b 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -458,6 +458,7 @@ void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode,
 void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
+enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
 #if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 13/36] net/i40e/base: read LPI status from external PHY
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (11 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
                     ` (24 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang
  Cc: dev, Xiaolong Ye, Krzysztof Galazka, Piotr Pietruszewski

When external PHY is used, MAC register may not reflect actual
state of LPI. Add function reading it directly from PHY or MAC,
depending on what is supported by the device.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 45 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  2 ++
 drivers/net/i40e/base/i40e_type.h      |  6 ++++
 3 files changed, 53 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index c2e7cf7d5..f256651d7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6982,6 +6982,51 @@ enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
 	return status;
 }
 #endif /* PF_DRIVER */
+/**
+ * i40e_get_phy_lpi_status - read LPI status from PHY or MAC register
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ *
+ * Read LPI state directly from external PHY register or from MAC
+ * register, depending on device ID and current link speed.
+ */
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stat)
+{
+	enum i40e_status_code ret = I40E_SUCCESS;
+	u32 val;
+
+	stat->rx_lpi_status = 0;
+	stat->tx_lpi_status = 0;
+
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB ||
+	     hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) {
+		ret = i40e_aq_get_phy_register(hw,
+					       I40E_AQ_PHY_REG_ACCESS_EXTERNAL,
+					       I40E_BCM_PHY_PCS_STATUS1_PAGE,
+					       true,
+					       I40E_BCM_PHY_PCS_STATUS1_REG,
+					       &val, NULL);
+
+		if (ret != I40E_SUCCESS)
+			return ret;
+
+		stat->rx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_RX_LPI);
+		stat->tx_lpi_status = !!(val & I40E_BCM_PHY_PCS_STATUS1_TX_LPI);
+
+		return ret;
+	}
+
+	val = rd32(hw, I40E_PRTPM_EEE_STAT);
+	stat->rx_lpi_status = (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
+	stat->tx_lpi_status = (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
+			       I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
+
+	return ret;
+}
+
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 38beb270b..c6c45eb5a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -74,6 +74,8 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
 
+enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
+					      struct i40e_hw_port_stats *stats);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 322300fa3..8d257e00a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -2038,4 +2038,10 @@ struct i40e_profile_info {
 	u8 reserved[7];
 	u8 name[I40E_DDP_NAME_SIZE];
 };
+
+#define I40E_BCM_PHY_PCS_STATUS1_PAGE	0x3
+#define I40E_BCM_PHY_PCS_STATUS1_REG	0x0001
+#define I40E_BCM_PHY_PCS_STATUS1_RX_LPI	BIT(8)
+#define I40E_BCM_PHY_PCS_STATUS1_TX_LPI	BIT(9)
+
 #endif /* _I40E_TYPE_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 14/36] net/i40e/base: change for missing "link modes"
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (12 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
                     ` (23 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Martyna Szapar

Fix for missing "Supported link modes" and "Advertised link modes"
info in ethtool after changed speed on X722 devices with BASE-T PHY
with FW API version >= 1.7.
The same FW API version on X710 and X722 does not mean the same
feature set so the change was needed as mac type of the device
should also be checked instead of FW API version only.

Fixes: e8228f1a16b7 ("net/i40e/base: report supported link modes")

Signed-off-by: Martyna Szapar <martyna.szapar@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index f256651d7..e0028ac4d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2043,8 +2043,8 @@ 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) {
+	if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE &&
+	    hw->mac.type != I40E_MAC_X722) {
 		__le32 tmp;
 
 		i40e_memcpy(&tmp, resp->link_type, sizeof(tmp),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 15/36] net/i40e/base: add reading LPI counters
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (13 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
                     ` (22 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Pietruszewski

This change introduces new function i40e_get_lpi_counters() reading
Low Power Idle (LPI) mode counters from Energy Efficient Ethernet (EEE)
statistics. Since reading EEE statistics requires running DNL script,
function i40e_aq_run_phy_activity() able to run it, was implemented.

i40e_lpi_stat_update() was introduced as helper function for retrieving
LPI counters' values relative to given offsets.

This change also fixes order of fields in struct
i40e_aqc_run_phy_activity and introduces union in the struct
providing more descriptive names of fields depending on usage
(command or response).

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  29 ++++--
 drivers/net/i40e/base/i40e_common.c     | 130 ++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  10 ++
 3 files changed, 163 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2bd8f81f9..d718c7326 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2272,15 +2272,32 @@ enum i40e_aq_phy_reg_type {
 	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
 };
 
+#pragma pack(1)
 /* Run PHY Activity (0x0626) */
 struct i40e_aqc_run_phy_activity {
-	__le16  activity_id;
-	u8      flags;
-	u8      reserved1;
-	__le32  control;
-	__le32  data;
-	u8      reserved2[4];
+	u8	cmd_flags;
+	__le16	activity_id;
+#define I40E_AQ_RUN_PHY_ACT_ID_USR_DFND			0x10
+	u8	reserved;
+	union {
+		struct {
+			__le32  dnl_opcode;
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR	0x801a
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR	0x1801b
+			__le32  data;
+			u8	reserved2[4];
+		} cmd;
+		struct {
+			__le32	cmd_status;
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK		0xFFFF
+			__le32	data0;
+			__le32	data1;
+		} resp;
+	} params;
 };
+#pragma pack()
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
 
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index e0028ac4d..9d76b6824 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7027,6 +7027,91 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 	return ret;
 }
 
+/**
+ * i40e_get_lpi_counters - read LPI counters from EEE statistics
+ * @hw: pointer to the hw struct
+ * @tx_counter: pointer to memory for TX LPI counter
+ * @rx_counter: pointer to memory for RX LPI counter
+ * @is_clear:   returns true if counters are clear after read
+ *
+ * Read Low Power Idle (LPI) mode counters from Energy Efficient
+ * Ethernet (EEE) statistics.
+ **/
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
+					    u32 *tx_counter, u32 *rx_counter,
+					    bool *is_clear)
+{
+	/* only X710-T*L requires special handling of counters
+	 * for other devices we just read the MAC registers
+	 */
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC &&
+	    hw->phy.link_info.link_speed != I40E_LINK_SPEED_1GB) {
+		enum i40e_status_code retval;
+		u32 cmd_status = 0;
+
+		*is_clear = false;
+		retval = i40e_aq_run_phy_activity(hw,
+				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
+				&cmd_status, tx_counter, rx_counter, NULL);
+
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+
+		return retval;
+	}
+
+	*is_clear = true;
+	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+
+	return I40E_SUCCESS;
+}
+
+/**
+ * i40e_lpi_stat_update - update LPI counters with values relative to offset
+ * @hw: pointer to the hw struct
+ * @offset_loaded: flag indicating need of writing current value to offset
+ * @tx_offset: pointer to offset of TX LPI counter
+ * @tx_stat: pointer to value of TX LPI counter
+ * @rx_offset: pointer to offset of RX LPI counter
+ * @rx_stat: pointer to value of RX LPI counter
+ *
+ * Update Low Power Idle (LPI) mode counters while having regard to passed
+ * offsets.
+ **/
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat)
+{
+	enum i40e_status_code retval;
+	u32 tx_counter, rx_counter;
+	bool is_clear;
+
+	retval = i40e_get_lpi_counters(hw, &tx_counter, &rx_counter, &is_clear);
+	if (retval)
+		goto err;
+
+	if (is_clear) {
+		*tx_stat += tx_counter;
+		*rx_stat += rx_counter;
+	} else {
+		if (!offset_loaded) {
+			*tx_offset = tx_counter;
+			*rx_offset = rx_counter;
+		}
+
+		*tx_stat = (tx_counter >= *tx_offset) ?
+			(u32)(tx_counter - *tx_offset) :
+			(u32)((tx_counter + BIT_ULL(32)) - *tx_offset);
+		*rx_stat = (rx_counter >= *rx_offset) ?
+			(u32)(rx_counter - *rx_offset) :
+			(u32)((rx_counter + BIT_ULL(32)) - *rx_offset);
+	}
+err:
+	return retval;
+}
 
 /**
  * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
@@ -7233,6 +7318,51 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 }
 
 #endif /* PF_DRIVER */
+/**
+ * i40e_aq_run_phy_activity
+ * @hw: pointer to the hw struct
+ * @activity_id: ID of DNL activity to run
+ * @dnl_opcode: opcode passed to DNL script
+ * @cmd_status: pointer to memory to write return value of DNL script
+ * @data0: pointer to memory for first 4 bytes of data returned by DNL script
+ * @data1: pointer to memory for last 4 bytes of data returned by DNL script
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Run DNL admin command.
+ **/
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 dnl_opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aqc_run_phy_activity *cmd;
+	enum i40e_status_code retval;
+	struct i40e_aq_desc desc;
+
+	cmd = (struct i40e_aqc_run_phy_activity *)&desc.params.raw;
+
+	if (!cmd_status || !data0 || !data1) {
+		retval = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_fill_default_direct_cmd_desc(&desc,
+					  i40e_aqc_opc_run_phy_activity);
+
+	cmd->activity_id = CPU_TO_LE16(activity_id);
+	cmd->params.cmd.dnl_opcode = CPU_TO_LE32(dnl_opcode);
+
+	retval = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+	if (retval)
+		goto err;
+
+	*cmd_status = LE32_TO_CPU(cmd->params.resp.cmd_status);
+	*data0 = LE32_TO_CPU(cmd->params.resp.data0);
+	*data1 = LE32_TO_CPU(cmd->params.resp.data1);
+err:
+	return retval;
+}
+
 #ifdef VF_DRIVER
 
 /**
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index c6c45eb5a..748a7a275 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -76,6 +76,12 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
+enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
+					    u32 *rx_counter, bool *is_clear);
+enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
+					   bool offset_loaded, u64 *tx_offset,
+					   u64 *tx_stat, u64 *rx_offset,
+					   u64 *rx_stat);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
@@ -550,6 +556,10 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 				u8 phy_select, u8 dev_addr, bool page_change,
 				u32 reg_addr, u32 *reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
+			 u32 *cmd_status, u32 *data0, u32 *data1,
+			 struct i40e_asq_cmd_details *cmd_details);
 
 enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw,
 			struct i40e_aqc_arp_proxy_data *proxy_config,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 16/36] net/i40e/base: backport style changes from upstream Linux
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (14 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 17/36] net/i40e/base: update status codes Xiaolong Ye
                     ` (21 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacob Keller

The upstream virtchnl.h has a few minor style differences to what is
out-of-tree, and there is no real reason we should prefer the current
style over whats upstream.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 88096cb45..a8d5eaf8a 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -123,13 +123,13 @@ enum virtchnl_ops {
 
 };
 
-/* This macro is used to generate a compilation error if a structure
+/* These macros are used to generate compilation errors if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
  * structure is not of the correct size, otherwise it creates an enum that is
  * never used.
  */
 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
-	{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}
+	{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
 
 /* Virtual channel message descriptor. This overlays the admin queue
  * descriptor. All other data is passed in external buffers.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 17/36] net/i40e/base: update status codes
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (15 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
                     ` (20 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Mitch Williams

Add a few new status codes and rename a few to make them more consistent.
Error code are mapped to similar values as in i40e_status.h, so as to be
compatible with older VF drivers not using this status enum.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/virtchnl.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index a8d5eaf8a..c677d0eb5 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -40,13 +40,19 @@
 /* Error Codes */
 enum virtchnl_status_code {
 	VIRTCHNL_STATUS_SUCCESS				= 0,
-	VIRTCHNL_ERR_PARAM				= -5,
+	VIRTCHNL_STATUS_ERR_PARAM			= -5,
+	VIRTCHNL_STATUS_ERR_NO_MEMORY			= -18,
 	VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH		= -38,
 	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
 	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
-	VIRTCHNL_STATUS_NOT_SUPPORTED			= -64,
+	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
+	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
 };
 
+/* Backward compatibility */
+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
+
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
@@ -732,7 +738,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 	case VIRTCHNL_OP_EVENT:
 	case VIRTCHNL_OP_UNKNOWN:
 	default:
-		return VIRTCHNL_ERR_PARAM;
+		return VIRTCHNL_STATUS_ERR_PARAM;
 	}
 	/* few more checks */
 	if (err_msg_format || valid_len != msglen)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 18/36] net/i40e/base: change of the incorrect Tx descriptors number
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (16 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 17/36] net/i40e/base: update status codes Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
                     ` (19 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel, Dariusz Chaberski

The existing driver allows setting the number of TX descriptors
to the value that is indivisible by 32. This is not properly
supported by x710 hardware. The patch limits the number of TX
descriptors to the whole value of 32.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Dariusz Chaberski <dariuszx.chaberski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_type.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 8d257e00a..f0e4b667a 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -79,8 +79,8 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
 #define I40E_HI_BYTE(x)		((u8)(((x) >> 8) & 0xFF))
 #define I40E_LO_BYTE(x)		((u8)((x) & 0xFF))
 
-/* Number of Transmit Descriptors must be a multiple of 8. */
-#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	8
+/* Number of Transmit Descriptors must be a multiple of 32. */
+#define I40E_REQ_TX_DESCRIPTOR_MULTIPLE	32
 /* Number of Receive Descriptors must be a multiple of 32 if
  * the number of descriptors is greater than 32.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 19/36] net/i40e/base: extend PHY access AQ command
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (17 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
                     ` (18 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

Currently FW use MDIO I/F number corresponded with current PF for PHY
access. This code allow to specify used MDIO I/F number.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 57 +++++++++++++++++++++++
 drivers/net/i40e/base/i40e_adminq_cmd.h |  6 ++-
 drivers/net/i40e/base/i40e_common.c     | 62 ++++++++++++++++++++-----
 drivers/net/i40e/base/i40e_prototype.h  | 27 +++++++----
 drivers/net/i40e/base/i40e_type.h       |  1 +
 5 files changed, 132 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 52bea842f..96e170e12 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -569,6 +569,57 @@ STATIC void i40e_resume_aq(struct i40e_hw *hw)
 }
 #endif /* PF_DRIVER */
 
+/**
+ *  i40e_set_hw_flags - set HW flags
+ *  @hw: pointer to the hardware structure
+ **/
+STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
+{
+	struct i40e_adminq_info *aq = &hw->aq;
+
+	hw->flags = 0;
+
+	switch (hw->mac.type) {
+	case I40E_MAC_XL710:
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) {
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+			/* The ability to RX (not drop) 802.1ad frames */
+			hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
+		}
+		break;
+	case I40E_MAC_X722:
+		hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
+			     I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
+			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+		/* fall through */
+	default:
+		break;
+	}
+
+	/* Newer versions of firmware require lock when reading the NVM */
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 5))
+		hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 8))
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+
+	if (aq->api_maj_ver > 1 ||
+	    (aq->api_maj_ver == 1 &&
+	     aq->api_min_ver >= 9))
+		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED;
+}
+
 /**
  *  i40e_init_adminq - main initialization routine for Admin Queue
  *  @hw: pointer to the hardware structure
@@ -636,6 +687,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_arq;
 
+	/*
+	 * Some features were introduced in different FW API version
+	 * for different MAC type.
+	 */
+	i40e_set_hw_flags(hw);
+
 	/* get the NVM version info */
 	i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION,
 			   &hw->nvm.version);
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index d718c7326..7181e0f58 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2310,7 +2310,11 @@ struct i40e_aqc_phy_register_access {
 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE	2
 	u8	dev_addres;
 	u8	cmd_flags;
-#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	1
+#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE	0x01
+#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER	0x02
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT	2
+#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK	(0x3 << \
+		I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT)
 	u8	reserved1;
 	__le32	reg_address;
 	__le32	reg_value;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9d76b6824..ee081d6ad 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7239,23 +7239,52 @@ void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val)
 		wr32(hw, reg_addr, reg_val);
 }
 
-#ifdef PF_DRIVER
 /**
- * i40e_aq_set_phy_register
+ * i40e_mdio_if_number_selection - MDIO I/F number selection
+ * @hw: pointer to the hw struct
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
+ * @cmd: pointer to PHY Register command structure
+ **/
+static void
+i40e_mdio_if_number_selection(struct i40e_hw *hw, bool set_mdio, u8 mdio_num,
+			      struct i40e_aqc_phy_register_access *cmd)
+{
+	if (set_mdio && cmd->phy_interface == I40E_AQ_PHY_REG_ACCESS_EXTERNAL) {
+		if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED)
+			cmd->cmd_flags |=
+				I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER |
+				((mdio_num <<
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) &
+				I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK);
+		else
+			i40e_debug(hw, I40E_DEBUG_PHY,
+				   "MDIO I/F number selection not supported by current FW version.\n");
+	}
+}
+
+/**
+ * i40e_aq_set_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: new register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Write the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_set_phy_register.
  **/
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7273,27 +7302,35 @@ enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
 	return status;
 }
 
 /**
- * i40e_aq_get_phy_register
+ * i40e_aq_get_phy_register_ext
  * @hw: pointer to the hw struct
  * @phy_select: select which phy should be accessed
  * @dev_addr: PHY device address
  * @page_change: enable auto page change
+ * @set_mdio: use MDIO I/F number specified by mdio_num
+ * @mdio_num: MDIO I/F number
  * @reg_addr: PHY register address
  * @reg_val: read register value
  * @cmd_details: pointer to command details structure or NULL
  *
  * Read the external PHY register.
+ * NOTE: In common cases MDIO I/F number should not be changed, thats why you
+ * may use simple wrapper i40e_aq_get_phy_register.
  **/
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_phy_register_access *cmd =
@@ -7310,6 +7347,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	if (!page_change)
 		cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE;
 
+	i40e_mdio_if_number_selection(hw, set_mdio, mdio_num, cmd);
+
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 	if (!status)
 		*reg_val = LE32_TO_CPU(cmd->reg_value);
@@ -7317,7 +7356,6 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
 	return status;
 }
 
-#endif /* PF_DRIVER */
 /**
  * i40e_aq_run_phy_activity
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 748a7a275..fcfe497f1 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -548,14 +548,25 @@ enum i40e_status_code i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
 				u32 reg_addr, u32 reg_val,
 				struct i40e_asq_cmd_details *cmd_details);
 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
-enum i40e_status_code i40e_aq_set_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw,
-				u8 phy_select, u8 dev_addr, bool page_change,
-				u32 reg_addr, u32 *reg_val,
-				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code
+i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
+			     u8 phy_select, u8 dev_addr, bool page_change,
+			     bool set_mdio, u8 mdio_num,
+			     u32 reg_addr, u32 *reg_val,
+			     struct i40e_asq_cmd_details *cmd_details);
+
+/* Convenience wrappers for most common use case */
+#define i40e_aq_set_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_set_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+#define i40e_aq_get_phy_register(hw, ps, da, pc, ra, rv, cd) \
+	i40e_aq_get_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
+
 enum i40e_status_code
 i40e_aq_run_phy_activity(struct i40e_hw *hw, u16 activity_id, u32 opcode,
 			 u32 *cmd_status, u32 *data0, u32 *data1,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index f0e4b667a..b380193f7 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -743,6 +743,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
+#define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 20/36] net/i40e/base: add drop mode parameter to set MAC config
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (18 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
                     ` (17 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Wnuczko Sylwia

This patch adds "drop mode" parameter to set mac config AQ command.
This bit controls the behavior when a no-drop packet is blocking a TC
queue.
0 – The PF driver is notified.
1 – The blocking packet is dropped and then the PF driver is notified.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     |  4 +++-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 29 +++++++++++++------------
 drivers/net/i40e/base/i40e_common.c     | 11 ++++++++++
 drivers/net/i40e/base/i40e_prototype.h  |  1 +
 drivers/net/i40e/base/i40e_type.h       |  1 +
 drivers/net/i40e/i40e_ethdev.c          |  2 +-
 6 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 96e170e12..0676f9a25 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -611,8 +611,10 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
-	     aq->api_min_ver >= 8))
+	     aq->api_min_ver >= 8)) {
 		hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT;
+		hw->flags |= I40E_HW_FLAG_DROP_MODE;
+	}
 
 	if (aq->api_maj_ver > 1 ||
 	    (aq->api_maj_ver == 1 &&
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 7181e0f58..f6c9d3e1a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2098,20 +2098,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
 struct i40e_aq_set_mac_config {
 	__le16	max_frame_size;
 	u8	params;
-#define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
-#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
-#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
-#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
-#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
-#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
-#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
-#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
-#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
+#define I40E_AQ_SET_MAC_CONFIG_CRC_EN			0x04
+#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK		0x78
+#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT		3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE		0x0
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX		0xF
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX		0x9
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX		0x8
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX		0x7
+#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX		0x6
+#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX		0x5
+#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX		0x4
+#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX		0x3
+#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX		0x2
+#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX		0x1
+#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN	0x80
 	u8	tx_timer_priority; /* bitmap */
 	__le16	tx_timer_value;
 	__le16	fc_refresh_threshold;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index ee081d6ad..eddc91e36 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1873,6 +1873,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
  * @max_frame_size: Maximum Frame Size to be supported by the port
  * @crc_en: Tell HW to append a CRC to outgoing frames
  * @pacing: Pacing configurations
+ * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked
  * @cmd_details: pointer to command details structure or NULL
  *
  * Configure MAC settings for frame size, jumbo frame support and the
@@ -1881,6 +1882,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size,
 				bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details)
 {
 	struct i40e_aq_desc desc;
@@ -1899,6 +1901,15 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 	if (crc_en)
 		cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN;
 
+	if (auto_drop_blocking_packets) {
+		if (hw->flags & I40E_HW_FLAG_DROP_MODE)
+			cmd->params |=
+				I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN;
+		else
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "This FW api version does not support drop mode.\n");
+	}
+
 #define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD	0x7FFF
 	cmd->fc_refresh_threshold =
 		CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD);
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index fcfe497f1..43db2a6f3 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -114,6 +114,7 @@ enum i40e_status_code i40e_aq_set_phy_int_mask(struct i40e_hw *hw, u16 mask,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw,
 				u16 max_frame_size, bool crc_en, u16 pacing,
+				bool auto_drop_blocking_packets,
 				struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_local_advt_reg(struct i40e_hw *hw,
 				u64 *advt_reg,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index b380193f7..d20b0fe20 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -744,6 +744,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
+#define I40E_HW_FLAG_DROP_MODE		    BIT_ULL(7)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 81ed847d7..3c60856b3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1649,7 +1649,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* Set the max frame size to 0x2600 by default,
 	 * in case other drivers changed the default value.
 	 */
-	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, 0, NULL);
+	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, false, 0, NULL);
 
 	/* initialize mirror rule list */
 	TAILQ_INIT(&pf->mirror_list);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 21/36] net/i40e/base: add FWS1B register masks
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (19 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 22/36] net/i40e/base: update FW API version Xiaolong Ye
                     ` (16 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Adrian Podlawski

Function check_recovery_mode had wrong if statement. Now we check proper
FWS1B register values, which are responsible for the recovery mode.
Recovery mode has 6 values in total. That's why we need 6 different flags.
Now in if statement we recognize type of mac and register value. Without
those changes driver could show wrong state.

Signed-off-by: Adrian Podlawski <adrian.podlawski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index e93ec3f58..6804aba51 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,18 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK \
+				I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK \
+				I40E_MASK(0x33, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
+				I40E_MASK(0xB, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
+				I40E_MASK(0xC, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_GLGEN_CLKSTAT                    0x000B8184 /* Reset: POR */
 #define I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT      0
 #define I40E_GLGEN_CLKSTAT_CLKMODE_MASK       I40E_MASK(0x1, I40E_GLGEN_CLKSTAT_CLKMODE_SHIFT)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 22/36] net/i40e/base: update FW API version
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (20 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
                     ` (15 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Azarewicz

Update FW API version to 1.9.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index f6c9d3e1a..0443c6361 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -12,8 +12,8 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0006
-#define I40E_FW_API_VERSION_MINOR_X710	0x0007
+#define I40E_FW_API_VERSION_MINOR_X722	0x0009
+#define I40E_FW_API_VERSION_MINOR_X710	0x0009
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
 					I40E_FW_API_VERSION_MINOR_X710 : \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 23/36] net/i40e/base: add persistent lldp support
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (21 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 22/36] net/i40e/base: update FW API version Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
                     ` (14 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Wnuczko Sylwia

This patch adds a function to read nvm module data and uses it to
read current lldp agent configuration from nvm api version 1.8.

Signed-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c       | 20 +++++++-
 drivers/net/i40e/base/i40e_dcb.h       |  5 ++
 drivers/net/i40e/base/i40e_nvm.c       | 71 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 4 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index f1465daa3..2ab5021ee 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -877,7 +877,25 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
-	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
+		u8 offset = 0;
+
+		if (hw->mac.type == I40E_MAC_XL710)
+			offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;
+		else if (hw->mac.type == I40E_MAC_X722)
+			offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
+		else
+			return I40E_NOT_SUPPORTED;
+
+		ret = i40e_read_nvm_module_data(hw,
+						I40E_SR_EMP_SR_SETTINGS_PTR,
+						offset,
+						I40E_LLDP_CURRENT_STATUS_OFFSET,
+						I40E_LLDP_CURRENT_STATUS_SIZE,
+						&lldp_cfg.adminstatus);
+	} else {
+		ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+	}
 	if (ret)
 		return I40E_ERR_NOT_READY;
 
diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 88fe405d7..520c7db73 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -39,6 +39,11 @@
 #define I40E_LLDP_ADMINSTATUS_ENABLED_TX	2
 #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX	3
 
+#define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET	0x2B
+#define I40E_LLDP_CURRENT_STATUS_X722_OFFSET	0x31
+#define I40E_LLDP_CURRENT_STATUS_OFFSET		1
+#define I40E_LLDP_CURRENT_STATUS_SIZE		1
+
 /* Defines for LLDP TLV header */
 #define I40E_LLDP_MIB_HLEN		14
 #define I40E_LLDP_TLV_LEN_SHIFT		0
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index c8b401cdd..fc24cc2ce 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -337,6 +337,77 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 	return ret_code;
 }
 
+/**
+ * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location
+ * @hw: Pointer to the HW structure
+ * @module_ptr: Pointer to module in words with respect to NVM beginning
+ * @module_offset: Offset in words from module start
+ * @data_offset: Offset in words from reading data area start
+ * @words_data_size: Words to read from NVM
+ * @data_ptr: Pointer to memory location where resulting buffer will be stored
+ **/
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr)
+{
+	enum i40e_status_code status;
+	u16 specific_ptr = 0;
+	u16 ptr_value = 0;
+	u16 offset = 0;
+
+	if (module_ptr != 0) {
+		status = i40e_read_nvm_word(hw, module_ptr, &ptr_value);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+	}
+#define I40E_NVM_INVALID_PTR_VAL 0x7FFF
+#define I40E_NVM_INVALID_VAL 0xFFFF
+
+	/* Pointer not initialized */
+	if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
+	    ptr_value == I40E_NVM_INVALID_VAL) {
+		i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n");
+		return I40E_ERR_BAD_PTR;
+	}
+
+	/* Check whether the module is in SR mapped area or outside */
+	if (ptr_value & I40E_PTR_TYPE) {
+		/* Pointer points outside of the Shared RAM mapped area */
+		i40e_debug(hw, I40E_DEBUG_ALL,
+			   "Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n");
+
+		return I40E_ERR_PARAM;
+	} else {
+		/* Read from the Shadow RAM */
+
+		status = i40e_read_nvm_word(hw, ptr_value + module_offset,
+					    &specific_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm word failed.Error code: %d.\n",
+				   status);
+			return I40E_ERR_NVM;
+		}
+
+		offset = ptr_value + module_offset + specific_ptr +
+			data_offset;
+
+		status = i40e_read_nvm_buffer(hw, offset, &words_data_size,
+					      data_ptr);
+		if (status != I40E_SUCCESS) {
+			i40e_debug(hw, I40E_DEBUG_ALL,
+				   "Reading nvm buffer failed.Error code: %d.\n",
+				   status);
+		}
+	}
+
+	return status;
+}
+
 /**
  * i40e_read_nvm_buffer_srctl - Reads Shadow RAM buffer via SRCTL register
  * @hw: pointer to the HW structure
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 43db2a6f3..afebf441d 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -442,6 +442,9 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,
 void i40e_release_nvm(struct i40e_hw *hw);
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 					 u16 *data);
+enum i40e_status_code
+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,
+			  u16 data_offset, u16 words_data_size, u16 *data_ptr);
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
 					   u16 *words, u16 *data);
 enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (22 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  8:19     ` Kwapulinski, Piotr
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 25/36] net/i40e/base: fix retrying logic Xiaolong Ye
                     ` (13 subsequent siblings)
  37 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Kwapulinski

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type()
to be public. It is required for recovery mode handling. Without this patch
recovery mode could not be detected at probe() function.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index eddc91e36..4f87ec9fa 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#else
-STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
-#endif
 {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index afebf441d..2b6198985 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -472,10 +472,8 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
 #endif /* PF_DRIVER */
 enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
-#if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 25/36] net/i40e/base: fix retrying logic
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (23 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
                     ` (12 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Marcin Formela

Fixed a bug where driver was breaking out of the loop and
reporting an error without retrying first.

Fixes: 466eec7d6b1a ("net/i40e/base: retry AQC to overcome IRCRead hangs")

Signed-off-by: Marcin Formela <marcin.formela@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 4f87ec9fa..a37e70599 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1714,19 +1714,22 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
 		status = i40e_asq_send_command(hw, &desc, abilities,
 					       abilities_size, cmd_details);
 
-		if (status != I40E_SUCCESS)
-			break;
-
-		if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) {
+		switch (hw->aq.asq_last_status) {
+		case I40E_AQ_RC_EIO:
 			status = I40E_ERR_UNKNOWN_PHY;
 			break;
-		} else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) {
+		case I40E_AQ_RC_EAGAIN:
 			i40e_msec_delay(1);
 			total_delay++;
 			status = I40E_ERR_TIMEOUT;
+			break;
+		/* also covers I40E_AQ_RC_OK */
+		default:
+			break;
 		}
-	} while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) &&
-		 (total_delay < max_delay));
+
+	} while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) &&
+		(total_delay < max_delay));
 
 	if (status != I40E_SUCCESS)
 		return status;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 26/36] net/i40e/base: mark additional missing bits as reserved
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (24 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 25/36] net/i40e/base: fix retrying logic Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 27/36] net/i40e/base: fix wrong 'Advertised FEC modes' Xiaolong Ye
                     ` (11 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jacob Keller

Mark bits 0xD through 0xF for the command flags of a cloud filter as
reserved. These bits are not yet defined and are considered as reserved
in the data sheet.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 0443c6361..658875a0d 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1402,6 +1402,9 @@ struct i40e_aqc_cloud_filters_element_data {
 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
 #define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C
+/* 0x000D reserved */
+/* 0x000E reserved */
+/* 0x000F reserved */
 /* 0x0010 to 0x0017 is for custom filters */
 #define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT		0x0010 /* Dest IP + L4 Port */
 #define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT		0x0011 /* Dest MAC + L4 Port */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 27/36] net/i40e/base: fix wrong 'Advertised FEC modes'
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (25 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
                     ` (10 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Gawin

Fix display of FEC settings for ethtool.
This patch change variable 'phy.link_info.req_fec_info' sent to ethtool.
Without this patch wrong FEC settings can be shown.

Fixes: 1216fb9f0c8c ("net/i40e/base: store the requested FEC information")

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index a37e70599..9ad0dd654 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2911,9 +2911,16 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw)
 		if (status)
 			return status;
 
-		hw->phy.link_info.req_fec_info =
-			abilities.fec_cfg_curr_mod_ext_info &
-			(I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS);
+		if (abilities.fec_cfg_curr_mod_ext_info &
+		    I40E_AQ_ENABLE_FEC_AUTO)
+			hw->phy.link_info.req_fec_info =
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
+		else
+			hw->phy.link_info.req_fec_info =
+				abilities.fec_cfg_curr_mod_ext_info &
+				(I40E_AQ_REQUEST_FEC_KR |
+				 I40E_AQ_REQUEST_FEC_RS);
 
 		i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type,
 			sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 28/36] net/i40e/base: add Flow Director defines
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (26 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 27/36] net/i40e/base: fix wrong 'Advertised FEC modes' Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
                     ` (9 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Doug Dziggel

Add defines for creating Flow Director flows as defined in datasheet
section 7.1.5.4 for field vectors.

Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 6804aba51..3a8c0ccd1 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -5287,6 +5287,87 @@
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT 0
 #define I40E_GLGEN_STAT_HALT_HALT_CELLS_MASK  I40E_MASK(0x3FFFFFFF, I40E_GLGEN_STAT_HALT_HALT_CELLS_SHIFT)
 #endif /* PF_DRIVER */
+/* Flow Director */
+#define I40E_REG_INSET_L2_DMAC_SHIFT            60
+#define I40E_REG_INSET_L2_DMAC_MASK             I40E_MASK(0xEULL, I40E_REG_INSET_L2_DMAC_SHIFT)
+#define I40E_REG_INSET_L2_SMAC_SHIFT            56
+#define I40E_REG_INSET_L2_SMAC_MASK             I40E_MASK(0x1CULL, I40E_REG_INSET_L2_SMAC_SHIFT)
+#define I40E_REG_INSET_L2_OUTER_VLAN_SHIFT      26
+#define I40E_REG_INSET_L2_OUTER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_OUTER_VLAN_SHIFT)
+#define I40E_REG_INSET_L2_INNER_VLAN_SHIFT      55
+#define I40E_REG_INSET_L2_INNER_VLAN_MASK       I40E_MASK(0x1ULL, I40E_REG_INSET_L2_INNER_VLAN_SHIFT)
+#define I40E_REG_INSET_TUNNEL_VLAN_SHIFT        56
+#define I40E_REG_INSET_TUNNEL_VLAN_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_VLAN_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP4_SHIFT         47
+#define I40E_REG_INSET_L3_SRC_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP4_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP4_MASK          I40E_MASK(0x3ULL, I40E_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT    49
+#define I40E_X722_REG_INSET_L3_SRC_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_SRC_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_DST_IP4_SHIFT    41
+#define I40E_X722_REG_INSET_L3_DST_IP4_MASK     I40E_MASK(0x3ULL, I40E_X722_REG_INSET_L3_DST_IP4_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT  52
+#define I40E_X722_REG_INSET_L3_IP4_PROTO_MASK   I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT    52
+#define I40E_X722_REG_INSET_L3_IP4_TTL_MASK     I40E_MASK(0x1ULL, I40E_X722_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TOS_SHIFT         54
+#define I40E_REG_INSET_L3_IP4_TOS_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TOS_SHIFT)
+#define I40E_REG_INSET_L3_IP4_PROTO_SHIFT       50
+#define I40E_REG_INSET_L3_IP4_PROTO_MASK        I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_PROTO_SHIFT)
+#define I40E_REG_INSET_L3_IP4_TTL_SHIFT         50
+#define I40E_REG_INSET_L3_IP4_TTL_MASK          I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP4_TTL_SHIFT)
+#define I40E_REG_INSET_L3_SRC_IP6_SHIFT         43
+#define I40E_REG_INSET_L3_SRC_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_SRC_IP6_SHIFT)
+#define I40E_REG_INSET_L3_DST_IP6_SHIFT         35
+#define I40E_REG_INSET_L3_DST_IP6_MASK          I40E_MASK(0xFFULL, I40E_REG_INSET_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_L3_IP6_TC_SHIFT          54
+#define I40E_REG_INSET_L3_IP6_TC_MASK           I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_TC_SHIFT)
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT    51
+#define I40E_REG_INSET_L3_IP6_NEXT_HDR_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_NEXT_HDR_SHIFT)
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT   51
+#define I40E_REG_INSET_L3_IP6_HOP_LIMIT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_L3_IP6_HOP_LIMIT_SHIFT)
+#define I40E_REG_INSET_L4_SRC_PORT_SHIFT        34
+#define I40E_REG_INSET_L4_SRC_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_SRC_PORT_SHIFT)
+#define I40E_REG_INSET_L4_DST_PORT_SHIFT        33
+#define I40E_REG_INSET_L4_DST_PORT_MASK         I40E_MASK(0x1ULL, I40E_REG_INSET_L4_DST_PORT_SHIFT)
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT 31
+#define I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_MASK  I40E_MASK(0x3ULL, I40E_REG_INSET_L4_SCTP_VERIFICATION_TAG_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT  22
+#define I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_DST_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT  11
+#define I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_MASK   I40E_MASK(0x7ULL, I40E_REG_INSET_TUNNEL_L2_INNER_SRC_MAC_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT   21
+#define I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_MASK    I40E_MASK(0x1ULL, I40E_REG_INSET_TUNNEL_L4_UDP_DST_PORT_SHIFT)
+#define I40E_REG_INSET_TUNNEL_ID_SHIFT          18
+#define I40E_REG_INSET_TUNNEL_ID_MASK           I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_ID_SHIFT)
+#define I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT    14
+#define I40E_REG_INSET_LAST_ETHER_TYPE_MASK     I40E_MASK(0x1ULL, I40E_REG_INSET_LAST_ETHER_TYPE_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT  8
+#define I40E_REG_INSET_TUNNEL_L3_SRC_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_SRC_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP4_MASK   I40E_MASK(0x3ULL, I40E_REG_INSET_TUNNEL_L3_DST_IP4_SHIFT)
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT  6
+#define I40E_REG_INSET_TUNNEL_L3_DST_IP6_MASK   I40E_MASK(0xFFULL, I40E_REG_INSET_TUNNEL_L3_DST_IP6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT 13
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD1_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD1_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT 12
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD2_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD2_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT 11
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD3_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD3_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT 10
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD4_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD4_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT 9
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD5_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD5_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT 8
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD6_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD6_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT 7
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD7_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD7_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORD8_MASK  I40E_MASK(0x1ULL, I40E_REG_INSET_FLEX_PAYLOAD_WORD8_SHIFT)
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT 6
+#define I40E_REG_INSET_FLEX_PAYLOAD_WORDS_MASK  I40E_MASK(0xFFULL, I40E_REG_INSET_FLEX_PAYLOAD_WORDS_SHIFT)
+#define I40E_REG_INSET_MASK_DEFAULT             0x0000000000000000ULL
+
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT       30
 #define I40E_VFINT_DYN_CTL01_WB_ON_ITR_MASK        I40E_MASK(0x1, I40E_VFINT_DYN_CTL01_WB_ON_ITR_SHIFT)
 #define I40E_VFINT_DYN_CTLN1_WB_ON_ITR_SHIFT       30
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 29/36] net/i40e/base: removed unreachable code
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (27 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
                     ` (8 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Dzmitry Sautsa

The result of the check is always FALSE and the code within "if"
is never executed.

Signed-off-by: Dzmitry Sautsa <dzmitryx.sautsa@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 9ad0dd654..8144d957e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -4869,8 +4869,6 @@ enum i40e_status_code i40e_aq_add_mcast_etag(struct i40e_hw *hw, u16 pv_seid,
 	cmd->num_unicast_etags = num_tags_in_buf;
 
 	desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
-	if (length > I40E_AQ_LARGE_BUF)
-		desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
 
 	status = i40e_asq_send_command(hw, &desc, buf, length, cmd_details);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 30/36] net/i40e/base: set PHY Access flag on X722
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (28 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
                     ` (7 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Adam Ludkiewicz

The X722 FW API version 1.9 adds support for accessing PHY
registers with Admin Queue Command. This enables reading
EEPROM data from (Q)SFP+ transceivers, what was previously
possible only on X710 devices.

Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_adminq.c     | 5 +++++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 0676f9a25..221c327d1 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -598,6 +598,11 @@ STATIC void i40e_set_hw_flags(struct i40e_hw *hw)
 		    (aq->api_maj_ver == 1 &&
 		     aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
 			hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
+			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
 		/* fall through */
 	default:
 		break;
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 658875a0d..d99fbbe6a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -21,6 +21,8 @@
 
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */
+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 31/36] net/i40e/base: implement reading lpi statistics
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (29 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
                     ` (6 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Jaroslaw Gawin

There was no time duration statistics for LPI (Low Power Idle)
in EEE (Energy-Efficient Ethernet).
Added new procedure to get duration values from FW.
Otherwise there is no available procedure to get tx_lpi_duration
and rx_lpi_duration values.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 56 ++++++++++++++++++++++++++
 drivers/net/i40e/base/i40e_prototype.h |  3 ++
 drivers/net/i40e/base/i40e_type.h      |  2 +
 3 files changed, 61 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8144d957e..d90012fd7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7083,6 +7083,62 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 	return I40E_SUCCESS;
 }
 
+/**
+ * i40e_get_lpi_duration - read LPI time duration from EEE statistics
+ * @hw: pointer to the hw struct
+ * @stat: pointer to structure with status of rx and tx lpi
+ * @tx_duration: pointer to memory for TX LPI time duration
+ * @rx_duration: pointer to memory for RX LPI time duration
+ *
+ * Read Low Power Idle (LPI) mode time duration from Energy Efficient
+ * Ethernet (EEE) statistics.
+ */
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration)
+{
+	u32 tx_time_dur, rx_time_dur;
+	enum i40e_status_code retval;
+	u32 cmd_status;
+
+	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC)
+		return I40E_ERR_NOT_IMPLEMENTED;
+
+	retval = i40e_aq_run_phy_activity
+		(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+		I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_DUR,
+		&cmd_status, &tx_time_dur, &rx_time_dur, NULL);
+
+	if (retval)
+		return retval;
+	if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+	    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+		return I40E_ERR_ADMIN_QUEUE_ERROR;
+
+	if (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB &&
+	    !tx_time_dur && !rx_time_dur &&
+	    stat->tx_lpi_status && stat->rx_lpi_status) {
+		retval = i40e_aq_run_phy_activity
+			(hw, I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+			I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT_DUR,
+			&cmd_status,
+			&tx_time_dur, &rx_time_dur, NULL);
+
+		if (retval)
+			return retval;
+		if ((cmd_status & I40E_AQ_RUN_PHY_ACT_CMD_STAT_MASK) !=
+		    I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
+			return I40E_ERR_ADMIN_QUEUE_ERROR;
+		tx_time_dur = 0;
+		rx_time_dur = 0;
+	}
+
+	*tx_duration = tx_time_dur;
+	*rx_duration = rx_time_dur;
+
+	return retval;
+}
+
 /**
  * i40e_lpi_stat_update - update LPI counters with values relative to offset
  * @hw: pointer to the hw struct
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 2b6198985..0d1adb689 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -82,6 +82,9 @@ enum i40e_status_code i40e_lpi_stat_update(struct i40e_hw *hw,
 					   bool offset_loaded, u64 *tx_offset,
 					   u64 *tx_stat, u64 *rx_offset,
 					   u64 *rx_stat);
+enum i40e_status_code i40e_get_lpi_duration(struct i40e_hw *hw,
+					    struct i40e_hw_port_stats *stat,
+					    u64 *tx_duration, u64 *rx_duration);
 /* admin send queue commands */
 
 enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index d20b0fe20..af9089829 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1498,6 +1498,8 @@ struct i40e_hw_port_stats {
 	u32 rx_lpi_status;
 	u64 tx_lpi_count;		/* etlpic */
 	u64 rx_lpi_count;		/* erlpic */
+	u64 tx_lpi_duration;
+	u64 rx_lpi_duration;
 };
 
 /* Checksum and Shadow RAM pointers */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 32/36] net/i40e/base: exposing missing LED functionality
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (30 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
                     ` (5 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Rusinski

The previous code had the LED code wrapped such that, it was
static to the file and not usable outside of it. It is now available.

Signed-off-by: Rusinski <mateusz.rusinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 8 ++++----
 drivers/net/i40e/base/i40e_prototype.h | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d90012fd7..d0cb53a9d 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -6851,8 +6851,8 @@ enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
  * @led_addr: LED register address
  * @reg_val: read register value
  **/
-static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 *reg_val)
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
@@ -6880,8 +6880,8 @@ static enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
  * @led_addr: LED register address
  * @reg_val: register value to write
  **/
-static enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
-					      u32 reg_val)
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val)
 {
 	enum i40e_status_code status;
 	u8 phy_addr = 0;
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0d1adb689..0f06e3262 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -73,7 +73,10 @@ enum i40e_status_code i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
 				       u16 *val);
 enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
 					      u32 time, u32 interval);
-
+enum i40e_status_code i40e_led_get_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 *reg_val);
+enum i40e_status_code i40e_led_set_reg(struct i40e_hw *hw, u16 led_addr,
+				       u32 reg_val);
 enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 					      struct i40e_hw_port_stats *stats);
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (31 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  8:19     ` Kwapulinski, Piotr
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
                     ` (4 subsequent siblings)
  37 siblings, 1 reply; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Piotr Kwapulinski

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 3a8c0ccd1..436f48efa 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 34/36] net/i40e/base: add CRC stripping capability
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (32 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
                     ` (3 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Paul M Stillwell Jr

Some VFs may want to disable CRC stripping on incoming packets
so create an offload for that. The VF already sends information
about configuring it's RX queues so use that structure to
indicate that the CRC stripping should be enabled or not.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.h |  3 +--
 drivers/net/i40e/base/virtchnl.h | 12 ++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h
index 520c7db73..60193c98d 100644
--- a/drivers/net/i40e/base/i40e_dcb.h
+++ b/drivers/net/i40e/base/i40e_dcb.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2018
+ * Copyright(c) 2001-2019
  */
 
 #ifndef _I40E_DCB_H_
@@ -205,5 +205,4 @@ i40e_get_fw_lldp_status(struct i40e_hw *hw,
 enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw);
 enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
 					      struct i40e_dcbx_config *dcbcfg);
-
 #endif /* _I40E_DCB_H_ */
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c677d0eb5..c613d4761 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -228,6 +228,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040
+#define VIRTCHNL_VF_OFFLOAD_CRC			0x00000080
 #define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000
 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000
 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
@@ -276,7 +277,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
  * VF sends this message to set up parameters for one RX queue.
  * External data buffer contains one instance of virtchnl_rxq_info.
- * PF configures requested queue and returns a status code.
+ * PF configures requested queue and returns a status code. The
+ * crc_disable flag disables CRC stripping on the VF. Setting
+ * the crc_disable flag to 1 will disable CRC stripping for each
+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
+ * offload must have been set prior to sending this info or the PF
+ * will ignore the request. This flag should be set the same for
+ * all of the queues for a VF.
  */
 
 /* Rx queue config info */
@@ -288,7 +295,8 @@ struct virtchnl_rxq_info {
 	u16 splithdr_enabled; /* deprecated with AVF 1.0 */
 	u32 databuffer_size;
 	u32 max_pkt_size;
-	u32 pad1;
+	u8 crc_disable;
+	u8 pad1[3];
 	u64 dma_ring_addr;
 	enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
 	u32 pad2;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 35/36] net/i40e/base: enable LED blinking flow
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (33 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
                     ` (2 subsequent siblings)
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Damian Milosek

Add X710T*L device specific operations (in port LED detection and
handling of GLGEN_GPIO_CTL.PIN_FUNC field) to enable LED blinking.

Signed-off-by: Damian Milosek <damian.milosek@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 28 +++++++++++++++++++++++++---
 drivers/net/i40e/base/i40e_devids.h |  2 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index d0cb53a9d..84e67f285 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1544,9 +1544,9 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 	u32 gpio_val = 0;
 	u32 port;
 
-	if (!hw->func_caps.led[idx])
+	if (!I40E_IS_X710TL_DEVICE(hw->device_id) &&
+	    !hw->func_caps.led[idx])
 		return 0;
-
 	gpio_val = rd32(hw, I40E_GLGEN_GPIO_CTL(idx));
 	port = (gpio_val & I40E_GLGEN_GPIO_CTL_PRT_NUM_MASK) >>
 		I40E_GLGEN_GPIO_CTL_PRT_NUM_SHIFT;
@@ -1565,8 +1565,15 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 #define I40E_FILTER_ACTIVITY 0xE
 #define I40E_LINK_ACTIVITY 0xC
 #define I40E_MAC_ACTIVITY 0xD
+#define I40E_FW_LED BIT(4)
+#define I40E_LED_MODE_VALID (I40E_GLGEN_GPIO_CTL_LED_MODE_MASK >> \
+			     I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT)
+
 #define I40E_LED0 22
 
+#define I40E_PIN_FUNC_SDP 0x0
+#define I40E_PIN_FUNC_LED 0x1
+
 /**
  * i40e_led_get - return current on/off mode
  * @hw: pointer to the hw struct
@@ -1628,8 +1635,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 	u32 current_mode = 0;
 	int i;
 
-	if (mode & 0xfffffff0)
+	if (mode & ~I40E_LED_MODE_VALID) {
 		DEBUGOUT1("invalid mode passed in %X\n", mode);
+		return;
+	}
 
 	/* as per the documentation GPIO 22-29 are the LED
 	 * GPIO pins named LED0..LED7
@@ -1655,6 +1664,19 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 			break;
 		}
 
+		if (I40E_IS_X710TL_DEVICE(hw->device_id)) {
+			u32 pin_func = 0;
+
+			if (mode & I40E_FW_LED)
+				pin_func = I40E_PIN_FUNC_SDP;
+			else
+				pin_func = I40E_PIN_FUNC_LED;
+
+			gpio_val &= ~I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK;
+			gpio_val |= ((pin_func <<
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_SHIFT) &
+				     I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK);
+		}
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
diff --git a/drivers/net/i40e/base/i40e_devids.h b/drivers/net/i40e/base/i40e_devids.h
index 1700db17a..5897d38f6 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -38,6 +38,8 @@
 #endif
 #define I40E_DEV_ID_10G_B		0x104F
 #define I40E_DEV_ID_10G_SFP		0x104E
+#define I40E_IS_X710TL_DEVICE(d) \
+	((d) == I40E_DEV_ID_10G_BASE_T_BC)
 #define I40E_DEV_ID_KX_X722		0x37CE
 #define I40E_DEV_ID_QSFP_X722		0x37CF
 #define I40E_DEV_ID_SFP_X722		0x37D0
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* [dpdk-dev] [PATCH v4 36/36] net/i40e/base: add new link speed constants
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (34 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
@ 2020-01-13  2:39   ` Xiaolong Ye
  2020-01-13  2:54   ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Zhang, Qi Z
  2020-01-13  3:26   ` Xing, Beilei
  37 siblings, 0 replies; 198+ messages in thread
From: Xiaolong Ye @ 2020-01-13  2:39 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, Aleksandr Loktionov

This patch fixes 'NIC Link is Up, Unknown bps' message in dmesg
for 2.5Gb/5Gb speeds. This problem is fixed by adding constants
for VIRTCHNL_LINK_SPEED_2_5GB and VIRTCHNL_LINK_SPEED_5GB.

Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_prototype.h | 4 ++++
 drivers/net/i40e/base/virtchnl.h       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 0f06e3262..d8ab3ea0a 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -505,6 +505,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
 		return VIRTCHNL_LINK_SPEED_100MB;
 	case I40E_LINK_SPEED_1GB:
 		return VIRTCHNL_LINK_SPEED_1GB;
+	case I40E_LINK_SPEED_2_5GB:
+		return VIRTCHNL_LINK_SPEED_2_5GB;
+	case I40E_LINK_SPEED_5GB:
+		return VIRTCHNL_LINK_SPEED_5GB;
 	case I40E_LINK_SPEED_10GB:
 		return VIRTCHNL_LINK_SPEED_10GB;
 	case I40E_LINK_SPEED_40GB:
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index c613d4761..92515bf34 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -53,12 +53,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
 
 enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
@@ -68,6 +70,8 @@ enum virtchnl_link_speed {
 	VIRTCHNL_LINK_SPEED_40GB	= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_20GB	= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
 	VIRTCHNL_LINK_SPEED_25GB	= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_2_5GB	= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+	VIRTCHNL_LINK_SPEED_5GB		= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (35 preceding siblings ...)
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
@ 2020-01-13  2:54   ` Zhang, Qi Z
  2020-01-13  3:26   ` Xing, Beilei
  37 siblings, 0 replies; 198+ messages in thread
From: Zhang, Qi Z @ 2020-01-13  2:54 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Ye, Xiaolong



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaolong Ye
> Sent: Monday, January 13, 2020 10:39 AM
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> Subject: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
> 
> This series is to support FVL 7.2 release.
> 
> The main changes include:
> 
> * virtchnl updates
> * add lldp support
> * Flow director updates
> * extend PHY access AQ cmd
> * add reading LPI counters
> * add support for Energy Efficient Ethernet
> * A few fixes.
> 
> v4:
> 
> * add a few missed Fixes tags
> 
> V3:
> 
> * add missing SOBs
> 
> V2:
> 
> * strip some unnecessary code
> * squash some fixes
> * improve commit logs
> 
> Xiaolong Ye (36):
>   net/i40e/base: add support for feature flags
>   net/i40e/base: increase max VSI count for VFs
>   net/i40e/base: change buffer address
>   net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
>   net/i40e/base: change misleading error message
>   net/i40e/base: further implementation of LLDP
>   net/i40e/base: add new device ids
>   net/i40e/base: add check for MAC type
>   net/i40e/base: adding flags for PHY types
>   net/i40e/base: improve AQ log granularity
>   net/i40e/base: add getter for FW LLDP agent status
>   net/i40e/base: add support for Energy Efficient Ethernet
>   net/i40e/base: read LPI status from external PHY
>   net/i40e/base: change for missing "link modes"
>   net/i40e/base: add reading LPI counters
>   net/i40e/base: backport style changes from upstream Linux
>   net/i40e/base: update status codes
>   net/i40e/base: change of the incorrect Tx descriptors number
>   net/i40e/base: extend PHY access AQ command
>   net/i40e/base: add drop mode parameter to set MAC config
>   net/i40e/base: add FWS1B register masks
>   net/i40e/base: update FW API version
>   net/i40e/base: add persistent lldp support
>   net/i40e/base: make i40e_set_mac_type() public
>   net/i40e/base: fix retrying logic
>   net/i40e/base: mark additional missing bits as reserved
>   net/i40e/base: fix wrong 'Advertised FEC modes'
>   net/i40e/base: add Flow Director defines
>   net/i40e/base: removed unreachable code
>   net/i40e/base: set PHY Access flag on X722
>   net/i40e/base: implement reading lpi statistics
>   net/i40e/base: exposing missing LED functionality
>   net/i40e/base: introduce firmware EMP reset register offsets
>   net/i40e/base: add CRC stripping capability
>   net/i40e/base: enable LED blinking flow
>   net/i40e/base: add new link speed constants
> 
>  drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
>  drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
>  drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
>  drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
>  drivers/net/i40e/base/i40e_dcb.h        |  20 +-
>  drivers/net/i40e/base/i40e_devids.h     |   4 +
>  drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
>  drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
>  drivers/net/i40e/base/i40e_register.h   |  95 ++++
>  drivers/net/i40e/base/i40e_type.h       |  39 +-
>  drivers/net/i40e/base/virtchnl.h        |  32 +-
>  drivers/net/i40e/i40e_ethdev.c          |  12 +-
>  drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
>  13 files changed, 1047 insertions(+), 323 deletions(-)
> 
> --
> 2.17.1


Acked-by: Qi Zhang <qi.z.zhang@intel.com>


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
                     ` (36 preceding siblings ...)
  2020-01-13  2:54   ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Zhang, Qi Z
@ 2020-01-13  3:26   ` Xing, Beilei
  2020-01-13  5:59     ` Ye, Xiaolong
  37 siblings, 1 reply; 198+ messages in thread
From: Xing, Beilei @ 2020-01-13  3:26 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Ye, Xiaolong



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xiaolong Ye
> Sent: Monday, January 13, 2020 10:39 AM
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> Subject: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
> 
> This series is to support FVL 7.2 release.
> 
> The main changes include:
> 
> * virtchnl updates
> * add lldp support
> * Flow director updates
> * extend PHY access AQ cmd
> * add reading LPI counters
> * add support for Energy Efficient Ethernet
> * A few fixes.
> 
> v4:
> 
> * add a few missed Fixes tags
> 
> V3:
> 
> * add missing SOBs
> 
> V2:
> 
> * strip some unnecessary code
> * squash some fixes
> * improve commit logs
> 
> Xiaolong Ye (36):
>   net/i40e/base: add support for feature flags
>   net/i40e/base: increase max VSI count for VFs
>   net/i40e/base: change buffer address
>   net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
>   net/i40e/base: change misleading error message
>   net/i40e/base: further implementation of LLDP
>   net/i40e/base: add new device ids
>   net/i40e/base: add check for MAC type
>   net/i40e/base: adding flags for PHY types
>   net/i40e/base: improve AQ log granularity
>   net/i40e/base: add getter for FW LLDP agent status
>   net/i40e/base: add support for Energy Efficient Ethernet
>   net/i40e/base: read LPI status from external PHY
>   net/i40e/base: change for missing "link modes"
>   net/i40e/base: add reading LPI counters
>   net/i40e/base: backport style changes from upstream Linux
>   net/i40e/base: update status codes
>   net/i40e/base: change of the incorrect Tx descriptors number
>   net/i40e/base: extend PHY access AQ command
>   net/i40e/base: add drop mode parameter to set MAC config
>   net/i40e/base: add FWS1B register masks
>   net/i40e/base: update FW API version
>   net/i40e/base: add persistent lldp support
>   net/i40e/base: make i40e_set_mac_type() public
>   net/i40e/base: fix retrying logic
>   net/i40e/base: mark additional missing bits as reserved
>   net/i40e/base: fix wrong 'Advertised FEC modes'
>   net/i40e/base: add Flow Director defines
>   net/i40e/base: removed unreachable code
>   net/i40e/base: set PHY Access flag on X722
>   net/i40e/base: implement reading lpi statistics
>   net/i40e/base: exposing missing LED functionality
>   net/i40e/base: introduce firmware EMP reset register offsets
>   net/i40e/base: add CRC stripping capability
>   net/i40e/base: enable LED blinking flow
>   net/i40e/base: add new link speed constants
> 
>  drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
>  drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
>  drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
>  drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
>  drivers/net/i40e/base/i40e_dcb.h        |  20 +-
>  drivers/net/i40e/base/i40e_devids.h     |   4 +
>  drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
>  drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
>  drivers/net/i40e/base/i40e_register.h   |  95 ++++
>  drivers/net/i40e/base/i40e_type.h       |  39 +-
>  drivers/net/i40e/base/virtchnl.h        |  32 +-
>  drivers/net/i40e/i40e_ethdev.c          |  12 +-
>  drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
>  13 files changed, 1047 insertions(+), 323 deletions(-)
> 
> --
> 2.17.1

Acked-by: Beilei Xing <beilei.xing@intel.com>


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-01-13  3:26   ` Xing, Beilei
@ 2020-01-13  5:59     ` Ye, Xiaolong
  2020-01-15 18:42       ` Kevin Traynor
  2020-02-03 14:09       ` Kevin Traynor
  0 siblings, 2 replies; 198+ messages in thread
From: Ye, Xiaolong @ 2020-01-13  5:59 UTC (permalink / raw)
  To: Xing, Beilei, Zhang, Qi Z; +Cc: dev



> -----Original Message-----
> From: Xing, Beilei
> Sent: Monday, January 13, 2020 11:26 AM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xiaolong Ye
> > Sent: Monday, January 13, 2020 10:39 AM
> > Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> > Subject: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
> >
> > This series is to support FVL 7.2 release.
> >
> > The main changes include:
> >
> > * virtchnl updates
> > * add lldp support
> > * Flow director updates
> > * extend PHY access AQ cmd
> > * add reading LPI counters
> > * add support for Energy Efficient Ethernet
> > * A few fixes.
> >
> > v4:
> >
> > * add a few missed Fixes tags
> >
> > V3:
> >
> > * add missing SOBs
> >
> > V2:
> >
> > * strip some unnecessary code
> > * squash some fixes
> > * improve commit logs
> >
> > Xiaolong Ye (36):
> >   net/i40e/base: add support for feature flags
> >   net/i40e/base: increase max VSI count for VFs
> >   net/i40e/base: change buffer address
> >   net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
> >   net/i40e/base: change misleading error message
> >   net/i40e/base: further implementation of LLDP
> >   net/i40e/base: add new device ids
> >   net/i40e/base: add check for MAC type
> >   net/i40e/base: adding flags for PHY types
> >   net/i40e/base: improve AQ log granularity
> >   net/i40e/base: add getter for FW LLDP agent status
> >   net/i40e/base: add support for Energy Efficient Ethernet
> >   net/i40e/base: read LPI status from external PHY
> >   net/i40e/base: change for missing "link modes"
> >   net/i40e/base: add reading LPI counters
> >   net/i40e/base: backport style changes from upstream Linux
> >   net/i40e/base: update status codes
> >   net/i40e/base: change of the incorrect Tx descriptors number
> >   net/i40e/base: extend PHY access AQ command
> >   net/i40e/base: add drop mode parameter to set MAC config
> >   net/i40e/base: add FWS1B register masks
> >   net/i40e/base: update FW API version
> >   net/i40e/base: add persistent lldp support
> >   net/i40e/base: make i40e_set_mac_type() public
> >   net/i40e/base: fix retrying logic
> >   net/i40e/base: mark additional missing bits as reserved
> >   net/i40e/base: fix wrong 'Advertised FEC modes'
> >   net/i40e/base: add Flow Director defines
> >   net/i40e/base: removed unreachable code
> >   net/i40e/base: set PHY Access flag on X722
> >   net/i40e/base: implement reading lpi statistics
> >   net/i40e/base: exposing missing LED functionality
> >   net/i40e/base: introduce firmware EMP reset register offsets
> >   net/i40e/base: add CRC stripping capability
> >   net/i40e/base: enable LED blinking flow
> >   net/i40e/base: add new link speed constants
> >
> >  drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
> >  drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
> >  drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
> >  drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
> >  drivers/net/i40e/base/i40e_dcb.h        |  20 +-
> >  drivers/net/i40e/base/i40e_devids.h     |   4 +
> >  drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
> >  drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
> >  drivers/net/i40e/base/i40e_register.h   |  95 ++++
> >  drivers/net/i40e/base/i40e_type.h       |  39 +-
> >  drivers/net/i40e/base/virtchnl.h        |  32 +-
> >  drivers/net/i40e/i40e_ethdev.c          |  12 +-
> >  drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
> >  13 files changed, 1047 insertions(+), 323 deletions(-)
> >
> > --
> > 2.17.1
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Series applied to dpdk-next-net-intel.

Thanks,
Xiaolong


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
@ 2020-01-13  8:19     ` Kwapulinski, Piotr
  0 siblings, 0 replies; 198+ messages in thread
From: Kwapulinski, Piotr @ 2020-01-13  8:19 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev

ACK

-----Original Message-----
From: Ye, Xiaolong <xiaolong.ye@intel.com> 
Sent: Monday, January 13, 2020 3:40 AM
To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Kwapulinski, Piotr <piotr.kwapulinski@intel.com>
Subject: [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public

Make i40e_set_mac_type() public. i40e driver requires i40e_set_mac_type() to be public. It is required for recovery mode handling. Without this patch recovery mode could not be detected at probe() function.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c    | 4 ----
 drivers/net/i40e/base/i40e_prototype.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index eddc91e36..4f87ec9fa 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -14,11 +14,7 @@
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#if defined(INTEGRATED_VF) || defined(VF_DRIVER)  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw) -#else -STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw) -#endif  {
 	enum i40e_status_code status = I40E_SUCCESS;
 
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index afebf441d..2b6198985 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -472,10 +472,8 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);  #endif /* PF_DRIVER */  enum i40e_status_code i40e_enable_eee(struct i40e_hw *hw, bool enable);
 
-#if defined(I40E_QV) || defined(VF_DRIVER)  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
 
-#endif
 extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
 
 STATIC INLINE struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
--
2.17.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets
  2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
@ 2020-01-13  8:19     ` Kwapulinski, Piotr
  0 siblings, 0 replies; 198+ messages in thread
From: Kwapulinski, Piotr @ 2020-01-13  8:19 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev

ACK

-----Original Message-----
From: Ye, Xiaolong <xiaolong.ye@intel.com> 
Sent: Monday, January 13, 2020 3:40 AM
To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Kwapulinski, Piotr <piotr.kwapulinski@intel.com>
Subject: [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets

Introduce offsets of firmware registers holding a number of EMP resets.
Implement offsets as a preprocessor's constants.
Required by drivers to read a number of EMP resets reported by FW.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_register.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_register.h b/drivers/net/i40e/base/i40e_register.h
index 3a8c0ccd1..436f48efa 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -366,6 +366,8 @@
 #define I40E_GL_FWSTS_FWRI_MASK   I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)
 #define I40E_GL_FWSTS_FWS1B_SHIFT 16
 #define I40E_GL_FWSTS_FWS1B_MASK  I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, 
+I40E_GL_FWSTS_FWS1B_SHIFT) #define I40E_GL_FWSTS_FWS1B_EMPR_10 
+I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
 #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK \
 				I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)  #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK \
--
2.17.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-01-13  5:59     ` Ye, Xiaolong
@ 2020-01-15 18:42       ` Kevin Traynor
  2020-02-03 14:09       ` Kevin Traynor
  1 sibling, 0 replies; 198+ messages in thread
From: Kevin Traynor @ 2020-01-15 18:42 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev, Xu, Qian Q

On 13/01/2020 05:59, Ye, Xiaolong wrote:
> 
> 
>> -----Original Message-----
>> From: Xing, Beilei
>> Sent: Monday, January 13, 2020 11:26 AM
>> To: Ye, Xiaolong <xiaolong.ye@intel.com>
>> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
>> Subject: RE: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
>>
>>
>>
>>> -----Original Message-----
>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xiaolong Ye
>>> Sent: Monday, January 13, 2020 10:39 AM
>>> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
>>> Subject: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
>>>
>>> This series is to support FVL 7.2 release.
>>>

7.1 is the latest here [1]. Am I looking in the wrong place or mixing up?

Please remember to update the table [2] in docs after testing, it was
missed in previous release.

[1]
https://downloadcenter.intel.com/product/82947/Intel-Ethernet-Controller-X710-Series

[2] https://git.dpdk.org/dpdk/tree/doc/guides/nics/i40e.rst#n61

>>> The main changes include:
>>>
>>> * virtchnl updates
>>> * add lldp support
>>> * Flow director updates
>>> * extend PHY access AQ cmd
>>> * add reading LPI counters
>>> * add support for Energy Efficient Ethernet
>>> * A few fixes.
>>>
>>> v4:
>>>
>>> * add a few missed Fixes tags
>>>
>>> V3:
>>>
>>> * add missing SOBs
>>>
>>> V2:
>>>
>>> * strip some unnecessary code
>>> * squash some fixes
>>> * improve commit logs
>>>
>>> Xiaolong Ye (36):
>>>   net/i40e/base: add support for feature flags
>>>   net/i40e/base: increase max VSI count for VFs
>>>   net/i40e/base: change buffer address
>>>   net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
>>>   net/i40e/base: change misleading error message
>>>   net/i40e/base: further implementation of LLDP
>>>   net/i40e/base: add new device ids
>>>   net/i40e/base: add check for MAC type
>>>   net/i40e/base: adding flags for PHY types
>>>   net/i40e/base: improve AQ log granularity
>>>   net/i40e/base: add getter for FW LLDP agent status
>>>   net/i40e/base: add support for Energy Efficient Ethernet
>>>   net/i40e/base: read LPI status from external PHY
>>>   net/i40e/base: change for missing "link modes"
>>>   net/i40e/base: add reading LPI counters
>>>   net/i40e/base: backport style changes from upstream Linux
>>>   net/i40e/base: update status codes
>>>   net/i40e/base: change of the incorrect Tx descriptors number
>>>   net/i40e/base: extend PHY access AQ command
>>>   net/i40e/base: add drop mode parameter to set MAC config
>>>   net/i40e/base: add FWS1B register masks
>>>   net/i40e/base: update FW API version
>>>   net/i40e/base: add persistent lldp support
>>>   net/i40e/base: make i40e_set_mac_type() public
>>>   net/i40e/base: fix retrying logic
>>>   net/i40e/base: mark additional missing bits as reserved
>>>   net/i40e/base: fix wrong 'Advertised FEC modes'
>>>   net/i40e/base: add Flow Director defines
>>>   net/i40e/base: removed unreachable code
>>>   net/i40e/base: set PHY Access flag on X722
>>>   net/i40e/base: implement reading lpi statistics
>>>   net/i40e/base: exposing missing LED functionality
>>>   net/i40e/base: introduce firmware EMP reset register offsets
>>>   net/i40e/base: add CRC stripping capability
>>>   net/i40e/base: enable LED blinking flow
>>>   net/i40e/base: add new link speed constants
>>>
>>>  drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
>>>  drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
>>>  drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
>>>  drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
>>>  drivers/net/i40e/base/i40e_dcb.h        |  20 +-
>>>  drivers/net/i40e/base/i40e_devids.h     |   4 +
>>>  drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
>>>  drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
>>>  drivers/net/i40e/base/i40e_register.h   |  95 ++++
>>>  drivers/net/i40e/base/i40e_type.h       |  39 +-
>>>  drivers/net/i40e/base/virtchnl.h        |  32 +-
>>>  drivers/net/i40e/i40e_ethdev.c          |  12 +-
>>>  drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
>>>  13 files changed, 1047 insertions(+), 323 deletions(-)
>>>
>>> --
>>> 2.17.1
>>
>> Acked-by: Beilei Xing <beilei.xing@intel.com>
> 
> Series applied to dpdk-next-net-intel.
> 
> Thanks,
> Xiaolong
> 


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-01-13  5:59     ` Ye, Xiaolong
  2020-01-15 18:42       ` Kevin Traynor
@ 2020-02-03 14:09       ` Kevin Traynor
  2020-02-04  3:23         ` Ye Xiaolong
  1 sibling, 1 reply; 198+ messages in thread
From: Kevin Traynor @ 2020-02-03 14:09 UTC (permalink / raw)
  To: Ye, Xiaolong, Xing, Beilei, Zhang, Qi Z; +Cc: dev, stable, Luca Boccassi

On 13/01/2020 05:59, Ye, Xiaolong wrote:
> 
> 
>> -----Original Message-----
>> From: Xing, Beilei
>> Sent: Monday, January 13, 2020 11:26 AM
>> To: Ye, Xiaolong <xiaolong.ye@intel.com>
>> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
>> Subject: RE: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
>>
>>
>>
>>> -----Original Message-----
>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xiaolong Ye
>>> Sent: Monday, January 13, 2020 10:39 AM
>>> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
>>> Subject: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
>>>
>>> This series is to support FVL 7.2 release.
>>>
>>> The main changes include:
>>>
>>> * virtchnl updates
>>> * add lldp support
>>> * Flow director updates
>>> * extend PHY access AQ cmd
>>> * add reading LPI counters
>>> * add support for Energy Efficient Ethernet
>>> * A few fixes.
>>>
>>> v4:
>>>
>>> * add a few missed Fixes tags
>>>
>>> V3:
>>>
>>> * add missing SOBs
>>>
>>> V2:
>>>
>>> * strip some unnecessary code
>>> * squash some fixes
>>> * improve commit logs
>>>
>>> Xiaolong Ye (36):
>>>   net/i40e/base: add support for feature flags
>>>   net/i40e/base: increase max VSI count for VFs
>>>   net/i40e/base: change buffer address
>>>   net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
>>>   net/i40e/base: change misleading error message
>>>   net/i40e/base: further implementation of LLDP
>>>   net/i40e/base: add new device ids
>>>   net/i40e/base: add check for MAC type
>>>   net/i40e/base: adding flags for PHY types
>>>   net/i40e/base: improve AQ log granularity
>>>   net/i40e/base: add getter for FW LLDP agent status
>>>   net/i40e/base: add support for Energy Efficient Ethernet
>>>   net/i40e/base: read LPI status from external PHY
>>>   net/i40e/base: change for missing "link modes"
>>>   net/i40e/base: add reading LPI counters
>>>   net/i40e/base: backport style changes from upstream Linux
>>>   net/i40e/base: update status codes
>>>   net/i40e/base: change of the incorrect Tx descriptors number
>>>   net/i40e/base: extend PHY access AQ command
>>>   net/i40e/base: add drop mode parameter to set MAC config
>>>   net/i40e/base: add FWS1B register masks
>>>   net/i40e/base: update FW API version
>>>   net/i40e/base: add persistent lldp support
>>>   net/i40e/base: make i40e_set_mac_type() public
>>>   net/i40e/base: fix retrying logic
>>>   net/i40e/base: mark additional missing bits as reserved
>>>   net/i40e/base: fix wrong 'Advertised FEC modes'
>>>   net/i40e/base: add Flow Director defines
>>>   net/i40e/base: removed unreachable code
>>>   net/i40e/base: set PHY Access flag on X722
>>>   net/i40e/base: implement reading lpi statistics
>>>   net/i40e/base: exposing missing LED functionality
>>>   net/i40e/base: introduce firmware EMP reset register offsets
>>>   net/i40e/base: add CRC stripping capability
>>>   net/i40e/base: enable LED blinking flow
>>>   net/i40e/base: add new link speed constants
>>>
>>>  drivers/net/i40e/base/i40e_adminq.c     | 142 +++---
>>>  drivers/net/i40e/base/i40e_adminq_cmd.h |  95 +++-
>>>  drivers/net/i40e/base/i40e_common.c     | 651 +++++++++++++++++-------
>>>  drivers/net/i40e/base/i40e_dcb.c        |  87 +++-
>>>  drivers/net/i40e/base/i40e_dcb.h        |  20 +-
>>>  drivers/net/i40e/base/i40e_devids.h     |   4 +
>>>  drivers/net/i40e/base/i40e_nvm.c        | 113 +++-
>>>  drivers/net/i40e/base/i40e_prototype.h  |  76 ++-
>>>  drivers/net/i40e/base/i40e_register.h   |  95 ++++
>>>  drivers/net/i40e/base/i40e_type.h       |  39 +-
>>>  drivers/net/i40e/base/virtchnl.h        |  32 +-
>>>  drivers/net/i40e/i40e_ethdev.c          |  12 +-
>>>  drivers/net/i40e/rte_pmd_i40e.c         |   4 +-
>>>  13 files changed, 1047 insertions(+), 323 deletions(-)
>>>
>>> --
>>> 2.17.1
>>
>> Acked-by: Beilei Xing <beilei.xing@intel.com>
> 
> Series applied to dpdk-next-net-intel.
> 
> Thanks,
> Xiaolong
> 

Hi Xiaolong/Beilei/Qi Z,

Some of these patches are tagged to go to 'S'table and are 'F'ixes,
while others are also fixes for older releases but not tagged to go to
stable.

No issue with not backporting patches (in fact i would prefer not if
some doubts), but want to check if the stable tag was missed by accident?

Also, note that Fw listed is v6.01 for 18.11, (v7.00 for 19.11) so
changes would need to be compatible with that.

20.02 8f33cbcfa S F net/i40e/base: fix buffer address (16.04)
20.02 4b3da9415 S F net/i40e/base: fix error message (1.7.0)
20.02 1da546c39 - F net/i40e/base: fix missing link modes (17.08)
20.02 79bfe7808 S F net/i40e/base: fix Tx descriptors number (1.7.0)
20.02 50126939c - F net/i40e/base: fix retrying logic (18.02)
20.02 b330a1c5c - F net/i40e/base: fix display of FEC settings (17.08)
20.02 03ef7d47f - F net/i40e/base: add new link speed constants (17.08)

Please confirm on patches above missing stable tag. For time being I
will only consider ones with stable tag.

thanks,
Kevin.


^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-02-03 14:09       ` Kevin Traynor
@ 2020-02-04  3:23         ` Ye Xiaolong
  2020-02-07  9:36           ` Kevin Traynor
  0 siblings, 1 reply; 198+ messages in thread
From: Ye Xiaolong @ 2020-02-04  3:23 UTC (permalink / raw)
  To: Kevin Traynor; +Cc: Xing, Beilei, Zhang, Qi Z, dev, stable, Luca Boccassi

Hi, Kevin

On 02/03, Kevin Traynor wrote:
>On 13/01/2020 05:59, Ye, Xiaolong wrote:

[snip]

>>> -----Original Message-----
>Hi Xiaolong/Beilei/Qi Z,
>
>Some of these patches are tagged to go to 'S'table and are 'F'ixes,
>while others are also fixes for older releases but not tagged to go to
>stable.
>
>No issue with not backporting patches (in fact i would prefer not if
>some doubts), but want to check if the stable tag was missed by accident?
>
>Also, note that Fw listed is v6.01 for 18.11, (v7.00 for 19.11) so
>changes would need to be compatible with that.

Yes, some of the stable tags were missed deliberately since the new base code
update is for FW 7.1/7.2, it's not guaranteed to be compatible with old FW.

>
>20.02 8f33cbcfa S F net/i40e/base: fix buffer address (16.04)
>20.02 4b3da9415 S F net/i40e/base: fix error message (1.7.0)
>20.02 1da546c39 - F net/i40e/base: fix missing link modes (17.08)
>20.02 79bfe7808 S F net/i40e/base: fix Tx descriptors number (1.7.0)
>20.02 50126939c - F net/i40e/base: fix retrying logic (18.02)
>20.02 b330a1c5c - F net/i40e/base: fix display of FEC settings (17.08)
>20.02 03ef7d47f - F net/i40e/base: add new link speed constants (17.08)
>

I would suggest we only backport below obvious fixes to stable releases.

20.02 8f33cbcfa S F net/i40e/base: fix buffer address (16.04)
20.02 4b3da9415 S F net/i40e/base: fix error message (1.7.0)
20.02 79bfe7808 S F net/i40e/base: fix Tx descriptors number (1.7.0)
20.02 50126939c - F net/i40e/base: fix retrying logic (18.02)

Thanks,
Xiaolong

>Please confirm on patches above missing stable tag. For time being I
>will only consider ones with stable tag.
>
>thanks,
>Kevin.
>

^ permalink raw reply	[flat|nested] 198+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/36] update for i40e base code
  2020-02-04  3:23         ` Ye Xiaolong
@ 2020-02-07  9:36           ` Kevin Traynor
  0 siblings, 0 replies; 198+ messages in thread
From: Kevin Traynor @ 2020-02-07  9:36 UTC (permalink / raw)
  To: Ye Xiaolong; +Cc: Xing, Beilei, Zhang, Qi Z, dev, stable, Luca Boccassi

On 04/02/2020 03:23, Ye Xiaolong wrote:
> Hi, Kevin
> 
> On 02/03, Kevin Traynor wrote:
>> On 13/01/2020 05:59, Ye, Xiaolong wrote:
> 
> [snip]
> 
>>>> -----Original Message-----
>> Hi Xiaolong/Beilei/Qi Z,
>>
>> Some of these patches are tagged to go to 'S'table and are 'F'ixes,
>> while others are also fixes for older releases but not tagged to go to
>> stable.
>>
>> No issue with not backporting patches (in fact i would prefer not if
>> some doubts), but want to check if the stable tag was missed by accident?
>>
>> Also, note that Fw listed is v6.01 for 18.11, (v7.00 for 19.11) so
>> changes would need to be compatible with that.
> 
> Yes, some of the stable tags were missed deliberately since the new base code
> update is for FW 7.1/7.2, it's not guaranteed to be compatible with old FW.
> 
>>
>> 20.02 8f33cbcfa S F net/i40e/base: fix buffer address (16.04)
>> 20.02 4b3da9415 S F net/i40e/base: fix error message (1.7.0)
>> 20.02 1da546c39 - F net/i40e/base: fix missing link modes (17.08)
>> 20.02 79bfe7808 S F net/i40e/base: fix Tx descriptors number (1.7.0)
>> 20.02 50126939c - F net/i40e/base: fix retrying logic (18.02)
>> 20.02 b330a1c5c - F net/i40e/base: fix display of FEC settings (17.08)
>> 20.02 03ef7d47f - F net/i40e/base: add new link speed constants (17.08)
>>
> 
> I would suggest we only backport below obvious fixes to stable releases.
> 
> 20.02 8f33cbcfa S F net/i40e/base: fix buffer address (16.04)
> 20.02 4b3da9415 S F net/i40e/base: fix error message (1.7.0)
> 20.02 79bfe7808 S F net/i40e/base: fix Tx descriptors number (1.7.0)
> 20.02 50126939c - F net/i40e/base: fix retrying logic (18.02)
> 

Thanks for confirming Xialong, I will backport the ones you suggest.

Kevin.

> Thanks,
> Xiaolong
> 
>> Please confirm on patches above missing stable tag. For time being I
>> will only consider ones with stable tag.
>>
>> thanks,
>> Kevin.
>>
> 


^ permalink raw reply	[flat|nested] 198+ messages in thread

end of thread, other threads:[~2020-02-07  9:36 UTC | newest]

Thread overview: 198+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02  7:48 [dpdk-dev] [PATCH 00/69] update for i40e base code Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 01/69] net/i40e/base: add support for feature flags Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 02/69] net/i40e/base: add ESXi support to transition to flat NVM Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 03/69] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 04/69] net/i40e/base: change buffer address Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 05/69] net/i40e/base: change for X722 10G-T ports LED Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 06/69] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 07/69] net/i40e/base: changed FW API version to 1.8 Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 08/69] net/i40e/base: change misleading error message Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 09/69] net/i40e/base: shadowRAM checksum calculation change Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 10/69] net/i40e/base: update Fort Park FW API to 1.8 Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 11/69] net/i40e/base: further implementation of LLDP Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 12/69] net/i40e/base: add new device ids for Carlsville Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 13/69] net/i40e/base: add check for MAC type Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 14/69] net/i40e/base: adding flags for PHY types Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 15/69] net/i40e/base: revert ShadowRAM checksum calculation change Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 16/69] net/i40e/base: improve AQ log granularity Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 17/69] net/i40e/base: change condition checks Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 18/69] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 19/69] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 20/69] net/i40e/base: read LPI status from external PHY Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 21/69] net/i40e/base: change reading LPI state Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 22/69] net/i40e/base: change for missing "link modes" Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 23/69] net/i40e/base: add reading LPI counters Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 24/69] net/i40e/base: update virtchnl.h Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 25/69] net/i40e/base: add opcodes reserved comments Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 26/69] net/i40e/base: revert Fix missing "fall through" comments Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 27/69] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 28/69] net/i40e/base: update status codes Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 29/69] net/i40e/base: use TX_LPI_EN bit to fully turn off EEE Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 30/69] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 31/69] net/i40e/base: extend PHY access AQ command Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 32/69] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
2019-12-02  7:48 ` [dpdk-dev] [PATCH 33/69] net/i40e/base: check_recovery_mode had wrong if statement Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 34/69] net/i40e/base: update FVL FW API version to 1.9 Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK " Xiaolong Ye
2019-12-02 19:03   ` Stillwell Jr, Paul M
2019-12-02  7:49 ` [dpdk-dev] [PATCH 36/69] net/i40e/base: add persistent lldp support Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 37/69] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 38/69] net/i40e/base: change retrying Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 39/69] net/i40e/base: revert fix for X722 10G-T ports LED Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 40/69] net/i40e/base: change link flapping on 25g cards Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 42/69] net/i40e/base: change long redundant define names Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 43/69] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 44/69] net/i40e/base: change for persistent lldp support Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 45/69] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 46/69] net/i40e/base: implement lpi statistics read from registers Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 47/69] net/i40e/base: add Flow Director defines Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 48/69] net/i40e/base: removed unreachable code Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 49/69] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 50/69] net/i40e/base: implement reading lpi statistics Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 51/69] net/i40e/base: add MRR field defines Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality Xiaolong Ye
2019-12-02 19:13   ` Stillwell Jr, Paul M
2019-12-02  7:49 ` [dpdk-dev] [PATCH 53/69] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 54/69] net/i40e/base: change for reading lpi statistics Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 55/69] net/i40e/base: update FVL FW API version to 1.10 Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 56/69] net/i40e/base: add CRC stripping capability Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features Xiaolong Ye
2019-12-02 19:14   ` Stillwell Jr, Paul M
2019-12-02  7:49 ` [dpdk-dev] [PATCH 58/69] net/i40e/base: add limits for nested structures Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 59/69] net/i40e/base: put the check for zero nested elements higher Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements Xiaolong Ye
2019-12-02 16:33   ` Williams, Mitch A
2019-12-02  7:49 ` [dpdk-dev] [PATCH 61/69] net/i40e/base: change 'Unknown bps' Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 62/69] net/i40e/base: add USO offload flag for AVF Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 63/69] net/i40e/base: update the interrupt mapping and negotiation Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 64/69] net/i40e/base: add inline ipsec data struct and commands Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 65/69] net/i40e/base: change all zero-sized arrays Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 66/69] net/i40e/base: support for additional flow type Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 67/69] net/i40e/base: change GET/SET_RSS_LUT valid_len check Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 68/69] net/i40e/base: add missing 0 length checks Xiaolong Ye
2019-12-02  7:49 ` [dpdk-dev] [PATCH 69/69] net/i40e/base: update version Xiaolong Ye
2019-12-12 15:20 ` [dpdk-dev] [PATCH v2 00/36] update for i40e base code Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 03/36] net/i40e/base: change buffer address Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 05/36] net/i40e/base: change misleading error message Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 07/36] net/i40e/base: add new device ids Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
2019-12-12 15:20   ` [dpdk-dev] [PATCH v2 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 17/36] net/i40e/base: update status codes Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 22/36] net/i40e/base: update FW API version Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 25/36] net/i40e/base: change retrying logic Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
2019-12-12 15:21   ` [dpdk-dev] [PATCH v2 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
2019-12-16  2:43 ` [dpdk-dev] [PATCH v3 00/36] update for i40e base code Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 03/36] net/i40e/base: change buffer address Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 05/36] net/i40e/base: change misleading error message Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 07/36] net/i40e/base: add new device ids Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 17/36] net/i40e/base: update status codes Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 22/36] net/i40e/base: update FW API version Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
2019-12-17 10:39     ` Kwapulinski, Piotr
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 25/36] net/i40e/base: change retrying logic Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 27/36] net/i40e/base: change wrong 'Advertised FEC modes' Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
2019-12-17 10:40     ` Kwapulinski, Piotr
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
2019-12-16  2:43   ` [dpdk-dev] [PATCH v3 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
2019-12-27  5:37     ` Xing, Beilei
2020-01-02  9:58       ` Loktionov, Aleksandr
2020-01-13  2:39 ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 01/36] net/i40e/base: add support for feature flags Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 02/36] net/i40e/base: increase max VSI count for VFs Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 03/36] net/i40e/base: change buffer address Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 04/36] net/i40e/base: decouple cfg_lldp_mib_change from init_dcb Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 05/36] net/i40e/base: change misleading error message Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 06/36] net/i40e/base: further implementation of LLDP Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 07/36] net/i40e/base: add new device ids Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 08/36] net/i40e/base: add check for MAC type Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 09/36] net/i40e/base: adding flags for PHY types Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 10/36] net/i40e/base: improve AQ log granularity Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 11/36] net/i40e/base: add getter for FW LLDP agent status Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 12/36] net/i40e/base: add support for Energy Efficient Ethernet Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 13/36] net/i40e/base: read LPI status from external PHY Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 14/36] net/i40e/base: change for missing "link modes" Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 15/36] net/i40e/base: add reading LPI counters Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 16/36] net/i40e/base: backport style changes from upstream Linux Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 17/36] net/i40e/base: update status codes Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 18/36] net/i40e/base: change of the incorrect Tx descriptors number Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 19/36] net/i40e/base: extend PHY access AQ command Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 20/36] net/i40e/base: add drop mode parameter to set MAC config Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 21/36] net/i40e/base: add FWS1B register masks Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 22/36] net/i40e/base: update FW API version Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 23/36] net/i40e/base: add persistent lldp support Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 24/36] net/i40e/base: make i40e_set_mac_type() public Xiaolong Ye
2020-01-13  8:19     ` Kwapulinski, Piotr
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 25/36] net/i40e/base: fix retrying logic Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 26/36] net/i40e/base: mark additional missing bits as reserved Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 27/36] net/i40e/base: fix wrong 'Advertised FEC modes' Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 28/36] net/i40e/base: add Flow Director defines Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 29/36] net/i40e/base: removed unreachable code Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 30/36] net/i40e/base: set PHY Access flag on X722 Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 31/36] net/i40e/base: implement reading lpi statistics Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 32/36] net/i40e/base: exposing missing LED functionality Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 33/36] net/i40e/base: introduce firmware EMP reset register offsets Xiaolong Ye
2020-01-13  8:19     ` Kwapulinski, Piotr
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 34/36] net/i40e/base: add CRC stripping capability Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 35/36] net/i40e/base: enable LED blinking flow Xiaolong Ye
2020-01-13  2:39   ` [dpdk-dev] [PATCH v4 36/36] net/i40e/base: add new link speed constants Xiaolong Ye
2020-01-13  2:54   ` [dpdk-dev] [PATCH v4 00/36] update for i40e base code Zhang, Qi Z
2020-01-13  3:26   ` Xing, Beilei
2020-01-13  5:59     ` Ye, Xiaolong
2020-01-15 18:42       ` Kevin Traynor
2020-02-03 14:09       ` Kevin Traynor
2020-02-04  3:23         ` Ye Xiaolong
2020-02-07  9:36           ` Kevin Traynor

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).