The patch introduces new ioctl SIOCGIFMEDIA2, which is similar
to SIOCGIFMEDIA, but returns not words but structs ifmed, which
has enough space for enhancements. The structure corresponding
to ioctl is ifmediareq2.
New structure has enough space to add tons of new media variants.
As example IFM_VFAST is added.
All old code around SIOCGIFMEDIA is left untouched.
In kernel side two new functions are provided for drivers:
- ifmedia_add2()
- idmedia_set2()
Drivers, that want to utilize new media subtypes, that do not
fit into media word, should use these new functions. Example
provided in vtnet(4). Older drivers do not require any editing.
Why do I advocate this change instead of D1965? Both changes
introduce a new ioctl, but in D1965 ioctl continues to use the
old structure, which even after hack has very limited space.
In D1965 ifconfig(1) uses both ioctls: the old one and the new
one, while in this patch ifconfig is switched to new ioctl, and
we actually can put kernel support for old ioctl and its structure
under BURN_BRIDGES.
Regarding driver KPI. Yep, mixture of ifmedia_add() and ifmedia_add2()
looks ugly. But the plan for FreeBSD 11 is total restructuring of all
ifnet(9) KPI. The work is now going on in the projects/ifnet branch.
And the ifmedia is going to be shaked there as well. So, all these foo2
and bar2 in KPI will not be carried into the future. They will live in
head before projects/ifnet is merged into head.
Of course patch is mergeable to stable/10.