Subject: Re: Strange errors from qec in Sparc Classic
To: David Laight <david@l8s.co.uk>
From: Jason Wright <jason@thought.net>
List: port-sparc
Date: 01/22/2002 22:22:30
On Tue, Jan 22, 2002 at 06:04:40PM +0000, David Laight wrote:
> 
> > Thanks, I added "sc->sc_debug" to qe.c and that cleared it up.
> 
> Looking at ths driver it isn't as well written as it might be :-)
> 
> 1) The end-of-tx interrupt path is significantly longer that necessary
> 99% of the time - because it always calls qestart.

Yes, polling the queue in qe_tint() seems pretty cheap, I'll see about
adding that.

> 2) Better still only enable the TX interrupt when tx flow controlled. 
> Saving 1 interrupt per tx packet is almost certainly measurably faster

I was more concerned with freeing resources quickly on low memory
machines.

> 3) qeintr should (probably) return 1 if it gets past the 'if (!(qecstat
> & 0xf)) return 0;' bit - otherwise you migth get a 'splurious interrupt'
> message from the interrupt dispatcher.

From my memory, qecstat (global register) is a kind of "something
interrupted" signal.  It's a quick way to check whether "this channel"
interrupted.  This is supposed to only happen when qestat has something
you requested.  (qestat is reset on read, and the relevant portion of
qecstat is reset when the qestat for that channel is read).  So, a
spurious interrupt, in theory, shouldn't be possible.

> 4) kill the '(idx % sc->sc_rb.rb_nrbuf)', division by a variable takes
> weeks!
> 
I try avoid it in my drivers (this was added when it was ported to NetBSD =)
(It's also been added to hme and be, I believe, too... not good for
performance on v7 cpus).

--Jason L. Wright