i40e_dcb.c (f4cc2d1710068319774a27d5c5e7ff85856c9278) | i40e_dcb.c (b4a7ce0690aedd9763b3b47ee7fcdb421f0434c7) |
---|---|
1/****************************************************************************** 2 3 Copyright (c) 2013-2018, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 879 unchanged lines hidden (view full) --- 888 889out: 890 return ret; 891} 892 893/** 894 * i40e_init_dcb 895 * @hw: pointer to the hw struct | 1/****************************************************************************** 2 3 Copyright (c) 2013-2018, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 879 unchanged lines hidden (view full) --- 888 889out: 890 return ret; 891} 892 893/** 894 * i40e_init_dcb 895 * @hw: pointer to the hw struct |
896 * @enable_mib_change: enable mib change event |
|
896 * 897 * Update DCB configuration from the Firmware 898 **/ | 897 * 898 * Update DCB configuration from the Firmware 899 **/ |
899enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw) | 900enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) |
900{ 901 enum i40e_status_code ret = I40E_SUCCESS; 902 struct i40e_lldp_variables lldp_cfg; 903 u8 adminstatus = 0; 904 905 if (!hw->func_caps.dcb) | 901{ 902 enum i40e_status_code ret = I40E_SUCCESS; 903 struct i40e_lldp_variables lldp_cfg; 904 u8 adminstatus = 0; 905 906 if (!hw->func_caps.dcb) |
906 return ret; | 907 return I40E_NOT_SUPPORTED; |
907 908 /* Read LLDP NVM area */ | 908 909 /* Read LLDP NVM area */ |
909 ret = i40e_read_lldp_cfg(hw, &lldp_cfg); | 910 if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) { 911 u8 offset = 0; 912 913 if (hw->mac.type == I40E_MAC_XL710) 914 offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET; 915 else if (hw->mac.type == I40E_MAC_X722) 916 offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET; 917 else 918 return I40E_NOT_SUPPORTED; 919 920 ret = i40e_read_nvm_module_data(hw, 921 I40E_SR_EMP_SR_SETTINGS_PTR, 922 offset, 923 I40E_LLDP_CURRENT_STATUS_OFFSET, 924 I40E_LLDP_CURRENT_STATUS_SIZE, 925 &lldp_cfg.adminstatus); 926 } else { 927 ret = i40e_read_lldp_cfg(hw, &lldp_cfg); 928 } |
910 if (ret) | 929 if (ret) |
911 return ret; | 930 return I40E_ERR_NOT_READY; |
912 913 /* Get the LLDP AdminStatus for the current port */ 914 adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); 915 adminstatus &= 0xF; 916 917 /* LLDP agent disabled */ 918 if (!adminstatus) { 919 hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; | 931 932 /* Get the LLDP AdminStatus for the current port */ 933 adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); 934 adminstatus &= 0xF; 935 936 /* LLDP agent disabled */ 937 if (!adminstatus) { 938 hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; |
920 return ret; | 939 return I40E_ERR_NOT_READY; |
921 } 922 923 /* Get DCBX status */ 924 ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); 925 if (ret) 926 return ret; 927 928 /* Check the DCBX Status */ | 940 } 941 942 /* Get DCBX status */ 943 ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); 944 if (ret) 945 return ret; 946 947 /* Check the DCBX Status */ |
929 switch (hw->dcbx_status) { 930 case I40E_DCBX_STATUS_DONE: 931 case I40E_DCBX_STATUS_IN_PROGRESS: | 948 if (hw->dcbx_status == I40E_DCBX_STATUS_DONE || 949 hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) { |
932 /* Get current DCBX configuration */ 933 ret = i40e_get_dcb_config(hw); 934 if (ret) 935 return ret; | 950 /* Get current DCBX configuration */ 951 ret = i40e_get_dcb_config(hw); 952 if (ret) 953 return ret; |
936 break; 937 case I40E_DCBX_STATUS_DISABLED: 938 return ret; 939 case I40E_DCBX_STATUS_NOT_STARTED: 940 case I40E_DCBX_STATUS_MULTIPLE_PEERS: 941 default: 942 break; | 954 } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) { 955 return I40E_ERR_NOT_READY; |
943 } 944 945 /* Configure the LLDP MIB change event */ | 956 } 957 958 /* Configure the LLDP MIB change event */ |
946 ret = i40e_aq_cfg_lldp_mib_change_event(hw, TRUE, NULL); | 959 if (enable_mib_change) 960 ret = i40e_aq_cfg_lldp_mib_change_event(hw, TRUE, NULL); 961 962 return ret; 963} 964 965/** 966 * i40e_get_fw_lldp_status 967 * @hw: pointer to the hw struct 968 * @lldp_status: pointer to the status enum 969 * 970 * Get status of FW Link Layer Discovery Protocol (LLDP) Agent. 971 * Status of agent is reported via @lldp_status parameter. 972 **/ 973enum i40e_status_code 974i40e_get_fw_lldp_status(struct i40e_hw *hw, 975 enum i40e_get_fw_lldp_status_resp *lldp_status) 976{ 977 enum i40e_status_code ret; 978 struct i40e_virt_mem mem; 979 u8 *lldpmib; 980 981 if (!lldp_status) 982 return I40E_ERR_PARAM; 983 984 /* Allocate buffer for the LLDPDU */ 985 ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE); |
947 if (ret) 948 return ret; 949 | 986 if (ret) 987 return ret; 988 |
989 lldpmib = (u8 *)mem.va; 990 ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib, 991 I40E_LLDPDU_SIZE, NULL, NULL, NULL); 992 993 if (ret == I40E_SUCCESS) { 994 *lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED; 995 } else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) { 996 /* MIB is not available yet but the agent is running */ 997 *lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED; 998 ret = I40E_SUCCESS; 999 } else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) { 1000 *lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED; 1001 ret = I40E_SUCCESS; 1002 } 1003 1004 i40e_free_virt_mem(hw, &mem); |
|
950 return ret; 951} 952 | 1005 return ret; 1006} 1007 |
1008 |
|
953/** 954 * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format 955 * @tlv: Fill the ETS config data in IEEE format 956 * @dcbcfg: Local store which holds the DCB Config 957 * 958 * Prepare IEEE 802.1Qaz ETS CFG TLV 959 **/ 960static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, --- 276 unchanged lines hidden (view full) --- 1237 ret = i40e_aq_set_lldp_mib(hw, mib_type, (void *)lldpmib, miblen, NULL); 1238 1239 i40e_free_virt_mem(hw, &mem); 1240 return ret; 1241} 1242 1243/** 1244 * i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format | 1009/** 1010 * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format 1011 * @tlv: Fill the ETS config data in IEEE format 1012 * @dcbcfg: Local store which holds the DCB Config 1013 * 1014 * Prepare IEEE 802.1Qaz ETS CFG TLV 1015 **/ 1016static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, --- 276 unchanged lines hidden (view full) --- 1293 ret = i40e_aq_set_lldp_mib(hw, mib_type, (void *)lldpmib, miblen, NULL); 1294 1295 i40e_free_virt_mem(hw, &mem); 1296 return ret; 1297} 1298 1299/** 1300 * i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format |
1245 * @hw: pointer to the hw struct | 1301 * @lldpmib: pointer to mib to be output 1302 * @miblen: pointer to u16 for length of lldpmib |
1246 * @dcbcfg: store for LLDPDU data 1247 * 1248 * send DCB configuration to FW 1249 **/ 1250enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, 1251 struct i40e_dcbx_config *dcbcfg) 1252{ 1253 u16 length, offset = 0, tlvid = I40E_TLV_ID_START; --- 132 unchanged lines hidden --- | 1303 * @dcbcfg: store for LLDPDU data 1304 * 1305 * send DCB configuration to FW 1306 **/ 1307enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, 1308 struct i40e_dcbx_config *dcbcfg) 1309{ 1310 u16 length, offset = 0, tlvid = I40E_TLV_ID_START; --- 132 unchanged lines hidden --- |