hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/intel/i40e/i40e_dcb.c
....@@ -863,22 +863,41 @@
863863 /**
864864 * i40e_init_dcb
865865 * @hw: pointer to the hw struct
866
+ * @enable_mib_change: enable mib change event
866867 *
867868 * Update DCB configuration from the Firmware
868869 **/
869
-i40e_status i40e_init_dcb(struct i40e_hw *hw)
870
+i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
870871 {
871872 i40e_status ret = 0;
872873 struct i40e_lldp_variables lldp_cfg;
873874 u8 adminstatus = 0;
874875
875876 if (!hw->func_caps.dcb)
876
- return ret;
877
+ return I40E_NOT_SUPPORTED;
877878
878879 /* Read LLDP NVM area */
879
- ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
880
+ if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
881
+ u8 offset = 0;
882
+
883
+ if (hw->mac.type == I40E_MAC_XL710)
884
+ offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;
885
+ else if (hw->mac.type == I40E_MAC_X722)
886
+ offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
887
+ else
888
+ return I40E_NOT_SUPPORTED;
889
+
890
+ ret = i40e_read_nvm_module_data(hw,
891
+ I40E_SR_EMP_SR_SETTINGS_PTR,
892
+ offset,
893
+ I40E_LLDP_CURRENT_STATUS_OFFSET,
894
+ I40E_LLDP_CURRENT_STATUS_SIZE,
895
+ &lldp_cfg.adminstatus);
896
+ } else {
897
+ ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
898
+ }
880899 if (ret)
881
- return ret;
900
+ return I40E_ERR_NOT_READY;
882901
883902 /* Get the LLDP AdminStatus for the current port */
884903 adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
....@@ -887,7 +906,7 @@
887906 /* LLDP agent disabled */
888907 if (!adminstatus) {
889908 hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
890
- return ret;
909
+ return I40E_ERR_NOT_READY;
891910 }
892911
893912 /* Get DCBX status */
....@@ -896,26 +915,19 @@
896915 return ret;
897916
898917 /* Check the DCBX Status */
899
- switch (hw->dcbx_status) {
900
- case I40E_DCBX_STATUS_DONE:
901
- case I40E_DCBX_STATUS_IN_PROGRESS:
918
+ if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
919
+ hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
902920 /* Get current DCBX configuration */
903921 ret = i40e_get_dcb_config(hw);
904922 if (ret)
905923 return ret;
906
- break;
907
- case I40E_DCBX_STATUS_DISABLED:
908
- return ret;
909
- case I40E_DCBX_STATUS_NOT_STARTED:
910
- case I40E_DCBX_STATUS_MULTIPLE_PEERS:
911
- default:
912
- break;
924
+ } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
925
+ return I40E_ERR_NOT_READY;
913926 }
914927
915928 /* Configure the LLDP MIB change event */
916
- ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
917
- if (ret)
918
- return ret;
929
+ if (enable_mib_change)
930
+ ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
919931
920932 return ret;
921933 }