Diff for /wikisrc/Converting_drivers_to_the_new_wifi_stack.mdwn between versions 1.11 and 1.12

version 1.11, 2021/01/17 16:08:00 version 1.12, 2021/01/18 09:10:31
Line 84  reflects on the driver and causes most o Line 84  reflects on the driver and causes most o
    You may want a replacement for IFF_OACATIVE logic for the main device,     You may want a replacement for IFF_OACATIVE logic for the main device,
    as there is no interface so no flags to (ab)use for that.     as there is no interface so no flags to (ab)use for that.
   
    Note that the way channels are set up has changed.   * The way channels are set up has changed.
    If your driver had a driver_init_channels() function, you can     If your driver had a driver_init_channels() function, you can
    use it mostly verbatim. Rename it to `driver_get_radiocaps` and     use it mostly verbatim (but see caveats below for `maxchans` and `nchans`).
    make it look like:     Rename it to `driver_get_radiocaps` and make it look like:
   
     ```      ```
     static void      static void
Line 128  reflects on the driver and causes most o Line 128  reflects on the driver and causes most o
    An example of a multi-frequency driver doing this is iwm(4).     An example of a multi-frequency driver doing this is iwm(4).
   
    It uses a helper function to add single channels individually     It uses a helper function to add single channels individually
    via ``ieee80211_add_channel``.     via `ieee80211_add_channel`.
    To add the channels for a band, it calls     To add the channels for a band, it calls
    ``iwm_add_channel_band(ic, chans, maxchans, nchans, start, num, bands)``     `iwm_add_channel_band(ic, chans, maxchans, nchans, start, num, bands)`
    where ``chans``, ``maxchans`` and ``nchans`` are the arguments passed to     where `chans`, `maxchans` and `nchans` are the arguments passed to
    this callback, chans collecting the resulting channels, nchans pointing     this callback, chans collecting the resulting channels, nchans pointing
    to the number of channels already collected, ``bands`` is the bitset of     to the number of channels already collected, `bands` is the bitset of
    bands to add (multiple IEEE80211_MODE_* bits). The offset ``start``     bands to add (multiple IEEE80211_MODE_* bits). The offset `start`
    is the index of the first channel to add to the output (first call will     is the index of the first channel to add to the output (first call will
    always be with 0 as ``start``), and ``num`` the number of channels     always be with 0 as ``start``), and `num` the number of channels
    you expect ``iwm_add_channel_band`` to add. The ``iwm_add_channel_band``     you expect `iwm_add_channel_band` to add. The `iwm_add_channel_band`
    helper function iterates over the channels, gets flags for the channels     helper function iterates over the channels, gets flags for the channels
    from firmware and calls ``ieee80211_add_channel``.     from firmware and calls `ieee80211_add_channel`.
   
      Overall the most important part in conversion of old drivers is to make sure that
      the out parameter `*nchans` is properly set to the number of channel data
      actually filled, and to respect the `maxchans` limit. This callback
      is called from two places, once from the drivers attach function,
      where `maxchan` is big enough (always `IEEE80211_CHAN_MAX`), and from
      ioctl `IEEE80211_IOC_DEVCAPS` where `maxchan` depends on the userland arguments
      and e.g. wpa_supplicant only asks for minmal data, as it is not interested
      in the actual channels available (`maxchan` is 1). The ioctl handling code
      will KASSERT proper behaviour of the callback.
   
  * If your driver used to override state machine functions (typical   * If your driver used to override state machine functions (typical
    `newstate` to controll LEDs when associating or similar),     `newstate` to controll LEDs when associating or similar),

Removed from v.1.11  
changed lines
  Added in v.1.12


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb