Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ice: Allow for delayed LLDP MIB change registration

Add an additional boolean parameter to the ice_init_dcb
function. This boolean controls if the LLDP MIB change
events are registered for. Also, add a new function
defined ice_cfg_lldp_mib_change. The additional function
is necessary to be able to register for LLDP MIB change
events after calling ice_init_dcb. The net effect of these
two changes is to allow a delayed registration for MIB change
events so that the driver is not accepting events before it
is ready for them.

Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Dave Ertman and committed by
Jeff Kirsher
ea300f41 201beeb7

+51 -15
+35 -4
drivers/net/ethernet/intel/ice/ice_dcb.c
··· 60 60 * Enable or Disable posting of an event on ARQ when LLDP MIB 61 61 * associated with the interface changes (0x0A01) 62 62 */ 63 - enum ice_status 63 + static enum ice_status 64 64 ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update, 65 65 struct ice_sq_cd *cd) 66 66 { ··· 943 943 /** 944 944 * ice_init_dcb 945 945 * @hw: pointer to the HW struct 946 + * @enable_mib_change: enable MIB change event 946 947 * 947 948 * Update DCB configuration from the Firmware 948 949 */ 949 - enum ice_status ice_init_dcb(struct ice_hw *hw) 950 + enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) 950 951 { 951 952 struct ice_port_info *pi = hw->port_info; 952 953 enum ice_status ret = 0; ··· 973 972 } 974 973 975 974 /* Configure the LLDP MIB change event */ 976 - ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); 975 + if (enable_mib_change) { 976 + ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); 977 + if (!ret) 978 + pi->is_sw_lldp = false; 979 + } 980 + 981 + return ret; 982 + } 983 + 984 + /** 985 + * ice_cfg_lldp_mib_change 986 + * @hw: pointer to the HW struct 987 + * @ena_mib: enable/disable MIB change event 988 + * 989 + * Configure (disable/enable) MIB 990 + */ 991 + enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) 992 + { 993 + struct ice_port_info *pi = hw->port_info; 994 + enum ice_status ret; 995 + 996 + if (!hw->func_caps.common_cap.dcb) 997 + return ICE_ERR_NOT_SUPPORTED; 998 + 999 + /* Get DCBX status */ 1000 + pi->dcbx_status = ice_get_dcbx_status(hw); 1001 + 1002 + if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) 1003 + return ICE_ERR_NOT_READY; 1004 + 1005 + ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); 977 1006 if (!ret) 978 - pi->is_sw_lldp = false; 1007 + pi->is_sw_lldp = !ena_mib; 979 1008 980 1009 return ret; 981 1010 }
+4 -7
drivers/net/ethernet/intel/ice/ice_dcb.h
··· 125 125 struct ice_dcbx_cfg *dcbcfg); 126 126 enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi); 127 127 enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi); 128 - enum ice_status ice_init_dcb(struct ice_hw *hw); 128 + enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change); 129 129 enum ice_status 130 130 ice_query_port_ets(struct ice_port_info *pi, 131 131 struct ice_aqc_port_ets_elem *buf, u16 buf_size, ··· 139 139 enum ice_status 140 140 ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent, 141 141 bool *dcbx_agent_status, struct ice_sq_cd *cd); 142 - enum ice_status 143 - ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update, 144 - struct ice_sq_cd *cd); 142 + enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib); 145 143 #else /* CONFIG_DCB */ 146 144 static inline enum ice_status 147 145 ice_aq_stop_lldp(struct ice_hw __always_unused *hw, ··· 170 172 } 171 173 172 174 static inline enum ice_status 173 - ice_aq_cfg_lldp_mib_change(struct ice_hw __always_unused *hw, 174 - bool __always_unused ena_update, 175 - struct ice_sq_cd __always_unused *cd) 175 + ice_cfg_lldp_mib_change(struct ice_hw __always_unused *hw, 176 + bool __always_unused ena_mib) 176 177 { 177 178 return 0; 178 179 }
+2 -2
drivers/net/ethernet/intel/ice/ice_dcb_lib.c
··· 318 318 goto dcb_error; 319 319 } 320 320 321 - ice_init_dcb(&pf->hw); 321 + ice_init_dcb(&pf->hw, true); 322 322 if (pf->hw.port_info->dcbx_status == ICE_DCBX_STATUS_DIS) 323 323 pf->hw.port_info->is_sw_lldp = true; 324 324 else ··· 451 451 452 452 port_info = hw->port_info; 453 453 454 - err = ice_init_dcb(hw); 454 + err = ice_init_dcb(hw, false); 455 455 if (err && !port_info->is_sw_lldp) { 456 456 dev_err(&pf->pdev->dev, "Error initializing DCB %d\n", err); 457 457 goto dcb_init_err;
+8 -2
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 1206 1206 enum ice_status status; 1207 1207 1208 1208 /* Disable FW LLDP engine */ 1209 - status = ice_aq_cfg_lldp_mib_change(&pf->hw, false, 1210 - NULL); 1209 + status = ice_cfg_lldp_mib_change(&pf->hw, false); 1210 + 1211 1211 /* If unregistering for LLDP events fails, this is 1212 1212 * not an error state, as there shouldn't be any 1213 1213 * events to respond to. ··· 1273 1273 * The FW LLDP engine will now be consuming them. 1274 1274 */ 1275 1275 ice_cfg_sw_lldp(vsi, false, false); 1276 + 1277 + /* Register for MIB change events */ 1278 + status = ice_cfg_lldp_mib_change(&pf->hw, true); 1279 + if (status) 1280 + dev_dbg(&pf->pdev->dev, 1281 + "Fail to enable MIB change events\n"); 1276 1282 } 1277 1283 } 1278 1284 clear_bit(ICE_FLAG_ETHTOOL_CTXT, pf->flags);
+2
drivers/net/ethernet/intel/ice/ice_main.c
··· 2536 2536 if (ice_init_pf_dcb(pf, false)) { 2537 2537 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); 2538 2538 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); 2539 + } else { 2540 + ice_cfg_lldp_mib_change(&pf->hw, true); 2539 2541 } 2540 2542 } 2541 2543