1 Subject: mac80211: provide sequence numbers
3 I've come to think that not providing sequence numbers for
4 the normal STA mode case was a mistake, at least two drivers
5 now had to implement code they wouldn't otherwise need, and
6 I believe at76_usb and adm8211 might be broken.
8 This patch makes mac80211 assign a sequence number to all
9 those frames that need one except beacons. That means that
10 if a driver only implements modes that do not do beaconing
11 it need not worry about the sequence number.
13 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
15 drivers/net/wireless/p54/p54.h | 1 -
16 drivers/net/wireless/p54/p54common.c | 18 +++++-------------
17 drivers/net/wireless/rtl8187.h | 1 -
18 drivers/net/wireless/rtl8187_dev.c | 18 ++++--------------
19 net/mac80211/ieee80211_i.h | 2 ++
20 net/mac80211/tx.c | 10 ++++++++++
21 6 files changed, 21 insertions(+), 29 deletions(-)
23 --- everything.orig/net/mac80211/ieee80211_i.h 2008-10-10 15:45:52.000000000 +0200
24 +++ everything/net/mac80211/ieee80211_i.h 2008-10-10 15:45:56.000000000 +0200
25 @@ -438,6 +438,8 @@ struct ieee80211_sub_if_data {
26 struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
27 struct ieee80211_key *default_key;
29 + u16 sequence_number;
31 /* BSS configuration for this interface. */
32 struct ieee80211_bss_conf bss_conf;
34 --- everything.orig/net/mac80211/tx.c 2008-10-10 15:45:48.000000000 +0200
35 +++ everything/net/mac80211/tx.c 2008-10-10 15:45:56.000000000 +0200
36 @@ -602,8 +602,18 @@ ieee80211_tx_h_sequence(struct ieee80211
37 if (ieee80211_hdrlen(hdr->frame_control) < 24)
41 + * Anything but QoS data that has a sequence number field
42 + * (is long enough) gets a sequence number from the global
45 if (!ieee80211_is_data_qos(hdr->frame_control)) {
46 + /* driver should assign sequence number */
47 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
48 + /* for pure STA mode without beacons, we can do it */
49 + hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number);
50 + tx->sdata->sequence_number += 0x10;
51 + tx->sdata->sequence_number &= IEEE80211_SCTL_SEQ;
55 --- everything.orig/drivers/net/wireless/p54/p54.h 2008-10-10 15:45:49.000000000 +0200
56 +++ everything/drivers/net/wireless/p54/p54.h 2008-10-10 15:45:56.000000000 +0200
57 @@ -67,7 +67,6 @@ struct p54_common {
58 int (*open)(struct ieee80211_hw *dev);
59 void (*stop)(struct ieee80211_hw *dev);
65 --- everything.orig/drivers/net/wireless/p54/p54common.c 2008-10-10 15:45:49.000000000 +0200
66 +++ everything/drivers/net/wireless/p54/p54common.c 2008-10-10 15:45:56.000000000 +0200
67 @@ -865,19 +865,6 @@ static int p54_tx(struct ieee80211_hw *d
69 txhdr->align[0] = padding;
71 - /* FIXME: The sequence that follows is needed for this driver to
72 - * work with mac80211 since "mac80211: fix TX sequence numbers".
73 - * As with the temporary code in rt2x00, changes will be needed
74 - * to get proper sequence numbers on beacons. In addition, this
75 - * patch places the sequence number in the hardware state, which
76 - * limits us to a single virtual state.
78 - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
79 - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
80 - priv->seqno += 0x10;
81 - ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
82 - ieee80211hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
84 /* modifies skb->cb and with it info, so must be last! */
85 p54_assign_address(dev, skb, hdr, skb->len);
87 @@ -1391,6 +1378,11 @@ struct ieee80211_hw *p54_init_common(siz
88 IEEE80211_HW_SIGNAL_DBM |
89 IEEE80211_HW_NOISE_DBM;
92 + * XXX: when this driver gets support for any mode that
93 + * requires beacons (AP, MESH, IBSS) then it must
94 + * implement IEEE80211_TX_CTL_ASSIGN_SEQ.
96 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
98 dev->channel_change_time = 1000; /* TODO: find actual value */
99 --- everything.orig/drivers/net/wireless/rtl8187_dev.c 2008-10-10 15:45:49.000000000 +0200
100 +++ everything/drivers/net/wireless/rtl8187_dev.c 2008-10-10 15:45:56.000000000 +0200
101 @@ -238,20 +238,6 @@ static int rtl8187_tx(struct ieee80211_h
102 ep = epmap[skb_get_queue_mapping(skb)];
105 - /* FIXME: The sequence that follows is needed for this driver to
106 - * work with mac80211 since "mac80211: fix TX sequence numbers".
107 - * As with the temporary code in rt2x00, changes will be needed
108 - * to get proper sequence numbers on beacons. In addition, this
109 - * patch places the sequence number in the hardware state, which
110 - * limits us to a single virtual state.
112 - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
113 - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
114 - priv->seqno += 0x10;
115 - ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
116 - ieee80211hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
119 info->driver_data[0] = dev;
120 info->driver_data[1] = urb;
122 @@ -1185,6 +1171,10 @@ static int __devinit rtl8187_probe(struc
123 dev->max_signal = 65;
127 + * XXX: Once this driver supports anything that requires
128 + * beacons it must implement IEEE80211_TX_CTL_ASSIGN_SEQ.
130 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
132 if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
133 --- everything.orig/drivers/net/wireless/rtl8187.h 2008-10-10 15:45:49.000000000 +0200
134 +++ everything/drivers/net/wireless/rtl8187.h 2008-10-10 15:45:56.000000000 +0200
135 @@ -100,7 +100,6 @@ struct rtl8187_priv {
136 struct usb_device *udev;