28 #include <linux/pci.h>
30 #include <linux/sched.h>
31 #include <linux/netdevice.h>
39 static void ixgbe_release_eeprom_semaphore(
struct ixgbe_hw *
hw);
41 static void ixgbe_standby_eeprom(
struct ixgbe_hw *
hw);
45 static void ixgbe_raise_eeprom_clk(
struct ixgbe_hw *
hw,
u32 *eec);
46 static void ixgbe_lower_eeprom_clk(
struct ixgbe_hw *
hw,
u32 *eec);
47 static void ixgbe_release_eeprom(
struct ixgbe_hw *
hw);
55 static s32 ixgbe_detect_eeprom_page_size_generic(
struct ixgbe_hw *
hw,
68 static s32 ixgbe_device_supports_autoneg_fc(
struct ixgbe_hw *
hw)
99 hw_dbg(hw,
"ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
116 switch (hw->
phy.media_type) {
140 switch (hw->
fc.requested_mode) {
185 hw_dbg(hw,
"Flow control param set incorrectly\n");
200 if (hw->
fc.strict_ieee)
204 hw_dbg(hw,
"Set up FC; PCS1GLCTL = 0x%08X\n", reg);
216 (ixgbe_device_supports_autoneg_fc(hw) == 0)) {
221 hw_dbg(hw,
"Set up FC; IXGBE_AUTOC = 0x%08X\n", reg);
240 hw->
phy.media_type = hw->
mac.ops.get_media_type(hw);
243 hw->
phy.ops.identify(hw);
246 hw->
mac.ops.clear_vfta(hw);
249 hw->
mac.ops.clear_hw_cntrs(hw);
282 for (i = 0; i < hw->
mac.max_tx_queues; i++) {
289 for (i = 0; i < hw->
mac.max_tx_queues; i++) {
295 for (i = 0; i < hw->
mac.max_rx_queues; i++) {
320 status = hw->
mac.ops.reset_hw(hw);
324 status = hw->
mac.ops.start_hw(hw);
345 for (i = 0; i < 8; i++)
361 for (i = 0; i < 8; i++) {
373 for (i = 0; i < 8; i++)
390 for (i = 0; i < 8; i++)
411 for (i = 0; i < 16; i++) {
428 hw->
phy.ops.identify(hw);
455 if (pba_num ==
NULL) {
456 hw_dbg(hw,
"PBA string buffer was null\n");
462 hw_dbg(hw,
"NVM Read Error\n");
468 hw_dbg(hw,
"NVM Read Error\n");
478 hw_dbg(hw,
"NVM PBA number is not stored as string\n");
481 if (pba_num_size < 11) {
482 hw_dbg(hw,
"PBA string buffer too small\n");
487 pba_num[0] = (data >> 12) & 0xF;
488 pba_num[1] = (data >> 8) & 0xF;
489 pba_num[2] = (data >> 4) & 0xF;
490 pba_num[3] = data & 0xF;
491 pba_num[4] = (pba_ptr >> 12) & 0xF;
492 pba_num[5] = (pba_ptr >> 8) & 0xF;
495 pba_num[8] = (pba_ptr >> 4) & 0xF;
496 pba_num[9] = pba_ptr & 0xF;
502 for (offset = 0; offset < 10; offset++) {
503 if (pba_num[offset] < 0xA)
505 else if (pba_num[offset] < 0x10)
506 pba_num[
offset] +=
'A' - 0xA;
512 ret_val = hw->
eeprom.ops.read(hw, pba_ptr, &length);
514 hw_dbg(hw,
"NVM Read Error\n");
518 if (length == 0xFFFF || length == 0) {
519 hw_dbg(hw,
"NVM PBA number section invalid length\n");
524 if (pba_num_size < (((
u32)length * 2) - 1)) {
525 hw_dbg(hw,
"PBA string buffer too small\n");
533 for (offset = 0; offset <
length; offset++) {
534 ret_val = hw->
eeprom.ops.read(hw, pba_ptr + offset, &data);
536 hw_dbg(hw,
"NVM Read Error\n");
539 pba_num[offset * 2] = (
u8)(data >> 8);
540 pba_num[(offset * 2) + 1] = (
u8)(data & 0xFF);
542 pba_num[offset * 2] =
'\0';
565 for (i = 0; i < 4; i++)
566 mac_addr[i] = (
u8)(rar_low >> (i*8));
568 for (i = 0; i < 2; i++)
569 mac_addr[i+4] = (
u8)(rar_high >> (i*8));
622 mac->
ops.set_lan_id(hw);
679 for (i = 0; i < hw->
mac.max_tx_queues; i++)
683 for (i = 0; i < hw->
mac.max_rx_queues; i++) {
698 return ixgbe_disable_pcie_master(hw);
780 hw_dbg(hw,
"Eeprom params: type = %d, size = %d, address bits: "
803 hw->
eeprom.ops.init_params(hw);
810 if (offset + words > hw->
eeprom.word_size) {
819 if ((hw->
eeprom.word_page_size == 0) &&
821 ixgbe_detect_eeprom_page_size_generic(hw, offset);
831 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset + i,
862 status = ixgbe_acquire_eeprom(hw);
865 if (ixgbe_ready_eeprom(hw) != 0) {
866 ixgbe_release_eeprom(hw);
872 for (i = 0; i < words; i++) {
873 ixgbe_standby_eeprom(hw);
876 ixgbe_shift_out_eeprom_bits(hw,
880 ixgbe_standby_eeprom(hw);
886 if ((hw->
eeprom.address_bits == 8) &&
887 ((offset + i) >= 128))
891 ixgbe_shift_out_eeprom_bits(hw, write_opcode,
893 ixgbe_shift_out_eeprom_bits(hw, (
u16)((offset + i) * 2),
896 page_size = hw->
eeprom.word_page_size;
901 word = (word >> 8) | (word << 8);
902 ixgbe_shift_out_eeprom_bits(hw, word, 16);
908 if (((offset + i) & (page_size - 1)) ==
911 }
while (++i < words);
913 ixgbe_standby_eeprom(hw);
917 ixgbe_release_eeprom(hw);
936 hw->
eeprom.ops.init_params(hw);
938 if (offset >= hw->
eeprom.word_size) {
943 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, 1, &data);
964 hw->
eeprom.ops.init_params(hw);
971 if (offset + words > hw->
eeprom.word_size) {
985 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset + i,
1005 static s32 ixgbe_read_eeprom_buffer_bit_bang(
struct ixgbe_hw *hw,
u16 offset,
1014 status = ixgbe_acquire_eeprom(hw);
1017 if (ixgbe_ready_eeprom(hw) != 0) {
1018 ixgbe_release_eeprom(hw);
1024 for (i = 0; i < words; i++) {
1025 ixgbe_standby_eeprom(hw);
1030 if ((hw->
eeprom.address_bits == 8) &&
1031 ((offset + i) >= 128))
1035 ixgbe_shift_out_eeprom_bits(hw, read_opcode,
1037 ixgbe_shift_out_eeprom_bits(hw, (
u16)((offset + i) * 2),
1038 hw->
eeprom.address_bits);
1041 word_in = ixgbe_shift_in_eeprom_bits(hw, 16);
1042 data[
i] = (word_in >> 8) | (word_in << 8);
1046 ixgbe_release_eeprom(hw);
1065 hw->
eeprom.ops.init_params(hw);
1067 if (offset >= hw->
eeprom.word_size) {
1072 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data);
1094 hw->
eeprom.ops.init_params(hw);
1101 if (offset >= hw->
eeprom.word_size) {
1106 for (i = 0; i < words; i++) {
1117 hw_dbg(hw,
"Eeprom read timed out\n");
1134 static s32 ixgbe_detect_eeprom_page_size_generic(
struct ixgbe_hw *hw,
1145 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset,
1146 IXGBE_EEPROM_PAGE_SIZE_MAX, data);
1147 hw->
eeprom.word_page_size = 0;
1151 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data);
1159 hw->
eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX - data[0];
1161 hw_dbg(hw,
"Detected EEPROM page size = %d words.",
1162 hw->
eeprom.word_page_size);
1196 hw->
eeprom.ops.init_params(hw);
1203 if (offset >= hw->
eeprom.word_size) {
1208 for (i = 0; i < words; i++) {
1215 hw_dbg(hw,
"Eeprom write EEWR timed out\n");
1223 hw_dbg(hw,
"Eeprom write EEWR timed out\n");
1253 static s32 ixgbe_poll_eerd_eewr_done(
struct ixgbe_hw *hw,
u32 ee_reg)
1281 static s32 ixgbe_acquire_eeprom(
struct ixgbe_hw *hw)
1308 hw_dbg(hw,
"Could not acquire EEPROM grant\n");
1332 static s32 ixgbe_get_eeprom_semaphore(
struct ixgbe_hw *hw)
1340 for (i = 0; i < timeout; i++) {
1354 hw_dbg(hw,
"Driver can't access the Eeprom - SMBI Semaphore "
1362 ixgbe_release_eeprom_semaphore(hw);
1377 for (i = 0; i < timeout; i++) {
1400 hw_dbg(hw,
"SWESMBI Software EEPROM semaphore "
1402 ixgbe_release_eeprom_semaphore(hw);
1406 hw_dbg(hw,
"Software semaphore SMBI between device drivers "
1419 static void ixgbe_release_eeprom_semaphore(
struct ixgbe_hw *hw)
1435 static s32 ixgbe_ready_eeprom(
struct ixgbe_hw *hw)
1450 spi_stat_reg = (
u8)ixgbe_shift_in_eeprom_bits(hw, 8);
1455 ixgbe_standby_eeprom(hw);
1462 if (i >= IXGBE_EEPROM_MAX_RETRY_SPI) {
1463 hw_dbg(hw,
"SPI EEPROM Status error\n");
1474 static void ixgbe_standby_eeprom(
struct ixgbe_hw *hw)
1497 static void ixgbe_shift_out_eeprom_bits(
struct ixgbe_hw *hw,
u16 data,
1510 mask = 0x01 << (count - 1);
1512 for (i = 0; i <
count; i++) {
1530 ixgbe_raise_eeprom_clk(hw, &eec);
1531 ixgbe_lower_eeprom_clk(hw, &eec);
1550 static u16 ixgbe_shift_in_eeprom_bits(
struct ixgbe_hw *hw,
u16 count)
1567 for (i = 0; i <
count; i++) {
1569 ixgbe_raise_eeprom_clk(hw, &eec);
1577 ixgbe_lower_eeprom_clk(hw, &eec);
1588 static void ixgbe_raise_eeprom_clk(
struct ixgbe_hw *hw,
u32 *eec)
1605 static void ixgbe_lower_eeprom_clk(
struct ixgbe_hw *hw,
u32 *eec)
1621 static void ixgbe_release_eeprom(
struct ixgbe_hw *hw)
1646 hw->
eeprom.semaphore_delay * 2000);
1664 if (hw->
eeprom.ops.read(hw, i, &word) != 0) {
1665 hw_dbg(hw,
"EEPROM read failed\n");
1673 hw->
eeprom.ops.read(hw, i, &pointer);
1676 if (pointer != 0xFFFF && pointer != 0) {
1677 hw->
eeprom.ops.read(hw, pointer, &length);
1679 if (length != 0xFFFF && length != 0) {
1680 for (j = pointer+1; j <= pointer+
length; j++) {
1681 hw->
eeprom.ops.read(hw, j, &word);
1706 u16 read_checksum = 0;
1713 status = hw->
eeprom.ops.read(hw, 0, &checksum);
1716 checksum = hw->
eeprom.ops.calc_checksum(hw);
1724 if (read_checksum != checksum)
1731 hw_dbg(hw,
"EEPROM read failed\n");
1751 status = hw->
eeprom.ops.read(hw, 0, &checksum);
1754 checksum = hw->
eeprom.ops.calc_checksum(hw);
1758 hw_dbg(hw,
"EEPROM read failed\n");
1781 else if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 &&
1782 mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)
1801 u32 rar_low, rar_high;
1802 u32 rar_entries = hw->
mac.num_rar_entries;
1805 if (index >= rar_entries) {
1806 hw_dbg(hw,
"RAR index %d is out of range.\n", index);
1811 hw->
mac.ops.set_vmdq(hw, index, vmdq);
1817 rar_low = ((
u32)addr[0] |
1818 ((
u32)addr[1] << 8) |
1819 ((
u32)addr[2] << 16) |
1820 ((
u32)addr[3] << 24));
1828 rar_high |= ((
u32)addr[4] | ((
u32)addr[5] << 8));
1830 if (enable_addr != 0)
1849 u32 rar_entries = hw->
mac.num_rar_entries;
1852 if (index >= rar_entries) {
1853 hw_dbg(hw,
"RAR index %d is out of range.\n", index);
1885 u32 rar_entries = hw->
mac.num_rar_entries;
1895 hw->
mac.ops.get_mac_addr(hw, hw->
mac.addr);
1897 hw_dbg(hw,
" Keeping Current RAR0 Addr =%pM\n", hw->
mac.addr);
1900 hw_dbg(hw,
"Overriding MAC Address in RAR[0]\n");
1901 hw_dbg(hw,
" New MAC Addr =%pM\n", hw->
mac.addr);
1913 hw_dbg(hw,
"Clearing RAR[1-%d]\n", rar_entries - 1);
1914 for (i = 1; i < rar_entries; i++) {
1923 hw_dbg(hw,
" Clearing MTA\n");
1924 for (i = 0; i < hw->
mac.mcft_size; i++)
1927 if (hw->
mac.ops.init_uta_tables)
1928 hw->
mac.ops.init_uta_tables(hw);
1945 static s32 ixgbe_mta_vector(
struct ixgbe_hw *hw,
u8 *mc_addr)
1949 switch (hw->
mac.mc_filter_type) {
1951 vector = ((mc_addr[4] >> 4) | (((
u16)mc_addr[5]) << 4));
1954 vector = ((mc_addr[4] >> 3) | (((
u16)mc_addr[5]) << 5));
1957 vector = ((mc_addr[4] >> 2) | (((
u16)mc_addr[5]) << 6));
1960 vector = ((mc_addr[4]) | (((
u16)mc_addr[5]) << 8));
1963 hw_dbg(hw,
"MC filter type param set incorrectly\n");
1979 static void ixgbe_set_mta(
struct ixgbe_hw *hw,
u8 *mc_addr)
1987 vector = ixgbe_mta_vector(hw, mc_addr);
1988 hw_dbg(hw,
" bit-vector = 0x%03X\n", vector);
1999 vector_reg = (vector >> 5) & 0x7F;
2000 vector_bit = vector & 0x1F;
2001 hw->
mac.mta_shadow[vector_reg] |= (1 << vector_bit);
2028 hw_dbg(hw,
" Clearing MTA\n");
2029 memset(&hw->
mac.mta_shadow, 0,
sizeof(hw->
mac.mta_shadow));
2033 hw_dbg(hw,
" Adding the multicast addresses:\n");
2034 ixgbe_set_mta(hw, ha->
addr);
2038 for (i = 0; i < hw->
mac.mcft_size; i++)
2040 hw->
mac.mta_shadow[i]);
2046 hw_dbg(hw,
"ixgbe_update_mc_addr_list_generic Complete\n");
2062 hw->
mac.mc_filter_type);
2092 u32 mflcn_reg, fccfg_reg;
2102 if (!hw->
fc.low_water ||
2103 !hw->
fc.high_water[0] ||
2104 !hw->
fc.pause_time) {
2105 hw_dbg(hw,
"Invalid water mark configuration\n");
2130 switch (hw->
fc.current_mode) {
2161 hw_dbg(hw,
"Flow control param set incorrectly\n");
2177 hw->
fc.high_water[
i]) {
2195 reg = hw->
fc.pause_time * 0x00010001;
2196 for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++)
2221 if ((!(adv_reg)) || (!(lp_reg)))
2224 if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) {
2234 hw_dbg(hw,
"Flow Control = FULL.\n");
2237 hw_dbg(hw,
"Flow Control=RX PAUSE frames only\n");
2239 }
else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) &&
2240 (lp_reg & lp_sym) && (lp_reg & lp_asm)) {
2242 hw_dbg(hw,
"Flow Control = TX PAUSE frames only.\n");
2243 }
else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) &&
2244 !(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
2246 hw_dbg(hw,
"Flow Control = RX PAUSE frames only.\n");
2249 hw_dbg(hw,
"Flow Control = NONE.\n");
2260 static s32 ixgbe_fc_autoneg_fiber(
struct ixgbe_hw *hw)
2262 u32 pcs_anadv_reg, pcs_lpab_reg, linkstat;
2279 ret_val = ixgbe_negotiate_fc(hw, pcs_anadv_reg,
2295 static s32 ixgbe_fc_autoneg_backplane(
struct ixgbe_hw *hw)
2297 u32 links2, anlp1_reg, autoc_reg, links;
2321 ret_val = ixgbe_negotiate_fc(hw, autoc_reg,
2335 static s32 ixgbe_fc_autoneg_copper(
struct ixgbe_hw *hw)
2337 u16 technology_ability_reg = 0;
2338 u16 lp_technology_ability_reg = 0;
2342 &technology_ability_reg);
2345 &lp_technology_ability_reg);
2347 return ixgbe_negotiate_fc(hw, (
u32)technology_ability_reg,
2348 (
u32)lp_technology_ability_reg,
2375 if (hw->
fc.disable_fc_autoneg)
2378 hw->
mac.ops.check_link(hw, &speed, &link_up,
false);
2382 switch (hw->
phy.media_type) {
2386 ret_val = ixgbe_fc_autoneg_fiber(hw);
2391 ret_val = ixgbe_fc_autoneg_backplane(hw);
2396 if (ixgbe_device_supports_autoneg_fc(hw) == 0)
2397 ret_val = ixgbe_fc_autoneg_copper(hw);
2406 hw->
fc.fc_was_autonegged =
true;
2408 hw->
fc.fc_was_autonegged =
false;
2409 hw->
fc.current_mode = hw->
fc.requested_mode;
2422 static s32 ixgbe_disable_pcie_master(
struct ixgbe_hw *hw)
2451 hw_dbg(hw,
"GIO Master Disable bit didn't clear - requesting resets\n");
2466 hw_dbg(hw,
"PCIe transaction pending bit also did not clear.\n");
2485 u32 fwmask = mask << 5;
2493 if (ixgbe_get_eeprom_semaphore(hw))
2497 if (!(gssr & (fwmask | swmask)))
2504 ixgbe_release_eeprom_semaphore(hw);
2510 hw_dbg(hw,
"Driver can't access resource, SW_FW_SYNC timeout.\n");
2517 ixgbe_release_eeprom_semaphore(hw);
2534 ixgbe_get_eeprom_semaphore(hw);
2540 ixgbe_release_eeprom_semaphore(hw);
2552 #define IXGBE_MAX_SECRX_POLL 40
2569 if (i >= IXGBE_MAX_SECRX_POLL)
2570 hw_dbg(hw,
"Rx unit being enabled before security "
2571 "path fully disabled. Continuing with init.\n");
2625 hw->
mac.ops.check_link(hw, &speed, &link_up,
false);
2675 static s32 ixgbe_get_san_mac_addr_offset(
struct ixgbe_hw *hw,
2676 u16 *san_mac_offset)
2699 u16 san_mac_data, san_mac_offset;
2706 ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
2708 if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
2713 for (i = 0; i < 6; i++)
2714 san_mac_addr[i] = 0xFF;
2716 goto san_mac_addr_out;
2720 hw->
mac.ops.set_lan_id(hw);
2724 for (i = 0; i < 3; i++) {
2725 hw->
eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
2726 san_mac_addr[i * 2] = (
u8)(san_mac_data);
2727 san_mac_addr[i * 2 + 1] = (
u8)(san_mac_data >> 8);
2749 switch (hw->
mac.type) {
2763 pci_read_config_word(adapter->
pdev, pcie_offset, &msix_count);
2769 if (msix_count > max_msix_count)
2770 msix_count = max_msix_count;
2783 u32 mpsar_lo, mpsar_hi;
2784 u32 rar_entries = hw->
mac.num_rar_entries;
2787 if (rar >= rar_entries) {
2788 hw_dbg(hw,
"RAR index %d is out of range.\n", rar);
2795 if (!mpsar_lo && !mpsar_hi)
2807 }
else if (vmdq < 32) {
2808 mpsar_lo &= ~(1 << vmdq);
2811 mpsar_hi &= ~(1 << (vmdq - 32));
2816 if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
2817 hw->
mac.ops.clear_rar(hw, rar);
2831 u32 rar_entries = hw->
mac.num_rar_entries;
2834 if (rar >= rar_entries) {
2835 hw_dbg(hw,
"RAR index %d is out of range.\n", rar);
2845 mpsar |= 1 << (vmdq - 32);
2863 u32 rar = hw->
mac.san_mac_rar_index;
2884 for (i = 0; i < 128; i++)
2901 u32 first_empty_slot = 0;
2914 if (!bits && !(first_empty_slot))
2915 first_empty_slot = regindex;
2916 else if ((bits & 0x0FFF) == vlan)
2925 if (regindex >= IXGBE_VLVF_ENTRIES) {
2926 if (first_empty_slot)
2927 regindex = first_empty_slot;
2929 hw_dbg(hw,
"No space in VLVF.\n");
2955 bool vfta_changed =
false;
2972 regindex = (vlan >> 5) & 0x7F;
2973 bitindex = vlan & 0x1F;
2974 targetbit = (1 << bitindex);
2978 if (!(vfta & targetbit)) {
2980 vfta_changed =
true;
2983 if ((vfta & targetbit)) {
2985 vfta_changed =
true;
3001 vlvf_index = ixgbe_find_vlvf_slot(hw, vlan);
3010 bits |= (1 << vind);
3017 bits |= (1 << (vind-32));
3027 bits &= ~(1 << vind);
3036 bits &= ~(1 << (vind-32));
3067 vfta_changed =
false;
3090 for (offset = 0; offset < hw->
mac.vft_size; offset++)
3112 bool *
link_up,
bool link_up_wait_to_complete)
3114 u32 links_reg, links_orig;
3122 if (links_orig != links_reg) {
3123 hw_dbg(hw,
"LINKS changed from %08X to %08X\n",
3124 links_orig, links_reg);
3127 if (link_up_wait_to_complete) {
3148 else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
3151 else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
3174 u16 alt_san_mac_blk_offset;
3177 *wwnn_prefix = 0xFFFF;
3178 *wwpn_prefix = 0xFFFF;
3182 &alt_san_mac_blk_offset);
3184 if ((alt_san_mac_blk_offset == 0) ||
3185 (alt_san_mac_blk_offset == 0xFFFF))
3186 goto wwn_prefix_out;
3190 hw->
eeprom.ops.read(hw, offset, &caps);
3192 goto wwn_prefix_out;
3196 hw->
eeprom.ops.read(hw, offset, wwnn_prefix);
3199 hw->
eeprom.ops.read(hw, offset, wwpn_prefix);
3215 int pf_target_reg = pf >> 3;
3216 int pf_target_shift = pf % 8;
3229 for (j = 0; j < pf_target_reg; j++)
3236 pfvfspoof &= (1 << pf_target_shift) - 1;
3256 int vf_target_reg = vf >> 3;
3265 pfvfspoof |= (1 << vf_target_shift);
3267 pfvfspoof &= ~(1 << vf_target_shift);
3298 u32 pbsize = hw->
mac.rx_pb_size;
3300 u32 rxpktsize, txpktsize, txpbthresh;
3316 rxpktsize = ((pbsize * 5 * 2) / (num_pb * 8));
3317 pbsize -= rxpktsize * (num_pb / 2);
3319 for (; i < (num_pb / 2); i++)
3325 for (; i < num_pb; i++)
3339 for (i = 0; i < num_pb; i++) {
3368 for (i = 0; i <
length; i++)
3371 return (
u8) (0 -
sum);
3384 static s32 ixgbe_host_interface_command(
struct ixgbe_hw *hw,
u32 *buffer,
3393 if (length == 0 || length & 0x3 ||
3395 hw_dbg(hw,
"Buffer length failure.\n");
3403 hw_dbg(hw,
"IXGBE_HOST_EN bit disabled.\n");
3409 dword_len = length >> 2;
3415 for (i = 0; i < dword_len; i++)
3430 if (i == IXGBE_HI_COMMAND_TIMEOUT ||
3432 hw_dbg(hw,
"Command has failed with no status valid.\n");
3438 dword_len = hdr_size >> 2;
3441 for (bi = 0; bi < dword_len; bi++) {
3451 if (length < (buf_len + hdr_size)) {
3452 hw_dbg(hw,
"Buffer not large enough for reply message.\n");
3458 dword_len = (buf_len + 3) >> 2;
3461 for (; bi <= dword_len; bi++) {
3503 fw_cmd.
hdr.checksum = 0;
3504 fw_cmd.
hdr.checksum = ixgbe_calculate_checksum((
u8 *)&fw_cmd,
3510 ret_val = ixgbe_host_interface_command(hw, (
u32 *)&fw_cmd,
3515 if (fw_cmd.
hdr.cmd_or_resp.ret_status ==
3539 u32 gcr_ext, hlreg0;
3570 static const u8 ixgbe_emc_temp_data[4] = {
3576 static const u8 ixgbe_emc_therm_limit[4] = {
3600 if ((*ets_offset == 0x0000) || (*ets_offset == 0xFFFF)) {
3605 status = hw->
eeprom.ops.read(hw, *ets_offset, ets_cfg);
3640 status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset);
3648 for (i = 0; i < num_sensors; i++) {
3652 status = hw->
eeprom.ops.read(hw, (ets_offset + 1 + i),
3662 if (sensor_location != 0) {
3663 status = hw->
phy.ops.read_i2c_byte(hw,
3664 ixgbe_emc_temp_data[sensor_index],
3688 u8 low_thresh_delta;
3702 status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset);
3712 for (i = 0; i < num_sensors; i++) {
3716 hw->
eeprom.ops.read(hw, (ets_offset + 1 + i), &ets_sensor);
3723 hw->
phy.ops.write_i2c_byte(hw,
3724 ixgbe_emc_therm_limit[sensor_index],
3727 if (sensor_location == 0)
3730 data->
sensor[
i].location = sensor_location;
3731 data->
sensor[
i].caution_thresh = therm_limit;
3732 data->
sensor[
i].max_op_thresh = therm_limit - low_thresh_delta;