Skip to content

Commit aa47b54

Browse files
emuslndavem330
authored andcommitted
ionic: decouple link message from netdev state
Rearrange the link_up/link_down messages so that we announce link up when we first notice that the link is up when the driver loads, and decouple the link_up/link_down messages from the UP and DOWN netdev state. Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ea315c5 commit aa47b54

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,35 @@ static void ionic_link_status_check(struct ionic_lif *lif)
7373
u16 link_status;
7474
bool link_up;
7575

76+
if (lif->ionic->is_mgmt_nic)
77+
return;
78+
7679
link_status = le16_to_cpu(lif->info->status.link_status);
7780
link_up = link_status == IONIC_PORT_OPER_STATUS_UP;
7881

79-
/* filter out the no-change cases */
80-
if (link_up == netif_carrier_ok(netdev))
81-
goto link_out;
82-
8382
if (link_up) {
84-
netdev_info(netdev, "Link up - %d Gbps\n",
85-
le32_to_cpu(lif->info->status.link_speed) / 1000);
83+
if (!netif_carrier_ok(netdev)) {
84+
u32 link_speed;
8685

87-
if (test_bit(IONIC_LIF_F_UP, lif->state)) {
88-
netif_tx_wake_all_queues(lif->netdev);
86+
ionic_port_identify(lif->ionic);
87+
link_speed = le32_to_cpu(lif->info->status.link_speed);
88+
netdev_info(netdev, "Link up - %d Gbps\n",
89+
link_speed / 1000);
8990
netif_carrier_on(netdev);
9091
}
92+
93+
if (test_bit(IONIC_LIF_F_UP, lif->state))
94+
netif_tx_wake_all_queues(lif->netdev);
9195
} else {
92-
netdev_info(netdev, "Link down\n");
96+
if (netif_carrier_ok(netdev)) {
97+
netdev_info(netdev, "Link down\n");
98+
netif_carrier_off(netdev);
99+
}
93100

94-
/* carrier off first to avoid watchdog timeout */
95-
netif_carrier_off(netdev);
96101
if (test_bit(IONIC_LIF_F_UP, lif->state))
97102
netif_tx_stop_all_queues(netdev);
98103
}
99104

100-
link_out:
101105
clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state);
102106
}
103107

@@ -1587,8 +1591,6 @@ int ionic_open(struct net_device *netdev)
15871591
struct ionic_lif *lif = netdev_priv(netdev);
15881592
int err;
15891593

1590-
netif_carrier_off(netdev);
1591-
15921594
err = ionic_txrx_alloc(lif);
15931595
if (err)
15941596
return err;
@@ -1936,6 +1938,8 @@ static struct ionic_lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index
19361938
ionic_ethtool_set_ops(netdev);
19371939

19381940
netdev->watchdog_timeo = 2 * HZ;
1941+
netif_carrier_off(netdev);
1942+
19391943
netdev->min_mtu = IONIC_MIN_MTU;
19401944
netdev->max_mtu = IONIC_MAX_MTU;
19411945

0 commit comments

Comments
 (0)