aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54common.c
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-10-14 21:55:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:31 -0400
commit0fdd7c5d2defe8c6873eb8a40a880eb0dc59573d (patch)
tree359d04aaef41ce6d2fda22c3e487c90f59adbc46 /drivers/net/wireless/p54/p54common.c
parentb88b15dfbddc8837569c6dea49348791357de4aa (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>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r--drivers/net/wireless/p54/p54common.c99
1 files changed, 37 insertions, 62 deletions
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
1117static void p54_init_vdcf(struct ieee80211_hw *dev) 1117static 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
1138static 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
1166static int p54_start(struct ieee80211_hw *dev) 1154static 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
1338static int p54_init_xbow_synth(struct ieee80211_hw *dev) 1314static 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}
1504EXPORT_SYMBOL_GPL(p54_free_common); 1479EXPORT_SYMBOL_GPL(p54_free_common);
1505 1480