Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 1999 20:17:34 +0100 (MET)
From:      Emmanuel Duros <Emmanuel.Duros@sophia.inria.fr>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   writing network device driver - pb with interrupt levels
Message-ID:  <199902021917.UAA01227@chouette.inria.fr>

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

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?199902021917.UAA01227>