Commit ec74a471 authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher
Browse files

ixgbe: clean up the condition for turning on/off the laser



This patch simplifies the check for calling en/disable_tx_laser() function
pointer. The pointer is only set on parts that can use it.

Signed-off-by: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent b3343a2a
Loading
Loading
Loading
Loading
+8 −23
Original line number Original line Diff line number Diff line
@@ -4087,11 +4087,8 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter)
	else
	else
		ixgbe_configure_msi_and_legacy(adapter);
		ixgbe_configure_msi_and_legacy(adapter);


	/* enable the optics for both mult-speed fiber and 82599 SFP+ fiber */
	/* enable the optics for 82599 SFP+ fiber */
	if (hw->mac.ops.enable_tx_laser &&
	if (hw->mac.ops.enable_tx_laser)
	    ((hw->phy.multispeed_fiber) ||
	     ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
	      (hw->mac.type == ixgbe_mac_82599EB))))
		hw->mac.ops.enable_tx_laser(hw);
		hw->mac.ops.enable_tx_laser(hw);


	clear_bit(__IXGBE_DOWN, &adapter->state);
	clear_bit(__IXGBE_DOWN, &adapter->state);
@@ -4413,11 +4410,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
	if (!pci_channel_offline(adapter->pdev))
	if (!pci_channel_offline(adapter->pdev))
		ixgbe_reset(adapter);
		ixgbe_reset(adapter);


	/* power down the optics for multispeed fiber and 82599 SFP+ fiber */
	/* power down the optics for 82599 SFP+ fiber */
	if (hw->mac.ops.disable_tx_laser &&
	if (hw->mac.ops.disable_tx_laser)
	    ((hw->phy.multispeed_fiber) ||
	     ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
	      (hw->mac.type == ixgbe_mac_82599EB))))
		hw->mac.ops.disable_tx_laser(hw);
		hw->mac.ops.disable_tx_laser(hw);


	ixgbe_clean_all_tx_rings(adapter);
	ixgbe_clean_all_tx_rings(adapter);
@@ -5050,14 +5044,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
	if (wufc) {
	if (wufc) {
		ixgbe_set_rx_mode(netdev);
		ixgbe_set_rx_mode(netdev);


		/*
		/* enable the optics for 82599 SFP+ fiber as we can WoL */
		 * enable the optics for both mult-speed fiber and
		if (hw->mac.ops.enable_tx_laser)
		 * 82599 SFP+ fiber as we can WoL.
		 */
		if (hw->mac.ops.enable_tx_laser &&
		    (hw->phy.multispeed_fiber ||
		    (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber &&
		     hw->mac.type == ixgbe_mac_82599EB)))
			hw->mac.ops.enable_tx_laser(hw);
			hw->mac.ops.enable_tx_laser(hw);


		/* turn on all-multi mode if wake on multicast is enabled */
		/* turn on all-multi mode if wake on multicast is enabled */
@@ -7468,11 +7456,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
	if (err)
	if (err)
		goto err_register;
		goto err_register;


	/* power down the optics for multispeed fiber and 82599 SFP+ fiber */
	/* power down the optics for 82599 SFP+ fiber */
	if (hw->mac.ops.disable_tx_laser &&
	if (hw->mac.ops.disable_tx_laser)
	    ((hw->phy.multispeed_fiber) ||
	     ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
	      (hw->mac.type == ixgbe_mac_82599EB))))
		hw->mac.ops.disable_tx_laser(hw);
		hw->mac.ops.disable_tx_laser(hw);


	/* carrier off reporting is important to ethtool even BEFORE open */
	/* carrier off reporting is important to ethtool even BEFORE open */