Subject: Re: Ethernet driver function
To: None <santanum@delhi.tcs.co.in>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 12/15/2000 10:39:56
On Fri, 15 Dec 2000, Izumi Tsutsui wrote:

> In <01C066B0.023E79E0@NOKIA_26M>
> santanum@delhi.tcs.co.in wrote:
> 
> > Currently I am going through the ethernet device drivers for
> > NetBSD 1.4.1. Can anyone please tell me which is the function
> > (and the C filename) that calls the ether_input() method
> > (on arrival of an ethernet frame) in case of a 3Com 3C905 TX
> > 10/100 ethernet interface (ex0). In other words I want to know
> > the first kernel entry point method name which strips the ethernet header.
> 
> On 1.4.x, ether_input() is called from ex_intr() in sys/dev/ic/elinkxl.c
> around line 1214. The ethernet header is stripped there.
> 
> On 1.5, it is called via (ifp->if_input)() from ex_intr(), and
> it is initialized to ether_input() in ex_config() by calling
> sys/net/if_ethersubr.c:ether_ifattach(). The ethernet header
> is stripped in ether_input().

Assuming that you are working on the same project as Rajnish Madan, y'all
might want to think about switching to using 1.5 as a base. As

As Izumi mentioned, the drivers have been modified to not strip the
ethernet headers, which would mean that you could do your VMAC processing
in the IP stack area rather than in the individual drivers. That would
mean you could switch ethernet cards w/o having to hack on the driver.

You might also look into trying to add the VMAC address as a multicast
address on that network interface, rather than putting it into promiscuous
mode. There is a check in ether_addmulti() making sure that the MAC in
question is actually a multicast MAC which you'd have to circumvent. But
if you used AF_UNSPEC for specifying the address, you probably could pull
this off. You would then not have to use promiscuous mode - the only
packets which would get passed into the kernel would be ones for either
the real MAC or the VMAC.

Take care,

Bill