diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-10-14 21:55:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:31 -0400 |
commit | 0fdd7c5d2defe8c6873eb8a40a880eb0dc59573d (patch) | |
tree | 359d04aaef41ce6d2fda22c3e487c90f59adbc46 | |
parent | b88b15dfbddc8837569c6dea49348791357de4aa (diff) |
p54: broken out edcf changes
This patch series hopefully increases p54's "longterm" stability.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/p54/p54.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 99 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54common.h | 28 |
3 files changed, 58 insertions, 78 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h index 1da96fe50241..1dace10feb7e 100644 --- a/drivers/net/wireless/p54/p54.h +++ b/drivers/net/wireless/p54/p54.h | |||
@@ -49,6 +49,13 @@ struct p54_control_hdr { | |||
49 | u8 data[0]; | 49 | u8 data[0]; |
50 | } __attribute__ ((packed)); | 50 | } __attribute__ ((packed)); |
51 | 51 | ||
52 | struct p54_edcf_queue_param { | ||
53 | __le16 aifs; | ||
54 | __le16 cwmin; | ||
55 | __le16 cwmax; | ||
56 | __le16 txop; | ||
57 | } __attribute__ ((packed)); | ||
58 | |||
52 | #define EEPROM_READBACK_LEN 0x3fc | 59 | #define EEPROM_READBACK_LEN 0x3fc |
53 | 60 | ||
54 | #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000 | 61 | #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000 |
@@ -85,13 +92,13 @@ struct p54_common { | |||
85 | u8 version; | 92 | u8 version; |
86 | u8 rx_antenna; | 93 | u8 rx_antenna; |
87 | unsigned int tx_hdr_len; | 94 | unsigned int tx_hdr_len; |
88 | void *cached_vdcf; | ||
89 | unsigned int fw_var; | 95 | unsigned int fw_var; |
90 | unsigned int fw_interface; | 96 | unsigned int fw_interface; |
91 | unsigned int output_power; | 97 | unsigned int output_power; |
92 | u32 tsf_low32; | 98 | u32 tsf_low32; |
93 | u32 tsf_high32; | 99 | u32 tsf_high32; |
94 | struct ieee80211_tx_queue_stats tx_stats[8]; | 100 | struct ieee80211_tx_queue_stats tx_stats[8]; |
101 | struct p54_edcf_queue_param qos_params[8]; | ||
95 | struct ieee80211_low_level_stats stats; | 102 | struct ieee80211_low_level_stats stats; |
96 | struct timer_list stats_timer; | 103 | struct timer_list stats_timer; |
97 | struct completion stats_comp; | 104 | struct completion stats_comp; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 237090140243..7ddb93bb60a1 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -1114,53 +1114,41 @@ do { \ | |||
1114 | queue.txop = cpu_to_le16(_txop); \ | 1114 | queue.txop = cpu_to_le16(_txop); \ |
1115 | } while(0) | 1115 | } while(0) |
1116 | 1116 | ||
1117 | static void p54_init_vdcf(struct ieee80211_hw *dev) | 1117 | static int p54_set_edcf(struct ieee80211_hw *dev) |
1118 | { | 1118 | { |
1119 | struct p54_common *priv = dev->priv; | 1119 | struct p54_common *priv = dev->priv; |
1120 | struct p54_control_hdr *hdr; | 1120 | struct p54_control_hdr *hdr; |
1121 | struct p54_tx_control_vdcf *vdcf; | 1121 | struct p54_edcf *edcf; |
1122 | 1122 | ||
1123 | /* all USB V1 adapters need a extra headroom */ | 1123 | hdr = kzalloc(priv->tx_hdr_len + sizeof(*hdr) + sizeof(*edcf), |
1124 | hdr = (void *)priv->cached_vdcf + priv->tx_hdr_len; | 1124 | GFP_ATOMIC); |
1125 | if (!hdr) | ||
1126 | return -ENOMEM; | ||
1127 | |||
1128 | hdr = (void *)hdr + priv->tx_hdr_len; | ||
1125 | hdr->magic1 = cpu_to_le16(0x8001); | 1129 | hdr->magic1 = cpu_to_le16(0x8001); |
1126 | hdr->len = cpu_to_le16(sizeof(*vdcf)); | 1130 | hdr->len = cpu_to_le16(sizeof(*edcf)); |
1127 | hdr->type = cpu_to_le16(P54_CONTROL_TYPE_DCFINIT); | 1131 | hdr->type = cpu_to_le16(P54_CONTROL_TYPE_DCFINIT); |
1128 | hdr->req_id = cpu_to_le32(priv->rx_start); | 1132 | hdr->retry1 = hdr->retry2 = 0; |
1129 | 1133 | edcf = (struct p54_edcf *)hdr->data; | |
1130 | vdcf = (struct p54_tx_control_vdcf *) hdr->data; | ||
1131 | |||
1132 | P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 47); | ||
1133 | P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 94); | ||
1134 | P54_SET_QUEUE(vdcf->queue[2], 0x0003, 0x000f, 0x03ff, 0); | ||
1135 | P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0); | ||
1136 | } | ||
1137 | |||
1138 | static void p54_set_vdcf(struct ieee80211_hw *dev) | ||
1139 | { | ||
1140 | struct p54_common *priv = dev->priv; | ||
1141 | struct p54_control_hdr *hdr; | ||
1142 | struct p54_tx_control_vdcf *vdcf; | ||
1143 | |||
1144 | hdr = (void *)priv->cached_vdcf + priv->tx_hdr_len; | ||
1145 | |||
1146 | p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*vdcf)); | ||
1147 | |||
1148 | vdcf = (struct p54_tx_control_vdcf *) hdr->data; | ||
1149 | |||
1150 | if (priv->use_short_slot) { | 1134 | if (priv->use_short_slot) { |
1151 | vdcf->slottime = 9; | 1135 | edcf->slottime = 9; |
1152 | vdcf->magic1 = 0x10; | 1136 | edcf->sifs = 0x10; |
1153 | vdcf->magic2 = 0x00; | 1137 | edcf->eofpad = 0x00; |
1154 | } else { | 1138 | } else { |
1155 | vdcf->slottime = 20; | 1139 | edcf->slottime = 20; |
1156 | vdcf->magic1 = 0x0a; | 1140 | edcf->sifs = 0x0a; |
1157 | vdcf->magic2 = 0x06; | 1141 | edcf->eofpad = 0x06; |
1158 | } | 1142 | } |
1159 | |||
1160 | /* (see prism54/isl_oid.h for further details) */ | 1143 | /* (see prism54/isl_oid.h for further details) */ |
1161 | vdcf->frameburst = cpu_to_le16(0); | 1144 | edcf->frameburst = cpu_to_le16(0); |
1145 | edcf->round_trip_delay = cpu_to_le16(0); | ||
1146 | memset(edcf->mapping, 0, sizeof(edcf->mapping)); | ||
1147 | memcpy(edcf->queue, priv->qos_params, sizeof(edcf->queue)); | ||
1162 | 1148 | ||
1163 | priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*vdcf), 0); | 1149 | p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*edcf)); |
1150 | priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*edcf), 1); | ||
1151 | return 0; | ||
1164 | } | 1152 | } |
1165 | 1153 | ||
1166 | static int p54_start(struct ieee80211_hw *dev) | 1154 | static int p54_start(struct ieee80211_hw *dev) |
@@ -1168,33 +1156,26 @@ static int p54_start(struct ieee80211_hw *dev) | |||
1168 | struct p54_common *priv = dev->priv; | 1156 | struct p54_common *priv = dev->priv; |
1169 | int err; | 1157 | int err; |
1170 | 1158 | ||
1171 | if (!priv->cached_vdcf) { | ||
1172 | priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf)+ | ||
1173 | priv->tx_hdr_len + sizeof(struct p54_control_hdr), | ||
1174 | GFP_KERNEL); | ||
1175 | |||
1176 | if (!priv->cached_vdcf) | ||
1177 | return -ENOMEM; | ||
1178 | } | ||
1179 | |||
1180 | if (!priv->cached_stats) { | 1159 | if (!priv->cached_stats) { |
1181 | priv->cached_stats = kzalloc(sizeof(struct p54_statistics) + | 1160 | priv->cached_stats = kzalloc(sizeof(struct p54_statistics) + |
1182 | priv->tx_hdr_len + sizeof(struct p54_control_hdr), | 1161 | priv->tx_hdr_len + sizeof(struct p54_control_hdr), |
1183 | GFP_KERNEL); | 1162 | GFP_KERNEL); |
1184 | 1163 | ||
1185 | if (!priv->cached_stats) { | 1164 | if (!priv->cached_stats) |
1186 | kfree(priv->cached_vdcf); | ||
1187 | priv->cached_vdcf = NULL; | ||
1188 | return -ENOMEM; | 1165 | return -ENOMEM; |
1189 | } | ||
1190 | } | 1166 | } |
1191 | 1167 | ||
1192 | err = priv->open(dev); | 1168 | err = priv->open(dev); |
1193 | if (!err) | 1169 | if (!err) |
1194 | priv->mode = NL80211_IFTYPE_MONITOR; | 1170 | priv->mode = NL80211_IFTYPE_MONITOR; |
1171 | P54_SET_QUEUE(priv->qos_params[0], 0x0002, 0x0003, 0x0007, 47); | ||
1172 | P54_SET_QUEUE(priv->qos_params[1], 0x0002, 0x0007, 0x000f, 94); | ||
1173 | P54_SET_QUEUE(priv->qos_params[2], 0x0003, 0x000f, 0x03ff, 0); | ||
1174 | P54_SET_QUEUE(priv->qos_params[3], 0x0007, 0x000f, 0x03ff, 0); | ||
1175 | err = p54_set_edcf(dev); | ||
1176 | if (!err) | ||
1177 | mod_timer(&priv->stats_timer, jiffies + HZ); | ||
1195 | 1178 | ||
1196 | p54_init_vdcf(dev); | ||
1197 | mod_timer(&priv->stats_timer, jiffies + HZ); | ||
1198 | return err; | 1179 | return err; |
1199 | } | 1180 | } |
1200 | 1181 | ||
@@ -1264,7 +1245,8 @@ static int p54_config(struct ieee80211_hw *dev, u32 changed) | |||
1264 | priv->rx_antenna = 2; /* automatic */ | 1245 | priv->rx_antenna = 2; /* automatic */ |
1265 | priv->output_power = conf->power_level << 2; | 1246 | priv->output_power = conf->power_level << 2; |
1266 | ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); | 1247 | ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); |
1267 | p54_set_vdcf(dev); | 1248 | if (!ret) |
1249 | ret = p54_set_edcf(dev); | ||
1268 | mutex_unlock(&priv->conf_mutex); | 1250 | mutex_unlock(&priv->conf_mutex); |
1269 | return ret; | 1251 | return ret; |
1270 | } | 1252 | } |
@@ -1319,20 +1301,14 @@ static int p54_conf_tx(struct ieee80211_hw *dev, u16 queue, | |||
1319 | const struct ieee80211_tx_queue_params *params) | 1301 | const struct ieee80211_tx_queue_params *params) |
1320 | { | 1302 | { |
1321 | struct p54_common *priv = dev->priv; | 1303 | struct p54_common *priv = dev->priv; |
1322 | struct p54_tx_control_vdcf *vdcf; | ||
1323 | |||
1324 | vdcf = (struct p54_tx_control_vdcf *)(((struct p54_control_hdr *) | ||
1325 | ((void *)priv->cached_vdcf + priv->tx_hdr_len))->data); | ||
1326 | 1304 | ||
1327 | if ((params) && !(queue > 4)) { | 1305 | if ((params) && !(queue > 4)) { |
1328 | P54_SET_QUEUE(vdcf->queue[queue], params->aifs, | 1306 | P54_SET_QUEUE(priv->qos_params[queue], params->aifs, |
1329 | params->cw_min, params->cw_max, params->txop); | 1307 | params->cw_min, params->cw_max, params->txop); |
1330 | } else | 1308 | } else |
1331 | return -EINVAL; | 1309 | return -EINVAL; |
1332 | 1310 | ||
1333 | p54_set_vdcf(dev); | 1311 | return p54_set_edcf(dev); |
1334 | |||
1335 | return 0; | ||
1336 | } | 1312 | } |
1337 | 1313 | ||
1338 | static int p54_init_xbow_synth(struct ieee80211_hw *dev) | 1314 | static int p54_init_xbow_synth(struct ieee80211_hw *dev) |
@@ -1418,7 +1394,7 @@ static void p54_bss_info_changed(struct ieee80211_hw *dev, | |||
1418 | 1394 | ||
1419 | if (changed & BSS_CHANGED_ERP_SLOT) { | 1395 | if (changed & BSS_CHANGED_ERP_SLOT) { |
1420 | priv->use_short_slot = info->use_short_slot; | 1396 | priv->use_short_slot = info->use_short_slot; |
1421 | p54_set_vdcf(dev); | 1397 | p54_set_edcf(dev); |
1422 | } | 1398 | } |
1423 | } | 1399 | } |
1424 | 1400 | ||
@@ -1499,7 +1475,6 @@ void p54_free_common(struct ieee80211_hw *dev) | |||
1499 | kfree(priv->iq_autocal); | 1475 | kfree(priv->iq_autocal); |
1500 | kfree(priv->output_limit); | 1476 | kfree(priv->output_limit); |
1501 | kfree(priv->curve_data); | 1477 | kfree(priv->curve_data); |
1502 | kfree(priv->cached_vdcf); | ||
1503 | } | 1478 | } |
1504 | EXPORT_SYMBOL_GPL(p54_free_common); | 1479 | EXPORT_SYMBOL_GPL(p54_free_common); |
1505 | 1480 | ||
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h index 22af41c7dab6..2cb3885c0210 100644 --- a/drivers/net/wireless/p54/p54common.h +++ b/drivers/net/wireless/p54/p54common.h | |||
@@ -7,8 +7,12 @@ | |||
7 | * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> | 7 | * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> |
8 | * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de> | 8 | * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de> |
9 | * | 9 | * |
10 | * Based on the islsm (softmac prism54) driver, which is: | 10 | * Based on: |
11 | * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. | 11 | * - the islsm (softmac prism54) driver, which is: |
12 | * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. | ||
13 | * | ||
14 | * - LMAC API interface header file for STLC4560 (lmac_longbow.h) | ||
15 | * Copyright (C) 2007 Conexant Systems, Inc. | ||
12 | * | 16 | * |
13 | * This program is free software; you can redistribute it and/or modify | 17 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License version 2 as | 18 | * it under the terms of the GNU General Public License version 2 as |
@@ -286,21 +290,15 @@ struct p54_tx_control_led { | |||
286 | __le16 duration; | 290 | __le16 duration; |
287 | } __attribute__ ((packed)); | 291 | } __attribute__ ((packed)); |
288 | 292 | ||
289 | struct p54_tx_vdcf_queues { | 293 | struct p54_edcf { |
290 | __le16 aifs; | 294 | u8 flags; |
291 | __le16 cwmin; | ||
292 | __le16 cwmax; | ||
293 | __le16 txop; | ||
294 | } __attribute__ ((packed)); | ||
295 | |||
296 | struct p54_tx_control_vdcf { | ||
297 | u8 padding; | ||
298 | u8 slottime; | 295 | u8 slottime; |
299 | u8 magic1; | 296 | u8 sifs; |
300 | u8 magic2; | 297 | u8 eofpad; |
301 | struct p54_tx_vdcf_queues queue[8]; | 298 | struct p54_edcf_queue_param queue[8]; |
302 | u8 pad2[4]; | 299 | u8 mapping[4]; |
303 | __le16 frameburst; | 300 | __le16 frameburst; |
301 | __le16 round_trip_delay; | ||
304 | } __attribute__ ((packed)); | 302 | } __attribute__ ((packed)); |
305 | 303 | ||
306 | struct p54_statistics { | 304 | struct p54_statistics { |