1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

modules/mqnic: Fix link status monitoring, initialize stored link status on start to "down"

Assume that the hardware link status is "down" when a netdev is brought "up"
administratively ("ip link set dev ... up"). This way a change of link status is
always occuring, in case hardware link status is indeed still "up" at that point
in time.

Otherwise bringing a netdev administratively "down" and "up" again, while the
hardware was "up" before and stays "up" during the administrative "down" period,
results in no netif_carrier_on() being called, because struct
mqnic_priv::link_status does not change.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
This commit is contained in:
Joachim Foerster 2022-05-24 11:08:08 +02:00 committed by Alex Forencich
parent 4cdb57bfe1
commit d6b2a38a92

View File

@ -99,11 +99,13 @@ static int mqnic_start_port(struct net_device *ndev)
netif_tx_start_all_queues(ndev);
netif_device_attach(ndev);
if (mqnic_link_status_poll)
if (mqnic_link_status_poll) {
priv->link_status = 0;
mod_timer(&priv->link_status_timer,
jiffies + msecs_to_jiffies(mqnic_link_status_poll));
else
} else {
netif_carrier_on(ndev);
}
return 0;
}
@ -542,10 +544,8 @@ int mqnic_create_netdev(struct mqnic_if *interface, struct net_device **ndev_ptr
ndev->max_mtu = min(interface->max_tx_mtu, interface->max_rx_mtu) - ETH_HLEN;
netif_carrier_off(ndev);
if (mqnic_link_status_poll) {
priv->link_status = false;
if (mqnic_link_status_poll)
timer_setup(&priv->link_status_timer, mqnic_link_status_timeout, 0);
}
ret = register_netdev(ndev);
if (ret) {