HomeFreeBSD

Convert miibus(4) to new ifmedia KPI. This requires some changes.

Description

Convert miibus(4) to new ifmedia KPI. This requires some changes.

o miibus(4) gets rid of interface knowledge entirely. It includes only

if_media.h, to get media macros.  It doesn't include if.h.

o Argument list to mii_attach() is reduced by the function pointers, that

now live in ifops.

o struct mii_data now stores mii_media, which caches value of currently

selected media.
XXX: it might be, that mii_media, mii_media_active and mii_media_status
can be collapsed into one word, but that's not entirely clear. So take
conservative approach.

o struct mii_data now stores array of available mediae, accessible by the

NIC driver.
XXX: since miibus can hold several phys, the array is allocated
dynamically.  The size of array MII_MAX_MEDIAE might need a bump in
future, in case if new phys ever appear.  Or a more smart allocation
method should be coded. However, it looks like future NICs aren't going
to use miibus(4), and definitely aren't going to carry > 1 phys.

o phy_status, phy_service and phy_reset now take media as argument, and

so do some internal functions.
Before, this functions used to take current media from struct ifmedia,
and ifmedia_ioctl() used to restore it to previous value, in case of
and error.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

Details

Provenance
glebiusAuthored on
Parents
rS282025: Cleanup a little more:
Branches
Unknown
Tags
Unknown