Page MenuHomeFreeBSD

Extend ifmedia word to struct ifmed.
Needs ReviewPublic

Authored by glebius on Mar 5 2015, 2:54 PM.

Details

Reviewers
jfv
gnn
adrian
karels
Group Reviewers
network
Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

glebius retitled this revision from to Extend ifmedia word to struct ifmed..
glebius updated this object.
glebius edited the test plan for this revision. (Show Details)
glebius added reviewers: network, adrian, jfv, gnn, karels.

I have very mixed feelings about this approach. On the one hand, having more bits is nice (although hps pointed out another, more-compatible way to getting a number of bits for Ethernet). On the other hand, it this the current non-generic, Ethernet-centric approach. If this is the content that FreeBSD 11 will support via its new interfaces, I think this is a bad approach. If FreeBSD 11 has a better interface media description, then we are stuck with 3 interfaces. The code in the patch also accentuates the Ethernet-specific nature of the change. I'd be interested in knowing whether a better interface would be helpful for 802.11. Maybe it already has enough separate mechanism..

This patch is incomplete. There is no way to set the new media variants with ifconfig. There needs to be a SIOCSIFMEDIA2 call using the structure. SIOCSIFMEDIA (using the old media word) may not need to be supported. If it is, that will add non-trivial complexity. The "demo" change in vtnet should keep the existing default and allow a new type to be selected with ifconfig.

One addition: I think the existence of this review should be announced on the -arch and -net lists with a link. The summary should be included.