aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-08 14:08:35 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-08 14:08:35 -0500
commitbf745e88b733a2806dc4da8a9cd5a7e4d67543ab (patch)
treeb78bd559f9088337a8654aeefefc6bad997a679c
parenta7ac8fc1d8d26c975c460a69aa7b9d5b5d5d29b0 (diff)
parent2b642ca5e93fa1c977e8c90480a2900149f262be (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/igb/e1000_defines.h1
-rw-r--r--drivers/net/igb/e1000_hw.h4
-rw-r--r--drivers/net/igb/e1000_regs.h7
-rw-r--r--drivers/net/igb/igb_ethtool.c9
-rw-r--r--drivers/net/igb/igb_main.c9
-rw-r--r--drivers/net/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c38
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c124
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c509
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c41
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c86
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_mbx.c27
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.c21
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h10
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c9
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--net/8021q/vlan_dev.c14
21 files changed, 608 insertions, 320 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 7ce3dd01d6eb..925c25c295f0 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2109,6 +2109,7 @@ config E1000
2109config E1000E 2109config E1000E
2110 tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" 2110 tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support"
2111 depends on PCI && (!SPARC32 || BROKEN) 2111 depends on PCI && (!SPARC32 || BROKEN)
2112 select CRC32
2112 ---help--- 2113 ---help---
2113 This driver supports the PCI-Express Intel(R) PRO/1000 gigabit 2114 This driver supports the PCI-Express Intel(R) PRO/1000 gigabit
2114 ethernet family of adapters. For PCI or PCI-X e1000 adapters, 2115 ethernet family of adapters. For PCI or PCI-X e1000 adapters,
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index ff46c91520af..92e11da25749 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -110,6 +110,7 @@
110/* Management Control */ 110/* Management Control */
111#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ 111#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */
112#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ 112#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */
113#define E1000_MANC_EN_BMC2OS 0x10000000 /* OSBMC is Enabled or not */
113/* Enable Neighbor Discovery Filtering */ 114/* Enable Neighbor Discovery Filtering */
114#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ 115#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
115#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ 116#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index 281324e85980..eec9ed735588 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -248,6 +248,10 @@ struct e1000_hw_stats {
248 u64 scvpc; 248 u64 scvpc;
249 u64 hrmpc; 249 u64 hrmpc;
250 u64 doosync; 250 u64 doosync;
251 u64 o2bgptc;
252 u64 o2bspc;
253 u64 b2ospc;
254 u64 b2ogprc;
251}; 255};
252 256
253struct e1000_phy_stats { 257struct e1000_phy_stats {
diff --git a/drivers/net/igb/e1000_regs.h b/drivers/net/igb/e1000_regs.h
index 3a6f8471aea2..61713548c027 100644
--- a/drivers/net/igb/e1000_regs.h
+++ b/drivers/net/igb/e1000_regs.h
@@ -328,4 +328,11 @@
328 328
329/* DMA Coalescing registers */ 329/* DMA Coalescing registers */
330#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ 330#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */
331
332/* OS2BMC Registers */
333#define E1000_B2OSPC 0x08FE0 /* BMC2OS packets sent by BMC */
334#define E1000_B2OGPRC 0x04158 /* BMC2OS packets received by host */
335#define E1000_O2BGPTC 0x08FE4 /* OS2BMC packets received by BMC */
336#define E1000_O2BSPC 0x0415C /* OS2BMC packets transmitted by host */
337
331#endif 338#endif
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 61f7849cb5a7..78d420b4b2db 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -86,6 +86,10 @@ static const struct igb_stats igb_gstrings_stats[] = {
86 IGB_STAT("tx_smbus", stats.mgptc), 86 IGB_STAT("tx_smbus", stats.mgptc),
87 IGB_STAT("rx_smbus", stats.mgprc), 87 IGB_STAT("rx_smbus", stats.mgprc),
88 IGB_STAT("dropped_smbus", stats.mgpdc), 88 IGB_STAT("dropped_smbus", stats.mgpdc),
89 IGB_STAT("os2bmc_rx_by_bmc", stats.o2bgptc),
90 IGB_STAT("os2bmc_tx_by_bmc", stats.b2ospc),
91 IGB_STAT("os2bmc_tx_by_host", stats.o2bspc),
92 IGB_STAT("os2bmc_rx_by_host", stats.b2ogprc),
89}; 93};
90 94
91#define IGB_NETDEV_STAT(_net_stat) { \ 95#define IGB_NETDEV_STAT(_net_stat) { \
@@ -603,7 +607,10 @@ static void igb_get_regs(struct net_device *netdev,
603 regs_buff[548] = rd32(E1000_TDFT); 607 regs_buff[548] = rd32(E1000_TDFT);
604 regs_buff[549] = rd32(E1000_TDFHS); 608 regs_buff[549] = rd32(E1000_TDFHS);
605 regs_buff[550] = rd32(E1000_TDFPC); 609 regs_buff[550] = rd32(E1000_TDFPC);
606 610 regs_buff[551] = adapter->stats.o2bgptc;
611 regs_buff[552] = adapter->stats.b2ospc;
612 regs_buff[553] = adapter->stats.o2bspc;
613 regs_buff[554] = adapter->stats.b2ogprc;
607} 614}
608 615
609static int igb_get_eeprom_len(struct net_device *netdev) 616static int igb_get_eeprom_len(struct net_device *netdev)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index eef380af0537..3666b967846a 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -4560,6 +4560,15 @@ void igb_update_stats(struct igb_adapter *adapter,
4560 adapter->stats.mgptc += rd32(E1000_MGTPTC); 4560 adapter->stats.mgptc += rd32(E1000_MGTPTC);
4561 adapter->stats.mgprc += rd32(E1000_MGTPRC); 4561 adapter->stats.mgprc += rd32(E1000_MGTPRC);
4562 adapter->stats.mgpdc += rd32(E1000_MGTPDC); 4562 adapter->stats.mgpdc += rd32(E1000_MGTPDC);
4563
4564 /* OS2BMC Stats */
4565 reg = rd32(E1000_MANC);
4566 if (reg & E1000_MANC_EN_BMC2OS) {
4567 adapter->stats.o2bgptc += rd32(E1000_O2BGPTC);
4568 adapter->stats.o2bspc += rd32(E1000_O2BSPC);
4569 adapter->stats.b2ospc += rd32(E1000_B2OSPC);
4570 adapter->stats.b2ogprc += rd32(E1000_B2OGPRC);
4571 }
4563} 4572}
4564 4573
4565static irqreturn_t igb_msix_other(int irq, void *data) 4574static irqreturn_t igb_msix_other(int irq, void *data)
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index b60b81bc2b15..1e546fc127d0 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -552,6 +552,8 @@ extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
552 struct sk_buff *skb); 552 struct sk_buff *skb);
553extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 553extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
554 struct scatterlist *sgl, unsigned int sgc); 554 struct scatterlist *sgl, unsigned int sgc);
555extern int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
556 struct scatterlist *sgl, unsigned int sgc);
555extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 557extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
556extern int ixgbe_fcoe_enable(struct net_device *netdev); 558extern int ixgbe_fcoe_enable(struct net_device *netdev);
557extern int ixgbe_fcoe_disable(struct net_device *netdev); 559extern int ixgbe_fcoe_disable(struct net_device *netdev);
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index fc41329399be..ff23907bde0c 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -280,10 +280,22 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
280{ 280{
281 enum ixgbe_media_type media_type; 281 enum ixgbe_media_type media_type;
282 282
283 /* Detect if there is a copper PHY attached. */
284 switch (hw->phy.type) {
285 case ixgbe_phy_cu_unknown:
286 case ixgbe_phy_tn:
287 case ixgbe_phy_aq:
288 media_type = ixgbe_media_type_copper;
289 goto out;
290 default:
291 break;
292 }
293
283 /* Media type for I82598 is based on device ID */ 294 /* Media type for I82598 is based on device ID */
284 switch (hw->device_id) { 295 switch (hw->device_id) {
285 case IXGBE_DEV_ID_82598: 296 case IXGBE_DEV_ID_82598:
286 case IXGBE_DEV_ID_82598_BX: 297 case IXGBE_DEV_ID_82598_BX:
298 /* Default device ID is mezzanine card KX/KX4 */
287 media_type = ixgbe_media_type_backplane; 299 media_type = ixgbe_media_type_backplane;
288 break; 300 break;
289 case IXGBE_DEV_ID_82598AF_DUAL_PORT: 301 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
@@ -306,7 +318,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
306 media_type = ixgbe_media_type_unknown; 318 media_type = ixgbe_media_type_unknown;
307 break; 319 break;
308 } 320 }
309 321out:
310 return media_type; 322 return media_type;
311} 323}
312 324
@@ -354,7 +366,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
354 366
355 /* Negotiate the fc mode to use */ 367 /* Negotiate the fc mode to use */
356 ret_val = ixgbe_fc_autoneg(hw); 368 ret_val = ixgbe_fc_autoneg(hw);
357 if (ret_val) 369 if (ret_val == IXGBE_ERR_FLOW_CONTROL)
358 goto out; 370 goto out;
359 371
360 /* Disable any previous flow control settings */ 372 /* Disable any previous flow control settings */
@@ -372,10 +384,10 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
372 * 2: Tx flow control is enabled (we can send pause frames but 384 * 2: Tx flow control is enabled (we can send pause frames but
373 * we do not support receiving pause frames). 385 * we do not support receiving pause frames).
374 * 3: Both Rx and Tx flow control (symmetric) are enabled. 386 * 3: Both Rx and Tx flow control (symmetric) are enabled.
375 * other: Invalid.
376#ifdef CONFIG_DCB 387#ifdef CONFIG_DCB
377 * 4: Priority Flow Control is enabled. 388 * 4: Priority Flow Control is enabled.
378#endif 389#endif
390 * other: Invalid.
379 */ 391 */
380 switch (hw->fc.current_mode) { 392 switch (hw->fc.current_mode) {
381 case ixgbe_fc_none: 393 case ixgbe_fc_none:
@@ -432,9 +444,10 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
432 reg = (rx_pba_size - hw->fc.low_water) << 6; 444 reg = (rx_pba_size - hw->fc.low_water) << 6;
433 if (hw->fc.send_xon) 445 if (hw->fc.send_xon)
434 reg |= IXGBE_FCRTL_XONE; 446 reg |= IXGBE_FCRTL_XONE;
447
435 IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg); 448 IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg);
436 449
437 reg = (rx_pba_size - hw->fc.high_water) << 10; 450 reg = (rx_pba_size - hw->fc.high_water) << 6;
438 reg |= IXGBE_FCRTH_FCEN; 451 reg |= IXGBE_FCRTH_FCEN;
439 452
440 IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg); 453 IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg);
@@ -632,7 +645,7 @@ out:
632 * @hw: pointer to hardware structure 645 * @hw: pointer to hardware structure
633 * @speed: new link speed 646 * @speed: new link speed
634 * @autoneg: true if auto-negotiation enabled 647 * @autoneg: true if auto-negotiation enabled
635 * @autoneg_wait_to_complete: true if waiting is needed to complete 648 * @autoneg_wait_to_complete: true when waiting for completion is needed
636 * 649 *
637 * Set the link speed in the AUTOC register and restarts link. 650 * Set the link speed in the AUTOC register and restarts link.
638 **/ 651 **/
@@ -671,7 +684,8 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
671 * ixgbe_hw This will write the AUTOC register based on the new 684 * ixgbe_hw This will write the AUTOC register based on the new
672 * stored values 685 * stored values
673 */ 686 */
674 status = ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); 687 status = ixgbe_start_mac_link_82598(hw,
688 autoneg_wait_to_complete);
675 } 689 }
676 690
677 return status; 691 return status;
@@ -1090,10 +1104,12 @@ static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
1090 1104
1091 /* Copper PHY must be checked before AUTOC LMS to determine correct 1105 /* Copper PHY must be checked before AUTOC LMS to determine correct
1092 * physical layer because 10GBase-T PHYs use LMS = KX4/KX */ 1106 * physical layer because 10GBase-T PHYs use LMS = KX4/KX */
1093 if (hw->phy.type == ixgbe_phy_tn || 1107 switch (hw->phy.type) {
1094 hw->phy.type == ixgbe_phy_cu_unknown) { 1108 case ixgbe_phy_tn:
1095 hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD, 1109 case ixgbe_phy_aq:
1096 &ext_ability); 1110 case ixgbe_phy_cu_unknown:
1111 hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE,
1112 MDIO_MMD_PMAPMD, &ext_ability);
1097 if (ext_ability & MDIO_PMA_EXTABLE_10GBT) 1113 if (ext_ability & MDIO_PMA_EXTABLE_10GBT)
1098 physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; 1114 physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
1099 if (ext_ability & MDIO_PMA_EXTABLE_1000BT) 1115 if (ext_ability & MDIO_PMA_EXTABLE_1000BT)
@@ -1101,6 +1117,8 @@ static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
1101 if (ext_ability & MDIO_PMA_EXTABLE_100BTX) 1117 if (ext_ability & MDIO_PMA_EXTABLE_100BTX)
1102 physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; 1118 physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
1103 goto out; 1119 goto out;
1120 default:
1121 break;
1104 } 1122 }
1105 1123
1106 switch (autoc & IXGBE_AUTOC_LMS_MASK) { 1124 switch (autoc & IXGBE_AUTOC_LMS_MASK) {
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 5ef968a10d42..00aeba385a2f 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -470,8 +470,6 @@ static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
470 **/ 470 **/
471static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) 471static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
472{ 472{
473 hw_dbg(hw, "ixgbe_flap_tx_laser_multispeed_fiber\n");
474
475 if (hw->mac.autotry_restart) { 473 if (hw->mac.autotry_restart) {
476 ixgbe_disable_tx_laser_multispeed_fiber(hw); 474 ixgbe_disable_tx_laser_multispeed_fiber(hw);
477 ixgbe_enable_tx_laser_multispeed_fiber(hw); 475 ixgbe_enable_tx_laser_multispeed_fiber(hw);
@@ -494,17 +492,21 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
494 bool autoneg_wait_to_complete) 492 bool autoneg_wait_to_complete)
495{ 493{
496 s32 status = 0; 494 s32 status = 0;
497 ixgbe_link_speed phy_link_speed; 495 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
498 ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN; 496 ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN;
499 u32 speedcnt = 0; 497 u32 speedcnt = 0;
500 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); 498 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
499 u32 i = 0;
501 bool link_up = false; 500 bool link_up = false;
502 bool negotiation; 501 bool negotiation;
503 int i;
504 502
505 /* Mask off requested but non-supported speeds */ 503 /* Mask off requested but non-supported speeds */
506 hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation); 504 status = hw->mac.ops.get_link_capabilities(hw, &link_speed,
507 speed &= phy_link_speed; 505 &negotiation);
506 if (status != 0)
507 return status;
508
509 speed &= link_speed;
508 510
509 /* 511 /*
510 * Try each speed one by one, highest priority first. We do this in 512 * Try each speed one by one, highest priority first. We do this in
@@ -515,9 +517,12 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
515 highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL; 517 highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
516 518
517 /* If we already have link at this speed, just jump out */ 519 /* If we already have link at this speed, just jump out */
518 hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false); 520 status = hw->mac.ops.check_link(hw, &link_speed, &link_up,
521 false);
522 if (status != 0)
523 return status;
519 524
520 if ((phy_link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up) 525 if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
521 goto out; 526 goto out;
522 527
523 /* Set the module link speed */ 528 /* Set the module link speed */
@@ -529,9 +534,9 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
529 msleep(40); 534 msleep(40);
530 535
531 status = ixgbe_setup_mac_link_82599(hw, 536 status = ixgbe_setup_mac_link_82599(hw,
532 IXGBE_LINK_SPEED_10GB_FULL, 537 IXGBE_LINK_SPEED_10GB_FULL,
533 autoneg, 538 autoneg,
534 autoneg_wait_to_complete); 539 autoneg_wait_to_complete);
535 if (status != 0) 540 if (status != 0)
536 return status; 541 return status;
537 542
@@ -548,8 +553,11 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
548 msleep(100); 553 msleep(100);
549 554
550 /* If we have link, just jump out */ 555 /* If we have link, just jump out */
551 hw->mac.ops.check_link(hw, &phy_link_speed, 556 status = hw->mac.ops.check_link(hw, &link_speed,
552 &link_up, false); 557 &link_up, false);
558 if (status != 0)
559 return status;
560
553 if (link_up) 561 if (link_up)
554 goto out; 562 goto out;
555 } 563 }
@@ -561,9 +569,12 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
561 highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL; 569 highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
562 570
563 /* If we already have link at this speed, just jump out */ 571 /* If we already have link at this speed, just jump out */
564 hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false); 572 status = hw->mac.ops.check_link(hw, &link_speed, &link_up,
573 false);
574 if (status != 0)
575 return status;
565 576
566 if ((phy_link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up) 577 if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
567 goto out; 578 goto out;
568 579
569 /* Set the module link speed */ 580 /* Set the module link speed */
@@ -576,9 +587,9 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
576 msleep(40); 587 msleep(40);
577 588
578 status = ixgbe_setup_mac_link_82599(hw, 589 status = ixgbe_setup_mac_link_82599(hw,
579 IXGBE_LINK_SPEED_1GB_FULL, 590 IXGBE_LINK_SPEED_1GB_FULL,
580 autoneg, 591 autoneg,
581 autoneg_wait_to_complete); 592 autoneg_wait_to_complete);
582 if (status != 0) 593 if (status != 0)
583 return status; 594 return status;
584 595
@@ -589,7 +600,11 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
589 msleep(100); 600 msleep(100);
590 601
591 /* If we have link, just jump out */ 602 /* If we have link, just jump out */
592 hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false); 603 status = hw->mac.ops.check_link(hw, &link_speed, &link_up,
604 false);
605 if (status != 0)
606 return status;
607
593 if (link_up) 608 if (link_up)
594 goto out; 609 goto out;
595 } 610 }
@@ -632,13 +647,10 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
632 bool autoneg_wait_to_complete) 647 bool autoneg_wait_to_complete)
633{ 648{
634 s32 status = 0; 649 s32 status = 0;
635 ixgbe_link_speed link_speed; 650 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
636 s32 i, j; 651 s32 i, j;
637 bool link_up = false; 652 bool link_up = false;
638 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); 653 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
639 struct ixgbe_adapter *adapter = hw->back;
640
641 hw_dbg(hw, "ixgbe_setup_mac_link_smartspeed.\n");
642 654
643 /* Set autoneg_advertised value based on input link speed */ 655 /* Set autoneg_advertised value based on input link speed */
644 hw->phy.autoneg_advertised = 0; 656 hw->phy.autoneg_advertised = 0;
@@ -664,7 +676,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
664 for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) { 676 for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) {
665 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg, 677 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
666 autoneg_wait_to_complete); 678 autoneg_wait_to_complete);
667 if (status) 679 if (status != 0)
668 goto out; 680 goto out;
669 681
670 /* 682 /*
@@ -677,8 +689,11 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
677 mdelay(100); 689 mdelay(100);
678 690
679 /* If we have link, just jump out */ 691 /* If we have link, just jump out */
680 hw->mac.ops.check_link(hw, &link_speed, 692 status = hw->mac.ops.check_link(hw, &link_speed,
681 &link_up, false); 693 &link_up, false);
694 if (status != 0)
695 goto out;
696
682 if (link_up) 697 if (link_up)
683 goto out; 698 goto out;
684 } 699 }
@@ -696,7 +711,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
696 hw->phy.smart_speed_active = true; 711 hw->phy.smart_speed_active = true;
697 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg, 712 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
698 autoneg_wait_to_complete); 713 autoneg_wait_to_complete);
699 if (status) 714 if (status != 0)
700 goto out; 715 goto out;
701 716
702 /* 717 /*
@@ -709,8 +724,11 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
709 mdelay(100); 724 mdelay(100);
710 725
711 /* If we have link, just jump out */ 726 /* If we have link, just jump out */
712 hw->mac.ops.check_link(hw, &link_speed, 727 status = hw->mac.ops.check_link(hw, &link_speed,
713 &link_up, false); 728 &link_up, false);
729 if (status != 0)
730 goto out;
731
714 if (link_up) 732 if (link_up)
715 goto out; 733 goto out;
716 } 734 }
@@ -722,7 +740,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
722 740
723out: 741out:
724 if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL)) 742 if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL))
725 e_info(hw, "Smartspeed has downgraded the link speed from " 743 hw_dbg(hw, "Smartspeed has downgraded the link speed from "
726 "the maximum advertised\n"); 744 "the maximum advertised\n");
727 return status; 745 return status;
728} 746}
@@ -754,6 +772,9 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
754 772
755 /* Check to see if speed passed in is supported. */ 773 /* Check to see if speed passed in is supported. */
756 hw->mac.ops.get_link_capabilities(hw, &link_capabilities, &autoneg); 774 hw->mac.ops.get_link_capabilities(hw, &link_capabilities, &autoneg);
775 if (status != 0)
776 goto out;
777
757 speed &= link_capabilities; 778 speed &= link_capabilities;
758 779
759 if (speed == IXGBE_LINK_SPEED_UNKNOWN) { 780 if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
@@ -883,7 +904,7 @@ static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
883 904
884 /* PHY ops must be identified and initialized prior to reset */ 905 /* PHY ops must be identified and initialized prior to reset */
885 906
886 /* Init PHY and function pointers, perform SFP setup */ 907 /* Identify PHY and related function pointers */
887 status = hw->phy.ops.init(hw); 908 status = hw->phy.ops.init(hw);
888 909
889 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) 910 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
@@ -895,6 +916,9 @@ static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
895 hw->phy.sfp_setup_needed = false; 916 hw->phy.sfp_setup_needed = false;
896 } 917 }
897 918
919 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
920 goto reset_hw_out;
921
898 /* Reset PHY */ 922 /* Reset PHY */
899 if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL) 923 if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL)
900 hw->phy.ops.reset(hw); 924 hw->phy.ops.reset(hw);
@@ -2051,28 +2075,28 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2051}; 2075};
2052 2076
2053static struct ixgbe_eeprom_operations eeprom_ops_82599 = { 2077static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
2054 .init_params = &ixgbe_init_eeprom_params_generic, 2078 .init_params = &ixgbe_init_eeprom_params_generic,
2055 .read = &ixgbe_read_eerd_generic, 2079 .read = &ixgbe_read_eerd_generic,
2056 .write = &ixgbe_write_eeprom_generic, 2080 .write = &ixgbe_write_eeprom_generic,
2057 .calc_checksum = &ixgbe_calc_eeprom_checksum_generic, 2081 .calc_checksum = &ixgbe_calc_eeprom_checksum_generic,
2058 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, 2082 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
2059 .update_checksum = &ixgbe_update_eeprom_checksum_generic, 2083 .update_checksum = &ixgbe_update_eeprom_checksum_generic,
2060}; 2084};
2061 2085
2062static struct ixgbe_phy_operations phy_ops_82599 = { 2086static struct ixgbe_phy_operations phy_ops_82599 = {
2063 .identify = &ixgbe_identify_phy_82599, 2087 .identify = &ixgbe_identify_phy_82599,
2064 .identify_sfp = &ixgbe_identify_sfp_module_generic, 2088 .identify_sfp = &ixgbe_identify_sfp_module_generic,
2065 .init = &ixgbe_init_phy_ops_82599, 2089 .init = &ixgbe_init_phy_ops_82599,
2066 .reset = &ixgbe_reset_phy_generic, 2090 .reset = &ixgbe_reset_phy_generic,
2067 .read_reg = &ixgbe_read_phy_reg_generic, 2091 .read_reg = &ixgbe_read_phy_reg_generic,
2068 .write_reg = &ixgbe_write_phy_reg_generic, 2092 .write_reg = &ixgbe_write_phy_reg_generic,
2069 .setup_link = &ixgbe_setup_phy_link_generic, 2093 .setup_link = &ixgbe_setup_phy_link_generic,
2070 .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, 2094 .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
2071 .read_i2c_byte = &ixgbe_read_i2c_byte_generic, 2095 .read_i2c_byte = &ixgbe_read_i2c_byte_generic,
2072 .write_i2c_byte = &ixgbe_write_i2c_byte_generic, 2096 .write_i2c_byte = &ixgbe_write_i2c_byte_generic,
2073 .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, 2097 .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic,
2074 .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, 2098 .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic,
2075 .check_overtemp = &ixgbe_tn_check_overtemp, 2099 .check_overtemp = &ixgbe_tn_check_overtemp,
2076}; 2100};
2077 2101
2078struct ixgbe_info ixgbe_82599_info = { 2102struct ixgbe_info ixgbe_82599_info = {
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index a7fb2e00f766..bcd952916eb2 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -47,6 +47,12 @@ static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec);
47static void ixgbe_release_eeprom(struct ixgbe_hw *hw); 47static void ixgbe_release_eeprom(struct ixgbe_hw *hw);
48 48
49static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); 49static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr);
50static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw);
51static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw);
52static s32 ixgbe_fc_autoneg_copper(struct ixgbe_hw *hw);
53static s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
54static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
55 u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
50static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num); 56static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num);
51 57
52/** 58/**
@@ -136,17 +142,29 @@ s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw)
136 IXGBE_READ_REG(hw, IXGBE_MRFC); 142 IXGBE_READ_REG(hw, IXGBE_MRFC);
137 IXGBE_READ_REG(hw, IXGBE_RLEC); 143 IXGBE_READ_REG(hw, IXGBE_RLEC);
138 IXGBE_READ_REG(hw, IXGBE_LXONTXC); 144 IXGBE_READ_REG(hw, IXGBE_LXONTXC);
139 IXGBE_READ_REG(hw, IXGBE_LXONRXC);
140 IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); 145 IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
141 IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); 146 if (hw->mac.type >= ixgbe_mac_82599EB) {
147 IXGBE_READ_REG(hw, IXGBE_LXONRXCNT);
148 IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT);
149 } else {
150 IXGBE_READ_REG(hw, IXGBE_LXONRXC);
151 IXGBE_READ_REG(hw, IXGBE_LXOFFRXC);
152 }
142 153
143 for (i = 0; i < 8; i++) { 154 for (i = 0; i < 8; i++) {
144 IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); 155 IXGBE_READ_REG(hw, IXGBE_PXONTXC(i));
145 IXGBE_READ_REG(hw, IXGBE_PXONRXC(i));
146 IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); 156 IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i));
147 IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); 157 if (hw->mac.type >= ixgbe_mac_82599EB) {
158 IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i));
159 IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i));
160 } else {
161 IXGBE_READ_REG(hw, IXGBE_PXONRXC(i));
162 IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i));
163 }
148 } 164 }
149 165 if (hw->mac.type >= ixgbe_mac_82599EB)
166 for (i = 0; i < 8; i++)
167 IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i));
150 IXGBE_READ_REG(hw, IXGBE_PRC64); 168 IXGBE_READ_REG(hw, IXGBE_PRC64);
151 IXGBE_READ_REG(hw, IXGBE_PRC127); 169 IXGBE_READ_REG(hw, IXGBE_PRC127);
152 IXGBE_READ_REG(hw, IXGBE_PRC255); 170 IXGBE_READ_REG(hw, IXGBE_PRC255);
@@ -184,9 +202,26 @@ s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw)
184 IXGBE_READ_REG(hw, IXGBE_BPTC); 202 IXGBE_READ_REG(hw, IXGBE_BPTC);
185 for (i = 0; i < 16; i++) { 203 for (i = 0; i < 16; i++) {
186 IXGBE_READ_REG(hw, IXGBE_QPRC(i)); 204 IXGBE_READ_REG(hw, IXGBE_QPRC(i));
187 IXGBE_READ_REG(hw, IXGBE_QBRC(i));
188 IXGBE_READ_REG(hw, IXGBE_QPTC(i)); 205 IXGBE_READ_REG(hw, IXGBE_QPTC(i));
189 IXGBE_READ_REG(hw, IXGBE_QBTC(i)); 206 if (hw->mac.type >= ixgbe_mac_82599EB) {
207 IXGBE_READ_REG(hw, IXGBE_QBRC_L(i));
208 IXGBE_READ_REG(hw, IXGBE_QBRC_H(i));
209 IXGBE_READ_REG(hw, IXGBE_QBTC_L(i));
210 IXGBE_READ_REG(hw, IXGBE_QBTC_H(i));
211 IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
212 } else {
213 IXGBE_READ_REG(hw, IXGBE_QBRC(i));
214 IXGBE_READ_REG(hw, IXGBE_QBTC(i));
215 }
216 }
217
218 if (hw->mac.type == ixgbe_mac_X540) {
219 if (hw->phy.id == 0)
220 hw->phy.ops.identify(hw);
221 hw->phy.ops.read_reg(hw, 0x3, IXGBE_PCRC8ECL, &i);
222 hw->phy.ops.read_reg(hw, 0x3, IXGBE_PCRC8ECH, &i);
223 hw->phy.ops.read_reg(hw, 0x3, IXGBE_LDPCECL, &i);
224 hw->phy.ops.read_reg(hw, 0x3, IXGBE_LDPCECH, &i);
190 } 225 }
191 226
192 return 0; 227 return 0;
@@ -1075,7 +1110,7 @@ static void ixgbe_release_eeprom(struct ixgbe_hw *hw)
1075 eec &= ~IXGBE_EEC_REQ; 1110 eec &= ~IXGBE_EEC_REQ;
1076 IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); 1111 IXGBE_WRITE_REG(hw, IXGBE_EEC, eec);
1077 1112
1078 ixgbe_release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 1113 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
1079 1114
1080 /* Delay before attempt to obtain semaphore again to allow FW access */ 1115 /* Delay before attempt to obtain semaphore again to allow FW access */
1081 msleep(hw->eeprom.semaphore_delay); 1116 msleep(hw->eeprom.semaphore_delay);
@@ -1537,7 +1572,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
1537#endif /* CONFIG_DCB */ 1572#endif /* CONFIG_DCB */
1538 /* Negotiate the fc mode to use */ 1573 /* Negotiate the fc mode to use */
1539 ret_val = ixgbe_fc_autoneg(hw); 1574 ret_val = ixgbe_fc_autoneg(hw);
1540 if (ret_val) 1575 if (ret_val == IXGBE_ERR_FLOW_CONTROL)
1541 goto out; 1576 goto out;
1542 1577
1543 /* Disable any previous flow control settings */ 1578 /* Disable any previous flow control settings */
@@ -1645,12 +1680,13 @@ out:
1645 **/ 1680 **/
1646s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) 1681s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
1647{ 1682{
1648 s32 ret_val = 0; 1683 s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
1649 ixgbe_link_speed speed; 1684 ixgbe_link_speed speed;
1650 u32 pcs_anadv_reg, pcs_lpab_reg, linkstat;
1651 u32 links2, anlp1_reg, autoc_reg, links;
1652 bool link_up; 1685 bool link_up;
1653 1686
1687 if (hw->fc.disable_fc_autoneg)
1688 goto out;
1689
1654 /* 1690 /*
1655 * AN should have completed when the cable was plugged in. 1691 * AN should have completed when the cable was plugged in.
1656 * Look for reasons to bail out. Bail out if: 1692 * Look for reasons to bail out. Bail out if:
@@ -1661,153 +1697,199 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
1661 * So use link_up_wait_to_complete=false. 1697 * So use link_up_wait_to_complete=false.
1662 */ 1698 */
1663 hw->mac.ops.check_link(hw, &speed, &link_up, false); 1699 hw->mac.ops.check_link(hw, &speed, &link_up, false);
1664 1700 if (!link_up) {
1665 if (hw->fc.disable_fc_autoneg || (!link_up)) { 1701 ret_val = IXGBE_ERR_FLOW_CONTROL;
1666 hw->fc.fc_was_autonegged = false;
1667 hw->fc.current_mode = hw->fc.requested_mode;
1668 goto out; 1702 goto out;
1669 } 1703 }
1670 1704
1671 /* 1705 switch (hw->phy.media_type) {
1672 * On backplane, bail out if 1706 /* Autoneg flow control on fiber adapters */
1673 * - backplane autoneg was not completed, or if 1707 case ixgbe_media_type_fiber:
1674 * - we are 82599 and link partner is not AN enabled 1708 if (speed == IXGBE_LINK_SPEED_1GB_FULL)
1675 */ 1709 ret_val = ixgbe_fc_autoneg_fiber(hw);
1676 if (hw->phy.media_type == ixgbe_media_type_backplane) { 1710 break;
1677 links = IXGBE_READ_REG(hw, IXGBE_LINKS);
1678 if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) {
1679 hw->fc.fc_was_autonegged = false;
1680 hw->fc.current_mode = hw->fc.requested_mode;
1681 goto out;
1682 }
1683 1711
1684 if (hw->mac.type == ixgbe_mac_82599EB) { 1712 /* Autoneg flow control on backplane adapters */
1685 links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); 1713 case ixgbe_media_type_backplane:
1686 if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) { 1714 ret_val = ixgbe_fc_autoneg_backplane(hw);
1687 hw->fc.fc_was_autonegged = false; 1715 break;
1688 hw->fc.current_mode = hw->fc.requested_mode; 1716
1689 goto out; 1717 /* Autoneg flow control on copper adapters */
1690 } 1718 case ixgbe_media_type_copper:
1691 } 1719 if (ixgbe_device_supports_autoneg_fc(hw) == 0)
1720 ret_val = ixgbe_fc_autoneg_copper(hw);
1721 break;
1722
1723 default:
1724 break;
1692 } 1725 }
1693 1726
1727out:
1728 if (ret_val == 0) {
1729 hw->fc.fc_was_autonegged = true;
1730 } else {
1731 hw->fc.fc_was_autonegged = false;
1732 hw->fc.current_mode = hw->fc.requested_mode;
1733 }
1734 return ret_val;
1735}
1736
1737/**
1738 * ixgbe_fc_autoneg_fiber - Enable flow control on 1 gig fiber
1739 * @hw: pointer to hardware structure
1740 *
1741 * Enable flow control according on 1 gig fiber.
1742 **/
1743static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw)
1744{
1745 u32 pcs_anadv_reg, pcs_lpab_reg, linkstat;
1746 s32 ret_val;
1747
1694 /* 1748 /*
1695 * On multispeed fiber at 1g, bail out if 1749 * On multispeed fiber at 1g, bail out if
1696 * - link is up but AN did not complete, or if 1750 * - link is up but AN did not complete, or if
1697 * - link is up and AN completed but timed out 1751 * - link is up and AN completed but timed out
1698 */ 1752 */
1699 if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL)) { 1753
1700 linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); 1754 linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
1701 if (((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || 1755 if (((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) ||
1702 ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) { 1756 ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) {
1703 hw->fc.fc_was_autonegged = false; 1757 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
1704 hw->fc.current_mode = hw->fc.requested_mode; 1758 goto out;
1705 goto out;
1706 }
1707 } 1759 }
1708 1760
1761 pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
1762 pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP);
1763
1764 ret_val = ixgbe_negotiate_fc(hw, pcs_anadv_reg,
1765 pcs_lpab_reg, IXGBE_PCS1GANA_SYM_PAUSE,
1766 IXGBE_PCS1GANA_ASM_PAUSE,
1767 IXGBE_PCS1GANA_SYM_PAUSE,
1768 IXGBE_PCS1GANA_ASM_PAUSE);
1769
1770out:
1771 return ret_val;
1772}
1773
1774/**
1775 * ixgbe_fc_autoneg_backplane - Enable flow control IEEE clause 37
1776 * @hw: pointer to hardware structure
1777 *
1778 * Enable flow control according to IEEE clause 37.
1779 **/
1780static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw)
1781{
1782 u32 links2, anlp1_reg, autoc_reg, links;
1783 s32 ret_val;
1784
1709 /* 1785 /*
1710 * Bail out on 1786 * On backplane, bail out if
1711 * - copper or CX4 adapters 1787 * - backplane autoneg was not completed, or if
1712 * - fiber adapters running at 10gig 1788 * - we are 82599 and link partner is not AN enabled
1713 */ 1789 */
1714 if ((hw->phy.media_type == ixgbe_media_type_copper) || 1790 links = IXGBE_READ_REG(hw, IXGBE_LINKS);
1715 (hw->phy.media_type == ixgbe_media_type_cx4) || 1791 if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) {
1716 ((hw->phy.media_type == ixgbe_media_type_fiber) &&
1717 (speed == IXGBE_LINK_SPEED_10GB_FULL))) {
1718 hw->fc.fc_was_autonegged = false; 1792 hw->fc.fc_was_autonegged = false;
1719 hw->fc.current_mode = hw->fc.requested_mode; 1793 hw->fc.current_mode = hw->fc.requested_mode;
1794 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
1720 goto out; 1795 goto out;
1721 } 1796 }
1722 1797
1798 if (hw->mac.type == ixgbe_mac_82599EB) {
1799 links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2);
1800 if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) {
1801 hw->fc.fc_was_autonegged = false;
1802 hw->fc.current_mode = hw->fc.requested_mode;
1803 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
1804 goto out;
1805 }
1806 }
1723 /* 1807 /*
1724 * Read the AN advertisement and LP ability registers and resolve 1808 * Read the 10g AN autoc and LP ability registers and resolve
1725 * local flow control settings accordingly 1809 * local flow control settings accordingly
1726 */ 1810 */
1727 if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && 1811 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1728 (hw->phy.media_type != ixgbe_media_type_backplane)) { 1812 anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1);
1729 pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
1730 pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP);
1731 if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
1732 (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE)) {
1733 /*
1734 * Now we need to check if the user selected Rx ONLY
1735 * of pause frames. In this case, we had to advertise
1736 * FULL flow control because we could not advertise RX
1737 * ONLY. Hence, we must now check to see if we need to
1738 * turn OFF the TRANSMISSION of PAUSE frames.
1739 */
1740 if (hw->fc.requested_mode == ixgbe_fc_full) {
1741 hw->fc.current_mode = ixgbe_fc_full;
1742 hw_dbg(hw, "Flow Control = FULL.\n");
1743 } else {
1744 hw->fc.current_mode = ixgbe_fc_rx_pause;
1745 hw_dbg(hw, "Flow Control=RX PAUSE only\n");
1746 }
1747 } else if (!(pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
1748 (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) &&
1749 (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
1750 (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) {
1751 hw->fc.current_mode = ixgbe_fc_tx_pause;
1752 hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n");
1753 } else if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
1754 (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) &&
1755 !(pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
1756 (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) {
1757 hw->fc.current_mode = ixgbe_fc_rx_pause;
1758 hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n");
1759 } else {
1760 hw->fc.current_mode = ixgbe_fc_none;
1761 hw_dbg(hw, "Flow Control = NONE.\n");
1762 }
1763 }
1764 1813
1765 if (hw->phy.media_type == ixgbe_media_type_backplane) { 1814 ret_val = ixgbe_negotiate_fc(hw, autoc_reg,
1815 anlp1_reg, IXGBE_AUTOC_SYM_PAUSE, IXGBE_AUTOC_ASM_PAUSE,
1816 IXGBE_ANLP1_SYM_PAUSE, IXGBE_ANLP1_ASM_PAUSE);
1817
1818out:
1819 return ret_val;
1820}
1821
1822/**
1823 * ixgbe_fc_autoneg_copper - Enable flow control IEEE clause 37
1824 * @hw: pointer to hardware structure
1825 *
1826 * Enable flow control according to IEEE clause 37.
1827 **/
1828static s32 ixgbe_fc_autoneg_copper(struct ixgbe_hw *hw)
1829{
1830 u16 technology_ability_reg = 0;
1831 u16 lp_technology_ability_reg = 0;
1832
1833 hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE,
1834 MDIO_MMD_AN,
1835 &technology_ability_reg);
1836 hw->phy.ops.read_reg(hw, MDIO_AN_LPA,
1837 MDIO_MMD_AN,
1838 &lp_technology_ability_reg);
1839
1840 return ixgbe_negotiate_fc(hw, (u32)technology_ability_reg,
1841 (u32)lp_technology_ability_reg,
1842 IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE,
1843 IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE);
1844}
1845
1846/**
1847 * ixgbe_negotiate_fc - Negotiate flow control
1848 * @hw: pointer to hardware structure
1849 * @adv_reg: flow control advertised settings
1850 * @lp_reg: link partner's flow control settings
1851 * @adv_sym: symmetric pause bit in advertisement
1852 * @adv_asm: asymmetric pause bit in advertisement
1853 * @lp_sym: symmetric pause bit in link partner advertisement
1854 * @lp_asm: asymmetric pause bit in link partner advertisement
1855 *
1856 * Find the intersection between advertised settings and link partner's
1857 * advertised settings
1858 **/
1859static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
1860 u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
1861{
1862 if ((!(adv_reg)) || (!(lp_reg)))
1863 return IXGBE_ERR_FC_NOT_NEGOTIATED;
1864
1865 if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) {
1766 /* 1866 /*
1767 * Read the 10g AN autoc and LP ability registers and resolve 1867 * Now we need to check if the user selected Rx ONLY
1768 * local flow control settings accordingly 1868 * of pause frames. In this case, we had to advertise
1869 * FULL flow control because we could not advertise RX
1870 * ONLY. Hence, we must now check to see if we need to
1871 * turn OFF the TRANSMISSION of PAUSE frames.
1769 */ 1872 */
1770 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); 1873 if (hw->fc.requested_mode == ixgbe_fc_full) {
1771 anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); 1874 hw->fc.current_mode = ixgbe_fc_full;
1772 1875 hw_dbg(hw, "Flow Control = FULL.\n");
1773 if ((autoc_reg & IXGBE_AUTOC_SYM_PAUSE) &&
1774 (anlp1_reg & IXGBE_ANLP1_SYM_PAUSE)) {
1775 /*
1776 * Now we need to check if the user selected Rx ONLY
1777 * of pause frames. In this case, we had to advertise
1778 * FULL flow control because we could not advertise RX
1779 * ONLY. Hence, we must now check to see if we need to
1780 * turn OFF the TRANSMISSION of PAUSE frames.
1781 */
1782 if (hw->fc.requested_mode == ixgbe_fc_full) {
1783 hw->fc.current_mode = ixgbe_fc_full;
1784 hw_dbg(hw, "Flow Control = FULL.\n");
1785 } else {
1786 hw->fc.current_mode = ixgbe_fc_rx_pause;
1787 hw_dbg(hw, "Flow Control=RX PAUSE only\n");
1788 }
1789 } else if (!(autoc_reg & IXGBE_AUTOC_SYM_PAUSE) &&
1790 (autoc_reg & IXGBE_AUTOC_ASM_PAUSE) &&
1791 (anlp1_reg & IXGBE_ANLP1_SYM_PAUSE) &&
1792 (anlp1_reg & IXGBE_ANLP1_ASM_PAUSE)) {
1793 hw->fc.current_mode = ixgbe_fc_tx_pause;
1794 hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n");
1795 } else if ((autoc_reg & IXGBE_AUTOC_SYM_PAUSE) &&
1796 (autoc_reg & IXGBE_AUTOC_ASM_PAUSE) &&
1797 !(anlp1_reg & IXGBE_ANLP1_SYM_PAUSE) &&
1798 (anlp1_reg & IXGBE_ANLP1_ASM_PAUSE)) {
1799 hw->fc.current_mode = ixgbe_fc_rx_pause;
1800 hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n");
1801 } else { 1876 } else {
1802 hw->fc.current_mode = ixgbe_fc_none; 1877 hw->fc.current_mode = ixgbe_fc_rx_pause;
1803 hw_dbg(hw, "Flow Control = NONE.\n"); 1878 hw_dbg(hw, "Flow Control=RX PAUSE frames only\n");
1804 } 1879 }
1880 } else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) &&
1881 (lp_reg & lp_sym) && (lp_reg & lp_asm)) {
1882 hw->fc.current_mode = ixgbe_fc_tx_pause;
1883 hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n");
1884 } else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) &&
1885 !(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
1886 hw->fc.current_mode = ixgbe_fc_rx_pause;
1887 hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n");
1888 } else {
1889 hw->fc.current_mode = ixgbe_fc_none;
1890 hw_dbg(hw, "Flow Control = NONE.\n");
1805 } 1891 }
1806 /* Record that current_mode is the result of a successful autoneg */ 1892 return 0;
1807 hw->fc.fc_was_autonegged = true;
1808
1809out:
1810 return ret_val;
1811} 1893}
1812 1894
1813/** 1895/**
@@ -1819,7 +1901,8 @@ out:
1819static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) 1901static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1820{ 1902{
1821 s32 ret_val = 0; 1903 s32 ret_val = 0;
1822 u32 reg; 1904 u32 reg = 0, reg_bp = 0;
1905 u16 reg_cu = 0;
1823 1906
1824#ifdef CONFIG_DCB 1907#ifdef CONFIG_DCB
1825 if (hw->fc.requested_mode == ixgbe_fc_pfc) { 1908 if (hw->fc.requested_mode == ixgbe_fc_pfc) {
@@ -1827,7 +1910,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1827 goto out; 1910 goto out;
1828 } 1911 }
1829 1912
1830#endif 1913#endif /* CONFIG_DCB */
1831 /* Validate the packetbuf configuration */ 1914 /* Validate the packetbuf configuration */
1832 if (packetbuf_num < 0 || packetbuf_num > 7) { 1915 if (packetbuf_num < 0 || packetbuf_num > 7) {
1833 hw_dbg(hw, "Invalid packet buffer number [%d], expected range " 1916 hw_dbg(hw, "Invalid packet buffer number [%d], expected range "
@@ -1865,11 +1948,26 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1865 hw->fc.requested_mode = ixgbe_fc_full; 1948 hw->fc.requested_mode = ixgbe_fc_full;
1866 1949
1867 /* 1950 /*
1868 * Set up the 1G flow control advertisement registers so the HW will be 1951 * Set up the 1G and 10G flow control advertisement registers so the
1869 * able to do fc autoneg once the cable is plugged in. If we end up 1952 * HW will be able to do fc autoneg once the cable is plugged in. If
1870 * using 10g instead, this is harmless. 1953 * we link at 10G, the 1G advertisement is harmless and vice versa.
1871 */ 1954 */
1872 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); 1955
1956 switch (hw->phy.media_type) {
1957 case ixgbe_media_type_fiber:
1958 case ixgbe_media_type_backplane:
1959 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
1960 reg_bp = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1961 break;
1962
1963 case ixgbe_media_type_copper:
1964 hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE,
1965 MDIO_MMD_AN, &reg_cu);
1966 break;
1967
1968 default:
1969 ;
1970 }
1873 1971
1874 /* 1972 /*
1875 * The possible values of fc.requested_mode are: 1973 * The possible values of fc.requested_mode are:
@@ -1888,6 +1986,11 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1888 case ixgbe_fc_none: 1986 case ixgbe_fc_none:
1889 /* Flow control completely disabled by software override. */ 1987 /* Flow control completely disabled by software override. */
1890 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); 1988 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
1989 if (hw->phy.media_type == ixgbe_media_type_backplane)
1990 reg_bp &= ~(IXGBE_AUTOC_SYM_PAUSE |
1991 IXGBE_AUTOC_ASM_PAUSE);
1992 else if (hw->phy.media_type == ixgbe_media_type_copper)
1993 reg_cu &= ~(IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE);
1891 break; 1994 break;
1892 case ixgbe_fc_rx_pause: 1995 case ixgbe_fc_rx_pause:
1893 /* 1996 /*
@@ -1899,6 +2002,11 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1899 * disable the adapter's ability to send PAUSE frames. 2002 * disable the adapter's ability to send PAUSE frames.
1900 */ 2003 */
1901 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); 2004 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
2005 if (hw->phy.media_type == ixgbe_media_type_backplane)
2006 reg_bp |= (IXGBE_AUTOC_SYM_PAUSE |
2007 IXGBE_AUTOC_ASM_PAUSE);
2008 else if (hw->phy.media_type == ixgbe_media_type_copper)
2009 reg_cu |= (IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE);
1902 break; 2010 break;
1903 case ixgbe_fc_tx_pause: 2011 case ixgbe_fc_tx_pause:
1904 /* 2012 /*
@@ -1907,10 +2015,22 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1907 */ 2015 */
1908 reg |= (IXGBE_PCS1GANA_ASM_PAUSE); 2016 reg |= (IXGBE_PCS1GANA_ASM_PAUSE);
1909 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE); 2017 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE);
2018 if (hw->phy.media_type == ixgbe_media_type_backplane) {
2019 reg_bp |= (IXGBE_AUTOC_ASM_PAUSE);
2020 reg_bp &= ~(IXGBE_AUTOC_SYM_PAUSE);
2021 } else if (hw->phy.media_type == ixgbe_media_type_copper) {
2022 reg_cu |= (IXGBE_TAF_ASM_PAUSE);
2023 reg_cu &= ~(IXGBE_TAF_SYM_PAUSE);
2024 }
1910 break; 2025 break;
1911 case ixgbe_fc_full: 2026 case ixgbe_fc_full:
1912 /* Flow control (both Rx and Tx) is enabled by SW override. */ 2027 /* Flow control (both Rx and Tx) is enabled by SW override. */
1913 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); 2028 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
2029 if (hw->phy.media_type == ixgbe_media_type_backplane)
2030 reg_bp |= (IXGBE_AUTOC_SYM_PAUSE |
2031 IXGBE_AUTOC_ASM_PAUSE);
2032 else if (hw->phy.media_type == ixgbe_media_type_copper)
2033 reg_cu |= (IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE);
1914 break; 2034 break;
1915#ifdef CONFIG_DCB 2035#ifdef CONFIG_DCB
1916 case ixgbe_fc_pfc: 2036 case ixgbe_fc_pfc:
@@ -1924,80 +2044,37 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1924 break; 2044 break;
1925 } 2045 }
1926 2046
1927 IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); 2047 if (hw->mac.type != ixgbe_mac_X540) {
1928 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); 2048 /*
1929 2049 * Enable auto-negotiation between the MAC & PHY;
1930 /* Disable AN timeout */ 2050 * the MAC will advertise clause 37 flow control.
1931 if (hw->fc.strict_ieee) 2051 */
1932 reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; 2052 IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg);
2053 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL);
1933 2054
1934 IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); 2055 /* Disable AN timeout */
1935 hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); 2056 if (hw->fc.strict_ieee)
2057 reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN;
1936 2058
1937 /* 2059 IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg);
1938 * Set up the 10G flow control advertisement registers so the HW 2060 hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg);
1939 * can do fc autoneg once the cable is plugged in. If we end up 2061 }
1940 * using 1g instead, this is harmless.
1941 */
1942 reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1943 2062
1944 /* 2063 /*
1945 * The possible values of fc.requested_mode are: 2064 * AUTOC restart handles negotiation of 1G and 10G on backplane
1946 * 0: Flow control is completely disabled 2065 * and copper. There is no need to set the PCS1GCTL register.
1947 * 1: Rx flow control is enabled (we can receive pause frames, 2066 *
1948 * but not send pause frames).
1949 * 2: Tx flow control is enabled (we can send pause frames but
1950 * we do not support receiving pause frames).
1951 * 3: Both Rx and Tx flow control (symmetric) are enabled.
1952 * other: Invalid.
1953 */ 2067 */
1954 switch (hw->fc.requested_mode) { 2068 if (hw->phy.media_type == ixgbe_media_type_backplane) {
1955 case ixgbe_fc_none: 2069 reg_bp |= IXGBE_AUTOC_AN_RESTART;
1956 /* Flow control completely disabled by software override. */ 2070 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_bp);
1957 reg &= ~(IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE); 2071 } else if ((hw->phy.media_type == ixgbe_media_type_copper) &&
1958 break; 2072 (ixgbe_device_supports_autoneg_fc(hw) == 0)) {
1959 case ixgbe_fc_rx_pause: 2073 hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE,
1960 /* 2074 MDIO_MMD_AN, reg_cu);
1961 * Rx Flow control is enabled and Tx Flow control is
1962 * disabled by software override. Since there really
1963 * isn't a way to advertise that we are capable of RX
1964 * Pause ONLY, we will advertise that we support both
1965 * symmetric and asymmetric Rx PAUSE. Later, we will
1966 * disable the adapter's ability to send PAUSE frames.
1967 */
1968 reg |= (IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE);
1969 break;
1970 case ixgbe_fc_tx_pause:
1971 /*
1972 * Tx Flow control is enabled, and Rx Flow control is
1973 * disabled by software override.
1974 */
1975 reg |= (IXGBE_AUTOC_ASM_PAUSE);
1976 reg &= ~(IXGBE_AUTOC_SYM_PAUSE);
1977 break;
1978 case ixgbe_fc_full:
1979 /* Flow control (both Rx and Tx) is enabled by SW override. */
1980 reg |= (IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE);
1981 break;
1982#ifdef CONFIG_DCB
1983 case ixgbe_fc_pfc:
1984 goto out;
1985 break;
1986#endif /* CONFIG_DCB */
1987 default:
1988 hw_dbg(hw, "Flow control param set incorrectly\n");
1989 ret_val = IXGBE_ERR_CONFIG;
1990 goto out;
1991 break;
1992 } 2075 }
1993 /*
1994 * AUTOC restart handles negotiation of 1G and 10G. There is
1995 * no need to set the PCS1GCTL register.
1996 */
1997 reg |= IXGBE_AUTOC_AN_RESTART;
1998 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg);
1999 hw_dbg(hw, "Set up FC; IXGBE_AUTOC = 0x%08X\n", reg);
2000 2076
2077 hw_dbg(hw, "Set up FC; IXGBE_AUTOC = 0x%08X\n", reg);
2001out: 2078out:
2002 return ret_val; 2079 return ret_val;
2003} 2080}
@@ -2085,7 +2162,7 @@ out:
2085 * @hw: pointer to hardware structure 2162 * @hw: pointer to hardware structure
2086 * @mask: Mask to specify which semaphore to acquire 2163 * @mask: Mask to specify which semaphore to acquire
2087 * 2164 *
2088 * Acquires the SWFW semaphore thought the GSSR register for the specified 2165 * Acquires the SWFW semaphore through the GSSR register for the specified
2089 * function (CSR, PHY0, PHY1, EEPROM, Flash) 2166 * function (CSR, PHY0, PHY1, EEPROM, Flash)
2090 **/ 2167 **/
2091s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask) 2168s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask)
@@ -2133,7 +2210,7 @@ s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask)
2133 * @hw: pointer to hardware structure 2210 * @hw: pointer to hardware structure
2134 * @mask: Mask to specify which semaphore to release 2211 * @mask: Mask to specify which semaphore to release
2135 * 2212 *
2136 * Releases the SWFW semaphore thought the GSSR register for the specified 2213 * Releases the SWFW semaphore through the GSSR register for the specified
2137 * function (CSR, PHY0, PHY1, EEPROM, Flash) 2214 * function (CSR, PHY0, PHY1, EEPROM, Flash)
2138 **/ 2215 **/
2139void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask) 2216void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask)
@@ -2722,6 +2799,28 @@ wwn_prefix_out:
2722} 2799}
2723 2800
2724/** 2801/**
2802 * ixgbe_device_supports_autoneg_fc - Check if phy supports autoneg flow
2803 * control
2804 * @hw: pointer to hardware structure
2805 *
2806 * There are several phys that do not support autoneg flow control. This
2807 * function check the device id to see if the associated phy supports
2808 * autoneg flow control.
2809 **/
2810static s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
2811{
2812
2813 switch (hw->device_id) {
2814 case IXGBE_DEV_ID_X540T:
2815 return 0;
2816 case IXGBE_DEV_ID_82599_T3_LOM:
2817 return 0;
2818 default:
2819 return IXGBE_ERR_FC_NOT_SUPPORTED;
2820 }
2821}
2822
2823/**
2725 * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing 2824 * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing
2726 * @hw: pointer to hardware structure 2825 * @hw: pointer to hardware structure
2727 * @enable: enable or disable switch for anti-spoofing 2826 * @enable: enable or disable switch for anti-spoofing
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 83511c022926..76380a2b35aa 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -161,29 +161,25 @@ static int ixgbe_get_settings(struct net_device *netdev,
161 } 161 }
162 162
163 ecmd->advertising = ADVERTISED_Autoneg; 163 ecmd->advertising = ADVERTISED_Autoneg;
164 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) 164 if (hw->phy.autoneg_advertised) {
165 ecmd->advertising |= ADVERTISED_100baseT_Full; 165 if (hw->phy.autoneg_advertised &
166 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) 166 IXGBE_LINK_SPEED_100_FULL)
167 ecmd->advertising |= ADVERTISED_10000baseT_Full; 167 ecmd->advertising |= ADVERTISED_100baseT_Full;
168 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) 168 if (hw->phy.autoneg_advertised &
169 ecmd->advertising |= ADVERTISED_1000baseT_Full; 169 IXGBE_LINK_SPEED_10GB_FULL)
170 /* 170 ecmd->advertising |= ADVERTISED_10000baseT_Full;
171 * It's possible that phy.autoneg_advertised may not be 171 if (hw->phy.autoneg_advertised &
172 * set yet. If so display what the default would be - 172 IXGBE_LINK_SPEED_1GB_FULL)
173 * both 1G and 10G supported. 173 ecmd->advertising |= ADVERTISED_1000baseT_Full;
174 */ 174 } else {
175 if (!(ecmd->advertising & (ADVERTISED_1000baseT_Full | 175 /*
176 ADVERTISED_10000baseT_Full))) 176 * Default advertised modes in case
177 * phy.autoneg_advertised isn't set.
178 */
177 ecmd->advertising |= (ADVERTISED_10000baseT_Full | 179 ecmd->advertising |= (ADVERTISED_10000baseT_Full |
178 ADVERTISED_1000baseT_Full); 180 ADVERTISED_1000baseT_Full);
179 181 if (hw->mac.type == ixgbe_mac_X540)
180 switch (hw->mac.type) { 182 ecmd->advertising |= ADVERTISED_100baseT_Full;
181 case ixgbe_mac_X540:
182 if (!(ecmd->advertising & ADVERTISED_100baseT_Full))
183 ecmd->advertising |= (ADVERTISED_100baseT_Full);
184 break;
185 default:
186 break;
187 } 183 }
188 184
189 if (hw->phy.media_type == ixgbe_media_type_copper) { 185 if (hw->phy.media_type == ixgbe_media_type_copper) {
@@ -336,6 +332,9 @@ static int ixgbe_set_settings(struct net_device *netdev,
336 if (ecmd->advertising & ADVERTISED_1000baseT_Full) 332 if (ecmd->advertising & ADVERTISED_1000baseT_Full)
337 advertised |= IXGBE_LINK_SPEED_1GB_FULL; 333 advertised |= IXGBE_LINK_SPEED_1GB_FULL;
338 334
335 if (ecmd->advertising & ADVERTISED_100baseT_Full)
336 advertised |= IXGBE_LINK_SPEED_100_FULL;
337
339 if (old == advertised) 338 if (old == advertised)
340 return err; 339 return err;
341 /* this sets the link speed and restarts auto-neg */ 340 /* this sets the link speed and restarts auto-neg */
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 27203c87ea14..00af15a9cdc6 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -135,22 +135,19 @@ out_ddp_put:
135 return len; 135 return len;
136} 136}
137 137
138
138/** 139/**
139 * ixgbe_fcoe_ddp_get - called to set up ddp context 140 * ixgbe_fcoe_ddp_setup - called to set up ddp context
140 * @netdev: the corresponding net_device 141 * @netdev: the corresponding net_device
141 * @xid: the exchange id requesting ddp 142 * @xid: the exchange id requesting ddp
142 * @sgl: the scatter-gather list for this request 143 * @sgl: the scatter-gather list for this request
143 * @sgc: the number of scatter-gather items 144 * @sgc: the number of scatter-gather items
144 * 145 *
145 * This is the implementation of net_device_ops.ndo_fcoe_ddp_setup
146 * and is expected to be called from ULD, e.g., FCP layer of libfc
147 * to set up ddp for the corresponding xid of the given sglist for
148 * the corresponding I/O.
149 *
150 * Returns : 1 for success and 0 for no ddp 146 * Returns : 1 for success and 0 for no ddp
151 */ 147 */
152int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 148static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid,
153 struct scatterlist *sgl, unsigned int sgc) 149 struct scatterlist *sgl, unsigned int sgc,
150 int target_mode)
154{ 151{
155 struct ixgbe_adapter *adapter; 152 struct ixgbe_adapter *adapter;
156 struct ixgbe_hw *hw; 153 struct ixgbe_hw *hw;
@@ -164,7 +161,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
164 unsigned int lastsize; 161 unsigned int lastsize;
165 unsigned int thisoff = 0; 162 unsigned int thisoff = 0;
166 unsigned int thislen = 0; 163 unsigned int thislen = 0;
167 u32 fcbuff, fcdmarw, fcfltrw; 164 u32 fcbuff, fcdmarw, fcfltrw, fcrxctl;
168 dma_addr_t addr = 0; 165 dma_addr_t addr = 0;
169 166
170 if (!netdev || !sgl) 167 if (!netdev || !sgl)
@@ -275,6 +272,9 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
275 fcbuff = (IXGBE_FCBUFF_4KB << IXGBE_FCBUFF_BUFFSIZE_SHIFT); 272 fcbuff = (IXGBE_FCBUFF_4KB << IXGBE_FCBUFF_BUFFSIZE_SHIFT);
276 fcbuff |= ((j & 0xff) << IXGBE_FCBUFF_BUFFCNT_SHIFT); 273 fcbuff |= ((j & 0xff) << IXGBE_FCBUFF_BUFFCNT_SHIFT);
277 fcbuff |= (firstoff << IXGBE_FCBUFF_OFFSET_SHIFT); 274 fcbuff |= (firstoff << IXGBE_FCBUFF_OFFSET_SHIFT);
275 /* Set WRCONTX bit to allow DDP for target */
276 if (target_mode)
277 fcbuff |= (IXGBE_FCBUFF_WRCONTX);
278 fcbuff |= (IXGBE_FCBUFF_VALID); 278 fcbuff |= (IXGBE_FCBUFF_VALID);
279 279
280 fcdmarw = xid; 280 fcdmarw = xid;
@@ -287,6 +287,16 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
287 /* program DMA context */ 287 /* program DMA context */
288 hw = &adapter->hw; 288 hw = &adapter->hw;
289 spin_lock_bh(&fcoe->lock); 289 spin_lock_bh(&fcoe->lock);
290
291 /* turn on last frame indication for target mode as FCP_RSPtarget is
292 * supposed to send FCP_RSP when it is done. */
293 if (target_mode && !test_bit(__IXGBE_FCOE_TARGET, &fcoe->mode)) {
294 set_bit(__IXGBE_FCOE_TARGET, &fcoe->mode);
295 fcrxctl = IXGBE_READ_REG(hw, IXGBE_FCRXCTRL);
296 fcrxctl |= IXGBE_FCRXCTRL_LASTSEQH;
297 IXGBE_WRITE_REG(hw, IXGBE_FCRXCTRL, fcrxctl);
298 }
299
290 IXGBE_WRITE_REG(hw, IXGBE_FCPTRL, ddp->udp & DMA_BIT_MASK(32)); 300 IXGBE_WRITE_REG(hw, IXGBE_FCPTRL, ddp->udp & DMA_BIT_MASK(32));
291 IXGBE_WRITE_REG(hw, IXGBE_FCPTRH, (u64)ddp->udp >> 32); 301 IXGBE_WRITE_REG(hw, IXGBE_FCPTRH, (u64)ddp->udp >> 32);
292 IXGBE_WRITE_REG(hw, IXGBE_FCBUFF, fcbuff); 302 IXGBE_WRITE_REG(hw, IXGBE_FCBUFF, fcbuff);
@@ -295,6 +305,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
295 IXGBE_WRITE_REG(hw, IXGBE_FCPARAM, 0); 305 IXGBE_WRITE_REG(hw, IXGBE_FCPARAM, 0);
296 IXGBE_WRITE_REG(hw, IXGBE_FCFLT, IXGBE_FCFLT_VALID); 306 IXGBE_WRITE_REG(hw, IXGBE_FCFLT, IXGBE_FCFLT_VALID);
297 IXGBE_WRITE_REG(hw, IXGBE_FCFLTRW, fcfltrw); 307 IXGBE_WRITE_REG(hw, IXGBE_FCFLTRW, fcfltrw);
308
298 spin_unlock_bh(&fcoe->lock); 309 spin_unlock_bh(&fcoe->lock);
299 310
300 return 1; 311 return 1;
@@ -309,6 +320,47 @@ out_noddp_unmap:
309} 320}
310 321
311/** 322/**
323 * ixgbe_fcoe_ddp_get - called to set up ddp context in initiator mode
324 * @netdev: the corresponding net_device
325 * @xid: the exchange id requesting ddp
326 * @sgl: the scatter-gather list for this request
327 * @sgc: the number of scatter-gather items
328 *
329 * This is the implementation of net_device_ops.ndo_fcoe_ddp_setup
330 * and is expected to be called from ULD, e.g., FCP layer of libfc
331 * to set up ddp for the corresponding xid of the given sglist for
332 * the corresponding I/O.
333 *
334 * Returns : 1 for success and 0 for no ddp
335 */
336int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
337 struct scatterlist *sgl, unsigned int sgc)
338{
339 return ixgbe_fcoe_ddp_setup(netdev, xid, sgl, sgc, 0);
340}
341
342/**
343 * ixgbe_fcoe_ddp_target - called to set up ddp context in target mode
344 * @netdev: the corresponding net_device
345 * @xid: the exchange id requesting ddp
346 * @sgl: the scatter-gather list for this request
347 * @sgc: the number of scatter-gather items
348 *
349 * This is the implementation of net_device_ops.ndo_fcoe_ddp_target
350 * and is expected to be called from ULD, e.g., FCP layer of libfc
351 * to set up ddp for the corresponding xid of the given sglist for
352 * the corresponding I/O. The DDP in target mode is a write I/O request
353 * from the initiator.
354 *
355 * Returns : 1 for success and 0 for no ddp
356 */
357int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
358 struct scatterlist *sgl, unsigned int sgc)
359{
360 return ixgbe_fcoe_ddp_setup(netdev, xid, sgl, sgc, 1);
361}
362
363/**
312 * ixgbe_fcoe_ddp - check ddp status and mark it done 364 * ixgbe_fcoe_ddp - check ddp status and mark it done
313 * @adapter: ixgbe adapter 365 * @adapter: ixgbe adapter
314 * @rx_desc: advanced rx descriptor 366 * @rx_desc: advanced rx descriptor
@@ -331,6 +383,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
331 struct ixgbe_fcoe *fcoe; 383 struct ixgbe_fcoe *fcoe;
332 struct ixgbe_fcoe_ddp *ddp; 384 struct ixgbe_fcoe_ddp *ddp;
333 struct fc_frame_header *fh; 385 struct fc_frame_header *fh;
386 struct fcoe_crc_eof *crc;
334 387
335 if (!ixgbe_rx_is_fcoe(rx_desc)) 388 if (!ixgbe_rx_is_fcoe(rx_desc))
336 goto ddp_out; 389 goto ddp_out;
@@ -384,7 +437,18 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
384 else if (ddp->len) 437 else if (ddp->len)
385 rc = ddp->len; 438 rc = ddp->len;
386 } 439 }
387 440 /* In target mode, check the last data frame of the sequence.
441 * For DDP in target mode, data is already DDPed but the header
442 * indication of the last data frame ould allow is to tell if we
443 * got all the data and the ULP can send FCP_RSP back, as this is
444 * not a full fcoe frame, we fill the trailer here so it won't be
445 * dropped by the ULP stack.
446 */
447 if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) &&
448 (fctl & FC_FC_END_SEQ)) {
449 crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc));
450 crc->fcoe_eof = FC_EOF_T;
451 }
388ddp_out: 452ddp_out:
389 return rc; 453 return rc;
390} 454}
@@ -840,5 +904,3 @@ int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
840 } 904 }
841 return rc; 905 return rc;
842} 906}
843
844
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h
index 02a00d2415d9..5a650a4ace66 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ixgbe/ixgbe_fcoe.h
@@ -52,6 +52,9 @@
52/* fcerr */ 52/* fcerr */
53#define IXGBE_FCERR_BADCRC 0x00100000 53#define IXGBE_FCERR_BADCRC 0x00100000
54 54
55/* FCoE DDP for target mode */
56#define __IXGBE_FCOE_TARGET 1
57
55struct ixgbe_fcoe_ddp { 58struct ixgbe_fcoe_ddp {
56 int len; 59 int len;
57 u32 err; 60 u32 err;
@@ -66,6 +69,7 @@ struct ixgbe_fcoe {
66 u8 tc; 69 u8 tc;
67 u8 up; 70 u8 up;
68#endif 71#endif
72 unsigned long mode;
69 atomic_t refcnt; 73 atomic_t refcnt;
70 spinlock_t lock; 74 spinlock_t lock;
71 struct pci_pool *pool; 75 struct pci_pool *pool;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 32231ffe0717..5998dc94dd5c 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3775,7 +3775,8 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
3775 if (ret) 3775 if (ret)
3776 goto link_cfg_out; 3776 goto link_cfg_out;
3777 3777
3778 if (hw->mac.ops.get_link_capabilities) 3778 autoneg = hw->phy.autoneg_advertised;
3779 if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
3779 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg, 3780 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg,
3780 &negotiation); 3781 &negotiation);
3781 if (ret) 3782 if (ret)
@@ -7019,6 +7020,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
7019#endif 7020#endif
7020#ifdef IXGBE_FCOE 7021#ifdef IXGBE_FCOE
7021 .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get, 7022 .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get,
7023 .ndo_fcoe_ddp_target = ixgbe_fcoe_ddp_target,
7022 .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put, 7024 .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put,
7023 .ndo_fcoe_enable = ixgbe_fcoe_enable, 7025 .ndo_fcoe_enable = ixgbe_fcoe_enable,
7024 .ndo_fcoe_disable = ixgbe_fcoe_disable, 7026 .ndo_fcoe_disable = ixgbe_fcoe_disable,
diff --git a/drivers/net/ixgbe/ixgbe_mbx.c b/drivers/net/ixgbe/ixgbe_mbx.c
index 2acacfa5e375..3cf8aec50fcd 100644
--- a/drivers/net/ixgbe/ixgbe_mbx.c
+++ b/drivers/net/ixgbe/ixgbe_mbx.c
@@ -448,23 +448,20 @@ void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw)
448{ 448{
449 struct ixgbe_mbx_info *mbx = &hw->mbx; 449 struct ixgbe_mbx_info *mbx = &hw->mbx;
450 450
451 switch (hw->mac.type) { 451 if (hw->mac.type != ixgbe_mac_82599EB &&
452 case ixgbe_mac_82599EB: 452 hw->mac.type != ixgbe_mac_X540)
453 case ixgbe_mac_X540: 453 return;
454 mbx->timeout = 0;
455 mbx->usec_delay = 0;
456 454
457 mbx->size = IXGBE_VFMAILBOX_SIZE; 455 mbx->timeout = 0;
456 mbx->udelay = 0;
458 457
459 mbx->stats.msgs_tx = 0; 458 mbx->stats.msgs_tx = 0;
460 mbx->stats.msgs_rx = 0; 459 mbx->stats.msgs_rx = 0;
461 mbx->stats.reqs = 0; 460 mbx->stats.reqs = 0;
462 mbx->stats.acks = 0; 461 mbx->stats.acks = 0;
463 mbx->stats.rsts = 0; 462 mbx->stats.rsts = 0;
464 break; 463
465 default: 464 mbx->size = IXGBE_VFMAILBOX_SIZE;
466 break;
467 }
468} 465}
469#endif /* CONFIG_PCI_IOV */ 466#endif /* CONFIG_PCI_IOV */
470 467
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 197230b2d1ac..9190a8fca427 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -57,6 +57,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
57{ 57{
58 s32 status = IXGBE_ERR_PHY_ADDR_INVALID; 58 s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
59 u32 phy_addr; 59 u32 phy_addr;
60 u16 ext_ability = 0;
60 61
61 if (hw->phy.type == ixgbe_phy_unknown) { 62 if (hw->phy.type == ixgbe_phy_unknown) {
62 for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { 63 for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
@@ -65,12 +66,29 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
65 ixgbe_get_phy_id(hw); 66 ixgbe_get_phy_id(hw);
66 hw->phy.type = 67 hw->phy.type =
67 ixgbe_get_phy_type_from_id(hw->phy.id); 68 ixgbe_get_phy_type_from_id(hw->phy.id);
69
70 if (hw->phy.type == ixgbe_phy_unknown) {
71 hw->phy.ops.read_reg(hw,
72 MDIO_PMA_EXTABLE,
73 MDIO_MMD_PMAPMD,
74 &ext_ability);
75 if (ext_ability &
76 (MDIO_PMA_EXTABLE_10GBT |
77 MDIO_PMA_EXTABLE_1000BT))
78 hw->phy.type =
79 ixgbe_phy_cu_unknown;
80 else
81 hw->phy.type =
82 ixgbe_phy_generic;
83 }
84
68 status = 0; 85 status = 0;
69 break; 86 break;
70 } 87 }
71 } 88 }
72 /* clear value if nothing found */ 89 /* clear value if nothing found */
73 hw->phy.mdio.prtad = 0; 90 if (status != 0)
91 hw->phy.mdio.prtad = 0;
74 } else { 92 } else {
75 status = 0; 93 status = 0;
76 } 94 }
@@ -823,7 +841,6 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
823 goto out; 841 goto out;
824 } 842 }
825 843
826 /* This is guaranteed to be 82599, no need to check for NULL */
827 hw->mac.ops.get_device_caps(hw, &enforce_sfp); 844 hw->mac.ops.get_device_caps(hw, &enforce_sfp);
828 if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) && 845 if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
829 !((hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0) || 846 !((hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0) ||
diff --git a/drivers/net/ixgbe/ixgbe_phy.h b/drivers/net/ixgbe/ixgbe_phy.h
index 2327baf04426..9bf2783d7a74 100644
--- a/drivers/net/ixgbe/ixgbe_phy.h
+++ b/drivers/net/ixgbe/ixgbe_phy.h
@@ -58,6 +58,10 @@
58#define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 58#define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2
59#define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 59#define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3
60 60
61/* Flow control defines */
62#define IXGBE_TAF_SYM_PAUSE 0x400
63#define IXGBE_TAF_ASM_PAUSE 0x800
64
61/* Bit-shift macros */ 65/* Bit-shift macros */
62#define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24 66#define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24
63#define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16 67#define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 013751db5fc0..f190a4a8faf4 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -659,6 +659,8 @@
659#define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */ 659#define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */
660#define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ 660#define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */
661#define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */ 661#define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */
662#define IXGBE_QBRC_L(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */
663#define IXGBE_QBRC_H(_i) (0x01038 + ((_i) * 0x40)) /* 16 of these */
662#define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */ 664#define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */
663#define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */ 665#define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */
664#define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */ 666#define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */
@@ -669,6 +671,11 @@
669#define IXGBE_FCOEDWRC 0x0242C /* Number of FCoE DWords Received */ 671#define IXGBE_FCOEDWRC 0x0242C /* Number of FCoE DWords Received */
670#define IXGBE_FCOEPTC 0x08784 /* Number of FCoE Packets Transmitted */ 672#define IXGBE_FCOEPTC 0x08784 /* Number of FCoE Packets Transmitted */
671#define IXGBE_FCOEDWTC 0x08788 /* Number of FCoE DWords Transmitted */ 673#define IXGBE_FCOEDWTC 0x08788 /* Number of FCoE DWords Transmitted */
674#define IXGBE_PCRC8ECL 0x0E810
675#define IXGBE_PCRC8ECH 0x0E811
676#define IXGBE_PCRC8ECH_MASK 0x1F
677#define IXGBE_LDPCECL 0x0E820
678#define IXGBE_LDPCECH 0x0E821
672 679
673/* Management */ 680/* Management */
674#define IXGBE_MAVTV(_i) (0x05010 + ((_i) * 4)) /* 8 of these (0-7) */ 681#define IXGBE_MAVTV(_i) (0x05010 + ((_i) * 4)) /* 8 of these (0-7) */
@@ -2691,6 +2698,9 @@ struct ixgbe_info {
2691#define IXGBE_ERR_EEPROM_VERSION -24 2698#define IXGBE_ERR_EEPROM_VERSION -24
2692#define IXGBE_ERR_NO_SPACE -25 2699#define IXGBE_ERR_NO_SPACE -25
2693#define IXGBE_ERR_OVERTEMP -26 2700#define IXGBE_ERR_OVERTEMP -26
2701#define IXGBE_ERR_FC_NOT_NEGOTIATED -27
2702#define IXGBE_ERR_FC_NOT_SUPPORTED -28
2703#define IXGBE_ERR_FLOW_CONTROL -29
2694#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 2704#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30
2695#define IXGBE_ERR_PBA_SECTION -31 2705#define IXGBE_ERR_PBA_SECTION -31
2696#define IXGBE_ERR_INVALID_ARGUMENT -32 2706#define IXGBE_ERR_INVALID_ARGUMENT -32
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index 2e3a2b4fa8b2..f47e93fe32be 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -251,8 +251,11 @@ static u32 ixgbe_get_supported_physical_layer_X540(struct ixgbe_hw *hw)
251} 251}
252 252
253/** 253/**
254 * ixgbe_init_eeprom_params_X540 - Initialize EEPROM params 254 * ixgbe_init_eeprom_params_X540 - Initialize EEPROM params
255 * @hw: pointer to hardware structure 255 * @hw: pointer to hardware structure
256 *
257 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
258 * ixgbe_hw struct in order to set up EEPROM access.
256 **/ 259 **/
257static s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw) 260static s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw)
258{ 261{
@@ -271,7 +274,7 @@ static s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw)
271 IXGBE_EEPROM_WORD_SIZE_SHIFT); 274 IXGBE_EEPROM_WORD_SIZE_SHIFT);
272 275
273 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n", 276 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n",
274 eeprom->type, eeprom->word_size); 277 eeprom->type, eeprom->word_size);
275 } 278 }
276 279
277 return 0; 280 return 0;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 71563e7b2bfb..6bd5d460b7c1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -871,6 +871,10 @@ struct net_device_ops {
871 unsigned int sgc); 871 unsigned int sgc);
872 int (*ndo_fcoe_ddp_done)(struct net_device *dev, 872 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
873 u16 xid); 873 u16 xid);
874 int (*ndo_fcoe_ddp_target)(struct net_device *dev,
875 u16 xid,
876 struct scatterlist *sgl,
877 unsigned int sgc);
874#define NETDEV_FCOE_WWNN 0 878#define NETDEV_FCOE_WWNN 0
875#define NETDEV_FCOE_WWPN 1 879#define NETDEV_FCOE_WWPN 1
876 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 880 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index be737539f34d..ae610f046de5 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -625,6 +625,19 @@ static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type)
625 rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type); 625 rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type);
626 return rc; 626 return rc;
627} 627}
628
629static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid,
630 struct scatterlist *sgl, unsigned int sgc)
631{
632 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
633 const struct net_device_ops *ops = real_dev->netdev_ops;
634 int rc = 0;
635
636 if (ops->ndo_fcoe_ddp_target)
637 rc = ops->ndo_fcoe_ddp_target(real_dev, xid, sgl, sgc);
638
639 return rc;
640}
628#endif 641#endif
629 642
630static void vlan_dev_change_rx_flags(struct net_device *dev, int change) 643static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
@@ -858,6 +871,7 @@ static const struct net_device_ops vlan_netdev_ops = {
858 .ndo_fcoe_enable = vlan_dev_fcoe_enable, 871 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
859 .ndo_fcoe_disable = vlan_dev_fcoe_disable, 872 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
860 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, 873 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
874 .ndo_fcoe_ddp_target = vlan_dev_fcoe_ddp_target,
861#endif 875#endif
862}; 876};
863 877