diff options
author | Sunil Goutham <sgoutham@cavium.com> | 2015-12-02 05:06:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-02 15:58:50 -0500 |
commit | 0b72a9a1060e7547e71e7f600849a2d3006bf63a (patch) | |
tree | 8f54ce6b7ee0ce1e8ec364d261cb8dbd78dced59 | |
parent | 006394a7cb20559418c602b8433ec1839b6fc1d3 (diff) |
net: thunderx: Switchon carrier only upon interface link up
Call netif_carrier_on() only if interface's link is up. Switching this on
upon IFF_UP by default, is causing issues with ethernet channel bonding
in LACP mode. Initial NETDEV_CHANGE notification was being skipped.
Also fixed some issues with link/speed/duplex reporting via ethtool.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c index af54c10945c2..a12b2e38cf61 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c | |||
@@ -112,6 +112,13 @@ static int nicvf_get_settings(struct net_device *netdev, | |||
112 | 112 | ||
113 | cmd->supported = 0; | 113 | cmd->supported = 0; |
114 | cmd->transceiver = XCVR_EXTERNAL; | 114 | cmd->transceiver = XCVR_EXTERNAL; |
115 | |||
116 | if (!nic->link_up) { | ||
117 | cmd->duplex = DUPLEX_UNKNOWN; | ||
118 | ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); | ||
119 | return 0; | ||
120 | } | ||
121 | |||
115 | if (nic->speed <= 1000) { | 122 | if (nic->speed <= 1000) { |
116 | cmd->port = PORT_MII; | 123 | cmd->port = PORT_MII; |
117 | cmd->autoneg = AUTONEG_ENABLE; | 124 | cmd->autoneg = AUTONEG_ENABLE; |
@@ -125,6 +132,13 @@ static int nicvf_get_settings(struct net_device *netdev, | |||
125 | return 0; | 132 | return 0; |
126 | } | 133 | } |
127 | 134 | ||
135 | static u32 nicvf_get_link(struct net_device *netdev) | ||
136 | { | ||
137 | struct nicvf *nic = netdev_priv(netdev); | ||
138 | |||
139 | return nic->link_up; | ||
140 | } | ||
141 | |||
128 | static void nicvf_get_drvinfo(struct net_device *netdev, | 142 | static void nicvf_get_drvinfo(struct net_device *netdev, |
129 | struct ethtool_drvinfo *info) | 143 | struct ethtool_drvinfo *info) |
130 | { | 144 | { |
@@ -660,7 +674,7 @@ static int nicvf_set_channels(struct net_device *dev, | |||
660 | 674 | ||
661 | static const struct ethtool_ops nicvf_ethtool_ops = { | 675 | static const struct ethtool_ops nicvf_ethtool_ops = { |
662 | .get_settings = nicvf_get_settings, | 676 | .get_settings = nicvf_get_settings, |
663 | .get_link = ethtool_op_get_link, | 677 | .get_link = nicvf_get_link, |
664 | .get_drvinfo = nicvf_get_drvinfo, | 678 | .get_drvinfo = nicvf_get_drvinfo, |
665 | .get_msglevel = nicvf_get_msglevel, | 679 | .get_msglevel = nicvf_get_msglevel, |
666 | .set_msglevel = nicvf_set_msglevel, | 680 | .set_msglevel = nicvf_set_msglevel, |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 7f709cbdcd87..dde8dc720cd3 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | |||
@@ -1057,6 +1057,7 @@ int nicvf_stop(struct net_device *netdev) | |||
1057 | 1057 | ||
1058 | netif_carrier_off(netdev); | 1058 | netif_carrier_off(netdev); |
1059 | netif_tx_stop_all_queues(nic->netdev); | 1059 | netif_tx_stop_all_queues(nic->netdev); |
1060 | nic->link_up = false; | ||
1060 | 1061 | ||
1061 | /* Teardown secondary qsets first */ | 1062 | /* Teardown secondary qsets first */ |
1062 | if (!nic->sqs_mode) { | 1063 | if (!nic->sqs_mode) { |
@@ -1211,9 +1212,6 @@ int nicvf_open(struct net_device *netdev) | |||
1211 | nic->drv_stats.txq_stop = 0; | 1212 | nic->drv_stats.txq_stop = 0; |
1212 | nic->drv_stats.txq_wake = 0; | 1213 | nic->drv_stats.txq_wake = 0; |
1213 | 1214 | ||
1214 | netif_carrier_on(netdev); | ||
1215 | netif_tx_start_all_queues(netdev); | ||
1216 | |||
1217 | return 0; | 1215 | return 0; |
1218 | cleanup: | 1216 | cleanup: |
1219 | nicvf_disable_intr(nic, NICVF_INTR_MBOX, 0); | 1217 | nicvf_disable_intr(nic, NICVF_INTR_MBOX, 0); |
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 6534b7362091..d77e41a459b9 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c | |||
@@ -612,6 +612,8 @@ static void bgx_poll_for_link(struct work_struct *work) | |||
612 | lmac->last_duplex = 1; | 612 | lmac->last_duplex = 1; |
613 | } else { | 613 | } else { |
614 | lmac->link_up = 0; | 614 | lmac->link_up = 0; |
615 | lmac->last_speed = SPEED_UNKNOWN; | ||
616 | lmac->last_duplex = DUPLEX_UNKNOWN; | ||
615 | } | 617 | } |
616 | 618 | ||
617 | if (lmac->last_link != lmac->link_up) { | 619 | if (lmac->last_link != lmac->link_up) { |