Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Feb 2001 11:04:54 -0700
From:      Wes Peters <wes@softweyr.com>
To:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc:        Luigi Rizzo <rizzo@aciri.org>, net@FreeBSD.ORG
Subject:   Re: potential infinite loop in network device drivers
Message-ID:  <3A843146.BFC863B9@softweyr.com>
References:  <200102090102.f19125x06386@iguana.aciri.org> <200102090209.VAA60712@khavrinen.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Wollman wrote:
> 
> <<On Thu, 8 Feb 2001 17:02:05 -0800 (PST), Luigi Rizzo <rizzo@aciri.org> said:
> 
> > it occurs to me that there is a potential infinite loop in
> > most if not all ethernet drivers. Basically, on a
> > receive interrupt, such drivers loop around the status word
> > until the receive queue is drained.
> 
> One possible right way to deal with this is to get rid of the
> two-level interrupt scheme (for fast interfaces at least) and push the
> packets all the way through the network stack.  This will ensure that
> if packets are arriving faster than we can handle them, they will be
> dropped by the network interface with an ``insufficient resources''
> error.
> 
> Another possible right way to deal with this is to move all network
> processing into the lower level, and poll round-robin for packets
> (with network interrupts disabled) until all network interfaces are
> finished (or we need to give the user a time slice).

This is similar to the way most VxWorks network drivers operate: the
"packet available" interrupt handler simply schedules tNetTask to 
retrieve the packet using a driver-specific callback function.  If 
the buffer on the network card gets filled up before tNetTask can get
around to it, packets are dropped until the system becomes less busy.
The programmer can tune the behavior by juggling the priorities of 
tNetTask and other busy parts of the system.  This helps to avoid the
problems of too many receive interrupts driving the system into 
interrupt livelock, as long as the card is smart enough to discard
packets without interrupting when its own buffers are full.

-- 
            "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                         Softweyr LLC
wes@softweyr.com                                           http://softweyr.com/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A843146.BFC863B9>