aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-05-22 20:01:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-03 14:05:09 -0400
commit5fd164e96cb9dc111f75468378de38c67b0fd161 (patch)
treeeeb4ec9dd3b2f1b034c1fc1c80b469de0c9275f7 /drivers/net/wireless
parentd77b034f62d4b8c6c39450d99de224b9b2c5debb (diff)
libertas: simplify and clean up association/start/join setup
Some of the parameters for association/join/start commands aren't used (like the FH and CF IEs for IBSS, and the FH IE for BSS), so get rid of their unions to reduce indirection. Also clean up structure names for kernel style. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/libertas/assoc.c57
-rw-r--r--drivers/net/wireless/libertas/dev.h6
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h16
-rw-r--r--drivers/net/wireless/libertas/scan.c32
-rw-r--r--drivers/net/wireless/libertas/types.h57
5 files changed, 70 insertions, 98 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index a0e440cd8967..d4d1d80045e0 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -219,11 +219,10 @@ static int lbs_adhoc_join(struct lbs_private *priv,
219 memcpy(&cmd.bss.bssid, &bss->bssid, ETH_ALEN); 219 memcpy(&cmd.bss.bssid, &bss->bssid, ETH_ALEN);
220 memcpy(&cmd.bss.ssid, &bss->ssid, bss->ssid_len); 220 memcpy(&cmd.bss.ssid, &bss->ssid, bss->ssid_len);
221 221
222 memcpy(&cmd.bss.phyparamset, &bss->phyparamset, 222 memcpy(&cmd.bss.ds, &bss->phy.ds, sizeof(struct ieee_ie_ds_param_set));
223 sizeof(union ieeetypes_phyparamset));
224 223
225 memcpy(&cmd.bss.ssparamset, &bss->ssparamset, 224 memcpy(&cmd.bss.ibss, &bss->ss.ibss,
226 sizeof(union IEEEtypes_ssparamset)); 225 sizeof(struct ieee_ie_ibss_param_set));
227 226
228 cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); 227 cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
229 lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 228 lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
@@ -260,7 +259,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
260 */ 259 */
261 lbs_set_basic_rate_flags(cmd.bss.rates, ratesize); 260 lbs_set_basic_rate_flags(cmd.bss.rates, ratesize);
262 261
263 cmd.bss.ssparamset.ibssparamset.atimwindow = cpu_to_le16(bss->atimwindow); 262 cmd.bss.ibss.atimwindow = bss->atimwindow;
264 263
265 if (assoc_req->secinfo.wep_enabled) { 264 if (assoc_req->secinfo.wep_enabled) {
266 u16 tmp = le16_to_cpu(cmd.bss.capability); 265 u16 tmp = le16_to_cpu(cmd.bss.capability);
@@ -343,14 +342,14 @@ static int lbs_adhoc_start(struct lbs_private *priv,
343 WARN_ON(!assoc_req->channel); 342 WARN_ON(!assoc_req->channel);
344 343
345 /* set Physical parameter set */ 344 /* set Physical parameter set */
346 cmd.phyparamset.dsparamset.elementid = WLAN_EID_DS_PARAMS; 345 cmd.ds.elementid = WLAN_EID_DS_PARAMS;
347 cmd.phyparamset.dsparamset.len = 1; 346 cmd.ds.len = 1;
348 cmd.phyparamset.dsparamset.currentchan = assoc_req->channel; 347 cmd.ds.channel = assoc_req->channel;
349 348
350 /* set IBSS parameter set */ 349 /* set IBSS parameter set */
351 cmd.ssparamset.ibssparamset.elementid = WLAN_EID_IBSS_PARAMS; 350 cmd.ibss.elementid = WLAN_EID_IBSS_PARAMS;
352 cmd.ssparamset.ibssparamset.len = 2; 351 cmd.ibss.len = 2;
353 cmd.ssparamset.ibssparamset.atimwindow = 0; 352 cmd.ibss.atimwindow = cpu_to_le16(0);
354 353
355 /* set capability info */ 354 /* set capability info */
356 tmpcap = WLAN_CAPABILITY_IBSS; 355 tmpcap = WLAN_CAPABILITY_IBSS;
@@ -1560,8 +1559,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
1560 u8 *pos; 1559 u8 *pos;
1561 u16 tmpcap, tmplen; 1560 u16 tmpcap, tmplen;
1562 struct mrvlietypes_ssidparamset *ssid; 1561 struct mrvlietypes_ssidparamset *ssid;
1563 struct mrvlietypes_phyparamset *phy; 1562 struct mrvlietypes_dsparamset *ds;
1564 struct mrvlietypes_ssparamset *ss; 1563 struct mrvlietypes_cfparamset *cf;
1565 struct mrvlietypes_ratesparamset *rates; 1564 struct mrvlietypes_ratesparamset *rates;
1566 struct mrvlietypes_rsnparamset *rsn; 1565 struct mrvlietypes_rsnparamset *rsn;
1567 1566
@@ -1594,20 +1593,18 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
1594 memcpy(ssid->ssid, bss->ssid, tmplen); 1593 memcpy(ssid->ssid, bss->ssid, tmplen);
1595 pos += sizeof(ssid->header) + tmplen; 1594 pos += sizeof(ssid->header) + tmplen;
1596 1595
1597 phy = (struct mrvlietypes_phyparamset *) pos; 1596 ds = (struct mrvlietypes_dsparamset *) pos;
1598 phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); 1597 ds->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
1599 tmplen = sizeof(phy->fh_ds.dsparamset); 1598 ds->header.len = cpu_to_le16(1);
1600 phy->header.len = cpu_to_le16(tmplen); 1599 ds->channel = bss->phy.ds.channel;
1601 memcpy(&phy->fh_ds.dsparamset, 1600 pos += sizeof(ds->header) + 1;
1602 &bss->phyparamset.dsparamset.currentchan, 1601
1603 tmplen); 1602 cf = (struct mrvlietypes_cfparamset *) pos;
1604 pos += sizeof(phy->header) + tmplen; 1603 cf->header.type = cpu_to_le16(TLV_TYPE_CF);
1605 1604 tmplen = sizeof(*cf) - sizeof (cf->header);
1606 ss = (struct mrvlietypes_ssparamset *) pos; 1605 cf->header.len = cpu_to_le16(tmplen);
1607 ss->header.type = cpu_to_le16(TLV_TYPE_CF); 1606 /* IE payload should be zeroed, firmware fills it in for us */
1608 tmplen = sizeof(ss->cf_ibss.cfparamset); 1607 pos += sizeof(*cf);
1609 ss->header.len = cpu_to_le16(tmplen);
1610 pos += sizeof(ss->header) + tmplen;
1611 1608
1612 rates = (struct mrvlietypes_ratesparamset *) pos; 1609 rates = (struct mrvlietypes_ratesparamset *) pos;
1613 rates->header.type = cpu_to_le16(TLV_TYPE_RATES); 1610 rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
@@ -1643,7 +1640,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
1643 } 1640 }
1644 1641
1645 /* update curbssparams */ 1642 /* update curbssparams */
1646 priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; 1643 priv->curbssparams.channel = bss->phy.ds.channel;
1647 1644
1648 if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { 1645 if (lbs_parse_dnld_countryinfo_11d(priv, bss)) {
1649 ret = -1; 1646 ret = -1;
@@ -1669,7 +1666,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
1669{ 1666{
1670 int ret = 0; 1667 int ret = 0;
1671 union iwreq_data wrqu; 1668 union iwreq_data wrqu;
1672 struct ieeetypes_assocrsp *passocrsp; 1669 struct ieee_assoc_response *passocrsp;
1673 struct bss_descriptor *bss; 1670 struct bss_descriptor *bss;
1674 u16 status_code; 1671 u16 status_code;
1675 1672
@@ -1682,7 +1679,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
1682 } 1679 }
1683 bss = &priv->in_progress_assoc_req->bss; 1680 bss = &priv->in_progress_assoc_req->bss;
1684 1681
1685 passocrsp = (struct ieeetypes_assocrsp *) &resp->params; 1682 passocrsp = (struct ieee_assoc_response *) &resp->params;
1686 1683
1687 /* 1684 /*
1688 * Older FW versions map the IEEE 802.11 Status Code in the association 1685 * Older FW versions map the IEEE 802.11 Status Code in the association
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index a4455ec7c354..d0de8c70f8c9 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -340,7 +340,7 @@ struct bss_descriptor {
340 u32 rssi; 340 u32 rssi;
341 u32 channel; 341 u32 channel;
342 u16 beaconperiod; 342 u16 beaconperiod;
343 u32 atimwindow; 343 __le16 atimwindow;
344 344
345 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ 345 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
346 u8 mode; 346 u8 mode;
@@ -350,8 +350,8 @@ struct bss_descriptor {
350 350
351 unsigned long last_scanned; 351 unsigned long last_scanned;
352 352
353 union ieeetypes_phyparamset phyparamset; 353 union ieee_phy_param_set phy;
354 union IEEEtypes_ssparamset ssparamset; 354 union ieee_ss_param_set ss;
355 355
356 struct ieeetypes_countryinfofullset countryinfo; 356 struct ieeetypes_countryinfofullset countryinfo;
357 357
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 391c54ab2b09..463ff977995c 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -278,7 +278,7 @@ struct cmd_ds_802_11_associate {
278} __attribute__ ((packed)); 278} __attribute__ ((packed));
279 279
280struct cmd_ds_802_11_associate_rsp { 280struct cmd_ds_802_11_associate_rsp {
281 struct ieeetypes_assocrsp assocRsp; 281 struct ieee_assoc_response response;
282} __attribute__ ((packed)); 282} __attribute__ ((packed));
283 283
284struct cmd_ds_802_11_set_wep { 284struct cmd_ds_802_11_set_wep {
@@ -535,9 +535,11 @@ struct cmd_ds_802_11_ad_hoc_start {
535 u8 bsstype; 535 u8 bsstype;
536 __le16 beaconperiod; 536 __le16 beaconperiod;
537 u8 dtimperiod; /* Reserved on v9 and later */ 537 u8 dtimperiod; /* Reserved on v9 and later */
538 union IEEEtypes_ssparamset ssparamset; 538 struct ieee_ie_ibss_param_set ibss;
539 union ieeetypes_phyparamset phyparamset; 539 u8 reserved1[4];
540 __le16 probedelay; 540 struct ieee_ie_ds_param_set ds;
541 u8 reserved2[4];
542 __le16 probedelay; /* Reserved on v9 and later */
541 __le16 capability; 543 __le16 capability;
542 u8 rates[MAX_RATES]; 544 u8 rates[MAX_RATES];
543 u8 tlv_memory_size_pad[100]; 545 u8 tlv_memory_size_pad[100];
@@ -558,8 +560,10 @@ struct adhoc_bssdesc {
558 u8 dtimperiod; 560 u8 dtimperiod;
559 __le64 timestamp; 561 __le64 timestamp;
560 __le64 localtime; 562 __le64 localtime;
561 union ieeetypes_phyparamset phyparamset; 563 struct ieee_ie_ds_param_set ds;
562 union IEEEtypes_ssparamset ssparamset; 564 u8 reserved1[4];
565 struct ieee_ie_ibss_param_set ibss;
566 u8 reserved2[4];
563 __le16 capability; 567 __le16 capability;
564 u8 rates[MAX_RATES]; 568 u8 rates[MAX_RATES];
565 569
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 8124db36aaff..38b056066e19 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -513,10 +513,10 @@ void lbs_scan_worker(struct work_struct *work)
513static int lbs_process_bss(struct bss_descriptor *bss, 513static int lbs_process_bss(struct bss_descriptor *bss,
514 uint8_t **pbeaconinfo, int *bytesleft) 514 uint8_t **pbeaconinfo, int *bytesleft)
515{ 515{
516 struct ieeetypes_fhparamset *pFH; 516 struct ieee_ie_fh_param_set *fh;
517 struct ieeetypes_dsparamset *pDS; 517 struct ieee_ie_ds_param_set *ds;
518 struct ieeetypes_cfparamset *pCF; 518 struct ieee_ie_cf_param_set *cf;
519 struct ieeetypes_ibssparamset *pibss; 519 struct ieee_ie_ibss_param_set *ibss;
520 DECLARE_SSID_BUF(ssid); 520 DECLARE_SSID_BUF(ssid);
521 struct ieeetypes_countryinfoset *pcountryinfo; 521 struct ieeetypes_countryinfoset *pcountryinfo;
522 uint8_t *pos, *end, *p; 522 uint8_t *pos, *end, *p;
@@ -616,32 +616,28 @@ static int lbs_process_bss(struct bss_descriptor *bss,
616 break; 616 break;
617 617
618 case WLAN_EID_FH_PARAMS: 618 case WLAN_EID_FH_PARAMS:
619 pFH = (struct ieeetypes_fhparamset *) pos; 619 fh = (struct ieee_ie_fh_param_set *) pos;
620 memmove(&bss->phyparamset.fhparamset, pFH, 620 memcpy(&bss->phy.fh, fh, sizeof(*fh));
621 sizeof(struct ieeetypes_fhparamset));
622 lbs_deb_scan("got FH IE\n"); 621 lbs_deb_scan("got FH IE\n");
623 break; 622 break;
624 623
625 case WLAN_EID_DS_PARAMS: 624 case WLAN_EID_DS_PARAMS:
626 pDS = (struct ieeetypes_dsparamset *) pos; 625 ds = (struct ieee_ie_ds_param_set *) pos;
627 bss->channel = pDS->currentchan; 626 bss->channel = ds->channel;
628 memcpy(&bss->phyparamset.dsparamset, pDS, 627 memcpy(&bss->phy.ds, ds, sizeof(*ds));
629 sizeof(struct ieeetypes_dsparamset));
630 lbs_deb_scan("got DS IE, channel %d\n", bss->channel); 628 lbs_deb_scan("got DS IE, channel %d\n", bss->channel);
631 break; 629 break;
632 630
633 case WLAN_EID_CF_PARAMS: 631 case WLAN_EID_CF_PARAMS:
634 pCF = (struct ieeetypes_cfparamset *) pos; 632 cf = (struct ieee_ie_cf_param_set *) pos;
635 memcpy(&bss->ssparamset.cfparamset, pCF, 633 memcpy(&bss->ss.cf, cf, sizeof(*cf));
636 sizeof(struct ieeetypes_cfparamset));
637 lbs_deb_scan("got CF IE\n"); 634 lbs_deb_scan("got CF IE\n");
638 break; 635 break;
639 636
640 case WLAN_EID_IBSS_PARAMS: 637 case WLAN_EID_IBSS_PARAMS:
641 pibss = (struct ieeetypes_ibssparamset *) pos; 638 ibss = (struct ieee_ie_ibss_param_set *) pos;
642 bss->atimwindow = le16_to_cpu(pibss->atimwindow); 639 bss->atimwindow = ibss->atimwindow;
643 memmove(&bss->ssparamset.ibssparamset, pibss, 640 memcpy(&bss->ss.ibss, ibss, sizeof(*ibss));
644 sizeof(struct ieeetypes_ibssparamset));
645 lbs_deb_scan("got IBSS IE\n"); 641 lbs_deb_scan("got IBSS IE\n");
646 break; 642 break;
647 643
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h
index de03b9c9c204..b8d2ce936046 100644
--- a/drivers/net/wireless/libertas/types.h
+++ b/drivers/net/wireless/libertas/types.h
@@ -8,7 +8,7 @@
8#include <asm/byteorder.h> 8#include <asm/byteorder.h>
9#include <linux/wireless.h> 9#include <linux/wireless.h>
10 10
11struct ieeetypes_cfparamset { 11struct ieee_ie_cf_param_set {
12 u8 elementid; 12 u8 elementid;
13 u8 len; 13 u8 len;
14 u8 cfpcnt; 14 u8 cfpcnt;
@@ -18,18 +18,18 @@ struct ieeetypes_cfparamset {
18} __attribute__ ((packed)); 18} __attribute__ ((packed));
19 19
20 20
21struct ieeetypes_ibssparamset { 21struct ieee_ie_ibss_param_set {
22 u8 elementid; 22 u8 elementid;
23 u8 len; 23 u8 len;
24 __le16 atimwindow; 24 __le16 atimwindow;
25} __attribute__ ((packed)); 25} __attribute__ ((packed));
26 26
27union IEEEtypes_ssparamset { 27union ieee_ss_param_set {
28 struct ieeetypes_cfparamset cfparamset; 28 struct ieee_ie_cf_param_set cf;
29 struct ieeetypes_ibssparamset ibssparamset; 29 struct ieee_ie_ibss_param_set ibss;
30} __attribute__ ((packed)); 30} __attribute__ ((packed));
31 31
32struct ieeetypes_fhparamset { 32struct ieee_ie_fh_param_set {
33 u8 elementid; 33 u8 elementid;
34 u8 len; 34 u8 len;
35 __le16 dwelltime; 35 __le16 dwelltime;
@@ -38,18 +38,18 @@ struct ieeetypes_fhparamset {
38 u8 hopindex; 38 u8 hopindex;
39} __attribute__ ((packed)); 39} __attribute__ ((packed));
40 40
41struct ieeetypes_dsparamset { 41struct ieee_ie_ds_param_set {
42 u8 elementid; 42 u8 elementid;
43 u8 len; 43 u8 len;
44 u8 currentchan; 44 u8 channel;
45} __attribute__ ((packed)); 45} __attribute__ ((packed));
46 46
47union ieeetypes_phyparamset { 47union ieee_phy_param_set {
48 struct ieeetypes_fhparamset fhparamset; 48 struct ieee_ie_fh_param_set fh;
49 struct ieeetypes_dsparamset dsparamset; 49 struct ieee_ie_ds_param_set ds;
50} __attribute__ ((packed)); 50} __attribute__ ((packed));
51 51
52struct ieeetypes_assocrsp { 52struct ieee_assoc_response {
53 __le16 capability; 53 __le16 capability;
54 __le16 statuscode; 54 __le16 statuscode;
55 __le16 aid; 55 __le16 aid;
@@ -149,42 +149,17 @@ struct mrvlietypes_chanlistparamset {
149 struct chanscanparamset chanscanparam[1]; 149 struct chanscanparamset chanscanparam[1];
150} __attribute__ ((packed)); 150} __attribute__ ((packed));
151 151
152struct cfparamset { 152struct mrvlietypes_cfparamset {
153 struct mrvlietypesheader header;
153 u8 cfpcnt; 154 u8 cfpcnt;
154 u8 cfpperiod; 155 u8 cfpperiod;
155 __le16 cfpmaxduration; 156 __le16 cfpmaxduration;
156 __le16 cfpdurationremaining; 157 __le16 cfpdurationremaining;
157} __attribute__ ((packed)); 158} __attribute__ ((packed));
158 159
159struct ibssparamset { 160struct mrvlietypes_dsparamset {
160 __le16 atimwindow;
161} __attribute__ ((packed));
162
163struct mrvlietypes_ssparamset {
164 struct mrvlietypesheader header;
165 union {
166 struct cfparamset cfparamset[1];
167 struct ibssparamset ibssparamset[1];
168 } cf_ibss;
169} __attribute__ ((packed));
170
171struct fhparamset {
172 __le16 dwelltime;
173 u8 hopset;
174 u8 hoppattern;
175 u8 hopindex;
176} __attribute__ ((packed));
177
178struct dsparamset {
179 u8 currentchan;
180} __attribute__ ((packed));
181
182struct mrvlietypes_phyparamset {
183 struct mrvlietypesheader header; 161 struct mrvlietypesheader header;
184 union { 162 u8 channel;
185 struct fhparamset fhparamset[1];
186 struct dsparamset dsparamset[1];
187 } fh_ds;
188} __attribute__ ((packed)); 163} __attribute__ ((packed));
189 164
190struct mrvlietypes_rsnparamset { 165struct mrvlietypes_rsnparamset {