more net80211 changes :/

Gleb Smirnoff glebius at FreeBSD.org
Tue Sep 8 15:22:44 UTC 2015


  Hi!

  It looks like another sweep over net80211 drivers is required. It isn't
going to be as huge as previous one.

The problem is that in the "new world order", there will be only if_attach(),
instead of if_alloc() / fill & hack / ether_ifattach. What right now happens
with net80211 is that all drivers have the same copy & paste in their
ic_vap_create, which yields in a sequence of:

- if_alloc
- driver specific code
- ether_ifattach

Which isn't possible to collapse into if_attach(), since driver code is
in the middle.

Another problem is embedding if ieee80211_vap into driver's softc. This
is a bad habit, which was proved by ifnet experience (fixed decade ago).

What patch does:

- Inline ieee80211_vap_setup() and ieee80211_vap_attach() into wlan_clone_create().
  Note, that this moves code from ieee80211.c to into ieee80211_freebsd.c,
  which is good, since this code about interaction with ifnet layer, which
  is FreeBSD specific and will be more FreeBSD specific.
  As dependency ifmedia support code and ieee80211_get_counter() also naturally
  move to the same file.

- In the new long wlan_clone_create(), after initial error checking call
  ic_vap_preattach() to allow driver do its own error checking. I predict
  that for now ath(4) will be the only driver to use ic_vap_preattach().

- If no errors, go with allocating and attaching the interface, and then
  call ic_vap_postattach.

- The ic_vap_postattach() for all drivers (save ath) would be remnants
  of ic_vap_create(), where all copy and paste is removed and only driver
  specific bits remain.

- ic_vap_postattach() may allocate driver specific softc for vap, which
  now longer has ieee80211_vap embedded.

This also removes all ambiguities with mac address handling, which was
juggled between three functions before.

The current patch covers iwn(4) only. Now sending this mail with patched
driver. Changing MAC aldo tested - works.

I'm starting to convert rest of drivers and meanwhile, waiting for your
input. May be you have ideas what else can be improved here.

-- 
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_vap_attach.diff
Type: text/x-diff
Size: 34880 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20150908/9898f484/attachment.bin>


More information about the freebsd-net mailing list