freebsd-nq/sys/dev/mii
Marcel Moolenaar 62d76917b8 Introduce a procedural interface to the ifnet structure. The new
interface allows the ifnet structure to be defined as an opaque
type in NIC drivers.  This then allows the ifnet structure to be
changed without a need to change or recompile NIC drivers.

Put differently, NIC drivers can be written and compiled once and
be used with different network stack implementations, provided of
course that those network stack implementations have an API and
ABI compatible interface.

This commit introduces the 'if_t' type to replace 'struct ifnet *'
as the type of a network interface. The 'if_t' type is defined as
'void *' to enable the compiler to perform type conversion to
'struct ifnet *' and vice versa where needed and without warnings.
The functions that implement the API are the only functions that
need to have an explicit cast.

The MII code has been converted to use the driver API to avoid
unnecessary code churn. Code churn comes from having to work with
both converted and unconverted drivers in correlation with having
callback functions that take an interface. By converting the MII
code first, the callback functions can be defined so that the
compiler will perform the typecasts automatically.

As soon as all drivers have been converted, the if_t type can be
redefined as needed and the API functions can be fix to not need
an explicit cast.

The immediate benefactors of this change are:
1.  Juniper Networks - The network stack implementation in Junos
    is entirely different from FreeBSD's one and this change
    allows Juniper to build "stock" NIC drivers that can be used
    in combination with both the FreeBSD and Junos stacks.
2.  FreeBSD - This change opens the door towards changing ifnet
    and implementing new features and optimizations in the network
    stack without it requiring a change in the many NIC drivers
    FreeBSD has.

Submitted by:	Anuranjan Shukla <anshukla@juniper.net>
Reviewed by:	glebius@
Obtained from:	Juniper Networks, Inc.
2014-06-02 17:54:39 +00:00
..
acphy.c
acphyreg.h
amphy.c
amphyreg.h
atphy.c
atphyreg.h
axphy.c
bmtphy.c
bmtphyreg.h
brgphy.c
brgphyreg.h
ciphy.c
ciphyreg.h
e1000phy.c
e1000phyreg.h
gentbi.c
icsphy.c
icsphyreg.h
ip1000phy.c
ip1000phyreg.h
jmphy.c
jmphyreg.h
lxtphy.c
lxtphyreg.h
mii_bitbang.c
mii_bitbang.h
mii_physubr.c
mii.c
mii.h
miibus_if.m
miidevs
miivar.h
mlphy.c
nsgphy.c
nsgphyreg.h
nsphy.c
nsphyreg.h
nsphyter.c
nsphyterreg.h
pnaphy.c
qsphy.c
qsphyreg.h
rdcphy.c
rdcphyreg.h
rgephy.c
rgephyreg.h
rlphy.c
rlswitch.c
smcphy.c
smscphy.c
tdkphy.c
tdkphyreg.h
tlphy.c
tlphyreg.h
truephy.c
truephyreg.h
ukphy_subr.c
ukphy.c
xmphy.c
xmphyreg.h