Skip to content

Commit

Permalink
drivers/net/{e1000|igc}: limit no packet is transmit after carrier off
Browse files Browse the repository at this point in the history
if the drvier tx queue is full up during the network cable unplugging,
there will be no txdone interrupt after inserting the network cable,
transmit cannot be recovered.

Modified to no longer fill the driver with packet when link down.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
  • Loading branch information
zhhyu7 authored and xiaoxiang781216 committed Feb 26, 2025
1 parent 51ba3c4 commit 2a9b916
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/e1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ static int e1000_transmit(FAR struct netdev_lowerhalf_s *dev,
return -EINVAL;
}

if (!IFF_IS_RUNNING(dev->netdev.d_flags))
{
return -ENETDOWN;
}

/* Store TX packet reference */

priv->tx_pkt[priv->tx_now] = pkt;
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/igc.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ static int igc_transmit(FAR struct netdev_lowerhalf_s *dev,
return -EINVAL;
}

if (!IFF_IS_RUNNING(dev->netdev.d_flags))
{
return -ENETDOWN;
}

/* Store TX packet reference */

priv->tx_pkt[priv->tx_now] = pkt;
Expand Down

0 comments on commit 2a9b916

Please sign in to comment.