Porting 802.11n (and hopefully 802.11ac) to FreeBSD iwm(4)


Project description

The aim of the project is to add the lacking 802.11n and 802.11ac support for the FreeBSD iwm driver. The priority is the 802.11n standard as 802.11ac is based on it.

The driver parts will be ported from 3 source trees: DragonFly BSD and Linux and OpenBSD.


Plan

Research & learning about wireless device driver development

1. (./) Linux iwlwifi:

  1. Start by drawing out the iwlwifi driver code by hand.
  2. Then look at the mac80211 code that creates the device and populates the mac80211 callbacks. Look for things like TX, RX, channel context, start and stop.

2. (./) 802.11n:


Antenna configuration

1. Let's review iwlwifi/mvm TX and RX antenna configuration code

2. Then we have to investigate iwlwifi and iwn to see how they assemble the MIMO version of the transmit PLCP.

3. Let's add placeholders routines for 11n methods.

4. Make MAC and PHY contexts in firmware aware of the fact that they can now use 11n.

5. Tell net80211 that it can now use 11n and see if it crashes.


Notes

These are loose notes and knowledge I gather during my research and conversations with other developers.


Typically, when the 802.11n support is added to a device driver this is the order of implementing features:

It's good to know that iwm is doing some really weird things with antenna configuration and channel setup, so it's worth looking at what iwlwifi/mvm/ is doing.

The RX path for iwlwifi/mvm/ shouldn't be that much different to what we've done in the FreeBSD RX path since the hardware is still giving us decap'ed frames but step #1 is always how is the NIC supposed to be configured to be in 11n mode and on an 11n channel way before you transmit 11n.

802.11ac doesn't run in 2.4 GHz.

Firstly - 11ac layers on top of 11n. There are some 11ac specific PHY level headers going on but MCS0..7 in 11n is MCS0..7 in 11ac. It's just MCS8 and MCS9 that are 11ac specific. Then, for 11n, you have multiple spatial streams. (MCS0..7 -> 1 stream, MCS8..15 -> 2 stream, MCS16..23 -> 3 stream, etc.) With 11ac, they have it as a 2d matrix. ((1, 2, 3.. n) stream ; (MCS0..9)) Then the third dimension is channel width - 20 and 40 are the same as 11abg, 11n. 80 and higher are 11ac so they really did build on top of 11n.

There are some new capabilities, some new ways to negotiate things that might not be done 100% correctly yet, but its getting there now the other bit is that almost all vendors have some kind of "11ac in 2GHz" vendor specific operation which AdrianChadd laid some groundwork for, but they are not going to be supported for the longest time.

You don't do 80MHz on 2GHz, For 40MHz however, there's a whole overlapping interop thing going on.


PLCP

802.11 protocols permit to negotiate transmission rates for every session. As well as that it is possible to change packet fragmentation in order to improve the throughput as the connection conditions change. This is where PLCP kicks in; it is a PHY layer which makes the features I listed possible.

Looking for PLCP uses in `mvm`

Firstly, I greped the mvm code for PLCP and tried to figure out how it works and when it is called.

The first function I focused on was iwl_mvm_mac80211_idx_to_hwrate.

It turned out that it is called from iwl_mvm_bss_info_changed. iwl_mvm_bss_info_changed behavior depends on whether on the mode it is operating in, which is either STA or AP/ADHOC.

When the mode is either AP or ADHOC then this is a list of function calls:

When the mode is STA then iwl_mvm_bss_info_changed_station is called, which doesn't seem to do anything anything about PLCP.

Another function where iwl_mvm_mac80211_idx_to_hwrate is called is iwl_mvm_get_tx_rate in iwlwifi/mvm/tx.c.

I still have to map out those function calls one or two levels higher as I do not understand the logic completely yet.

To-dos

I need to investigate iwl_hwrate_to_plcp_idx (iwlwifi/mvm/rs.c) as it looks like a function which calculates which rate should be applied.

Also, I don't know yet why and when those rates are changed.

PLCP in mvm/tx.c is still a mystery.


Milestones

Week #

Days

Description

Status

Research & Learning About Wireless Device Driver Development

{*}

1

May 30 - June 5

Read Linux iwlwifi/mvm and FreeBSD iwm code.
Learn about wireless device driver development.

(./)

2

June 6 - June 12

Antenna Setup

{o}

3

June 13 - June 19

Look for PLCP occurences in the iwlwifi/mvm code.

4

June 20 - June 26

5

June 27 - July 3

6

July 4 - July 10

Channel Setup

{o}

MIMO Frames

{o}

7

July 11 - July 17

8

July 18 - July 24

9

July 25 - July 31

10

August 1 - August 7

Frames Aggregation

{o}

11

August 8 - August 14

12

August 15 - August 21

End of Coding

{o}

13

August 22 - August 29


Reports

Week

Report

1

[GSOC17] Porting 802.11n and 802.11ac support to iwm(4)

2

3

[GSOC17] Porting 802.11n and 802.11ac support to iwm(4)

4


SummerOfCode2017/Porting80211nAnd80211acToFreeBSDiwm (last edited 2018-04-05 23:31:10 by MateuszPiotrowski)