3939#define IXGBE_82599_MC_TBL_SIZE 128
4040#define IXGBE_82599_VFT_TBL_SIZE 128
4141
42+ void ixgbe_flap_tx_laser_multispeed_fiber (struct ixgbe_hw * hw );
4243s32 ixgbe_setup_mac_link_multispeed_fiber (struct ixgbe_hw * hw ,
4344 ixgbe_link_speed speed ,
4445 bool autoneg ,
@@ -68,7 +69,9 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
6869 if (hw -> phy .multispeed_fiber ) {
6970 /* Set up dual speed SFP+ support */
7071 mac -> ops .setup_link = & ixgbe_setup_mac_link_multispeed_fiber ;
72+ mac -> ops .flap_tx_laser = & ixgbe_flap_tx_laser_multispeed_fiber ;
7173 } else {
74+ mac -> ops .flap_tx_laser = NULL ;
7275 if ((mac -> ops .get_media_type (hw ) ==
7376 ixgbe_media_type_backplane ) &&
7477 (hw -> phy .smart_speed == ixgbe_smart_speed_auto ||
@@ -412,6 +415,41 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
412415 return status ;
413416}
414417
418+ /**
419+ * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser
420+ * @hw: pointer to hardware structure
421+ *
422+ * When the driver changes the link speeds that it can support,
423+ * it sets autotry_restart to true to indicate that we need to
424+ * initiate a new autotry session with the link partner. To do
425+ * so, we set the speed then disable and re-enable the tx laser, to
426+ * alert the link partner that it also needs to restart autotry on its
427+ * end. This is consistent with true clause 37 autoneg, which also
428+ * involves a loss of signal.
429+ **/
430+ void ixgbe_flap_tx_laser_multispeed_fiber (struct ixgbe_hw * hw )
431+ {
432+ u32 esdp_reg = IXGBE_READ_REG (hw , IXGBE_ESDP );
433+
434+ hw_dbg (hw , "ixgbe_flap_tx_laser_multispeed_fiber\n" );
435+
436+ if (hw -> mac .autotry_restart ) {
437+ /* Disable tx laser; allow 100us to go dark per spec */
438+ esdp_reg |= IXGBE_ESDP_SDP3 ;
439+ IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
440+ IXGBE_WRITE_FLUSH (hw );
441+ udelay (100 );
442+
443+ /* Enable tx laser; allow 100ms to light up */
444+ esdp_reg &= ~IXGBE_ESDP_SDP3 ;
445+ IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
446+ IXGBE_WRITE_FLUSH (hw );
447+ msleep (100 );
448+
449+ hw -> mac .autotry_restart = false;
450+ }
451+ }
452+
415453/**
416454 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
417455 * @hw: pointer to hardware structure
@@ -439,16 +477,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
439477 hw -> mac .ops .get_link_capabilities (hw , & phy_link_speed , & negotiation );
440478 speed &= phy_link_speed ;
441479
442- /*
443- * When the driver changes the link speeds that it can support,
444- * it sets autotry_restart to true to indicate that we need to
445- * initiate a new autotry session with the link partner. To do
446- * so, we set the speed then disable and re-enable the tx laser, to
447- * alert the link partner that it also needs to restart autotry on its
448- * end. This is consistent with true clause 37 autoneg, which also
449- * involves a loss of signal.
450- */
451-
452480 /*
453481 * Try each speed one by one, highest priority first. We do this in
454482 * software because 10gb fiber doesn't support speed autonegotiation.
@@ -466,6 +494,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
466494 /* Set the module link speed */
467495 esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5 );
468496 IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
497+ IXGBE_WRITE_FLUSH (hw );
469498
470499 /* Allow module to change analog characteristics (1G->10G) */
471500 msleep (40 );
@@ -478,19 +507,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
478507 return status ;
479508
480509 /* Flap the tx laser if it has not already been done */
481- if (hw -> mac .autotry_restart ) {
482- /* Disable tx laser; allow 100us to go dark per spec */
483- esdp_reg |= IXGBE_ESDP_SDP3 ;
484- IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
485- udelay (100 );
486-
487- /* Enable tx laser; allow 2ms to light up per spec */
488- esdp_reg &= ~IXGBE_ESDP_SDP3 ;
489- IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
490- msleep (2 );
491-
492- hw -> mac .autotry_restart = false;
493- }
510+ hw -> mac .ops .flap_tx_laser (hw );
494511
495512 /*
496513 * Wait for the controller to acquire link. Per IEEE 802.3ap,
@@ -525,6 +542,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
525542 esdp_reg &= ~IXGBE_ESDP_SDP5 ;
526543 esdp_reg |= IXGBE_ESDP_SDP5_DIR ;
527544 IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
545+ IXGBE_WRITE_FLUSH (hw );
528546
529547 /* Allow module to change analog characteristics (10G->1G) */
530548 msleep (40 );
@@ -537,19 +555,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
537555 return status ;
538556
539557 /* Flap the tx laser if it has not already been done */
540- if (hw -> mac .autotry_restart ) {
541- /* Disable tx laser; allow 100us to go dark per spec */
542- esdp_reg |= IXGBE_ESDP_SDP3 ;
543- IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
544- udelay (100 );
545-
546- /* Enable tx laser; allow 2ms to light up per spec */
547- esdp_reg &= ~IXGBE_ESDP_SDP3 ;
548- IXGBE_WRITE_REG (hw , IXGBE_ESDP , esdp_reg );
549- msleep (2 );
550-
551- hw -> mac .autotry_restart = false;
552- }
558+ hw -> mac .ops .flap_tx_laser (hw );
553559
554560 /* Wait for the link partner to also set speed */
555561 msleep (100 );
0 commit comments