On Wed, 2007-02-14 at 14:23 +0100, Ivo van Doorn wrote: > Most hardware can keep track of sequence numbers themselves, > unfortunately *most* doesn't cover all devices. ;) > This patch will keep track of the (per-bss) sequence number > if the flag IEEE80211_HW_SOFTWARE_SEQUENCE has been set. Can this be a library function instead? Our TX path is already cluttered enough... > +static void ieee80211_include_sequence(struct net_device *dev, > + struct ieee80211_hdr *hdr) > +{ > + struct ieee80211_sta_bss *bss; > + u8 *bssid = ieee80211_get_bssid(hdr, sizeof(*hdr)); > + > + bss = ieee80211_rx_bss_get(dev, bssid); > + if (!bss) > + return; > + > + /* > + * Set the sequence number for this frame. > + */ > + hdr->seq_ctrl = cpu_to_le16(bss->sequence & IEEE80211_SCTL_SEQ); > + > + /* > + * Increase the sequence number. > + */ > + bss->sequence = (bss->sequence + 0x10) & IEEE80211_SCTL_SEQ; > + > + ieee80211_rx_bss_put(dev, bss); > +} This could be exported getting an skb instead of the ieee80211_hdr. Then the driver can just call it whenever it needs the sequence number for a frame. It'll need to be a bit smart about fragmentation but I think that's ok. I may be radical, but I think that a lot of things hardware can do belong into library functions the driver can use instead of cluttering the stack with it. johannes
Attachment:
signature.asc
Description: This is a digitally signed message part