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

ixgbe: Add hardware specific initialization code for 82599 devices

This patch adds the hardware initialization code specific to 82599. This
is similar to the 82598 hardware initialization code. It also includes all
changes to the existing hardware init code to support 82599.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

PJ Waskiewicz and committed by
David S. Miller
11afc1b1 8010dc30

+2927 -58
+5 -2
drivers/net/ixgbe/ixgbe_82598.c
··· 1046 1046 * 1047 1047 * Determines physical layer capabilities of the current configuration. 1048 1048 **/ 1049 - static s32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw) 1049 + static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw) 1050 1050 { 1051 - s32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; 1051 + u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; 1052 1052 1053 1053 switch (hw->device_id) { 1054 1054 case IXGBE_DEV_ID_82598: ··· 1111 1111 .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, 1112 1112 .get_media_type = &ixgbe_get_media_type_82598, 1113 1113 .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82598, 1114 + .enable_rx_dma = &ixgbe_enable_rx_dma_generic, 1114 1115 .get_mac_addr = &ixgbe_get_mac_addr_generic, 1115 1116 .stop_adapter = &ixgbe_stop_adapter_generic, 1117 + .get_bus_info = &ixgbe_get_bus_info_generic, 1118 + .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, 1116 1119 .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, 1117 1120 .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, 1118 1121 .setup_link = &ixgbe_setup_mac_link_82598,
+1277
drivers/net/ixgbe/ixgbe_82599.c
··· 1 + /******************************************************************************* 2 + 3 + Intel 10 Gigabit PCI Express Linux driver 4 + Copyright(c) 1999 - 2009 Intel Corporation. 5 + 6 + This program is free software; you can redistribute it and/or modify it 7 + under the terms and conditions of the GNU General Public License, 8 + version 2, as published by the Free Software Foundation. 9 + 10 + This program is distributed in the hope it will be useful, but WITHOUT 11 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + more details. 14 + 15 + You should have received a copy of the GNU General Public License along with 16 + this program; if not, write to the Free Software Foundation, Inc., 17 + 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 18 + 19 + The full GNU General Public License is included in this distribution in 20 + the file called "COPYING". 21 + 22 + Contact Information: 23 + e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> 24 + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 25 + 26 + *******************************************************************************/ 27 + 28 + #include <linux/pci.h> 29 + #include <linux/delay.h> 30 + #include <linux/sched.h> 31 + 32 + #include "ixgbe.h" 33 + #include "ixgbe_phy.h" 34 + 35 + #define IXGBE_82599_MAX_TX_QUEUES 128 36 + #define IXGBE_82599_MAX_RX_QUEUES 128 37 + #define IXGBE_82599_RAR_ENTRIES 128 38 + #define IXGBE_82599_MC_TBL_SIZE 128 39 + #define IXGBE_82599_VFT_TBL_SIZE 128 40 + 41 + s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, 42 + ixgbe_link_speed *speed, 43 + bool *autoneg); 44 + enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw); 45 + s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw); 46 + s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, 47 + ixgbe_link_speed speed, bool autoneg, 48 + bool autoneg_wait_to_complete); 49 + s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw); 50 + s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, 51 + ixgbe_link_speed *speed, 52 + bool *link_up, bool link_up_wait_to_complete); 53 + s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, 54 + ixgbe_link_speed speed, 55 + bool autoneg, 56 + bool autoneg_wait_to_complete); 57 + static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, 58 + ixgbe_link_speed *speed, 59 + bool *autoneg); 60 + static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw); 61 + static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, 62 + ixgbe_link_speed speed, 63 + bool autoneg, 64 + bool autoneg_wait_to_complete); 65 + s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw); 66 + s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq); 67 + s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq); 68 + s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, 69 + u32 vind, bool vlan_on); 70 + s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw); 71 + s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index); 72 + s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index); 73 + s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw); 74 + s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val); 75 + s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val); 76 + s32 ixgbe_start_hw_rev_0_82599(struct ixgbe_hw *hw); 77 + s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw); 78 + s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw); 79 + u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw); 80 + 81 + void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) 82 + { 83 + struct ixgbe_mac_info *mac = &hw->mac; 84 + if (hw->phy.multispeed_fiber) { 85 + /* Set up dual speed SFP+ support */ 86 + mac->ops.setup_link = 87 + &ixgbe_setup_mac_link_multispeed_fiber; 88 + mac->ops.setup_link_speed = 89 + &ixgbe_setup_mac_link_speed_multispeed_fiber; 90 + } else { 91 + mac->ops.setup_link = 92 + &ixgbe_setup_mac_link_82599; 93 + mac->ops.setup_link_speed = 94 + &ixgbe_setup_mac_link_speed_82599; 95 + } 96 + } 97 + 98 + s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) 99 + { 100 + s32 ret_val = 0; 101 + u16 list_offset, data_offset, data_value; 102 + 103 + if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { 104 + ixgbe_init_mac_link_ops_82599(hw); 105 + ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset, 106 + &data_offset); 107 + 108 + if (ret_val != 0) 109 + goto setup_sfp_out; 110 + 111 + hw->eeprom.ops.read(hw, ++data_offset, &data_value); 112 + while (data_value != 0xffff) { 113 + IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value); 114 + IXGBE_WRITE_FLUSH(hw); 115 + hw->eeprom.ops.read(hw, ++data_offset, &data_value); 116 + } 117 + /* Now restart DSP */ 118 + IXGBE_WRITE_REG(hw, IXGBE_CORECTL, 0x00000102); 119 + IXGBE_WRITE_REG(hw, IXGBE_CORECTL, 0x00000b1d); 120 + IXGBE_WRITE_FLUSH(hw); 121 + } 122 + 123 + setup_sfp_out: 124 + return ret_val; 125 + } 126 + 127 + /** 128 + * ixgbe_get_pcie_msix_count_82599 - Gets MSI-X vector count 129 + * @hw: pointer to hardware structure 130 + * 131 + * Read PCIe configuration space, and get the MSI-X vector count from 132 + * the capabilities table. 133 + **/ 134 + u32 ixgbe_get_pcie_msix_count_82599(struct ixgbe_hw *hw) 135 + { 136 + struct ixgbe_adapter *adapter = hw->back; 137 + u16 msix_count; 138 + pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82599_CAPS, 139 + &msix_count); 140 + msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK; 141 + 142 + /* MSI-X count is zero-based in HW, so increment to give proper value */ 143 + msix_count++; 144 + 145 + return msix_count; 146 + } 147 + 148 + static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) 149 + { 150 + struct ixgbe_mac_info *mac = &hw->mac; 151 + struct ixgbe_phy_info *phy = &hw->phy; 152 + s32 ret_val; 153 + 154 + /* Set the bus information prior to PHY identification */ 155 + mac->ops.get_bus_info(hw); 156 + 157 + /* Call PHY identify routine to get the Cu or SFI phy type */ 158 + ret_val = phy->ops.identify(hw); 159 + 160 + if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED) 161 + goto get_invariants_out; 162 + 163 + ixgbe_init_mac_link_ops_82599(hw); 164 + 165 + /* Setup SFP module if there is one present. */ 166 + ret_val = mac->ops.setup_sfp(hw); 167 + 168 + /* If copper media, overwrite with copper function pointers */ 169 + if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 170 + mac->ops.setup_link = &ixgbe_setup_copper_link_82599; 171 + mac->ops.setup_link_speed = 172 + &ixgbe_setup_copper_link_speed_82599; 173 + mac->ops.get_link_capabilities = 174 + &ixgbe_get_copper_link_capabilities_82599; 175 + } 176 + 177 + /* PHY Init */ 178 + switch (hw->phy.type) { 179 + case ixgbe_phy_tn: 180 + phy->ops.check_link = &ixgbe_check_phy_link_tnx; 181 + phy->ops.get_firmware_version = 182 + &ixgbe_get_phy_firmware_version_tnx; 183 + break; 184 + default: 185 + break; 186 + } 187 + 188 + mac->mcft_size = IXGBE_82599_MC_TBL_SIZE; 189 + mac->vft_size = IXGBE_82599_VFT_TBL_SIZE; 190 + mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES; 191 + mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES; 192 + mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES; 193 + mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw); 194 + 195 + get_invariants_out: 196 + return ret_val; 197 + } 198 + 199 + /** 200 + * ixgbe_get_link_capabilities_82599 - Determines link capabilities 201 + * @hw: pointer to hardware structure 202 + * @speed: pointer to link speed 203 + * @negotiation: true when autoneg or autotry is enabled 204 + * 205 + * Determines the link capabilities by reading the AUTOC register. 206 + **/ 207 + s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, 208 + ixgbe_link_speed *speed, 209 + bool *negotiation) 210 + { 211 + s32 status = 0; 212 + 213 + switch (hw->mac.orig_autoc & IXGBE_AUTOC_LMS_MASK) { 214 + case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: 215 + *speed = IXGBE_LINK_SPEED_1GB_FULL; 216 + *negotiation = false; 217 + break; 218 + 219 + case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: 220 + *speed = IXGBE_LINK_SPEED_10GB_FULL; 221 + *negotiation = false; 222 + break; 223 + 224 + case IXGBE_AUTOC_LMS_1G_AN: 225 + *speed = IXGBE_LINK_SPEED_1GB_FULL; 226 + *negotiation = true; 227 + break; 228 + 229 + case IXGBE_AUTOC_LMS_10G_SERIAL: 230 + *speed = IXGBE_LINK_SPEED_10GB_FULL; 231 + *negotiation = false; 232 + break; 233 + 234 + case IXGBE_AUTOC_LMS_KX4_KX_KR: 235 + case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN: 236 + *speed = IXGBE_LINK_SPEED_UNKNOWN; 237 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KR_SUPP) 238 + *speed |= IXGBE_LINK_SPEED_10GB_FULL; 239 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KX4_SUPP) 240 + *speed |= IXGBE_LINK_SPEED_10GB_FULL; 241 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KX_SUPP) 242 + *speed |= IXGBE_LINK_SPEED_1GB_FULL; 243 + *negotiation = true; 244 + break; 245 + 246 + case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII: 247 + *speed = IXGBE_LINK_SPEED_100_FULL; 248 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KR_SUPP) 249 + *speed |= IXGBE_LINK_SPEED_10GB_FULL; 250 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KX4_SUPP) 251 + *speed |= IXGBE_LINK_SPEED_10GB_FULL; 252 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KX_SUPP) 253 + *speed |= IXGBE_LINK_SPEED_1GB_FULL; 254 + *negotiation = true; 255 + break; 256 + 257 + case IXGBE_AUTOC_LMS_SGMII_1G_100M: 258 + *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL; 259 + *negotiation = false; 260 + break; 261 + 262 + default: 263 + status = IXGBE_ERR_LINK_SETUP; 264 + goto out; 265 + break; 266 + } 267 + 268 + if (hw->phy.multispeed_fiber) { 269 + *speed |= IXGBE_LINK_SPEED_10GB_FULL | 270 + IXGBE_LINK_SPEED_1GB_FULL; 271 + *negotiation = true; 272 + } 273 + 274 + out: 275 + return status; 276 + } 277 + 278 + /** 279 + * ixgbe_get_copper_link_capabilities_82599 - Determines link capabilities 280 + * @hw: pointer to hardware structure 281 + * @speed: pointer to link speed 282 + * @autoneg: boolean auto-negotiation value 283 + * 284 + * Determines the link capabilities by reading the AUTOC register. 285 + **/ 286 + static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, 287 + ixgbe_link_speed *speed, 288 + bool *autoneg) 289 + { 290 + s32 status = IXGBE_ERR_LINK_SETUP; 291 + u16 speed_ability; 292 + 293 + *speed = 0; 294 + *autoneg = true; 295 + 296 + status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_SPEED_ABILITY, 297 + IXGBE_MDIO_PMA_PMD_DEV_TYPE, 298 + &speed_ability); 299 + 300 + if (status == 0) { 301 + if (speed_ability & IXGBE_MDIO_PHY_SPEED_10G) 302 + *speed |= IXGBE_LINK_SPEED_10GB_FULL; 303 + if (speed_ability & IXGBE_MDIO_PHY_SPEED_1G) 304 + *speed |= IXGBE_LINK_SPEED_1GB_FULL; 305 + } 306 + 307 + return status; 308 + } 309 + 310 + /** 311 + * ixgbe_get_media_type_82599 - Get media type 312 + * @hw: pointer to hardware structure 313 + * 314 + * Returns the media type (fiber, copper, backplane) 315 + **/ 316 + enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) 317 + { 318 + enum ixgbe_media_type media_type; 319 + 320 + /* Detect if there is a copper PHY attached. */ 321 + if (hw->phy.type == ixgbe_phy_cu_unknown || 322 + hw->phy.type == ixgbe_phy_tn) { 323 + media_type = ixgbe_media_type_copper; 324 + goto out; 325 + } 326 + 327 + switch (hw->device_id) { 328 + case IXGBE_DEV_ID_82599: 329 + case IXGBE_DEV_ID_82599_KX4: 330 + /* Default device ID is mezzanine card KX/KX4 */ 331 + media_type = ixgbe_media_type_backplane; 332 + break; 333 + case IXGBE_DEV_ID_82599_SFP: 334 + media_type = ixgbe_media_type_fiber; 335 + break; 336 + default: 337 + media_type = ixgbe_media_type_unknown; 338 + break; 339 + } 340 + out: 341 + return media_type; 342 + } 343 + 344 + /** 345 + * ixgbe_setup_mac_link_82599 - Setup MAC link settings 346 + * @hw: pointer to hardware structure 347 + * 348 + * Configures link settings based on values in the ixgbe_hw struct. 349 + * Restarts the link. Performs autonegotiation if needed. 350 + **/ 351 + s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw) 352 + { 353 + u32 autoc_reg; 354 + u32 links_reg; 355 + u32 i; 356 + s32 status = 0; 357 + 358 + /* Restart link */ 359 + autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); 360 + autoc_reg |= IXGBE_AUTOC_AN_RESTART; 361 + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 362 + 363 + /* Only poll for autoneg to complete if specified to do so */ 364 + if (hw->phy.autoneg_wait_to_complete) { 365 + if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == 366 + IXGBE_AUTOC_LMS_KX4_KX_KR || 367 + (autoc_reg & IXGBE_AUTOC_LMS_MASK) == 368 + IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || 369 + (autoc_reg & IXGBE_AUTOC_LMS_MASK) == 370 + IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 371 + links_reg = 0; /* Just in case Autoneg time = 0 */ 372 + for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { 373 + links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); 374 + if (links_reg & IXGBE_LINKS_KX_AN_COMP) 375 + break; 376 + msleep(100); 377 + } 378 + if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 379 + status = IXGBE_ERR_AUTONEG_NOT_COMPLETE; 380 + hw_dbg(hw, "Autoneg did not complete.\n"); 381 + } 382 + } 383 + } 384 + 385 + /* Set up flow control */ 386 + status = ixgbe_setup_fc_generic(hw, 0); 387 + 388 + /* Add delay to filter out noises during initial link setup */ 389 + msleep(50); 390 + 391 + return status; 392 + } 393 + 394 + /** 395 + * ixgbe_setup_mac_link_multispeed_fiber - Setup MAC link settings 396 + * @hw: pointer to hardware structure 397 + * 398 + * Configures link settings based on values in the ixgbe_hw struct. 399 + * Restarts the link for multi-speed fiber at 1G speed, if link 400 + * fails at 10G. 401 + * Performs autonegotiation if needed. 402 + **/ 403 + s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw) 404 + { 405 + s32 status = 0; 406 + ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_82599_AUTONEG; 407 + status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, 408 + link_speed, 409 + true, true); 410 + return status; 411 + } 412 + 413 + /** 414 + * ixgbe_setup_mac_link_speed_multispeed_fiber - Set MAC link speed 415 + * @hw: pointer to hardware structure 416 + * @speed: new link speed 417 + * @autoneg: true if autonegotiation enabled 418 + * @autoneg_wait_to_complete: true when waiting for completion is needed 419 + * 420 + * Set the link speed in the AUTOC register and restarts link. 421 + **/ 422 + s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, 423 + ixgbe_link_speed speed, 424 + bool autoneg, 425 + bool autoneg_wait_to_complete) 426 + { 427 + s32 status = 0; 428 + ixgbe_link_speed phy_link_speed; 429 + ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN; 430 + u32 speedcnt = 0; 431 + u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); 432 + bool link_up = false; 433 + bool negotiation; 434 + 435 + /* Mask off requested but non-supported speeds */ 436 + hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation); 437 + speed &= phy_link_speed; 438 + 439 + /* 440 + * Try each speed one by one, highest priority first. We do this in 441 + * software because 10gb fiber doesn't support speed autonegotiation. 442 + */ 443 + if (speed & IXGBE_LINK_SPEED_10GB_FULL) { 444 + speedcnt++; 445 + highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL; 446 + 447 + /* Set hardware SDP's */ 448 + esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); 449 + IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); 450 + 451 + ixgbe_setup_mac_link_speed_82599(hw, 452 + IXGBE_LINK_SPEED_10GB_FULL, 453 + autoneg, 454 + autoneg_wait_to_complete); 455 + 456 + msleep(50); 457 + 458 + /* If we have link, just jump out */ 459 + hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false); 460 + if (link_up) 461 + goto out; 462 + } 463 + 464 + if (speed & IXGBE_LINK_SPEED_1GB_FULL) { 465 + speedcnt++; 466 + if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN) 467 + highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL; 468 + 469 + /* Set hardware SDP's */ 470 + esdp_reg &= ~IXGBE_ESDP_SDP5; 471 + esdp_reg |= IXGBE_ESDP_SDP5_DIR; 472 + IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); 473 + 474 + ixgbe_setup_mac_link_speed_82599( 475 + hw, IXGBE_LINK_SPEED_1GB_FULL, autoneg, 476 + autoneg_wait_to_complete); 477 + 478 + msleep(50); 479 + 480 + /* If we have link, just jump out */ 481 + hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false); 482 + if (link_up) 483 + goto out; 484 + } 485 + 486 + /* 487 + * We didn't get link. Configure back to the highest speed we tried, 488 + * (if there was more than one). We call ourselves back with just the 489 + * single highest speed that the user requested. 490 + */ 491 + if (speedcnt > 1) 492 + status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, 493 + highest_link_speed, 494 + autoneg, 495 + autoneg_wait_to_complete); 496 + 497 + out: 498 + return status; 499 + } 500 + 501 + /** 502 + * ixgbe_check_mac_link_82599 - Determine link and speed status 503 + * @hw: pointer to hardware structure 504 + * @speed: pointer to link speed 505 + * @link_up: true when link is up 506 + * @link_up_wait_to_complete: bool used to wait for link up or not 507 + * 508 + * Reads the links register to determine if link is up and the current speed 509 + **/ 510 + s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 511 + bool *link_up, bool link_up_wait_to_complete) 512 + { 513 + u32 links_reg; 514 + u32 i; 515 + 516 + links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); 517 + if (link_up_wait_to_complete) { 518 + for (i = 0; i < IXGBE_LINK_UP_TIME; i++) { 519 + if (links_reg & IXGBE_LINKS_UP) { 520 + *link_up = true; 521 + break; 522 + } else { 523 + *link_up = false; 524 + } 525 + msleep(100); 526 + links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); 527 + } 528 + } else { 529 + if (links_reg & IXGBE_LINKS_UP) 530 + *link_up = true; 531 + else 532 + *link_up = false; 533 + } 534 + 535 + if ((links_reg & IXGBE_LINKS_SPEED_82599) == 536 + IXGBE_LINKS_SPEED_10G_82599) 537 + *speed = IXGBE_LINK_SPEED_10GB_FULL; 538 + else if ((links_reg & IXGBE_LINKS_SPEED_82599) == 539 + IXGBE_LINKS_SPEED_1G_82599) 540 + *speed = IXGBE_LINK_SPEED_1GB_FULL; 541 + else 542 + *speed = IXGBE_LINK_SPEED_100_FULL; 543 + 544 + 545 + return 0; 546 + } 547 + 548 + /** 549 + * ixgbe_setup_mac_link_speed_82599 - Set MAC link speed 550 + * @hw: pointer to hardware structure 551 + * @speed: new link speed 552 + * @autoneg: true if autonegotiation enabled 553 + * @autoneg_wait_to_complete: true when waiting for completion is needed 554 + * 555 + * Set the link speed in the AUTOC register and restarts link. 556 + **/ 557 + s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, 558 + ixgbe_link_speed speed, bool autoneg, 559 + bool autoneg_wait_to_complete) 560 + { 561 + s32 status = 0; 562 + u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); 563 + u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); 564 + u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK; 565 + u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; 566 + u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; 567 + u32 links_reg; 568 + u32 i; 569 + ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; 570 + 571 + /* Check to see if speed passed in is supported. */ 572 + hw->mac.ops.get_link_capabilities(hw, &link_capabilities, &autoneg); 573 + speed &= link_capabilities; 574 + 575 + if (speed == IXGBE_LINK_SPEED_UNKNOWN) { 576 + status = IXGBE_ERR_LINK_SETUP; 577 + } else if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || 578 + link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || 579 + link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 580 + /* Set KX4/KX/KR support according to speed requested */ 581 + autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP); 582 + if (speed & IXGBE_LINK_SPEED_10GB_FULL) 583 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KX4_SUPP) 584 + autoc |= IXGBE_AUTOC_KX4_SUPP; 585 + if (hw->mac.orig_autoc & IXGBE_AUTOC_KR_SUPP) 586 + autoc |= IXGBE_AUTOC_KR_SUPP; 587 + if (speed & IXGBE_LINK_SPEED_1GB_FULL) 588 + autoc |= IXGBE_AUTOC_KX_SUPP; 589 + } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) && 590 + (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN || 591 + link_mode == IXGBE_AUTOC_LMS_1G_AN)) { 592 + /* Switch from 1G SFI to 10G SFI if requested */ 593 + if ((speed == IXGBE_LINK_SPEED_10GB_FULL) && 594 + (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) { 595 + autoc &= ~IXGBE_AUTOC_LMS_MASK; 596 + autoc |= IXGBE_AUTOC_LMS_10G_SERIAL; 597 + } 598 + } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) && 599 + (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) { 600 + /* Switch from 10G SFI to 1G SFI if requested */ 601 + if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && 602 + (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) { 603 + autoc &= ~IXGBE_AUTOC_LMS_MASK; 604 + if (autoneg) 605 + autoc |= IXGBE_AUTOC_LMS_1G_AN; 606 + else 607 + autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN; 608 + } 609 + } 610 + 611 + if (status == 0) { 612 + /* Restart link */ 613 + autoc |= IXGBE_AUTOC_AN_RESTART; 614 + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); 615 + 616 + /* Only poll for autoneg to complete if specified to do so */ 617 + if (autoneg_wait_to_complete) { 618 + if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || 619 + link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || 620 + link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 621 + links_reg = 0; /*Just in case Autoneg time=0*/ 622 + for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { 623 + links_reg = 624 + IXGBE_READ_REG(hw, IXGBE_LINKS); 625 + if (links_reg & IXGBE_LINKS_KX_AN_COMP) 626 + break; 627 + msleep(100); 628 + } 629 + if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 630 + status = 631 + IXGBE_ERR_AUTONEG_NOT_COMPLETE; 632 + hw_dbg(hw, "Autoneg did not " 633 + "complete.\n"); 634 + } 635 + } 636 + } 637 + 638 + /* Set up flow control */ 639 + status = ixgbe_setup_fc_generic(hw, 0); 640 + 641 + /* Add delay to filter out noises during initial link setup */ 642 + msleep(50); 643 + } 644 + 645 + return status; 646 + } 647 + 648 + /** 649 + * ixgbe_setup_copper_link_82599 - Setup copper link settings 650 + * @hw: pointer to hardware structure 651 + * 652 + * Restarts the link on PHY and then MAC. Performs autonegotiation if needed. 653 + **/ 654 + static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw) 655 + { 656 + s32 status; 657 + 658 + /* Restart autonegotiation on PHY */ 659 + status = hw->phy.ops.setup_link(hw); 660 + 661 + /* Set up MAC */ 662 + ixgbe_setup_mac_link_82599(hw); 663 + 664 + return status; 665 + } 666 + 667 + /** 668 + * ixgbe_setup_copper_link_speed_82599 - Set the PHY autoneg advertised field 669 + * @hw: pointer to hardware structure 670 + * @speed: new link speed 671 + * @autoneg: true if autonegotiation enabled 672 + * @autoneg_wait_to_complete: true if waiting is needed to complete 673 + * 674 + * Restarts link on PHY and MAC based on settings passed in. 675 + **/ 676 + static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, 677 + ixgbe_link_speed speed, 678 + bool autoneg, 679 + bool autoneg_wait_to_complete) 680 + { 681 + s32 status; 682 + 683 + /* Setup the PHY according to input speed */ 684 + status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, 685 + autoneg_wait_to_complete); 686 + /* Set up MAC */ 687 + ixgbe_setup_mac_link_82599(hw); 688 + 689 + return status; 690 + } 691 + 692 + /** 693 + * ixgbe_reset_hw_82599 - Perform hardware reset 694 + * @hw: pointer to hardware structure 695 + * 696 + * Resets the hardware by resetting the transmit and receive units, masks 697 + * and clears all interrupts, perform a PHY reset, and perform a link (MAC) 698 + * reset. 699 + **/ 700 + s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) 701 + { 702 + s32 status = 0; 703 + u32 ctrl, ctrl_ext; 704 + u32 i; 705 + u32 autoc; 706 + u32 autoc2; 707 + 708 + /* Call adapter stop to disable tx/rx and clear interrupts */ 709 + hw->mac.ops.stop_adapter(hw); 710 + 711 + /* Reset PHY */ 712 + hw->phy.ops.reset(hw); 713 + 714 + /* 715 + * Prevent the PCI-E bus from from hanging by disabling PCI-E master 716 + * access and verify no pending requests before reset 717 + */ 718 + if (ixgbe_disable_pcie_master(hw) != 0) { 719 + status = IXGBE_ERR_MASTER_REQUESTS_PENDING; 720 + hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 721 + } 722 + 723 + /* 724 + * Issue global reset to the MAC. This needs to be a SW reset. 725 + * If link reset is used, it might reset the MAC when mng is using it 726 + */ 727 + ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); 728 + IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST)); 729 + IXGBE_WRITE_FLUSH(hw); 730 + 731 + /* Poll for reset bit to self-clear indicating reset is complete */ 732 + for (i = 0; i < 10; i++) { 733 + udelay(1); 734 + ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); 735 + if (!(ctrl & IXGBE_CTRL_RST)) 736 + break; 737 + } 738 + if (ctrl & IXGBE_CTRL_RST) { 739 + status = IXGBE_ERR_RESET_FAILED; 740 + hw_dbg(hw, "Reset polling failed to complete.\n"); 741 + } 742 + /* Clear PF Reset Done bit so PF/VF Mail Ops can work */ 743 + ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); 744 + ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD; 745 + IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); 746 + 747 + msleep(50); 748 + 749 + 750 + 751 + /* 752 + * Store the original AUTOC/AUTOC2 values if they have not been 753 + * stored off yet. Otherwise restore the stored original 754 + * values since the reset operation sets back to defaults. 755 + */ 756 + autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); 757 + autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); 758 + if (hw->mac.orig_link_settings_stored == false) { 759 + hw->mac.orig_autoc = autoc; 760 + hw->mac.orig_autoc2 = autoc2; 761 + hw->mac.orig_link_settings_stored = true; 762 + } else { 763 + if (autoc != hw->mac.orig_autoc) 764 + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc | 765 + IXGBE_AUTOC_AN_RESTART)); 766 + 767 + if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) != 768 + (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) { 769 + autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK; 770 + autoc2 |= (hw->mac.orig_autoc2 & 771 + IXGBE_AUTOC2_UPPER_MASK); 772 + IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); 773 + } 774 + } 775 + 776 + /* Store the permanent mac address */ 777 + hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 778 + 779 + return status; 780 + } 781 + 782 + /** 783 + * ixgbe_clear_vmdq_82599 - Disassociate a VMDq pool index from a rx address 784 + * @hw: pointer to hardware struct 785 + * @rar: receive address register index to disassociate 786 + * @vmdq: VMDq pool index to remove from the rar 787 + **/ 788 + s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq) 789 + { 790 + u32 mpsar_lo, mpsar_hi; 791 + u32 rar_entries = hw->mac.num_rar_entries; 792 + 793 + if (rar < rar_entries) { 794 + mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); 795 + mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); 796 + 797 + if (!mpsar_lo && !mpsar_hi) 798 + goto done; 799 + 800 + if (vmdq == IXGBE_CLEAR_VMDQ_ALL) { 801 + if (mpsar_lo) { 802 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); 803 + mpsar_lo = 0; 804 + } 805 + if (mpsar_hi) { 806 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); 807 + mpsar_hi = 0; 808 + } 809 + } else if (vmdq < 32) { 810 + mpsar_lo &= ~(1 << vmdq); 811 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo); 812 + } else { 813 + mpsar_hi &= ~(1 << (vmdq - 32)); 814 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi); 815 + } 816 + 817 + /* was that the last pool using this rar? */ 818 + if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0) 819 + hw->mac.ops.clear_rar(hw, rar); 820 + } else { 821 + hw_dbg(hw, "RAR index %d is out of range.\n", rar); 822 + } 823 + 824 + done: 825 + return 0; 826 + } 827 + 828 + /** 829 + * ixgbe_set_vmdq_82599 - Associate a VMDq pool index with a rx address 830 + * @hw: pointer to hardware struct 831 + * @rar: receive address register index to associate with a VMDq index 832 + * @vmdq: VMDq pool index 833 + **/ 834 + s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq) 835 + { 836 + u32 mpsar; 837 + u32 rar_entries = hw->mac.num_rar_entries; 838 + 839 + if (rar < rar_entries) { 840 + if (vmdq < 32) { 841 + mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); 842 + mpsar |= 1 << vmdq; 843 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar); 844 + } else { 845 + mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); 846 + mpsar |= 1 << (vmdq - 32); 847 + IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar); 848 + } 849 + } else { 850 + hw_dbg(hw, "RAR index %d is out of range.\n", rar); 851 + } 852 + return 0; 853 + } 854 + 855 + /** 856 + * ixgbe_set_vfta_82599 - Set VLAN filter table 857 + * @hw: pointer to hardware structure 858 + * @vlan: VLAN id to write to VLAN filter 859 + * @vind: VMDq output index that maps queue to VLAN id in VFVFB 860 + * @vlan_on: boolean flag to turn on/off VLAN in VFVF 861 + * 862 + * Turn on/off specified VLAN in the VLAN filter table. 863 + **/ 864 + s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, u32 vind, 865 + bool vlan_on) 866 + { 867 + u32 regindex; 868 + u32 bitindex; 869 + u32 bits; 870 + u32 first_empty_slot; 871 + 872 + if (vlan > 4095) 873 + return IXGBE_ERR_PARAM; 874 + 875 + /* 876 + * this is a 2 part operation - first the VFTA, then the 877 + * VLVF and VLVFB if vind is set 878 + */ 879 + 880 + /* Part 1 881 + * The VFTA is a bitstring made up of 128 32-bit registers 882 + * that enable the particular VLAN id, much like the MTA: 883 + * bits[11-5]: which register 884 + * bits[4-0]: which bit in the register 885 + */ 886 + regindex = (vlan >> 5) & 0x7F; 887 + bitindex = vlan & 0x1F; 888 + bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex)); 889 + if (vlan_on) 890 + bits |= (1 << bitindex); 891 + else 892 + bits &= ~(1 << bitindex); 893 + IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits); 894 + 895 + 896 + /* Part 2 897 + * If the vind is set 898 + * Either vlan_on 899 + * make sure the vlan is in VLVF 900 + * set the vind bit in the matching VLVFB 901 + * Or !vlan_on 902 + * clear the pool bit and possibly the vind 903 + */ 904 + if (vind) { 905 + /* find the vlanid or the first empty slot */ 906 + first_empty_slot = 0; 907 + 908 + for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) { 909 + bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex)); 910 + if (!bits && !first_empty_slot) 911 + first_empty_slot = regindex; 912 + else if ((bits & 0x0FFF) == vlan) 913 + break; 914 + } 915 + 916 + if (regindex >= IXGBE_VLVF_ENTRIES) { 917 + if (first_empty_slot) 918 + regindex = first_empty_slot; 919 + else { 920 + hw_dbg(hw, "No space in VLVF.\n"); 921 + goto out; 922 + } 923 + } 924 + 925 + if (vlan_on) { 926 + /* set the pool bit */ 927 + if (vind < 32) { 928 + bits = IXGBE_READ_REG(hw, 929 + IXGBE_VLVFB(regindex * 2)); 930 + bits |= (1 << vind); 931 + IXGBE_WRITE_REG(hw, 932 + IXGBE_VLVFB(regindex * 2), bits); 933 + } else { 934 + bits = IXGBE_READ_REG(hw, 935 + IXGBE_VLVFB((regindex * 2) + 1)); 936 + bits |= (1 << vind); 937 + IXGBE_WRITE_REG(hw, 938 + IXGBE_VLVFB((regindex * 2) + 1), bits); 939 + } 940 + } else { 941 + /* clear the pool bit */ 942 + if (vind < 32) { 943 + bits = IXGBE_READ_REG(hw, 944 + IXGBE_VLVFB(regindex * 2)); 945 + bits &= ~(1 << vind); 946 + IXGBE_WRITE_REG(hw, 947 + IXGBE_VLVFB(regindex * 2), bits); 948 + bits |= IXGBE_READ_REG(hw, 949 + IXGBE_VLVFB((regindex * 2) + 1)); 950 + } else { 951 + bits = IXGBE_READ_REG(hw, 952 + IXGBE_VLVFB((regindex * 2) + 1)); 953 + bits &= ~(1 << vind); 954 + IXGBE_WRITE_REG(hw, 955 + IXGBE_VLVFB((regindex * 2) + 1), bits); 956 + bits |= IXGBE_READ_REG(hw, 957 + IXGBE_VLVFB(regindex * 2)); 958 + } 959 + } 960 + 961 + if (bits) 962 + IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex), 963 + (IXGBE_VLVF_VIEN | vlan)); 964 + else 965 + IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex), 0); 966 + } 967 + 968 + out: 969 + return 0; 970 + } 971 + 972 + /** 973 + * ixgbe_clear_vfta_82599 - Clear VLAN filter table 974 + * @hw: pointer to hardware structure 975 + * 976 + * Clears the VLAN filer table, and the VMDq index associated with the filter 977 + **/ 978 + s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw) 979 + { 980 + u32 offset; 981 + 982 + for (offset = 0; offset < hw->mac.vft_size; offset++) 983 + IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0); 984 + 985 + for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) { 986 + IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0); 987 + IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2), 0); 988 + IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset * 2) + 1), 0); 989 + } 990 + 991 + return 0; 992 + } 993 + 994 + /** 995 + * ixgbe_blink_led_start_82599 - Blink LED based on index. 996 + * @hw: pointer to hardware structure 997 + * @index: led number to blink 998 + **/ 999 + s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index) 1000 + { 1001 + u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 1002 + 1003 + led_reg &= ~IXGBE_LED_MODE_MASK(index); 1004 + led_reg |= IXGBE_LED_BLINK(index); 1005 + IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); 1006 + IXGBE_WRITE_FLUSH(hw); 1007 + 1008 + return 0; 1009 + } 1010 + 1011 + /** 1012 + * ixgbe_blink_led_stop_82599 - Stop blinking LED based on index. 1013 + * @hw: pointer to hardware structure 1014 + * @index: led number to stop blinking 1015 + **/ 1016 + s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index) 1017 + { 1018 + u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 1019 + 1020 + led_reg &= ~IXGBE_LED_MODE_MASK(index); 1021 + led_reg &= ~IXGBE_LED_BLINK(index); 1022 + IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); 1023 + IXGBE_WRITE_FLUSH(hw); 1024 + 1025 + return 0; 1026 + } 1027 + 1028 + /** 1029 + * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array 1030 + * @hw: pointer to hardware structure 1031 + **/ 1032 + s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw) 1033 + { 1034 + int i; 1035 + hw_dbg(hw, " Clearing UTA\n"); 1036 + 1037 + for (i = 0; i < 128; i++) 1038 + IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0); 1039 + 1040 + return 0; 1041 + } 1042 + 1043 + /** 1044 + * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register 1045 + * @hw: pointer to hardware structure 1046 + * @reg: analog register to read 1047 + * @val: read value 1048 + * 1049 + * Performs read operation to Omer analog register specified. 1050 + **/ 1051 + s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) 1052 + { 1053 + u32 core_ctl; 1054 + 1055 + IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD | 1056 + (reg << 8)); 1057 + IXGBE_WRITE_FLUSH(hw); 1058 + udelay(10); 1059 + core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL); 1060 + *val = (u8)core_ctl; 1061 + 1062 + return 0; 1063 + } 1064 + 1065 + /** 1066 + * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register 1067 + * @hw: pointer to hardware structure 1068 + * @reg: atlas register to write 1069 + * @val: value to write 1070 + * 1071 + * Performs write operation to Omer analog register specified. 1072 + **/ 1073 + s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) 1074 + { 1075 + u32 core_ctl; 1076 + 1077 + core_ctl = (reg << 8) | val; 1078 + IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl); 1079 + IXGBE_WRITE_FLUSH(hw); 1080 + udelay(10); 1081 + 1082 + return 0; 1083 + } 1084 + 1085 + /** 1086 + * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx 1087 + * @hw: pointer to hardware structure 1088 + * 1089 + * Starts the hardware using the generic start_hw function. 1090 + * Then performs device-specific: 1091 + * Clears the rate limiter registers. 1092 + **/ 1093 + s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) 1094 + { 1095 + u32 q_num; 1096 + 1097 + ixgbe_start_hw_generic(hw); 1098 + 1099 + /* Clear the rate limiters */ 1100 + for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) { 1101 + IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num); 1102 + IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); 1103 + } 1104 + IXGBE_WRITE_FLUSH(hw); 1105 + 1106 + return 0; 1107 + } 1108 + 1109 + /** 1110 + * ixgbe_identify_phy_82599 - Get physical layer module 1111 + * @hw: pointer to hardware structure 1112 + * 1113 + * Determines the physical layer module found on the current adapter. 1114 + **/ 1115 + s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw) 1116 + { 1117 + s32 status = IXGBE_ERR_PHY_ADDR_INVALID; 1118 + status = ixgbe_identify_phy_generic(hw); 1119 + if (status != 0) 1120 + status = ixgbe_identify_sfp_module_generic(hw); 1121 + return status; 1122 + } 1123 + 1124 + /** 1125 + * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type 1126 + * @hw: pointer to hardware structure 1127 + * 1128 + * Determines physical layer capabilities of the current configuration. 1129 + **/ 1130 + u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw) 1131 + { 1132 + u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; 1133 + 1134 + switch (hw->device_id) { 1135 + case IXGBE_DEV_ID_82599: 1136 + case IXGBE_DEV_ID_82599_KX4: 1137 + /* Default device ID is mezzanine card KX/KX4 */ 1138 + physical_layer = (IXGBE_PHYSICAL_LAYER_10GBASE_KX4 | 1139 + IXGBE_PHYSICAL_LAYER_1000BASE_KX); 1140 + break; 1141 + case IXGBE_DEV_ID_82599_SFP: 1142 + hw->phy.ops.identify_sfp(hw); 1143 + 1144 + switch (hw->phy.sfp_type) { 1145 + case ixgbe_sfp_type_da_cu: 1146 + physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU; 1147 + break; 1148 + case ixgbe_sfp_type_sr: 1149 + physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR; 1150 + break; 1151 + case ixgbe_sfp_type_lr: 1152 + physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR; 1153 + break; 1154 + default: 1155 + physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; 1156 + break; 1157 + } 1158 + break; 1159 + default: 1160 + physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; 1161 + break; 1162 + } 1163 + 1164 + return physical_layer; 1165 + } 1166 + 1167 + /** 1168 + * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599 1169 + * @hw: pointer to hardware structure 1170 + * @regval: register value to write to RXCTRL 1171 + * 1172 + * Enables the Rx DMA unit for 82599 1173 + **/ 1174 + s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval) 1175 + { 1176 + #define IXGBE_MAX_SECRX_POLL 30 1177 + int i; 1178 + int secrxreg; 1179 + 1180 + /* 1181 + * Workaround for 82599 silicon errata when enabling the Rx datapath. 1182 + * If traffic is incoming before we enable the Rx unit, it could hang 1183 + * the Rx DMA unit. Therefore, make sure the security engine is 1184 + * completely disabled prior to enabling the Rx unit. 1185 + */ 1186 + secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); 1187 + secrxreg |= IXGBE_SECRXCTRL_RX_DIS; 1188 + IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); 1189 + for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) { 1190 + secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); 1191 + if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY) 1192 + break; 1193 + else 1194 + udelay(10); 1195 + } 1196 + 1197 + /* For informational purposes only */ 1198 + if (i >= IXGBE_MAX_SECRX_POLL) 1199 + hw_dbg(hw, "Rx unit being enabled before security " 1200 + "path fully disabled. Continuing with init.\n"); 1201 + 1202 + IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); 1203 + secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); 1204 + secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS; 1205 + IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); 1206 + IXGBE_WRITE_FLUSH(hw); 1207 + 1208 + return 0; 1209 + } 1210 + 1211 + static struct ixgbe_mac_operations mac_ops_82599 = { 1212 + .init_hw = &ixgbe_init_hw_generic, 1213 + .reset_hw = &ixgbe_reset_hw_82599, 1214 + .start_hw = &ixgbe_start_hw_82599, 1215 + .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, 1216 + .get_media_type = &ixgbe_get_media_type_82599, 1217 + .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, 1218 + .enable_rx_dma = &ixgbe_enable_rx_dma_82599, 1219 + .get_mac_addr = &ixgbe_get_mac_addr_generic, 1220 + .stop_adapter = &ixgbe_stop_adapter_generic, 1221 + .get_bus_info = &ixgbe_get_bus_info_generic, 1222 + .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, 1223 + .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, 1224 + .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, 1225 + .setup_link = &ixgbe_setup_mac_link_82599, 1226 + .setup_link_speed = &ixgbe_setup_mac_link_speed_82599, 1227 + .check_link = &ixgbe_check_mac_link_82599, 1228 + .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 1229 + .led_on = &ixgbe_led_on_generic, 1230 + .led_off = &ixgbe_led_off_generic, 1231 + .blink_led_start = &ixgbe_blink_led_start_82599, 1232 + .blink_led_stop = &ixgbe_blink_led_stop_82599, 1233 + .set_rar = &ixgbe_set_rar_generic, 1234 + .clear_rar = &ixgbe_clear_rar_generic, 1235 + .set_vmdq = &ixgbe_set_vmdq_82599, 1236 + .clear_vmdq = &ixgbe_clear_vmdq_82599, 1237 + .init_rx_addrs = &ixgbe_init_rx_addrs_generic, 1238 + .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic, 1239 + .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, 1240 + .enable_mc = &ixgbe_enable_mc_generic, 1241 + .disable_mc = &ixgbe_disable_mc_generic, 1242 + .clear_vfta = &ixgbe_clear_vfta_82599, 1243 + .set_vfta = &ixgbe_set_vfta_82599, 1244 + .setup_fc = &ixgbe_setup_fc_generic, 1245 + .init_uta_tables = &ixgbe_init_uta_tables_82599, 1246 + .setup_sfp = &ixgbe_setup_sfp_modules_82599, 1247 + }; 1248 + 1249 + static struct ixgbe_eeprom_operations eeprom_ops_82599 = { 1250 + .init_params = &ixgbe_init_eeprom_params_generic, 1251 + .read = &ixgbe_read_eeprom_generic, 1252 + .write = &ixgbe_write_eeprom_generic, 1253 + .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, 1254 + .update_checksum = &ixgbe_update_eeprom_checksum_generic, 1255 + }; 1256 + 1257 + static struct ixgbe_phy_operations phy_ops_82599 = { 1258 + .identify = &ixgbe_identify_phy_82599, 1259 + .identify_sfp = &ixgbe_identify_sfp_module_generic, 1260 + .reset = &ixgbe_reset_phy_generic, 1261 + .read_reg = &ixgbe_read_phy_reg_generic, 1262 + .write_reg = &ixgbe_write_phy_reg_generic, 1263 + .setup_link = &ixgbe_setup_phy_link_generic, 1264 + .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, 1265 + .read_i2c_byte = &ixgbe_read_i2c_byte_generic, 1266 + .write_i2c_byte = &ixgbe_write_i2c_byte_generic, 1267 + .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, 1268 + .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, 1269 + }; 1270 + 1271 + struct ixgbe_info ixgbe_82599_info = { 1272 + .mac = ixgbe_mac_82599EB, 1273 + .get_invariants = &ixgbe_get_invariants_82599, 1274 + .mac_ops = &mac_ops_82599, 1275 + .eeprom_ops = &eeprom_ops_82599, 1276 + .phy_ops = &phy_ops_82599, 1277 + };
+319
drivers/net/ixgbe/ixgbe_common.c
··· 29 29 #include <linux/delay.h> 30 30 #include <linux/sched.h> 31 31 32 + #include "ixgbe.h" 32 33 #include "ixgbe_common.h" 33 34 #include "ixgbe_phy.h" 34 35 ··· 252 251 } 253 252 254 253 /** 254 + * ixgbe_get_bus_info_generic - Generic set PCI bus info 255 + * @hw: pointer to hardware structure 256 + * 257 + * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure 258 + **/ 259 + s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw) 260 + { 261 + struct ixgbe_adapter *adapter = hw->back; 262 + struct ixgbe_mac_info *mac = &hw->mac; 263 + u16 link_status; 264 + 265 + hw->bus.type = ixgbe_bus_type_pci_express; 266 + 267 + /* Get the negotiated link width and speed from PCI config space */ 268 + pci_read_config_word(adapter->pdev, IXGBE_PCI_LINK_STATUS, 269 + &link_status); 270 + 271 + switch (link_status & IXGBE_PCI_LINK_WIDTH) { 272 + case IXGBE_PCI_LINK_WIDTH_1: 273 + hw->bus.width = ixgbe_bus_width_pcie_x1; 274 + break; 275 + case IXGBE_PCI_LINK_WIDTH_2: 276 + hw->bus.width = ixgbe_bus_width_pcie_x2; 277 + break; 278 + case IXGBE_PCI_LINK_WIDTH_4: 279 + hw->bus.width = ixgbe_bus_width_pcie_x4; 280 + break; 281 + case IXGBE_PCI_LINK_WIDTH_8: 282 + hw->bus.width = ixgbe_bus_width_pcie_x8; 283 + break; 284 + default: 285 + hw->bus.width = ixgbe_bus_width_unknown; 286 + break; 287 + } 288 + 289 + switch (link_status & IXGBE_PCI_LINK_SPEED) { 290 + case IXGBE_PCI_LINK_SPEED_2500: 291 + hw->bus.speed = ixgbe_bus_speed_2500; 292 + break; 293 + case IXGBE_PCI_LINK_SPEED_5000: 294 + hw->bus.speed = ixgbe_bus_speed_5000; 295 + break; 296 + default: 297 + hw->bus.speed = ixgbe_bus_speed_unknown; 298 + break; 299 + } 300 + 301 + mac->ops.set_lan_id(hw); 302 + 303 + return 0; 304 + } 305 + 306 + /** 307 + * ixgbe_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices 308 + * @hw: pointer to the HW structure 309 + * 310 + * Determines the LAN function id by reading memory-mapped registers 311 + * and swaps the port value if requested. 312 + **/ 313 + void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw) 314 + { 315 + struct ixgbe_bus_info *bus = &hw->bus; 316 + u32 reg; 317 + 318 + reg = IXGBE_READ_REG(hw, IXGBE_STATUS); 319 + bus->func = (reg & IXGBE_STATUS_LAN_ID) >> IXGBE_STATUS_LAN_ID_SHIFT; 320 + bus->lan_id = bus->func; 321 + 322 + /* check for a port swap */ 323 + reg = IXGBE_READ_REG(hw, IXGBE_FACTPS); 324 + if (reg & IXGBE_FACTPS_LFS) 325 + bus->func ^= 0x1; 326 + } 327 + 328 + /** 255 329 * ixgbe_stop_adapter_generic - Generic stop Tx/Rx units 256 330 * @hw: pointer to hardware structure 257 331 * ··· 463 387 } 464 388 465 389 return 0; 390 + } 391 + 392 + /** 393 + * ixgbe_write_eeprom_generic - Writes 16 bit value to EEPROM 394 + * @hw: pointer to hardware structure 395 + * @offset: offset within the EEPROM to be written to 396 + * @data: 16 bit word to be written to the EEPROM 397 + * 398 + * If ixgbe_eeprom_update_checksum is not called after this function, the 399 + * EEPROM will most likely contain an invalid checksum. 400 + **/ 401 + s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data) 402 + { 403 + s32 status; 404 + u8 write_opcode = IXGBE_EEPROM_WRITE_OPCODE_SPI; 405 + 406 + hw->eeprom.ops.init_params(hw); 407 + 408 + if (offset >= hw->eeprom.word_size) { 409 + status = IXGBE_ERR_EEPROM; 410 + goto out; 411 + } 412 + 413 + /* Prepare the EEPROM for writing */ 414 + status = ixgbe_acquire_eeprom(hw); 415 + 416 + if (status == 0) { 417 + if (ixgbe_ready_eeprom(hw) != 0) { 418 + ixgbe_release_eeprom(hw); 419 + status = IXGBE_ERR_EEPROM; 420 + } 421 + } 422 + 423 + if (status == 0) { 424 + ixgbe_standby_eeprom(hw); 425 + 426 + /* Send the WRITE ENABLE command (8 bit opcode ) */ 427 + ixgbe_shift_out_eeprom_bits(hw, IXGBE_EEPROM_WREN_OPCODE_SPI, 428 + IXGBE_EEPROM_OPCODE_BITS); 429 + 430 + ixgbe_standby_eeprom(hw); 431 + 432 + /* 433 + * Some SPI eeproms use the 8th address bit embedded in the 434 + * opcode 435 + */ 436 + if ((hw->eeprom.address_bits == 8) && (offset >= 128)) 437 + write_opcode |= IXGBE_EEPROM_A8_OPCODE_SPI; 438 + 439 + /* Send the Write command (8-bit opcode + addr) */ 440 + ixgbe_shift_out_eeprom_bits(hw, write_opcode, 441 + IXGBE_EEPROM_OPCODE_BITS); 442 + ixgbe_shift_out_eeprom_bits(hw, (u16)(offset*2), 443 + hw->eeprom.address_bits); 444 + 445 + /* Send the data */ 446 + data = (data >> 8) | (data << 8); 447 + ixgbe_shift_out_eeprom_bits(hw, data, 16); 448 + ixgbe_standby_eeprom(hw); 449 + 450 + msleep(hw->eeprom.semaphore_delay); 451 + /* Done with writing - release the EEPROM */ 452 + ixgbe_release_eeprom(hw); 453 + } 454 + 455 + out: 456 + return status; 466 457 } 467 458 468 459 /** ··· 1630 1487 } 1631 1488 1632 1489 /** 1490 + * ixgbe_fc_enable - Enable flow control 1491 + * @hw: pointer to hardware structure 1492 + * @packetbuf_num: packet buffer number (0-7) 1493 + * 1494 + * Enable flow control according to the current settings. 1495 + **/ 1496 + s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) 1497 + { 1498 + s32 ret_val = 0; 1499 + u32 mflcn_reg; 1500 + u32 fccfg_reg; 1501 + u32 reg; 1502 + 1503 + mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); 1504 + mflcn_reg &= ~(IXGBE_MFLCN_RFCE | IXGBE_MFLCN_RPFCE); 1505 + 1506 + fccfg_reg = IXGBE_READ_REG(hw, IXGBE_FCCFG); 1507 + fccfg_reg &= ~(IXGBE_FCCFG_TFCE_802_3X | IXGBE_FCCFG_TFCE_PRIORITY); 1508 + 1509 + /* 1510 + * The possible values of fc.current_mode are: 1511 + * 0: Flow control is completely disabled 1512 + * 1: Rx flow control is enabled (we can receive pause frames, 1513 + * but not send pause frames). 1514 + * 2: Tx flow control is enabled (we can send pause frames but 1515 + * we do not support receiving pause frames). 1516 + * 3: Both Rx and Tx flow control (symmetric) are enabled. 1517 + * other: Invalid. 1518 + */ 1519 + switch (hw->fc.current_mode) { 1520 + case ixgbe_fc_none: 1521 + /* Flow control completely disabled by software override. */ 1522 + break; 1523 + case ixgbe_fc_rx_pause: 1524 + /* 1525 + * Rx Flow control is enabled and Tx Flow control is 1526 + * disabled by software override. Since there really 1527 + * isn't a way to advertise that we are capable of RX 1528 + * Pause ONLY, we will advertise that we support both 1529 + * symmetric and asymmetric Rx PAUSE. Later, we will 1530 + * disable the adapter's ability to send PAUSE frames. 1531 + */ 1532 + mflcn_reg |= IXGBE_MFLCN_RFCE; 1533 + break; 1534 + case ixgbe_fc_tx_pause: 1535 + /* 1536 + * Tx Flow control is enabled, and Rx Flow control is 1537 + * disabled by software override. 1538 + */ 1539 + fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; 1540 + break; 1541 + case ixgbe_fc_full: 1542 + /* Flow control (both Rx and Tx) is enabled by SW override. */ 1543 + mflcn_reg |= IXGBE_MFLCN_RFCE; 1544 + fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; 1545 + break; 1546 + default: 1547 + hw_dbg(hw, "Flow control param set incorrectly\n"); 1548 + ret_val = -IXGBE_ERR_CONFIG; 1549 + goto out; 1550 + break; 1551 + } 1552 + 1553 + /* Enable 802.3x based flow control settings. */ 1554 + IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); 1555 + IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); 1556 + 1557 + /* Set up and enable Rx high/low water mark thresholds, enable XON. */ 1558 + if (hw->fc.current_mode & ixgbe_fc_tx_pause) { 1559 + if (hw->fc.send_xon) 1560 + IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), 1561 + (hw->fc.low_water | IXGBE_FCRTL_XONE)); 1562 + else 1563 + IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), 1564 + hw->fc.low_water); 1565 + 1566 + IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(packetbuf_num), 1567 + (hw->fc.high_water | IXGBE_FCRTH_FCEN)); 1568 + } 1569 + 1570 + /* Configure pause time (2 TCs per register) */ 1571 + reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num)); 1572 + if ((packetbuf_num & 1) == 0) 1573 + reg = (reg & 0xFFFF0000) | hw->fc.pause_time; 1574 + else 1575 + reg = (reg & 0x0000FFFF) | (hw->fc.pause_time << 16); 1576 + IXGBE_WRITE_REG(hw, IXGBE_FCTTV(packetbuf_num / 2), reg); 1577 + 1578 + IXGBE_WRITE_REG(hw, IXGBE_FCRTV, (hw->fc.pause_time >> 1)); 1579 + 1580 + out: 1581 + return ret_val; 1582 + } 1583 + 1584 + /** 1633 1585 * ixgbe_fc_autoneg - Configure flow control 1634 1586 * @hw: pointer to hardware structure 1635 1587 * ··· 1863 1625 } 1864 1626 1865 1627 /** 1628 + * ixgbe_setup_fc_generic - Set up flow control 1629 + * @hw: pointer to hardware structure 1630 + * 1631 + * Sets up flow control. 1632 + **/ 1633 + s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num) 1634 + { 1635 + s32 ret_val = 0; 1636 + ixgbe_link_speed speed; 1637 + bool link_up; 1638 + 1639 + /* Validate the packetbuf configuration */ 1640 + if (packetbuf_num < 0 || packetbuf_num > 7) { 1641 + hw_dbg(hw, "Invalid packet buffer number [%d], expected range " 1642 + "is 0-7\n", packetbuf_num); 1643 + ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; 1644 + goto out; 1645 + } 1646 + 1647 + /* 1648 + * Validate the water mark configuration. Zero water marks are invalid 1649 + * because it causes the controller to just blast out fc packets. 1650 + */ 1651 + if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) { 1652 + hw_dbg(hw, "Invalid water mark configuration\n"); 1653 + ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; 1654 + goto out; 1655 + } 1656 + 1657 + /* 1658 + * Validate the requested mode. Strict IEEE mode does not allow 1659 + * ixgbe_fc_rx_pause because it will cause testing anomalies. 1660 + */ 1661 + if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { 1662 + hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict " 1663 + "IEEE mode\n"); 1664 + ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; 1665 + goto out; 1666 + } 1667 + 1668 + /* 1669 + * 10gig parts do not have a word in the EEPROM to determine the 1670 + * default flow control setting, so we explicitly set it to full. 1671 + */ 1672 + if (hw->fc.requested_mode == ixgbe_fc_default) 1673 + hw->fc.requested_mode = ixgbe_fc_full; 1674 + 1675 + /* 1676 + * Save off the requested flow control mode for use later. Depending 1677 + * on the link partner's capabilities, we may or may not use this mode. 1678 + */ 1679 + hw->fc.current_mode = hw->fc.requested_mode; 1680 + 1681 + /* Decide whether to use autoneg or not. */ 1682 + hw->mac.ops.check_link(hw, &speed, &link_up, false); 1683 + if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL)) 1684 + ret_val = ixgbe_fc_autoneg(hw); 1685 + 1686 + if (ret_val) 1687 + goto out; 1688 + 1689 + ret_val = ixgbe_fc_enable(hw, packetbuf_num); 1690 + 1691 + out: 1692 + return ret_val; 1693 + } 1694 + 1695 + /** 1866 1696 * ixgbe_disable_pcie_master - Disable PCI-express master access 1867 1697 * @hw: pointer to hardware structure 1868 1698 * ··· 2038 1732 ixgbe_release_eeprom_semaphore(hw); 2039 1733 } 2040 1734 1735 + /** 1736 + * ixgbe_enable_rx_dma_generic - Enable the Rx DMA unit 1737 + * @hw: pointer to hardware structure 1738 + * @regval: register value to write to RXCTRL 1739 + * 1740 + * Enables the Rx DMA unit 1741 + **/ 1742 + s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) 1743 + { 1744 + IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); 1745 + 1746 + return 0; 1747 + }
+10
drivers/net/ixgbe/ixgbe_common.h
··· 37 37 s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num); 38 38 s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr); 39 39 s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw); 40 + void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw); 40 41 s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw); 41 42 42 43 s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index); 43 44 s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index); 44 45 45 46 s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw); 47 + s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data); 46 48 s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data); 47 49 s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, 48 50 u16 *data); ··· 63 61 u32 addr_count, ixgbe_mc_addr_itr func); 64 62 s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); 65 63 s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); 64 + s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); 66 65 s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num); 67 66 s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packtetbuf_num); 68 67 s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw); ··· 77 74 s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val); 78 75 79 76 #define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 77 + 78 + #ifndef writeq 79 + #define writeq(val, addr) writel((u32) (val), addr); \ 80 + writel((u32) (val >> 32), (addr + 4)); 81 + #endif 82 + 83 + #define IXGBE_WRITE_REG64(a, reg, value) writeq((value), ((a)->hw_addr + (reg))) 80 84 81 85 #define IXGBE_READ_REG(a, reg) readl((a)->hw_addr + (reg)) 82 86
+1 -1
drivers/net/ixgbe/ixgbe_ethtool.c
··· 469 469 regs_buff[825] = IXGBE_READ_REG(hw, IXGBE_IP6AT); 470 470 regs_buff[826] = IXGBE_READ_REG(hw, IXGBE_WUPL); 471 471 regs_buff[827] = IXGBE_READ_REG(hw, IXGBE_WUPM); 472 - regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT); 472 + regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); 473 473 474 474 regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); 475 475 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS);
+576 -14
drivers/net/ixgbe/ixgbe_phy.c
··· 32 32 #include "ixgbe_common.h" 33 33 #include "ixgbe_phy.h" 34 34 35 + static void ixgbe_i2c_start(struct ixgbe_hw *hw); 36 + static void ixgbe_i2c_stop(struct ixgbe_hw *hw); 37 + static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data); 38 + static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data); 39 + static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw); 40 + static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data); 41 + static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data); 42 + static s32 ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl); 43 + static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl); 44 + static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data); 45 + static bool ixgbe_get_i2c_data(u32 *i2cctl); 46 + static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); 35 47 static bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr); 36 48 static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); 37 49 static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); ··· 555 543 u8 identifier = 0; 556 544 u8 comp_codes_1g = 0; 557 545 u8 comp_codes_10g = 0; 558 - u8 oui_bytes[4] = {0, 0, 0, 0}; 546 + u8 oui_bytes[3] = {0, 0, 0}; 559 547 u8 transmission_media = 0; 548 + u16 enforce_sfp = 0; 560 549 561 550 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER, 562 551 &identifier); ··· 577 564 578 565 /* ID Module 579 566 * ========= 580 - * 0 SFP_DA_CU 581 - * 1 SFP_SR 582 - * 2 SFP_LR 567 + * 0 SFP_DA_CU 568 + * 1 SFP_SR 569 + * 2 SFP_LR 570 + * 3 SFP_DA_CORE0 - 82599-specific 571 + * 4 SFP_DA_CORE1 - 82599-specific 572 + * 5 SFP_SR/LR_CORE0 - 82599-specific 573 + * 6 SFP_SR/LR_CORE1 - 82599-specific 583 574 */ 584 - if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE) 585 - hw->phy.sfp_type = ixgbe_sfp_type_da_cu; 586 - else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) 587 - hw->phy.sfp_type = ixgbe_sfp_type_sr; 588 - else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE) 589 - hw->phy.sfp_type = ixgbe_sfp_type_lr; 590 - else 591 - hw->phy.sfp_type = ixgbe_sfp_type_unknown; 575 + if (hw->mac.type == ixgbe_mac_82598EB) { 576 + if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE) 577 + hw->phy.sfp_type = ixgbe_sfp_type_da_cu; 578 + else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) 579 + hw->phy.sfp_type = ixgbe_sfp_type_sr; 580 + else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE) 581 + hw->phy.sfp_type = ixgbe_sfp_type_lr; 582 + else 583 + hw->phy.sfp_type = ixgbe_sfp_type_unknown; 584 + } else if (hw->mac.type == ixgbe_mac_82599EB) { 585 + if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE) 586 + if (hw->bus.lan_id == 0) 587 + hw->phy.sfp_type = 588 + ixgbe_sfp_type_da_cu_core0; 589 + else 590 + hw->phy.sfp_type = 591 + ixgbe_sfp_type_da_cu_core1; 592 + else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) 593 + if (hw->bus.lan_id == 0) 594 + hw->phy.sfp_type = 595 + ixgbe_sfp_type_srlr_core0; 596 + else 597 + hw->phy.sfp_type = 598 + ixgbe_sfp_type_srlr_core1; 599 + else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE) 600 + if (hw->bus.lan_id == 0) 601 + hw->phy.sfp_type = 602 + ixgbe_sfp_type_srlr_core0; 603 + else 604 + hw->phy.sfp_type = 605 + ixgbe_sfp_type_srlr_core1; 606 + else 607 + hw->phy.sfp_type = ixgbe_sfp_type_unknown; 608 + } 592 609 593 610 /* Determine PHY vendor */ 594 611 if (hw->phy.type == ixgbe_phy_unknown) { ··· 650 607 case IXGBE_SFF_VENDOR_OUI_AVAGO: 651 608 hw->phy.type = ixgbe_phy_sfp_avago; 652 609 break; 610 + case IXGBE_SFF_VENDOR_OUI_INTEL: 611 + hw->phy.type = ixgbe_phy_sfp_intel; 612 + break; 653 613 default: 654 614 if (transmission_media & 655 615 IXGBE_SFF_TWIN_AX_CAPABLE) ··· 662 616 break; 663 617 } 664 618 } 665 - status = 0; 619 + if (hw->mac.type == ixgbe_mac_82598EB || 620 + (hw->phy.sfp_type != ixgbe_sfp_type_sr && 621 + hw->phy.sfp_type != ixgbe_sfp_type_lr && 622 + hw->phy.sfp_type != ixgbe_sfp_type_srlr_core0 && 623 + hw->phy.sfp_type != ixgbe_sfp_type_srlr_core1)) { 624 + status = 0; 625 + goto out; 626 + } 627 + 628 + hw->eeprom.ops.read(hw, IXGBE_PHY_ENFORCE_INTEL_SFP_OFFSET, 629 + &enforce_sfp); 630 + if (!(enforce_sfp & IXGBE_PHY_ALLOW_ANY_SFP)) { 631 + /* Make sure we're a supported PHY type */ 632 + if (hw->phy.type == ixgbe_phy_sfp_intel) { 633 + status = 0; 634 + } else { 635 + hw_dbg(hw, "SFP+ module not supported\n"); 636 + status = IXGBE_ERR_SFP_NOT_SUPPORTED; 637 + } 638 + } else { 639 + status = 0; 640 + } 666 641 } 667 642 668 643 out: ··· 718 651 hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset); 719 652 720 653 if ((!*list_offset) || (*list_offset == 0xFFFF)) 721 - return IXGBE_ERR_PHY; 654 + return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT; 722 655 723 656 /* Shift offset to first ID word */ 724 657 (*list_offset)++; ··· 752 685 } 753 686 754 687 return 0; 688 + } 689 + 690 + /** 691 + * ixgbe_read_i2c_eeprom_generic - Reads 8 bit EEPROM word over I2C interface 692 + * @hw: pointer to hardware structure 693 + * @byte_offset: EEPROM byte offset to read 694 + * @eeprom_data: value read 695 + * 696 + * Performs byte read operation to SFP module's EEPROM over I2C interface. 697 + **/ 698 + s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 699 + u8 *eeprom_data) 700 + { 701 + return hw->phy.ops.read_i2c_byte(hw, byte_offset, 702 + IXGBE_I2C_EEPROM_DEV_ADDR, 703 + eeprom_data); 704 + } 705 + 706 + /** 707 + * ixgbe_write_i2c_eeprom_generic - Writes 8 bit EEPROM word over I2C interface 708 + * @hw: pointer to hardware structure 709 + * @byte_offset: EEPROM byte offset to write 710 + * @eeprom_data: value to write 711 + * 712 + * Performs byte write operation to SFP module's EEPROM over I2C interface. 713 + **/ 714 + s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 715 + u8 eeprom_data) 716 + { 717 + return hw->phy.ops.write_i2c_byte(hw, byte_offset, 718 + IXGBE_I2C_EEPROM_DEV_ADDR, 719 + eeprom_data); 720 + } 721 + 722 + /** 723 + * ixgbe_read_i2c_byte_generic - Reads 8 bit word over I2C 724 + * @hw: pointer to hardware structure 725 + * @byte_offset: byte offset to read 726 + * @data: value read 727 + * 728 + * Performs byte read operation to SFP module's EEPROM over I2C interface at 729 + * a specified deivce address. 730 + **/ 731 + s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 732 + u8 dev_addr, u8 *data) 733 + { 734 + s32 status = 0; 735 + u32 max_retry = 1; 736 + u32 retry = 0; 737 + bool nack = 1; 738 + 739 + do { 740 + ixgbe_i2c_start(hw); 741 + 742 + /* Device Address and write indication */ 743 + status = ixgbe_clock_out_i2c_byte(hw, dev_addr); 744 + if (status != 0) 745 + goto fail; 746 + 747 + status = ixgbe_get_i2c_ack(hw); 748 + if (status != 0) 749 + goto fail; 750 + 751 + status = ixgbe_clock_out_i2c_byte(hw, byte_offset); 752 + if (status != 0) 753 + goto fail; 754 + 755 + status = ixgbe_get_i2c_ack(hw); 756 + if (status != 0) 757 + goto fail; 758 + 759 + ixgbe_i2c_start(hw); 760 + 761 + /* Device Address and read indication */ 762 + status = ixgbe_clock_out_i2c_byte(hw, (dev_addr | 0x1)); 763 + if (status != 0) 764 + goto fail; 765 + 766 + status = ixgbe_get_i2c_ack(hw); 767 + if (status != 0) 768 + goto fail; 769 + 770 + status = ixgbe_clock_in_i2c_byte(hw, data); 771 + if (status != 0) 772 + goto fail; 773 + 774 + status = ixgbe_clock_out_i2c_bit(hw, nack); 775 + if (status != 0) 776 + goto fail; 777 + 778 + ixgbe_i2c_stop(hw); 779 + break; 780 + 781 + fail: 782 + ixgbe_i2c_bus_clear(hw); 783 + retry++; 784 + if (retry < max_retry) 785 + hw_dbg(hw, "I2C byte read error - Retrying.\n"); 786 + else 787 + hw_dbg(hw, "I2C byte read error.\n"); 788 + 789 + } while (retry < max_retry); 790 + 791 + return status; 792 + } 793 + 794 + /** 795 + * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C 796 + * @hw: pointer to hardware structure 797 + * @byte_offset: byte offset to write 798 + * @data: value to write 799 + * 800 + * Performs byte write operation to SFP module's EEPROM over I2C interface at 801 + * a specified device address. 802 + **/ 803 + s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 804 + u8 dev_addr, u8 data) 805 + { 806 + s32 status = 0; 807 + u32 max_retry = 1; 808 + u32 retry = 0; 809 + 810 + do { 811 + ixgbe_i2c_start(hw); 812 + 813 + status = ixgbe_clock_out_i2c_byte(hw, dev_addr); 814 + if (status != 0) 815 + goto fail; 816 + 817 + status = ixgbe_get_i2c_ack(hw); 818 + if (status != 0) 819 + goto fail; 820 + 821 + status = ixgbe_clock_out_i2c_byte(hw, byte_offset); 822 + if (status != 0) 823 + goto fail; 824 + 825 + status = ixgbe_get_i2c_ack(hw); 826 + if (status != 0) 827 + goto fail; 828 + 829 + status = ixgbe_clock_out_i2c_byte(hw, data); 830 + if (status != 0) 831 + goto fail; 832 + 833 + status = ixgbe_get_i2c_ack(hw); 834 + if (status != 0) 835 + goto fail; 836 + 837 + ixgbe_i2c_stop(hw); 838 + break; 839 + 840 + fail: 841 + ixgbe_i2c_bus_clear(hw); 842 + retry++; 843 + if (retry < max_retry) 844 + hw_dbg(hw, "I2C byte write error - Retrying.\n"); 845 + else 846 + hw_dbg(hw, "I2C byte write error.\n"); 847 + } while (retry < max_retry); 848 + 849 + return status; 850 + } 851 + 852 + /** 853 + * ixgbe_i2c_start - Sets I2C start condition 854 + * @hw: pointer to hardware structure 855 + * 856 + * Sets I2C start condition (High -> Low on SDA while SCL is High) 857 + **/ 858 + static void ixgbe_i2c_start(struct ixgbe_hw *hw) 859 + { 860 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 861 + 862 + /* Start condition must begin with data and clock high */ 863 + ixgbe_set_i2c_data(hw, &i2cctl, 1); 864 + ixgbe_raise_i2c_clk(hw, &i2cctl); 865 + 866 + /* Setup time for start condition (4.7us) */ 867 + udelay(IXGBE_I2C_T_SU_STA); 868 + 869 + ixgbe_set_i2c_data(hw, &i2cctl, 0); 870 + 871 + /* Hold time for start condition (4us) */ 872 + udelay(IXGBE_I2C_T_HD_STA); 873 + 874 + ixgbe_lower_i2c_clk(hw, &i2cctl); 875 + 876 + /* Minimum low period of clock is 4.7 us */ 877 + udelay(IXGBE_I2C_T_LOW); 878 + 879 + } 880 + 881 + /** 882 + * ixgbe_i2c_stop - Sets I2C stop condition 883 + * @hw: pointer to hardware structure 884 + * 885 + * Sets I2C stop condition (Low -> High on SDA while SCL is High) 886 + **/ 887 + static void ixgbe_i2c_stop(struct ixgbe_hw *hw) 888 + { 889 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 890 + 891 + /* Stop condition must begin with data low and clock high */ 892 + ixgbe_set_i2c_data(hw, &i2cctl, 0); 893 + ixgbe_raise_i2c_clk(hw, &i2cctl); 894 + 895 + /* Setup time for stop condition (4us) */ 896 + udelay(IXGBE_I2C_T_SU_STO); 897 + 898 + ixgbe_set_i2c_data(hw, &i2cctl, 1); 899 + 900 + /* bus free time between stop and start (4.7us)*/ 901 + udelay(IXGBE_I2C_T_BUF); 902 + } 903 + 904 + /** 905 + * ixgbe_clock_in_i2c_byte - Clocks in one byte via I2C 906 + * @hw: pointer to hardware structure 907 + * @data: data byte to clock in 908 + * 909 + * Clocks in one byte data via I2C data/clock 910 + **/ 911 + static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) 912 + { 913 + s32 status = 0; 914 + s32 i; 915 + bool bit = 0; 916 + 917 + for (i = 7; i >= 0; i--) { 918 + status = ixgbe_clock_in_i2c_bit(hw, &bit); 919 + *data |= bit << i; 920 + 921 + if (status != 0) 922 + break; 923 + } 924 + 925 + return status; 926 + } 927 + 928 + /** 929 + * ixgbe_clock_out_i2c_byte - Clocks out one byte via I2C 930 + * @hw: pointer to hardware structure 931 + * @data: data byte clocked out 932 + * 933 + * Clocks out one byte data via I2C data/clock 934 + **/ 935 + static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data) 936 + { 937 + s32 status = 0; 938 + s32 i; 939 + u32 i2cctl; 940 + bool bit = 0; 941 + 942 + for (i = 7; i >= 0; i--) { 943 + bit = (data >> i) & 0x1; 944 + status = ixgbe_clock_out_i2c_bit(hw, bit); 945 + 946 + if (status != 0) 947 + break; 948 + } 949 + 950 + /* Release SDA line (set high) */ 951 + i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 952 + i2cctl |= IXGBE_I2C_DATA_OUT; 953 + IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, i2cctl); 954 + 955 + return status; 956 + } 957 + 958 + /** 959 + * ixgbe_get_i2c_ack - Polls for I2C ACK 960 + * @hw: pointer to hardware structure 961 + * 962 + * Clocks in/out one bit via I2C data/clock 963 + **/ 964 + static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw) 965 + { 966 + s32 status; 967 + u32 i = 0; 968 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 969 + u32 timeout = 10; 970 + bool ack = 1; 971 + 972 + status = ixgbe_raise_i2c_clk(hw, &i2cctl); 973 + 974 + if (status != 0) 975 + goto out; 976 + 977 + /* Minimum high period of clock is 4us */ 978 + udelay(IXGBE_I2C_T_HIGH); 979 + 980 + /* Poll for ACK. Note that ACK in I2C spec is 981 + * transition from 1 to 0 */ 982 + for (i = 0; i < timeout; i++) { 983 + i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 984 + ack = ixgbe_get_i2c_data(&i2cctl); 985 + 986 + udelay(1); 987 + if (ack == 0) 988 + break; 989 + } 990 + 991 + if (ack == 1) { 992 + hw_dbg(hw, "I2C ack was not received.\n"); 993 + status = IXGBE_ERR_I2C; 994 + } 995 + 996 + ixgbe_lower_i2c_clk(hw, &i2cctl); 997 + 998 + /* Minimum low period of clock is 4.7 us */ 999 + udelay(IXGBE_I2C_T_LOW); 1000 + 1001 + out: 1002 + return status; 1003 + } 1004 + 1005 + /** 1006 + * ixgbe_clock_in_i2c_bit - Clocks in one bit via I2C data/clock 1007 + * @hw: pointer to hardware structure 1008 + * @data: read data value 1009 + * 1010 + * Clocks in one bit via I2C data/clock 1011 + **/ 1012 + static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data) 1013 + { 1014 + s32 status; 1015 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 1016 + 1017 + status = ixgbe_raise_i2c_clk(hw, &i2cctl); 1018 + 1019 + /* Minimum high period of clock is 4us */ 1020 + udelay(IXGBE_I2C_T_HIGH); 1021 + 1022 + i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 1023 + *data = ixgbe_get_i2c_data(&i2cctl); 1024 + 1025 + ixgbe_lower_i2c_clk(hw, &i2cctl); 1026 + 1027 + /* Minimum low period of clock is 4.7 us */ 1028 + udelay(IXGBE_I2C_T_LOW); 1029 + 1030 + return status; 1031 + } 1032 + 1033 + /** 1034 + * ixgbe_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock 1035 + * @hw: pointer to hardware structure 1036 + * @data: data value to write 1037 + * 1038 + * Clocks out one bit via I2C data/clock 1039 + **/ 1040 + static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data) 1041 + { 1042 + s32 status; 1043 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 1044 + 1045 + status = ixgbe_set_i2c_data(hw, &i2cctl, data); 1046 + if (status == 0) { 1047 + status = ixgbe_raise_i2c_clk(hw, &i2cctl); 1048 + 1049 + /* Minimum high period of clock is 4us */ 1050 + udelay(IXGBE_I2C_T_HIGH); 1051 + 1052 + ixgbe_lower_i2c_clk(hw, &i2cctl); 1053 + 1054 + /* Minimum low period of clock is 4.7 us. 1055 + * This also takes care of the data hold time. 1056 + */ 1057 + udelay(IXGBE_I2C_T_LOW); 1058 + } else { 1059 + status = IXGBE_ERR_I2C; 1060 + hw_dbg(hw, "I2C data was not set to %X\n", data); 1061 + } 1062 + 1063 + return status; 1064 + } 1065 + /** 1066 + * ixgbe_raise_i2c_clk - Raises the I2C SCL clock 1067 + * @hw: pointer to hardware structure 1068 + * @i2cctl: Current value of I2CCTL register 1069 + * 1070 + * Raises the I2C clock line '0'->'1' 1071 + **/ 1072 + static s32 ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl) 1073 + { 1074 + s32 status = 0; 1075 + 1076 + *i2cctl |= IXGBE_I2C_CLK_OUT; 1077 + 1078 + IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1079 + 1080 + /* SCL rise time (1000ns) */ 1081 + udelay(IXGBE_I2C_T_RISE); 1082 + 1083 + return status; 1084 + } 1085 + 1086 + /** 1087 + * ixgbe_lower_i2c_clk - Lowers the I2C SCL clock 1088 + * @hw: pointer to hardware structure 1089 + * @i2cctl: Current value of I2CCTL register 1090 + * 1091 + * Lowers the I2C clock line '1'->'0' 1092 + **/ 1093 + static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl) 1094 + { 1095 + 1096 + *i2cctl &= ~IXGBE_I2C_CLK_OUT; 1097 + 1098 + IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1099 + 1100 + /* SCL fall time (300ns) */ 1101 + udelay(IXGBE_I2C_T_FALL); 1102 + } 1103 + 1104 + /** 1105 + * ixgbe_set_i2c_data - Sets the I2C data bit 1106 + * @hw: pointer to hardware structure 1107 + * @i2cctl: Current value of I2CCTL register 1108 + * @data: I2C data value (0 or 1) to set 1109 + * 1110 + * Sets the I2C data bit 1111 + **/ 1112 + static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data) 1113 + { 1114 + s32 status = 0; 1115 + 1116 + if (data) 1117 + *i2cctl |= IXGBE_I2C_DATA_OUT; 1118 + else 1119 + *i2cctl &= ~IXGBE_I2C_DATA_OUT; 1120 + 1121 + IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1122 + 1123 + /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */ 1124 + udelay(IXGBE_I2C_T_RISE + IXGBE_I2C_T_FALL + IXGBE_I2C_T_SU_DATA); 1125 + 1126 + /* Verify data was set correctly */ 1127 + *i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 1128 + if (data != ixgbe_get_i2c_data(i2cctl)) { 1129 + status = IXGBE_ERR_I2C; 1130 + hw_dbg(hw, "Error - I2C data was not set to %X.\n", data); 1131 + } 1132 + 1133 + return status; 1134 + } 1135 + 1136 + /** 1137 + * ixgbe_get_i2c_data - Reads the I2C SDA data bit 1138 + * @hw: pointer to hardware structure 1139 + * @i2cctl: Current value of I2CCTL register 1140 + * 1141 + * Returns the I2C data bit value 1142 + **/ 1143 + static bool ixgbe_get_i2c_data(u32 *i2cctl) 1144 + { 1145 + bool data; 1146 + 1147 + if (*i2cctl & IXGBE_I2C_DATA_IN) 1148 + data = 1; 1149 + else 1150 + data = 0; 1151 + 1152 + return data; 1153 + } 1154 + 1155 + /** 1156 + * ixgbe_i2c_bus_clear - Clears the I2C bus 1157 + * @hw: pointer to hardware structure 1158 + * 1159 + * Clears the I2C bus by sending nine clock pulses. 1160 + * Used when data line is stuck low. 1161 + **/ 1162 + static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw) 1163 + { 1164 + u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); 1165 + u32 i; 1166 + 1167 + ixgbe_set_i2c_data(hw, &i2cctl, 1); 1168 + 1169 + for (i = 0; i < 9; i++) { 1170 + ixgbe_raise_i2c_clk(hw, &i2cctl); 1171 + 1172 + /* Min high period of clock is 4us */ 1173 + udelay(IXGBE_I2C_T_HIGH); 1174 + 1175 + ixgbe_lower_i2c_clk(hw, &i2cctl); 1176 + 1177 + /* Min low period of clock is 4.7us*/ 1178 + udelay(IXGBE_I2C_T_LOW); 1179 + } 1180 + 1181 + /* Put the i2c bus back to default state */ 1182 + ixgbe_i2c_stop(hw); 755 1183 } 756 1184 757 1185 /**
+12 -4
drivers/net/ixgbe/ixgbe_phy.h
··· 54 54 #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 55 55 56 56 /* Bit-shift macros */ 57 - #define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 12 58 - #define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 8 59 - #define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT 4 57 + #define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24 58 + #define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16 59 + #define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT 8 60 60 61 61 /* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */ 62 62 #define IXGBE_SFF_VENDOR_OUI_TYCO 0x00407600 63 63 #define IXGBE_SFF_VENDOR_OUI_FTL 0x00906500 64 64 #define IXGBE_SFF_VENDOR_OUI_AVAGO 0x00176A00 65 + #define IXGBE_SFF_VENDOR_OUI_INTEL 0x001B2100 65 66 66 67 /* I2C SDA and SCL timing parameters for standard mode */ 67 68 #define IXGBE_I2C_T_HD_STA 4 ··· 102 101 s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, 103 102 u16 *list_offset, 104 103 u16 *data_offset); 105 - 104 + s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 105 + u8 dev_addr, u8 *data); 106 + s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 107 + u8 dev_addr, u8 data); 108 + s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 109 + u8 *eeprom_data); 110 + s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 111 + u8 eeprom_data); 106 112 #endif /* _IXGBE_PHY_H_ */
+727 -37
drivers/net/ixgbe/ixgbe_type.h
··· 45 45 #define IXGBE_DEV_ID_82598_DA_DUAL_PORT 0x10F1 46 46 #define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1 47 47 #define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4 48 + #define IXGBE_DEV_ID_82599 0x10D8 49 + #define IXGBE_DEV_ID_82599_KX4 0x10F7 50 + #define IXGBE_DEV_ID_82599_SFP 0x10FB 48 51 49 52 /* General Registers */ 50 53 #define IXGBE_CTRL 0x00000 ··· 55 52 #define IXGBE_CTRL_EXT 0x00018 56 53 #define IXGBE_ESDP 0x00020 57 54 #define IXGBE_EODSDP 0x00028 55 + #define IXGBE_I2CCTL 0x00028 58 56 #define IXGBE_LEDCTL 0x00200 59 57 #define IXGBE_FRTIMER 0x00048 60 58 #define IXGBE_TCPTIMER 0x0004C 59 + #define IXGBE_CORESPARE 0x00600 60 + #define IXGBE_EXVET 0x05078 61 61 62 62 /* NVM Registers */ 63 63 #define IXGBE_EEC 0x10010 ··· 74 68 #define IXGBE_FLOP 0x1013C 75 69 #define IXGBE_GRC 0x10200 76 70 71 + /* General Receive Control */ 72 + #define IXGBE_GRC_MNG 0x00000001 /* Manageability Enable */ 73 + #define IXGBE_GRC_APME 0x00000002 /* Advanced Power Management Enable */ 74 + 75 + #define IXGBE_VPDDIAG0 0x10204 76 + #define IXGBE_VPDDIAG1 0x10208 77 + 78 + /* I2CCTL Bit Masks */ 79 + #define IXGBE_I2C_CLK_IN 0x00000001 80 + #define IXGBE_I2C_CLK_OUT 0x00000002 81 + #define IXGBE_I2C_DATA_IN 0x00000004 82 + #define IXGBE_I2C_DATA_OUT 0x00000008 83 + 77 84 /* Interrupt Registers */ 78 85 #define IXGBE_EICR 0x00800 79 86 #define IXGBE_EICS 0x00808 ··· 94 75 #define IXGBE_EIMC 0x00888 95 76 #define IXGBE_EIAC 0x00810 96 77 #define IXGBE_EIAM 0x00890 97 - #define IXGBE_EITR(_i) (((_i) <= 23) ? (0x00820 + ((_i) * 4)) : (0x012300 + ((_i) * 4))) 78 + #define IXGBE_EICS_EX(_i) (0x00A90 + (_i) * 4) 79 + #define IXGBE_EIMS_EX(_i) (0x00AA0 + (_i) * 4) 80 + #define IXGBE_EIMC_EX(_i) (0x00AB0 + (_i) * 4) 81 + #define IXGBE_EIAM_EX(_i) (0x00AD0 + (_i) * 4) 82 + #define IXGBE_EITR(_i) (((_i) <= 23) ? (0x00820 + ((_i) * 4)) : \ 83 + (0x012300 + (((_i) - 24) * 4))) 84 + #define IXGBE_EITR_ITR_INT_MASK 0x00000FFF 85 + #define IXGBE_EITR_LLI_MOD 0x00008000 86 + #define IXGBE_EITR_CNT_WDIS 0x80000000 98 87 #define IXGBE_IVAR(_i) (0x00900 + ((_i) * 4)) /* 24 at 0x900-0x960 */ 88 + #define IXGBE_IVAR_MISC 0x00A00 /* misc MSI-X interrupt causes */ 89 + #define IXGBE_EITRSEL 0x00894 99 90 #define IXGBE_MSIXT 0x00000 /* MSI-X Table. 0x0000 - 0x01C */ 100 91 #define IXGBE_MSIXPBA 0x02000 /* MSI-X Pending bit array */ 101 92 #define IXGBE_PBACL(_i) (((_i) == 0) ? (0x11068) : (0x110C0 + ((_i) * 4))) 102 93 #define IXGBE_GPIE 0x00898 103 94 104 95 /* Flow Control Registers */ 96 + #define IXGBE_FCADBUL 0x03210 97 + #define IXGBE_FCADBUH 0x03214 98 + #define IXGBE_FCAMACL 0x04328 99 + #define IXGBE_FCAMACH 0x0432C 100 + #define IXGBE_FCRTH_82599(_i) (0x03260 + ((_i) * 4)) /* 8 of these (0-7) */ 101 + #define IXGBE_FCRTL_82599(_i) (0x03220 + ((_i) * 4)) /* 8 of these (0-7) */ 105 102 #define IXGBE_PFCTOP 0x03008 106 103 #define IXGBE_FCTTV(_i) (0x03200 + ((_i) * 4)) /* 4 of these (0-3) */ 107 104 #define IXGBE_FCRTL(_i) (0x03220 + ((_i) * 8)) /* 8 of these (0-7) */ 108 105 #define IXGBE_FCRTH(_i) (0x03260 + ((_i) * 8)) /* 8 of these (0-7) */ 109 106 #define IXGBE_FCRTV 0x032A0 107 + #define IXGBE_FCCFG 0x03D00 110 108 #define IXGBE_TFCS 0x0CE00 111 109 112 110 /* Receive DMA Registers */ 113 - #define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : (0x0D000 + ((_i - 64) * 0x40))) 114 - #define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : (0x0D004 + ((_i - 64) * 0x40))) 115 - #define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : (0x0D008 + ((_i - 64) * 0x40))) 116 - #define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : (0x0D010 + ((_i - 64) * 0x40))) 117 - #define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : (0x0D018 + ((_i - 64) * 0x40))) 118 - #define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : (0x0D028 + ((_i - 64) * 0x40))) 111 + #define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : \ 112 + (0x0D000 + ((_i - 64) * 0x40))) 113 + #define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : \ 114 + (0x0D004 + ((_i - 64) * 0x40))) 115 + #define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : \ 116 + (0x0D008 + ((_i - 64) * 0x40))) 117 + #define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : \ 118 + (0x0D010 + ((_i - 64) * 0x40))) 119 + #define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : \ 120 + (0x0D018 + ((_i - 64) * 0x40))) 121 + #define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : \ 122 + (0x0D028 + ((_i - 64) * 0x40))) 123 + #define IXGBE_RDDCC 0x02F20 124 + #define IXGBE_RXMEMWRAP 0x03190 125 + #define IXGBE_STARCTRL 0x03024 119 126 /* 120 127 * Split and Replication Receive Control Registers 121 128 * 00-15 : 0x02100 + n*4 ··· 174 129 #define IXGBE_DRECCCTL_DISABLE 0 175 130 /* Multicast Table Array - 128 entries */ 176 131 #define IXGBE_MTA(_i) (0x05200 + ((_i) * 4)) 177 - #define IXGBE_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : (0x0A200 + ((_i) * 8))) 178 - #define IXGBE_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : (0x0A204 + ((_i) * 8))) 132 + #define IXGBE_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ 133 + (0x0A200 + ((_i) * 8))) 134 + #define IXGBE_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ 135 + (0x0A204 + ((_i) * 8))) 136 + #define IXGBE_MPSAR_LO(_i) (0x0A600 + ((_i) * 8)) 137 + #define IXGBE_MPSAR_HI(_i) (0x0A604 + ((_i) * 8)) 179 138 /* Packet split receive type */ 180 - #define IXGBE_PSRTYPE(_i) (((_i) <= 15) ? (0x05480 + ((_i) * 4)) : (0x0EA00 + ((_i) * 4))) 139 + #define IXGBE_PSRTYPE(_i) (((_i) <= 15) ? (0x05480 + ((_i) * 4)) : \ 140 + (0x0EA00 + ((_i) * 4))) 181 141 /* array of 4096 1-bit vlan filters */ 182 142 #define IXGBE_VFTA(_i) (0x0A000 + ((_i) * 4)) 183 143 /*array of 4096 4-bit vlan vmdq indices */ ··· 191 141 #define IXGBE_VLNCTRL 0x05088 192 142 #define IXGBE_MCSTCTRL 0x05090 193 143 #define IXGBE_MRQC 0x05818 144 + #define IXGBE_SAQF(_i) (0x0E000 + ((_i) * 4)) /* Source Address Queue Filter */ 145 + #define IXGBE_DAQF(_i) (0x0E200 + ((_i) * 4)) /* Dest. Address Queue Filter */ 146 + #define IXGBE_SDPQF(_i) (0x0E400 + ((_i) * 4)) /* Src Dest. Addr Queue Filter */ 147 + #define IXGBE_FTQF(_i) (0x0E600 + ((_i) * 4)) /* Five Tuple Queue Filter */ 148 + #define IXGBE_ETQF(_i) (0x05128 + ((_i) * 4)) /* EType Queue Filter */ 149 + #define IXGBE_ETQS(_i) (0x0EC00 + ((_i) * 4)) /* EType Queue Select */ 150 + #define IXGBE_SYNQF 0x0EC30 /* SYN Packet Queue Filter */ 151 + #define IXGBE_RQTC 0x0EC70 152 + #define IXGBE_MTQC 0x08120 153 + #define IXGBE_VLVF(_i) (0x0F100 + ((_i) * 4)) /* 64 of these (0-63) */ 154 + #define IXGBE_VLVFB(_i) (0x0F200 + ((_i) * 4)) /* 128 of these (0-127) */ 155 + #define IXGBE_VT_CTL 0x051B0 156 + #define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4)) 157 + #define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4)) 158 + #define IXGBE_QDE 0x2F04 159 + #define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */ 160 + #define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4)) 161 + #define IXGBE_VMRCTL(_i) (0x0F600 + ((_i) * 4)) 162 + #define IXGBE_VMRVLAN(_i) (0x0F610 + ((_i) * 4)) 163 + #define IXGBE_VMRVM(_i) (0x0F630 + ((_i) * 4)) 164 + #define IXGBE_L34T_IMIR(_i) (0x0E800 + ((_i) * 4)) /*128 of these (0-127)*/ 165 + #define IXGBE_LLITHRESH 0x0EC90 194 166 #define IXGBE_IMIR(_i) (0x05A80 + ((_i) * 4)) /* 8 of these (0-7) */ 195 167 #define IXGBE_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* 8 of these (0-7) */ 196 168 #define IXGBE_IMIRVP 0x05AC0 197 169 #define IXGBE_VMD_CTL 0x0581C 198 170 #define IXGBE_RETA(_i) (0x05C00 + ((_i) * 4)) /* 32 of these (0-31) */ 199 171 #define IXGBE_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* 10 of these (0-9) */ 200 - 201 172 202 173 /* Transmit DMA registers */ 203 174 #define IXGBE_TDBAL(_i) (0x06000 + ((_i) * 0x40)) /* 32 of these (0-31)*/ ··· 231 160 #define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40)) 232 161 #define IXGBE_DTXCTL 0x07E00 233 162 163 + #define IXGBE_DMATXCTL 0x04A80 164 + #define IXGBE_DTXMXSZRQ 0x08100 165 + #define IXGBE_DTXTCPFLGL 0x04A88 166 + #define IXGBE_DTXTCPFLGH 0x04A8C 167 + #define IXGBE_LBDRPEN 0x0CA00 168 + #define IXGBE_TXPBTHRESH(_i) (0x04950 + ((_i) * 4)) /* 8 of these 0 - 7 */ 169 + 170 + #define IXGBE_DMATXCTL_TE 0x1 /* Transmit Enable */ 171 + #define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */ 172 + #define IXGBE_DMATXCTL_GDV 0x8 /* Global Double VLAN */ 173 + #define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ 234 174 #define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ 175 + /* Tx DCA Control register : 128 of these (0-127) */ 176 + #define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) 235 177 #define IXGBE_TIPG 0x0CB00 236 178 #define IXGBE_TXPBSIZE(_i) (0x0CC00 + ((_i) * 4)) /* 8 of these */ 237 179 #define IXGBE_MNGTXMAP 0x0CD10 ··· 261 177 262 178 #define IXGBE_WUPL 0x05900 263 179 #define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */ 264 - #define IXGBE_FHFT 0x09000 /* Flex host filter table 9000-93FC */ 180 + #define IXGBE_FHFT(_n) (0x09000 + (_n * 0x100)) /* Flex host filter table */ 181 + #define IXGBE_FHFT_EXT(_n) (0x09800 + (_n * 0x100)) /* Ext Flexible Host 182 + * Filter Table */ 265 183 266 - /* Music registers */ 184 + #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 185 + #define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 186 + 187 + /* Each Flexible Filter is at most 128 (0x80) bytes in length */ 188 + #define IXGBE_FLEXIBLE_FILTER_SIZE_MAX 128 189 + #define IXGBE_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ 190 + #define IXGBE_FHFT_LENGTH_MASK 0x0FF /* Length in lower byte */ 191 + 192 + /* Definitions for power management and wakeup registers */ 193 + /* Wake Up Control */ 194 + #define IXGBE_WUC_PME_EN 0x00000002 /* PME Enable */ 195 + #define IXGBE_WUC_PME_STATUS 0x00000004 /* PME Status */ 196 + #define IXGBE_WUC_ADVD3WUC 0x00000010 /* D3Cold wake up cap. enable*/ 197 + 198 + /* Wake Up Filter Control */ 199 + #define IXGBE_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ 200 + #define IXGBE_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ 201 + #define IXGBE_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 202 + #define IXGBE_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ 203 + #define IXGBE_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 204 + #define IXGBE_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ 205 + #define IXGBE_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ 206 + #define IXGBE_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ 207 + #define IXGBE_WUFC_MNG 0x00000100 /* Directed Mgmt Packet Wakeup Enable */ 208 + 209 + #define IXGBE_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ 210 + #define IXGBE_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ 211 + #define IXGBE_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ 212 + #define IXGBE_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ 213 + #define IXGBE_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ 214 + #define IXGBE_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ 215 + #define IXGBE_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ 216 + #define IXGBE_WUFC_FLX_FILTERS 0x000F0000 /* Mask for 4 flex filters */ 217 + #define IXGBE_WUFC_EXT_FLX_FILTERS 0x00300000 /* Mask for Ext. flex filters */ 218 + #define IXGBE_WUFC_ALL_FILTERS 0x003F00FF /* Mask for all 6 wakeup filters*/ 219 + #define IXGBE_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ 220 + 221 + /* Wake Up Status */ 222 + #define IXGBE_WUS_LNKC IXGBE_WUFC_LNKC 223 + #define IXGBE_WUS_MAG IXGBE_WUFC_MAG 224 + #define IXGBE_WUS_EX IXGBE_WUFC_EX 225 + #define IXGBE_WUS_MC IXGBE_WUFC_MC 226 + #define IXGBE_WUS_BC IXGBE_WUFC_BC 227 + #define IXGBE_WUS_ARP IXGBE_WUFC_ARP 228 + #define IXGBE_WUS_IPV4 IXGBE_WUFC_IPV4 229 + #define IXGBE_WUS_IPV6 IXGBE_WUFC_IPV6 230 + #define IXGBE_WUS_MNG IXGBE_WUFC_MNG 231 + #define IXGBE_WUS_FLX0 IXGBE_WUFC_FLX0 232 + #define IXGBE_WUS_FLX1 IXGBE_WUFC_FLX1 233 + #define IXGBE_WUS_FLX2 IXGBE_WUFC_FLX2 234 + #define IXGBE_WUS_FLX3 IXGBE_WUFC_FLX3 235 + #define IXGBE_WUS_FLX4 IXGBE_WUFC_FLX4 236 + #define IXGBE_WUS_FLX5 IXGBE_WUFC_FLX5 237 + #define IXGBE_WUS_FLX_FILTERS IXGBE_WUFC_FLX_FILTERS 238 + 239 + /* Wake Up Packet Length */ 240 + #define IXGBE_WUPL_LENGTH_MASK 0xFFFF 241 + 242 + /* DCB registers */ 267 243 #define IXGBE_RMCS 0x03D00 268 244 #define IXGBE_DPMCS 0x07F40 269 245 #define IXGBE_PDPMCS 0x0CD00 ··· 336 192 #define IXGBE_TDPT2TCSR(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ 337 193 338 194 195 + /* Security Control Registers */ 196 + #define IXGBE_SECTXCTRL 0x08800 197 + #define IXGBE_SECTXSTAT 0x08804 198 + #define IXGBE_SECTXBUFFAF 0x08808 199 + #define IXGBE_SECTXMINIFG 0x08810 200 + #define IXGBE_SECTXSTAT 0x08804 201 + #define IXGBE_SECRXCTRL 0x08D00 202 + #define IXGBE_SECRXSTAT 0x08D04 203 + 204 + /* Security Bit Fields and Masks */ 205 + #define IXGBE_SECTXCTRL_SECTX_DIS 0x00000001 206 + #define IXGBE_SECTXCTRL_TX_DIS 0x00000002 207 + #define IXGBE_SECTXCTRL_STORE_FORWARD 0x00000004 208 + 209 + #define IXGBE_SECTXSTAT_SECTX_RDY 0x00000001 210 + #define IXGBE_SECTXSTAT_ECC_TXERR 0x00000002 211 + 212 + #define IXGBE_SECRXCTRL_SECRX_DIS 0x00000001 213 + #define IXGBE_SECRXCTRL_RX_DIS 0x00000002 214 + 215 + #define IXGBE_SECRXSTAT_SECRX_RDY 0x00000001 216 + #define IXGBE_SECRXSTAT_ECC_RXERR 0x00000002 217 + 218 + /* LinkSec (MacSec) Registers */ 219 + #define IXGBE_LSECTXCAP 0x08A00 220 + #define IXGBE_LSECRXCAP 0x08F00 221 + #define IXGBE_LSECTXCTRL 0x08A04 222 + #define IXGBE_LSECTXSCL 0x08A08 /* SCI Low */ 223 + #define IXGBE_LSECTXSCH 0x08A0C /* SCI High */ 224 + #define IXGBE_LSECTXSA 0x08A10 225 + #define IXGBE_LSECTXPN0 0x08A14 226 + #define IXGBE_LSECTXPN1 0x08A18 227 + #define IXGBE_LSECTXKEY0(_n) (0x08A1C + (4 * (_n))) /* 4 of these (0-3) */ 228 + #define IXGBE_LSECTXKEY1(_n) (0x08A2C + (4 * (_n))) /* 4 of these (0-3) */ 229 + #define IXGBE_LSECRXCTRL 0x08F04 230 + #define IXGBE_LSECRXSCL 0x08F08 231 + #define IXGBE_LSECRXSCH 0x08F0C 232 + #define IXGBE_LSECRXSA(_i) (0x08F10 + (4 * (_i))) /* 2 of these (0-1) */ 233 + #define IXGBE_LSECRXPN(_i) (0x08F18 + (4 * (_i))) /* 2 of these (0-1) */ 234 + #define IXGBE_LSECRXKEY(_n, _m) (0x08F20 + ((0x10 * (_n)) + (4 * (_m)))) 235 + #define IXGBE_LSECTXUT 0x08A3C /* OutPktsUntagged */ 236 + #define IXGBE_LSECTXPKTE 0x08A40 /* OutPktsEncrypted */ 237 + #define IXGBE_LSECTXPKTP 0x08A44 /* OutPktsProtected */ 238 + #define IXGBE_LSECTXOCTE 0x08A48 /* OutOctetsEncrypted */ 239 + #define IXGBE_LSECTXOCTP 0x08A4C /* OutOctetsProtected */ 240 + #define IXGBE_LSECRXUT 0x08F40 /* InPktsUntagged/InPktsNoTag */ 241 + #define IXGBE_LSECRXOCTD 0x08F44 /* InOctetsDecrypted */ 242 + #define IXGBE_LSECRXOCTV 0x08F48 /* InOctetsValidated */ 243 + #define IXGBE_LSECRXBAD 0x08F4C /* InPktsBadTag */ 244 + #define IXGBE_LSECRXNOSCI 0x08F50 /* InPktsNoSci */ 245 + #define IXGBE_LSECRXUNSCI 0x08F54 /* InPktsUnknownSci */ 246 + #define IXGBE_LSECRXUNCH 0x08F58 /* InPktsUnchecked */ 247 + #define IXGBE_LSECRXDELAY 0x08F5C /* InPktsDelayed */ 248 + #define IXGBE_LSECRXLATE 0x08F60 /* InPktsLate */ 249 + #define IXGBE_LSECRXOK(_n) (0x08F64 + (0x04 * (_n))) /* InPktsOk */ 250 + #define IXGBE_LSECRXINV(_n) (0x08F6C + (0x04 * (_n))) /* InPktsInvalid */ 251 + #define IXGBE_LSECRXNV(_n) (0x08F74 + (0x04 * (_n))) /* InPktsNotValid */ 252 + #define IXGBE_LSECRXUNSA 0x08F7C /* InPktsUnusedSa */ 253 + #define IXGBE_LSECRXNUSA 0x08F80 /* InPktsNotUsingSa */ 254 + 255 + /* LinkSec (MacSec) Bit Fields and Masks */ 256 + #define IXGBE_LSECTXCAP_SUM_MASK 0x00FF0000 257 + #define IXGBE_LSECTXCAP_SUM_SHIFT 16 258 + #define IXGBE_LSECRXCAP_SUM_MASK 0x00FF0000 259 + #define IXGBE_LSECRXCAP_SUM_SHIFT 16 260 + 261 + #define IXGBE_LSECTXCTRL_EN_MASK 0x00000003 262 + #define IXGBE_LSECTXCTRL_DISABLE 0x0 263 + #define IXGBE_LSECTXCTRL_AUTH 0x1 264 + #define IXGBE_LSECTXCTRL_AUTH_ENCRYPT 0x2 265 + #define IXGBE_LSECTXCTRL_AISCI 0x00000020 266 + #define IXGBE_LSECTXCTRL_PNTHRSH_MASK 0xFFFFFF00 267 + #define IXGBE_LSECTXCTRL_RSV_MASK 0x000000D8 268 + 269 + #define IXGBE_LSECRXCTRL_EN_MASK 0x0000000C 270 + #define IXGBE_LSECRXCTRL_EN_SHIFT 2 271 + #define IXGBE_LSECRXCTRL_DISABLE 0x0 272 + #define IXGBE_LSECRXCTRL_CHECK 0x1 273 + #define IXGBE_LSECRXCTRL_STRICT 0x2 274 + #define IXGBE_LSECRXCTRL_DROP 0x3 275 + #define IXGBE_LSECRXCTRL_PLSH 0x00000040 276 + #define IXGBE_LSECRXCTRL_RP 0x00000080 277 + #define IXGBE_LSECRXCTRL_RSV_MASK 0xFFFFFF33 278 + 279 + /* IpSec Registers */ 280 + #define IXGBE_IPSTXIDX 0x08900 281 + #define IXGBE_IPSTXSALT 0x08904 282 + #define IXGBE_IPSTXKEY(_i) (0x08908 + (4 * (_i))) /* 4 of these (0-3) */ 283 + #define IXGBE_IPSRXIDX 0x08E00 284 + #define IXGBE_IPSRXIPADDR(_i) (0x08E04 + (4 * (_i))) /* 4 of these (0-3) */ 285 + #define IXGBE_IPSRXSPI 0x08E14 286 + #define IXGBE_IPSRXIPIDX 0x08E18 287 + #define IXGBE_IPSRXKEY(_i) (0x08E1C + (4 * (_i))) /* 4 of these (0-3) */ 288 + #define IXGBE_IPSRXSALT 0x08E2C 289 + #define IXGBE_IPSRXMOD 0x08E30 290 + 291 + #define IXGBE_SECTXCTRL_STORE_FORWARD_ENABLE 0x4 292 + 293 + /* DCB registers */ 294 + #define IXGBE_RTRPCS 0x02430 295 + #define IXGBE_RTTDCS 0x04900 296 + #define IXGBE_RTTPCS 0x0CD00 297 + #define IXGBE_RTRUP2TC 0x03020 298 + #define IXGBE_RTTUP2TC 0x0C800 299 + #define IXGBE_RTRPT4C(_i) (0x02140 + ((_i) * 4)) /* 8 of these (0-7) */ 300 + #define IXGBE_RTRPT4S(_i) (0x02160 + ((_i) * 4)) /* 8 of these (0-7) */ 301 + #define IXGBE_RTTDT2C(_i) (0x04910 + ((_i) * 4)) /* 8 of these (0-7) */ 302 + #define IXGBE_RTTDT2S(_i) (0x04930 + ((_i) * 4)) /* 8 of these (0-7) */ 303 + #define IXGBE_RTTPT2C(_i) (0x0CD20 + ((_i) * 4)) /* 8 of these (0-7) */ 304 + #define IXGBE_RTTPT2S(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ 305 + #define IXGBE_RTTDQSEL 0x04904 306 + #define IXGBE_RTTDT1C 0x04908 307 + #define IXGBE_RTTDT1S 0x0490C 308 + #define IXGBE_RTTDTECC 0x04990 309 + #define IXGBE_RTTDTECC_NO_BCN 0x00000100 310 + #define IXGBE_RTTBCNRC 0x04984 339 311 340 312 /* Stats registers */ 341 313 #define IXGBE_CRCERRS 0x04000 ··· 466 206 #define IXGBE_LXONRXC 0x0CF60 467 207 #define IXGBE_LXOFFTXC 0x03F68 468 208 #define IXGBE_LXOFFRXC 0x0CF68 209 + #define IXGBE_LXONRXCNT 0x041A4 210 + #define IXGBE_LXOFFRXCNT 0x041A8 211 + #define IXGBE_PXONRXCNT(_i) (0x04140 + ((_i) * 4)) /* 8 of these */ 212 + #define IXGBE_PXOFFRXCNT(_i) (0x04160 + ((_i) * 4)) /* 8 of these */ 213 + #define IXGBE_PXON2OFFCNT(_i) (0x03240 + ((_i) * 4)) /* 8 of these */ 469 214 #define IXGBE_PXONTXC(_i) (0x03F00 + ((_i) * 4)) /* 8 of these 3F00-3F1C*/ 470 215 #define IXGBE_PXONRXC(_i) (0x0CF00 + ((_i) * 4)) /* 8 of these CF00-CF1C*/ 471 216 #define IXGBE_PXOFFTXC(_i) (0x03F20 + ((_i) * 4)) /* 8 of these 3F20-3F3C*/ ··· 510 245 #define IXGBE_MPTC 0x040F0 511 246 #define IXGBE_BPTC 0x040F4 512 247 #define IXGBE_XEC 0x04120 248 + #define IXGBE_SSVPC 0x08780 513 249 514 - #define IXGBE_RQSMR(_i) (0x02300 + ((_i) * 4)) /* 16 of these */ 515 - #define IXGBE_TQSMR(_i) (((_i) <= 7) ? (0x07300 + ((_i) * 4)) : (0x08600 + ((_i) * 4))) 250 + #define IXGBE_RQSMR(_i) (0x02300 + ((_i) * 4)) 251 + #define IXGBE_TQSMR(_i) (((_i) <= 7) ? (0x07300 + ((_i) * 4)) : \ 252 + (0x08600 + ((_i) * 4))) 253 + #define IXGBE_TQSM(_i) (0x08600 + ((_i) * 4)) 516 254 517 255 #define IXGBE_QPRC(_i) (0x01030 + ((_i) * 0x40)) /* 16 of these */ 518 256 #define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */ 519 257 #define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ 520 258 #define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */ 259 + #define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */ 260 + #define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */ 261 + #define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */ 521 262 522 263 /* Management */ 523 264 #define IXGBE_MAVTV(_i) (0x05010 + ((_i) * 4)) /* 8 of these (0-7) */ ··· 536 265 #define IXGBE_MMAL(_i) (0x05910 + ((_i) * 8)) /* 4 of these (0-3) */ 537 266 #define IXGBE_MMAH(_i) (0x05914 + ((_i) * 8)) /* 4 of these (0-3) */ 538 267 #define IXGBE_FTFT 0x09400 /* 0x9400-0x97FC */ 268 + #define IXGBE_METF(_i) (0x05190 + ((_i) * 4)) /* 4 of these (0-3) */ 269 + #define IXGBE_MDEF_EXT(_i) (0x05160 + ((_i) * 4)) /* 8 of these (0-7) */ 270 + #define IXGBE_LSWFW 0x15014 539 271 540 272 /* ARC Subsystem registers */ 541 273 #define IXGBE_HICR 0x15F00 ··· 571 297 #define IXGBE_DCA_ID 0x11070 572 298 #define IXGBE_DCA_CTRL 0x11074 573 299 300 + /* PCIe registers 82599-specific */ 301 + #define IXGBE_GCR_EXT 0x11050 302 + #define IXGBE_GSCL_5_82599 0x11030 303 + #define IXGBE_GSCL_6_82599 0x11034 304 + #define IXGBE_GSCL_7_82599 0x11038 305 + #define IXGBE_GSCL_8_82599 0x1103C 306 + #define IXGBE_PHYADR_82599 0x11040 307 + #define IXGBE_PHYDAT_82599 0x11044 308 + #define IXGBE_PHYCTL_82599 0x11048 309 + #define IXGBE_PBACLR_82599 0x11068 310 + #define IXGBE_CIAA_82599 0x11088 311 + #define IXGBE_CIAD_82599 0x1108C 312 + #define IXGBE_PCIE_DIAG_0_82599 0x11090 313 + #define IXGBE_PCIE_DIAG_1_82599 0x11094 314 + #define IXGBE_PCIE_DIAG_2_82599 0x11098 315 + #define IXGBE_PCIE_DIAG_3_82599 0x1109C 316 + #define IXGBE_PCIE_DIAG_4_82599 0x110A0 317 + #define IXGBE_PCIE_DIAG_5_82599 0x110A4 318 + #define IXGBE_PCIE_DIAG_6_82599 0x110A8 319 + #define IXGBE_PCIE_DIAG_7_82599 0x110C0 320 + #define IXGBE_INTRPT_CSR_82599 0x110B0 321 + #define IXGBE_INTRPT_MASK_82599 0x110B8 322 + #define IXGBE_CDQ_MBR_82599 0x110B4 323 + #define IXGBE_MISC_REG_82599 0x110F0 324 + #define IXGBE_ECC_CTRL_0_82599 0x11100 325 + #define IXGBE_ECC_CTRL_1_82599 0x11104 326 + #define IXGBE_ECC_STATUS_82599 0x110E0 327 + #define IXGBE_BAR_CTRL_82599 0x110F4 328 + 329 + /* Time Sync Registers */ 330 + #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ 331 + #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ 332 + #define IXGBE_RXSTMPL 0x051E8 /* Rx timestamp Low - RO */ 333 + #define IXGBE_RXSTMPH 0x051A4 /* Rx timestamp High - RO */ 334 + #define IXGBE_RXSATRL 0x051A0 /* Rx timestamp attribute low - RO */ 335 + #define IXGBE_RXSATRH 0x051A8 /* Rx timestamp attribute high - RO */ 336 + #define IXGBE_RXMTRL 0x05120 /* RX message type register low - RW */ 337 + #define IXGBE_TXSTMPL 0x08C04 /* Tx timestamp value Low - RO */ 338 + #define IXGBE_TXSTMPH 0x08C08 /* Tx timestamp value High - RO */ 339 + #define IXGBE_SYSTIML 0x08C0C /* System time register Low - RO */ 340 + #define IXGBE_SYSTIMH 0x08C10 /* System time register High - RO */ 341 + #define IXGBE_TIMINCA 0x08C14 /* Increment attributes register - RW */ 342 + #define IXGBE_RXUDP 0x08C1C /* Time Sync Rx UDP Port - RW */ 343 + 574 344 /* Diagnostic Registers */ 575 345 #define IXGBE_RDSTATCTL 0x02C20 576 346 #define IXGBE_RDSTAT(_i) (0x02C00 + ((_i) * 4)) /* 0x02C00-0x02C1C */ 577 347 #define IXGBE_RDHMPN 0x02F08 578 348 #define IXGBE_RIC_DW(_i) (0x02F10 + ((_i) * 4)) 579 349 #define IXGBE_RDPROBE 0x02F20 350 + #define IXGBE_RDMAM 0x02F30 351 + #define IXGBE_RDMAD 0x02F34 580 352 #define IXGBE_TDSTATCTL 0x07C20 581 353 #define IXGBE_TDSTAT(_i) (0x07C00 + ((_i) * 4)) /* 0x07C00 - 0x07C1C */ 582 354 #define IXGBE_TDHMPN 0x07F08 355 + #define IXGBE_TDHMPN2 0x082FC 356 + #define IXGBE_TXDESCIC 0x082CC 583 357 #define IXGBE_TIC_DW(_i) (0x07F10 + ((_i) * 4)) 358 + #define IXGBE_TIC_DW2(_i) (0x082B0 + ((_i) * 4)) 584 359 #define IXGBE_TDPROBE 0x07F20 585 360 #define IXGBE_TXBUFCTRL 0x0C600 586 361 #define IXGBE_TXBUFDATA0 0x0C610 ··· 657 334 #define IXGBE_TXDATARDPTR(_i) (0x0C720 + ((_i) * 4)) /* 8 of these C720-C72C*/ 658 335 #define IXGBE_TXDESCRDPTR(_i) (0x0C730 + ((_i) * 4)) /* 8 of these C730-C73C*/ 659 336 #define IXGBE_PCIEECCCTL 0x1106C 337 + #define IXGBE_PCIEECCCTL0 0x11100 338 + #define IXGBE_PCIEECCCTL1 0x11104 660 339 #define IXGBE_PBTXECC 0x0C300 661 340 #define IXGBE_PBRXECC 0x03300 662 341 #define IXGBE_GHECCR 0x110B0 ··· 684 359 #define IXGBE_MSRWD 0x04260 685 360 #define IXGBE_MLADD 0x04264 686 361 #define IXGBE_MHADD 0x04268 362 + #define IXGBE_MAXFRS 0x04268 687 363 #define IXGBE_TREG 0x0426C 688 364 #define IXGBE_PCSS1 0x04288 689 365 #define IXGBE_PCSS2 0x0428C 690 366 #define IXGBE_XPCSS 0x04290 367 + #define IXGBE_MFLCN 0x04294 691 368 #define IXGBE_SERDESC 0x04298 692 369 #define IXGBE_MACS 0x0429C 693 370 #define IXGBE_AUTOC 0x042A0 694 371 #define IXGBE_LINKS 0x042A4 372 + #define IXGBE_LINKS2 0x04324 695 373 #define IXGBE_AUTOC2 0x042A8 696 374 #define IXGBE_AUTOC3 0x042AC 697 375 #define IXGBE_ANLP1 0x042B0 698 376 #define IXGBE_ANLP2 0x042B4 699 377 #define IXGBE_ATLASCTL 0x04800 378 + #define IXGBE_MMNGC 0x042D0 379 + #define IXGBE_ANLPNP1 0x042D4 380 + #define IXGBE_ANLPNP2 0x042D8 381 + #define IXGBE_KRPCSFC 0x042E0 382 + #define IXGBE_KRPCSS 0x042E4 383 + #define IXGBE_FECS1 0x042E8 384 + #define IXGBE_FECS2 0x042EC 385 + #define IXGBE_SMADARCTL 0x14F10 386 + #define IXGBE_MPVC 0x04318 387 + #define IXGBE_SGMIIC 0x04314 388 + 389 + /* Omer CORECTL */ 390 + #define IXGBE_CORECTL 0x014F00 391 + /* BARCTRL */ 392 + #define IXGBE_BARCTRL 0x110F4 393 + #define IXGBE_BARCTRL_FLSIZE 0x0700 394 + #define IXGBE_BARCTRL_CSRSIZE 0x2000 700 395 701 396 /* RDRXCTL Bit Masks */ 702 397 #define IXGBE_RDRXCTL_RDMTS_1_2 0x00000000 /* Rx Desc Min Threshold Size */ 398 + #define IXGBE_RDRXCTL_CRCSTRIP 0x00000002 /* CRC Strip */ 703 399 #define IXGBE_RDRXCTL_MVMEN 0x00000020 704 400 #define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */ 401 + #define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */ 402 + 403 + /* RQTC Bit Masks and Shifts */ 404 + #define IXGBE_RQTC_SHIFT_TC(_i) ((_i) * 4) 405 + #define IXGBE_RQTC_TC0_MASK (0x7 << 0) 406 + #define IXGBE_RQTC_TC1_MASK (0x7 << 4) 407 + #define IXGBE_RQTC_TC2_MASK (0x7 << 8) 408 + #define IXGBE_RQTC_TC3_MASK (0x7 << 12) 409 + #define IXGBE_RQTC_TC4_MASK (0x7 << 16) 410 + #define IXGBE_RQTC_TC5_MASK (0x7 << 20) 411 + #define IXGBE_RQTC_TC6_MASK (0x7 << 24) 412 + #define IXGBE_RQTC_TC7_MASK (0x7 << 28) 413 + 414 + /* PSRTYPE.RQPL Bit masks and shift */ 415 + #define IXGBE_PSRTYPE_RQPL_MASK 0x7 416 + #define IXGBE_PSRTYPE_RQPL_SHIFT 29 705 417 706 418 /* CTRL Bit Masks */ 707 419 #define IXGBE_CTRL_GIO_DIS 0x00000004 /* Global IO Master Disable bit */ ··· 753 391 #define IXGBE_MHADD_MFS_SHIFT 16 754 392 755 393 /* Extended Device Control */ 394 + #define IXGBE_CTRL_EXT_PFRSTD 0x00004000 /* Physical Function Reset Done */ 756 395 #define IXGBE_CTRL_EXT_NS_DIS 0x00010000 /* No Snoop disable */ 757 396 #define IXGBE_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ 758 397 #define IXGBE_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ ··· 766 403 #define IXGBE_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ 767 404 768 405 #define IXGBE_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ 406 + #define IXGBE_DCA_RXCTRL_CPUID_MASK_82599 0xFF000000 /* Rx CPUID Mask */ 407 + #define IXGBE_DCA_RXCTRL_CPUID_SHIFT_82599 24 /* Rx CPUID Shift */ 769 408 #define IXGBE_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ 770 409 #define IXGBE_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ 771 410 #define IXGBE_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ ··· 776 411 #define IXGBE_DCA_RXCTRL_DESC_HSRO_EN (1 << 15) /* DCA Rx Split Header RO */ 777 412 778 413 #define IXGBE_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ 414 + #define IXGBE_DCA_TXCTRL_CPUID_MASK_82599 0xFF000000 /* Tx CPUID Mask */ 415 + #define IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599 24 /* Tx CPUID Shift */ 779 416 #define IXGBE_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ 780 417 #define IXGBE_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */ 781 418 #define IXGBE_DCA_MAX_QUEUES_82598 16 /* DCA regs only on 16 queues */ ··· 821 454 #define IXGBE_ATLAS_PDN_TX_1G_QL_ALL 0xF0 822 455 #define IXGBE_ATLAS_PDN_TX_AN_QL_ALL 0xF0 823 456 457 + /* Omer bit masks */ 458 + #define IXGBE_CORECTL_WRITE_CMD 0x00010000 824 459 825 460 /* Device Type definitions for new protocol MDIO commands */ 826 461 #define IXGBE_MDIO_PMA_PMD_DEV_TYPE 0x1 ··· 850 481 #define IXGBE_MDIO_PHY_SPEED_ABILITY 0x4 /* Speed Ability Reg */ 851 482 #define IXGBE_MDIO_PHY_SPEED_10G 0x0001 /* 10G capable */ 852 483 #define IXGBE_MDIO_PHY_SPEED_1G 0x0010 /* 1G capable */ 484 + #define IXGBE_MDIO_PHY_EXT_ABILITY 0xB /* Ext Ability Reg */ 485 + #define IXGBE_MDIO_PHY_10GBASET_ABILITY 0x0004 /* 10GBaseT capable */ 486 + #define IXGBE_MDIO_PHY_1000BASET_ABILITY 0x0020 /* 1000BaseT capable */ 853 487 854 - #define IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR 0xC30A /* PHY_XS SDA/SCL Address Reg */ 488 + #define IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR 0xC30A /* PHY_XS SDA/SCL Addr Reg */ 855 489 #define IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA 0xC30B /* PHY_XS SDA/SCL Data Reg */ 856 490 #define IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT 0xC30C /* PHY_XS SDA/SCL Status Reg */ 857 491 ··· 869 497 #define IXGBE_PHY_REVISION_MASK 0xFFFFFFF0 870 498 #define IXGBE_MAX_PHY_ADDR 32 871 499 872 - /* PHY IDs */ 500 + /* PHY IDs*/ 873 501 #define TN1010_PHY_ID 0x00A19410 874 502 #define TNX_FW_REV 0xB 875 503 #define QT2022_PHY_ID 0x0043A400 ··· 889 517 #define IXGBE_CONTROL_NL 0x000F 890 518 #define IXGBE_CONTROL_EOL_NL 0x0FFF 891 519 #define IXGBE_CONTROL_SOL_NL 0x0000 520 + #define IXGBE_PHY_ENFORCE_INTEL_SFP_OFFSET 0x002C 521 + #define IXGBE_PHY_ALLOW_ANY_SFP 0x1 892 522 893 523 /* General purpose Interrupt Enable */ 894 524 #define IXGBE_SDP0_GPIEN 0x00000001 /* SDP0 */ 895 525 #define IXGBE_SDP1_GPIEN 0x00000002 /* SDP1 */ 526 + #define IXGBE_SDP2_GPIEN 0x00000004 /* SDP2 */ 896 527 #define IXGBE_GPIE_MSIX_MODE 0x00000010 /* MSI-X mode */ 897 528 #define IXGBE_GPIE_OCD 0x00000020 /* Other Clear Disable */ 898 529 #define IXGBE_GPIE_EIMEN 0x00000040 /* Immediate Interrupt Enable */ 899 530 #define IXGBE_GPIE_EIAME 0x40000000 900 531 #define IXGBE_GPIE_PBA_SUPPORT 0x80000000 532 + #define IXGBE_GPIE_VTMODE_MASK 0x0000C000 /* VT Mode Mask */ 533 + #define IXGBE_GPIE_VTMODE_16 0x00004000 /* 16 VFs 8 queues per VF */ 534 + #define IXGBE_GPIE_VTMODE_32 0x00008000 /* 32 VFs 4 queues per VF */ 535 + #define IXGBE_GPIE_VTMODE_64 0x0000C000 /* 64 VFs 2 queues per VF */ 901 536 902 537 /* Transmit Flow Control status */ 903 538 #define IXGBE_TFCS_TXOFF 0x00000001 ··· 945 566 #define IXGBE_VMD_CTL_VMDQ_EN 0x00000001 946 567 #define IXGBE_VMD_CTL_VMDQ_FILTER 0x00000002 947 568 569 + /* VT_CTL bitmasks */ 570 + #define IXGBE_VT_CTL_DIS_DEFPL 0x20000000 /* disable default pool */ 571 + #define IXGBE_VT_CTL_REPLEN 0x40000000 /* replication enabled */ 572 + #define IXGBE_VT_CTL_VT_ENABLE 0x00000001 /* Enable VT Mode */ 573 + 574 + /* VMOLR bitmasks */ 575 + #define IXGBE_VMOLR_AUPE 0x01000000 /* accept untagged packets */ 576 + #define IXGBE_VMOLR_ROMPE 0x02000000 /* accept packets in MTA tbl */ 577 + #define IXGBE_VMOLR_ROPE 0x04000000 /* accept packets in UC tbl */ 578 + #define IXGBE_VMOLR_BAM 0x08000000 /* accept broadcast packets */ 579 + #define IXGBE_VMOLR_MPE 0x10000000 /* multicast promiscuous */ 580 + 581 + /* VFRE bitmask */ 582 + #define IXGBE_VFRE_ENABLE_ALL 0xFFFFFFFF 583 + 948 584 /* RDHMPN and TDHMPN bitmasks */ 949 585 #define IXGBE_RDHMPN_RDICADDR 0x007FF800 950 586 #define IXGBE_RDHMPN_RDICRDREQ 0x00800000 ··· 968 574 #define IXGBE_TDHMPN_TDICRDREQ 0x00800000 969 575 #define IXGBE_TDHMPN_TDICADDR_SHIFT 11 970 576 577 + #define IXGBE_RDMAM_MEM_SEL_SHIFT 13 578 + #define IXGBE_RDMAM_DWORD_SHIFT 9 579 + #define IXGBE_RDMAM_DESC_COMP_FIFO 1 580 + #define IXGBE_RDMAM_DFC_CMD_FIFO 2 581 + #define IXGBE_RDMAM_TCN_STATUS_RAM 4 582 + #define IXGBE_RDMAM_WB_COLL_FIFO 5 583 + #define IXGBE_RDMAM_QSC_CNT_RAM 6 584 + #define IXGBE_RDMAM_QSC_QUEUE_CNT 8 585 + #define IXGBE_RDMAM_QSC_QUEUE_RAM 0xA 586 + #define IXGBE_RDMAM_DESC_COM_FIFO_RANGE 135 587 + #define IXGBE_RDMAM_DESC_COM_FIFO_COUNT 4 588 + #define IXGBE_RDMAM_DFC_CMD_FIFO_RANGE 48 589 + #define IXGBE_RDMAM_DFC_CMD_FIFO_COUNT 7 590 + #define IXGBE_RDMAM_TCN_STATUS_RAM_RANGE 256 591 + #define IXGBE_RDMAM_TCN_STATUS_RAM_COUNT 9 592 + #define IXGBE_RDMAM_WB_COLL_FIFO_RANGE 8 593 + #define IXGBE_RDMAM_WB_COLL_FIFO_COUNT 4 594 + #define IXGBE_RDMAM_QSC_CNT_RAM_RANGE 64 595 + #define IXGBE_RDMAM_QSC_CNT_RAM_COUNT 4 596 + #define IXGBE_RDMAM_QSC_QUEUE_CNT_RANGE 32 597 + #define IXGBE_RDMAM_QSC_QUEUE_CNT_COUNT 4 598 + #define IXGBE_RDMAM_QSC_QUEUE_RAM_RANGE 128 599 + #define IXGBE_RDMAM_QSC_QUEUE_RAM_COUNT 8 600 + 601 + #define IXGBE_TXDESCIC_READY 0x80000000 602 + 971 603 /* Receive Checksum Control */ 972 604 #define IXGBE_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ 973 605 #define IXGBE_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 974 606 975 607 /* FCRTL Bit Masks */ 976 - #define IXGBE_FCRTL_XONE 0x80000000 /* bit 31, XON enable */ 977 - #define IXGBE_FCRTH_FCEN 0x80000000 /* Rx Flow control enable */ 608 + #define IXGBE_FCRTL_XONE 0x80000000 /* XON enable */ 609 + #define IXGBE_FCRTH_FCEN 0x80000000 /* Packet buffer fc enable */ 978 610 979 611 /* PAP bit masks*/ 980 612 #define IXGBE_PAP_TXPAUSECNT_MASK 0x0000FFFF /* Pause counter mask */ ··· 1010 590 /* Receive Arbitration Control: 0 Round Robin, 1 DFP */ 1011 591 #define IXGBE_RMCS_RAC 0x00000004 1012 592 #define IXGBE_RMCS_DFP IXGBE_RMCS_RAC /* Deficit Fixed Priority ena */ 1013 - #define IXGBE_RMCS_TFCE_802_3X 0x00000008 /* Tx Priority flow control ena */ 1014 - #define IXGBE_RMCS_TFCE_PRIORITY 0x00000010 /* Tx Priority flow control ena */ 593 + #define IXGBE_RMCS_TFCE_802_3X 0x00000008 /* Tx Priority FC ena */ 594 + #define IXGBE_RMCS_TFCE_PRIORITY 0x00000010 /* Tx Priority FC ena */ 1015 595 #define IXGBE_RMCS_ARBDIS 0x00000040 /* Arbitration disable bit */ 1016 596 597 + /* FCCFG Bit Masks */ 598 + #define IXGBE_FCCFG_TFCE_802_3X 0x00000008 /* Tx link FC enable */ 599 + #define IXGBE_FCCFG_TFCE_PRIORITY 0x00000010 /* Tx priority FC enable */ 1017 600 1018 601 /* Interrupt register bitmasks */ 1019 602 1020 603 /* Extended Interrupt Cause Read */ 1021 604 #define IXGBE_EICR_RTX_QUEUE 0x0000FFFF /* RTx Queue Interrupt */ 605 + #define IXGBE_EICR_FLOW_DIR 0x00010000 /* FDir Exception */ 606 + #define IXGBE_EICR_RX_MISS 0x00020000 /* Packet Buffer Overrun */ 607 + #define IXGBE_EICR_PCI 0x00040000 /* PCI Exception */ 608 + #define IXGBE_EICR_MAILBOX 0x00080000 /* VF to PF Mailbox Interrupt */ 1022 609 #define IXGBE_EICR_LSC 0x00100000 /* Link Status Change */ 610 + #define IXGBE_EICR_LINKSEC 0x00200000 /* PN Threshold */ 1023 611 #define IXGBE_EICR_MNG 0x00400000 /* Manageability Event Interrupt */ 1024 612 #define IXGBE_EICR_GPI_SDP0 0x01000000 /* Gen Purpose Interrupt on SDP0 */ 1025 613 #define IXGBE_EICR_GPI_SDP1 0x02000000 /* Gen Purpose Interrupt on SDP1 */ 614 + #define IXGBE_EICR_GPI_SDP2 0x04000000 /* Gen Purpose Interrupt on SDP2 */ 615 + #define IXGBE_EICR_ECC 0x10000000 /* ECC Error */ 1026 616 #define IXGBE_EICR_PBUR 0x10000000 /* Packet Buffer Handler Error */ 1027 617 #define IXGBE_EICR_DHER 0x20000000 /* Descriptor Handler Error */ 1028 618 #define IXGBE_EICR_TCP_TIMER 0x40000000 /* TCP Timer */ ··· 1040 610 1041 611 /* Extended Interrupt Cause Set */ 1042 612 #define IXGBE_EICS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ 613 + #define IXGBE_EICS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ 614 + #define IXGBE_EICS_RX_MISS IXGBE_EICR_RX_MISS /* Pkt Buffer Overrun */ 615 + #define IXGBE_EICS_PCI IXGBE_EICR_PCI /* PCI Exception */ 616 + #define IXGBE_EICS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ 1043 617 #define IXGBE_EICS_LSC IXGBE_EICR_LSC /* Link Status Change */ 1044 618 #define IXGBE_EICS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ 1045 619 #define IXGBE_EICS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ 1046 620 #define IXGBE_EICS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ 621 + #define IXGBE_EICS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ 622 + #define IXGBE_EICS_ECC IXGBE_EICR_ECC /* ECC Error */ 1047 623 #define IXGBE_EICS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ 1048 624 #define IXGBE_EICS_DHER IXGBE_EICR_DHER /* Desc Handler Error */ 1049 625 #define IXGBE_EICS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ ··· 1057 621 1058 622 /* Extended Interrupt Mask Set */ 1059 623 #define IXGBE_EIMS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ 624 + #define IXGBE_EIMS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ 625 + #define IXGBE_EIMS_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ 626 + #define IXGBE_EIMS_PCI IXGBE_EICR_PCI /* PCI Exception */ 627 + #define IXGBE_EIMS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ 1060 628 #define IXGBE_EIMS_LSC IXGBE_EICR_LSC /* Link Status Change */ 1061 629 #define IXGBE_EIMS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ 1062 630 #define IXGBE_EIMS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ 1063 631 #define IXGBE_EIMS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ 632 + #define IXGBE_EIMS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ 633 + #define IXGBE_EIMS_ECC IXGBE_EICR_ECC /* ECC Error */ 1064 634 #define IXGBE_EIMS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ 1065 635 #define IXGBE_EIMS_DHER IXGBE_EICR_DHER /* Descr Handler Error */ 1066 636 #define IXGBE_EIMS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ ··· 1074 632 1075 633 /* Extended Interrupt Mask Clear */ 1076 634 #define IXGBE_EIMC_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ 635 + #define IXGBE_EIMC_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ 636 + #define IXGBE_EIMC_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ 637 + #define IXGBE_EIMC_PCI IXGBE_EICR_PCI /* PCI Exception */ 638 + #define IXGBE_EIMC_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ 1077 639 #define IXGBE_EIMC_LSC IXGBE_EICR_LSC /* Link Status Change */ 1078 640 #define IXGBE_EIMC_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ 1079 641 #define IXGBE_EIMC_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ 1080 642 #define IXGBE_EIMC_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ 643 + #define IXGBE_EIMC_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ 644 + #define IXGBE_EIMC_ECC IXGBE_EICR_ECC /* ECC Error */ 1081 645 #define IXGBE_EIMC_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ 1082 646 #define IXGBE_EIMC_DHER IXGBE_EICR_DHER /* Desc Handler Err */ 1083 647 #define IXGBE_EIMC_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ ··· 1106 658 #define IXGBE_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ 1107 659 #define IXGBE_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ 1108 660 #define IXGBE_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of control bits */ 661 + #define IXGBE_IMIR_SIZE_BP_82599 0x00001000 /* Packet size bypass */ 662 + #define IXGBE_IMIR_CTRL_URG_82599 0x00002000 /* Check URG bit in header */ 663 + #define IXGBE_IMIR_CTRL_ACK_82599 0x00004000 /* Check ACK bit in header */ 664 + #define IXGBE_IMIR_CTRL_PSH_82599 0x00008000 /* Check PSH bit in header */ 665 + #define IXGBE_IMIR_CTRL_RST_82599 0x00010000 /* Check RST bit in header */ 666 + #define IXGBE_IMIR_CTRL_SYN_82599 0x00020000 /* Check SYN bit in header */ 667 + #define IXGBE_IMIR_CTRL_FIN_82599 0x00040000 /* Check FIN bit in header */ 668 + #define IXGBE_IMIR_CTRL_BP_82599 0x00080000 /* Bypass check of control bits */ 669 + #define IXGBE_IMIR_LLI_EN_82599 0x00100000 /* Enables low latency Int */ 670 + #define IXGBE_IMIR_RX_QUEUE_MASK_82599 0x0000007F /* Rx Queue Mask */ 671 + #define IXGBE_IMIR_RX_QUEUE_SHIFT_82599 21 /* Rx Queue Shift */ 672 + #define IXGBE_IMIRVP_PRIORITY_MASK 0x00000007 /* VLAN priority mask */ 673 + #define IXGBE_IMIRVP_PRIORITY_EN 0x00000008 /* VLAN priority enable */ 674 + 675 + #define IXGBE_MAX_FTQF_FILTERS 128 676 + #define IXGBE_FTQF_PROTOCOL_MASK 0x00000003 677 + #define IXGBE_FTQF_PROTOCOL_TCP 0x00000000 678 + #define IXGBE_FTQF_PROTOCOL_UDP 0x00000001 679 + #define IXGBE_FTQF_PROTOCOL_SCTP 2 680 + #define IXGBE_FTQF_PRIORITY_MASK 0x00000007 681 + #define IXGBE_FTQF_PRIORITY_SHIFT 2 682 + #define IXGBE_FTQF_POOL_MASK 0x0000003F 683 + #define IXGBE_FTQF_POOL_SHIFT 8 684 + #define IXGBE_FTQF_5TUPLE_MASK_MASK 0x0000001F 685 + #define IXGBE_FTQF_5TUPLE_MASK_SHIFT 25 686 + #define IXGBE_FTQF_POOL_MASK_EN 0x40000000 687 + #define IXGBE_FTQF_QUEUE_ENABLE 0x80000000 1109 688 1110 689 /* Interrupt clear mask */ 1111 690 #define IXGBE_IRQ_CLEAR_MASK 0xFFFFFFFF ··· 1152 677 1153 678 #define IXGBE_IVAR_ALLOC_VAL 0x80 /* Interrupt Allocation valid */ 1154 679 680 + /* ETYPE Queue Filter/Select Bit Masks */ 681 + #define IXGBE_MAX_ETQF_FILTERS 8 682 + #define IXGBE_ETQF_BCN 0x10000000 /* bit 28 */ 683 + #define IXGBE_ETQF_1588 0x40000000 /* bit 30 */ 684 + #define IXGBE_ETQF_FILTER_EN 0x80000000 /* bit 31 */ 685 + #define IXGBE_ETQF_POOL_ENABLE (1 << 26) /* bit 26 */ 686 + 687 + #define IXGBE_ETQS_RX_QUEUE 0x007F0000 /* bits 22:16 */ 688 + #define IXGBE_ETQS_RX_QUEUE_SHIFT 16 689 + #define IXGBE_ETQS_LLI 0x20000000 /* bit 29 */ 690 + #define IXGBE_ETQS_QUEUE_EN 0x80000000 /* bit 31 */ 691 + 692 + /* 693 + * ETQF filter list: one static filter per filter consumer. This is 694 + * to avoid filter collisions later. Add new filters 695 + * here!! 696 + * 697 + * Current filters: 698 + * EAPOL 802.1x (0x888e): Filter 0 699 + * BCN (0x8904): Filter 1 700 + * 1588 (0x88f7): Filter 3 701 + */ 702 + #define IXGBE_ETQF_FILTER_EAPOL 0 703 + #define IXGBE_ETQF_FILTER_BCN 1 704 + #define IXGBE_ETQF_FILTER_1588 3 1155 705 /* VLAN Control Bit Masks */ 1156 706 #define IXGBE_VLNCTRL_VET 0x0000FFFF /* bits 0-15 */ 1157 707 #define IXGBE_VLNCTRL_CFI 0x10000000 /* bit 28 */ ··· 1184 684 #define IXGBE_VLNCTRL_VFE 0x40000000 /* bit 30 */ 1185 685 #define IXGBE_VLNCTRL_VME 0x80000000 /* bit 31 */ 1186 686 687 + /* VLAN pool filtering masks */ 688 + #define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */ 689 + #define IXGBE_VLVF_ENTRIES 64 1187 690 1188 691 #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */ 1189 692 1190 693 /* STATUS Bit Masks */ 1191 - #define IXGBE_STATUS_LAN_ID 0x0000000C /* LAN ID */ 1192 - #define IXGBE_STATUS_GIO 0x00080000 /* GIO Master Enable Status */ 694 + #define IXGBE_STATUS_LAN_ID 0x0000000C /* LAN ID */ 695 + #define IXGBE_STATUS_LAN_ID_SHIFT 2 /* LAN ID Shift*/ 696 + #define IXGBE_STATUS_GIO 0x00080000 /* GIO Master Enable Status */ 1193 697 1194 698 #define IXGBE_STATUS_LAN_ID_0 0x00000000 /* LAN ID 0 */ 1195 699 #define IXGBE_STATUS_LAN_ID_1 0x00000004 /* LAN ID 1 */ 1196 700 1197 701 /* ESDP Bit Masks */ 1198 - #define IXGBE_ESDP_SDP4 0x00000001 /* SDP4 Data Value */ 1199 - #define IXGBE_ESDP_SDP5 0x00000002 /* SDP5 Data Value */ 702 + #define IXGBE_ESDP_SDP0 0x00000001 703 + #define IXGBE_ESDP_SDP1 0x00000002 704 + #define IXGBE_ESDP_SDP4 0x00000010 /* SDP4 Data Value */ 705 + #define IXGBE_ESDP_SDP5 0x00000020 /* SDP5 Data Value */ 706 + #define IXGBE_ESDP_SDP6 0x00000040 /* SDP6 Data Value */ 1200 707 #define IXGBE_ESDP_SDP4_DIR 0x00000004 /* SDP4 IO direction */ 1201 - #define IXGBE_ESDP_SDP5_DIR 0x00000008 /* SDP5 IO direction */ 708 + #define IXGBE_ESDP_SDP5_DIR 0x00002000 /* SDP5 IO direction */ 1202 709 1203 710 /* LEDCTL Bit Masks */ 1204 711 #define IXGBE_LED_IVRT_BASE 0x00000040 ··· 1237 730 #define IXGBE_AUTOC_AN_RX_LOOSE 0x01000000 1238 731 #define IXGBE_AUTOC_AN_RX_DRIFT 0x00800000 1239 732 #define IXGBE_AUTOC_AN_RX_ALIGN 0x007C0000 733 + #define IXGBE_AUTOC_FECA 0x00040000 734 + #define IXGBE_AUTOC_FECR 0x00020000 735 + #define IXGBE_AUTOC_KR_SUPP 0x00010000 1240 736 #define IXGBE_AUTOC_AN_RESTART 0x00001000 1241 737 #define IXGBE_AUTOC_FLU 0x00000001 1242 738 #define IXGBE_AUTOC_LMS_SHIFT 13 739 + #define IXGBE_AUTOC_LMS_10G_SERIAL (0x3 << IXGBE_AUTOC_LMS_SHIFT) 740 + #define IXGBE_AUTOC_LMS_KX4_KX_KR (0x4 << IXGBE_AUTOC_LMS_SHIFT) 741 + #define IXGBE_AUTOC_LMS_SGMII_1G_100M (0x5 << IXGBE_AUTOC_LMS_SHIFT) 742 + #define IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) 743 + #define IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII (0x7 << IXGBE_AUTOC_LMS_SHIFT) 1243 744 #define IXGBE_AUTOC_LMS_MASK (0x7 << IXGBE_AUTOC_LMS_SHIFT) 1244 745 #define IXGBE_AUTOC_LMS_1G_LINK_NO_AN (0x0 << IXGBE_AUTOC_LMS_SHIFT) 1245 746 #define IXGBE_AUTOC_LMS_10G_LINK_NO_AN (0x1 << IXGBE_AUTOC_LMS_SHIFT) ··· 1256 741 #define IXGBE_AUTOC_LMS_KX4_AN_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) 1257 742 #define IXGBE_AUTOC_LMS_ATTACH_TYPE (0x7 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) 1258 743 1259 - #define IXGBE_AUTOC_1G_PMA_PMD 0x00000200 1260 - #define IXGBE_AUTOC_10G_PMA_PMD 0x00000180 1261 - #define IXGBE_AUTOC_10G_PMA_PMD_SHIFT 7 1262 - #define IXGBE_AUTOC_1G_PMA_PMD_SHIFT 9 744 + #define IXGBE_AUTOC_1G_PMA_PMD_MASK 0x00000200 745 + #define IXGBE_AUTOC_1G_PMA_PMD_SHIFT 9 746 + #define IXGBE_AUTOC_10G_PMA_PMD_MASK 0x00000180 747 + #define IXGBE_AUTOC_10G_PMA_PMD_SHIFT 7 1263 748 #define IXGBE_AUTOC_10G_XAUI (0x0 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) 1264 749 #define IXGBE_AUTOC_10G_KX4 (0x1 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) 1265 750 #define IXGBE_AUTOC_10G_CX4 (0x2 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) 1266 751 #define IXGBE_AUTOC_1G_BX (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) 1267 752 #define IXGBE_AUTOC_1G_KX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) 753 + #define IXGBE_AUTOC_1G_SFI (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) 754 + #define IXGBE_AUTOC_1G_KX_BX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) 755 + 756 + #define IXGBE_AUTOC2_UPPER_MASK 0xFFFF0000 757 + #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK 0x00030000 758 + #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT 16 759 + #define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 760 + #define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 761 + #define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 1268 762 1269 763 /* LINKS Bit Masks */ 1270 764 #define IXGBE_LINKS_KX_AN_COMP 0x80000000 ··· 1283 759 #define IXGBE_LINKS_RX_MODE 0x06000000 1284 760 #define IXGBE_LINKS_TX_MODE 0x01800000 1285 761 #define IXGBE_LINKS_XGXS_EN 0x00400000 762 + #define IXGBE_LINKS_SGMII_EN 0x02000000 1286 763 #define IXGBE_LINKS_PCS_1G_EN 0x00200000 1287 764 #define IXGBE_LINKS_1G_AN_EN 0x00100000 1288 765 #define IXGBE_LINKS_KX_AN_IDLE 0x00080000 ··· 1293 768 #define IXGBE_LINKS_TL_FAULT 0x00001000 1294 769 #define IXGBE_LINKS_SIGNAL 0x00000F00 1295 770 771 + #define IXGBE_LINKS_SPEED_82599 0x30000000 772 + #define IXGBE_LINKS_SPEED_10G_82599 0x30000000 773 + #define IXGBE_LINKS_SPEED_1G_82599 0x20000000 774 + #define IXGBE_LINKS_SPEED_100_82599 0x10000000 1296 775 #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ 1297 776 #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ 1298 777 ··· 1373 844 #define IXGBE_FW_PTR 0x0F 1374 845 #define IXGBE_PBANUM0_PTR 0x15 1375 846 #define IXGBE_PBANUM1_PTR 0x16 847 + #define IXGBE_PCIE_MSIX_82599_CAPS 0x72 1376 848 #define IXGBE_PCIE_MSIX_82598_CAPS 0x62 1377 849 1378 850 /* MSI-X capability fields masks */ ··· 1426 896 #define IXGBE_PCI_LINK_SPEED 0xF 1427 897 #define IXGBE_PCI_LINK_SPEED_2500 0x1 1428 898 #define IXGBE_PCI_LINK_SPEED_5000 0x2 899 + #define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E 900 + #define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80 1429 901 1430 902 /* Number of 100 microseconds we wait for PCI Express master disable */ 1431 903 #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 ··· 1480 948 #define IXGBE_RXCTRL_RXEN 0x00000001 /* Enable Receiver */ 1481 949 #define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */ 1482 950 #define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */ 951 + #define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */ 1483 952 1484 953 #define IXGBE_FCTRL_SBP 0x00000002 /* Store Bad Packet */ 1485 954 #define IXGBE_FCTRL_MPE 0x00000100 /* Multicast Promiscuous Ena*/ ··· 1491 958 /* Receive Priority Flow Control Enable */ 1492 959 #define IXGBE_FCTRL_RPFCE 0x00004000 1493 960 #define IXGBE_FCTRL_RFCE 0x00008000 /* Receive Flow Control Ena */ 961 + #define IXGBE_MFLCN_PMCF 0x00000001 /* Pass MAC Control Frames */ 962 + #define IXGBE_MFLCN_DPF 0x00000002 /* Discard Pause Frame */ 963 + #define IXGBE_MFLCN_RPFCE 0x00000004 /* Receive Priority FC Enable */ 964 + #define IXGBE_MFLCN_RFCE 0x00000008 /* Receive FC Enable */ 1494 965 1495 966 /* Multiple Receive Queue Control */ 1496 967 #define IXGBE_MRQC_RSSEN 0x00000001 /* RSS Enable */ 968 + #define IXGBE_MRQC_MRQE_MASK 0xF /* Bits 3:0 */ 969 + #define IXGBE_MRQC_RT8TCEN 0x00000002 /* 8 TC no RSS */ 970 + #define IXGBE_MRQC_RT4TCEN 0x00000003 /* 4 TC no RSS */ 971 + #define IXGBE_MRQC_RTRSS8TCEN 0x00000004 /* 8 TC w/ RSS */ 972 + #define IXGBE_MRQC_RTRSS4TCEN 0x00000005 /* 4 TC w/ RSS */ 973 + #define IXGBE_MRQC_VMDQEN 0x00000008 /* VMDq2 64 pools no RSS */ 974 + #define IXGBE_MRQC_VMDQRSS32EN 0x0000000A /* VMDq2 32 pools w/ RSS */ 975 + #define IXGBE_MRQC_VMDQRSS64EN 0x0000000B /* VMDq2 64 pools w/ RSS */ 976 + #define IXGBE_MRQC_VMDQRT8TCEN 0x0000000C /* VMDq2/RT 16 pool 8 TC */ 977 + #define IXGBE_MRQC_VMDQRT4TCEN 0x0000000D /* VMDq2/RT 32 pool 4 TC */ 1497 978 #define IXGBE_MRQC_RSS_FIELD_MASK 0xFFFF0000 1498 979 #define IXGBE_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 1499 980 #define IXGBE_MRQC_RSS_FIELD_IPV4 0x00020000 ··· 1518 971 #define IXGBE_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 1519 972 #define IXGBE_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 1520 973 #define IXGBE_MRQC_RSS_FIELD_IPV6_EX_UDP 0x01000000 974 + #define IXGBE_MRQC_L3L4TXSWEN 0x00008000 975 + 976 + /* Queue Drop Enable */ 977 + #define IXGBE_QDE_ENABLE 0x00000001 978 + #define IXGBE_QDE_IDX_MASK 0x00007F00 979 + #define IXGBE_QDE_IDX_SHIFT 8 1521 980 1522 981 #define IXGBE_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ 1523 982 #define IXGBE_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ ··· 1535 982 #define IXGBE_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ 1536 983 #define IXGBE_TXD_STAT_DD 0x00000001 /* Descriptor Done */ 1537 984 985 + #define IXGBE_RXDADV_IPSEC_STATUS_SECP 0x00020000 986 + #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000 987 + #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 988 + #define IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED 0x18000000 989 + #define IXGBE_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000 990 + /* Multiple Transmit Queue Command Register */ 991 + #define IXGBE_MTQC_RT_ENA 0x1 /* DCB Enable */ 992 + #define IXGBE_MTQC_VT_ENA 0x2 /* VMDQ2 Enable */ 993 + #define IXGBE_MTQC_64Q_1PB 0x0 /* 64 queues 1 pack buffer */ 994 + #define IXGBE_MTQC_64VF 0x8 /* 2 TX Queues per pool w/64VF's */ 995 + #define IXGBE_MTQC_8TC_8TQ 0xC /* 8 TC if RT_ENA or 8 TQ if VT_ENA */ 996 + 1538 997 /* Receive Descriptor bit definitions */ 1539 998 #define IXGBE_RXD_STAT_DD 0x01 /* Descriptor Done */ 1540 999 #define IXGBE_RXD_STAT_EOP 0x02 /* End of Packet */ 1000 + #define IXGBE_RXD_STAT_FLM 0x04 /* FDir Match */ 1541 1001 #define IXGBE_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ 1002 + #define IXGBE_RXDADV_NEXTP_MASK 0x000FFFF0 /* Next Descriptor Index */ 1003 + #define IXGBE_RXDADV_NEXTP_SHIFT 0x00000004 1542 1004 #define IXGBE_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ 1543 1005 #define IXGBE_RXD_STAT_L4CS 0x20 /* L4 xsum calculated */ 1544 1006 #define IXGBE_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ ··· 1562 994 #define IXGBE_RXD_STAT_VEXT 0x200 /* 1st VLAN found */ 1563 995 #define IXGBE_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */ 1564 996 #define IXGBE_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ 997 + #define IXGBE_RXD_STAT_LLINT 0x800 /* Pkt caused Low Latency Interrupt */ 998 + #define IXGBE_RXD_STAT_TS 0x10000 /* Time Stamp */ 999 + #define IXGBE_RXD_STAT_SECP 0x20000 /* Security Processing */ 1000 + #define IXGBE_RXD_STAT_LB 0x40000 /* Loopback Status */ 1565 1001 #define IXGBE_RXD_STAT_ACK 0x8000 /* ACK Packet indication */ 1566 1002 #define IXGBE_RXD_ERR_CE 0x01 /* CRC Error */ 1567 1003 #define IXGBE_RXD_ERR_LE 0x02 /* Length Error */ ··· 1574 1002 #define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */ 1575 1003 #define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */ 1576 1004 #define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */ 1005 + #define IXGBE_RXDADV_ERR_MASK 0xfff00000 /* RDESC.ERRORS mask */ 1006 + #define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */ 1577 1007 #define IXGBE_RXDADV_ERR_HBO 0x00800000 /*Header Buffer Overflow */ 1578 1008 #define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */ 1579 1009 #define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */ ··· 1590 1016 #define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */ 1591 1017 #define IXGBE_RXD_CFI_SHIFT 12 1592 1018 1019 + #define IXGBE_RXDADV_STAT_DD IXGBE_RXD_STAT_DD /* Done */ 1020 + #define IXGBE_RXDADV_STAT_EOP IXGBE_RXD_STAT_EOP /* End of Packet */ 1021 + #define IXGBE_RXDADV_STAT_FLM IXGBE_RXD_STAT_FLM /* FDir Match */ 1022 + #define IXGBE_RXDADV_STAT_VP IXGBE_RXD_STAT_VP /* IEEE VLAN Pkt */ 1023 + #define IXGBE_RXDADV_STAT_MASK 0x000fffff /* Stat/NEXTP: bit 0-19 */ 1024 + 1025 + /* PSRTYPE bit definitions */ 1026 + #define IXGBE_PSRTYPE_TCPHDR 0x00000010 1027 + #define IXGBE_PSRTYPE_UDPHDR 0x00000020 1028 + #define IXGBE_PSRTYPE_IPV4HDR 0x00000100 1029 + #define IXGBE_PSRTYPE_IPV6HDR 0x00000200 1593 1030 1594 1031 /* SRRCTL bit definitions */ 1595 1032 #define IXGBE_SRRCTL_BSIZEPKT_SHIFT 10 /* so many KBs */ 1033 + #define IXGBE_SRRCTL_RDMTS_SHIFT 22 1034 + #define IXGBE_SRRCTL_RDMTS_MASK 0x01C00000 1035 + #define IXGBE_SRRCTL_DROP_EN 0x10000000 1596 1036 #define IXGBE_SRRCTL_BSIZEPKT_MASK 0x0000007F 1597 1037 #define IXGBE_SRRCTL_BSIZEHDR_MASK 0x00003F00 1598 1038 #define IXGBE_SRRCTL_DESCTYPE_LEGACY 0x00000000 ··· 1621 1033 1622 1034 #define IXGBE_RXDADV_RSSTYPE_MASK 0x0000000F 1623 1035 #define IXGBE_RXDADV_PKTTYPE_MASK 0x0000FFF0 1036 + #define IXGBE_RXDADV_PKTTYPE_MASK_EX 0x0001FFF0 1624 1037 #define IXGBE_RXDADV_HDRBUFLEN_MASK 0x00007FE0 1625 1038 #define IXGBE_RXDADV_HDRBUFLEN_SHIFT 5 1626 1039 #define IXGBE_RXDADV_SPLITHEADER_EN 0x00001000 ··· 1649 1060 #define IXGBE_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */ 1650 1061 #define IXGBE_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */ 1651 1062 #define IXGBE_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */ 1063 + #define IXGBE_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */ 1064 + #define IXGBE_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */ 1065 + #define IXGBE_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */ 1066 + #define IXGBE_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */ 1067 + #define IXGBE_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */ 1068 + #define IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */ 1069 + 1070 + /* Security Processing bit Indication */ 1071 + #define IXGBE_RXDADV_LNKSEC_STATUS_SECP 0x00020000 1072 + #define IXGBE_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000 1073 + #define IXGBE_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000 1074 + #define IXGBE_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000 1075 + #define IXGBE_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000 1076 + 1652 1077 /* Masks to determine if packets should be dropped due to frame errors */ 1653 1078 #define IXGBE_RXD_ERR_FRAME_ERR_MASK ( \ 1654 1079 IXGBE_RXD_ERR_CE | \ ··· 1692 1089 #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ 1693 1090 #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 1694 1091 1092 + /* Little Endian defines */ 1093 + #ifndef __le32 1094 + #define __le32 u32 1095 + #endif 1096 + #ifndef __le64 1097 + #define __le64 u64 1098 + 1099 + #endif 1695 1100 1696 1101 /* Transmit Descriptor - Legacy */ 1697 1102 struct ixgbe_legacy_tx_desc { ··· 1787 1176 1788 1177 /* Adv Transmit Descriptor Config Masks */ 1789 1178 #define IXGBE_ADVTXD_DTALEN_MASK 0x0000FFFF /* Data buf length(bytes) */ 1179 + #define IXGBE_ADVTXD_MAC_LINKSEC 0x00040000 /* Insert LinkSec */ 1180 + #define IXGBE_ADVTXD_IPSEC_SA_INDEX_MASK 0x000003FF /* IPSec SA index */ 1181 + #define IXGBE_ADVTXD_IPSEC_ESP_LEN_MASK 0x000001FF /* IPSec ESP length */ 1790 1182 #define IXGBE_ADVTXD_DTYP_MASK 0x00F00000 /* DTYP mask */ 1791 1183 #define IXGBE_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Desc */ 1792 1184 #define IXGBE_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ ··· 1824 1210 #define IXGBE_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ 1825 1211 #define IXGBE_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ 1826 1212 #define IXGBE_ADVTXD_TUCMD_MKRREQ 0x00002000 /*Req requires Markers and CRC*/ 1213 + #define IXGBE_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ 1214 + #define IXGBE_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ 1215 + #define IXGBE_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000/* ESP Encrypt Enable */ 1827 1216 #define IXGBE_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ 1828 1217 #define IXGBE_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ 1829 1218 ··· 1840 1223 #define IXGBE_LINK_SPEED_10GB_FULL 0x0080 1841 1224 #define IXGBE_LINK_SPEED_82598_AUTONEG (IXGBE_LINK_SPEED_1GB_FULL | \ 1842 1225 IXGBE_LINK_SPEED_10GB_FULL) 1226 + #define IXGBE_LINK_SPEED_82599_AUTONEG (IXGBE_LINK_SPEED_100_FULL | \ 1227 + IXGBE_LINK_SPEED_1GB_FULL | \ 1228 + IXGBE_LINK_SPEED_10GB_FULL) 1229 + 1230 + #define IXGBE_PCIE_DEV_CTRL_2 0xC8 1231 + #define PCIE_COMPL_TO_VALUE 0x05 1843 1232 1844 1233 /* Physical layer type */ 1845 1234 typedef u32 ixgbe_physical_layer; ··· 1862 1239 #define IXGBE_PHYSICAL_LAYER_1000BASE_KX 0x0200 1863 1240 #define IXGBE_PHYSICAL_LAYER_1000BASE_BX 0x0400 1864 1241 1865 - 1866 1242 enum ixgbe_eeprom_type { 1867 1243 ixgbe_eeprom_uninitialized = 0, 1868 1244 ixgbe_eeprom_spi, ··· 1871 1249 enum ixgbe_mac_type { 1872 1250 ixgbe_mac_unknown = 0, 1873 1251 ixgbe_mac_82598EB, 1252 + ixgbe_mac_82599EB, 1874 1253 ixgbe_num_macs 1875 1254 }; 1876 1255 1877 1256 enum ixgbe_phy_type { 1878 1257 ixgbe_phy_unknown = 0, 1879 1258 ixgbe_phy_tn, 1259 + ixgbe_phy_cu_unknown, 1880 1260 ixgbe_phy_qt, 1881 1261 ixgbe_phy_xaui, 1882 1262 ixgbe_phy_nl, ··· 1887 1263 ixgbe_phy_sfp_avago, 1888 1264 ixgbe_phy_sfp_ftl, 1889 1265 ixgbe_phy_sfp_unknown, 1266 + ixgbe_phy_sfp_intel, 1890 1267 ixgbe_phy_generic 1891 1268 }; 1892 1269 1893 1270 /* 1894 1271 * SFP+ module type IDs: 1895 1272 * 1896 - * ID Module Type 1273 + * ID Module Type 1897 1274 * ============= 1898 - * 0 SFP_DA_CU 1899 - * 1 SFP_SR 1900 - * 2 SFP_LR 1275 + * 0 SFP_DA_CU 1276 + * 1 SFP_SR 1277 + * 2 SFP_LR 1278 + * 3 SFP_DA_CU_CORE0 - 82599-specific 1279 + * 4 SFP_DA_CU_CORE1 - 82599-specific 1280 + * 5 SFP_SR/LR_CORE0 - 82599-specific 1281 + * 6 SFP_SR/LR_CORE1 - 82599-specific 1901 1282 */ 1902 1283 enum ixgbe_sfp_type { 1903 1284 ixgbe_sfp_type_da_cu = 0, 1904 1285 ixgbe_sfp_type_sr = 1, 1905 1286 ixgbe_sfp_type_lr = 2, 1287 + ixgbe_sfp_type_da_cu_core0 = 3, 1288 + ixgbe_sfp_type_da_cu_core1 = 4, 1289 + ixgbe_sfp_type_srlr_core0 = 5, 1290 + ixgbe_sfp_type_srlr_core1 = 6, 1906 1291 ixgbe_sfp_type_not_present = 0xFFFE, 1907 1292 ixgbe_sfp_type_unknown = 0xFFFF 1908 1293 }; ··· 1933 1300 ixgbe_fc_default 1934 1301 }; 1935 1302 1303 + /* PCI bus types */ 1304 + enum ixgbe_bus_type { 1305 + ixgbe_bus_type_unknown = 0, 1306 + ixgbe_bus_type_pci, 1307 + ixgbe_bus_type_pcix, 1308 + ixgbe_bus_type_pci_express, 1309 + ixgbe_bus_type_reserved 1310 + }; 1311 + 1312 + /* PCI bus speeds */ 1313 + enum ixgbe_bus_speed { 1314 + ixgbe_bus_speed_unknown = 0, 1315 + ixgbe_bus_speed_33, 1316 + ixgbe_bus_speed_66, 1317 + ixgbe_bus_speed_100, 1318 + ixgbe_bus_speed_120, 1319 + ixgbe_bus_speed_133, 1320 + ixgbe_bus_speed_2500, 1321 + ixgbe_bus_speed_5000, 1322 + ixgbe_bus_speed_reserved 1323 + }; 1324 + 1325 + /* PCI bus widths */ 1326 + enum ixgbe_bus_width { 1327 + ixgbe_bus_width_unknown = 0, 1328 + ixgbe_bus_width_pcie_x1, 1329 + ixgbe_bus_width_pcie_x2, 1330 + ixgbe_bus_width_pcie_x4 = 4, 1331 + ixgbe_bus_width_pcie_x8 = 8, 1332 + ixgbe_bus_width_32, 1333 + ixgbe_bus_width_64, 1334 + ixgbe_bus_width_reserved 1335 + }; 1336 + 1936 1337 struct ixgbe_addr_filter_info { 1937 1338 u32 num_mc_addrs; 1938 1339 u32 rar_used_count; ··· 1974 1307 u32 mta_in_use; 1975 1308 u32 overflow_promisc; 1976 1309 bool user_set_promisc; 1310 + }; 1311 + 1312 + /* Bus parameters */ 1313 + struct ixgbe_bus_info { 1314 + enum ixgbe_bus_speed speed; 1315 + enum ixgbe_bus_width width; 1316 + enum ixgbe_bus_type type; 1317 + 1318 + u16 func; 1319 + u16 lan_id; 1977 1320 }; 1978 1321 1979 1322 /* Flow control parameters */ ··· 2054 1377 u64 qptc[16]; 2055 1378 u64 qbrc[16]; 2056 1379 u64 qbtc[16]; 1380 + u64 qprdc[16]; 1381 + u64 pxon2offc[8]; 1382 + u64 fdirustat_add; 1383 + u64 fdirustat_remove; 1384 + u64 fdirfstat_fadd; 1385 + u64 fdirfstat_fremove; 1386 + u64 fdirmatch; 1387 + u64 fdirmiss; 2057 1388 }; 2058 1389 2059 1390 /* forward declaration */ ··· 2086 1401 s32 (*start_hw)(struct ixgbe_hw *); 2087 1402 s32 (*clear_hw_cntrs)(struct ixgbe_hw *); 2088 1403 enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); 2089 - s32 (*get_supported_physical_layer)(struct ixgbe_hw *); 1404 + u32 (*get_supported_physical_layer)(struct ixgbe_hw *); 2090 1405 s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); 2091 1406 s32 (*stop_adapter)(struct ixgbe_hw *); 2092 1407 s32 (*get_bus_info)(struct ixgbe_hw *); 1408 + void (*set_lan_id)(struct ixgbe_hw *); 2093 1409 s32 (*read_analog_reg8)(struct ixgbe_hw*, u32, u8*); 2094 1410 s32 (*write_analog_reg8)(struct ixgbe_hw*, u32, u8); 1411 + s32 (*setup_sfp)(struct ixgbe_hw *); 1412 + s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); 2095 1413 2096 1414 /* Link */ 2097 1415 s32 (*setup_link)(struct ixgbe_hw *); ··· 2150 1462 struct ixgbe_eeprom_info { 2151 1463 struct ixgbe_eeprom_operations ops; 2152 1464 enum ixgbe_eeprom_type type; 2153 - u32 semaphore_delay; 1465 + u32 semaphore_delay; 2154 1466 u16 word_size; 2155 1467 u16 address_bits; 2156 1468 }; ··· 2196 1508 struct ixgbe_fc_info fc; 2197 1509 struct ixgbe_phy_info phy; 2198 1510 struct ixgbe_eeprom_info eeprom; 1511 + struct ixgbe_bus_info bus; 2199 1512 u16 device_id; 2200 1513 u16 vendor_id; 2201 1514 u16 subsystem_device_id; ··· 2235 1546 #define IXGBE_ERR_I2C -18 2236 1547 #define IXGBE_ERR_SFP_NOT_SUPPORTED -19 2237 1548 #define IXGBE_ERR_SFP_NOT_PRESENT -20 1549 + #define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 2238 1550 #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF 2239 1551 2240 1552 #endif /* _IXGBE_TYPE_H_ */