Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2003 13:14:39 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Vincent Jardin <vjardin@wanadoo.fr>
Subject:   Re: adding if_dev member to struct ifnet
Message-ID:  <XFMail.20030930131439.jhb@FreeBSD.org>
In-Reply-To: <11374.1064934514@critter.freebsd.dk>

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

On 30-Sep-2003 Poul-Henning Kamp wrote:
> In message <XFMail.20030930103348.jhb@FreeBSD.org>, John Baldwin writes:
> 
>>>>Yes, if it helps to remove if_name/if_unit, it is a thing to do. Moreover it 
>>>>sounds a good idea to have the if_dev field into the ifnet structure.
>>> 
>>> Somebody please explain how this would work for non-hardware
>>> interfaces like if_loop, if_tun, if_tap etc ?
>>> 
>>> device_t is what we use to hitch drivers to hardware.
>>> 
>>> ifnet is what we use to hitch drivers to the netstack.  
>>> 
>>> They should not be tangled.
>>
>>You mean like dev_t and device_t shouldn't be tangled like we do
>>with si_drv1?  Oh, wait...
> 
> I don't think any correctly written driver stores it's device_t in
> a dev_t.  It should store it's softc structure, which should contain
> pointers to both.  Even if there is a driver which does do that,
> it happens inside the device driver, and it does not handicap the
> remaining device drivers with its choice.

Fair enough.  I think that Brooks planned to use a NULL device_t for
interfaces w/o a backing new-bus device.  However, that means you
still need if_name for all the non-newbus devices, so this seems
somewhat pointless if if_name is the only reason.  Another counterpoint
is that the new-bus namespace and the netif namespace aren't the same
anyway and that seemed to be the point of this linkage.  The
dev_t <> softc <> device_t linkages aren't about unifying namespaces.

> There is nothing in the "data-model" of the kernel that says that
> a network interface corresponds to exactly one hardware device
> and more importantly: there shouldn't be either.

Agreed.

> If all you want is an extra field in "struct ifnet" to hang driver
> information on, then by all means add that field.  As long as you
> give it type "void *" and make it private to the driver I have no
> problem with that.

Fair enough, though I don't think this is what Brooks was after.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



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