update for i40e base code
cover update for i40e base code
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(-)
Signature · 1 line
2.17.1
PATCH 1/69 net/i40e/base: add support for feature flags
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.
--- 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(-)
drivers/net/i40e/base/i40e_common.c +25 -0
@@ -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; }
drivers/net/i40e/base/i40e_nvm.c +39 -3
61 lines not on this page · raw message
drivers/net/i40e/base/i40e_type.h +22 -0
@@ -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 ];
Signature · 1 line
2.17.1
PATCH 2/69 net/i40e/base: add ESXi support to transition to flat NVM
In reply to Xiaolong YeESXi is required to transition back to a flat NVM from structured. Adding ifdef support for ESXi.
--- drivers/net/i40e/base/i40e_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/base/i40e_common.c +4 -4
@@ -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 */
Signature · 1 line
2.17.1
PATCH 3/69 net/i40e/base: increase max VSI count for VFs
In reply to Xiaolong YeFor 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.
--- drivers/net/i40e/base/i40e_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_type.h +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 4/69 net/i40e/base: change buffer address
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_common.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH 5/69 net/i40e/base: change for X722 10G-T ports LED
In reply to Xiaolong YeOn 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.
--- drivers/net/i40e/base/i40e_common.c | 35 ----------------------------- 1 file changed, 35 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -35
@@ -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) &
Signature · 1 line
2.17.1
PATCH 6/69 net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
In reply to Xiaolong YeThere 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.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +37 -15
@@ -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; }
drivers/net/i40e/base/i40e_dcb.h +4 -1
@@ -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);
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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,
Signature · 1 line
2.17.1
PATCH 7/69 net/i40e/base: changed FW API version to 1.8
In reply to Xiaolong YeA new FW has been released, which uses API version 1.8.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -1
@@ -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 : \
Signature · 1 line
2.17.1
PATCH 8/69 net/i40e/base: change misleading error message
In reply to Xiaolong YeThis patch changes an error code for an admin queue head overrun to use I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.
--- drivers/net/i40e/base/i40e_adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq.c +1 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH 9/69 net/i40e/base: shadowRAM checksum calculation change
In reply to Xiaolong YeDue 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
--- drivers/net/i40e/base/i40e_nvm.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/net/i40e/base/i40e_nvm.c +25 -3
@@ -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; }
Signature · 1 line
2.17.1
PATCH 10/69 net/i40e/base: update Fort Park FW API to 1.8
In reply to Xiaolong YeIn 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -1
@@ -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 ? \
Signature · 1 line
2.17.1
PATCH 11/69 net/i40e/base: further implementation of LLDP
In reply to Xiaolong YeThis 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!
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +5 -0
@@ -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;
drivers/net/i40e/base/i40e_adminq_cmd.h +16 -4
@@ -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 0x2u8 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 0x2u8 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;
drivers/net/i40e/base/i40e_common.c +59 -0
97 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +5 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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" );
drivers/net/i40e/rte_pmd_i40e.c +2 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH 12/69 net/i40e/base: add new device ids for Carlsville
In reply to Xiaolong YeNew device ids are created to support SFP+ and backplane connections on ports 2 & 3 of the Carlsville.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +2 -0
@@ -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 :
drivers/net/i40e/base/i40e_devids.h +2 -0
@@ -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
drivers/net/i40e/i40e_ethdev.c +2 -0
@@ -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 */ }, };
Signature · 1 line
2.17.1
PATCH 13/69 net/i40e/base: add check for MAC type
In reply to Xiaolong YeSome 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.
--- drivers/net/i40e/base/i40e_adminq.c | 84 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 39 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +45 -39
@@ -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;
Signature · 1 line
2.17.1
PATCH 14/69 net/i40e/base: adding flags for PHY types
In reply to Xiaolong YeAdding 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +7 -0
@@ -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
Signature · 1 line
2.17.1
PATCH 15/69 net/i40e/base: revert ShadowRAM checksum calculation change
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_nvm.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
drivers/net/i40e/base/i40e_nvm.c +3 -25
@@ -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; }
Signature · 1 line
2.17.1
PATCH 16/69 net/i40e/base: improve AQ log granularity
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_adminq.c | 8 ++++---- drivers/net/i40e/base/i40e_common.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +4 -4
@@ -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);
drivers/net/i40e/base/i40e_common.c +11 -6
@@ -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;
Signature · 1 line
2.17.1
PATCH 17/69 net/i40e/base: change condition checks
In reply to Xiaolong YeTwo conditional checks were checking the opposite of what was intended.
--- drivers/net/i40e/base/i40e_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +2 -2
@@ -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)
Signature · 1 line
2.17.1
PATCH 18/69 net/i40e/base: add getter for FW LLDP agent status
In reply to Xiaolong YeThis 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 <[email protected]> in 40G FreeBSD driver.
--- drivers/net/i40e/base/i40e_dcb.c | 50 ++++++++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_dcb.h | 7 +++++ 2 files changed, 57 insertions(+)
drivers/net/i40e/base/i40e_dcb.c +50 -0
@@ -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
drivers/net/i40e/base/i40e_dcb.h +7 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH 19/69 net/i40e/base: add support for Energy Efficient Ethernet
In reply to Xiaolong YeThis change adds i40e_enable_eee() function controlling advertisement of Energy Efficient Ethernet mode (EEE).
--- drivers/net/i40e/base/i40e_common.c | 57 ++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_prototype.h | 1 + 2 files changed, 58 insertions(+)
drivers/net/i40e/base/i40e_common.c +57 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH 20/69 net/i40e/base: read LPI status from external PHY
In reply to Xiaolong YeWhen 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.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +66 -0
@@ -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 */ /**
drivers/net/i40e/base/i40e_prototype.h +2 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +8 -0
@@ -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_ */
Signature · 1 line
2.17.1
PATCH 21/69 net/i40e/base: change reading LPI state
In reply to Xiaolong YeSpecial 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.
--- drivers/net/i40e/base/i40e_common.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/i40e/base/i40e_common.c +9 -5
@@ -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
Signature · 1 line
2.17.1
PATCH 22/69 net/i40e/base: change for missing "link modes"
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +1 -2
@@ -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),
Signature · 1 line
2.17.1
PATCH 23/69 net/i40e/base: add reading LPI counters
In reply to Xiaolong YeThis 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).
--- 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(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +20 -6
@@ -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);
drivers/net/i40e/base/i40e_common.c +113 -0
125 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +12 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH 24/69 net/i40e/base: update virtchnl.h
In reply to Xiaolong YeThe major changes include:
* add virtchnl structures to support queue channels
* add eth_stats definition for OP_GET_STATS
* add filter data structure
--- drivers/net/i40e/base/virtchnl.h | 162 ++++++++++++++++++++++++++++--- 1 file changed, 147 insertions(+), 15 deletions(-)
drivers/net/i40e/base/virtchnl.h +147 -15
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 25/69 net/i40e/base: add opcodes reserved comments
In reply to Xiaolong YeWhen 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.
--- drivers/net/i40e/base/virtchnl.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/i40e/base/virtchnl.h +4 -0
@@ -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 */ #endifVIRTCHNL_OP_CONFIG_RSS_KEY =23 , VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
Signature · 1 line
2.17.1
PATCH 26/69 net/i40e/base: revert Fix missing "fall through" comments
In reply to Xiaolong YeThese 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.
--- drivers/net/i40e/base/virtchnl.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/i40e/base/virtchnl.h +0 -7
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 27/69 net/i40e/base: backport style changes from upstream Linux
In reply to Xiaolong YeThe 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".
--- drivers/net/i40e/base/virtchnl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +2 -2
@@ -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) }
Signature · 1 line
2.17.1
PATCH 28/69 net/i40e/base: update status codes
In reply to Xiaolong YeAdd 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.
--- drivers/net/i40e/base/virtchnl.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/i40e/base/virtchnl.h +9 -3
@@ -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)
Signature · 1 line
2.17.1
PATCH 29/69 net/i40e/base: use TX_LPI_EN bit to fully turn off EEE
In reply to Xiaolong YeChanging 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.
--- drivers/net/i40e/base/i40e_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/i40e/base/i40e_common.c +7 -1
@@ -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 );
Signature · 1 line
2.17.1
PATCH 30/69 net/i40e/base: change of the incorrect Tx descriptors number
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_type.h +2 -2
@@ -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. */
Signature · 1 line
2.17.1
PATCH 31/69 net/i40e/base: extend PHY access AQ command
In reply to Xiaolong YeCurrently FW use MDIO I/F number corresponded with current PF for PHY access. This code allow to specify used MDIO I/F number.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +5 -0
@@ -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;
drivers/net/i40e/base/i40e_adminq_cmd.h +5 -1
@@ -2311,7 +2311,11 @@ struct i40e_aqc_phy_register_access {#define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE 2u8 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;
drivers/net/i40e/base/i40e_common.c +50 -10
104 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +19 -8
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH 32/69 net/i40e/base: add drop mode parameter to set MAC config
In reply to Xiaolong YeThis 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.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +3 -1
@@ -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 &&
drivers/net/i40e/base/i40e_adminq_cmd.h +15 -14
@@ -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 0x80u8 tx_timer_priority;/* bitmap */ __le16 tx_timer_value;__le16 fc_refresh_threshold;
drivers/net/i40e/base/i40e_common.c +11 -0
@@ -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 );
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH 33/69 net/i40e/base: check_recovery_mode had wrong if statement
In reply to Xiaolong YeFunction 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.
--- drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/i40e/base/i40e_register.h +12 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH 34/69 net/i40e/base: update FVL FW API version to 1.9
In reply to Xiaolong YeUpcoming FVL FW increment API version to 1.9 due to Extend PHY access AQ command support. SW is ready for that support as well.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -1
@@ -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 : \
Signature · 1 line
2.17.1
PATCH 35/69 net/i40e/base: update FPK FW API version to 1.9
In reply to Xiaolong YeUpcoming 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -1
@@ -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 ? \
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 35/69] net/i40e/base: update FPK FW API version to 1.9
NACK, no code names in public commit messages.
Paul
Quoted 41 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaolong Ye
Sent: Sunday, December 1, 2019 11:49 PM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Azarewicz, Piotr <[email protected]>
Subject: [dpdk-dev] [PATCH 35/69]net/i40e/base: update FPK FW API version to 1.9Upcoming 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 <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Galazka Krzysztof <[email protected]>Reviewed-by Formela Marcin <[email protected]>Reviewed-by Kirsher Jeffrey T <[email protected]>Reviewed-by Michael Alice <[email protected]>Signed-off-by Xiaolong Ye <[email protected]>--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/base/i40e_adminq_cmd.h +1
-1@@ -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
PATCH 36/69 net/i40e/base: add persistent lldp support
In reply to Xiaolong YeThis patch adds a function to read nvm module data and uses it to read current lldp agent configuration from nvm api version 1.8.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +17 -1
@@ -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 ;
drivers/net/i40e/base/i40e_dcb.h +2 -0
@@ -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
drivers/net/i40e/base/i40e_nvm.c +71 -0
77 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +4 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH 37/69 net/i40e/base: make i40e_set_mac_type() public
In reply to Xiaolong YeMake 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.
--- drivers/net/i40e/base/i40e_common.c | 4 ---- drivers/net/i40e/base/i40e_prototype.h | 2 -- 2 files changed, 6 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -4
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +0 -2
@@ -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)
Signature · 1 line
2.17.1
PATCH 38/69 net/i40e/base: change retrying
In reply to Xiaolong YeFixed a bug where driver was breaking out of the loop and reporting an error without retrying first.
--- drivers/net/i40e/base/i40e_common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -7
@@ -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;
Signature · 1 line
2.17.1
PATCH 39/69 net/i40e/base: revert fix for X722 10G-T ports LED
In reply to Xiaolong YeAfter 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.
--- drivers/net/i40e/base/i40e_common.c | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/i40e/base/i40e_common.c +35 -0
@@ -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) &
Signature · 1 line
2.17.1
PATCH 40/69 net/i40e/base: change link flapping on 25g cards
In reply to Xiaolong YeAfter 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.
--- drivers/net/i40e/base/i40e_common.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/i40e/base/i40e_common.c +9 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH 41/69 net/i40e/base: changeed code wrapping for CARLSVILLE_HW
In reply to Xiaolong YeAs 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.
--- drivers/net/i40e/base/i40e_common.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/net/i40e/base/i40e_common.c +15 -12
@@ -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 ; }/**
Signature · 1 line
2.17.1
PATCH 42/69 net/i40e/base: change long redundant define names
In reply to Xiaolong YeThere 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 6 +++--- drivers/net/i40e/base/i40e_common.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -3
@@ -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 0x10u8 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;
drivers/net/i40e/base/i40e_common.c +4 -4
@@ -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;
Signature · 1 line
2.17.1
PATCH 43/69 net/i40e/base: mark additional missing bits as reserved
In reply to Xiaolong YeMark 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH 44/69 net/i40e/base: change for persistent lldp support
In reply to Xiaolong YeThis patch fixes function to read nvm module data and uses it to read current lldp agent configuration from nvm api version 1.8.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +3 -1
@@ -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);
drivers/net/i40e/base/i40e_dcb.h +3 -0
@@ -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
drivers/net/i40e/base/i40e_nvm.c +29 -29
85 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +4 -4
@@ -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,
Signature · 1 line
2.17.1
PATCH 45/69 net/i40e/base: change wrong 'Advertised FEC modes'
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -3
@@ -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 );
Signature · 1 line
2.17.1
PATCH 46/69 net/i40e/base: implement lpi statistics read from registers
In reply to Xiaolong YeOn 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.
--- drivers/net/i40e/base/i40e_common.c | 40 +++++++++++++++----------- drivers/net/i40e/base/i40e_prototype.h | 2 +- 2 files changed, 25 insertions(+), 17 deletions(-)
drivers/net/i40e/base/i40e_common.c +24 -16
@@ -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; }
drivers/net/i40e/base/i40e_prototype.h +1 -1
@@ -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,
Signature · 1 line
2.17.1
PATCH 47/69 net/i40e/base: add Flow Director defines
In reply to Xiaolong YeAdd defines for creating Flow Director flows as defined in datasheet section 7.1.5.4 for field vectors.
--- drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
drivers/net/i40e/base/i40e_register.h +81 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH 48/69 net/i40e/base: removed unreachable code
In reply to Xiaolong YeThe result of the check is always FALSE and the code within "if" is never executed.
Run static code analyzer.
--- drivers/net/i40e/base/i40e_common.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH 49/69 net/i40e/base: set PHY Access flag on X722
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_adminq.c | 5 +++++ drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++ 2 files changed, 7 insertions(+)
drivers/net/i40e/base/i40e_adminq.c +5 -0
@@ -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 ;
drivers/net/i40e/base/i40e_adminq_cmd.h +2 -0
@@ -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
Signature · 1 line
2.17.1
PATCH 50/69 net/i40e/base: implement reading lpi statistics
In reply to Xiaolong YeThere 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.
--- 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(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +2 -0
@@ -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;
drivers/net/i40e/base/i40e_common.c +61 -0
67 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +3 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +2 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH 51/69 net/i40e/base: add MRR field defines
In reply to Xiaolong YeAdd defines for Minimum Rollback Revision fields as defined in FVL DCR 378
--- drivers/net/i40e/base/i40e_type.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/i40e/base/i40e_type.h +10 -0
@@ -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_ */
Signature · 1 line
2.17.1
PATCH 52/69 net/i40e/base: exposing missing LED functionality
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_common.c | 10 ++++++++++ drivers/net/i40e/base/i40e_prototype.h | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/net/i40e/base/i40e_common.c +10 -0
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +6 -1
@@ -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,
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 52/69] net/i40e/base: exposing missing LED functionality
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
Quoted 85 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaolong Ye
Sent: Sunday, December 1, 2019 11:49 PM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Rusinski, Mateusz <[email protected]>
Subject: [dpdk-dev] [PATCH 52/69]net/i40e/base: exposing missing LED functionalityThe 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 <[email protected]>Reviewed-by Kirsher Jeffrey T <[email protected]>Reviewed-by Michael Alice <[email protected]>Signed-off-by Xiaolong Ye <[email protected]>--- drivers/net/i40e/base/i40e_common.c | 10 ++++++++++ drivers/net/i40e/base/i40e_prototype.h | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-)drivers/net/i40e/base/i40e_common.c +5
-0@@ -6950,8 +6950,13 @@ enum i40e_status_codei40e_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 {
drivers/net/i40e/base/i40e_common.c +5
-0enum i40e_status_code status;u8 phy_addr =0 ;@@ -6979,8 +6984,13 @@ static enum i40e_status_codei40e_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 {
drivers/net/i40e/base/i40e_common.c +0
-0enum i40e_status_code status;u8 phy_addr =0 ;drivers/net/i40e/base/i40e_prototype.h +6
-1@@ -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_codei40e_get_phy_lpi_status(structi40e_hw*hw,
structi40e_hw_port_stats*stats);
enumi40e_status_codei40e_get_lpi_counters(structi40e_hw*hw, u32*tx_counter,
--
2.17.1
PATCH 53/69 net/i40e/base: introduce firmware EMP reset register offsets
In reply to Xiaolong YeIntroduce 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.
--- drivers/net/i40e/base/i40e_register.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/i40e/base/i40e_register.h +2 -0
@@ -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 \
Signature · 1 line
2.17.1
PATCH 54/69 net/i40e/base: change for reading lpi statistics
In reply to Xiaolong YeThere 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 1 + drivers/net/i40e/base/i40e_common.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -0
@@ -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;
drivers/net/i40e/base/i40e_common.c +4 -2
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 55/69 net/i40e/base: update FVL FW API version to 1.10
In reply to Xiaolong YeINTERNAL 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +1 -1
@@ -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 : \
Signature · 1 line
2.17.1
PATCH 56/69 net/i40e/base: add CRC stripping capability
In reply to Xiaolong YeSome 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"
--- drivers/net/i40e/base/virtchnl.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +10 -2
@@ -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;
Signature · 1 line
2.17.1
PATCH 57/69 net/i40e/base: update virtchnl header with advanced features
In reply to Xiaolong YeUpdating 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.
--- drivers/net/i40e/base/virtchnl.h | 511 ++++++++++++++++++++++++++++++- 1 file changed, 509 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +509 -2
@@ -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 :
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 57/69] net/i40e/base: update virtchnl header with advanced features
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
Quoted 608 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaolong Ye
Sent: Sunday, December 1, 2019 11:49 PM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Burra, Phani R <[email protected]>
Subject: [dpdk-dev] [PATCH 57/69]net/i40e/base: update virtchnl header with advanced featuresUpdating 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 <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Kirsher Jeffrey T <[email protected]>Signed-off-by Xiaolong Ye <[email protected]>--- drivers/net/i40e/base/virtchnl.h | 511 ++++++++++++++++++++++++++++++- 1 file changed, 509 insertions(+), 2 deletions(-)drivers/net/i40e/base/virtchnl.h +3
-1@@ -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
drivers/net/i40e/base/virtchnl.h +2
-0+* be used if both the PF and VF have successfully negotiated the +* VIRTCHNL_VF_CAP_EXT_FEATURES capability during initial capabilities
drivers/net/i40e/base/virtchnl.h +26
-1+* 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 | \drivers/net/i40e/base/virtchnl.h +121
-0VIRTCHNL_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.
+ */drivers/net/i40e/base/virtchnl.h +113
-0+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.
+ */drivers/net/i40e/base/virtchnl.h +119
-0+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 changedrivers/net/i40e/base/virtchnl.h +152
-0+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
PATCH 58/69 net/i40e/base: add limits for nested structures
In reply to Xiaolong YeThe 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_QUEUESVIRTCHNL_OP_CONFIG_IRQ_MAPVIRTCHNL_OP_ADD_ETH_ADDRVIRTCHNL_OP_DEL_ETH_ADDRVIRTCHNL_OP_ADD_VLANVIRTCHNL_OP_DEL_VLANVIRTCHNL_OP_CONFIG_IWARP_IRQ_MAPVIRTCHNL_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.
--- drivers/net/i40e/base/virtchnl.h | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
drivers/net/i40e/base/virtchnl.h +76 -0
@@ -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 )
Signature · 1 line
2.17.1
PATCH 59/69 net/i40e/base: put the check for zero nested elements higher
In reply to Xiaolong YeChecking 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.
--- drivers/net/i40e/base/virtchnl.h | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-)
drivers/net/i40e/base/virtchnl.h +6 -22
@@ -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 :
Signature · 1 line
2.17.1
PATCH 60/69 net/i40e/base: clarify requirements
In reply to Xiaolong YeAdd some comments to clarify driver requirements and expectations. No code or struct changes.
--- drivers/net/i40e/base/virtchnl.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +18 -2
@@ -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;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 60/69] net/i40e/base: clarify requirements
NAK
Code wrapped in EXTERNAL_RELEASE must not be released publicly.
Quoted 73 lines
-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Sunday, December 01, 2019 11:49 PM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Williams, Mitch A <[email protected]>
Subject: [PATCH 60/69]net/i40e/base: clarify requirementsAdd some comments to clarify driver requirements and expectations. No code or struct changes.
Signed-off-by Mitch Williams <[email protected]>Reviewed-by Kirsher Jeffrey T <[email protected]>Signed-off-by Xiaolong Ye <[email protected]>--- drivers/net/i40e/base/virtchnl.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/net/i40e/base/virtchnl.h +1
-1@@ -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.
*/
structvirtchnl_queue_pair_info{drivers/net/i40e/base/virtchnl.h +14
-2/* 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
PATCH 61/69 net/i40e/base: change 'Unknown bps'
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_prototype.h | 4 ++++ drivers/net/i40e/base/virtchnl.h | 4 ++++ 2 files changed, 8 insertions(+)
drivers/net/i40e/base/i40e_prototype.h +4 -0
@@ -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 :
drivers/net/i40e/base/virtchnl.h +4 -0
@@ -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 0x7enum 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 */
Signature · 1 line
2.17.1
PATCH 62/69 net/i40e/base: add USO offload flag for AVF
In reply to Xiaolong YeAdd new virtchl offload flag to indicate ability to support UDP segmentation offload in driver
--- drivers/net/i40e/base/virtchnl.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/i40e/base/virtchnl.h +1 -0
@@ -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
Signature · 1 line
2.17.1
PATCH 63/69 net/i40e/base: update the interrupt mapping and negotiation
In reply to Xiaolong YeRefactored the structures of interrupt negotiation and queue vector mapping for the extended features. Also updated the new struct for RSS LUT
--- drivers/net/i40e/base/virtchnl.h | 164 +++++++++++++++++++------------ 1 file changed, 103 insertions(+), 61 deletions(-)
drivers/net/i40e/base/virtchnl.h +103 -61
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 64/69 net/i40e/base: add inline ipsec data struct and commands
In reply to Xiaolong YeAVF 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.
--- drivers/net/i40e/base/virtchnl.h | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/i40e/base/virtchnl.h +35 -0
@@ -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 );
Signature · 1 line
2.17.1
PATCH 65/69 net/i40e/base: change all zero-sized arrays
In reply to Xiaolong YeC++ compilers do not allow zero-sized arrays. Convert structs to use single element arrays.
--- drivers/net/i40e/base/virtchnl.h | 77 +++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 21 deletions(-)
drivers/net/i40e/base/virtchnl.h +56 -21
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 66/69 net/i40e/base: support for additional flow type
In reply to Xiaolong YeThis 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
--- drivers/net/i40e/base/virtchnl.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/i40e/base/virtchnl.h +24 -0
@@ -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 {
Signature · 1 line
2.17.1
PATCH 67/69 net/i40e/base: change GET/SET_RSS_LUT valid_len check
In reply to Xiaolong YeEach lut entry is a u16, so fix the valid_len check using sizeof(u16)
--- drivers/net/i40e/base/virtchnl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/virtchnl.h +1 -1
@@ -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 :
Signature · 1 line
2.17.1
PATCH 68/69 net/i40e/base: add missing 0 length checks
In reply to Xiaolong YeOther 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.
--- drivers/net/i40e/base/virtchnl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/i40e/base/virtchnl.h +12 -0
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 69/69 net/i40e/base: update version
In reply to Xiaolong YeUpdate version to 2019.11.14.
--- drivers/net/i40e/base/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/README +1 -1
@@ -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
Signature · 1 line
2.17.1
v2 cover update for i40e base code
In reply to Xiaolong YeThis 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(-)
Signature · 1 line
2.17.1
PATCH v2 1/36 net/i40e/base: add support for feature flags
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.
--- 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(-)
drivers/net/i40e/base/i40e_common.c +11 -0
@@ -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;
drivers/net/i40e/base/i40e_nvm.c +39 -3
61 lines not on this page · raw message
drivers/net/i40e/base/i40e_type.h +22 -0
@@ -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 ];
Signature · 1 line
2.17.1
PATCH v2 2/36 net/i40e/base: increase max VSI count for VFs
In reply to Xiaolong YeFor 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.
--- drivers/net/i40e/base/i40e_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_type.h +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v2 3/36 net/i40e/base: change buffer address
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_common.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 4/36 net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
In reply to Xiaolong YeThere 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.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +11 -17
@@ -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; }
drivers/net/i40e/base/i40e_dcb.h +2 -1
@@ -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);
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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,
Signature · 1 line
2.17.1
PATCH v2 5/36 net/i40e/base: change misleading error message
In reply to Xiaolong YeThis patch changes an error code for an admin queue head overrun to use I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.
--- drivers/net/i40e/base/i40e_adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq.c +1 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH v2 6/36 net/i40e/base: further implementation of LLDP
In reply to Xiaolong YeThis 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.
--- 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(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +16 -3
@@ -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 0x2u8 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 0x2u8 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;
drivers/net/i40e/base/i40e_common.c +41 -132
226 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +5 -13
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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" );
drivers/net/i40e/rte_pmd_i40e.c +2 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 7/36 net/i40e/base: add new device ids
In reply to Xiaolong YeNew device ids are created to support SFP+ and backplane connections.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +2 -0
@@ -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 :
drivers/net/i40e/base/i40e_devids.h +2 -0
@@ -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
drivers/net/i40e/i40e_ethdev.c +2 -0
@@ -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 */ }, };
Signature · 1 line
2.17.1
PATCH v2 8/36 net/i40e/base: add check for MAC type
In reply to Xiaolong YeSome 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.
--- drivers/net/i40e/base/i40e_adminq.c | 68 +++++++---------------------- 1 file changed, 16 insertions(+), 52 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +16 -52
@@ -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;
Signature · 1 line
2.17.1
PATCH v2 9/36 net/i40e/base: adding flags for PHY types
In reply to Xiaolong YeAdding 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 10/36 net/i40e/base: improve AQ log granularity
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_adminq.c | 8 ++++---- drivers/net/i40e/base/i40e_common.c | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +4 -4
@@ -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);
drivers/net/i40e/base/i40e_common.c +12 -7
@@ -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;
Signature · 1 line
2.17.1
PATCH v2 11/36 net/i40e/base: add getter for FW LLDP agent status
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_dcb.c | 43 ++++++++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_dcb.h | 9 +++++++ 2 files changed, 52 insertions(+)
drivers/net/i40e/base/i40e_dcb.c +43 -0
@@ -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
drivers/net/i40e/base/i40e_dcb.h +9 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 12/36 net/i40e/base: add support for Energy Efficient Ethernet
In reply to Xiaolong YeThis change adds i40e_enable_eee() function controlling advertisement of Energy Efficient Ethernet mode (EEE).
--- drivers/net/i40e/base/i40e_common.c | 64 ++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_prototype.h | 1 + 2 files changed, 65 insertions(+)
drivers/net/i40e/base/i40e_common.c +64 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 13/36 net/i40e/base: read LPI status from external PHY
In reply to Xiaolong YeWhen 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.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +45 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +2 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +6 -0
@@ -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_ */
Signature · 1 line
2.17.1
PATCH v2 14/36 net/i40e/base: change for missing "link modes"
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +2 -2
@@ -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),
Signature · 1 line
2.17.1
PATCH v2 15/36 net/i40e/base: add reading LPI counters
In reply to Xiaolong YeThis 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).
--- 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(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +23 -6
@@ -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);
drivers/net/i40e/base/i40e_common.c +130 -0
142 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +10 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH v2 16/36 net/i40e/base: backport style changes from upstream Linux
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/virtchnl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +2 -2
@@ -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.
Signature · 1 line
2.17.1
PATCH v2 17/36 net/i40e/base: update status codes
In reply to Xiaolong YeAdd 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.
--- drivers/net/i40e/base/virtchnl.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/i40e/base/virtchnl.h +9 -3
@@ -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)
Signature · 1 line
2.17.1
PATCH v2 18/36 net/i40e/base: change of the incorrect Tx descriptors number
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_type.h +2 -2
@@ -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. */
Signature · 1 line
2.17.1
PATCH v2 19/36 net/i40e/base: extend PHY access AQ command
In reply to Xiaolong YeCurrently FW use MDIO I/F number corresponded with current PF for PHY access. This code allow to specify used MDIO I/F number.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +57 -0
@@ -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);
drivers/net/i40e/base/i40e_adminq_cmd.h +5 -1
@@ -2310,7 +2310,11 @@ struct i40e_aqc_phy_register_access {#define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE 2u8 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;
drivers/net/i40e/base/i40e_common.c +50 -12
113 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +19 -8
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v2 20/36 net/i40e/base: add drop mode parameter to set MAC config
In reply to Xiaolong YeThis 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.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +3 -1
@@ -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 &&
drivers/net/i40e/base/i40e_adminq_cmd.h +15 -14
@@ -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 0x80u8 tx_timer_priority;/* bitmap */ __le16 tx_timer_value;__le16 fc_refresh_threshold;
drivers/net/i40e/base/i40e_common.c +11 -0
@@ -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 );
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 21/36 net/i40e/base: add FWS1B register masks
In reply to Xiaolong YeFunction 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.
--- drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/i40e/base/i40e_register.h +12 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH v2 22/36 net/i40e/base: update FW API version
In reply to Xiaolong YeUpdate FW API version to 1.9.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +2 -2
@@ -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 : \
Signature · 1 line
2.17.1
PATCH v2 23/36 net/i40e/base: add persistent lldp support
In reply to Xiaolong YeThis patch adds a function to read nvm module data and uses it to read current lldp agent configuration from nvm api version 1.8.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +19 -1
@@ -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 ;
drivers/net/i40e/base/i40e_dcb.h +5 -0
@@ -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
drivers/net/i40e/base/i40e_nvm.c +71 -0
77 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +3 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH v2 24/36 net/i40e/base: make i40e_set_mac_type() public
In reply to Xiaolong YeMake 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.
--- drivers/net/i40e/base/i40e_common.c | 4 ---- drivers/net/i40e/base/i40e_prototype.h | 2 -- 2 files changed, 6 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -4
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +0 -2
@@ -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)
Signature · 1 line
2.17.1
PATCH v2 25/36 net/i40e/base: change retrying logic
In reply to Xiaolong YeFixed a bug where driver was breaking out of the loop and reporting an error without retrying first.
--- drivers/net/i40e/base/i40e_common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -7
@@ -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;
Signature · 1 line
2.17.1
PATCH v2 26/36 net/i40e/base: mark additional missing bits as reserved
In reply to Xiaolong YeMark 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v2 27/36 net/i40e/base: change wrong 'Advertised FEC modes'
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -3
@@ -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 );
Signature · 1 line
2.17.1
PATCH v2 28/36 net/i40e/base: add Flow Director defines
In reply to Xiaolong YeAdd defines for creating Flow Director flows as defined in datasheet section 7.1.5.4 for field vectors.
--- drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
drivers/net/i40e/base/i40e_register.h +81 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 29/36 net/i40e/base: removed unreachable code
In reply to Xiaolong YeThe result of the check is always FALSE and the code within "if" is never executed.
--- drivers/net/i40e/base/i40e_common.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH v2 30/36 net/i40e/base: set PHY Access flag on X722
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_adminq.c | 5 +++++ drivers/net/i40e/base/i40e_adminq_cmd.h | 2 ++ 2 files changed, 7 insertions(+)
drivers/net/i40e/base/i40e_adminq.c +5 -0
@@ -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 ;
drivers/net/i40e/base/i40e_adminq_cmd.h +2 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 31/36 net/i40e/base: implement reading lpi statistics
In reply to Xiaolong YeThere 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.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +56 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +3 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +2 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v2 32/36 net/i40e/base: exposing missing LED functionality
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_common.c | 8 ++++---- drivers/net/i40e/base/i40e_prototype.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/i40e/base/i40e_common.c +4 -4
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +4 -1
@@ -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,
Signature · 1 line
2.17.1
PATCH v2 33/36 net/i40e/base: introduce firmware EMP reset register offsets
In reply to Xiaolong YeIntroduce 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.
--- drivers/net/i40e/base/i40e_register.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/i40e/base/i40e_register.h +2 -0
@@ -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 \
Signature · 1 line
2.17.1
PATCH v2 34/36 net/i40e/base: add CRC stripping capability
In reply to Xiaolong YeSome 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.
--- drivers/net/i40e/base/i40e_dcb.h | 3 +-- drivers/net/i40e/base/virtchnl.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/i40e/base/i40e_dcb.h +1 -2
@@ -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_ */
drivers/net/i40e/base/virtchnl.h +10 -2
@@ -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;
Signature · 1 line
2.17.1
PATCH v2 35/36 net/i40e/base: enable LED blinking flow
In reply to Xiaolong YeAdd X710T*L device specific operations (in port LED detection and handling of GLGEN_GPIO_CTL.PIN_FUNC field) to enable LED blinking.
--- drivers/net/i40e/base/i40e_common.c | 28 +++++++++++++++++++++++++--- drivers/net/i40e/base/i40e_devids.h | 2 ++ 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/net/i40e/base/i40e_common.c +25 -3
@@ -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) &
drivers/net/i40e/base/i40e_devids.h +2 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 36/36 net/i40e/base: add new link speed constants
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_prototype.h | 4 ++++ drivers/net/i40e/base/virtchnl.h | 4 ++++ 2 files changed, 8 insertions(+)
drivers/net/i40e/base/i40e_prototype.h +4 -0
@@ -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 :
drivers/net/i40e/base/virtchnl.h +4 -0
@@ -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 0x7enum 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 */
Signature · 1 line
2.17.1
v3 cover update for i40e base code
In reply to Xiaolong YeThis 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(-)
Signature · 1 line
2.17.1
PATCH v3 1/36 net/i40e/base: add support for feature flags
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.
--- 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(-)
drivers/net/i40e/base/i40e_common.c +11 -0
@@ -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;
drivers/net/i40e/base/i40e_nvm.c +39 -3
61 lines not on this page · raw message
drivers/net/i40e/base/i40e_type.h +22 -0
@@ -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 ];
Signature · 1 line
2.17.1
PATCH v3 2/36 net/i40e/base: increase max VSI count for VFs
In reply to Xiaolong YeFor 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.
--- drivers/net/i40e/base/i40e_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_type.h +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v3 3/36 net/i40e/base: change buffer address
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_common.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 4/36 net/i40e/base: decouple cfg_lldp_mib_change from init_dcb
In reply to Xiaolong YeThere 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.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +11 -17
@@ -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; }
drivers/net/i40e/base/i40e_dcb.h +2 -1
@@ -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);
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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,
Signature · 1 line
2.17.1
PATCH v3 5/36 net/i40e/base: change misleading error message
In reply to Xiaolong YeThis patch changes an error code for an admin queue head overrun to use I40E_ERR_ADMIN_QUEUE_FULL instead of I40E_ERR_QUEUE_EMPTY.
--- drivers/net/i40e/base/i40e_adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/base/i40e_adminq.c +1 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH v3 6/36 net/i40e/base: further implementation of LLDP
In reply to Xiaolong YeThis 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.
--- 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(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +16 -3
@@ -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 0x2u8 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 0x2u8 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;
drivers/net/i40e/base/i40e_common.c +41 -132
226 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +5 -13
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -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" );
drivers/net/i40e/rte_pmd_i40e.c +2 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 7/36 net/i40e/base: add new device ids
In reply to Xiaolong YeNew device ids are created to support SFP+ and backplane connections.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +2 -0
@@ -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 :
drivers/net/i40e/base/i40e_devids.h +2 -0
@@ -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
drivers/net/i40e/i40e_ethdev.c +2 -0
@@ -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 */ }, };
Signature · 1 line
2.17.1
PATCH v3 8/36 net/i40e/base: add check for MAC type
In reply to Xiaolong YeSome 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.
--- drivers/net/i40e/base/i40e_adminq.c | 68 +++++++---------------------- 1 file changed, 16 insertions(+), 52 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +16 -52
@@ -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;
Signature · 1 line
2.17.1
PATCH v3 9/36 net/i40e/base: adding flags for PHY types
In reply to Xiaolong YeAdding 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v3 10/36 net/i40e/base: improve AQ log granularity
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_adminq.c | 8 ++++---- drivers/net/i40e/base/i40e_common.c | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/net/i40e/base/i40e_adminq.c +4 -4
@@ -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);
drivers/net/i40e/base/i40e_common.c +12 -7
@@ -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;
Signature · 1 line
2.17.1
PATCH v3 11/36 net/i40e/base: add getter for FW LLDP agent status
In reply to Xiaolong YeThis 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.
--- drivers/net/i40e/base/i40e_dcb.c | 43 ++++++++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_dcb.h | 9 +++++++ 2 files changed, 52 insertions(+)
drivers/net/i40e/base/i40e_dcb.c +43 -0
@@ -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
drivers/net/i40e/base/i40e_dcb.h +9 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 12/36 net/i40e/base: add support for Energy Efficient Ethernet
In reply to Xiaolong YeThis change adds i40e_enable_eee() function controlling advertisement of Energy Efficient Ethernet mode (EEE).
--- drivers/net/i40e/base/i40e_common.c | 64 ++++++++++++++++++++++++++ drivers/net/i40e/base/i40e_prototype.h | 1 + 2 files changed, 65 insertions(+)
drivers/net/i40e/base/i40e_common.c +64 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 13/36 net/i40e/base: read LPI status from external PHY
In reply to Xiaolong YeWhen 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.
--- 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(+)
drivers/net/i40e/base/i40e_common.c +45 -0
@@ -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
drivers/net/i40e/base/i40e_prototype.h +2 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +6 -0
@@ -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_ */
Signature · 1 line
2.17.1
PATCH v3 14/36 net/i40e/base: change for missing "link modes"
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +2 -2
@@ -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),
Signature · 1 line
2.17.1
PATCH v3 15/36 net/i40e/base: add reading LPI counters
In reply to Xiaolong YeThis 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).
--- 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(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +23 -6
@@ -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);
drivers/net/i40e/base/i40e_common.c +130 -0
142 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +10 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH v3 16/36 net/i40e/base: backport style changes from upstream Linux
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/virtchnl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/virtchnl.h +2 -2
@@ -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.
Signature · 1 line
2.17.1
PATCH v3 17/36 net/i40e/base: update status codes
In reply to Xiaolong YeAdd 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.
--- drivers/net/i40e/base/virtchnl.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/i40e/base/virtchnl.h +9 -3
@@ -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)
Signature · 1 line
2.17.1
PATCH v3 18/36 net/i40e/base: change of the incorrect Tx descriptors number
In reply to Xiaolong YeThe 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.
--- drivers/net/i40e/base/i40e_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_type.h +2 -2
@@ -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. */
Signature · 1 line
2.17.1
PATCH v3 19/36 net/i40e/base: extend PHY access AQ command
In reply to Xiaolong YeCurrently FW use MDIO I/F number corresponded with current PF for PHY access. This code allow to specify used MDIO I/F number.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +57 -0
@@ -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);
drivers/net/i40e/base/i40e_adminq_cmd.h +5 -1
@@ -2310,7 +2310,11 @@ struct i40e_aqc_phy_register_access {#define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE 2u8 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;
drivers/net/i40e/base/i40e_common.c +50 -12
113 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +19 -8
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v3 20/36 net/i40e/base: add drop mode parameter to set MAC config
In reply to Xiaolong YeThis 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.
--- 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(-)
drivers/net/i40e/base/i40e_adminq.c +3 -1
@@ -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 &&
drivers/net/i40e/base/i40e_adminq_cmd.h +15 -14
@@ -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 0x80u8 tx_timer_priority;/* bitmap */ __le16 tx_timer_value;__le16 fc_refresh_threshold;
drivers/net/i40e/base/i40e_common.c +11 -0
@@ -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 );
drivers/net/i40e/base/i40e_prototype.h +1 -0
@@ -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,
drivers/net/i40e/base/i40e_type.h +1 -0
@@ -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 */
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 21/36 net/i40e/base: add FWS1B register masks
In reply to Xiaolong YeFunction 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.
--- drivers/net/i40e/base/i40e_register.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/i40e/base/i40e_register.h +12 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH v3 22/36 net/i40e/base: update FW API version
In reply to Xiaolong YeUpdate FW API version to 1.9.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +2 -2
@@ -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 : \
Signature · 1 line
2.17.1
PATCH v3 23/36 net/i40e/base: add persistent lldp support
In reply to Xiaolong YeThis patch adds a function to read nvm module data and uses it to read current lldp agent configuration from nvm api version 1.8.
--- 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(-)
drivers/net/i40e/base/i40e_dcb.c +19 -1
@@ -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 ;
drivers/net/i40e/base/i40e_dcb.h +5 -0
@@ -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
drivers/net/i40e/base/i40e_nvm.c +71 -0
77 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +3 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH v3 24/36 net/i40e/base: make i40e_set_mac_type() public
In reply to Xiaolong YeMake 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.
--- drivers/net/i40e/base/i40e_common.c | 4 ---- drivers/net/i40e/base/i40e_prototype.h | 2 -- 2 files changed, 6 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -4
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +0 -2
@@ -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)
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 24/36] net/i40e/base: make i40e_set_mac_type() public
ACK
-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Monday, December 16, 2019 3:43 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Stillwell Jr, Paul M <[email protected]>; Ye, Xiaolong <[email protected]>; Kwapulinski, Piotr <[email protected]>
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.
--- drivers/net/i40e/base/i40e_common.c | 4 ---- drivers/net/i40e/base/i40e_prototype.h | 2 -- 2 files changed, 6 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -1
@@ -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 ;
drivers/net/i40e/base/i40e_prototype.h +0 -3
@@ -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.
PATCH v3 25/36 net/i40e/base: change retrying logic
In reply to Xiaolong YeFixed a bug where driver was breaking out of the loop and reporting an error without retrying first.
--- drivers/net/i40e/base/i40e_common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -7
@@ -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;
Signature · 1 line
2.17.1
PATCH v3 26/36 net/i40e/base: mark additional missing bits as reserved
In reply to Xiaolong YeMark 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.
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/i40e/base/i40e_adminq_cmd.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v3 27/36 net/i40e/base: change wrong 'Advertised FEC modes'
In reply to Xiaolong YeFix 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.
--- drivers/net/i40e/base/i40e_common.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/i40e/base/i40e_common.c +10 -3
@@ -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 );
Signature · 1 line
2.17.1
PATCH v3 28/36 net/i40e/base: add Flow Director defines
In reply to Xiaolong YeAdd defines for creating Flow Director flows as defined in datasheet section 7.1.5.4 for field vectors.
--- drivers/net/i40e/base/i40e_register.h | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
drivers/net/i40e/base/i40e_register.h +81 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v3 29/36 net/i40e/base: removed unreachable code
In reply to Xiaolong YeThe result of the check is always FALSE and the code within "if" is never executed.
--- drivers/net/i40e/base/i40e_common.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/i40e/base/i40e_common.c +0 -2
@@ -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);
Signature · 1 line
2.17.1