# The mac80211 subsystem for kernel developers

## The basic mac80211 driver interface

You should read and understand the information contained within this part of the book while implementing a driver. In some chapters, advanced usage is noted, that may be skipped at first.

This part of the book only covers station and monitor mode functionality, additional information required to implement the other modes is covered in the second part of the book.

### Basic hardware handling

TBD

This chapter shall contain information on getting a hw struct allocated and registered with mac80211.

Since it is required to allocate rates/modes before registering a hw struct, this chapter shall also contain information on setting up the rate/mode structs.

Additionally, some discussion about the callbacks and the general programming model should be in here, including the definition of ieee80211_ops which will be referred to a lot.

Finally, a discussion of hardware capabilities should be done with references to other parts of the book.

!Finclude/net/mac80211.h ieee80211_hw !Finclude/net/mac80211.h ieee80211_hw_flags !Finclude/net/mac80211.h SET_IEEE80211_DEV !Finclude/net/mac80211.h SET_IEEE80211_PERM_ADDR !Finclude/net/mac80211.h ieee80211_ops !Finclude/net/mac80211.h ieee80211_alloc_hw !Finclude/net/mac80211.h ieee80211_register_hw !Finclude/net/mac80211.h ieee80211_get_tx_led_name !Finclude/net/mac80211.h ieee80211_get_rx_led_name !Finclude/net/mac80211.h ieee80211_get_assoc_led_name !Finclude/net/mac80211.h ieee80211_get_radio_led_name !Finclude/net/mac80211.h ieee80211_unregister_hw !Finclude/net/mac80211.h ieee80211_free_hw

### PHY configuration

TBD

This chapter should describe PHY handling including start/stop callbacks and the various structures used.

!Finclude/net/mac80211.h ieee80211_conf !Finclude/net/mac80211.h ieee80211_conf_flags

### Virtual interfaces

TBD

This chapter should describe virtual interface basics that are relevant to the driver (VLANs, MGMT etc are not.) It should explain the use of the add_iface/remove_iface callbacks as well as the interface configuration callbacks.

Things related to AP mode should be discussed there.

Things related to supporting multiple interfaces should be in the appropriate chapter, a BIG FAT note should be here about this though and the recommendation to allow only a single interface in STA mode at first!

!Finclude/net/mac80211.h ieee80211_if_init_conf !Finclude/net/mac80211.h ieee80211_if_conf

### Receive and transmit processing

#### what should be here

TBD

This should describe the receive and transmit paths in mac80211/the drivers as well as transmit status handling.

#### Frame format

!Pinclude/net/mac80211.h Frame format

#### Packet alignment

!Pnet/mac80211/rx.c Packet alignment

#### Calling into mac80211 from interrupts

!Pinclude/net/mac80211.h Calling mac80211 from interrupts

#### functions/definitions

!Finclude/net/mac80211.h ieee80211_rx_status !Finclude/net/mac80211.h mac80211_rx_flags !Finclude/net/mac80211.h ieee80211_tx_info !Finclude/net/mac80211.h ieee80211_rx !Finclude/net/mac80211.h ieee80211_rx_irqsafe !Finclude/net/mac80211.h ieee80211_tx_status !Finclude/net/mac80211.h ieee80211_tx_status_irqsafe !Finclude/net/mac80211.h ieee80211_rts_get !Finclude/net/mac80211.h ieee80211_rts_duration !Finclude/net/mac80211.h ieee80211_ctstoself_get !Finclude/net/mac80211.h ieee80211_ctstoself_duration !Finclude/net/mac80211.h ieee80211_generic_frame_duration !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb !Finclude/net/mac80211.h ieee80211_hdrlen !Finclude/net/mac80211.h ieee80211_wake_queue !Finclude/net/mac80211.h ieee80211_stop_queue !Finclude/net/mac80211.h ieee80211_wake_queues !Finclude/net/mac80211.h ieee80211_stop_queues

### Frame filtering

!Pinclude/net/mac80211.h Frame filtering !Finclude/net/mac80211.h ieee80211_filter_flags

## Advanced driver interface

Information contained within this part of the book is of interest only for advanced interaction of mac80211 with drivers to exploit more hardware capabilities and improve performance.

### Hardware crypto acceleration

!Pinclude/net/mac80211.h Hardware crypto acceleration !Finclude/net/mac80211.h set_key_cmd !Finclude/net/mac80211.h ieee80211_key_conf !Finclude/net/mac80211.h ieee80211_key_alg !Finclude/net/mac80211.h ieee80211_key_flags

### Powersave support

!Pinclude/net/mac80211.h Powersave support

### Beacon filter support

!Pinclude/net/mac80211.h Beacon filter support !Finclude/net/mac80211.h ieee80211_beacon_loss

### Multiple queues and QoS support

TBD

!Finclude/net/mac80211.h ieee80211_tx_queue_params !Finclude/net/mac80211.h ieee80211_tx_queue_stats

### Access point mode support

TBD

Some parts of the if_conf should be discussed here instead

Insert notes about VLAN interfaces with hw crypto here or in the hw crypto chapter.

!Finclude/net/mac80211.h ieee80211_get_buffered_bc !Finclude/net/mac80211.h ieee80211_beacon_get

### Supporting multiple virtual interfaces

TBD

Note: WDS with identical MAC address should almost always be OK

Insert notes about having multiple virtual interfaces with different MAC addresses here, note which configurations are supported by mac80211, add notes about supporting hw crypto with it.

### Hardware scan offload

TBD

!Finclude/net/mac80211.h ieee80211_scan_completed

## Rate control interface

TBD

This part of the book describes the rate control algorithm interface and how it relates to mac80211 and drivers.

### dummy chapter

TBD

## Internals

TBD

This part of the book describes mac80211 internals.

### Key handling

#### Key handling basics

!Pnet/mac80211/key.c Key handling basics

#### MORE TBD

TBD

### Receive processing

TBD

### Transmit processing

TBD

### Station info handling

#### Programming information

!Fnet/mac80211/sta_info.h sta_info !Fnet/mac80211/sta_info.h ieee80211_sta_info_flags

#### STA information lifetime rules

!Pnet/mac80211/sta_info.c STA information lifetime rules

### Synchronisation

TBD

Locking, lots of RCU