Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 1999 18:22:07 +0100 (MET)
From:      Emmanuel Duros <Emmanuel.Duros@sophia.inria.fr>
To:        dennis@etinc.com
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: writing network device driver - pb with interrupt levels
Message-ID:  <199902031722.SAA11377@chouette.inria.fr>
In-Reply-To: <199902021938.TAA14862@etinc.com> (message from Dennis on Tue, 02 Feb 1999 19:43:49 -0500)

next in thread | previous in thread | raw e-mail | index | archive | help

> What is the transmission rate, and what is the size of the fifo? 

The transmission rate is constant at 2Mbps and the fifo is 4 Kb.  I did
add the flag 0xe0ffe0ff to the IDE controller but I still get
losses. However, results are better with this configuration.

After some investigation, I notice that when I get losses (= fifo gets
completly filled with incoming traffic), two consecutive interrupts
generated by the card are processed with an interval of 200 to 700
millisecondes -> meanwhile the fifo runs quickly out of space.

This only happens during I/O accesses on the IDE drive. The wd driver
seems to block the card interrupt for a long while reading/wrinting
large files on the disk (?).

I wonder why this happens because the card interrupt level (net device)
is higher than the IDE disk controller (bio) !

Emmanuel


> Date: Tue, 02 Feb 1999 19:43:49 -0500
> From: Dennis <dennis@etinc.com>
> Cc: Emmanuel Duros <Emmanuel.Duros@sophia.inria.fr>,
>         freebsd-hackers@FreeBSD.ORG
> 
> At 01:53 PM 2/2/99 -0800, Mike Smith wrote:
> >> On Tue, 2 Feb 1999 20:17:34 +0100 (MET) 
> >>  Emmanuel Duros <Emmanuel.Duros@sophia.inria.fr> wrote:
> >> 
> >>  > When writing on the IDE drive, the fifo of the card gets completely
> >>  > filled and therefore loses bytes. In fact I cannot read data as fast as
> >>  > it arrives because the CPU is busy with I/O accesses on the IDE
> >>  > drive. It seems the drive I/O have higher interrupt level than the card
> >>  > has. (BTW, the code works fine with an SCSI drive instead !?!??!)
> >> 
> >> In NetBSD, we fixed this by enforcing an "spl heirarchy".
> >> 
> >> Note, in my example, I say splnet, because in NetBSD network soft
> interrupts
> >> are "splsoftnet".
> >> 
> >> 	splbio <= splnet <= spltty <= splimp
> >> 
> >> This allows you to block other interrupts from things which are less likely
> >> to lose data if their interrupt is not serviced quickly.
> >> 
> >> So, in your device interrupt handler (which is implicitly run at splnet),
> >> bio interrupts are also implicitly blocked so that your driver can work
> >> unhindered (but serial interrrupts, which are less freqent and more prone
> >> to data loss, can still come through).
> >
> >If it is actually interrupt-related, it's fairly manifest that this
> >isn't actually the problem, as otherwise the splimp() around the handler
> >loop would have drastically reduced the incidence of overflows.  (ie. 
> >artificially implementing priority of 'dv' over 'wd' interrupts).
> 
> Note, as I said before, it is VERY possible that the fifo simply isnt large
> enough...
> before jumping into analysis, the simple question of whether it is feasible
> to 
> do needs to be answered. not everything can be done.......
> 
> What is the transmission rate, and what is the size of the fifo? 
> 
> db
> 
---- Original msg
>From eduros Tue Feb  2 20:17:33 1999
Date: Tue, 2 Feb 99 20:17:33 MET
From: Emmanuel Duros <Emmanuel.Duros@sophia.inria.fr>
To: freebsd-hackers@freebsd.org
Subject: writing network device driver - pb with interrupt levels
X-URL: http://www.inria.fr/rodeo/personnel/eduros


Hi,

I am writing a driver for a network card and I have a pb with interrupt
levels.

Basically, when I read data from the card it works fine as long as I do
not intensively read from/write to the hard drive.

This card works as follows: 

It has a fifo which gets filled with incoming traffic (IP datagrams) and
generates an interrupt when the fifo goes from the an empty to a
non-empty state.

When the interrup occures, I read the data from the fifo with the
following code:

void dvintr(int unit){
  ...
  while (fifo_not_empty){
  
    data = inw( addr_read );    /* No DMA transfer !!! -> quite slow */
    fill_buffer( buf, data);     
    ...
  }

 dvread( buf );    /* when we get a complete MAC packet */
...
}

The card does not provide DMA functionalities, I have to read word-long
data from the ISA bus with the inw() function.   :-(

This code works fine when there is no read/write on my IDE hard drive.

When writing on the IDE drive, the fifo of the card gets completely
filled and therefore loses bytes. In fact I cannot read data as fast as
it arrives because the CPU is busy with I/O accesses on the IDE
drive. It seems the drive I/O have higher interrupt level than the card
has. (BTW, the code works fine with an SCSI drive instead !?!??!)

I do not understand this because in the kernel config file, the card has
the correct priority level which is higher than disk I/O:

device dv0 at isa? port 0x310 net irq 11 vector dvintr

I also tried to surround the code in dvintr() with:

s = splimp();
  --loop--
splx(s)

but it is unsuccessful. Anyway I am already at splimp level when I enter
the dvintr() function (see kernel config file), am I right ?

Could someone give me some help on this ?

BTW, what is the exact meaning of the disable_intr() and enable_intr()
functions ?

Thanks a lot in advance

Emmanuel

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



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