100GbE Intel Wired LAN Driver Updates 2019-11-06
Subsystems (3)
This series contains updates to ice driver only.
Jesse implements set_eeprom functionality in ethtool by adding functions to enable reading of the NVM image.
Scott adds ethtool -m support so that we can read eeprom data on SFP/OSFP modules.
Anirudh updates the return value to properly reflect when SRIOV is not supported.
Md Fahad updates the driver to handle a change in the NVM, where the boot configuration section was moved to the Preserved Field Area (PFA) of the NVM.
Paul resolves an issue when DCBx requests non-contiguous TCs, transmit hangs could occur, so configure a default traffic class (TC0) in these cases to prevent traffic hangs. Adds a print statement to notify the user when unsupported modules are inserted.
Bruce fixes up the driver unload code flow to ensure we do not clear the interrupt scheme until the reset is complete, otherwise a hardware error may occur.
Dave updates the DCB initialization to set is_sw_lldp boolean when the firmware has been detected to be in an untenable state. This will ensure that the firmware is in a known state.
Michal saves off the PCI state and I/O BARs address after PCI bus reset so that after the reset, device registers can be read. Also adds a NULL pointer check to prevent a potential kernel panic.
Mitch resolves an issue where VF's on PF's other than 0 were not seeing resets by using the per-PF VF ID instead of the absolute VF ID.
Krzysztof does some code cleanup to remove a unneeded wrapper and reduces the code complexity.
Brett reduces confusion by changing the name of ice_vc_dis_vf() to ice_vc_reset_vf() to better describe what the function is actually doing.
v2: dropped patch 3 "ice: Add support for FW recovery mode detection"
from the origin al series, while Ani makes changes based on community feedback to implement devlink into the changes.
The following are changes since commit a3ead21d6eec4d18b48466c7b978566bc9cab676:
Merge tag 'wireless-drivers-next-2019-11-05' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 100GbE
Anirudh Venkataramanan (1):
ice: Fix return value when SR-IOV is not supported
Brett Creeley (1):
ice: Rename VF function ice_vc_dis_vf to match its behavior
Bruce Allan (1):
ice: fix driver unload flow
Dave Ertman (1):
ice: Adjust DCB INIT for SW mode
Jesse Brandeburg (1):
ice: implement set_eeprom functionality
Krzysztof Kazimierczak (1):
ice: Get rid of ice_cleanup_header
Md Fahad Iqbal Polash (1):
ice: Update Boot Configuration Section read of NVM
Michal Swiatkowski (2):
ice: save PCI state in probe
ice: Check for null pointer dereference when setting rings
Mitch Williams (1):
ice: write register with correct offset
Paul Greenwalt (3):
ice: handle DCBx non-contiguous TC request
ice: print unsupported module message
ice: print PCI link speed and width
Scott W Taylor (1):
ice: add ethtool -m support for reading i2c eeprom modules
.../net/ethernet/intel/ice/ice_adminq_cmd.h | 36 ++ drivers/net/ethernet/intel/ice/ice_common.c | 112 ++++++ drivers/net/ethernet/intel/ice/ice_common.h | 11 +- drivers/net/ethernet/intel/ice/ice_dcb.c | 6 +- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 141 +++++-- drivers/net/ethernet/intel/ice/ice_ethtool.c | 272 ++++++++++++- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 24 ++ drivers/net/ethernet/intel/ice/ice_lib.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 32 +- drivers/net/ethernet/intel/ice/ice_nvm.c | 380 +++++++++++++----- drivers/net/ethernet/intel/ice/ice_nvm.h | 80 ++++ drivers/net/ethernet/intel/ice/ice_txrx.c | 27 +- drivers/net/ethernet/intel/ice/ice_type.h | 3 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 16 +- 15 files changed, 948 insertions(+), 196 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_nvm.h
Signature · 1 line
2.21.0
PATCH v2 1/14 ice: implement set_eeprom functionality
From: Jesse Brandeburg <[email protected]>
The driver needs set_eeprom to work so that it can program the onboard NVM using our update application.
Add functions that are necessary to enable reading the NVM image. They implement basic functionality to lock, read, unlock during an NVM read. Also remove shadow ram functionality since it is no longer used. In addition move a few function declarations into ice_nvm.h.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 3 + drivers/net/ethernet/intel/ice/ice_common.h | 4 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 125 ++++++- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 24 ++ drivers/net/ethernet/intel/ice/ice_lib.h | 2 + drivers/net/ethernet/intel/ice/ice_nvm.c | 341 +++++++++++++----- drivers/net/ethernet/intel/ice/ice_nvm.h | 79 ++++ 8 files changed, 468 insertions(+), 112 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_nvm.h
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +3 -0
@@ -1170,6 +1170,8 @@ struct ice_aqc_nvm {__le32 addr_low; }; +#define ICE_AQC_NVM_START_POINT 0 +/* NVM Checksum Command (direct, 0x0706) */ struct ice_aqc_nvm_checksum {u8 flags;
@@ -1673,6 +1675,7 @@ enum ice_aq_err {ICE_AQ_RC_ENOMEM =9 ,/* Out of memory */ ICE_AQ_RC_EBUSY =12 ,/* Device or resource busy */ ICE_AQ_RC_EEXIST =13 ,/* Object already exists */ +ICE_AQ_RC_EINVAL =14 ,/* Invalid argument */ ICE_AQ_RC_ENOSPC =16 ,/* No space left or allocation failure */ ICE_AQ_RC_ENOSYS =17 ,/* Function not implemented */ ICE_AQ_RC_ENOSEC = 24, /* Missing security manifest */
drivers/net/ethernet/intel/ice/ice_common.h +1 -3
@@ -6,6 +6,7 @@#include "ice.h" #include "ice_type.h" +#include "ice_nvm.h" #include "ice_flex_pipe.h" #include "ice_switch.h" #include <linux/avf/virtchnl.h>
@@ -32,9 +33,6 @@ enum ice_status ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res, enum ice_aq_res_access_type access, u32 timeout);void ice_release_res (struct ice_hw *hw,enum ice_aq_res_ids res); -enum ice_status ice_init_nvm (struct ice_hw *hw); -enum ice_status -ice_read_sr_buf (struct ice_hw *hw,u16 offset,u16 *words,u16 *data); enum ice_status ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, struct ice_aq_desc *desc, void *buf, u16 buf_size,
drivers/net/ethernet/intel/ice/ice_ethtool.c +106 -19
172 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2 -0
@@ -91,6 +91,7 @@#define QRXFLXP_CNTXT_RXDID_IDX_M ICE_M(0x3F, 0)#define QRXFLXP_CNTXT_RXDID_PRIO_S 8#define QRXFLXP_CNTXT_RXDID_PRIO_M ICE_M(0x7, 8) +#define GL_FWSTS 0x00083048#define GLGEN_RSTAT 0x000B8188#define GLGEN_RSTAT_DEVSTATE_M ICE_M(0x3, 0)#define GLGEN_RSTCTL 0x000B8180
@@ -267,6 +268,7 @@#define VP_MDET_TX_TCLAN_VALID_M BIT(0)#define VP_MDET_TX_TDPU (_VF) (0x00040000 + ((_VF) * 4))#define VP_MDET_TX_TDPU_VALID_M BIT(0) +#define GL_MNG_FWSM 0x000B6134#define GLNVM_FLA 0x000B6108#define GLNVM_FLA_LOCKED_M BIT(6)#define GLNVM_GENS 0x000B6100
drivers/net/ethernet/intel/ice/ice_lib.c +24 -0
@@ -2609,3 +2609,27 @@ ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)ice_free_fltr_list (&vsi->back->pdev->dev, &tmp_add_list);return status; } + +/** +* ice_status_to_errno - convert from enum ice_status to Linux errno +* @err: ice_status value to convert +*/ +int ice_status_to_errno (enum ice_status err) +{ +switch (err) { +case ICE_SUCCESS : +return 0 ; +case ICE_ERR_DOES_NOT_EXIST : +return -ENOENT ; +case ICE_ERR_OUT_OF_RANGE : +return -ENOTTY ; +case ICE_ERR_PARAM : +return -EINVAL ; +case ICE_ERR_NO_MEMORY : +return -ENOMEM ; +case ICE_ERR_MAX_LIMIT : +return -EAGAIN ; +default : +return -EINVAL ; + } +}
drivers/net/ethernet/intel/ice/ice_lib.h +2 -0
@@ -89,6 +89,8 @@ void ice_update_rx_ring_stats(struct ice_ring *ring, u64 pkts, u64 bytes);void ice_vsi_cfg_frame_size (struct ice_vsi *vsi); +int ice_status_to_errno (enum ice_status err); +u32 ice_intrl_usec_to_reg (u8 intrl,u8 gran);char *ice_nvm_version_str (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_nvm.c +251 -90
397 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 2/14 ice: add ethtool -m support for reading i2c eeprom modules
In reply to Jeff KirsherFrom: Scott W Taylor <[email protected]>
Implement ethtool -m support to read eeprom data from SFP/QSFP modules.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 29 ++++ drivers/net/ethernet/intel/ice/ice_common.c | 46 ++++++ drivers/net/ethernet/intel/ice/ice_common.h | 4 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 147 ++++++++++++++++++ 4 files changed, 226 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +29 -0
@@ -1147,6 +1147,33 @@ struct ice_aqc_set_port_id_led {u8 rsvd[13 ]; }; +/* Read/Write SFF EEPROM command (indirect 0x06EE) */ +struct ice_aqc_sff_eeprom { +u8 lport_num; +u8 lport_num_valid; +#define ICE_AQC_SFF_PORT_NUM_VALID BIT(0) +__le16 i2c_bus_addr; +#define ICE_AQC_SFF_I2CBUS_7BIT_M 0x7F +#define ICE_AQC_SFF_I2CBUS_10BIT_M 0x3FF +#define ICE_AQC_SFF_I2CBUS_TYPE_M BIT(10) +#define ICE_AQC_SFF_I2CBUS_TYPE_7BIT 0 +#define ICE_AQC_SFF_I2CBUS_TYPE_10BIT ICE_AQC_SFF_I2CBUS_TYPE_M +#define ICE_AQC_SFF_SET_EEPROM_PAGE_S 11 +#define ICE_AQC_SFF_SET_EEPROM_PAGE_M (0x3 << ICE_AQC_SFF_SET_EEPROM_PAGE_S) +#define ICE_AQC_SFF_NO_PAGE_CHANGE 0 +#define ICE_AQC_SFF_SET_23_ON_MISMATCH 1 +#define ICE_AQC_SFF_SET_22_ON_MISMATCH 2 +#define ICE_AQC_SFF_IS_WRITE BIT(15) +__le16 i2c_mem_addr; +__le16 eeprom_page; +#define ICE_AQC_SFF_EEPROM_BANK_S 0 +#define ICE_AQC_SFF_EEPROM_BANK_M (0xFF << ICE_AQC_SFF_EEPROM_BANK_S) +#define ICE_AQC_SFF_EEPROM_PAGE_S 8 +#define ICE_AQC_SFF_EEPROM_PAGE_M (0xFF << ICE_AQC_SFF_EEPROM_PAGE_S) +__le32 addr_high; +__le32 addr_low; +}; +/* NVM Read command (indirect 0x0701) * NVM Erase commands (direct 0x0702) * NVM Update commands (indirect 0x0703)
@@ -1620,6 +1647,7 @@ struct ice_aq_desc {struct ice_aqc_get_phy_caps get_phy;struct ice_aqc_set_phy_cfg set_phy;struct ice_aqc_restart_an restart_an; +struct ice_aqc_sff_eeprom read_write_sff_param;struct ice_aqc_set_port_id_led set_port_id_led;struct ice_aqc_get_sw_cfg get_sw_conf;struct ice_aqc_sw_rules sw_rules;
@@ -1744,6 +1772,7 @@ enum ice_adminq_opc { ice_aqc_opc_set_event_mask =0x0613 , ice_aqc_opc_set_mac_lb =0x0620 , ice_aqc_opc_set_port_id_led =0x06E9 , + ice_aqc_opc_sff_eeprom =0x06EE ,/* NVM commands */ ice_aqc_opc_nvm_read = 0x0701,
drivers/net/ethernet/intel/ice/ice_common.c +46 -0
52 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +4 -0
@@ -115,6 +115,10 @@ ice_aq_set_mac_loopback(struct ice_hw *hw, bool ena_lpbk, struct ice_sq_cd *cd);enum ice_status ice_aq_set_port_id_led (struct ice_port_info *pi,bool is_orig_mode,struct ice_sq_cd *cd); +enum ice_status +ice_aq_sff_eeprom (struct ice_hw *hw,u16 lport,u8 bus_addr, +u16 mem_addr,u8 page,u8 set_page,u8 *data,u8 length, +bool write,struct ice_sq_cd *cd); enum ice_status ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
drivers/net/ethernet/intel/ice/ice_ethtool.c +147 -0
159 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 3/14 ice: Update Boot Configuration Section read of NVM
In reply to Jeff KirsherFrom: Md Fahad Iqbal Polash <[email protected]>
The Boot Configuration Section Block has been moved to the Preserved Field Area (PFA) of NVM. Update the NVM reads that involves Boot Configuration Section.
--- drivers/net/ethernet/intel/ice/ice_common.c | 66 +++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 3 + drivers/net/ethernet/intel/ice/ice_nvm.c | 51 +++++++++++++--- drivers/net/ethernet/intel/ice/ice_nvm.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 3 + 5 files changed, 115 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +66 -0
@@ -1066,6 +1066,72 @@ enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req)return ice_check_reset (hw); } +/** +* ice_get_pfa_module_tlv - Reads sub module TLV from NVM PFA +* @hw: pointer to hardware structure +* @module_tlv: pointer to module TLV to return +* @module_tlv_len: pointer to module TLV length to return +* @module_type: module type requested +* +* Finds the requested sub module TLV type from the Preserved Field +* Area (PFA) and returns the TLV pointer and length. The caller can +* use these to read the variable length TLV value. +*/ +enum ice_status +ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len, +u16 module_type) +{ +enum ice_status status; +u16 pfa_len, pfa_ptr; +u16 next_tlv; + + status =ice_read_sr_word (hw,ICE_SR_PFA_PTR , &pfa_ptr); +if (status) { +ice_debug (hw,ICE_DBG_INIT ,"Preserved Field Array pointer.\n" ); +return status; + } + status =ice_read_sr_word (hw, pfa_ptr, &pfa_len); +if (status) { +ice_debug (hw,ICE_DBG_INIT ,"Failed to read PFA length.\n" ); +return status; + } +/* Starting with first TLV after PFA length, iterate through the list +* of TLVs to find the requested one. +*/ + next_tlv = pfa_ptr +1 ; +while (next_tlv < pfa_ptr + pfa_len) { +u16 tlv_sub_module_type; +u16 tlv_len; + +/* Read TLV type */ + status =ice_read_sr_word (hw, next_tlv, &tlv_sub_module_type); +if (status) { +ice_debug (hw,ICE_DBG_INIT ,"Failed to read TLV type.\n" ); +break ; + } +/* Read TLV length */ + status =ice_read_sr_word (hw, next_tlv +1 , &tlv_len); +if (status) { +ice_debug (hw,ICE_DBG_INIT ,"Failed to read TLV length.\n" ); +break ; + } +if (tlv_sub_module_type == module_type) { +if (tlv_len) { + *module_tlv = next_tlv; + *module_tlv_len = tlv_len; +return 0 ; + } +return ICE_ERR_INVAL_SIZE ; + } +/* Check next TLV, i.e. current TLV pointer + length + 2 words +* (for current TLV's type and length) +*/ + next_tlv = next_tlv + tlv_len +2 ; + } +/* Module does not exist */ +return ICE_ERR_DOES_NOT_EXIST ; +} +/** * ice_copy_rxq_ctx_to_hw * @hw: pointer to the hardware structure
drivers/net/ethernet/intel/ice/ice_common.h +3 -0
@@ -17,6 +17,9 @@ void ice_debug_cq(struct ice_hw *hw, u32 mask, void *desc, void *buf, u16 buf_len);enum ice_status ice_init_hw (struct ice_hw *hw);void ice_deinit_hw (struct ice_hw *hw); +enum ice_status +ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len, +u16 module_type);enum ice_status ice_check_reset (struct ice_hw *hw);enum ice_status ice_reset (struct ice_hw *hw,enum ice_reset_req req);enum ice_status ice_create_all_ctrlq (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_nvm.c +42 -9
83 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +1 -0
@@ -76,4 +76,5 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length, void *data, bool last_command, bool read_shadow_ram, struct ice_sq_cd *cd);enum ice_status ice_init_nvm (struct ice_hw *hw); +enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data);#endif /* _ICE_NVM_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -555,6 +555,8 @@ struct ice_hw_port_stats { };/* Checksum and Shadow RAM pointers */ +#define ICE_SR_BOOT_CFG_PTR 0x132 +#define ICE_NVM_OEM_VER_OFF 0x02#define ICE_SR_NVM_DEV_STARTER_VER 0x18#define ICE_SR_NVM_EETRACK_LO 0x2D#define ICE_SR_NVM_EETRACK_HI 0x2E
@@ -568,6 +570,7 @@ struct ice_hw_port_stats {#define ICE_OEM_VER_BUILD_MASK (0xffff << ICE_OEM_VER_BUILD_SHIFT)#define ICE_OEM_VER_SHIFT 24#define ICE_OEM_VER_MASK (0xff << ICE_OEM_VER_SHIFT) +#define ICE_SR_PFA_PTR 0x40#define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800#define ICE_SR_WORDS_IN_1KB 512
Signature · 1 line
2.21.0
PATCH v2 4/14 ice: handle DCBx non-contiguous TC request
In reply to Jeff KirsherFrom: Paul Greenwalt <[email protected]>
If DCBx request non-contiguous TCs, then the driver will configure default traffic class (TC0). This is done to prevent Tx hang since the driver currently does not support non-contiguous TC.
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 141 ++++++++++++++----- 1 file changed, 102 insertions(+), 39 deletions(-)
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +102 -39
@@ -3,6 +3,8 @@#include "ice_dcb_lib.h" +static void ice_pf_dcb_recfg (struct ice_pf *pf); +/** * ice_vsi_cfg_netdev_tc - Setup the netdev TC configuration * @vsi: the VSI being configured
@@ -137,42 +139,6 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi) } } -/** -* ice_pf_dcb_recfg - Reconfigure all VEBs and VSIs -* @pf: pointer to the PF struct -* -* Assumed caller has already disabled all VSIs before -* calling this function. Reconfiguring DCB based on -* local_dcbx_cfg. -*/ -static void ice_pf_dcb_recfg (struct ice_pf *pf) -{ -struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; -u8 tc_map =0 ; -int v, ret; - -/* Update each VSI */ -ice_for_each_vsi (pf, v) { -if (!pf->vsi[v]) -continue ; - -if (pf->vsi[v]->type ==ICE_VSI_PF ) - tc_map =ice_dcb_get_ena_tc (dcbcfg); -else - tc_map =ICE_DFLT_TRAFFIC_CLASS ; - - ret =ice_vsi_cfg_tc (pf->vsi[v], tc_map); -if (ret) { -dev_err (&pf->pdev->dev, -"Failed to config TC for VSI index: %d\n" , - pf->vsi[v]->idx); -continue ; - } - -ice_vsi_map_rings_to_vectors (pf->vsi[v]); - } -} -/** * ice_pf_dcb_cfg - Apply new DCB configuration * @pf: pointer to the PF struct
@@ -437,9 +403,10 @@ static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked)/** * ice_dcb_sw_default_config - Apply a default DCB config * @pf: PF to apply config to +* @ets_willing: configure ets willing * @locked: was this function called with RTNL held */ -static int ice_dcb_sw_dflt_cfg (struct ice_pf *pf,bool locked) +static int ice_dcb_sw_dflt_cfg (struct ice_pf *pf,bool ets_willing,bool locked) {struct ice_aqc_port_ets_elem buf = {0 };struct ice_dcbx_cfg *dcbcfg;
@@ -454,7 +421,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool locked)memset (dcbcfg,0 ,sizeof (*dcbcfg));memset (&pi->local_dcbx_cfg,0 ,sizeof (*dcbcfg)); - dcbcfg->etscfg.willing =1 ; + dcbcfg->etscfg.willing = ets_willing ?1 :0 ; dcbcfg->etscfg.maxtcs = hw->func_caps.common_cap.maxtc; dcbcfg->etscfg.tcbwtable[0 ] =100 ; dcbcfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ;
@@ -479,6 +446,102 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool locked)return ice_query_port_ets (pi, &buf,sizeof (buf),NULL ); } +/** +* ice_dcb_tc_contig - Check that TCs are contiguous +* @prio_table: pointer to priority table +* +* Check if TCs begin with TC0 and are contiguous +*/ +static bool ice_dcb_tc_contig (u8 *prio_table) +{ +u8 max_tc =0 ; +int i; + +for (i =0 ; i <CEE_DCBX_MAX_PRIO ; i++) { +u8 cur_tc = prio_table[i]; + +if (cur_tc > max_tc) +return false; +else if (cur_tc == max_tc) + max_tc++; + } + +return true; +} + +/** +* ice_dcb_noncontig_cfg - Configure DCB for non-contiguous TCs +* @pf: pointer to the PF struct +* +* If non-contiguous TCs, then configure SW DCB with TC0 and ETS non-willing +*/ +static int ice_dcb_noncontig_cfg (struct ice_pf *pf) +{ +struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; +int ret; + +/* Configure SW DCB default with ETS non-willing */ + ret =ice_dcb_sw_dflt_cfg (pf, false, true); +if (ret) { +dev_err (&pf->pdev->dev, +"Failed to set local DCB config %d\n" , ret); +return ret; + } + +/* Reconfigure with ETS willing so that FW will send LLDP MIB event */ + dcbcfg->etscfg.willing =1 ; + ret =ice_set_dcb_cfg (pf->hw.port_info); +if (ret) +dev_err (&pf->pdev->dev,"Failed to set DCB to unwilling\n" ); + +return ret; +} + +/** +* ice_pf_dcb_recfg - Reconfigure all VEBs and VSIs +* @pf: pointer to the PF struct +* +* Assumed caller has already disabled all VSIs before +* calling this function. Reconfiguring DCB based on +* local_dcbx_cfg. +*/ +static void ice_pf_dcb_recfg (struct ice_pf *pf) +{ +struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; +u8 tc_map =0 ; +int v, ret; + +/* Update each VSI */ +ice_for_each_vsi (pf, v) { +if (!pf->vsi[v]) +continue ; + +if (pf->vsi[v]->type ==ICE_VSI_PF ) { + tc_map =ice_dcb_get_ena_tc (dcbcfg); + +/* If DCBX request non-contiguous TC, then configure +* default TC +*/ +if (!ice_dcb_tc_contig (dcbcfg->etscfg.prio_table)) { + tc_map =ICE_DFLT_TRAFFIC_CLASS ; +ice_dcb_noncontig_cfg (pf); + } + }else { + tc_map =ICE_DFLT_TRAFFIC_CLASS ; + } + + ret =ice_vsi_cfg_tc (pf->vsi[v], tc_map); +if (ret) { +dev_err (&pf->pdev->dev, +"Failed to config TC for VSI index: %d\n" , + pf->vsi[v]->idx); +continue ; + } + +ice_vsi_map_rings_to_vectors (pf->vsi[v]); + } +} +/** * ice_init_pf_dcb - initialize DCB for a PF * @pf: PF to initialize DCB for
@@ -507,7 +570,7 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)dev_info (&pf->pdev->dev,"FW LLDP is disabled, DCBx/LLDP in SW mode.\n" );clear_bit (ICE_FLAG_FW_LLDP_AGENT , pf->flags); - err =ice_dcb_sw_dflt_cfg (pf, locked); + err =ice_dcb_sw_dflt_cfg (pf, true, locked);if (err) {dev_err (&pf->pdev->dev,"Failed to set local DCB config %d\n" , err);
Signature · 1 line
2.21.0
PATCH v2 5/14 ice: fix driver unload flow
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
As part of the driver unload flow, a PF reset is issued which may still cause an interrupt to be generated by the device. Do not clear the interrupt scheme until the reset is complete and there are no pending transactions otherwise a hardware error may occur.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +2 -1
@@ -3348,12 +3348,13 @@ static void ice_remove(struct pci_dev *pdev) }ice_deinit_pf (pf);ice_deinit_hw (&pf->hw); -ice_clear_interrupt_scheme (pf);/* Issue a PFR as part of the prescribed driver unload flow. Do not * do it via ice_schedule_reset() since there is no need to rebuild * and the service task is already stopped. */ ice_reset (&pf->hw,ICE_RESET_PFR ); +pci_wait_for_pending_transaction (pdev); +ice_clear_interrupt_scheme (pf);pci_disable_pcie_error_reporting (pdev); }
Signature · 1 line
2.21.0
PATCH v2 6/14 ice: Adjust DCB INIT for SW mode
In reply to Jeff KirsherFrom: Dave Ertman <[email protected]>
Adjust ice_init_dcb to set the is_sw_lldp boolean in the case where the FW has been detected to be in an untenable state such that the driver should forcibly make sure it is off.
This will ensure that the FW is in a known state.
--- drivers/net/ethernet/intel/ice/ice_dcb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_dcb.c +3 -3
@@ -965,9 +965,9 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) {/* Get current DCBX configuration */ ret =ice_get_dcb_cfg (pi); - pi->is_sw_lldp = (hw->adminq.sq_last_status ==ICE_AQ_RC_EPERM );if (ret)return ret; + pi->is_sw_lldp = false; } else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) {return ICE_ERR_NOT_READY ; }
@@ -975,8 +975,8 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)/* Configure the LLDP MIB change event */ if (enable_mib_change) { ret =ice_aq_cfg_lldp_mib_change (hw, true,NULL ); -if (!ret) - pi->is_sw_lldp = false; +if (ret) + pi->is_sw_lldp = true; }return ret;
Signature · 1 line
2.21.0
PATCH v2 7/14 ice: save PCI state in probe
In reply to Jeff KirsherFrom: Michal Swiatkowski <[email protected]>
Save state to correct recovery memory and I/O BARs address after PCI bus reset. Without this after reset kernel can't read device registers.
--- drivers/net/ethernet/intel/ice/ice_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -3152,6 +3152,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) hw = &pf->hw; hw->hw_addr =pcim_iomap_table (pdev)[ICE_BAR0 ]; +pci_save_state (pdev); + hw->back = pf; hw->vendor_id = pdev->vendor; hw->device_id = pdev->device;
Signature · 1 line
2.21.0
PATCH v2 8/14 ice: Check for null pointer dereference when setting rings
In reply to Jeff KirsherFrom: Michal Swiatkowski <[email protected]>
Without this check rebuild vsi can lead to kernel panic.
--- drivers/net/ethernet/intel/ice/ice_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +14 -4
@@ -4303,8 +4303,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) }ice_for_each_txq (vsi, i) { - vsi->tx_rings[i]->netdev = vsi->netdev; - err =ice_setup_tx_ring (vsi->tx_rings[i]); +struct ice_ring *ring = vsi->tx_rings[i]; + +if (!ring) +return -EINVAL ; + + ring->netdev = vsi->netdev; + err =ice_setup_tx_ring (ring);if (err)break ; }
@@ -4329,8 +4334,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) }ice_for_each_rxq (vsi, i) { - vsi->rx_rings[i]->netdev = vsi->netdev; - err =ice_setup_rx_ring (vsi->rx_rings[i]); +struct ice_ring *ring = vsi->rx_rings[i]; + +if (!ring) +return -EINVAL ; + + ring->netdev = vsi->netdev; + err =ice_setup_rx_ring (ring);if (err)break ; }
Signature · 1 line
2.21.0
PATCH v2 9/14 ice: write register with correct offset
In reply to Jeff KirsherFrom: Mitch Williams <[email protected]>
The VF_MBX_ARQLEN register array is per-PF, not global, so we should not use the absolute VF ID as an index. Instead, use the per-PF VF ID.
This fixes an issue with VFs on PFs other than 0 not seeing reset.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1 -1
@@ -390,7 +390,7 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr)* by the time we get here. */ if (!is_pfr) -wr32 (hw,VF_MBX_ARQLEN (vf_abs_id),0 ); +wr32 (hw,VF_MBX_ARQLEN (vf->vf_id),0 );/* In the case of a VFLR, the HW has already reset the VF and we * just need to clean up, so don't hit the VFRTRIG register.
Signature · 1 line
2.21.0
PATCH v2 10/14 ice: print unsupported module message
In reply to Jeff KirsherFrom: Paul Greenwalt <[email protected]>
Print message to inform user if unsupported module is inserted, and extend the topology / configuration detection.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 4 ++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 10 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +4 -0
@@ -1044,6 +1044,10 @@ struct ice_aqc_get_link_status_data {#define ICE_AQ_LINK_TOPO_CONFLICT BIT(0)#define ICE_AQ_LINK_MEDIA_CONFLICT BIT(1)#define ICE_AQ_LINK_TOPO_CORRUPT BIT(2) +#define ICE_AQ_LINK_TOPO_UNREACH_PRT BIT(4) +#define ICE_AQ_LINK_TOPO_UNDRUTIL_PRT BIT(5) +#define ICE_AQ_LINK_TOPO_UNDRUTIL_MEDIA BIT(6) +#define ICE_AQ_LINK_TOPO_UNSUPP_MEDIA BIT(7)u8 reserved1;u8 link_info;#define ICE_AQ_LINK_UP BIT(0)/* Link Status */
drivers/net/ethernet/intel/ice/ice_main.c +6 -0
@@ -637,8 +637,14 @@ static void ice_print_topo_conflict(struct ice_vsi *vsi)switch (vsi->port_info->phy.link_info.topo_media_conflict) {case ICE_AQ_LINK_TOPO_CONFLICT :case ICE_AQ_LINK_MEDIA_CONFLICT : +case ICE_AQ_LINK_TOPO_UNREACH_PRT : +case ICE_AQ_LINK_TOPO_UNDRUTIL_PRT : +case ICE_AQ_LINK_TOPO_UNDRUTIL_MEDIA :netdev_info (vsi->netdev,"Possible mis-configuration of the Ethernet port detected, please use the Intel(R) Ethernet Port Configuration Tool application to address the issue.\n" );break ; +case ICE_AQ_LINK_TOPO_UNSUPP_MEDIA : +netdev_info (vsi->netdev,"Rx/Tx is disabled on this device because an unsupported module type was detected. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for a list of supported modules.\n" ); +break ;default :break ; }
Signature · 1 line
2.21.0
PATCH v2 11/14 ice: print PCI link speed and width
In reply to Jeff KirsherFrom: Paul Greenwalt <[email protected]>
Print message to inform user of PCI link speed and width.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
@@ -3305,6 +3305,9 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)ice_cfg_lldp_mib_change (&pf->hw, true); } +/* print PCI link speed and width */ +pcie_print_link_status (pf->pdev); +return 0 ; err_alloc_sw_unroll:
Signature · 1 line
2.21.0
PATCH v2 12/14 ice: Get rid of ice_cleanup_header
In reply to Jeff KirsherFrom: Krzysztof Kazimierczak <[email protected]>
ice_cleanup_hdrs() has been stripped of most of its content, it only serves as a wrapper for eth_skb_pad(). We can get rid of it altogether and simplify the codebase.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 27 ++--------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +2 -25
@@ -944,27 +944,6 @@ static void ice_put_rx_buf(struct ice_ring *rx_ring, struct ice_rx_buf *rx_buf) rx_buf->skb =NULL ; } -/** -* ice_cleanup_headers - Correct empty headers -* @skb: pointer to current skb being fixed -* -* Also address the case where we are pulling data in on pages only -* and as such no data is present in the skb header. -* -* In addition if skb is not at least 60 bytes we need to pad it so that -* it is large enough to qualify as a valid Ethernet frame. -* -* Returns true if an error was encountered and skb was freed. -*/ -static bool ice_cleanup_headers (struct sk_buff *skb) -{ -/* if eth_skb_pad returns an error the skb was freed */ -if (eth_skb_pad (skb)) -return true; - -return false; -} -/** * ice_is_non_eop - process handling of non-EOP buffers * @rx_ring: Rx ring being processed
@@ -1124,10 +1103,8 @@ static int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)if (ice_test_staterr (rx_desc, stat_err_bits)) vlan_tag =le16_to_cpu (rx_desc->wb.l2tag1); -/* correct empty headers and pad skb if needed (to make valid -* ethernet frame -*/ -if (ice_cleanup_headers (skb)) { +/* pad the skb if needed, to make a valid ethernet frame */ +if (eth_skb_pad (skb)) { skb =NULL ;continue ; }
Signature · 1 line
2.21.0
PATCH v2 13/14 ice: Rename VF function ice_vc_dis_vf to match its behavior
In reply to Jeff KirsherFrom: Brett Creeley <[email protected]>
ice_vc_dis_vf() tells iavf that it's going to perform a reset and then performs a software reset. This is misleading based on the function name because the VF does not get disabled. So fix this by changing the name to ice_vc_reset_vf().
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +5 -7
@@ -1496,12 +1496,10 @@ void ice_process_vflr_event(struct ice_pf *pf) }/** -* ice_vc_dis_vf - Disable a given VF via SW reset +* ice_vc_reset_vf - Perform software reset on the VF after informing the AVF * @vf: pointer to the VF info -* -* Disable the VF through a SW reset */ -static void ice_vc_dis_vf (struct ice_vf *vf) +static void ice_vc_reset_vf (struct ice_vf *vf) {ice_vc_notify_vf_reset (vf);ice_reset_vf (vf, false);
@@ -2541,7 +2539,7 @@ static int ice_vc_request_qs_msg(struct ice_vf *vf, u8 *msg) }else {/* request is successful, then reset VF */ vf->num_req_qs = req_queues; -ice_vc_dis_vf (vf); +ice_vc_reset_vf (vf);dev_info (&pf->pdev->dev,"VF %d granted request of %u queues.\n" , vf->vf_id, req_queues);
@@ -3168,7 +3166,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)"MAC on VF %d set to %pM. VF driver will be reinitialized\n" , vf_id, mac); -ice_vc_dis_vf (vf); +ice_vc_reset_vf (vf);return ret; }
@@ -3204,7 +3202,7 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)return 0 ; vf->trusted = trusted; -ice_vc_dis_vf (vf); +ice_vc_reset_vf (vf);dev_info (&pf->pdev->dev,"VF %u is now %strusted\n" , vf_id, trusted ?"" :"un" );
Signature · 1 line
2.21.0
PATCH v2 14/14 ice: Fix return value when SR-IOV is not supported
In reply to Jeff KirsherFrom: Anirudh Venkataramanan <[email protected]>
When the device is not capable of supporting SR-IOV -ENODEV is being returned; -EOPNOTSUPP is more appropriate.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1 -1
@@ -1408,7 +1408,7 @@ static int ice_pci_sriov_ena(struct ice_pf *pf, int num_vfs)if (!test_bit (ICE_FLAG_SRIOV_CAPABLE , pf->flags)) {dev_err (dev,"This device is not capable of SR-IOV\n" ); -return -ENODEV ; +return -EOPNOTSUPP ; }if (pre_existing_vfs && pre_existing_vfs != num_vfs)
Signature · 1 line
2.21.0
Quoted 50 lines · Jeff Kirsher
This series contains updates to ice driver only.
Jesse implements
set_eepromfunctionality in ethtool by adding functions
to enable reading of the NVM image.Scott adds ethtool -m support so that we can read eeprom data on SFP/OSFP
modules.Anirudh updates the return value to properly reflect when SRIOV is not
supported.Md Fahad updates the driver to handle a change in the NVM, where the boot configuration section was moved to the Preserved Field Area (PFA)
of the NVM.Paul resolves an issue when DCBx requests non-contiguous TCs, transmit
hangs could occur, so configure a default traffic class (TC0) in these
cases to prevent traffic hangs. Adds a print statement to notify the user when unsupported modules are inserted.Bruce fixes up the driver unload code flow to ensure we do not clear the
interrupt scheme until the reset is complete, otherwise a hardware error
may occur.Dave updates the DCB initialization to set
is_sw_lldpboolean when the
firmware has been detected to be in an untenable state. This will ensure that the firmware is in a known state.Michal saves off the PCI state and I/O BARs address after PCI bus reset
so that after the reset, device registers can be read. Also adds a NULL
pointer check to prevent a potential kernel panic.Mitch resolves an issue where VF's on PF's other than 0 were not seeing
resets by using the per-PF VF ID instead of the absolute VF ID.Krzysztof does some code cleanup to remove a unneeded wrapper and reduces the code complexity.
Quoted 7 lines
Brett reduces confusion by changing the name of
ice_vc_dis_vf()toice_vc_reset_vf()to better describe what the function is actually doing.v2: dropped patch 3 "ice: Add support for FW recovery mode detection"
from the origin al series, while Ani makes changes based on community feedback to implement devlink into the changes.
Sorry for the thrash, I will need to generate a v3 of this series. I need to drop patch 1 of the series as well, since these driver changes will be affected by Ani's work to implement devlink into the driver, as well as we found a bug with this particular patch.