From e7be9f9a1a89dce07f5ce5590378c03e693f7dc2 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 12 Jul 2001 22:51:59 +0000 Subject: [PATCH] Deal with the condition where we lose link in the middle of transmitting a bunch of frames. In this case, the dc_link flag is cleared, and dc_start() stops draining the if_snd send queue, which results in lots of 'no buffers available' errors being reported to applications. The whole idea behind not draining the send queue until the link comes up was to avoid having the gratuitous ARP being lost while we're waiting for autoneg to complete after the interface is first brought up. As an optimization, change the test in dc_start() so that we only bail if dc_link is not set _and_ there are less than 10 packets in the send queue. If the queue has many frames in it, we need to drain them. If the queue has a small number of frames in it, we can hold off on sending them until the link comes up. MFC after: 1 week --- sys/dev/dc/if_dc.c | 2 +- sys/pci/if_dc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index ec18090e5d5..7bf23e19a4d 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -2953,7 +2953,7 @@ static void dc_start(ifp) DC_LOCK(sc); - if (!sc->dc_link) { + if (!sc->dc_link && ifp->if_snd.ifq_len < 10) { DC_UNLOCK(sc); return; } diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index ec18090e5d5..7bf23e19a4d 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -2953,7 +2953,7 @@ static void dc_start(ifp) DC_LOCK(sc); - if (!sc->dc_link) { + if (!sc->dc_link && ifp->if_snd.ifq_len < 10) { DC_UNLOCK(sc); return; }