Subject: Re: PCI device interface and interrupts
To: Marc Lanoue <mlanoue@hyperchip.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 09/21/2000 09:21:41
On Wed, Sep 20, 2000 at 04:41:17PM -0400, Marc Lanoue wrote:
> I don't want to port anything. As a matter of fact, I have the whole IP
> stack in hands (IP, UDP, sockets, etc.), so I don't want to use the existing
> one from the NetBSD kernel. So at this point for me, it's a question of
> knowing what is the easiest solution to interface with an Ethernet card that
> is plugged on the PCI bus. It's simply a question of being able to use the
> PCI card as it is done through the device driver. Ultimately, there will be
> no Ethernet card configured in the kernel once it will be reconfigured,
> compiled and started all over again. But, is that possible to do for what I
> want to validate (i.e., interface my own IP stack with an Ethernet PCI
> card). In that case, how can I use the same Ethernet card? What is the
> simplest way to interface with it? Am I allowed to interface with the DMA,
> I/O and PCI bus from what would probably be an application running my own IP
> stack?
>
> Thanks a lot for your time and cooperation Manuel, it's appreciated. I'm
> really confused with NetBSD as it doesn't have (unless I'm wrong once again)
> any "generic" interface to access the bus, interrupt control and PCI
> interface functions in general libraries. But since I'm a newbie with
> NetBSD maybe I'm wrong on that side too.
Ok, so you don't want to access the bus, interrupt control and PCI interface
(there are functions for this, but it's to write drivers, not to talk to
drivers).
You just need to ask the driver to send a packet for you, and get the
pakets received by the interface.
If you can do all this in userland then you can use the bpf(4) interface
for this (this is the kind of interface used by e.g. tcpdump). You'll also
have to disable the in-kernel IP stack to avoid interferences. Hum, if you do
this you'll also have to implement arp (or permanent entries to the arp tables
of other machines).
Another way of doing it is to remplace the in-kernel ip stack with yours, but
this is IMHO more difficult: you'll also need to add a new soft inetrrupt, and
interface with sockets. The entry points in the kernel to send/receive packets
are ether_output() and ether_input()
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--