tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: (non-)Equivalence of if_type == IFT_ETHER and (struct ethercom*) == (struct ifnet*)



On Mon, Oct 17, 2022 at 03:48:19PM +0100, David Brownlee wrote:
> Would the third option (a la FreeBSD) of moving everything to the
> generic interface structure have the fewest number of casts/helper
> methods?

The fewest casts/helper method are needed for the first option that
I implemented on the wifi branch now: allow casting of "struct ifnet *ifp"
to "struct ethercom*" for wifi interfaces too (that is: for everything using
IFT_ETHER). And this method requires absolutely no churn - but leaves
us with the (theoretically) unclean "struct ethercom *ec = (void*)ifp;"
cast.

The FreeBSD way (option 3) will cause a lot of churn too as we spent some
effort to cleanly separate ethernet from generic interfaces - and this
would be undone. The result will not need any casts though (similar to
the patch presented here and no helper/accessor methods either).

> Would it also make sharing code a little easier? (thinking of the new
> wifi branch)

It won't make a noticable/serious difference there.

Martin


Home | Main Index | Thread Index | Old Index