ice: refactor ice_discover_caps to avoid need to retry
Subsystems (2)
Tony Nguyen
maintainerPATCH 1/15 ice: refactor ice_discover_caps to avoid need to retry
From: Jacob Keller <[email protected]>
The ice_discover_caps function is used to read the device and function capabilities, updating the hardware capabilities structures with relevant data.
The exact number of capabilities returned by the hardware is unknown ahead of time. The AdminQ command will report the total number of capabilities in the return buffer.
The current implementation involves requesting capabilities once, reading this returned size, and then re-requested with that size.
This isn't really necessary. The firmware interface has a maximum size of ICE_AQ_MAX_BUF_LEN. Firmware can never return more than ICE_AQ_MAX_BUF_LEN / sizeof(struct ice_aqc_list_caps_elem) capabilities.
Avoid the retry loop by simply allocating a buffer of size ICE_AQ_MAX_BUF_LEN. This is significantly simpler than retrying. The extra allocation isn't a big deal, as it will be released after we finish parsing the capabilities.
--- drivers/net/ethernet/intel/ice/ice_common.c | 43 ++++++--------------- 1 file changed, 12 insertions(+), 31 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +12 -31
@@ -1901,40 +1901,21 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc) {enum ice_status status;u32 cap_count; -u16 cbuf_len; -u8 retries; - -/* The driver doesn't know how many capabilities the device will return -* so the buffer size required isn't known ahead of time. The driver -* starts with cbuf_len and if this turns out to be insufficient, the -* device returns ICE_AQ_RC_ENOMEM and also the cap_count it needs. -* The driver then allocates the buffer based on the count and retries -* the operation. So it follows that the retry count is 2. -*/ -#define ICE_GET_CAP_BUF_COUNT 40 -#define ICE_GET_CAP_RETRY_COUNT 2 - - cap_count =ICE_GET_CAP_BUF_COUNT ; - retries =ICE_GET_CAP_RETRY_COUNT ; - -do { -void *cbuf; - - cbuf_len = (u16)(cap_count * -sizeof (struct ice_aqc_list_caps_elem )); - cbuf =devm_kzalloc (ice_hw_to_dev (hw), cbuf_len,GFP_KERNEL ); -if (!cbuf) -return ICE_ERR_NO_MEMORY ; +void *cbuf; - status =ice_aq_discover_caps (hw, cbuf, cbuf_len, &cap_count, - opc,NULL ); -devm_kfree (ice_hw_to_dev (hw), cbuf); + cbuf =kzalloc (ICE_AQ_MAX_BUF_LEN ,GFP_KERNEL ); +if (!cbuf) +return ICE_ERR_NO_MEMORY ; -if (!status || hw->adminq.sq_last_status !=ICE_AQ_RC_ENOMEM ) -break ; +/* Although the driver doesn't know the number of capabilities the +* device will return, we can simply send a 4KB buffer, the maximum +* possible size that firmware can return. +*/ + cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); -/* If ENOMEM is returned, try again with bigger buffer */ - }while (--retries); + status =ice_aq_discover_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + opc,NULL ); +kfree (cbuf);return status; }
Signature · 1 line
2.20.1
Tony Nguyen
maintainerPATCH 2/15 ice: split ice_parse_caps into separate functions
From: Jacob Keller <[email protected]>
The ice_parse_caps function is used to convert the capability block data coming from firmware into a structured format used by other parts of the code.
The current implementation directly updates the hw->func_caps and hw->dev_caps structures. It is directly called from within ice_aq_discover_caps. This causes the discover_caps function to have the side effect of modifying the hw capability structures, which is not intuitive.
Split this function into ice_parse_dev_caps and ice_parse_func_caps. These functions will take a pointer to the dev_caps and func_caps respectively. Also create an ice_parse_common_caps for sharing the capability logic that is common to device and function.
Doing so enables a future refactor to allow reading and parsing capabilities into a local caps structure instead of modifying the members of the hw structure directly.
--- drivers/net/ethernet/intel/ice/ice_common.c | 548 ++++++++++++++------ 1 file changed, 378 insertions(+), 170 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +378 -170
@@ -1617,204 +1617,412 @@ static u32 ice_get_num_per_func(struct ice_hw *hw, u32 max) }/** -* ice_parse_caps - parse function/device capabilities +* ice_parse_common_caps - parse common device/function capabilities * @hw: pointer to the HW struct -* @buf: pointer to a buffer containing function/device capability records -* @cap_count: number of capability records in the list -* @opc: type of capabilities list to parse +* @caps: pointer to common capabilities structure +* @elem: the capability element to parse +* @prefix: message prefix for tracing capabilities * -* Helper function to parse function(0x000a)/device(0x000b) capabilities list. +* Given a capability element, extract relevant details into the common +* capability structure. +* +* Returns: true if the capability matches one of the common capability ids, +* false otherwise. +*/ +static bool +ice_parse_common_caps (struct ice_hw *hw,struct ice_hw_common_caps *caps, +struct ice_aqc_list_caps_elem *elem,const char *prefix) +{ +u32 logical_id =le32_to_cpu (elem->logical_id); +u32 phys_id =le32_to_cpu (elem->phys_id); +u32 number =le32_to_cpu (elem->number); +u16 cap =le16_to_cpu (elem->cap); +bool found = true; + +switch (cap) { +case ICE_AQC_CAPS_VALID_FUNCTIONS : + caps->valid_functions = number; +ice_debug (hw,ICE_DBG_INIT , +"%s: valid_functions (bitmap) = %d\n" , prefix, + caps->valid_functions); +break ; +case ICE_AQC_CAPS_SRIOV : + caps->sr_iov_1_1 = (number ==1 ); +ice_debug (hw,ICE_DBG_INIT , +"%s: sr_iov_1_1 = %d\n" , prefix, + caps->sr_iov_1_1); +break ; +case ICE_AQC_CAPS_DCB : + caps->dcb = (number ==1 ); + caps->active_tc_bitmap = logical_id; + caps->maxtc = phys_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: dcb = %d\n" , prefix, caps->dcb); +ice_debug (hw,ICE_DBG_INIT , +"%s: active_tc_bitmap = %d\n" , prefix, + caps->active_tc_bitmap); +ice_debug (hw,ICE_DBG_INIT , +"%s: maxtc = %d\n" , prefix, caps->maxtc); +break ; +case ICE_AQC_CAPS_RSS : + caps->rss_table_size = number; + caps->rss_table_entry_width = logical_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: rss_table_size = %d\n" , prefix, + caps->rss_table_size); +ice_debug (hw,ICE_DBG_INIT , +"%s: rss_table_entry_width = %d\n" , prefix, + caps->rss_table_entry_width); +break ; +case ICE_AQC_CAPS_RXQS : + caps->num_rxq = number; + caps->rxq_first_id = phys_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: num_rxq = %d\n" , prefix, + caps->num_rxq); +ice_debug (hw,ICE_DBG_INIT , +"%s: rxq_first_id = %d\n" , prefix, + caps->rxq_first_id); +break ; +case ICE_AQC_CAPS_TXQS : + caps->num_txq = number; + caps->txq_first_id = phys_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: num_txq = %d\n" , prefix, + caps->num_txq); +ice_debug (hw,ICE_DBG_INIT , +"%s: txq_first_id = %d\n" , prefix, + caps->txq_first_id); +break ; +case ICE_AQC_CAPS_MSIX : + caps->num_msix_vectors = number; + caps->msix_vector_first_id = phys_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: num_msix_vectors = %d\n" , prefix, + caps->num_msix_vectors); +ice_debug (hw,ICE_DBG_INIT , +"%s: msix_vector_first_id = %d\n" , prefix, + caps->msix_vector_first_id); +break ; +case ICE_AQC_CAPS_MAX_MTU : + caps->max_mtu = number; +ice_debug (hw,ICE_DBG_INIT ,"%s: max_mtu = %d\n" , + prefix, caps->max_mtu); +break ; +default : +/* Not one of the recognized common capabilities */ + found = false; + } + +return found; +} + +/** +* ice_recalc_port_limited_caps - Recalculate port limited capabilities +* @hw: pointer to the HW structure +* @caps: pointer to capabilities structure to fix +* +* Re-calculate the capabilities that are dependent on the number of physical +* ports; i.e. some features are not supported or function differently on +* devices with more than 4 ports. */ static void -ice_parse_caps (struct ice_hw *hw,void *buf,u32 cap_count, -enum ice_adminq_opc opc) +ice_recalc_port_limited_caps (struct ice_hw *hw,struct ice_hw_common_caps *caps) +{ +/* This assumes device capabilities are always scanned before function +* capabilities during the initialization flow. +*/ +if (hw->dev_caps.num_funcs >4 ) { +/* Max 4 TCs per port */ + caps->maxtc =4 ; +ice_debug (hw,ICE_DBG_INIT , +"reducing maxtc to %d (based on #ports)\n" , + caps->maxtc); + } +} + +/** +* ice_parse_vf_func_caps - Parse ICE_AQC_CAPS_VF function caps +* @hw: pointer to the HW struct +* @func_p: pointer to function capabilities structure +* @cap: pointer to the capability element to parse +* +* Extract function capabilities for ICE_AQC_CAPS_VF. +*/ +static void +ice_parse_vf_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p, +struct ice_aqc_list_caps_elem *cap) +{ +u32 number =le32_to_cpu (cap->number); +u32 logical_id =le32_to_cpu (cap->logical_id); + + func_p->num_allocd_vfs = number; + func_p->vf_base_id = logical_id; +ice_debug (hw,ICE_DBG_INIT ,"func caps: num_allocd_vfs = %d\n" , + func_p->num_allocd_vfs); +ice_debug (hw,ICE_DBG_INIT ,"func caps: vf_base_id = %d\n" , + func_p->vf_base_id); +} + +/** +* ice_parse_vsi_func_caps - Parse ICE_AQC_CAPS_VSI function caps +* @hw: pointer to the HW struct +* @func_p: pointer to function capabilities structure +* @cap: pointer to the capability element to parse +* +* Extract function capabilities for ICE_AQC_CAPS_VSI. +*/ +static void +ice_parse_vsi_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p, +struct ice_aqc_list_caps_elem *cap) +{ + func_p->guar_num_vsi =ice_get_num_per_func (hw,ICE_MAX_VSI ); +ice_debug (hw,ICE_DBG_INIT ,"func caps: guar_num_vsi (fw) = %d\n" , +le32_to_cpu (cap->number)); +ice_debug (hw,ICE_DBG_INIT ,"func caps: guar_num_vsi = %d\n" , + func_p->guar_num_vsi); +} + +/** +* ice_parse_fdir_func_caps - Parse ICE_AQC_CAPS_FD function caps +* @hw: pointer to the HW struct +* @func_p: pointer to function capabilities structure +* +* Extract function capabilities for ICE_AQC_CAPS_FD. +*/ +static void +ice_parse_fdir_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p) +{ +u32 reg_val, val; + + reg_val =rd32 (hw,GLQF_FD_SIZE ); + val = (reg_val &GLQF_FD_SIZE_FD_GSIZE_M ) >> +GLQF_FD_SIZE_FD_GSIZE_S ; + func_p->fd_fltr_guar = +ice_get_num_per_func (hw, val); + val = (reg_val &GLQF_FD_SIZE_FD_BSIZE_M ) >> +GLQF_FD_SIZE_FD_BSIZE_S ; + func_p->fd_fltr_best_effort = val; + +ice_debug (hw,ICE_DBG_INIT , +"func caps: fd_fltr_guar = %d\n" , + func_p->fd_fltr_guar); +ice_debug (hw,ICE_DBG_INIT , +"func caps: fd_fltr_best_effort = %d\n" , + func_p->fd_fltr_best_effort); +} + +/** +* ice_parse_func_caps - Parse function capabilities +* @hw: pointer to the HW struct +* @func_p: pointer to function capabilities structure +* @buf: buffer containing the function capability records +* @cap_count: the number of capabilities +* +* Helper function to parse function (0x000A) capabilities list. For +* capabilities shared between device and function, this relies on +* ice_parse_common_caps. +* +* Loop through the list of provided capabilities and extract the relevant +* data into the function capabilities structured. +*/ +static void +ice_parse_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p, +void *buf,u32 cap_count) {struct ice_aqc_list_caps_elem *cap_resp; -struct ice_hw_func_caps *func_p =NULL ; -struct ice_hw_dev_caps *dev_p =NULL ; -struct ice_hw_common_caps *caps; -char const *prefix;u32 i; -if (!buf) -return ; - cap_resp = (struct ice_aqc_list_caps_elem *)buf; -if (opc == ice_aqc_opc_list_dev_caps) { - dev_p = &hw->dev_caps; - caps = &dev_p->common_cap; - prefix ="dev cap" ; - }else if (opc == ice_aqc_opc_list_func_caps) { - func_p = &hw->func_caps; - caps = &func_p->common_cap; - prefix ="func cap" ; - }else { -ice_debug (hw,ICE_DBG_INIT ,"wrong opcode\n" ); -return ; - } +memset (func_p,0 ,sizeof (*func_p)); -for (i =0 ; caps && i < cap_count; i++, cap_resp++) { -u32 logical_id =le32_to_cpu (cap_resp->logical_id); -u32 phys_id =le32_to_cpu (cap_resp->phys_id); -u32 number =le32_to_cpu (cap_resp->number); -u16 cap =le16_to_cpu (cap_resp->cap); +for (i =0 ; i < cap_count; i++) { +u16 cap =le16_to_cpu (cap_resp[i].cap); +bool found; -switch (cap) { -case ICE_AQC_CAPS_VALID_FUNCTIONS : - caps->valid_functions = number; -ice_debug (hw,ICE_DBG_INIT , -"%s: valid_functions (bitmap) = %d\n" , prefix, - caps->valid_functions); + found =ice_parse_common_caps (hw, &func_p->common_cap, + &cap_resp[i],"func caps" ); -/* store func count for resource management purposes */ -if (dev_p) - dev_p->num_funcs =hweight32 (number); -break ; -case ICE_AQC_CAPS_SRIOV : - caps->sr_iov_1_1 = (number ==1 ); -ice_debug (hw,ICE_DBG_INIT , -"%s: sr_iov_1_1 = %d\n" , prefix, - caps->sr_iov_1_1); -break ; +switch (cap) {case ICE_AQC_CAPS_VF : -if (dev_p) { - dev_p->num_vfs_exposed = number; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_vfs_exposed = %d\n" , prefix, - dev_p->num_vfs_exposed); - }else if (func_p) { - func_p->num_allocd_vfs = number; - func_p->vf_base_id = logical_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_allocd_vfs = %d\n" , prefix, - func_p->num_allocd_vfs); -ice_debug (hw,ICE_DBG_INIT , -"%s: vf_base_id = %d\n" , prefix, - func_p->vf_base_id); - } +ice_parse_vf_func_caps (hw, func_p, &cap_resp[i]);break ;case ICE_AQC_CAPS_VSI : -if (dev_p) { - dev_p->num_vsi_allocd_to_host = number; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_vsi_allocd_to_host = %d\n" , - prefix, - dev_p->num_vsi_allocd_to_host); - }else if (func_p) { - func_p->guar_num_vsi = -ice_get_num_per_func (hw,ICE_MAX_VSI ); -ice_debug (hw,ICE_DBG_INIT , -"%s: guar_num_vsi (fw) = %d\n" , - prefix, number); -ice_debug (hw,ICE_DBG_INIT , -"%s: guar_num_vsi = %d\n" , - prefix, func_p->guar_num_vsi); - } +ice_parse_vsi_func_caps (hw, func_p, &cap_resp[i]);break ; -case ICE_AQC_CAPS_DCB : - caps->dcb = (number ==1 ); - caps->active_tc_bitmap = logical_id; - caps->maxtc = phys_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: dcb = %d\n" , prefix, caps->dcb); -ice_debug (hw,ICE_DBG_INIT , -"%s: active_tc_bitmap = %d\n" , prefix, - caps->active_tc_bitmap); -ice_debug (hw,ICE_DBG_INIT , -"%s: maxtc = %d\n" , prefix, caps->maxtc); -break ; -case ICE_AQC_CAPS_RSS : - caps->rss_table_size = number; - caps->rss_table_entry_width = logical_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: rss_table_size = %d\n" , prefix, - caps->rss_table_size); -ice_debug (hw,ICE_DBG_INIT , -"%s: rss_table_entry_width = %d\n" , prefix, - caps->rss_table_entry_width); +case ICE_AQC_CAPS_FD : +ice_parse_fdir_func_caps (hw, func_p);break ; -case ICE_AQC_CAPS_RXQS : - caps->num_rxq = number; - caps->rxq_first_id = phys_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_rxq = %d\n" , prefix, - caps->num_rxq); -ice_debug (hw,ICE_DBG_INIT , -"%s: rxq_first_id = %d\n" , prefix, - caps->rxq_first_id); +default : +/* Don't list common capabilities as unknown */ +if (!found) +ice_debug (hw,ICE_DBG_INIT , +"func caps: unknown capability[%d]: 0x%x\n" , + i, cap);break ; -case ICE_AQC_CAPS_TXQS : - caps->num_txq = number; - caps->txq_first_id = phys_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_txq = %d\n" , prefix, - caps->num_txq); -ice_debug (hw,ICE_DBG_INIT , -"%s: txq_first_id = %d\n" , prefix, - caps->txq_first_id); + } + } + +ice_recalc_port_limited_caps (hw, &func_p->common_cap); +} + +/** +* ice_parse_valid_functions_cap - Parse ICE_AQC_CAPS_VALID_FUNCTIONS caps +* @hw: pointer to the HW struct +* @dev_p: pointer to device capabilities structure +* @cap: capability element to parse +* +* Parse ICE_AQC_CAPS_VALID_FUNCTIONS for device capabilities. +*/ +static void +ice_parse_valid_functions_cap (struct ice_hw *hw,struct ice_hw_dev_caps *dev_p, +struct ice_aqc_list_caps_elem *cap) +{ +u32 number =le32_to_cpu (cap->number); + + dev_p->num_funcs =hweight32 (number); +ice_debug (hw,ICE_DBG_INIT ,"dev caps: num_funcs = %d\n" , + dev_p->num_funcs); +} + +/** +* ice_parse_vf_dev_caps - Parse ICE_AQC_CAPS_VF device caps +* @hw: pointer to the HW struct +* @dev_p: pointer to device capabilities structure +* @cap: capability element to parse +* +* Parse ICE_AQC_CAPS_VF for device capabilities. +*/ +static void +ice_parse_vf_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_p, +struct ice_aqc_list_caps_elem *cap) +{ +u32 number =le32_to_cpu (cap->number); + + dev_p->num_vfs_exposed = number; +ice_debug (hw,ICE_DBG_INIT ,"dev_caps: num_vfs_exposed = %d\n" , + dev_p->num_vfs_exposed); +} + +/** +* ice_parse_vsi_dev_caps - Parse ICE_AQC_CAPS_VSI device caps +* @hw: pointer to the HW struct +* @dev_p: pointer to device capabilities structure +* @cap: capability element to parse +* +* Parse ICE_AQC_CAPS_VSI for device capabilities. +*/ +static void +ice_parse_vsi_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_p, +struct ice_aqc_list_caps_elem *cap) +{ +u32 number =le32_to_cpu (cap->number); + + dev_p->num_vsi_allocd_to_host = number; +ice_debug (hw,ICE_DBG_INIT ,"dev caps: num_vsi_allocd_to_host = %d\n" , + dev_p->num_vsi_allocd_to_host); +} + +/** +* ice_parse_fdir_dev_caps - Parse ICE_AQC_CAPS_FD device caps +* @hw: pointer to the HW struct +* @dev_p: pointer to device capabilities structure +* @cap: capability element to parse +* +* Parse ICE_AQC_CAPS_FD for device capabilities. +*/ +static void +ice_parse_fdir_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_p, +struct ice_aqc_list_caps_elem *cap) +{ +u32 number =le32_to_cpu (cap->number); + + dev_p->num_flow_director_fltr = number; +ice_debug (hw,ICE_DBG_INIT ,"dev caps: num_flow_director_fltr = %d\n" , + dev_p->num_flow_director_fltr); +} + +/** +* ice_parse_dev_caps - Parse device capabilities +* @hw: pointer to the HW struct +* @dev_p: pointer to device capabilities structure +* @buf: buffer containing the device capability records +* @cap_count: the number of capabilities +* +* Helper device to parse device (0x000B) capabilities list. For +* capabilities shared between device and device, this relies on +* ice_parse_common_caps. +* +* Loop through the list of provided capabilities and extract the relevant +* data into the device capabilities structured. +*/ +static void +ice_parse_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_p, +void *buf,u32 cap_count) +{ +struct ice_aqc_list_caps_elem *cap_resp; +u32 i; + + cap_resp = (struct ice_aqc_list_caps_elem *)buf; + +memset (dev_p,0 ,sizeof (*dev_p)); + +for (i =0 ; i < cap_count; i++) { +u16 cap =le16_to_cpu (cap_resp[i].cap); +bool found; + + found =ice_parse_common_caps (hw, &dev_p->common_cap, + &cap_resp[i],"dev caps" ); + +switch (cap) { +case ICE_AQC_CAPS_VALID_FUNCTIONS : +ice_parse_valid_functions_cap (hw, dev_p, &cap_resp[i]);break ; -case ICE_AQC_CAPS_MSIX : - caps->num_msix_vectors = number; - caps->msix_vector_first_id = phys_id; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_msix_vectors = %d\n" , prefix, - caps->num_msix_vectors); -ice_debug (hw,ICE_DBG_INIT , -"%s: msix_vector_first_id = %d\n" , prefix, - caps->msix_vector_first_id); +case ICE_AQC_CAPS_VF : +ice_parse_vf_dev_caps (hw, dev_p, &cap_resp[i]);break ; -case ICE_AQC_CAPS_FD : -if (dev_p) { - dev_p->num_flow_director_fltr = number; -ice_debug (hw,ICE_DBG_INIT , -"%s: num_flow_director_fltr = %d\n" , - prefix, - dev_p->num_flow_director_fltr); - } -if (func_p) { -u32 reg_val, val; - - reg_val =rd32 (hw,GLQF_FD_SIZE ); - val = (reg_val &GLQF_FD_SIZE_FD_GSIZE_M ) >> -GLQF_FD_SIZE_FD_GSIZE_S ; - func_p->fd_fltr_guar = -ice_get_num_per_func (hw, val); - val = (reg_val &GLQF_FD_SIZE_FD_BSIZE_M ) >> -GLQF_FD_SIZE_FD_BSIZE_S ; - func_p->fd_fltr_best_effort = val; -ice_debug (hw,ICE_DBG_INIT , -"%s: fd_fltr_guar = %d\n" , - prefix, func_p->fd_fltr_guar); -ice_debug (hw,ICE_DBG_INIT , -"%s: fd_fltr_best_effort = %d\n" , - prefix, func_p->fd_fltr_best_effort); - } +case ICE_AQC_CAPS_VSI : +ice_parse_vsi_dev_caps (hw, dev_p, &cap_resp[i]);break ; -case ICE_AQC_CAPS_MAX_MTU : - caps->max_mtu = number; -ice_debug (hw,ICE_DBG_INIT ,"%s: max_mtu = %d\n" , - prefix, caps->max_mtu); +case ICE_AQC_CAPS_FD : +ice_parse_fdir_dev_caps (hw, dev_p, &cap_resp[i]);break ;default : -ice_debug (hw,ICE_DBG_INIT , -"%s: unknown capability[%d]: 0x%x\n" , prefix, - i, cap); +/* Don't list common capabilities as unknown */ +if (!found) +ice_debug (hw,ICE_DBG_INIT , +"dev caps: unknown capability[%d]: 0x%x\n" , + i, cap);break ; } } -/* Re-calculate capabilities that are dependent on the number of -* physical ports; i.e. some features are not supported or function -* differently on devices with more than 4 ports. -*/ -if (hw->dev_caps.num_funcs >4 ) { -/* Max 4 TCs per port */ - caps->maxtc =4 ; -ice_debug (hw,ICE_DBG_INIT , -"%s: maxtc = %d (based on #ports)\n" , prefix, - caps->maxtc); - } +ice_recalc_port_limited_caps (hw, &dev_p->common_cap); +} + +/** +* ice_parse_caps - parse function/device capabilities +* @hw: pointer to the HW struct +* @buf: pointer to a buffer containing function/device capability records +* @cap_count: number of capability records in the list +* @opc: type of capabilities list to parse +* +* Helper function to parse function(0x000a)/device(0x000b) capabilities list. +*/ +static void +ice_parse_caps (struct ice_hw *hw,void *buf,u32 cap_count, +enum ice_adminq_opc opc) +{ +if (!buf) +return ; + +if (opc == ice_aqc_opc_list_dev_caps) +ice_parse_dev_caps (hw, &hw->dev_caps, buf, cap_count); +else if (opc == ice_aqc_opc_list_func_caps) +ice_parse_func_caps (hw, &hw->func_caps, buf, cap_count); +else +ice_debug (hw,ICE_DBG_INIT ,"wrong opcode\n" ); }/**
Signature · 1 line
2.20.1
Bowers
PATCH 2/15 ice: split ice_parse_caps into separate functions
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 02/15] ice: splitice_parse_capsinto separate functionsFrom: Jacob Keller <[email protected]>
The
ice_parse_capsfunction is used to convert the capability block data coming from firmware into a structured format used by other parts of the code.The current implementation directly updates the
hw->func_capsandhw->dev_capsstructures. It is directly called from withinice_aq_discover_caps. This causes thediscover_capsfunction to have the side effect of modifying the hw capability structures, which is not intuitive.Split this function into
ice_parse_dev_capsandice_parse_func_caps. These functions will take a pointer to thedev_capsandfunc_capsrespectively. Also create anice_parse_common_capsfor sharing the capability logic that is common to device and function.
Quoted 8 lines
Doing so enables a future refactor to allow reading and parsing capabilities into a local caps structure instead of modifying the members of the hw structure directly.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 548 ++++++++++++++------ 1 file changed, 378 insertions(+), 170 deletions(-)
Tony Nguyen
maintainerPATCH 3/15 ice: split ice_discover_caps into two functions
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
Using the new ice_aq_list_caps and ice_parse_(dev|func)_caps functions, replace ice_discover_caps with two functions that each take a pointer to the dev_caps and func_caps structures respectively.
This makes the side effect of updating the hw->dev_caps and hw->func_caps obvious from reading the implementation of the function. Additionally, it opens the way for enabling reading of device capabilities outside of the initialization flow. By passing in a pointer, another caller will be able to read the capabilities without modifying the hw capabilities structures.
As there are no other callers, it is safe to now remove ice_aq_discover_caps and ice_parse_caps.
--- drivers/net/ethernet/intel/ice/ice_common.c | 94 +++++++++------------ 1 file changed, 39 insertions(+), 55 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +39 -55
@@ -52,7 +52,8 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw)* is returned in user specified buffer. Please interpret user specified * buffer as "manage_mac_read" response. * Response such as various MAC addresses are stored in HW struct (port.mac) -* ice_aq_discover_caps is expected to be called before this function is called. +* ice_discover_dev_caps is expected to be called before this function is +* called. */ static enum ice_status ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size,
@@ -2001,30 +2002,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,ice_recalc_port_limited_caps (hw, &dev_p->common_cap); } -/** -* ice_parse_caps - parse function/device capabilities -* @hw: pointer to the HW struct -* @buf: pointer to a buffer containing function/device capability records -* @cap_count: number of capability records in the list -* @opc: type of capabilities list to parse -* -* Helper function to parse function(0x000a)/device(0x000b) capabilities list. -*/ -static void -ice_parse_caps (struct ice_hw *hw,void *buf,u32 cap_count, -enum ice_adminq_opc opc) -{ -if (!buf) -return ; - -if (opc == ice_aqc_opc_list_dev_caps) -ice_parse_dev_caps (hw, &hw->dev_caps, buf, cap_count); -else if (opc == ice_aqc_opc_list_func_caps) -ice_parse_func_caps (hw, &hw->func_caps, buf, cap_count); -else -ice_debug (hw,ICE_DBG_INIT ,"wrong opcode\n" ); -} -/** * ice_aq_list_caps - query function/device capabilities * @hw: pointer to the HW struct
@@ -2068,47 +2045,52 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count, }/** -* ice_aq_discover_caps - query function/device capabilities -* @hw: pointer to the HW struct -* @buf: a virtual buffer to hold the capabilities -* @buf_size: Size of the virtual buffer -* @cap_count: cap count needed if AQ err==ENOMEM -* @opc: capabilities type to discover - pass in the command opcode -* @cd: pointer to command details structure or NULL -* -* Get the function(0x000a)/device(0x000b) capabilities description from -* the firmware. +* ice_discover_dev_caps - Read and extract device capabilities +* @hw: pointer to the hardware structure +* @dev_caps: pointer to device capabilities structure * -* NOTE: this function has the side effect of updating the hw->dev_caps or -* hw->func_caps by way of calling ice_parse_caps. +* Read the device capabilities and extract them into the dev_caps structure +* for later use. */ static enum ice_status -ice_aq_discover_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count, -enum ice_adminq_opc opc,struct ice_sq_cd *cd) +ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps) { -u32 local_cap_count =0 ;enum ice_status status; +u32 cap_count =0 ; +void *cbuf; - status =ice_aq_list_caps (hw, buf, buf_size, &local_cap_count, - opc, cd); + cbuf =kzalloc (ICE_AQ_MAX_BUF_LEN ,GFP_KERNEL ); +if (!cbuf) +return ICE_ERR_NO_MEMORY ; + +/* Although the driver doesn't know the number of capabilities the +* device will return, we can simply send a 4KB buffer, the maximum +* possible size that firmware can return. +*/ + cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); + + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_dev_caps,NULL );if (!status) -ice_parse_caps (hw, buf, local_cap_count, opc); -else if (hw->adminq.sq_last_status ==ICE_AQ_RC_ENOMEM ) - *cap_count = local_cap_count; +ice_parse_dev_caps (hw, dev_caps, cbuf, cap_count); +kfree (cbuf);return status; }/** -* ice_discover_caps - get info about the HW +* ice_discover_func_caps - Read and extract function capabilities * @hw: pointer to the hardware structure -* @opc: capabilities type to discover - pass in the command opcode +* @func_caps: pointer to function capabilities structure +* +* Read the function capabilities and extract them into the func_caps structure +* for later use. */ static enum ice_status -ice_discover_caps (struct ice_hw *hw,enum ice_adminq_opc opc) +ice_discover_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_caps) {enum ice_status status; -u32 cap_count; +u32 cap_count =0 ;void *cbuf; cbuf =kzalloc (ICE_AQ_MAX_BUF_LEN ,GFP_KERNEL );
@@ -2121,8 +2103,10 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)*/ cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); - status =ice_aq_discover_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, - opc,NULL ); + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_func_caps,NULL ); +if (!status) +ice_parse_func_caps (hw, func_caps, cbuf, cap_count);kfree (cbuf);return status;
@@ -2200,11 +2184,11 @@ enum ice_status ice_get_caps(struct ice_hw *hw) {enum ice_status status; - status =ice_discover_caps (hw, ice_aqc_opc_list_dev_caps); -if (!status) - status =ice_discover_caps (hw, ice_aqc_opc_list_func_caps); + status =ice_discover_dev_caps (hw, &hw->dev_caps); +if (status) +return status; -return status; +return ice_discover_func_caps (hw, &hw->func_caps); }/**
Signature · 1 line
2.20.1
Bowers
PATCH 3/15 ice: split ice_discover_caps into two functions
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 03/15] ice: splitice_discover_capsinto two functionsFrom: Jacob Keller <[email protected]>
Using the new
ice_aq_list_capsand ice_parse_(dev|func)_caps functions, replaceice_discover_capswith two functions that each take a pointer to thedev_capsandfunc_capsstructures respectively.This makes the side effect of updating the
hw->dev_capsandhw->func_capsobvious from reading the implementation of the function. Additionally, it opens the way for enabling reading of device capabilities outside of the initialization flow. By passing in a pointer, another caller will be able to read the capabilities without modifying the hw capabilities structures.
Quoted 7 lines
As there are no other callers, it is safe to now remove
ice_aq_discover_capsandice_parse_caps.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 94 +++++++++------------ 1 file changed, 39 insertions(+), 55 deletions(-)
Tony Nguyen
maintainerPATCH 4/15 ice: Add advanced power mgmt for WoL
In reply to Tony NguyenFrom: Akeem G Abodunrin <[email protected]>
Adds callbacks needed to support advanced power management for Wake on LAN. Also make ice_pf_state_is_nominal function available for all configurations not just CONFIG_PCI_IOV.
--- drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 56 +++ .../net/ethernet/intel/ice/ice_hw_autogen.h | 9 + 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 | 363 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_nvm.c | 3 +- drivers/net/ethernet/intel/ice/ice_nvm.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 25 -- 10 files changed, 458 insertions(+), 29 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -0
@@ -426,6 +426,8 @@ struct ice_pf {u16 empr_count;/* EMP reset count */ u16 pfr_count;/* PF reset count */ + u8 wol_ena : 1; /* software state of WoL */ +u32 wakeup_reason;/* last wakeup reason */ struct ice_hw_port_stats stats;struct ice_hw_port_stats stats_prev;struct ice_hw hw;
@@ -574,6 +576,7 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);void ice_print_link_msg (struct ice_vsi *vsi,bool isup);const char *ice_stat_str (enum ice_status stat_err);const char *ice_aq_str (enum ice_aq_err aq_err); +bool ice_is_wol_supported (struct ice_pf *pf);int ice_fdir_write_fltr (struct ice_pf *pf,struct ice_fdir_fltr *input,bool add,bool is_tun);
drivers/net/ethernet/intel/ice/ice_ethtool.c +56 -0
74 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +9 -0
@@ -389,6 +389,15 @@#define VSIQF_FD_SIZE (_VSI) (0x00462000 + ((_VSI) * 4))#define VSIQF_HKEY_MAX_INDEX 12#define VSIQF_HLUT_MAX_INDEX 15 +#define PFPM_APM 0x000B8080 +#define PFPM_APM_APME_M BIT(0) +#define PFPM_WUFC 0x0009DC00 +#define PFPM_WUFC_MAG_M BIT(1) +#define PFPM_WUS 0x0009DB80 +#define PFPM_WUS_LNKC_M BIT(0) +#define PFPM_WUS_MAG_M BIT(1) +#define PFPM_WUS_MNG_M BIT(3) +#define PFPM_WUS_FW_RST_WK_M BIT(31)#define VFINT_DYN_CTLN (_i) (0x00003800 + ((_i) * 4))#define VFINT_DYN_CTLN_CLEARPBA_M BIT(1)#define PRTRPB_RDPC 0x000AC260
drivers/net/ethernet/intel/ice/ice_lib.c +24 -0
@@ -1498,6 +1498,30 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) vsi_num, ice_stat_str(status)); } +/** +* ice_pf_state_is_nominal - checks the PF for nominal state +* @pf: pointer to PF to check +* +* Check the PF's state for a collection of bits that would indicate +* the PF is in a state that would inhibit normal operation for +* driver functionality. +* +* Returns true if PF is in a nominal state, false otherwise +*/ +bool ice_pf_state_is_nominal (struct ice_pf *pf) +{ + DECLARE_BITMAP(check_bits, __ICE_STATE_NBITS) = { 0 }; + +if (!pf) +return false; + +bitmap_set (check_bits,0 , __ICE_STATE_NOMINAL_CHECK_BITS); +if (bitmap_intersects (pf->state, check_bits, __ICE_STATE_NBITS)) +return false; + +return true; +} +/** * ice_update_eth_stats - Update VSI-specific ethernet statistics counters * @vsi: the VSI to be updated
drivers/net/ethernet/intel/ice/ice_lib.h +2 -0
@@ -8,6 +8,8 @@const char *ice_vsi_type_str (enum ice_vsi_type vsi_type); +bool ice_pf_state_is_nominal (struct ice_pf *pf); +void ice_update_eth_stats (struct ice_vsi *vsi);int ice_vsi_cfg_rxqs (struct ice_vsi *vsi);
drivers/net/ethernet/intel/ice/ice_main.c +361 -2
432 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.c +1 -2
@@ -172,8 +172,7 @@ void ice_release_nvm(struct ice_hw *hw)* * Reads one 16 bit word from the Shadow RAM using the ice_read_sr_word_aq. */ -static enum ice_status -ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data) +enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data) {enum ice_status status;
drivers/net/ethernet/intel/ice/ice_nvm.h +1 -0
@@ -13,4 +13,5 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,enum ice_status ice_read_pba_string (struct ice_hw *hw,u8 *pba_num,u32 pba_num_size);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 +1 -0
@@ -736,6 +736,7 @@ enum ice_sw_fwd_act_type {/* Checksum and Shadow RAM pointers */ #define ICE_SR_BOOT_CFG_PTR 0x132 +#define ICE_SR_NVM_WOL_CFG 0x19#define ICE_NVM_OROM_VER_OFF 0x02#define ICE_SR_PBA_BLOCK_PTR 0x16#define ICE_SR_NVM_DEV_STARTER_VER 0x18
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +0 -25
@@ -1927,31 +1927,6 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)return ret; } -/** -* ice_pf_state_is_nominal - checks the PF for nominal state -* @pf: pointer to PF to check -* -* Check the PF's state for a collection of bits that would indicate -* the PF is in a state that would inhibit normal operation for -* driver functionality. -* -* Returns true if PF is in a nominal state. -* Returns false otherwise -*/ -static bool ice_pf_state_is_nominal (struct ice_pf *pf) -{ - DECLARE_BITMAP(check_bits, __ICE_STATE_NBITS) = { 0 }; - -if (!pf) -return false; - -bitmap_set (check_bits,0 , __ICE_STATE_NOMINAL_CHECK_BITS); -if (bitmap_intersects (pf->state, check_bits, __ICE_STATE_NBITS)) -return false; - -return true; -} -/** * ice_pci_sriov_ena - Enable or change number of VFs * @pf: pointer to the PF structure
Signature · 1 line
2.20.1
Bowers
PATCH 4/15 ice: Add advanced power mgmt for WoL
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 04/15] ice: Add advanced power mgmt for WoLFrom: Akeem G Abodunrin <[email protected]>
Adds callbacks needed to support advanced power management for Wake on LAN.
Also makeice_pf_state_is_nominalfunction available for all configurations not justCONFIG_PCI_IOV.Signed-off-by Akeem G Abodunrin <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
Quoted 12 lines
--- drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 56 +++ .../net/ethernet/intel/ice/ice_hw_autogen.h | 9 + 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 | 363 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_nvm.c | 3 +- drivers/net/ethernet/intel/ice/ice_nvm.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 25 -- 10 files changed, 458 insertions(+), 29 deletions(-)
Tony Nguyen
maintainerPATCH 5/15 ice: refactor FC functions
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
Create a helper function for configuring requested flow control so that it can be utilized by other functions looking to configure flow control settings. Utilize the existing helper ice_copy_phy_caps_to_cfg() to copy a PHY capability to configuration instead duplicating the code for it.
--- drivers/net/ethernet/intel/ice/ice_common.c | 75 +++++++++++++-------- 1 file changed, 46 insertions(+), 29 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +46 -29
@@ -2515,28 +2515,19 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) }/** -* ice_set_fc -* @pi: port information structure -* @aq_failures: pointer to status code, specific to ice_set_fc routine -* @ena_auto_link_update: enable automatic link update -* -* Set the requested flow control mode. +* ice_cfg_phy_fc - Configure PHY FC data based on FC mode +* @cfg: PHY configuration data to set FC mode +* @req_mode: FC mode to configure */ -enum ice_status -ice_set_fc (struct ice_port_info *pi,u8 *aq_failures,bool ena_auto_link_update) +static enum ice_status +ice_cfg_phy_fc (struct ice_aqc_set_phy_cfg_data *cfg,enum ice_fc_mode req_mode) { -struct ice_aqc_set_phy_cfg_data cfg = {0 }; -struct ice_aqc_get_phy_caps_data *pcaps; -enum ice_status status;u8 pause_mask =0x0 ; -struct ice_hw *hw; -if (!pi) -return ICE_ERR_PARAM ; - hw = pi->hw; - *aq_failures =ICE_SET_FC_AQ_FAIL_NONE ; +if (!cfg) +return ICE_ERR_BAD_PTR ; -switch (pi->fc.req_mode) { +switch (req_mode) {case ICE_FC_FULL : pause_mask |=ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |=ICE_AQC_PHY_EN_RX_LINK_PAUSE ;
@@ -2551,6 +2542,38 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)break ; } +/* clear the old pause settings */ + cfg->caps &= ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE | +ICE_AQC_PHY_EN_RX_LINK_PAUSE ); + +/* set the new capabilities */ + cfg->caps |= pause_mask; + +return 0 ; +} + +/** +* ice_set_fc +* @pi: port information structure +* @aq_failures: pointer to status code, specific to ice_set_fc routine +* @ena_auto_link_update: enable automatic link update +* +* Set the requested flow control mode. +*/ +enum ice_status +ice_set_fc (struct ice_port_info *pi,u8 *aq_failures,bool ena_auto_link_update) +{ +struct ice_aqc_set_phy_cfg_data cfg = {0 }; +struct ice_aqc_get_phy_caps_data *pcaps; +enum ice_status status; +struct ice_hw *hw; + +if (!pi) +return ICE_ERR_BAD_PTR ; + + *aq_failures =0 ; + hw = pi->hw; + pcaps =devm_kzalloc (ice_hw_to_dev (hw),sizeof (*pcaps),GFP_KERNEL );if (!pcaps)return ICE_ERR_NO_MEMORY ;
@@ -2563,12 +2586,12 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update) goto out; } -/* clear the old pause settings */ - cfg.caps = pcaps->caps & ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE | -ICE_AQC_PHY_EN_RX_LINK_PAUSE ); +ice_copy_phy_caps_to_cfg (pcaps, &cfg); -/* set the new capabilities */ - cfg.caps |= pause_mask; +/* Configure the set PHY data */ + status =ice_cfg_phy_fc (&cfg, pi->fc.req_mode); +if (status) + goto out;/* If the capabilities have changed, then set the new config */ if (cfg.caps != pcaps->caps) {
@@ -2577,13 +2600,6 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)/* Auto restart link so settings take effect */ if (ena_auto_link_update) cfg.caps |=ICE_AQ_PHY_ENA_AUTO_LINK_UPDT ; -/* Copy over all the old settings */ - cfg.phy_type_high = pcaps->phy_type_high; - cfg.phy_type_low = pcaps->phy_type_low; - cfg.low_power_ctrl = pcaps->low_power_ctrl; - cfg.eee_cap = pcaps->eee_cap; - cfg.eeer_value = pcaps->eeer_value; - cfg.link_fec_opt = pcaps->link_fec_options; status =ice_aq_set_phy_cfg (hw, pi->lport, &cfg,NULL );if (status) {
@@ -2629,6 +2645,7 @@ ice_copy_phy_caps_to_cfg(struct ice_aqc_get_phy_caps_data *caps,if (!caps || !cfg)return ; +memset (cfg,0 ,sizeof (*cfg)); cfg->phy_type_low = caps->phy_type_low; cfg->phy_type_high = caps->phy_type_high; cfg->caps = caps->caps;
Signature · 1 line
2.20.1
Bowers
PATCH 5/15 ice: refactor FC functions
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 05/15] ice: refactor FC functionsFrom: Paul Greenwalt <[email protected]>
Create a helper function for configuring requested flow control so that it can be utilized by other functions looking to configure flow control settings. Utilize the existing helper
ice_copy_phy_caps_to_cfg()to copy a PHY capability to configuration instead duplicating the code for it.
Quoted 5 lines
Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 75 +++++++++++++-------- 1 file changed, 46 insertions(+), 29 deletions(-)
Tony Nguyen
maintainerPATCH 6/15 ice: move auto FEC checks into ice_cfg_phy_fec()
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
The call to ice_cfg_phy_fec() requires the caller to perform certain actions before calling it. Instead of imposing these preconditions move the operations into the function and perform them ourselves.
Also, fix some style issues in nearby touched code.
--- drivers/net/ethernet/intel/ice/ice_common.c | 43 ++++++++++++++++---- drivers/net/ethernet/intel/ice/ice_common.h | 5 ++- drivers/net/ethernet/intel/ice/ice_ethtool.c | 31 ++------------ 3 files changed, 40 insertions(+), 39 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +34 -9
@@ -2657,25 +2657,41 @@ ice_copy_phy_caps_to_cfg(struct ice_aqc_get_phy_caps_data *caps,/** * ice_cfg_phy_fec - Configure PHY FEC data based on FEC mode +* @pi: port information structure * @cfg: PHY configuration data to set FEC mode * @fec: FEC mode to configure -* -* Caller should copy ice_aqc_get_phy_caps_data.caps ICE_AQC_PHY_EN_AUTO_FEC -* (bit 7) and ice_aqc_get_phy_caps_data.link_fec_options to cfg.caps -* ICE_AQ_PHY_ENA_AUTO_FEC (bit 7) and cfg.link_fec_options before calling. */ -void -ice_cfg_phy_fec (struct ice_aqc_set_phy_cfg_data *cfg,enum ice_fec_mode fec) +enum ice_status +ice_cfg_phy_fec (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg, +enum ice_fec_mode fec) { +struct ice_aqc_get_phy_caps_data *pcaps; +enum ice_status status; + +if (!pi || !cfg) +return ICE_ERR_BAD_PTR ; + + pcaps =kzalloc (sizeof (*pcaps),GFP_KERNEL ); +if (!pcaps) +return ICE_ERR_NO_MEMORY ; + + status =ice_aq_get_phy_caps (pi, false,ICE_AQC_REPORT_TOPO_CAP , pcaps, +NULL ); +if (status) + goto out; + + cfg->caps |= pcaps->caps &ICE_AQC_PHY_EN_AUTO_FEC ; + cfg->link_fec_opt = pcaps->link_fec_options; +switch (fec) {case ICE_FEC_BASER :/* Clear RS bits, and AND BASE-R ability * bits and OR request bits. */ cfg->link_fec_opt &=ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | -ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN ; +ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN ; cfg->link_fec_opt |=ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | -ICE_AQC_PHY_FEC_25G_KR_REQ ; +ICE_AQC_PHY_FEC_25G_KR_REQ ;break ;case ICE_FEC_RS :/* Clear BASE-R bits, and AND RS ability
@@ -2683,7 +2699,7 @@ ice_cfg_phy_fec(struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec)*/ cfg->link_fec_opt &=ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN ; cfg->link_fec_opt |=ICE_AQC_PHY_FEC_25G_RS_528_REQ | -ICE_AQC_PHY_FEC_25G_RS_544_REQ ; +ICE_AQC_PHY_FEC_25G_RS_544_REQ ;break ;case ICE_FEC_NONE :/* Clear all FEC option bits. */
@@ -2692,8 +2708,17 @@ ice_cfg_phy_fec(struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec)case ICE_FEC_AUTO :/* AND auto FEC bit, and all caps bits. */ cfg->caps &=ICE_AQC_PHY_CAPS_MASK ; + cfg->link_fec_opt |= pcaps->link_fec_options; +break ; +default : + status =ICE_ERR_PARAM ;break ; } + +out: +kfree (pcaps); + +return status; }/**
drivers/net/ethernet/intel/ice/ice_common.h +3 -2
@@ -103,8 +103,9 @@ ice_aq_set_phy_cfg(struct ice_hw *hw, u8 lport,enum ice_status ice_set_fc (struct ice_port_info *pi,u8 *aq_failures,bool ena_auto_link_update); -void -ice_cfg_phy_fec (struct ice_aqc_set_phy_cfg_data *cfg,enum ice_fec_mode fec); +enum ice_status +ice_cfg_phy_fec (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg, +enum ice_fec_mode fec);void ice_copy_phy_caps_to_cfg (struct ice_aqc_get_phy_caps_data *caps,struct ice_aqc_set_phy_cfg_data *cfg);
drivers/net/ethernet/intel/ice/ice_ethtool.c +3 -28
@@ -968,7 +968,6 @@ static int ice_set_fec_cfg(struct net_device *netdev, enum ice_fec_mode req_fec)struct ice_aqc_set_phy_cfg_data config = {0 };struct ice_aqc_get_phy_caps_data *caps;struct ice_vsi *vsi = np->vsi; -u8 sw_cfg_caps, sw_cfg_fec;struct ice_port_info *pi;enum ice_status status;int err =0 ;
@@ -997,36 +996,12 @@ static int ice_set_fec_cfg(struct net_device *netdev, enum ice_fec_mode req_fec)/* Copy SW configuration returned from PHY caps to PHY config */ ice_copy_phy_caps_to_cfg (caps, &config); - sw_cfg_caps = caps->caps; - sw_cfg_fec = caps->link_fec_options; -/* Get toloplogy caps, then copy PHY FEC topoloy caps to PHY config */ -memset (caps,0 ,sizeof (*caps)); +ice_cfg_phy_fec (pi, &config, req_fec); + config.caps |=ICE_AQ_PHY_ENA_AUTO_LINK_UPDT ; - status =ice_aq_get_phy_caps (pi, false,ICE_AQC_REPORT_TOPO_CAP , - caps,NULL ); -if (status) { +if (ice_aq_set_phy_cfg (pi->hw, pi->lport, &config,NULL )) err = -EAGAIN ; - goto done; - } - - config.caps |= (caps->caps &ICE_AQC_PHY_EN_AUTO_FEC ); - config.link_fec_opt = caps->link_fec_options; - -ice_cfg_phy_fec (&config, req_fec); - -/* If FEC mode has changed, then set PHY configuration and enable AN. */ -if ((config.caps &ICE_AQ_PHY_ENA_AUTO_FEC ) != - (sw_cfg_caps &ICE_AQC_PHY_EN_AUTO_FEC ) || - config.link_fec_opt != sw_cfg_fec) { -if (caps->caps &ICE_AQC_PHY_AN_MODE ) - config.caps |=ICE_AQ_PHY_ENA_AUTO_LINK_UPDT ; - - status =ice_aq_set_phy_cfg (pi->hw, pi->lport, &config,NULL ); - -if (status) - err = -EAGAIN ; - } done:kfree (caps);
Signature · 1 line
2.20.1
Bowers
PATCH 6/15 ice: move auto FEC checks into ice_cfg_phy_fec()
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 06/15] ice: move auto FEC checks intoice_cfg_phy_fec()From: Paul Greenwalt <[email protected]>
The call to
ice_cfg_phy_fec()requires the caller to perform certain actions before calling it. Instead of imposing these preconditions move the operations into the function and perform them ourselves.Also, fix some style issues in nearby touched code.
Quoted 8 lines
Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Chinh T Cao <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 43 ++++++++++++++++---- drivers/net/ethernet/intel/ice/ice_common.h | 5 ++- drivers/net/ethernet/intel/ice/ice_ethtool.c | 31 ++------------ 3 files changed, 40 insertions(+), 39 deletions(-)
Tony Nguyen
maintainerPATCH 7/15 ice: restore PHY settings on media insertion
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
After the transition from no media to media FW will clear the set-phy-cfg data set by the user. Save initial PHY settings and any settings later requested by the user and use that data to restore PHY settings on media insertion. Since PHY configuration is now being stored, replace calls that were calling FW to get the configuration with the saved copy.
--- drivers/net/ethernet/intel/ice/ice.h | 3 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 145 ++++++++- drivers/net/ethernet/intel/ice/ice_common.h | 14 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 120 +++---- drivers/net/ethernet/intel/ice/ice_main.c | 308 ++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_type.h | 21 ++ 7 files changed, 517 insertions(+), 95 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -0
@@ -224,6 +224,7 @@ enum ice_state { __ICE_OICR_INTR_DIS,/* Global OICR interrupt disabled */ __ICE_MDD_VF_PRINT_PENDING,/* set when MDD event handle */ __ICE_VF_RESETS_DISABLED,/* disable resets during ice_remove */ + __ICE_PHY_INIT_COMPLETE, __ICE_FD_VF_FLUSH_CTX,/* set at FD Rx IRQ or timeout */ __ICE_STATE_NBITS /* must be last */ };
@@ -442,6 +443,8 @@ struct ice_pf {u32 sw_int_count;struct ice_dcf dcf; +__le64 nvm_phy_type_lo;/* NVM PHY type low */ +__le64 nvm_phy_type_hi;/* NVM PHY type high */ u64 supported_rxdids;/* bitmap for supported RXDID */ };
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -1147,6 +1147,7 @@ struct ice_aqc_get_link_status_data {#define ICE_AQ_LINK_PWR_QSFP_CLASS_3 2#define ICE_AQ_LINK_PWR_QSFP_CLASS_4 3__le16 link_speed; +#define ICE_AQ_LINK_SPEED_M 0x7FF#define ICE_AQ_LINK_SPEED_10MB BIT(0)#define ICE_AQ_LINK_SPEED_100MB BIT(1)#define ICE_AQ_LINK_SPEED_1000MB BIT(2)
drivers/net/ethernet/intel/ice/ice_common.c +135 -10
217 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +11 -3
@@ -98,18 +98,26 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags, struct ice_sq_cd *cd);enum ice_status ice_clear_pf_cfg (struct ice_hw *hw);enum ice_status -ice_aq_set_phy_cfg (struct ice_hw *hw,u8 lport, +ice_aq_set_phy_cfg (struct ice_hw *hw,struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg,struct ice_sq_cd *cd); +enum ice_fc_mode ice_caps_to_fc_mode (u8 caps); +enum ice_fec_mode ice_caps_to_fec_mode (u8 caps,u8 fec_options);enum ice_status ice_set_fc (struct ice_port_info *pi,u8 *aq_failures,bool ena_auto_link_update);enum ice_status -ice_cfg_phy_fec (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg, -enum ice_fec_mode fec); +ice_cfg_phy_fc (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg, +enum ice_fc_mode fc); +bool +ice_phy_caps_equals_cfg (struct ice_aqc_get_phy_caps_data *caps, +struct ice_aqc_set_phy_cfg_data *cfg);void ice_copy_phy_caps_to_cfg (struct ice_aqc_get_phy_caps_data *caps,struct ice_aqc_set_phy_cfg_data *cfg);enum ice_status +ice_cfg_phy_fec (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg, +enum ice_fec_mode fec); +enum ice_status ice_aq_set_link_restart_an (struct ice_port_info *pi,bool ena_link,struct ice_sq_cd *cd);enum ice_status
drivers/net/ethernet/intel/ice/ice_ethtool.c +64 -56
200 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +282 -26
382 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +21 -0
@@ -87,6 +87,12 @@ enum ice_fc_mode {ICE_FC_DFLT }; +enum ice_phy_cache_mode { +ICE_FC_MODE =0 , +ICE_SPEED_MODE , +ICE_FEC_MODE +}; +enum ice_fec_mode {ICE_FEC_NONE =0 ,ICE_FEC_RS ,
@@ -94,6 +100,14 @@ enum ice_fec_mode {ICE_FEC_AUTO }; +struct ice_phy_cache_mode_data { +union { +enum ice_fec_mode curr_user_fec_req; +enum ice_fc_mode curr_user_fc_req; +u16 curr_user_speed_req; + } data; +}; +enum ice_set_fc_aq_failures {ICE_SET_FC_AQ_FAIL_NONE =0 ,ICE_SET_FC_AQ_FAIL_GET ,
@@ -160,6 +174,13 @@ struct ice_phy_info {u64 phy_type_high;enum ice_media_type media_type;u8 get_link_info; +/* Please refer to struct ice_aqc_get_link_status_data to get +* detail of enable bit in curr_user_speed_req +*/ +u16 curr_user_speed_req; +enum ice_fec_mode curr_user_fec_req; +enum ice_fc_mode curr_user_fc_req; +struct ice_aqc_set_phy_cfg_data curr_user_phy_cfg; };/* protocol enumeration for filters */
Signature · 1 line
2.20.1
Bowers
PATCH 7/15 ice: restore PHY settings on media insertion
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 07/15] ice: restore PHY settings on media insertionFrom: Paul Greenwalt <[email protected]>
After the transition from no media to media FW will clear the set-phy-cfg data set by the user. Save initial PHY settings and any settings later requested by the user and use that data to restore PHY settings on media insertion. Since PHY configuration is now being stored, replace calls that were calling FW to get the configuration with the saved copy.
Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Chinh T Cao <[email protected]>Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
Quoted 9 lines
--- drivers/net/ethernet/intel/ice/ice.h | 3 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 145 ++++++++- drivers/net/ethernet/intel/ice/ice_common.h | 14 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 120 +++---- drivers/net/ethernet/intel/ice/ice_main.c | 308 ++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_type.h | 21 ++ 7 files changed, 517 insertions(+), 95 deletions(-)
Tony Nguyen
maintainerPATCH 8/15 ice: add link lenient and default override support
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
Adds functions to check for link override firmware support and get the override settings for a port. The previously supported/default link mode was strict mode.
In strict mode link is configured based on get PHY capabilities PHY types with media.
Lenient mode is now the default link mode. In lenient mode the link is configured based on get PHY capabilities PHY types without media. This allows the user to configure link that the media does not report. Limit the minimum supported link mode to 25G for devices that support 100G, and 1G for devices that support less than 100G.
Default override is only supported in lenient mode. If default override is supported and enabled, then default override values are used for configuring speed and FEC. Default override provide persistent link settings in the NVM.
--- drivers/net/ethernet/intel/ice/ice.h | 3 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_common.c | 170 +++++- drivers/net/ethernet/intel/ice/ice_common.h | 8 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 519 +++++++++++------- drivers/net/ethernet/intel/ice/ice_main.c | 99 +++- drivers/net/ethernet/intel/ice/ice_nvm.c | 2 +- drivers/net/ethernet/intel/ice/ice_nvm.h | 3 + drivers/net/ethernet/intel/ice/ice_type.h | 35 ++ 9 files changed, 628 insertions(+), 216 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -0
@@ -224,6 +224,7 @@ enum ice_state { __ICE_OICR_INTR_DIS,/* Global OICR interrupt disabled */ __ICE_MDD_VF_PRINT_PENDING,/* set when MDD event handle */ __ICE_VF_RESETS_DISABLED,/* disable resets during ice_remove */ + __ICE_LINK_DEFAULT_OVERRIDE_PENDING, __ICE_PHY_INIT_COMPLETE, __ICE_FD_VF_FLUSH_CTX,/* set at FD Rx IRQ or timeout */ __ICE_STATE_NBITS/* must be last */
@@ -367,6 +368,7 @@ enum ice_pf_flags {ICE_FLAG_LEGACY_RX ,ICE_FLAG_VF_TRUE_PROMISC_ENA ,ICE_FLAG_MDD_AUTO_RESET_VF , +ICE_FLAG_LINK_LENIENT_MODE_ENA , ICE_PF_FLAGS_NBITS /* must be last */ };
@@ -445,6 +447,7 @@ struct ice_pf {struct ice_dcf dcf;__le64 nvm_phy_type_lo;/* NVM PHY type low */ __le64 nvm_phy_type_hi;/* NVM PHY type high */ +struct ice_link_default_override_tlv link_dflt_override;u64 supported_rxdids;/* bitmap for supported RXDID */ };
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +3 -2
@@ -983,7 +983,8 @@ struct ice_aqc_get_phy_caps_data {#define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN BIT(6)#define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN BIT(7)#define ICE_AQC_PHY_FEC_MASK ICE_M(0xdf, 0) -u8 rsvd1;/* Byte 35 reserved */ +u8 module_compliance_enforcement; +#define ICE_AQC_MOD_ENFORCE_STRICT_MODE BIT(0)u8 extended_compliance_code;#define ICE_MODULE_TYPE_TOTAL_BYTE 3u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE ];
@@ -1036,7 +1037,7 @@ struct ice_aqc_set_phy_cfg_data {__le16 eee_cap;/* Value from ice_aqc_get_phy_caps */ __le16 eeer_value;u8 link_fec_opt;/* Use defines from ice_aqc_get_phy_caps */ -u8 rsvd1; +u8 module_compliance_enforcement; };/* Set MAC Config command data structure (direct 0x0603) */
drivers/net/ethernet/intel/ice/ice_common.c +166 -4
211 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +7 -1
@@ -100,6 +100,11 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw);enum ice_status ice_aq_set_phy_cfg (struct ice_hw *hw,struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg,struct ice_sq_cd *cd); +bool ice_fw_supports_link_override (struct ice_hw *hw); +enum ice_status +ice_get_link_default_override (struct ice_link_default_override_tlv *ldo, +struct ice_port_info *pi); +enum ice_fc_mode ice_caps_to_fc_mode (u8 caps);enum ice_fec_mode ice_caps_to_fec_mode (u8 caps,u8 fec_options);enum ice_status
@@ -112,7 +117,8 @@ bool ice_phy_caps_equals_cfg(struct ice_aqc_get_phy_caps_data *caps, struct ice_aqc_set_phy_cfg_data *cfg);void -ice_copy_phy_caps_to_cfg (struct ice_aqc_get_phy_caps_data *caps, +ice_copy_phy_caps_to_cfg (struct ice_port_info *pi, +struct ice_aqc_get_phy_caps_data *caps,struct ice_aqc_set_phy_cfg_data *cfg); enum ice_status ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
drivers/net/ethernet/intel/ice/ice_ethtool.c +319 -200
625 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +91 -8
143 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.c +1 -1
@@ -196,7 +196,7 @@ enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)* Area (PFA) and returns the TLV pointer and length. The caller can * use these to read the variable length TLV value. */ -static enum ice_status +enum ice_status ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len,u16 module_type) {
drivers/net/ethernet/intel/ice/ice_nvm.h +3 -0
@@ -11,6 +11,9 @@ enum ice_status ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, bool read_shadow_ram);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_read_pba_string (struct ice_hw *hw,u8 *pba_num,u32 pba_num_size);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);
drivers/net/ethernet/intel/ice/ice_type.h +35 -0
@@ -118,6 +118,7 @@ enum ice_set_fc_aq_failures {/* Various MAC types */ enum ice_mac_type {ICE_MAC_UNKNOWN =0 , +ICE_MAC_E810 ,ICE_MAC_GENERIC , };
@@ -332,6 +333,28 @@ struct ice_nvm_info {u8 blank_nvm_mode;/* is NVM empty (no FW present) */ }; +struct ice_link_default_override_tlv { +u8 options; +#define ICE_LINK_OVERRIDE_OPT_M 0x3F +#define ICE_LINK_OVERRIDE_STRICT_MODE BIT(0) +#define ICE_LINK_OVERRIDE_EPCT_DIS BIT(1) +#define ICE_LINK_OVERRIDE_PORT_DIS BIT(2) +#define ICE_LINK_OVERRIDE_EN BIT(3) +#define ICE_LINK_OVERRIDE_AUTO_LINK_DIS BIT(4) +#define ICE_LINK_OVERRIDE_EEE_EN BIT(5) +u8 phy_config; +#define ICE_LINK_OVERRIDE_PHY_CFG_S 8 +#define ICE_LINK_OVERRIDE_PHY_CFG_M (0xC3 << ICE_LINK_OVERRIDE_PHY_CFG_S) +#define ICE_LINK_OVERRIDE_PAUSE_M 0x3 +#define ICE_LINK_OVERRIDE_LESM_EN BIT(6) +#define ICE_LINK_OVERRIDE_AUTO_FEC_EN BIT(7) +u8 fec_options; +#define ICE_LINK_OVERRIDE_FEC_OPT_M 0xFF +u8 rsvd1; +u64 phy_type_low; +u64 phy_type_high; +}; +#define ICE_NVM_VER_LEN 32/* netlist version information */
@@ -483,6 +506,7 @@ struct ice_dcb_app_priority_table {#define ICE_APP_SEL_ETHTYPE 0x1#define ICE_APP_SEL_TCPIP 0x2#define ICE_CEE_APP_SEL_ETHTYPE 0x0 +#define ICE_SR_LINK_DEFAULT_OVERRIDE_PTR 0x134#define ICE_CEE_APP_SEL_TCPIP 0x1struct ice_dcbx_cfg {
@@ -775,6 +799,17 @@ enum ice_sw_fwd_act_type {#define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)#define ICE_SR_PFA_PTR 0x40#define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800 + +/* Link override related */ +#define ICE_SR_PFA_LINK_OVERRIDE_WORDS 10 +#define ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS 4 +#define ICE_SR_PFA_LINK_OVERRIDE_OFFSET 2 +#define ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET 1 +#define ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET 2 +#define ICE_FW_API_LINK_OVERRIDE_MAJ 1 +#define ICE_FW_API_LINK_OVERRIDE_MIN 5 +#define ICE_FW_API_LINK_OVERRIDE_PATCH 2 +#define ICE_SR_WORDS_IN_1KB 512/* Hash redirection LUT for VSI - maximum array size */
Signature · 1 line
2.20.1
Bowers
PATCH 8/15 ice: add link lenient and default override support
Quoted 31 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 08/15] ice: add link lenient and default override supportFrom: Paul Greenwalt <[email protected]>
Adds functions to check for link override firmware support and get the override settings for a port. The previously supported/default link mode was strict mode.
In strict mode link is configured based on get PHY capabilities PHY types with media.
Lenient mode is now the default link mode. In lenient mode the link is configured based on get PHY capabilities PHY types without media. This allows the user to configure link that the media does not report. Limit the minimum supported link mode to 25G for devices that support 100G, and 1G for devices that support less than 100G.
Default override is only supported in lenient mode. If default override is supported and enabled, then default override values are used for configuring speed and FEC. Default override provide persistent link settings in the NVM.
Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Evan Swanson <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice.h | 3 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_common.c | 170 +++++- drivers/net/ethernet/intel/ice/ice_common.h | 8 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 519 +++++++++++------- drivers/net/ethernet/intel/ice/ice_main.c | 99 +++- drivers/net/ethernet/intel/ice/ice_nvm.c | 2 +- drivers/net/ethernet/intel/ice/ice_nvm.h | 3 + drivers/net/ethernet/intel/ice/ice_type.h | 35 ++ 9 files changed, 628 insertions(+), 216 deletions(-)
Tony Nguyen
maintainerPATCH 9/15 ice: support Total Port Shutdown on devices that support it
In reply to Tony NguyenFrom: Bruce Allan <[email protected]>
When the Port Disable bit is set in the Link Default Override Mask TLV PFA module in the NVM, Total Port Shutdown mode is supported and enabled. In this mode, the driver should act as if the link-down-on-close ethool private flag is always enabled and dis-allow any change to that flag.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 14 +++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -362,6 +362,7 @@ enum ice_pf_flags {ICE_FLAG_FD_ENA ,ICE_FLAG_ADV_FEATURES ,ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA , +ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA ,ICE_FLAG_NO_MEDIA ,ICE_FLAG_FW_LLDP_AGENT , ICE_FLAG_ETHTOOL_CTXT, /* set when ethtool holds RTNL lock */
drivers/net/ethernet/intel/ice/ice_ethtool.c +12 -0
@@ -1196,6 +1196,17 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)bitmap_xor (change_flags, pf->flags, orig_flags,ICE_PF_FLAGS_NBITS ); +/* Do not allow change to link-down-on-close when Total Port Shutdown +* is enabled. +*/ +if (test_bit (ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA , change_flags) && +test_bit (ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA , pf->flags)) { +dev_err (dev,"Setting link-down-on-close not supported on this port\n" ); +set_bit (ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA , pf->flags); + ret = -EINVAL ; + goto ethtool_exit; + } +if (test_bit (ICE_FLAG_FW_LLDP_AGENT , change_flags)) {if (!test_bit (ICE_FLAG_FW_LLDP_AGENT , pf->flags)) {enum ice_status status;
@@ -1283,6 +1294,7 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)change_bit (ICE_FLAG_VF_TRUE_PROMISC_ENA , pf->flags); ret = -EAGAIN ; } +ethtool_exit:clear_bit (ICE_FLAG_ETHTOOL_CTXT , pf->flags);return ret; }
drivers/net/ethernet/intel/ice/ice_main.c +13 -1
@@ -1446,6 +1446,8 @@ static int ice_init_nvm_phy_type(struct ice_port_info *pi)/** * ice_init_link_dflt_override - Initialize link default override * @pi: port info structure +* +* Initialize link default override and PHY total port shutdown during probe */ static void ice_init_link_dflt_override (struct ice_port_info *pi) {
@@ -1453,7 +1455,17 @@ static void ice_init_link_dflt_override(struct ice_port_info *pi)struct ice_pf *pf = pi->hw->back; ldo = &pf->link_dflt_override; -ice_get_link_default_override (ldo, pi); +if (ice_get_link_default_override (ldo, pi)) +return ; + +if (!(ldo->options &ICE_LINK_OVERRIDE_PORT_DIS )) +return ; + +/* Enable Total Port Shutdown (override/replace link-down-on-close +* ethtool private flag) for ports with Port Disable bit set. +*/ +set_bit (ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA , pf->flags); +set_bit (ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA , pf->flags); }/**
Signature · 1 line
2.20.1
Bowers
PATCH 9/15 ice: support Total Port Shutdown on devices that support it
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 09/15] ice: support Total Port Shutdown on devices that support itFrom: Bruce Allan <[email protected]>
When the Port Disable bit is set in the Link Default Override Mask TLV PFA module in the NVM, Total Port Shutdown mode is supported and enabled. In this mode, the driver should act as if the link-down-on-close ethool private flag is always enabled and dis-allow any change to that flag.
Quoted 8 lines
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 14 +++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 10/15 ice: add ice_aq_get_phy_caps() debug logs
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
Add debug logs for ice_aq_get_phy_caps(), and format ice_aq_set_phy_cfg() and ice_aq_get_link_info() debug logs to make them more readable.
--- drivers/net/ethernet/intel/ice/ice_common.c | 68 +++++++++++++++------ 1 file changed, 50 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +50 -18
@@ -150,11 +150,13 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,u16 pcaps_size =sizeof (*pcaps);struct ice_aq_desc desc;enum ice_status status; +struct ice_hw *hw; cmd = &desc.params.get_phy;if (!pcaps || (report_mode & ~ICE_AQC_REPORT_MODE_M ) || !pi)return ICE_ERR_PARAM ; + hw = pi->hw;ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_get_phy_caps);
@@ -162,7 +164,32 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, cmd->param0 |=cpu_to_le16 (ICE_AQC_GET_PHY_RQM ); cmd->param0 |=cpu_to_le16 (report_mode); - status =ice_aq_send_cmd (pi->hw, &desc, pcaps, pcaps_size, cd); + status =ice_aq_send_cmd (hw, &desc, pcaps, pcaps_size, cd); + +ice_debug (hw,ICE_DBG_LINK ,"get phy caps - report_mode = 0x%x\n" , + report_mode); +ice_debug (hw,ICE_DBG_LINK ," phy_type_low = 0x%llx\n" , + (unsigned long long )le64_to_cpu (pcaps->phy_type_low)); +ice_debug (hw,ICE_DBG_LINK ," phy_type_high = 0x%llx\n" , + (unsigned long long )le64_to_cpu (pcaps->phy_type_high)); +ice_debug (hw,ICE_DBG_LINK ," caps = 0x%x\n" , pcaps->caps); +ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl = 0x%x\n" , + pcaps->low_power_ctrl); +ice_debug (hw,ICE_DBG_LINK ," eee_cap = 0x%x\n" , pcaps->eee_cap); +ice_debug (hw,ICE_DBG_LINK ," eeer_value = 0x%x\n" , + pcaps->eeer_value); +ice_debug (hw,ICE_DBG_LINK ," link_fec_options = 0x%x\n" , + pcaps->link_fec_options); +ice_debug (hw,ICE_DBG_LINK ," module_compliance_enforcement = 0x%x\n" , + pcaps->module_compliance_enforcement); +ice_debug (hw,ICE_DBG_LINK ," extended_compliance_code = 0x%x\n" , + pcaps->extended_compliance_code); +ice_debug (hw,ICE_DBG_LINK ," module_type[0] = 0x%x\n" , + pcaps->module_type[0 ]); +ice_debug (hw,ICE_DBG_LINK ," module_type[1] = 0x%x\n" , + pcaps->module_type[1 ]); +ice_debug (hw,ICE_DBG_LINK ," module_type[2] = 0x%x\n" , + pcaps->module_type[2 ]);if (!status && report_mode ==ICE_AQC_REPORT_TOPO_CAP ) { pi->phy.phy_type_low =le64_to_cpu (pcaps->phy_type_low);
@@ -326,18 +353,21 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, li->lse_ena = !!(resp->cmd_flags &cpu_to_le16 (ICE_AQ_LSE_IS_ENABLED )); -ice_debug (hw,ICE_DBG_LINK ,"link_speed = 0x%x\n" , li->link_speed); -ice_debug (hw,ICE_DBG_LINK ,"phy_type_low = 0x%llx\n" , +ice_debug (hw,ICE_DBG_LINK ,"get link info\n" ); +ice_debug (hw,ICE_DBG_LINK ," link_speed = 0x%x\n" , li->link_speed); +ice_debug (hw,ICE_DBG_LINK ," phy_type_low = 0x%llx\n" , (unsigned long long )li->phy_type_low); -ice_debug (hw,ICE_DBG_LINK ,"phy_type_high = 0x%llx\n" , +ice_debug (hw,ICE_DBG_LINK ," phy_type_high = 0x%llx\n" , (unsigned long long )li->phy_type_high); -ice_debug (hw,ICE_DBG_LINK ,"media_type = 0x%x\n" , *hw_media_type); -ice_debug (hw,ICE_DBG_LINK ,"link_info = 0x%x\n" , li->link_info); -ice_debug (hw,ICE_DBG_LINK ,"an_info = 0x%x\n" , li->an_info); -ice_debug (hw,ICE_DBG_LINK ,"ext_info = 0x%x\n" , li->ext_info); -ice_debug (hw,ICE_DBG_LINK ,"lse_ena = 0x%x\n" , li->lse_ena); -ice_debug (hw,ICE_DBG_LINK ,"max_frame = 0x%x\n" , li->max_frame_size); -ice_debug (hw,ICE_DBG_LINK ,"pacing = 0x%x\n" , li->pacing); +ice_debug (hw,ICE_DBG_LINK ," media_type = 0x%x\n" , *hw_media_type); +ice_debug (hw,ICE_DBG_LINK ," link_info = 0x%x\n" , li->link_info); +ice_debug (hw,ICE_DBG_LINK ," an_info = 0x%x\n" , li->an_info); +ice_debug (hw,ICE_DBG_LINK ," ext_info = 0x%x\n" , li->ext_info); +ice_debug (hw,ICE_DBG_LINK ," fec_info = 0x%x\n" , li->fec_info); +ice_debug (hw,ICE_DBG_LINK ," lse_ena = 0x%x\n" , li->lse_ena); +ice_debug (hw,ICE_DBG_LINK ," max_frame = 0x%x\n" , + li->max_frame_size); +ice_debug (hw,ICE_DBG_LINK ," pacing = 0x%x\n" , li->pacing);/* save link status information */ if (link)
@@ -2489,16 +2519,18 @@ ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi, desc.params.set_phy.lport_num = pi->lport; desc.flags |=cpu_to_le16 (ICE_AQ_FLAG_RD ); -ice_debug (hw,ICE_DBG_LINK ,"phy_type_low = 0x%llx\n" , +ice_debug (hw,ICE_DBG_LINK ,"set phy cfg\n" ); +ice_debug (hw,ICE_DBG_LINK ," phy_type_low = 0x%llx\n" , (unsigned long long )le64_to_cpu (cfg->phy_type_low)); -ice_debug (hw,ICE_DBG_LINK ,"phy_type_high = 0x%llx\n" , +ice_debug (hw,ICE_DBG_LINK ," phy_type_high = 0x%llx\n" , (unsigned long long )le64_to_cpu (cfg->phy_type_high)); -ice_debug (hw,ICE_DBG_LINK ,"caps = 0x%x\n" , cfg->caps); -ice_debug (hw,ICE_DBG_LINK ,"low_power_ctrl = 0x%x\n" , +ice_debug (hw,ICE_DBG_LINK ," caps = 0x%x\n" , cfg->caps); +ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl = 0x%x\n" , cfg->low_power_ctrl); -ice_debug (hw,ICE_DBG_LINK ,"eee_cap = 0x%x\n" , cfg->eee_cap); -ice_debug (hw,ICE_DBG_LINK ,"eeer_value = 0x%x\n" , cfg->eeer_value); -ice_debug (hw,ICE_DBG_LINK ,"link_fec_opt = 0x%x\n" , cfg->link_fec_opt); +ice_debug (hw,ICE_DBG_LINK ," eee_cap = 0x%x\n" , cfg->eee_cap); +ice_debug (hw,ICE_DBG_LINK ," eeer_value = 0x%x\n" , cfg->eeer_value); +ice_debug (hw,ICE_DBG_LINK ," link_fec_opt = 0x%x\n" , + cfg->link_fec_opt); status =ice_aq_send_cmd (hw, &desc, cfg,sizeof (*cfg), cd);if (hw->adminq.sq_last_status ==ICE_AQ_RC_EMODE )
Signature · 1 line
2.20.1
Bowers
PATCH 10/15 ice: add ice_aq_get_phy_caps() debug logs
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 10/15] ice: addice_aq_get_phy_caps()debug logsFrom: Paul Greenwalt <[email protected]>
Add debug logs for
ice_aq_get_phy_caps(), and formatice_aq_set_phy_cfg()andice_aq_get_link_info()debug logs to make them more readable.
Quoted 6 lines
Signed-off-by Paul Greenwalt <[email protected]>Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 68 +++++++++++++++------ 1 file changed, 50 insertions(+), 18 deletions(-)
Tony Nguyen
maintainerPATCH 11/15 ice: update reporting of autoneg capabilities
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
Firmware now reports AN28, AN32, and AN73. Add a helper and check these new values and report PHY autoneg capability.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 3 +++ drivers/net/ethernet/intel/ice/ice_common.c | 15 +++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 ++++---- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 5 files changed, 29 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +3 -0
@@ -963,6 +963,9 @@ struct ice_aqc_get_phy_caps_data {#define ICE_AQC_PHY_CAPS_MASK ICE_M(0xff, 0)u8 low_power_ctrl;#define ICE_AQC_PHY_EN_D3COLD_LOW_POWER_AUTONEG BIT(0) +#define ICE_AQC_PHY_AN_EN_CLAUSE28 BIT(1) +#define ICE_AQC_PHY_AN_EN_CLAUSE73 BIT(2) +#define ICE_AQC_PHY_AN_EN_CLAUSE37 BIT(3)__le16 eee_cap;#define ICE_AQC_PHY_EEE_EN_100BASE_TX BIT(0)#define ICE_AQC_PHY_EEE_EN_1000BASE_T BIT(1)
drivers/net/ethernet/intel/ice/ice_common.c +15 -0
@@ -4237,3 +4237,18 @@ ice_get_link_default_override(struct ice_link_default_override_tlv *ldo,return status; } + +/** +* ice_is_phy_caps_an_enabled - check if PHY capabilities autoneg is enabled +* @caps: get PHY capability data +*/ +bool ice_is_phy_caps_an_enabled (struct ice_aqc_get_phy_caps_data *caps) +{ +if (caps->caps &ICE_AQC_PHY_AN_MODE || + caps->low_power_ctrl & (ICE_AQC_PHY_AN_EN_CLAUSE28 | +ICE_AQC_PHY_AN_EN_CLAUSE73 | +ICE_AQC_PHY_AN_EN_CLAUSE37 )) +return true; + +return false; +}
drivers/net/ethernet/intel/ice/ice_common.h +1 -0
@@ -104,6 +104,7 @@ bool ice_fw_supports_link_override(struct ice_hw *hw);enum ice_status ice_get_link_default_override (struct ice_link_default_override_tlv *ldo,struct ice_port_info *pi); +bool ice_is_phy_caps_an_enabled (struct ice_aqc_get_phy_caps_data *caps);enum ice_fc_mode ice_caps_to_fc_mode (u8 caps);enum ice_fec_mode ice_caps_to_fec_mode (u8 caps,u8 fec_options);
drivers/net/ethernet/intel/ice/ice_ethtool.c +4 -4
@@ -2987,8 +2987,8 @@ ice_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)if (status) goto out; - pause->autoneg = ((pcaps->caps &ICE_AQC_PHY_AN_MODE ) ? -AUTONEG_ENABLE :AUTONEG_DISABLE ); + pause->autoneg =ice_is_phy_caps_an_enabled (pcaps) ?AUTONEG_ENABLE : +AUTONEG_DISABLE ;if (dcbx_cfg->pfc.pfcena)/* PFC enabled so report LFC as off */
@@ -3056,8 +3056,8 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)return -EIO ; } - is_an = ((pcaps->caps &ICE_AQC_PHY_AN_MODE ) ? -AUTONEG_ENABLE :AUTONEG_DISABLE ); + is_an =ice_is_phy_caps_an_enabled (pcaps) ?AUTONEG_ENABLE : +AUTONEG_DISABLE ;kfree (pcaps);
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
@@ -612,6 +612,7 @@ static void ice_print_topo_conflict(struct ice_vsi *vsi)void ice_print_link_msg (struct ice_vsi *vsi,bool isup) {struct ice_aqc_get_phy_caps_data *caps; +const char *an_advertised;enum ice_status status;const char *fec_req;const char *speed;
@@ -710,6 +711,7 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup) caps =kzalloc (sizeof (*caps),GFP_KERNEL );if (!caps) { fec_req ="Unknown" ; + an_advertised ="Unknown" ; goto done; }
@@ -718,6 +720,8 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup)if (status)netdev_info (vsi->netdev,"Get phy capability failed.\n" ); + an_advertised =ice_is_phy_caps_an_enabled (caps) ?"On" :"Off" ; +if (caps->link_fec_options &ICE_AQC_PHY_FEC_25G_RS_528_REQ || caps->link_fec_options &ICE_AQC_PHY_FEC_25G_RS_544_REQ ) fec_req ="RS-FEC" ;
@@ -730,8 +734,8 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup)kfree (caps); done: -netdev_info (vsi->netdev,"NIC Link is up %sbps Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg: %s, Flow Control: %s\n" , - speed, fec_req, fec, an, fc); +netdev_info (vsi->netdev,"NIC Link is up %sbps Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg Advertised: %s, Autoneg Negotiated: %s, Flow Control: %s\n" , + speed, fec_req, fec, an_advertised, an, fc);ice_print_topo_conflict (vsi); }
Signature · 1 line
2.20.1
Bowers
PATCH 11/15 ice: update reporting of autoneg capabilities
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 11/15] ice: update reporting of autoneg capabilitiesFrom: Paul Greenwalt <[email protected]>
Firmware now reports AN28, AN32, and AN73. Add a helper and check these new values and report PHY autoneg capability.
Quoted 8 lines
Signed-off-by Paul Greenwalt <[email protected]>--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 3 +++ drivers/net/ethernet/intel/ice/ice_common.c | 15 +++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 ++++---- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 5 files changed, 29 insertions(+), 6 deletions(-)
Tony Nguyen
maintainerPATCH 12/15 ice: Rename low_power_ctrl
In reply to Tony NguyenFrom: Lev Faerman <[email protected]>
Rename the low_power_ctrl field to low_power_ctrl_an to be properly descriptive of it being an autonegotiation field.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_common.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -2
@@ -961,7 +961,7 @@ struct ice_aqc_get_phy_caps_data {#define ICE_AQC_GET_PHY_EN_MOD_QUAL BIT(5)#define ICE_AQC_PHY_EN_AUTO_FEC BIT(7)#define ICE_AQC_PHY_CAPS_MASK ICE_M(0xff, 0) -u8 low_power_ctrl; +u8 low_power_ctrl_an;#define ICE_AQC_PHY_EN_D3COLD_LOW_POWER_AUTONEG BIT(0)#define ICE_AQC_PHY_AN_EN_CLAUSE28 BIT(1)#define ICE_AQC_PHY_AN_EN_CLAUSE73 BIT(2)
@@ -1036,7 +1036,7 @@ struct ice_aqc_set_phy_cfg_data {#define ICE_AQ_PHY_ENA_AUTO_LINK_UPDT BIT(5)#define ICE_AQ_PHY_ENA_LESM BIT(6)#define ICE_AQ_PHY_ENA_AUTO_FEC BIT(7) -u8 low_power_ctrl; +u8 low_power_ctrl_an;__le16 eee_cap;/* Value from ice_aqc_get_phy_caps */ __le16 eeer_value;u8 link_fec_opt;/* Use defines from ice_aqc_get_phy_caps */
drivers/net/ethernet/intel/ice/ice_common.c +9 -9
@@ -173,8 +173,8 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,ice_debug (hw,ICE_DBG_LINK ," phy_type_high = 0x%llx\n" , (unsigned long long )le64_to_cpu (pcaps->phy_type_high));ice_debug (hw,ICE_DBG_LINK ," caps = 0x%x\n" , pcaps->caps); -ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl = 0x%x\n" , - pcaps->low_power_ctrl); +ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl_an = 0x%x\n" , + pcaps->low_power_ctrl_an);ice_debug (hw,ICE_DBG_LINK ," eee_cap = 0x%x\n" , pcaps->eee_cap);ice_debug (hw,ICE_DBG_LINK ," eeer_value = 0x%x\n" , pcaps->eeer_value);
@@ -2525,8 +2525,8 @@ ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi,ice_debug (hw,ICE_DBG_LINK ," phy_type_high = 0x%llx\n" , (unsigned long long )le64_to_cpu (cfg->phy_type_high));ice_debug (hw,ICE_DBG_LINK ," caps = 0x%x\n" , cfg->caps); -ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl = 0x%x\n" , - cfg->low_power_ctrl); +ice_debug (hw,ICE_DBG_LINK ," low_power_ctrl_an = 0x%x\n" , + cfg->low_power_ctrl_an);ice_debug (hw,ICE_DBG_LINK ," eee_cap = 0x%x\n" , cfg->eee_cap);ice_debug (hw,ICE_DBG_LINK ," eeer_value = 0x%x\n" , cfg->eeer_value); ice_debug(hw, ICE_DBG_LINK, " link_fec_opt = 0x%x\n",
@@ -2811,7 +2811,7 @@ ice_phy_caps_equals_cfg(struct ice_aqc_get_phy_caps_data *phy_caps,if (phy_caps->phy_type_low != phy_cfg->phy_type_low || phy_caps->phy_type_high != phy_cfg->phy_type_high || ((phy_caps->caps & caps_mask) != (phy_cfg->caps & cfg_mask)) || - phy_caps->low_power_ctrl != phy_cfg->low_power_ctrl || + phy_caps->low_power_ctrl_an != phy_cfg->low_power_ctrl_an || phy_caps->eee_cap != phy_cfg->eee_cap || phy_caps->eeer_value != phy_cfg->eeer_value || phy_caps->link_fec_options != phy_cfg->link_fec_opt)
@@ -2841,7 +2841,7 @@ ice_copy_phy_caps_to_cfg(struct ice_port_info *pi, cfg->phy_type_low = caps->phy_type_low; cfg->phy_type_high = caps->phy_type_high; cfg->caps = caps->caps; - cfg->low_power_ctrl = caps->low_power_ctrl; + cfg->low_power_ctrl_an = caps->low_power_ctrl_an; cfg->eee_cap = caps->eee_cap; cfg->eeer_value = caps->eeer_value; cfg->link_fec_opt = caps->link_fec_options;
@@ -4245,9 +4245,9 @@ ice_get_link_default_override(struct ice_link_default_override_tlv *ldo,bool ice_is_phy_caps_an_enabled (struct ice_aqc_get_phy_caps_data *caps) {if (caps->caps &ICE_AQC_PHY_AN_MODE || - caps->low_power_ctrl & (ICE_AQC_PHY_AN_EN_CLAUSE28 | -ICE_AQC_PHY_AN_EN_CLAUSE73 | -ICE_AQC_PHY_AN_EN_CLAUSE37 )) + caps->low_power_ctrl_an & (ICE_AQC_PHY_AN_EN_CLAUSE28 | +ICE_AQC_PHY_AN_EN_CLAUSE73 | +ICE_AQC_PHY_AN_EN_CLAUSE37 ))return true;return false;
Signature · 1 line
2.20.1
Bowers
PATCH 12/15 ice: Rename low_power_ctrl
Quoted 9 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 12/15] ice: Renamelow_power_ctrlFrom: Lev Faerman <[email protected]>
Quoted 8 lines
Rename the
low_power_ctrlfield tolow_power_ctrl_anto be properly descriptive of it being an autonegotiation field.Signed-off-by Lev Faerman <[email protected]>--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_common.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-)
Tony Nguyen
maintainerPATCH 13/15 ice: add AQC get link topology handle support
In reply to Tony NguyenFrom: Paul Greenwalt <[email protected]>
Add AQC get link topology handle support. This is needed to determine Direct Attach (DA) or backplane media type for PHY types that support either. Get link topology handle cage node type request can be used to determine if a cage is present or not. If a cage is present for PHY types that supports both DA and backplane media type, then the media type is DA, else the media type is backplane.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 53 +++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.c | 66 ++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +53 -0
@@ -1194,6 +1194,57 @@ struct ice_aqc_set_mac_lb {u8 reserved[15 ]; }; +struct ice_aqc_link_topo_addr { +u8 lport_num; +u8 lport_num_valid; +#define ICE_AQC_LINK_TOPO_PORT_NUM_VALID BIT(0) +u8 node_type_ctx; +#define ICE_AQC_LINK_TOPO_NODE_TYPE_S 0 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_M (0xF << ICE_AQC_LINK_TOPO_NODE_TYPE_S) +#define ICE_AQC_LINK_TOPO_NODE_TYPE_PHY 0 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_GPIO_CTRL 1 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_MUX_CTRL 2 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_LED_CTRL 3 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_LED 4 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_THERMAL 5 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_CAGE 6 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_MEZZ 7 +#define ICE_AQC_LINK_TOPO_NODE_TYPE_ID_EEPROM 8 +#define ICE_AQC_LINK_TOPO_NODE_CTX_S 4 +#define ICE_AQC_LINK_TOPO_NODE_CTX_M \ + (0xF << ICE_AQC_LINK_TOPO_NODE_CTX_S) +#define ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL 0 +#define ICE_AQC_LINK_TOPO_NODE_CTX_BOARD 1 +#define ICE_AQC_LINK_TOPO_NODE_CTX_PORT 2 +#define ICE_AQC_LINK_TOPO_NODE_CTX_NODE 3 +#define ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED 4 +#define ICE_AQC_LINK_TOPO_NODE_CTX_OVERRIDE 5 +u8 index; +__le16 handle; +#define ICE_AQC_LINK_TOPO_HANDLE_S 0 +#define ICE_AQC_LINK_TOPO_HANDLE_M (0x3FF << ICE_AQC_LINK_TOPO_HANDLE_S) +/* Used to decode the handle field */ +#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_M BIT(9) +#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM BIT(9) +#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ 0 +#define ICE_AQC_LINK_TOPO_HANDLE_NODE_S 0 +/* In case of a Mezzanine type */ +#define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_NODE_M \ + (0x3F << ICE_AQC_LINK_TOPO_HANDLE_NODE_S) +#define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_S 6 +#define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_M (0x7 << ICE_AQC_LINK_TOPO_HANDLE_MEZZ_S) +/* In case of a LOM type */ +#define ICE_AQC_LINK_TOPO_HANDLE_LOM_NODE_M \ + (0x1FF << ICE_AQC_LINK_TOPO_HANDLE_NODE_S) +}; + +/* Get Link Topology Handle (direct, 0x06E0) */ +struct ice_aqc_get_link_topo { +struct ice_aqc_link_topo_addr addr; +u8 node_part_num; +u8 rsvd[9 ]; +}; +/* Set Port Identification LED (direct, 0x06E9) */ struct ice_aqc_set_port_id_led {u8 lport_num;
@@ -1764,6 +1815,7 @@ struct ice_aq_desc {struct ice_aqc_set_event_mask set_event_mask;struct ice_aqc_get_link_status get_link_status;struct ice_aqc_event_lan_overflow lan_overflow; +struct ice_aqc_get_link_topo get_link_topo; } params; };
@@ -1869,6 +1921,7 @@ enum ice_adminq_opc { ice_aqc_opc_get_link_status =0x0607 , ice_aqc_opc_set_event_mask =0x0613 , ice_aqc_opc_set_mac_lb =0x0620 , + ice_aqc_opc_get_link_topo =0x06E0 , ice_aqc_opc_set_port_id_led =0x06E9 , ice_aqc_opc_sff_eeprom = 0x06EE,
drivers/net/ethernet/intel/ice/ice_common.c +65 -1
90 lines not on this page · raw message
Signature · 1 line
2.20.1
Bowers
PATCH 13/15 ice: add AQC get link topology handle support
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 13/15] ice: add AQC get link topology handle supportFrom: Paul Greenwalt <[email protected]>
Add AQC get link topology handle support. This is needed to determine Direct Attach (DA) or backplane media type for PHY types that support either. Get link topology handle cage node type request can be used to determine if a cage is present or not. If a cage is present for PHY types that supports both DA and backplane media type, then the media type is DA, else the media type is backplane.
Quoted 5 lines
Signed-off-by Paul Greenwalt <[email protected]>--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 53 +++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.c | 66 ++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 14/15 ice: Report AOC PHY Types as Fiber
In reply to Tony NguyenFrom: Doug Dziggel <[email protected]>
Report AOC types as fiber instead of unknown.
--- drivers/net/ethernet/intel/ice/ice_common.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_common.c +11 -0
@@ -285,6 +285,14 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)case ICE_PHY_TYPE_LOW_100GBASE_LR4 :case ICE_PHY_TYPE_LOW_100GBASE_SR2 :case ICE_PHY_TYPE_LOW_100GBASE_DR : +case ICE_PHY_TYPE_LOW_10G_SFI_AOC_ACC : +case ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC : +case ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC : +case ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC : +case ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC : +case ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC : +case ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC : +case ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC :return ICE_MEDIA_FIBER ;case ICE_PHY_TYPE_LOW_100BASE_TX :case ICE_PHY_TYPE_LOW_1000BASE_T :
@@ -338,6 +346,9 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) fallthrough;case ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4 :return ICE_MEDIA_BACKPLANE ; +case ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC : +case ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC : +return ICE_MEDIA_FIBER ; } }return ICE_MEDIA_UNKNOWN ;
Signature · 1 line
2.20.1
Bowers
PATCH 14/15 ice: Report AOC PHY Types as Fiber
Quoted 8 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 14/15] ice: Report AOC PHY Types as Fiber
Quoted 8 lines
From: Doug Dziggel <[email protected]>
Report AOC types as fiber instead of unknown.
Signed-off-by Doug Dziggel <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
Tony Nguyen
maintainerPATCH 15/15 ice: add 1G SGMII PHY type
In reply to Tony NguyenFrom: Paul M Stillwell Jr <[email protected]>
There isn't a case for 1G SGMII in ice_get_media_type() so add the handling for it.
Also handle the special case where some direct attach cables may report that they support 1G SGMII, but that is erroneous since SGMII is supposed to be a backplane media type (between a MAC and a PHY). If the driver doesn't handle this special case then a user could see the 'Port' in ethtool change from 'Direct attach Copper' to 'Backplane' when they have forced the speed to 1G, but the cable hasn't changed.
Lastly, change ice_aq_get_phy_caps() to save themodule_type info if the function was called withICE_AQC_REPORT_TOPO_CAP. This call uses the media
information to populate the module_type. If no
media is present then the values in module_type
will be 0.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -993,6 +993,7 @@ struct ice_aqc_get_phy_caps_data {u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE ];#define ICE_AQC_MOD_TYPE_BYTE0_SFP_PLUS 0xA0#define ICE_AQC_MOD_TYPE_BYTE0_QSFP_PLUS 0x80 +#define ICE_AQC_MOD_TYPE_IDENT 1#define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE BIT(0)#define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE BIT(1)#define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_SR BIT(4)
drivers/net/ethernet/intel/ice/ice_common.c +14 -3
@@ -194,6 +194,8 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,if (!status && report_mode ==ICE_AQC_REPORT_TOPO_CAP ) { pi->phy.phy_type_low =le64_to_cpu (pcaps->phy_type_low); pi->phy.phy_type_high =le64_to_cpu (pcaps->phy_type_high); +memcpy (pi->phy.link_info.module_type, &pcaps->module_type, +sizeof (pi->phy.link_info.module_type)); }return status;
@@ -266,6 +268,18 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)return ICE_MEDIA_UNKNOWN ;if (hw_link_info->phy_type_low) { +/* 1G SGMII is a special case where some DA cable PHYs +* may show this as an option when it really shouldn't +* be since SGMII is meant to be between a MAC and a PHY +* in a backplane. Try to detect this case and handle it +*/ +if (hw_link_info->phy_type_low ==ICE_PHY_TYPE_LOW_1G_SGMII && + (hw_link_info->module_type[ICE_AQC_MOD_TYPE_IDENT ] == +ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE || + hw_link_info->module_type[ICE_AQC_MOD_TYPE_IDENT ] == +ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE )) +return ICE_MEDIA_DA ; +switch (hw_link_info->phy_type_low) {case ICE_PHY_TYPE_LOW_1000BASE_SX :case ICE_PHY_TYPE_LOW_1000BASE_LX :
@@ -2647,9 +2661,6 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) status =ice_aq_get_phy_caps (pi, false,ICE_AQC_REPORT_TOPO_CAP , pcaps,NULL ); -if (!status) -memcpy (li->module_type, &pcaps->module_type, -sizeof (li->module_type));devm_kfree (ice_hw_to_dev (hw), pcaps); }
Signature · 1 line
2.20.1
Bowers
PATCH 15/15 ice: add 1G SGMII PHY type
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 15/15] ice: add 1G SGMII PHY typeFrom: Paul M Stillwell Jr <[email protected]>
There isn't a case for 1G SGMII in
ice_get_media_type()so add the handling for it.Also handle the special case where some direct attach cables may report that they support 1G SGMII, but that is erroneous since SGMII is supposed to be a backplane media type (between a MAC and a PHY). If the driver doesn't handle this special case then a user could see the 'Port' in ethtool change from 'Direct attach Copper' to 'Backplane' when they have forced the speed to 1G, but the cable hasn't changed.
Lastly, change
ice_aq_get_phy_caps()to save themodule_typeinfo if the function was called withICE_AQC_REPORT_TOPO_CAP. This call uses the media information to populate themodule_type. If no media is present then the values inmodule_typewill be 0.
Quoted 6 lines
Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Bowers
PATCH 1/15 ice: refactor ice_discover_caps to avoid need to retry
In reply to Tony NguyenQuoted 29 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, July 9, 2020 9:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S49 01/15] ice: refactorice_discover_capsto avoid need to retryFrom: Jacob Keller <[email protected]>
The
ice_discover_capsfunction is used to read the device and function capabilities, updating the hardware capabilities structures with relevant data.The exact number of capabilities returned by the hardware is unknown ahead of time. The AdminQ command will report the total number of capabilities in the return buffer.
The current implementation involves requesting capabilities once, reading this returned size, and then re-requested with that size.
This isn't really necessary. The firmware interface has a maximum size of
ICE_AQ_MAX_BUF_LEN. Firmware can never return more thanICE_AQ_MAX_BUF_LEN/sizeof(struct ice_aqc_list_caps_elem)capabilities.Avoid the retry loop by simply allocating a buffer of size
ICE_AQ_MAX_BUF_LEN. This is significantly simpler than retrying. The extra allocation isn't a big deal, as it will be released after we finish parsing the capabilities.
Quoted 4 lines
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 43 ++++++--------------- 1 file changed, 12 insertions(+), 31 deletions(-)