Commit 4de17c8c authored by Auke Kok's avatar Auke Kok Committed by Auke Kok

ixgb: remove duplicate code setting duplex and speed

Removed duplicate code.  Create ixgb_set_speed_duplex function to contain
duplicate code.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarJohn Ronciak <john.ronciak@intel.com>
parent 96f9c2e2
...@@ -117,6 +117,16 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -117,6 +117,16 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
return 0; return 0;
} }
static void ixgb_set_speed_duplex(struct net_device *netdev)
{
struct ixgb_adapter *adapter = netdev_priv(netdev);
/* be optimistic about our link, since we were up before */
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
netif_wake_queue(netdev);
}
static int static int
ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{ {
...@@ -130,12 +140,7 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -130,12 +140,7 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ixgb_down(adapter, TRUE); ixgb_down(adapter, TRUE);
ixgb_reset(adapter); ixgb_reset(adapter);
ixgb_up(adapter); ixgb_up(adapter);
/* be optimistic about our link, since we were up before */ ixgb_set_speed_duplex(netdev);
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
netif_wake_queue(netdev);
} else } else
ixgb_reset(adapter); ixgb_reset(adapter);
...@@ -183,11 +188,7 @@ ixgb_set_pauseparam(struct net_device *netdev, ...@@ -183,11 +188,7 @@ ixgb_set_pauseparam(struct net_device *netdev,
if(netif_running(adapter->netdev)) { if(netif_running(adapter->netdev)) {
ixgb_down(adapter, TRUE); ixgb_down(adapter, TRUE);
ixgb_up(adapter); ixgb_up(adapter);
/* be optimistic about our link, since we were up before */ ixgb_set_speed_duplex(netdev);
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
netif_wake_queue(netdev);
} else } else
ixgb_reset(adapter); ixgb_reset(adapter);
...@@ -212,11 +213,7 @@ ixgb_set_rx_csum(struct net_device *netdev, uint32_t data) ...@@ -212,11 +213,7 @@ ixgb_set_rx_csum(struct net_device *netdev, uint32_t data)
if(netif_running(netdev)) { if(netif_running(netdev)) {
ixgb_down(adapter,TRUE); ixgb_down(adapter,TRUE);
ixgb_up(adapter); ixgb_up(adapter);
/* be optimistic about our link, since we were up before */ ixgb_set_speed_duplex(netdev);
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
netif_wake_queue(netdev);
} else } else
ixgb_reset(adapter); ixgb_reset(adapter);
return 0; return 0;
...@@ -593,11 +590,7 @@ ixgb_set_ringparam(struct net_device *netdev, ...@@ -593,11 +590,7 @@ ixgb_set_ringparam(struct net_device *netdev,
adapter->tx_ring = tx_new; adapter->tx_ring = tx_new;
if((err = ixgb_up(adapter))) if((err = ixgb_up(adapter)))
return err; return err;
/* be optimistic about our link, since we were up before */ ixgb_set_speed_duplex(netdev);
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
netif_wake_queue(netdev);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment