| .. | .. |
|---|
| 863 | 863 | /** |
|---|
| 864 | 864 | * i40e_init_dcb |
|---|
| 865 | 865 | * @hw: pointer to the hw struct |
|---|
| 866 | + * @enable_mib_change: enable mib change event |
|---|
| 866 | 867 | * |
|---|
| 867 | 868 | * Update DCB configuration from the Firmware |
|---|
| 868 | 869 | **/ |
|---|
| 869 | | -i40e_status i40e_init_dcb(struct i40e_hw *hw) |
|---|
| 870 | +i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) |
|---|
| 870 | 871 | { |
|---|
| 871 | 872 | i40e_status ret = 0; |
|---|
| 872 | 873 | struct i40e_lldp_variables lldp_cfg; |
|---|
| 873 | 874 | u8 adminstatus = 0; |
|---|
| 874 | 875 | |
|---|
| 875 | 876 | if (!hw->func_caps.dcb) |
|---|
| 876 | | - return ret; |
|---|
| 877 | + return I40E_NOT_SUPPORTED; |
|---|
| 877 | 878 | |
|---|
| 878 | 879 | /* 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 | + } |
|---|
| 880 | 899 | if (ret) |
|---|
| 881 | | - return ret; |
|---|
| 900 | + return I40E_ERR_NOT_READY; |
|---|
| 882 | 901 | |
|---|
| 883 | 902 | /* Get the LLDP AdminStatus for the current port */ |
|---|
| 884 | 903 | adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); |
|---|
| .. | .. |
|---|
| 887 | 906 | /* LLDP agent disabled */ |
|---|
| 888 | 907 | if (!adminstatus) { |
|---|
| 889 | 908 | hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; |
|---|
| 890 | | - return ret; |
|---|
| 909 | + return I40E_ERR_NOT_READY; |
|---|
| 891 | 910 | } |
|---|
| 892 | 911 | |
|---|
| 893 | 912 | /* Get DCBX status */ |
|---|
| .. | .. |
|---|
| 896 | 915 | return ret; |
|---|
| 897 | 916 | |
|---|
| 898 | 917 | /* 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) { |
|---|
| 902 | 920 | /* Get current DCBX configuration */ |
|---|
| 903 | 921 | ret = i40e_get_dcb_config(hw); |
|---|
| 904 | 922 | if (ret) |
|---|
| 905 | 923 | 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; |
|---|
| 913 | 926 | } |
|---|
| 914 | 927 | |
|---|
| 915 | 928 | /* 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); |
|---|
| 919 | 931 | |
|---|
| 920 | 932 | return ret; |
|---|
| 921 | 933 | } |
|---|