mac80211: add rate control rewrite and enhance the performance of the minstrel algori...
[openwrt/openwrt.git] / package / mac80211 / patches / 422-mac80211-seqno-station.patch
1 Subject: mac80211: provide sequence numbers
2
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.
7
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.
12
13 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
14 ---
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(-)
22
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;
28
29 + u16 sequence_number;
30 +
31 /* BSS configuration for this interface. */
32 struct ieee80211_bss_conf bss_conf;
33
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)
38 return TX_CONTINUE;
39
40 + /*
41 + * Anything but QoS data that has a sequence number field
42 + * (is long enough) gets a sequence number from the global
43 + * counter.
44 + */
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;
52 return TX_CONTINUE;
53 }
54
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);
60 int mode;
61 - u16 seqno;
62 u16 rx_mtu;
63 u8 headroom;
64 u8 tailroom;
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
68 if (padding)
69 txhdr->align[0] = padding;
70
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.
77 - */
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);
83 - }
84 /* modifies skb->cb and with it info, so must be last! */
85 p54_assign_address(dev, skb, hdr, skb->len);
86
87 @@ -1391,6 +1378,11 @@ struct ieee80211_hw *p54_init_common(siz
88 IEEE80211_HW_SIGNAL_DBM |
89 IEEE80211_HW_NOISE_DBM;
90
91 + /*
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.
95 + */
96 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
97
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)];
103 }
104
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.
111 - */
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);
117 - }
118 -
119 info->driver_data[0] = dev;
120 info->driver_data[1] = urb;
121
122 @@ -1185,6 +1171,10 @@ static int __devinit rtl8187_probe(struc
123 dev->max_signal = 65;
124 }
125
126 + /*
127 + * XXX: Once this driver supports anything that requires
128 + * beacons it must implement IEEE80211_TX_CTL_ASSIGN_SEQ.
129 + */
130 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
131
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;
137 u32 rx_conf;
138 u16 txpwr_base;
139 - u16 seqno;
140 u8 asic_rev;
141 u8 is_rtl8187b;
142 enum {