iPXE
|
Functions | |
struct net80211_device * | net80211_alloc (size_t priv_size) |
Allocate 802.11 device. More... | |
int | net80211_register (struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw) |
Register 802.11 device with network stack. More... | |
u16 | net80211_duration (struct net80211_device *dev, int bytes, u16 rate) |
Calculate one frame's contribution to 802.11 duration field. More... | |
void | net80211_rx (struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate) |
Handle receipt of 802.11 frame. More... | |
void | net80211_rx_err (struct net80211_device *dev, struct io_buffer *iob, int rc) |
Indicate an error in receiving a packet. More... | |
void | net80211_tx_complete (struct net80211_device *dev, struct io_buffer *iob, int retries, int rc) |
Indicate the completed transmission of a packet. More... | |
void | net80211_unregister (struct net80211_device *dev) |
Unregister 802.11 device from network stack. More... | |
void | net80211_free (struct net80211_device *dev) |
Free 802.11 device. More... | |
struct net80211_device* net80211_alloc | ( | size_t | priv_size | ) |
Allocate 802.11 device.
priv_size | Size of driver-private allocation area |
dev | Newly allocated 802.11 device |
This function allocates a net_device with space in its private area for both the net80211_device it will wrap and the driver-private data space requested. It initializes the link-layer-specific parts of the net_device, and links the net80211_device to the net_device appropriately.
Definition at line 754 of file net80211.c.
References alloc_netdev(), net_device::dev, eth_broadcast, IEEE80211_MAX_DATA_LEN, INIT_LIST_HEAD, net_device::ll_broadcast, net_device::ll_protocol, net_device::max_pkt_len, net80211_netdev_ops, net80211_null_ops, net80211_process_desc, netdev, netdev_init(), NULL, net_device::priv, process_init_stopped(), and net_device::refcnt.
Referenced by ath5k_probe(), ath_pci_probe(), and rtl818x_probe().
int net80211_register | ( | struct net80211_device * | dev, |
struct net80211_device_operations * | ops, | ||
struct net80211_hw_info * | hw | ||
) |
Register 802.11 device with network stack.
dev | 802.11 device |
ops | 802.11 device operations |
hw | 802.11 hardware information |
This also registers the wrapping net_device with the higher network layers.
Definition at line 791 of file net80211.c.
References net_device::dev, ENOMEM, ETH_ALEN, net80211_device_operations::irq, list_add_tail, malloc(), memcpy(), net80211_devices, NET80211_MAX_CHANNELS, NETDEV_IRQ_UNSUPPORTED, and register_netdev().
Referenced by ath5k_attach(), ath9k_init_device(), and rtl818x_probe().
u16 net80211_duration | ( | struct net80211_device * | dev, |
int | bytes, | ||
u16 | rate | ||
) |
Calculate one frame's contribution to 802.11 duration field.
dev | 802.11 device |
bytes | Amount of data to calculate duration for |
dur | Duration field in microseconds |
To avoid multiple stations attempting to transmit at once, 802.11 provides that every packet shall include a duration field specifying a length of time for which the wireless medium will be reserved after it is transmitted. The duration is measured in microseconds and is calculated with respect to the current physical-layer parameters of the 802.11 device.
For an unfragmented data or management frame, or the last fragment of a fragmented frame, the duration captures only the 10 data bytes of one ACK; call once with bytes = 10.
For a fragment of a data or management rame that will be followed by more fragments, the duration captures an ACK, the following fragment, and its ACK; add the results of three calls, two with bytes = 10 and one with bytes set to the next fragment's size.
For an RTS control frame, the duration captures the responding CTS, the frame being sent, and its ACK; add the results of three calls, two with bytes = 10 and one with bytes set to the next frame's size (assuming unfragmented).
For a CTS-to-self control frame, the duration captures the frame being protected and its ACK; add the results of two calls, one with bytes = 10 and one with bytes set to the next frame's size.
No other frame types are currently supported by iPXE.
Definition at line 441 of file net80211.c.
References net80211_channel::band, bits, bytes, net80211_device::channel, net80211_device::channels, NET80211_BAND_5GHZ, NET80211_PHY_USE_SHORT_PREAMBLE, net80211_rate_is_erp(), and net80211_device::phy_flags.
Referenced by ath5k_hw_write_rate_duration(), net80211_cts_duration(), net80211_ll_push(), and net80211_tx_mgmt().
void net80211_rx | ( | struct net80211_device * | dev, |
struct io_buffer * | iob, | ||
int | signal, | ||
u16 | rate | ||
) |
Handle receipt of 802.11 frame.
dev | 802.11 device |
iob | I/O buffer |
signal | Received signal strength |
rate | Bitrate at which frame was received, in 100 kbps units |
If the rate or signal is unknown, 0 should be passed.
Definition at line 2689 of file net80211.c.
References net80211_device::bssid, net80211_device::crypto, io_buffer::data, DBGC, DBGC2, net80211_crypto::decrypt, EINVAL_CRYPTO_REQUEST, ETH_ALEN, net80211_hw_info::flags, free_iob(), net80211_device::gcrypto, hdr, net80211_device::hw, IEEE80211_FC_MORE_FRAG, IEEE80211_FC_PROTECTED, IEEE80211_FC_RETRY, IEEE80211_FC_SUBTYPE, IEEE80211_FC_TYPE, IEEE80211_FC_VERSION, IEEE80211_FRAG, IEEE80211_STYPE_DATA, IEEE80211_THIS_VERSION, IEEE80211_TYPE_CTRL, IEEE80211_TYPE_MGMT, iob_unput, net80211_device::last_rx_seq, net80211_device::last_signal, memcmp(), NET80211_ASSOCIATED, net80211_handle_mgmt(), net80211_rx_frag(), net80211_device::netdev, netdev_rx(), netdev_rx_err(), NULL, rc80211_update_rx(), net80211_device::rctl, net80211_device::state, and type.
Referenced by ath5k_handle_rx(), ath_rx_tasklet(), net80211_rx_frag(), and rtl818x_handle_rx().
void net80211_rx_err | ( | struct net80211_device * | dev, |
struct io_buffer * | iob, | ||
int | rc | ||
) |
Indicate an error in receiving a packet.
dev | 802.11 device |
iob | I/O buffer with received packet, or NULL |
rc | Error code |
This logs the error with the wrapping net_device, and frees iob if it is passed.
Definition at line 2788 of file net80211.c.
References net80211_device::netdev, netdev_rx_err(), and rc.
Referenced by ath5k_handle_rx(), and rtl818x_handle_rx().
void net80211_tx_complete | ( | struct net80211_device * | dev, |
struct io_buffer * | iob, | ||
int | retries, | ||
int | rc | ||
) |
Indicate the completed transmission of a packet.
dev | 802.11 device |
iob | I/O buffer of transmitted packet |
retries | Number of times this packet was retransmitted |
rc | Error code, or 0 for success |
This logs an error with the wrapping net_device if one occurred, and removes and frees the I/O buffer from its TX queue. The provided retry information is used to tune our transmission rate.
If the packet did not need to be retransmitted because it was properly ACKed the first time, retries should be 0.
Definition at line 2808 of file net80211.c.
References net80211_device::netdev, netdev_tx_complete_err(), rc, rc80211_update_tx(), and net80211_device::rctl.
Referenced by ath5k_tx_processq(), ath5k_txbuf_free(), ath_tx_complete(), rtl818x_free_tx_ring(), and rtl818x_handle_tx().
void net80211_unregister | ( | struct net80211_device * | dev | ) |
Unregister 802.11 device from network stack.
dev | 802.11 device |
After this call, the device operations are cleared so that they will not be called.
Definition at line 824 of file net80211.c.
References net_device::dev, list_del, net80211_null_ops, and unregister_netdev().
Referenced by ath5k_detach(), ath9k_deinit_device(), and rtl818x_remove().
void net80211_free | ( | struct net80211_device * | dev | ) |
Free 802.11 device.
dev | 802.11 device |
The device should be unregistered before this function is called.
Definition at line 838 of file net80211.c.
References net_device::dev, free, netdev_nullify(), netdev_put(), and rc80211_free().
Referenced by ath5k_probe(), ath5k_remove(), ath_pci_probe(), ath_pci_remove(), rtl818x_probe(), and rtl818x_remove().