[rt2x00-users] Alignment, padding and IV/ICV
Ivo van Doorn
ivdoorn at gmail.com
Tue Dec 1 21:59:59 UTC 2009
On Tuesday 01 December 2009, Benoit PAPILLAULT wrote:
> Ivo van Doorn a écrit :
> >> Part 1:
> >> 1. mac80211 sends us a packet in rt2x00mac_tx
> >> 2. we remove IV/ICV from the packet if applicable (we copy IV to
> >> skbdesc->iv)
> >> 3. we call rt2x00queue_insert_l2pad which is doing 3 things : align
> >> 802.11 header, align 802.11 payload, add padding. That might be a bit
> >> too much.
> > Partially right, there is a if-statement if it should apply l2-padding or not,
> > when l2 padding is required, it is cheaper to align the data as well since
> > we are moving the header and/or payload anyway.
> OK. I understand this is an implementation optimization, but
> functionally, it should be the same isn't it?
> >> RX path analysis (this does not fully represent is doing exactly, but
> >> it's only for understanding) :
> >> 1. we receive a packet from HW in rt2x00usb_interrupt_rxdone
> >> 2. we remove header (RXINFO+RXWI) & footer (RXD+USB pad) in
> >> rt2800usb_fill_rxdone
> >> 3. we remove L2 pad between 802.11 header and 802.11 payload if applicable
> >> 4. we set skb->len to rxdesc.size to remove padding at the end of the frame
> >> 5. we reinsert IV between header/payload and ICV at the end (after
> >> payload) if applicable
> >> 6. we align payload : it seems that mac80211 already takes care of that
> > As far as I know mac80211 will WARN_ON() when the payload is aligned,
> > but will not perform the alignment itself. That is why rt2x00lib is doing it.
> I talked to Johannes, alignment is done in ieee80211_rx() when it calls
> ieee80211_deliver_skb() [inside ieee80211_rx_h_data].
Ah ok, that changes things then, since we can remove the alignment code
out of rt2x00lib. That should make things a lot easier for RX frames. :)
More information about the users