Skip to content

Commit

Permalink
net: thunderx: Switchon carrier only upon interface link up
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sunil Goutham authored and David S. Miller committed Dec 2, 2015
1 parent 006394a commit 0b72a9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ static int nicvf_get_settings(struct net_device *netdev,

cmd->supported = 0;
cmd->transceiver = XCVR_EXTERNAL;

if (!nic->link_up) {
cmd->duplex = DUPLEX_UNKNOWN;
ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
return 0;
}

if (nic->speed <= 1000) {
cmd->port = PORT_MII;
cmd->autoneg = AUTONEG_ENABLE;
Expand All @@ -125,6 +132,13 @@ static int nicvf_get_settings(struct net_device *netdev,
return 0;
}

static u32 nicvf_get_link(struct net_device *netdev)
{
struct nicvf *nic = netdev_priv(netdev);

return nic->link_up;
}

static void nicvf_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{
Expand Down Expand Up @@ -660,7 +674,7 @@ static int nicvf_set_channels(struct net_device *dev,

static const struct ethtool_ops nicvf_ethtool_ops = {
.get_settings = nicvf_get_settings,
.get_link = ethtool_op_get_link,
.get_link = nicvf_get_link,
.get_drvinfo = nicvf_get_drvinfo,
.get_msglevel = nicvf_get_msglevel,
.set_msglevel = nicvf_set_msglevel,
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/ethernet/cavium/thunder/nicvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ int nicvf_stop(struct net_device *netdev)

netif_carrier_off(netdev);
netif_tx_stop_all_queues(nic->netdev);
nic->link_up = false;

/* Teardown secondary qsets first */
if (!nic->sqs_mode) {
Expand Down Expand Up @@ -1211,9 +1212,6 @@ int nicvf_open(struct net_device *netdev)
nic->drv_stats.txq_stop = 0;
nic->drv_stats.txq_wake = 0;

netif_carrier_on(netdev);
netif_tx_start_all_queues(netdev);

return 0;
cleanup:
nicvf_disable_intr(nic, NICVF_INTR_MBOX, 0);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/cavium/thunder/thunder_bgx.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ static void bgx_poll_for_link(struct work_struct *work)
lmac->last_duplex = 1;
} else {
lmac->link_up = 0;
lmac->last_speed = SPEED_UNKNOWN;
lmac->last_duplex = DUPLEX_UNKNOWN;
}

if (lmac->last_link != lmac->link_up) {
Expand Down

0 comments on commit 0b72a9a

Please sign in to comment.