aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-04 19:44:01 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-04 19:44:01 -0500
commit3123e666ea92ab0b1762e97e0785d20a0ab25088 (patch)
treeaab303bf0d7158edb438de6b47886f9b574d2541
parented58dd41f3aeefc11a7f634db90687f92ea8632e (diff)
parentc256e05b7b30fab484deacb4f8cff59ce649c75e (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c8
-rw-r--r--drivers/net/wireless/p54common.c20
-rw-r--r--drivers/net/wireless/p54common.h8
-rw-r--r--drivers/net/wireless/rndis_wlan.c8
-rw-r--r--drivers/ssb/driver_pcicore.c5
-rw-r--r--net/mac80211/rc80211_pid_algo.c92
7 files changed, 70 insertions, 73 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index c39de422e220..5f3f34e1dbfd 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3829,7 +3829,7 @@ static void b43legacy_print_driverinfo(void)
3829#ifdef CONFIG_B43LEGACY_DMA 3829#ifdef CONFIG_B43LEGACY_DMA
3830 feat_dma = "D"; 3830 feat_dma = "D";
3831#endif 3831#endif
3832 printk(KERN_INFO "Broadcom 43xx driver loaded " 3832 printk(KERN_INFO "Broadcom 43xx-legacy driver loaded "
3833 "[ Features: %s%s%s%s%s, Firmware-ID: " 3833 "[ Features: %s%s%s%s%s, Firmware-ID: "
3834 B43legacy_SUPPORTED_FIRMWARE_ID " ]\n", 3834 B43legacy_SUPPORTED_FIRMWARE_ID " ]\n",
3835 feat_pci, feat_leds, feat_rfkill, feat_pio, feat_dma); 3835 feat_pci, feat_leds, feat_rfkill, feat_pio, feat_dma);
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 159216a91903..bdc6a1cc2103 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -562,9 +562,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
562 } 562 }
563 563
564 resp = (void *)priv->upld_buf; 564 resp = (void *)priv->upld_buf;
565 565 curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command);
566 curcmd = le16_to_cpu(resp->command);
567
568 respcmd = le16_to_cpu(resp->command); 566 respcmd = le16_to_cpu(resp->command);
569 result = le16_to_cpu(resp->result); 567 result = le16_to_cpu(resp->result);
570 568
@@ -572,9 +570,9 @@ int lbs_process_rx_command(struct lbs_private *priv)
572 respcmd, le16_to_cpu(resp->seqnum), priv->upld_len, jiffies); 570 respcmd, le16_to_cpu(resp->seqnum), priv->upld_len, jiffies);
573 lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len); 571 lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len);
574 572
575 if (resp->seqnum != resp->seqnum) { 573 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
576 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n", 574 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
577 le16_to_cpu(resp->seqnum), le16_to_cpu(resp->seqnum)); 575 le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
578 spin_unlock_irqrestore(&priv->driver_lock, flags); 576 spin_unlock_irqrestore(&priv->driver_lock, flags);
579 ret = -1; 577 ret = -1;
580 goto done; 578 goto done;
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c
index 5cda49aff3a8..d191e055a788 100644
--- a/drivers/net/wireless/p54common.c
+++ b/drivers/net/wireless/p54common.c
@@ -166,18 +166,23 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
166 struct p54_common *priv = dev->priv; 166 struct p54_common *priv = dev->priv;
167 struct eeprom_pda_wrap *wrap = NULL; 167 struct eeprom_pda_wrap *wrap = NULL;
168 struct pda_entry *entry; 168 struct pda_entry *entry;
169 int i = 0;
170 unsigned int data_len, entry_len; 169 unsigned int data_len, entry_len;
171 void *tmp; 170 void *tmp;
172 int err; 171 int err;
172 u8 *end = (u8 *)eeprom + len;
173 173
174 wrap = (struct eeprom_pda_wrap *) eeprom; 174 wrap = (struct eeprom_pda_wrap *) eeprom;
175 entry = (void *)wrap->data + wrap->len; 175 entry = (void *)wrap->data + le16_to_cpu(wrap->len);
176 i += 2; 176
177 i += le16_to_cpu(entry->len)*2; 177 /* verify that at least the entry length/code fits */
178 while (i < len) { 178 while ((u8 *)entry <= end - sizeof(*entry)) {
179 entry_len = le16_to_cpu(entry->len); 179 entry_len = le16_to_cpu(entry->len);
180 data_len = ((entry_len - 1) << 1); 180 data_len = ((entry_len - 1) << 1);
181
182 /* abort if entry exceeds whole structure */
183 if ((u8 *)entry + sizeof(*entry) + data_len > end)
184 break;
185
181 switch (le16_to_cpu(entry->code)) { 186 switch (le16_to_cpu(entry->code)) {
182 case PDR_MAC_ADDRESS: 187 case PDR_MAC_ADDRESS:
183 SET_IEEE80211_PERM_ADDR(dev, entry->data); 188 SET_IEEE80211_PERM_ADDR(dev, entry->data);
@@ -249,13 +254,12 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
249 priv->version = *(u8 *)(entry->data + 1); 254 priv->version = *(u8 *)(entry->data + 1);
250 break; 255 break;
251 case PDR_END: 256 case PDR_END:
252 i = len; 257 /* make it overrun */
258 entry_len = len;
253 break; 259 break;
254 } 260 }
255 261
256 entry = (void *)entry + (entry_len + 1)*2; 262 entry = (void *)entry + (entry_len + 1)*2;
257 i += 2;
258 i += entry_len*2;
259 } 263 }
260 264
261 if (!priv->iq_autocal || !priv->output_limit || !priv->curve_data) { 265 if (!priv->iq_autocal || !priv->output_limit || !priv->curve_data) {
diff --git a/drivers/net/wireless/p54common.h b/drivers/net/wireless/p54common.h
index a721334e20d9..b67ff34e26fe 100644
--- a/drivers/net/wireless/p54common.h
+++ b/drivers/net/wireless/p54common.h
@@ -53,10 +53,10 @@ struct pda_entry {
53} __attribute__ ((packed)); 53} __attribute__ ((packed));
54 54
55struct eeprom_pda_wrap { 55struct eeprom_pda_wrap {
56 u32 magic; 56 __le32 magic;
57 u16 pad; 57 __le16 pad;
58 u16 len; 58 __le16 len;
59 u32 arm_opcode; 59 __le32 arm_opcode;
60 u8 data[0]; 60 u8 data[0];
61} __attribute__ ((packed)); 61} __attribute__ ((packed));
62 62
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d9460aed1f22..10b776c1adc5 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -260,7 +260,7 @@ struct NDIS_802_11_KEY {
260 __le32 KeyLength; 260 __le32 KeyLength;
261 u8 Bssid[6]; 261 u8 Bssid[6];
262 u8 Padding[6]; 262 u8 Padding[6];
263 __le64 KeyRSC; 263 u8 KeyRSC[8];
264 u8 KeyMaterial[32]; 264 u8 KeyMaterial[32];
265} __attribute__((packed)); 265} __attribute__((packed));
266 266
@@ -1508,7 +1508,7 @@ static int rndis_iw_set_encode_ext(struct net_device *dev,
1508 struct usbnet *usbdev = dev->priv; 1508 struct usbnet *usbdev = dev->priv;
1509 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev); 1509 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1510 struct NDIS_802_11_KEY ndis_key; 1510 struct NDIS_802_11_KEY ndis_key;
1511 int i, keyidx, ret; 1511 int keyidx, ret;
1512 u8 *addr; 1512 u8 *addr;
1513 1513
1514 keyidx = wrqu->encoding.flags & IW_ENCODE_INDEX; 1514 keyidx = wrqu->encoding.flags & IW_ENCODE_INDEX;
@@ -1543,9 +1543,7 @@ static int rndis_iw_set_encode_ext(struct net_device *dev,
1543 ndis_key.KeyIndex = cpu_to_le32(keyidx); 1543 ndis_key.KeyIndex = cpu_to_le32(keyidx);
1544 1544
1545 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { 1545 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
1546 for (i = 0; i < 6; i++) 1546 memcpy(ndis_key.KeyRSC, ext->rx_seq, 6);
1547 ndis_key.KeyRSC |=
1548 cpu_to_le64(ext->rx_seq[i] << (i * 8));
1549 ndis_key.KeyIndex |= cpu_to_le32(1 << 29); 1547 ndis_key.KeyIndex |= cpu_to_le32(1 << 29);
1550 } 1548 }
1551 1549
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 07ab48d9ceab..74b9a8aea52b 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -111,7 +111,10 @@ static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
111 111
112 /* Enable PCI bridge bus mastering and memory space */ 112 /* Enable PCI bridge bus mastering and memory space */
113 pci_set_master(dev); 113 pci_set_master(dev);
114 pcibios_enable_device(dev, ~0); 114 if (pcibios_enable_device(dev, ~0) < 0) {
115 ssb_printk(KERN_ERR "PCI: SSB bridge enable failed\n");
116 return;
117 }
115 118
116 /* Enable PCI bridge BAR1 prefetch and burst */ 119 /* Enable PCI bridge BAR1 prefetch and burst */
117 pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3); 120 pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index c339571632b2..3b77410588e7 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -2,7 +2,7 @@
2 * Copyright 2002-2005, Instant802 Networks, Inc. 2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc. 3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de> 4 * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de>
5 * Copyright 2007, Stefano Brivio <stefano.brivio@polimi.it> 5 * Copyright 2007-2008, Stefano Brivio <stefano.brivio@polimi.it>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -63,72 +63,66 @@
63 * RC_PID_ARITH_SHIFT. 63 * RC_PID_ARITH_SHIFT.
64 */ 64 */
65 65
66 66/* Adjust the rate while ensuring that we won't switch to a lower rate if it
67/* Shift the adjustment so that we won't switch to a lower rate if it exhibited 67 * exhibited a worse failed frames behaviour and we'll choose the highest rate
68 * a worse failed frames behaviour and we'll choose the highest rate whose 68 * whose failed frames behaviour is not worse than the one of the original rate
69 * failed frames behaviour is not worse than the one of the original rate 69 * target. While at it, check that the new rate is valid. */
70 * target. While at it, check that the adjustment is within the ranges. Then,
71 * provide the new rate index. */
72static int rate_control_pid_shift_adjust(struct rc_pid_rateinfo *r,
73 int adj, int cur, int l)
74{
75 int i, j, k, tmp;
76
77 j = r[cur].rev_index;
78 i = j + adj;
79
80 if (i < 0)
81 return r[0].index;
82 if (i >= l - 1)
83 return r[l - 1].index;
84
85 tmp = i;
86
87 if (adj < 0) {
88 for (k = j; k >= i; k--)
89 if (r[k].diff <= r[j].diff)
90 tmp = k;
91 } else {
92 for (k = i + 1; k + i < l; k++)
93 if (r[k].diff <= r[i].diff)
94 tmp = k;
95 }
96
97 return r[tmp].index;
98}
99
100static void rate_control_pid_adjust_rate(struct ieee80211_local *local, 70static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
101 struct sta_info *sta, int adj, 71 struct sta_info *sta, int adj,
102 struct rc_pid_rateinfo *rinfo) 72 struct rc_pid_rateinfo *rinfo)
103{ 73{
104 struct ieee80211_sub_if_data *sdata; 74 struct ieee80211_sub_if_data *sdata;
105 struct ieee80211_hw_mode *mode; 75 struct ieee80211_hw_mode *mode;
106 int newidx; 76 int cur_sorted, new_sorted, probe, tmp, n_bitrates;
107 int maxrate; 77 int cur = sta->txrate;
108 int back = (adj > 0) ? 1 : -1;
109 78
110 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 79 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
111 80
112 mode = local->oper_hw_mode; 81 mode = local->oper_hw_mode;
113 maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1; 82 n_bitrates = mode->num_rates;
114 83
115 newidx = rate_control_pid_shift_adjust(rinfo, adj, sta->txrate, 84 /* Map passed arguments to sorted values. */
116 mode->num_rates); 85 cur_sorted = rinfo[cur].rev_index;
86 new_sorted = cur_sorted + adj;
117 87
118 while (newidx != sta->txrate) { 88 /* Check limits. */
119 if (rate_supported(sta, mode, newidx) && 89 if (new_sorted < 0)
120 (maxrate < 0 || newidx <= maxrate)) { 90 new_sorted = rinfo[0].rev_index;
121 sta->txrate = newidx; 91 else if (new_sorted >= n_bitrates)
122 break; 92 new_sorted = rinfo[n_bitrates - 1].rev_index;
123 }
124 93
125 newidx += back; 94 tmp = new_sorted;
95
96 if (adj < 0) {
97 /* Ensure that the rate decrease isn't disadvantageous. */
98 for (probe = cur_sorted; probe >= new_sorted; probe--)
99 if (rinfo[probe].diff <= rinfo[cur_sorted].diff &&
100 rate_supported(sta, mode, rinfo[probe].index))
101 tmp = probe;
102 } else {
103 /* Look for rate increase with zero (or below) cost. */
104 for (probe = new_sorted + 1; probe < n_bitrates; probe++)
105 if (rinfo[probe].diff <= rinfo[new_sorted].diff &&
106 rate_supported(sta, mode, rinfo[probe].index))
107 tmp = probe;
126 } 108 }
127 109
110 /* Fit the rate found to the nearest supported rate. */
111 do {
112 if (rate_supported(sta, mode, rinfo[tmp].index)) {
113 sta->txrate = rinfo[tmp].index;
114 break;
115 }
116 if (adj < 0)
117 tmp--;
118 else
119 tmp++;
120 } while (tmp < n_bitrates && tmp >= 0);
121
128#ifdef CONFIG_MAC80211_DEBUGFS 122#ifdef CONFIG_MAC80211_DEBUGFS
129 rate_control_pid_event_rate_change( 123 rate_control_pid_event_rate_change(
130 &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events, 124 &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events,
131 newidx, mode->rates[newidx].rate); 125 cur, mode->rates[cur].rate);
132#endif 126#endif
133} 127}
134 128