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 <[email protected]>
  • Loading branch information
zhhyu7 committed Feb 26, 2025
1 parent 950b178 commit 6a7ad1e
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 @@ -498,6 +498,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 6a7ad1e

Please sign in to comment.