Commit 5fd164e9 authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

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: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d77b034f
...@@ -219,11 +219,10 @@ static int lbs_adhoc_join(struct lbs_private *priv, ...@@ -219,11 +219,10 @@ static int lbs_adhoc_join(struct lbs_private *priv,
memcpy(&cmd.bss.bssid, &bss->bssid, ETH_ALEN); memcpy(&cmd.bss.bssid, &bss->bssid, ETH_ALEN);
memcpy(&cmd.bss.ssid, &bss->ssid, bss->ssid_len); memcpy(&cmd.bss.ssid, &bss->ssid, bss->ssid_len);
memcpy(&cmd.bss.phyparamset, &bss->phyparamset, memcpy(&cmd.bss.ds, &bss->phy.ds, sizeof(struct ieee_ie_ds_param_set));
sizeof(union ieeetypes_phyparamset));
memcpy(&cmd.bss.ssparamset, &bss->ssparamset, memcpy(&cmd.bss.ibss, &bss->ss.ibss,
sizeof(union IEEEtypes_ssparamset)); sizeof(struct ieee_ie_ibss_param_set));
cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 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,7 +259,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
*/ */
lbs_set_basic_rate_flags(cmd.bss.rates, ratesize); lbs_set_basic_rate_flags(cmd.bss.rates, ratesize);
cmd.bss.ssparamset.ibssparamset.atimwindow = cpu_to_le16(bss->atimwindow); cmd.bss.ibss.atimwindow = bss->atimwindow;
if (assoc_req->secinfo.wep_enabled) { if (assoc_req->secinfo.wep_enabled) {
u16 tmp = le16_to_cpu(cmd.bss.capability); u16 tmp = le16_to_cpu(cmd.bss.capability);
...@@ -343,14 +342,14 @@ static int lbs_adhoc_start(struct lbs_private *priv, ...@@ -343,14 +342,14 @@ static int lbs_adhoc_start(struct lbs_private *priv,
WARN_ON(!assoc_req->channel); WARN_ON(!assoc_req->channel);
/* set Physical parameter set */ /* set Physical parameter set */
cmd.phyparamset.dsparamset.elementid = WLAN_EID_DS_PARAMS; cmd.ds.elementid = WLAN_EID_DS_PARAMS;
cmd.phyparamset.dsparamset.len = 1; cmd.ds.len = 1;
cmd.phyparamset.dsparamset.currentchan = assoc_req->channel; cmd.ds.channel = assoc_req->channel;
/* set IBSS parameter set */ /* set IBSS parameter set */
cmd.ssparamset.ibssparamset.elementid = WLAN_EID_IBSS_PARAMS; cmd.ibss.elementid = WLAN_EID_IBSS_PARAMS;
cmd.ssparamset.ibssparamset.len = 2; cmd.ibss.len = 2;
cmd.ssparamset.ibssparamset.atimwindow = 0; cmd.ibss.atimwindow = cpu_to_le16(0);
/* set capability info */ /* set capability info */
tmpcap = WLAN_CAPABILITY_IBSS; tmpcap = WLAN_CAPABILITY_IBSS;
...@@ -1560,8 +1559,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, ...@@ -1560,8 +1559,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
u8 *pos; u8 *pos;
u16 tmpcap, tmplen; u16 tmpcap, tmplen;
struct mrvlietypes_ssidparamset *ssid; struct mrvlietypes_ssidparamset *ssid;
struct mrvlietypes_phyparamset *phy; struct mrvlietypes_dsparamset *ds;
struct mrvlietypes_ssparamset *ss; struct mrvlietypes_cfparamset *cf;
struct mrvlietypes_ratesparamset *rates; struct mrvlietypes_ratesparamset *rates;
struct mrvlietypes_rsnparamset *rsn; struct mrvlietypes_rsnparamset *rsn;
...@@ -1594,20 +1593,18 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, ...@@ -1594,20 +1593,18 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
memcpy(ssid->ssid, bss->ssid, tmplen); memcpy(ssid->ssid, bss->ssid, tmplen);
pos += sizeof(ssid->header) + tmplen; pos += sizeof(ssid->header) + tmplen;
phy = (struct mrvlietypes_phyparamset *) pos; ds = (struct mrvlietypes_dsparamset *) pos;
phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); ds->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
tmplen = sizeof(phy->fh_ds.dsparamset); ds->header.len = cpu_to_le16(1);
phy->header.len = cpu_to_le16(tmplen); ds->channel = bss->phy.ds.channel;
memcpy(&phy->fh_ds.dsparamset, pos += sizeof(ds->header) + 1;
&bss->phyparamset.dsparamset.currentchan,
tmplen); cf = (struct mrvlietypes_cfparamset *) pos;
pos += sizeof(phy->header) + tmplen; cf->header.type = cpu_to_le16(TLV_TYPE_CF);
tmplen = sizeof(*cf) - sizeof (cf->header);
ss = (struct mrvlietypes_ssparamset *) pos; cf->header.len = cpu_to_le16(tmplen);
ss->header.type = cpu_to_le16(TLV_TYPE_CF); /* IE payload should be zeroed, firmware fills it in for us */
tmplen = sizeof(ss->cf_ibss.cfparamset); pos += sizeof(*cf);
ss->header.len = cpu_to_le16(tmplen);
pos += sizeof(ss->header) + tmplen;
rates = (struct mrvlietypes_ratesparamset *) pos; rates = (struct mrvlietypes_ratesparamset *) pos;
rates->header.type = cpu_to_le16(TLV_TYPE_RATES); rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
...@@ -1643,7 +1640,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, ...@@ -1643,7 +1640,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
} }
/* update curbssparams */ /* update curbssparams */
priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; priv->curbssparams.channel = bss->phy.ds.channel;
if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { if (lbs_parse_dnld_countryinfo_11d(priv, bss)) {
ret = -1; ret = -1;
...@@ -1669,7 +1666,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv, ...@@ -1669,7 +1666,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
{ {
int ret = 0; int ret = 0;
union iwreq_data wrqu; union iwreq_data wrqu;
struct ieeetypes_assocrsp *passocrsp; struct ieee_assoc_response *passocrsp;
struct bss_descriptor *bss; struct bss_descriptor *bss;
u16 status_code; u16 status_code;
...@@ -1682,7 +1679,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv, ...@@ -1682,7 +1679,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
} }
bss = &priv->in_progress_assoc_req->bss; bss = &priv->in_progress_assoc_req->bss;
passocrsp = (struct ieeetypes_assocrsp *) &resp->params; passocrsp = (struct ieee_assoc_response *) &resp->params;
/* /*
* Older FW versions map the IEEE 802.11 Status Code in the association * Older FW versions map the IEEE 802.11 Status Code in the association
......
...@@ -340,7 +340,7 @@ struct bss_descriptor { ...@@ -340,7 +340,7 @@ struct bss_descriptor {
u32 rssi; u32 rssi;
u32 channel; u32 channel;
u16 beaconperiod; u16 beaconperiod;
u32 atimwindow; __le16 atimwindow;
/* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
u8 mode; u8 mode;
...@@ -350,8 +350,8 @@ struct bss_descriptor { ...@@ -350,8 +350,8 @@ struct bss_descriptor {
unsigned long last_scanned; unsigned long last_scanned;
union ieeetypes_phyparamset phyparamset; union ieee_phy_param_set phy;
union IEEEtypes_ssparamset ssparamset; union ieee_ss_param_set ss;
struct ieeetypes_countryinfofullset countryinfo; struct ieeetypes_countryinfofullset countryinfo;
......
...@@ -278,7 +278,7 @@ struct cmd_ds_802_11_associate { ...@@ -278,7 +278,7 @@ struct cmd_ds_802_11_associate {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_associate_rsp { struct cmd_ds_802_11_associate_rsp {
struct ieeetypes_assocrsp assocRsp; struct ieee_assoc_response response;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_set_wep { struct cmd_ds_802_11_set_wep {
...@@ -535,9 +535,11 @@ struct cmd_ds_802_11_ad_hoc_start { ...@@ -535,9 +535,11 @@ struct cmd_ds_802_11_ad_hoc_start {
u8 bsstype; u8 bsstype;
__le16 beaconperiod; __le16 beaconperiod;
u8 dtimperiod; /* Reserved on v9 and later */ u8 dtimperiod; /* Reserved on v9 and later */
union IEEEtypes_ssparamset ssparamset; struct ieee_ie_ibss_param_set ibss;
union ieeetypes_phyparamset phyparamset; u8 reserved1[4];
__le16 probedelay; struct ieee_ie_ds_param_set ds;
u8 reserved2[4];
__le16 probedelay; /* Reserved on v9 and later */
__le16 capability; __le16 capability;
u8 rates[MAX_RATES]; u8 rates[MAX_RATES];
u8 tlv_memory_size_pad[100]; u8 tlv_memory_size_pad[100];
...@@ -558,8 +560,10 @@ struct adhoc_bssdesc { ...@@ -558,8 +560,10 @@ struct adhoc_bssdesc {
u8 dtimperiod; u8 dtimperiod;
__le64 timestamp; __le64 timestamp;
__le64 localtime; __le64 localtime;
union ieeetypes_phyparamset phyparamset; struct ieee_ie_ds_param_set ds;
union IEEEtypes_ssparamset ssparamset; u8 reserved1[4];
struct ieee_ie_ibss_param_set ibss;
u8 reserved2[4];
__le16 capability; __le16 capability;
u8 rates[MAX_RATES]; u8 rates[MAX_RATES];
......
...@@ -513,10 +513,10 @@ void lbs_scan_worker(struct work_struct *work) ...@@ -513,10 +513,10 @@ void lbs_scan_worker(struct work_struct *work)
static int lbs_process_bss(struct bss_descriptor *bss, static int lbs_process_bss(struct bss_descriptor *bss,
uint8_t **pbeaconinfo, int *bytesleft) uint8_t **pbeaconinfo, int *bytesleft)
{ {
struct ieeetypes_fhparamset *pFH; struct ieee_ie_fh_param_set *fh;
struct ieeetypes_dsparamset *pDS; struct ieee_ie_ds_param_set *ds;
struct ieeetypes_cfparamset *pCF; struct ieee_ie_cf_param_set *cf;
struct ieeetypes_ibssparamset *pibss; struct ieee_ie_ibss_param_set *ibss;
DECLARE_SSID_BUF(ssid); DECLARE_SSID_BUF(ssid);
struct ieeetypes_countryinfoset *pcountryinfo; struct ieeetypes_countryinfoset *pcountryinfo;
uint8_t *pos, *end, *p; uint8_t *pos, *end, *p;
...@@ -616,32 +616,28 @@ static int lbs_process_bss(struct bss_descriptor *bss, ...@@ -616,32 +616,28 @@ static int lbs_process_bss(struct bss_descriptor *bss,
break; break;
case WLAN_EID_FH_PARAMS: case WLAN_EID_FH_PARAMS:
pFH = (struct ieeetypes_fhparamset *) pos; fh = (struct ieee_ie_fh_param_set *) pos;
memmove(&bss->phyparamset.fhparamset, pFH, memcpy(&bss->phy.fh, fh, sizeof(*fh));
sizeof(struct ieeetypes_fhparamset));
lbs_deb_scan("got FH IE\n"); lbs_deb_scan("got FH IE\n");
break; break;
case WLAN_EID_DS_PARAMS: case WLAN_EID_DS_PARAMS:
pDS = (struct ieeetypes_dsparamset *) pos; ds = (struct ieee_ie_ds_param_set *) pos;
bss->channel = pDS->currentchan; bss->channel = ds->channel;
memcpy(&bss->phyparamset.dsparamset, pDS, memcpy(&bss->phy.ds, ds, sizeof(*ds));
sizeof(struct ieeetypes_dsparamset));
lbs_deb_scan("got DS IE, channel %d\n", bss->channel); lbs_deb_scan("got DS IE, channel %d\n", bss->channel);
break; break;
case WLAN_EID_CF_PARAMS: case WLAN_EID_CF_PARAMS:
pCF = (struct ieeetypes_cfparamset *) pos; cf = (struct ieee_ie_cf_param_set *) pos;
memcpy(&bss->ssparamset.cfparamset, pCF, memcpy(&bss->ss.cf, cf, sizeof(*cf));
sizeof(struct ieeetypes_cfparamset));
lbs_deb_scan("got CF IE\n"); lbs_deb_scan("got CF IE\n");
break; break;
case WLAN_EID_IBSS_PARAMS: case WLAN_EID_IBSS_PARAMS:
pibss = (struct ieeetypes_ibssparamset *) pos; ibss = (struct ieee_ie_ibss_param_set *) pos;
bss->atimwindow = le16_to_cpu(pibss->atimwindow); bss->atimwindow = ibss->atimwindow;
memmove(&bss->ssparamset.ibssparamset, pibss, memcpy(&bss->ss.ibss, ibss, sizeof(*ibss));
sizeof(struct ieeetypes_ibssparamset));
lbs_deb_scan("got IBSS IE\n"); lbs_deb_scan("got IBSS IE\n");
break; break;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/wireless.h> #include <linux/wireless.h>
struct ieeetypes_cfparamset { struct ieee_ie_cf_param_set {
u8 elementid; u8 elementid;
u8 len; u8 len;
u8 cfpcnt; u8 cfpcnt;
...@@ -18,18 +18,18 @@ struct ieeetypes_cfparamset { ...@@ -18,18 +18,18 @@ struct ieeetypes_cfparamset {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_ibssparamset { struct ieee_ie_ibss_param_set {
u8 elementid; u8 elementid;
u8 len; u8 len;
__le16 atimwindow; __le16 atimwindow;
} __attribute__ ((packed)); } __attribute__ ((packed));
union IEEEtypes_ssparamset { union ieee_ss_param_set {
struct ieeetypes_cfparamset cfparamset; struct ieee_ie_cf_param_set cf;
struct ieeetypes_ibssparamset ibssparamset; struct ieee_ie_ibss_param_set ibss;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_fhparamset { struct ieee_ie_fh_param_set {
u8 elementid; u8 elementid;
u8 len; u8 len;
__le16 dwelltime; __le16 dwelltime;
...@@ -38,18 +38,18 @@ struct ieeetypes_fhparamset { ...@@ -38,18 +38,18 @@ struct ieeetypes_fhparamset {
u8 hopindex; u8 hopindex;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_dsparamset { struct ieee_ie_ds_param_set {
u8 elementid; u8 elementid;
u8 len; u8 len;
u8 currentchan; u8 channel;
} __attribute__ ((packed)); } __attribute__ ((packed));
union ieeetypes_phyparamset { union ieee_phy_param_set {
struct ieeetypes_fhparamset fhparamset; struct ieee_ie_fh_param_set fh;
struct ieeetypes_dsparamset dsparamset; struct ieee_ie_ds_param_set ds;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_assocrsp { struct ieee_assoc_response {
__le16 capability; __le16 capability;
__le16 statuscode; __le16 statuscode;
__le16 aid; __le16 aid;
...@@ -149,42 +149,17 @@ struct mrvlietypes_chanlistparamset { ...@@ -149,42 +149,17 @@ struct mrvlietypes_chanlistparamset {
struct chanscanparamset chanscanparam[1]; struct chanscanparamset chanscanparam[1];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cfparamset { struct mrvlietypes_cfparamset {
struct mrvlietypesheader header;
u8 cfpcnt; u8 cfpcnt;
u8 cfpperiod; u8 cfpperiod;
__le16 cfpmaxduration; __le16 cfpmaxduration;
__le16 cfpdurationremaining; __le16 cfpdurationremaining;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ibssparamset { struct mrvlietypes_dsparamset {
__le16 atimwindow;
} __attribute__ ((packed));
struct mrvlietypes_ssparamset {
struct mrvlietypesheader header;
union {
struct cfparamset cfparamset[1];
struct ibssparamset ibssparamset[1];
} cf_ibss;
} __attribute__ ((packed));
struct fhparamset {
__le16 dwelltime;
u8 hopset;
u8 hoppattern;
u8 hopindex;
} __attribute__ ((packed));
struct dsparamset {
u8 currentchan;
} __attribute__ ((packed));
struct mrvlietypes_phyparamset {
struct mrvlietypesheader header; struct mrvlietypesheader header;
union { u8 channel;
struct fhparamset fhparamset[1];
struct dsparamset dsparamset[1];
} fh_ds;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_rsnparamset { struct mrvlietypes_rsnparamset {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment