From 15ca36fb994923b454df44e5d7aa14b84ce5aee4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 27 Dec 2007 16:43:38 -0800 Subject: [LIBERTAS]: Remove last stray user of MAC_FMT. Reported by Denis V. Lunev Signed-off-by: David S. Miller --- drivers/net/wireless/libertas/debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 0bda0b51191..95dd4edf64c 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -243,7 +243,8 @@ static void libertas_parse_bssid(char *buf, size_t count, if (!hold) return; hold += 6; - sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5); + sscanf(hold, "%02x:%02x:%02x:%02x:%02x:%02x", + mac, mac+1, mac+2, mac+3, mac+4, mac+5); memcpy(scan_cfg->bssid, mac, ETH_ALEN); } -- cgit v1.2.3 From 9f9dac281ba2acd3d6d3574076f86b8f99aaebc0 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Fri, 26 Oct 2007 10:12:14 +0200 Subject: libertas: move wlan_*_association_work from header to c file Move wlan_postpone_association_work() and wlan_cancel_association_work() from a assoc.h file to the sole user, into wext.c. Renamed those two functions to to libertas_XXX as well. Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.h | 18 ------------- drivers/net/wireless/libertas/wext.c | 50 ++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index e09b7490abb..ed737eb995c 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h @@ -11,22 +11,4 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter); void libertas_sync_channel(struct work_struct *work); -#define ASSOC_DELAY (HZ / 2) -static inline void wlan_postpone_association_work(wlan_private *priv) -{ - if (priv->adapter->surpriseremoved) - return; - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, ASSOC_DELAY); -} - -static inline void wlan_cancel_association_work(wlan_private *priv) -{ - cancel_delayed_work(&priv->assoc_work); - if (priv->adapter->pending_assoc_req) { - kfree(priv->adapter->pending_assoc_req); - priv->adapter->pending_assoc_req = NULL; - } -} - #endif /* _WLAN_ASSOC_H */ diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 395b7882d4d..135116d9070 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -21,6 +21,24 @@ #include "assoc.h" +static inline void libertas_postpone_association_work(wlan_private *priv) +{ + if (priv->adapter->surpriseremoved) + return; + cancel_delayed_work(&priv->assoc_work); + queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); +} + +static inline void libertas_cancel_association_work(wlan_private *priv) +{ + cancel_delayed_work(&priv->assoc_work); + if (priv->adapter->pending_assoc_req) { + kfree(priv->adapter->pending_assoc_req); + priv->adapter->pending_assoc_req = NULL; + } +} + + /** * @brief Find the channel frequency power info with specific channel * @@ -949,9 +967,9 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, out: if (ret == 0) { set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } else { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1050,11 +1068,11 @@ static int wlan_set_mode(struct net_device *dev, assoc_req = wlan_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } else { assoc_req->mode = *uwrq; set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); } mutex_unlock(&adapter->lock); @@ -1335,9 +1353,9 @@ static int wlan_set_encode(struct net_device *dev, out: if (ret == 0) { set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } else { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1576,9 +1594,9 @@ static int wlan_set_encodeext(struct net_device *dev, out: if (ret == 0) { - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } else { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1623,9 +1641,9 @@ static int wlan_set_genie(struct net_device *dev, out: if (ret == 0) { set_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } else { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1752,9 +1770,9 @@ out: if (ret == 0) { if (updated) set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } else if (ret != -EOPNOTSUPP) { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1929,13 +1947,13 @@ out: memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); assoc_req->ssid_len = ssid_len; set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } } /* Cancel the association request if there was an error */ if (ret != 0) { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1974,13 +1992,13 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, /* Get or create the current association request */ assoc_req = wlan_get_association_request(adapter); if (!assoc_req) { - wlan_cancel_association_work(priv); + libertas_cancel_association_work(priv); ret = -ENOMEM; } else { /* Copy the BSSID to the association request */ memcpy(&assoc_req->bssid, awrq->sa_data, ETH_ALEN); set_bit(ASSOC_FLAG_BSSID, &assoc_req->flags); - wlan_postpone_association_work(priv); + libertas_postpone_association_work(priv); } mutex_unlock(&adapter->lock); -- cgit v1.2.3 From f59d9782751bf1a2c51e7e1e9f614ffec35fb52e Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Fri, 26 Oct 2007 21:51:26 +0200 Subject: wireless: fix '!x & y' typo's Fix priority mistakes similar to '!x & y' Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 135116d9070..4dec5e5565b 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -1398,7 +1398,7 @@ static int wlan_get_encodeext(struct net_device *dev, index = adapter->wep_tx_keyidx; } - if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && + if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && ext->alg != IW_ENCODE_ALG_WEP) { if (index != 0 || adapter->mode != IW_MODE_INFRA) goto out; -- cgit v1.2.3 From c00acf46deb18926931ba264510353cf22b98a79 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Ruiz Date: Thu, 18 Oct 2007 10:16:33 +0200 Subject: netdev: ARRAY_SIZE() cleanups Convert array size calculations to use ARRAY_SIZE(). Signed-off-by: Alejandro Martinez Ruiz Signed-off-by: Jeff Garzik --- drivers/net/wireless/libertas/11d.c | 24 +++++++----------------- drivers/net/wireless/libertas/wext.c | 11 +++-------- 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 9cf0211de67..8bbd3227e6f 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -46,13 +46,11 @@ static struct chan_freq_power channel_freq_power_UN_BG[] = { static u8 wlan_region_2_code(u8 * region) { u8 i; - u8 size = sizeof(region_code_mapping)/ - sizeof(struct region_code_mapping); for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++) region[i] = toupper(region[i]); - for (i = 0; i < size; i++) { + for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { if (!memcmp(region, region_code_mapping[i].region, COUNTRY_CODE_LEN)) return (region_code_mapping[i].code); @@ -65,9 +63,8 @@ static u8 wlan_region_2_code(u8 * region) static u8 *wlan_code_2_region(u8 code) { u8 i; - u8 size = sizeof(region_code_mapping) - / sizeof(struct region_code_mapping); - for (i = 0; i < size; i++) { + + for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { if (region_code_mapping[i].code == code) return (region_code_mapping[i].region); } @@ -90,8 +87,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan) u8 cfp_no; cfp = channel_freq_power_UN_BG; - cfp_no = sizeof(channel_freq_power_UN_BG) / - sizeof(struct chan_freq_power); + cfp_no = ARRAY_SIZE(channel_freq_power_UN_BG); for (i = 0; i < cfp_no; i++) { if ((cfp + i)->channel == firstchan) { @@ -141,16 +137,12 @@ static u8 wlan_channel_known_11d(u8 chan, u32 libertas_chan_2_freq(u8 chan, u8 band) { struct chan_freq_power *cf; - u16 cnt; u16 i; u32 freq = 0; cf = channel_freq_power_UN_BG; - cnt = - sizeof(channel_freq_power_UN_BG) / - sizeof(struct chan_freq_power); - for (i = 0; i < cnt; i++) { + for (i = 0; i < ARRAY_SIZE(channel_freq_power_UN_BG); i++) { if (chan == cf[i].channel) freq = cf[i].freq; } @@ -664,8 +656,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) if (priv->adapter->enable11d) { /* update parsed_region_chan_11; dnld domaininf to FW */ - for (j = 0; j < sizeof(adapter->region_channel) / - sizeof(adapter->region_channel[0]); j++) { + for (j = 0; j < ARRAY_SIZE(adapter->region_channel); j++) { region_chan = &adapter->region_channel[j]; lbs_deb_11d("%d region_chan->band %d\n", j, @@ -679,8 +670,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) break; } - if (j >= sizeof(adapter->region_channel) / - sizeof(adapter->region_channel[0])) { + if (j >= ARRAY_SIZE(adapter->region_channel)) { lbs_deb_11d("region_chan not found, band %d\n", adapter->curbssparams.band); ret = -1; diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 4dec5e5565b..4ef5b9e00c7 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -52,11 +52,9 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada { struct chan_freq_power *cfp = NULL; struct region_channel *rc; - int count = sizeof(adapter->region_channel) / - sizeof(adapter->region_channel[0]); int i, j; - for (j = 0; !cfp && (j < count); j++) { + for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { rc = &adapter->region_channel[j]; if (adapter->enable11d) @@ -93,11 +91,9 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter, { struct chan_freq_power *cfp = NULL; struct region_channel *rc; - int count = sizeof(adapter->region_channel) / - sizeof(adapter->region_channel[0]); int i, j; - for (j = 0; !cfp && (j < count); j++) { + for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { rc = &adapter->region_channel[j]; if (adapter->enable11d) @@ -624,8 +620,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, } if (!flag) { for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && (j < sizeof(adapter->region_channel) - / sizeof(adapter->region_channel[0])); j++) { + && (j < ARRAY_SIZE(adapter->region_channel)); j++) { cfp = adapter->region_channel[j].CFP; for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) && adapter->region_channel[j].valid -- cgit v1.2.3 From 28fc1f5a0c375cb6375fa48e9a8b393f2a189be6 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 29 Oct 2007 05:46:16 -0400 Subject: [netdrvr] irq handler minor cleanups in several drivers * use irq_handler_t where appropriate * no need to use 'irq' function arg, its already stored in a data struct * rename irq handler 'irq' argument to 'dummy', where the function has been analyzed and proven not to use its first argument. * remove always-false "dev_id == NULL" test from irq handlers * remove pointless casts from void* * declance: irq argument is not const * add KERN_xxx printk prefix * fix minor whitespace weirdness Signed-off-by: Jeff Garzik --- drivers/net/wireless/libertas/if_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index ba4fc2b3bf0..d383c0f9fe3 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -243,7 +243,7 @@ static inline void if_cs_disable_ints(struct if_cs_card *card) static irqreturn_t if_cs_interrupt(int irq, void *data) { - struct if_cs_card *card = (struct if_cs_card *)data; + struct if_cs_card *card = data; u16 int_cause; lbs_deb_enter(LBS_DEB_CS); -- cgit v1.2.3 From 93a3b607e6eff7880959149a581d90c71887eb19 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 23 Nov 2007 21:50:20 -0500 Subject: wireless: checkpatch cleanups Signed-off-by: Jeff Garzik --- drivers/net/wireless/libertas/wext.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 4ef5b9e00c7..19c2873d2d7 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -32,10 +32,8 @@ static inline void libertas_postpone_association_work(wlan_private *priv) static inline void libertas_cancel_association_work(wlan_private *priv) { cancel_delayed_work(&priv->assoc_work); - if (priv->adapter->pending_assoc_req) { - kfree(priv->adapter->pending_assoc_req); - priv->adapter->pending_assoc_req = NULL; - } + kfree(priv->adapter->pending_assoc_req); + priv->adapter->pending_assoc_req = NULL; } -- cgit v1.2.3 From 1007832103d016d1563fab71d4cf2b057a0bcceb Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 15 Nov 2007 18:05:47 -0500 Subject: libertas: move to uniform lbs_/LBS_ namespace This patch unifies the namespace of variables, functions defines and structures. It does: - rename libertas_XXX to lbs_XXX - rename LIBERTAS_XXX to lbs_XXX - rename wlan_XXX to lbs_XXX - rename WLAN_XXX to LBS_XXX (but only those that were defined in libertas-local *.h files, e.g. not defines from net/ieee80211.h) While passing, I fixed some checkpatch.pl errors too. Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/11d.c | 72 ++--- drivers/net/wireless/libertas/11d.h | 24 +- drivers/net/wireless/libertas/assoc.c | 120 ++++---- drivers/net/wireless/libertas/assoc.h | 12 +- drivers/net/wireless/libertas/cmd.c | 274 ++++++++--------- drivers/net/wireless/libertas/cmdresp.c | 174 +++++------ drivers/net/wireless/libertas/debugfs.c | 402 ++++++++++++------------ drivers/net/wireless/libertas/debugfs.h | 12 +- drivers/net/wireless/libertas/decl.h | 84 ++--- drivers/net/wireless/libertas/defs.h | 54 ++-- drivers/net/wireless/libertas/dev.h | 42 +-- drivers/net/wireless/libertas/ethtool.c | 52 ++-- drivers/net/wireless/libertas/host.h | 6 +- drivers/net/wireless/libertas/hostcmd.h | 12 +- drivers/net/wireless/libertas/if_cs.c | 42 +-- drivers/net/wireless/libertas/if_sdio.c | 46 +-- drivers/net/wireless/libertas/if_sdio.h | 4 +- drivers/net/wireless/libertas/if_usb.c | 86 +++--- drivers/net/wireless/libertas/if_usb.h | 4 +- drivers/net/wireless/libertas/join.c | 130 ++++---- drivers/net/wireless/libertas/join.h | 38 +-- drivers/net/wireless/libertas/main.c | 528 ++++++++++++++++---------------- drivers/net/wireless/libertas/rx.c | 66 ++-- drivers/net/wireless/libertas/scan.c | 184 +++++------ drivers/net/wireless/libertas/scan.h | 86 +++--- drivers/net/wireless/libertas/tx.c | 38 +-- drivers/net/wireless/libertas/types.h | 6 +- drivers/net/wireless/libertas/wext.c | 476 ++++++++++++++-------------- drivers/net/wireless/libertas/wext.h | 14 +- 29 files changed, 1546 insertions(+), 1542 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 8bbd3227e6f..d16f566e878 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -43,7 +43,7 @@ static struct chan_freq_power channel_freq_power_UN_BG[] = { {14, 2484, TX_PWR_DEFAULT} }; -static u8 wlan_region_2_code(u8 * region) +static u8 lbs_region_2_code(u8 *region) { u8 i; @@ -60,7 +60,7 @@ static u8 wlan_region_2_code(u8 * region) return (region_code_mapping[0].code); } -static u8 *wlan_code_2_region(u8 code) +static u8 *lbs_code_2_region(u8 code) { u8 i; @@ -79,7 +79,7 @@ static u8 *wlan_code_2_region(u8 code) * @param nrchan number of channels * @return the nrchan-th chan number */ -static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan) +static u8 lbs_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 *chan) /*find the nrchan-th chan after the firstchan*/ { u8 i; @@ -113,7 +113,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan) * @param parsed_region_chan pointer to parsed_region_chan_11d * @return TRUE; FALSE */ -static u8 wlan_channel_known_11d(u8 chan, +static u8 lbs_channel_known_11d(u8 chan, struct parsed_region_chan_11d * parsed_region_chan) { struct chan_power_11d *chanpwr = parsed_region_chan->chanpwr; @@ -134,7 +134,7 @@ static u8 wlan_channel_known_11d(u8 chan, return 0; } -u32 libertas_chan_2_freq(u8 chan, u8 band) +u32 lbs_chan_2_freq(u8 chan, u8 band) { struct chan_freq_power *cf; u16 i; @@ -152,7 +152,7 @@ u32 libertas_chan_2_freq(u8 chan, u8 band) static int generate_domain_info_11d(struct parsed_region_chan_11d *parsed_region_chan, - struct wlan_802_11d_domain_reg * domaininfo) + struct lbs_802_11d_domain_reg *domaininfo) { u8 nr_subband = 0; @@ -217,7 +217,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d * @param *parsed_region_chan pointer to parsed_region_chan_11d * @return N/A */ -static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_chan, +static void lbs_generate_parsed_region_chan_11d(struct region_channel *region_chan, struct parsed_region_chan_11d * parsed_region_chan) { @@ -238,7 +238,7 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_ parsed_region_chan->band = region_chan->band; parsed_region_chan->region = region_chan->region; memcpy(parsed_region_chan->countrycode, - wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN); + lbs_code_2_region(region_chan->region), COUNTRY_CODE_LEN); lbs_deb_11d("region 0x%x, band %d\n", parsed_region_chan->region, parsed_region_chan->band); @@ -264,7 +264,7 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_ * @param chan chan * @return TRUE;FALSE */ -static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan) +static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan) { struct chan_freq_power *cfp; int cfp_no; @@ -273,7 +273,7 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan) lbs_deb_enter(LBS_DEB_11D); - cfp = libertas_get_region_cfp_table(region, band, &cfp_no); + cfp = lbs_get_region_cfp_table(region, band, &cfp_no); if (cfp == NULL) return 0; @@ -338,7 +338,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* /*Step1: check region_code */ parsed_region_chan->region = region = - wlan_region_2_code(countryinfo->countrycode); + lbs_region_2_code(countryinfo->countrycode); lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region); lbs_deb_hex(LBS_DEB_11D, "countrycode", (char *)countryinfo->countrycode, @@ -367,7 +367,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) { /*step4: channel is supported? */ - if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) { + if (!lbs_get_chan_11d(band, firstchan, i, &curchan)) { /* Chan is not found in UN table */ lbs_deb_11d("chan is not supported: %d \n", i); break; @@ -375,7 +375,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* lastchan = curchan; - if (wlan_region_chan_supported_11d + if (lbs_region_chan_supported_11d (region, band, curchan)) { /*step5: Check if curchan is supported by mrvl in region */ parsed_region_chan->chanpwr[idx].chan = curchan; @@ -411,14 +411,14 @@ done: * @param parsed_region_chan pointer to parsed_region_chan_11d * @return PASSIVE if chan is unknown; ACTIVE if chan is known */ -u8 libertas_get_scan_type_11d(u8 chan, +u8 lbs_get_scan_type_11d(u8 chan, struct parsed_region_chan_11d * parsed_region_chan) { u8 scan_type = CMD_SCAN_TYPE_PASSIVE; lbs_deb_enter(LBS_DEB_11D); - if (wlan_channel_known_11d(chan, parsed_region_chan)) { + if (lbs_channel_known_11d(chan, parsed_region_chan)) { lbs_deb_11d("found, do active scan\n"); scan_type = CMD_SCAN_TYPE_ACTIVE; } else { @@ -430,7 +430,7 @@ u8 libertas_get_scan_type_11d(u8 chan, } -void libertas_init_11d(wlan_private * priv) +void lbs_init_11d(lbs_private * priv) { priv->adapter->enable11d = 0; memset(&(priv->adapter->parsed_region_chan), 0, @@ -440,10 +440,10 @@ void libertas_init_11d(wlan_private * priv) /** * @brief This function sets DOMAIN INFO to FW - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @return 0; -1 */ -static int set_domain_info_11d(wlan_private * priv) +static int set_domain_info_11d(lbs_private * priv) { int ret; @@ -452,7 +452,7 @@ static int set_domain_info_11d(wlan_private * priv) return 0; } - ret = libertas_prepare_and_send_command(priv, CMD_802_11D_DOMAIN_INFO, + ret = lbs_prepare_and_send_command(priv, CMD_802_11D_DOMAIN_INFO, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, NULL); if (ret) @@ -463,13 +463,13 @@ static int set_domain_info_11d(wlan_private * priv) /** * @brief This function setups scan channels - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @param band band * @return 0 */ -int libertas_set_universaltable(wlan_private * priv, u8 band) +int lbs_set_universaltable(lbs_private * priv, u8 band) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u16 size = sizeof(struct chan_freq_power); u16 i = 0; @@ -492,20 +492,20 @@ int libertas_set_universaltable(wlan_private * priv, u8 band) /** * @brief This function implements command CMD_802_11D_DOMAIN_INFO - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @param cmd pointer to cmd buffer * @param cmdno cmd ID * @param cmdOption cmd action * @return 0 */ -int libertas_cmd_802_11d_domain_info(wlan_private * priv, +int lbs_cmd_802_11d_domain_info(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmdno, u16 cmdoption) { struct cmd_ds_802_11d_domain_info *pdomaininfo = &cmd->params.domaininfo; struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u8 nr_subband = adapter->domainreg.nr_subband; lbs_deb_enter(LBS_DEB_11D); @@ -552,11 +552,11 @@ done: /** * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @param resp pointer to command response buffer * @return 0; -1 */ -int libertas_ret_802_11d_domain_info(wlan_private * priv, +int lbs_ret_802_11d_domain_info(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; @@ -598,14 +598,14 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv, /** * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @return 0; -1 */ -int libertas_parse_dnld_countryinfo_11d(wlan_private * priv, +int lbs_parse_dnld_countryinfo_11d(lbs_private * priv, struct bss_descriptor * bss) { int ret; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_11D); if (priv->adapter->enable11d) { @@ -620,7 +620,7 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv, } memset(&adapter->domainreg, 0, - sizeof(struct wlan_802_11d_domain_reg)); + sizeof(struct lbs_802_11d_domain_reg)); generate_domain_info_11d(&adapter->parsed_region_chan, &adapter->domainreg); @@ -640,13 +640,13 @@ done: /** * @brief This function generates 11D info from user specified regioncode and download to FW - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @return 0; -1 */ -int libertas_create_dnld_countryinfo_11d(wlan_private * priv) +int lbs_create_dnld_countryinfo_11d(lbs_private * priv) { int ret; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct region_channel *region_chan; u8 j; @@ -679,12 +679,12 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) memset(&adapter->parsed_region_chan, 0, sizeof(struct parsed_region_chan_11d)); - wlan_generate_parsed_region_chan_11d(region_chan, + lbs_generate_parsed_region_chan_11d(region_chan, &adapter-> parsed_region_chan); memset(&adapter->domainreg, 0, - sizeof(struct wlan_802_11d_domain_reg)); + sizeof(struct lbs_802_11d_domain_reg)); generate_domain_info_11d(&adapter->parsed_region_chan, &adapter->domainreg); diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h index 3a6d1f8db78..4f7f0deb6c8 100644 --- a/drivers/net/wireless/libertas/11d.h +++ b/drivers/net/wireless/libertas/11d.h @@ -2,8 +2,8 @@ * This header file contains data structures and * function declarations of 802.11d */ -#ifndef _WLAN_11D_ -#define _WLAN_11D_ +#ifndef _LBS_11D_ +#define _LBS_11D_ #include "types.h" #include "defs.h" @@ -52,7 +52,7 @@ struct cmd_ds_802_11d_domain_info { } __attribute__ ((packed)); /** domain regulatory information */ -struct wlan_802_11d_domain_reg { +struct lbs_802_11d_domain_reg { /** country Code*/ u8 countrycode[COUNTRY_CODE_LEN]; /** No. of subband*/ @@ -78,26 +78,26 @@ struct region_code_mapping { u8 code; }; -u8 libertas_get_scan_type_11d(u8 chan, +u8 lbs_get_scan_type_11d(u8 chan, struct parsed_region_chan_11d *parsed_region_chan); -u32 libertas_chan_2_freq(u8 chan, u8 band); +u32 lbs_chan_2_freq(u8 chan, u8 band); -void libertas_init_11d(wlan_private * priv); +void lbs_init_11d(lbs_private * priv); -int libertas_set_universaltable(wlan_private * priv, u8 band); +int lbs_set_universaltable(lbs_private * priv, u8 band); -int libertas_cmd_802_11d_domain_info(wlan_private * priv, +int lbs_cmd_802_11d_domain_info(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmdno, u16 cmdOption); -int libertas_ret_802_11d_domain_info(wlan_private * priv, +int lbs_ret_802_11d_domain_info(lbs_private * priv, struct cmd_ds_command *resp); struct bss_descriptor; -int libertas_parse_dnld_countryinfo_11d(wlan_private * priv, +int lbs_parse_dnld_countryinfo_11d(lbs_private * priv, struct bss_descriptor * bss); -int libertas_create_dnld_countryinfo_11d(wlan_private * priv); +int lbs_create_dnld_countryinfo_11d(lbs_private * priv); -#endif /* _WLAN_11D_ */ +#endif diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index b61b176e9d0..e52b1eead28 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -38,10 +38,10 @@ static void print_assoc_req(const char * extra, struct assoc_request * assoc_req } -static int assoc_helper_essid(wlan_private *priv, +static int assoc_helper_essid(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; int channel = -1; @@ -58,15 +58,15 @@ static int assoc_helper_essid(wlan_private *priv, lbs_deb_assoc("New SSID requested: '%s'\n", escape_essid(assoc_req->ssid, assoc_req->ssid_len)); if (assoc_req->mode == IW_MODE_INFRA) { - libertas_send_specific_ssid_scan(priv, assoc_req->ssid, + lbs_send_specific_ssid_scan(priv, assoc_req->ssid, assoc_req->ssid_len, 0); - bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid, + bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); if (bss != NULL) { lbs_deb_assoc("SSID found in scan list, associating\n"); memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); - ret = wlan_associate(priv, assoc_req); + ret = lbs_associate(priv, assoc_req); } else { lbs_deb_assoc("SSID not found; cannot associate\n"); } @@ -74,23 +74,23 @@ static int assoc_helper_essid(wlan_private *priv, /* Scan for the network, do not save previous results. Stale * scan data will cause us to join a non-existant adhoc network */ - libertas_send_specific_ssid_scan(priv, assoc_req->ssid, + lbs_send_specific_ssid_scan(priv, assoc_req->ssid, assoc_req->ssid_len, 1); /* Search for the requested SSID in the scan table */ - bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid, + bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel); if (bss != NULL) { lbs_deb_assoc("SSID found, will join\n"); memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); - libertas_join_adhoc_network(priv, assoc_req); + lbs_join_adhoc_network(priv, assoc_req); } else { /* else send START command */ lbs_deb_assoc("SSID not found, creating adhoc network\n"); memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, IW_ESSID_MAX_SIZE); assoc_req->bss.ssid_len = assoc_req->ssid_len; - libertas_start_adhoc_network(priv, assoc_req); + lbs_start_adhoc_network(priv, assoc_req); } } @@ -99,10 +99,10 @@ static int assoc_helper_essid(wlan_private *priv, } -static int assoc_helper_bssid(wlan_private *priv, +static int assoc_helper_bssid(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; DECLARE_MAC_BUF(mac); @@ -111,7 +111,7 @@ static int assoc_helper_bssid(wlan_private *priv, print_mac(mac, assoc_req->bssid)); /* Search for index position in list for requested MAC */ - bss = libertas_find_bssid_in_list(adapter, assoc_req->bssid, + bss = lbs_find_bssid_in_list(adapter, assoc_req->bssid, assoc_req->mode); if (bss == NULL) { lbs_deb_assoc("ASSOC: WAP: BSSID %s not found, " @@ -121,10 +121,10 @@ static int assoc_helper_bssid(wlan_private *priv, memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); if (assoc_req->mode == IW_MODE_INFRA) { - ret = wlan_associate(priv, assoc_req); - lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret); + ret = lbs_associate(priv, assoc_req); + lbs_deb_assoc("ASSOC: lbs_associate(bssid) returned %d\n", ret); } else if (assoc_req->mode == IW_MODE_ADHOC) { - libertas_join_adhoc_network(priv, assoc_req); + lbs_join_adhoc_network(priv, assoc_req); } out: @@ -133,7 +133,7 @@ out: } -static int assoc_helper_associate(wlan_private *priv, +static int assoc_helper_associate(lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0, done = 0; @@ -162,10 +162,10 @@ static int assoc_helper_associate(wlan_private *priv, } -static int assoc_helper_mode(wlan_private *priv, +static int assoc_helper_mode(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -175,12 +175,12 @@ static int assoc_helper_mode(wlan_private *priv, if (assoc_req->mode == IW_MODE_INFRA) { if (adapter->psstate != PS_STATE_FULL_POWER) - libertas_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - adapter->psmode = WLAN802_11POWERMODECAM; + lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); + adapter->psmode = LBS802_11POWERMODECAM; } adapter->mode = assoc_req->mode; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, 0, CMD_OPTION_WAITFORRSP, OID_802_11_INFRASTRUCTURE_MODE, @@ -192,26 +192,26 @@ done: } -static int update_channel(wlan_private * priv) +static int update_channel(lbs_private * priv) { /* the channel in f/w could be out of sync, get the current channel */ - return libertas_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, + return lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, CMD_OPT_802_11_RF_CHANNEL_GET, CMD_OPTION_WAITFORRSP, 0, NULL); } -void libertas_sync_channel(struct work_struct *work) +void lbs_sync_channel(struct work_struct *work) { - wlan_private *priv = container_of(work, wlan_private, sync_channel); + lbs_private *priv = container_of(work, lbs_private, sync_channel); if (update_channel(priv) != 0) lbs_pr_info("Channel synchronization failed."); } -static int assoc_helper_channel(wlan_private *priv, +static int assoc_helper_channel(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -227,7 +227,7 @@ static int assoc_helper_channel(wlan_private *priv, lbs_deb_assoc("ASSOC: channel: %d -> %d\n", adapter->curbssparams.channel, assoc_req->channel); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, CMD_OPT_802_11_RF_CHANNEL_SET, CMD_OPTION_WAITFORRSP, 0, &assoc_req->channel); if (ret < 0) { @@ -263,10 +263,10 @@ done: } -static int assoc_helper_wep_keys(wlan_private *priv, +static int assoc_helper_wep_keys(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int i; int ret = 0; @@ -277,13 +277,13 @@ static int assoc_helper_wep_keys(wlan_private *priv, || assoc_req->wep_keys[1].len || assoc_req->wep_keys[2].len || assoc_req->wep_keys[3].len) { - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SET_WEP, CMD_ACT_ADD, CMD_OPTION_WAITFORRSP, 0, assoc_req); } else { - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SET_WEP, CMD_ACT_REMOVE, CMD_OPTION_WAITFORRSP, @@ -298,7 +298,7 @@ static int assoc_helper_wep_keys(wlan_private *priv, adapter->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; else adapter->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; - ret = libertas_set_mac_packet_filter(priv); + ret = lbs_set_mac_packet_filter(priv); if (ret) goto out; @@ -318,10 +318,10 @@ out: return ret; } -static int assoc_helper_secinfo(wlan_private *priv, +static int assoc_helper_secinfo(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; u32 do_wpa; u32 rsn = 0; @@ -329,9 +329,9 @@ static int assoc_helper_secinfo(wlan_private *priv, lbs_deb_enter(LBS_DEB_ASSOC); memcpy(&adapter->secinfo, &assoc_req->secinfo, - sizeof(struct wlan_802_11_security)); + sizeof(struct lbs_802_11_security)); - ret = libertas_set_mac_packet_filter(priv); + ret = lbs_set_mac_packet_filter(priv); if (ret) goto out; @@ -341,7 +341,7 @@ static int assoc_helper_secinfo(wlan_private *priv, */ /* Get RSN enabled/disabled */ - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_ENABLE_RSN, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, @@ -358,7 +358,7 @@ static int assoc_helper_secinfo(wlan_private *priv, /* Set RSN enabled/disabled */ rsn = do_wpa; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_ENABLE_RSN, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, @@ -370,7 +370,7 @@ out: } -static int assoc_helper_wpa_keys(wlan_private *priv, +static int assoc_helper_wpa_keys(lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0; @@ -385,7 +385,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv, if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { clear_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_KEY_MATERIAL, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, @@ -399,7 +399,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv, if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { clear_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_KEY_MATERIAL, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, @@ -413,10 +413,10 @@ out: } -static int assoc_helper_wpa_ie(wlan_private *priv, +static int assoc_helper_wpa_ie(lbs_private *priv, struct assoc_request * assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -434,10 +434,10 @@ static int assoc_helper_wpa_ie(wlan_private *priv, } -static int should_deauth_infrastructure(wlan_adapter *adapter, +static int should_deauth_infrastructure(lbs_adapter *adapter, struct assoc_request * assoc_req) { - if (adapter->connect_status != LIBERTAS_CONNECTED) + if (adapter->connect_status != LBS_CONNECTED) return 0; if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { @@ -475,13 +475,13 @@ static int should_deauth_infrastructure(wlan_adapter *adapter, } -static int should_stop_adhoc(wlan_adapter *adapter, +static int should_stop_adhoc(lbs_adapter *adapter, struct assoc_request * assoc_req) { - if (adapter->connect_status != LIBERTAS_CONNECTED) + if (adapter->connect_status != LBS_CONNECTED) return 0; - if (libertas_ssid_cmp(adapter->curbssparams.ssid, + if (lbs_ssid_cmp(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len, assoc_req->ssid, assoc_req->ssid_len) != 0) return 1; @@ -501,10 +501,10 @@ static int should_stop_adhoc(wlan_adapter *adapter, } -void libertas_association_worker(struct work_struct *work) +void lbs_association_worker(struct work_struct *work) { - wlan_private *priv = container_of(work, wlan_private, assoc_work.work); - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = container_of(work, lbs_private, assoc_work.work); + lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req = NULL; int ret = 0; int find_any_ssid = 0; @@ -538,7 +538,7 @@ void libertas_association_worker(struct work_struct *work) if (find_any_ssid) { u8 new_mode; - ret = libertas_find_best_network_ssid(priv, assoc_req->ssid, + ret = lbs_find_best_network_ssid(priv, assoc_req->ssid, &assoc_req->ssid_len, assoc_req->mode, &new_mode); if (ret) { lbs_deb_assoc("Could not find best network\n"); @@ -559,7 +559,7 @@ void libertas_association_worker(struct work_struct *work) */ if (adapter->mode == IW_MODE_INFRA) { if (should_deauth_infrastructure(adapter, assoc_req)) { - ret = libertas_send_deauthentication(priv); + ret = lbs_send_deauthentication(priv); if (ret) { lbs_deb_assoc("Deauthentication due to new " "configuration request failed: %d\n", @@ -568,7 +568,7 @@ void libertas_association_worker(struct work_struct *work) } } else if (adapter->mode == IW_MODE_ADHOC) { if (should_stop_adhoc(adapter, assoc_req)) { - ret = libertas_stop_adhoc_network(priv); + ret = lbs_stop_adhoc_network(priv); if (ret) { lbs_deb_assoc("Teardown of AdHoc network due to " "new configuration request failed: %d\n", @@ -649,7 +649,7 @@ void libertas_association_worker(struct work_struct *work) success = 0; } - if (adapter->connect_status != LIBERTAS_CONNECTED) { + if (adapter->connect_status != LBS_CONNECTED) { lbs_deb_assoc("ASSOC: association attempt unsuccessful, " "not connected.\n"); success = 0; @@ -661,11 +661,11 @@ void libertas_association_worker(struct work_struct *work) escape_essid(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len), print_mac(mac, adapter->curbssparams.bssid)); - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, CMD_OPTION_WAITFORRSP, 0, NULL); - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } else { @@ -692,7 +692,7 @@ done: /* * Caller MUST hold any necessary locks */ -struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) +struct assoc_request *lbs_get_association_request(lbs_adapter *adapter) { struct assoc_request * assoc_req; @@ -753,7 +753,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { memcpy(&assoc_req->secinfo, &adapter->secinfo, - sizeof(struct wlan_802_11_security)); + sizeof(struct lbs_802_11_security)); } if (!test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index ed737eb995c..462931cbf3b 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h @@ -1,14 +1,14 @@ /* Copyright (C) 2006, Red Hat, Inc. */ -#ifndef _WLAN_ASSOC_H_ -#define _WLAN_ASSOC_H_ +#ifndef _LBS_ASSOC_H_ +#define _LBS_ASSOC_H_ #include "dev.h" -void libertas_association_worker(struct work_struct *work); +void lbs_association_worker(struct work_struct *work); -struct assoc_request * wlan_get_association_request(wlan_adapter *adapter); +struct assoc_request * lbs_get_association_request(lbs_adapter *adapter); -void libertas_sync_channel(struct work_struct *work); +void lbs_sync_channel(struct work_struct *work); -#endif /* _WLAN_ASSOC_H */ +#endif /* _LBS_ASSOC_H */ diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index be5cfd8402c..5b2a1c7c5f0 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -37,7 +37,7 @@ static u8 is_command_allowed_in_ps(__le16 command) return 0; } -static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd) +static int lbs_cmd_hw_spec(lbs_private * priv, struct cmd_ds_command *cmd) { struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; @@ -51,7 +51,7 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd) return 0; } -static int wlan_cmd_802_11_ps_mode(wlan_private * priv, +static int lbs_cmd_802_11_ps_mode(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { @@ -90,7 +90,7 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv, +static int lbs_cmd_802_11_inactivity_timeout(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -114,11 +114,11 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_sleep_params(wlan_private * priv, +static int lbs_cmd_802_11_sleep_params(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; lbs_deb_enter(LBS_DEB_CMD); @@ -145,13 +145,13 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_set_wep(wlan_private * priv, +static int lbs_cmd_802_11_set_wep(lbs_private * priv, struct cmd_ds_command *cmd, u32 cmd_act, void * pdata_buf) { struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -219,7 +219,7 @@ done: return ret; } -static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, +static int lbs_cmd_802_11_enable_rsn(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void * pdata_buf) @@ -272,7 +272,7 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, lbs_deb_leave(LBS_DEB_CMD); } -static int wlan_cmd_802_11_key_material(wlan_private * priv, +static int lbs_cmd_802_11_key_material(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, void *pdata_buf) @@ -319,7 +319,7 @@ done: return ret; } -static int wlan_cmd_802_11_reset(wlan_private * priv, +static int lbs_cmd_802_11_reset(lbs_private * priv, struct cmd_ds_command *cmd, int cmd_action) { struct cmd_ds_802_11_reset *reset = &cmd->params.reset; @@ -334,7 +334,7 @@ static int wlan_cmd_802_11_reset(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_get_log(wlan_private * priv, +static int lbs_cmd_802_11_get_log(lbs_private * priv, struct cmd_ds_command *cmd) { lbs_deb_enter(LBS_DEB_CMD); @@ -346,7 +346,7 @@ static int wlan_cmd_802_11_get_log(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_get_stat(wlan_private * priv, +static int lbs_cmd_802_11_get_stat(lbs_private * priv, struct cmd_ds_command *cmd) { lbs_deb_enter(LBS_DEB_CMD); @@ -358,13 +358,13 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, +static int lbs_cmd_802_11_snmp_mib(lbs_private * priv, struct cmd_ds_command *cmd, int cmd_action, int cmd_oid, void *pdata_buf) { struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u8 ucTemp; lbs_deb_enter(LBS_DEB_CMD); @@ -479,11 +479,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_radio_control(wlan_private * priv, +static int lbs_cmd_802_11_radio_control(lbs_private * priv, struct cmd_ds_command *cmd, int cmd_action) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; lbs_deb_enter(LBS_DEB_CMD); @@ -519,7 +519,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, +static int lbs_cmd_802_11_rf_tx_power(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -563,7 +563,7 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_monitor_mode(wlan_private * priv, +static int lbs_cmd_802_11_monitor_mode(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -583,13 +583,13 @@ static int wlan_cmd_802_11_monitor_mode(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv, +static int lbs_cmd_802_11_rate_adapt_rateset(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_802_11_rate_adapt_rateset *rateadapt = &cmd->params.rateset; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = @@ -605,12 +605,12 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_data_rate(wlan_private * priv, +static int lbs_cmd_802_11_data_rate(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -621,7 +621,7 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, pdatarate->action = cpu_to_le16(cmd_action); if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) { - pdatarate->rates[0] = libertas_data_rate_to_fw_index(adapter->cur_rate); + pdatarate->rates[0] = lbs_data_rate_to_fw_index(adapter->cur_rate); lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", adapter->cur_rate); } else if (cmd_action == CMD_ACT_SET_TX_AUTO) { @@ -632,12 +632,12 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, return 0; } -static int wlan_cmd_mac_multicast_adr(wlan_private * priv, +static int lbs_cmd_mac_multicast_adr(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + @@ -655,7 +655,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_rf_channel(wlan_private * priv, +static int lbs_cmd_802_11_rf_channel(lbs_private * priv, struct cmd_ds_command *cmd, int option, void *pdata_buf) { @@ -676,10 +676,10 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_rssi(wlan_private * priv, +static int lbs_cmd_802_11_rssi(lbs_private * priv, struct cmd_ds_command *cmd) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_RSSI); @@ -698,15 +698,15 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv, return 0; } -static int wlan_cmd_reg_access(wlan_private * priv, +static int lbs_cmd_reg_access(lbs_private * priv, struct cmd_ds_command *cmdptr, u8 cmd_action, void *pdata_buf) { - struct wlan_offset_value *offval; + struct lbs_offset_value *offval; lbs_deb_enter(LBS_DEB_CMD); - offval = (struct wlan_offset_value *)pdata_buf; + offval = (struct lbs_offset_value *)pdata_buf; switch (cmdptr->command) { case CMD_MAC_REG_ACCESS: @@ -773,11 +773,11 @@ static int wlan_cmd_reg_access(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_mac_address(wlan_private * priv, +static int lbs_cmd_802_11_mac_address(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS); @@ -797,11 +797,11 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv, return 0; } -static int wlan_cmd_802_11_eeprom_access(wlan_private * priv, +static int lbs_cmd_802_11_eeprom_access(lbs_private * priv, struct cmd_ds_command *cmd, int cmd_action, void *pdata_buf) { - struct wlan_ioctl_regrdwr *ea = pdata_buf; + struct lbs_ioctl_regrdwr *ea = pdata_buf; lbs_deb_enter(LBS_DEB_CMD); @@ -819,7 +819,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv, return 0; } -static int wlan_cmd_bt_access(wlan_private * priv, +static int lbs_cmd_bt_access(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -857,7 +857,7 @@ static int wlan_cmd_bt_access(wlan_private * priv, return 0; } -static int wlan_cmd_fwt_access(wlan_private * priv, +static int lbs_cmd_fwt_access(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -879,7 +879,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv, return 0; } -static int wlan_cmd_mesh_access(wlan_private * priv, +static int lbs_cmd_mesh_access(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -901,7 +901,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv, return 0; } -static int wlan_cmd_set_boot2_ver(wlan_private * priv, +static int lbs_cmd_set_boot2_ver(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -913,10 +913,10 @@ static int wlan_cmd_set_boot2_ver(wlan_private * priv, } /* - * Note: NEVER use libertas_queue_cmd() with addtail==0 other than for + * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for * the command timer, because it does not account for queued commands. */ -void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) +void lbs_queue_cmd(lbs_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) { unsigned long flags; struct cmd_ds_command *cmdptr; @@ -968,12 +968,12 @@ done: * For now - we are not performing the endian conversion the second time - but * for PS and DEEP_SLEEP we need to worry */ -static int DownloadcommandToStation(wlan_private * priv, +static int DownloadcommandToStation(lbs_private * priv, struct cmd_ctrl_node *cmdnode) { unsigned long flags; struct cmd_ds_command *cmdptr; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = -1; u16 cmdsize; u16 command; @@ -990,7 +990,7 @@ static int DownloadcommandToStation(wlan_private * priv, spin_lock_irqsave(&adapter->driver_lock, flags); if (!cmdptr || !cmdptr->size) { lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n"); - __libertas_cleanup_and_insert_cmd(priv, cmdnode); + __lbs_cleanup_and_insert_cmd(priv, cmdnode); spin_unlock_irqrestore(&adapter->driver_lock, flags); goto done; } @@ -1015,7 +1015,7 @@ static int DownloadcommandToStation(wlan_private * priv, lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n"); spin_lock_irqsave(&adapter->driver_lock, flags); adapter->cur_cmd_retcode = ret; - __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); + __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -1038,7 +1038,7 @@ done: return ret; } -static int wlan_cmd_mac_control(wlan_private * priv, +static int lbs_cmd_mac_control(lbs_private * priv, struct cmd_ds_command *cmd) { struct cmd_ds_mac_control *mac = &cmd->params.macctrl; @@ -1060,9 +1060,9 @@ static int wlan_cmd_mac_control(wlan_private * priv, * This function inserts command node to cmdfreeq * after cleans it. Requires adapter->driver_lock held. */ -void __libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node *ptempcmd) +void __lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptempcmd) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; if (!ptempcmd) return; @@ -1071,22 +1071,22 @@ void __libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); } -static void libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node *ptempcmd) +static void lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptempcmd) { unsigned long flags; spin_lock_irqsave(&priv->adapter->driver_lock, flags); - __libertas_cleanup_and_insert_cmd(priv, ptempcmd); + __lbs_cleanup_and_insert_cmd(priv, ptempcmd); spin_unlock_irqrestore(&priv->adapter->driver_lock, flags); } -int libertas_set_radio_control(wlan_private * priv) +int lbs_set_radio_control(lbs_private * priv) { int ret = 0; lbs_deb_enter(LBS_DEB_CMD); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RADIO_CONTROL, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -1098,14 +1098,14 @@ int libertas_set_radio_control(wlan_private * priv) return ret; } -int libertas_set_mac_packet_filter(wlan_private * priv) +int lbs_set_mac_packet_filter(lbs_private * priv) { int ret = 0; lbs_deb_enter(LBS_DEB_CMD); /* Send MAC control command to station */ - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_MAC_CONTROL, 0, 0, 0, NULL); lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); @@ -1115,7 +1115,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv) /** * @brief This function prepare the command before send to firmware. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param cmd_no command number * @param cmd_action command action: GET or SET * @param wait_option wait option: wait response or not @@ -1123,13 +1123,13 @@ int libertas_set_mac_packet_filter(wlan_private * priv) * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ -int libertas_prepare_and_send_command(wlan_private * priv, +int lbs_prepare_and_send_command(lbs_private * priv, u16 cmd_no, u16 cmd_action, u16 wait_option, u32 cmd_oid, void *pdata_buf) { int ret = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; struct cmd_ds_command *cmdptr; unsigned long flags; @@ -1148,7 +1148,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, goto done; } - cmdnode = libertas_get_free_cmd_ctrl_node(priv); + cmdnode = lbs_get_free_cmd_ctrl_node(priv); if (cmdnode == NULL) { lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); @@ -1159,7 +1159,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, goto done; } - libertas_set_cmd_ctrl_node(priv, cmdnode, cmd_oid, wait_option, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, cmd_oid, wait_option, pdata_buf); cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; @@ -1167,7 +1167,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, if (!cmdptr) { lbs_deb_host("PREP_CMD: cmdptr is NULL\n"); - libertas_cleanup_and_insert_cmd(priv, cmdnode); + lbs_cleanup_and_insert_cmd(priv, cmdnode); ret = -1; goto done; } @@ -1181,116 +1181,116 @@ int libertas_prepare_and_send_command(wlan_private * priv, switch (cmd_no) { case CMD_GET_HW_SPEC: - ret = wlan_cmd_hw_spec(priv, cmdptr); + ret = lbs_cmd_hw_spec(priv, cmdptr); break; case CMD_802_11_PS_MODE: - ret = wlan_cmd_802_11_ps_mode(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action); break; case CMD_802_11_SCAN: - ret = libertas_cmd_80211_scan(priv, cmdptr, pdata_buf); + ret = lbs_cmd_80211_scan(priv, cmdptr, pdata_buf); break; case CMD_MAC_CONTROL: - ret = wlan_cmd_mac_control(priv, cmdptr); + ret = lbs_cmd_mac_control(priv, cmdptr); break; case CMD_802_11_ASSOCIATE: case CMD_802_11_REASSOCIATE: - ret = libertas_cmd_80211_associate(priv, cmdptr, pdata_buf); + ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); break; case CMD_802_11_DEAUTHENTICATE: - ret = libertas_cmd_80211_deauthenticate(priv, cmdptr); + ret = lbs_cmd_80211_deauthenticate(priv, cmdptr); break; case CMD_802_11_SET_WEP: - ret = wlan_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_AD_HOC_START: - ret = libertas_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); + ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); break; case CMD_CODE_DNLD: break; case CMD_802_11_RESET: - ret = wlan_cmd_802_11_reset(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action); break; case CMD_802_11_GET_LOG: - ret = wlan_cmd_802_11_get_log(priv, cmdptr); + ret = lbs_cmd_802_11_get_log(priv, cmdptr); break; case CMD_802_11_AUTHENTICATE: - ret = libertas_cmd_80211_authenticate(priv, cmdptr, pdata_buf); + ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); break; case CMD_802_11_GET_STAT: - ret = wlan_cmd_802_11_get_stat(priv, cmdptr); + ret = lbs_cmd_802_11_get_stat(priv, cmdptr); break; case CMD_802_11_SNMP_MIB: - ret = wlan_cmd_802_11_snmp_mib(priv, cmdptr, + ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr, cmd_action, cmd_oid, pdata_buf); break; case CMD_MAC_REG_ACCESS: case CMD_BBP_REG_ACCESS: case CMD_RF_REG_ACCESS: - ret = wlan_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_RF_CHANNEL: - ret = wlan_cmd_802_11_rf_channel(priv, cmdptr, + ret = lbs_cmd_802_11_rf_channel(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_RF_TX_POWER: - ret = wlan_cmd_802_11_rf_tx_power(priv, cmdptr, + ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_RADIO_CONTROL: - ret = wlan_cmd_802_11_radio_control(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_radio_control(priv, cmdptr, cmd_action); break; case CMD_802_11_DATA_RATE: - ret = wlan_cmd_802_11_data_rate(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_data_rate(priv, cmdptr, cmd_action); break; case CMD_802_11_RATE_ADAPT_RATESET: - ret = wlan_cmd_802_11_rate_adapt_rateset(priv, + ret = lbs_cmd_802_11_rate_adapt_rateset(priv, cmdptr, cmd_action); break; case CMD_MAC_MULTICAST_ADR: - ret = wlan_cmd_mac_multicast_adr(priv, cmdptr, cmd_action); + ret = lbs_cmd_mac_multicast_adr(priv, cmdptr, cmd_action); break; case CMD_802_11_MONITOR_MODE: - ret = wlan_cmd_802_11_monitor_mode(priv, cmdptr, + ret = lbs_cmd_802_11_monitor_mode(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_AD_HOC_JOIN: - ret = libertas_cmd_80211_ad_hoc_join(priv, cmdptr, pdata_buf); + ret = lbs_cmd_80211_ad_hoc_join(priv, cmdptr, pdata_buf); break; case CMD_802_11_RSSI: - ret = wlan_cmd_802_11_rssi(priv, cmdptr); + ret = lbs_cmd_802_11_rssi(priv, cmdptr); break; case CMD_802_11_AD_HOC_STOP: - ret = libertas_cmd_80211_ad_hoc_stop(priv, cmdptr); + ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); break; case CMD_802_11_ENABLE_RSN: - ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, + ret = lbs_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_802_11_KEY_MATERIAL: - ret = wlan_cmd_802_11_key_material(priv, cmdptr, cmd_action, + ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action, cmd_oid, pdata_buf); break; @@ -1300,11 +1300,11 @@ int libertas_prepare_and_send_command(wlan_private * priv, break; case CMD_802_11_MAC_ADDRESS: - ret = wlan_cmd_802_11_mac_address(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_mac_address(priv, cmdptr, cmd_action); break; case CMD_802_11_EEPROM_ACCESS: - ret = wlan_cmd_802_11_eeprom_access(priv, cmdptr, + ret = lbs_cmd_802_11_eeprom_access(priv, cmdptr, cmd_action, pdata_buf); break; @@ -1322,17 +1322,17 @@ int libertas_prepare_and_send_command(wlan_private * priv, goto done; case CMD_802_11D_DOMAIN_INFO: - ret = libertas_cmd_802_11d_domain_info(priv, cmdptr, + ret = lbs_cmd_802_11d_domain_info(priv, cmdptr, cmd_no, cmd_action); break; case CMD_802_11_SLEEP_PARAMS: - ret = wlan_cmd_802_11_sleep_params(priv, cmdptr, cmd_action); + ret = lbs_cmd_802_11_sleep_params(priv, cmdptr, cmd_action); break; case CMD_802_11_INACTIVITY_TIMEOUT: - ret = wlan_cmd_802_11_inactivity_timeout(priv, cmdptr, + ret = lbs_cmd_802_11_inactivity_timeout(priv, cmdptr, cmd_action, pdata_buf); - libertas_set_cmd_ctrl_node(priv, cmdnode, 0, 0, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, 0, 0, pdata_buf); break; case CMD_802_11_TPC_CFG: @@ -1379,19 +1379,19 @@ int libertas_prepare_and_send_command(wlan_private * priv, ret = 0; break; case CMD_BT_ACCESS: - ret = wlan_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_FWT_ACCESS: - ret = wlan_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_MESH_ACCESS: - ret = wlan_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_SET_BOOT2_VER: - ret = wlan_cmd_set_boot2_ver(priv, cmdptr, cmd_action, pdata_buf); + ret = lbs_cmd_set_boot2_ver(priv, cmdptr, cmd_action, pdata_buf); break; case CMD_GET_TSF: @@ -1409,14 +1409,14 @@ int libertas_prepare_and_send_command(wlan_private * priv, /* return error, since the command preparation failed */ if (ret != 0) { lbs_deb_host("PREP_CMD: command preparation failed\n"); - libertas_cleanup_and_insert_cmd(priv, cmdnode); + lbs_cleanup_and_insert_cmd(priv, cmdnode); ret = -1; goto done; } cmdnode->cmdwaitqwoken = 0; - libertas_queue_cmd(adapter, cmdnode, 1); + lbs_queue_cmd(adapter, cmdnode, 1); wake_up_interruptible(&priv->waitq); if (wait_option & CMD_OPTION_WAITFORRSP) { @@ -1439,23 +1439,23 @@ done: lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command); +EXPORT_SYMBOL_GPL(lbs_prepare_and_send_command); /** * @brief This function allocates the command buffer and link * it to command free queue. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return 0 or -1 */ -int libertas_allocate_cmd_buffer(wlan_private * priv) +int lbs_allocate_cmd_buffer(lbs_private * priv) { int ret = 0; u32 ulbufsize; u32 i; struct cmd_ctrl_node *tempcmd_array; u8 *ptempvirtualaddr; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -1484,7 +1484,7 @@ int libertas_allocate_cmd_buffer(wlan_private * priv) for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { init_waitqueue_head(&tempcmd_array[i].cmdwait_q); - libertas_cleanup_and_insert_cmd(priv, &tempcmd_array[i]); + lbs_cleanup_and_insert_cmd(priv, &tempcmd_array[i]); } ret = 0; @@ -1497,15 +1497,15 @@ done: /** * @brief This function frees the command buffer. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return 0 or -1 */ -int libertas_free_cmd_buffer(wlan_private * priv) +int lbs_free_cmd_buffer(lbs_private * priv) { u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ unsigned int i; struct cmd_ctrl_node *tempcmd_array; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -1541,13 +1541,13 @@ done: * @brief This function gets a free command node if available in * command free queue. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL */ -struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv) +struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(lbs_private * priv) { struct cmd_ctrl_node *tempnode; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; unsigned long flags; lbs_deb_enter(LBS_DEB_HOST); @@ -1602,14 +1602,14 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) /** * @brief This function initializes the command node. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param ptempnode A pointer to cmd_ctrl_node structure * @param cmd_oid cmd oid: treated as sub command * @param wait_option wait option: wait response or not * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ -void libertas_set_cmd_ctrl_node(wlan_private * priv, +void lbs_set_cmd_ctrl_node(lbs_private * priv, struct cmd_ctrl_node *ptempnode, u32 cmd_oid, u16 wait_option, void *pdata_buf) { @@ -1630,19 +1630,19 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv, * pending queue. It will put fimware back to PS mode * if applicable. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return 0 or -1 */ -int libertas_execute_next_command(wlan_private * priv) +int lbs_execute_next_command(lbs_private * priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode = NULL; struct cmd_ds_command *cmdptr; unsigned long flags; int ret = 0; // Debug group is LBS_DEB_THREAD and not LBS_DEB_HOST, because the - // only caller to us is libertas_thread() and we get even when a + // only caller to us is lbs_thread() and we get even when a // data packet is received lbs_deb_enter(LBS_DEB_THREAD); @@ -1683,7 +1683,7 @@ int libertas_execute_next_command(wlan_private * priv) /* * 1. Non-PS command: * Queue it. set needtowakeup to TRUE if current state - * is SLEEP, otherwise call libertas_ps_wakeup to send Exit_PS. + * is SLEEP, otherwise call lbs_ps_wakeup to send Exit_PS. * 2. PS command but not Exit_PS: * Ignore it. * 3. PS command Exit_PS: @@ -1702,7 +1702,7 @@ int libertas_execute_next_command(wlan_private * priv) since it is blocked in main_thread. */ adapter->needtowakeup = 1; } else - libertas_ps_wakeup(priv, 0); + lbs_ps_wakeup(priv, 0); ret = 0; goto done; @@ -1722,7 +1722,7 @@ int libertas_execute_next_command(wlan_private * priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); list_del((struct list_head *)cmdnode); - libertas_cleanup_and_insert_cmd(priv, cmdnode); + lbs_cleanup_and_insert_cmd(priv, cmdnode); ret = 0; goto done; @@ -1733,7 +1733,7 @@ int libertas_execute_next_command(wlan_private * priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); list_del((struct list_head *)cmdnode); - libertas_cleanup_and_insert_cmd(priv, cmdnode); + lbs_cleanup_and_insert_cmd(priv, cmdnode); adapter->needtowakeup = 1; ret = 0; @@ -1753,9 +1753,9 @@ int libertas_execute_next_command(wlan_private * priv) * check if in power save mode, if yes, put the device back * to PS mode */ - if ((adapter->psmode != WLAN802_11POWERMODECAM) && + if ((adapter->psmode != LBS802_11POWERMODECAM) && (adapter->psstate == PS_STATE_FULL_POWER) && - (adapter->connect_status == LIBERTAS_CONNECTED)) { + (adapter->connect_status == LBS_CONNECTED)) { if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { /* check for valid WPA group keys */ @@ -1764,13 +1764,13 @@ int libertas_execute_next_command(wlan_private * priv) lbs_deb_host( "EXEC_NEXT_CMD: WPA enabled and GTK_SET" " go back to PS_SLEEP"); - libertas_ps_sleep(priv, 0); + lbs_ps_sleep(priv, 0); } } else { lbs_deb_host( "EXEC_NEXT_CMD: cmdpendingq empty, " "go back to PS_SLEEP"); - libertas_ps_sleep(priv, 0); + lbs_ps_sleep(priv, 0); } } } @@ -1781,7 +1781,7 @@ done: return ret; } -void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) +void lbs_send_iwevcustom_event(lbs_private *priv, s8 *str) { union iwreq_data iwrq; u8 buf[50]; @@ -1805,10 +1805,10 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) lbs_deb_leave(LBS_DEB_WEXT); } -static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) +static int sendconfirmsleep(lbs_private *priv, u8 *cmdptr, u16 size) { unsigned long flags; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_HOST); @@ -1847,7 +1847,7 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) return ret; } -void libertas_ps_sleep(wlan_private * priv, int wait_option) +void lbs_ps_sleep(lbs_private * priv, int wait_option) { lbs_deb_enter(LBS_DEB_HOST); @@ -1856,7 +1856,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option) * Remove this check if it is to be supported in IBSS mode also */ - libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE, + lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, CMD_SUBCMD_ENTER_PS, wait_option, 0, NULL); lbs_deb_leave(LBS_DEB_HOST); @@ -1865,19 +1865,19 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option) /** * @brief This function sends Exit_PS command to firmware. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param wait_option wait response or not * @return n/a */ -void libertas_ps_wakeup(wlan_private * priv, int wait_option) +void lbs_ps_wakeup(lbs_private * priv, int wait_option) { __le32 Localpsmode; lbs_deb_enter(LBS_DEB_HOST); - Localpsmode = cpu_to_le32(WLAN802_11POWERMODECAM); + Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM); - libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE, + lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, CMD_SUBCMD_EXIT_PS, wait_option, 0, &Localpsmode); @@ -1888,14 +1888,14 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option) * @brief This function checks condition and prepares to * send sleep confirm command to firmware if ok. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param psmode Power Saving mode * @return n/a */ -void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode) +void lbs_ps_confirm_sleep(lbs_private * priv, u16 psmode) { unsigned long flags =0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u8 allowed = 1; lbs_deb_enter(LBS_DEB_HOST); @@ -1917,8 +1917,8 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode) spin_unlock_irqrestore(&adapter->driver_lock, flags); if (allowed) { - lbs_deb_host("sending libertas_ps_confirm_sleep\n"); - sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, + lbs_deb_host("sending lbs_ps_confirm_sleep\n"); + sendconfirmsleep(priv, (u8 *) & adapter->lbs_ps_confirm_sleep, sizeof(struct PS_CMD_ConfirmSleep)); } else { lbs_deb_host("sleep confirm has been delayed\n"); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 8f90892ea22..6c1fdb8f11f 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -20,15 +20,15 @@ * reports disconnect to upper layer, clean tx/rx packets, * reset link state etc. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return n/a */ -void libertas_mac_event_disconnected(wlan_private * priv) +void lbs_mac_event_disconnected(lbs_private * priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; union iwreq_data wrqu; - if (adapter->connect_status != LIBERTAS_CONNECTED) + if (adapter->connect_status != LBS_CONNECTED) return; lbs_deb_enter(LBS_DEB_CMD); @@ -65,7 +65,7 @@ void libertas_mac_event_disconnected(wlan_private * priv) adapter->curbssparams.ssid_len), adapter->curbssparams.ssid_len); - adapter->connect_status = LIBERTAS_DISCONNECTED; + adapter->connect_status = LBS_DISCONNECTED; /* Clear out associated SSID and BSSID since connection is * no longer valid. @@ -77,7 +77,7 @@ void libertas_mac_event_disconnected(wlan_private * priv) if (adapter->psstate != PS_STATE_FULL_POWER) { /* make firmware to exit PS mode */ lbs_deb_cmd("disconnected, so exit PS mode\n"); - libertas_ps_wakeup(priv, 0); + lbs_ps_wakeup(priv, 0); } lbs_deb_leave(LBS_DEB_CMD); } @@ -85,11 +85,11 @@ void libertas_mac_event_disconnected(wlan_private * priv) /** * @brief This function handles MIC failure event. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @para event the event id * @return n/a */ -static void handle_mic_failureevent(wlan_private * priv, u32 event) +static void handle_mic_failureevent(lbs_private * priv, u32 event) { char buf[50]; @@ -104,15 +104,15 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event) strcat(buf, "multicast "); } - libertas_send_iwevcustom_event(priv, buf); + lbs_send_iwevcustom_event(priv, buf); lbs_deb_leave(LBS_DEB_CMD); } -static int wlan_ret_reg_access(wlan_private * priv, +static int lbs_ret_reg_access(lbs_private * priv, u16 type, struct cmd_ds_command *resp) { int ret = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -152,12 +152,12 @@ static int wlan_ret_reg_access(wlan_private * priv, return ret; } -static int wlan_ret_get_hw_spec(wlan_private * priv, +static int lbs_ret_get_hw_spec(lbs_private * priv, struct cmd_ds_command *resp) { u32 i; struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; DECLARE_MAC_BUF(mac); @@ -183,7 +183,7 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { /* use the region code to search for the index */ - if (adapter->regioncode == libertas_region_code_to_index[i]) { + if (adapter->regioncode == lbs_region_code_to_index[i]) { break; } } @@ -201,12 +201,12 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, if (priv->mesh_dev) memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); - if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { + if (lbs_set_regiontable(priv, adapter->regioncode, 0)) { ret = -1; goto done; } - if (libertas_set_universaltable(priv, 0)) { + if (lbs_set_universaltable(priv, 0)) { ret = -1; goto done; } @@ -216,11 +216,11 @@ done: return ret; } -static int wlan_ret_802_11_sleep_params(wlan_private * priv, +static int lbs_ret_802_11_sleep_params(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -240,14 +240,14 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv, return 0; } -static int wlan_ret_802_11_stat(wlan_private * priv, +static int lbs_ret_802_11_stat(lbs_private * priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_CMD); /* currently adapter->wlan802_11Stat is unused struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; // TODO Convert it to Big endian befor copy memcpy(&adapter->wlan802_11Stat, @@ -257,7 +257,7 @@ static int wlan_ret_802_11_stat(wlan_private * priv, return 0; } -static int wlan_ret_802_11_snmp_mib(wlan_private * priv, +static int lbs_ret_802_11_snmp_mib(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; @@ -299,12 +299,12 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv, return 0; } -static int wlan_ret_802_11_key_material(wlan_private * priv, +static int lbs_ret_802_11_key_material(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_key_material *pkeymaterial = &resp->params.keymaterial; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(pkeymaterial->action); lbs_deb_enter(LBS_DEB_CMD); @@ -355,11 +355,11 @@ static int wlan_ret_802_11_key_material(wlan_private * priv, return 0; } -static int wlan_ret_802_11_mac_address(wlan_private * priv, +static int lbs_ret_802_11_mac_address(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -369,11 +369,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv, return 0; } -static int wlan_ret_802_11_rf_tx_power(wlan_private * priv, +static int lbs_ret_802_11_rf_tx_power(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -385,11 +385,11 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv, return 0; } -static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, +static int lbs_ret_802_11_rate_adapt_rateset(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -402,11 +402,11 @@ static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, return 0; } -static int wlan_ret_802_11_data_rate(wlan_private * priv, +static int lbs_ret_802_11_data_rate(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -416,18 +416,18 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, /* FIXME: get actual rates FW can do if this command actually returns * all data rates supported. */ - adapter->cur_rate = libertas_fw_index_to_data_rate(pdatarate->rates[0]); + adapter->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", adapter->cur_rate); lbs_deb_leave(LBS_DEB_CMD); return 0; } -static int wlan_ret_802_11_rf_channel(wlan_private * priv, +static int lbs_ret_802_11_rf_channel(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(rfchannel->action); u16 newchannel = le16_to_cpu(rfchannel->currentchannel); @@ -446,11 +446,11 @@ static int wlan_ret_802_11_rf_channel(wlan_private * priv, return 0; } -static int wlan_ret_802_11_rssi(wlan_private * priv, +static int lbs_ret_802_11_rssi(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -477,12 +477,12 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, return 0; } -static int wlan_ret_802_11_eeprom_access(wlan_private * priv, +static int lbs_ret_802_11_eeprom_access(lbs_private * priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; - struct wlan_ioctl_regrdwr *pbuf; - pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; + lbs_adapter *adapter = priv->adapter; + struct lbs_ioctl_regrdwr *pbuf; + pbuf = (struct lbs_ioctl_regrdwr *) adapter->prdeeprom; lbs_deb_enter_args(LBS_DEB_CMD, "len %d", le16_to_cpu(resp->params.rdeeprom.bytecount)); @@ -503,11 +503,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, return 0; } -static int wlan_ret_get_log(wlan_private * priv, +static int lbs_ret_get_log(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -518,11 +518,11 @@ static int wlan_ret_get_log(wlan_private * priv, return 0; } -static int libertas_ret_802_11_enable_rsn(wlan_private * priv, +static int lbs_ret_802_11_enable_rsn(lbs_private * priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u32 * pdata_buf = adapter->cur_cmd->pdata_buf; lbs_deb_enter(LBS_DEB_CMD); @@ -538,11 +538,11 @@ static int libertas_ret_802_11_enable_rsn(wlan_private * priv, static inline int handle_cmd_response(u16 respcmd, struct cmd_ds_command *resp, - wlan_private *priv) + lbs_private *priv) { int ret = 0; unsigned long flags; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -550,47 +550,47 @@ static inline int handle_cmd_response(u16 respcmd, case CMD_RET(CMD_MAC_REG_ACCESS): case CMD_RET(CMD_BBP_REG_ACCESS): case CMD_RET(CMD_RF_REG_ACCESS): - ret = wlan_ret_reg_access(priv, respcmd, resp); + ret = lbs_ret_reg_access(priv, respcmd, resp); break; case CMD_RET(CMD_GET_HW_SPEC): - ret = wlan_ret_get_hw_spec(priv, resp); + ret = lbs_ret_get_hw_spec(priv, resp); break; case CMD_RET(CMD_802_11_SCAN): - ret = libertas_ret_80211_scan(priv, resp); + ret = lbs_ret_80211_scan(priv, resp); break; case CMD_RET(CMD_802_11_GET_LOG): - ret = wlan_ret_get_log(priv, resp); + ret = lbs_ret_get_log(priv, resp); break; case CMD_RET_802_11_ASSOCIATE: case CMD_RET(CMD_802_11_ASSOCIATE): case CMD_RET(CMD_802_11_REASSOCIATE): - ret = libertas_ret_80211_associate(priv, resp); + ret = lbs_ret_80211_associate(priv, resp); break; case CMD_RET(CMD_802_11_DISASSOCIATE): case CMD_RET(CMD_802_11_DEAUTHENTICATE): - ret = libertas_ret_80211_disassociate(priv, resp); + ret = lbs_ret_80211_disassociate(priv, resp); break; case CMD_RET(CMD_802_11_AD_HOC_START): case CMD_RET(CMD_802_11_AD_HOC_JOIN): - ret = libertas_ret_80211_ad_hoc_start(priv, resp); + ret = lbs_ret_80211_ad_hoc_start(priv, resp); break; case CMD_RET(CMD_802_11_GET_STAT): - ret = wlan_ret_802_11_stat(priv, resp); + ret = lbs_ret_802_11_stat(priv, resp); break; case CMD_RET(CMD_802_11_SNMP_MIB): - ret = wlan_ret_802_11_snmp_mib(priv, resp); + ret = lbs_ret_802_11_snmp_mib(priv, resp); break; case CMD_RET(CMD_802_11_RF_TX_POWER): - ret = wlan_ret_802_11_rf_tx_power(priv, resp); + ret = lbs_ret_802_11_rf_tx_power(priv, resp); break; case CMD_RET(CMD_802_11_SET_AFC): @@ -612,45 +612,45 @@ static inline int handle_cmd_response(u16 respcmd, break; case CMD_RET(CMD_802_11_ENABLE_RSN): - ret = libertas_ret_802_11_enable_rsn(priv, resp); + ret = lbs_ret_802_11_enable_rsn(priv, resp); break; case CMD_RET(CMD_802_11_DATA_RATE): - ret = wlan_ret_802_11_data_rate(priv, resp); + ret = lbs_ret_802_11_data_rate(priv, resp); break; case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): - ret = wlan_ret_802_11_rate_adapt_rateset(priv, resp); + ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); break; case CMD_RET(CMD_802_11_RF_CHANNEL): - ret = wlan_ret_802_11_rf_channel(priv, resp); + ret = lbs_ret_802_11_rf_channel(priv, resp); break; case CMD_RET(CMD_802_11_RSSI): - ret = wlan_ret_802_11_rssi(priv, resp); + ret = lbs_ret_802_11_rssi(priv, resp); break; case CMD_RET(CMD_802_11_MAC_ADDRESS): - ret = wlan_ret_802_11_mac_address(priv, resp); + ret = lbs_ret_802_11_mac_address(priv, resp); break; case CMD_RET(CMD_802_11_AD_HOC_STOP): - ret = libertas_ret_80211_ad_hoc_stop(priv, resp); + ret = lbs_ret_80211_ad_hoc_stop(priv, resp); break; case CMD_RET(CMD_802_11_KEY_MATERIAL): - ret = wlan_ret_802_11_key_material(priv, resp); + ret = lbs_ret_802_11_key_material(priv, resp); break; case CMD_RET(CMD_802_11_EEPROM_ACCESS): - ret = wlan_ret_802_11_eeprom_access(priv, resp); + ret = lbs_ret_802_11_eeprom_access(priv, resp); break; case CMD_RET(CMD_802_11D_DOMAIN_INFO): - ret = libertas_ret_802_11d_domain_info(priv, resp); + ret = lbs_ret_802_11d_domain_info(priv, resp); break; case CMD_RET(CMD_802_11_SLEEP_PARAMS): - ret = wlan_ret_802_11_sleep_params(priv, resp); + ret = lbs_ret_802_11_sleep_params(priv, resp); break; case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): spin_lock_irqsave(&adapter->driver_lock, flags); @@ -713,11 +713,11 @@ static inline int handle_cmd_response(u16 respcmd, return ret; } -int libertas_process_rx_command(wlan_private * priv) +int lbs_process_rx_command(lbs_private * priv) { u16 respcmd; struct cmd_ds_command *resp; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; ulong flags; u16 result; @@ -749,7 +749,7 @@ int libertas_process_rx_command(wlan_private * priv) if (!(respcmd & 0x8000)) { lbs_deb_host("invalid response!\n"); adapter->cur_cmd_retcode = -1; - __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); + __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -774,27 +774,27 @@ int libertas_process_rx_command(wlan_private * priv) /* * We should not re-try enter-ps command in * ad-hoc mode. It takes place in - * libertas_execute_next_command(). + * lbs_execute_next_command(). */ if (adapter->mode == IW_MODE_ADHOC && action == CMD_SUBCMD_ENTER_PS) - adapter->psmode = WLAN802_11POWERMODECAM; + adapter->psmode = LBS802_11POWERMODECAM; } else if (action == CMD_SUBCMD_ENTER_PS) { adapter->needtowakeup = 0; adapter->psstate = PS_STATE_AWAKE; lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); - if (adapter->connect_status != LIBERTAS_CONNECTED) { + if (adapter->connect_status != LBS_CONNECTED) { /* * When Deauth Event received before Enter_PS command * response, We need to wake up the firmware. */ lbs_deb_host( - "disconnected, invoking libertas_ps_wakeup\n"); + "disconnected, invoking lbs_ps_wakeup\n"); spin_unlock_irqrestore(&adapter->driver_lock, flags); mutex_unlock(&adapter->lock); - libertas_ps_wakeup(priv, 0); + lbs_ps_wakeup(priv, 0); mutex_lock(&adapter->lock); spin_lock_irqsave(&adapter->driver_lock, flags); } @@ -806,7 +806,7 @@ int libertas_process_rx_command(wlan_private * priv) lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); } - __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); + __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -837,7 +837,7 @@ int libertas_process_rx_command(wlan_private * priv) } - __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); + __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -853,7 +853,7 @@ int libertas_process_rx_command(wlan_private * priv) spin_lock_irqsave(&adapter->driver_lock, flags); if (adapter->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ - __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); + __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); adapter->nr_cmd_pending--; WARN_ON(adapter->nr_cmd_pending > 128); adapter->cur_cmd = NULL; @@ -866,10 +866,10 @@ done: return ret; } -int libertas_process_event(wlan_private * priv) +int lbs_process_event(lbs_private * priv) { int ret = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; u32 eventcause; lbs_deb_enter(LBS_DEB_CMD); @@ -887,17 +887,17 @@ int libertas_process_event(wlan_private * priv) case MACREG_INT_CODE_DEAUTHENTICATED: lbs_deb_cmd("EVENT: deauthenticated\n"); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); break; case MACREG_INT_CODE_DISASSOCIATED: lbs_deb_cmd("EVENT: disassociated\n"); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); break; case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: lbs_deb_cmd("EVENT: link lost\n"); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); break; case MACREG_INT_CODE_PS_SLEEP: @@ -911,7 +911,7 @@ int libertas_process_event(wlan_private * priv) } adapter->psstate = PS_STATE_PRE_SLEEP; - libertas_ps_confirm_sleep(priv, (u16) adapter->psmode); + lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); break; @@ -932,10 +932,10 @@ int libertas_process_event(wlan_private * priv) * wait for the command processing to finish * before resuming sending * adapter->needtowakeup will be set to FALSE - * in libertas_ps_wakeup() + * in lbs_ps_wakeup() */ lbs_deb_cmd("waking up ...\n"); - libertas_ps_wakeup(priv, 0); + lbs_ps_wakeup(priv, 0); } break; @@ -979,7 +979,7 @@ int libertas_process_event(wlan_private * priv) break; } lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); - adapter->connect_status = LIBERTAS_CONNECTED; + adapter->connect_status = LBS_CONNECTED; if (priv->mesh_open == 1) { netif_wake_queue(priv->mesh_dev); netif_carrier_on(priv->mesh_dev); diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 95dd4edf64c..1b382cfaf37 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -11,14 +11,14 @@ #include "host.h" #include "debugfs.h" -static struct dentry *libertas_dir = NULL; +static struct dentry *lbs_dir; static char *szStates[] = { "Connected", "Disconnected" }; #ifdef PROC_DEBUG -static void libertas_debug_init(wlan_private * priv, struct net_device *dev); +static void lbs_debug_init(lbs_private * priv, struct net_device *dev); #endif static int open_file_generic(struct inode *inode, struct file *file) @@ -35,10 +35,10 @@ static ssize_t write_file_dummy(struct file *file, const char __user *buf, static const size_t len = PAGE_SIZE; -static ssize_t libertas_dev_info(struct file *file, char __user *userbuf, +static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -56,10 +56,10 @@ static ssize_t libertas_dev_info(struct file *file, char __user *userbuf, } -static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, +static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; size_t pos = 0; int numscansdone = 0, res; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -98,11 +98,11 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_sleepparams_write(struct file *file, +static ssize_t lbs_sleepparams_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t buf_size, res; int p1, p2, p3, p4, p5, p6; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -125,7 +125,7 @@ static ssize_t libertas_sleepparams_write(struct file *file, priv->adapter->sp.sp_extsleepclk = p5; priv->adapter->sp.sp_reserved = p6; - res = libertas_prepare_and_send_command(priv, + res = lbs_prepare_and_send_command(priv, CMD_802_11_SLEEP_PARAMS, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -140,17 +140,17 @@ out_unlock: return res; } -static ssize_t libertas_sleepparams_read(struct file *file, char __user *userbuf, +static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_prepare_and_send_command(priv, + res = lbs_prepare_and_send_command(priv, CMD_802_11_SLEEP_PARAMS, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -171,10 +171,10 @@ out_unlock: return res; } -static ssize_t libertas_extscan(struct file *file, const char __user *userbuf, +static ssize_t lbs_extscan(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; union iwreq_data wrqu; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -186,7 +186,7 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf, goto out_unlock; } - libertas_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0); + lbs_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0); memset(&wrqu, 0, sizeof(union iwreq_data)); wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); @@ -196,8 +196,8 @@ out_unlock: return count; } -static int libertas_parse_chan(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg, int dur) +static int lbs_parse_chan(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg, int dur) { char *start, *end, *hold, *str; int i = 0; @@ -233,8 +233,8 @@ static int libertas_parse_chan(char *buf, size_t count, return i; } -static void libertas_parse_bssid(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg) +static void lbs_parse_bssid(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg) { char *hold; unsigned int mac[ETH_ALEN]; @@ -248,8 +248,8 @@ static void libertas_parse_bssid(char *buf, size_t count, memcpy(scan_cfg->bssid, mac, ETH_ALEN); } -static void libertas_parse_ssid(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg) +static void lbs_parse_ssid(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg) { char *hold, *end; ssize_t size; @@ -268,7 +268,7 @@ static void libertas_parse_ssid(char *buf, size_t count, return; } -static int libertas_parse_clear(char *buf, size_t count, const char *tag) +static int lbs_parse_clear(char *buf, size_t count, const char *tag) { char *hold; int val; @@ -285,8 +285,8 @@ static int libertas_parse_clear(char *buf, size_t count, const char *tag) return val; } -static int libertas_parse_dur(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg) +static int lbs_parse_dur(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg) { char *hold; int val; @@ -300,8 +300,8 @@ static int libertas_parse_dur(char *buf, size_t count, return val; } -static void libertas_parse_probes(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg) +static void lbs_parse_probes(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg) { char *hold; int val; @@ -317,8 +317,8 @@ static void libertas_parse_probes(char *buf, size_t count, return; } -static void libertas_parse_type(char *buf, size_t count, - struct wlan_ioctl_user_scan_cfg *scan_cfg) +static void lbs_parse_type(char *buf, size_t count, + struct lbs_ioctl_user_scan_cfg *scan_cfg) { char *hold; int val; @@ -338,19 +338,19 @@ static void libertas_parse_type(char *buf, size_t count, return; } -static ssize_t libertas_setuserscan(struct file *file, +static ssize_t lbs_setuserscan(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; - struct wlan_ioctl_user_scan_cfg *scan_cfg; + struct lbs_ioctl_user_scan_cfg *scan_cfg; union iwreq_data wrqu; int dur; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - scan_cfg = kzalloc(sizeof(struct wlan_ioctl_user_scan_cfg), GFP_KERNEL); + scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL); if (!scan_cfg) return -ENOMEM; @@ -360,18 +360,18 @@ static ssize_t libertas_setuserscan(struct file *file, goto out_unlock; } - scan_cfg->bsstype = WLAN_SCAN_BSS_TYPE_ANY; + scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY; - dur = libertas_parse_dur(buf, count, scan_cfg); - libertas_parse_chan(buf, count, scan_cfg, dur); - libertas_parse_bssid(buf, count, scan_cfg); - scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid="); - libertas_parse_ssid(buf, count, scan_cfg); - scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid="); - libertas_parse_probes(buf, count, scan_cfg); - libertas_parse_type(buf, count, scan_cfg); + dur = lbs_parse_dur(buf, count, scan_cfg); + lbs_parse_chan(buf, count, scan_cfg, dur); + lbs_parse_bssid(buf, count, scan_cfg); + scan_cfg->clear_bssid = lbs_parse_clear(buf, count, "clear_bssid="); + lbs_parse_ssid(buf, count, scan_cfg); + scan_cfg->clear_ssid = lbs_parse_clear(buf, count, "clear_ssid="); + lbs_parse_probes(buf, count, scan_cfg); + lbs_parse_type(buf, count, scan_cfg); - wlan_scan_networks(priv, scan_cfg, 1); + lbs_scan_networks(priv, scan_cfg, 1); wait_event_interruptible(priv->adapter->cmd_pending, !priv->adapter->nr_cmd_pending); @@ -384,21 +384,21 @@ out_unlock: return count; } -static int libertas_event_initcmd(wlan_private *priv, void **response_buf, +static int lbs_event_initcmd(lbs_private *priv, void **response_buf, struct cmd_ctrl_node **cmdnode, struct cmd_ds_command **cmd) { u16 wait_option = CMD_OPTION_WAITFORRSP; - if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { - lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n"); + if (!(*cmdnode = lbs_get_free_cmd_ctrl_node(priv))) { + lbs_deb_debugfs("failed lbs_get_free_cmd_ctrl_node\n"); return -ENOMEM; } if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { lbs_deb_debugfs("failed to allocate response buffer!\n"); return -ENOMEM; } - libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); + lbs_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); init_waitqueue_head(&(*cmdnode)->cmdwait_q); (*cmdnode)->pdata_buf = *response_buf; (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; @@ -410,11 +410,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, return 0; } -static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, +static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -424,7 +424,7 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -433,7 +433,7 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -480,9 +480,9 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, return res; } -static u16 libertas_get_events_bitmap(wlan_private *priv) +static u16 lbs_get_events_bitmap(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -490,14 +490,14 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) int res; u16 event_bitmap; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) return res; event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -525,12 +525,12 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) return event_bitmap; } -static ssize_t libertas_lowrssi_write(struct file *file, +static ssize_t lbs_lowrssi_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -554,9 +554,9 @@ static ssize_t libertas_lowrssi_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -576,7 +576,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, event_bitmap |= subscribed ? 0x0001 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -606,11 +606,11 @@ out_unlock: return res; } -static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, +static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -620,7 +620,7 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -629,7 +629,7 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -678,12 +678,12 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_lowsnr_write(struct file *file, +static ssize_t lbs_lowsnr_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -707,9 +707,9 @@ static ssize_t libertas_lowsnr_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -728,7 +728,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, event_bitmap |= subscribed ? 0x0002 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -759,11 +759,11 @@ out_unlock: return res; } -static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, +static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -773,7 +773,7 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -782,7 +782,7 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -830,12 +830,12 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_failcount_write(struct file *file, +static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -859,9 +859,9 @@ static ssize_t libertas_failcount_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -880,7 +880,7 @@ static ssize_t libertas_failcount_write(struct file *file, event_bitmap |= subscribed ? 0x0004 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -910,11 +910,11 @@ out_unlock: return res; } -static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, +static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -924,7 +924,7 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -933,7 +933,7 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -981,12 +981,12 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_bcnmiss_write(struct file *file, +static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1010,9 +1010,9 @@ static ssize_t libertas_bcnmiss_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -1030,7 +1030,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, event_bitmap |= subscribed ? 0x0008 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -1060,11 +1060,11 @@ out_unlock: return res; } -static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, +static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -1074,7 +1074,7 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -1083,7 +1083,7 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -1132,12 +1132,12 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_highrssi_write(struct file *file, +static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1161,9 +1161,9 @@ static ssize_t libertas_highrssi_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -1182,7 +1182,7 @@ static ssize_t libertas_highrssi_write(struct file *file, event_bitmap |= subscribed ? 0x0010 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -1210,11 +1210,11 @@ out_unlock: return res; } -static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, +static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -1224,7 +1224,7 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) { free_page(addr); return res; @@ -1233,7 +1233,7 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, event = &pcmdptr->params.subscribe_event; event->action = cpu_to_le16(CMD_ACT_GET); pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -1282,12 +1282,12 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, return res; } -static ssize_t libertas_highsnr_write(struct file *file, +static ssize_t lbs_highsnr_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1311,9 +1311,9 @@ static ssize_t libertas_highsnr_write(struct file *file, goto out_unlock; } - event_bitmap = libertas_get_events_bitmap(priv); + event_bitmap = lbs_get_events_bitmap(priv); - res = libertas_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); + res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); if (res < 0) goto out_unlock; @@ -1332,7 +1332,7 @@ static ssize_t libertas_highsnr_write(struct file *file, event_bitmap |= subscribed ? 0x0020 : 0x0; event->events = cpu_to_le16(event_bitmap); - libertas_queue_cmd(adapter, pcmdnode, 1); + lbs_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->waitq); /* Sleep until response is generated by FW */ @@ -1362,12 +1362,12 @@ out_unlock: return res; } -static ssize_t libertas_rdmac_read(struct file *file, char __user *userbuf, +static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; - struct wlan_offset_value offval; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; + struct lbs_offset_value offval; ssize_t pos = 0; int ret; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -1376,7 +1376,7 @@ static ssize_t libertas_rdmac_read(struct file *file, char __user *userbuf, offval.offset = priv->mac_offset; offval.value = 0; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_MAC_REG_ACCESS, 0, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1388,11 +1388,11 @@ static ssize_t libertas_rdmac_read(struct file *file, char __user *userbuf, return ret; } -static ssize_t libertas_rdmac_write(struct file *file, +static ssize_t lbs_rdmac_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1409,15 +1409,15 @@ out_unlock: return res; } -static ssize_t libertas_wrmac_write(struct file *file, +static ssize_t lbs_wrmac_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; - struct wlan_offset_value offval; + struct lbs_offset_value offval; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1434,7 +1434,7 @@ static ssize_t libertas_wrmac_write(struct file *file, offval.offset = offset; offval.value = value; - res = libertas_prepare_and_send_command(priv, + res = lbs_prepare_and_send_command(priv, CMD_MAC_REG_ACCESS, 1, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1445,12 +1445,12 @@ out_unlock: return res; } -static ssize_t libertas_rdbbp_read(struct file *file, char __user *userbuf, +static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; - struct wlan_offset_value offval; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; + struct lbs_offset_value offval; ssize_t pos = 0; int ret; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -1459,7 +1459,7 @@ static ssize_t libertas_rdbbp_read(struct file *file, char __user *userbuf, offval.offset = priv->bbp_offset; offval.value = 0; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_BBP_REG_ACCESS, 0, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1472,11 +1472,11 @@ static ssize_t libertas_rdbbp_read(struct file *file, char __user *userbuf, return ret; } -static ssize_t libertas_rdbbp_write(struct file *file, +static ssize_t lbs_rdbbp_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1493,15 +1493,15 @@ out_unlock: return res; } -static ssize_t libertas_wrbbp_write(struct file *file, +static ssize_t lbs_wrbbp_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; - struct wlan_offset_value offval; + struct lbs_offset_value offval; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1518,7 +1518,7 @@ static ssize_t libertas_wrbbp_write(struct file *file, offval.offset = offset; offval.value = value; - res = libertas_prepare_and_send_command(priv, + res = lbs_prepare_and_send_command(priv, CMD_BBP_REG_ACCESS, 1, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1529,12 +1529,12 @@ out_unlock: return res; } -static ssize_t libertas_rdrf_read(struct file *file, char __user *userbuf, +static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; - wlan_adapter *adapter = priv->adapter; - struct wlan_offset_value offval; + lbs_private *priv = file->private_data; + lbs_adapter *adapter = priv->adapter; + struct lbs_offset_value offval; ssize_t pos = 0; int ret; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -1543,7 +1543,7 @@ static ssize_t libertas_rdrf_read(struct file *file, char __user *userbuf, offval.offset = priv->rf_offset; offval.value = 0; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_RF_REG_ACCESS, 0, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1556,11 +1556,11 @@ static ssize_t libertas_rdrf_read(struct file *file, char __user *userbuf, return ret; } -static ssize_t libertas_rdrf_write(struct file *file, +static ssize_t lbs_rdrf_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1577,15 +1577,15 @@ out_unlock: return res; } -static ssize_t libertas_wrrf_write(struct file *file, +static ssize_t lbs_wrrf_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - wlan_private *priv = file->private_data; + lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; - struct wlan_offset_value offval; + struct lbs_offset_value offval; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1602,7 +1602,7 @@ static ssize_t libertas_wrrf_write(struct file *file, offval.offset = offset; offval.value = value; - res = libertas_prepare_and_send_command(priv, + res = lbs_prepare_and_send_command(priv, CMD_RF_REG_ACCESS, 1, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); @@ -1620,69 +1620,69 @@ out_unlock: .write = (fwrite), \ } -struct libertas_debugfs_files { +struct lbs_debugfs_files { char *name; int perm; struct file_operations fops; }; -static struct libertas_debugfs_files debugfs_files[] = { - { "info", 0444, FOPS(libertas_dev_info, write_file_dummy), }, - { "getscantable", 0444, FOPS(libertas_getscantable, +static struct lbs_debugfs_files debugfs_files[] = { + { "info", 0444, FOPS(lbs_dev_info, write_file_dummy), }, + { "getscantable", 0444, FOPS(lbs_getscantable, write_file_dummy), }, - { "sleepparams", 0644, FOPS(libertas_sleepparams_read, - libertas_sleepparams_write), }, - { "extscan", 0600, FOPS(NULL, libertas_extscan), }, - { "setuserscan", 0600, FOPS(NULL, libertas_setuserscan), }, + { "sleepparams", 0644, FOPS(lbs_sleepparams_read, + lbs_sleepparams_write), }, + { "extscan", 0600, FOPS(NULL, lbs_extscan), }, + { "setuserscan", 0600, FOPS(NULL, lbs_setuserscan), }, }; -static struct libertas_debugfs_files debugfs_events_files[] = { - {"low_rssi", 0644, FOPS(libertas_lowrssi_read, - libertas_lowrssi_write), }, - {"low_snr", 0644, FOPS(libertas_lowsnr_read, - libertas_lowsnr_write), }, - {"failure_count", 0644, FOPS(libertas_failcount_read, - libertas_failcount_write), }, - {"beacon_missed", 0644, FOPS(libertas_bcnmiss_read, - libertas_bcnmiss_write), }, - {"high_rssi", 0644, FOPS(libertas_highrssi_read, - libertas_highrssi_write), }, - {"high_snr", 0644, FOPS(libertas_highsnr_read, - libertas_highsnr_write), }, +static struct lbs_debugfs_files debugfs_events_files[] = { + {"low_rssi", 0644, FOPS(lbs_lowrssi_read, + lbs_lowrssi_write), }, + {"low_snr", 0644, FOPS(lbs_lowsnr_read, + lbs_lowsnr_write), }, + {"failure_count", 0644, FOPS(lbs_failcount_read, + lbs_failcount_write), }, + {"beacon_missed", 0644, FOPS(lbs_bcnmiss_read, + lbs_bcnmiss_write), }, + {"high_rssi", 0644, FOPS(lbs_highrssi_read, + lbs_highrssi_write), }, + {"high_snr", 0644, FOPS(lbs_highsnr_read, + lbs_highsnr_write), }, }; -static struct libertas_debugfs_files debugfs_regs_files[] = { - {"rdmac", 0644, FOPS(libertas_rdmac_read, libertas_rdmac_write), }, - {"wrmac", 0600, FOPS(NULL, libertas_wrmac_write), }, - {"rdbbp", 0644, FOPS(libertas_rdbbp_read, libertas_rdbbp_write), }, - {"wrbbp", 0600, FOPS(NULL, libertas_wrbbp_write), }, - {"rdrf", 0644, FOPS(libertas_rdrf_read, libertas_rdrf_write), }, - {"wrrf", 0600, FOPS(NULL, libertas_wrrf_write), }, +static struct lbs_debugfs_files debugfs_regs_files[] = { + {"rdmac", 0644, FOPS(lbs_rdmac_read, lbs_rdmac_write), }, + {"wrmac", 0600, FOPS(NULL, lbs_wrmac_write), }, + {"rdbbp", 0644, FOPS(lbs_rdbbp_read, lbs_rdbbp_write), }, + {"wrbbp", 0600, FOPS(NULL, lbs_wrbbp_write), }, + {"rdrf", 0644, FOPS(lbs_rdrf_read, lbs_rdrf_write), }, + {"wrrf", 0600, FOPS(NULL, lbs_wrrf_write), }, }; -void libertas_debugfs_init(void) +void lbs_debugfs_init(void) { - if (!libertas_dir) - libertas_dir = debugfs_create_dir("libertas_wireless", NULL); + if (!lbs_dir) + lbs_dir = debugfs_create_dir("lbs_wireless", NULL); return; } -void libertas_debugfs_remove(void) +void lbs_debugfs_remove(void) { - if (libertas_dir) - debugfs_remove(libertas_dir); + if (lbs_dir) + debugfs_remove(lbs_dir); return; } -void libertas_debugfs_init_one(wlan_private *priv, struct net_device *dev) +void lbs_debugfs_init_one(lbs_private *priv, struct net_device *dev) { int i; - struct libertas_debugfs_files *files; - if (!libertas_dir) + struct lbs_debugfs_files *files; + if (!lbs_dir) goto exit; - priv->debugfs_dir = debugfs_create_dir(dev->name, libertas_dir); + priv->debugfs_dir = debugfs_create_dir(dev->name, lbs_dir); if (!priv->debugfs_dir) goto exit; @@ -1722,13 +1722,13 @@ void libertas_debugfs_init_one(wlan_private *priv, struct net_device *dev) } #ifdef PROC_DEBUG - libertas_debug_init(priv, dev); + lbs_debug_init(priv, dev); #endif exit: return; } -void libertas_debugfs_remove_one(wlan_private *priv) +void lbs_debugfs_remove_one(lbs_private *priv) { int i; @@ -1755,8 +1755,8 @@ void libertas_debugfs_remove_one(wlan_private *priv) #ifdef PROC_DEBUG -#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n)) -#define item_addr(n) (offsetof(wlan_adapter, n)) +#define item_size(n) (FIELD_SIZEOF(lbs_adapter, n)) +#define item_addr(n) (offsetof(lbs_adapter, n)) struct debug_data { @@ -1765,7 +1765,7 @@ struct debug_data { size_t addr; }; -/* To debug any member of wlan_adapter, simply add one line here. +/* To debug any member of lbs_adapter, simply add one line here. */ static struct debug_data items[] = { {"intcounter", item_size(intcounter), item_addr(intcounter)}, @@ -1786,7 +1786,7 @@ static int num_of_items = ARRAY_SIZE(items); * @param data data to output * @return number of output data */ -static ssize_t wlan_debugfs_read(struct file *file, char __user *userbuf, +static ssize_t lbs_debugfs_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { int val = 0; @@ -1830,7 +1830,7 @@ static ssize_t wlan_debugfs_read(struct file *file, char __user *userbuf, * @param data data to write * @return number of data */ -static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf, +static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, size_t cnt, loff_t *ppos) { int r, i; @@ -1882,21 +1882,21 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf, return (ssize_t)cnt; } -static struct file_operations libertas_debug_fops = { +static struct file_operations lbs_debug_fops = { .owner = THIS_MODULE, .open = open_file_generic, - .write = wlan_debugfs_write, - .read = wlan_debugfs_read, + .write = lbs_debugfs_write, + .read = lbs_debugfs_read, }; /** * @brief create debug proc file * - * @param priv pointer wlan_private + * @param priv pointer lbs_private * @param dev pointer net_device * @return N/A */ -static void libertas_debug_init(wlan_private * priv, struct net_device *dev) +static void lbs_debug_init(lbs_private * priv, struct net_device *dev) { int i; @@ -1908,7 +1908,7 @@ static void libertas_debug_init(wlan_private * priv, struct net_device *dev) priv->debugfs_debug = debugfs_create_file("debug", 0644, priv->debugfs_dir, &items[0], - &libertas_debug_fops); + &lbs_debug_fops); } #endif diff --git a/drivers/net/wireless/libertas/debugfs.h b/drivers/net/wireless/libertas/debugfs.h index 880a11b95d2..c9758458198 100644 --- a/drivers/net/wireless/libertas/debugfs.h +++ b/drivers/net/wireless/libertas/debugfs.h @@ -1,6 +1,10 @@ -void libertas_debugfs_init(void); -void libertas_debugfs_remove(void); +#ifndef _LBS_DEBUGFS_H_ +#define _LBS_DEBUGFS_H_ -void libertas_debugfs_init_one(wlan_private *priv, struct net_device *dev); -void libertas_debugfs_remove_one(wlan_private *priv); +void lbs_debugfs_init(void); +void lbs_debugfs_remove(void); +void lbs_debugfs_init_one(lbs_private *priv, struct net_device *dev); +void lbs_debugfs_remove_one(lbs_private *priv); + +#endif diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 87fea9d5b90..7dd76f8e8d2 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -3,80 +3,80 @@ * functions defined in other source files */ -#ifndef _WLAN_DECL_H_ -#define _WLAN_DECL_H_ +#ifndef _LBS_DECL_H_ +#define _LBS_DECL_H_ #include #include "defs.h" /** Function Prototype Declaration */ -struct wlan_private; +struct lbs_private; struct sk_buff; struct net_device; -int libertas_set_mac_packet_filter(wlan_private * priv); +int lbs_set_mac_packet_filter(lbs_private * priv); -void libertas_send_tx_feedback(wlan_private * priv); +void lbs_send_tx_feedback(lbs_private * priv); -int libertas_free_cmd_buffer(wlan_private * priv); +int lbs_free_cmd_buffer(lbs_private * priv); struct cmd_ctrl_node; -struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv); +struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(lbs_private * priv); -void libertas_set_cmd_ctrl_node(wlan_private * priv, +void lbs_set_cmd_ctrl_node(lbs_private * priv, struct cmd_ctrl_node *ptempnode, u32 cmd_oid, u16 wait_option, void *pdata_buf); -int libertas_prepare_and_send_command(wlan_private * priv, +int lbs_prepare_and_send_command(lbs_private * priv, u16 cmd_no, u16 cmd_action, u16 wait_option, u32 cmd_oid, void *pdata_buf); -void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail); +void lbs_queue_cmd(lbs_adapter *adapter, struct cmd_ctrl_node *cmdnode, u8 addtail); -int libertas_allocate_cmd_buffer(wlan_private * priv); -int libertas_execute_next_command(wlan_private * priv); -int libertas_process_event(wlan_private * priv); -void libertas_interrupt(struct net_device *); -int libertas_set_radio_control(wlan_private * priv); -u32 libertas_fw_index_to_data_rate(u8 index); -u8 libertas_data_rate_to_fw_index(u32 rate); -void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen); +int lbs_allocate_cmd_buffer(lbs_private * priv); +int lbs_execute_next_command(lbs_private * priv); +int lbs_process_event(lbs_private * priv); +void lbs_interrupt(struct net_device *); +int lbs_set_radio_control(lbs_private * priv); +u32 lbs_fw_index_to_data_rate(u8 index); +u8 lbs_data_rate_to_fw_index(u32 rate); +void lbs_get_fwversion(lbs_adapter *adapter, char *fwversion, int maxlen); -void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb); +void lbs_upload_rx_packet(lbs_private * priv, struct sk_buff *skb); /** The proc fs interface */ -int libertas_process_rx_command(wlan_private * priv); -int libertas_process_tx(wlan_private * priv, struct sk_buff *skb); -void __libertas_cleanup_and_insert_cmd(wlan_private * priv, +int lbs_process_rx_command(lbs_private * priv); +int lbs_process_tx(lbs_private * priv, struct sk_buff *skb); +void __lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptempcmd); -int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band); +int lbs_set_regiontable(lbs_private * priv, u8 region, u8 band); -int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *); +int lbs_process_rxed_packet(lbs_private * priv, struct sk_buff *); -void libertas_ps_sleep(wlan_private * priv, int wait_option); -void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode); -void libertas_ps_wakeup(wlan_private * priv, int wait_option); +void lbs_ps_sleep(lbs_private * priv, int wait_option); +void lbs_ps_confirm_sleep(lbs_private * priv, u16 psmode); +void lbs_ps_wakeup(lbs_private * priv, int wait_option); -void libertas_tx_runqueue(wlan_private *priv); +void lbs_tx_runqueue(lbs_private *priv); -struct chan_freq_power *libertas_find_cfp_by_band_and_channel( - wlan_adapter * adapter, u8 band, u16 channel); +struct chan_freq_power *lbs_find_cfp_by_band_and_channel( + lbs_adapter *adapter, u8 band, u16 channel); -void libertas_mac_event_disconnected(wlan_private * priv); +void lbs_mac_event_disconnected(lbs_private * priv); -void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); +void lbs_send_iwevcustom_event(lbs_private *priv, s8 *str); /* main.c */ -struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, +struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no); -wlan_private *libertas_add_card(void *card, struct device *dmdev); -int libertas_remove_card(wlan_private *priv); -int libertas_start_card(wlan_private *priv); -int libertas_stop_card(wlan_private *priv); -int libertas_add_mesh(wlan_private *priv, struct device *dev); -void libertas_remove_mesh(wlan_private *priv); -int libertas_reset_device(wlan_private *priv); - -#endif /* _WLAN_DECL_H_ */ +lbs_private *lbs_add_card(void *card, struct device *dmdev); +int lbs_remove_card(lbs_private *priv); +int lbs_start_card(lbs_private *priv); +int lbs_stop_card(lbs_private *priv); +int lbs_add_mesh(lbs_private *priv, struct device *dev); +void lbs_remove_mesh(lbs_private *priv); +int lbs_reset_device(lbs_private *priv); + +#endif diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 3a0c9beefcf..81ab99c3f49 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h @@ -2,8 +2,8 @@ * This header file contains global constant/enum definitions, * global variable declaration. */ -#ifndef _WLAN_DEFS_H_ -#define _WLAN_DEFS_H_ +#ifndef _LBS_DEFS_H_ +#define _LBS_DEFS_H_ #include @@ -41,11 +41,11 @@ #define LBS_DEB_HEX 0x00200000 #define LBS_DEB_SDIO 0x00400000 -extern unsigned int libertas_debug; +extern unsigned int lbs_debug; #ifdef DEBUG #define LBS_DEB_LL(grp, grpnam, fmt, args...) \ -do { if ((libertas_debug & (grp)) == (grp)) \ +do { if ((lbs_debug & (grp)) == (grp)) \ printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ in_interrupt() ? " (INT)" : "", ## args); } while (0) #else @@ -96,8 +96,8 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in int i = 0; if (len && - (libertas_debug & LBS_DEB_HEX) && - (libertas_debug & grp)) + (lbs_debug & LBS_DEB_HEX) && + (lbs_debug & grp)) { for (i = 1; i <= len; i++) { if ((i & 0xf) == 1) { @@ -138,7 +138,7 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in #define MRVDRV_ASSOCIATION_TIME_OUT 255 #define MRVDRV_SNAP_HEADER_LEN 8 -#define WLAN_UPLD_SIZE 2312 +#define LBS_UPLD_SIZE 2312 #define DEV_NAME_LEN 32 /** Misc constants */ @@ -262,12 +262,12 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in #define UNSET_MESH_FRAME(x) (x->cb[6]=0) /** Global Variable Declaration */ -typedef struct _wlan_private wlan_private; -typedef struct _wlan_adapter wlan_adapter; -extern const char libertas_driver_version[]; -extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE]; +typedef struct _lbs_private lbs_private; +typedef struct _lbs_adapter lbs_adapter; +extern const char lbs_driver_version[]; +extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; -extern u8 libertas_bg_rates[MAX_RATES]; +extern u8 lbs_bg_rates[MAX_RATES]; /** ENUM definition*/ /** SNRNF_TYPE */ @@ -284,13 +284,13 @@ enum SNRNF_DATA { MAX_TYPE_AVG }; -/** WLAN_802_11_POWER_MODE */ -enum WLAN_802_11_POWER_MODE { - WLAN802_11POWERMODECAM, - WLAN802_11POWERMODEMAX_PSP, - WLAN802_11POWERMODEFAST_PSP, +/** LBS_802_11_POWER_MODE */ +enum LBS_802_11_POWER_MODE { + LBS802_11POWERMODECAM, + LBS802_11POWERMODEMAX_PSP, + LBS802_11POWERMODEFAST_PSP, /*not a real mode, defined as an upper bound */ - WLAN802_11POWEMODEMAX + LBS802_11POWEMODEMAX }; /** PS_STATE */ @@ -308,16 +308,16 @@ enum DNLD_STATE { DNLD_CMD_SENT }; -/** WLAN_MEDIA_STATE */ -enum WLAN_MEDIA_STATE { - LIBERTAS_CONNECTED, - LIBERTAS_DISCONNECTED +/** LBS_MEDIA_STATE */ +enum LBS_MEDIA_STATE { + LBS_CONNECTED, + LBS_DISCONNECTED }; -/** WLAN_802_11_PRIVACY_FILTER */ -enum WLAN_802_11_PRIVACY_FILTER { - WLAN802_11PRIVFILTERACCEPTALL, - WLAN802_11PRIVFILTER8021XWEP +/** LBS_802_11_PRIVACY_FILTER */ +enum LBS_802_11_PRIVACY_FILTER { + LBS802_11PRIVFILTERACCEPTALL, + LBS802_11PRIVFILTER8021XWEP }; /** mv_ms_type */ @@ -382,4 +382,4 @@ enum SNMP_MIB_VALUE_e { #define FWT_DEFAULT_SLEEPMODE 0 #define FWT_DEFAULT_SNR 0 -#endif /* _WLAN_DEFS_H_ */ +#endif diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 1fb807aa91b..27db5d4389a 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -1,10 +1,10 @@ /** * This file contains definitions and data structures specific * to Marvell 802.11 NIC. It contains the Device Information - * structure wlan_adapter. + * structure lbs_adapter. */ -#ifndef _WLAN_DEV_H_ -#define _WLAN_DEV_H_ +#ifndef _LBS_DEV_H_ +#define _LBS_DEV_H_ #include #include @@ -15,7 +15,7 @@ #include "defs.h" #include "scan.h" -extern struct ethtool_ops libertas_ethtool_ops; +extern struct ethtool_ops lbs_ethtool_ops; #define MAX_BSSID_PER_CHANNEL 16 @@ -53,7 +53,7 @@ struct region_channel { struct chan_freq_power *CFP; }; -struct wlan_802_11_security { +struct lbs_802_11_security { u8 WPAenabled; u8 WPA2enabled; u8 wep_enabled; @@ -87,7 +87,7 @@ struct sleep_params { }; /* Mesh statistics */ -struct wlan_mesh_stats { +struct lbs_mesh_stats { u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */ u32 fwd_unicast_cnt; /* Fwd: Unicast counter */ u32 fwd_drop_ttl; /* Fwd: TTL zero */ @@ -99,7 +99,7 @@ struct wlan_mesh_stats { }; /** Private structure for the MV device */ -struct _wlan_private { +struct _lbs_private { int open; int mesh_open; int infra_open; @@ -109,7 +109,7 @@ struct _wlan_private { char name[DEV_NAME_LEN]; void *card; - wlan_adapter *adapter; + lbs_adapter *adapter; struct net_device *dev; struct net_device_stats stats; @@ -118,7 +118,7 @@ struct _wlan_private { struct ieee80211_device *ieee; struct iw_statistics wstats; - struct wlan_mesh_stats mstats; + struct lbs_mesh_stats mstats; struct dentry *debugfs_dir; struct dentry *debugfs_debug; struct dentry *debugfs_files[6]; @@ -136,7 +136,7 @@ struct _wlan_private { /** Upload length */ u32 upld_len; /* Upload buffer */ - u8 upld_buf[WLAN_UPLD_SIZE]; + u8 upld_buf[LBS_UPLD_SIZE]; /* Download sent: bit0 1/0=data_sent/data_tx_done, bit1 1/0=cmd_sent/cmd_tx_done, @@ -155,9 +155,9 @@ struct _wlan_private { struct work_struct sync_channel; /** Hardware access */ - int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb); - int (*hw_get_int_status) (wlan_private * priv, u8 *); - int (*hw_read_event_cause) (wlan_private *); + int (*hw_host_to_card) (lbs_private *priv, u8 type, u8 *payload, u16 nb); + int (*hw_get_int_status) (lbs_private *priv, u8 *); + int (*hw_read_event_cause) (lbs_private *); }; /** Association request @@ -194,7 +194,7 @@ struct assoc_request { struct enc_key wpa_mcast_key; struct enc_key wpa_unicast_key; - struct wlan_802_11_security secinfo; + struct lbs_802_11_security secinfo; /** WPA Information Elements*/ u8 wpa_ie[MAX_WPA_IE_LEN]; @@ -205,7 +205,7 @@ struct assoc_request { }; /** Wlan adapter data structure*/ -struct _wlan_adapter { +struct _lbs_adapter { /** STATUS variables */ u8 fwreleasenumber[4]; u32 fwcapinfo; @@ -213,7 +213,7 @@ struct _wlan_adapter { struct mutex lock; - u8 tmptxbuf[WLAN_UPLD_SIZE]; + u8 tmptxbuf[LBS_UPLD_SIZE]; /* protected by hard_start_xmit serialization */ /** command-related variables */ @@ -302,13 +302,13 @@ struct _wlan_adapter { u32 psstate; u8 needtowakeup; - struct PS_CMD_ConfirmSleep libertas_ps_confirm_sleep; + struct PS_CMD_ConfirmSleep lbs_ps_confirm_sleep; struct assoc_request * pending_assoc_req; struct assoc_request * in_progress_assoc_req; /** Encryption parameter */ - struct wlan_802_11_security secinfo; + struct lbs_802_11_security secinfo; /** WEP keys */ struct enc_key wep_keys[4]; @@ -350,7 +350,7 @@ struct _wlan_adapter { struct region_channel universal_channel[MAX_REGION_CHANNEL_NUM]; /** 11D and Domain Regulatory Data */ - struct wlan_802_11d_domain_reg domainreg; + struct lbs_802_11d_domain_reg domainreg; struct parsed_region_chan_11d parsed_region_chan; /** FSM variable for 11d support */ @@ -358,7 +358,7 @@ struct _wlan_adapter { /** MISCELLANEOUS */ u8 *prdeeprom; - struct wlan_offset_value offsetvalue; + struct lbs_offset_value offsetvalue; struct cmd_ds_802_11_get_log logmsg; @@ -368,4 +368,4 @@ struct _wlan_adapter { u8 last_scanned_channel; }; -#endif /* _WLAN_DEV_H_ */ +#endif diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index 3dae15211b6..8121399f4b9 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c @@ -19,35 +19,35 @@ static const char * mesh_stat_strings[]= { "tx_failed_cnt" }; -static void libertas_ethtool_get_drvinfo(struct net_device *dev, +static void lbs_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - wlan_private *priv = (wlan_private *) dev->priv; + lbs_private *priv = (lbs_private *) dev->priv; char fwver[32]; - libertas_get_fwversion(priv->adapter, fwver, sizeof(fwver) - 1); + lbs_get_fwversion(priv->adapter, fwver, sizeof(fwver) - 1); strcpy(info->driver, "libertas"); - strcpy(info->version, libertas_driver_version); + strcpy(info->version, lbs_driver_version); strcpy(info->fw_version, fwver); } /* All 8388 parts have 16KiB EEPROM size at the time of writing. * In case that changes this needs fixing. */ -#define LIBERTAS_EEPROM_LEN 16384 +#define LBS_EEPROM_LEN 16384 -static int libertas_ethtool_get_eeprom_len(struct net_device *dev) +static int lbs_ethtool_get_eeprom_len(struct net_device *dev) { - return LIBERTAS_EEPROM_LEN; + return LBS_EEPROM_LEN; } -static int libertas_ethtool_get_eeprom(struct net_device *dev, +static int lbs_ethtool_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 * bytes) { - wlan_private *priv = (wlan_private *) dev->priv; - wlan_adapter *adapter = priv->adapter; - struct wlan_ioctl_regrdwr regctrl; + lbs_private *priv = (lbs_private *) dev->priv; + lbs_adapter *adapter = priv->adapter; + struct lbs_ioctl_regrdwr regctrl; char *ptr; int ret; @@ -55,7 +55,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, regctrl.offset = eeprom->offset; regctrl.NOB = eeprom->len; - if (eeprom->offset + eeprom->len > LIBERTAS_EEPROM_LEN) + if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN) return -EINVAL; // mutex_lock(&priv->mutex); @@ -70,7 +70,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n", regctrl.action, regctrl.offset, regctrl.NOB); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_EEPROM_ACCESS, regctrl.action, CMD_OPTION_WAITFORRSP, 0, @@ -87,7 +87,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, ptr = (char *)adapter->prdeeprom; /* skip the command header, but include the "value" u32 variable */ - ptr = ptr + sizeof(struct wlan_ioctl_regrdwr) - 4; + ptr = ptr + sizeof(struct lbs_ioctl_regrdwr) - 4; /* * Return the result back to the user @@ -105,17 +105,17 @@ done: return ret; } -static void libertas_ethtool_get_stats(struct net_device * dev, +static void lbs_ethtool_get_stats(struct net_device * dev, struct ethtool_stats * stats, u64 * data) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; struct cmd_ds_mesh_access mesh_access; int ret; lbs_deb_enter(LBS_DEB_ETHTOOL); /* Get Mesh Statistics */ - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS, CMD_OPTION_WAITFORRSP, 0, &mesh_access); @@ -143,7 +143,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev, lbs_deb_enter(LBS_DEB_ETHTOOL); } -static int libertas_ethtool_get_sset_count(struct net_device * dev, int sset) +static int lbs_ethtool_get_sset_count(struct net_device * dev, int sset) { switch (sset) { case ETH_SS_STATS: @@ -153,7 +153,7 @@ static int libertas_ethtool_get_sset_count(struct net_device * dev, int sset) } } -static void libertas_ethtool_get_strings (struct net_device * dev, +static void lbs_ethtool_get_strings(struct net_device *dev, u32 stringset, u8 * s) { @@ -173,12 +173,12 @@ static void libertas_ethtool_get_strings (struct net_device * dev, lbs_deb_enter(LBS_DEB_ETHTOOL); } -struct ethtool_ops libertas_ethtool_ops = { - .get_drvinfo = libertas_ethtool_get_drvinfo, - .get_eeprom = libertas_ethtool_get_eeprom, - .get_eeprom_len = libertas_ethtool_get_eeprom_len, - .get_sset_count = libertas_ethtool_get_sset_count, - .get_ethtool_stats = libertas_ethtool_get_stats, - .get_strings = libertas_ethtool_get_strings, +struct ethtool_ops lbs_ethtool_ops = { + .get_drvinfo = lbs_ethtool_get_drvinfo, + .get_eeprom = lbs_ethtool_get_eeprom, + .get_eeprom_len = lbs_ethtool_get_eeprom_len, + .get_sset_count = lbs_ethtool_get_sset_count, + .get_ethtool_stats = lbs_ethtool_get_stats, + .get_strings = lbs_ethtool_get_strings, }; diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index b37ddbca969..3746f702d98 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -2,8 +2,8 @@ * This file contains definitions of WLAN commands. */ -#ifndef _HOST_H_ -#define _HOST_H_ +#ifndef _LBS_HOST_H_ +#define _LBS_HOST_H_ /** PUBLIC DEFINITIONS */ #define DEFAULT_AD_HOC_CHANNEL 6 @@ -287,4 +287,4 @@ enum cmd_mesh_access_opts { #define MACREG_INT_CODE_SNR_HIGH 0x0000001d #define MACREG_INT_CODE_MESH_AUTO_STARTED 0x00000023 -#endif /* _HOST_H_ */ +#endif diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index e1045dc02cc..6477ce0839d 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -2,8 +2,8 @@ * This file contains the function prototypes, data structure * and defines for all the host/station commands */ -#ifndef __HOSTCMD__H -#define __HOSTCMD__H +#ifndef _LBS_HOSTCMD_H +#define _LBS_HOSTCMD_H #include #include "11d.h" @@ -86,13 +86,13 @@ struct cmd_ctrl_node { /* Generic structure to hold all key types. */ struct enc_key { u16 len; - u16 flags; /* KEY_INFO_* from wlan_defs.h */ - u16 type; /* KEY_TYPE_* from wlan_defs.h */ + u16 flags; /* KEY_INFO_* from defs.h */ + u16 type; /* KEY_TYPE_* from defs.h */ u8 key[32]; }; -/* wlan_offset_value */ -struct wlan_offset_value { +/* lbs_offset_value */ +struct lbs_offset_value { u32 offset; u32 value; }; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index d383c0f9fe3..b0b95cf2e7c 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -57,7 +57,7 @@ MODULE_LICENSE("GPL"); struct if_cs_card { struct pcmcia_device *p_dev; - wlan_private *priv; + lbs_private *priv; void __iomem *iobase; }; @@ -263,7 +263,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) if (!card->priv->adapter->cur_cmd) wake_up_interruptible(&card->priv->waitq); - if (card->priv->adapter->connect_status == LIBERTAS_CONNECTED) + if (card->priv->adapter->connect_status == LBS_CONNECTED) netif_wake_queue(card->priv->dev); } @@ -271,7 +271,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); } - libertas_interrupt(card->priv->dev); + lbs_interrupt(card->priv->dev); return IRQ_HANDLED; } @@ -286,7 +286,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) /* * Called from if_cs_host_to_card to send a command to the hardware */ -static int if_cs_send_cmd(wlan_private *priv, u8 *buf, u16 nb) +static int if_cs_send_cmd(lbs_private *priv, u8 *buf, u16 nb) { struct if_cs_card *card = (struct if_cs_card *)priv->card; int ret = -1; @@ -331,7 +331,7 @@ done: /* * Called from if_cs_host_to_card to send a data to the hardware */ -static void if_cs_send_data(wlan_private *priv, u8 *buf, u16 nb) +static void if_cs_send_data(lbs_private *priv, u8 *buf, u16 nb) { struct if_cs_card *card = (struct if_cs_card *)priv->card; @@ -354,7 +354,7 @@ static void if_cs_send_data(wlan_private *priv, u8 *buf, u16 nb) /* * Get the command result out of the card. */ -static int if_cs_receive_cmdres(wlan_private *priv, u8* data, u32 *len) +static int if_cs_receive_cmdres(lbs_private *priv, u8 *data, u32 *len) { int ret = -1; u16 val; @@ -386,7 +386,7 @@ out: } -static struct sk_buff *if_cs_receive_data(wlan_private *priv) +static struct sk_buff *if_cs_receive_data(lbs_private *priv) { struct sk_buff *skb = NULL; u16 len; @@ -616,7 +616,7 @@ done: /********************************************************************/ /* Send commands or data packets to the card */ -static int if_cs_host_to_card(wlan_private *priv, u8 type, u8 *buf, u16 nb) +static int if_cs_host_to_card(lbs_private *priv, u8 type, u8 *buf, u16 nb) { int ret = -1; @@ -641,10 +641,10 @@ static int if_cs_host_to_card(wlan_private *priv, u8 type, u8 *buf, u16 nb) } -static int if_cs_get_int_status(wlan_private *priv, u8 *ireg) +static int if_cs_get_int_status(lbs_private *priv, u8 *ireg) { struct if_cs_card *card = (struct if_cs_card *)priv->card; - //wlan_adapter *adapter = priv->adapter; + /* lbs_adapter *adapter = priv->adapter; */ int ret = 0; u16 int_cause; u8 *cmdbuf; @@ -668,7 +668,7 @@ sbi_get_int_status_exit: /* is there a data packet for us? */ if (*ireg & IF_CS_C_S_RX_UPLD_RDY) { struct sk_buff *skb = if_cs_receive_data(priv); - libertas_process_rxed_packet(priv, skb); + lbs_process_rxed_packet(priv, skb); *ireg &= ~IF_CS_C_S_RX_UPLD_RDY; } @@ -698,7 +698,7 @@ out: } -static int if_cs_read_event_cause(wlan_private *priv) +static int if_cs_read_event_cause(lbs_private *priv) { lbs_deb_enter(LBS_DEB_CS); @@ -746,7 +746,7 @@ static void if_cs_release(struct pcmcia_device *p_dev) static int if_cs_probe(struct pcmcia_device *p_dev) { int ret = -ENOMEM; - wlan_private *priv; + lbs_private *priv; struct if_cs_card *card; /* CIS parsing */ tuple_t tuple; @@ -856,7 +856,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) goto out2; /* Make this card known to the libertas driver */ - priv = libertas_add_card(card, &p_dev->dev); + priv = lbs_add_card(card, &p_dev->dev); if (!priv) { ret = -ENOMEM; goto out2; @@ -885,7 +885,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) if_cs_enable_ints(card); /* And finally bring the card up */ - if (libertas_start_card(priv) != 0) { + if (lbs_start_card(priv) != 0) { lbs_pr_err("could not activate card\n"); goto out3; } @@ -894,7 +894,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) goto out; out3: - libertas_remove_card(priv); + lbs_remove_card(priv); out2: ioport_unmap(card->iobase); out1: @@ -917,8 +917,8 @@ static void if_cs_detach(struct pcmcia_device *p_dev) lbs_deb_enter(LBS_DEB_CS); - libertas_stop_card(card->priv); - libertas_remove_card(card->priv); + lbs_stop_card(card->priv); + lbs_remove_card(card->priv); if_cs_disable_ints(card); if_cs_release(p_dev); kfree(card); @@ -939,7 +939,7 @@ static struct pcmcia_device_id if_cs_ids[] = { MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); -static struct pcmcia_driver libertas_driver = { +static struct pcmcia_driver lbs_driver = { .owner = THIS_MODULE, .drv = { .name = DRV_NAME, @@ -955,7 +955,7 @@ static int __init if_cs_init(void) int ret; lbs_deb_enter(LBS_DEB_CS); - ret = pcmcia_register_driver(&libertas_driver); + ret = pcmcia_register_driver(&lbs_driver); lbs_deb_leave(LBS_DEB_CS); return ret; } @@ -964,7 +964,7 @@ static int __init if_cs_init(void) static void __exit if_cs_exit(void) { lbs_deb_enter(LBS_DEB_CS); - pcmcia_unregister_driver(&libertas_driver); + pcmcia_unregister_driver(&lbs_driver); lbs_deb_leave(LBS_DEB_CS); } diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 4f1efb108c2..0c762eea7a3 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -40,11 +40,11 @@ #include "dev.h" #include "if_sdio.h" -static char *libertas_helper_name = NULL; -module_param_named(helper_name, libertas_helper_name, charp, 0644); +static char *lbs_helper_name = NULL; +module_param_named(helper_name, lbs_helper_name, charp, 0644); -static char *libertas_fw_name = NULL; -module_param_named(fw_name, libertas_fw_name, charp, 0644); +static char *lbs_fw_name = NULL; +module_param_named(fw_name, lbs_fw_name, charp, 0644); static const struct sdio_device_id if_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_LIBERTAS) }, @@ -82,7 +82,7 @@ struct if_sdio_packet { struct if_sdio_card { struct sdio_func *func; - wlan_private *priv; + lbs_private *priv; int model; unsigned long ioport; @@ -154,7 +154,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, card->int_cause |= MRVDRV_CMD_UPLD_RDY; - libertas_interrupt(card->priv->dev); + lbs_interrupt(card->priv->dev); ret = 0; @@ -194,7 +194,7 @@ static int if_sdio_handle_data(struct if_sdio_card *card, memcpy(data, buffer, size); - libertas_process_rxed_packet(card->priv, skb); + lbs_process_rxed_packet(card->priv, skb); ret = 0; @@ -236,7 +236,7 @@ static int if_sdio_handle_event(struct if_sdio_card *card, card->event = event; card->int_cause |= MRVDRV_CARDEVENT; - libertas_interrupt(card->priv->dev); + lbs_interrupt(card->priv->dev); spin_unlock_irqrestore(&card->priv->adapter->driver_lock, flags); @@ -694,7 +694,7 @@ out: /* Libertas callbacks */ /*******************************************************************/ -static int if_sdio_host_to_card(wlan_private *priv, u8 type, u8 *buf, u16 nb) +static int if_sdio_host_to_card(lbs_private *priv, u8 type, u8 *buf, u16 nb) { int ret; struct if_sdio_card *card; @@ -775,7 +775,7 @@ out: return ret; } -static int if_sdio_get_int_status(wlan_private *priv, u8 *ireg) +static int if_sdio_get_int_status(lbs_private *priv, u8 *ireg) { struct if_sdio_card *card; @@ -791,7 +791,7 @@ static int if_sdio_get_int_status(wlan_private *priv, u8 *ireg) return 0; } -static int if_sdio_read_event_cause(wlan_private *priv) +static int if_sdio_read_event_cause(lbs_private *priv) { struct if_sdio_card *card; @@ -836,7 +836,7 @@ static void if_sdio_interrupt(struct sdio_func *func) */ if (cause & IF_SDIO_H_INT_DNLD) { if ((card->priv->dnld_sent == DNLD_DATA_SENT) && - (card->priv->adapter->connect_status == LIBERTAS_CONNECTED)) + (card->priv->adapter->connect_status == LBS_CONNECTED)) netif_wake_queue(card->priv->dev); card->priv->dnld_sent = DNLD_RES_RECEIVED; } @@ -857,7 +857,7 @@ static int if_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct if_sdio_card *card; - wlan_private *priv; + lbs_private *priv; int ret, i; unsigned int model; struct if_sdio_packet *packet; @@ -905,15 +905,15 @@ static int if_sdio_probe(struct sdio_func *func, card->helper = if_sdio_models[i].helper; card->firmware = if_sdio_models[i].firmware; - if (libertas_helper_name) { + if (lbs_helper_name) { lbs_deb_sdio("overriding helper firmware: %s\n", - libertas_helper_name); - card->helper = libertas_helper_name; + lbs_helper_name); + card->helper = lbs_helper_name; } - if (libertas_fw_name) { - lbs_deb_sdio("overriding firmware: %s\n", libertas_fw_name); - card->firmware = libertas_fw_name; + if (lbs_fw_name) { + lbs_deb_sdio("overriding firmware: %s\n", lbs_fw_name); + card->firmware = lbs_fw_name; } sdio_claim_host(func); @@ -951,7 +951,7 @@ static int if_sdio_probe(struct sdio_func *func, if (ret) goto reclaim; - priv = libertas_add_card(card, &func->dev); + priv = lbs_add_card(card, &func->dev); if (!priv) { ret = -ENOMEM; goto reclaim; @@ -975,7 +975,7 @@ static int if_sdio_probe(struct sdio_func *func, if (ret) goto reclaim; - ret = libertas_start_card(priv); + ret = lbs_start_card(priv); if (ret) goto err_activate_card; @@ -1020,8 +1020,8 @@ static void if_sdio_remove(struct sdio_func *func) card->priv->adapter->surpriseremoved = 1; lbs_deb_sdio("call remove card\n"); - libertas_stop_card(card->priv); - libertas_remove_card(card->priv); + lbs_stop_card(card->priv); + lbs_remove_card(card->priv); flush_scheduled_work(); diff --git a/drivers/net/wireless/libertas/if_sdio.h b/drivers/net/wireless/libertas/if_sdio.h index dfcaea7b168..533bdfbf5d2 100644 --- a/drivers/net/wireless/libertas/if_sdio.h +++ b/drivers/net/wireless/libertas/if_sdio.h @@ -9,8 +9,8 @@ * your option) any later version. */ -#ifndef LIBERTAS_IF_SDIO_H -#define LIBERTAS_IF_SDIO_H +#ifndef _LBS_IF_SDIO_H +#define _LBS_IF_SDIO_H #define IF_SDIO_IOPORT 0x00 diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index cb59f46ed12..797d3fbf715 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -21,8 +21,8 @@ static const char usbdriver_name[] = "usb8xxx"; static u8 *default_fw_name = "usb8388.bin"; -static char *libertas_fw_name = NULL; -module_param_named(fw_name, libertas_fw_name, charp, 0644); +static char *lbs_fw_name; +module_param_named(fw_name, lbs_fw_name, charp, 0644); /* * We need to send a RESET command to all USB devices before @@ -45,9 +45,9 @@ MODULE_DEVICE_TABLE(usb, if_usb_table); static void if_usb_receive(struct urb *urb); static void if_usb_receive_fwload(struct urb *urb); static int if_usb_prog_firmware(struct usb_card_rec *cardp); -static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb); -static int if_usb_get_int_status(wlan_private * priv, u8 *); -static int if_usb_read_event_cause(wlan_private *); +static int if_usb_host_to_card(lbs_private *priv, u8 type, u8 *payload, u16 nb); +static int if_usb_get_int_status(lbs_private *priv, u8 *); +static int if_usb_read_event_cause(lbs_private *); static int usb_tx_block(struct usb_card_rec *cardp, u8 *payload, u16 nb); static void if_usb_free(struct usb_card_rec *cardp); static int if_usb_submit_rx_urb(struct usb_card_rec *cardp); @@ -65,7 +65,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) /* handle the transmission complete validations */ if (urb->status == 0) { - wlan_private *priv = cardp->priv; + lbs_private *priv = cardp->priv; /* lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n"); @@ -77,7 +77,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) * valid at firmware load time. */ if (priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct net_device *dev = priv->dev; priv->dnld_sent = DNLD_RES_RECEIVED; @@ -86,7 +86,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) if (!adapter->cur_cmd) wake_up_interruptible(&priv->waitq); - if ((adapter->connect_status == LIBERTAS_CONNECTED)) { + if ((adapter->connect_status == LBS_CONNECTED)) { netif_wake_queue(dev); netif_wake_queue(priv->mesh_dev); } @@ -136,7 +136,7 @@ static int if_usb_probe(struct usb_interface *intf, struct usb_device *udev; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; - wlan_private *priv; + lbs_private *priv; struct usb_card_rec *cardp; int i; @@ -222,12 +222,12 @@ static int if_usb_probe(struct usb_interface *intf, goto err_prog_firmware; } - if (!(priv = libertas_add_card(cardp, &udev->dev))) + if (!(priv = lbs_add_card(cardp, &udev->dev))) goto err_prog_firmware; cardp->priv = priv; - if (libertas_add_mesh(priv, &udev->dev)) + if (lbs_add_mesh(priv, &udev->dev)) goto err_add_mesh; cardp->eth_dev = priv->dev; @@ -242,7 +242,7 @@ static int if_usb_probe(struct usb_interface *intf, msleep_interruptible(200); priv->adapter->fw_ready = 1; - if (libertas_start_card(priv)) + if (lbs_start_card(priv)) goto err_start_card; list_add_tail(&cardp->list, &usb_devices); @@ -253,9 +253,9 @@ static int if_usb_probe(struct usb_interface *intf, return 0; err_start_card: - libertas_remove_mesh(priv); + lbs_remove_mesh(priv); err_add_mesh: - libertas_remove_card(priv); + lbs_remove_card(priv); err_prog_firmware: if_usb_reset_device(cardp); dealloc: @@ -273,7 +273,7 @@ error: static void if_usb_disconnect(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - wlan_private *priv = (wlan_private *) cardp->priv; + lbs_private *priv = (lbs_private *) cardp->priv; lbs_deb_enter(LBS_DEB_MAIN); @@ -283,12 +283,12 @@ static void if_usb_disconnect(struct usb_interface *intf) list_del(&cardp->list); if (priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; adapter->surpriseremoved = 1; - libertas_stop_card(priv); - libertas_remove_mesh(priv); - libertas_remove_card(priv); + lbs_stop_card(priv); + lbs_remove_mesh(priv); + lbs_remove_card(priv); } /* Unlink and free urb */ @@ -302,7 +302,7 @@ static void if_usb_disconnect(struct usb_interface *intf) /** * @brief This function download FW - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @return 0 */ static int if_prog_firmware(struct usb_card_rec *cardp) @@ -385,7 +385,7 @@ static int if_prog_firmware(struct usb_card_rec *cardp) static int if_usb_reset_device(struct usb_card_rec *cardp) { int ret; - wlan_private * priv = cardp->priv; + lbs_private * priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -395,7 +395,7 @@ static int if_usb_reset_device(struct usb_card_rec *cardp) ret = usb_reset_device(cardp->udev); if (!ret && priv) { msleep(10); - ret = libertas_reset_device(priv); + ret = lbs_reset_device(priv); msleep(10); } @@ -406,7 +406,7 @@ static int if_usb_reset_device(struct usb_card_rec *cardp) /** * @brief This function transfer the data to the device. - * @param priv pointer to wlan_private + * @param priv pointer to lbs_private * @param payload pointer to payload data * @param nb data length * @return 0 or -1 @@ -583,7 +583,7 @@ exit: static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, struct usb_card_rec *cardp, - wlan_private *priv) + lbs_private *priv) { if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { @@ -596,14 +596,14 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, skb_reserve(skb, IPFIELD_ALIGN_OFFSET); skb_put(skb, recvlength); skb_pull(skb, MESSAGE_HEADER_LEN); - libertas_process_rxed_packet(priv, skb); + lbs_process_rxed_packet(priv, skb); priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); } static inline void process_cmdrequest(int recvlength, u8 *recvbuff, struct sk_buff *skb, struct usb_card_rec *cardp, - wlan_private *priv) + lbs_private *priv) { u8 *cmdbuf; if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { @@ -631,7 +631,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, priv->upld_len); kfree_skb(skb); - libertas_interrupt(priv->dev); + lbs_interrupt(priv->dev); spin_unlock(&priv->adapter->driver_lock); lbs_deb_usbd(&cardp->udev->dev, @@ -652,7 +652,7 @@ static void if_usb_receive(struct urb *urb) struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; struct sk_buff *skb = rinfo->skb; struct usb_card_rec *cardp = (struct usb_card_rec *) rinfo->cardp; - wlan_private * priv = cardp->priv; + lbs_private * priv = cardp->priv; int recvlength = urb->actual_length; u8 *recvbuff = NULL; @@ -695,14 +695,14 @@ static void if_usb_receive(struct urb *urb) lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", cardp->usb_event_cause); if (cardp->usb_event_cause & 0xffff0000) { - libertas_send_tx_feedback(priv); + lbs_send_tx_feedback(priv); spin_unlock(&priv->adapter->driver_lock); break; } cardp->usb_event_cause <<= 3; cardp->usb_int_cause |= MRVDRV_CARDEVENT; kfree_skb(skb); - libertas_interrupt(priv->dev); + lbs_interrupt(priv->dev); spin_unlock(&priv->adapter->driver_lock); goto rx_exit; default: @@ -720,13 +720,13 @@ rx_exit: /** * @brief This function downloads data to FW - * @param priv pointer to wlan_private structure + * @param priv pointer to lbs_private structure * @param type type of data * @param buf pointer to data buffer * @param len number of bytes * @return 0 or -1 */ -static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) +static int if_usb_host_to_card(lbs_private *priv, u8 type, u8 *payload, u16 nb) { struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; @@ -753,7 +753,7 @@ static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 n } /* called with adapter->driver_lock held */ -static int if_usb_get_int_status(wlan_private * priv, u8 * ireg) +static int if_usb_get_int_status(lbs_private *priv, u8 *ireg) { struct usb_card_rec *cardp = priv->card; @@ -765,7 +765,7 @@ static int if_usb_get_int_status(wlan_private * priv, u8 * ireg) return 0; } -static int if_usb_read_event_cause(wlan_private * priv) +static int if_usb_read_event_cause(lbs_private * priv) { struct usb_card_rec *cardp = priv->card; @@ -856,10 +856,10 @@ static int if_usb_prog_firmware(struct usb_card_rec *cardp) lbs_deb_enter(LBS_DEB_USB); - if ((ret = request_firmware(&cardp->fw, libertas_fw_name, + if ((ret = request_firmware(&cardp->fw, lbs_fw_name, &cardp->udev->dev)) < 0) { lbs_pr_err("request_firmware() failed with %#x\n", ret); - lbs_pr_err("firmware %s not found\n", libertas_fw_name); + lbs_pr_err("firmware %s not found\n", lbs_fw_name); goto done; } @@ -940,7 +940,7 @@ done: static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - wlan_private *priv = cardp->priv; + lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -954,7 +954,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); mesh_access.data[0] = cpu_to_le32(1); - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_MESH_ACCESS, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -976,7 +976,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) static int if_usb_resume(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - wlan_private *priv = cardp->priv; + lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -994,7 +994,7 @@ static int if_usb_resume(struct usb_interface *intf) struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); mesh_access.data[0] = cpu_to_le32(0); - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_MESH_ACCESS, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -1027,8 +1027,8 @@ static int if_usb_init_module(void) lbs_deb_enter(LBS_DEB_MAIN); - if (libertas_fw_name == NULL) { - libertas_fw_name = default_fw_name; + if (lbs_fw_name == NULL) { + lbs_fw_name = default_fw_name; } ret = usb_register(&if_usb_driver); @@ -1044,7 +1044,7 @@ static void if_usb_exit_module(void) lbs_deb_enter(LBS_DEB_MAIN); list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list) { - libertas_prepare_and_send_command(cardp->priv, CMD_802_11_RESET, + lbs_prepare_and_send_command(cardp->priv, CMD_802_11_RESET, CMD_ACT_HALT, 0, 0, NULL); } diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index e07a10ed28b..9b4230864c4 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -1,5 +1,5 @@ -#ifndef _LIBERTAS_IF_USB_H -#define _LIBERTAS_IF_USB_H +#ifndef _LBS_IF_USB_H +#define _LBS_IF_USB_H #include diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index dc24a05c944..90c25f47812 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -30,16 +30,16 @@ * NOTE: Setting the MSB of the basic rates need to be taken * care, either before or after calling this function * - * @param adapter A pointer to wlan_adapter structure + * @param adapter A pointer to lbs_adapter structure * @param rate1 the buffer which keeps input and output * @param rate1_size the size of rate1 buffer; new size of buffer on return * * @return 0 or -1 */ -static int get_common_rates(wlan_adapter * adapter, u8 * rates, u16 *rates_size) +static int get_common_rates(lbs_adapter *adapter, u8 *rates, u16 *rates_size) { - u8 *card_rates = libertas_bg_rates; - size_t num_card_rates = sizeof(libertas_bg_rates); + u8 *card_rates = lbs_bg_rates; + size_t num_card_rates = sizeof(lbs_bg_rates); int ret = 0, i, j; u8 tmp[30]; size_t tmp_size = 0; @@ -85,7 +85,7 @@ done: * @param rates buffer of data rates * @param len size of buffer */ -static void libertas_set_basic_rate_flags(u8 * rates, size_t len) +static void lbs_set_basic_rate_flags(u8 *rates, size_t len) { int i; @@ -104,7 +104,7 @@ static void libertas_set_basic_rate_flags(u8 * rates, size_t len) * @param rates buffer of data rates * @param len size of buffer */ -void libertas_unset_basic_rate_flags(u8 * rates, size_t len) +void lbs_unset_basic_rate_flags(u8 *rates, size_t len) { int i; @@ -116,19 +116,19 @@ void libertas_unset_basic_rate_flags(u8 * rates, size_t len) /** * @brief Associate to a specific BSS discovered in a scan * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param pbssdesc Pointer to the BSS descriptor to associate with. * * @return 0-success, otherwise fail */ -int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_associate(lbs_private *priv, struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret; lbs_deb_enter(LBS_DEB_JOIN); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req->bss.bssid); @@ -142,9 +142,9 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) else adapter->preamble = CMD_TYPE_LONG_PREAMBLE; - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_ASSOCIATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_ASSOCIATE, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); done: @@ -155,13 +155,13 @@ done: /** * @brief Start an Adhoc Network * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param adhocssid The ssid of the Adhoc Network * @return 0--success, -1--fail */ -int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_start_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; adapter->adhoccreate = 1; @@ -174,12 +174,12 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass adapter->preamble = CMD_TYPE_LONG_PREAMBLE; } - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel); lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_START, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_START, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); return ret; @@ -188,15 +188,15 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass /** * @brief Join an adhoc network found in a previous scan * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param pbssdesc Pointer to a BSS descriptor found in a previous scan * to attempt to join * * @return 0--success, -1--fail */ -int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_join_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct bss_descriptor * bss = &assoc_req->bss; int ret = 0; @@ -211,11 +211,11 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso /* check if the requested SSID is already joined */ if ( adapter->curbssparams.ssid_len - && !libertas_ssid_cmp(adapter->curbssparams.ssid, + && !lbs_ssid_cmp(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len, bss->ssid, bss->ssid_len) && (adapter->mode == IW_MODE_ADHOC) - && (adapter->connect_status == LIBERTAS_CONNECTED)) { + && (adapter->connect_status == LBS_CONNECTED)) { union iwreq_data wrqu; lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as " @@ -243,14 +243,14 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; } - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); adapter->adhoccreate = 0; - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, 0, CMD_OPTION_WAITFORRSP, OID_802_11_SSID, assoc_req); @@ -258,38 +258,38 @@ out: return ret; } -int libertas_stop_adhoc_network(wlan_private * priv) +int lbs_stop_adhoc_network(lbs_private * priv) { - return libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_STOP, + return lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_STOP, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } /** * @brief Send Deauthentication Request * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return 0--success, -1--fail */ -int libertas_send_deauthentication(wlan_private * priv) +int lbs_send_deauthentication(lbs_private *priv) { - return libertas_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, + return lbs_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } /** * @brief This function prepares command of authenticate. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param cmd A pointer to cmd_ds_command structure * @param pdata_buf Void cast of pointer to a BSSID to authenticate with * * @return 0 or -1 */ -int libertas_cmd_80211_authenticate(wlan_private * priv, +int lbs_cmd_80211_authenticate(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; int ret = -1; u8 *bssid = pdata_buf; @@ -329,10 +329,10 @@ out: return ret; } -int libertas_cmd_80211_deauthenticate(wlan_private * priv, +int lbs_cmd_80211_deauthenticate(lbs_private *priv, struct cmd_ds_command *cmd) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; lbs_deb_enter(LBS_DEB_JOIN); @@ -352,10 +352,10 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, return 0; } -int libertas_cmd_80211_associate(wlan_private * priv, +int lbs_cmd_80211_associate(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_associate *passo = &cmd->params.associate; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -431,7 +431,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(rates->rates, tmplen); + lbs_set_basic_rate_flags(rates->rates, tmplen); if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { rsn = (struct mrvlietypes_rsnparamset *) pos; @@ -448,7 +448,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, /* update curbssparams */ adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; - if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { + if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { ret = -1; goto done; } @@ -468,10 +468,10 @@ done: return ret; } -int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_start(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; int ret = 0; int cmdappendsize = 0; @@ -548,8 +548,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, adhs->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); memset(adhs->rates, 0, sizeof(adhs->rates)); - ratesize = min(sizeof(adhs->rates), sizeof(libertas_bg_rates)); - memcpy(adhs->rates, libertas_bg_rates, ratesize); + ratesize = min(sizeof(adhs->rates), sizeof(lbs_bg_rates)); + memcpy(adhs->rates, lbs_bg_rates, ratesize); /* Copy the ad-hoc creating rates into Current BSS state structure */ memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); @@ -558,14 +558,14 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(adhs->rates, ratesize); + lbs_set_basic_rate_flags(adhs->rates, ratesize); lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", adhs->rates[0], adhs->rates[1], adhs->rates[2], adhs->rates[3]); lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n"); - if (libertas_create_dnld_countryinfo_11d(priv)) { + if (lbs_create_dnld_countryinfo_11d(priv)) { lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); ret = -1; goto done; @@ -580,7 +580,7 @@ done: return ret; } -int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_stop(lbs_private *priv, struct cmd_ds_command *cmd) { cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP); @@ -589,10 +589,10 @@ int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, return 0; } -int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_join(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj; struct assoc_request * assoc_req = pdata_buf; struct bss_descriptor *bss = &assoc_req->bss; @@ -652,7 +652,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(join_cmd->bss.rates, ratesize); + lbs_set_basic_rate_flags(join_cmd->bss.rates, ratesize); join_cmd->bss.ssparamset.ibssparamset.atimwindow = cpu_to_le16(bss->atimwindow); @@ -663,12 +663,12 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, join_cmd->bss.capability = cpu_to_le16(tmp); } - if (adapter->psmode == WLAN802_11POWERMODEMAX_PSP) { + if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { /* wake up first */ __le32 Localpsmode; - Localpsmode = cpu_to_le32(WLAN802_11POWERMODECAM); - ret = libertas_prepare_and_send_command(priv, + Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM); + ret = lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, CMD_ACT_SET, 0, 0, &Localpsmode); @@ -679,7 +679,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, } } - if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { + if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { ret = -1; goto done; } @@ -692,10 +692,10 @@ done: return ret; } -int libertas_ret_80211_associate(wlan_private * priv, +int lbs_ret_80211_associate(lbs_private *priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; union iwreq_data wrqu; struct ieeetypes_assocrsp *passocrsp; @@ -762,7 +762,7 @@ int libertas_ret_80211_associate(wlan_private * priv, } if (status_code) { - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); ret = -1; goto done; } @@ -771,7 +771,7 @@ int libertas_ret_80211_associate(wlan_private * priv, le16_to_cpu(resp->size) - S_DS_GEN); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LIBERTAS_CONNECTED; + adapter->connect_status = LBS_CONNECTED; lbs_deb_join("ASSOC_RESP: assocated to '%s'\n", escape_essid(bss->ssid, bss->ssid_len)); @@ -809,21 +809,21 @@ done: return ret; } -int libertas_ret_80211_disassociate(wlan_private * priv, +int lbs_ret_80211_disassociate(lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); lbs_deb_leave(LBS_DEB_JOIN); return 0; } -int libertas_ret_80211_ad_hoc_start(wlan_private * priv, +int lbs_ret_80211_ad_hoc_start(lbs_private *priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; u16 command = le16_to_cpu(resp->command); u16 result = le16_to_cpu(resp->result); @@ -852,8 +852,8 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, */ if (result) { lbs_deb_join("ADHOC_RESP: failed\n"); - if (adapter->connect_status == LIBERTAS_CONNECTED) { - libertas_mac_event_disconnected(priv); + if (adapter->connect_status == LBS_CONNECTED) { + lbs_mac_event_disconnected(priv); } ret = -1; goto done; @@ -867,7 +867,7 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, escape_essid(bss->ssid, bss->ssid_len)); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LIBERTAS_CONNECTED; + adapter->connect_status = LBS_CONNECTED; if (command == CMD_RET(CMD_802_11_AD_HOC_START)) { /* Update the created network descriptor with the new BSSID */ @@ -904,12 +904,12 @@ done: return ret; } -int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, +int lbs_ret_80211_ad_hoc_stop(lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); lbs_deb_leave(LBS_DEB_JOIN); return 0; diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h index 894a072b9f8..5c2b2df5e57 100644 --- a/drivers/net/wireless/libertas/join.h +++ b/drivers/net/wireless/libertas/join.h @@ -2,52 +2,52 @@ * Interface for the wlan infrastructure and adhoc join routines * * Driver interface functions and type declarations for the join module - * implemented in wlan_join.c. Process all start/join requests for + * implemented in join.c. Process all start/join requests for * both adhoc and infrastructure networks */ -#ifndef _WLAN_JOIN_H -#define _WLAN_JOIN_H +#ifndef _LBS_JOIN_H +#define _LBS_JOIN_H #include "defs.h" #include "dev.h" struct cmd_ds_command; -int libertas_cmd_80211_authenticate(wlan_private * priv, +int lbs_cmd_80211_authenticate(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_join(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_stop(lbs_private *priv, struct cmd_ds_command *cmd); -int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_start(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int libertas_cmd_80211_deauthenticate(wlan_private * priv, +int lbs_cmd_80211_deauthenticate(lbs_private *priv, struct cmd_ds_command *cmd); -int libertas_cmd_80211_associate(wlan_private * priv, +int lbs_cmd_80211_associate(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int libertas_ret_80211_ad_hoc_start(wlan_private * priv, +int lbs_ret_80211_ad_hoc_start(lbs_private *priv, struct cmd_ds_command *resp); -int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, +int lbs_ret_80211_ad_hoc_stop(lbs_private *priv, struct cmd_ds_command *resp); -int libertas_ret_80211_disassociate(wlan_private * priv, +int lbs_ret_80211_disassociate(lbs_private *priv, struct cmd_ds_command *resp); -int libertas_ret_80211_associate(wlan_private * priv, +int lbs_ret_80211_associate(lbs_private *priv, struct cmd_ds_command *resp); -int libertas_start_adhoc_network(wlan_private * priv, +int lbs_start_adhoc_network(lbs_private *priv, struct assoc_request * assoc_req); -int libertas_join_adhoc_network(wlan_private * priv, +int lbs_join_adhoc_network(lbs_private *priv, struct assoc_request * assoc_req); -int libertas_stop_adhoc_network(wlan_private * priv); +int lbs_stop_adhoc_network(lbs_private *priv); -int libertas_send_deauthentication(wlan_private * priv); +int lbs_send_deauthentication(lbs_private *priv); -int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req); +int lbs_associate(lbs_private *priv, struct assoc_request *assoc_req); -void libertas_unset_basic_rate_flags(u8 * rates, size_t len); +void lbs_unset_basic_rate_flags(u8 *rates, size_t len); #endif diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 1823b48a8ba..825970af341 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -24,7 +24,7 @@ #include "join.h" #define DRIVER_RELEASE_VERSION "323.p0" -const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION +const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION #ifdef DEBUG "-dbg" #endif @@ -32,80 +32,80 @@ const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION /* Module parameters */ -unsigned int libertas_debug = 0; -module_param(libertas_debug, int, 0644); -EXPORT_SYMBOL_GPL(libertas_debug); +unsigned int lbs_debug; +EXPORT_SYMBOL_GPL(lbs_debug); +module_param_named(libertas_debug, lbs_debug, int, 0644); -#define WLAN_TX_PWR_DEFAULT 20 /*100mW */ -#define WLAN_TX_PWR_US_DEFAULT 20 /*100mW */ -#define WLAN_TX_PWR_JP_DEFAULT 16 /*50mW */ -#define WLAN_TX_PWR_FR_DEFAULT 20 /*100mW */ -#define WLAN_TX_PWR_EMEA_DEFAULT 20 /*100mW */ +#define LBS_TX_PWR_DEFAULT 20 /*100mW */ +#define LBS_TX_PWR_US_DEFAULT 20 /*100mW */ +#define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */ +#define LBS_TX_PWR_FR_DEFAULT 20 /*100mW */ +#define LBS_TX_PWR_EMEA_DEFAULT 20 /*100mW */ /* Format { channel, frequency (MHz), maxtxpower } */ /* band: 'B/G', region: USA FCC/Canada IC */ static struct chan_freq_power channel_freq_power_US_BG[] = { - {1, 2412, WLAN_TX_PWR_US_DEFAULT}, - {2, 2417, WLAN_TX_PWR_US_DEFAULT}, - {3, 2422, WLAN_TX_PWR_US_DEFAULT}, - {4, 2427, WLAN_TX_PWR_US_DEFAULT}, - {5, 2432, WLAN_TX_PWR_US_DEFAULT}, - {6, 2437, WLAN_TX_PWR_US_DEFAULT}, - {7, 2442, WLAN_TX_PWR_US_DEFAULT}, - {8, 2447, WLAN_TX_PWR_US_DEFAULT}, - {9, 2452, WLAN_TX_PWR_US_DEFAULT}, - {10, 2457, WLAN_TX_PWR_US_DEFAULT}, - {11, 2462, WLAN_TX_PWR_US_DEFAULT} + {1, 2412, LBS_TX_PWR_US_DEFAULT}, + {2, 2417, LBS_TX_PWR_US_DEFAULT}, + {3, 2422, LBS_TX_PWR_US_DEFAULT}, + {4, 2427, LBS_TX_PWR_US_DEFAULT}, + {5, 2432, LBS_TX_PWR_US_DEFAULT}, + {6, 2437, LBS_TX_PWR_US_DEFAULT}, + {7, 2442, LBS_TX_PWR_US_DEFAULT}, + {8, 2447, LBS_TX_PWR_US_DEFAULT}, + {9, 2452, LBS_TX_PWR_US_DEFAULT}, + {10, 2457, LBS_TX_PWR_US_DEFAULT}, + {11, 2462, LBS_TX_PWR_US_DEFAULT} }; /* band: 'B/G', region: Europe ETSI */ static struct chan_freq_power channel_freq_power_EU_BG[] = { - {1, 2412, WLAN_TX_PWR_EMEA_DEFAULT}, - {2, 2417, WLAN_TX_PWR_EMEA_DEFAULT}, - {3, 2422, WLAN_TX_PWR_EMEA_DEFAULT}, - {4, 2427, WLAN_TX_PWR_EMEA_DEFAULT}, - {5, 2432, WLAN_TX_PWR_EMEA_DEFAULT}, - {6, 2437, WLAN_TX_PWR_EMEA_DEFAULT}, - {7, 2442, WLAN_TX_PWR_EMEA_DEFAULT}, - {8, 2447, WLAN_TX_PWR_EMEA_DEFAULT}, - {9, 2452, WLAN_TX_PWR_EMEA_DEFAULT}, - {10, 2457, WLAN_TX_PWR_EMEA_DEFAULT}, - {11, 2462, WLAN_TX_PWR_EMEA_DEFAULT}, - {12, 2467, WLAN_TX_PWR_EMEA_DEFAULT}, - {13, 2472, WLAN_TX_PWR_EMEA_DEFAULT} + {1, 2412, LBS_TX_PWR_EMEA_DEFAULT}, + {2, 2417, LBS_TX_PWR_EMEA_DEFAULT}, + {3, 2422, LBS_TX_PWR_EMEA_DEFAULT}, + {4, 2427, LBS_TX_PWR_EMEA_DEFAULT}, + {5, 2432, LBS_TX_PWR_EMEA_DEFAULT}, + {6, 2437, LBS_TX_PWR_EMEA_DEFAULT}, + {7, 2442, LBS_TX_PWR_EMEA_DEFAULT}, + {8, 2447, LBS_TX_PWR_EMEA_DEFAULT}, + {9, 2452, LBS_TX_PWR_EMEA_DEFAULT}, + {10, 2457, LBS_TX_PWR_EMEA_DEFAULT}, + {11, 2462, LBS_TX_PWR_EMEA_DEFAULT}, + {12, 2467, LBS_TX_PWR_EMEA_DEFAULT}, + {13, 2472, LBS_TX_PWR_EMEA_DEFAULT} }; /* band: 'B/G', region: Spain */ static struct chan_freq_power channel_freq_power_SPN_BG[] = { - {10, 2457, WLAN_TX_PWR_DEFAULT}, - {11, 2462, WLAN_TX_PWR_DEFAULT} + {10, 2457, LBS_TX_PWR_DEFAULT}, + {11, 2462, LBS_TX_PWR_DEFAULT} }; /* band: 'B/G', region: France */ static struct chan_freq_power channel_freq_power_FR_BG[] = { - {10, 2457, WLAN_TX_PWR_FR_DEFAULT}, - {11, 2462, WLAN_TX_PWR_FR_DEFAULT}, - {12, 2467, WLAN_TX_PWR_FR_DEFAULT}, - {13, 2472, WLAN_TX_PWR_FR_DEFAULT} + {10, 2457, LBS_TX_PWR_FR_DEFAULT}, + {11, 2462, LBS_TX_PWR_FR_DEFAULT}, + {12, 2467, LBS_TX_PWR_FR_DEFAULT}, + {13, 2472, LBS_TX_PWR_FR_DEFAULT} }; /* band: 'B/G', region: Japan */ static struct chan_freq_power channel_freq_power_JPN_BG[] = { - {1, 2412, WLAN_TX_PWR_JP_DEFAULT}, - {2, 2417, WLAN_TX_PWR_JP_DEFAULT}, - {3, 2422, WLAN_TX_PWR_JP_DEFAULT}, - {4, 2427, WLAN_TX_PWR_JP_DEFAULT}, - {5, 2432, WLAN_TX_PWR_JP_DEFAULT}, - {6, 2437, WLAN_TX_PWR_JP_DEFAULT}, - {7, 2442, WLAN_TX_PWR_JP_DEFAULT}, - {8, 2447, WLAN_TX_PWR_JP_DEFAULT}, - {9, 2452, WLAN_TX_PWR_JP_DEFAULT}, - {10, 2457, WLAN_TX_PWR_JP_DEFAULT}, - {11, 2462, WLAN_TX_PWR_JP_DEFAULT}, - {12, 2467, WLAN_TX_PWR_JP_DEFAULT}, - {13, 2472, WLAN_TX_PWR_JP_DEFAULT}, - {14, 2484, WLAN_TX_PWR_JP_DEFAULT} + {1, 2412, LBS_TX_PWR_JP_DEFAULT}, + {2, 2417, LBS_TX_PWR_JP_DEFAULT}, + {3, 2422, LBS_TX_PWR_JP_DEFAULT}, + {4, 2427, LBS_TX_PWR_JP_DEFAULT}, + {5, 2432, LBS_TX_PWR_JP_DEFAULT}, + {6, 2437, LBS_TX_PWR_JP_DEFAULT}, + {7, 2442, LBS_TX_PWR_JP_DEFAULT}, + {8, 2447, LBS_TX_PWR_JP_DEFAULT}, + {9, 2452, LBS_TX_PWR_JP_DEFAULT}, + {10, 2457, LBS_TX_PWR_JP_DEFAULT}, + {11, 2462, LBS_TX_PWR_JP_DEFAULT}, + {12, 2467, LBS_TX_PWR_JP_DEFAULT}, + {13, 2472, LBS_TX_PWR_JP_DEFAULT}, + {14, 2484, LBS_TX_PWR_JP_DEFAULT} }; /** @@ -153,13 +153,13 @@ static struct region_cfp_table region_cfp_table[] = { /** * the table to keep region code */ -u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = +u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE] = { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; /** * 802.11b/g supported bitrates (in 500Kb/s units) */ -u8 libertas_bg_rates[MAX_RATES] = +u8 lbs_bg_rates[MAX_RATES] = { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0x00, 0x00 }; @@ -179,7 +179,7 @@ static u8 fw_data_rates[MAX_RATES] = * @param idx The index of data rate * @return data rate or 0 */ -u32 libertas_fw_index_to_data_rate(u8 idx) +u32 lbs_fw_index_to_data_rate(u8 idx) { if (idx >= sizeof(fw_data_rates)) idx = 0; @@ -192,7 +192,7 @@ u32 libertas_fw_index_to_data_rate(u8 idx) * @param rate data rate * @return index or 0 */ -u8 libertas_data_rate_to_fw_index(u32 rate) +u8 lbs_data_rate_to_fw_index(u32 rate) { u8 i; @@ -213,13 +213,13 @@ u8 libertas_data_rate_to_fw_index(u32 rate) /** * @brief Get function for sysfs attribute anycast_mask */ -static ssize_t libertas_anycast_get(struct device * dev, +static ssize_t lbs_anycast_get(struct device *dev, struct device_attribute *attr, char * buf) { struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); - libertas_prepare_and_send_command(to_net_dev(dev)->priv, + lbs_prepare_and_send_command(to_net_dev(dev)->priv, CMD_MESH_ACCESS, CMD_ACT_MESH_GET_ANYCAST, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -230,7 +230,7 @@ static ssize_t libertas_anycast_get(struct device * dev, /** * @brief Set function for sysfs attribute anycast_mask */ -static ssize_t libertas_anycast_set(struct device * dev, +static ssize_t lbs_anycast_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { struct cmd_ds_mesh_access mesh_access; @@ -240,86 +240,86 @@ static ssize_t libertas_anycast_set(struct device * dev, sscanf(buf, "%x", &datum); mesh_access.data[0] = cpu_to_le32(datum); - libertas_prepare_and_send_command((to_net_dev(dev))->priv, + lbs_prepare_and_send_command((to_net_dev(dev))->priv, CMD_MESH_ACCESS, CMD_ACT_MESH_SET_ANYCAST, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); return strlen(buf); } -int libertas_add_rtap(wlan_private *priv); -void libertas_remove_rtap(wlan_private *priv); +int lbs_add_rtap(lbs_private *priv); +void lbs_remove_rtap(lbs_private *priv); /** * Get function for sysfs attribute rtap */ -static ssize_t libertas_rtap_get(struct device * dev, +static ssize_t lbs_rtap_get(struct device *dev, struct device_attribute *attr, char * buf) { - wlan_private *priv = (wlan_private *) (to_net_dev(dev))->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *) (to_net_dev(dev))->priv; + lbs_adapter *adapter = priv->adapter; return snprintf(buf, 5, "0x%X\n", adapter->monitormode); } /** * Set function for sysfs attribute rtap */ -static ssize_t libertas_rtap_set(struct device * dev, +static ssize_t lbs_rtap_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { int monitor_mode; - wlan_private *priv = (wlan_private *) (to_net_dev(dev))->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *) (to_net_dev(dev))->priv; + lbs_adapter *adapter = priv->adapter; sscanf(buf, "%x", &monitor_mode); - if (monitor_mode != WLAN_MONITOR_OFF) { + if (monitor_mode != LBS_MONITOR_OFF) { if(adapter->monitormode == monitor_mode) return strlen(buf); - if (adapter->monitormode == WLAN_MONITOR_OFF) { + if (adapter->monitormode == LBS_MONITOR_OFF) { if (adapter->mode == IW_MODE_INFRA) - libertas_send_deauthentication(priv); + lbs_send_deauthentication(priv); else if (adapter->mode == IW_MODE_ADHOC) - libertas_stop_adhoc_network(priv); - libertas_add_rtap(priv); + lbs_stop_adhoc_network(priv); + lbs_add_rtap(priv); } adapter->monitormode = monitor_mode; } else { - if(adapter->monitormode == WLAN_MONITOR_OFF) + if (adapter->monitormode == LBS_MONITOR_OFF) return strlen(buf); - adapter->monitormode = WLAN_MONITOR_OFF; - libertas_remove_rtap(priv); + adapter->monitormode = LBS_MONITOR_OFF; + lbs_remove_rtap(priv); netif_wake_queue(priv->dev); netif_wake_queue(priv->mesh_dev); } - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_802_11_MONITOR_MODE, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, &adapter->monitormode); return strlen(buf); } /** - * libertas_rtap attribute to be exported per mshX interface + * lbs_rtap attribute to be exported per mshX interface * through sysfs (/sys/class/net/mshX/libertas-rtap) */ -static DEVICE_ATTR(libertas_rtap, 0644, libertas_rtap_get, - libertas_rtap_set ); +static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, + lbs_rtap_set ); /** * anycast_mask attribute to be exported per mshX interface * through sysfs (/sys/class/net/mshX/anycast_mask) */ -static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set); +static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); -static ssize_t libertas_autostart_enabled_get(struct device * dev, +static ssize_t lbs_autostart_enabled_get(struct device *dev, struct device_attribute *attr, char * buf) { struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); - libertas_prepare_and_send_command(to_net_dev(dev)->priv, + lbs_prepare_and_send_command(to_net_dev(dev)->priv, CMD_MESH_ACCESS, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -327,19 +327,19 @@ static ssize_t libertas_autostart_enabled_get(struct device * dev, return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); } -static ssize_t libertas_autostart_enabled_set(struct device * dev, +static ssize_t lbs_autostart_enabled_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { struct cmd_ds_mesh_access mesh_access; uint32_t datum; - wlan_private * priv = (to_net_dev(dev))->priv; + lbs_private *priv = (to_net_dev(dev))->priv; int ret; memset(&mesh_access, 0, sizeof(mesh_access)); sscanf(buf, "%d", &datum); mesh_access.data[0] = cpu_to_le32(datum); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_MESH_ACCESS, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -350,16 +350,16 @@ static ssize_t libertas_autostart_enabled_set(struct device * dev, } static DEVICE_ATTR(autostart_enabled, 0644, - libertas_autostart_enabled_get, libertas_autostart_enabled_set); + lbs_autostart_enabled_get, lbs_autostart_enabled_set); -static struct attribute *libertas_mesh_sysfs_entries[] = { +static struct attribute *lbs_mesh_sysfs_entries[] = { &dev_attr_anycast_mask.attr, &dev_attr_autostart_enabled.attr, NULL, }; -static struct attribute_group libertas_mesh_attr_group = { - .attrs = libertas_mesh_sysfs_entries, +static struct attribute_group lbs_mesh_attr_group = { + .attrs = lbs_mesh_sysfs_entries, }; /** @@ -375,8 +375,8 @@ static struct attribute_group libertas_mesh_attr_group = { */ static int pre_open_check(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *) dev->priv; + lbs_adapter *adapter = priv->adapter; int i = 0; while (!adapter->fw_ready && i < 20) { @@ -397,16 +397,16 @@ static int pre_open_check(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int libertas_dev_open(struct net_device *dev) +static int lbs_dev_open(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *) dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_NET); priv->open = 1; - if (adapter->connect_status == LIBERTAS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); if (priv->mesh_dev) netif_carrier_on(priv->mesh_dev); @@ -425,16 +425,16 @@ static int libertas_dev_open(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int libertas_mesh_open(struct net_device *dev) +static int lbs_mesh_open(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv ; + lbs_private *priv = (lbs_private *) dev->priv ; if (pre_open_check(dev) == -1) return -1; priv->mesh_open = 1 ; netif_wake_queue(priv->mesh_dev); if (priv->infra_open == 0) - return libertas_dev_open(priv->dev) ; + return lbs_dev_open(priv->dev) ; return 0; } @@ -444,22 +444,22 @@ static int libertas_mesh_open(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int libertas_open(struct net_device *dev) +static int lbs_open(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv ; + lbs_private *priv = (lbs_private *) dev->priv ; if(pre_open_check(dev) == -1) return -1; priv->infra_open = 1 ; netif_wake_queue(priv->dev); if (priv->open == 0) - return libertas_dev_open(priv->dev) ; + return lbs_dev_open(priv->dev) ; return 0; } -static int libertas_dev_close(struct net_device *dev) +static int lbs_dev_close(struct net_device *dev) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_NET); @@ -476,14 +476,14 @@ static int libertas_dev_close(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int libertas_mesh_close(struct net_device *dev) +static int lbs_mesh_close(struct net_device *dev) { - wlan_private *priv = (wlan_private *) (dev->priv); + lbs_private *priv = (lbs_private *) (dev->priv); priv->mesh_open = 0; netif_stop_queue(priv->mesh_dev); if (priv->infra_open == 0) - return libertas_dev_close(dev); + return lbs_dev_close(dev); else return 0; } @@ -494,23 +494,23 @@ static int libertas_mesh_close(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int libertas_close(struct net_device *dev) +static int lbs_close(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv; + lbs_private *priv = (lbs_private *) dev->priv; netif_stop_queue(dev); priv->infra_open = 0; if (priv->mesh_open == 0) - return libertas_dev_close(dev); + return lbs_dev_close(dev); else return 0; } -static int libertas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) +static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { int ret = 0; - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_NET); @@ -523,7 +523,7 @@ static int libertas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (priv->mesh_dev) netif_stop_queue(priv->mesh_dev); - if (libertas_process_tx(priv, skb) == 0) + if (lbs_process_tx(priv, skb) == 0) dev->trans_start = jiffies; done: lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); @@ -531,54 +531,54 @@ done: } /** - * @brief Mark mesh packets and handover them to libertas_hard_start_xmit + * @brief Mark mesh packets and handover them to lbs_hard_start_xmit * */ -static int libertas_mesh_pre_start_xmit(struct sk_buff *skb, +static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; int ret; lbs_deb_enter(LBS_DEB_MESH); - if(priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode != LBS_MONITOR_OFF) { netif_stop_queue(dev); return -EOPNOTSUPP; } SET_MESH_FRAME(skb); - ret = libertas_hard_start_xmit(skb, priv->dev); + ret = lbs_hard_start_xmit(skb, priv->dev); lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); return ret; } /** - * @brief Mark non-mesh packets and handover them to libertas_hard_start_xmit + * @brief Mark non-mesh packets and handover them to lbs_hard_start_xmit * */ -static int libertas_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) +static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; int ret; lbs_deb_enter(LBS_DEB_NET); - if(priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode != LBS_MONITOR_OFF) { netif_stop_queue(dev); return -EOPNOTSUPP; } UNSET_MESH_FRAME(skb); - ret = libertas_hard_start_xmit(skb, dev); + ret = lbs_hard_start_xmit(skb, dev); lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); return ret; } -static void libertas_tx_timeout(struct net_device *dev) +static void lbs_tx_timeout(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv; + lbs_private *priv = (lbs_private *) dev->priv; lbs_deb_enter(LBS_DEB_TX); @@ -588,14 +588,14 @@ static void libertas_tx_timeout(struct net_device *dev) dev->trans_start = jiffies; if (priv->adapter->currenttxskb) { - if (priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode != LBS_MONITOR_OFF) { /* If we are here, we have not received feedback from the previous packet. Assume TX_FAIL and move on. */ priv->adapter->eventcause = 0x01000000; - libertas_send_tx_feedback(priv); + lbs_send_tx_feedback(priv); } else wake_up_interruptible(&priv->waitq); - } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { + } else if (priv->adapter->connect_status == LBS_CONNECTED) { netif_wake_queue(priv->dev); if (priv->mesh_dev) netif_wake_queue(priv->mesh_dev); @@ -607,21 +607,21 @@ static void libertas_tx_timeout(struct net_device *dev) /** * @brief This function returns the network statistics * - * @param dev A pointer to wlan_private structure + * @param dev A pointer to lbs_private structure * @return A pointer to net_device_stats structure */ -static struct net_device_stats *libertas_get_stats(struct net_device *dev) +static struct net_device_stats *lbs_get_stats(struct net_device *dev) { - wlan_private *priv = (wlan_private *) dev->priv; + lbs_private *priv = (lbs_private *) dev->priv; return &priv->stats; } -static int libertas_set_mac_address(struct net_device *dev, void *addr) +static int lbs_set_mac_address(struct net_device *dev, void *addr) { int ret = 0; - wlan_private *priv = (wlan_private *) dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *) dev->priv; + lbs_adapter *adapter = priv->adapter; struct sockaddr *phwaddr = addr; lbs_deb_enter(LBS_DEB_NET); @@ -637,7 +637,7 @@ static int libertas_set_mac_address(struct net_device *dev, void *addr) lbs_deb_hex(LBS_DEB_NET, "addr", phwaddr->sa_data, ETH_ALEN); memcpy(adapter->current_addr, phwaddr->sa_data, ETH_ALEN); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -657,7 +657,7 @@ done: return ret; } -static int libertas_copy_multicast_address(wlan_adapter * adapter, +static int lbs_copy_multicast_address(lbs_adapter *adapter, struct net_device *dev) { int i = 0; @@ -672,10 +672,10 @@ static int libertas_copy_multicast_address(wlan_adapter * adapter, } -static void libertas_set_multicast_list(struct net_device *dev) +static void lbs_set_multicast_list(struct net_device *dev) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int oldpacketfilter; DECLARE_MAC_BUF(mac); @@ -718,7 +718,7 @@ static void libertas_set_multicast_list(struct net_device *dev) CMD_ACT_MAC_MULTICAST_ENABLE; adapter->nr_of_multicastmacaddr = - libertas_copy_multicast_address(adapter, dev); + lbs_copy_multicast_address(adapter, dev); lbs_deb_net("multicast addresses: %d\n", dev->mc_count); @@ -729,7 +729,7 @@ static void libertas_set_multicast_list(struct net_device *dev) adapter->multicastlist[i])); } /* send multicast addresses to firmware */ - libertas_prepare_and_send_command(priv, + lbs_prepare_and_send_command(priv, CMD_MAC_MULTICAST_ADR, CMD_ACT_SET, 0, 0, NULL); @@ -738,25 +738,25 @@ static void libertas_set_multicast_list(struct net_device *dev) } if (adapter->currentpacketfilter != oldpacketfilter) { - libertas_set_mac_packet_filter(priv); + lbs_set_mac_packet_filter(priv); } lbs_deb_leave(LBS_DEB_NET); } /** - * @brief This function handles the major jobs in the WLAN driver. + * @brief This function handles the major jobs in the LBS driver. * It handles all events generated by firmware, RX data received * from firmware and TX data sent from kernel. * - * @param data A pointer to wlan_thread structure + * @param data A pointer to lbs_thread structure * @return 0 */ -static int libertas_thread(void *data) +static int lbs_thread(void *data) { struct net_device *dev = data; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; wait_queue_t wait; u8 ireg = 0; @@ -836,7 +836,7 @@ static int libertas_thread(void *data) adapter->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; spin_unlock_irq(&adapter->driver_lock); - libertas_process_rx_command(priv); + lbs_process_rx_command(priv); spin_lock_irq(&adapter->driver_lock); } @@ -853,7 +853,7 @@ static int libertas_thread(void *data) continue; } spin_unlock_irq(&adapter->driver_lock); - libertas_process_event(priv); + lbs_process_event(priv); } else spin_unlock_irq(&adapter->driver_lock); @@ -861,7 +861,7 @@ static int libertas_thread(void *data) if (adapter->psstate == PS_STATE_PRE_SLEEP) { if (!priv->dnld_sent && !adapter->cur_cmd) { if (adapter->connect_status == - LIBERTAS_CONNECTED) { + LBS_CONNECTED) { lbs_deb_thread( "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " "dnld_sent=%d cur_cmd=%p, confirm now\n", @@ -870,7 +870,7 @@ static int libertas_thread(void *data) priv->dnld_sent, adapter->cur_cmd); - libertas_ps_confirm_sleep(priv, + lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); } else { /* workaround for firmware sending @@ -894,15 +894,15 @@ static int libertas_thread(void *data) /* Execute the next command */ if (!priv->dnld_sent && !priv->adapter->cur_cmd) - libertas_execute_next_command(priv); + lbs_execute_next_command(priv); /* Wake-up command waiters which can't sleep in - * libertas_prepare_and_send_command + * lbs_prepare_and_send_command */ if (!adapter->nr_cmd_pending) wake_up_all(&adapter->cmd_pending); - libertas_tx_runqueue(priv); + lbs_tx_runqueue(priv); } del_timer(&adapter->command_timer); @@ -918,13 +918,13 @@ static int libertas_thread(void *data) * HW spec from firmware and set basic parameters to * firmware. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return 0 or -1 */ -static int wlan_setup_firmware(wlan_private * priv) +static int lbs_setup_firmware(lbs_private *priv) { int ret = -1; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_mesh_access mesh_access; lbs_deb_enter(LBS_DEB_FW); @@ -934,7 +934,7 @@ static int wlan_setup_firmware(wlan_private * priv) */ memset(adapter->current_addr, 0xff, ETH_ALEN); - ret = libertas_prepare_and_send_command(priv, CMD_GET_HW_SPEC, + ret = lbs_prepare_and_send_command(priv, CMD_GET_HW_SPEC, 0, CMD_OPTION_WAITFORRSP, 0, NULL); if (ret) { @@ -942,10 +942,10 @@ static int wlan_setup_firmware(wlan_private * priv) goto done; } - libertas_set_mac_packet_filter(priv); + lbs_set_mac_packet_filter(priv); /* Get the supported Data rates */ - ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, CMD_ACT_GET_TX_RATE, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -958,7 +958,7 @@ static int wlan_setup_firmware(wlan_private * priv) if (priv->mesh_dev) { memset(&mesh_access, 0, sizeof(mesh_access)); mesh_access.data[0] = cpu_to_le32(0); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_MESH_ACCESS, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); @@ -970,7 +970,7 @@ static int wlan_setup_firmware(wlan_private * priv) } /* Set the boot2 version in firmware */ - ret = libertas_prepare_and_send_command(priv, CMD_SET_BOOT2_VER, + ret = lbs_prepare_and_send_command(priv, CMD_SET_BOOT2_VER, 0, CMD_OPTION_WAITFORRSP, 0, NULL); ret = 0; @@ -985,8 +985,8 @@ done: */ static void command_timer_fn(unsigned long data) { - wlan_private *priv = (wlan_private *)data; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = (lbs_private *)data; + lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *ptempnode; struct cmd_ds_command *cmd; unsigned long flags; @@ -1013,16 +1013,16 @@ static void command_timer_fn(unsigned long data) spin_unlock_irqrestore(&adapter->driver_lock, flags); lbs_deb_fw("re-sending same command because of timeout\n"); - libertas_queue_cmd(adapter, ptempnode, 0); + lbs_queue_cmd(adapter, ptempnode, 0); wake_up_interruptible(&priv->waitq); return; } -static int libertas_init_adapter(wlan_private * priv) +static int lbs_init_adapter(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; size_t bufsize; int i, ret = 0; @@ -1043,17 +1043,17 @@ static int libertas_init_adapter(wlan_private * priv) &adapter->network_free_list); } - adapter->libertas_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum); - adapter->libertas_ps_confirm_sleep.command = + adapter->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum); + adapter->lbs_ps_confirm_sleep.command = cpu_to_le16(CMD_802_11_PS_MODE); - adapter->libertas_ps_confirm_sleep.size = + adapter->lbs_ps_confirm_sleep.size = cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep)); - adapter->libertas_ps_confirm_sleep.action = + adapter->lbs_ps_confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED); memset(adapter->current_addr, 0xff, ETH_ALEN); - adapter->connect_status = LIBERTAS_DISCONNECTED; + adapter->connect_status = LBS_DISCONNECTED; adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; adapter->mode = IW_MODE_INFRA; adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; @@ -1061,7 +1061,7 @@ static int libertas_init_adapter(wlan_private * priv) adapter->radioon = RADIO_ON; adapter->auto_rate = 1; adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; - adapter->psmode = WLAN802_11POWERMODECAM; + adapter->psmode = LBS802_11POWERMODECAM; adapter->psstate = PS_STATE_FULL_POWER; mutex_init(&adapter->lock); @@ -1081,7 +1081,7 @@ static int libertas_init_adapter(wlan_private * priv) adapter->nr_cmd_pending = 0; /* Allocate the command buffers */ - if (libertas_allocate_cmd_buffer(priv)) { + if (lbs_allocate_cmd_buffer(priv)) { lbs_pr_err("Out of memory allocating command buffers\n"); ret = -1; } @@ -1090,9 +1090,9 @@ out: return ret; } -static void libertas_free_adapter(wlan_private * priv) +static void lbs_free_adapter(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; if (!adapter) { lbs_deb_fw("why double free adapter?\n"); @@ -1100,7 +1100,7 @@ static void libertas_free_adapter(wlan_private * priv) } lbs_deb_fw("free command buffer\n"); - libertas_free_cmd_buffer(priv); + lbs_free_cmd_buffer(priv); lbs_deb_fw("free command_timer\n"); del_timer(&adapter->command_timer); @@ -1117,32 +1117,32 @@ static void libertas_free_adapter(wlan_private * priv) /** * @brief This function adds the card. it will probe the - * card, allocate the wlan_priv and initialize the device. + * card, allocate the lbs_priv and initialize the device. * * @param card A pointer to card - * @return A pointer to wlan_private structure + * @return A pointer to lbs_private structure */ -wlan_private *libertas_add_card(void *card, struct device *dmdev) +lbs_private *lbs_add_card(void *card, struct device *dmdev) { struct net_device *dev = NULL; - wlan_private *priv = NULL; + lbs_private *priv = NULL; lbs_deb_enter(LBS_DEB_NET); /* Allocate an Ethernet device and register it */ - if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { + if (!(dev = alloc_etherdev(sizeof(lbs_private)))) { lbs_pr_err("init ethX device failed\n"); goto done; } priv = dev->priv; - /* allocate buffer for wlan_adapter */ - if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) { - lbs_pr_err("allocate buffer for wlan_adapter failed\n"); + /* allocate buffer for lbs_adapter */ + if (!(priv->adapter = kzalloc(sizeof(lbs_adapter), GFP_KERNEL))) { + lbs_pr_err("allocate buffer for lbs_adapter failed\n"); goto err_kzalloc; } - if (libertas_init_adapter(priv)) { + if (lbs_init_adapter(priv)) { lbs_pr_err("failed to initialize adapter structure.\n"); goto err_init_adapter; } @@ -1154,46 +1154,46 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev) priv->hotplug_device = dmdev; /* Setup the OS Interface to our functions */ - dev->open = libertas_open; - dev->hard_start_xmit = libertas_pre_start_xmit; - dev->stop = libertas_close; - dev->set_mac_address = libertas_set_mac_address; - dev->tx_timeout = libertas_tx_timeout; - dev->get_stats = libertas_get_stats; + dev->open = lbs_open; + dev->hard_start_xmit = lbs_pre_start_xmit; + dev->stop = lbs_close; + dev->set_mac_address = lbs_set_mac_address; + dev->tx_timeout = lbs_tx_timeout; + dev->get_stats = lbs_get_stats; dev->watchdog_timeo = 5 * HZ; - dev->ethtool_ops = &libertas_ethtool_ops; + dev->ethtool_ops = &lbs_ethtool_ops; #ifdef WIRELESS_EXT - dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; + dev->wireless_handlers = (struct iw_handler_def *)&lbs_handler_def; #endif dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - dev->set_multicast_list = libertas_set_multicast_list; + dev->set_multicast_list = lbs_set_multicast_list; SET_NETDEV_DEV(dev, dmdev); priv->rtap_net_dev = NULL; - if (device_create_file(dmdev, &dev_attr_libertas_rtap)) + if (device_create_file(dmdev, &dev_attr_lbs_rtap)) goto err_init_adapter; lbs_deb_thread("Starting main thread...\n"); init_waitqueue_head(&priv->waitq); - priv->main_thread = kthread_run(libertas_thread, dev, "libertas_main"); + priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); if (IS_ERR(priv->main_thread)) { lbs_deb_thread("Error creating main thread.\n"); goto err_kthread_run; } - priv->work_thread = create_singlethread_workqueue("libertas_worker"); - INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker); - INIT_DELAYED_WORK(&priv->scan_work, libertas_scan_worker); - INIT_WORK(&priv->sync_channel, libertas_sync_channel); + priv->work_thread = create_singlethread_workqueue("lbs_worker"); + INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker); + INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); + INIT_WORK(&priv->sync_channel, lbs_sync_channel); goto done; err_kthread_run: - device_remove_file(dmdev, &dev_attr_libertas_rtap); + device_remove_file(dmdev, &dev_attr_lbs_rtap); err_init_adapter: - libertas_free_adapter(priv); + lbs_free_adapter(priv); err_kzalloc: free_netdev(dev); @@ -1203,29 +1203,29 @@ done: lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); return priv; } -EXPORT_SYMBOL_GPL(libertas_add_card); +EXPORT_SYMBOL_GPL(lbs_add_card); -int libertas_remove_card(wlan_private *priv) +int lbs_remove_card(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct net_device *dev = priv->dev; union iwreq_data wrqu; lbs_deb_enter(LBS_DEB_MAIN); - libertas_remove_rtap(priv); + lbs_remove_rtap(priv); dev = priv->dev; - device_remove_file(priv->hotplug_device, &dev_attr_libertas_rtap); + device_remove_file(priv->hotplug_device, &dev_attr_lbs_rtap); cancel_delayed_work(&priv->scan_work); cancel_delayed_work(&priv->assoc_work); destroy_workqueue(priv->work_thread); - if (adapter->psmode == WLAN802_11POWERMODEMAX_PSP) { - adapter->psmode = WLAN802_11POWERMODECAM; - libertas_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); + if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { + adapter->psmode = LBS802_11POWERMODECAM; + lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); } memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN); @@ -1236,7 +1236,7 @@ int libertas_remove_card(wlan_private *priv) adapter->surpriseremoved = 1; kthread_stop(priv->main_thread); - libertas_free_adapter(priv); + lbs_free_adapter(priv); priv->dev = NULL; free_netdev(dev); @@ -1244,10 +1244,10 @@ int libertas_remove_card(wlan_private *priv) lbs_deb_leave(LBS_DEB_MAIN); return 0; } -EXPORT_SYMBOL_GPL(libertas_remove_card); +EXPORT_SYMBOL_GPL(lbs_remove_card); -int libertas_start_card(wlan_private *priv) +int lbs_start_card(lbs_private *priv) { struct net_device *dev = priv->dev; int ret = -1; @@ -1255,19 +1255,19 @@ int libertas_start_card(wlan_private *priv) lbs_deb_enter(LBS_DEB_MAIN); /* poke the firmware */ - ret = wlan_setup_firmware(priv); + ret = lbs_setup_firmware(priv); if (ret) goto done; /* init 802.11d */ - libertas_init_11d(priv); + lbs_init_11d(priv); if (register_netdev(dev)) { lbs_pr_err("cannot register ethX device\n"); goto done; } - libertas_debugfs_init_one(priv, dev); + lbs_debugfs_init_one(priv, dev); lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); @@ -1277,10 +1277,10 @@ done: lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_start_card); +EXPORT_SYMBOL_GPL(lbs_start_card); -int libertas_stop_card(wlan_private *priv) +int lbs_stop_card(lbs_private *priv) { struct net_device *dev = priv->dev; int ret = -1; @@ -1292,7 +1292,7 @@ int libertas_stop_card(wlan_private *priv) netif_stop_queue(priv->dev); netif_carrier_off(priv->dev); - libertas_debugfs_remove_one(priv); + lbs_debugfs_remove_one(priv); /* Flush pending command nodes */ spin_lock_irqsave(&priv->adapter->driver_lock, flags); @@ -1307,16 +1307,16 @@ int libertas_stop_card(wlan_private *priv) lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_stop_card); +EXPORT_SYMBOL_GPL(lbs_stop_card); /** * @brief This function adds mshX interface * - * @param priv A pointer to the wlan_private structure + * @param priv A pointer to the lbs_private structure * @return 0 if successful, -X otherwise */ -int libertas_add_mesh(wlan_private *priv, struct device *dev) +int lbs_add_mesh(lbs_private *priv, struct device *dev) { struct net_device *mesh_dev = NULL; int ret = 0; @@ -1332,12 +1332,12 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) mesh_dev->priv = priv; priv->mesh_dev = mesh_dev; - mesh_dev->open = libertas_mesh_open; - mesh_dev->hard_start_xmit = libertas_mesh_pre_start_xmit; - mesh_dev->stop = libertas_mesh_close; - mesh_dev->get_stats = libertas_get_stats; - mesh_dev->set_mac_address = libertas_set_mac_address; - mesh_dev->ethtool_ops = &libertas_ethtool_ops; + mesh_dev->open = lbs_mesh_open; + mesh_dev->hard_start_xmit = lbs_mesh_pre_start_xmit; + mesh_dev->stop = lbs_mesh_close; + mesh_dev->get_stats = lbs_get_stats; + mesh_dev->set_mac_address = lbs_set_mac_address; + mesh_dev->ethtool_ops = &lbs_ethtool_ops; memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, sizeof(priv->dev->dev_addr)); @@ -1353,7 +1353,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) goto err_free; } - ret = sysfs_create_group(&(mesh_dev->dev.kobj), &libertas_mesh_attr_group); + ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); if (ret) goto err_unregister; @@ -1371,10 +1371,10 @@ done: lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_add_mesh); +EXPORT_SYMBOL_GPL(lbs_add_mesh); -void libertas_remove_mesh(wlan_private *priv) +void lbs_remove_mesh(lbs_private *priv) { struct net_device *mesh_dev; @@ -1388,7 +1388,7 @@ void libertas_remove_mesh(wlan_private *priv) netif_stop_queue(mesh_dev); netif_carrier_off(priv->mesh_dev); - sysfs_remove_group(&(mesh_dev->dev.kobj), &libertas_mesh_attr_group); + sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); unregister_netdev(mesh_dev); priv->mesh_dev = NULL ; @@ -1397,7 +1397,7 @@ void libertas_remove_mesh(wlan_private *priv) out: lbs_deb_leave(LBS_DEB_MAIN); } -EXPORT_SYMBOL_GPL(libertas_remove_mesh); +EXPORT_SYMBOL_GPL(lbs_remove_mesh); /** * @brief This function finds the CFP in @@ -1408,7 +1408,7 @@ EXPORT_SYMBOL_GPL(libertas_remove_mesh); * @param cfp_no A pointer to CFP number * @return A pointer to CFP */ -struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *cfp_no) +struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no) { int i, end; @@ -1430,9 +1430,9 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c return NULL; } -int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) +int lbs_set_regiontable(lbs_private *priv, u8 region, u8 band) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; int i = 0; @@ -1444,7 +1444,7 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); { - cfp = libertas_get_region_cfp_table(region, band, &cfp_no); + cfp = lbs_get_region_cfp_table(region, band, &cfp_no); if (cfp != NULL) { adapter->region_channel[i].nrcfp = cfp_no; adapter->region_channel[i].CFP = cfp; @@ -1472,13 +1472,13 @@ out: * @param dev A pointer to net_device structure * @return n/a */ -void libertas_interrupt(struct net_device *dev) +void lbs_interrupt(struct net_device *dev) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_THREAD); - lbs_deb_thread("libertas_interrupt: intcounter=%d\n", + lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->adapter->intcounter); priv->adapter->intcounter++; @@ -1494,35 +1494,35 @@ void libertas_interrupt(struct net_device *dev) lbs_deb_leave(LBS_DEB_THREAD); } -EXPORT_SYMBOL_GPL(libertas_interrupt); +EXPORT_SYMBOL_GPL(lbs_interrupt); -int libertas_reset_device(wlan_private *priv) +int lbs_reset_device(lbs_private *priv) { int ret; lbs_deb_enter(LBS_DEB_MAIN); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_RESET, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RESET, CMD_ACT_HALT, 0, 0, NULL); msleep_interruptible(10); lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_reset_device); +EXPORT_SYMBOL_GPL(lbs_reset_device); -static int libertas_init_module(void) +static int lbs_init_module(void) { lbs_deb_enter(LBS_DEB_MAIN); - libertas_debugfs_init(); + lbs_debugfs_init(); lbs_deb_leave(LBS_DEB_MAIN); return 0; } -static void libertas_exit_module(void) +static void lbs_exit_module(void) { lbs_deb_enter(LBS_DEB_MAIN); - libertas_debugfs_remove(); + lbs_debugfs_remove(); lbs_deb_leave(LBS_DEB_MAIN); } @@ -1531,32 +1531,32 @@ static void libertas_exit_module(void) * rtap interface support fuctions */ -static int libertas_rtap_open(struct net_device *dev) +static int lbs_rtap_open(struct net_device *dev) { netif_carrier_off(dev); netif_stop_queue(dev); return 0; } -static int libertas_rtap_stop(struct net_device *dev) +static int lbs_rtap_stop(struct net_device *dev) { return 0; } -static int libertas_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) +static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { netif_stop_queue(dev); return -EOPNOTSUPP; } -static struct net_device_stats *libertas_rtap_get_stats(struct net_device *dev) +static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) { - wlan_private *priv = dev->priv; + lbs_private *priv = dev->priv; return &priv->ieee->stats; } -void libertas_remove_rtap(wlan_private *priv) +void lbs_remove_rtap(lbs_private *priv) { if (priv->rtap_net_dev == NULL) return; @@ -1565,7 +1565,7 @@ void libertas_remove_rtap(wlan_private *priv) priv->rtap_net_dev = NULL; } -int libertas_add_rtap(wlan_private *priv) +int lbs_add_rtap(lbs_private *priv) { int rc = 0; @@ -1582,11 +1582,11 @@ int libertas_add_rtap(wlan_private *priv) strcpy(priv->rtap_net_dev->name, "rtap%d"); priv->rtap_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; - priv->rtap_net_dev->open = libertas_rtap_open; - priv->rtap_net_dev->stop = libertas_rtap_stop; - priv->rtap_net_dev->get_stats = libertas_rtap_get_stats; - priv->rtap_net_dev->hard_start_xmit = libertas_rtap_hard_start_xmit; - priv->rtap_net_dev->set_multicast_list = libertas_set_multicast_list; + priv->rtap_net_dev->open = lbs_rtap_open; + priv->rtap_net_dev->stop = lbs_rtap_stop; + priv->rtap_net_dev->get_stats = lbs_rtap_get_stats; + priv->rtap_net_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; + priv->rtap_net_dev->set_multicast_list = lbs_set_multicast_list; priv->rtap_net_dev->priv = priv; priv->ieee->iw_mode = IW_MODE_MONITOR; @@ -1602,8 +1602,8 @@ int libertas_add_rtap(wlan_private *priv) } -module_init(libertas_init_module); -module_exit(libertas_exit_module); +module_init(lbs_init_module); +module_exit(lbs_exit_module); MODULE_DESCRIPTION("Libertas WLAN Driver Library"); MODULE_AUTHOR("Marvell International Ltd."); diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 0420e5b9ff9..20495590434 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -35,19 +35,19 @@ struct rx80211packethdr { void *eth80211_hdr; } __attribute__ ((packed)); -static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb); +static int process_rxed_802_11_packet(lbs_private *priv, struct sk_buff *skb); /** * @brief This function computes the avgSNR . * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return avgSNR */ -static u8 wlan_getavgsnr(wlan_private * priv) +static u8 lbs_getavgsnr(lbs_private *priv) { u8 i; u16 temp = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF == 0) return 0; for (i = 0; i < adapter->numSNRNF; i++) @@ -59,14 +59,14 @@ static u8 wlan_getavgsnr(wlan_private * priv) /** * @brief This function computes the AvgNF * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return AvgNF */ -static u8 wlan_getavgnf(wlan_private * priv) +static u8 lbs_getavgnf(lbs_private *priv) { u8 i; u16 temp = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF == 0) return 0; for (i = 0; i < adapter->numSNRNF; i++) @@ -78,13 +78,13 @@ static u8 wlan_getavgnf(wlan_private * priv) /** * @brief This function save the raw SNR/NF to our internel buffer * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param prxpd A pointer to rxpd structure of received packet * @return n/a */ -static void wlan_save_rawSNRNF(wlan_private * priv, struct rxpd *p_rx_pd) +static void lbs_save_rawSNRNF(lbs_private *priv, struct rxpd *p_rx_pd) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF < DEFAULT_DATA_AVG_FACTOR) adapter->numSNRNF++; adapter->rawSNR[adapter->nextSNRNF] = p_rx_pd->snr; @@ -98,13 +98,13 @@ static void wlan_save_rawSNRNF(wlan_private * priv, struct rxpd *p_rx_pd) /** * @brief This function computes the RSSI in received packet. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param prxpd A pointer to rxpd structure of received packet * @return n/a */ -static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) +static void lbs_compute_rssi(lbs_private *priv, struct rxpd *p_rx_pd) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_RX); @@ -115,10 +115,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) adapter->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr; adapter->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf; - wlan_save_rawSNRNF(priv, p_rx_pd); + lbs_save_rawSNRNF(priv, p_rx_pd); - adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; - adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; + adapter->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE; + adapter->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE; lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n", adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); @@ -134,11 +134,11 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) lbs_deb_leave(LBS_DEB_RX); } -void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) +void lbs_upload_rx_packet(lbs_private *priv, struct sk_buff *skb) { lbs_deb_rx("skb->data %p\n", skb->data); - if (priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode != LBS_MONITOR_OFF) { skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); } else { if (priv->mesh_dev && IS_MESH_FRAME(skb)) @@ -154,13 +154,13 @@ void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) * @brief This function processes received packet and forwards it * to kernel/upper layer * - * @param priv A pointer to wlan_private + * @param priv A pointer to lbs_private * @param skb A pointer to skb which includes the received packet * @return 0 or -1 */ -int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) +int lbs_process_rxed_packet(lbs_private *priv, struct sk_buff *skb) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct rxpackethdr *p_rx_pkt; @@ -173,7 +173,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) lbs_deb_enter(LBS_DEB_RX); - if (priv->adapter->monitormode != WLAN_MONITOR_OFF) + if (priv->adapter->monitormode != LBS_MONITOR_OFF) return process_rxed_802_11_packet(priv, skb); p_rx_pkt = (struct rxpackethdr *) skb->data; @@ -258,22 +258,22 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) * only if the rate is auto */ if (adapter->auto_rate) - adapter->cur_rate = libertas_fw_index_to_data_rate(p_rx_pd->rx_rate); + adapter->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); - wlan_compute_rssi(priv, p_rx_pd); + lbs_compute_rssi(priv, p_rx_pd); lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); priv->stats.rx_bytes += skb->len; priv->stats.rx_packets++; - libertas_upload_rx_packet(priv, skb); + lbs_upload_rx_packet(priv, skb); ret = 0; done: lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(libertas_process_rxed_packet); +EXPORT_SYMBOL_GPL(lbs_process_rxed_packet); /** * @brief This function converts Tx/Rx rates from the Marvell WLAN format @@ -319,13 +319,13 @@ static u8 convert_mv_rate_to_radiotap(u8 rate) * @brief This function processes a received 802.11 packet and forwards it * to kernel/upper layer * - * @param priv A pointer to wlan_private + * @param priv A pointer to lbs_private * @param skb A pointer to skb which includes the received packet * @return 0 or -1 */ -static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) +static int process_rxed_802_11_packet(lbs_private *priv, struct sk_buff *skb) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct rx80211packethdr *p_rx_pkt; @@ -359,7 +359,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); /* create the exported radio header */ - if(priv->adapter->monitormode == WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode == LBS_MONITOR_OFF) { /* no radio header */ /* chop the rxpd */ skb_pull(skb, sizeof(struct rxpd)); @@ -409,15 +409,15 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) * only if the rate is auto */ if (adapter->auto_rate) - adapter->cur_rate = libertas_fw_index_to_data_rate(prxpd->rx_rate); + adapter->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); - wlan_compute_rssi(priv, prxpd); + lbs_compute_rssi(priv, prxpd); lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); priv->stats.rx_bytes += skb->len; priv->stats.rx_packets++; - libertas_upload_rx_packet(priv, skb); + lbs_upload_rx_packet(priv, skb); ret = 0; diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index ad1e67d984c..30e1a8e8a16 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -39,8 +39,8 @@ //! Memory needed to store a max number/size SSID TLV for a firmware scan #define SSID_TLV_MAX_SIZE (1 * sizeof(struct mrvlietypes_ssidparamset)) -//! Maximum memory needed for a wlan_scan_cmd_config with all TLVs at max -#define MAX_SCAN_CFG_ALLOC (sizeof(struct wlan_scan_cmd_config) \ +//! Maximum memory needed for a lbs_scan_cmd_config with all TLVs at max +#define MAX_SCAN_CFG_ALLOC (sizeof(struct lbs_scan_cmd_config) \ + sizeof(struct mrvlietypes_numprobes) \ + CHAN_TLV_MAX_SIZE \ + SSID_TLV_MAX_SIZE) @@ -80,7 +80,7 @@ static inline void clear_bss_descriptor (struct bss_descriptor * bss) memset(bss, 0, offsetof(struct bss_descriptor, list)); } -static inline int match_bss_no_security(struct wlan_802_11_security * secinfo, +static inline int match_bss_no_security(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { if ( !secinfo->wep_enabled @@ -94,7 +94,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo, return 0; } -static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo, +static inline int match_bss_static_wep(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { if ( secinfo->wep_enabled @@ -106,7 +106,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo, return 0; } -static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, +static inline int match_bss_wpa(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { if ( !secinfo->wep_enabled @@ -121,7 +121,7 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, return 0; } -static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, +static inline int match_bss_wpa2(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { if ( !secinfo->wep_enabled @@ -136,7 +136,7 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, return 0; } -static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo, +static inline int match_bss_dynamic_wep(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { if ( !secinfo->wep_enabled @@ -163,13 +163,13 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo, * 0 0 0 0 !=NONE 1 0 0 yes Dynamic WEP * * - * @param adapter A pointer to wlan_adapter + * @param adapter A pointer to lbs_adapter * @param index Index in scantable to check against current driver settings * @param mode Network mode: Infrastructure or IBSS * * @return Index in scantable, or error code if negative */ -static int is_network_compatible(wlan_adapter * adapter, +static int is_network_compatible(lbs_adapter *adapter, struct bss_descriptor * bss, u8 mode) { int matched = 0; @@ -235,7 +235,7 @@ done: * * @return 0--ssid is same, otherwise is different */ -int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) +int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) { if (ssid1_len != ssid2_len) return -1; @@ -256,13 +256,13 @@ int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) /** * @brief Create a channel list for the driver to scan based on region info * - * Only used from wlan_scan_setup_scan_config() + * Only used from lbs_scan_setup_scan_config() * * Use the driver region/band information to construct a comprehensive list * of channels to scan. This routine is used for any scan that is not * provided a specific channel list to scan. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param scanchanlist Output parameter: resulting channel list to scan * @param filteredscan Flag indicating whether or not a BSSID or SSID filter * is being sent in the command to firmware. Used to @@ -272,12 +272,12 @@ int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) * * @return void */ -static void wlan_scan_create_channel_list(wlan_private * priv, +static void lbs_scan_create_channel_list(lbs_private *priv, struct chanscanparamset * scanchanlist, u8 filteredscan) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct region_channel *scanregion; struct chan_freq_power *cfp; int rgnidx; @@ -297,7 +297,7 @@ static void wlan_scan_create_channel_list(wlan_private * priv, for (rgnidx = 0; rgnidx < ARRAY_SIZE(adapter->region_channel); rgnidx++) { if (priv->adapter->enable11d && - adapter->connect_status != LIBERTAS_CONNECTED) { + adapter->connect_status != LBS_CONNECTED) { /* Scan all the supported chan for the first scan */ if (!adapter->universal_channel[rgnidx].valid) continue; @@ -319,7 +319,7 @@ static void wlan_scan_create_channel_list(wlan_private * priv, if (priv->adapter->enable11d) { scantype = - libertas_get_scan_type_11d(cfp->channel, + lbs_get_scan_type_11d(cfp->channel, &adapter-> parsed_region_chan); } @@ -357,24 +357,24 @@ static void wlan_scan_create_channel_list(wlan_private * priv, /* Delayed partial scan worker */ -void libertas_scan_worker(struct work_struct *work) +void lbs_scan_worker(struct work_struct *work) { - wlan_private *priv = container_of(work, wlan_private, scan_work.work); + lbs_private *priv = container_of(work, lbs_private, scan_work.work); - wlan_scan_networks(priv, NULL, 0); + lbs_scan_networks(priv, NULL, 0); } /** - * @brief Construct a wlan_scan_cmd_config structure to use in issue scan cmds + * @brief Construct a lbs_scan_cmd_config structure to use in issue scan cmds * - * Application layer or other functions can invoke wlan_scan_networks - * with a scan configuration supplied in a wlan_ioctl_user_scan_cfg struct. - * This structure is used as the basis of one or many wlan_scan_cmd_config + * Application layer or other functions can invoke lbs_scan_networks + * with a scan configuration supplied in a lbs_ioctl_user_scan_cfg struct. + * This structure is used as the basis of one or many lbs_scan_cmd_config * commands that are sent to the command processing module and sent to * firmware. * - * Create a wlan_scan_cmd_config based on the following user supplied + * Create a lbs_scan_cmd_config based on the following user supplied * parameters (if present): * - SSID filter * - BSSID filter @@ -385,7 +385,7 @@ void libertas_scan_worker(struct work_struct *work) * If the number of probes is not set, use the adapter default setting * Qualify the channel * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param puserscanin NULL or pointer to scan configuration parameters * @param ppchantlvout Output parameter: Pointer to the start of the * channel TLV portion of the output scan config @@ -403,9 +403,9 @@ void libertas_scan_worker(struct work_struct *work) * * @return resulting scan configuration */ -static struct wlan_scan_cmd_config * -wlan_scan_setup_scan_config(wlan_private * priv, - const struct wlan_ioctl_user_scan_cfg * puserscanin, +static struct lbs_scan_cmd_config * +lbs_scan_setup_scan_config(lbs_private *priv, + const struct lbs_ioctl_user_scan_cfg *puserscanin, struct mrvlietypes_chanlistparamset ** ppchantlvout, struct chanscanparamset * pscanchanlist, int *pmaxchanperscan, @@ -414,7 +414,7 @@ wlan_scan_setup_scan_config(wlan_private * priv, { struct mrvlietypes_numprobes *pnumprobestlv; struct mrvlietypes_ssidparamset *pssidtlv; - struct wlan_scan_cmd_config * pscancfgout = NULL; + struct lbs_scan_cmd_config *pscancfgout = NULL; u8 *ptlvpos; u16 numprobes; int chanidx; @@ -523,13 +523,13 @@ wlan_scan_setup_scan_config(wlan_private * priv, if (!puserscanin || !puserscanin->chanlist[0].channumber) { /* Create a default channel scan list */ lbs_deb_scan("creating full region channel list\n"); - wlan_scan_create_channel_list(priv, pscanchanlist, + lbs_scan_create_channel_list(priv, pscanchanlist, *pfilteredscan); goto out; } for (chanidx = 0; - chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX + chanidx < LBS_IOCTL_USER_SCAN_CHAN_MAX && puserscanin->chanlist[chanidx].channumber; chanidx++) { channel = puserscanin->chanlist[chanidx].channumber; @@ -579,14 +579,14 @@ out: /** * @brief Construct and send multiple scan config commands to the firmware * - * Only used from wlan_scan_networks() + * Only used from lbs_scan_networks() * - * Previous routines have created a wlan_scan_cmd_config with any requested + * Previous routines have created a lbs_scan_cmd_config with any requested * TLVs. This function splits the channel TLV into maxchanperscan lists * and sends the portion of the channel TLV along with the other TLVs - * to the wlan_cmd routines for execution in the firmware. + * to the lbs_cmd routines for execution in the firmware. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param maxchanperscan Maximum number channels to be included in each * scan command sent to firmware * @param filteredscan Flag indicating whether or not a BSSID or SSID @@ -600,13 +600,13 @@ out: * * @return 0 or error return otherwise */ -static int wlan_scan_channel_list(wlan_private * priv, +static int lbs_scan_channel_list(lbs_private *priv, int maxchanperscan, u8 filteredscan, - struct wlan_scan_cmd_config * pscancfgout, + struct lbs_scan_cmd_config *pscancfgout, struct mrvlietypes_chanlistparamset * pchantlvout, struct chanscanparamset * pscanchanlist, - const struct wlan_ioctl_user_scan_cfg * puserscanin, + const struct lbs_ioctl_user_scan_cfg *puserscanin, int full_scan) { struct chanscanparamset *ptmpchan; @@ -720,7 +720,7 @@ static int wlan_scan_channel_list(wlan_private * priv, } /* Send the scan command to the firmware with the specified cfg */ - ret = libertas_prepare_and_send_command(priv, CMD_802_11_SCAN, 0, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, 0, 0, 0, pscancfgout); if (scanned >= 2 && !full_scan) { ret = 0; @@ -751,10 +751,10 @@ out: } /* - * Only used from wlan_scan_networks() + * Only used from lbs_scan_networks() */ -static void clear_selected_scan_list_entries(wlan_adapter *adapter, - const struct wlan_ioctl_user_scan_cfg *scan_cfg) +static void clear_selected_scan_list_entries(lbs_adapter *adapter, + const struct lbs_ioctl_user_scan_cfg *scan_cfg) { struct bss_descriptor *bss; struct bss_descriptor *safe; @@ -812,21 +812,21 @@ out: * order to send the appropriate scan commands to firmware to populate or * update the internal driver scan table * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param puserscanin Pointer to the input configuration for the requested * scan. * @param full_scan ??? * * @return 0 or < 0 if error */ -int wlan_scan_networks(wlan_private * priv, - const struct wlan_ioctl_user_scan_cfg * puserscanin, +int lbs_scan_networks(lbs_private *priv, + const struct lbs_ioctl_user_scan_cfg *puserscanin, int full_scan) { - wlan_adapter * adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct mrvlietypes_chanlistparamset *pchantlvout; struct chanscanparamset * scan_chan_list = NULL; - struct wlan_scan_cmd_config * scan_cfg = NULL; + struct lbs_scan_cmd_config *scan_cfg = NULL; u8 filteredscan; u8 scancurrentchanonly; int maxchanperscan; @@ -846,13 +846,13 @@ int wlan_scan_networks(wlan_private * priv, cancel_delayed_work(&priv->scan_work); scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * - WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); + LBS_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); if (scan_chan_list == NULL) { ret = -ENOMEM; goto out; } - scan_cfg = wlan_scan_setup_scan_config(priv, + scan_cfg = lbs_scan_setup_scan_config(priv, puserscanin, &pchantlvout, scan_chan_list, @@ -876,7 +876,7 @@ int wlan_scan_networks(wlan_private * priv, } } - ret = wlan_scan_channel_list(priv, + ret = lbs_scan_channel_list(priv, maxchanperscan, filteredscan, scan_cfg, @@ -897,7 +897,7 @@ int wlan_scan_networks(wlan_private * priv, mutex_unlock(&adapter->lock); #endif - if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { + if (priv->adapter->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); if (priv->mesh_dev) { @@ -928,7 +928,7 @@ out: * * @return 0 or -1 */ -static int libertas_process_bss(struct bss_descriptor * bss, +static int lbs_process_bss(struct bss_descriptor *bss, u8 ** pbeaconinfo, int *bytesleft) { struct ieeetypes_fhparamset *pFH; @@ -1139,7 +1139,7 @@ static int libertas_process_bss(struct bss_descriptor * bss, /* Timestamp */ bss->last_scanned = jiffies; - libertas_unset_basic_rate_flags(bss->rates, sizeof(bss->rates)); + lbs_unset_basic_rate_flags(bss->rates, sizeof(bss->rates)); ret = 0; @@ -1153,13 +1153,13 @@ done: * * Used in association code * - * @param adapter A pointer to wlan_adapter + * @param adapter A pointer to lbs_adapter * @param bssid BSSID to find in the scan list * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list, or error return code (< 0) */ -struct bss_descriptor *libertas_find_bssid_in_list(wlan_adapter * adapter, +struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter, u8 * bssid, u8 mode) { struct bss_descriptor * iter_bss; @@ -1205,14 +1205,14 @@ out: * * Used in association code * - * @param adapter A pointer to wlan_adapter + * @param adapter A pointer to lbs_adapter * @param ssid SSID to find in the list * @param bssid BSSID to qualify the SSID selection (if provided) * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list */ -struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter, +struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter, u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, int channel) { @@ -1230,7 +1230,7 @@ struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter, || (iter_bss->last_scanned < tmp_oldest->last_scanned)) tmp_oldest = iter_bss; - if (libertas_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len, + if (lbs_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len, ssid, ssid_len) != 0) continue; /* ssid doesn't match */ if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0) @@ -1277,11 +1277,11 @@ out: * Search the scan table for the best SSID that also matches the current * adapter network preference (infrastructure or adhoc) * - * @param adapter A pointer to wlan_adapter + * @param adapter A pointer to lbs_adapter * * @return index in BSSID list */ -static struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter, +static struct bss_descriptor *lbs_find_best_ssid_in_list(lbs_adapter *adapter, u8 mode) { u8 bestrssi = 0; @@ -1323,27 +1323,27 @@ static struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * ad * * Used from association worker. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param pSSID A pointer to AP's ssid * * @return 0--success, otherwise--fail */ -int libertas_find_best_network_ssid(wlan_private * priv, +int lbs_find_best_network_ssid(lbs_private *priv, u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int ret = -1; struct bss_descriptor * found; lbs_deb_enter(LBS_DEB_SCAN); - wlan_scan_networks(priv, NULL, 1); + lbs_scan_networks(priv, NULL, 1); if (adapter->surpriseremoved) goto out; wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); - found = libertas_find_best_ssid_in_list(adapter, preferred_mode); + found = lbs_find_best_ssid_in_list(adapter, preferred_mode); if (found && (found->ssid_len > 0)) { memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); *out_ssid_len = found->ssid_len; @@ -1366,11 +1366,11 @@ out: * * @return 0 --success, otherwise fail */ -int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, +int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_SCAN); @@ -1392,7 +1392,7 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, * * Used in association code and from debugfs * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param ssid A pointer to the SSID to scan for * @param ssid_len Length of the SSID * @param clear_ssid Should existing scan results with this SSID @@ -1402,11 +1402,11 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, * * @return 0-success, otherwise fail */ -int libertas_send_specific_ssid_scan(wlan_private * priv, +int lbs_send_specific_ssid_scan(lbs_private *priv, u8 *ssid, u8 ssid_len, u8 clear_ssid) { - wlan_adapter *adapter = priv->adapter; - struct wlan_ioctl_user_scan_cfg scancfg; + lbs_adapter *adapter = priv->adapter; + struct lbs_ioctl_user_scan_cfg scancfg; int ret = 0; lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s', clear %d", @@ -1420,7 +1420,7 @@ int libertas_send_specific_ssid_scan(wlan_private * priv, scancfg.ssid_len = ssid_len; scancfg.clear_ssid = clear_ssid; - wlan_scan_networks(priv, &scancfg, 1); + lbs_scan_networks(priv, &scancfg, 1); if (adapter->surpriseremoved) { ret = -1; goto out; @@ -1443,11 +1443,11 @@ out: #define MAX_CUSTOM_LEN 64 -static inline char *libertas_translate_scan(wlan_private *priv, +static inline char *lbs_translate_scan(lbs_private *priv, char *start, char *stop, struct bss_descriptor *bss) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; char *current_val; /* For rates */ struct iw_event iwe; /* Temporary buffer */ @@ -1459,7 +1459,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, lbs_deb_enter(LBS_DEB_SCAN); - cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, bss->channel); + cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, bss->channel); if (!cfp) { lbs_deb_scan("Invalid channel number %d\n", bss->channel); start = NULL; @@ -1515,7 +1515,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, */ if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate - && !libertas_ssid_cmp(adapter->curbssparams.ssid, + && !lbs_ssid_cmp(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len, bss->ssid, bss->ssid_len)) { int snr, nf; @@ -1549,7 +1549,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, stop, &iwe, IW_EV_PARAM_LEN); } if ((bss->mode == IW_MODE_ADHOC) - && !libertas_ssid_cmp(adapter->curbssparams.ssid, + && !lbs_ssid_cmp(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len, bss->ssid, bss->ssid_len) && adapter->adhoccreate) { @@ -1606,12 +1606,12 @@ out: * * @return 0 --success, otherwise fail */ -int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, +int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { #define SCAN_ITEM_SIZE 128 - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int err = 0; char *ev = extra; char *stop = ev + dwrq->length; @@ -1622,7 +1622,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, /* Update RSSI if current BSS is a locally created ad-hoc BSS */ if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) { - libertas_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, + lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } @@ -1650,7 +1650,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, } /* Translate to WE format this entry */ - next_ev = libertas_translate_scan(priv, ev, stop, iter_bss); + next_ev = lbs_translate_scan(priv, ev, stop, iter_bss); if (next_ev == NULL) continue; ev = next_ev; @@ -1677,24 +1677,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, /** * @brief Prepare a scan command to be sent to the firmware * - * Called from libertas_prepare_and_send_command() in cmd.c + * Called from lbs_prepare_and_send_command() in cmd.c * * Sends a fixed lenght data part (specifying the BSS type and BSSID filters) * as well as a variable number/length of TLVs to the firmware. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param cmd A pointer to cmd_ds_command structure to be sent to * firmware with the cmd_DS_801_11_SCAN structure - * @param pdata_buf Void pointer cast of a wlan_scan_cmd_config struct used + * @param pdata_buf Void pointer cast of a lbs_scan_cmd_config struct used * to set the fields/TLVs for the command sent to firmware * * @return 0 or -1 */ -int libertas_cmd_80211_scan(wlan_private * priv, +int lbs_cmd_80211_scan(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; - struct wlan_scan_cmd_config *pscancfg = pdata_buf; + struct lbs_scan_cmd_config *pscancfg = pdata_buf; lbs_deb_enter(LBS_DEB_SCAN); @@ -1750,14 +1750,14 @@ static inline int is_same_network(struct bss_descriptor *src, * | bufsize and sizeof the fixed fields above) | * .-----------------------------------------------------------. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param resp A pointer to cmd_ds_command * * @return 0 or -1 */ -int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) +int lbs_ret_80211_scan(lbs_private *priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_scan_rsp *pscan; struct bss_descriptor * iter_bss; struct bss_descriptor * safe; @@ -1821,7 +1821,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) /* Process the data fields and IEs returned for this BSS */ memset(&new, 0, sizeof (struct bss_descriptor)); - if (libertas_process_bss(&new, &pbssinfo, &bytesleft) != 0) { + if (lbs_process_bss(&new, &pbssinfo, &bytesleft) != 0) { /* error parsing the scan response, skipped */ lbs_deb_scan("SCAN_RESP: process_bss returned ERROR\n"); continue; diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index c29c031bef8..7ed66f40d18 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h @@ -2,10 +2,10 @@ * Interface for the wlan network scan routines * * Driver interface functions and type declarations for the scan module - * implemented in wlan_scan.c. + * implemented in scan.c. */ -#ifndef _WLAN_SCAN_H -#define _WLAN_SCAN_H +#ifndef _LBS_SCAN_H +#define _LBS_SCAN_H #include #include "hostcmd.h" @@ -13,38 +13,38 @@ /** * @brief Maximum number of channels that can be sent in a setuserscan ioctl * - * @sa wlan_ioctl_user_scan_cfg + * @sa lbs_ioctl_user_scan_cfg */ -#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50 +#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50 -//! Infrastructure BSS scan type in wlan_scan_cmd_config -#define WLAN_SCAN_BSS_TYPE_BSS 1 +//! Infrastructure BSS scan type in lbs_scan_cmd_config +#define LBS_SCAN_BSS_TYPE_BSS 1 -//! Adhoc BSS scan type in wlan_scan_cmd_config -#define WLAN_SCAN_BSS_TYPE_IBSS 2 +//! Adhoc BSS scan type in lbs_scan_cmd_config +#define LBS_SCAN_BSS_TYPE_IBSS 2 -//! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter -#define WLAN_SCAN_BSS_TYPE_ANY 3 +//! Adhoc or Infrastructure BSS scan type in lbs_scan_cmd_config, no filter +#define LBS_SCAN_BSS_TYPE_ANY 3 /** * @brief Structure used internally in the wlan driver to configure a scan. * * Sent to the command processing module to configure the firmware - * scan command prepared by libertas_cmd_80211_scan. + * scan command prepared by lbs_cmd_80211_scan. * - * @sa wlan_scan_networks + * @sa lbs_scan_networks * */ -struct wlan_scan_cmd_config { +struct lbs_scan_cmd_config { /** * @brief BSS type to be sent in the firmware command * * Field can be used to restrict the types of networks returned in the * scan. valid settings are: * - * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure) - * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc) - * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) + * - LBS_SCAN_BSS_TYPE_BSS (infrastructure) + * - LBS_SCAN_BSS_TYPE_IBSS (adhoc) + * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) */ u8 bsstype; @@ -68,12 +68,12 @@ struct wlan_scan_cmd_config { }; /** - * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg + * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg * * Multiple instances of this structure are included in the IOCTL command * to configure a instance of a scan on the specific channel. */ -struct wlan_ioctl_user_scan_chan { +struct lbs_ioctl_user_scan_chan { u8 channumber; //!< channel Number to scan u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1 u8 scantype; //!< Scan type: Active = 0, Passive = 1 @@ -83,23 +83,23 @@ struct wlan_ioctl_user_scan_chan { /** * @brief IOCTL input structure to configure an immediate scan cmd to firmware * - * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies + * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies * a number of parameters to be used in general for the scan as well - * as a channel list (wlan_ioctl_user_scan_chan) for each scan period + * as a channel list (lbs_ioctl_user_scan_chan) for each scan period * desired. * - * @sa libertas_set_user_scan_ioctl + * @sa lbs_set_user_scan_ioctl */ -struct wlan_ioctl_user_scan_cfg { +struct lbs_ioctl_user_scan_cfg { /** * @brief BSS type to be sent in the firmware command * * Field can be used to restrict the types of networks returned in the * scan. valid settings are: * - * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure) - * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc) - * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) + * - LBS_SCAN_BSS_TYPE_BSS (infrastructure) + * - LBS_SCAN_BSS_TYPE_IBSS (adhoc) + * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) */ u8 bsstype; @@ -128,7 +128,7 @@ struct wlan_ioctl_user_scan_cfg { /** * @brief Variable number (fixed maximum) of channels to scan up */ - struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX]; + struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX]; }; /** @@ -174,30 +174,30 @@ struct bss_descriptor { struct list_head list; }; -int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); +int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); -struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter, - u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, - int channel); +struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter, + u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode, + int channel); -struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter, - u8 * bssid, u8 mode); +struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter, + u8 *bssid, u8 mode); -int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid, +int lbs_find_best_network_ssid(lbs_private *priv, u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode); -int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid, +int lbs_send_specific_ssid_scan(lbs_private *priv, u8 *ssid, u8 ssid_len, u8 clear_ssid); -int libertas_cmd_80211_scan(wlan_private * priv, +int lbs_cmd_80211_scan(lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int libertas_ret_80211_scan(wlan_private * priv, +int lbs_ret_80211_scan(lbs_private *priv, struct cmd_ds_command *resp); -int wlan_scan_networks(wlan_private * priv, - const struct wlan_ioctl_user_scan_cfg * puserscanin, +int lbs_scan_networks(lbs_private *priv, + const struct lbs_ioctl_user_scan_cfg *puserscanin, int full_scan); struct ifreq; @@ -205,11 +205,11 @@ struct ifreq; struct iw_point; struct iw_param; struct iw_request_info; -int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, +int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra); -int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, +int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -void libertas_scan_worker(struct work_struct *work); +void lbs_scan_worker(struct work_struct *work); -#endif /* _WLAN_SCAN_H */ +#endif diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index fbec06c10dd..93725ce55b1 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -52,11 +52,11 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) * @brief This function processes a single packet and sends * to IF layer * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param skb A pointer to skb which includes TX packet * @return 0 or -1 */ -static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) +static int SendSinglePacket(lbs_private *priv, struct sk_buff *skb) { int ret = 0; struct txpd localtxpd; @@ -86,7 +86,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); p802x_hdr = skb->data; - if (priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (priv->adapter->monitormode != LBS_MONITOR_OFF) { /* locate radiotap header */ pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data; @@ -106,7 +106,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) } /* copy destination address from 802.3 or 802.11 header */ - if (priv->adapter->monitormode != WLAN_MONITOR_OFF) + if (priv->adapter->monitormode != LBS_MONITOR_OFF) memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); else memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); @@ -144,7 +144,7 @@ done: priv->stats.tx_errors++; } - if (!ret && priv->adapter->monitormode != WLAN_MONITOR_OFF) { + if (!ret && priv->adapter->monitormode != LBS_MONITOR_OFF) { /* Keep the skb to echo it back once Tx feedback is received from FW */ skb_orphan(skb); @@ -164,9 +164,9 @@ done: } -void libertas_tx_runqueue(wlan_private *priv) +void lbs_tx_runqueue(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; int i; spin_lock(&adapter->txqueue_lock); @@ -180,9 +180,9 @@ void libertas_tx_runqueue(wlan_private *priv) spin_unlock(&adapter->txqueue_lock); } -static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb) +static void lbs_tx_queue(lbs_private *priv, struct sk_buff *skb) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; spin_lock(&adapter->txqueue_lock); @@ -205,10 +205,10 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb) * @brief This function checks the conditions and sends packet to IF * layer if everything is ok. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @return n/a */ -int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) +int lbs_process_tx(lbs_private *priv, struct sk_buff *skb) { int ret = -1; @@ -223,7 +223,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) if ((priv->adapter->psstate == PS_STATE_SLEEP) || (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) { - wlan_tx_queue(priv, skb); + lbs_tx_queue(priv, skb); return ret; } @@ -239,20 +239,20 @@ done: * @brief This function sends to the host the last transmitted packet, * filling the radiotap headers with transmission information. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @param status A 32 bit value containing transmission status. * * @returns void */ -void libertas_send_tx_feedback(wlan_private * priv) +void lbs_send_tx_feedback(lbs_private *priv) { - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; struct tx_radiotap_hdr *radiotap_hdr; u32 status = adapter->eventcause; int txfail; int try_count; - if (adapter->monitormode == WLAN_MONITOR_OFF || + if (adapter->monitormode == LBS_MONITOR_OFF || adapter->currenttxskb == NULL) return; @@ -270,13 +270,13 @@ void libertas_send_tx_feedback(wlan_private * priv) try_count = (status >> 16) & 0xff; radiotap_hdr->data_retries = (try_count) ? (1 + adapter->txretrycount - try_count) : 0; - libertas_upload_rx_packet(priv, adapter->currenttxskb); + lbs_upload_rx_packet(priv, adapter->currenttxskb); adapter->currenttxskb = NULL; priv->adapter->TxLockFlag = 0; - if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { + if (priv->adapter->connect_status == LBS_CONNECTED) { netif_wake_queue(priv->dev); if (priv->mesh_dev) netif_wake_queue(priv->mesh_dev); } } -EXPORT_SYMBOL_GPL(libertas_send_tx_feedback); +EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h index a43a5f63c87..8a454454e2a 100644 --- a/drivers/net/wireless/libertas/types.h +++ b/drivers/net/wireless/libertas/types.h @@ -1,8 +1,8 @@ /** * This header file contains definition for global types */ -#ifndef _WLAN_TYPES_ -#define _WLAN_TYPES_ +#ifndef _LBS_TYPES_H_ +#define _LBS_TYPES_H_ #include #include @@ -250,4 +250,4 @@ struct mrvlietypes_ledgpio { struct led_pin ledpin[1]; } __attribute__ ((packed)); -#endif /* _WLAN_TYPES_ */ +#endif diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 19c2873d2d7..57fe5f67a05 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -21,7 +21,7 @@ #include "assoc.h" -static inline void libertas_postpone_association_work(wlan_private *priv) +static inline void lbs_postpone_association_work(lbs_private *priv) { if (priv->adapter->surpriseremoved) return; @@ -29,7 +29,7 @@ static inline void libertas_postpone_association_work(wlan_private *priv) queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); } -static inline void libertas_cancel_association_work(wlan_private *priv) +static inline void lbs_cancel_association_work(lbs_private *priv) { cancel_delayed_work(&priv->assoc_work); kfree(priv->adapter->pending_assoc_req); @@ -40,12 +40,12 @@ static inline void libertas_cancel_association_work(wlan_private *priv) /** * @brief Find the channel frequency power info with specific channel * - * @param adapter A pointer to wlan_adapter structure + * @param adapter A pointer to lbs_adapter structure * @param band it can be BAND_A, BAND_G or BAND_B * @param channel the channel for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ -struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * adapter, +struct chan_freq_power *lbs_find_cfp_by_band_and_channel(lbs_adapter *adapter, u8 band, u16 channel) { struct chan_freq_power *cfp = NULL; @@ -70,7 +70,7 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada } if (!cfp && channel) - lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find " + lbs_deb_wext("lbs_find_cfp_by_band_and_channel: can't find " "cfp by band %d / channel %d\n", band, channel); return cfp; @@ -79,12 +79,12 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada /** * @brief Find the channel frequency power info with specific frequency * - * @param adapter A pointer to wlan_adapter structure + * @param adapter A pointer to lbs_adapter structure * @param band it can be BAND_A, BAND_G or BAND_B * @param freq the frequency for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ -static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter, +static struct chan_freq_power *find_cfp_by_band_and_freq(lbs_adapter *adapter, u8 band, u32 freq) { struct chan_freq_power *cfp = NULL; @@ -119,14 +119,14 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter, /** * @brief Set Radio On/OFF * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to lbs_private structure * @option Radio Option * @return 0 --success, otherwise fail */ -static int wlan_radio_ioctl(wlan_private * priv, u8 option) +static int lbs_radio_ioctl(lbs_private *priv, u8 option) { int ret = 0; - wlan_adapter *adapter = priv->adapter; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -134,7 +134,7 @@ static int wlan_radio_ioctl(wlan_private * priv, u8 option) lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); adapter->radioon = option; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RADIO_CONTROL, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -147,22 +147,22 @@ static int wlan_radio_ioctl(wlan_private * priv, u8 option) /** * @brief Copy active data rates based on adapter mode and status * - * @param adapter A pointer to wlan_adapter structure + * @param adapter A pointer to lbs_adapter structure * @param rate The buf to return the active rates */ -static void copy_active_data_rates(wlan_adapter * adapter, u8 * rates) +static void copy_active_data_rates(lbs_adapter *adapter, u8 *rates) { lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status != LIBERTAS_CONNECTED) - memcpy(rates, libertas_bg_rates, MAX_RATES); + if (adapter->connect_status != LBS_CONNECTED) + memcpy(rates, lbs_bg_rates, MAX_RATES); else memcpy(rates, adapter->curbssparams.rates, MAX_RATES); lbs_deb_leave(LBS_DEB_WEXT); } -static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, char *extra) { @@ -175,16 +175,16 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; lbs_deb_enter(LBS_DEB_WEXT); - cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, + cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, adapter->curbssparams.channel); if (!cfp) { @@ -202,15 +202,15 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status == LIBERTAS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); } else { memset(awrq->sa_data, 0, ETH_ALEN); @@ -221,11 +221,11 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -246,11 +246,11 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -267,14 +267,14 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); /* Use nickname to indicate that mesh is on */ - if (adapter->connect_status == LIBERTAS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { strncpy(extra, "Mesh", 12); extra[12] = '\0'; dwrq->length = strlen(extra); @@ -289,12 +289,12 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; u32 rthr = vwrq->value; lbs_deb_enter(LBS_DEB_WEXT); @@ -307,7 +307,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, adapter->rtsthsd = rthr; } - ret = libertas_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, OID_802_11_RTS_THRESHOLD, &rthr); @@ -315,17 +315,17 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, return ret; } -static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); adapter->rtsthsd = 0; - ret = libertas_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, OID_802_11_RTS_THRESHOLD, NULL); if (ret) @@ -341,13 +341,13 @@ out: return ret; } -static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; u32 fthr = vwrq->value; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -360,7 +360,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, adapter->fragthsd = fthr; } - ret = libertas_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); @@ -368,17 +368,17 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, return ret; } -static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); adapter->fragthsd = 0; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, OID_802_11_FRAGMENTATION_THRESHOLD, NULL); @@ -395,11 +395,11 @@ out: return ret; } -static int wlan_get_mode(struct net_device *dev, +static int lbs_get_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -421,17 +421,17 @@ static int mesh_wlan_get_mode(struct net_device *dev, return 0; } -static int wlan_get_txpow(struct net_device *dev, +static int lbs_get_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_TX_POWER, CMD_ACT_TX_POWER_OPT_GET, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -454,12 +454,12 @@ out: return ret; } -static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -474,7 +474,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, /* Adding 1 to convert retry count to try count */ adapter->txretrycount = vwrq->value + 1; - ret = libertas_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_SET, CMD_OPTION_WAITFORRSP, OID_802_11_TX_RETRYCOUNT, NULL); @@ -490,17 +490,17 @@ out: return ret; } -static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_WEXT); adapter->txretrycount = 0; - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, OID_802_11_TX_RETRYCOUNT, NULL); @@ -558,12 +558,12 @@ static inline void sort_channels(struct iw_freq *freq, int num) * @param extra A pointer to extra data buf * @return 0 --success, otherwise fail */ -static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int i, j; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct iw_range *range = (struct iw_range *)extra; struct chan_freq_power *cfp; u8 rates[MAX_RATES + 1]; @@ -589,7 +589,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, range->num_frequency = 0; if (priv->adapter->enable11d && - adapter->connect_status == LIBERTAS_CONNECTED) { + adapter->connect_status == LBS_CONNECTED) { u8 chan_no; u8 band; @@ -610,7 +610,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, lbs_deb_wext("chan_no %d\n", chan_no); range->freq[range->num_frequency].i = (long)chan_no; range->freq[range->num_frequency].m = - (long)libertas_chan_2_freq(chan_no, band) * 100000; + (long)lbs_chan_2_freq(chan_no, band) * 100000; range->freq[range->num_frequency].e = 1; range->num_frequency++; } @@ -735,11 +735,11 @@ out: return 0; } -static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -748,9 +748,9 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, */ if (vwrq->disabled) { - adapter->psmode = WLAN802_11POWERMODECAM; + adapter->psmode = LBS802_11POWERMODECAM; if (adapter->psstate != PS_STATE_FULL_POWER) { - libertas_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); + lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); } return 0; @@ -765,33 +765,33 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, return -EINVAL; } - if (adapter->psmode != WLAN802_11POWERMODECAM) { + if (adapter->psmode != LBS802_11POWERMODECAM) { return 0; } - adapter->psmode = WLAN802_11POWERMODEMAX_PSP; + adapter->psmode = LBS802_11POWERMODEMAX_PSP; - if (adapter->connect_status == LIBERTAS_CONNECTED) { - libertas_ps_sleep(priv, CMD_OPTION_WAITFORRSP); + if (adapter->connect_status == LBS_CONNECTED) { + lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); } lbs_deb_leave(LBS_DEB_WEXT); return 0; } -static int wlan_get_power(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int mode; lbs_deb_enter(LBS_DEB_WEXT); mode = adapter->psmode; - if ((vwrq->disabled = (mode == WLAN802_11POWERMODECAM)) - || adapter->connect_status == LIBERTAS_DISCONNECTED) + if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM)) + || adapter->connect_status == LBS_DISCONNECTED) { goto out; } @@ -803,7 +803,7 @@ out: return 0; } -static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) +static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) { enum { POOR = 30, @@ -813,8 +813,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) EXCELLENT = 95, PERFECT = 100 }; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; u32 rssi_qual; u32 tx_qual; u32 quality = 0; @@ -827,7 +827,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) priv->wstats.status = adapter->mode; /* If we're not associated, all quality values are meaningless */ - if (adapter->connect_status != LIBERTAS_CONNECTED) + if (adapter->connect_status != LBS_CONNECTED) goto out; /* Quality by RSSI */ @@ -890,9 +890,9 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) stats_valid = 1; /* update stats asynchronously for future calls */ - libertas_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, + lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, 0, 0, NULL); - libertas_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0, + lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0, 0, 0, NULL); out: if (!stats_valid) { @@ -912,19 +912,19 @@ out: } -static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { int ret = -EINVAL; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -949,7 +949,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, goto out; } - cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); + cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); if (!cfp) { goto out; } @@ -960,9 +960,9 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, out: if (ret == 0) { set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } else { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -970,11 +970,11 @@ out: return ret; } -static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; u32 new_rate; u16 action; int ret = -EINVAL; @@ -1006,7 +1006,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, adapter->auto_rate = 0; } - ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, action, CMD_OPTION_WAITFORRSP, 0, NULL); out: @@ -1014,15 +1014,15 @@ out: return ret; } -static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status == LIBERTAS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { vwrq->value = adapter->cur_rate * 500000; if (adapter->auto_rate) @@ -1039,12 +1039,12 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_set_mode(struct net_device *dev, +static int lbs_set_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); @@ -1058,14 +1058,14 @@ static int wlan_set_mode(struct net_device *dev, } mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } else { assoc_req->mode = *uwrq; set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); } mutex_unlock(&adapter->lock); @@ -1085,12 +1085,12 @@ out: * @param extra A pointer to extra data buf * @return 0 --success, otherwise fail */ -static int wlan_get_encode(struct net_device *dev, +static int lbs_get_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, u8 * extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; lbs_deb_enter(LBS_DEB_WEXT); @@ -1171,7 +1171,7 @@ static int wlan_get_encode(struct net_device *dev, * @param set_tx_key Force set TX key (1 = yes, 0 = no) * @return 0 --success, otherwise fail */ -static int wlan_set_wep_key(struct assoc_request *assoc_req, +static int lbs_set_wep_key(struct assoc_request *assoc_req, const char *key_material, u16 key_length, u16 index, @@ -1289,20 +1289,20 @@ static void disable_wpa(struct assoc_request *assoc_req) * @param extra A pointer to extra data buf * @return 0 --success, otherwise fail */ -static int wlan_set_encode(struct net_device *dev, +static int lbs_set_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; u16 is_default = 0, index = 0, set_tx_key = 0; lbs_deb_enter(LBS_DEB_WEXT); mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1328,7 +1328,7 @@ static int wlan_set_encode(struct net_device *dev, if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default)) set_tx_key = 1; - ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); + ret = lbs_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); if (ret) goto out; @@ -1346,9 +1346,9 @@ static int wlan_set_encode(struct net_device *dev, out: if (ret == 0) { set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } else { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1365,14 +1365,14 @@ out: * @param extra A pointer to extra data buf * @return 0 on success, otherwise failure */ -static int wlan_get_encodeext(struct net_device *dev, +static int lbs_get_encodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int ret = -EINVAL; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int index, max_key_len; @@ -1472,14 +1472,14 @@ out: * @param extra A pointer to extra data buf * @return 0 --success, otherwise fail */ -static int wlan_set_encodeext(struct net_device *dev, +static int lbs_set_encodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int alg = ext->alg; struct assoc_request * assoc_req; @@ -1487,7 +1487,7 @@ static int wlan_set_encodeext(struct net_device *dev, lbs_deb_enter(LBS_DEB_WEXT); mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1514,7 +1514,7 @@ static int wlan_set_encodeext(struct net_device *dev, set_tx_key = 1; /* Copy key to driver */ - ret = wlan_set_wep_key (assoc_req, ext->key, ext->key_len, index, + ret = lbs_set_wep_key(assoc_req, ext->key, ext->key_len, index, set_tx_key); if (ret) goto out; @@ -1587,9 +1587,9 @@ static int wlan_set_encodeext(struct net_device *dev, out: if (ret == 0) { - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } else { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1598,20 +1598,20 @@ out: } -static int wlan_set_genie(struct net_device *dev, +static int lbs_set_genie(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1634,9 +1634,9 @@ static int wlan_set_genie(struct net_device *dev, out: if (ret == 0) { set_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } else { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1644,14 +1644,14 @@ out: return ret; } -static int wlan_get_genie(struct net_device *dev, +static int lbs_get_genie(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1674,13 +1674,13 @@ out: } -static int wlan_set_auth(struct net_device *dev, +static int lbs_set_auth(struct net_device *dev, struct iw_request_info *info, struct iw_param *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; int updated = 0; @@ -1688,7 +1688,7 @@ static int wlan_set_auth(struct net_device *dev, lbs_deb_enter(LBS_DEB_WEXT); mutex_lock(&adapter->lock); - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1763,9 +1763,9 @@ out: if (ret == 0) { if (updated) set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } else if (ret != -EOPNOTSUPP) { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1773,14 +1773,14 @@ out: return ret; } -static int wlan_get_auth(struct net_device *dev, +static int lbs_get_auth(struct net_device *dev, struct iw_request_info *info, struct iw_param *dwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1813,25 +1813,25 @@ static int wlan_get_auth(struct net_device *dev, } -static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; u16 dbm; lbs_deb_enter(LBS_DEB_WEXT); if (vwrq->disabled) { - wlan_radio_ioctl(priv, RADIO_OFF); + lbs_radio_ioctl(priv, RADIO_OFF); return 0; } adapter->preamble = CMD_TYPE_AUTO_PREAMBLE; - wlan_radio_ioctl(priv, RADIO_ON); + lbs_radio_ioctl(priv, RADIO_ON); /* Userspace check in iwrange if it should use dBm or mW, * therefore this should never happen... Jean II */ @@ -1847,7 +1847,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, lbs_deb_wext("txpower set %d dbm\n", dbm); - ret = libertas_prepare_and_send_command(priv, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_TX_POWER, CMD_ACT_TX_POWER_OPT_SET_LOW, CMD_OPTION_WAITFORRSP, 0, (void *)&dbm); @@ -1856,11 +1856,11 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, return ret; } -static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, +static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1872,7 +1872,7 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, /* * Get the current SSID */ - if (adapter->connect_status == LIBERTAS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { memcpy(extra, adapter->curbssparams.ssid, adapter->curbssparams.ssid_len); extra[adapter->curbssparams.ssid_len] = '\0'; @@ -1892,11 +1892,11 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, return 0; } -static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; int ret = 0; u8 ssid[IW_ESSID_MAX_SIZE]; u8 ssid_len = 0; @@ -1932,7 +1932,7 @@ out: mutex_lock(&adapter->lock); if (ret == 0) { /* Get or create the current association request */ - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { ret = -ENOMEM; } else { @@ -1940,13 +1940,13 @@ out: memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); assoc_req->ssid_len = ssid_len; set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } } /* Cancel the association request if there was an error */ if (ret != 0) { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1964,11 +1964,11 @@ out: * @param extra A pointer to extra data buf * @return 0 --success, otherwise fail */ -static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, +static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { - wlan_private *priv = dev->priv; - wlan_adapter *adapter = priv->adapter; + lbs_private *priv = dev->priv; + lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; DECLARE_MAC_BUF(mac); @@ -1983,15 +1983,15 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, mutex_lock(&adapter->lock); /* Get or create the current association request */ - assoc_req = wlan_get_association_request(adapter); + assoc_req = lbs_get_association_request(adapter); if (!assoc_req) { - libertas_cancel_association_work(priv); + lbs_cancel_association_work(priv); ret = -ENOMEM; } else { /* Copy the BSSID to the association request */ memcpy(&assoc_req->bssid, awrq->sa_data, ETH_ALEN); set_bit(ASSOC_FLAG_BSSID, &assoc_req->flags); - libertas_postpone_association_work(priv); + lbs_postpone_association_work(priv); } mutex_unlock(&adapter->lock); @@ -1999,7 +1999,7 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, return ret; } -void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) +void lbs_get_fwversion(lbs_adapter *adapter, char *fwversion, int maxlen) { char fwver[32]; @@ -2025,19 +2025,19 @@ void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) /* * iwconfig settable callbacks */ -static const iw_handler wlan_handler[] = { +static const iw_handler lbs_handler[] = { (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) wlan_get_name, /* SIOCGIWNAME */ + (iw_handler) lbs_get_name, /* SIOCGIWNAME */ (iw_handler) NULL, /* SIOCSIWNWID */ (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */ - (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */ - (iw_handler) wlan_set_mode, /* SIOCSIWMODE */ - (iw_handler) wlan_get_mode, /* SIOCGIWMODE */ + (iw_handler) lbs_set_freq, /* SIOCSIWFREQ */ + (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ + (iw_handler) lbs_set_mode, /* SIOCSIWMODE */ + (iw_handler) lbs_get_mode, /* SIOCGIWMODE */ (iw_handler) NULL, /* SIOCSIWSENS */ (iw_handler) NULL, /* SIOCGIWSENS */ (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) wlan_get_range, /* SIOCGIWRANGE */ + (iw_handler) lbs_get_range, /* SIOCGIWRANGE */ (iw_handler) NULL, /* SIOCSIWPRIV */ (iw_handler) NULL, /* SIOCGIWPRIV */ (iw_handler) NULL, /* SIOCSIWSTATS */ @@ -2046,56 +2046,56 @@ static const iw_handler wlan_handler[] = { iw_handler_get_spy, /* SIOCGIWSPY */ iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ - (iw_handler) wlan_set_wap, /* SIOCSIWAP */ - (iw_handler) wlan_get_wap, /* SIOCGIWAP */ + (iw_handler) lbs_set_wap, /* SIOCSIWAP */ + (iw_handler) lbs_get_wap, /* SIOCGIWAP */ (iw_handler) NULL, /* SIOCSIWMLME */ (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ - (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */ - (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */ - (iw_handler) wlan_set_essid, /* SIOCSIWESSID */ - (iw_handler) wlan_get_essid, /* SIOCGIWESSID */ - (iw_handler) wlan_set_nick, /* SIOCSIWNICKN */ - (iw_handler) wlan_get_nick, /* SIOCGIWNICKN */ + (iw_handler) lbs_set_scan, /* SIOCSIWSCAN */ + (iw_handler) lbs_get_scan, /* SIOCGIWSCAN */ + (iw_handler) lbs_set_essid, /* SIOCSIWESSID */ + (iw_handler) lbs_get_essid, /* SIOCGIWESSID */ + (iw_handler) lbs_set_nick, /* SIOCSIWNICKN */ + (iw_handler) lbs_get_nick, /* SIOCGIWNICKN */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ - (iw_handler) wlan_set_rate, /* SIOCSIWRATE */ - (iw_handler) wlan_get_rate, /* SIOCGIWRATE */ - (iw_handler) wlan_set_rts, /* SIOCSIWRTS */ - (iw_handler) wlan_get_rts, /* SIOCGIWRTS */ - (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */ - (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */ - (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */ - (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */ - (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */ - (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */ - (iw_handler) wlan_set_power, /* SIOCSIWPOWER */ - (iw_handler) wlan_get_power, /* SIOCGIWPOWER */ + (iw_handler) lbs_set_rate, /* SIOCSIWRATE */ + (iw_handler) lbs_get_rate, /* SIOCGIWRATE */ + (iw_handler) lbs_set_rts, /* SIOCSIWRTS */ + (iw_handler) lbs_get_rts, /* SIOCGIWRTS */ + (iw_handler) lbs_set_frag, /* SIOCSIWFRAG */ + (iw_handler) lbs_get_frag, /* SIOCGIWFRAG */ + (iw_handler) lbs_set_txpow, /* SIOCSIWTXPOW */ + (iw_handler) lbs_get_txpow, /* SIOCGIWTXPOW */ + (iw_handler) lbs_set_retry, /* SIOCSIWRETRY */ + (iw_handler) lbs_get_retry, /* SIOCGIWRETRY */ + (iw_handler) lbs_set_encode, /* SIOCSIWENCODE */ + (iw_handler) lbs_get_encode, /* SIOCGIWENCODE */ + (iw_handler) lbs_set_power, /* SIOCSIWPOWER */ + (iw_handler) lbs_get_power, /* SIOCGIWPOWER */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ - (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */ - (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */ - (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */ - (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */ - (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */ - (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */ + (iw_handler) lbs_set_genie, /* SIOCSIWGENIE */ + (iw_handler) lbs_get_genie, /* SIOCGIWGENIE */ + (iw_handler) lbs_set_auth, /* SIOCSIWAUTH */ + (iw_handler) lbs_get_auth, /* SIOCGIWAUTH */ + (iw_handler) lbs_set_encodeext,/* SIOCSIWENCODEEXT */ + (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */ (iw_handler) NULL, /* SIOCSIWPMKSA */ }; static const iw_handler mesh_wlan_handler[] = { (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) wlan_get_name, /* SIOCGIWNAME */ + (iw_handler) lbs_get_name, /* SIOCGIWNAME */ (iw_handler) NULL, /* SIOCSIWNWID */ (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */ - (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */ + (iw_handler) lbs_set_freq, /* SIOCSIWFREQ */ + (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ (iw_handler) NULL, /* SIOCSIWMODE */ (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ (iw_handler) NULL, /* SIOCSIWSENS */ (iw_handler) NULL, /* SIOCGIWSENS */ (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) wlan_get_range, /* SIOCGIWRANGE */ + (iw_handler) lbs_get_range, /* SIOCGIWRANGE */ (iw_handler) NULL, /* SIOCSIWPRIV */ (iw_handler) NULL, /* SIOCGIWPRIV */ (iw_handler) NULL, /* SIOCSIWSTATS */ @@ -2108,46 +2108,46 @@ static const iw_handler mesh_wlan_handler[] = { (iw_handler) NULL, /* SIOCGIWAP */ (iw_handler) NULL, /* SIOCSIWMLME */ (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ - (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */ - (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */ + (iw_handler) lbs_set_scan, /* SIOCSIWSCAN */ + (iw_handler) lbs_get_scan, /* SIOCGIWSCAN */ (iw_handler) NULL, /* SIOCSIWESSID */ (iw_handler) NULL, /* SIOCGIWESSID */ (iw_handler) NULL, /* SIOCSIWNICKN */ (iw_handler) mesh_get_nick, /* SIOCGIWNICKN */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ - (iw_handler) wlan_set_rate, /* SIOCSIWRATE */ - (iw_handler) wlan_get_rate, /* SIOCGIWRATE */ - (iw_handler) wlan_set_rts, /* SIOCSIWRTS */ - (iw_handler) wlan_get_rts, /* SIOCGIWRTS */ - (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */ - (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */ - (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */ - (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */ - (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */ - (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */ - (iw_handler) wlan_set_power, /* SIOCSIWPOWER */ - (iw_handler) wlan_get_power, /* SIOCGIWPOWER */ + (iw_handler) lbs_set_rate, /* SIOCSIWRATE */ + (iw_handler) lbs_get_rate, /* SIOCGIWRATE */ + (iw_handler) lbs_set_rts, /* SIOCSIWRTS */ + (iw_handler) lbs_get_rts, /* SIOCGIWRTS */ + (iw_handler) lbs_set_frag, /* SIOCSIWFRAG */ + (iw_handler) lbs_get_frag, /* SIOCGIWFRAG */ + (iw_handler) lbs_set_txpow, /* SIOCSIWTXPOW */ + (iw_handler) lbs_get_txpow, /* SIOCGIWTXPOW */ + (iw_handler) lbs_set_retry, /* SIOCSIWRETRY */ + (iw_handler) lbs_get_retry, /* SIOCGIWRETRY */ + (iw_handler) lbs_set_encode, /* SIOCSIWENCODE */ + (iw_handler) lbs_get_encode, /* SIOCGIWENCODE */ + (iw_handler) lbs_set_power, /* SIOCSIWPOWER */ + (iw_handler) lbs_get_power, /* SIOCGIWPOWER */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ - (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */ - (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */ - (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */ - (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */ - (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */ - (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */ + (iw_handler) lbs_set_genie, /* SIOCSIWGENIE */ + (iw_handler) lbs_get_genie, /* SIOCGIWGENIE */ + (iw_handler) lbs_set_auth, /* SIOCSIWAUTH */ + (iw_handler) lbs_get_auth, /* SIOCGIWAUTH */ + (iw_handler) lbs_set_encodeext,/* SIOCSIWENCODEEXT */ + (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */ (iw_handler) NULL, /* SIOCSIWPMKSA */ }; -struct iw_handler_def libertas_handler_def = { - .num_standard = ARRAY_SIZE(wlan_handler), - .standard = (iw_handler *) wlan_handler, - .get_wireless_stats = wlan_get_wireless_stats, +struct iw_handler_def lbs_handler_def = { + .num_standard = ARRAY_SIZE(lbs_handler), + .standard = (iw_handler *) lbs_handler, + .get_wireless_stats = lbs_get_wireless_stats, }; struct iw_handler_def mesh_handler_def = { .num_standard = ARRAY_SIZE(mesh_wlan_handler), .standard = (iw_handler *) mesh_wlan_handler, - .get_wireless_stats = wlan_get_wireless_stats, + .get_wireless_stats = lbs_get_wireless_stats, }; diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h index 6aa444c7de8..a563d9a231b 100644 --- a/drivers/net/wireless/libertas/wext.h +++ b/drivers/net/wireless/libertas/wext.h @@ -1,11 +1,11 @@ /** * This file contains definition for IOCTL call. */ -#ifndef _WLAN_WEXT_H_ -#define _WLAN_WEXT_H_ +#ifndef _LBS_WEXT_H_ +#define _LBS_WEXT_H_ -/** wlan_ioctl_regrdwr */ -struct wlan_ioctl_regrdwr { +/** lbs_ioctl_regrdwr */ +struct lbs_ioctl_regrdwr { /** Which register to access */ u16 whichreg; /** Read or Write */ @@ -15,9 +15,9 @@ struct wlan_ioctl_regrdwr { u32 value; }; -#define WLAN_MONITOR_OFF 0 +#define LBS_MONITOR_OFF 0 -extern struct iw_handler_def libertas_handler_def; +extern struct iw_handler_def lbs_handler_def; extern struct iw_handler_def mesh_handler_def; -#endif /* _WLAN_WEXT_H_ */ +#endif -- cgit v1.2.3 From 0765af4493193149505f118d04d9300f0a15c8f5 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Mon, 15 Oct 2007 12:55:56 +0200 Subject: libertas: clean up association debug messages This makes the debug output of all association stuff clearer by: * adding some lbs_deb_enter()/lbs_deb_leave() calls * printing the return level in one place * lower-casing some string Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 136 ++++++++++++++++------------------ 1 file changed, 64 insertions(+), 72 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index e52b1eead28..f634c9496ec 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -14,29 +14,6 @@ static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static void print_assoc_req(const char * extra, struct assoc_request * assoc_req) -{ - DECLARE_MAC_BUF(mac); - lbs_deb_assoc( - "#### Association Request: %s\n" - " flags: 0x%08lX\n" - " SSID: '%s'\n" - " channel: %d\n" - " band: %d\n" - " mode: %d\n" - " BSSID: %s\n" - " Encryption:%s%s%s\n" - " auth: %d\n", - extra, assoc_req->flags, - escape_essid(assoc_req->ssid, assoc_req->ssid_len), - assoc_req->channel, assoc_req->band, assoc_req->mode, - print_mac(mac, assoc_req->bssid), - assoc_req->secinfo.WPAenabled ? " WPA" : "", - assoc_req->secinfo.WPA2enabled ? " WPA2" : "", - assoc_req->secinfo.wep_enabled ? " WEP" : "", - assoc_req->secinfo.auth_mode); -} - static int assoc_helper_essid(lbs_private *priv, struct assoc_request * assoc_req) @@ -55,7 +32,7 @@ static int assoc_helper_essid(lbs_private *priv, if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) channel = assoc_req->channel; - lbs_deb_assoc("New SSID requested: '%s'\n", + lbs_deb_assoc("SSID '%s' requested\n", escape_essid(assoc_req->ssid, assoc_req->ssid_len)); if (assoc_req->mode == IW_MODE_INFRA) { lbs_send_specific_ssid_scan(priv, assoc_req->ssid, @@ -64,7 +41,6 @@ static int assoc_helper_essid(lbs_private *priv, bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); if (bss != NULL) { - lbs_deb_assoc("SSID found in scan list, associating\n"); memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); ret = lbs_associate(priv, assoc_req); } else { @@ -138,6 +114,8 @@ static int assoc_helper_associate(lbs_private *priv, { int ret = 0, done = 0; + lbs_deb_enter(LBS_DEB_ASSOC); + /* If we're given and 'any' BSSID, try associating based on SSID */ if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { @@ -145,19 +123,14 @@ static int assoc_helper_associate(lbs_private *priv, && compare_ether_addr(bssid_off, assoc_req->bssid)) { ret = assoc_helper_bssid(priv, assoc_req); done = 1; - if (ret) { - lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret); - } } } if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { ret = assoc_helper_essid(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret); - } } + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } @@ -194,18 +167,24 @@ done: static int update_channel(lbs_private * priv) { + int ret; /* the channel in f/w could be out of sync, get the current channel */ - return lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, + lbs_deb_enter(LBS_DEB_ASSOC); + ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, CMD_OPT_802_11_RF_CHANNEL_GET, CMD_OPTION_WAITFORRSP, 0, NULL); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); + return ret; } void lbs_sync_channel(struct work_struct *work) { lbs_private *priv = container_of(work, lbs_private, sync_channel); + lbs_deb_enter(LBS_DEB_ASSOC); if (update_channel(priv) != 0) lbs_pr_info("Channel synchronization failed."); + lbs_deb_leave(LBS_DEB_ASSOC); } static int assoc_helper_channel(lbs_private *priv, @@ -437,40 +416,51 @@ static int assoc_helper_wpa_ie(lbs_private *priv, static int should_deauth_infrastructure(lbs_adapter *adapter, struct assoc_request * assoc_req) { + int ret = 0; + + lbs_deb_enter(LBS_DEB_ASSOC); + if (adapter->connect_status != LBS_CONNECTED) return 0; if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - lbs_deb_assoc("Deauthenticating due to new SSID in " - " configuration request.\n"); - return 1; + lbs_deb_assoc("Deauthenticating due to new SSID\n"); + ret = 1; + goto out; } if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { - lbs_deb_assoc("Deauthenticating due to updated security " - "info in configuration request.\n"); - return 1; + lbs_deb_assoc("Deauthenticating due to new security\n"); + ret = 1; + goto out; } } if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { - lbs_deb_assoc("Deauthenticating due to new BSSID in " - " configuration request.\n"); - return 1; + lbs_deb_assoc("Deauthenticating due to new BSSID\n"); + ret = 1; + goto out; } if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { - lbs_deb_assoc("Deauthenticating due to channel switch.\n"); - return 1; + lbs_deb_assoc("Deauthenticating due to channel switch\n"); + ret = 1; + goto out; } /* FIXME: deal with 'auto' mode somehow */ if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { - if (assoc_req->mode != IW_MODE_INFRA) - return 1; + if (assoc_req->mode != IW_MODE_INFRA) { + lbs_deb_assoc("Deauthenticating due to leaving " + "infra mode\n"); + ret = 1; + goto out; + } } +out: + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return 0; } @@ -478,6 +468,8 @@ static int should_deauth_infrastructure(lbs_adapter *adapter, static int should_stop_adhoc(lbs_adapter *adapter, struct assoc_request * assoc_req) { + lbs_deb_enter(LBS_DEB_ASSOC); + if (adapter->connect_status != LBS_CONNECTED) return 0; @@ -497,6 +489,7 @@ static int should_stop_adhoc(lbs_adapter *adapter, return 1; } + lbs_deb_leave(LBS_DEB_ASSOC); return 0; } @@ -521,7 +514,24 @@ void lbs_association_worker(struct work_struct *work) if (!assoc_req) goto done; - print_assoc_req(__func__, assoc_req); + lbs_deb_assoc( + "Association Request:\n" + " flags: 0x%08lx\n" + " SSID: '%s'\n" + " chann: %d\n" + " band: %d\n" + " mode: %d\n" + " BSSID: %s\n" + " secinfo: %s%s%s\n" + " auth_mode: %d\n", + assoc_req->flags, + escape_essid(assoc_req->ssid, assoc_req->ssid_len), + assoc_req->channel, assoc_req->band, assoc_req->mode, + print_mac(mac, assoc_req->bssid), + assoc_req->secinfo.WPAenabled ? " WPA" : "", + assoc_req->secinfo.WPA2enabled ? " WPA2" : "", + assoc_req->secinfo.wep_enabled ? " WEP" : "", + assoc_req->secinfo.auth_mode); /* If 'any' SSID was specified, find an SSID to associate with */ if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) @@ -581,58 +591,40 @@ void lbs_association_worker(struct work_struct *work) /* Send the various configuration bits to the firmware */ if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { ret = assoc_helper_mode(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { ret = assoc_helper_channel(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } if ( test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags) || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { ret = assoc_helper_wep_keys(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { ret = assoc_helper_secinfo(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { ret = assoc_helper_wpa_ie(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags) || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { ret = assoc_helper_wpa_keys(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", - __LINE__, ret); + if (ret) goto out; - } } /* SSID/BSSID should be the _last_ config option set, because they @@ -696,6 +688,7 @@ struct assoc_request *lbs_get_association_request(lbs_adapter *adapter) { struct assoc_request * assoc_req; + lbs_deb_enter(LBS_DEB_ASSOC); if (!adapter->pending_assoc_req) { adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL); @@ -762,7 +755,6 @@ struct assoc_request *lbs_get_association_request(lbs_adapter *adapter) assoc_req->wpa_ie_len = adapter->wpa_ie_len; } - print_assoc_req(__func__, assoc_req); - + lbs_deb_leave(LBS_DEB_ASSOC); return assoc_req; } -- cgit v1.2.3 From 82209adcb157e5861f2105d1658f1f07f75d69f2 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 20 Nov 2007 17:43:32 -0500 Subject: libertas: drop useless default_fw_name variable Signed-off-by: Andres Salomon Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 797d3fbf715..6d19d267702 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -19,9 +19,8 @@ #define MESSAGE_HEADER_LEN 4 static const char usbdriver_name[] = "usb8xxx"; -static u8 *default_fw_name = "usb8388.bin"; -static char *lbs_fw_name; +static char *lbs_fw_name = "usb8388.bin"; module_param_named(fw_name, lbs_fw_name, charp, 0644); /* @@ -1027,10 +1026,6 @@ static int if_usb_init_module(void) lbs_deb_enter(LBS_DEB_MAIN); - if (lbs_fw_name == NULL) { - lbs_fw_name = default_fw_name; - } - ret = usb_register(&if_usb_driver); lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); -- cgit v1.2.3 From 4fb910fd3ada36cd9fbf6e037b87f2a83fd740b7 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 20 Nov 2007 17:43:45 -0500 Subject: libertas: mark module_init/exit functions as __init/__exit Signed-off-by: Andres Salomon Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_sdio.c | 4 ++-- drivers/net/wireless/libertas/if_usb.c | 4 ++-- drivers/net/wireless/libertas/main.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 0c762eea7a3..de4ad57fae4 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -1052,7 +1052,7 @@ static struct sdio_driver if_sdio_driver = { /* Module functions */ /*******************************************************************/ -static int if_sdio_init_module(void) +static int __init if_sdio_init_module(void) { int ret = 0; @@ -1068,7 +1068,7 @@ static int if_sdio_init_module(void) return ret; } -static void if_sdio_exit_module(void) +static void __exit if_sdio_exit_module(void) { lbs_deb_enter(LBS_DEB_SDIO); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 6d19d267702..f7d2b46340e 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -1020,7 +1020,7 @@ static struct usb_driver if_usb_driver = { .resume = if_usb_resume, }; -static int if_usb_init_module(void) +static int __init if_usb_init_module(void) { int ret = 0; @@ -1032,7 +1032,7 @@ static int if_usb_init_module(void) return ret; } -static void if_usb_exit_module(void) +static void __exit if_usb_exit_module(void) { struct usb_card_rec *cardp, *cardp_temp; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 825970af341..f0da18c331d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1510,7 +1510,7 @@ int lbs_reset_device(lbs_private *priv) } EXPORT_SYMBOL_GPL(lbs_reset_device); -static int lbs_init_module(void) +static int __init lbs_init_module(void) { lbs_deb_enter(LBS_DEB_MAIN); lbs_debugfs_init(); @@ -1518,7 +1518,7 @@ static int lbs_init_module(void) return 0; } -static void lbs_exit_module(void) +static void __exit lbs_exit_module(void) { lbs_deb_enter(LBS_DEB_MAIN); -- cgit v1.2.3 From be13f1897f76a4b395c3d572a18b2802fd521946 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 20 Nov 2007 17:43:55 -0500 Subject: libertas: reset devices upon disconnect rather than module unloading 1) Do not reset libertas devices upon module unload. We're unloading the module, we're not killing off devices. 2) Instead, reset libertas devices inside if_usb_disconnect, as we're killing off interfaces and so on. 3) Resetting via disconnect callback means we no longer need to keep track of probed libertas devices; kill off that list (and its wonderful lack of locking..), as well. Drop a useless comment as well. Signed-off-by: Andres Salomon Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 26 ++++---------------------- drivers/net/wireless/libertas/if_usb.h | 3 --- 2 files changed, 4 insertions(+), 25 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index f7d2b46340e..4d4f757a927 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #define DRV_NAME "usb8xxx" @@ -23,15 +22,6 @@ static const char usbdriver_name[] = "usb8xxx"; static char *lbs_fw_name = "usb8388.bin"; module_param_named(fw_name, lbs_fw_name, charp, 0644); -/* - * We need to send a RESET command to all USB devices before - * we tear down the USB connection. Otherwise we would not - * be able to re-init device the device if the module gets - * loaded again. This is a list of all initialized USB devices, - * for the reset code see if_usb_reset_device() -*/ -static LIST_HEAD(usb_devices); - static struct usb_device_id if_usb_table[] = { /* Enter the device signature inside */ { USB_DEVICE(0x1286, 0x2001) }, @@ -244,8 +234,6 @@ static int if_usb_probe(struct usb_interface *intf, if (lbs_start_card(priv)) goto err_start_card; - list_add_tail(&cardp->list, &usb_devices); - usb_get_dev(udev); usb_set_intfdata(intf, cardp); @@ -279,8 +267,6 @@ static void if_usb_disconnect(struct usb_interface *intf) /* Update Surprise removed to TRUE */ cardp->surprise_removed = 1; - list_del(&cardp->list); - if (priv) { lbs_adapter *adapter = priv->adapter; @@ -290,6 +276,10 @@ static void if_usb_disconnect(struct usb_interface *intf) lbs_remove_card(priv); } + /* this is (apparently?) necessary for future usage of the device */ + lbs_prepare_and_send_command(priv, CMD_802_11_RESET, CMD_ACT_HALT, + 0, 0, NULL); + /* Unlink and free urb */ if_usb_free(cardp); @@ -1034,16 +1024,8 @@ static int __init if_usb_init_module(void) static void __exit if_usb_exit_module(void) { - struct usb_card_rec *cardp, *cardp_temp; - lbs_deb_enter(LBS_DEB_MAIN); - list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list) { - lbs_prepare_and_send_command(cardp->priv, CMD_802_11_RESET, - CMD_ACT_HALT, 0, 0, NULL); - } - - /* API unregisters the driver from USB subsystem */ usb_deregister(&if_usb_driver); lbs_deb_leave(LBS_DEB_MAIN); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 9b4230864c4..f53ddb25158 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -1,8 +1,6 @@ #ifndef _LBS_IF_USB_H #define _LBS_IF_USB_H -#include - /** * This file contains definition for USB interface. */ @@ -44,7 +42,6 @@ struct read_cb_info { /** USB card description structure*/ struct usb_card_rec { - struct list_head list; struct net_device *eth_dev; struct usb_device *udev; struct urb *rx_urb, *tx_urb; -- cgit v1.2.3 From 798fbfec9ca1dfd656963debb14d049868d24465 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 20 Nov 2007 17:44:04 -0500 Subject: libertas: nuke useless variable usbdriver_name and useless comments I think it was pretty obvious what fields in if_usb_driver are... Signed-off-by: Andres Salomon Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 4d4f757a927..043a33d49f4 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -17,8 +17,6 @@ #define MESSAGE_HEADER_LEN 4 -static const char usbdriver_name[] = "usb8xxx"; - static char *lbs_fw_name = "usb8388.bin"; module_param_named(fw_name, lbs_fw_name, charp, 0644); @@ -998,13 +996,9 @@ static int if_usb_resume(struct usb_interface *intf) #endif static struct usb_driver if_usb_driver = { - /* driver name */ - .name = usbdriver_name, - /* probe function name */ + .name = DRV_NAME, .probe = if_usb_probe, - /* disconnect function name */ .disconnect = if_usb_disconnect, - /* device signature table */ .id_table = if_usb_table, .suspend = if_usb_suspend, .resume = if_usb_resume, -- cgit v1.2.3 From 01d77d8d4747d73cfb6daf35cdc906a2db8ded9d Mon Sep 17 00:00:00 2001 From: Brajesh Dave Date: Tue, 20 Nov 2007 17:44:14 -0500 Subject: libertas: separate mesh connectivity from that of the main interface The transmit and receive traffic as soon as the mesh interface is brought up. Test case 1: Bring up only the mesh interface and ping. No need for any iwconfig commands on the main interface. $ ifconfig msh0 192.168.5.3 $ iwconfig msh0 channel X $ ping 192.168.5.2 If ping succeeds, PASS Test case 2: Associate with the main interface, and turn off AP. Mesh interface should not lose connectivity. $ iwconfig eth0 mode managed essid "my_ssid" $ ifconfig msh0 192.168.5.3 $ ping 192.168.5.2 If ping continues uninterrupted, PASS This feature requires firmware version 5.110.19.p0 or newer, available here: http://dev.laptop.org/pub/firmware/libertas/ Signed-off-by: Ashish Shukla Signed-off-by: Javier Cardona Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 3 ++- drivers/net/wireless/libertas/cmdresp.c | 2 +- drivers/net/wireless/libertas/dev.h | 1 + drivers/net/wireless/libertas/if_usb.c | 5 +++-- drivers/net/wireless/libertas/join.c | 9 --------- drivers/net/wireless/libertas/main.c | 29 ++++++++++++++++++++--------- drivers/net/wireless/libertas/scan.c | 14 ++++++++------ drivers/net/wireless/libertas/tx.c | 9 +++++---- drivers/net/wireless/libertas/wext.c | 11 +++++++---- 9 files changed, 47 insertions(+), 36 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 5b2a1c7c5f0..b4d1b148584 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1755,7 +1755,8 @@ int lbs_execute_next_command(lbs_private * priv) */ if ((adapter->psmode != LBS802_11POWERMODECAM) && (adapter->psstate == PS_STATE_FULL_POWER) && - (adapter->connect_status == LBS_CONNECTED)) { + ((adapter->connect_status == LBS_CONNECTED) || + (adapter->mesh_connect_status == LBS_CONNECTED))) { if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { /* check for valid WPA group keys */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 6c1fdb8f11f..11b93f2cde8 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -979,7 +979,7 @@ int lbs_process_event(lbs_private * priv) break; } lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); - adapter->connect_status = LBS_CONNECTED; + adapter->mesh_connect_status = LBS_CONNECTED; if (priv->mesh_open == 1) { netif_wake_queue(priv->mesh_dev); netif_carrier_on(priv->mesh_dev); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 27db5d4389a..433b9bdf80f 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -291,6 +291,7 @@ struct _lbs_adapter { /** NIC Operation characteristics */ u16 currentpacketfilter; u32 connect_status; + u32 mesh_connect_status; u16 regioncode; u16 txpowerlevel; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 043a33d49f4..26176d54c57 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -73,10 +73,11 @@ static void if_usb_write_bulk_callback(struct urb *urb) if (!adapter->cur_cmd) wake_up_interruptible(&priv->waitq); - if ((adapter->connect_status == LBS_CONNECTED)) { + if (adapter->connect_status == LBS_CONNECTED) netif_wake_queue(dev); + + if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) netif_wake_queue(priv->mesh_dev); - } } } else { /* print the failure status number for debug */ diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 90c25f47812..3854d91c90e 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -795,10 +795,6 @@ int lbs_ret_80211_associate(lbs_private *priv, netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); - if (priv->mesh_dev) { - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - } memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; @@ -884,11 +880,6 @@ int lbs_ret_80211_ad_hoc_start(lbs_private *priv, netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); - if (priv->mesh_dev) { - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - } - memset(&wrqu, 0, sizeof(wrqu)); memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index f0da18c331d..769117916fb 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -406,13 +406,15 @@ static int lbs_dev_open(struct net_device *dev) priv->open = 1; - if (adapter->connect_status == LBS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) netif_carrier_on(priv->dev); - if (priv->mesh_dev) - netif_carrier_on(priv->mesh_dev); - } else { + else netif_carrier_off(priv->dev); - if (priv->mesh_dev) + + if (priv->mesh_dev) { + if (adapter->mesh_connect_status == LBS_CONNECTED) + netif_carrier_on(priv->mesh_dev); + else netif_carrier_off(priv->mesh_dev); } @@ -433,6 +435,11 @@ static int lbs_mesh_open(struct net_device *dev) return -1; priv->mesh_open = 1 ; netif_wake_queue(priv->mesh_dev); + + priv->adapter->mesh_connect_status = LBS_CONNECTED; + + netif_carrier_on(priv->mesh_dev); + netif_wake_queue(priv->mesh_dev); if (priv->infra_open == 0) return lbs_dev_open(priv->dev) ; return 0; @@ -548,7 +555,7 @@ static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, SET_MESH_FRAME(skb); - ret = lbs_hard_start_xmit(skb, priv->dev); + ret = lbs_hard_start_xmit(skb, priv->mesh_dev); lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); return ret; } @@ -595,9 +602,12 @@ static void lbs_tx_timeout(struct net_device *dev) lbs_send_tx_feedback(priv); } else wake_up_interruptible(&priv->waitq); - } else if (priv->adapter->connect_status == LBS_CONNECTED) { - netif_wake_queue(priv->dev); - if (priv->mesh_dev) + } else if (dev == priv->dev) { + if (priv->adapter->connect_status == LBS_CONNECTED) + netif_wake_queue(priv->dev); + + } else if (dev == priv->mesh_dev) { + if (priv->adapter->mesh_connect_status == LBS_CONNECTED) netif_wake_queue(priv->mesh_dev); } @@ -1054,6 +1064,7 @@ static int lbs_init_adapter(lbs_private *priv) memset(adapter->current_addr, 0xff, ETH_ALEN); adapter->connect_status = LBS_DISCONNECTED; + adapter->mesh_connect_status = LBS_DISCONNECTED; adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; adapter->mode = IW_MODE_INFRA; adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 30e1a8e8a16..13a0838aa1e 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -297,7 +297,8 @@ static void lbs_scan_create_channel_list(lbs_private *priv, for (rgnidx = 0; rgnidx < ARRAY_SIZE(adapter->region_channel); rgnidx++) { if (priv->adapter->enable11d && - adapter->connect_status != LBS_CONNECTED) { + (adapter->connect_status != LBS_CONNECTED) && + (adapter->mesh_connect_status != LBS_CONNECTED)) { /* Scan all the supported chan for the first scan */ if (!adapter->universal_channel[rgnidx].valid) continue; @@ -897,13 +898,14 @@ int lbs_scan_networks(lbs_private *priv, mutex_unlock(&adapter->lock); #endif - if (priv->adapter->connect_status == LBS_CONNECTED) { + if (adapter->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); - if (priv->mesh_dev) { - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - } + } + + if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) { + netif_carrier_on(priv->mesh_dev); + netif_wake_queue(priv->mesh_dev); } out: diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 93725ce55b1..267274b804c 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -273,10 +273,11 @@ void lbs_send_tx_feedback(lbs_private *priv) lbs_upload_rx_packet(priv, adapter->currenttxskb); adapter->currenttxskb = NULL; priv->adapter->TxLockFlag = 0; - if (priv->adapter->connect_status == LBS_CONNECTED) { + + if (adapter->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); - if (priv->mesh_dev) - netif_wake_queue(priv->mesh_dev); - } + + if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) + netif_wake_queue(priv->mesh_dev); } EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 57fe5f67a05..2231a65a537 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -154,7 +154,8 @@ static void copy_active_data_rates(lbs_adapter *adapter, u8 *rates) { lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status != LBS_CONNECTED) + if ((adapter->connect_status != LBS_CONNECTED) && + (adapter->mesh_connect_status != LBS_CONNECTED)) memcpy(rates, lbs_bg_rates, MAX_RATES); else memcpy(rates, adapter->curbssparams.rates, MAX_RATES); @@ -274,7 +275,7 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, /* Use nickname to indicate that mesh is on */ - if (adapter->connect_status == LBS_CONNECTED) { + if (adapter->mesh_connect_status == LBS_CONNECTED) { strncpy(extra, "Mesh", 12); extra[12] = '\0'; dwrq->length = strlen(extra); @@ -589,7 +590,8 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, range->num_frequency = 0; if (priv->adapter->enable11d && - adapter->connect_status == LBS_CONNECTED) { + (adapter->connect_status == LBS_CONNECTED || + adapter->mesh_connect_status == LBS_CONNECTED)) { u8 chan_no; u8 band; @@ -827,7 +829,8 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) priv->wstats.status = adapter->mode; /* If we're not associated, all quality values are meaningless */ - if (adapter->connect_status != LBS_CONNECTED) + if ((adapter->connect_status != LBS_CONNECTED) && + (adapter->mesh_connect_status != LBS_CONNECTED)) goto out; /* Quality by RSSI */ -- cgit v1.2.3 From 96287ac4f7b387acbe17e24b5e1bcbf3bc0e75cd Mon Sep 17 00:00:00 2001 From: Brajesh Dave Date: Tue, 20 Nov 2007 17:44:28 -0500 Subject: libertas: configurable beacon interval Requires firmware version 5.110.19.p0 or newer, available here: http://dev.laptop.org/pub/firmware/libertas/ Signed-off-by: Ashish Shukla Signed-off-by: Javier Cardona Signed-off-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 25 +++++++++++++++++++++++++ drivers/net/wireless/libertas/cmdresp.c | 22 ++++++++++++++++++++++ drivers/net/wireless/libertas/dev.h | 2 ++ drivers/net/wireless/libertas/host.h | 2 ++ drivers/net/wireless/libertas/hostcmd.h | 7 +++++++ drivers/net/wireless/libertas/join.c | 4 +++- 6 files changed, 61 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index b4d1b148584..3702c5da1f6 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -901,6 +901,28 @@ static int lbs_cmd_mesh_access(lbs_private * priv, return 0; } +static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, + struct cmd_ds_command *cmd, + u16 cmd_action) +{ + struct cmd_ds_802_11_beacon_control + *bcn_ctrl = &cmd->params.bcn_ctrl; + struct lbs_adapter *adapter = priv->adapter; + + lbs_deb_enter(LBS_DEB_CMD); + cmd->size = + cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control) + + S_DS_GEN); + cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL); + + bcn_ctrl->action = cpu_to_le16(cmd_action); + bcn_ctrl->beacon_enable = cpu_to_le16(adapter->beacon_enable); + bcn_ctrl->beacon_period = cpu_to_le16(adapter->beacon_period); + + lbs_deb_leave(LBS_DEB_CMD); + return 0; +} + static int lbs_cmd_set_boot2_ver(lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) @@ -1400,6 +1422,9 @@ int lbs_prepare_and_send_command(lbs_private * priv, S_DS_GEN); ret = 0; break; + case CMD_802_11_BEACON_CTRL: + ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action); + break; default: lbs_deb_host("PREP_CMD: unknown command 0x%04x\n", cmd_no); ret = -1; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 11b93f2cde8..1f74810a5e1 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -536,6 +536,24 @@ static int lbs_ret_802_11_enable_rsn(lbs_private * priv, return 0; } +static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, + struct cmd_ds_command *resp) +{ + struct cmd_ds_802_11_beacon_control *bcn_ctrl = + &resp->params.bcn_ctrl; + struct lbs_adapter *adapter = priv->adapter; + + lbs_deb_enter(LBS_DEB_CMD); + + if (bcn_ctrl->action == CMD_ACT_GET) { + adapter->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); + adapter->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); + } + + lbs_deb_enter(LBS_DEB_CMD); + return 0; +} + static inline int handle_cmd_response(u16 respcmd, struct cmd_ds_command *resp, lbs_private *priv) @@ -704,6 +722,10 @@ static inline int handle_cmd_response(u16 respcmd, memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, sizeof(resp->params.mesh)); break; + case CMD_RET(CMD_802_11_BEACON_CTRL): + ret = lbs_ret_802_11_bcn_ctrl(priv, resp); + break; + default: lbs_deb_host("CMD_RESP: unknown cmd response 0x%04x\n", resp->command); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 433b9bdf80f..53776bca86f 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -263,6 +263,8 @@ struct _lbs_adapter { struct list_head network_free_list; struct bss_descriptor *networks; + u16 beacon_period; + u8 beacon_enable; u8 adhoccreate; /** capability Info used in Association, start, join */ diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 3746f702d98..256cac2050c 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -116,6 +116,8 @@ #define CMD_SET_BOOT2_VER 0x00a5 +#define CMD_802_11_BEACON_CTRL 0x00b0 + /* For the IEEE Power Save */ #define CMD_SUBCMD_ENTER_PS 0x0030 #define CMD_SUBCMD_EXIT_PS 0x0031 diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 6477ce0839d..f4a265daff2 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -332,6 +332,12 @@ struct cmd_ds_802_11_radio_control { __le16 control; }; +struct cmd_ds_802_11_beacon_control { + __le16 action; + __le16 beacon_enable; + __le16 beacon_period; +}; + struct cmd_ds_802_11_sleep_params { /* ACT_GET/ACT_SET */ __le16 action; @@ -668,6 +674,7 @@ struct cmd_ds_command { struct cmd_ds_set_boot2_ver boot2_ver; struct cmd_ds_get_tsf gettsf; struct cmd_ds_802_11_subscribe_event subscribe_event; + struct cmd_ds_802_11_beacon_control bcn_ctrl; } params; } __attribute__ ((packed)); diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 3854d91c90e..ca67524ee8d 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -510,7 +510,9 @@ int lbs_cmd_80211_ad_hoc_start(lbs_private *priv, /* set the BSS type */ adhs->bsstype = CMD_BSS_TYPE_IBSS; adapter->mode = IW_MODE_ADHOC; - adhs->beaconperiod = cpu_to_le16(MRVDRV_BEACON_INTERVAL); + if (adapter->beacon_period == 0) + adapter->beacon_period = MRVDRV_BEACON_INTERVAL; + adhs->beaconperiod = cpu_to_le16(adapter->beacon_period); /* set Physical param set */ #define DS_PARA_IE_ID 3 -- cgit v1.2.3 From 69f9032d9dfeb763b467fdbe8cf5938f5457083a Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Fri, 23 Nov 2007 15:43:44 +0100 Subject: libertas: remove arbitrary typedefs New typedefs are usually frowned upon. This patch changes libertas_adapter -> struct libertas_adapter libertas_priv -> struct libertas_priv While passing, make everything checkpatch.pl-clean that gets touches. Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/11d.c | 34 +++---- drivers/net/wireless/libertas/11d.h | 14 +-- drivers/net/wireless/libertas/assoc.c | 48 +++++----- drivers/net/wireless/libertas/assoc.h | 4 +- drivers/net/wireless/libertas/cmd.c | 144 ++++++++++++++-------------- drivers/net/wireless/libertas/cmdresp.c | 80 ++++++++-------- drivers/net/wireless/libertas/debugfs.c | 108 ++++++++++----------- drivers/net/wireless/libertas/debugfs.h | 4 +- drivers/net/wireless/libertas/decl.h | 88 +++++++++-------- drivers/net/wireless/libertas/defs.h | 2 - drivers/net/wireless/libertas/dev.h | 14 +-- drivers/net/wireless/libertas/ethtool.c | 8 +- drivers/net/wireless/libertas/if_cs.c | 23 +++-- drivers/net/wireless/libertas/if_sdio.c | 11 ++- drivers/net/wireless/libertas/if_usb.c | 46 +++++---- drivers/net/wireless/libertas/join.c | 68 ++++++------- drivers/net/wireless/libertas/join.h | 30 +++--- drivers/net/wireless/libertas/main.c | 122 ++++++++++++------------ drivers/net/wireless/libertas/rx.c | 42 ++++---- drivers/net/wireless/libertas/scan.c | 79 +++++++-------- drivers/net/wireless/libertas/scan.h | 16 ++-- drivers/net/wireless/libertas/tx.c | 22 ++--- drivers/net/wireless/libertas/wext.c | 164 ++++++++++++++++---------------- 23 files changed, 606 insertions(+), 565 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index d16f566e878..377dcb5b8f0 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -430,7 +430,7 @@ u8 lbs_get_scan_type_11d(u8 chan, } -void lbs_init_11d(lbs_private * priv) +void lbs_init_11d(struct lbs_private *priv) { priv->adapter->enable11d = 0; memset(&(priv->adapter->parsed_region_chan), 0, @@ -440,10 +440,10 @@ void lbs_init_11d(lbs_private * priv) /** * @brief This function sets DOMAIN INFO to FW - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @return 0; -1 */ -static int set_domain_info_11d(lbs_private * priv) +static int set_domain_info_11d(struct lbs_private *priv) { int ret; @@ -463,13 +463,13 @@ static int set_domain_info_11d(lbs_private * priv) /** * @brief This function setups scan channels - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @param band band * @return 0 */ -int lbs_set_universaltable(lbs_private * priv, u8 band) +int lbs_set_universaltable(struct lbs_private *priv, u8 band) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u16 size = sizeof(struct chan_freq_power); u16 i = 0; @@ -492,20 +492,20 @@ int lbs_set_universaltable(lbs_private * priv, u8 band) /** * @brief This function implements command CMD_802_11D_DOMAIN_INFO - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @param cmd pointer to cmd buffer * @param cmdno cmd ID * @param cmdOption cmd action * @return 0 */ -int lbs_cmd_802_11d_domain_info(lbs_private * priv, +int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmdno, u16 cmdoption) { struct cmd_ds_802_11d_domain_info *pdomaininfo = &cmd->params.domaininfo; struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u8 nr_subband = adapter->domainreg.nr_subband; lbs_deb_enter(LBS_DEB_11D); @@ -552,11 +552,11 @@ done: /** * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @param resp pointer to command response buffer * @return 0; -1 */ -int lbs_ret_802_11d_domain_info(lbs_private * priv, +int lbs_ret_802_11d_domain_info(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; @@ -598,14 +598,14 @@ int lbs_ret_802_11d_domain_info(lbs_private * priv, /** * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @return 0; -1 */ -int lbs_parse_dnld_countryinfo_11d(lbs_private * priv, +int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, struct bss_descriptor * bss) { int ret; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_11D); if (priv->adapter->enable11d) { @@ -640,13 +640,13 @@ done: /** * @brief This function generates 11D info from user specified regioncode and download to FW - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @return 0; -1 */ -int lbs_create_dnld_countryinfo_11d(lbs_private * priv) +int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv) { int ret; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct region_channel *region_chan; u8 j; diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h index 4f7f0deb6c8..811eea2cfba 100644 --- a/drivers/net/wireless/libertas/11d.h +++ b/drivers/net/wireless/libertas/11d.h @@ -78,26 +78,28 @@ struct region_code_mapping { u8 code; }; +struct lbs_private; + u8 lbs_get_scan_type_11d(u8 chan, struct parsed_region_chan_11d *parsed_region_chan); u32 lbs_chan_2_freq(u8 chan, u8 band); -void lbs_init_11d(lbs_private * priv); +void lbs_init_11d(struct lbs_private *priv); -int lbs_set_universaltable(lbs_private * priv, u8 band); +int lbs_set_universaltable(struct lbs_private *priv, u8 band); -int lbs_cmd_802_11d_domain_info(lbs_private * priv, +int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmdno, u16 cmdOption); -int lbs_ret_802_11d_domain_info(lbs_private * priv, +int lbs_ret_802_11d_domain_info(struct lbs_private *priv, struct cmd_ds_command *resp); struct bss_descriptor; -int lbs_parse_dnld_countryinfo_11d(lbs_private * priv, +int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, struct bss_descriptor * bss); -int lbs_create_dnld_countryinfo_11d(lbs_private * priv); +int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv); #endif diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index f634c9496ec..b529e54151d 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -15,10 +15,10 @@ static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static int assoc_helper_essid(lbs_private *priv, +static int assoc_helper_essid(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; int channel = -1; @@ -75,10 +75,10 @@ static int assoc_helper_essid(lbs_private *priv, } -static int assoc_helper_bssid(lbs_private *priv, +static int assoc_helper_bssid(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; DECLARE_MAC_BUF(mac); @@ -109,7 +109,7 @@ out: } -static int assoc_helper_associate(lbs_private *priv, +static int assoc_helper_associate(struct lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0, done = 0; @@ -135,10 +135,10 @@ static int assoc_helper_associate(lbs_private *priv, } -static int assoc_helper_mode(lbs_private *priv, +static int assoc_helper_mode(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -165,7 +165,7 @@ done: } -static int update_channel(lbs_private * priv) +static int update_channel(struct lbs_private *priv) { int ret; /* the channel in f/w could be out of sync, get the current channel */ @@ -179,7 +179,8 @@ static int update_channel(lbs_private * priv) void lbs_sync_channel(struct work_struct *work) { - lbs_private *priv = container_of(work, lbs_private, sync_channel); + struct lbs_private *priv = container_of(work, struct lbs_private, + sync_channel); lbs_deb_enter(LBS_DEB_ASSOC); if (update_channel(priv) != 0) @@ -187,10 +188,10 @@ void lbs_sync_channel(struct work_struct *work) lbs_deb_leave(LBS_DEB_ASSOC); } -static int assoc_helper_channel(lbs_private *priv, +static int assoc_helper_channel(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -242,10 +243,10 @@ done: } -static int assoc_helper_wep_keys(lbs_private *priv, +static int assoc_helper_wep_keys(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int i; int ret = 0; @@ -297,10 +298,10 @@ out: return ret; } -static int assoc_helper_secinfo(lbs_private *priv, +static int assoc_helper_secinfo(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; u32 do_wpa; u32 rsn = 0; @@ -349,7 +350,7 @@ out: } -static int assoc_helper_wpa_keys(lbs_private *priv, +static int assoc_helper_wpa_keys(struct lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0; @@ -392,10 +393,10 @@ out: } -static int assoc_helper_wpa_ie(lbs_private *priv, +static int assoc_helper_wpa_ie(struct lbs_private *priv, struct assoc_request * assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -413,7 +414,7 @@ static int assoc_helper_wpa_ie(lbs_private *priv, } -static int should_deauth_infrastructure(lbs_adapter *adapter, +static int should_deauth_infrastructure(struct lbs_adapter *adapter, struct assoc_request * assoc_req) { int ret = 0; @@ -465,7 +466,7 @@ out: } -static int should_stop_adhoc(lbs_adapter *adapter, +static int should_stop_adhoc(struct lbs_adapter *adapter, struct assoc_request * assoc_req) { lbs_deb_enter(LBS_DEB_ASSOC); @@ -496,8 +497,9 @@ static int should_stop_adhoc(lbs_adapter *adapter, void lbs_association_worker(struct work_struct *work) { - lbs_private *priv = container_of(work, lbs_private, assoc_work.work); - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = container_of(work, struct lbs_private, + assoc_work.work); + struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req = NULL; int ret = 0; int find_any_ssid = 0; @@ -684,7 +686,7 @@ done: /* * Caller MUST hold any necessary locks */ -struct assoc_request *lbs_get_association_request(lbs_adapter *adapter) +struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter) { struct assoc_request * assoc_req; diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index 462931cbf3b..fad00ae0d00 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h @@ -6,9 +6,7 @@ #include "dev.h" void lbs_association_worker(struct work_struct *work); - -struct assoc_request * lbs_get_association_request(lbs_adapter *adapter); - +struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter); void lbs_sync_channel(struct work_struct *work); #endif /* _LBS_ASSOC_H */ diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3702c5da1f6..dde17c65bcc 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -37,7 +37,7 @@ static u8 is_command_allowed_in_ps(__le16 command) return 0; } -static int lbs_cmd_hw_spec(lbs_private * priv, struct cmd_ds_command *cmd) +static int lbs_cmd_hw_spec(struct lbs_private *priv, struct cmd_ds_command *cmd) { struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; @@ -51,7 +51,7 @@ static int lbs_cmd_hw_spec(lbs_private * priv, struct cmd_ds_command *cmd) return 0; } -static int lbs_cmd_802_11_ps_mode(lbs_private * priv, +static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { @@ -90,7 +90,7 @@ static int lbs_cmd_802_11_ps_mode(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_inactivity_timeout(lbs_private * priv, +static int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -114,11 +114,11 @@ static int lbs_cmd_802_11_inactivity_timeout(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_sleep_params(lbs_private * priv, +static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; lbs_deb_enter(LBS_DEB_CMD); @@ -145,13 +145,13 @@ static int lbs_cmd_802_11_sleep_params(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_set_wep(lbs_private * priv, +static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, struct cmd_ds_command *cmd, u32 cmd_act, void * pdata_buf) { struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -219,7 +219,7 @@ done: return ret; } -static int lbs_cmd_802_11_enable_rsn(lbs_private * priv, +static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void * pdata_buf) @@ -272,7 +272,7 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, lbs_deb_leave(LBS_DEB_CMD); } -static int lbs_cmd_802_11_key_material(lbs_private * priv, +static int lbs_cmd_802_11_key_material(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, void *pdata_buf) @@ -319,7 +319,7 @@ done: return ret; } -static int lbs_cmd_802_11_reset(lbs_private * priv, +static int lbs_cmd_802_11_reset(struct lbs_private *priv, struct cmd_ds_command *cmd, int cmd_action) { struct cmd_ds_802_11_reset *reset = &cmd->params.reset; @@ -334,7 +334,7 @@ static int lbs_cmd_802_11_reset(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_get_log(lbs_private * priv, +static int lbs_cmd_802_11_get_log(struct lbs_private *priv, struct cmd_ds_command *cmd) { lbs_deb_enter(LBS_DEB_CMD); @@ -346,7 +346,7 @@ static int lbs_cmd_802_11_get_log(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_get_stat(lbs_private * priv, +static int lbs_cmd_802_11_get_stat(struct lbs_private *priv, struct cmd_ds_command *cmd) { lbs_deb_enter(LBS_DEB_CMD); @@ -358,13 +358,13 @@ static int lbs_cmd_802_11_get_stat(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_snmp_mib(lbs_private * priv, +static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, struct cmd_ds_command *cmd, int cmd_action, int cmd_oid, void *pdata_buf) { struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u8 ucTemp; lbs_deb_enter(LBS_DEB_CMD); @@ -479,11 +479,11 @@ static int lbs_cmd_802_11_snmp_mib(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_radio_control(lbs_private * priv, +static int lbs_cmd_802_11_radio_control(struct lbs_private *priv, struct cmd_ds_command *cmd, int cmd_action) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; lbs_deb_enter(LBS_DEB_CMD); @@ -519,7 +519,7 @@ static int lbs_cmd_802_11_radio_control(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_rf_tx_power(lbs_private * priv, +static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -563,7 +563,7 @@ static int lbs_cmd_802_11_rf_tx_power(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_monitor_mode(lbs_private * priv, +static int lbs_cmd_802_11_monitor_mode(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -583,13 +583,13 @@ static int lbs_cmd_802_11_monitor_mode(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_rate_adapt_rateset(lbs_private * priv, +static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_802_11_rate_adapt_rateset *rateadapt = &cmd->params.rateset; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = @@ -605,12 +605,12 @@ static int lbs_cmd_802_11_rate_adapt_rateset(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_data_rate(lbs_private * priv, +static int lbs_cmd_802_11_data_rate(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -632,12 +632,12 @@ static int lbs_cmd_802_11_data_rate(lbs_private * priv, return 0; } -static int lbs_cmd_mac_multicast_adr(lbs_private * priv, +static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + @@ -655,7 +655,7 @@ static int lbs_cmd_mac_multicast_adr(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_rf_channel(lbs_private * priv, +static int lbs_cmd_802_11_rf_channel(struct lbs_private *priv, struct cmd_ds_command *cmd, int option, void *pdata_buf) { @@ -676,10 +676,10 @@ static int lbs_cmd_802_11_rf_channel(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_rssi(lbs_private * priv, +static int lbs_cmd_802_11_rssi(struct lbs_private *priv, struct cmd_ds_command *cmd) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_RSSI); @@ -698,7 +698,7 @@ static int lbs_cmd_802_11_rssi(lbs_private * priv, return 0; } -static int lbs_cmd_reg_access(lbs_private * priv, +static int lbs_cmd_reg_access(struct lbs_private *priv, struct cmd_ds_command *cmdptr, u8 cmd_action, void *pdata_buf) { @@ -773,11 +773,11 @@ static int lbs_cmd_reg_access(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_mac_address(lbs_private * priv, +static int lbs_cmd_802_11_mac_address(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS); @@ -797,7 +797,7 @@ static int lbs_cmd_802_11_mac_address(lbs_private * priv, return 0; } -static int lbs_cmd_802_11_eeprom_access(lbs_private * priv, +static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv, struct cmd_ds_command *cmd, int cmd_action, void *pdata_buf) { @@ -819,7 +819,7 @@ static int lbs_cmd_802_11_eeprom_access(lbs_private * priv, return 0; } -static int lbs_cmd_bt_access(lbs_private * priv, +static int lbs_cmd_bt_access(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -857,7 +857,7 @@ static int lbs_cmd_bt_access(lbs_private * priv, return 0; } -static int lbs_cmd_fwt_access(lbs_private * priv, +static int lbs_cmd_fwt_access(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -879,7 +879,7 @@ static int lbs_cmd_fwt_access(lbs_private * priv, return 0; } -static int lbs_cmd_mesh_access(lbs_private * priv, +static int lbs_cmd_mesh_access(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -923,7 +923,7 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, return 0; } -static int lbs_cmd_set_boot2_ver(lbs_private * priv, +static int lbs_cmd_set_boot2_ver(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) { @@ -938,7 +938,9 @@ static int lbs_cmd_set_boot2_ver(lbs_private * priv, * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for * the command timer, because it does not account for queued commands. */ -void lbs_queue_cmd(lbs_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) +void lbs_queue_cmd(struct lbs_adapter *adapter, + struct cmd_ctrl_node *cmdnode, + u8 addtail) { unsigned long flags; struct cmd_ds_command *cmdptr; @@ -990,12 +992,12 @@ done: * For now - we are not performing the endian conversion the second time - but * for PS and DEEP_SLEEP we need to worry */ -static int DownloadcommandToStation(lbs_private * priv, +static int DownloadcommandToStation(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode) { unsigned long flags; struct cmd_ds_command *cmdptr; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = -1; u16 cmdsize; u16 command; @@ -1060,7 +1062,7 @@ done: return ret; } -static int lbs_cmd_mac_control(lbs_private * priv, +static int lbs_cmd_mac_control(struct lbs_private *priv, struct cmd_ds_command *cmd) { struct cmd_ds_mac_control *mac = &cmd->params.macctrl; @@ -1082,9 +1084,10 @@ static int lbs_cmd_mac_control(lbs_private * priv, * This function inserts command node to cmdfreeq * after cleans it. Requires adapter->driver_lock held. */ -void __lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptempcmd) +void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *ptempcmd) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; if (!ptempcmd) return; @@ -1093,7 +1096,8 @@ void __lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptem list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); } -static void lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node *ptempcmd) +static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *ptempcmd) { unsigned long flags; @@ -1102,7 +1106,7 @@ static void lbs_cleanup_and_insert_cmd(lbs_private * priv, struct cmd_ctrl_node spin_unlock_irqrestore(&priv->adapter->driver_lock, flags); } -int lbs_set_radio_control(lbs_private * priv) +int lbs_set_radio_control(struct lbs_private *priv) { int ret = 0; @@ -1120,7 +1124,7 @@ int lbs_set_radio_control(lbs_private * priv) return ret; } -int lbs_set_mac_packet_filter(lbs_private * priv) +int lbs_set_mac_packet_filter(struct lbs_private *priv) { int ret = 0; @@ -1137,7 +1141,7 @@ int lbs_set_mac_packet_filter(lbs_private * priv) /** * @brief This function prepare the command before send to firmware. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param cmd_no command number * @param cmd_action command action: GET or SET * @param wait_option wait option: wait response or not @@ -1145,13 +1149,13 @@ int lbs_set_mac_packet_filter(lbs_private * priv) * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ -int lbs_prepare_and_send_command(lbs_private * priv, +int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, u16 cmd_action, u16 wait_option, u32 cmd_oid, void *pdata_buf) { int ret = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; struct cmd_ds_command *cmdptr; unsigned long flags; @@ -1470,17 +1474,17 @@ EXPORT_SYMBOL_GPL(lbs_prepare_and_send_command); * @brief This function allocates the command buffer and link * it to command free queue. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return 0 or -1 */ -int lbs_allocate_cmd_buffer(lbs_private * priv) +int lbs_allocate_cmd_buffer(struct lbs_private *priv) { int ret = 0; u32 ulbufsize; u32 i; struct cmd_ctrl_node *tempcmd_array; u8 *ptempvirtualaddr; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -1522,15 +1526,15 @@ done: /** * @brief This function frees the command buffer. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return 0 or -1 */ -int lbs_free_cmd_buffer(lbs_private * priv) +int lbs_free_cmd_buffer(struct lbs_private *priv) { u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ unsigned int i; struct cmd_ctrl_node *tempcmd_array; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -1566,13 +1570,13 @@ done: * @brief This function gets a free command node if available in * command free queue. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL */ -struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(lbs_private * priv) +struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(struct lbs_private *priv) { struct cmd_ctrl_node *tempnode; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; unsigned long flags; lbs_deb_enter(LBS_DEB_HOST); @@ -1627,14 +1631,14 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) /** * @brief This function initializes the command node. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param ptempnode A pointer to cmd_ctrl_node structure * @param cmd_oid cmd oid: treated as sub command * @param wait_option wait option: wait response or not * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ -void lbs_set_cmd_ctrl_node(lbs_private * priv, +void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, u32 cmd_oid, u16 wait_option, void *pdata_buf) { @@ -1655,12 +1659,12 @@ void lbs_set_cmd_ctrl_node(lbs_private * priv, * pending queue. It will put fimware back to PS mode * if applicable. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return 0 or -1 */ -int lbs_execute_next_command(lbs_private * priv) +int lbs_execute_next_command(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode = NULL; struct cmd_ds_command *cmdptr; unsigned long flags; @@ -1807,7 +1811,7 @@ done: return ret; } -void lbs_send_iwevcustom_event(lbs_private *priv, s8 *str) +void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str) { union iwreq_data iwrq; u8 buf[50]; @@ -1831,10 +1835,10 @@ void lbs_send_iwevcustom_event(lbs_private *priv, s8 *str) lbs_deb_leave(LBS_DEB_WEXT); } -static int sendconfirmsleep(lbs_private *priv, u8 *cmdptr, u16 size) +static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) { unsigned long flags; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_HOST); @@ -1873,7 +1877,7 @@ static int sendconfirmsleep(lbs_private *priv, u8 *cmdptr, u16 size) return ret; } -void lbs_ps_sleep(lbs_private * priv, int wait_option) +void lbs_ps_sleep(struct lbs_private *priv, int wait_option) { lbs_deb_enter(LBS_DEB_HOST); @@ -1891,11 +1895,11 @@ void lbs_ps_sleep(lbs_private * priv, int wait_option) /** * @brief This function sends Exit_PS command to firmware. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param wait_option wait response or not * @return n/a */ -void lbs_ps_wakeup(lbs_private * priv, int wait_option) +void lbs_ps_wakeup(struct lbs_private *priv, int wait_option) { __le32 Localpsmode; @@ -1914,14 +1918,14 @@ void lbs_ps_wakeup(lbs_private * priv, int wait_option) * @brief This function checks condition and prepares to * send sleep confirm command to firmware if ok. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param psmode Power Saving mode * @return n/a */ -void lbs_ps_confirm_sleep(lbs_private * priv, u16 psmode) +void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) { unsigned long flags =0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u8 allowed = 1; lbs_deb_enter(LBS_DEB_HOST); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 1f74810a5e1..3596957f1d5 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -20,12 +20,12 @@ * reports disconnect to upper layer, clean tx/rx packets, * reset link state etc. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return n/a */ -void lbs_mac_event_disconnected(lbs_private * priv) +void lbs_mac_event_disconnected(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; union iwreq_data wrqu; if (adapter->connect_status != LBS_CONNECTED) @@ -85,11 +85,11 @@ void lbs_mac_event_disconnected(lbs_private * priv) /** * @brief This function handles MIC failure event. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @para event the event id * @return n/a */ -static void handle_mic_failureevent(lbs_private * priv, u32 event) +static void handle_mic_failureevent(struct lbs_private *priv, u32 event) { char buf[50]; @@ -108,11 +108,11 @@ static void handle_mic_failureevent(lbs_private * priv, u32 event) lbs_deb_leave(LBS_DEB_CMD); } -static int lbs_ret_reg_access(lbs_private * priv, +static int lbs_ret_reg_access(struct lbs_private *priv, u16 type, struct cmd_ds_command *resp) { int ret = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -152,12 +152,12 @@ static int lbs_ret_reg_access(lbs_private * priv, return ret; } -static int lbs_ret_get_hw_spec(lbs_private * priv, +static int lbs_ret_get_hw_spec(struct lbs_private *priv, struct cmd_ds_command *resp) { u32 i; struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; DECLARE_MAC_BUF(mac); @@ -216,11 +216,11 @@ done: return ret; } -static int lbs_ret_802_11_sleep_params(lbs_private * priv, +static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -240,14 +240,14 @@ static int lbs_ret_802_11_sleep_params(lbs_private * priv, return 0; } -static int lbs_ret_802_11_stat(lbs_private * priv, +static int lbs_ret_802_11_stat(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_CMD); /* currently adapter->wlan802_11Stat is unused struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; // TODO Convert it to Big endian befor copy memcpy(&adapter->wlan802_11Stat, @@ -257,7 +257,7 @@ static int lbs_ret_802_11_stat(lbs_private * priv, return 0; } -static int lbs_ret_802_11_snmp_mib(lbs_private * priv, +static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; @@ -299,12 +299,12 @@ static int lbs_ret_802_11_snmp_mib(lbs_private * priv, return 0; } -static int lbs_ret_802_11_key_material(lbs_private * priv, +static int lbs_ret_802_11_key_material(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_key_material *pkeymaterial = &resp->params.keymaterial; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(pkeymaterial->action); lbs_deb_enter(LBS_DEB_CMD); @@ -355,11 +355,11 @@ static int lbs_ret_802_11_key_material(lbs_private * priv, return 0; } -static int lbs_ret_802_11_mac_address(lbs_private * priv, +static int lbs_ret_802_11_mac_address(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -369,11 +369,11 @@ static int lbs_ret_802_11_mac_address(lbs_private * priv, return 0; } -static int lbs_ret_802_11_rf_tx_power(lbs_private * priv, +static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -385,11 +385,11 @@ static int lbs_ret_802_11_rf_tx_power(lbs_private * priv, return 0; } -static int lbs_ret_802_11_rate_adapt_rateset(lbs_private * priv, +static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -402,11 +402,11 @@ static int lbs_ret_802_11_rate_adapt_rateset(lbs_private * priv, return 0; } -static int lbs_ret_802_11_data_rate(lbs_private * priv, +static int lbs_ret_802_11_data_rate(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -423,11 +423,11 @@ static int lbs_ret_802_11_data_rate(lbs_private * priv, return 0; } -static int lbs_ret_802_11_rf_channel(lbs_private * priv, +static int lbs_ret_802_11_rf_channel(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(rfchannel->action); u16 newchannel = le16_to_cpu(rfchannel->currentchannel); @@ -446,11 +446,11 @@ static int lbs_ret_802_11_rf_channel(lbs_private * priv, return 0; } -static int lbs_ret_802_11_rssi(lbs_private * priv, +static int lbs_ret_802_11_rssi(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -477,10 +477,10 @@ static int lbs_ret_802_11_rssi(lbs_private * priv, return 0; } -static int lbs_ret_802_11_eeprom_access(lbs_private * priv, +static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv, struct cmd_ds_command *resp) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_regrdwr *pbuf; pbuf = (struct lbs_ioctl_regrdwr *) adapter->prdeeprom; @@ -503,11 +503,11 @@ static int lbs_ret_802_11_eeprom_access(lbs_private * priv, return 0; } -static int lbs_ret_get_log(lbs_private * priv, +static int lbs_ret_get_log(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -518,11 +518,11 @@ static int lbs_ret_get_log(lbs_private * priv, return 0; } -static int lbs_ret_802_11_enable_rsn(lbs_private * priv, +static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u32 * pdata_buf = adapter->cur_cmd->pdata_buf; lbs_deb_enter(LBS_DEB_CMD); @@ -556,11 +556,11 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, static inline int handle_cmd_response(u16 respcmd, struct cmd_ds_command *resp, - lbs_private *priv) + struct lbs_private *priv) { int ret = 0; unsigned long flags; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -735,11 +735,11 @@ static inline int handle_cmd_response(u16 respcmd, return ret; } -int lbs_process_rx_command(lbs_private * priv) +int lbs_process_rx_command(struct lbs_private *priv) { u16 respcmd; struct cmd_ds_command *resp; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; ulong flags; u16 result; @@ -888,10 +888,10 @@ done: return ret; } -int lbs_process_event(lbs_private * priv) +int lbs_process_event(struct lbs_private *priv) { int ret = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; u32 eventcause; lbs_deb_enter(LBS_DEB_CMD); diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 1b382cfaf37..2e1842474f8 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -18,7 +18,7 @@ static char *szStates[] = { }; #ifdef PROC_DEBUG -static void lbs_debug_init(lbs_private * priv, struct net_device *dev); +static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev); #endif static int open_file_generic(struct inode *inode, struct file *file) @@ -38,7 +38,7 @@ static const size_t len = PAGE_SIZE; static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -59,7 +59,7 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; size_t pos = 0; int numscansdone = 0, res; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -102,7 +102,7 @@ static ssize_t lbs_sleepparams_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t buf_size, res; int p1, p2, p3, p4, p5, p6; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -143,8 +143,8 @@ out_unlock: static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -174,7 +174,7 @@ out_unlock: static ssize_t lbs_extscan(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; union iwreq_data wrqu; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -342,7 +342,7 @@ static ssize_t lbs_setuserscan(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; struct lbs_ioctl_user_scan_cfg *scan_cfg; union iwreq_data wrqu; @@ -384,7 +384,7 @@ out_unlock: return count; } -static int lbs_event_initcmd(lbs_private *priv, void **response_buf, +static int lbs_event_initcmd(struct lbs_private *priv, void **response_buf, struct cmd_ctrl_node **cmdnode, struct cmd_ds_command **cmd) { @@ -413,8 +413,8 @@ static int lbs_event_initcmd(lbs_private *priv, void **response_buf, static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -480,9 +480,9 @@ static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, return res; } -static u16 lbs_get_events_bitmap(lbs_private *priv) +static u16 lbs_get_events_bitmap(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -529,8 +529,8 @@ static ssize_t lbs_lowrssi_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -609,8 +609,8 @@ out_unlock: static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -682,8 +682,8 @@ static ssize_t lbs_lowsnr_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -762,8 +762,8 @@ out_unlock: static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -834,8 +834,8 @@ static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -913,8 +913,8 @@ out_unlock: static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -985,8 +985,8 @@ static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1063,8 +1063,8 @@ out_unlock: static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -1136,8 +1136,8 @@ static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1213,8 +1213,8 @@ out_unlock: static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *pcmdnode; struct cmd_ds_command *pcmdptr; struct cmd_ds_802_11_subscribe_event *event; @@ -1286,8 +1286,8 @@ static ssize_t lbs_highsnr_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; int value, freq, subscribed, cmd_len; struct cmd_ctrl_node *pcmdnode; @@ -1365,8 +1365,8 @@ out_unlock: static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -1392,7 +1392,7 @@ static ssize_t lbs_rdmac_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1414,7 +1414,7 @@ static ssize_t lbs_wrmac_write(struct file *file, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; struct lbs_offset_value offval; @@ -1448,8 +1448,8 @@ out_unlock: static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -1476,7 +1476,7 @@ static ssize_t lbs_rdbbp_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1498,7 +1498,7 @@ static ssize_t lbs_wrbbp_write(struct file *file, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; struct lbs_offset_value offval; @@ -1532,8 +1532,8 @@ out_unlock: static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = file->private_data; + struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -1560,7 +1560,7 @@ static ssize_t lbs_rdrf_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -1582,7 +1582,7 @@ static ssize_t lbs_wrrf_write(struct file *file, size_t count, loff_t *ppos) { - lbs_private *priv = file->private_data; + struct lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; struct lbs_offset_value offval; @@ -1675,7 +1675,7 @@ void lbs_debugfs_remove(void) return; } -void lbs_debugfs_init_one(lbs_private *priv, struct net_device *dev) +void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev) { int i; struct lbs_debugfs_files *files; @@ -1728,7 +1728,7 @@ exit: return; } -void lbs_debugfs_remove_one(lbs_private *priv) +void lbs_debugfs_remove_one(struct lbs_private *priv) { int i; @@ -1755,8 +1755,8 @@ void lbs_debugfs_remove_one(lbs_private *priv) #ifdef PROC_DEBUG -#define item_size(n) (FIELD_SIZEOF(lbs_adapter, n)) -#define item_addr(n) (offsetof(lbs_adapter, n)) +#define item_size(n) (FIELD_SIZEOF(struct lbs_adapter, n)) +#define item_addr(n) (offsetof(struct lbs_adapter, n)) struct debug_data { @@ -1765,7 +1765,7 @@ struct debug_data { size_t addr; }; -/* To debug any member of lbs_adapter, simply add one line here. +/* To debug any member of struct lbs_adapter, simply add one line here. */ static struct debug_data items[] = { {"intcounter", item_size(intcounter), item_addr(intcounter)}, @@ -1892,11 +1892,11 @@ static struct file_operations lbs_debug_fops = { /** * @brief create debug proc file * - * @param priv pointer lbs_private + * @param priv pointer struct lbs_private * @param dev pointer net_device * @return N/A */ -static void lbs_debug_init(lbs_private * priv, struct net_device *dev) +static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev) { int i; diff --git a/drivers/net/wireless/libertas/debugfs.h b/drivers/net/wireless/libertas/debugfs.h index c9758458198..f2b9c7ffe0f 100644 --- a/drivers/net/wireless/libertas/debugfs.h +++ b/drivers/net/wireless/libertas/debugfs.h @@ -4,7 +4,7 @@ void lbs_debugfs_init(void); void lbs_debugfs_remove(void); -void lbs_debugfs_init_one(lbs_private *priv, struct net_device *dev); -void lbs_debugfs_remove_one(lbs_private *priv); +void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev); +void lbs_debugfs_remove_one(struct lbs_private *priv); #endif diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 7dd76f8e8d2..74187f34666 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -12,71 +12,79 @@ /** Function Prototype Declaration */ struct lbs_private; +struct lbs_adapter; struct sk_buff; struct net_device; -int lbs_set_mac_packet_filter(lbs_private * priv); +int lbs_set_mac_packet_filter(struct lbs_private *priv); -void lbs_send_tx_feedback(lbs_private * priv); +void lbs_send_tx_feedback(struct lbs_private *priv); -int lbs_free_cmd_buffer(lbs_private * priv); +int lbs_free_cmd_buffer(struct lbs_private *priv); struct cmd_ctrl_node; -struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(lbs_private * priv); +struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(struct lbs_private *priv); -void lbs_set_cmd_ctrl_node(lbs_private * priv, - struct cmd_ctrl_node *ptempnode, - u32 cmd_oid, u16 wait_option, void *pdata_buf); +void lbs_set_cmd_ctrl_node(struct lbs_private *priv, + struct cmd_ctrl_node *ptempnode, + u32 cmd_oid, u16 wait_option, void *pdata_buf); -int lbs_prepare_and_send_command(lbs_private * priv, - u16 cmd_no, - u16 cmd_action, - u16 wait_option, u32 cmd_oid, void *pdata_buf); +int lbs_prepare_and_send_command(struct lbs_private *priv, + u16 cmd_no, + u16 cmd_action, + u16 wait_option, u32 cmd_oid, void *pdata_buf); -void lbs_queue_cmd(lbs_adapter *adapter, struct cmd_ctrl_node *cmdnode, u8 addtail); +void lbs_queue_cmd(struct lbs_adapter *adapter, + struct cmd_ctrl_node *cmdnode, + u8 addtail); -int lbs_allocate_cmd_buffer(lbs_private * priv); -int lbs_execute_next_command(lbs_private * priv); -int lbs_process_event(lbs_private * priv); +int lbs_allocate_cmd_buffer(struct lbs_private *priv); +int lbs_execute_next_command(struct lbs_private *priv); +int lbs_process_event(struct lbs_private *priv); void lbs_interrupt(struct net_device *); -int lbs_set_radio_control(lbs_private * priv); +int lbs_set_radio_control(struct lbs_private *priv); u32 lbs_fw_index_to_data_rate(u8 index); u8 lbs_data_rate_to_fw_index(u32 rate); -void lbs_get_fwversion(lbs_adapter *adapter, char *fwversion, int maxlen); +void lbs_get_fwversion(struct lbs_adapter *adapter, + char *fwversion, + int maxlen); -void lbs_upload_rx_packet(lbs_private * priv, struct sk_buff *skb); +void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb); /** The proc fs interface */ -int lbs_process_rx_command(lbs_private * priv); -int lbs_process_tx(lbs_private * priv, struct sk_buff *skb); -void __lbs_cleanup_and_insert_cmd(lbs_private * priv, - struct cmd_ctrl_node *ptempcmd); +int lbs_process_rx_command(struct lbs_private *priv); +int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb); +void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *ptempcmd); -int lbs_set_regiontable(lbs_private * priv, u8 region, u8 band); +int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); -int lbs_process_rxed_packet(lbs_private * priv, struct sk_buff *); +int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); -void lbs_ps_sleep(lbs_private * priv, int wait_option); -void lbs_ps_confirm_sleep(lbs_private * priv, u16 psmode); -void lbs_ps_wakeup(lbs_private * priv, int wait_option); +void lbs_ps_sleep(struct lbs_private *priv, int wait_option); +void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode); +void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); -void lbs_tx_runqueue(lbs_private *priv); +void lbs_tx_runqueue(struct lbs_private *priv); struct chan_freq_power *lbs_find_cfp_by_band_and_channel( - lbs_adapter *adapter, u8 band, u16 channel); + struct lbs_adapter *adapter, + u8 band, + u16 channel); -void lbs_mac_event_disconnected(lbs_private * priv); +void lbs_mac_event_disconnected(struct lbs_private *priv); -void lbs_send_iwevcustom_event(lbs_private *priv, s8 *str); +void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str); /* main.c */ -struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, - int *cfp_no); -lbs_private *lbs_add_card(void *card, struct device *dmdev); -int lbs_remove_card(lbs_private *priv); -int lbs_start_card(lbs_private *priv); -int lbs_stop_card(lbs_private *priv); -int lbs_add_mesh(lbs_private *priv, struct device *dev); -void lbs_remove_mesh(lbs_private *priv); -int lbs_reset_device(lbs_private *priv); +struct chan_freq_power *lbs_get_region_cfp_table(u8 region, + u8 band, + int *cfp_no); +struct lbs_private *lbs_add_card(void *card, struct device *dmdev); +int lbs_remove_card(struct lbs_private *priv); +int lbs_start_card(struct lbs_private *priv); +int lbs_stop_card(struct lbs_private *priv); +int lbs_add_mesh(struct lbs_private *priv, struct device *dev); +void lbs_remove_mesh(struct lbs_private *priv); +int lbs_reset_device(struct lbs_private *priv); #endif diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 81ab99c3f49..82423842a70 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h @@ -262,8 +262,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in #define UNSET_MESH_FRAME(x) (x->cb[6]=0) /** Global Variable Declaration */ -typedef struct _lbs_private lbs_private; -typedef struct _lbs_adapter lbs_adapter; extern const char lbs_driver_version[]; extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 53776bca86f..1efea63c669 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -1,7 +1,7 @@ /** * This file contains definitions and data structures specific * to Marvell 802.11 NIC. It contains the Device Information - * structure lbs_adapter. + * structure struct lbs_adapter. */ #ifndef _LBS_DEV_H_ #define _LBS_DEV_H_ @@ -99,7 +99,7 @@ struct lbs_mesh_stats { }; /** Private structure for the MV device */ -struct _lbs_private { +struct lbs_private { int open; int mesh_open; int infra_open; @@ -109,7 +109,7 @@ struct _lbs_private { char name[DEV_NAME_LEN]; void *card; - lbs_adapter *adapter; + struct lbs_adapter *adapter; struct net_device *dev; struct net_device_stats stats; @@ -155,9 +155,9 @@ struct _lbs_private { struct work_struct sync_channel; /** Hardware access */ - int (*hw_host_to_card) (lbs_private *priv, u8 type, u8 *payload, u16 nb); - int (*hw_get_int_status) (lbs_private *priv, u8 *); - int (*hw_read_event_cause) (lbs_private *); + int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); + int (*hw_get_int_status) (struct lbs_private *priv, u8 *); + int (*hw_read_event_cause) (struct lbs_private *); }; /** Association request @@ -205,7 +205,7 @@ struct assoc_request { }; /** Wlan adapter data structure*/ -struct _lbs_adapter { +struct lbs_adapter { /** STATUS variables */ u8 fwreleasenumber[4]; u32 fwcapinfo; diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index 8121399f4b9..f32fb00129e 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c @@ -22,7 +22,7 @@ static const char * mesh_stat_strings[]= { static void lbs_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - lbs_private *priv = (lbs_private *) dev->priv; + struct lbs_private *priv = (struct lbs_private *) dev->priv; char fwver[32]; lbs_get_fwversion(priv->adapter, fwver, sizeof(fwver) - 1); @@ -45,8 +45,8 @@ static int lbs_ethtool_get_eeprom_len(struct net_device *dev) static int lbs_ethtool_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 * bytes) { - lbs_private *priv = (lbs_private *) dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_regrdwr regctrl; char *ptr; int ret; @@ -108,7 +108,7 @@ done: static void lbs_ethtool_get_stats(struct net_device * dev, struct ethtool_stats * stats, u64 * data) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; struct cmd_ds_mesh_access mesh_access; int ret; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index b0b95cf2e7c..5fadcc03eea 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -57,7 +57,7 @@ MODULE_LICENSE("GPL"); struct if_cs_card { struct pcmcia_device *p_dev; - lbs_private *priv; + struct lbs_private *priv; void __iomem *iobase; }; @@ -286,7 +286,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) /* * Called from if_cs_host_to_card to send a command to the hardware */ -static int if_cs_send_cmd(lbs_private *priv, u8 *buf, u16 nb) +static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb) { struct if_cs_card *card = (struct if_cs_card *)priv->card; int ret = -1; @@ -331,7 +331,7 @@ done: /* * Called from if_cs_host_to_card to send a data to the hardware */ -static void if_cs_send_data(lbs_private *priv, u8 *buf, u16 nb) +static void if_cs_send_data(struct lbs_private *priv, u8 *buf, u16 nb) { struct if_cs_card *card = (struct if_cs_card *)priv->card; @@ -354,7 +354,7 @@ static void if_cs_send_data(lbs_private *priv, u8 *buf, u16 nb) /* * Get the command result out of the card. */ -static int if_cs_receive_cmdres(lbs_private *priv, u8 *data, u32 *len) +static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) { int ret = -1; u16 val; @@ -386,7 +386,7 @@ out: } -static struct sk_buff *if_cs_receive_data(lbs_private *priv) +static struct sk_buff *if_cs_receive_data(struct lbs_private *priv) { struct sk_buff *skb = NULL; u16 len; @@ -616,7 +616,10 @@ done: /********************************************************************/ /* Send commands or data packets to the card */ -static int if_cs_host_to_card(lbs_private *priv, u8 type, u8 *buf, u16 nb) +static int if_cs_host_to_card(struct lbs_private *priv, + u8 type, + u8 *buf, + u16 nb) { int ret = -1; @@ -641,10 +644,10 @@ static int if_cs_host_to_card(lbs_private *priv, u8 type, u8 *buf, u16 nb) } -static int if_cs_get_int_status(lbs_private *priv, u8 *ireg) +static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg) { struct if_cs_card *card = (struct if_cs_card *)priv->card; - /* lbs_adapter *adapter = priv->adapter; */ + /* struct lbs_adapter *adapter = priv->adapter; */ int ret = 0; u16 int_cause; u8 *cmdbuf; @@ -698,7 +701,7 @@ out: } -static int if_cs_read_event_cause(lbs_private *priv) +static int if_cs_read_event_cause(struct lbs_private *priv) { lbs_deb_enter(LBS_DEB_CS); @@ -746,7 +749,7 @@ static void if_cs_release(struct pcmcia_device *p_dev) static int if_cs_probe(struct pcmcia_device *p_dev) { int ret = -ENOMEM; - lbs_private *priv; + struct lbs_private *priv; struct if_cs_card *card; /* CIS parsing */ tuple_t tuple; diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index de4ad57fae4..7a7037bdd37 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -82,7 +82,7 @@ struct if_sdio_packet { struct if_sdio_card { struct sdio_func *func; - lbs_private *priv; + struct lbs_private *priv; int model; unsigned long ioport; @@ -694,7 +694,8 @@ out: /* Libertas callbacks */ /*******************************************************************/ -static int if_sdio_host_to_card(lbs_private *priv, u8 type, u8 *buf, u16 nb) +static int if_sdio_host_to_card(struct lbs_private *priv, + u8 type, u8 *buf, u16 nb) { int ret; struct if_sdio_card *card; @@ -775,7 +776,7 @@ out: return ret; } -static int if_sdio_get_int_status(lbs_private *priv, u8 *ireg) +static int if_sdio_get_int_status(struct lbs_private *priv, u8 *ireg) { struct if_sdio_card *card; @@ -791,7 +792,7 @@ static int if_sdio_get_int_status(lbs_private *priv, u8 *ireg) return 0; } -static int if_sdio_read_event_cause(lbs_private *priv) +static int if_sdio_read_event_cause(struct lbs_private *priv) { struct if_sdio_card *card; @@ -857,7 +858,7 @@ static int if_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct if_sdio_card *card; - lbs_private *priv; + struct lbs_private *priv; int ret, i; unsigned int model; struct if_sdio_packet *packet; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 26176d54c57..4fce0baa071 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -32,9 +32,12 @@ MODULE_DEVICE_TABLE(usb, if_usb_table); static void if_usb_receive(struct urb *urb); static void if_usb_receive_fwload(struct urb *urb); static int if_usb_prog_firmware(struct usb_card_rec *cardp); -static int if_usb_host_to_card(lbs_private *priv, u8 type, u8 *payload, u16 nb); -static int if_usb_get_int_status(lbs_private *priv, u8 *); -static int if_usb_read_event_cause(lbs_private *); +static int if_usb_host_to_card(struct lbs_private *priv, + u8 type, + u8 *payload, + u16 nb); +static int if_usb_get_int_status(struct lbs_private *priv, u8 *); +static int if_usb_read_event_cause(struct lbs_private *); static int usb_tx_block(struct usb_card_rec *cardp, u8 *payload, u16 nb); static void if_usb_free(struct usb_card_rec *cardp); static int if_usb_submit_rx_urb(struct usb_card_rec *cardp); @@ -52,7 +55,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) /* handle the transmission complete validations */ if (urb->status == 0) { - lbs_private *priv = cardp->priv; + struct lbs_private *priv = cardp->priv; /* lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n"); @@ -64,7 +67,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) * valid at firmware load time. */ if (priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct net_device *dev = priv->dev; priv->dnld_sent = DNLD_RES_RECEIVED; @@ -124,7 +127,7 @@ static int if_usb_probe(struct usb_interface *intf, struct usb_device *udev; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; - lbs_private *priv; + struct lbs_private *priv; struct usb_card_rec *cardp; int i; @@ -259,7 +262,7 @@ error: static void if_usb_disconnect(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - lbs_private *priv = (lbs_private *) cardp->priv; + struct lbs_private *priv = (struct lbs_private *) cardp->priv; lbs_deb_enter(LBS_DEB_MAIN); @@ -267,7 +270,7 @@ static void if_usb_disconnect(struct usb_interface *intf) cardp->surprise_removed = 1; if (priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; adapter->surpriseremoved = 1; lbs_stop_card(priv); @@ -290,7 +293,7 @@ static void if_usb_disconnect(struct usb_interface *intf) /** * @brief This function download FW - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @return 0 */ static int if_prog_firmware(struct usb_card_rec *cardp) @@ -373,7 +376,7 @@ static int if_prog_firmware(struct usb_card_rec *cardp) static int if_usb_reset_device(struct usb_card_rec *cardp) { int ret; - lbs_private * priv = cardp->priv; + struct lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -394,7 +397,7 @@ static int if_usb_reset_device(struct usb_card_rec *cardp) /** * @brief This function transfer the data to the device. - * @param priv pointer to lbs_private + * @param priv pointer to struct lbs_private * @param payload pointer to payload data * @param nb data length * @return 0 or -1 @@ -571,7 +574,7 @@ exit: static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, struct usb_card_rec *cardp, - lbs_private *priv) + struct lbs_private *priv) { if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { @@ -591,7 +594,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, static inline void process_cmdrequest(int recvlength, u8 *recvbuff, struct sk_buff *skb, struct usb_card_rec *cardp, - lbs_private *priv) + struct lbs_private *priv) { u8 *cmdbuf; if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { @@ -640,7 +643,7 @@ static void if_usb_receive(struct urb *urb) struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; struct sk_buff *skb = rinfo->skb; struct usb_card_rec *cardp = (struct usb_card_rec *) rinfo->cardp; - lbs_private * priv = cardp->priv; + struct lbs_private *priv = cardp->priv; int recvlength = urb->actual_length; u8 *recvbuff = NULL; @@ -708,13 +711,16 @@ rx_exit: /** * @brief This function downloads data to FW - * @param priv pointer to lbs_private structure + * @param priv pointer to struct lbs_private structure * @param type type of data * @param buf pointer to data buffer * @param len number of bytes * @return 0 or -1 */ -static int if_usb_host_to_card(lbs_private *priv, u8 type, u8 *payload, u16 nb) +static int if_usb_host_to_card(struct lbs_private *priv, + u8 type, + u8 *payload, + u16 nb) { struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; @@ -741,7 +747,7 @@ static int if_usb_host_to_card(lbs_private *priv, u8 type, u8 *payload, u16 nb) } /* called with adapter->driver_lock held */ -static int if_usb_get_int_status(lbs_private *priv, u8 *ireg) +static int if_usb_get_int_status(struct lbs_private *priv, u8 *ireg) { struct usb_card_rec *cardp = priv->card; @@ -753,7 +759,7 @@ static int if_usb_get_int_status(lbs_private *priv, u8 *ireg) return 0; } -static int if_usb_read_event_cause(lbs_private * priv) +static int if_usb_read_event_cause(struct lbs_private *priv) { struct usb_card_rec *cardp = priv->card; @@ -928,7 +934,7 @@ done: static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - lbs_private *priv = cardp->priv; + struct lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -964,7 +970,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) static int if_usb_resume(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); - lbs_private *priv = cardp->priv; + struct lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index ca67524ee8d..d80b6e05e27 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -30,13 +30,15 @@ * NOTE: Setting the MSB of the basic rates need to be taken * care, either before or after calling this function * - * @param adapter A pointer to lbs_adapter structure + * @param adapter A pointer to struct lbs_adapter structure * @param rate1 the buffer which keeps input and output * @param rate1_size the size of rate1 buffer; new size of buffer on return * * @return 0 or -1 */ -static int get_common_rates(lbs_adapter *adapter, u8 *rates, u16 *rates_size) +static int get_common_rates(struct lbs_adapter *adapter, + u8 *rates, + u16 *rates_size) { u8 *card_rates = lbs_bg_rates; size_t num_card_rates = sizeof(lbs_bg_rates); @@ -116,14 +118,14 @@ void lbs_unset_basic_rate_flags(u8 *rates, size_t len) /** * @brief Associate to a specific BSS discovered in a scan * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param pbssdesc Pointer to the BSS descriptor to associate with. * * @return 0-success, otherwise fail */ -int lbs_associate(lbs_private *priv, struct assoc_request *assoc_req) +int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret; lbs_deb_enter(LBS_DEB_JOIN); @@ -155,13 +157,14 @@ done: /** * @brief Start an Adhoc Network * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param adhocssid The ssid of the Adhoc Network * @return 0--success, -1--fail */ -int lbs_start_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req) +int lbs_start_adhoc_network(struct lbs_private *priv, + struct assoc_request *assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; adapter->adhoccreate = 1; @@ -188,15 +191,16 @@ int lbs_start_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req) /** * @brief Join an adhoc network found in a previous scan * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param pbssdesc Pointer to a BSS descriptor found in a previous scan * to attempt to join * * @return 0--success, -1--fail */ -int lbs_join_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req) +int lbs_join_adhoc_network(struct lbs_private *priv, + struct assoc_request *assoc_req) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct bss_descriptor * bss = &assoc_req->bss; int ret = 0; @@ -258,7 +262,7 @@ out: return ret; } -int lbs_stop_adhoc_network(lbs_private * priv) +int lbs_stop_adhoc_network(struct lbs_private *priv) { return lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_STOP, 0, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -267,10 +271,10 @@ int lbs_stop_adhoc_network(lbs_private * priv) /** * @brief Send Deauthentication Request * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return 0--success, -1--fail */ -int lbs_send_deauthentication(lbs_private *priv) +int lbs_send_deauthentication(struct lbs_private *priv) { return lbs_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -279,17 +283,17 @@ int lbs_send_deauthentication(lbs_private *priv) /** * @brief This function prepares command of authenticate. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param cmd A pointer to cmd_ds_command structure * @param pdata_buf Void cast of pointer to a BSSID to authenticate with * * @return 0 or -1 */ -int lbs_cmd_80211_authenticate(lbs_private *priv, +int lbs_cmd_80211_authenticate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; int ret = -1; u8 *bssid = pdata_buf; @@ -329,10 +333,10 @@ out: return ret; } -int lbs_cmd_80211_deauthenticate(lbs_private *priv, +int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, struct cmd_ds_command *cmd) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; lbs_deb_enter(LBS_DEB_JOIN); @@ -352,10 +356,10 @@ int lbs_cmd_80211_deauthenticate(lbs_private *priv, return 0; } -int lbs_cmd_80211_associate(lbs_private *priv, +int lbs_cmd_80211_associate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_associate *passo = &cmd->params.associate; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -468,10 +472,10 @@ done: return ret; } -int lbs_cmd_80211_ad_hoc_start(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; int ret = 0; int cmdappendsize = 0; @@ -582,7 +586,7 @@ done: return ret; } -int lbs_cmd_80211_ad_hoc_stop(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *cmd) { cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP); @@ -591,10 +595,10 @@ int lbs_cmd_80211_ad_hoc_stop(lbs_private *priv, return 0; } -int lbs_cmd_80211_ad_hoc_join(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj; struct assoc_request * assoc_req = pdata_buf; struct bss_descriptor *bss = &assoc_req->bss; @@ -694,10 +698,10 @@ done: return ret; } -int lbs_ret_80211_associate(lbs_private *priv, +int lbs_ret_80211_associate(struct lbs_private *priv, struct cmd_ds_command *resp) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; union iwreq_data wrqu; struct ieeetypes_assocrsp *passocrsp; @@ -807,7 +811,7 @@ done: return ret; } -int lbs_ret_80211_disassociate(lbs_private *priv, +int lbs_ret_80211_disassociate(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); @@ -818,10 +822,10 @@ int lbs_ret_80211_disassociate(lbs_private *priv, return 0; } -int lbs_ret_80211_ad_hoc_start(lbs_private *priv, +int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *resp) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; u16 command = le16_to_cpu(resp->command); u16 result = le16_to_cpu(resp->result); @@ -897,7 +901,7 @@ done: return ret; } -int lbs_ret_80211_ad_hoc_stop(lbs_private *priv, +int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h index 5c2b2df5e57..c617d071f78 100644 --- a/drivers/net/wireless/libertas/join.h +++ b/drivers/net/wireless/libertas/join.h @@ -12,41 +12,41 @@ #include "dev.h" struct cmd_ds_command; -int lbs_cmd_80211_authenticate(lbs_private *priv, +int lbs_cmd_80211_authenticate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int lbs_cmd_80211_ad_hoc_join(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int lbs_cmd_80211_ad_hoc_stop(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *cmd); -int lbs_cmd_80211_ad_hoc_start(lbs_private *priv, +int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int lbs_cmd_80211_deauthenticate(lbs_private *priv, +int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, struct cmd_ds_command *cmd); -int lbs_cmd_80211_associate(lbs_private *priv, +int lbs_cmd_80211_associate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int lbs_ret_80211_ad_hoc_start(lbs_private *priv, +int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *resp); -int lbs_ret_80211_ad_hoc_stop(lbs_private *priv, +int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *resp); -int lbs_ret_80211_disassociate(lbs_private *priv, +int lbs_ret_80211_disassociate(struct lbs_private *priv, struct cmd_ds_command *resp); -int lbs_ret_80211_associate(lbs_private *priv, +int lbs_ret_80211_associate(struct lbs_private *priv, struct cmd_ds_command *resp); -int lbs_start_adhoc_network(lbs_private *priv, +int lbs_start_adhoc_network(struct lbs_private *priv, struct assoc_request * assoc_req); -int lbs_join_adhoc_network(lbs_private *priv, +int lbs_join_adhoc_network(struct lbs_private *priv, struct assoc_request * assoc_req); -int lbs_stop_adhoc_network(lbs_private *priv); +int lbs_stop_adhoc_network(struct lbs_private *priv); -int lbs_send_deauthentication(lbs_private *priv); +int lbs_send_deauthentication(struct lbs_private *priv); -int lbs_associate(lbs_private *priv, struct assoc_request *assoc_req); +int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req); void lbs_unset_basic_rate_flags(u8 *rates, size_t len); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 769117916fb..a3957698edb 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -247,8 +247,8 @@ static ssize_t lbs_anycast_set(struct device *dev, return strlen(buf); } -int lbs_add_rtap(lbs_private *priv); -void lbs_remove_rtap(lbs_private *priv); +int lbs_add_rtap(struct lbs_private *priv); +void lbs_remove_rtap(struct lbs_private *priv); /** * Get function for sysfs attribute rtap @@ -256,8 +256,9 @@ void lbs_remove_rtap(lbs_private *priv); static ssize_t lbs_rtap_get(struct device *dev, struct device_attribute *attr, char * buf) { - lbs_private *priv = (lbs_private *) (to_net_dev(dev))->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) + (to_net_dev(dev))->priv; + struct lbs_adapter *adapter = priv->adapter; return snprintf(buf, 5, "0x%X\n", adapter->monitormode); } @@ -268,8 +269,9 @@ static ssize_t lbs_rtap_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { int monitor_mode; - lbs_private *priv = (lbs_private *) (to_net_dev(dev))->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) + (to_net_dev(dev))->priv; + struct lbs_adapter *adapter = priv->adapter; sscanf(buf, "%x", &monitor_mode); if (monitor_mode != LBS_MONITOR_OFF) { @@ -332,7 +334,7 @@ static ssize_t lbs_autostart_enabled_set(struct device *dev, { struct cmd_ds_mesh_access mesh_access; uint32_t datum; - lbs_private *priv = (to_net_dev(dev))->priv; + struct lbs_private *priv = (to_net_dev(dev))->priv; int ret; memset(&mesh_access, 0, sizeof(mesh_access)); @@ -375,8 +377,8 @@ static struct attribute_group lbs_mesh_attr_group = { */ static int pre_open_check(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) dev->priv; + struct lbs_adapter *adapter = priv->adapter; int i = 0; while (!adapter->fw_ready && i < 20) { @@ -399,8 +401,8 @@ static int pre_open_check(struct net_device *dev) */ static int lbs_dev_open(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_NET); @@ -429,7 +431,7 @@ static int lbs_dev_open(struct net_device *dev) */ static int lbs_mesh_open(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv ; + struct lbs_private *priv = (struct lbs_private *) dev->priv ; if (pre_open_check(dev) == -1) return -1; @@ -453,7 +455,7 @@ static int lbs_mesh_open(struct net_device *dev) */ static int lbs_open(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv ; + struct lbs_private *priv = (struct lbs_private *) dev->priv ; if(pre_open_check(dev) == -1) return -1; @@ -466,7 +468,7 @@ static int lbs_open(struct net_device *dev) static int lbs_dev_close(struct net_device *dev) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_NET); @@ -485,7 +487,7 @@ static int lbs_dev_close(struct net_device *dev) */ static int lbs_mesh_close(struct net_device *dev) { - lbs_private *priv = (lbs_private *) (dev->priv); + struct lbs_private *priv = (struct lbs_private *) (dev->priv); priv->mesh_open = 0; netif_stop_queue(priv->mesh_dev); @@ -503,7 +505,7 @@ static int lbs_mesh_close(struct net_device *dev) */ static int lbs_close(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv; + struct lbs_private *priv = (struct lbs_private *) dev->priv; netif_stop_queue(dev); priv->infra_open = 0; @@ -517,7 +519,7 @@ static int lbs_close(struct net_device *dev) static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { int ret = 0; - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_NET); @@ -544,7 +546,7 @@ done: static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; int ret; lbs_deb_enter(LBS_DEB_MESH); @@ -566,7 +568,7 @@ static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, */ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; int ret; lbs_deb_enter(LBS_DEB_NET); @@ -585,7 +587,7 @@ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) static void lbs_tx_timeout(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv; + struct lbs_private *priv = (struct lbs_private *) dev->priv; lbs_deb_enter(LBS_DEB_TX); @@ -617,12 +619,12 @@ static void lbs_tx_timeout(struct net_device *dev) /** * @brief This function returns the network statistics * - * @param dev A pointer to lbs_private structure + * @param dev A pointer to struct lbs_private structure * @return A pointer to net_device_stats structure */ static struct net_device_stats *lbs_get_stats(struct net_device *dev) { - lbs_private *priv = (lbs_private *) dev->priv; + struct lbs_private *priv = (struct lbs_private *) dev->priv; return &priv->stats; } @@ -630,8 +632,8 @@ static struct net_device_stats *lbs_get_stats(struct net_device *dev) static int lbs_set_mac_address(struct net_device *dev, void *addr) { int ret = 0; - lbs_private *priv = (lbs_private *) dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *) dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct sockaddr *phwaddr = addr; lbs_deb_enter(LBS_DEB_NET); @@ -667,7 +669,7 @@ done: return ret; } -static int lbs_copy_multicast_address(lbs_adapter *adapter, +static int lbs_copy_multicast_address(struct lbs_adapter *adapter, struct net_device *dev) { int i = 0; @@ -684,8 +686,8 @@ static int lbs_copy_multicast_address(lbs_adapter *adapter, static void lbs_set_multicast_list(struct net_device *dev) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int oldpacketfilter; DECLARE_MAC_BUF(mac); @@ -765,8 +767,8 @@ static void lbs_set_multicast_list(struct net_device *dev) static int lbs_thread(void *data) { struct net_device *dev = data; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; wait_queue_t wait; u8 ireg = 0; @@ -928,13 +930,13 @@ static int lbs_thread(void *data) * HW spec from firmware and set basic parameters to * firmware. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return 0 or -1 */ -static int lbs_setup_firmware(lbs_private *priv) +static int lbs_setup_firmware(struct lbs_private *priv) { int ret = -1; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_mesh_access mesh_access; lbs_deb_enter(LBS_DEB_FW); @@ -995,8 +997,8 @@ done: */ static void command_timer_fn(unsigned long data) { - lbs_private *priv = (lbs_private *)data; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = (struct lbs_private *)data; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *ptempnode; struct cmd_ds_command *cmd; unsigned long flags; @@ -1030,9 +1032,9 @@ static void command_timer_fn(unsigned long data) return; } -static int lbs_init_adapter(lbs_private *priv) +static int lbs_init_adapter(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; size_t bufsize; int i, ret = 0; @@ -1101,9 +1103,9 @@ out: return ret; } -static void lbs_free_adapter(lbs_private *priv) +static void lbs_free_adapter(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; if (!adapter) { lbs_deb_fw("why double free adapter?\n"); @@ -1131,25 +1133,27 @@ static void lbs_free_adapter(lbs_private *priv) * card, allocate the lbs_priv and initialize the device. * * @param card A pointer to card - * @return A pointer to lbs_private structure + * @return A pointer to struct lbs_private structure */ -lbs_private *lbs_add_card(void *card, struct device *dmdev) +struct lbs_private *lbs_add_card(void *card, struct device *dmdev) { struct net_device *dev = NULL; - lbs_private *priv = NULL; + struct lbs_private *priv = NULL; lbs_deb_enter(LBS_DEB_NET); /* Allocate an Ethernet device and register it */ - if (!(dev = alloc_etherdev(sizeof(lbs_private)))) { + dev = alloc_etherdev(sizeof(struct lbs_private)); + if (!dev) { lbs_pr_err("init ethX device failed\n"); goto done; } priv = dev->priv; - /* allocate buffer for lbs_adapter */ - if (!(priv->adapter = kzalloc(sizeof(lbs_adapter), GFP_KERNEL))) { - lbs_pr_err("allocate buffer for lbs_adapter failed\n"); + /* allocate buffer for struct lbs_adapter */ + priv->adapter = kzalloc(sizeof(struct lbs_adapter), GFP_KERNEL); + if (!priv->adapter) { + lbs_pr_err("allocate buffer for struct lbs_adapter failed\n"); goto err_kzalloc; } @@ -1217,9 +1221,9 @@ done: EXPORT_SYMBOL_GPL(lbs_add_card); -int lbs_remove_card(lbs_private *priv) +int lbs_remove_card(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct net_device *dev = priv->dev; union iwreq_data wrqu; @@ -1258,7 +1262,7 @@ int lbs_remove_card(lbs_private *priv) EXPORT_SYMBOL_GPL(lbs_remove_card); -int lbs_start_card(lbs_private *priv) +int lbs_start_card(struct lbs_private *priv) { struct net_device *dev = priv->dev; int ret = -1; @@ -1291,7 +1295,7 @@ done: EXPORT_SYMBOL_GPL(lbs_start_card); -int lbs_stop_card(lbs_private *priv) +int lbs_stop_card(struct lbs_private *priv) { struct net_device *dev = priv->dev; int ret = -1; @@ -1324,10 +1328,10 @@ EXPORT_SYMBOL_GPL(lbs_stop_card); /** * @brief This function adds mshX interface * - * @param priv A pointer to the lbs_private structure + * @param priv A pointer to the struct lbs_private structure * @return 0 if successful, -X otherwise */ -int lbs_add_mesh(lbs_private *priv, struct device *dev) +int lbs_add_mesh(struct lbs_private *priv, struct device *dev) { struct net_device *mesh_dev = NULL; int ret = 0; @@ -1385,7 +1389,7 @@ done: EXPORT_SYMBOL_GPL(lbs_add_mesh); -void lbs_remove_mesh(lbs_private *priv) +void lbs_remove_mesh(struct lbs_private *priv) { struct net_device *mesh_dev; @@ -1441,9 +1445,9 @@ struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no return NULL; } -int lbs_set_regiontable(lbs_private *priv, u8 region, u8 band) +int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; int i = 0; @@ -1485,7 +1489,7 @@ out: */ void lbs_interrupt(struct net_device *dev) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; lbs_deb_enter(LBS_DEB_THREAD); @@ -1507,7 +1511,7 @@ void lbs_interrupt(struct net_device *dev) } EXPORT_SYMBOL_GPL(lbs_interrupt); -int lbs_reset_device(lbs_private *priv) +int lbs_reset_device(struct lbs_private *priv) { int ret; @@ -1562,12 +1566,12 @@ static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) { - lbs_private *priv = dev->priv; + struct lbs_private *priv = dev->priv; return &priv->ieee->stats; } -void lbs_remove_rtap(lbs_private *priv) +void lbs_remove_rtap(struct lbs_private *priv) { if (priv->rtap_net_dev == NULL) return; @@ -1576,7 +1580,7 @@ void lbs_remove_rtap(lbs_private *priv) priv->rtap_net_dev = NULL; } -int lbs_add_rtap(lbs_private *priv) +int lbs_add_rtap(struct lbs_private *priv) { int rc = 0; diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 20495590434..fa467dfef00 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -35,19 +35,20 @@ struct rx80211packethdr { void *eth80211_hdr; } __attribute__ ((packed)); -static int process_rxed_802_11_packet(lbs_private *priv, struct sk_buff *skb); +static int process_rxed_802_11_packet(struct lbs_private *priv, + struct sk_buff *skb); /** * @brief This function computes the avgSNR . * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return avgSNR */ -static u8 lbs_getavgsnr(lbs_private *priv) +static u8 lbs_getavgsnr(struct lbs_private *priv) { u8 i; u16 temp = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF == 0) return 0; for (i = 0; i < adapter->numSNRNF; i++) @@ -59,14 +60,14 @@ static u8 lbs_getavgsnr(lbs_private *priv) /** * @brief This function computes the AvgNF * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return AvgNF */ -static u8 lbs_getavgnf(lbs_private *priv) +static u8 lbs_getavgnf(struct lbs_private *priv) { u8 i; u16 temp = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF == 0) return 0; for (i = 0; i < adapter->numSNRNF; i++) @@ -78,13 +79,13 @@ static u8 lbs_getavgnf(lbs_private *priv) /** * @brief This function save the raw SNR/NF to our internel buffer * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param prxpd A pointer to rxpd structure of received packet * @return n/a */ -static void lbs_save_rawSNRNF(lbs_private *priv, struct rxpd *p_rx_pd) +static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; if (adapter->numSNRNF < DEFAULT_DATA_AVG_FACTOR) adapter->numSNRNF++; adapter->rawSNR[adapter->nextSNRNF] = p_rx_pd->snr; @@ -98,13 +99,13 @@ static void lbs_save_rawSNRNF(lbs_private *priv, struct rxpd *p_rx_pd) /** * @brief This function computes the RSSI in received packet. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param prxpd A pointer to rxpd structure of received packet * @return n/a */ -static void lbs_compute_rssi(lbs_private *priv, struct rxpd *p_rx_pd) +static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_RX); @@ -134,7 +135,7 @@ static void lbs_compute_rssi(lbs_private *priv, struct rxpd *p_rx_pd) lbs_deb_leave(LBS_DEB_RX); } -void lbs_upload_rx_packet(lbs_private *priv, struct sk_buff *skb) +void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) { lbs_deb_rx("skb->data %p\n", skb->data); @@ -154,13 +155,13 @@ void lbs_upload_rx_packet(lbs_private *priv, struct sk_buff *skb) * @brief This function processes received packet and forwards it * to kernel/upper layer * - * @param priv A pointer to lbs_private + * @param priv A pointer to struct lbs_private * @param skb A pointer to skb which includes the received packet * @return 0 or -1 */ -int lbs_process_rxed_packet(lbs_private *priv, struct sk_buff *skb) +int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct rxpackethdr *p_rx_pkt; @@ -319,13 +320,14 @@ static u8 convert_mv_rate_to_radiotap(u8 rate) * @brief This function processes a received 802.11 packet and forwards it * to kernel/upper layer * - * @param priv A pointer to lbs_private + * @param priv A pointer to struct lbs_private * @param skb A pointer to skb which includes the received packet * @return 0 or -1 */ -static int process_rxed_802_11_packet(lbs_private *priv, struct sk_buff *skb) +static int process_rxed_802_11_packet(struct lbs_private *priv, + struct sk_buff *skb) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct rx80211packethdr *p_rx_pkt; diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 13a0838aa1e..4e465bb4fd6 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -163,13 +163,13 @@ static inline int match_bss_dynamic_wep(struct lbs_802_11_security *secinfo, * 0 0 0 0 !=NONE 1 0 0 yes Dynamic WEP * * - * @param adapter A pointer to lbs_adapter + * @param adapter A pointer to struct lbs_adapter * @param index Index in scantable to check against current driver settings * @param mode Network mode: Infrastructure or IBSS * * @return Index in scantable, or error code if negative */ -static int is_network_compatible(lbs_adapter *adapter, +static int is_network_compatible(struct lbs_adapter *adapter, struct bss_descriptor * bss, u8 mode) { int matched = 0; @@ -262,7 +262,7 @@ int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) * of channels to scan. This routine is used for any scan that is not * provided a specific channel list to scan. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param scanchanlist Output parameter: resulting channel list to scan * @param filteredscan Flag indicating whether or not a BSSID or SSID filter * is being sent in the command to firmware. Used to @@ -272,12 +272,12 @@ int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) * * @return void */ -static void lbs_scan_create_channel_list(lbs_private *priv, +static void lbs_scan_create_channel_list(struct lbs_private *priv, struct chanscanparamset * scanchanlist, u8 filteredscan) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct region_channel *scanregion; struct chan_freq_power *cfp; int rgnidx; @@ -360,7 +360,9 @@ static void lbs_scan_create_channel_list(lbs_private *priv, /* Delayed partial scan worker */ void lbs_scan_worker(struct work_struct *work) { - lbs_private *priv = container_of(work, lbs_private, scan_work.work); + struct lbs_private *priv = container_of(work, + struct lbs_private, + scan_work.work); lbs_scan_networks(priv, NULL, 0); } @@ -386,7 +388,7 @@ void lbs_scan_worker(struct work_struct *work) * If the number of probes is not set, use the adapter default setting * Qualify the channel * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param puserscanin NULL or pointer to scan configuration parameters * @param ppchantlvout Output parameter: Pointer to the start of the * channel TLV portion of the output scan config @@ -405,7 +407,7 @@ void lbs_scan_worker(struct work_struct *work) * @return resulting scan configuration */ static struct lbs_scan_cmd_config * -lbs_scan_setup_scan_config(lbs_private *priv, +lbs_scan_setup_scan_config(struct lbs_private *priv, const struct lbs_ioctl_user_scan_cfg *puserscanin, struct mrvlietypes_chanlistparamset ** ppchantlvout, struct chanscanparamset * pscanchanlist, @@ -587,7 +589,7 @@ out: * and sends the portion of the channel TLV along with the other TLVs * to the lbs_cmd routines for execution in the firmware. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param maxchanperscan Maximum number channels to be included in each * scan command sent to firmware * @param filteredscan Flag indicating whether or not a BSSID or SSID @@ -601,7 +603,7 @@ out: * * @return 0 or error return otherwise */ -static int lbs_scan_channel_list(lbs_private *priv, +static int lbs_scan_channel_list(struct lbs_private *priv, int maxchanperscan, u8 filteredscan, struct lbs_scan_cmd_config *pscancfgout, @@ -754,7 +756,7 @@ out: /* * Only used from lbs_scan_networks() */ -static void clear_selected_scan_list_entries(lbs_adapter *adapter, +static void clear_selected_scan_list_entries(struct lbs_adapter *adapter, const struct lbs_ioctl_user_scan_cfg *scan_cfg) { struct bss_descriptor *bss; @@ -813,18 +815,18 @@ out: * order to send the appropriate scan commands to firmware to populate or * update the internal driver scan table * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param puserscanin Pointer to the input configuration for the requested * scan. * @param full_scan ??? * * @return 0 or < 0 if error */ -int lbs_scan_networks(lbs_private *priv, +int lbs_scan_networks(struct lbs_private *priv, const struct lbs_ioctl_user_scan_cfg *puserscanin, int full_scan) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct mrvlietypes_chanlistparamset *pchantlvout; struct chanscanparamset * scan_chan_list = NULL; struct lbs_scan_cmd_config *scan_cfg = NULL; @@ -1155,13 +1157,13 @@ done: * * Used in association code * - * @param adapter A pointer to lbs_adapter + * @param adapter A pointer to struct lbs_adapter * @param bssid BSSID to find in the scan list * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list, or error return code (< 0) */ -struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter, +struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, u8 * bssid, u8 mode) { struct bss_descriptor * iter_bss; @@ -1207,14 +1209,14 @@ out: * * Used in association code * - * @param adapter A pointer to lbs_adapter + * @param adapter A pointer to struct lbs_adapter * @param ssid SSID to find in the list * @param bssid BSSID to qualify the SSID selection (if provided) * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list */ -struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter, +struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, int channel) { @@ -1279,12 +1281,13 @@ out: * Search the scan table for the best SSID that also matches the current * adapter network preference (infrastructure or adhoc) * - * @param adapter A pointer to lbs_adapter + * @param adapter A pointer to struct lbs_adapter * * @return index in BSSID list */ -static struct bss_descriptor *lbs_find_best_ssid_in_list(lbs_adapter *adapter, - u8 mode) +static struct bss_descriptor *lbs_find_best_ssid_in_list( + struct lbs_adapter *adapter, + u8 mode) { u8 bestrssi = 0; struct bss_descriptor * iter_bss; @@ -1325,15 +1328,15 @@ static struct bss_descriptor *lbs_find_best_ssid_in_list(lbs_adapter *adapter, * * Used from association worker. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param pSSID A pointer to AP's ssid * * @return 0--success, otherwise--fail */ -int lbs_find_best_network_ssid(lbs_private *priv, +int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int ret = -1; struct bss_descriptor * found; @@ -1371,8 +1374,8 @@ out: int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_SCAN); @@ -1394,7 +1397,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, * * Used in association code and from debugfs * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param ssid A pointer to the SSID to scan for * @param ssid_len Length of the SSID * @param clear_ssid Should existing scan results with this SSID @@ -1404,10 +1407,10 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, * * @return 0-success, otherwise fail */ -int lbs_send_specific_ssid_scan(lbs_private *priv, +int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, u8 ssid_len, u8 clear_ssid) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_user_scan_cfg scancfg; int ret = 0; @@ -1445,11 +1448,11 @@ out: #define MAX_CUSTOM_LEN 64 -static inline char *lbs_translate_scan(lbs_private *priv, +static inline char *lbs_translate_scan(struct lbs_private *priv, char *start, char *stop, struct bss_descriptor *bss) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; char *current_val; /* For rates */ struct iw_event iwe; /* Temporary buffer */ @@ -1612,8 +1615,8 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { #define SCAN_ITEM_SIZE 128 - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int err = 0; char *ev = extra; char *stop = ev + dwrq->length; @@ -1684,7 +1687,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, * Sends a fixed lenght data part (specifying the BSS type and BSSID filters) * as well as a variable number/length of TLVs to the firmware. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param cmd A pointer to cmd_ds_command structure to be sent to * firmware with the cmd_DS_801_11_SCAN structure * @param pdata_buf Void pointer cast of a lbs_scan_cmd_config struct used @@ -1692,7 +1695,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, * * @return 0 or -1 */ -int lbs_cmd_80211_scan(lbs_private *priv, +int lbs_cmd_80211_scan(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; @@ -1752,14 +1755,14 @@ static inline int is_same_network(struct bss_descriptor *src, * | bufsize and sizeof the fixed fields above) | * .-----------------------------------------------------------. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param resp A pointer to cmd_ds_command * * @return 0 or -1 */ -int lbs_ret_80211_scan(lbs_private *priv, struct cmd_ds_command *resp) +int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_scan_rsp *pscan; struct bss_descriptor * iter_bss; struct bss_descriptor * safe; diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index 7ed66f40d18..b2314481467 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h @@ -10,6 +10,8 @@ #include #include "hostcmd.h" +struct lbs_adapter; + /** * @brief Maximum number of channels that can be sent in a setuserscan ioctl * @@ -176,27 +178,27 @@ struct bss_descriptor { int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); -struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter, +struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode, int channel); -struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter, +struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, u8 *bssid, u8 mode); -int lbs_find_best_network_ssid(lbs_private *priv, u8 *out_ssid, +int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode); -int lbs_send_specific_ssid_scan(lbs_private *priv, u8 *ssid, +int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, u8 ssid_len, u8 clear_ssid); -int lbs_cmd_80211_scan(lbs_private *priv, +int lbs_cmd_80211_scan(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf); -int lbs_ret_80211_scan(lbs_private *priv, +int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp); -int lbs_scan_networks(lbs_private *priv, +int lbs_scan_networks(struct lbs_private *priv, const struct lbs_ioctl_user_scan_cfg *puserscanin, int full_scan); diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 267274b804c..b423ce1ff42 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -52,11 +52,11 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) * @brief This function processes a single packet and sends * to IF layer * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param skb A pointer to skb which includes TX packet * @return 0 or -1 */ -static int SendSinglePacket(lbs_private *priv, struct sk_buff *skb) +static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) { int ret = 0; struct txpd localtxpd; @@ -164,9 +164,9 @@ done: } -void lbs_tx_runqueue(lbs_private *priv) +void lbs_tx_runqueue(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; int i; spin_lock(&adapter->txqueue_lock); @@ -180,9 +180,9 @@ void lbs_tx_runqueue(lbs_private *priv) spin_unlock(&adapter->txqueue_lock); } -static void lbs_tx_queue(lbs_private *priv, struct sk_buff *skb) +static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; spin_lock(&adapter->txqueue_lock); @@ -205,10 +205,10 @@ static void lbs_tx_queue(lbs_private *priv, struct sk_buff *skb) * @brief This function checks the conditions and sends packet to IF * layer if everything is ok. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @return n/a */ -int lbs_process_tx(lbs_private *priv, struct sk_buff *skb) +int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) { int ret = -1; @@ -239,14 +239,14 @@ done: * @brief This function sends to the host the last transmitted packet, * filling the radiotap headers with transmission information. * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @param status A 32 bit value containing transmission status. * * @returns void */ -void lbs_send_tx_feedback(lbs_private *priv) +void lbs_send_tx_feedback(struct lbs_private *priv) { - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; struct tx_radiotap_hdr *radiotap_hdr; u32 status = adapter->eventcause; int txfail; diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 2231a65a537..b8c93c0adb2 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -21,7 +21,7 @@ #include "assoc.h" -static inline void lbs_postpone_association_work(lbs_private *priv) +static inline void lbs_postpone_association_work(struct lbs_private *priv) { if (priv->adapter->surpriseremoved) return; @@ -29,7 +29,7 @@ static inline void lbs_postpone_association_work(lbs_private *priv) queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); } -static inline void lbs_cancel_association_work(lbs_private *priv) +static inline void lbs_cancel_association_work(struct lbs_private *priv) { cancel_delayed_work(&priv->assoc_work); kfree(priv->adapter->pending_assoc_req); @@ -40,13 +40,15 @@ static inline void lbs_cancel_association_work(lbs_private *priv) /** * @brief Find the channel frequency power info with specific channel * - * @param adapter A pointer to lbs_adapter structure + * @param adapter A pointer to struct lbs_adapter structure * @param band it can be BAND_A, BAND_G or BAND_B * @param channel the channel for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ -struct chan_freq_power *lbs_find_cfp_by_band_and_channel(lbs_adapter *adapter, - u8 band, u16 channel) +struct chan_freq_power *lbs_find_cfp_by_band_and_channel( + struct lbs_adapter *adapter, + u8 band, + u16 channel) { struct chan_freq_power *cfp = NULL; struct region_channel *rc; @@ -79,13 +81,15 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel(lbs_adapter *adapter, /** * @brief Find the channel frequency power info with specific frequency * - * @param adapter A pointer to lbs_adapter structure + * @param adapter A pointer to struct lbs_adapter structure * @param band it can be BAND_A, BAND_G or BAND_B * @param freq the frequency for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ -static struct chan_freq_power *find_cfp_by_band_and_freq(lbs_adapter *adapter, - u8 band, u32 freq) +static struct chan_freq_power *find_cfp_by_band_and_freq( + struct lbs_adapter *adapter, + u8 band, + u32 freq) { struct chan_freq_power *cfp = NULL; struct region_channel *rc; @@ -119,14 +123,14 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(lbs_adapter *adapter, /** * @brief Set Radio On/OFF * - * @param priv A pointer to lbs_private structure + * @param priv A pointer to struct lbs_private structure * @option Radio Option * @return 0 --success, otherwise fail */ -static int lbs_radio_ioctl(lbs_private *priv, u8 option) +static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) { int ret = 0; - lbs_adapter *adapter = priv->adapter; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -147,10 +151,10 @@ static int lbs_radio_ioctl(lbs_private *priv, u8 option) /** * @brief Copy active data rates based on adapter mode and status * - * @param adapter A pointer to lbs_adapter structure + * @param adapter A pointer to struct lbs_adapter structure * @param rate The buf to return the active rates */ -static void copy_active_data_rates(lbs_adapter *adapter, u8 *rates) +static void copy_active_data_rates(struct lbs_adapter *adapter, u8 *rates) { lbs_deb_enter(LBS_DEB_WEXT); @@ -179,8 +183,8 @@ static int lbs_get_name(struct net_device *dev, struct iw_request_info *info, static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; lbs_deb_enter(LBS_DEB_WEXT); @@ -206,8 +210,8 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -225,8 +229,8 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -250,8 +254,8 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -268,8 +272,8 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -294,8 +298,8 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; u32 rthr = vwrq->value; lbs_deb_enter(LBS_DEB_WEXT); @@ -320,8 +324,8 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -347,8 +351,8 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, { int ret = 0; u32 fthr = vwrq->value; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -373,8 +377,8 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -399,8 +403,8 @@ out: static int lbs_get_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -427,8 +431,8 @@ static int lbs_get_txpow(struct net_device *dev, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -459,8 +463,8 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -494,8 +498,8 @@ out: static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_WEXT); @@ -563,8 +567,8 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int i, j; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct iw_range *range = (struct iw_range *)extra; struct chan_freq_power *cfp; u8 rates[MAX_RATES + 1]; @@ -740,8 +744,8 @@ out: static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -784,8 +788,8 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int mode; lbs_deb_enter(LBS_DEB_WEXT); @@ -815,8 +819,8 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) EXCELLENT = 95, PERFECT = 100 }; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; u32 rssi_qual; u32 tx_qual; u32 quality = 0; @@ -919,8 +923,8 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { int ret = -EINVAL; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; struct assoc_request * assoc_req; @@ -976,8 +980,8 @@ out: static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; u32 new_rate; u16 action; int ret = -EINVAL; @@ -1020,8 +1024,8 @@ out: static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1046,8 +1050,8 @@ static int lbs_set_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); @@ -1092,8 +1096,8 @@ static int lbs_get_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, u8 * extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; lbs_deb_enter(LBS_DEB_WEXT); @@ -1297,8 +1301,8 @@ static int lbs_set_encode(struct net_device *dev, struct iw_point *dwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; u16 is_default = 0, index = 0, set_tx_key = 0; @@ -1374,8 +1378,8 @@ static int lbs_get_encodeext(struct net_device *dev, char *extra) { int ret = -EINVAL; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int index, max_key_len; @@ -1481,8 +1485,8 @@ static int lbs_set_encodeext(struct net_device *dev, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int alg = ext->alg; struct assoc_request * assoc_req; @@ -1606,8 +1610,8 @@ static int lbs_set_genie(struct net_device *dev, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req; @@ -1653,8 +1657,8 @@ static int lbs_get_genie(struct net_device *dev, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1682,8 +1686,8 @@ static int lbs_set_auth(struct net_device *dev, struct iw_param *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; int updated = 0; @@ -1782,8 +1786,8 @@ static int lbs_get_auth(struct net_device *dev, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1820,8 +1824,8 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; u16 dbm; @@ -1862,8 +1866,8 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1898,8 +1902,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; int ret = 0; u8 ssid[IW_ESSID_MAX_SIZE]; u8 ssid_len = 0; @@ -1970,8 +1974,8 @@ out: static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { - lbs_private *priv = dev->priv; - lbs_adapter *adapter = priv->adapter; + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; DECLARE_MAC_BUF(mac); @@ -2002,7 +2006,7 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, return ret; } -void lbs_get_fwversion(lbs_adapter *adapter, char *fwversion, int maxlen) +void lbs_get_fwversion(struct lbs_adapter *adapter, char *fwversion, int maxlen) { char fwver[32]; -- cgit v1.2.3 From 3a1886491710c196656a005fcc693172f5bb4c8a Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Mon, 26 Nov 2007 10:07:14 +0100 Subject: libertas: rework event subscription This patch moves re-works the implementation of event subscription via debugfs. For this: * it tells cmd.c and cmdresp.c about CMD_802_11_SUBSCRIBE_EVENT * removes lots of low-level cmd stuff from debugfs.c * create unified functions to read/write snr, rssi, bcnmiss and failcount * introduces #define's for subscription event bitmask values * add a function to search for a specific element in an IE (a.k.a. TLV) * add a function to find out the size of the TLV. This is needed because lbs_prepare_and_send_command() has an argument for a data buffer, but not for it's lengths and TLVs can be, by definition, vary in size. * fix a bug where it was not possible to disable an event Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 50 ++ drivers/net/wireless/libertas/cmdresp.c | 24 + drivers/net/wireless/libertas/debugfs.c | 1071 ++++++------------------------- drivers/net/wireless/libertas/host.h | 8 + drivers/net/wireless/libertas/hostcmd.h | 7 + drivers/net/wireless/libertas/types.h | 19 +- 6 files changed, 278 insertions(+), 901 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index dde17c65bcc..d98bec92474 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -246,6 +246,52 @@ static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, } +static ssize_t lbs_tlv_size(const u8 *tlv, u16 size) +{ + ssize_t pos = 0; + struct mrvlietypesheader *tlv_h; + while (pos < size) { + u16 length; + tlv_h = (struct mrvlietypesheader *) tlv; + if (tlv_h->len == 0) + return pos; + length = le16_to_cpu(tlv_h->len) + + sizeof(struct mrvlietypesheader); + pos += length; + tlv += length; + } + return pos; +} + + +static void lbs_cmd_802_11_subscribe_event(struct lbs_private *priv, + struct cmd_ds_command *cmd, u16 cmd_action, + void *pdata_buf) +{ + struct cmd_ds_802_11_subscribe_event *events = + (struct cmd_ds_802_11_subscribe_event *) pdata_buf; + + /* pdata_buf points to a struct cmd_ds_802_11_subscribe_event and room + * for various Marvell TLVs */ + + lbs_deb_enter(LBS_DEB_CMD); + + cmd->size = cpu_to_le16(sizeof(*events) + - sizeof(events->tlv) + + S_DS_GEN); + cmd->params.subscribe_event.action = cpu_to_le16(cmd_action); + if (cmd_action == CMD_ACT_GET) { + cmd->params.subscribe_event.events = 0; + } else { + ssize_t sz = lbs_tlv_size(events->tlv, sizeof(events->tlv)); + cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + sz); + cmd->params.subscribe_event.events = events->events; + memcpy(cmd->params.subscribe_event.tlv, events->tlv, sz); + } + + lbs_deb_leave(LBS_DEB_CMD); +} + static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, struct enc_key * pkey) { @@ -1394,6 +1440,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = 0; break; } + case CMD_802_11_SUBSCRIBE_EVENT: + lbs_cmd_802_11_subscribe_event(priv, cmdptr, + cmd_action, pdata_buf); + break; case CMD_802_11_PWR_CFG: cmdptr->command = cpu_to_le16(CMD_802_11_PWR_CFG); cmdptr->size = diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 3596957f1d5..87b5bd2988e 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -554,6 +554,26 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, return 0; } +static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, + struct cmd_ds_command *resp) +{ + struct lbs_adapter *adapter = priv->adapter; + struct cmd_ds_802_11_subscribe_event *cmd_event = + &resp->params.subscribe_event; + struct cmd_ds_802_11_subscribe_event *dst_event = + adapter->cur_cmd->pdata_buf; + + lbs_deb_enter(LBS_DEB_CMD); + + if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) { + dst_event->events = le16_to_cpu(cmd_event->events); + memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv)); + } + + lbs_deb_leave(LBS_DEB_CMD); + return 0; +} + static inline int handle_cmd_response(u16 respcmd, struct cmd_ds_command *resp, struct lbs_private *priv) @@ -689,6 +709,10 @@ static inline int handle_cmd_response(u16 respcmd, sizeof(struct cmd_ds_802_11_led_ctrl)); spin_unlock_irqrestore(&adapter->driver_lock, flags); break; + case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT): + ret = lbs_ret_802_11_subscribe_event(priv, resp); + break; + case CMD_RET(CMD_802_11_PWR_CFG): spin_lock_irqsave(&adapter->driver_lock, flags); memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 2e1842474f8..de768de4584 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -384,524 +384,162 @@ out_unlock: return count; } -static int lbs_event_initcmd(struct lbs_private *priv, void **response_buf, - struct cmd_ctrl_node **cmdnode, - struct cmd_ds_command **cmd) -{ - u16 wait_option = CMD_OPTION_WAITFORRSP; - if (!(*cmdnode = lbs_get_free_cmd_ctrl_node(priv))) { - lbs_deb_debugfs("failed lbs_get_free_cmd_ctrl_node\n"); - return -ENOMEM; - } - if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { - lbs_deb_debugfs("failed to allocate response buffer!\n"); - return -ENOMEM; - } - lbs_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); - init_waitqueue_head(&(*cmdnode)->cmdwait_q); - (*cmdnode)->pdata_buf = *response_buf; - (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; - (*cmdnode)->cmdwaitqwoken = 0; - *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; - (*cmd)->command = cpu_to_le16(CMD_802_11_SUBSCRIBE_EVENT); - (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum); - (*cmd)->result = 0; - return 0; -} - -static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +/* + * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might + * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the + * firmware. Here's an example: + * 04 01 02 00 00 00 05 01 02 00 00 00 06 01 02 00 + * 00 00 07 01 02 00 3c 00 00 00 00 00 00 00 03 03 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * + * The 04 01 is the TLV type (here TLV_TYPE_RSSI_LOW), 02 00 is the length, + * 00 00 are the data bytes of this TLV. For this TLV, their meaning is + * defined in mrvlietypes_thresholds + * + * This function searches in this TLV data chunk for a given TLV type + * and returns a pointer to the first data byte of the TLV, or to NULL + * if the TLV hasn't been found. + */ +static void *lbs_tlv_find(u16 tlv_type, const u8 *tlv, u16 size) { - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; + __le16 le_type = cpu_to_le16(tlv_type); ssize_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_rssithreshold *Lowrssi; - case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW): - Lowrssi = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - Lowrssi->rssivalue, - Lowrssi->rssifreq, - (event->events & cpu_to_le16(0x0001))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_snrthreshold); - break; - } - } - - kfree(response_buf); - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; + struct mrvlietypesheader *tlv_h; + while (pos < size) { + u16 length; + tlv_h = (struct mrvlietypesheader *) tlv; + if (tlv_h->type == le_type) + return tlv_h; + if (tlv_h->len == 0) + return NULL; + length = le16_to_cpu(tlv_h->len) + + sizeof(struct mrvlietypesheader); + pos += length; + tlv += length; + } + return NULL; } + +/* + * This just gets the bitmap of currently subscribed events. Used when + * adding an additonal event subscription. + */ static u16 lbs_get_events_bitmap(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res; - u16 event_bitmap; - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - return res; - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + ssize_t res; - pcmdptr = response_buf; + struct cmd_ds_802_11_subscribe_event *events = kzalloc( + sizeof(struct cmd_ds_802_11_subscribe_event), + GFP_KERNEL); - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - return 0; - } + res = lbs_prepare_and_send_command(priv, + CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_GET, + CMD_OPTION_WAITFORRSP, 0, events); - if (le16_to_cpu(pcmdptr->command) != CMD_RET(CMD_802_11_SUBSCRIBE_EVENT)) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); + if (res) { + kfree(events); return 0; } - - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - event_bitmap = le16_to_cpu(event->events); - kfree(response_buf); - return event_bitmap; + return le16_to_cpu(events->events); } -static ssize_t lbs_lowrssi_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_rssithreshold *rssi_threshold; - void *response_buf; - u16 event_bitmap; - u8 *ptr; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); - if (res != 3) { - res = -EFAULT; - goto out_unlock; - } - - event_bitmap = lbs_get_events_bitmap(priv); - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_rssithreshold)); - - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); - rssi_threshold->header.type = cpu_to_le16(0x0104); - rssi_threshold->header.len = cpu_to_le16(2); - rssi_threshold->rssivalue = value; - rssi_threshold->rssifreq = freq; - event_bitmap |= subscribed ? 0x0001 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_threshold_read( + u16 tlv_type, u16 event_mask, + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; - ssize_t pos = 0; + ssize_t res = 0; + size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; + u8 value; + u8 freq; - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + struct cmd_ds_802_11_subscribe_event *events = kzalloc( + sizeof(struct cmd_ds_802_11_subscribe_event), + GFP_KERNEL); + struct mrvlietypes_thresholds *got; - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; + res = lbs_prepare_and_send_command(priv, + CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_GET, + CMD_OPTION_WAITFORRSP, 0, events); + if (res) { + kfree(events); + return res; } - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_snrthreshold *LowSnr; - case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW): - LowSnr = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - LowSnr->snrvalue, - LowSnr->snrfreq, - (event->events & cpu_to_le16(0x0002))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_snrthreshold); - break; - } + got = lbs_tlv_find(tlv_type, events->tlv, sizeof(events->tlv)); + if (got) { + value = got->value; + freq = got->freq; } + kfree(events); - kfree(response_buf); + if (got) + pos += snprintf(buf, len, "%d %d %d\n", value, freq, + !!(le16_to_cpu(events->events) & event_mask)); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; -} - -static ssize_t lbs_lowsnr_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_snrthreshold *snr_threshold; - void *response_buf; - u16 event_bitmap; - u8 *ptr; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); - if (res != 3) { - res = -EFAULT; - goto out_unlock; - } - - event_bitmap = lbs_get_events_bitmap(priv); - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_snrthreshold)); - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); - snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); - snr_threshold->header.len = cpu_to_le16(2); - snr_threshold->snrvalue = value; - snr_threshold->snrfreq = freq; - event_bitmap |= subscribed ? 0x0002 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - - res = count; -out_unlock: free_page(addr); return res; } -static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; - ssize_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_failurecount *failcount; - case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT): - failcount = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - failcount->failvalue, - failcount->Failfreq, - (event->events & cpu_to_le16(0x0004))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_failurecount); - break; - } - } - kfree(response_buf); - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; -} - -static ssize_t lbs_failcount_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_threshold_write( + u16 tlv_type, u16 event_mask, + struct file *file, + const char __user *userbuf, + size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_failurecount *failcount; - void *response_buf; - u16 event_bitmap; - u8 *ptr; + int value, freq, curr_mask, new_mask; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; + struct cmd_ds_802_11_subscribe_event *events; buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; goto out_unlock; } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); + res = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); if (res != 3) { res = -EFAULT; goto out_unlock; } + curr_mask = lbs_get_events_bitmap(priv); - event_bitmap = lbs_get_events_bitmap(priv); - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_failurecount)); - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - failcount = (struct mrvlietypes_failurecount *)(ptr); - failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); - failcount->header.len = cpu_to_le16(2); - failcount->failvalue = value; - failcount->Failfreq = freq; - event_bitmap |= subscribed ? 0x0004 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = (struct cmd_ds_command *)response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; + if (new_mask) + new_mask = curr_mask | event_mask; + else + new_mask = curr_mask & ~event_mask; + + /* Now everything is set and we can send stuff down to the firmware */ + events = kzalloc( + sizeof(struct cmd_ds_802_11_subscribe_event), + GFP_KERNEL); + if (events) { + struct mrvlietypes_thresholds *tlv = + (struct mrvlietypes_thresholds *) events->tlv; + events->action = cpu_to_le16(CMD_ACT_SET); + events->events = cpu_to_le16(new_mask); + tlv->header.type = cpu_to_le16(tlv_type); + tlv->header.len = cpu_to_le16( + sizeof(struct mrvlietypes_thresholds) - + sizeof(struct mrvlietypesheader)); + tlv->value = value; + if (tlv_type != TLV_TYPE_BCNMISS) + tlv->freq = freq; + lbs_prepare_and_send_command(priv, + CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_SET, + CMD_OPTION_WAITFORRSP, 0, events); + kfree(events); } res = count; @@ -910,457 +548,119 @@ out_unlock: return res; } -static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; - ssize_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - free_page(addr); - kfree(response_buf); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - free_page(addr); - kfree(response_buf); - return 0; - } - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_beaconsmissed *bcnmiss; - case __constant_cpu_to_le16(TLV_TYPE_BCNMISS): - bcnmiss = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", - bcnmiss->beaconmissed, - (event->events & cpu_to_le16(0x0008))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_beaconsmissed); - break; - } - } - - kfree(response_buf); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; -} - -static ssize_t lbs_bcnmiss_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_lowrssi_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_beaconsmissed *bcnmiss; - void *response_buf; - u16 event_bitmap; - u8 *ptr; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); - if (res != 3) { - res = -EFAULT; - goto out_unlock; - } - - event_bitmap = lbs_get_events_bitmap(priv); - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_beaconsmissed)); - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); - bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); - bcnmiss->header.len = cpu_to_le16(2); - bcnmiss->beaconmissed = value; - event_bitmap |= subscribed ? 0x0008 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - free_page(addr); - kfree(response_buf); - return 0; - } - - res = count; -out_unlock: - free_page(addr); - return res; + return lbs_threshold_read(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, + file, userbuf, count, ppos); } -static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; - ssize_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } +static ssize_t lbs_lowrssi_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, + file, userbuf, count, ppos); +} - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); +static ssize_t lbs_lowsnr_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_read(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, + file, userbuf, count, ppos); +} - pcmdptr = response_buf; - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } +static ssize_t lbs_lowsnr_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, + file, userbuf, count, ppos); +} - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_rssithreshold *Highrssi; - case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH): - Highrssi = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - Highrssi->rssivalue, - Highrssi->rssifreq, - (event->events & cpu_to_le16(0x0010))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_snrthreshold); - break; - } - } +static ssize_t lbs_failcount_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_read(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, + file, userbuf, count, ppos); +} - kfree(response_buf); - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; +static ssize_t lbs_failcount_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, + file, userbuf, count, ppos); } -static ssize_t lbs_highrssi_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) + +static ssize_t lbs_highrssi_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_rssithreshold *rssi_threshold; - void *response_buf; - u16 event_bitmap; - u8 *ptr; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + return lbs_threshold_read(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, + file, userbuf, count, ppos); +} - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); - if (res != 3) { - res = -EFAULT; - goto out_unlock; - } - event_bitmap = lbs_get_events_bitmap(priv); +static ssize_t lbs_highrssi_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, + file, userbuf, count, ppos); +} - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_rssithreshold)); - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); - rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); - rssi_threshold->header.len = cpu_to_le16(2); - rssi_threshold->rssivalue = value; - rssi_threshold->rssifreq = freq; - event_bitmap |= subscribed ? 0x0010 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - return 0; - } +static ssize_t lbs_highsnr_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_read(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, + file, userbuf, count, ppos); +} - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - return 0; - } - res = count; -out_unlock: - free_page(addr); - return res; +static ssize_t lbs_highsnr_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, + file, userbuf, count, ppos); } -static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_bcnmiss_read( + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - void *response_buf; - int res, cmd_len; - ssize_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) { - free_page(addr); - return res; - } - - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_GET); - pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (void *)(response_buf + S_DS_GEN); - while (cmd_len < le16_to_cpu(pcmdptr->size)) { - struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); - switch (header->type) { - struct mrvlietypes_snrthreshold *HighSnr; - case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH): - HighSnr = (void *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - HighSnr->snrvalue, - HighSnr->snrfreq, - (event->events & cpu_to_le16(0x0020))?1:0); - default: - cmd_len += sizeof(struct mrvlietypes_snrthreshold); - break; - } - } + return lbs_threshold_read(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, + file, userbuf, count, ppos); +} - kfree(response_buf); - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; +static ssize_t lbs_bcnmiss_write( + struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + return lbs_threshold_write(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, + file, userbuf, count, ppos); } -static ssize_t lbs_highsnr_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; - ssize_t res, buf_size; - int value, freq, subscribed, cmd_len; - struct cmd_ctrl_node *pcmdnode; - struct cmd_ds_command *pcmdptr; - struct cmd_ds_802_11_subscribe_event *event; - struct mrvlietypes_snrthreshold *snr_threshold; - void *response_buf; - u16 event_bitmap; - u8 *ptr; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%d %d %d", &value, &freq, &subscribed); - if (res != 3) { - res = -EFAULT; - goto out_unlock; - } - event_bitmap = lbs_get_events_bitmap(priv); - res = lbs_event_initcmd(priv, &response_buf, &pcmdnode, &pcmdptr); - if (res < 0) - goto out_unlock; - event = &pcmdptr->params.subscribe_event; - event->action = cpu_to_le16(CMD_ACT_SET); - pcmdptr->size = cpu_to_le16(S_DS_GEN + - sizeof(struct cmd_ds_802_11_subscribe_event) + - sizeof(struct mrvlietypes_snrthreshold)); - cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - ptr = (u8*) pcmdptr+cmd_len; - snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); - snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); - snr_threshold->header.len = cpu_to_le16(2); - snr_threshold->snrvalue = value; - snr_threshold->snrfreq = freq; - event_bitmap |= subscribed ? 0x0020 : 0x0; - event->events = cpu_to_le16(event_bitmap); - - lbs_queue_cmd(adapter, pcmdnode, 1); - wake_up_interruptible(&priv->waitq); - - /* Sleep until response is generated by FW */ - wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); - - pcmdptr = response_buf; - - if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __func__, - le16_to_cpu(pcmdptr->result)); - kfree(response_buf); - free_page(addr); - return 0; - } - if (pcmdptr->command != cpu_to_le16(CMD_RET(CMD_802_11_SUBSCRIBE_EVENT))) { - lbs_pr_err("command response incorrect!\n"); - kfree(response_buf); - free_page(addr); - return 0; - } - res = count; -out_unlock: - free_page(addr); - return res; -} static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) @@ -1911,4 +1211,3 @@ static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev) &lbs_debug_fops); } #endif - diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 256cac2050c..6b8932a003a 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -180,6 +180,14 @@ #define CMD_TYPE_SHORT_PREAMBLE 0x0002 #define CMD_TYPE_LONG_PREAMBLE 0x0003 +/* Event flags for CMD_802_11_SUBSCRIBE_EVENT */ +#define CMD_SUBSCRIBE_RSSI_LOW 0x0001 +#define CMD_SUBSCRIBE_SNR_LOW 0x0002 +#define CMD_SUBSCRIBE_FAILCOUNT 0x0004 +#define CMD_SUBSCRIBE_BCNMISS 0x0008 +#define CMD_SUBSCRIBE_RSSI_HIGH 0x0010 +#define CMD_SUBSCRIBE_SNR_HIGH 0x0020 + #define TURN_ON_RF 0x01 #define RADIO_ON 0x01 #define RADIO_OFF 0x00 diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index f4a265daff2..614db6c7457 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -151,6 +151,13 @@ struct cmd_ds_802_11_reset { struct cmd_ds_802_11_subscribe_event { __le16 action; __le16 events; + + /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a + * number of TLVs. From the v5.1 manual, those TLVs would add up to + * 40 bytes. However, future firmware might add additional TLVs, so I + * bump this up a bit. + */ + u8 tlv[128]; }; /* diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h index 8a454454e2a..f0d57958b34 100644 --- a/drivers/net/wireless/libertas/types.h +++ b/drivers/net/wireless/libertas/types.h @@ -201,22 +201,11 @@ struct mrvlietypes_powercapability { s8 maxpower; } __attribute__ ((packed)); -struct mrvlietypes_rssithreshold { +/* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */ +struct mrvlietypes_thresholds { struct mrvlietypesheader header; - u8 rssivalue; - u8 rssifreq; -} __attribute__ ((packed)); - -struct mrvlietypes_snrthreshold { - struct mrvlietypesheader header; - u8 snrvalue; - u8 snrfreq; -} __attribute__ ((packed)); - -struct mrvlietypes_failurecount { - struct mrvlietypesheader header; - u8 failvalue; - u8 Failfreq; + u8 value; + u8 freq; } __attribute__ ((packed)); struct mrvlietypes_beaconsmissed { -- cgit v1.2.3 From 91843463bc4ca5eb2be4b8b5c5efd474e0c56283 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 28 Nov 2007 14:05:02 +0100 Subject: libertas: tweak association debug output Change debug output codes from LBS_DEB_JOIN to LBS_DEB_ASSOC Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 9 +++--- drivers/net/wireless/libertas/cmdresp.c | 7 +---- drivers/net/wireless/libertas/join.c | 55 ++++++++++++++------------------- 3 files changed, 28 insertions(+), 43 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index b529e54151d..88da68ee0f0 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -638,20 +638,19 @@ void lbs_association_worker(struct work_struct *work) ret = assoc_helper_associate(priv, assoc_req); if (ret) { - lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n", + lbs_deb_assoc("ASSOC: association unsuccessful: %d\n", ret); success = 0; } if (adapter->connect_status != LBS_CONNECTED) { - lbs_deb_assoc("ASSOC: association attempt unsuccessful, " - "not connected.\n"); + lbs_deb_assoc("ASSOC: association unsuccessful, " + "not connected\n"); success = 0; } if (success) { - lbs_deb_assoc("ASSOC: association attempt successful. " - "Associated to '%s' (%s)\n", + lbs_deb_assoc("ASSOC: associated to '%s', %s\n", escape_essid(adapter->curbssparams.ssid, adapter->curbssparams.ssid_len), print_mac(mac, adapter->curbssparams.bssid)); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 87b5bd2988e..5165c91897a 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -31,7 +31,7 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) if (adapter->connect_status != LBS_CONNECTED) return; - lbs_deb_enter(LBS_DEB_CMD); + lbs_deb_enter(LBS_DEB_ASSOC); memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; @@ -60,11 +60,6 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); adapter->nextSNRNF = 0; adapter->numSNRNF = 0; - lbs_deb_cmd("current SSID '%s', length %u\n", - escape_essid(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len), - adapter->curbssparams.ssid_len); - adapter->connect_status = LBS_DISCONNECTED; /* Clear out associated SSID and BSSID since connection is diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index d80b6e05e27..1550e6afb05 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -57,7 +57,7 @@ static int get_common_rates(struct lbs_adapter *adapter, lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); - lbs_deb_join("Tx datarate is currently 0x%X\n", adapter->cur_rate); + lbs_deb_join("TX data rate 0x%02x\n", adapter->cur_rate); if (!adapter->auto_rate) { for (i = 0; i < tmp_size; i++) { @@ -128,7 +128,7 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) struct lbs_adapter *adapter = priv->adapter; int ret; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, @@ -150,7 +150,7 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } @@ -324,7 +324,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv, memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); - lbs_deb_join("AUTH_CMD: BSSID is : %s auth=0x%X\n", + lbs_deb_join("AUTH_CMD: BSSID %s, auth 0x%x\n", print_mac(mac, bssid), pauthenticate->authtype); ret = 0; @@ -372,7 +372,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, struct mrvlietypes_ratesparamset *rates; struct mrvlietypes_rsnparamset *rsn; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); pos = (u8 *) passo; @@ -426,7 +426,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, } pos += sizeof(rates->header) + tmplen; rates->header.len = cpu_to_le16(tmplen); - lbs_deb_join("ASSOC_CMD: num rates = %u\n", tmplen); + lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen); /* Copy the infra. association rates into Current BSS state structure */ memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); @@ -464,11 +464,10 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, if (bss->mode == IW_MODE_INFRA) tmpcap |= WLAN_CAPABILITY_ESS; passo->capability = cpu_to_le16(tmpcap); - lbs_deb_join("ASSOC_CMD: capability=%4X CAPINFO_MASK=%4X\n", - tmpcap, CAPINFO_MASK); + lbs_deb_assoc("ASSOC_CMD: capability 0x%04x\n", tmpcap); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } @@ -708,10 +707,10 @@ int lbs_ret_80211_associate(struct lbs_private *priv, struct bss_descriptor * bss; u16 status_code; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); if (!adapter->in_progress_assoc_req) { - lbs_deb_join("ASSOC_RESP: no in-progress association request\n"); + lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n"); ret = -1; goto done; } @@ -740,30 +739,25 @@ int lbs_ret_80211_associate(struct lbs_private *priv, status_code = le16_to_cpu(passocrsp->statuscode); switch (status_code) { case 0x00: - lbs_deb_join("ASSOC_RESP: Association succeeded\n"); break; case 0x01: - lbs_deb_join("ASSOC_RESP: Association failed; invalid " - "parameters (status code %d)\n", status_code); + lbs_deb_assoc("ASSOC_RESP: invalid parameters\n"); break; case 0x02: - lbs_deb_join("ASSOC_RESP: Association failed; internal timer " - "expired while waiting for the AP (status code %d)" - "\n", status_code); + lbs_deb_assoc("ASSOC_RESP: internal timer " + "expired while waiting for the AP\n"); break; case 0x03: - lbs_deb_join("ASSOC_RESP: Association failed; association " - "was refused by the AP (status code %d)\n", - status_code); + lbs_deb_assoc("ASSOC_RESP: association " + "refused by AP\n"); break; case 0x04: - lbs_deb_join("ASSOC_RESP: Association failed; authentication " - "was refused by the AP (status code %d)\n", - status_code); + lbs_deb_assoc("ASSOC_RESP: authentication " + "refused by AP\n"); break; default: - lbs_deb_join("ASSOC_RESP: Association failed; reason unknown " - "(status code %d)\n", status_code); + lbs_deb_assoc("ASSOC_RESP: failure reason 0x%02x " + " unknown\n", status_code); break; } @@ -773,22 +767,19 @@ int lbs_ret_80211_associate(struct lbs_private *priv, goto done; } - lbs_deb_hex(LBS_DEB_JOIN, "ASSOC_RESP", (void *)&resp->params, + lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_RESP", (void *)&resp->params, le16_to_cpu(resp->size) - S_DS_GEN); /* Send a Media Connected event, according to the Spec */ adapter->connect_status = LBS_CONNECTED; - lbs_deb_join("ASSOC_RESP: assocated to '%s'\n", - escape_essid(bss->ssid, bss->ssid_len)); - /* Update current SSID and BSSID */ memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); adapter->curbssparams.ssid_len = bss->ssid_len; memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); - lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", - adapter->currentpacketfilter); + lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n", + adapter->currentpacketfilter); adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; adapter->NF[TYPE_RXPD][TYPE_AVG] = 0; @@ -807,7 +798,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv, wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } -- cgit v1.2.3 From 01affb653077d8581552d566276b405237636e5c Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 28 Nov 2007 14:08:12 +0100 Subject: libertas: tweak tx path debugging Make two functions in the TX packet path emit their debug messages with LBS_DEB_TX, not LBS_DEB_MAIN. Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index a3957698edb..67b6d7959e1 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -521,7 +521,7 @@ static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) int ret = 0; struct lbs_private *priv = dev->priv; - lbs_deb_enter(LBS_DEB_NET); + lbs_deb_enter(LBS_DEB_TX); if (priv->dnld_sent || priv->adapter->TxLockFlag) { priv->stats.tx_dropped++; @@ -535,7 +535,7 @@ static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (lbs_process_tx(priv, skb) == 0) dev->trans_start = jiffies; done: - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); return ret; } @@ -571,7 +571,7 @@ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) struct lbs_private *priv = dev->priv; int ret; - lbs_deb_enter(LBS_DEB_NET); + lbs_deb_enter(LBS_DEB_TX); if (priv->adapter->monitormode != LBS_MONITOR_OFF) { netif_stop_queue(dev); @@ -581,7 +581,7 @@ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) UNSET_MESH_FRAME(skb); ret = lbs_hard_start_xmit(skb, dev); - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); return ret; } -- cgit v1.2.3 From dd1d12dabfeb123881b0c813d0b7d3585312bacd Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 28 Nov 2007 17:29:36 +0100 Subject: libertas: remove numprobes Remove the ability to specify number of probes via debugfs Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/README | 21 ++++++++++----------- drivers/net/wireless/libertas/debugfs.c | 18 ------------------ drivers/net/wireless/libertas/scan.c | 20 +------------------- drivers/net/wireless/libertas/scan.h | 5 ----- 4 files changed, 11 insertions(+), 53 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README index 0b133ce6380..05cfc29e43c 100644 --- a/drivers/net/wireless/libertas/README +++ b/drivers/net/wireless/libertas/README @@ -201,15 +201,14 @@ setuserscan ssid="[SSID]" specify a SSID filter for the scan keep=[0 or 1] keep the previous scan results (1), discard (0) dur=[scan time] time to scan for each channel in milliseconds - probes=[#] number of probe requests to send on each chan type=[1,2,3] BSS type: 1 (Infra), 2(Adhoc), 3(Any) - Any combination of the above arguments can be supplied on the command line. - If the chan token is absent, a full channel scan will be completed by - the driver. If the dur or probes tokens are absent, the driver default - setting will be used. The bssid and ssid fields, if blank, - will produce an unfiltered scan. The type field will default to 3 (Any) - and the keep field will default to 0 (Discard). + Any combination of the above arguments can be supplied on the command + line. If the chan token is absent, a full channel scan will be + completed by the driver. If dur tokens are absent, the driver default + setting will be used. The bssid and ssid fields, if blank, will + produce an unfiltered scan. The type field will default to 3 (Any) and + the keep field will default to 0 (Discard). Examples: 1) Perform an active scan on channels 1, 6, and 11 in the 'g' band: @@ -230,10 +229,10 @@ setuserscan the current scan table intact, update existing or append new scan data: echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan - 6) Scan channel 6, for all infrastructure networks, sending two probe - requests. Keep the previous scan table intact. Update any duplicate - BSSID/SSID matches with the new scan data: - echo "chan=6g type=1 probes=2 keep=1" > setuserscan + 6) Scan channel 6, for all infrastructure networks. + Keep the previous scan table intact. Update any duplicate BSSID/SSID + matches with the new scan data: + echo "chan=6g type=1 keep=1" > setuserscan All entries in the scan table (not just the new scan data when keep=1) will be displayed upon completion by use of the getscantable ioctl. diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index de768de4584..e79236cfdbc 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -300,23 +300,6 @@ static int lbs_parse_dur(char *buf, size_t count, return val; } -static void lbs_parse_probes(char *buf, size_t count, - struct lbs_ioctl_user_scan_cfg *scan_cfg) -{ - char *hold; - int val; - - hold = strstr(buf, "probes="); - if (!hold) - return; - hold += 7; - sscanf(hold, "%d", &val); - - scan_cfg->numprobes = val; - - return; -} - static void lbs_parse_type(char *buf, size_t count, struct lbs_ioctl_user_scan_cfg *scan_cfg) { @@ -368,7 +351,6 @@ static ssize_t lbs_setuserscan(struct file *file, scan_cfg->clear_bssid = lbs_parse_clear(buf, count, "clear_bssid="); lbs_parse_ssid(buf, count, scan_cfg); scan_cfg->clear_ssid = lbs_parse_clear(buf, count, "clear_ssid="); - lbs_parse_probes(buf, count, scan_cfg); lbs_parse_type(buf, count, scan_cfg); lbs_scan_networks(priv, scan_cfg, 1); diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 4e465bb4fd6..de9c548cb6a 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -41,7 +41,6 @@ //! Maximum memory needed for a lbs_scan_cmd_config with all TLVs at max #define MAX_SCAN_CFG_ALLOC (sizeof(struct lbs_scan_cmd_config) \ - + sizeof(struct mrvlietypes_numprobes) \ + CHAN_TLV_MAX_SIZE \ + SSID_TLV_MAX_SIZE) @@ -385,7 +384,6 @@ void lbs_scan_worker(struct work_struct *work) * - channel list * * If the SSID or BSSID filter is not present, disable/clear the filter. - * If the number of probes is not set, use the adapter default setting * Qualify the channel * * @param priv A pointer to struct lbs_private structure @@ -415,11 +413,9 @@ lbs_scan_setup_scan_config(struct lbs_private *priv, u8 * pfilteredscan, u8 * pscancurrentonly) { - struct mrvlietypes_numprobes *pnumprobestlv; struct mrvlietypes_ssidparamset *pssidtlv; struct lbs_scan_cmd_config *pscancfgout = NULL; u8 *ptlvpos; - u16 numprobes; int chanidx; int scantype; int scandur; @@ -468,9 +464,6 @@ lbs_scan_setup_scan_config(struct lbs_private *priv, pscancfgout->bsstype = puserscanin->bsstype ? puserscanin->bsstype : CMD_BSS_TYPE_ANY; - /* Set the number of probes to send, use adapter setting if unset */ - numprobes = puserscanin->numprobes ? puserscanin->numprobes : 0; - /* * Set the BSSID filter to the incoming configuration, * if non-zero. If not set, it will remain disabled (all zeros). @@ -502,22 +495,11 @@ lbs_scan_setup_scan_config(struct lbs_private *priv, } } else { pscancfgout->bsstype = CMD_BSS_TYPE_ANY; - numprobes = 0; - } - - /* If the input config or adapter has the number of Probes set, add tlv */ - if (numprobes) { - pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; - pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES); - pnumprobestlv->header.len = cpu_to_le16(2); - pnumprobestlv->numprobes = cpu_to_le16(numprobes); - - ptlvpos += sizeof(*pnumprobestlv); } /* * Set the output for the channel TLV to the address in the tlv buffer - * past any TLVs that were added in this fuction (SSID, numprobes). + * past any TLVs that were added in this fuction (SSID). * channel TLVs will be added past this for each scan command, preserving * the TLVs that were previously added. */ diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index b2314481467..e420cd9217c 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h @@ -105,11 +105,6 @@ struct lbs_ioctl_user_scan_cfg { */ u8 bsstype; - /** - * @brief Configure the number of probe requests for active chan scans - */ - u8 numprobes; - /** * @brief BSSID filter sent in the firmware command to limit the results */ -- cgit v1.2.3 From a7d0adae40d0effc1484261a66fb703eb7e840b5 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 28 Nov 2007 17:30:21 +0100 Subject: libertas: remove user-specified channel list Remove the ability to specify channels to scan via debugfs Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/README | 33 ++++++------------ drivers/net/wireless/libertas/debugfs.c | 38 --------------------- drivers/net/wireless/libertas/scan.c | 59 ++------------------------------- drivers/net/wireless/libertas/scan.h | 5 --- 4 files changed, 13 insertions(+), 122 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README index 05cfc29e43c..d860fc37575 100644 --- a/drivers/net/wireless/libertas/README +++ b/drivers/net/wireless/libertas/README @@ -195,8 +195,6 @@ setuserscan where [ARGS]: - chan=[chan#][band][mode] where band is [a,b,g] and mode is - blank for active or 'p' for passive bssid=xx:xx:xx:xx:xx:xx specify a BSSID filter for the scan ssid="[SSID]" specify a SSID filter for the scan keep=[0 or 1] keep the previous scan results (1), discard (0) @@ -204,35 +202,26 @@ setuserscan type=[1,2,3] BSS type: 1 (Infra), 2(Adhoc), 3(Any) Any combination of the above arguments can be supplied on the command - line. If the chan token is absent, a full channel scan will be - completed by the driver. If dur tokens are absent, the driver default - setting will be used. The bssid and ssid fields, if blank, will - produce an unfiltered scan. The type field will default to 3 (Any) and - the keep field will default to 0 (Discard). + line. If dur tokens are absent, the driver default setting will be used. + The bssid and ssid fields, if blank, will produce an unfiltered scan. + The type field will default to 3 (Any) and the keep field will default + to 0 (Discard). Examples: - 1) Perform an active scan on channels 1, 6, and 11 in the 'g' band: - echo "chan=1g,6g,11g" > setuserscan + 1) Perform a passive scan on all channels for 20 ms per channel: + echo "dur=20" > setuserscan - 2) Perform a passive scan on channel 11 for 20 ms: - echo "chan=11gp dur=20" > setuserscan + 2) Perform an active scan for a specific SSID: + echo "ssid="TestAP"" > setuserscan - 3) Perform an active scan on channels 1, 6, and 11; and a passive scan on - channel 36 in the 'a' band: - - echo "chan=1g,6g,11g,36ap" > setuserscan - - 4) Perform an active scan on channel 6 and 36 for a specific SSID: - echo "chan=6g,36a ssid="TestAP"" > setuserscan - - 5) Scan all available channels (B/G, A bands) for a specific BSSID, keep + 3) Scan all available channels (B/G, A bands) for a specific BSSID, keep the current scan table intact, update existing or append new scan data: echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan - 6) Scan channel 6, for all infrastructure networks. + 4) Scan for all infrastructure networks. Keep the previous scan table intact. Update any duplicate BSSID/SSID matches with the new scan data: - echo "chan=6g type=1 keep=1" > setuserscan + echo "type=1 keep=1" > setuserscan All entries in the scan table (not just the new scan data when keep=1) will be displayed upon completion by use of the getscantable ioctl. diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index e79236cfdbc..d3a47cc9547 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -196,43 +196,6 @@ out_unlock: return count; } -static int lbs_parse_chan(char *buf, size_t count, - struct lbs_ioctl_user_scan_cfg *scan_cfg, int dur) -{ - char *start, *end, *hold, *str; - int i = 0; - - start = strstr(buf, "chan="); - if (!start) - return -EINVAL; - start += 5; - end = strchr(start, ' '); - if (!end) - end = buf + count; - hold = kzalloc((end - start)+1, GFP_KERNEL); - if (!hold) - return -ENOMEM; - strncpy(hold, start, end - start); - hold[(end-start)+1] = '\0'; - while(hold && (str = strsep(&hold, ","))) { - int chan; - char band, passive = 0; - sscanf(str, "%d%c%c", &chan, &band, &passive); - scan_cfg->chanlist[i].channumber = chan; - scan_cfg->chanlist[i].scantype = passive ? 1 : 0; - if (band == 'b' || band == 'g') - scan_cfg->chanlist[i].radiotype = 0; - else if (band == 'a') - scan_cfg->chanlist[i].radiotype = 1; - - scan_cfg->chanlist[i].scantime = dur; - i++; - } - - kfree(hold); - return i; -} - static void lbs_parse_bssid(char *buf, size_t count, struct lbs_ioctl_user_scan_cfg *scan_cfg) { @@ -346,7 +309,6 @@ static ssize_t lbs_setuserscan(struct file *file, scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY; dur = lbs_parse_dur(buf, count, scan_cfg); - lbs_parse_chan(buf, count, scan_cfg, dur); lbs_parse_bssid(buf, count, scan_cfg); scan_cfg->clear_bssid = lbs_parse_clear(buf, count, "clear_bssid="); lbs_parse_ssid(buf, count, scan_cfg); diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index de9c548cb6a..236bc7daf4d 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -416,11 +416,6 @@ lbs_scan_setup_scan_config(struct lbs_private *priv, struct mrvlietypes_ssidparamset *pssidtlv; struct lbs_scan_cmd_config *pscancfgout = NULL; u8 *ptlvpos; - int chanidx; - int scantype; - int scandur; - int channel; - int radiotype; lbs_deb_enter(LBS_DEB_SCAN); @@ -505,58 +500,8 @@ lbs_scan_setup_scan_config(struct lbs_private *priv, */ *ppchantlvout = (struct mrvlietypes_chanlistparamset *) ptlvpos; - if (!puserscanin || !puserscanin->chanlist[0].channumber) { - /* Create a default channel scan list */ - lbs_deb_scan("creating full region channel list\n"); - lbs_scan_create_channel_list(priv, pscanchanlist, - *pfilteredscan); - goto out; - } - - for (chanidx = 0; - chanidx < LBS_IOCTL_USER_SCAN_CHAN_MAX - && puserscanin->chanlist[chanidx].channumber; chanidx++) { - - channel = puserscanin->chanlist[chanidx].channumber; - (pscanchanlist + chanidx)->channumber = channel; - - radiotype = puserscanin->chanlist[chanidx].radiotype; - (pscanchanlist + chanidx)->radiotype = radiotype; - - scantype = puserscanin->chanlist[chanidx].scantype; - - if (scantype == CMD_SCAN_TYPE_PASSIVE) { - (pscanchanlist + - chanidx)->chanscanmode.passivescan = 1; - } else { - (pscanchanlist + - chanidx)->chanscanmode.passivescan = 0; - } - - if (puserscanin->chanlist[chanidx].scantime) { - scandur = puserscanin->chanlist[chanidx].scantime; - } else { - if (scantype == CMD_SCAN_TYPE_PASSIVE) { - scandur = MRVDRV_PASSIVE_SCAN_CHAN_TIME; - } else { - scandur = MRVDRV_ACTIVE_SCAN_CHAN_TIME; - } - } - - (pscanchanlist + chanidx)->minscantime = - cpu_to_le16(scandur); - (pscanchanlist + chanidx)->maxscantime = - cpu_to_le16(scandur); - } - - /* Check if we are only scanning the current channel */ - if ((chanidx == 1) && - (puserscanin->chanlist[0].channumber == - priv->adapter->curbssparams.channel)) { - *pscancurrentonly = 1; - lbs_deb_scan("scanning current channel only"); - } - + lbs_scan_create_channel_list(priv, pscanchanlist, + *pfilteredscan); out: return pscancfgout; } diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index e420cd9217c..9b62e2b01f6 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h @@ -121,11 +121,6 @@ struct lbs_ioctl_user_scan_cfg { /* Clear existing scan results matching this SSID */ u8 clear_ssid; - - /** - * @brief Variable number (fixed maximum) of channels to scan up - */ - struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX]; }; /** -- cgit v1.2.3 From 0b3c07ff6467e6055ca3dd2239494ada96303274 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 28 Nov 2007 09:15:11 +0100 Subject: libertas: less eventcause shifts * only shift eventcause once * convert mac events to decimal, as this is what the firmware manual uses in section 6.1, too Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 11 ++++--- drivers/net/wireless/libertas/host.h | 52 +++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 28 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 5165c91897a..90f1c4974fa 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -916,12 +916,12 @@ int lbs_process_event(struct lbs_private *priv) lbs_deb_enter(LBS_DEB_CMD); spin_lock_irq(&adapter->driver_lock); - eventcause = adapter->eventcause; + eventcause = adapter->eventcause >> SBI_EVENT_CAUSE_SHIFT; spin_unlock_irq(&adapter->driver_lock); - lbs_deb_cmd("event cause 0x%x\n", eventcause); + lbs_deb_cmd("event cause %d\n", eventcause); - switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { + switch (eventcause) { case MACREG_INT_CODE_LINK_SENSED: lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n"); break; @@ -936,7 +936,7 @@ int lbs_process_event(struct lbs_private *priv) lbs_mac_event_disconnected(priv); break; - case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: + case MACREG_INT_CODE_LINK_LOST_NO_SCAN: lbs_deb_cmd("EVENT: link lost\n"); lbs_mac_event_disconnected(priv); break; @@ -1030,8 +1030,7 @@ int lbs_process_event(struct lbs_private *priv) break; default: - lbs_pr_alert("EVENT: unknown event id 0x%04x\n", - eventcause >> SBI_EVENT_CAUSE_SHIFT); + lbs_pr_alert("EVENT: unknown event id %d\n", eventcause); break; } diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 6b8932a003a..4828bbf6639 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -274,27 +274,35 @@ enum cmd_mesh_access_opts { }; /** Card Event definition */ -#define MACREG_INT_CODE_TX_PPA_FREE 0x00000000 -#define MACREG_INT_CODE_TX_DMA_DONE 0x00000001 -#define MACREG_INT_CODE_LINK_LOSE_W_SCAN 0x00000002 -#define MACREG_INT_CODE_LINK_LOSE_NO_SCAN 0x00000003 -#define MACREG_INT_CODE_LINK_SENSED 0x00000004 -#define MACREG_INT_CODE_CMD_FINISHED 0x00000005 -#define MACREG_INT_CODE_MIB_CHANGED 0x00000006 -#define MACREG_INT_CODE_INIT_DONE 0x00000007 -#define MACREG_INT_CODE_DEAUTHENTICATED 0x00000008 -#define MACREG_INT_CODE_DISASSOCIATED 0x00000009 -#define MACREG_INT_CODE_PS_AWAKE 0x0000000a -#define MACREG_INT_CODE_PS_SLEEP 0x0000000b -#define MACREG_INT_CODE_MIC_ERR_MULTICAST 0x0000000d -#define MACREG_INT_CODE_MIC_ERR_UNICAST 0x0000000e -#define MACREG_INT_CODE_WM_AWAKE 0x0000000f -#define MACREG_INT_CODE_ADHOC_BCN_LOST 0x00000011 -#define MACREG_INT_CODE_RSSI_LOW 0x00000019 -#define MACREG_INT_CODE_SNR_LOW 0x0000001a -#define MACREG_INT_CODE_MAX_FAIL 0x0000001b -#define MACREG_INT_CODE_RSSI_HIGH 0x0000001c -#define MACREG_INT_CODE_SNR_HIGH 0x0000001d -#define MACREG_INT_CODE_MESH_AUTO_STARTED 0x00000023 +#define MACREG_INT_CODE_TX_PPA_FREE 0 +#define MACREG_INT_CODE_TX_DMA_DONE 1 +#define MACREG_INT_CODE_LINK_LOST_W_SCAN 2 +#define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3 +#define MACREG_INT_CODE_LINK_SENSED 4 +#define MACREG_INT_CODE_CMD_FINISHED 5 +#define MACREG_INT_CODE_MIB_CHANGED 6 +#define MACREG_INT_CODE_INIT_DONE 7 +#define MACREG_INT_CODE_DEAUTHENTICATED 8 +#define MACREG_INT_CODE_DISASSOCIATED 9 +#define MACREG_INT_CODE_PS_AWAKE 10 +#define MACREG_INT_CODE_PS_SLEEP 11 +#define MACREG_INT_CODE_MIC_ERR_MULTICAST 13 +#define MACREG_INT_CODE_MIC_ERR_UNICAST 14 +#define MACREG_INT_CODE_WM_AWAKE 15 +#define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16 +#define MACREG_INT_CODE_ADHOC_BCN_LOST 17 +#define MACREG_INT_CODE_HOST_AWAKE 18 +#define MACREG_INT_CODE_STOP_TX 19 +#define MACREG_INT_CODE_START_TX 20 +#define MACREG_INT_CODE_CHANNEL_SWITCH 21 +#define MACREG_INT_CODE_MEASUREMENT_RDY 22 +#define MACREG_INT_CODE_WMM_CHANGE 23 +#define MACREG_INT_CODE_BG_SCAN_REPORT 24 +#define MACREG_INT_CODE_RSSI_LOW 25 +#define MACREG_INT_CODE_SNR_LOW 26 +#define MACREG_INT_CODE_MAX_FAIL 27 +#define MACREG_INT_CODE_RSSI_HIGH 28 +#define MACREG_INT_CODE_SNR_HIGH 29 +#define MACREG_INT_CODE_MESH_AUTO_STARTED 35 #endif -- cgit v1.2.3 From 77d8cf2c093be3b58f6deed10673d0bc8cbd4202 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 28 Nov 2007 16:20:51 +0000 Subject: libertas: Fix memory leak of RX skbs Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 4fce0baa071..c27ffcfdbe8 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -460,6 +460,8 @@ static int __if_usb_submit_rx_urb(struct usb_card_rec *cardp, if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { /* handle failure conditions */ lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n"); + kfree_skb(skb); + rinfo->skb = NULL; ret = -1; } else { /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */ @@ -667,8 +669,10 @@ static void if_usb_receive(struct urb *urb) lbs_deb_usbd(&cardp->udev->dev, "Recv length = 0x%x, Recv type = 0x%X\n", recvlength, recvtype); - } else if (urb->status) + } else if (urb->status) { + kfree_skb(skb); goto rx_exit; + } switch (recvtype) { case CMD_TYPE_DATA: -- cgit v1.2.3 From f5ece8fc8d3f5e36bda3554b74b0fbecb0a14309 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 1 Dec 2007 15:15:41 +0000 Subject: libertas: Remove cmd_oid from struct cmd_ctrl_node This is only needed for SNMP and key operations; it doesn't need to be preserved outside that context. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 9 +++------ drivers/net/wireless/libertas/decl.h | 2 +- drivers/net/wireless/libertas/hostcmd.h | 2 -- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index d98bec92474..6658590ca6e 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1231,7 +1231,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, goto done; } - lbs_set_cmd_ctrl_node(priv, cmdnode, cmd_oid, wait_option, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf); cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; @@ -1404,7 +1404,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, case CMD_802_11_INACTIVITY_TIMEOUT: ret = lbs_cmd_802_11_inactivity_timeout(priv, cmdptr, cmd_action, pdata_buf); - lbs_set_cmd_ctrl_node(priv, cmdnode, 0, 0, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, 0, pdata_buf); break; case CMD_802_11_TPC_CFG: @@ -1668,7 +1668,6 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) ptempnode->cmdwaitqwoken = 1; wake_up_interruptible(&ptempnode->cmdwait_q); ptempnode->status = 0; - ptempnode->cmd_oid = (u32) 0; ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; @@ -1683,21 +1682,19 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) * * @param priv A pointer to struct lbs_private structure * @param ptempnode A pointer to cmd_ctrl_node structure - * @param cmd_oid cmd oid: treated as sub command * @param wait_option wait option: wait response or not * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, - u32 cmd_oid, u16 wait_option, void *pdata_buf) + u16 wait_option, void *pdata_buf) { lbs_deb_enter(LBS_DEB_HOST); if (!ptempnode) return; - ptempnode->cmd_oid = cmd_oid; ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 74187f34666..447297a5e68 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -26,7 +26,7 @@ struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(struct lbs_private *priv); void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, - u32 cmd_oid, u16 wait_option, void *pdata_buf); + u16 wait_option, void *pdata_buf); int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 614db6c7457..c0291490075 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -69,8 +69,6 @@ struct cmd_ctrl_node { /* CMD link list */ struct list_head list; u32 status; - /* CMD ID */ - u32 cmd_oid; /*CMD wait option: wait for finish or no wait */ u16 wait_option; /* command parameter */ -- cgit v1.2.3 From e775ed7c677b163c80643036c32e23d3e59b9429 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 14:36:11 +0000 Subject: libertas: Consolidate lbs_host_to_card_done() function. As we move towards having this done by a state machine, start by having a single 'stuff sent' function, which is called by if_usb/if_sdio/if_cs after sending both data and commands. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/decl.h | 1 + drivers/net/wireless/libertas/if_cs.c | 12 +++--------- drivers/net/wireless/libertas/if_sdio.c | 9 +++------ drivers/net/wireless/libertas/if_usb.c | 18 ++---------------- drivers/net/wireless/libertas/main.c | 18 ++++++++++++++++++ 5 files changed, 27 insertions(+), 31 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 447297a5e68..201ec60f1dc 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -86,5 +86,6 @@ int lbs_stop_card(struct lbs_private *priv); int lbs_add_mesh(struct lbs_private *priv, struct device *dev); void lbs_remove_mesh(struct lbs_private *priv); int lbs_reset_device(struct lbs_private *priv); +void lbs_host_to_card_done(struct lbs_private *priv); #endif diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 5fadcc03eea..54b1ba3e250 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -253,19 +253,13 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) /* Not for us */ return IRQ_NONE; - } else if(int_cause == 0xffff) { + } else if (int_cause == 0xffff) { /* Read in junk, the card has probably been removed */ card->priv->adapter->surpriseremoved = 1; } else { - if(int_cause & IF_CS_H_IC_TX_OVER) { - card->priv->dnld_sent = DNLD_RES_RECEIVED; - if (!card->priv->adapter->cur_cmd) - wake_up_interruptible(&card->priv->waitq); - - if (card->priv->adapter->connect_status == LBS_CONNECTED) - netif_wake_queue(card->priv->dev); - } + if (int_cause & IF_CS_H_IC_TX_OVER) + lbs_host_to_card_done(card->priv); /* clear interrupt */ if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 7a7037bdd37..cccca311f75 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -835,12 +835,9 @@ static void if_sdio_interrupt(struct sdio_func *func) * Ignore the define name, this really means the card has * successfully received the command. */ - if (cause & IF_SDIO_H_INT_DNLD) { - if ((card->priv->dnld_sent == DNLD_DATA_SENT) && - (card->priv->adapter->connect_status == LBS_CONNECTED)) - netif_wake_queue(card->priv->dev); - card->priv->dnld_sent = DNLD_RES_RECEIVED; - } + if (cause & IF_SDIO_H_INT_DNLD) + lbs_host_to_card_done(card->priv); + if (cause & IF_SDIO_H_INT_UPLD) { ret = if_sdio_card_to_host(card); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index c27ffcfdbe8..418dcab8b1c 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -66,22 +66,8 @@ static void if_usb_write_bulk_callback(struct urb *urb) /* Used for both firmware TX and regular TX. priv isn't * valid at firmware load time. */ - if (priv) { - struct lbs_adapter *adapter = priv->adapter; - struct net_device *dev = priv->dev; - - priv->dnld_sent = DNLD_RES_RECEIVED; - - /* Wake main thread if commands are pending */ - if (!adapter->cur_cmd) - wake_up_interruptible(&priv->waitq); - - if (adapter->connect_status == LBS_CONNECTED) - netif_wake_queue(dev); - - if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) - netif_wake_queue(priv->mesh_dev); - } + if (priv) + lbs_host_to_card_done(priv); } else { /* print the failure status number for debug */ lbs_pr_info("URB in failure status: %d\n", urb->status); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 67b6d7959e1..ed02c02c96d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -616,6 +616,24 @@ static void lbs_tx_timeout(struct net_device *dev) lbs_deb_leave(LBS_DEB_TX); } +void lbs_host_to_card_done(struct lbs_private *priv) +{ + struct lbs_adapter *adapter = priv->adapter; + + priv->dnld_sent = DNLD_RES_RECEIVED; + + /* Wake main thread if commands are pending */ + if (!adapter->cur_cmd) + wake_up_interruptible(&priv->waitq); + + if (priv->dev && adapter->connect_status == LBS_CONNECTED) + netif_wake_queue(priv->dev); + + if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED) + netif_wake_queue(priv->mesh_dev); +} +EXPORT_SYMBOL_GPL(lbs_host_to_card_done); + /** * @brief This function returns the network statistics * -- cgit v1.2.3 From 891f32a1c4fe5c57f15873fa1d9fff425b30ab4d Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 5 Dec 2007 17:57:56 +0100 Subject: libertas: remove cmd_ctrl_node->cmdflags There was no code that ever did set this flag. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 7 ------- drivers/net/wireless/libertas/hostcmd.h | 1 - 2 files changed, 8 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 90f1c4974fa..cbd28ee7c5b 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -856,13 +856,6 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - if (adapter->cur_cmd->cmdflags & CMD_F_HOSTCMD) { - /* Copy the response back to response buffer */ - memcpy(adapter->cur_cmd->pdata_buf, resp, - le16_to_cpu(resp->size)); - adapter->cur_cmd->cmdflags &= ~CMD_F_HOSTCMD; - } - /* If the command is not successful, cleanup and return failure */ if ((result != 0 || !(respcmd & 0x8000))) { lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n", diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index c0291490075..217ae122fca 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -75,7 +75,6 @@ struct cmd_ctrl_node { void *pdata_buf; /*command data */ u8 *bufvirtualaddr; - u16 cmdflags; /* wait queue */ u16 cmdwaitqwoken; wait_queue_head_t cmdwait_q; -- cgit v1.2.3 From c68b3bbdb596b5f82f1f0731f6fcb210735aff39 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 5 Dec 2007 17:57:58 +0100 Subject: libertas: remove cmd_ctrl_node->status There was no code that ever did set this variable. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 1 - drivers/net/wireless/libertas/hostcmd.h | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 6658590ca6e..43dde7eec75 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1667,7 +1667,6 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) return; ptempnode->cmdwaitqwoken = 1; wake_up_interruptible(&ptempnode->cmdwait_q); - ptempnode->status = 0; ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 217ae122fca..f096d995194 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -68,7 +68,6 @@ struct rxpd { struct cmd_ctrl_node { /* CMD link list */ struct list_head list; - u32 status; /*CMD wait option: wait for finish or no wait */ u16 wait_option; /* command parameter */ -- cgit v1.2.3 From 0d61d04210b617963c202a3c4dcbcd26a024d5d3 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 5 Dec 2007 17:58:06 +0100 Subject: libertas: make more functions static These functions were used in the old debugfs code for events, but as this code is now gone, there's no need to export those functions. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 9 +++++++-- drivers/net/wireless/libertas/decl.h | 7 +------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 43dde7eec75..54ef990a46c 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -13,6 +13,11 @@ #include "wext.h" static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode); +struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); +void lbs_set_cmd_ctrl_node(struct lbs_private *priv, + struct cmd_ctrl_node *ptempnode, + u16 wait_option, void *pdata_buf); + static u16 commands_allowed_in_ps[] = { CMD_802_11_RSSI, @@ -1220,7 +1225,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, goto done; } - cmdnode = lbs_get_free_cmd_ctrl_node(priv); + cmdnode = lbs_get_cmd_ctrl_node(priv); if (cmdnode == NULL) { lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); @@ -1623,7 +1628,7 @@ done: * @param priv A pointer to struct lbs_private structure * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL */ -struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(struct lbs_private *priv) +struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) { struct cmd_ctrl_node *tempnode; struct lbs_adapter *adapter = priv->adapter; diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 201ec60f1dc..0856cc96f51 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -15,18 +15,13 @@ struct lbs_private; struct lbs_adapter; struct sk_buff; struct net_device; +struct cmd_ctrl_node; int lbs_set_mac_packet_filter(struct lbs_private *priv); void lbs_send_tx_feedback(struct lbs_private *priv); int lbs_free_cmd_buffer(struct lbs_private *priv); -struct cmd_ctrl_node; -struct cmd_ctrl_node *lbs_get_free_cmd_ctrl_node(struct lbs_private *priv); - -void lbs_set_cmd_ctrl_node(struct lbs_private *priv, - struct cmd_ctrl_node *ptempnode, - u16 wait_option, void *pdata_buf); int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, -- cgit v1.2.3 From 675787e29fd97d08bf7e6253c89ab6de23bf7089 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 5 Dec 2007 17:58:11 +0100 Subject: libertas: handy function to call firmware commands Using an arbitrary firmware command was actually very painful. One had to change big switch() statements in cmd.c, cmdresp.c, add structs to the big union in "struct cmd_ds_command" and add the define for the CMD_802_11_xxx to the proper place. With this function, this is now much easier. For now, it implements a blocking (a.k.a. CMD_OPTION_WAITFORRSP) way where one deals directly with command requests and response buffers. You can do everything in one place: Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 96 +++++++++++++++++++++++++++++++++ drivers/net/wireless/libertas/cmdresp.c | 23 +++++--- drivers/net/wireless/libertas/decl.h | 6 +++ drivers/net/wireless/libertas/hostcmd.h | 11 ++-- 4 files changed, 126 insertions(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 54ef990a46c..9064513aea0 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -2007,3 +2007,99 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) lbs_deb_leave(LBS_DEB_HOST); } + + +/** + * @brief Simple way to call firmware functions + * + * @param priv A pointer to struct lbs_private structure + * @param psmode one of the many CMD_802_11_xxxx + * @param cmd pointer to the parameters structure for above command + * (this should not include the command, size, sequence + * and result fields from struct cmd_ds_gen) + * @param cmd_size size structure pointed to by cmd + * @param rsp pointer to an area where the result should be placed + * @param rsp_size pointer to the size of the rsp area. If the firmware + * returns fewer bytes, then this *rsp_size will be + * changed to the actual size. + * @return -1 in case of a higher level error, otherwise + * the result code from the firmware + */ +int lbs_cmd(struct lbs_private *priv, + u16 command, + void *cmd, int cmd_size, + void *rsp, int *rsp_size) +{ + struct lbs_adapter *adapter = priv->adapter; + struct cmd_ctrl_node *cmdnode; + struct cmd_ds_gen *cmdptr; + unsigned long flags; + int ret = 0; + + lbs_deb_enter(LBS_DEB_HOST); + lbs_deb_host("rsp at %p, rsp_size at %p\n", rsp, rsp_size); + + if (!adapter || !rsp_size) { + lbs_deb_host("PREP_CMD: adapter is NULL\n"); + ret = -1; + goto done; + } + + if (adapter->surpriseremoved) { + lbs_deb_host("PREP_CMD: card removed\n"); + ret = -1; + goto done; + } + + cmdnode = lbs_get_cmd_ctrl_node(priv); + + if (cmdnode == NULL) { + lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); + + /* Wake up main thread to execute next command */ + wake_up_interruptible(&priv->waitq); + ret = -1; + goto done; + } + + cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; + cmdnode->wait_option = CMD_OPTION_WAITFORRSP; + cmdnode->pdata_buf = rsp; + cmdnode->pdata_size = rsp_size; + + /* Set sequence number, clean result, move to buffer */ + adapter->seqnum++; + cmdptr->command = cpu_to_le16(command); + cmdptr->size = cmd_size + S_DS_GEN; + cmdptr->seqnum = cpu_to_le16(adapter->seqnum); + cmdptr->result = 0; + memcpy(cmdptr->cmdresp, cmd, cmd_size); + + lbs_deb_host("PREP_CMD: command 0x%04x\n", command); + + /* here was the big old switch() statement, which is now obsolete, + * because the caller of lbs_cmd() sets up all of *cmd for us. */ + + cmdnode->cmdwaitqwoken = 0; + lbs_queue_cmd(adapter, cmdnode, 1); + wake_up_interruptible(&priv->waitq); + + might_sleep(); + wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); + + spin_lock_irqsave(&adapter->driver_lock, flags); + if (adapter->cur_cmd_retcode) { + lbs_deb_host("PREP_CMD: command failed with return code %d\n", + adapter->cur_cmd_retcode); + adapter->cur_cmd_retcode = 0; + ret = -1; + } + spin_unlock_irqrestore(&adapter->driver_lock, flags); + +done: + lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); + return ret; +} +EXPORT_SYMBOL_GPL(lbs_cmd); + + diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index cbd28ee7c5b..6a43de772aa 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -799,7 +799,7 @@ int lbs_process_rx_command(struct lbs_private *priv) } /* Store the response code to cur_cmd_retcode. */ - adapter->cur_cmd_retcode = result;; + adapter->cur_cmd_retcode = result; if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; @@ -880,11 +880,22 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); - - ret = handle_cmd_response(respcmd, resp, priv); - - spin_lock_irqsave(&adapter->driver_lock, flags); + if (adapter->cur_cmd->pdata_size) { + struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; + u16 sz = cpu_to_le16(resp->size); + if (sz > *adapter->cur_cmd->pdata_size) { + lbs_pr_err("response 0x%04x doesn't fit into " + "buffer (%d > %d)\n", respcmd, + sz, *adapter->cur_cmd->pdata_size); + sz = *adapter->cur_cmd->pdata_size; + } + memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz); + *adapter->cur_cmd->pdata_size = sz; + } else { + spin_unlock_irqrestore(&adapter->driver_lock, flags); + ret = handle_cmd_response(respcmd, resp, priv); + spin_lock_irqsave(&adapter->driver_lock, flags); + } if (adapter->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 0856cc96f51..6f47ff08962 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -16,6 +16,7 @@ struct lbs_adapter; struct sk_buff; struct net_device; struct cmd_ctrl_node; +struct cmd_ds_command; int lbs_set_mac_packet_filter(struct lbs_private *priv); @@ -23,6 +24,11 @@ void lbs_send_tx_feedback(struct lbs_private *priv); int lbs_free_cmd_buffer(struct lbs_private *priv); +int lbs_cmd(struct lbs_private *priv, + u16 command, + void *cmd, int cmd_size, + void *resp, int *resp_size); + int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, u16 cmd_action, diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index f096d995194..be69ae65292 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -66,13 +66,13 @@ struct rxpd { }; struct cmd_ctrl_node { - /* CMD link list */ struct list_head list; - /*CMD wait option: wait for finish or no wait */ + /* wait for finish or not */ u16 wait_option; - /* command parameter */ + /* command response */ void *pdata_buf; - /*command data */ + int *pdata_size; + /* command data */ u8 *bufvirtualaddr; /* wait queue */ u16 cmdwaitqwoken; @@ -100,9 +100,12 @@ struct cmd_ds_gen { __le16 size; __le16 seqnum; __le16 result; + void *cmdresp[0]; }; #define S_DS_GEN sizeof(struct cmd_ds_gen) + + /* * Define data structure for CMD_GET_HW_SPEC * This structure defines the response for the GET_HW_SPEC command -- cgit v1.2.3 From 9088566176cb7f7361e862557eb20adfdd1bfc1f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 10:36:08 +0000 Subject: libertas: Don't claim to have checksummed incoming packets. This explains why we never noticed the corruption of checksums on outgoing packets... we weren't actually checking them either. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index fa467dfef00..a252a8f74be 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -147,7 +147,7 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) else skb->protocol = eth_type_trans(skb, priv->dev); } - skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->ip_summed = CHECKSUM_NONE; netif_rx(skb); } -- cgit v1.2.3 From 2c94404c30008a10ccd3c7e31645626eb90a8a06 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 14:41:08 +0000 Subject: libertas: Move SET_BOOT2_VER command to if_usb where it belongs This is meaningless for non-USB devices and unimplemented in their firmware. It's somewhat dubious for USB devices too, but that's a different story. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 5 +++++ drivers/net/wireless/libertas/main.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 418dcab8b1c..f8589283d7b 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -222,6 +222,11 @@ static int if_usb_probe(struct usb_interface *intf, if (lbs_start_card(priv)) goto err_start_card; + /* Set the boot2 version in firmware, ignoring errors. */ + (void)lbs_prepare_and_send_command(priv, CMD_SET_BOOT2_VER, + 0, CMD_OPTION_WAITFORRSP, 0, NULL); + + usb_get_dev(udev); usb_set_intfdata(intf, cardp); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index ed02c02c96d..a5b573ce545 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -999,10 +999,6 @@ static int lbs_setup_firmware(struct lbs_private *priv) priv->mesh_autostart_enabled = 0; } - /* Set the boot2 version in firmware */ - ret = lbs_prepare_and_send_command(priv, CMD_SET_BOOT2_VER, - 0, CMD_OPTION_WAITFORRSP, 0, NULL); - ret = 0; done: lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); -- cgit v1.2.3 From ad9de29130599d4be3467932643797da3b9869f6 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 12:37:31 +0000 Subject: libertas: Zero 'pdata_size' field in cmd_ctrl_node reliably. Otherwise, lbs_process_rx_command() will take the new path for lbs_cmd() responses, when it shouldn't. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 9064513aea0..4fc3e4b56d0 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1674,6 +1674,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) wake_up_interruptible(&ptempnode->cmdwait_q); ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; + ptempnode->pdata_size = 0; if (ptempnode->bufvirtualaddr != NULL) memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); @@ -1701,6 +1702,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; + ptempnode->pdata_size = 0; lbs_deb_leave(LBS_DEB_HOST); } -- cgit v1.2.3 From 6228c0aea544f5292977e6b27cd231a4ea137a62 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 12:38:31 +0000 Subject: libertas: Byteswap cmdptr->size in lbs_cmd() Bad Holger. Always test on big-endian machines, if it's little-endian you need to be swapping to/from. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4fc3e4b56d0..7097dcf7abc 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -2072,7 +2072,7 @@ int lbs_cmd(struct lbs_private *priv, /* Set sequence number, clean result, move to buffer */ adapter->seqnum++; cmdptr->command = cpu_to_le16(command); - cmdptr->size = cmd_size + S_DS_GEN; + cmdptr->size = cpu_to_le16(cmd_size + S_DS_GEN); cmdptr->seqnum = cpu_to_le16(adapter->seqnum); cmdptr->result = 0; memcpy(cmdptr->cmdresp, cmd, cmd_size); -- cgit v1.2.3 From abe3ed14d39adcea9ae186cf741b15d11544458f Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Thu, 6 Dec 2007 13:01:21 +0100 Subject: libertas: don't cast a pointer to pointer of Don't cast struct foo * to struct list_head *, it's safe only when the list member is the first member of struct foo. Also don't cast struct list_head * to struct foo *. Signed-off-by: Li Zefan Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 7097dcf7abc..851eb3ce3e1 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1021,11 +1021,10 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, spin_lock_irqsave(&adapter->driver_lock, flags); if (addtail) { - list_add_tail((struct list_head *)cmdnode, - &adapter->cmdpendingq); + list_add_tail(&cmdnode->list, &adapter->cmdpendingq); adapter->nr_cmd_pending++; } else - list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); + list_add(&cmdnode->list, &adapter->cmdpendingq); spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -1144,7 +1143,7 @@ void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, return; cleanup_cmdnode(ptempcmd); - list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); + list_add_tail(&ptempcmd->list, &adapter->cmdfreeq); } static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, @@ -1642,8 +1641,9 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) spin_lock_irqsave(&adapter->driver_lock, flags); if (!list_empty(&adapter->cmdfreeq)) { - tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; - list_del((struct list_head *)tempnode); + tempnode = list_first_entry(&adapter->cmdfreeq, + struct cmd_ctrl_node, list); + list_del(&tempnode->list); } else { lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); tempnode = NULL; @@ -1738,8 +1738,8 @@ int lbs_execute_next_command(struct lbs_private *priv) } if (!list_empty(&adapter->cmdpendingq)) { - cmdnode = (struct cmd_ctrl_node *) - adapter->cmdpendingq.next; + cmdnode = list_first_entry(&adapter->cmdpendingq, + struct cmd_ctrl_node, list); } spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -1803,7 +1803,7 @@ int lbs_execute_next_command(struct lbs_private *priv) cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { lbs_deb_host( "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); - list_del((struct list_head *)cmdnode); + list_del(&cmdnode->list); lbs_cleanup_and_insert_cmd(priv, cmdnode); ret = 0; @@ -1814,7 +1814,7 @@ int lbs_execute_next_command(struct lbs_private *priv) (adapter->psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); - list_del((struct list_head *)cmdnode); + list_del(&cmdnode->list); lbs_cleanup_and_insert_cmd(priv, cmdnode); adapter->needtowakeup = 1; @@ -1826,7 +1826,7 @@ int lbs_execute_next_command(struct lbs_private *priv) "EXEC_NEXT_CMD: sending EXIT_PS\n"); } } - list_del((struct list_head *)cmdnode); + list_del(&cmdnode->list); lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", le16_to_cpu(cmdptr->command)); DownloadcommandToStation(priv, cmdnode); -- cgit v1.2.3 From 09d4fad6e8972061fbb0e2e5ae9e686d84f57af6 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 6 Dec 2007 13:50:30 +0100 Subject: libertas: fix data packet size errors I wondered about junk bytes at the end when using "lbsdebug +hex +host" until I noticed that firmware for the CF card sends my extranous bytes. It says "I have 20 bytes", I take 20 bytes, but the last 8 bytes of this are just data junk. Also, in the new lbs_cmd() where was a size miscalulation that made itself clear after fixing this bug. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 2 +- drivers/net/wireless/libertas/if_cs.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 6a43de772aa..22a69736338 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -882,7 +882,7 @@ int lbs_process_rx_command(struct lbs_private *priv) if (adapter->cur_cmd->pdata_size) { struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; - u16 sz = cpu_to_le16(resp->size); + u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; if (sz > *adapter->cur_cmd->pdata_size) { lbs_pr_err("response 0x%04x doesn't fit into " "buffer (%d > %d)\n", respcmd, diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 54b1ba3e250..8508260a286 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -373,6 +373,9 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) if (*len & 1) data[*len-1] = if_cs_read8(priv->card, IF_CS_C_CMD); + /* This is a workaround for a firmware that reports too much + * bytes */ + *len -= 8; ret = 0; out: lbs_deb_leave_args(LBS_DEB_CS, "ret %d, len %d", ret, *len); -- cgit v1.2.3 From 04c80f1ab1333f21aa4e92f3554e83365da449a0 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 12:51:00 +0000 Subject: libertas: Use lbs_cmd() for setting Boot2 version Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index f8589283d7b..4d89fd0f53e 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -101,6 +101,21 @@ static void if_usb_free(struct usb_card_rec *cardp) lbs_deb_leave(LBS_DEB_USB); } +static void if_usb_set_boot2_ver(struct lbs_private *priv) +{ + struct cmd_ds_set_boot2_ver b2_cmd; + int rsp_len = sizeof(b2_cmd); + + b2_cmd.action = 0; + b2_cmd.version = cpu_to_le16(priv->boot2_version); + + if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), + &b2_cmd, &rsp_len)) { + lbs_deb_usb("Setting boot2 version failed\n"); + } +} + + /** * @brief sets the configuration values * @param ifnum interface number @@ -222,10 +237,7 @@ static int if_usb_probe(struct usb_interface *intf, if (lbs_start_card(priv)) goto err_start_card; - /* Set the boot2 version in firmware, ignoring errors. */ - (void)lbs_prepare_and_send_command(priv, CMD_SET_BOOT2_VER, - 0, CMD_OPTION_WAITFORRSP, 0, NULL); - + if_usb_set_boot2_ver(priv); usb_get_dev(udev); usb_set_intfdata(intf, cardp); -- cgit v1.2.3 From f9f6890e41815cfb8aa34fe9efb216fcc16eea9e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 6 Dec 2007 14:44:21 +0000 Subject: libertas: Remove SET_BOOT2_VER support from the Big Switch Statement. And the death of libertas_prepare_and_send_command() starts... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 851eb3ce3e1..b1ea878863a 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -974,17 +974,6 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, return 0; } -static int lbs_cmd_set_boot2_ver(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) -{ - struct cmd_ds_set_boot2_ver *boot2_ver = &cmd->params.boot2_ver; - cmd->command = cpu_to_le16(CMD_SET_BOOT2_VER); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_set_boot2_ver) + S_DS_GEN); - boot2_ver->version = priv->boot2_version; - return 0; -} - /* * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for * the command timer, because it does not account for queued commands. @@ -1470,10 +1459,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf); break; - case CMD_SET_BOOT2_VER: - ret = lbs_cmd_set_boot2_ver(priv, cmdptr, cmd_action, pdata_buf); - break; - case CMD_GET_TSF: cmdptr->command = cpu_to_le16(CMD_GET_TSF); cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + -- cgit v1.2.3 From 83eacf233e62349c8a7282616fedc602ee95a555 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 7 Dec 2007 12:56:45 +0000 Subject: libertas: Fix endianness in boot2_version handling. We read it from the card. We byte-swap it. We write it back to the card. D'oh. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 4d89fd0f53e..d5fc7d7ed53 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -227,7 +227,7 @@ static int if_usb_probe(struct usb_interface *intf, priv->hw_host_to_card = if_usb_host_to_card; priv->hw_get_int_status = if_usb_get_int_status; priv->hw_read_event_cause = if_usb_read_event_cause; - priv->boot2_version = udev->descriptor.bcdDevice; + priv->boot2_version = le16_to_cpu(udev->descriptor.bcdDevice); /* Delay 200 ms to waiting for the FW ready */ if_usb_submit_rx_urb(cardp); -- cgit v1.2.3 From ffd074fc78c1053b1f1697ebbe5bcfbb64949d16 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Fri, 7 Dec 2007 16:52:10 +0100 Subject: libertas: implement new scanning logic This changes the code that is used for scanning and makes it hopefully easier to understand: * move function into logical blocks * create a bunch of lbs_scan_add_XXXX_tlv() functions, that help to create the TLV parameter of CMD_802_11_SCAN * all of them are now called from the much simpler lbs_do_scan() * no **puserscancfg double-pointers :-) Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 3 +- drivers/net/wireless/libertas/scan.c | 871 +++++++++++++++-------------------- 2 files changed, 361 insertions(+), 513 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 1efea63c669..96a34c5bce8 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -366,9 +366,8 @@ struct lbs_adapter { struct cmd_ds_802_11_get_log logmsg; u32 monitormode; + int last_scanned_channel; u8 fw_ready; - - u8 last_scanned_channel; }; #endif diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 236bc7daf4d..90c18889b71 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -79,6 +79,22 @@ static inline void clear_bss_descriptor (struct bss_descriptor * bss) memset(bss, 0, offsetof(struct bss_descriptor, list)); } +/** + * @brief Compare two SSIDs + * + * @param ssid1 A pointer to ssid to compare + * @param ssid2 A pointer to ssid to compare + * + * @return 0: ssid is same, otherwise is different + */ +int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) +{ + if (ssid1_len != ssid2_len) + return -1; + + return memcmp(ssid1, ssid2, ssid1_len); +} + static inline int match_bss_no_security(struct lbs_802_11_security *secinfo, struct bss_descriptor * match_bss) { @@ -149,6 +165,18 @@ static inline int match_bss_dynamic_wep(struct lbs_802_11_security *secinfo, return 0; } +static inline int is_same_network(struct bss_descriptor *src, + struct bss_descriptor *dst) +{ + /* A network is only a duplicate if the channel, BSSID, and ESSID + * all match. We treat all with the same BSSID and channel + * as one network */ + return ((src->ssid_len == dst->ssid_len) && + (src->channel == dst->channel) && + !compare_ether_addr(src->bssid, dst->bssid) && + !memcmp(src->ssid, dst->ssid, src->ssid_len)); +} + /** * @brief Check if a scanned network compatible with the driver settings * @@ -184,9 +212,9 @@ static int is_network_compatible(struct lbs_adapter *adapter, goto done; } else if ((matched = match_bss_wpa(&adapter->secinfo, bss))) { lbs_deb_scan( - "is_network_compatible() WPA: wpa_ie=%#x " - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " - "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0], + "is_network_compatible() WPA: wpa_ie 0x%x " + "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " + "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d", adapter->secinfo.WPA2enabled ? "e" : "d", @@ -194,9 +222,9 @@ static int is_network_compatible(struct lbs_adapter *adapter, goto done; } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { lbs_deb_scan( - "is_network_compatible() WPA2: wpa_ie=%#x " - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " - "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0], + "is_network_compatible() WPA2: wpa_ie 0x%x " + "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " + "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d", adapter->secinfo.WPA2enabled ? "e" : "d", @@ -205,7 +233,7 @@ static int is_network_compatible(struct lbs_adapter *adapter, } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { lbs_deb_scan( "is_network_compatible() dynamic WEP: " - "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", + "wpa_ie 0x%x wpa2_ie 0x%x privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], (bss->capability & WLAN_CAPABILITY_PRIVACY)); goto done; @@ -213,8 +241,8 @@ static int is_network_compatible(struct lbs_adapter *adapter, /* bss security settings don't match those configured on card */ lbs_deb_scan( - "is_network_compatible() FAILED: wpa_ie=%#x " - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", + "is_network_compatible() FAILED: wpa_ie 0x%x " + "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d", @@ -226,22 +254,6 @@ done: return matched; } -/** - * @brief Compare two SSIDs - * - * @param ssid1 A pointer to ssid to compare - * @param ssid2 A pointer to ssid to compare - * - * @return 0--ssid is same, otherwise is different - */ -int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) -{ - if (ssid1_len != ssid2_len) - return -1; - - return memcmp(ssid1, ssid2, ssid1_len); -} - @@ -251,6 +263,16 @@ int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) /* */ /*********************************************************************/ +void lbs_scan_worker(struct work_struct *work) +{ + struct lbs_private *priv = + container_of(work, struct lbs_private, scan_work.work); + + lbs_deb_enter(LBS_DEB_SCAN); + lbs_scan_networks(priv, NULL, 0); + lbs_deb_leave(LBS_DEB_SCAN); +} + /** * @brief Create a channel list for the driver to scan based on region info @@ -271,7 +293,7 @@ int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) * * @return void */ -static void lbs_scan_create_channel_list(struct lbs_private *priv, +static int lbs_scan_create_channel_list(struct lbs_private *priv, struct chanscanparamset * scanchanlist, u8 filteredscan) { @@ -284,8 +306,6 @@ static void lbs_scan_create_channel_list(struct lbs_private *priv, int nextchan; u8 scantype; - lbs_deb_enter_args(LBS_DEB_SCAN, "filteredscan %d", filteredscan); - chanidx = 0; /* Set the default scan type to the user specified type, will later @@ -353,383 +373,151 @@ static void lbs_scan_create_channel_list(struct lbs_private *priv, } } } + return chanidx; } -/* Delayed partial scan worker */ -void lbs_scan_worker(struct work_struct *work) +/* + * Add SSID TLV of the form: + * + * TLV-ID SSID 00 00 + * length 06 00 + * ssid 4d 4e 54 45 53 54 + */ +static int lbs_scan_add_ssid_tlv(u8 *tlv, + const struct lbs_ioctl_user_scan_cfg *user_cfg) { - struct lbs_private *priv = container_of(work, - struct lbs_private, - scan_work.work); - - lbs_scan_networks(priv, NULL, 0); + struct mrvlietypes_ssidparamset *ssid_tlv = + (struct mrvlietypes_ssidparamset *)tlv; + ssid_tlv->header.type = cpu_to_le16(TLV_TYPE_SSID); + ssid_tlv->header.len = cpu_to_le16(user_cfg->ssid_len); + memcpy(ssid_tlv->ssid, user_cfg->ssid, user_cfg->ssid_len); + return sizeof(ssid_tlv->header) + user_cfg->ssid_len; } -/** - * @brief Construct a lbs_scan_cmd_config structure to use in issue scan cmds - * - * Application layer or other functions can invoke lbs_scan_networks - * with a scan configuration supplied in a lbs_ioctl_user_scan_cfg struct. - * This structure is used as the basis of one or many lbs_scan_cmd_config - * commands that are sent to the command processing module and sent to - * firmware. - * - * Create a lbs_scan_cmd_config based on the following user supplied - * parameters (if present): - * - SSID filter - * - BSSID filter - * - Number of Probes to be sent - * - channel list - * - * If the SSID or BSSID filter is not present, disable/clear the filter. - * Qualify the channel +/* + * Add CHANLIST TLV of the form * - * @param priv A pointer to struct lbs_private structure - * @param puserscanin NULL or pointer to scan configuration parameters - * @param ppchantlvout Output parameter: Pointer to the start of the - * channel TLV portion of the output scan config - * @param pscanchanlist Output parameter: Pointer to the resulting channel - * list to scan - * @param pmaxchanperscan Output parameter: Number of channels to scan for - * each issuance of the firmware scan command - * @param pfilteredscan Output parameter: Flag indicating whether or not - * a BSSID or SSID filter is being sent in the - * command to firmware. Used to increase the number - * of channels sent in a scan command and to - * disable the firmware channel scan filter. - * @param pscancurrentonly Output parameter: Flag indicating whether or not - * we are only scanning our current active channel + * TLV-ID CHANLIST 01 01 + * length 5b 00 + * channel 1 00 01 00 00 00 64 00 + * radio type 00 + * channel 01 + * scan type 00 + * min scan time 00 00 + * max scan time 64 00 + * channel 2 00 02 00 00 00 64 00 + * channel 3 00 03 00 00 00 64 00 + * channel 4 00 04 00 00 00 64 00 + * channel 5 00 05 00 00 00 64 00 + * channel 6 00 06 00 00 00 64 00 + * channel 7 00 07 00 00 00 64 00 + * channel 8 00 08 00 00 00 64 00 + * channel 9 00 09 00 00 00 64 00 + * channel 10 00 0a 00 00 00 64 00 + * channel 11 00 0b 00 00 00 64 00 + * channel 12 00 0c 00 00 00 64 00 + * channel 13 00 0d 00 00 00 64 00 * - * @return resulting scan configuration */ -static struct lbs_scan_cmd_config * -lbs_scan_setup_scan_config(struct lbs_private *priv, - const struct lbs_ioctl_user_scan_cfg *puserscanin, - struct mrvlietypes_chanlistparamset ** ppchantlvout, - struct chanscanparamset * pscanchanlist, - int *pmaxchanperscan, - u8 * pfilteredscan, - u8 * pscancurrentonly) +static int lbs_scan_add_chanlist_tlv(u8 *tlv, + struct chanscanparamset *chan_list, + int chan_count) { - struct mrvlietypes_ssidparamset *pssidtlv; - struct lbs_scan_cmd_config *pscancfgout = NULL; - u8 *ptlvpos; - - lbs_deb_enter(LBS_DEB_SCAN); - - pscancfgout = kzalloc(MAX_SCAN_CFG_ALLOC, GFP_KERNEL); - if (pscancfgout == NULL) - goto out; - - /* The tlvbufferlen is calculated for each scan command. The TLVs added - * in this routine will be preserved since the routine that sends - * the command will append channelTLVs at *ppchantlvout. The difference - * between the *ppchantlvout and the tlvbuffer start will be used - * to calculate the size of anything we add in this routine. - */ - pscancfgout->tlvbufferlen = 0; - - /* Running tlv pointer. Assigned to ppchantlvout at end of function - * so later routines know where channels can be added to the command buf - */ - ptlvpos = pscancfgout->tlvbuffer; - - /* - * Set the initial scan paramters for progressive scanning. If a specific - * BSSID or SSID is used, the number of channels in the scan command - * will be increased to the absolute maximum - */ - *pmaxchanperscan = MRVDRV_CHANNELS_PER_SCAN_CMD; - - /* Initialize the scan as un-filtered by firmware, set to TRUE below if - * a SSID or BSSID filter is sent in the command - */ - *pfilteredscan = 0; - - /* Initialize the scan as not being only on the current channel. If - * the channel list is customized, only contains one channel, and - * is the active channel, this is set true and data flow is not halted. - */ - *pscancurrentonly = 0; - - if (puserscanin) { - /* Set the bss type scan filter, use adapter setting if unset */ - pscancfgout->bsstype = - puserscanin->bsstype ? puserscanin->bsstype : CMD_BSS_TYPE_ANY; - - /* - * Set the BSSID filter to the incoming configuration, - * if non-zero. If not set, it will remain disabled (all zeros). - */ - memcpy(pscancfgout->bssid, puserscanin->bssid, - sizeof(pscancfgout->bssid)); - - if (puserscanin->ssid_len) { - pssidtlv = - (struct mrvlietypes_ssidparamset *) pscancfgout-> - tlvbuffer; - pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID); - pssidtlv->header.len = cpu_to_le16(puserscanin->ssid_len); - memcpy(pssidtlv->ssid, puserscanin->ssid, - puserscanin->ssid_len); - ptlvpos += sizeof(pssidtlv->header) + puserscanin->ssid_len; - } - - /* - * The default number of channels sent in the command is low to - * ensure the response buffer from the firmware does not truncate - * scan results. That is not an issue with an SSID or BSSID - * filter applied to the scan results in the firmware. - */ - if ( puserscanin->ssid_len - || (compare_ether_addr(pscancfgout->bssid, &zeromac[0]) != 0)) { - *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN; - *pfilteredscan = 1; - } - } else { - pscancfgout->bsstype = CMD_BSS_TYPE_ANY; - } - - /* - * Set the output for the channel TLV to the address in the tlv buffer - * past any TLVs that were added in this fuction (SSID). - * channel TLVs will be added past this for each scan command, preserving - * the TLVs that were previously added. - */ - *ppchantlvout = (struct mrvlietypes_chanlistparamset *) ptlvpos; - - lbs_scan_create_channel_list(priv, pscanchanlist, - *pfilteredscan); -out: - return pscancfgout; + size_t size = sizeof(struct chanscanparamset) * chan_count; + struct mrvlietypes_chanlistparamset *chan_tlv = + (struct mrvlietypes_chanlistparamset *) tlv; + + chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); + memcpy(chan_tlv->chanscanparam, chan_list, size); + chan_tlv->header.len = cpu_to_le16(size); + return sizeof(chan_tlv->header) + size; } -/** - * @brief Construct and send multiple scan config commands to the firmware - * - * Only used from lbs_scan_networks() - * - * Previous routines have created a lbs_scan_cmd_config with any requested - * TLVs. This function splits the channel TLV into maxchanperscan lists - * and sends the portion of the channel TLV along with the other TLVs - * to the lbs_cmd routines for execution in the firmware. + +/* + * Add RATES TLV of the form * - * @param priv A pointer to struct lbs_private structure - * @param maxchanperscan Maximum number channels to be included in each - * scan command sent to firmware - * @param filteredscan Flag indicating whether or not a BSSID or SSID - * filter is being used for the firmware command - * scan command sent to firmware - * @param pscancfgout Scan configuration used for this scan. - * @param pchantlvout Pointer in the pscancfgout where the channel TLV - * should start. This is past any other TLVs that - * must be sent down in each firmware command. - * @param pscanchanlist List of channels to scan in maxchanperscan segments + * TLV-ID RATES 01 00 + * length 0e 00 + * rates 82 84 8b 96 0c 12 18 24 30 48 60 6c * - * @return 0 or error return otherwise + * The rates are in lbs_bg_rates[], but for the 802.11b + * rates the high bit isn't set. */ -static int lbs_scan_channel_list(struct lbs_private *priv, - int maxchanperscan, - u8 filteredscan, - struct lbs_scan_cmd_config *pscancfgout, - struct mrvlietypes_chanlistparamset * pchantlvout, - struct chanscanparamset * pscanchanlist, - const struct lbs_ioctl_user_scan_cfg *puserscanin, - int full_scan) +static int lbs_scan_add_rates_tlv(u8 *tlv) { - struct chanscanparamset *ptmpchan; - struct chanscanparamset *pstartchan; - u8 scanband; - int doneearly; - int tlvidx; - int ret = 0; - int scanned = 0; - union iwreq_data wrqu; - - lbs_deb_enter_args(LBS_DEB_SCAN, "maxchanperscan %d, filteredscan %d, " - "full_scan %d", maxchanperscan, filteredscan, full_scan); - - if (!pscancfgout || !pchantlvout || !pscanchanlist) { - lbs_deb_scan("pscancfgout, pchantlvout or " - "pscanchanlist is NULL\n"); - ret = -1; - goto out; - } - - pchantlvout->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - - /* Set the temp channel struct pointer to the start of the desired list */ - ptmpchan = pscanchanlist; - - if (priv->adapter->last_scanned_channel && !puserscanin) - ptmpchan += priv->adapter->last_scanned_channel; - - /* Loop through the desired channel list, sending a new firmware scan - * commands for each maxchanperscan channels (or for 1,6,11 individually - * if configured accordingly) - */ - while (ptmpchan->channumber) { - - tlvidx = 0; - pchantlvout->header.len = 0; - scanband = ptmpchan->radiotype; - pstartchan = ptmpchan; - doneearly = 0; - - /* Construct the channel TLV for the scan command. Continue to - * insert channel TLVs until: - * - the tlvidx hits the maximum configured per scan command - * - the next channel to insert is 0 (end of desired channel list) - * - doneearly is set (controlling individual scanning of 1,6,11) - */ - while (tlvidx < maxchanperscan && ptmpchan->channumber - && !doneearly && scanned < 2) { - - lbs_deb_scan("channel %d, radio %d, passive %d, " - "dischanflt %d, maxscantime %d\n", - ptmpchan->channumber, - ptmpchan->radiotype, - ptmpchan->chanscanmode.passivescan, - ptmpchan->chanscanmode.disablechanfilt, - ptmpchan->maxscantime); - - /* Copy the current channel TLV to the command being prepared */ - memcpy(pchantlvout->chanscanparam + tlvidx, - ptmpchan, sizeof(pchantlvout->chanscanparam)); - - /* Increment the TLV header length by the size appended */ - /* Ew, it would be _so_ nice if we could just declare the - variable little-endian and let GCC handle it for us */ - pchantlvout->header.len = - cpu_to_le16(le16_to_cpu(pchantlvout->header.len) + - sizeof(pchantlvout->chanscanparam)); - - /* - * The tlv buffer length is set to the number of bytes of the - * between the channel tlv pointer and the start of the - * tlv buffer. This compensates for any TLVs that were appended - * before the channel list. - */ - pscancfgout->tlvbufferlen = ((u8 *) pchantlvout - - pscancfgout->tlvbuffer); - - /* Add the size of the channel tlv header and the data length */ - pscancfgout->tlvbufferlen += - (sizeof(pchantlvout->header) - + le16_to_cpu(pchantlvout->header.len)); - - /* Increment the index to the channel tlv we are constructing */ - tlvidx++; - - doneearly = 0; - - /* Stop the loop if the *current* channel is in the 1,6,11 set - * and we are not filtering on a BSSID or SSID. - */ - if (!filteredscan && (ptmpchan->channumber == 1 - || ptmpchan->channumber == 6 - || ptmpchan->channumber == 11)) { - doneearly = 1; - } - - /* Increment the tmp pointer to the next channel to be scanned */ - ptmpchan++; - scanned++; - - /* Stop the loop if the *next* channel is in the 1,6,11 set. - * This will cause it to be the only channel scanned on the next - * interation - */ - if (!filteredscan && (ptmpchan->channumber == 1 - || ptmpchan->channumber == 6 - || ptmpchan->channumber == 11)) { - doneearly = 1; - } - } - - /* Send the scan command to the firmware with the specified cfg */ - ret = lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, 0, - 0, 0, pscancfgout); - if (scanned >= 2 && !full_scan) { - ret = 0; - goto done; - } - scanned = 0; - } - -done: - priv->adapter->last_scanned_channel = ptmpchan->channumber; - - if (priv->adapter->last_scanned_channel) { - /* Schedule the next part of the partial scan */ - if (!full_scan && !priv->adapter->surpriseremoved) { - cancel_delayed_work(&priv->scan_work); - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(300)); - } - } else { - /* All done, tell userspace the scan table has been updated */ - memset(&wrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); + int i; + struct mrvlietypes_ratesparamset *rate_tlv = + (struct mrvlietypes_ratesparamset *) tlv; + + rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES); + tlv += sizeof(rate_tlv->header); + for (i = 0; i < MAX_RATES; i++) { + *tlv = lbs_bg_rates[i]; + if (*tlv == 0) + break; + /* This code makes sure that the 802.11b rates (1 MBit/s, 2 + MBit/s, 5.5 MBit/s and 11 MBit/s get's the high bit set. + Note that the values are MBit/s * 2, to mark them as + basic rates so that the firmware likes it better */ + if (*tlv == 0x02 || *tlv == 0x04 || + *tlv == 0x0b || *tlv == 0x16) + *tlv |= 0x80; + tlv++; } - -out: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; + rate_tlv->header.len = cpu_to_le16(i); + return sizeof(rate_tlv->header) + i; } + /* - * Only used from lbs_scan_networks() -*/ -static void clear_selected_scan_list_entries(struct lbs_adapter *adapter, - const struct lbs_ioctl_user_scan_cfg *scan_cfg) + * Generate the CMD_802_11_SCAN command with the proper tlv + * for a bunch of channels. + */ +static int lbs_do_scan(struct lbs_private *priv, + u8 bsstype, + struct chanscanparamset *chan_list, + int chan_count, + const struct lbs_ioctl_user_scan_cfg *user_cfg) { - struct bss_descriptor *bss; - struct bss_descriptor *safe; - u32 clear_ssid_flag = 0, clear_bssid_flag = 0; + int ret = -ENOMEM; + struct lbs_scan_cmd_config *scan_cmd; + u8 *tlv; /* pointer into our current, growing TLV storage area */ - lbs_deb_enter(LBS_DEB_SCAN); + lbs_deb_enter_args(LBS_DEB_SCAN, "bsstype %d, chanlist[].chan %d, " + "chan_count %d", + bsstype, chan_list[0].channumber, chan_count); - if (!scan_cfg) + /* create the fixed part for scan command */ + scan_cmd = kzalloc(MAX_SCAN_CFG_ALLOC, GFP_KERNEL); + if (scan_cmd == NULL) goto out; - - if (scan_cfg->clear_ssid && scan_cfg->ssid_len) - clear_ssid_flag = 1; - - if (scan_cfg->clear_bssid - && (compare_ether_addr(scan_cfg->bssid, &zeromac[0]) != 0) - && (compare_ether_addr(scan_cfg->bssid, &bcastmac[0]) != 0)) { - clear_bssid_flag = 1; - } - - if (!clear_ssid_flag && !clear_bssid_flag) - goto out; - - mutex_lock(&adapter->lock); - list_for_each_entry_safe (bss, safe, &adapter->network_list, list) { - u32 clear = 0; - - /* Check for an SSID match */ - if ( clear_ssid_flag - && (bss->ssid_len == scan_cfg->ssid_len) - && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len)) - clear = 1; - - /* Check for a BSSID match */ - if ( clear_bssid_flag - && !compare_ether_addr(bss->bssid, scan_cfg->bssid)) - clear = 1; - - if (clear) { - list_move_tail (&bss->list, &adapter->network_free_list); - clear_bss_descriptor(bss); - } - } - mutex_unlock(&adapter->lock); + tlv = scan_cmd->tlvbuffer; + if (user_cfg) + memcpy(scan_cmd->bssid, user_cfg->bssid, ETH_ALEN); + scan_cmd->bsstype = bsstype; + + /* add TLVs */ + if (user_cfg && user_cfg->ssid_len) + tlv += lbs_scan_add_ssid_tlv(tlv, user_cfg); + if (chan_list && chan_count) + tlv += lbs_scan_add_chanlist_tlv(tlv, chan_list, chan_count); + tlv += lbs_scan_add_rates_tlv(tlv); + + /* This is the final data we are about to send */ + scan_cmd->tlvbufferlen = tlv - scan_cmd->tlvbuffer; + lbs_deb_hex(LBS_DEB_SCAN, "SCAN_CMD", (void *)scan_cmd, 1+6); + lbs_deb_hex(LBS_DEB_SCAN, "SCAN_TLV", scan_cmd->tlvbuffer, + scan_cmd->tlvbufferlen); + + ret = lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, 0, + CMD_OPTION_WAITFORRSP, 0, scan_cmd); out: - lbs_deb_leave(LBS_DEB_SCAN); + kfree(scan_cmd); + lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); + return ret; } @@ -745,29 +533,30 @@ out: * @param priv A pointer to struct lbs_private structure * @param puserscanin Pointer to the input configuration for the requested * scan. - * @param full_scan ??? * * @return 0 or < 0 if error */ int lbs_scan_networks(struct lbs_private *priv, - const struct lbs_ioctl_user_scan_cfg *puserscanin, + const struct lbs_ioctl_user_scan_cfg *user_cfg, int full_scan) { struct lbs_adapter *adapter = priv->adapter; - struct mrvlietypes_chanlistparamset *pchantlvout; - struct chanscanparamset * scan_chan_list = NULL; - struct lbs_scan_cmd_config *scan_cfg = NULL; - u8 filteredscan; - u8 scancurrentchanonly; - int maxchanperscan; - int ret; + int ret = -ENOMEM; + struct chanscanparamset *chan_list; + struct chanscanparamset *curr_chans; + int chan_count; + u8 bsstype = CMD_BSS_TYPE_ANY; + int numchannels = MRVDRV_CHANNELS_PER_SCAN_CMD; + int filteredscan = 0; + union iwreq_data wrqu; #ifdef CONFIG_LIBERTAS_DEBUG - struct bss_descriptor * iter_bss; + struct bss_descriptor *iter; int i = 0; DECLARE_MAC_BUF(mac); #endif - lbs_deb_enter_args(LBS_DEB_SCAN, "full_scan %d", full_scan); + lbs_deb_enter_args(LBS_DEB_SCAN, "full_scan %d", + full_scan); /* Cancel any partial outstanding partial scans if this scan * is a full scan. @@ -775,85 +564,130 @@ int lbs_scan_networks(struct lbs_private *priv, if (full_scan && delayed_work_pending(&priv->scan_work)) cancel_delayed_work(&priv->scan_work); - scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * - LBS_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); - if (scan_chan_list == NULL) { - ret = -ENOMEM; - goto out; + /* Determine same scan parameters */ + if (user_cfg) { + if (user_cfg->bsstype) + bsstype = user_cfg->bsstype; + if (compare_ether_addr(user_cfg->bssid, &zeromac[0]) != 0) { + numchannels = MRVDRV_MAX_CHANNELS_PER_SCAN; + filteredscan = 1; + } } + lbs_deb_scan("numchannels %d, bsstype %d, " + "filteredscan %d\n", + numchannels, bsstype, filteredscan); - scan_cfg = lbs_scan_setup_scan_config(priv, - puserscanin, - &pchantlvout, - scan_chan_list, - &maxchanperscan, - &filteredscan, - &scancurrentchanonly); - if (scan_cfg == NULL) { - ret = -ENOMEM; + /* Create list of channels to scan */ + chan_list = kzalloc(sizeof(struct chanscanparamset) * + LBS_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); + if (!chan_list) { + lbs_pr_alert("SCAN: chan_list empty\n"); goto out; } - clear_selected_scan_list_entries(adapter, puserscanin); + /* We want to scan all channels */ + chan_count = lbs_scan_create_channel_list(priv, chan_list, + filteredscan); - /* Keep the data path active if we are only scanning our current channel */ - if (!scancurrentchanonly) { - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - if (priv->mesh_dev) { + netif_stop_queue(priv->dev); + netif_carrier_off(priv->dev); + if (priv->mesh_dev) { netif_stop_queue(priv->mesh_dev); netif_carrier_off(priv->mesh_dev); - } } - ret = lbs_scan_channel_list(priv, - maxchanperscan, - filteredscan, - scan_cfg, - pchantlvout, - scan_chan_list, - puserscanin, - full_scan); + /* Prepare to continue an interrupted scan */ + lbs_deb_scan("chan_count %d, last_scanned_channel %d\n", + chan_count, adapter->last_scanned_channel); + curr_chans = chan_list; + /* advance channel list by already-scanned-channels */ + if (adapter->last_scanned_channel > 0) { + curr_chans += adapter->last_scanned_channel; + chan_count -= adapter->last_scanned_channel; + } + + /* Send scan command(s) + * numchannels contains the number of channels we should maximally scan + * chan_count is the total number of channels to scan + */ + + while (chan_count) { + int to_scan = min(numchannels, chan_count); + lbs_deb_scan("scanning %d of %d channels\n", + to_scan, chan_count); + ret = lbs_do_scan(priv, bsstype, curr_chans, + to_scan, user_cfg); + if (ret) { + lbs_pr_err("SCAN_CMD failed\n"); + goto out2; + } + curr_chans += to_scan; + chan_count -= to_scan; + + /* somehow schedule the next part of the scan */ + if (chan_count && + !full_scan && + !priv->adapter->surpriseremoved) { + /* -1 marks just that we're currently scanning */ + if (adapter->last_scanned_channel < 0) + adapter->last_scanned_channel = to_scan; + else + adapter->last_scanned_channel += to_scan; + cancel_delayed_work(&priv->scan_work); + queue_delayed_work(priv->work_thread, &priv->scan_work, + msecs_to_jiffies(300)); + /* skip over GIWSCAN event */ + goto out; + } + + } + memset(&wrqu, 0, sizeof(union iwreq_data)); + wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); #ifdef CONFIG_LIBERTAS_DEBUG /* Dump the scan table */ mutex_lock(&adapter->lock); - lbs_deb_scan("The scan table contains:\n"); - list_for_each_entry (iter_bss, &adapter->network_list, list) { - lbs_deb_scan("scan %02d, %s, RSSI, %d, SSID '%s'\n", - i++, print_mac(mac, iter_bss->bssid), (s32) iter_bss->rssi, - escape_essid(iter_bss->ssid, iter_bss->ssid_len)); - } + lbs_deb_scan("scan table:\n"); + list_for_each_entry(iter, &adapter->network_list, list) + lbs_deb_scan("%02d: BSSID %s, RSSI %d, SSID '%s'\n", + i++, print_mac(mac, iter->bssid), (s32) iter->rssi, + escape_essid(iter->ssid, iter->ssid_len)); mutex_unlock(&adapter->lock); #endif +out2: + adapter->last_scanned_channel = 0; + +out: if (adapter->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); } - if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) { netif_carrier_on(priv->mesh_dev); netif_wake_queue(priv->mesh_dev); } - -out: - if (scan_cfg) - kfree(scan_cfg); - - if (scan_chan_list) - kfree(scan_chan_list); + kfree(chan_list); lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); return ret; } + + + +/*********************************************************************/ +/* */ +/* Result interpretation */ +/* */ +/*********************************************************************/ + /** * @brief Interpret a BSS scan response returned from the firmware * * Parse the various fixed fields and IEs passed back for a a BSS probe - * response or beacon from the scan command. Record information as needed - * in the scan table struct bss_descriptor for that entry. + * response or beacon from the scan command. Record information as needed + * in the scan table struct bss_descriptor for that entry. * * @param bss Output parameter: Pointer to the BSS Entry * @@ -898,7 +732,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, *bytesleft -= beaconsize; memcpy(bss->bssid, pos, ETH_ALEN); - lbs_deb_scan("process_bss: AP BSSID %s\n", print_mac(mac, bss->bssid)); + lbs_deb_scan("process_bss: BSSID %s\n", print_mac(mac, bss->bssid)); pos += ETH_ALEN; if ((end - pos) < 12) { @@ -914,7 +748,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, /* RSSI is 1 byte long */ bss->rssi = *pos; - lbs_deb_scan("process_bss: RSSI=%02X\n", *pos); + lbs_deb_scan("process_bss: RSSI %d\n", *pos); pos++; /* time stamp is 8 bytes long */ @@ -926,18 +760,18 @@ static int lbs_process_bss(struct bss_descriptor *bss, /* capability information is 2 bytes long */ bss->capability = le16_to_cpup((void *) pos); - lbs_deb_scan("process_bss: capabilities = 0x%4X\n", bss->capability); + lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability); pos += 2; if (bss->capability & WLAN_CAPABILITY_PRIVACY) - lbs_deb_scan("process_bss: AP WEP enabled\n"); + lbs_deb_scan("process_bss: WEP enabled\n"); if (bss->capability & WLAN_CAPABILITY_IBSS) bss->mode = IW_MODE_ADHOC; else bss->mode = IW_MODE_INFRA; /* rest of the current buffer are IE's */ - lbs_deb_scan("process_bss: IE length for this AP = %zd\n", end - pos); + lbs_deb_scan("process_bss: IE len %zd\n", end - pos); lbs_deb_hex(LBS_DEB_SCAN, "process_bss: IE info", pos, end - pos); /* process variable IE */ @@ -955,7 +789,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, case MFIE_TYPE_SSID: bss->ssid_len = elem->len; memcpy(bss->ssid, elem->data, elem->len); - lbs_deb_scan("ssid '%s', ssid length %u\n", + lbs_deb_scan("got SSID IE: '%s', len %u\n", escape_essid(bss->ssid, bss->ssid_len), bss->ssid_len); break; @@ -964,16 +798,14 @@ static int lbs_process_bss(struct bss_descriptor *bss, n_basic_rates = min_t(u8, MAX_RATES, elem->len); memcpy(bss->rates, elem->data, n_basic_rates); got_basic_rates = 1; + lbs_deb_scan("got RATES IE\n"); break; case MFIE_TYPE_FH_SET: pFH = (struct ieeetypes_fhparamset *) pos; memmove(&bss->phyparamset.fhparamset, pFH, sizeof(struct ieeetypes_fhparamset)); -#if 0 /* I think we can store these LE */ - bss->phyparamset.fhparamset.dwelltime - = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime); -#endif + lbs_deb_scan("got FH IE\n"); break; case MFIE_TYPE_DS_SET: @@ -981,12 +813,14 @@ static int lbs_process_bss(struct bss_descriptor *bss, bss->channel = pDS->currentchan; memcpy(&bss->phyparamset.dsparamset, pDS, sizeof(struct ieeetypes_dsparamset)); + lbs_deb_scan("got DS IE, channel %d\n", bss->channel); break; case MFIE_TYPE_CF_SET: pCF = (struct ieeetypes_cfparamset *) pos; memcpy(&bss->ssparamset.cfparamset, pCF, sizeof(struct ieeetypes_cfparamset)); + lbs_deb_scan("got CF IE\n"); break; case MFIE_TYPE_IBSS_SET: @@ -994,18 +828,16 @@ static int lbs_process_bss(struct bss_descriptor *bss, bss->atimwindow = le32_to_cpu(pibss->atimwindow); memmove(&bss->ssparamset.ibssparamset, pibss, sizeof(struct ieeetypes_ibssparamset)); -#if 0 - bss->ssparamset.ibssparamset.atimwindow - = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow); -#endif + lbs_deb_scan("got IBSS IE\n"); break; case MFIE_TYPE_COUNTRY: pcountryinfo = (struct ieeetypes_countryinfoset *) pos; + lbs_deb_scan("got COUNTRY IE\n"); if (pcountryinfo->len < sizeof(pcountryinfo->countrycode) || pcountryinfo->len > 254) { lbs_deb_scan("process_bss: 11D- Err " - "CountryInfo len =%d min=%zd max=254\n", + "CountryInfo len %d, min %zd, max 254\n", pcountryinfo->len, sizeof(pcountryinfo->countrycode)); ret = -1; @@ -1024,8 +856,11 @@ static int lbs_process_bss(struct bss_descriptor *bss, * already found. Data rate IE should come before * extended supported rate IE */ - if (!got_basic_rates) + lbs_deb_scan("got RATESEX IE\n"); + if (!got_basic_rates) { + lbs_deb_scan("... but ignoring it\n"); break; + } n_ex_rates = elem->len; if (n_basic_rates + n_ex_rates > MAX_RATES) @@ -1044,24 +879,36 @@ static int lbs_process_bss(struct bss_descriptor *bss, bss->wpa_ie_len = min(elem->len + 2, MAX_WPA_IE_LEN); memcpy(bss->wpa_ie, elem, bss->wpa_ie_len); - lbs_deb_hex(LBS_DEB_SCAN, "process_bss: WPA IE", bss->wpa_ie, + lbs_deb_scan("got WPA IE\n"); + lbs_deb_hex(LBS_DEB_SCAN, "WPA IE", bss->wpa_ie, elem->len); } else if (elem->len >= MARVELL_MESH_IE_LENGTH && elem->data[0] == 0x00 && elem->data[1] == 0x50 && elem->data[2] == 0x43 && elem->data[3] == 0x04) { + lbs_deb_scan("got mesh IE\n"); bss->mesh = 1; + } else { + lbs_deb_scan("got generiec IE: " + "%02x:%02x:%02x:%02x, len %d\n", + elem->data[0], elem->data[1], + elem->data[2], elem->data[3], + elem->len); } break; case MFIE_TYPE_RSN: + lbs_deb_scan("got RSN IE\n"); bss->rsn_ie_len = min(elem->len + 2, MAX_WPA_IE_LEN); memcpy(bss->rsn_ie, elem, bss->rsn_ie_len); - lbs_deb_hex(LBS_DEB_SCAN, "process_bss: RSN_IE", bss->rsn_ie, elem->len); + lbs_deb_hex(LBS_DEB_SCAN, "process_bss: RSN_IE", + bss->rsn_ie, elem->len); break; default: + lbs_deb_scan("got IE 0x%04x, len %d\n", + elem->id, elem->len); break; } @@ -1273,8 +1120,6 @@ int lbs_find_best_network_ssid(struct lbs_private *priv, if (adapter->surpriseremoved) goto out; - wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); - found = lbs_find_best_ssid_in_list(adapter, preferred_mode); if (found && (found->ssid_len > 0)) { memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); @@ -1288,36 +1133,6 @@ out: return ret; } -/** - * @brief Scan Network - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * - * @return 0 --success, otherwise fail - */ -int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; - - lbs_deb_enter(LBS_DEB_SCAN); - - if (!delayed_work_pending(&priv->scan_work)) { - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(50)); - } - - if (adapter->surpriseremoved) - return -1; - - lbs_deb_leave(LBS_DEB_SCAN); - return 0; -} - /** * @brief Send a scan command for all available channels filtered on a spec @@ -1329,8 +1144,6 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, * @param ssid_len Length of the SSID * @param clear_ssid Should existing scan results with this SSID * be cleared? - * @param prequestedssid A pointer to AP's ssid - * @param keeppreviousscan Flag used to save/clear scan table before scan * * @return 0-success, otherwise fail */ @@ -1357,7 +1170,6 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, ret = -1; goto out; } - wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); out: lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); @@ -1373,6 +1185,7 @@ out: /* */ /*********************************************************************/ + #define MAX_CUSTOM_LEN 64 static inline char *lbs_translate_scan(struct lbs_private *priv, @@ -1398,7 +1211,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, goto out; } - /* First entry *MUST* be the AP BSSID */ + /* First entry *MUST* be the BSSID */ iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); @@ -1528,6 +1341,55 @@ out: return start; } + +/** + * @brief Handle Scan Network ioctl + * + * @param dev A pointer to net_device structure + * @param info A pointer to iw_request_info structure + * @param vwrq A pointer to iw_param structure + * @param extra A pointer to extra data buf + * + * @return 0 --success, otherwise fail + */ +int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrqu, char *extra) +{ + struct lbs_private *priv = dev->priv; + struct lbs_adapter *adapter = priv->adapter; + + lbs_deb_enter(LBS_DEB_SCAN); + + if (!netif_running(dev)) + return -ENETDOWN; + + /* mac80211 does this: + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + if (sdata->type != IEEE80211_IF_TYPE_xxx) + return -EOPNOTSUPP; + + if (wrqu->data.length == sizeof(struct iw_scan_req) && + wrqu->data.flags & IW_SCAN_THIS_ESSID) { + req = (struct iw_scan_req *)extra; + ssid = req->essid; + ssid_len = req->essid_len; + } + */ + + if (!delayed_work_pending(&priv->scan_work)) + queue_delayed_work(priv->work_thread, &priv->scan_work, + msecs_to_jiffies(50)); + /* set marker that currently a scan is taking place */ + adapter->last_scanned_channel = -1; + + if (adapter->surpriseremoved) + return -EIO; + + lbs_deb_leave(LBS_DEB_SCAN); + return 0; +} + + /** * @brief Handle Retrieve scan table ioctl * @@ -1552,6 +1414,10 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, lbs_deb_enter(LBS_DEB_SCAN); + /* iwlist should wait until the current scan is finished */ + if (adapter->last_scanned_channel) + return -EAGAIN; + /* Update RSSI if current BSS is a locally created ad-hoc BSS */ if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) { lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, @@ -1609,7 +1475,8 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, /** * @brief Prepare a scan command to be sent to the firmware * - * Called from lbs_prepare_and_send_command() in cmd.c + * Called via lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, ...) + * from cmd.c * * Sends a fixed lenght data part (specifying the BSS type and BSSID filters) * as well as a variable number/length of TLVs to the firmware. @@ -1623,7 +1490,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, * @return 0 or -1 */ int lbs_cmd_80211_scan(struct lbs_private *priv, - struct cmd_ds_command *cmd, void *pdata_buf) + struct cmd_ds_command *cmd, void *pdata_buf) { struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; struct lbs_scan_cmd_config *pscancfg = pdata_buf; @@ -1635,32 +1502,14 @@ int lbs_cmd_80211_scan(struct lbs_private *priv, memcpy(pscan->bssid, pscancfg->bssid, ETH_ALEN); memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen); - cmd->command = cpu_to_le16(CMD_802_11_SCAN); - /* size is equal to the sizeof(fixed portions) + the TLV len + header */ cmd->size = cpu_to_le16(sizeof(pscan->bsstype) + ETH_ALEN + pscancfg->tlvbufferlen + S_DS_GEN); - lbs_deb_scan("SCAN_CMD: command 0x%04x, size %d, seqnum %d\n", - le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), - le16_to_cpu(cmd->seqnum)); - lbs_deb_leave(LBS_DEB_SCAN); return 0; } -static inline int is_same_network(struct bss_descriptor *src, - struct bss_descriptor *dst) -{ - /* A network is only a duplicate if the channel, BSSID, and ESSID - * all match. We treat all with the same BSSID and channel - * as one network */ - return ((src->ssid_len == dst->ssid_len) && - (src->channel == dst->channel) && - !compare_ether_addr(src->bssid, dst->bssid) && - !memcmp(src->ssid, dst->ssid, src->ssid_len)); -} - /** * @brief This function handles the command response of scan * @@ -1725,7 +1574,7 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft); scanrespsize = le16_to_cpu(get_unaligned((u16*)&resp->size)); - lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n", + lbs_deb_scan("SCAN_RESP: scan results %d\n", pscan->nr_sets); pbssinfo = pscan->bssdesc_and_tlvbuffer; @@ -1788,7 +1637,7 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) continue; } - lbs_deb_scan("SCAN_RESP: BSSID = %s\n", + lbs_deb_scan("SCAN_RESP: BSSID %s\n", print_mac(mac, new.bssid)); /* Copy the locally created newbssentry to the scan table */ -- cgit v1.2.3 From 0856e6816b30a84aa74c70ecb2bde0c41402f647 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 7 Dec 2007 15:12:26 +0000 Subject: libertas: when usb_submit_usb fails, include the error code in the printk Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index d5fc7d7ed53..e9190a6a1dc 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -424,7 +424,7 @@ static int usb_tx_block(struct usb_card_rec *cardp, u8 * payload, u16 nb) if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { /* transfer failed */ - lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n"); + lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed: %d\n", ret); ret = -1; } else { /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */ @@ -462,7 +462,7 @@ static int __if_usb_submit_rx_urb(struct usb_card_rec *cardp, /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */ if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { /* handle failure conditions */ - lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n"); + lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed: %d\n", ret); kfree_skb(skb); rinfo->skb = NULL; ret = -1; -- cgit v1.2.3 From 1723047d6742cc172d5c0f1a5245deaee67ff331 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 7 Dec 2007 15:13:05 +0000 Subject: libertas: Switch to using a callback function pointer for commands Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 31 +++++++++++++++++++++++++------ drivers/net/wireless/libertas/cmdresp.c | 23 ++++++++--------------- drivers/net/wireless/libertas/hostcmd.h | 1 + 3 files changed, 34 insertions(+), 21 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index b1ea878863a..ebfcb7bac68 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1659,7 +1659,8 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) wake_up_interruptible(&ptempnode->cmdwait_q); ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; - ptempnode->pdata_size = 0; + ptempnode->pdata_size = NULL; + ptempnode->callback = NULL; if (ptempnode->bufvirtualaddr != NULL) memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); @@ -1687,7 +1688,8 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; - ptempnode->pdata_size = 0; + ptempnode->pdata_size = NULL; + ptempnode->callback = NULL; lbs_deb_leave(LBS_DEB_HOST); } @@ -2012,10 +2014,26 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * @return -1 in case of a higher level error, otherwise * the result code from the firmware */ -int lbs_cmd(struct lbs_private *priv, - u16 command, - void *cmd, int cmd_size, - void *rsp, int *rsp_size) + +static int lbs_cmd_callback(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv) +{ + struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; + struct lbs_adapter *adapter = priv->adapter; + u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; + + if (sz > *adapter->cur_cmd->pdata_size) { + lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n", + respcmd, sz, *adapter->cur_cmd->pdata_size); + sz = *adapter->cur_cmd->pdata_size; + } + memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz); + *adapter->cur_cmd->pdata_size = sz; + + return 0; +} + +int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size, + void *rsp, int *rsp_size) { struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; @@ -2053,6 +2071,7 @@ int lbs_cmd(struct lbs_private *priv, cmdnode->wait_option = CMD_OPTION_WAITFORRSP; cmdnode->pdata_buf = rsp; cmdnode->pdata_size = rsp_size; + cmdnode->callback = lbs_cmd_callback; /* Set sequence number, clean result, move to buffer */ adapter->seqnum++; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 22a69736338..20ca38c7f87 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -880,22 +880,15 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - if (adapter->cur_cmd->pdata_size) { - struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; - u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; - if (sz > *adapter->cur_cmd->pdata_size) { - lbs_pr_err("response 0x%04x doesn't fit into " - "buffer (%d > %d)\n", respcmd, - sz, *adapter->cur_cmd->pdata_size); - sz = *adapter->cur_cmd->pdata_size; - } - memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz); - *adapter->cur_cmd->pdata_size = sz; - } else { - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&adapter->driver_lock, flags); + + if (adapter->cur_cmd && adapter->cur_cmd->callback) + ret = adapter->cur_cmd->callback(respcmd, resp, priv); + else ret = handle_cmd_response(respcmd, resp, priv); - spin_lock_irqsave(&adapter->driver_lock, flags); - } + + spin_lock_irqsave(&adapter->driver_lock, flags); + if (adapter->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index be69ae65292..5ef65ae0de5 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -72,6 +72,7 @@ struct cmd_ctrl_node { /* command response */ void *pdata_buf; int *pdata_size; + int (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv); /* command data */ u8 *bufvirtualaddr; /* wait queue */ -- cgit v1.2.3 From c2df2efe96742b78454acdffe6d278ae334fc838 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Fri, 7 Dec 2007 15:30:44 +0000 Subject: libertas: endianness fixes Recently I found that that sparse by default doesn't endianness checks. So I changed my compilation habit to be make modules C=1 SUBDIRS=drivers/net/wireless/libertas CHECKFLAGS="-D__CHECK_ENDIAN__" so that I get the little-endian checks from sparse as well. That showed up a good bunch of problems. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/11d.c | 2 +- drivers/net/wireless/libertas/cmd.c | 28 ++++++++++++++-------------- drivers/net/wireless/libertas/cmdresp.c | 2 +- drivers/net/wireless/libertas/hostcmd.h | 8 ++++---- drivers/net/wireless/libertas/if_sdio.c | 2 +- drivers/net/wireless/libertas/if_usb.c | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 377dcb5b8f0..013965d4051 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -518,7 +518,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, - (int)(cmd->size)); + le16_to_cpu(cmd->size)); goto done; } diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index ebfcb7bac68..cf1ab8a345f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -431,7 +431,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, u8 mode = (u8) (size_t) pdata_buf; pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I); - pSNMPMIB->bufsize = sizeof(u8); + pSNMPMIB->bufsize = cpu_to_le16(sizeof(u8)); if (mode == IW_MODE_ADHOC) { ucTemp = SNMP_MIB_VALUE_ADHOC; } else { @@ -451,8 +451,8 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I); if (cmd_action == CMD_ACT_SET) { - pSNMPMIB->querytype = CMD_ACT_SET; - pSNMPMIB->bufsize = sizeof(u16); + pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); + pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); ulTemp = *(u32 *)pdata_buf; *((__le16 *)(pSNMPMIB->value)) = cpu_to_le16((u16) ulTemp); @@ -484,7 +484,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, { u32 ulTemp; - pSNMPMIB->oid = le16_to_cpu((u16) RTSTHRESH_I); + pSNMPMIB->oid = cpu_to_le16(RTSTHRESH_I); if (cmd_action == CMD_ACT_GET) { pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET); @@ -759,7 +759,7 @@ static int lbs_cmd_reg_access(struct lbs_private *priv, offval = (struct lbs_offset_value *)pdata_buf; - switch (cmdptr->command) { + switch (le16_to_cpu(cmdptr->command)) { case CMD_MAC_REG_ACCESS: { struct cmd_ds_mac_reg_access *macreg; @@ -999,7 +999,7 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, } /* Exit_PS command needs to be queued in the header always. */ - if (cmdptr->command == CMD_802_11_PS_MODE) { + if (le16_to_cpu(cmdptr->command) == CMD_802_11_PS_MODE) { struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { if (adapter->psstate != PS_STATE_FULL_POWER) @@ -1062,15 +1062,14 @@ static int DownloadcommandToStation(struct lbs_private *priv, adapter->cur_cmd_retcode = 0; spin_unlock_irqrestore(&adapter->driver_lock, flags); - cmdsize = cmdptr->size; - command = cpu_to_le16(cmdptr->command); + cmdsize = le16_to_cpu(cmdptr->size); + command = le16_to_cpu(cmdptr->command); lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n", - command, le16_to_cpu(cmdptr->size), jiffies); + command, cmdsize, jiffies); lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize); cmdnode->cmdwaitqwoken = 0; - cmdsize = cpu_to_le16(cmdsize); ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); @@ -1426,9 +1425,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, #define ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN 8 cmdptr->size = - cpu_to_le16(gpio->header.len + S_DS_GEN + - ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN); - gpio->header.len = cpu_to_le16(gpio->header.len); + cpu_to_le16(le16_to_cpu(gpio->header.len) + + S_DS_GEN + + ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN); + gpio->header.len = gpio->header.len; ret = 0; break; @@ -2019,7 +2019,7 @@ static int lbs_cmd_callback(uint16_t respcmd, struct cmd_ds_command *resp, struc { struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; struct lbs_adapter *adapter = priv->adapter; - u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; + u16 sz = le16_to_cpu(resp->size) - S_DS_GEN; if (sz > *adapter->cur_cmd->pdata_size) { lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n", diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 20ca38c7f87..f6c1016b2bb 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -561,7 +561,7 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_CMD); if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) { - dst_event->events = le16_to_cpu(cmd_event->events); + dst_event->events = cmd_event->events; memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv)); } diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 5ef65ae0de5..efdb720d9fe 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -419,13 +419,13 @@ struct cmd_ds_802_11_rf_antenna { }; struct cmd_ds_802_11_monitor_mode { - u16 action; - u16 mode; + __le16 action; + __le16 mode; }; struct cmd_ds_set_boot2_ver { - u16 action; - u16 version; + __le16 action; + __le16 version; }; struct cmd_ds_802_11_ps_mode { diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index cccca311f75..181ebf0fc0d 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -454,7 +454,7 @@ static int if_sdio_prog_helper(struct if_sdio_card *card) chunk_size = min(size, (size_t)60); - *((u32*)chunk_buffer) = cpu_to_le32(chunk_size); + *((__le32*)chunk_buffer) = cpu_to_le32(chunk_size); memcpy(chunk_buffer + 4, firmware, chunk_size); /* lbs_deb_sdio("sending %d bytes chunk\n", chunk_size); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index e9190a6a1dc..a17371fe2fe 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -107,7 +107,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) int rsp_len = sizeof(b2_cmd); b2_cmd.action = 0; - b2_cmd.version = cpu_to_le16(priv->boot2_version); + b2_cmd.version = priv->boot2_version; if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), &b2_cmd, &rsp_len)) { @@ -227,7 +227,7 @@ static int if_usb_probe(struct usb_interface *intf, priv->hw_host_to_card = if_usb_host_to_card; priv->hw_get_int_status = if_usb_get_int_status; priv->hw_read_event_cause = if_usb_read_event_cause; - priv->boot2_version = le16_to_cpu(udev->descriptor.bcdDevice); + priv->boot2_version = udev->descriptor.bcdDevice; /* Delay 200 ms to waiting for the FW ready */ if_usb_submit_rx_urb(cardp); -- cgit v1.2.3 From c12bdc45d9bc4e576ca54944b708cd45c738ec07 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 7 Dec 2007 19:32:12 +0000 Subject: libertas: Don't set IW_ENCODE_NOKEY when returning WEP keys. Also clean up the double setting/clearing of IW_ENCODE_DISABLED. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/wext.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index b8c93c0adb2..1af140bbbcb 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -1122,14 +1122,6 @@ static int lbs_get_encode(struct net_device *dev, break; } - if ( adapter->secinfo.wep_enabled - || adapter->secinfo.WPAenabled - || adapter->secinfo.WPA2enabled) { - dwrq->flags &= ~IW_ENCODE_DISABLED; - } else { - dwrq->flags |= IW_ENCODE_DISABLED; - } - memset(extra, 0, 16); mutex_lock(&adapter->lock); @@ -1150,14 +1142,13 @@ static int lbs_get_encode(struct net_device *dev, || (adapter->secinfo.WPA2enabled)) { /* return WPA enabled */ dwrq->flags &= ~IW_ENCODE_DISABLED; + dwrq->flags |= IW_ENCODE_NOKEY; } else { dwrq->flags |= IW_ENCODE_DISABLED; } mutex_unlock(&adapter->lock); - dwrq->flags |= IW_ENCODE_NOKEY; - lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n", extra[0], extra[1], extra[2], extra[3], extra[4], extra[5], dwrq->length); -- cgit v1.2.3 From 99c893f34ab932171af27264c0cba4946ca0c355 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 00:23:55 +0000 Subject: libertas: Fix up error handling in lbs_setuserscan() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/debugfs.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index d3a47cc9547..b0a76c5bec6 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -293,18 +293,23 @@ static ssize_t lbs_setuserscan(struct file *file, struct lbs_ioctl_user_scan_cfg *scan_cfg; union iwreq_data wrqu; int dur; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = (char *)get_zeroed_page(GFP_KERNEL); - scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL); - if (!scan_cfg) + if (!buf) return -ENOMEM; - + buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; - goto out_unlock; + goto out_buf; + } + + scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL); + if (!scan_cfg) { + res = -ENOMEM; + goto out_buf; } + res = count; scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY; @@ -317,15 +322,19 @@ static ssize_t lbs_setuserscan(struct file *file, lbs_scan_networks(priv, scan_cfg, 1); wait_event_interruptible(priv->adapter->cmd_pending, - !priv->adapter->nr_cmd_pending); + priv->adapter->surpriseremoved || !priv->adapter->nr_cmd_pending); + + if (priv->adapter->surpriseremoved) + goto out_scan_cfg; memset(&wrqu, 0x00, sizeof(union iwreq_data)); wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); -out_unlock: - free_page(addr); + out_scan_cfg: kfree(scan_cfg); - return count; + out_buf: + free_page((unsigned long)buf); + return res; } -- cgit v1.2.3 From ac47246e246c183ed68b3fdb307a83d00313a325 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 00:35:00 +0000 Subject: libertas: kill adapter->nr_cmd_pending Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 6 ++---- drivers/net/wireless/libertas/cmdresp.c | 5 ----- drivers/net/wireless/libertas/debugfs.c | 3 ++- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/main.c | 4 +--- 5 files changed, 5 insertions(+), 14 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index cf1ab8a345f..092c295e380 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1009,10 +1009,9 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, spin_lock_irqsave(&adapter->driver_lock, flags); - if (addtail) { + if (addtail) list_add_tail(&cmdnode->list, &adapter->cmdpendingq); - adapter->nr_cmd_pending++; - } else + else list_add(&cmdnode->list, &adapter->cmdpendingq); spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -1078,7 +1077,6 @@ static int DownloadcommandToStation(struct lbs_private *priv, spin_lock_irqsave(&adapter->driver_lock, flags); adapter->cur_cmd_retcode = ret; __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); goto done; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index f6c1016b2bb..44865bf12ba 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -791,7 +791,6 @@ int lbs_process_rx_command(struct lbs_private *priv) lbs_deb_host("invalid response!\n"); adapter->cur_cmd_retcode = -1; __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); ret = -1; @@ -848,7 +847,6 @@ int lbs_process_rx_command(struct lbs_private *priv) } __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -872,7 +870,6 @@ int lbs_process_rx_command(struct lbs_private *priv) } __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->nr_cmd_pending--; adapter->cur_cmd = NULL; spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -892,8 +889,6 @@ int lbs_process_rx_command(struct lbs_private *priv) if (adapter->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->nr_cmd_pending--; - WARN_ON(adapter->nr_cmd_pending > 128); adapter->cur_cmd = NULL; } spin_unlock_irqrestore(&adapter->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index b0a76c5bec6..9a041e5b209 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -322,7 +322,8 @@ static ssize_t lbs_setuserscan(struct file *file, lbs_scan_networks(priv, scan_cfg, 1); wait_event_interruptible(priv->adapter->cmd_pending, - priv->adapter->surpriseremoved || !priv->adapter->nr_cmd_pending); + priv->adapter->surpriseremoved || + (!priv->adapter->cur_cmd && list_empty(&priv->adapter->cmdpendingq))); if (priv->adapter->surpriseremoved) goto out_scan_cfg; diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 96a34c5bce8..fb26f18e446 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -231,7 +231,6 @@ struct lbs_adapter { struct list_head cmdpendingq; wait_queue_head_t cmd_pending; - u8 nr_cmd_pending; /* command related variables protected by adapter->driver_lock */ /** Async and Sync Event variables */ diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index a5b573ce545..500357ba48d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -929,14 +929,13 @@ static int lbs_thread(void *data) /* Wake-up command waiters which can't sleep in * lbs_prepare_and_send_command */ - if (!adapter->nr_cmd_pending) + if (!list_empty(&adapter->cmdpendingq)) wake_up_all(&adapter->cmd_pending); lbs_tx_runqueue(priv); } del_timer(&adapter->command_timer); - adapter->nr_cmd_pending = 0; wake_up_all(&adapter->cmd_pending); lbs_deb_leave(LBS_DEB_THREAD); @@ -1105,7 +1104,6 @@ static int lbs_init_adapter(struct lbs_private *priv) spin_lock_init(&adapter->driver_lock); init_waitqueue_head(&adapter->cmd_pending); - adapter->nr_cmd_pending = 0; /* Allocate the command buffers */ if (lbs_allocate_cmd_buffer(priv)) { -- cgit v1.2.3 From 448a51ae0684c146c9f9ba4e178ab2182512258f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 00:59:54 +0000 Subject: libertas: switch lbs_cmd() to take a callback function pointer All existing code which sends commands is set up to have some function called with the results, not to get data back. It's more versatile this way, and providing it with a callback function which involves memcpy() is hardly difficult. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 30 ++++-------------------------- drivers/net/wireless/libertas/decl.h | 6 ++---- drivers/net/wireless/libertas/hostcmd.h | 1 - drivers/net/wireless/libertas/if_usb.c | 5 +---- 4 files changed, 7 insertions(+), 35 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 092c295e380..6838c9cd856 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1657,7 +1657,6 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) wake_up_interruptible(&ptempnode->cmdwait_q); ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; - ptempnode->pdata_size = NULL; ptempnode->callback = NULL; if (ptempnode->bufvirtualaddr != NULL) @@ -1686,7 +1685,6 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; - ptempnode->pdata_size = NULL; ptempnode->callback = NULL; lbs_deb_leave(LBS_DEB_HOST); @@ -2013,25 +2011,8 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * the result code from the firmware */ -static int lbs_cmd_callback(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv) -{ - struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; - struct lbs_adapter *adapter = priv->adapter; - u16 sz = le16_to_cpu(resp->size) - S_DS_GEN; - - if (sz > *adapter->cur_cmd->pdata_size) { - lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n", - respcmd, sz, *adapter->cur_cmd->pdata_size); - sz = *adapter->cur_cmd->pdata_size; - } - memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz); - *adapter->cur_cmd->pdata_size = sz; - - return 0; -} - -int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size, - void *rsp, int *rsp_size) +int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, + int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)) { struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; @@ -2040,9 +2021,8 @@ int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size, int ret = 0; lbs_deb_enter(LBS_DEB_HOST); - lbs_deb_host("rsp at %p, rsp_size at %p\n", rsp, rsp_size); - if (!adapter || !rsp_size) { + if (!adapter) { lbs_deb_host("PREP_CMD: adapter is NULL\n"); ret = -1; goto done; @@ -2067,9 +2047,7 @@ int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size, cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; cmdnode->wait_option = CMD_OPTION_WAITFORRSP; - cmdnode->pdata_buf = rsp; - cmdnode->pdata_size = rsp_size; - cmdnode->callback = lbs_cmd_callback; + cmdnode->callback = callback; /* Set sequence number, clean result, move to buffer */ adapter->seqnum++; diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 6f47ff08962..1a8fdaa7375 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -24,10 +24,8 @@ void lbs_send_tx_feedback(struct lbs_private *priv); int lbs_free_cmd_buffer(struct lbs_private *priv); -int lbs_cmd(struct lbs_private *priv, - u16 command, - void *cmd, int cmd_size, - void *resp, int *resp_size); +int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, + int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)); int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index efdb720d9fe..f1c1d3f106c 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -71,7 +71,6 @@ struct cmd_ctrl_node { u16 wait_option; /* command response */ void *pdata_buf; - int *pdata_size; int (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv); /* command data */ u8 *bufvirtualaddr; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index a17371fe2fe..7c4bd8d982a 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -104,15 +104,12 @@ static void if_usb_free(struct usb_card_rec *cardp) static void if_usb_set_boot2_ver(struct lbs_private *priv) { struct cmd_ds_set_boot2_ver b2_cmd; - int rsp_len = sizeof(b2_cmd); b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; - if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), - &b2_cmd, &rsp_len)) { + if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL)) lbs_deb_usb("Setting boot2 version failed\n"); - } } -- cgit v1.2.3 From 59f3e4bf1e3bc385d91a993d75865f99baa0486d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 17:42:59 +0000 Subject: libertas: clean up lbs_thread() to make it slightly more readable No semantic changes. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 92 ++++++++++++++---------------------- 1 file changed, 36 insertions(+), 56 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 500357ba48d..f595664f98c 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -795,70 +795,60 @@ static int lbs_thread(void *data) init_waitqueue_entry(&wait, current); set_freezable(); + for (;;) { - lbs_deb_thread( "main-thread 111: intcounter=%d " - "currenttxskb=%p dnld_sent=%d\n", - adapter->intcounter, - adapter->currenttxskb, priv->dnld_sent); + lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", + adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); add_wait_queue(&priv->waitq, &wait); set_current_state(TASK_INTERRUPTIBLE); spin_lock_irq(&adapter->driver_lock); + if ((adapter->psstate == PS_STATE_SLEEP) || - (!adapter->intcounter - && (priv->dnld_sent || adapter->cur_cmd || - list_empty(&adapter->cmdpendingq)))) { - lbs_deb_thread( - "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", - adapter->connect_status, adapter->intcounter, - adapter->psmode, adapter->psstate); + (!adapter->intcounter && (priv->dnld_sent || adapter->cur_cmd || list_empty(&adapter->cmdpendingq)))) { + lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", + adapter->connect_status, adapter->intcounter, + adapter->psmode, adapter->psstate); spin_unlock_irq(&adapter->driver_lock); schedule(); } else spin_unlock_irq(&adapter->driver_lock); - lbs_deb_thread( - "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " - "dnld_sent=%d\n", adapter->intcounter, - adapter->currenttxskb, priv->dnld_sent); + lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n", + adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); set_current_state(TASK_RUNNING); remove_wait_queue(&priv->waitq, &wait); try_to_freeze(); - lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p " - "dnld_sent=%d\n", - adapter->intcounter, - adapter->currenttxskb, priv->dnld_sent); + lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n", + adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); - if (kthread_should_stop() - || adapter->surpriseremoved) { - lbs_deb_thread( - "main-thread: break from main thread: surpriseremoved=0x%x\n", - adapter->surpriseremoved); + if (kthread_should_stop() || adapter->surpriseremoved) { + lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n", + adapter->surpriseremoved); break; } spin_lock_irq(&adapter->driver_lock); + if (adapter->intcounter) { u8 int_status; + adapter->intcounter = 0; int_status = priv->hw_get_int_status(priv, &ireg); if (int_status) { - lbs_deb_thread( - "main-thread: reading HOST_INT_STATUS_REG failed\n"); + lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n"); spin_unlock_irq(&adapter->driver_lock); continue; } adapter->hisregcpy |= ireg; } - lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p " - "dnld_sent=%d\n", - adapter->intcounter, - adapter->currenttxskb, priv->dnld_sent); + lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n", + adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); /* command response? */ if (adapter->hisregcpy & MRVDRV_CMD_UPLD_RDY) { @@ -877,8 +867,7 @@ static int lbs_thread(void *data) adapter->hisregcpy &= ~MRVDRV_CARDEVENT; if (priv->hw_read_event_cause(priv)) { - lbs_pr_alert( - "main-thread: hw_read_event_cause failed\n"); + lbs_pr_alert("main-thread: hw_read_event_cause failed\n"); spin_unlock_irq(&adapter->driver_lock); continue; } @@ -888,30 +877,21 @@ static int lbs_thread(void *data) spin_unlock_irq(&adapter->driver_lock); /* Check if we need to confirm Sleep Request received previously */ - if (adapter->psstate == PS_STATE_PRE_SLEEP) { - if (!priv->dnld_sent && !adapter->cur_cmd) { - if (adapter->connect_status == - LBS_CONNECTED) { - lbs_deb_thread( - "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " - "dnld_sent=%d cur_cmd=%p, confirm now\n", - adapter->intcounter, - adapter->currenttxskb, - priv->dnld_sent, - adapter->cur_cmd); - - lbs_ps_confirm_sleep(priv, - (u16) adapter->psmode); - } else { - /* workaround for firmware sending - * deauth/linkloss event immediately - * after sleep request, remove this - * after firmware fixes it - */ - adapter->psstate = PS_STATE_AWAKE; - lbs_pr_alert( - "main-thread: ignore PS_SleepConfirm in non-connected state\n"); - } + if (adapter->psstate == PS_STATE_PRE_SLEEP && + !priv->dnld_sent && !adapter->cur_cmd) { + if (adapter->connect_status == LBS_CONNECTED) { + lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n", + adapter->intcounter, adapter->currenttxskb, priv->dnld_sent, adapter->cur_cmd); + + lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); + } else { + /* workaround for firmware sending + * deauth/linkloss event immediately + * after sleep request; remove this + * after firmware fixes it + */ + adapter->psstate = PS_STATE_AWAKE; + lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n"); } } -- cgit v1.2.3 From e7deced05f15693cca71bfae747b8d57eadeb1b2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 18:29:16 +0000 Subject: libertas: fix lbs_rtap attribute in sysfs At least it doesn't oops when you attempt to read or write it now. Only when you enable it and then later turn it off. And when it's enabled I don't see how it actually works. But one fewer oops is good, for now... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 2 -- drivers/net/wireless/libertas/main.c | 18 ++++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index fb26f18e446..5cb29235fee 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -143,8 +143,6 @@ struct lbs_private { all other bits reserved 0 */ u8 dnld_sent; - struct device *hotplug_device; - /** thread to service interrupts */ struct task_struct *main_thread; wait_queue_head_t waitq; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index f595664f98c..d03a2f8710f 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -256,8 +256,7 @@ void lbs_remove_rtap(struct lbs_private *priv); static ssize_t lbs_rtap_get(struct device *dev, struct device_attribute *attr, char * buf) { - struct lbs_private *priv = (struct lbs_private *) - (to_net_dev(dev))->priv; + struct lbs_private *priv = to_net_dev(dev)->priv; struct lbs_adapter *adapter = priv->adapter; return snprintf(buf, 5, "0x%X\n", adapter->monitormode); } @@ -269,8 +268,7 @@ static ssize_t lbs_rtap_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { int monitor_mode; - struct lbs_private *priv = (struct lbs_private *) - (to_net_dev(dev))->priv; + struct lbs_private *priv = to_net_dev(dev)->priv; struct lbs_adapter *adapter = priv->adapter; sscanf(buf, "%x", &monitor_mode); @@ -1158,7 +1156,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) priv->card = card; priv->mesh_open = 0; priv->infra_open = 0; - priv->hotplug_device = dmdev; /* Setup the OS Interface to our functions */ dev->open = lbs_open; @@ -1178,15 +1175,13 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) SET_NETDEV_DEV(dev, dmdev); priv->rtap_net_dev = NULL; - if (device_create_file(dmdev, &dev_attr_lbs_rtap)) - goto err_init_adapter; lbs_deb_thread("Starting main thread...\n"); init_waitqueue_head(&priv->waitq); priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); if (IS_ERR(priv->main_thread)) { lbs_deb_thread("Error creating main thread.\n"); - goto err_kthread_run; + goto err_init_adapter; } priv->work_thread = create_singlethread_workqueue("lbs_worker"); @@ -1196,9 +1191,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) goto done; -err_kthread_run: - device_remove_file(dmdev, &dev_attr_lbs_rtap); - err_init_adapter: lbs_free_adapter(priv); @@ -1224,7 +1216,7 @@ int lbs_remove_card(struct lbs_private *priv) lbs_remove_rtap(priv); dev = priv->dev; - device_remove_file(priv->hotplug_device, &dev_attr_lbs_rtap); + device_remove_file(&dev->dev, &dev_attr_lbs_rtap); cancel_delayed_work(&priv->scan_work); cancel_delayed_work(&priv->assoc_work); @@ -1273,6 +1265,8 @@ int lbs_start_card(struct lbs_private *priv) lbs_pr_err("cannot register ethX device\n"); goto done; } + if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) + lbs_pr_err("cannot register lbs_rtap attribute\n"); lbs_debugfs_init_one(priv, dev); -- cgit v1.2.3 From f86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 19:46:19 +0000 Subject: libertas: kill TxLockFlag We don't need this. We can use adapter->currenttxskb instead. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/main.c | 25 ++++++++++++++++++++++--- drivers/net/wireless/libertas/tx.c | 9 +++------ 3 files changed, 25 insertions(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 5cb29235fee..eaa45d4bb9d 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -285,7 +285,6 @@ struct lbs_adapter { /** Tx-related variables (for single packet tx) */ struct sk_buff *currenttxskb; - u16 TxLockFlag; /** NIC Operation characteristics */ u16 currentpacketfilter; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index d03a2f8710f..7155f481816 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -290,8 +290,14 @@ static ssize_t lbs_rtap_set(struct device *dev, return strlen(buf); adapter->monitormode = LBS_MONITOR_OFF; lbs_remove_rtap(priv); - netif_wake_queue(priv->dev); - netif_wake_queue(priv->mesh_dev); + + if (adapter->currenttxskb) { + dev_kfree_skb_any(adapter->currenttxskb); + adapter->currenttxskb = NULL; + } + + /* Wake queues, command thread, etc. */ + lbs_host_to_card_done(priv); } lbs_prepare_and_send_command(priv, @@ -521,7 +527,15 @@ static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) lbs_deb_enter(LBS_DEB_TX); - if (priv->dnld_sent || priv->adapter->TxLockFlag) { + /* We could return NETDEV_TX_BUSY here, but I'd actually + like to get the point where we can BUG() */ + if (priv->dnld_sent) { + lbs_pr_err("%s while dnld_sent\n", __func__); + priv->stats.tx_dropped++; + goto done; + } + if (priv->adapter->currenttxskb) { + lbs_pr_err("%s while TX skb pending\n", __func__); priv->stats.tx_dropped++; goto done; } @@ -624,6 +638,11 @@ void lbs_host_to_card_done(struct lbs_private *priv) if (!adapter->cur_cmd) wake_up_interruptible(&priv->waitq); + /* Don't wake netif queues if we're in monitor mode and + a TX packet is already pending. */ + if (priv->adapter->currenttxskb) + return; + if (priv->dev && adapter->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index b423ce1ff42..131ef3fe033 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -152,11 +152,11 @@ done: netif_stop_queue(priv->dev); if (priv->mesh_dev) netif_stop_queue(priv->mesh_dev); - /* freeze any packets already in our queues */ - priv->adapter->TxLockFlag = 1; + + /* Keep the skb around for when we get feedback */ + priv->adapter->currenttxskb = skb; } else { dev_kfree_skb_any(skb); - priv->adapter->currenttxskb = NULL; } lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); @@ -227,8 +227,6 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) return ret; } - priv->adapter->currenttxskb = skb; - ret = SendSinglePacket(priv, skb); done: lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); @@ -272,7 +270,6 @@ void lbs_send_tx_feedback(struct lbs_private *priv) (1 + adapter->txretrycount - try_count) : 0; lbs_upload_rx_packet(priv, adapter->currenttxskb); adapter->currenttxskb = NULL; - priv->adapter->TxLockFlag = 0; if (adapter->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); -- cgit v1.2.3 From aa21c004f80bdf943736c62dccf0c0398d7824f3 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 20:04:36 +0000 Subject: libertas: kill struct lbs_adapter There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/11d.c | 68 +++--- drivers/net/wireless/libertas/assoc.c | 136 ++++++------ drivers/net/wireless/libertas/assoc.h | 2 +- drivers/net/wireless/libertas/cmd.c | 278 +++++++++++------------- drivers/net/wireless/libertas/cmdresp.c | 336 ++++++++++++++--------------- drivers/net/wireless/libertas/debugfs.c | 56 +++-- drivers/net/wireless/libertas/decl.h | 7 +- drivers/net/wireless/libertas/dev.h | 97 +++++---- drivers/net/wireless/libertas/ethtool.c | 19 +- drivers/net/wireless/libertas/if_cs.c | 21 +- drivers/net/wireless/libertas/if_sdio.c | 20 +- drivers/net/wireless/libertas/if_usb.c | 27 ++- drivers/net/wireless/libertas/join.c | 150 ++++++------- drivers/net/wireless/libertas/main.c | 326 +++++++++++++--------------- drivers/net/wireless/libertas/rx.c | 78 ++++--- drivers/net/wireless/libertas/scan.c | 188 ++++++++-------- drivers/net/wireless/libertas/scan.h | 6 +- drivers/net/wireless/libertas/tx.c | 63 +++--- drivers/net/wireless/libertas/wext.c | 372 +++++++++++++++----------------- 19 files changed, 1046 insertions(+), 1204 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 013965d4051..5e10ce0d351 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -432,8 +432,8 @@ u8 lbs_get_scan_type_11d(u8 chan, void lbs_init_11d(struct lbs_private *priv) { - priv->adapter->enable11d = 0; - memset(&(priv->adapter->parsed_region_chan), 0, + priv->enable11d = 0; + memset(&(priv->parsed_region_chan), 0, sizeof(struct parsed_region_chan_11d)); return; } @@ -447,7 +447,7 @@ static int set_domain_info_11d(struct lbs_private *priv) { int ret; - if (!priv->adapter->enable11d) { + if (!priv->enable11d) { lbs_deb_11d("dnld domain Info with 11d disabled\n"); return 0; } @@ -469,22 +469,21 @@ static int set_domain_info_11d(struct lbs_private *priv) */ int lbs_set_universaltable(struct lbs_private *priv, u8 band) { - struct lbs_adapter *adapter = priv->adapter; u16 size = sizeof(struct chan_freq_power); u16 i = 0; - memset(adapter->universal_channel, 0, - sizeof(adapter->universal_channel)); + memset(priv->universal_channel, 0, + sizeof(priv->universal_channel)); - adapter->universal_channel[i].nrcfp = + priv->universal_channel[i].nrcfp = sizeof(channel_freq_power_UN_BG) / size; lbs_deb_11d("BG-band nrcfp %d\n", - adapter->universal_channel[i].nrcfp); + priv->universal_channel[i].nrcfp); - adapter->universal_channel[i].CFP = channel_freq_power_UN_BG; - adapter->universal_channel[i].valid = 1; - adapter->universal_channel[i].region = UNIVERSAL_REGION_CODE; - adapter->universal_channel[i].band = band; + priv->universal_channel[i].CFP = channel_freq_power_UN_BG; + priv->universal_channel[i].valid = 1; + priv->universal_channel[i].region = UNIVERSAL_REGION_CODE; + priv->universal_channel[i].band = band; i++; return 0; @@ -505,8 +504,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, struct cmd_ds_802_11d_domain_info *pdomaininfo = &cmd->params.domaininfo; struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain; - struct lbs_adapter *adapter = priv->adapter; - u8 nr_subband = adapter->domainreg.nr_subband; + u8 nr_subband = priv->domainreg.nr_subband; lbs_deb_enter(LBS_DEB_11D); @@ -523,7 +521,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, } domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); - memcpy(domain->countrycode, adapter->domainreg.countrycode, + memcpy(domain->countrycode, priv->domainreg.countrycode, sizeof(domain->countrycode)); domain->header.len = @@ -531,7 +529,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, sizeof(domain->countrycode)); if (nr_subband) { - memcpy(domain->subband, adapter->domainreg.subband, + memcpy(domain->subband, priv->domainreg.subband, nr_subband * sizeof(struct ieeetypes_subbandset)); cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + @@ -605,24 +603,23 @@ int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, struct bss_descriptor * bss) { int ret; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_11D); - if (priv->adapter->enable11d) { - memset(&adapter->parsed_region_chan, 0, + if (priv->enable11d) { + memset(&priv->parsed_region_chan, 0, sizeof(struct parsed_region_chan_11d)); ret = parse_domain_info_11d(&bss->countryinfo, 0, - &adapter->parsed_region_chan); + &priv->parsed_region_chan); if (ret == -1) { lbs_deb_11d("error parsing domain_info from AP\n"); goto done; } - memset(&adapter->domainreg, 0, + memset(&priv->domainreg, 0, sizeof(struct lbs_802_11d_domain_reg)); - generate_domain_info_11d(&adapter->parsed_region_chan, - &adapter->domainreg); + generate_domain_info_11d(&priv->parsed_region_chan, + &priv->domainreg); ret = set_domain_info_11d(priv); @@ -646,18 +643,17 @@ done: int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv) { int ret; - struct lbs_adapter *adapter = priv->adapter; struct region_channel *region_chan; u8 j; lbs_deb_enter(LBS_DEB_11D); - lbs_deb_11d("curbssparams.band %d\n", adapter->curbssparams.band); + lbs_deb_11d("curbssparams.band %d\n", priv->curbssparams.band); - if (priv->adapter->enable11d) { + if (priv->enable11d) { /* update parsed_region_chan_11; dnld domaininf to FW */ - for (j = 0; j < ARRAY_SIZE(adapter->region_channel); j++) { - region_chan = &adapter->region_channel[j]; + for (j = 0; j < ARRAY_SIZE(priv->region_channel); j++) { + region_chan = &priv->region_channel[j]; lbs_deb_11d("%d region_chan->band %d\n", j, region_chan->band); @@ -665,28 +661,28 @@ int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv) if (!region_chan || !region_chan->valid || !region_chan->CFP) continue; - if (region_chan->band != adapter->curbssparams.band) + if (region_chan->band != priv->curbssparams.band) continue; break; } - if (j >= ARRAY_SIZE(adapter->region_channel)) { + if (j >= ARRAY_SIZE(priv->region_channel)) { lbs_deb_11d("region_chan not found, band %d\n", - adapter->curbssparams.band); + priv->curbssparams.band); ret = -1; goto done; } - memset(&adapter->parsed_region_chan, 0, + memset(&priv->parsed_region_chan, 0, sizeof(struct parsed_region_chan_11d)); lbs_generate_parsed_region_chan_11d(region_chan, - &adapter-> + &priv-> parsed_region_chan); - memset(&adapter->domainreg, 0, + memset(&priv->domainreg, 0, sizeof(struct lbs_802_11d_domain_reg)); - generate_domain_info_11d(&adapter->parsed_region_chan, - &adapter->domainreg); + generate_domain_info_11d(&priv->parsed_region_chan, + &priv->domainreg); ret = set_domain_info_11d(priv); diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 88da68ee0f0..63bd692c723 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -18,7 +18,6 @@ static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static int assoc_helper_essid(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; int channel = -1; @@ -38,7 +37,7 @@ static int assoc_helper_essid(struct lbs_private *priv, lbs_send_specific_ssid_scan(priv, assoc_req->ssid, assoc_req->ssid_len, 0); - bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, + bss = lbs_find_ssid_in_list(priv, assoc_req->ssid, assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); if (bss != NULL) { memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); @@ -54,7 +53,7 @@ static int assoc_helper_essid(struct lbs_private *priv, assoc_req->ssid_len, 1); /* Search for the requested SSID in the scan table */ - bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, + bss = lbs_find_ssid_in_list(priv, assoc_req->ssid, assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel); if (bss != NULL) { lbs_deb_assoc("SSID found, will join\n"); @@ -78,7 +77,6 @@ static int assoc_helper_essid(struct lbs_private *priv, static int assoc_helper_bssid(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct bss_descriptor * bss; DECLARE_MAC_BUF(mac); @@ -87,7 +85,7 @@ static int assoc_helper_bssid(struct lbs_private *priv, print_mac(mac, assoc_req->bssid)); /* Search for index position in list for requested MAC */ - bss = lbs_find_bssid_in_list(adapter, assoc_req->bssid, + bss = lbs_find_bssid_in_list(priv, assoc_req->bssid, assoc_req->mode); if (bss == NULL) { lbs_deb_assoc("ASSOC: WAP: BSSID %s not found, " @@ -138,21 +136,20 @@ static int assoc_helper_associate(struct lbs_private *priv, static int assoc_helper_mode(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); - if (assoc_req->mode == adapter->mode) + if (assoc_req->mode == priv->mode) goto done; if (assoc_req->mode == IW_MODE_INFRA) { - if (adapter->psstate != PS_STATE_FULL_POWER) + if (priv->psstate != PS_STATE_FULL_POWER) lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - adapter->psmode = LBS802_11POWERMODECAM; + priv->psmode = LBS802_11POWERMODECAM; } - adapter->mode = assoc_req->mode; + priv->mode = assoc_req->mode; ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, 0, CMD_OPTION_WAITFORRSP, @@ -191,7 +188,6 @@ void lbs_sync_channel(struct work_struct *work) static int assoc_helper_channel(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -201,11 +197,11 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_assoc("ASSOC: channel: error getting channel."); } - if (assoc_req->channel == adapter->curbssparams.channel) + if (assoc_req->channel == priv->curbssparams.channel) goto done; lbs_deb_assoc("ASSOC: channel: %d -> %d\n", - adapter->curbssparams.channel, assoc_req->channel); + priv->curbssparams.channel, assoc_req->channel); ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, CMD_OPT_802_11_RF_CHANNEL_SET, @@ -219,7 +215,7 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_assoc("ASSOC: channel: error getting channel."); } - if (assoc_req->channel != adapter->curbssparams.channel) { + if (assoc_req->channel != priv->curbssparams.channel) { lbs_deb_assoc("ASSOC: channel: failed to update channel to %d", assoc_req->channel); goto done; @@ -246,7 +242,6 @@ done: static int assoc_helper_wep_keys(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int i; int ret = 0; @@ -275,23 +270,23 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, /* enable/disable the MAC's WEP packet filter */ if (assoc_req->secinfo.wep_enabled) - adapter->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; + priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; else - adapter->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; + priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; ret = lbs_set_mac_packet_filter(priv); if (ret) goto out; - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); - /* Copy WEP keys into adapter wep key fields */ + /* Copy WEP keys into priv wep key fields */ for (i = 0; i < 4; i++) { - memcpy(&adapter->wep_keys[i], &assoc_req->wep_keys[i], + memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i], sizeof(struct enc_key)); } - adapter->wep_tx_keyidx = assoc_req->wep_tx_keyidx; + priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx; - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); out: lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); @@ -301,14 +296,13 @@ out: static int assoc_helper_secinfo(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; u32 do_wpa; u32 rsn = 0; lbs_deb_enter(LBS_DEB_ASSOC); - memcpy(&adapter->secinfo, &assoc_req->secinfo, + memcpy(&priv->secinfo, &assoc_req->secinfo, sizeof(struct lbs_802_11_security)); ret = lbs_set_mac_packet_filter(priv); @@ -396,17 +390,16 @@ out: static int assoc_helper_wpa_ie(struct lbs_private *priv, struct assoc_request * assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { - memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); - adapter->wpa_ie_len = assoc_req->wpa_ie_len; + memcpy(&priv->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); + priv->wpa_ie_len = assoc_req->wpa_ie_len; } else { - memset(&adapter->wpa_ie, 0, MAX_WPA_IE_LEN); - adapter->wpa_ie_len = 0; + memset(&priv->wpa_ie, 0, MAX_WPA_IE_LEN); + priv->wpa_ie_len = 0; } lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); @@ -414,14 +407,14 @@ static int assoc_helper_wpa_ie(struct lbs_private *priv, } -static int should_deauth_infrastructure(struct lbs_adapter *adapter, +static int should_deauth_infrastructure(struct lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0; lbs_deb_enter(LBS_DEB_ASSOC); - if (adapter->connect_status != LBS_CONNECTED) + if (priv->connect_status != LBS_CONNECTED) return 0; if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { @@ -431,7 +424,7 @@ static int should_deauth_infrastructure(struct lbs_adapter *adapter, } if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { - if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { + if (priv->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { lbs_deb_assoc("Deauthenticating due to new security\n"); ret = 1; goto out; @@ -466,16 +459,16 @@ out: } -static int should_stop_adhoc(struct lbs_adapter *adapter, +static int should_stop_adhoc(struct lbs_private *priv, struct assoc_request * assoc_req) { lbs_deb_enter(LBS_DEB_ASSOC); - if (adapter->connect_status != LBS_CONNECTED) + if (priv->connect_status != LBS_CONNECTED) return 0; - if (lbs_ssid_cmp(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len, + if (lbs_ssid_cmp(priv->curbssparams.ssid, + priv->curbssparams.ssid_len, assoc_req->ssid, assoc_req->ssid_len) != 0) return 1; @@ -486,7 +479,7 @@ static int should_stop_adhoc(struct lbs_adapter *adapter, } if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { - if (assoc_req->channel != adapter->curbssparams.channel) + if (assoc_req->channel != priv->curbssparams.channel) return 1; } @@ -499,7 +492,6 @@ void lbs_association_worker(struct work_struct *work) { struct lbs_private *priv = container_of(work, struct lbs_private, assoc_work.work); - struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req = NULL; int ret = 0; int find_any_ssid = 0; @@ -507,11 +499,11 @@ void lbs_association_worker(struct work_struct *work) lbs_deb_enter(LBS_DEB_ASSOC); - mutex_lock(&adapter->lock); - assoc_req = adapter->pending_assoc_req; - adapter->pending_assoc_req = NULL; - adapter->in_progress_assoc_req = assoc_req; - mutex_unlock(&adapter->lock); + mutex_lock(&priv->lock); + assoc_req = priv->pending_assoc_req; + priv->pending_assoc_req = NULL; + priv->in_progress_assoc_req = assoc_req; + mutex_unlock(&priv->lock); if (!assoc_req) goto done; @@ -569,8 +561,8 @@ void lbs_association_worker(struct work_struct *work) * Check if the attributes being changing require deauthentication * from the currently associated infrastructure access point. */ - if (adapter->mode == IW_MODE_INFRA) { - if (should_deauth_infrastructure(adapter, assoc_req)) { + if (priv->mode == IW_MODE_INFRA) { + if (should_deauth_infrastructure(priv, assoc_req)) { ret = lbs_send_deauthentication(priv); if (ret) { lbs_deb_assoc("Deauthentication due to new " @@ -578,8 +570,8 @@ void lbs_association_worker(struct work_struct *work) ret); } } - } else if (adapter->mode == IW_MODE_ADHOC) { - if (should_stop_adhoc(adapter, assoc_req)) { + } else if (priv->mode == IW_MODE_ADHOC) { + if (should_stop_adhoc(priv, assoc_req)) { ret = lbs_stop_adhoc_network(priv); if (ret) { lbs_deb_assoc("Teardown of AdHoc network due to " @@ -643,7 +635,7 @@ void lbs_association_worker(struct work_struct *work) success = 0; } - if (adapter->connect_status != LBS_CONNECTED) { + if (priv->connect_status != LBS_CONNECTED) { lbs_deb_assoc("ASSOC: association unsuccessful, " "not connected\n"); success = 0; @@ -651,9 +643,9 @@ void lbs_association_worker(struct work_struct *work) if (success) { lbs_deb_assoc("ASSOC: associated to '%s', %s\n", - escape_essid(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len), - print_mac(mac, adapter->curbssparams.bssid)); + escape_essid(priv->curbssparams.ssid, + priv->curbssparams.ssid_len), + print_mac(mac, priv->curbssparams.bssid)); lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -672,9 +664,9 @@ out: ret); } - mutex_lock(&adapter->lock); - adapter->in_progress_assoc_req = NULL; - mutex_unlock(&adapter->lock); + mutex_lock(&priv->lock); + priv->in_progress_assoc_req = NULL; + mutex_unlock(&priv->lock); kfree(assoc_req); done: @@ -685,15 +677,15 @@ done: /* * Caller MUST hold any necessary locks */ -struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter) +struct assoc_request *lbs_get_association_request(struct lbs_private *priv) { struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_ASSOC); - if (!adapter->pending_assoc_req) { - adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request), + if (!priv->pending_assoc_req) { + priv->pending_assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL); - if (!adapter->pending_assoc_req) { + if (!priv->pending_assoc_req) { lbs_pr_info("Not enough memory to allocate association" " request!\n"); return NULL; @@ -703,57 +695,57 @@ struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter) /* Copy current configuration attributes to the association request, * but don't overwrite any that are already set. */ - assoc_req = adapter->pending_assoc_req; + assoc_req = priv->pending_assoc_req; if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid, + memcpy(&assoc_req->ssid, &priv->curbssparams.ssid, IW_ESSID_MAX_SIZE); - assoc_req->ssid_len = adapter->curbssparams.ssid_len; + assoc_req->ssid_len = priv->curbssparams.ssid_len; } if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) - assoc_req->channel = adapter->curbssparams.channel; + assoc_req->channel = priv->curbssparams.channel; if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags)) - assoc_req->band = adapter->curbssparams.band; + assoc_req->band = priv->curbssparams.band; if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) - assoc_req->mode = adapter->mode; + assoc_req->mode = priv->mode; if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { - memcpy(&assoc_req->bssid, adapter->curbssparams.bssid, + memcpy(&assoc_req->bssid, priv->curbssparams.bssid, ETH_ALEN); } if (!test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags)) { int i; for (i = 0; i < 4; i++) { - memcpy(&assoc_req->wep_keys[i], &adapter->wep_keys[i], + memcpy(&assoc_req->wep_keys[i], &priv->wep_keys[i], sizeof(struct enc_key)); } } if (!test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) - assoc_req->wep_tx_keyidx = adapter->wep_tx_keyidx; + assoc_req->wep_tx_keyidx = priv->wep_tx_keyidx; if (!test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_mcast_key, &adapter->wpa_mcast_key, + memcpy(&assoc_req->wpa_mcast_key, &priv->wpa_mcast_key, sizeof(struct enc_key)); } if (!test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_unicast_key, &adapter->wpa_unicast_key, + memcpy(&assoc_req->wpa_unicast_key, &priv->wpa_unicast_key, sizeof(struct enc_key)); } if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { - memcpy(&assoc_req->secinfo, &adapter->secinfo, + memcpy(&assoc_req->secinfo, &priv->secinfo, sizeof(struct lbs_802_11_security)); } if (!test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_ie, &adapter->wpa_ie, + memcpy(&assoc_req->wpa_ie, &priv->wpa_ie, MAX_WPA_IE_LEN); - assoc_req->wpa_ie_len = adapter->wpa_ie_len; + assoc_req->wpa_ie_len = priv->wpa_ie_len; } lbs_deb_leave(LBS_DEB_ASSOC); diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index fad00ae0d00..08372bbf376 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h @@ -6,7 +6,7 @@ #include "dev.h" void lbs_association_worker(struct work_struct *work); -struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter); +struct assoc_request *lbs_get_association_request(struct lbs_private *priv); void lbs_sync_channel(struct work_struct *work); #endif /* _LBS_ASSOC_H */ diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 6838c9cd856..49a9aeee2b6 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -50,7 +50,7 @@ static int lbs_cmd_hw_spec(struct lbs_private *priv, struct cmd_ds_command *cmd) cmd->command = cpu_to_le16(CMD_GET_HW_SPEC); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); - memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); + memcpy(hwspec->permanentaddr, priv->current_addr, ETH_ALEN); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -123,7 +123,6 @@ static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; lbs_deb_enter(LBS_DEB_CMD); @@ -133,17 +132,17 @@ static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, cmd->command = cpu_to_le16(CMD_802_11_SLEEP_PARAMS); if (cmd_action == CMD_ACT_GET) { - memset(&adapter->sp, 0, sizeof(struct sleep_params)); + memset(&priv->sp, 0, sizeof(struct sleep_params)); memset(sp, 0, sizeof(struct cmd_ds_802_11_sleep_params)); sp->action = cpu_to_le16(cmd_action); } else if (cmd_action == CMD_ACT_SET) { sp->action = cpu_to_le16(cmd_action); - sp->error = cpu_to_le16(adapter->sp.sp_error); - sp->offset = cpu_to_le16(adapter->sp.sp_offset); - sp->stabletime = cpu_to_le16(adapter->sp.sp_stabletime); - sp->calcontrol = (u8) adapter->sp.sp_calcontrol; - sp->externalsleepclk = (u8) adapter->sp.sp_extsleepclk; - sp->reserved = cpu_to_le16(adapter->sp.sp_reserved); + sp->error = cpu_to_le16(priv->sp.sp_error); + sp->offset = cpu_to_le16(priv->sp.sp_offset); + sp->stabletime = cpu_to_le16(priv->sp.sp_stabletime); + sp->calcontrol = (u8) priv->sp.sp_calcontrol; + sp->externalsleepclk = (u8) priv->sp.sp_extsleepclk; + sp->reserved = cpu_to_le16(priv->sp.sp_reserved); } lbs_deb_leave(LBS_DEB_CMD); @@ -156,7 +155,6 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, void * pdata_buf) { struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -212,9 +210,9 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, wep->action = cpu_to_le16(CMD_ACT_REMOVE); /* default tx key index */ - wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx & + wep->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx & (u32)CMD_WEP_KEY_INDEX_MASK)); - lbs_deb_cmd("SET_WEP: remove key %d\n", adapter->wep_tx_keyidx); + lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx); } ret = 0; @@ -415,7 +413,6 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, int cmd_oid, void *pdata_buf) { struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib; - struct lbs_adapter *adapter = priv->adapter; u8 ucTemp; lbs_deb_enter(LBS_DEB_CMD); @@ -507,7 +504,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); *((__le16 *)(pSNMPMIB->value)) = - cpu_to_le16((u16) adapter->txretrycount); + cpu_to_le16((u16) priv->txretrycount); } break; @@ -534,7 +531,6 @@ static int lbs_cmd_802_11_radio_control(struct lbs_private *priv, struct cmd_ds_command *cmd, int cmd_action) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; lbs_deb_enter(LBS_DEB_CMD); @@ -546,7 +542,7 @@ static int lbs_cmd_802_11_radio_control(struct lbs_private *priv, pradiocontrol->action = cpu_to_le16(cmd_action); - switch (adapter->preamble) { + switch (priv->preamble) { case CMD_TYPE_SHORT_PREAMBLE: pradiocontrol->control = cpu_to_le16(SET_SHORT_PREAMBLE); break; @@ -561,7 +557,7 @@ static int lbs_cmd_802_11_radio_control(struct lbs_private *priv, break; } - if (adapter->radioon) + if (priv->radioon) pradiocontrol->control |= cpu_to_le16(TURN_ON_RF); else pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); @@ -640,7 +636,6 @@ static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, { struct cmd_ds_802_11_rate_adapt_rateset *rateadapt = &cmd->params.rateset; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = @@ -649,8 +644,8 @@ static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, cmd->command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET); rateadapt->action = cpu_to_le16(cmd_action); - rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto); - rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap); + rateadapt->enablehwauto = cpu_to_le16(priv->enablehwauto); + rateadapt->bitmap = cpu_to_le16(priv->ratebitmap); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -661,7 +656,6 @@ static int lbs_cmd_802_11_data_rate(struct lbs_private *priv, u16 cmd_action) { struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -672,9 +666,9 @@ static int lbs_cmd_802_11_data_rate(struct lbs_private *priv, pdatarate->action = cpu_to_le16(cmd_action); if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) { - pdatarate->rates[0] = lbs_data_rate_to_fw_index(adapter->cur_rate); + pdatarate->rates[0] = lbs_data_rate_to_fw_index(priv->cur_rate); lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", - adapter->cur_rate); + priv->cur_rate); } else if (cmd_action == CMD_ACT_SET_TX_AUTO) { lbs_deb_cmd("DATA_RATE: setting auto\n"); } @@ -688,7 +682,6 @@ static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, u16 cmd_action) { struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + @@ -698,9 +691,9 @@ static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, lbs_deb_cmd("MULTICAST_ADR: setting %d addresses\n", pMCastAdr->nr_of_adrs); pMCastAdr->action = cpu_to_le16(cmd_action); pMCastAdr->nr_of_adrs = - cpu_to_le16((u16) adapter->nr_of_multicastmacaddr); - memcpy(pMCastAdr->maclist, adapter->multicastlist, - adapter->nr_of_multicastmacaddr * ETH_ALEN); + cpu_to_le16((u16) priv->nr_of_multicastmacaddr); + memcpy(pMCastAdr->maclist, priv->multicastlist, + priv->nr_of_multicastmacaddr * ETH_ALEN); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -730,7 +723,6 @@ static int lbs_cmd_802_11_rf_channel(struct lbs_private *priv, static int lbs_cmd_802_11_rssi(struct lbs_private *priv, struct cmd_ds_command *cmd) { - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_RSSI); @@ -738,12 +730,12 @@ static int lbs_cmd_802_11_rssi(struct lbs_private *priv, cmd->params.rssi.N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR); /* reset Beacon SNR/NF/RSSI values */ - adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; - adapter->SNR[TYPE_BEACON][TYPE_AVG] = 0; - adapter->NF[TYPE_BEACON][TYPE_NOAVG] = 0; - adapter->NF[TYPE_BEACON][TYPE_AVG] = 0; - adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0; - adapter->RSSI[TYPE_BEACON][TYPE_AVG] = 0; + priv->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; + priv->SNR[TYPE_BEACON][TYPE_AVG] = 0; + priv->NF[TYPE_BEACON][TYPE_NOAVG] = 0; + priv->NF[TYPE_BEACON][TYPE_AVG] = 0; + priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0; + priv->RSSI[TYPE_BEACON][TYPE_AVG] = 0; lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -828,7 +820,6 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) { - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS); @@ -840,8 +831,8 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv, if (cmd_action == CMD_ACT_SET) { memcpy(cmd->params.macadd.macadd, - adapter->current_addr, ETH_ALEN); - lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", adapter->current_addr, 6); + priv->current_addr, ETH_ALEN); + lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", priv->current_addr, 6); } lbs_deb_leave(LBS_DEB_CMD); @@ -958,7 +949,6 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, { struct cmd_ds_802_11_beacon_control *bcn_ctrl = &cmd->params.bcn_ctrl; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); cmd->size = @@ -967,8 +957,8 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL); bcn_ctrl->action = cpu_to_le16(cmd_action); - bcn_ctrl->beacon_enable = cpu_to_le16(adapter->beacon_enable); - bcn_ctrl->beacon_period = cpu_to_le16(adapter->beacon_period); + bcn_ctrl->beacon_enable = cpu_to_le16(priv->beacon_enable); + bcn_ctrl->beacon_period = cpu_to_le16(priv->beacon_period); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -978,7 +968,7 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for * the command timer, because it does not account for queued commands. */ -void lbs_queue_cmd(struct lbs_adapter *adapter, +void lbs_queue_cmd(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode, u8 addtail) { @@ -1002,19 +992,19 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, if (le16_to_cpu(cmdptr->command) == CMD_802_11_PS_MODE) { struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { - if (adapter->psstate != PS_STATE_FULL_POWER) + if (priv->psstate != PS_STATE_FULL_POWER) addtail = 0; } } - spin_lock_irqsave(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); if (addtail) - list_add_tail(&cmdnode->list, &adapter->cmdpendingq); + list_add_tail(&cmdnode->list, &priv->cmdpendingq); else - list_add(&cmdnode->list, &adapter->cmdpendingq); + list_add(&cmdnode->list, &priv->cmdpendingq); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command)); @@ -1035,31 +1025,30 @@ static int DownloadcommandToStation(struct lbs_private *priv, { unsigned long flags; struct cmd_ds_command *cmdptr; - struct lbs_adapter *adapter = priv->adapter; int ret = -1; u16 cmdsize; u16 command; lbs_deb_enter(LBS_DEB_HOST); - if (!adapter || !cmdnode) { - lbs_deb_host("DNLD_CMD: adapter or cmdmode is NULL\n"); + if (!priv || !cmdnode) { + lbs_deb_host("DNLD_CMD: priv or cmdmode is NULL\n"); goto done; } cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; - spin_lock_irqsave(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); if (!cmdptr || !cmdptr->size) { lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n"); __lbs_cleanup_and_insert_cmd(priv, cmdnode); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } - adapter->cur_cmd = cmdnode; - adapter->cur_cmd_retcode = 0; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + priv->cur_cmd = cmdnode; + priv->cur_cmd_retcode = 0; + spin_unlock_irqrestore(&priv->driver_lock, flags); cmdsize = le16_to_cpu(cmdptr->size); command = le16_to_cpu(cmdptr->command); @@ -1074,11 +1063,11 @@ static int DownloadcommandToStation(struct lbs_private *priv, if (ret != 0) { lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n"); - spin_lock_irqsave(&adapter->driver_lock, flags); - adapter->cur_cmd_retcode = ret; - __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->cur_cmd = NULL; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); + priv->cur_cmd_retcode = ret; + __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); + priv->cur_cmd = NULL; + spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } @@ -1087,9 +1076,9 @@ static int DownloadcommandToStation(struct lbs_private *priv, /* Setup the timer after transmit command */ if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE || command == CMD_802_11_ASSOCIATE) - mod_timer(&adapter->command_timer, jiffies + (10*HZ)); + mod_timer(&priv->command_timer, jiffies + (10*HZ)); else - mod_timer(&adapter->command_timer, jiffies + (5*HZ)); + mod_timer(&priv->command_timer, jiffies + (5*HZ)); ret = 0; @@ -1107,7 +1096,7 @@ static int lbs_cmd_mac_control(struct lbs_private *priv, cmd->command = cpu_to_le16(CMD_MAC_CONTROL); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); - mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); + mac->action = cpu_to_le16(priv->currentpacketfilter); lbs_deb_cmd("MAC_CONTROL: action 0x%x, size %d\n", le16_to_cpu(mac->action), le16_to_cpu(cmd->size)); @@ -1118,18 +1107,17 @@ static int lbs_cmd_mac_control(struct lbs_private *priv, /** * This function inserts command node to cmdfreeq - * after cleans it. Requires adapter->driver_lock held. + * after cleans it. Requires priv->driver_lock held. */ void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, struct cmd_ctrl_node *ptempcmd) { - struct lbs_adapter *adapter = priv->adapter; if (!ptempcmd) return; cleanup_cmdnode(ptempcmd); - list_add_tail(&ptempcmd->list, &adapter->cmdfreeq); + list_add_tail(&ptempcmd->list, &priv->cmdfreeq); } static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, @@ -1137,9 +1125,9 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, { unsigned long flags; - spin_lock_irqsave(&priv->adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); __lbs_cleanup_and_insert_cmd(priv, ptempcmd); - spin_unlock_irqrestore(&priv->adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); } int lbs_set_radio_control(struct lbs_private *priv) @@ -1154,7 +1142,7 @@ int lbs_set_radio_control(struct lbs_private *priv) CMD_OPTION_WAITFORRSP, 0, NULL); lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", - priv->adapter->radioon, priv->adapter->preamble); + priv->radioon, priv->preamble); lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return ret; @@ -1191,20 +1179,19 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, u16 wait_option, u32 cmd_oid, void *pdata_buf) { int ret = 0; - struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; struct cmd_ds_command *cmdptr; unsigned long flags; lbs_deb_enter(LBS_DEB_HOST); - if (!adapter) { - lbs_deb_host("PREP_CMD: adapter is NULL\n"); + if (!priv) { + lbs_deb_host("PREP_CMD: priv is NULL\n"); ret = -1; goto done; } - if (adapter->surpriseremoved) { + if (priv->surpriseremoved) { lbs_deb_host("PREP_CMD: card removed\n"); ret = -1; goto done; @@ -1235,8 +1222,8 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, } /* Set sequence number, command and INT option */ - adapter->seqnum++; - cmdptr->seqnum = cpu_to_le16(adapter->seqnum); + priv->seqnum++; + cmdptr->seqnum = cpu_to_le16(priv->seqnum); cmdptr->command = cpu_to_le16(cmd_no); cmdptr->result = 0; @@ -1482,7 +1469,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(adapter, cmdnode, 1); + lbs_queue_cmd(priv, cmdnode, 1); wake_up_interruptible(&priv->waitq); if (wait_option & CMD_OPTION_WAITFORRSP) { @@ -1492,14 +1479,14 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdnode->cmdwaitqwoken); } - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->cur_cmd_retcode) { + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->cur_cmd_retcode) { lbs_deb_host("PREP_CMD: command failed with return code %d\n", - adapter->cur_cmd_retcode); - adapter->cur_cmd_retcode = 0; + priv->cur_cmd_retcode); + priv->cur_cmd_retcode = 0; ret = -1; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); done: lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); @@ -1521,7 +1508,6 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv) u32 i; struct cmd_ctrl_node *tempcmd_array; u8 *ptempvirtualaddr; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -1533,7 +1519,7 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv) ret = -1; goto done; } - adapter->cmd_array = tempcmd_array; + priv->cmd_array = tempcmd_array; /* Allocate and initialize command buffers */ ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; @@ -1571,17 +1557,16 @@ int lbs_free_cmd_buffer(struct lbs_private *priv) u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ unsigned int i; struct cmd_ctrl_node *tempcmd_array; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); /* need to check if cmd array is allocated or not */ - if (adapter->cmd_array == NULL) { + if (priv->cmd_array == NULL) { lbs_deb_host("FREE_CMD_BUF: cmd_array is NULL\n"); goto done; } - tempcmd_array = adapter->cmd_array; + tempcmd_array = priv->cmd_array; /* Release shared memory buffers */ ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; @@ -1593,9 +1578,9 @@ int lbs_free_cmd_buffer(struct lbs_private *priv) } /* Release cmd_ctrl_node */ - if (adapter->cmd_array) { - kfree(adapter->cmd_array); - adapter->cmd_array = NULL; + if (priv->cmd_array) { + kfree(priv->cmd_array); + priv->cmd_array = NULL; } done: @@ -1613,18 +1598,17 @@ done: struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) { struct cmd_ctrl_node *tempnode; - struct lbs_adapter *adapter = priv->adapter; unsigned long flags; lbs_deb_enter(LBS_DEB_HOST); - if (!adapter) + if (!priv) return NULL; - spin_lock_irqsave(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); - if (!list_empty(&adapter->cmdfreeq)) { - tempnode = list_first_entry(&adapter->cmdfreeq, + if (!list_empty(&priv->cmdfreeq)) { + tempnode = list_first_entry(&priv->cmdfreeq, struct cmd_ctrl_node, list); list_del(&tempnode->list); } else { @@ -1632,7 +1616,7 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) tempnode = NULL; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); if (tempnode) cleanup_cmdnode(tempnode); @@ -1700,7 +1684,6 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, */ int lbs_execute_next_command(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode = NULL; struct cmd_ds_command *cmdptr; unsigned long flags; @@ -1711,40 +1694,40 @@ int lbs_execute_next_command(struct lbs_private *priv) // data packet is received lbs_deb_enter(LBS_DEB_THREAD); - spin_lock_irqsave(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); - if (adapter->cur_cmd) { + if (priv->cur_cmd) { lbs_pr_alert( "EXEC_NEXT_CMD: already processing command!\n"); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; goto done; } - if (!list_empty(&adapter->cmdpendingq)) { - cmdnode = list_first_entry(&adapter->cmdpendingq, + if (!list_empty(&priv->cmdpendingq)) { + cmdnode = list_first_entry(&priv->cmdpendingq, struct cmd_ctrl_node, list); } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); if (cmdnode) { cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; if (is_command_allowed_in_ps(cmdptr->command)) { - if ((adapter->psstate == PS_STATE_SLEEP) || - (adapter->psstate == PS_STATE_PRE_SLEEP)) { + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n", le16_to_cpu(cmdptr->command), - adapter->psstate); + priv->psstate); ret = -1; goto done; } lbs_deb_host("EXEC_NEXT_CMD: OK to send command " "0x%04x in psstate %d\n", le16_to_cpu(cmdptr->command), - adapter->psstate); - } else if (adapter->psstate != PS_STATE_FULL_POWER) { + priv->psstate); + } else if (priv->psstate != PS_STATE_FULL_POWER) { /* * 1. Non-PS command: * Queue it. set needtowakeup to TRUE if current state @@ -1760,12 +1743,12 @@ int lbs_execute_next_command(struct lbs_private *priv) cpu_to_le16(CMD_802_11_PS_MODE)) { /* Prepare to send Exit PS, * this non PS command will be sent later */ - if ((adapter->psstate == PS_STATE_SLEEP) - || (adapter->psstate == PS_STATE_PRE_SLEEP) + if ((priv->psstate == PS_STATE_SLEEP) + || (priv->psstate == PS_STATE_PRE_SLEEP) ) { /* w/ new scheme, it will not reach here. since it is blocked in main_thread. */ - adapter->needtowakeup = 1; + priv->needtowakeup = 1; } else lbs_ps_wakeup(priv, 0); @@ -1793,13 +1776,13 @@ int lbs_execute_next_command(struct lbs_private *priv) goto done; } - if ((adapter->psstate == PS_STATE_SLEEP) || - (adapter->psstate == PS_STATE_PRE_SLEEP)) { + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); list_del(&cmdnode->list); lbs_cleanup_and_insert_cmd(priv, cmdnode); - adapter->needtowakeup = 1; + priv->needtowakeup = 1; ret = 0; goto done; @@ -1818,15 +1801,15 @@ int lbs_execute_next_command(struct lbs_private *priv) * check if in power save mode, if yes, put the device back * to PS mode */ - if ((adapter->psmode != LBS802_11POWERMODECAM) && - (adapter->psstate == PS_STATE_FULL_POWER) && - ((adapter->connect_status == LBS_CONNECTED) || - (adapter->mesh_connect_status == LBS_CONNECTED))) { - if (adapter->secinfo.WPAenabled || - adapter->secinfo.WPA2enabled) { + if ((priv->psmode != LBS802_11POWERMODECAM) && + (priv->psstate == PS_STATE_FULL_POWER) && + ((priv->connect_status == LBS_CONNECTED) || + (priv->mesh_connect_status == LBS_CONNECTED))) { + if (priv->secinfo.WPAenabled || + priv->secinfo.WPA2enabled) { /* check for valid WPA group keys */ - if (adapter->wpa_mcast_key.len || - adapter->wpa_unicast_key.len) { + if (priv->wpa_mcast_key.len || + priv->wpa_unicast_key.len) { lbs_deb_host( "EXEC_NEXT_CMD: WPA enabled and GTK_SET" " go back to PS_SLEEP"); @@ -1874,7 +1857,6 @@ void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str) static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) { unsigned long flags; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_HOST); @@ -1887,24 +1869,24 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); priv->dnld_sent = DNLD_RES_RECEIVED; - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->intcounter || adapter->currenttxskb) + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->intcounter || priv->currenttxskb) lbs_deb_host("SEND_SLEEPC_CMD: intcounter %d, currenttxskb %p\n", - adapter->intcounter, adapter->currenttxskb); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + priv->intcounter, priv->currenttxskb); + spin_unlock_irqrestore(&priv->driver_lock, flags); if (ret) { lbs_pr_alert( "SEND_SLEEPC_CMD: Host to Card failed for Confirm Sleep\n"); } else { - spin_lock_irqsave(&adapter->driver_lock, flags); - if (!adapter->intcounter) { - adapter->psstate = PS_STATE_SLEEP; + spin_lock_irqsave(&priv->driver_lock, flags); + if (!priv->intcounter) { + priv->psstate = PS_STATE_SLEEP; } else { lbs_deb_host("SEND_SLEEPC_CMD: after sent, intcounter %d\n", - adapter->intcounter); + priv->intcounter); } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n"); } @@ -1961,7 +1943,6 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option) void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) { unsigned long flags =0; - struct lbs_adapter *adapter = priv->adapter; u8 allowed = 1; lbs_deb_enter(LBS_DEB_HOST); @@ -1971,20 +1952,20 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) lbs_deb_host("dnld_sent was set"); } - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->cur_cmd) { + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->cur_cmd) { allowed = 0; lbs_deb_host("cur_cmd was set"); } - if (adapter->intcounter > 0) { + if (priv->intcounter > 0) { allowed = 0; - lbs_deb_host("intcounter %d", adapter->intcounter); + lbs_deb_host("intcounter %d", priv->intcounter); } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); if (allowed) { lbs_deb_host("sending lbs_ps_confirm_sleep\n"); - sendconfirmsleep(priv, (u8 *) & adapter->lbs_ps_confirm_sleep, + sendconfirmsleep(priv, (u8 *) & priv->lbs_ps_confirm_sleep, sizeof(struct PS_CMD_ConfirmSleep)); } else { lbs_deb_host("sleep confirm has been delayed\n"); @@ -2014,7 +1995,6 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmdnode; struct cmd_ds_gen *cmdptr; unsigned long flags; @@ -2022,13 +2002,13 @@ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, lbs_deb_enter(LBS_DEB_HOST); - if (!adapter) { - lbs_deb_host("PREP_CMD: adapter is NULL\n"); + if (!priv) { + lbs_deb_host("PREP_CMD: priv is NULL\n"); ret = -1; goto done; } - if (adapter->surpriseremoved) { + if (priv->surpriseremoved) { lbs_deb_host("PREP_CMD: card removed\n"); ret = -1; goto done; @@ -2050,10 +2030,10 @@ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, cmdnode->callback = callback; /* Set sequence number, clean result, move to buffer */ - adapter->seqnum++; + priv->seqnum++; cmdptr->command = cpu_to_le16(command); cmdptr->size = cpu_to_le16(cmd_size + S_DS_GEN); - cmdptr->seqnum = cpu_to_le16(adapter->seqnum); + cmdptr->seqnum = cpu_to_le16(priv->seqnum); cmdptr->result = 0; memcpy(cmdptr->cmdresp, cmd, cmd_size); @@ -2063,20 +2043,20 @@ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, * because the caller of lbs_cmd() sets up all of *cmd for us. */ cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(adapter, cmdnode, 1); + lbs_queue_cmd(priv, cmdnode, 1); wake_up_interruptible(&priv->waitq); might_sleep(); wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->cur_cmd_retcode) { + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->cur_cmd_retcode) { lbs_deb_host("PREP_CMD: command failed with return code %d\n", - adapter->cur_cmd_retcode); - adapter->cur_cmd_retcode = 0; + priv->cur_cmd_retcode); + priv->cur_cmd_retcode = 0; ret = -1; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); done: lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 44865bf12ba..ab6e729efac 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -25,10 +25,9 @@ */ void lbs_mac_event_disconnected(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; union iwreq_data wrqu; - if (adapter->connect_status != LBS_CONNECTED) + if (priv->connect_status != LBS_CONNECTED) return; lbs_deb_enter(LBS_DEB_ASSOC); @@ -45,31 +44,31 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); /* Free Tx and Rx packets */ - kfree_skb(priv->adapter->currenttxskb); - priv->adapter->currenttxskb = NULL; + kfree_skb(priv->currenttxskb); + priv->currenttxskb = NULL; /* report disconnect to upper layer */ netif_stop_queue(priv->dev); netif_carrier_off(priv->dev); /* reset SNR/NF/RSSI values */ - memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); - memset(adapter->NF, 0x00, sizeof(adapter->NF)); - memset(adapter->RSSI, 0x00, sizeof(adapter->RSSI)); - memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR)); - memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); - adapter->nextSNRNF = 0; - adapter->numSNRNF = 0; - adapter->connect_status = LBS_DISCONNECTED; + memset(priv->SNR, 0x00, sizeof(priv->SNR)); + memset(priv->NF, 0x00, sizeof(priv->NF)); + memset(priv->RSSI, 0x00, sizeof(priv->RSSI)); + memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); + memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); + priv->nextSNRNF = 0; + priv->numSNRNF = 0; + priv->connect_status = LBS_DISCONNECTED; /* Clear out associated SSID and BSSID since connection is * no longer valid. */ - memset(&adapter->curbssparams.bssid, 0, ETH_ALEN); - memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); - adapter->curbssparams.ssid_len = 0; + memset(&priv->curbssparams.bssid, 0, ETH_ALEN); + memset(&priv->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); + priv->curbssparams.ssid_len = 0; - if (adapter->psstate != PS_STATE_FULL_POWER) { + if (priv->psstate != PS_STATE_FULL_POWER) { /* make firmware to exit PS mode */ lbs_deb_cmd("disconnected, so exit PS mode\n"); lbs_ps_wakeup(priv, 0); @@ -107,7 +106,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv, u16 type, struct cmd_ds_command *resp) { int ret = 0; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -116,8 +114,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, { struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; - adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - adapter->offsetvalue.value = le32_to_cpu(reg->value); + priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); + priv->offsetvalue.value = le32_to_cpu(reg->value); break; } @@ -125,8 +123,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, { struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; - adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - adapter->offsetvalue.value = reg->value; + priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); + priv->offsetvalue.value = reg->value; break; } @@ -134,8 +132,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, { struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; - adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - adapter->offsetvalue.value = reg->value; + priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); + priv->offsetvalue.value = reg->value; break; } @@ -152,19 +150,18 @@ static int lbs_ret_get_hw_spec(struct lbs_private *priv, { u32 i; struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; DECLARE_MAC_BUF(mac); lbs_deb_enter(LBS_DEB_CMD); - adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); + priv->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); - memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4); + memcpy(priv->fwreleasenumber, hwspec->fwreleasenumber, 4); lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", - adapter->fwreleasenumber[2], adapter->fwreleasenumber[1], - adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]); + priv->fwreleasenumber[2], priv->fwreleasenumber[1], + priv->fwreleasenumber[0], priv->fwreleasenumber[3]); lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", print_mac(mac, hwspec->permanentaddr)); lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", @@ -174,29 +171,29 @@ static int lbs_ret_get_hw_spec(struct lbs_private *priv, * only ever be 8-bit, even though the field size is 16-bit. Some firmware * returns non-zero high 8 bits here. */ - adapter->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF; + priv->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF; for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { /* use the region code to search for the index */ - if (adapter->regioncode == lbs_region_code_to_index[i]) { + if (priv->regioncode == lbs_region_code_to_index[i]) { break; } } /* if it's unidentified region code, use the default (USA) */ if (i >= MRVDRV_MAX_REGION_CODE) { - adapter->regioncode = 0x10; + priv->regioncode = 0x10; lbs_pr_info("unidentified region code; using the default (USA)\n"); } - if (adapter->current_addr[0] == 0xff) - memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN); + if (priv->current_addr[0] == 0xff) + memmove(priv->current_addr, hwspec->permanentaddr, ETH_ALEN); - memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); + memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); if (priv->mesh_dev) - memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); + memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); - if (lbs_set_regiontable(priv, adapter->regioncode, 0)) { + if (lbs_set_regiontable(priv, priv->regioncode, 0)) { ret = -1; goto done; } @@ -215,7 +212,6 @@ static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -224,12 +220,12 @@ static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), sp->calcontrol, sp->externalsleepclk); - adapter->sp.sp_error = le16_to_cpu(sp->error); - adapter->sp.sp_offset = le16_to_cpu(sp->offset); - adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); - adapter->sp.sp_calcontrol = sp->calcontrol; - adapter->sp.sp_extsleepclk = sp->externalsleepclk; - adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); + priv->sp.sp_error = le16_to_cpu(sp->error); + priv->sp.sp_offset = le16_to_cpu(sp->offset); + priv->sp.sp_stabletime = le16_to_cpu(sp->stabletime); + priv->sp.sp_calcontrol = sp->calcontrol; + priv->sp.sp_extsleepclk = sp->externalsleepclk; + priv->sp.sp_reserved = le16_to_cpu(sp->reserved); lbs_deb_enter(LBS_DEB_CMD); return 0; @@ -239,13 +235,12 @@ static int lbs_ret_802_11_stat(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_CMD); -/* currently adapter->wlan802_11Stat is unused +/* currently priv->wlan802_11Stat is unused struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat; - struct lbs_adapter *adapter = priv->adapter; // TODO Convert it to Big endian befor copy - memcpy(&adapter->wlan802_11Stat, + memcpy(&priv->wlan802_11Stat, p11Stat, sizeof(struct cmd_ds_802_11_get_stat)); */ lbs_deb_leave(LBS_DEB_CMD); @@ -268,22 +263,22 @@ static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv, if (querytype == CMD_ACT_GET) { switch (oid) { case FRAGTHRESH_I: - priv->adapter->fragthsd = + priv->fragthsd = le16_to_cpu(*((__le16 *)(smib->value))); lbs_deb_cmd("SNMP_RESP: frag threshold %u\n", - priv->adapter->fragthsd); + priv->fragthsd); break; case RTSTHRESH_I: - priv->adapter->rtsthsd = + priv->rtsthsd = le16_to_cpu(*((__le16 *)(smib->value))); lbs_deb_cmd("SNMP_RESP: rts threshold %u\n", - priv->adapter->rtsthsd); + priv->rtsthsd); break; case SHORT_RETRYLIM_I: - priv->adapter->txretrycount = + priv->txretrycount = le16_to_cpu(*((__le16 *)(smib->value))); lbs_deb_cmd("SNMP_RESP: tx retry count %u\n", - priv->adapter->rtsthsd); + priv->rtsthsd); break; default: break; @@ -299,7 +294,6 @@ static int lbs_ret_802_11_key_material(struct lbs_private *priv, { struct cmd_ds_802_11_key_material *pkeymaterial = &resp->params.keymaterial; - struct lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(pkeymaterial->action); lbs_deb_enter(LBS_DEB_CMD); @@ -327,9 +321,9 @@ static int lbs_ret_802_11_key_material(struct lbs_private *priv, break; if (key_flags & KEY_INFO_WPA_UNICAST) - pkey = &adapter->wpa_unicast_key; + pkey = &priv->wpa_unicast_key; else if (key_flags & KEY_INFO_WPA_MCAST) - pkey = &adapter->wpa_mcast_key; + pkey = &priv->wpa_mcast_key; else break; @@ -354,11 +348,10 @@ static int lbs_ret_802_11_mac_address(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); - memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); + memcpy(priv->current_addr, macadd->macadd, ETH_ALEN); lbs_deb_enter(LBS_DEB_CMD); return 0; @@ -368,13 +361,12 @@ static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); - adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); + priv->txpowerlevel = le16_to_cpu(rtp->currentlevel); - lbs_deb_cmd("TX power currently %d\n", adapter->txpowerlevel); + lbs_deb_cmd("TX power currently %d\n", priv->txpowerlevel); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -384,13 +376,12 @@ static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); if (rates->action == CMD_ACT_GET) { - adapter->enablehwauto = le16_to_cpu(rates->enablehwauto); - adapter->ratebitmap = le16_to_cpu(rates->bitmap); + priv->enablehwauto = le16_to_cpu(rates->enablehwauto); + priv->ratebitmap = le16_to_cpu(rates->bitmap); } lbs_deb_leave(LBS_DEB_CMD); @@ -401,7 +392,6 @@ static int lbs_ret_802_11_data_rate(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); @@ -411,8 +401,8 @@ static int lbs_ret_802_11_data_rate(struct lbs_private *priv, /* FIXME: get actual rates FW can do if this command actually returns * all data rates supported. */ - adapter->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); - lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", adapter->cur_rate); + priv->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); + lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", priv->cur_rate); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -422,19 +412,18 @@ static int lbs_ret_802_11_rf_channel(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; - struct lbs_adapter *adapter = priv->adapter; u16 action = le16_to_cpu(rfchannel->action); u16 newchannel = le16_to_cpu(rfchannel->currentchannel); lbs_deb_enter(LBS_DEB_CMD); if (action == CMD_OPT_802_11_RF_CHANNEL_GET - && adapter->curbssparams.channel != newchannel) { + && priv->curbssparams.channel != newchannel) { lbs_deb_cmd("channel switch from %d to %d\n", - adapter->curbssparams.channel, newchannel); + priv->curbssparams.channel, newchannel); /* Update the channel again */ - adapter->curbssparams.channel = newchannel; + priv->curbssparams.channel = newchannel; } lbs_deb_enter(LBS_DEB_CMD); @@ -445,28 +434,27 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); /* store the non average value */ - adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); - adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); + priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); + priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); - adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); - adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); + priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); + priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); - adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = - CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], - adapter->NF[TYPE_BEACON][TYPE_NOAVG]); + priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = + CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], + priv->NF[TYPE_BEACON][TYPE_NOAVG]); - adapter->RSSI[TYPE_BEACON][TYPE_AVG] = - CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, - adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); + priv->RSSI[TYPE_BEACON][TYPE_AVG] = + CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, + priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); lbs_deb_cmd("RSSI: beacon %d, avg %d\n", - adapter->RSSI[TYPE_BEACON][TYPE_NOAVG], - adapter->RSSI[TYPE_BEACON][TYPE_AVG]); + priv->RSSI[TYPE_BEACON][TYPE_NOAVG], + priv->RSSI[TYPE_BEACON][TYPE_AVG]); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -475,9 +463,8 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv, static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv, struct cmd_ds_command *resp) { - struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_regrdwr *pbuf; - pbuf = (struct lbs_ioctl_regrdwr *) adapter->prdeeprom; + pbuf = (struct lbs_ioctl_regrdwr *) priv->prdeeprom; lbs_deb_enter_args(LBS_DEB_CMD, "len %d", le16_to_cpu(resp->params.rdeeprom.bytecount)); @@ -502,12 +489,11 @@ static int lbs_ret_get_log(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); /* Stored little-endian */ - memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); + memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); lbs_deb_leave(LBS_DEB_CMD); return 0; @@ -517,8 +503,7 @@ static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; - struct lbs_adapter *adapter = priv->adapter; - u32 * pdata_buf = adapter->cur_cmd->pdata_buf; + u32 * pdata_buf = priv->cur_cmd->pdata_buf; lbs_deb_enter(LBS_DEB_CMD); @@ -536,13 +521,12 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, { struct cmd_ds_802_11_beacon_control *bcn_ctrl = &resp->params.bcn_ctrl; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_CMD); if (bcn_ctrl->action == CMD_ACT_GET) { - adapter->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); - adapter->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); + priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); + priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); } lbs_deb_enter(LBS_DEB_CMD); @@ -552,11 +536,10 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, struct cmd_ds_command *resp) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_subscribe_event *cmd_event = &resp->params.subscribe_event; struct cmd_ds_802_11_subscribe_event *dst_event = - adapter->cur_cmd->pdata_buf; + priv->cur_cmd->pdata_buf; lbs_deb_enter(LBS_DEB_CMD); @@ -575,7 +558,6 @@ static inline int handle_cmd_response(u16 respcmd, { int ret = 0; unsigned long flags; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_HOST); @@ -628,10 +610,10 @@ static inline int handle_cmd_response(u16 respcmd, case CMD_RET(CMD_802_11_SET_AFC): case CMD_RET(CMD_802_11_GET_AFC): - spin_lock_irqsave(&adapter->driver_lock, flags); - memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, + spin_lock_irqsave(&priv->driver_lock, flags); + memmove(priv->cur_cmd->pdata_buf, &resp->params.afc, sizeof(struct cmd_ds_802_11_afc)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; @@ -686,59 +668,59 @@ static inline int handle_cmd_response(u16 respcmd, ret = lbs_ret_802_11_sleep_params(priv, resp); break; case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): - spin_lock_irqsave(&adapter->driver_lock, flags); - *((u16 *) adapter->cur_cmd->pdata_buf) = + spin_lock_irqsave(&priv->driver_lock, flags); + *((u16 *) priv->cur_cmd->pdata_buf) = le16_to_cpu(resp->params.inactivity_timeout.timeout); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_802_11_TPC_CFG): - spin_lock_irqsave(&adapter->driver_lock, flags); - memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, + spin_lock_irqsave(&priv->driver_lock, flags); + memmove(priv->cur_cmd->pdata_buf, &resp->params.tpccfg, sizeof(struct cmd_ds_802_11_tpc_cfg)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_802_11_LED_GPIO_CTRL): - spin_lock_irqsave(&adapter->driver_lock, flags); - memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, + spin_lock_irqsave(&priv->driver_lock, flags); + memmove(priv->cur_cmd->pdata_buf, &resp->params.ledgpio, sizeof(struct cmd_ds_802_11_led_ctrl)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT): ret = lbs_ret_802_11_subscribe_event(priv, resp); break; case CMD_RET(CMD_802_11_PWR_CFG): - spin_lock_irqsave(&adapter->driver_lock, flags); - memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, + spin_lock_irqsave(&priv->driver_lock, flags); + memmove(priv->cur_cmd->pdata_buf, &resp->params.pwrcfg, sizeof(struct cmd_ds_802_11_pwr_cfg)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_GET_TSF): - spin_lock_irqsave(&adapter->driver_lock, flags); - memcpy(priv->adapter->cur_cmd->pdata_buf, + spin_lock_irqsave(&priv->driver_lock, flags); + memcpy(priv->cur_cmd->pdata_buf, &resp->params.gettsf.tsfvalue, sizeof(u64)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_BT_ACCESS): - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->cur_cmd->pdata_buf) - memcpy(adapter->cur_cmd->pdata_buf, + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->cur_cmd->pdata_buf) + memcpy(priv->cur_cmd->pdata_buf, &resp->params.bt.addr1, 2 * ETH_ALEN); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_FWT_ACCESS): - spin_lock_irqsave(&adapter->driver_lock, flags); - if (adapter->cur_cmd->pdata_buf) - memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, + spin_lock_irqsave(&priv->driver_lock, flags); + if (priv->cur_cmd->pdata_buf) + memcpy(priv->cur_cmd->pdata_buf, &resp->params.fwt, sizeof(resp->params.fwt)); - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_MESH_ACCESS): - if (adapter->cur_cmd->pdata_buf) - memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, + if (priv->cur_cmd->pdata_buf) + memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh, sizeof(resp->params.mesh)); break; case CMD_RET(CMD_802_11_BEACON_CTRL): @@ -758,7 +740,6 @@ int lbs_process_rx_command(struct lbs_private *priv) { u16 respcmd; struct cmd_ds_command *resp; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; ulong flags; u16 result; @@ -766,39 +747,39 @@ int lbs_process_rx_command(struct lbs_private *priv) lbs_deb_enter(LBS_DEB_HOST); /* Now we got response from FW, cancel the command timer */ - del_timer(&adapter->command_timer); + del_timer(&priv->command_timer); - mutex_lock(&adapter->lock); - spin_lock_irqsave(&adapter->driver_lock, flags); + mutex_lock(&priv->lock); + spin_lock_irqsave(&priv->driver_lock, flags); - if (!adapter->cur_cmd) { + if (!priv->cur_cmd) { lbs_deb_host("CMD_RESP: cur_cmd is NULL\n"); ret = -1; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } - resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); + resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr); respcmd = le16_to_cpu(resp->command); result = le16_to_cpu(resp->result); lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n", respcmd, priv->upld_len, jiffies); - lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", adapter->cur_cmd->bufvirtualaddr, + lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", priv->cur_cmd->bufvirtualaddr, priv->upld_len); if (!(respcmd & 0x8000)) { lbs_deb_host("invalid response!\n"); - adapter->cur_cmd_retcode = -1; - __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->cur_cmd = NULL; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + priv->cur_cmd_retcode = -1; + __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); + priv->cur_cmd = NULL; + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; goto done; } /* Store the response code to cur_cmd_retcode. */ - adapter->cur_cmd_retcode = result; + priv->cur_cmd_retcode = result; if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; @@ -816,15 +797,15 @@ int lbs_process_rx_command(struct lbs_private *priv) * ad-hoc mode. It takes place in * lbs_execute_next_command(). */ - if (adapter->mode == IW_MODE_ADHOC && + if (priv->mode == IW_MODE_ADHOC && action == CMD_SUBCMD_ENTER_PS) - adapter->psmode = LBS802_11POWERMODECAM; + priv->psmode = LBS802_11POWERMODECAM; } else if (action == CMD_SUBCMD_ENTER_PS) { - adapter->needtowakeup = 0; - adapter->psstate = PS_STATE_AWAKE; + priv->needtowakeup = 0; + priv->psstate = PS_STATE_AWAKE; lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); - if (adapter->connect_status != LBS_CONNECTED) { + if (priv->connect_status != LBS_CONNECTED) { /* * When Deauth Event received before Enter_PS command * response, We need to wake up the firmware. @@ -832,23 +813,23 @@ int lbs_process_rx_command(struct lbs_private *priv) lbs_deb_host( "disconnected, invoking lbs_ps_wakeup\n"); - spin_unlock_irqrestore(&adapter->driver_lock, flags); - mutex_unlock(&adapter->lock); + spin_unlock_irqrestore(&priv->driver_lock, flags); + mutex_unlock(&priv->lock); lbs_ps_wakeup(priv, 0); - mutex_lock(&adapter->lock); - spin_lock_irqsave(&adapter->driver_lock, flags); + mutex_lock(&priv->lock); + spin_lock_irqsave(&priv->driver_lock, flags); } } else if (action == CMD_SUBCMD_EXIT_PS) { - adapter->needtowakeup = 0; - adapter->psstate = PS_STATE_FULL_POWER; + priv->needtowakeup = 0; + priv->psstate = PS_STATE_FULL_POWER; lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); } else { lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); } - __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->cur_cmd = NULL; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); + priv->cur_cmd = NULL; + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = 0; goto done; @@ -869,32 +850,32 @@ int lbs_process_rx_command(struct lbs_private *priv) } - __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->cur_cmd = NULL; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); + priv->cur_cmd = NULL; + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; goto done; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); - if (adapter->cur_cmd && adapter->cur_cmd->callback) - ret = adapter->cur_cmd->callback(respcmd, resp, priv); + if (priv->cur_cmd && priv->cur_cmd->callback) + ret = priv->cur_cmd->callback(respcmd, resp, priv); else ret = handle_cmd_response(respcmd, resp, priv); - spin_lock_irqsave(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); - if (adapter->cur_cmd) { + if (priv->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ - __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); - adapter->cur_cmd = NULL; + __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); + priv->cur_cmd = NULL; } - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); done: - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); return ret; } @@ -902,14 +883,13 @@ done: int lbs_process_event(struct lbs_private *priv) { int ret = 0; - struct lbs_adapter *adapter = priv->adapter; u32 eventcause; lbs_deb_enter(LBS_DEB_CMD); - spin_lock_irq(&adapter->driver_lock); - eventcause = adapter->eventcause >> SBI_EVENT_CAUSE_SHIFT; - spin_unlock_irq(&adapter->driver_lock); + spin_lock_irq(&priv->driver_lock); + eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT; + spin_unlock_irq(&priv->driver_lock); lbs_deb_cmd("event cause %d\n", eventcause); @@ -937,14 +917,14 @@ int lbs_process_event(struct lbs_private *priv) lbs_deb_cmd("EVENT: sleep\n"); /* handle unexpected PS SLEEP event */ - if (adapter->psstate == PS_STATE_FULL_POWER) { + if (priv->psstate == PS_STATE_FULL_POWER) { lbs_deb_cmd( "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n"); break; } - adapter->psstate = PS_STATE_PRE_SLEEP; + priv->psstate = PS_STATE_PRE_SLEEP; - lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); + lbs_ps_confirm_sleep(priv, (u16) priv->psmode); break; @@ -952,19 +932,19 @@ int lbs_process_event(struct lbs_private *priv) lbs_deb_cmd("EVENT: awake\n"); /* handle unexpected PS AWAKE event */ - if (adapter->psstate == PS_STATE_FULL_POWER) { + if (priv->psstate == PS_STATE_FULL_POWER) { lbs_deb_cmd( "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); break; } - adapter->psstate = PS_STATE_AWAKE; + priv->psstate = PS_STATE_AWAKE; - if (adapter->needtowakeup) { + if (priv->needtowakeup) { /* * wait for the command processing to finish * before resuming sending - * adapter->needtowakeup will be set to FALSE + * priv->needtowakeup will be set to FALSE * in lbs_ps_wakeup() */ lbs_deb_cmd("waking up ...\n"); @@ -1012,12 +992,12 @@ int lbs_process_event(struct lbs_private *priv) break; } lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); - adapter->mesh_connect_status = LBS_CONNECTED; + priv->mesh_connect_status = LBS_CONNECTED; if (priv->mesh_open == 1) { netif_wake_queue(priv->mesh_dev); netif_carrier_on(priv->mesh_dev); } - adapter->mode = IW_MODE_ADHOC; + priv->mode = IW_MODE_ADHOC; schedule_work(&priv->sync_channel); break; @@ -1026,9 +1006,9 @@ int lbs_process_event(struct lbs_private *priv) break; } - spin_lock_irq(&adapter->driver_lock); - adapter->eventcause = 0; - spin_unlock_irq(&adapter->driver_lock); + spin_lock_irq(&priv->driver_lock); + priv->eventcause = 0; + spin_unlock_irq(&priv->driver_lock); lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return ret; diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 9a041e5b209..fe422b28a4f 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -45,9 +45,9 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, ssize_t res; pos += snprintf(buf+pos, len-pos, "state = %s\n", - szStates[priv->adapter->connect_status]); + szStates[priv->connect_status]); pos += snprintf(buf+pos, len-pos, "region_code = %02x\n", - (u32) priv->adapter->regioncode); + (u32) priv->regioncode); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); @@ -70,8 +70,8 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, pos += snprintf(buf+pos, len-pos, "# | ch | rssi | bssid | cap | Qual | SSID \n"); - mutex_lock(&priv->adapter->lock); - list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { + mutex_lock(&priv->lock); + list_for_each_entry (iter_bss, &priv->network_list, list) { u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS); u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY); u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT); @@ -90,7 +90,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, numscansdone++; } - mutex_unlock(&priv->adapter->lock); + mutex_unlock(&priv->lock); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); @@ -118,12 +118,12 @@ static ssize_t lbs_sleepparams_write(struct file *file, res = -EFAULT; goto out_unlock; } - priv->adapter->sp.sp_error = p1; - priv->adapter->sp.sp_offset = p2; - priv->adapter->sp.sp_stabletime = p3; - priv->adapter->sp.sp_calcontrol = p4; - priv->adapter->sp.sp_extsleepclk = p5; - priv->adapter->sp.sp_reserved = p6; + priv->sp.sp_error = p1; + priv->sp.sp_offset = p2; + priv->sp.sp_stabletime = p3; + priv->sp.sp_calcontrol = p4; + priv->sp.sp_extsleepclk = p5; + priv->sp.sp_reserved = p6; res = lbs_prepare_and_send_command(priv, CMD_802_11_SLEEP_PARAMS, @@ -144,7 +144,6 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; ssize_t res; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); @@ -159,10 +158,10 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, goto out_unlock; } - pos += snprintf(buf, len, "%d %d %d %d %d %d\n", adapter->sp.sp_error, - adapter->sp.sp_offset, adapter->sp.sp_stabletime, - adapter->sp.sp_calcontrol, adapter->sp.sp_extsleepclk, - adapter->sp.sp_reserved); + pos += snprintf(buf, len, "%d %d %d %d %d %d\n", priv->sp.sp_error, + priv->sp.sp_offset, priv->sp.sp_stabletime, + priv->sp.sp_calcontrol, priv->sp.sp_extsleepclk, + priv->sp.sp_reserved); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); @@ -321,11 +320,11 @@ static ssize_t lbs_setuserscan(struct file *file, lbs_parse_type(buf, count, scan_cfg); lbs_scan_networks(priv, scan_cfg, 1); - wait_event_interruptible(priv->adapter->cmd_pending, - priv->adapter->surpriseremoved || - (!priv->adapter->cur_cmd && list_empty(&priv->adapter->cmdpendingq))); + wait_event_interruptible(priv->cmd_pending, + priv->surpriseremoved || + (!priv->cur_cmd && list_empty(&priv->cmdpendingq))); - if (priv->adapter->surpriseremoved) + if (priv->surpriseremoved) goto out_scan_cfg; memset(&wrqu, 0x00, sizeof(union iwreq_data)); @@ -620,7 +619,6 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -635,7 +633,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n", - priv->mac_offset, adapter->offsetvalue.value); + priv->mac_offset, priv->offsetvalue.value); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); free_page(addr); @@ -703,7 +701,6 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -718,7 +715,7 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n", - priv->bbp_offset, adapter->offsetvalue.value); + priv->bbp_offset, priv->offsetvalue.value); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); free_page(addr); @@ -787,7 +784,6 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - struct lbs_adapter *adapter = priv->adapter; struct lbs_offset_value offval; ssize_t pos = 0; int ret; @@ -802,7 +798,7 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, CMD_OPTION_WAITFORRSP, 0, &offval); mdelay(10); pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n", - priv->rf_offset, adapter->offsetvalue.value); + priv->rf_offset, priv->offsetvalue.value); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); free_page(addr); @@ -1009,8 +1005,8 @@ void lbs_debugfs_remove_one(struct lbs_private *priv) #ifdef PROC_DEBUG -#define item_size(n) (FIELD_SIZEOF(struct lbs_adapter, n)) -#define item_addr(n) (offsetof(struct lbs_adapter, n)) +#define item_size(n) (FIELD_SIZEOF(struct lbs_private, n)) +#define item_addr(n) (offsetof(struct lbs_private, n)) struct debug_data { @@ -1019,7 +1015,7 @@ struct debug_data { size_t addr; }; -/* To debug any member of struct lbs_adapter, simply add one line here. +/* To debug any member of struct lbs_private, simply add one line here. */ static struct debug_data items[] = { {"intcounter", item_size(intcounter), item_addr(intcounter)}, @@ -1158,7 +1154,7 @@ static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev) return; for (i = 0; i < num_of_items; i++) - items[i].addr += (size_t) priv->adapter; + items[i].addr += (size_t) priv; priv->debugfs_debug = debugfs_create_file("debug", 0644, priv->debugfs_dir, &items[0], diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 1a8fdaa7375..e255b191574 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -12,7 +12,6 @@ /** Function Prototype Declaration */ struct lbs_private; -struct lbs_adapter; struct sk_buff; struct net_device; struct cmd_ctrl_node; @@ -32,7 +31,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_action, u16 wait_option, u32 cmd_oid, void *pdata_buf); -void lbs_queue_cmd(struct lbs_adapter *adapter, +void lbs_queue_cmd(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode, u8 addtail); @@ -43,7 +42,7 @@ void lbs_interrupt(struct net_device *); int lbs_set_radio_control(struct lbs_private *priv); u32 lbs_fw_index_to_data_rate(u8 index); u8 lbs_data_rate_to_fw_index(u32 rate); -void lbs_get_fwversion(struct lbs_adapter *adapter, +void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen); @@ -66,7 +65,7 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); void lbs_tx_runqueue(struct lbs_private *priv); struct chan_freq_power *lbs_find_cfp_by_band_and_channel( - struct lbs_adapter *adapter, + struct lbs_private *priv, u8 band, u16 channel); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index eaa45d4bb9d..21b0d382096 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -1,7 +1,7 @@ /** * This file contains definitions and data structures specific * to Marvell 802.11 NIC. It contains the Device Information - * structure struct lbs_adapter. + * structure struct lbs_private.. */ #ifndef _LBS_DEV_H_ #define _LBS_DEV_H_ @@ -109,7 +109,6 @@ struct lbs_private { char name[DEV_NAME_LEN]; void *card; - struct lbs_adapter *adapter; struct net_device *dev; struct net_device_stats stats; @@ -156,54 +155,10 @@ struct lbs_private { int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); int (*hw_get_int_status) (struct lbs_private *priv, u8 *); int (*hw_read_event_cause) (struct lbs_private *); -}; - -/** Association request - * - * Encapsulates all the options that describe a specific assocation request - * or configuration of the wireless card's radio, mode, and security settings. - */ -struct assoc_request { -#define ASSOC_FLAG_SSID 1 -#define ASSOC_FLAG_CHANNEL 2 -#define ASSOC_FLAG_BAND 3 -#define ASSOC_FLAG_MODE 4 -#define ASSOC_FLAG_BSSID 5 -#define ASSOC_FLAG_WEP_KEYS 6 -#define ASSOC_FLAG_WEP_TX_KEYIDX 7 -#define ASSOC_FLAG_WPA_MCAST_KEY 8 -#define ASSOC_FLAG_WPA_UCAST_KEY 9 -#define ASSOC_FLAG_SECINFO 10 -#define ASSOC_FLAG_WPA_IE 11 - unsigned long flags; - - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - u8 channel; - u8 band; - u8 mode; - u8 bssid[ETH_ALEN]; - - /** WEP keys */ - struct enc_key wep_keys[4]; - u16 wep_tx_keyidx; - - /** WPA keys */ - struct enc_key wpa_mcast_key; - struct enc_key wpa_unicast_key; - - struct lbs_802_11_security secinfo; - /** WPA Information Elements*/ - u8 wpa_ie[MAX_WPA_IE_LEN]; - u8 wpa_ie_len; - - /* BSS to associate with for infrastructure of Ad-Hoc join */ - struct bss_descriptor bss; -}; + /* was struct lbs_adapter from here... */ -/** Wlan adapter data structure*/ -struct lbs_adapter { + /** Wlan adapter data structure*/ /** STATUS variables */ u8 fwreleasenumber[4]; u32 fwcapinfo; @@ -229,7 +184,7 @@ struct lbs_adapter { struct list_head cmdpendingq; wait_queue_head_t cmd_pending; - /* command related variables protected by adapter->driver_lock */ + /* command related variables protected by priv->driver_lock */ /** Async and Sync Event variables */ u32 intcounter; @@ -366,4 +321,48 @@ struct lbs_adapter { u8 fw_ready; }; +/** Association request + * + * Encapsulates all the options that describe a specific assocation request + * or configuration of the wireless card's radio, mode, and security settings. + */ +struct assoc_request { +#define ASSOC_FLAG_SSID 1 +#define ASSOC_FLAG_CHANNEL 2 +#define ASSOC_FLAG_BAND 3 +#define ASSOC_FLAG_MODE 4 +#define ASSOC_FLAG_BSSID 5 +#define ASSOC_FLAG_WEP_KEYS 6 +#define ASSOC_FLAG_WEP_TX_KEYIDX 7 +#define ASSOC_FLAG_WPA_MCAST_KEY 8 +#define ASSOC_FLAG_WPA_UCAST_KEY 9 +#define ASSOC_FLAG_SECINFO 10 +#define ASSOC_FLAG_WPA_IE 11 + unsigned long flags; + + u8 ssid[IW_ESSID_MAX_SIZE + 1]; + u8 ssid_len; + u8 channel; + u8 band; + u8 mode; + u8 bssid[ETH_ALEN]; + + /** WEP keys */ + struct enc_key wep_keys[4]; + u16 wep_tx_keyidx; + + /** WPA keys */ + struct enc_key wpa_mcast_key; + struct enc_key wpa_unicast_key; + + struct lbs_802_11_security secinfo; + + /** WPA Information Elements*/ + u8 wpa_ie[MAX_WPA_IE_LEN]; + u8 wpa_ie_len; + + /* BSS to associate with for infrastructure of Ad-Hoc join */ + struct bss_descriptor bss; +}; + #endif diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index f32fb00129e..a54b4f406af 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c @@ -25,7 +25,7 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev, struct lbs_private *priv = (struct lbs_private *) dev->priv; char fwver[32]; - lbs_get_fwversion(priv->adapter, fwver, sizeof(fwver) - 1); + lbs_get_fwversion(priv, fwver, sizeof(fwver) - 1); strcpy(info->driver, "libertas"); strcpy(info->version, lbs_driver_version); @@ -46,7 +46,6 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 * bytes) { struct lbs_private *priv = (struct lbs_private *) dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_regrdwr regctrl; char *ptr; int ret; @@ -60,10 +59,10 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev, // mutex_lock(&priv->mutex); - adapter->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL); - if (!adapter->prdeeprom) + priv->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL); + if (!priv->prdeeprom) return -ENOMEM; - memcpy(adapter->prdeeprom, ®ctrl, sizeof(regctrl)); + memcpy(priv->prdeeprom, ®ctrl, sizeof(regctrl)); /* +14 is for action, offset, and NOB in * response */ @@ -77,14 +76,14 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev, ®ctrl); if (ret) { - if (adapter->prdeeprom) - kfree(adapter->prdeeprom); + if (priv->prdeeprom) + kfree(priv->prdeeprom); goto done; } mdelay(10); - ptr = (char *)adapter->prdeeprom; + ptr = (char *)priv->prdeeprom; /* skip the command header, but include the "value" u32 variable */ ptr = ptr + sizeof(struct lbs_ioctl_regrdwr) - 4; @@ -94,8 +93,8 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev, */ memcpy(bytes, ptr, eeprom->len); - if (adapter->prdeeprom) - kfree(adapter->prdeeprom); + if (priv->prdeeprom) + kfree(priv->prdeeprom); // mutex_unlock(&priv->mutex); ret = 0; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 8508260a286..49a01780dd0 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -255,7 +255,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) } else if (int_cause == 0xffff) { /* Read in junk, the card has probably been removed */ - card->priv->adapter->surpriseremoved = 1; + card->priv->surpriseremoved = 1; } else { if (int_cause & IF_CS_H_IC_TX_OVER) @@ -644,7 +644,6 @@ static int if_cs_host_to_card(struct lbs_private *priv, static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg) { struct if_cs_card *card = (struct if_cs_card *)priv->card; - /* struct lbs_adapter *adapter = priv->adapter; */ int ret = 0; u16 int_cause; u8 *cmdbuf; @@ -652,7 +651,7 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg) lbs_deb_enter(LBS_DEB_CS); - if (priv->adapter->surpriseremoved) + if (priv->surpriseremoved) goto out; int_cause = if_cs_read16(card, IF_CS_C_INT_CAUSE) & IF_CS_C_IC_MASK; @@ -678,22 +677,22 @@ sbi_get_int_status_exit: /* Card has a command result for us */ if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { - spin_lock(&priv->adapter->driver_lock); - if (!priv->adapter->cur_cmd) { + spin_lock(&priv->driver_lock); + if (!priv->cur_cmd) { cmdbuf = priv->upld_buf; - priv->adapter->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY; + priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY; } else { - cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr; + cmdbuf = priv->cur_cmd->bufvirtualaddr; } ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len); - spin_unlock(&priv->adapter->driver_lock); + spin_unlock(&priv->driver_lock); if (ret < 0) lbs_pr_err("could not receive cmd from card\n"); } out: - lbs_deb_leave_args(LBS_DEB_CS, "ret %d, ireg 0x%x, hisregcpy 0x%x", ret, *ireg, priv->adapter->hisregcpy); + lbs_deb_leave_args(LBS_DEB_CS, "ret %d, ireg 0x%x, hisregcpy 0x%x", ret, *ireg, priv->hisregcpy); return ret; } @@ -702,7 +701,7 @@ static int if_cs_read_event_cause(struct lbs_private *priv) { lbs_deb_enter(LBS_DEB_CS); - priv->adapter->eventcause = (if_cs_read16(priv->card, IF_CS_C_STATUS) & IF_CS_C_S_STATUS_MASK) >> 5; + priv->eventcause = (if_cs_read16(priv->card, IF_CS_C_STATUS) & IF_CS_C_S_STATUS_MASK) >> 5; if_cs_write16(priv->card, IF_CS_H_INT_CAUSE, IF_CS_H_IC_HOST_EVENT); return 0; @@ -869,7 +868,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) priv->hw_get_int_status = if_cs_get_int_status; priv->hw_read_event_cause = if_cs_read_event_cause; - priv->adapter->fw_ready = 1; + priv->fw_ready = 1; /* Now actually get the IRQ */ ret = request_irq(p_dev->irq.AssignedIRQ, if_cs_interrupt, diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 181ebf0fc0d..24239609367 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -134,9 +134,9 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, lbs_deb_enter(LBS_DEB_SDIO); - spin_lock_irqsave(&card->priv->adapter->driver_lock, flags); + spin_lock_irqsave(&card->priv->driver_lock, flags); - if (!card->priv->adapter->cur_cmd) { + if (!card->priv->cur_cmd) { lbs_deb_sdio("discarding spurious response\n"); ret = 0; goto out; @@ -149,7 +149,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, goto out; } - memcpy(card->priv->adapter->cur_cmd->bufvirtualaddr, buffer, size); + memcpy(card->priv->cur_cmd->bufvirtualaddr, buffer, size); card->priv->upld_len = size; card->int_cause |= MRVDRV_CMD_UPLD_RDY; @@ -159,7 +159,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, ret = 0; out: - spin_unlock_irqrestore(&card->priv->adapter->driver_lock, flags); + spin_unlock_irqrestore(&card->priv->driver_lock, flags); lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); @@ -231,14 +231,14 @@ static int if_sdio_handle_event(struct if_sdio_card *card, event <<= SBI_EVENT_CAUSE_SHIFT; } - spin_lock_irqsave(&card->priv->adapter->driver_lock, flags); + spin_lock_irqsave(&card->priv->driver_lock, flags); card->event = event; card->int_cause |= MRVDRV_CARDEVENT; lbs_interrupt(card->priv->dev); - spin_unlock_irqrestore(&card->priv->adapter->driver_lock, flags); + spin_unlock_irqrestore(&card->priv->driver_lock, flags); ret = 0; @@ -800,7 +800,7 @@ static int if_sdio_read_event_cause(struct lbs_private *priv) card = priv->card; - priv->adapter->eventcause = card->event; + priv->eventcause = card->event; lbs_deb_leave(LBS_DEB_SDIO); @@ -962,7 +962,7 @@ static int if_sdio_probe(struct sdio_func *func, priv->hw_get_int_status = if_sdio_get_int_status; priv->hw_read_event_cause = if_sdio_read_event_cause; - priv->adapter->fw_ready = 1; + priv->fw_ready = 1; /* * Enable interrupts now that everything is set up @@ -985,7 +985,7 @@ out: err_activate_card: flush_scheduled_work(); free_netdev(priv->dev); - kfree(priv->adapter); + kfree(priv); reclaim: sdio_claim_host(func); release_int: @@ -1015,7 +1015,7 @@ static void if_sdio_remove(struct sdio_func *func) card = sdio_get_drvdata(func); - card->priv->adapter->surpriseremoved = 1; + card->priv->surpriseremoved = 1; lbs_deb_sdio("call remove card\n"); lbs_stop_card(card->priv); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 7c4bd8d982a..87bed4a1718 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -229,7 +229,7 @@ static int if_usb_probe(struct usb_interface *intf, /* Delay 200 ms to waiting for the FW ready */ if_usb_submit_rx_urb(cardp); msleep_interruptible(200); - priv->adapter->fw_ready = 1; + priv->fw_ready = 1; if (lbs_start_card(priv)) goto err_start_card; @@ -270,9 +270,8 @@ static void if_usb_disconnect(struct usb_interface *intf) cardp->surprise_removed = 1; if (priv) { - struct lbs_adapter *adapter = priv->adapter; - adapter->surpriseremoved = 1; + priv->surpriseremoved = 1; lbs_stop_card(priv); lbs_remove_mesh(priv); lbs_remove_card(priv); @@ -609,14 +608,14 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, if (!in_interrupt()) BUG(); - spin_lock(&priv->adapter->driver_lock); + spin_lock(&priv->driver_lock); /* take care of cur_cmd = NULL case by reading the * data to clear the interrupt */ - if (!priv->adapter->cur_cmd) { + if (!priv->cur_cmd) { cmdbuf = priv->upld_buf; - priv->adapter->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; + priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; } else - cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr; + cmdbuf = priv->cur_cmd->bufvirtualaddr; cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); @@ -625,7 +624,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, kfree_skb(skb); lbs_interrupt(priv->dev); - spin_unlock(&priv->adapter->driver_lock); + spin_unlock(&priv->driver_lock); lbs_deb_usbd(&cardp->udev->dev, "Wake up main thread to handle cmd response\n"); @@ -685,20 +684,20 @@ static void if_usb_receive(struct urb *urb) case CMD_TYPE_INDICATION: /* Event cause handling */ - spin_lock(&priv->adapter->driver_lock); + spin_lock(&priv->driver_lock); cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN)); lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", cardp->usb_event_cause); if (cardp->usb_event_cause & 0xffff0000) { lbs_send_tx_feedback(priv); - spin_unlock(&priv->adapter->driver_lock); + spin_unlock(&priv->driver_lock); break; } cardp->usb_event_cause <<= 3; cardp->usb_int_cause |= MRVDRV_CARDEVENT; kfree_skb(skb); lbs_interrupt(priv->dev); - spin_unlock(&priv->adapter->driver_lock); + spin_unlock(&priv->driver_lock); goto rx_exit; default: lbs_deb_usbd(&cardp->udev->dev, "Unknown command type 0x%X\n", @@ -750,7 +749,7 @@ static int if_usb_host_to_card(struct lbs_private *priv, nb + MESSAGE_HEADER_LEN); } -/* called with adapter->driver_lock held */ +/* called with priv->driver_lock held */ static int if_usb_get_int_status(struct lbs_private *priv, u8 *ireg) { struct usb_card_rec *cardp = priv->card; @@ -767,7 +766,7 @@ static int if_usb_read_event_cause(struct lbs_private *priv) { struct usb_card_rec *cardp = priv->card; - priv->adapter->eventcause = cardp->usb_event_cause; + priv->eventcause = cardp->usb_event_cause; /* Re-submit rx urb here to avoid event lost issue */ if_usb_submit_rx_urb(cardp); return 0; @@ -942,7 +941,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) lbs_deb_enter(LBS_DEB_USB); - if (priv->adapter->psstate != PS_STATE_FULL_POWER) + if (priv->psstate != PS_STATE_FULL_POWER) return -1; if (priv->mesh_dev && !priv->mesh_autostart_enabled) { diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 1550e6afb05..14425d9a198 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -30,13 +30,13 @@ * NOTE: Setting the MSB of the basic rates need to be taken * care, either before or after calling this function * - * @param adapter A pointer to struct lbs_adapter structure + * @param priv A pointer to struct lbs_private structure * @param rate1 the buffer which keeps input and output * @param rate1_size the size of rate1 buffer; new size of buffer on return * * @return 0 or -1 */ -static int get_common_rates(struct lbs_adapter *adapter, +static int get_common_rates(struct lbs_private *priv, u8 *rates, u16 *rates_size) { @@ -57,15 +57,15 @@ static int get_common_rates(struct lbs_adapter *adapter, lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); - lbs_deb_join("TX data rate 0x%02x\n", adapter->cur_rate); + lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); - if (!adapter->auto_rate) { + if (!priv->auto_rate) { for (i = 0; i < tmp_size; i++) { - if (tmp[i] == adapter->cur_rate) + if (tmp[i] == priv->cur_rate) goto done; } lbs_pr_alert("Previously set fixed data rate %#x isn't " - "compatible with the network.\n", adapter->cur_rate); + "compatible with the network.\n", priv->cur_rate); ret = -1; goto done; } @@ -125,7 +125,6 @@ void lbs_unset_basic_rate_flags(u8 *rates, size_t len) */ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret; lbs_deb_enter(LBS_DEB_ASSOC); @@ -138,11 +137,11 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) goto done; /* set preamble to firmware */ - if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + if ( (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; else - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; lbs_set_radio_control(priv); @@ -164,17 +163,16 @@ done: int lbs_start_adhoc_network(struct lbs_private *priv, struct assoc_request *assoc_req) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; - adapter->adhoccreate = 1; + priv->adhoccreate = 1; - if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { + if (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { lbs_deb_join("AdhocStart: Short preamble\n"); - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; } else { lbs_deb_join("AdhocStart: Long preamble\n"); - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; } lbs_set_radio_control(priv); @@ -200,26 +198,25 @@ int lbs_start_adhoc_network(struct lbs_private *priv, int lbs_join_adhoc_network(struct lbs_private *priv, struct assoc_request *assoc_req) { - struct lbs_adapter *adapter = priv->adapter; struct bss_descriptor * bss = &assoc_req->bss; int ret = 0; lbs_deb_join("%s: Current SSID '%s', ssid length %u\n", __func__, - escape_essid(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len), - adapter->curbssparams.ssid_len); + escape_essid(priv->curbssparams.ssid, + priv->curbssparams.ssid_len), + priv->curbssparams.ssid_len); lbs_deb_join("%s: requested ssid '%s', ssid length %u\n", __func__, escape_essid(bss->ssid, bss->ssid_len), bss->ssid_len); /* check if the requested SSID is already joined */ - if ( adapter->curbssparams.ssid_len - && !lbs_ssid_cmp(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len, + if ( priv->curbssparams.ssid_len + && !lbs_ssid_cmp(priv->curbssparams.ssid, + priv->curbssparams.ssid_len, bss->ssid, bss->ssid_len) - && (adapter->mode == IW_MODE_ADHOC) - && (adapter->connect_status == LBS_CONNECTED)) { + && (priv->mode == IW_MODE_ADHOC) + && (priv->connect_status == LBS_CONNECTED)) { union iwreq_data wrqu; lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as " @@ -229,7 +226,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv, * request really was successful, even if just a null-op. */ memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); @@ -239,12 +236,12 @@ int lbs_join_adhoc_network(struct lbs_private *priv, /* Use shortpreamble only when both creator and card supports short preamble */ if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) - || !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { + || !(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { lbs_deb_join("AdhocJoin: Long preamble\n"); - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; } else { lbs_deb_join("AdhocJoin: Short preamble\n"); - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; } lbs_set_radio_control(priv); @@ -252,7 +249,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv, lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); - adapter->adhoccreate = 0; + priv->adhoccreate = 0; ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, 0, CMD_OPTION_WAITFORRSP, @@ -293,7 +290,6 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; int ret = -1; u8 *bssid = pdata_buf; @@ -306,7 +302,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv, + S_DS_GEN); /* translate auth mode to 802.11 defined wire value */ - switch (adapter->secinfo.auth_mode) { + switch (priv->secinfo.auth_mode) { case IW_AUTH_ALG_OPEN_SYSTEM: pauthenticate->authtype = 0x00; break; @@ -318,7 +314,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv, break; default: lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n", - adapter->secinfo.auth_mode); + priv->secinfo.auth_mode); goto out; } @@ -336,7 +332,6 @@ out: int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, struct cmd_ds_command *cmd) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; lbs_deb_enter(LBS_DEB_JOIN); @@ -346,7 +341,7 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, S_DS_GEN); /* set AP MAC address */ - memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); + memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN); /* Reason code 3 = Station is leaving */ #define REASON_CODE_STA_LEAVING 3 @@ -359,7 +354,6 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, int lbs_cmd_80211_associate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_associate *passo = &cmd->params.associate; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -376,7 +370,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, pos = (u8 *) passo; - if (!adapter) { + if (!priv) { ret = -1; goto done; } @@ -420,7 +414,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, rates->header.type = cpu_to_le16(TLV_TYPE_RATES); memcpy(&rates->rates, &bss->rates, MAX_RATES); tmplen = MAX_RATES; - if (get_common_rates(adapter, rates->rates, &tmplen)) { + if (get_common_rates(priv, rates->rates, &tmplen)) { ret = -1; goto done; } @@ -429,8 +423,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen); /* Copy the infra. association rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, &rates->rates, tmplen); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, &rates->rates, tmplen); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. @@ -450,7 +444,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv, } /* update curbssparams */ - adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; + priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { ret = -1; @@ -474,7 +468,6 @@ done: int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; int ret = 0; int cmdappendsize = 0; @@ -484,7 +477,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_JOIN); - if (!adapter) { + if (!priv) { ret = -1; goto done; } @@ -494,7 +487,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, /* * Fill in the parameters for 2 data structures: * 1. cmd_ds_802_11_ad_hoc_start command - * 2. adapter->scantable[i] + * 2. priv->scantable[i] * * Driver will fill up SSID, bsstype,IBSS param, Physical Param, * probe delay, and cap info. @@ -512,10 +505,10 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, /* set the BSS type */ adhs->bsstype = CMD_BSS_TYPE_IBSS; - adapter->mode = IW_MODE_ADHOC; - if (adapter->beacon_period == 0) - adapter->beacon_period = MRVDRV_BEACON_INTERVAL; - adhs->beaconperiod = cpu_to_le16(adapter->beacon_period); + priv->mode = IW_MODE_ADHOC; + if (priv->beacon_period == 0) + priv->beacon_period = MRVDRV_BEACON_INTERVAL; + adhs->beaconperiod = cpu_to_le16(priv->beacon_period); /* set Physical param set */ #define DS_PARA_IE_ID 3 @@ -557,8 +550,8 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, memcpy(adhs->rates, lbs_bg_rates, ratesize); /* Copy the ad-hoc creating rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, &adhs->rates, ratesize); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, &adhs->rates, ratesize); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. @@ -597,7 +590,6 @@ int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj; struct assoc_request * assoc_req = pdata_buf; struct bss_descriptor *bss = &assoc_req->bss; @@ -638,21 +630,21 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, /* probedelay */ join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - adapter->curbssparams.channel = bss->channel; + priv->curbssparams.channel = bss->channel; /* Copy Data rates from the rates recorded in scan response */ memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates)); ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES); memcpy(join_cmd->bss.rates, bss->rates, ratesize); - if (get_common_rates(adapter, join_cmd->bss.rates, &ratesize)) { + if (get_common_rates(priv, join_cmd->bss.rates, &ratesize)) { lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); ret = -1; goto done; } /* Copy the ad-hoc creating rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, join_cmd->bss.rates, ratesize); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, join_cmd->bss.rates, ratesize); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. @@ -668,7 +660,7 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, join_cmd->bss.capability = cpu_to_le16(tmp); } - if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { + if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { /* wake up first */ __le32 Localpsmode; @@ -700,7 +692,6 @@ done: int lbs_ret_80211_associate(struct lbs_private *priv, struct cmd_ds_command *resp) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; union iwreq_data wrqu; struct ieeetypes_assocrsp *passocrsp; @@ -709,12 +700,12 @@ int lbs_ret_80211_associate(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_ASSOC); - if (!adapter->in_progress_assoc_req) { + if (!priv->in_progress_assoc_req) { lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n"); ret = -1; goto done; } - bss = &adapter->in_progress_assoc_req->bss; + bss = &priv->in_progress_assoc_req->bss; passocrsp = (struct ieeetypes_assocrsp *) & resp->params; @@ -771,29 +762,29 @@ int lbs_ret_80211_associate(struct lbs_private *priv, le16_to_cpu(resp->size) - S_DS_GEN); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LBS_CONNECTED; + priv->connect_status = LBS_CONNECTED; /* Update current SSID and BSSID */ - memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - adapter->curbssparams.ssid_len = bss->ssid_len; - memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); + memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); + priv->curbssparams.ssid_len = bss->ssid_len; + memcpy(priv->curbssparams.bssid, bss->bssid, ETH_ALEN); lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n", - adapter->currentpacketfilter); + priv->currentpacketfilter); - adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; - adapter->NF[TYPE_RXPD][TYPE_AVG] = 0; + priv->SNR[TYPE_RXPD][TYPE_AVG] = 0; + priv->NF[TYPE_RXPD][TYPE_AVG] = 0; - memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR)); - memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); - adapter->nextSNRNF = 0; - adapter->numSNRNF = 0; + memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); + memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); + priv->nextSNRNF = 0; + priv->numSNRNF = 0; netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); @@ -816,7 +807,6 @@ int lbs_ret_80211_disassociate(struct lbs_private *priv, int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *resp) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; u16 command = le16_to_cpu(resp->command); u16 result = le16_to_cpu(resp->result); @@ -833,19 +823,19 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, lbs_deb_join("ADHOC_RESP: command = %x\n", command); lbs_deb_join("ADHOC_RESP: result = %x\n", result); - if (!adapter->in_progress_assoc_req) { + if (!priv->in_progress_assoc_req) { lbs_deb_join("ADHOC_RESP: no in-progress association request\n"); ret = -1; goto done; } - bss = &adapter->in_progress_assoc_req->bss; + bss = &priv->in_progress_assoc_req->bss; /* * Join result code 0 --> SUCCESS */ if (result) { lbs_deb_join("ADHOC_RESP: failed\n"); - if (adapter->connect_status == LBS_CONNECTED) { + if (priv->connect_status == LBS_CONNECTED) { lbs_mac_event_disconnected(priv); } ret = -1; @@ -860,7 +850,7 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, escape_essid(bss->ssid, bss->ssid_len)); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LBS_CONNECTED; + priv->connect_status = LBS_CONNECTED; if (command == CMD_RET(CMD_802_11_AD_HOC_START)) { /* Update the created network descriptor with the new BSSID */ @@ -868,22 +858,22 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, } /* Set the BSSID from the joined/started descriptor */ - memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); + memcpy(&priv->curbssparams.bssid, bss->bssid, ETH_ALEN); /* Set the new SSID to current SSID */ - memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - adapter->curbssparams.ssid_len = bss->ssid_len; + memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); + priv->curbssparams.ssid_len = bss->ssid_len; netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n"); - lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel); + lbs_deb_join("ADHOC_RESP: channel = %d\n", priv->curbssparams.channel); lbs_deb_join("ADHOC_RESP: BSSID = %s\n", print_mac(mac, padhocresult->bssid)); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 7155f481816..243cdea419c 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -257,8 +257,7 @@ static ssize_t lbs_rtap_get(struct device *dev, struct device_attribute *attr, char * buf) { struct lbs_private *priv = to_net_dev(dev)->priv; - struct lbs_adapter *adapter = priv->adapter; - return snprintf(buf, 5, "0x%X\n", adapter->monitormode); + return snprintf(buf, 5, "0x%X\n", priv->monitormode); } /** @@ -269,31 +268,30 @@ static ssize_t lbs_rtap_set(struct device *dev, { int monitor_mode; struct lbs_private *priv = to_net_dev(dev)->priv; - struct lbs_adapter *adapter = priv->adapter; sscanf(buf, "%x", &monitor_mode); if (monitor_mode != LBS_MONITOR_OFF) { - if(adapter->monitormode == monitor_mode) + if(priv->monitormode == monitor_mode) return strlen(buf); - if (adapter->monitormode == LBS_MONITOR_OFF) { - if (adapter->mode == IW_MODE_INFRA) + if (priv->monitormode == LBS_MONITOR_OFF) { + if (priv->mode == IW_MODE_INFRA) lbs_send_deauthentication(priv); - else if (adapter->mode == IW_MODE_ADHOC) + else if (priv->mode == IW_MODE_ADHOC) lbs_stop_adhoc_network(priv); lbs_add_rtap(priv); } - adapter->monitormode = monitor_mode; + priv->monitormode = monitor_mode; } else { - if (adapter->monitormode == LBS_MONITOR_OFF) + if (priv->monitormode == LBS_MONITOR_OFF) return strlen(buf); - adapter->monitormode = LBS_MONITOR_OFF; + priv->monitormode = LBS_MONITOR_OFF; lbs_remove_rtap(priv); - if (adapter->currenttxskb) { - dev_kfree_skb_any(adapter->currenttxskb); - adapter->currenttxskb = NULL; + if (priv->currenttxskb) { + dev_kfree_skb_any(priv->currenttxskb); + priv->currenttxskb = NULL; } /* Wake queues, command thread, etc. */ @@ -302,7 +300,7 @@ static ssize_t lbs_rtap_set(struct device *dev, lbs_prepare_and_send_command(priv, CMD_802_11_MONITOR_MODE, CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, &adapter->monitormode); + CMD_OPTION_WAITFORRSP, 0, &priv->monitormode); return strlen(buf); } @@ -382,14 +380,13 @@ static struct attribute_group lbs_mesh_attr_group = { static int pre_open_check(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; - struct lbs_adapter *adapter = priv->adapter; int i = 0; - while (!adapter->fw_ready && i < 20) { + while (!priv->fw_ready && i < 20) { i++; msleep_interruptible(100); } - if (!adapter->fw_ready) { + if (!priv->fw_ready) { lbs_pr_err("firmware not ready\n"); return -1; } @@ -406,19 +403,18 @@ static int pre_open_check(struct net_device *dev) static int lbs_dev_open(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_NET); priv->open = 1; - if (adapter->connect_status == LBS_CONNECTED) + if (priv->connect_status == LBS_CONNECTED) netif_carrier_on(priv->dev); else netif_carrier_off(priv->dev); if (priv->mesh_dev) { - if (adapter->mesh_connect_status == LBS_CONNECTED) + if (priv->mesh_connect_status == LBS_CONNECTED) netif_carrier_on(priv->mesh_dev); else netif_carrier_off(priv->mesh_dev); @@ -442,7 +438,7 @@ static int lbs_mesh_open(struct net_device *dev) priv->mesh_open = 1 ; netif_wake_queue(priv->mesh_dev); - priv->adapter->mesh_connect_status = LBS_CONNECTED; + priv->mesh_connect_status = LBS_CONNECTED; netif_carrier_on(priv->mesh_dev); netif_wake_queue(priv->mesh_dev); @@ -534,7 +530,7 @@ static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) priv->stats.tx_dropped++; goto done; } - if (priv->adapter->currenttxskb) { + if (priv->currenttxskb) { lbs_pr_err("%s while TX skb pending\n", __func__); priv->stats.tx_dropped++; goto done; @@ -562,7 +558,7 @@ static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, int ret; lbs_deb_enter(LBS_DEB_MESH); - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->monitormode != LBS_MONITOR_OFF) { netif_stop_queue(dev); return -EOPNOTSUPP; } @@ -585,7 +581,7 @@ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) lbs_deb_enter(LBS_DEB_TX); - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->monitormode != LBS_MONITOR_OFF) { netif_stop_queue(dev); return -EOPNOTSUPP; } @@ -608,20 +604,20 @@ static void lbs_tx_timeout(struct net_device *dev) priv->dnld_sent = DNLD_RES_RECEIVED; dev->trans_start = jiffies; - if (priv->adapter->currenttxskb) { - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->currenttxskb) { + if (priv->monitormode != LBS_MONITOR_OFF) { /* If we are here, we have not received feedback from the previous packet. Assume TX_FAIL and move on. */ - priv->adapter->eventcause = 0x01000000; + priv->eventcause = 0x01000000; lbs_send_tx_feedback(priv); } else wake_up_interruptible(&priv->waitq); } else if (dev == priv->dev) { - if (priv->adapter->connect_status == LBS_CONNECTED) + if (priv->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); } else if (dev == priv->mesh_dev) { - if (priv->adapter->mesh_connect_status == LBS_CONNECTED) + if (priv->mesh_connect_status == LBS_CONNECTED) netif_wake_queue(priv->mesh_dev); } @@ -630,23 +626,22 @@ static void lbs_tx_timeout(struct net_device *dev) void lbs_host_to_card_done(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; priv->dnld_sent = DNLD_RES_RECEIVED; /* Wake main thread if commands are pending */ - if (!adapter->cur_cmd) + if (!priv->cur_cmd) wake_up_interruptible(&priv->waitq); /* Don't wake netif queues if we're in monitor mode and a TX packet is already pending. */ - if (priv->adapter->currenttxskb) + if (priv->currenttxskb) return; - if (priv->dev && adapter->connect_status == LBS_CONNECTED) + if (priv->dev && priv->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); - if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED) + if (priv->mesh_dev && priv->mesh_connect_status == LBS_CONNECTED) netif_wake_queue(priv->mesh_dev); } EXPORT_SYMBOL_GPL(lbs_host_to_card_done); @@ -668,7 +663,6 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr) { int ret = 0; struct lbs_private *priv = (struct lbs_private *) dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct sockaddr *phwaddr = addr; lbs_deb_enter(LBS_DEB_NET); @@ -676,13 +670,13 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr) /* In case it was called from the mesh device */ dev = priv->dev ; - memset(adapter->current_addr, 0, ETH_ALEN); + memset(priv->current_addr, 0, ETH_ALEN); /* dev->dev_addr is 8 bytes */ lbs_deb_hex(LBS_DEB_NET, "dev->dev_addr", dev->dev_addr, ETH_ALEN); lbs_deb_hex(LBS_DEB_NET, "addr", phwaddr->sa_data, ETH_ALEN); - memcpy(adapter->current_addr, phwaddr->sa_data, ETH_ALEN); + memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN); ret = lbs_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS, CMD_ACT_SET, @@ -694,24 +688,24 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr) goto done; } - lbs_deb_hex(LBS_DEB_NET, "adapter->macaddr", adapter->current_addr, ETH_ALEN); - memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN); + lbs_deb_hex(LBS_DEB_NET, "priv->macaddr", priv->current_addr, ETH_ALEN); + memcpy(dev->dev_addr, priv->current_addr, ETH_ALEN); if (priv->mesh_dev) - memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); + memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); done: lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); return ret; } -static int lbs_copy_multicast_address(struct lbs_adapter *adapter, +static int lbs_copy_multicast_address(struct lbs_private *priv, struct net_device *dev) { int i = 0; struct dev_mc_list *mcptr = dev->mc_list; for (i = 0; i < dev->mc_count; i++) { - memcpy(&adapter->multicastlist[i], mcptr->dmi_addr, ETH_ALEN); + memcpy(&priv->multicastlist[i], mcptr->dmi_addr, ETH_ALEN); mcptr = mcptr->next; } @@ -722,50 +716,49 @@ static int lbs_copy_multicast_address(struct lbs_adapter *adapter, static void lbs_set_multicast_list(struct net_device *dev) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int oldpacketfilter; DECLARE_MAC_BUF(mac); lbs_deb_enter(LBS_DEB_NET); - oldpacketfilter = adapter->currentpacketfilter; + oldpacketfilter = priv->currentpacketfilter; if (dev->flags & IFF_PROMISC) { lbs_deb_net("enable promiscuous mode\n"); - adapter->currentpacketfilter |= + priv->currentpacketfilter |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; - adapter->currentpacketfilter &= + priv->currentpacketfilter &= ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | CMD_ACT_MAC_MULTICAST_ENABLE); } else { /* Multicast */ - adapter->currentpacketfilter &= + priv->currentpacketfilter &= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE; if (dev->flags & IFF_ALLMULTI || dev->mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE) { lbs_deb_net( "enabling all multicast\n"); - adapter->currentpacketfilter |= + priv->currentpacketfilter |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE; - adapter->currentpacketfilter &= + priv->currentpacketfilter &= ~CMD_ACT_MAC_MULTICAST_ENABLE; } else { - adapter->currentpacketfilter &= + priv->currentpacketfilter &= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE; if (!dev->mc_count) { lbs_deb_net("no multicast addresses, " "disabling multicast\n"); - adapter->currentpacketfilter &= + priv->currentpacketfilter &= ~CMD_ACT_MAC_MULTICAST_ENABLE; } else { int i; - adapter->currentpacketfilter |= + priv->currentpacketfilter |= CMD_ACT_MAC_MULTICAST_ENABLE; - adapter->nr_of_multicastmacaddr = - lbs_copy_multicast_address(adapter, dev); + priv->nr_of_multicastmacaddr = + lbs_copy_multicast_address(priv, dev); lbs_deb_net("multicast addresses: %d\n", dev->mc_count); @@ -773,7 +766,7 @@ static void lbs_set_multicast_list(struct net_device *dev) for (i = 0; i < dev->mc_count; i++) { lbs_deb_net("Multicast address %d:%s\n", i, print_mac(mac, - adapter->multicastlist[i])); + priv->multicastlist[i])); } /* send multicast addresses to firmware */ lbs_prepare_and_send_command(priv, @@ -784,7 +777,7 @@ static void lbs_set_multicast_list(struct net_device *dev) } } - if (adapter->currentpacketfilter != oldpacketfilter) { + if (priv->currentpacketfilter != oldpacketfilter) { lbs_set_mac_packet_filter(priv); } @@ -803,7 +796,6 @@ static int lbs_thread(void *data) { struct net_device *dev = data; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; wait_queue_t wait; u8 ireg = 0; @@ -815,99 +807,99 @@ static int lbs_thread(void *data) for (;;) { lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", - adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); + priv->intcounter, priv->currenttxskb, priv->dnld_sent); add_wait_queue(&priv->waitq, &wait); set_current_state(TASK_INTERRUPTIBLE); - spin_lock_irq(&adapter->driver_lock); + spin_lock_irq(&priv->driver_lock); - if ((adapter->psstate == PS_STATE_SLEEP) || - (!adapter->intcounter && (priv->dnld_sent || adapter->cur_cmd || list_empty(&adapter->cmdpendingq)))) { + if ((priv->psstate == PS_STATE_SLEEP) || + (!priv->intcounter && (priv->dnld_sent || priv->cur_cmd || list_empty(&priv->cmdpendingq)))) { lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", - adapter->connect_status, adapter->intcounter, - adapter->psmode, adapter->psstate); - spin_unlock_irq(&adapter->driver_lock); + priv->connect_status, priv->intcounter, + priv->psmode, priv->psstate); + spin_unlock_irq(&priv->driver_lock); schedule(); } else - spin_unlock_irq(&adapter->driver_lock); + spin_unlock_irq(&priv->driver_lock); lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n", - adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); + priv->intcounter, priv->currenttxskb, priv->dnld_sent); set_current_state(TASK_RUNNING); remove_wait_queue(&priv->waitq, &wait); try_to_freeze(); lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n", - adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); + priv->intcounter, priv->currenttxskb, priv->dnld_sent); - if (kthread_should_stop() || adapter->surpriseremoved) { + if (kthread_should_stop() || priv->surpriseremoved) { lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n", - adapter->surpriseremoved); + priv->surpriseremoved); break; } - spin_lock_irq(&adapter->driver_lock); + spin_lock_irq(&priv->driver_lock); - if (adapter->intcounter) { + if (priv->intcounter) { u8 int_status; - adapter->intcounter = 0; + priv->intcounter = 0; int_status = priv->hw_get_int_status(priv, &ireg); if (int_status) { lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n"); - spin_unlock_irq(&adapter->driver_lock); + spin_unlock_irq(&priv->driver_lock); continue; } - adapter->hisregcpy |= ireg; + priv->hisregcpy |= ireg; } lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n", - adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); + priv->intcounter, priv->currenttxskb, priv->dnld_sent); /* command response? */ - if (adapter->hisregcpy & MRVDRV_CMD_UPLD_RDY) { + if (priv->hisregcpy & MRVDRV_CMD_UPLD_RDY) { lbs_deb_thread("main-thread: cmd response ready\n"); - adapter->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; - spin_unlock_irq(&adapter->driver_lock); + priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; + spin_unlock_irq(&priv->driver_lock); lbs_process_rx_command(priv); - spin_lock_irq(&adapter->driver_lock); + spin_lock_irq(&priv->driver_lock); } /* Any Card Event */ - if (adapter->hisregcpy & MRVDRV_CARDEVENT) { + if (priv->hisregcpy & MRVDRV_CARDEVENT) { lbs_deb_thread("main-thread: Card Event Activity\n"); - adapter->hisregcpy &= ~MRVDRV_CARDEVENT; + priv->hisregcpy &= ~MRVDRV_CARDEVENT; if (priv->hw_read_event_cause(priv)) { lbs_pr_alert("main-thread: hw_read_event_cause failed\n"); - spin_unlock_irq(&adapter->driver_lock); + spin_unlock_irq(&priv->driver_lock); continue; } - spin_unlock_irq(&adapter->driver_lock); + spin_unlock_irq(&priv->driver_lock); lbs_process_event(priv); } else - spin_unlock_irq(&adapter->driver_lock); + spin_unlock_irq(&priv->driver_lock); /* Check if we need to confirm Sleep Request received previously */ - if (adapter->psstate == PS_STATE_PRE_SLEEP && - !priv->dnld_sent && !adapter->cur_cmd) { - if (adapter->connect_status == LBS_CONNECTED) { + if (priv->psstate == PS_STATE_PRE_SLEEP && + !priv->dnld_sent && !priv->cur_cmd) { + if (priv->connect_status == LBS_CONNECTED) { lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n", - adapter->intcounter, adapter->currenttxskb, priv->dnld_sent, adapter->cur_cmd); + priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd); - lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); + lbs_ps_confirm_sleep(priv, (u16) priv->psmode); } else { /* workaround for firmware sending * deauth/linkloss event immediately * after sleep request; remove this * after firmware fixes it */ - adapter->psstate = PS_STATE_AWAKE; + priv->psstate = PS_STATE_AWAKE; lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n"); } } @@ -915,25 +907,25 @@ static int lbs_thread(void *data) /* The PS state is changed during processing of Sleep Request * event above */ - if ((priv->adapter->psstate == PS_STATE_SLEEP) || - (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) continue; /* Execute the next command */ - if (!priv->dnld_sent && !priv->adapter->cur_cmd) + if (!priv->dnld_sent && !priv->cur_cmd) lbs_execute_next_command(priv); /* Wake-up command waiters which can't sleep in * lbs_prepare_and_send_command */ - if (!list_empty(&adapter->cmdpendingq)) - wake_up_all(&adapter->cmd_pending); + if (!list_empty(&priv->cmdpendingq)) + wake_up_all(&priv->cmd_pending); lbs_tx_runqueue(priv); } - del_timer(&adapter->command_timer); - wake_up_all(&adapter->cmd_pending); + del_timer(&priv->command_timer); + wake_up_all(&priv->cmd_pending); lbs_deb_leave(LBS_DEB_THREAD); return 0; @@ -950,7 +942,6 @@ static int lbs_thread(void *data) static int lbs_setup_firmware(struct lbs_private *priv) { int ret = -1; - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_mesh_access mesh_access; lbs_deb_enter(LBS_DEB_FW); @@ -958,7 +949,7 @@ static int lbs_setup_firmware(struct lbs_private *priv) /* * Read MAC address from HW */ - memset(adapter->current_addr, 0xff, ETH_ALEN); + memset(priv->current_addr, 0xff, ETH_ALEN); ret = lbs_prepare_and_send_command(priv, CMD_GET_HW_SPEC, 0, CMD_OPTION_WAITFORRSP, 0, NULL); @@ -1008,12 +999,11 @@ done: static void command_timer_fn(unsigned long data) { struct lbs_private *priv = (struct lbs_private *)data; - struct lbs_adapter *adapter = priv->adapter; struct cmd_ctrl_node *ptempnode; struct cmd_ds_command *cmd; unsigned long flags; - ptempnode = adapter->cur_cmd; + ptempnode = priv->cur_cmd; if (ptempnode == NULL) { lbs_deb_fw("ptempnode empty\n"); return; @@ -1027,15 +1017,15 @@ static void command_timer_fn(unsigned long data) lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command); - if (!adapter->fw_ready) + if (!priv->fw_ready) return; - spin_lock_irqsave(&adapter->driver_lock, flags); - adapter->cur_cmd = NULL; - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_lock_irqsave(&priv->driver_lock, flags); + priv->cur_cmd = NULL; + spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_fw("re-sending same command because of timeout\n"); - lbs_queue_cmd(adapter, ptempnode, 0); + lbs_queue_cmd(priv, ptempnode, 0); wake_up_interruptible(&priv->waitq); @@ -1044,63 +1034,62 @@ static void command_timer_fn(unsigned long data) static int lbs_init_adapter(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; size_t bufsize; int i, ret = 0; /* Allocate buffer to store the BSSID list */ bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); - adapter->networks = kzalloc(bufsize, GFP_KERNEL); - if (!adapter->networks) { + priv->networks = kzalloc(bufsize, GFP_KERNEL); + if (!priv->networks) { lbs_pr_err("Out of memory allocating beacons\n"); ret = -1; goto out; } /* Initialize scan result lists */ - INIT_LIST_HEAD(&adapter->network_free_list); - INIT_LIST_HEAD(&adapter->network_list); + INIT_LIST_HEAD(&priv->network_free_list); + INIT_LIST_HEAD(&priv->network_list); for (i = 0; i < MAX_NETWORK_COUNT; i++) { - list_add_tail(&adapter->networks[i].list, - &adapter->network_free_list); + list_add_tail(&priv->networks[i].list, + &priv->network_free_list); } - adapter->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum); - adapter->lbs_ps_confirm_sleep.command = + priv->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++priv->seqnum); + priv->lbs_ps_confirm_sleep.command = cpu_to_le16(CMD_802_11_PS_MODE); - adapter->lbs_ps_confirm_sleep.size = + priv->lbs_ps_confirm_sleep.size = cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep)); - adapter->lbs_ps_confirm_sleep.action = + priv->lbs_ps_confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED); - memset(adapter->current_addr, 0xff, ETH_ALEN); + memset(priv->current_addr, 0xff, ETH_ALEN); - adapter->connect_status = LBS_DISCONNECTED; - adapter->mesh_connect_status = LBS_DISCONNECTED; - adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - adapter->mode = IW_MODE_INFRA; - adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; - adapter->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; - adapter->radioon = RADIO_ON; - adapter->auto_rate = 1; - adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; - adapter->psmode = LBS802_11POWERMODECAM; - adapter->psstate = PS_STATE_FULL_POWER; + priv->connect_status = LBS_DISCONNECTED; + priv->mesh_connect_status = LBS_DISCONNECTED; + priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; + priv->mode = IW_MODE_INFRA; + priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; + priv->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; + priv->radioon = RADIO_ON; + priv->auto_rate = 1; + priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; + priv->psmode = LBS802_11POWERMODECAM; + priv->psstate = PS_STATE_FULL_POWER; - mutex_init(&adapter->lock); + mutex_init(&priv->lock); - memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*)); - adapter->tx_queue_idx = 0; - spin_lock_init(&adapter->txqueue_lock); + memset(&priv->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*)); + priv->tx_queue_idx = 0; + spin_lock_init(&priv->txqueue_lock); - setup_timer(&adapter->command_timer, command_timer_fn, + setup_timer(&priv->command_timer, command_timer_fn, (unsigned long)priv); - INIT_LIST_HEAD(&adapter->cmdfreeq); - INIT_LIST_HEAD(&adapter->cmdpendingq); + INIT_LIST_HEAD(&priv->cmdfreeq); + INIT_LIST_HEAD(&priv->cmdpendingq); - spin_lock_init(&adapter->driver_lock); - init_waitqueue_head(&adapter->cmd_pending); + spin_lock_init(&priv->driver_lock); + init_waitqueue_head(&priv->cmd_pending); /* Allocate the command buffers */ if (lbs_allocate_cmd_buffer(priv)) { @@ -1114,27 +1103,15 @@ out: static void lbs_free_adapter(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; - - if (!adapter) { - lbs_deb_fw("why double free adapter?\n"); - return; - } - lbs_deb_fw("free command buffer\n"); lbs_free_cmd_buffer(priv); lbs_deb_fw("free command_timer\n"); - del_timer(&adapter->command_timer); + del_timer(&priv->command_timer); lbs_deb_fw("free scan results table\n"); - kfree(adapter->networks); - adapter->networks = NULL; - - /* Free the adapter object itself */ - lbs_deb_fw("free adapter\n"); - kfree(adapter); - priv->adapter = NULL; + kfree(priv->networks); + priv->networks = NULL; } /** @@ -1159,13 +1136,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) } priv = dev->priv; - /* allocate buffer for struct lbs_adapter */ - priv->adapter = kzalloc(sizeof(struct lbs_adapter), GFP_KERNEL); - if (!priv->adapter) { - lbs_pr_err("allocate buffer for struct lbs_adapter failed\n"); - goto err_kzalloc; - } - if (lbs_init_adapter(priv)) { lbs_pr_err("failed to initialize adapter structure.\n"); goto err_init_adapter; @@ -1212,8 +1182,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) err_init_adapter: lbs_free_adapter(priv); - -err_kzalloc: free_netdev(dev); priv = NULL; @@ -1226,7 +1194,6 @@ EXPORT_SYMBOL_GPL(lbs_add_card); int lbs_remove_card(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; struct net_device *dev = priv->dev; union iwreq_data wrqu; @@ -1241,8 +1208,8 @@ int lbs_remove_card(struct lbs_private *priv) cancel_delayed_work(&priv->assoc_work); destroy_workqueue(priv->work_thread); - if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { - adapter->psmode = LBS802_11POWERMODECAM; + if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { + priv->psmode = LBS802_11POWERMODECAM; lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); } @@ -1251,7 +1218,7 @@ int lbs_remove_card(struct lbs_private *priv) wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); /* Stop the thread servicing the interrupts */ - adapter->surpriseremoved = 1; + priv->surpriseremoved = 1; kthread_stop(priv->main_thread); lbs_free_adapter(priv); @@ -1315,12 +1282,12 @@ int lbs_stop_card(struct lbs_private *priv) lbs_debugfs_remove_one(priv); /* Flush pending command nodes */ - spin_lock_irqsave(&priv->adapter->driver_lock, flags); - list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { + spin_lock_irqsave(&priv->driver_lock, flags); + list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { cmdnode->cmdwaitqwoken = 1; wake_up_interruptible(&cmdnode->cmdwait_q); } - spin_unlock_irqrestore(&priv->adapter->driver_lock, flags); + spin_unlock_irqrestore(&priv->driver_lock, flags); unregister_netdev(dev); @@ -1452,7 +1419,6 @@ struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; int i = 0; @@ -1461,22 +1427,22 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) lbs_deb_enter(LBS_DEB_MAIN); - memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); + memset(priv->region_channel, 0, sizeof(priv->region_channel)); { cfp = lbs_get_region_cfp_table(region, band, &cfp_no); if (cfp != NULL) { - adapter->region_channel[i].nrcfp = cfp_no; - adapter->region_channel[i].CFP = cfp; + priv->region_channel[i].nrcfp = cfp_no; + priv->region_channel[i].CFP = cfp; } else { lbs_deb_main("wrong region code %#x in band B/G\n", region); ret = -1; goto out; } - adapter->region_channel[i].valid = 1; - adapter->region_channel[i].region = region; - adapter->region_channel[i].band = band; + priv->region_channel[i].valid = 1; + priv->region_channel[i].region = region; + priv->region_channel[i].band = band; i++; } out: @@ -1499,12 +1465,12 @@ void lbs_interrupt(struct net_device *dev) lbs_deb_enter(LBS_DEB_THREAD); lbs_deb_thread("lbs_interrupt: intcounter=%d\n", - priv->adapter->intcounter); + priv->intcounter); - priv->adapter->intcounter++; + priv->intcounter++; - if (priv->adapter->psstate == PS_STATE_SLEEP) { - priv->adapter->psstate = PS_STATE_AWAKE; + if (priv->psstate == PS_STATE_SLEEP) { + priv->psstate = PS_STATE_AWAKE; netif_wake_queue(dev); if (priv->mesh_dev) netif_wake_queue(priv->mesh_dev); diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index a252a8f74be..58e83110812 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -48,12 +48,11 @@ static u8 lbs_getavgsnr(struct lbs_private *priv) { u8 i; u16 temp = 0; - struct lbs_adapter *adapter = priv->adapter; - if (adapter->numSNRNF == 0) + if (priv->numSNRNF == 0) return 0; - for (i = 0; i < adapter->numSNRNF; i++) - temp += adapter->rawSNR[i]; - return (u8) (temp / adapter->numSNRNF); + for (i = 0; i < priv->numSNRNF; i++) + temp += priv->rawSNR[i]; + return (u8) (temp / priv->numSNRNF); } @@ -67,12 +66,11 @@ static u8 lbs_getavgnf(struct lbs_private *priv) { u8 i; u16 temp = 0; - struct lbs_adapter *adapter = priv->adapter; - if (adapter->numSNRNF == 0) + if (priv->numSNRNF == 0) return 0; - for (i = 0; i < adapter->numSNRNF; i++) - temp += adapter->rawNF[i]; - return (u8) (temp / adapter->numSNRNF); + for (i = 0; i < priv->numSNRNF; i++) + temp += priv->rawNF[i]; + return (u8) (temp / priv->numSNRNF); } @@ -85,14 +83,13 @@ static u8 lbs_getavgnf(struct lbs_private *priv) */ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd) { - struct lbs_adapter *adapter = priv->adapter; - if (adapter->numSNRNF < DEFAULT_DATA_AVG_FACTOR) - adapter->numSNRNF++; - adapter->rawSNR[adapter->nextSNRNF] = p_rx_pd->snr; - adapter->rawNF[adapter->nextSNRNF] = p_rx_pd->nf; - adapter->nextSNRNF++; - if (adapter->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) - adapter->nextSNRNF = 0; + if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR) + priv->numSNRNF++; + priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr; + priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf; + priv->nextSNRNF++; + if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) + priv->nextSNRNF = 0; return; } @@ -105,32 +102,31 @@ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd) */ static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd) { - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_RX); lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf); lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n", - adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); + priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, + priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); - adapter->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr; - adapter->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf; + priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr; + priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf; lbs_save_rawSNRNF(priv, p_rx_pd); - adapter->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE; - adapter->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE; + priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE; + priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE; lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n", - adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); + priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, + priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); - adapter->RSSI[TYPE_RXPD][TYPE_NOAVG] = - CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_NOAVG], - adapter->NF[TYPE_RXPD][TYPE_NOAVG]); + priv->RSSI[TYPE_RXPD][TYPE_NOAVG] = + CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG], + priv->NF[TYPE_RXPD][TYPE_NOAVG]); - adapter->RSSI[TYPE_RXPD][TYPE_AVG] = - CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); + priv->RSSI[TYPE_RXPD][TYPE_AVG] = + CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, + priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); lbs_deb_leave(LBS_DEB_RX); } @@ -139,7 +135,7 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) { lbs_deb_rx("skb->data %p\n", skb->data); - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->monitormode != LBS_MONITOR_OFF) { skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); } else { if (priv->mesh_dev && IS_MESH_FRAME(skb)) @@ -161,7 +157,6 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) */ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct rxpackethdr *p_rx_pkt; @@ -174,7 +169,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_enter(LBS_DEB_RX); - if (priv->adapter->monitormode != LBS_MONITOR_OFF) + if (priv->monitormode != LBS_MONITOR_OFF) return process_rxed_802_11_packet(priv, skb); p_rx_pkt = (struct rxpackethdr *) skb->data; @@ -258,8 +253,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) /* Take the data rate from the rxpd structure * only if the rate is auto */ - if (adapter->auto_rate) - adapter->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); + if (priv->auto_rate) + priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); lbs_compute_rssi(priv, p_rx_pd); @@ -327,7 +322,6 @@ static u8 convert_mv_rate_to_radiotap(u8 rate) static int process_rxed_802_11_packet(struct lbs_private *priv, struct sk_buff *skb) { - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct rx80211packethdr *p_rx_pkt; @@ -361,7 +355,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); /* create the exported radio header */ - if (priv->adapter->monitormode == LBS_MONITOR_OFF) { + if (priv->monitormode == LBS_MONITOR_OFF) { /* no radio header */ /* chop the rxpd */ skb_pull(skb, sizeof(struct rxpd)); @@ -410,8 +404,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, /* Take the data rate from the rxpd structure * only if the rate is auto */ - if (adapter->auto_rate) - adapter->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); + if (priv->auto_rate) + priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); lbs_compute_rssi(priv, prxpd); diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 90c18889b71..8b6ce61aba4 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -190,13 +190,13 @@ static inline int is_same_network(struct bss_descriptor *src, * 0 0 0 0 !=NONE 1 0 0 yes Dynamic WEP * * - * @param adapter A pointer to struct lbs_adapter + * @param priv A pointer to struct lbs_private * @param index Index in scantable to check against current driver settings * @param mode Network mode: Infrastructure or IBSS * * @return Index in scantable, or error code if negative */ -static int is_network_compatible(struct lbs_adapter *adapter, +static int is_network_compatible(struct lbs_private *priv, struct bss_descriptor * bss, u8 mode) { int matched = 0; @@ -206,31 +206,31 @@ static int is_network_compatible(struct lbs_adapter *adapter, if (bss->mode != mode) goto done; - if ((matched = match_bss_no_security(&adapter->secinfo, bss))) { + if ((matched = match_bss_no_security(&priv->secinfo, bss))) { goto done; - } else if ((matched = match_bss_static_wep(&adapter->secinfo, bss))) { + } else if ((matched = match_bss_static_wep(&priv->secinfo, bss))) { goto done; - } else if ((matched = match_bss_wpa(&adapter->secinfo, bss))) { + } else if ((matched = match_bss_wpa(&priv->secinfo, bss))) { lbs_deb_scan( "is_network_compatible() WPA: wpa_ie 0x%x " "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], - adapter->secinfo.wep_enabled ? "e" : "d", - adapter->secinfo.WPAenabled ? "e" : "d", - adapter->secinfo.WPA2enabled ? "e" : "d", + priv->secinfo.wep_enabled ? "e" : "d", + priv->secinfo.WPAenabled ? "e" : "d", + priv->secinfo.WPA2enabled ? "e" : "d", (bss->capability & WLAN_CAPABILITY_PRIVACY)); goto done; - } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { + } else if ((matched = match_bss_wpa2(&priv->secinfo, bss))) { lbs_deb_scan( "is_network_compatible() WPA2: wpa_ie 0x%x " "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], - adapter->secinfo.wep_enabled ? "e" : "d", - adapter->secinfo.WPAenabled ? "e" : "d", - adapter->secinfo.WPA2enabled ? "e" : "d", + priv->secinfo.wep_enabled ? "e" : "d", + priv->secinfo.WPAenabled ? "e" : "d", + priv->secinfo.WPA2enabled ? "e" : "d", (bss->capability & WLAN_CAPABILITY_PRIVACY)); goto done; - } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { + } else if ((matched = match_bss_dynamic_wep(&priv->secinfo, bss))) { lbs_deb_scan( "is_network_compatible() dynamic WEP: " "wpa_ie 0x%x wpa2_ie 0x%x privacy 0x%x\n", @@ -244,9 +244,9 @@ static int is_network_compatible(struct lbs_adapter *adapter, "is_network_compatible() FAILED: wpa_ie 0x%x " "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], - adapter->secinfo.wep_enabled ? "e" : "d", - adapter->secinfo.WPAenabled ? "e" : "d", - adapter->secinfo.WPA2enabled ? "e" : "d", + priv->secinfo.wep_enabled ? "e" : "d", + priv->secinfo.WPAenabled ? "e" : "d", + priv->secinfo.WPA2enabled ? "e" : "d", (bss->capability & WLAN_CAPABILITY_PRIVACY)); done: @@ -298,7 +298,6 @@ static int lbs_scan_create_channel_list(struct lbs_private *priv, u8 filteredscan) { - struct lbs_adapter *adapter = priv->adapter; struct region_channel *scanregion; struct chan_freq_power *cfp; int rgnidx; @@ -314,22 +313,22 @@ static int lbs_scan_create_channel_list(struct lbs_private *priv, */ scantype = CMD_SCAN_TYPE_ACTIVE; - for (rgnidx = 0; rgnidx < ARRAY_SIZE(adapter->region_channel); rgnidx++) { - if (priv->adapter->enable11d && - (adapter->connect_status != LBS_CONNECTED) && - (adapter->mesh_connect_status != LBS_CONNECTED)) { + for (rgnidx = 0; rgnidx < ARRAY_SIZE(priv->region_channel); rgnidx++) { + if (priv->enable11d && + (priv->connect_status != LBS_CONNECTED) && + (priv->mesh_connect_status != LBS_CONNECTED)) { /* Scan all the supported chan for the first scan */ - if (!adapter->universal_channel[rgnidx].valid) + if (!priv->universal_channel[rgnidx].valid) continue; - scanregion = &adapter->universal_channel[rgnidx]; + scanregion = &priv->universal_channel[rgnidx]; /* clear the parsed_region_chan for the first scan */ - memset(&adapter->parsed_region_chan, 0x00, - sizeof(adapter->parsed_region_chan)); + memset(&priv->parsed_region_chan, 0x00, + sizeof(priv->parsed_region_chan)); } else { - if (!adapter->region_channel[rgnidx].valid) + if (!priv->region_channel[rgnidx].valid) continue; - scanregion = &adapter->region_channel[rgnidx]; + scanregion = &priv->region_channel[rgnidx]; } for (nextchan = 0; @@ -337,10 +336,10 @@ static int lbs_scan_create_channel_list(struct lbs_private *priv, cfp = scanregion->CFP + nextchan; - if (priv->adapter->enable11d) { + if (priv->enable11d) { scantype = lbs_get_scan_type_11d(cfp->channel, - &adapter-> + &priv-> parsed_region_chan); } @@ -540,7 +539,6 @@ int lbs_scan_networks(struct lbs_private *priv, const struct lbs_ioctl_user_scan_cfg *user_cfg, int full_scan) { - struct lbs_adapter *adapter = priv->adapter; int ret = -ENOMEM; struct chanscanparamset *chan_list; struct chanscanparamset *curr_chans; @@ -598,12 +596,12 @@ int lbs_scan_networks(struct lbs_private *priv, /* Prepare to continue an interrupted scan */ lbs_deb_scan("chan_count %d, last_scanned_channel %d\n", - chan_count, adapter->last_scanned_channel); + chan_count, priv->last_scanned_channel); curr_chans = chan_list; /* advance channel list by already-scanned-channels */ - if (adapter->last_scanned_channel > 0) { - curr_chans += adapter->last_scanned_channel; - chan_count -= adapter->last_scanned_channel; + if (priv->last_scanned_channel > 0) { + curr_chans += priv->last_scanned_channel; + chan_count -= priv->last_scanned_channel; } /* Send scan command(s) @@ -627,12 +625,12 @@ int lbs_scan_networks(struct lbs_private *priv, /* somehow schedule the next part of the scan */ if (chan_count && !full_scan && - !priv->adapter->surpriseremoved) { + !priv->surpriseremoved) { /* -1 marks just that we're currently scanning */ - if (adapter->last_scanned_channel < 0) - adapter->last_scanned_channel = to_scan; + if (priv->last_scanned_channel < 0) + priv->last_scanned_channel = to_scan; else - adapter->last_scanned_channel += to_scan; + priv->last_scanned_channel += to_scan; cancel_delayed_work(&priv->scan_work); queue_delayed_work(priv->work_thread, &priv->scan_work, msecs_to_jiffies(300)); @@ -646,24 +644,24 @@ int lbs_scan_networks(struct lbs_private *priv, #ifdef CONFIG_LIBERTAS_DEBUG /* Dump the scan table */ - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); lbs_deb_scan("scan table:\n"); - list_for_each_entry(iter, &adapter->network_list, list) + list_for_each_entry(iter, &priv->network_list, list) lbs_deb_scan("%02d: BSSID %s, RSSI %d, SSID '%s'\n", i++, print_mac(mac, iter->bssid), (s32) iter->rssi, escape_essid(iter->ssid, iter->ssid_len)); - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); #endif out2: - adapter->last_scanned_channel = 0; + priv->last_scanned_channel = 0; out: - if (adapter->connect_status == LBS_CONNECTED) { + if (priv->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); netif_wake_queue(priv->dev); } - if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) { + if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { netif_carrier_on(priv->mesh_dev); netif_wake_queue(priv->mesh_dev); } @@ -931,13 +929,13 @@ done: * * Used in association code * - * @param adapter A pointer to struct lbs_adapter + * @param priv A pointer to struct lbs_private * @param bssid BSSID to find in the scan list * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list, or error return code (< 0) */ -struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, +struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv, u8 * bssid, u8 mode) { struct bss_descriptor * iter_bss; @@ -955,14 +953,14 @@ struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, * continue past a matched bssid that is not compatible in case there * is an AP with multiple SSIDs assigned to the same BSSID */ - mutex_lock(&adapter->lock); - list_for_each_entry (iter_bss, &adapter->network_list, list) { + mutex_lock(&priv->lock); + list_for_each_entry (iter_bss, &priv->network_list, list) { if (compare_ether_addr(iter_bss->bssid, bssid)) continue; /* bssid doesn't match */ switch (mode) { case IW_MODE_INFRA: case IW_MODE_ADHOC: - if (!is_network_compatible(adapter, iter_bss, mode)) + if (!is_network_compatible(priv, iter_bss, mode)) break; found_bss = iter_bss; break; @@ -971,7 +969,7 @@ struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, break; } } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); out: lbs_deb_leave_args(LBS_DEB_SCAN, "found_bss %p", found_bss); @@ -983,14 +981,14 @@ out: * * Used in association code * - * @param adapter A pointer to struct lbs_adapter + * @param priv A pointer to struct lbs_private * @param ssid SSID to find in the list * @param bssid BSSID to qualify the SSID selection (if provided) * @param mode Network mode: Infrastructure or IBSS * * @return index in BSSID list */ -struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, +struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv, u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, int channel) { @@ -1001,9 +999,9 @@ struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, lbs_deb_enter(LBS_DEB_SCAN); - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); - list_for_each_entry (iter_bss, &adapter->network_list, list) { + list_for_each_entry (iter_bss, &priv->network_list, list) { if ( !tmp_oldest || (iter_bss->last_scanned < tmp_oldest->last_scanned)) tmp_oldest = iter_bss; @@ -1019,7 +1017,7 @@ struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, switch (mode) { case IW_MODE_INFRA: case IW_MODE_ADHOC: - if (!is_network_compatible(adapter, iter_bss, mode)) + if (!is_network_compatible(priv, iter_bss, mode)) break; if (bssid) { @@ -1044,7 +1042,7 @@ struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, } out: - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_SCAN, "found_bss %p", found_bss); return found_bss; } @@ -1055,12 +1053,12 @@ out: * Search the scan table for the best SSID that also matches the current * adapter network preference (infrastructure or adhoc) * - * @param adapter A pointer to struct lbs_adapter + * @param priv A pointer to struct lbs_private * * @return index in BSSID list */ static struct bss_descriptor *lbs_find_best_ssid_in_list( - struct lbs_adapter *adapter, + struct lbs_private *priv, u8 mode) { u8 bestrssi = 0; @@ -1069,13 +1067,13 @@ static struct bss_descriptor *lbs_find_best_ssid_in_list( lbs_deb_enter(LBS_DEB_SCAN); - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); - list_for_each_entry (iter_bss, &adapter->network_list, list) { + list_for_each_entry (iter_bss, &priv->network_list, list) { switch (mode) { case IW_MODE_INFRA: case IW_MODE_ADHOC: - if (!is_network_compatible(adapter, iter_bss, mode)) + if (!is_network_compatible(priv, iter_bss, mode)) break; if (SCAN_RSSI(iter_bss->rssi) <= bestrssi) break; @@ -1092,7 +1090,7 @@ static struct bss_descriptor *lbs_find_best_ssid_in_list( } } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_SCAN, "best_bss %p", best_bss); return best_bss; } @@ -1110,17 +1108,16 @@ static struct bss_descriptor *lbs_find_best_ssid_in_list( int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode) { - struct lbs_adapter *adapter = priv->adapter; int ret = -1; struct bss_descriptor * found; lbs_deb_enter(LBS_DEB_SCAN); lbs_scan_networks(priv, NULL, 1); - if (adapter->surpriseremoved) + if (priv->surpriseremoved) goto out; - found = lbs_find_best_ssid_in_list(adapter, preferred_mode); + found = lbs_find_best_ssid_in_list(priv, preferred_mode); if (found && (found->ssid_len > 0)) { memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); *out_ssid_len = found->ssid_len; @@ -1150,7 +1147,6 @@ out: int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, u8 ssid_len, u8 clear_ssid) { - struct lbs_adapter *adapter = priv->adapter; struct lbs_ioctl_user_scan_cfg scancfg; int ret = 0; @@ -1166,7 +1162,7 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, scancfg.clear_ssid = clear_ssid; lbs_scan_networks(priv, &scancfg, 1); - if (adapter->surpriseremoved) { + if (priv->surpriseremoved) { ret = -1; goto out; } @@ -1192,7 +1188,6 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, char *start, char *stop, struct bss_descriptor *bss) { - struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; char *current_val; /* For rates */ struct iw_event iwe; /* Temporary buffer */ @@ -1204,7 +1199,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_SCAN); - cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, bss->channel); + cfp = lbs_find_cfp_by_band_and_channel(priv, 0, bss->channel); if (!cfp) { lbs_deb_scan("Invalid channel number %d\n", bss->channel); start = NULL; @@ -1247,25 +1242,25 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, if (iwe.u.qual.qual > 100) iwe.u.qual.qual = 100; - if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { + if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; } else { iwe.u.qual.noise = - CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); + CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]); } /* Locally created ad-hoc BSSs won't have beacons if this is the * only station in the adhoc network; so get signal strength * from receive statistics. */ - if ((adapter->mode == IW_MODE_ADHOC) - && adapter->adhoccreate - && !lbs_ssid_cmp(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len, + if ((priv->mode == IW_MODE_ADHOC) + && priv->adhoccreate + && !lbs_ssid_cmp(priv->curbssparams.ssid, + priv->curbssparams.ssid_len, bss->ssid, bss->ssid_len)) { int snr, nf; - snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; - nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; + snr = priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; + nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; iwe.u.qual.level = CAL_RSSI(snr, nf); } start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); @@ -1294,10 +1289,10 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, stop, &iwe, IW_EV_PARAM_LEN); } if ((bss->mode == IW_MODE_ADHOC) - && !lbs_ssid_cmp(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len, + && !lbs_ssid_cmp(priv->curbssparams.ssid, + priv->curbssparams.ssid_len, bss->ssid, bss->ssid_len) - && adapter->adhoccreate) { + && priv->adhoccreate) { iwe.u.bitrate.value = 22 * 500000; current_val = iwe_stream_add_value(start, current_val, stop, &iwe, IW_EV_PARAM_LEN); @@ -1356,7 +1351,6 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrqu, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_SCAN); @@ -1380,9 +1374,9 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, queue_delayed_work(priv->work_thread, &priv->scan_work, msecs_to_jiffies(50)); /* set marker that currently a scan is taking place */ - adapter->last_scanned_channel = -1; + priv->last_scanned_channel = -1; - if (adapter->surpriseremoved) + if (priv->surpriseremoved) return -EIO; lbs_deb_leave(LBS_DEB_SCAN); @@ -1405,7 +1399,6 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, { #define SCAN_ITEM_SIZE 128 struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int err = 0; char *ev = extra; char *stop = ev + dwrq->length; @@ -1415,17 +1408,17 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, lbs_deb_enter(LBS_DEB_SCAN); /* iwlist should wait until the current scan is finished */ - if (adapter->last_scanned_channel) + if (priv->last_scanned_channel) return -EAGAIN; /* Update RSSI if current BSS is a locally created ad-hoc BSS */ - if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) { + if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) { lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } - mutex_lock(&adapter->lock); - list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) { + mutex_lock(&priv->lock); + list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) { char * next_ev; unsigned long stale_time; @@ -1442,7 +1435,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; if (time_after(jiffies, stale_time)) { list_move_tail (&iter_bss->list, - &adapter->network_free_list); + &priv->network_free_list); clear_bss_descriptor(iter_bss); continue; } @@ -1453,7 +1446,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, continue; ev = next_ev; } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); dwrq->length = (ev - extra); dwrq->flags = 0; @@ -1538,7 +1531,6 @@ int lbs_cmd_80211_scan(struct lbs_private *priv, */ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) { - struct lbs_adapter *adapter = priv->adapter; struct cmd_ds_802_11_scan_rsp *pscan; struct bss_descriptor * iter_bss; struct bss_descriptor * safe; @@ -1552,11 +1544,11 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) lbs_deb_enter(LBS_DEB_SCAN); /* Prune old entries from scan table */ - list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) { + list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) { unsigned long stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; if (time_before(jiffies, stale_time)) continue; - list_move_tail (&iter_bss->list, &adapter->network_free_list); + list_move_tail (&iter_bss->list, &priv->network_free_list); clear_bss_descriptor(iter_bss); } @@ -1609,7 +1601,7 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) } /* Try to find this bss in the scan table */ - list_for_each_entry (iter_bss, &adapter->network_list, list) { + list_for_each_entry (iter_bss, &priv->network_list, list) { if (is_same_network(iter_bss, &new)) { found = iter_bss; break; @@ -1623,16 +1615,16 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) if (found) { /* found, clear it */ clear_bss_descriptor(found); - } else if (!list_empty(&adapter->network_free_list)) { + } else if (!list_empty(&priv->network_free_list)) { /* Pull one from the free list */ - found = list_entry(adapter->network_free_list.next, + found = list_entry(priv->network_free_list.next, struct bss_descriptor, list); - list_move_tail(&found->list, &adapter->network_list); + list_move_tail(&found->list, &priv->network_list); } else if (oldest) { /* If there are no more slots, expire the oldest */ found = oldest; clear_bss_descriptor(found); - list_move_tail(&found->list, &adapter->network_list); + list_move_tail(&found->list, &priv->network_list); } else { continue; } diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index 9b62e2b01f6..319f70dde35 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h @@ -10,8 +10,6 @@ #include #include "hostcmd.h" -struct lbs_adapter; - /** * @brief Maximum number of channels that can be sent in a setuserscan ioctl * @@ -168,11 +166,11 @@ struct bss_descriptor { int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); -struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter, +struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv, u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode, int channel); -struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter, +struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv, u8 *bssid, u8 mode); int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid, diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 131ef3fe033..4cb39d33003 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -64,11 +64,11 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) u8 *p802x_hdr; struct tx_radiotap_hdr *pradiotap_hdr; u32 new_rate; - u8 *ptr = priv->adapter->tmptxbuf; + u8 *ptr = priv->tmptxbuf; lbs_deb_enter(LBS_DEB_TX); - if (priv->adapter->surpriseremoved) + if (priv->surpriseremoved) return -1; if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { @@ -86,7 +86,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); p802x_hdr = skb->data; - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->monitormode != LBS_MONITOR_OFF) { /* locate radiotap header */ pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data; @@ -106,7 +106,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) } /* copy destination address from 802.3 or 802.11 header */ - if (priv->adapter->monitormode != LBS_MONITOR_OFF) + if (priv->monitormode != LBS_MONITOR_OFF) memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); else memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); @@ -124,7 +124,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); ret = priv->hw_host_to_card(priv, MVMS_DAT, - priv->adapter->tmptxbuf, + priv->tmptxbuf, le16_to_cpu(plocaltxpd->tx_packet_length) + sizeof(struct txpd)); @@ -144,7 +144,7 @@ done: priv->stats.tx_errors++; } - if (!ret && priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (!ret && priv->monitormode != LBS_MONITOR_OFF) { /* Keep the skb to echo it back once Tx feedback is received from FW */ skb_orphan(skb); @@ -154,7 +154,7 @@ done: netif_stop_queue(priv->mesh_dev); /* Keep the skb around for when we get feedback */ - priv->adapter->currenttxskb = skb; + priv->currenttxskb = skb; } else { dev_kfree_skb_any(skb); } @@ -166,29 +166,27 @@ done: void lbs_tx_runqueue(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; int i; - spin_lock(&adapter->txqueue_lock); - for (i = 0; i < adapter->tx_queue_idx; i++) { - struct sk_buff *skb = adapter->tx_queue_ps[i]; - spin_unlock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); + for (i = 0; i < priv->tx_queue_idx; i++) { + struct sk_buff *skb = priv->tx_queue_ps[i]; + spin_unlock(&priv->txqueue_lock); SendSinglePacket(priv, skb); - spin_lock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); } - adapter->tx_queue_idx = 0; - spin_unlock(&adapter->txqueue_lock); + priv->tx_queue_idx = 0; + spin_unlock(&priv->txqueue_lock); } static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) { - struct lbs_adapter *adapter = priv->adapter; - spin_lock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); - WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); - adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; - if (adapter->tx_queue_idx == NR_TX_QUEUE) { + WARN_ON(priv->tx_queue_idx >= NR_TX_QUEUE); + priv->tx_queue_ps[priv->tx_queue_idx++] = skb; + if (priv->tx_queue_idx == NR_TX_QUEUE) { netif_stop_queue(priv->dev); if (priv->mesh_dev) netif_stop_queue(priv->mesh_dev); @@ -198,7 +196,7 @@ static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) netif_start_queue(priv->mesh_dev); } - spin_unlock(&adapter->txqueue_lock); + spin_unlock(&priv->txqueue_lock); } /** @@ -221,8 +219,8 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) goto done; } - if ((priv->adapter->psstate == PS_STATE_SLEEP) || - (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) { + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_tx_queue(priv, skb); return ret; } @@ -244,17 +242,16 @@ done: */ void lbs_send_tx_feedback(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; struct tx_radiotap_hdr *radiotap_hdr; - u32 status = adapter->eventcause; + u32 status = priv->eventcause; int txfail; int try_count; - if (adapter->monitormode == LBS_MONITOR_OFF || - adapter->currenttxskb == NULL) + if (priv->monitormode == LBS_MONITOR_OFF || + priv->currenttxskb == NULL) return; - radiotap_hdr = (struct tx_radiotap_hdr *)adapter->currenttxskb->data; + radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data; txfail = (status >> 24); @@ -267,14 +264,14 @@ void lbs_send_tx_feedback(struct lbs_private *priv) #endif try_count = (status >> 16) & 0xff; radiotap_hdr->data_retries = (try_count) ? - (1 + adapter->txretrycount - try_count) : 0; - lbs_upload_rx_packet(priv, adapter->currenttxskb); - adapter->currenttxskb = NULL; + (1 + priv->txretrycount - try_count) : 0; + lbs_upload_rx_packet(priv, priv->currenttxskb); + priv->currenttxskb = NULL; - if (adapter->connect_status == LBS_CONNECTED) + if (priv->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); - if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) + if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) netif_wake_queue(priv->mesh_dev); } EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 1af140bbbcb..1e0b2245db5 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -23,7 +23,7 @@ static inline void lbs_postpone_association_work(struct lbs_private *priv) { - if (priv->adapter->surpriseremoved) + if (priv->surpriseremoved) return; cancel_delayed_work(&priv->assoc_work); queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); @@ -32,21 +32,21 @@ static inline void lbs_postpone_association_work(struct lbs_private *priv) static inline void lbs_cancel_association_work(struct lbs_private *priv) { cancel_delayed_work(&priv->assoc_work); - kfree(priv->adapter->pending_assoc_req); - priv->adapter->pending_assoc_req = NULL; + kfree(priv->pending_assoc_req); + priv->pending_assoc_req = NULL; } /** * @brief Find the channel frequency power info with specific channel * - * @param adapter A pointer to struct lbs_adapter structure + * @param priv A pointer to struct lbs_private structure * @param band it can be BAND_A, BAND_G or BAND_B * @param channel the channel for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ struct chan_freq_power *lbs_find_cfp_by_band_and_channel( - struct lbs_adapter *adapter, + struct lbs_private *priv, u8 band, u16 channel) { @@ -54,11 +54,11 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel( struct region_channel *rc; int i, j; - for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { - rc = &adapter->region_channel[j]; + for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { + rc = &priv->region_channel[j]; - if (adapter->enable11d) - rc = &adapter->universal_channel[j]; + if (priv->enable11d) + rc = &priv->universal_channel[j]; if (!rc->valid || !rc->CFP) continue; if (rc->band != band) @@ -81,13 +81,13 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel( /** * @brief Find the channel frequency power info with specific frequency * - * @param adapter A pointer to struct lbs_adapter structure + * @param priv A pointer to struct lbs_private structure * @param band it can be BAND_A, BAND_G or BAND_B * @param freq the frequency for looking * @return A pointer to struct chan_freq_power structure or NULL if not find. */ static struct chan_freq_power *find_cfp_by_band_and_freq( - struct lbs_adapter *adapter, + struct lbs_private *priv, u8 band, u32 freq) { @@ -95,11 +95,11 @@ static struct chan_freq_power *find_cfp_by_band_and_freq( struct region_channel *rc; int i, j; - for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { - rc = &adapter->region_channel[j]; + for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { + rc = &priv->region_channel[j]; - if (adapter->enable11d) - rc = &adapter->universal_channel[j]; + if (priv->enable11d) + rc = &priv->universal_channel[j]; if (!rc->valid || !rc->CFP) continue; if (rc->band != band) @@ -130,13 +130,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq( static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) { int ret = 0; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->radioon != option) { + if (priv->radioon != option) { lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); - adapter->radioon = option; + priv->radioon = option; ret = lbs_prepare_and_send_command(priv, CMD_802_11_RADIO_CONTROL, @@ -151,18 +150,18 @@ static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) /** * @brief Copy active data rates based on adapter mode and status * - * @param adapter A pointer to struct lbs_adapter structure + * @param priv A pointer to struct lbs_private structure * @param rate The buf to return the active rates */ -static void copy_active_data_rates(struct lbs_adapter *adapter, u8 *rates) +static void copy_active_data_rates(struct lbs_private *priv, u8 *rates) { lbs_deb_enter(LBS_DEB_WEXT); - if ((adapter->connect_status != LBS_CONNECTED) && - (adapter->mesh_connect_status != LBS_CONNECTED)) + if ((priv->connect_status != LBS_CONNECTED) && + (priv->mesh_connect_status != LBS_CONNECTED)) memcpy(rates, lbs_bg_rates, MAX_RATES); else - memcpy(rates, adapter->curbssparams.rates, MAX_RATES); + memcpy(rates, priv->curbssparams.rates, MAX_RATES); lbs_deb_leave(LBS_DEB_WEXT); } @@ -184,18 +183,17 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; lbs_deb_enter(LBS_DEB_WEXT); - cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, - adapter->curbssparams.channel); + cfp = lbs_find_cfp_by_band_and_channel(priv, 0, + priv->curbssparams.channel); if (!cfp) { - if (adapter->curbssparams.channel) + if (priv->curbssparams.channel) lbs_deb_wext("invalid channel %d\n", - adapter->curbssparams.channel); + priv->curbssparams.channel); return -EINVAL; } @@ -211,12 +209,11 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status == LBS_CONNECTED) { - memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); + if (priv->connect_status == LBS_CONNECTED) { + memcpy(awrq->sa_data, priv->curbssparams.bssid, ETH_ALEN); } else { memset(awrq->sa_data, 0, ETH_ALEN); } @@ -230,7 +227,6 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -242,10 +238,10 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, return -E2BIG; } - mutex_lock(&adapter->lock); - memset(adapter->nodename, 0, sizeof(adapter->nodename)); - memcpy(adapter->nodename, extra, dwrq->length); - mutex_unlock(&adapter->lock); + mutex_lock(&priv->lock); + memset(priv->nodename, 0, sizeof(priv->nodename)); + memcpy(priv->nodename, extra, dwrq->length); + mutex_unlock(&priv->lock); lbs_deb_leave(LBS_DEB_WEXT); return 0; @@ -255,12 +251,11 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - dwrq->length = strlen(adapter->nodename); - memcpy(extra, adapter->nodename, dwrq->length); + dwrq->length = strlen(priv->nodename); + memcpy(extra, priv->nodename, dwrq->length); extra[dwrq->length] = '\0'; dwrq->flags = 1; /* active */ @@ -273,13 +268,12 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); /* Use nickname to indicate that mesh is on */ - if (adapter->mesh_connect_status == LBS_CONNECTED) { + if (priv->mesh_connect_status == LBS_CONNECTED) { strncpy(extra, "Mesh", 12); extra[12] = '\0'; dwrq->length = strlen(extra); @@ -299,17 +293,16 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; u32 rthr = vwrq->value; lbs_deb_enter(LBS_DEB_WEXT); if (vwrq->disabled) { - adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; + priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; } else { if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE) return -EINVAL; - adapter->rtsthsd = rthr; + priv->rtsthsd = rthr; } ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, @@ -325,18 +318,17 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - adapter->rtsthsd = 0; + priv->rtsthsd = 0; ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, OID_802_11_RTS_THRESHOLD, NULL); if (ret) goto out; - vwrq->value = adapter->rtsthsd; + vwrq->value = priv->rtsthsd; vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); vwrq->fixed = 1; @@ -352,17 +344,16 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, int ret = 0; u32 fthr = vwrq->value; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); if (vwrq->disabled) { - adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; + priv->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; } else { if (fthr < MRVDRV_FRAG_MIN_VALUE || fthr > MRVDRV_FRAG_MAX_VALUE) return -EINVAL; - adapter->fragthsd = fthr; + priv->fragthsd = fthr; } ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, @@ -378,11 +369,10 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - adapter->fragthsd = 0; + priv->fragthsd = 0; ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, @@ -390,7 +380,7 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, if (ret) goto out; - vwrq->value = adapter->fragthsd; + vwrq->value = priv->fragthsd; vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); vwrq->fixed = 1; @@ -404,11 +394,10 @@ static int lbs_get_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - *uwrq = adapter->mode; + *uwrq = priv->mode; lbs_deb_leave(LBS_DEB_WEXT); return 0; @@ -432,7 +421,6 @@ static int lbs_get_txpow(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -444,10 +432,10 @@ static int lbs_get_txpow(struct net_device *dev, if (ret) goto out; - lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel); - vwrq->value = adapter->txpowerlevel; + lbs_deb_wext("tx power level %d dbm\n", priv->txpowerlevel); + vwrq->value = priv->txpowerlevel; vwrq->fixed = 1; - if (adapter->radioon) { + if (priv->radioon) { vwrq->disabled = 0; vwrq->flags = IW_TXPOW_DBM; } else { @@ -464,7 +452,6 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -477,7 +464,7 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, return -EINVAL; /* Adding 1 to convert retry count to try count */ - adapter->txretrycount = vwrq->value + 1; + priv->txretrycount = vwrq->value + 1; ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_SET, @@ -499,12 +486,11 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; lbs_deb_enter(LBS_DEB_WEXT); - adapter->txretrycount = 0; + priv->txretrycount = 0; ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, CMD_ACT_GET, CMD_OPTION_WAITFORRSP, @@ -516,7 +502,7 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, if (!vwrq->flags) { vwrq->flags = IW_RETRY_LIMIT; /* Subtract 1 to convert try count to retry count */ - vwrq->value = adapter->txretrycount - 1; + vwrq->value = priv->txretrycount - 1; } out: @@ -568,7 +554,6 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, { int i, j; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct iw_range *range = (struct iw_range *)extra; struct chan_freq_power *cfp; u8 rates[MAX_RATES + 1]; @@ -584,7 +569,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, range->max_nwid = 0; memset(rates, 0, sizeof(rates)); - copy_active_data_rates(adapter, rates); + copy_active_data_rates(priv, rates); range->num_bitrates = strnlen(rates, IW_MAX_BITRATES); for (i = 0; i < range->num_bitrates; i++) range->bitrate[i] = rates[i] * 500000; @@ -593,14 +578,14 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, range->num_bitrates); range->num_frequency = 0; - if (priv->adapter->enable11d && - (adapter->connect_status == LBS_CONNECTED || - adapter->mesh_connect_status == LBS_CONNECTED)) { + if (priv->enable11d && + (priv->connect_status == LBS_CONNECTED || + priv->mesh_connect_status == LBS_CONNECTED)) { u8 chan_no; u8 band; struct parsed_region_chan_11d *parsed_region_chan = - &adapter->parsed_region_chan; + &priv->parsed_region_chan; if (parsed_region_chan == NULL) { lbs_deb_wext("11d: parsed_region_chan is NULL\n"); @@ -624,12 +609,12 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, } if (!flag) { for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && (j < ARRAY_SIZE(adapter->region_channel)); j++) { - cfp = adapter->region_channel[j].CFP; + && (j < ARRAY_SIZE(priv->region_channel)); j++) { + cfp = priv->region_channel[j].CFP; for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && adapter->region_channel[j].valid + && priv->region_channel[j].valid && cfp - && (i < adapter->region_channel[j].nrcfp); i++) { + && (i < priv->region_channel[j].nrcfp); i++) { range->freq[range->num_frequency].i = (long)cfp->channel; range->freq[range->num_frequency].m = @@ -729,7 +714,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); range->event_capa[1] = IW_EVENT_CAPA_K_1; - if (adapter->fwcapinfo & FW_CAPINFO_WPA) { + if (priv->fwcapinfo & FW_CAPINFO_WPA) { range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP @@ -745,7 +730,6 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -754,8 +738,8 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, */ if (vwrq->disabled) { - adapter->psmode = LBS802_11POWERMODECAM; - if (adapter->psstate != PS_STATE_FULL_POWER) { + priv->psmode = LBS802_11POWERMODECAM; + if (priv->psstate != PS_STATE_FULL_POWER) { lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); } @@ -771,13 +755,13 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, return -EINVAL; } - if (adapter->psmode != LBS802_11POWERMODECAM) { + if (priv->psmode != LBS802_11POWERMODECAM) { return 0; } - adapter->psmode = LBS802_11POWERMODEMAX_PSP; + priv->psmode = LBS802_11POWERMODEMAX_PSP; - if (adapter->connect_status == LBS_CONNECTED) { + if (priv->connect_status == LBS_CONNECTED) { lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); } @@ -789,15 +773,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int mode; lbs_deb_enter(LBS_DEB_WEXT); - mode = adapter->psmode; + mode = priv->psmode; if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM)) - || adapter->connect_status == LBS_DISCONNECTED) + || priv->connect_status == LBS_DISCONNECTED) { goto out; } @@ -820,7 +803,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) PERFECT = 100 }; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; u32 rssi_qual; u32 tx_qual; u32 quality = 0; @@ -830,23 +812,23 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) lbs_deb_enter(LBS_DEB_WEXT); - priv->wstats.status = adapter->mode; + priv->wstats.status = priv->mode; /* If we're not associated, all quality values are meaningless */ - if ((adapter->connect_status != LBS_CONNECTED) && - (adapter->mesh_connect_status != LBS_CONNECTED)) + if ((priv->connect_status != LBS_CONNECTED) && + (priv->mesh_connect_status != LBS_CONNECTED)) goto out; /* Quality by RSSI */ priv->wstats.qual.level = - CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], - adapter->NF[TYPE_BEACON][TYPE_NOAVG]); + CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], + priv->NF[TYPE_BEACON][TYPE_NOAVG]); - if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { + if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; } else { priv->wstats.qual.noise = - CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); + CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]); } lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); @@ -870,7 +852,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) /* Quality by TX errors */ priv->wstats.discard.retries = priv->stats.tx_errors; - tx_retries = le32_to_cpu(adapter->logmsg.retry); + tx_retries = le32_to_cpu(priv->logmsg.retry); if (tx_retries > 75) tx_qual = (90 - tx_retries) * POOR / 15; @@ -886,10 +868,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; quality = min(quality, tx_qual); - priv->wstats.discard.code = le32_to_cpu(adapter->logmsg.wepundecryptable); - priv->wstats.discard.fragment = le32_to_cpu(adapter->logmsg.rxfrag); + priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable); + priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag); priv->wstats.discard.retries = tx_retries; - priv->wstats.discard.misc = le32_to_cpu(adapter->logmsg.ackfailure); + priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure); /* Calculate quality */ priv->wstats.qual.qual = min_t(u8, quality, 100); @@ -924,14 +906,13 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, { int ret = -EINVAL; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct chan_freq_power *cfp; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -941,7 +922,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, if (fwrq->e == 1) { long f = fwrq->m / 100000; - cfp = find_cfp_by_band_and_freq(adapter, 0, f); + cfp = find_cfp_by_band_and_freq(priv, 0, f); if (!cfp) { lbs_deb_wext("invalid freq %ld\n", f); goto out; @@ -956,7 +937,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, goto out; } - cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); + cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m); if (!cfp) { goto out; } @@ -971,7 +952,7 @@ out: } else { lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -981,7 +962,6 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; u32 new_rate; u16 action; int ret = -EINVAL; @@ -993,14 +973,14 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, /* Auto rate? */ if (vwrq->value == -1) { action = CMD_ACT_SET_TX_AUTO; - adapter->auto_rate = 1; - adapter->cur_rate = 0; + priv->auto_rate = 1; + priv->cur_rate = 0; } else { if (vwrq->value % 100000) goto out; memset(rates, 0, sizeof(rates)); - copy_active_data_rates(adapter, rates); + copy_active_data_rates(priv, rates); new_rate = vwrq->value / 500000; if (!memchr(rates, new_rate, sizeof(rates))) { lbs_pr_alert("fixed data rate 0x%X out of range\n", @@ -1008,9 +988,9 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, goto out; } - adapter->cur_rate = new_rate; + priv->cur_rate = new_rate; action = CMD_ACT_SET_TX_FIX_RATE; - adapter->auto_rate = 0; + priv->auto_rate = 0; } ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, @@ -1025,14 +1005,13 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->connect_status == LBS_CONNECTED) { - vwrq->value = adapter->cur_rate * 500000; + if (priv->connect_status == LBS_CONNECTED) { + vwrq->value = priv->cur_rate * 500000; - if (adapter->auto_rate) + if (priv->auto_rate) vwrq->fixed = 0; else vwrq->fixed = 1; @@ -1051,7 +1030,6 @@ static int lbs_set_mode(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); @@ -1064,8 +1042,8 @@ static int lbs_set_mode(struct net_device *dev, goto out; } - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; lbs_cancel_association_work(priv); @@ -1075,7 +1053,7 @@ static int lbs_set_mode(struct net_device *dev, lbs_postpone_association_work(priv); lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); out: lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); @@ -1097,18 +1075,17 @@ static int lbs_get_encode(struct net_device *dev, struct iw_point *dwrq, u8 * extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; lbs_deb_enter(LBS_DEB_WEXT); lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", - dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); + dwrq->flags, index, dwrq->length, priv->wep_tx_keyidx); dwrq->flags = 0; /* Authentication method */ - switch (adapter->secinfo.auth_mode) { + switch (priv->secinfo.auth_mode) { case IW_AUTH_ALG_OPEN_SYSTEM: dwrq->flags = IW_ENCODE_OPEN; break; @@ -1124,22 +1101,22 @@ static int lbs_get_encode(struct net_device *dev, memset(extra, 0, 16); - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); /* Default to returning current transmit key */ if (index < 0) - index = adapter->wep_tx_keyidx; + index = priv->wep_tx_keyidx; - if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) { - memcpy(extra, adapter->wep_keys[index].key, - adapter->wep_keys[index].len); - dwrq->length = adapter->wep_keys[index].len; + if ((priv->wep_keys[index].len) && priv->secinfo.wep_enabled) { + memcpy(extra, priv->wep_keys[index].key, + priv->wep_keys[index].len); + dwrq->length = priv->wep_keys[index].len; dwrq->flags |= (index + 1); /* Return WEP enabled */ dwrq->flags &= ~IW_ENCODE_DISABLED; - } else if ((adapter->secinfo.WPAenabled) - || (adapter->secinfo.WPA2enabled)) { + } else if ((priv->secinfo.WPAenabled) + || (priv->secinfo.WPA2enabled)) { /* return WPA enabled */ dwrq->flags &= ~IW_ENCODE_DISABLED; dwrq->flags |= IW_ENCODE_NOKEY; @@ -1147,7 +1124,7 @@ static int lbs_get_encode(struct net_device *dev, dwrq->flags |= IW_ENCODE_DISABLED; } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n", extra[0], extra[1], extra[2], @@ -1293,14 +1270,13 @@ static int lbs_set_encode(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; u16 is_default = 0, index = 0, set_tx_key = 0; lbs_deb_enter(LBS_DEB_WEXT); - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1348,7 +1324,7 @@ out: } else { lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -1370,7 +1346,6 @@ static int lbs_get_encodeext(struct net_device *dev, { int ret = -EINVAL; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int index, max_key_len; @@ -1386,46 +1361,46 @@ static int lbs_get_encodeext(struct net_device *dev, goto out; index--; } else { - index = adapter->wep_tx_keyidx; + index = priv->wep_tx_keyidx; } if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && ext->alg != IW_ENCODE_ALG_WEP) { - if (index != 0 || adapter->mode != IW_MODE_INFRA) + if (index != 0 || priv->mode != IW_MODE_INFRA) goto out; } dwrq->flags = index + 1; memset(ext, 0, sizeof(*ext)); - if ( !adapter->secinfo.wep_enabled - && !adapter->secinfo.WPAenabled - && !adapter->secinfo.WPA2enabled) { + if ( !priv->secinfo.wep_enabled + && !priv->secinfo.WPAenabled + && !priv->secinfo.WPA2enabled) { ext->alg = IW_ENCODE_ALG_NONE; ext->key_len = 0; dwrq->flags |= IW_ENCODE_DISABLED; } else { u8 *key = NULL; - if ( adapter->secinfo.wep_enabled - && !adapter->secinfo.WPAenabled - && !adapter->secinfo.WPA2enabled) { + if ( priv->secinfo.wep_enabled + && !priv->secinfo.WPAenabled + && !priv->secinfo.WPA2enabled) { /* WEP */ ext->alg = IW_ENCODE_ALG_WEP; - ext->key_len = adapter->wep_keys[index].len; - key = &adapter->wep_keys[index].key[0]; - } else if ( !adapter->secinfo.wep_enabled - && (adapter->secinfo.WPAenabled || - adapter->secinfo.WPA2enabled)) { + ext->key_len = priv->wep_keys[index].len; + key = &priv->wep_keys[index].key[0]; + } else if ( !priv->secinfo.wep_enabled + && (priv->secinfo.WPAenabled || + priv->secinfo.WPA2enabled)) { /* WPA */ struct enc_key * pkey = NULL; - if ( adapter->wpa_mcast_key.len - && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &adapter->wpa_mcast_key; - else if ( adapter->wpa_unicast_key.len - && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &adapter->wpa_unicast_key; + if ( priv->wpa_mcast_key.len + && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) + pkey = &priv->wpa_mcast_key; + else if ( priv->wpa_unicast_key.len + && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) + pkey = &priv->wpa_unicast_key; if (pkey) { if (pkey->type == KEY_TYPE_ID_AES) { @@ -1477,15 +1452,14 @@ static int lbs_set_encodeext(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int alg = ext->alg; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1589,7 +1563,7 @@ out: } else { lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -1602,14 +1576,13 @@ static int lbs_set_genie(struct net_device *dev, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; struct assoc_request * assoc_req; lbs_deb_enter(LBS_DEB_WEXT); - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1625,7 +1598,7 @@ static int lbs_set_genie(struct net_device *dev, memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length); assoc_req->wpa_ie_len = dwrq->length; } else { - memset(&assoc_req->wpa_ie[0], 0, sizeof(adapter->wpa_ie)); + memset(&assoc_req->wpa_ie[0], 0, sizeof(priv->wpa_ie)); assoc_req->wpa_ie_len = 0; } @@ -1636,7 +1609,7 @@ out: } else { lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -1649,22 +1622,21 @@ static int lbs_get_genie(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); - if (adapter->wpa_ie_len == 0) { + if (priv->wpa_ie_len == 0) { dwrq->length = 0; goto out; } - if (dwrq->length < adapter->wpa_ie_len) { + if (dwrq->length < priv->wpa_ie_len) { ret = -E2BIG; goto out; } - dwrq->length = adapter->wpa_ie_len; - memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); + dwrq->length = priv->wpa_ie_len; + memcpy(extra, &priv->wpa_ie[0], priv->wpa_ie_len); out: lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); @@ -1678,15 +1650,14 @@ static int lbs_set_auth(struct net_device *dev, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; int updated = 0; lbs_deb_enter(LBS_DEB_WEXT); - mutex_lock(&adapter->lock); - assoc_req = lbs_get_association_request(adapter); + mutex_lock(&priv->lock); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; goto out; @@ -1765,7 +1736,7 @@ out: } else if (ret != -EOPNOTSUPP) { lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -1778,27 +1749,26 @@ static int lbs_get_auth(struct net_device *dev, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); switch (dwrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: dwrq->value = 0; - if (adapter->secinfo.WPAenabled) + if (priv->secinfo.WPAenabled) dwrq->value |= IW_AUTH_WPA_VERSION_WPA; - if (adapter->secinfo.WPA2enabled) + if (priv->secinfo.WPA2enabled) dwrq->value |= IW_AUTH_WPA_VERSION_WPA2; if (!dwrq->value) dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; break; case IW_AUTH_80211_AUTH_ALG: - dwrq->value = adapter->secinfo.auth_mode; + dwrq->value = priv->secinfo.auth_mode; break; case IW_AUTH_WPA_ENABLED: - if (adapter->secinfo.WPAenabled && adapter->secinfo.WPA2enabled) + if (priv->secinfo.WPAenabled && priv->secinfo.WPA2enabled) dwrq->value = 1; break; @@ -1816,7 +1786,6 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, { int ret = 0; struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; u16 dbm; @@ -1827,7 +1796,7 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, return 0; } - adapter->preamble = CMD_TYPE_AUTO_PREAMBLE; + priv->preamble = CMD_TYPE_AUTO_PREAMBLE; lbs_radio_ioctl(priv, RADIO_ON); @@ -1858,7 +1827,6 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; lbs_deb_enter(LBS_DEB_WEXT); @@ -1870,19 +1838,19 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, /* * Get the current SSID */ - if (adapter->connect_status == LBS_CONNECTED) { - memcpy(extra, adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len); - extra[adapter->curbssparams.ssid_len] = '\0'; + if (priv->connect_status == LBS_CONNECTED) { + memcpy(extra, priv->curbssparams.ssid, + priv->curbssparams.ssid_len); + extra[priv->curbssparams.ssid_len] = '\0'; } else { memset(extra, 0, 32); - extra[adapter->curbssparams.ssid_len] = '\0'; + extra[priv->curbssparams.ssid_len] = '\0'; } /* * If none, we may want to get the one that was set */ - dwrq->length = adapter->curbssparams.ssid_len; + dwrq->length = priv->curbssparams.ssid_len; dwrq->flags = 1; /* active */ @@ -1894,7 +1862,6 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; int ret = 0; u8 ssid[IW_ESSID_MAX_SIZE]; u8 ssid_len = 0; @@ -1927,10 +1894,10 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, } out: - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); if (ret == 0) { /* Get or create the current association request */ - assoc_req = lbs_get_association_request(adapter); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { ret = -ENOMEM; } else { @@ -1947,7 +1914,7 @@ out: lbs_cancel_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; @@ -1966,7 +1933,6 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { struct lbs_private *priv = dev->priv; - struct lbs_adapter *adapter = priv->adapter; struct assoc_request * assoc_req; int ret = 0; DECLARE_MAC_BUF(mac); @@ -1978,10 +1944,10 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac, awrq->sa_data)); - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); /* Get or create the current association request */ - assoc_req = lbs_get_association_request(adapter); + assoc_req = lbs_get_association_request(priv); if (!assoc_req) { lbs_cancel_association_work(priv); ret = -ENOMEM; @@ -1992,30 +1958,30 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, lbs_postpone_association_work(priv); } - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); return ret; } -void lbs_get_fwversion(struct lbs_adapter *adapter, char *fwversion, int maxlen) +void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen) { char fwver[32]; - mutex_lock(&adapter->lock); + mutex_lock(&priv->lock); - if (adapter->fwreleasenumber[3] == 0) + if (priv->fwreleasenumber[3] == 0) sprintf(fwver, "%u.%u.%u", - adapter->fwreleasenumber[2], - adapter->fwreleasenumber[1], - adapter->fwreleasenumber[0]); + priv->fwreleasenumber[2], + priv->fwreleasenumber[1], + priv->fwreleasenumber[0]); else sprintf(fwver, "%u.%u.%u.p%u", - adapter->fwreleasenumber[2], - adapter->fwreleasenumber[1], - adapter->fwreleasenumber[0], - adapter->fwreleasenumber[3]); + priv->fwreleasenumber[2], + priv->fwreleasenumber[1], + priv->fwreleasenumber[0], + priv->fwreleasenumber[3]); - mutex_unlock(&adapter->lock); + mutex_unlock(&priv->lock); snprintf(fwversion, maxlen, fwver); } -- cgit v1.2.3 From a63b22bb5bb58d7a1d1b38aeac9a55c51565131c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 20:56:44 +0000 Subject: libertas: use lbs_host_to_card_done() in lbs_tx_timeout() Also attempt some locking in lbs_host_to_card_done() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 40 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 243cdea419c..2ff5f1b77b1 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -601,31 +601,24 @@ static void lbs_tx_timeout(struct net_device *dev) lbs_pr_err("tx watch dog timeout\n"); - priv->dnld_sent = DNLD_RES_RECEIVED; dev->trans_start = jiffies; if (priv->currenttxskb) { - if (priv->monitormode != LBS_MONITOR_OFF) { - /* If we are here, we have not received feedback from - the previous packet. Assume TX_FAIL and move on. */ - priv->eventcause = 0x01000000; - lbs_send_tx_feedback(priv); - } else - wake_up_interruptible(&priv->waitq); - } else if (dev == priv->dev) { - if (priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - - } else if (dev == priv->mesh_dev) { - if (priv->mesh_connect_status == LBS_CONNECTED) - netif_wake_queue(priv->mesh_dev); + priv->eventcause = 0x01000000; + lbs_send_tx_feedback(priv); } + /* XX: Shouldn't we also call into the hw-specific driver + to kick it somehow? */ + lbs_host_to_card_done(priv); lbs_deb_leave(LBS_DEB_TX); } void lbs_host_to_card_done(struct lbs_private *priv) { + unsigned long flags; + + spin_lock_irqsave(&priv->driver_lock, flags); priv->dnld_sent = DNLD_RES_RECEIVED; @@ -634,15 +627,16 @@ void lbs_host_to_card_done(struct lbs_private *priv) wake_up_interruptible(&priv->waitq); /* Don't wake netif queues if we're in monitor mode and - a TX packet is already pending. */ - if (priv->currenttxskb) - return; - - if (priv->dev && priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); + a TX packet is already pending, or if there are commands + queued to be sent. */ + if (!priv->currenttxskb && list_empty(&priv->cmdpendingq)) { + if (priv->dev && priv->connect_status == LBS_CONNECTED) + netif_wake_queue(priv->dev); - if (priv->mesh_dev && priv->mesh_connect_status == LBS_CONNECTED) - netif_wake_queue(priv->mesh_dev); + if (priv->mesh_dev && priv->mesh_connect_status == LBS_CONNECTED) + netif_wake_queue(priv->mesh_dev); + } + spin_unlock_irqrestore(&priv->driver_lock, flags); } EXPORT_SYMBOL_GPL(lbs_host_to_card_done); -- cgit v1.2.3 From 6d35fdfced3922aa27f130eec2b28857c39298fd Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 23:49:06 +0000 Subject: libertas: cope with device which already has firmware loaded Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 35 +++++++++++++++++++++------------- drivers/net/wireless/libertas/if_usb.h | 2 +- 2 files changed, 23 insertions(+), 14 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 87bed4a1718..141d185ac01 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -374,20 +374,23 @@ static int if_prog_firmware(struct usb_card_rec *cardp) static int if_usb_reset_device(struct usb_card_rec *cardp) { + struct cmd_ds_command *cmd = (void *)&cardp->bulk_out_buffer[4]; int ret; - struct lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); - /* Try a USB port reset first, if that fails send the reset - * command to the firmware. - */ + *(__le32 *)cardp->bulk_out_buffer = cpu_to_le32(CMD_TYPE_REQUEST); + + cmd->command = cpu_to_le16(CMD_802_11_RESET); + cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); + cmd->result = cpu_to_le16(0); + cmd->seqnum = cpu_to_le16(0x5a5a); + cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT); + usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); + + msleep(10); ret = usb_reset_device(cardp->udev); - if (!ret && priv) { - msleep(10); - ret = lbs_reset_device(priv); - msleep(10); - } + msleep(10); lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); @@ -508,9 +511,15 @@ static void if_usb_receive_fwload(struct urb *urb) return; } if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { - lbs_pr_info( - "boot cmd response wrong magic number (0x%x)\n", - le32_to_cpu(bootcmdresp.u32magicnumber)); + if (bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_REQUEST) || + bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_DATA) || + bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_INDICATION)) { + lbs_pr_info("Firmware already seems alive; resetting\n"); + cardp->bootcmdresp = -1; + } else { + lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", + le32_to_cpu(bootcmdresp.u32magicnumber)); + } } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { lbs_pr_info( "boot cmd response cmd_tag error (%d)\n", @@ -883,7 +892,7 @@ restart: } while (cardp->bootcmdresp == 0 && j < 10); } while (cardp->bootcmdresp == 0 && i < 5); - if (cardp->bootcmdresp == 0) { + if (cardp->bootcmdresp <= 0) { if (--reset_count >= 0) { if_usb_reset_device(cardp); goto restart; diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index f53ddb25158..940a369f1fe 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -70,7 +70,7 @@ struct usb_card_rec { u8 rx_urb_recall; - u8 bootcmdresp; + s8 bootcmdresp; }; /** fwheader */ -- cgit v1.2.3 From 020bb19e2f8cfebb314b8bce4bc48a511c6f5940 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 11:08:25 -0500 Subject: libertas: stop debugfs code looking at cmdpendingq It doesn't need to wait until no commands are pending anyway -- it only needs to wait until the scan is finished. We can hopefully find it something else to wait on too -- it's the only user of the cmd_pending waitqueue. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index fe422b28a4f..745191a6896 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -321,8 +321,7 @@ static ssize_t lbs_setuserscan(struct file *file, lbs_scan_networks(priv, scan_cfg, 1); wait_event_interruptible(priv->cmd_pending, - priv->surpriseremoved || - (!priv->cur_cmd && list_empty(&priv->cmdpendingq))); + priv->surpriseremoved || !priv->last_scanned_channel); if (priv->surpriseremoved) goto out_scan_cfg; -- cgit v1.2.3 From 2abdc0b7756ece70b1f0fd65a651bf8ce487a223 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 12:37:27 -0500 Subject: libertas: kill internal tx queue for PS mode It was buggy as hell anyway, since it was just spewing packets at the device when it wasn't necessarily ready for them (in the USB case, while the URB was still busy). We could probably do with a better way of flushing packets to the device _immediately_, before we stick it back into sleep mode. But we can no longer just dequeue packets directly, it seems. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/decl.h | 2 -- drivers/net/wireless/libertas/dev.h | 5 ----- drivers/net/wireless/libertas/main.c | 6 ------ drivers/net/wireless/libertas/tx.c | 40 +++--------------------------------- 4 files changed, 3 insertions(+), 50 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index e255b191574..b0945140ba1 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -62,8 +62,6 @@ void lbs_ps_sleep(struct lbs_private *priv, int wait_option); void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode); void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); -void lbs_tx_runqueue(struct lbs_private *priv); - struct chan_freq_power *lbs_find_cfp_by_band_and_channel( struct lbs_private *priv, u8 band, diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 21b0d382096..a9c3adc421b 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -197,11 +197,6 @@ struct lbs_private { /** Timers */ struct timer_list command_timer; - /* TX queue used in PS mode */ - spinlock_t txqueue_lock; - struct sk_buff *tx_queue_ps[NR_TX_QUEUE]; - unsigned int tx_queue_idx; - u8 hisregcpy; /** current ssid/bssid related parameters*/ diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2ff5f1b77b1..c6389951824 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -914,8 +914,6 @@ static int lbs_thread(void *data) */ if (!list_empty(&priv->cmdpendingq)) wake_up_all(&priv->cmd_pending); - - lbs_tx_runqueue(priv); } del_timer(&priv->command_timer); @@ -1072,10 +1070,6 @@ static int lbs_init_adapter(struct lbs_private *priv) mutex_init(&priv->lock); - memset(&priv->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*)); - priv->tx_queue_idx = 0; - spin_lock_init(&priv->txqueue_lock); - setup_timer(&priv->command_timer, command_timer_fn, (unsigned long)priv); diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 4cb39d33003..749535e3f77 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -164,41 +164,6 @@ done: } -void lbs_tx_runqueue(struct lbs_private *priv) -{ - int i; - - spin_lock(&priv->txqueue_lock); - for (i = 0; i < priv->tx_queue_idx; i++) { - struct sk_buff *skb = priv->tx_queue_ps[i]; - spin_unlock(&priv->txqueue_lock); - SendSinglePacket(priv, skb); - spin_lock(&priv->txqueue_lock); - } - priv->tx_queue_idx = 0; - spin_unlock(&priv->txqueue_lock); -} - -static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) -{ - - spin_lock(&priv->txqueue_lock); - - WARN_ON(priv->tx_queue_idx >= NR_TX_QUEUE); - priv->tx_queue_ps[priv->tx_queue_idx++] = skb; - if (priv->tx_queue_idx == NR_TX_QUEUE) { - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); - } else { - netif_start_queue(priv->dev); - if (priv->mesh_dev) - netif_start_queue(priv->mesh_dev); - } - - spin_unlock(&priv->txqueue_lock); -} - /** * @brief This function checks the conditions and sends packet to IF * layer if everything is ok. @@ -221,8 +186,9 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) if ((priv->psstate == PS_STATE_SLEEP) || (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_tx_queue(priv, skb); - return ret; + lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", + priv->psstate == PS_STATE_SLEEP?"":"pre-"); + goto done; } ret = SendSinglePacket(priv, skb); -- cgit v1.2.3 From 6b4a7e0fbd772495572e038d296853a741e0454b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 12:48:10 -0500 Subject: libertas: kill SendSinglePacket() function. Make a start on reducing the number of pointless nested functions, starting with the StudlyCaps. No semantic changes (yet) -- we can sort out the now-obvious discrepancy in the failure paths in a separate commit. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 66 ++++++++++++++------------------------ 1 file changed, 24 insertions(+), 42 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 749535e3f77..10596f3bb59 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -49,16 +49,16 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) } /** - * @brief This function processes a single packet and sends - * to IF layer + * @brief This function checks the conditions and sends packet to IF + * layer if everything is ok. * * @param priv A pointer to struct lbs_private structure * @param skb A pointer to skb which includes TX packet * @return 0 or -1 */ -static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) +int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) { - int ret = 0; + int ret = -1; struct txpd localtxpd; struct txpd *plocaltxpd = &localtxpd; u8 *p802x_hdr; @@ -68,16 +68,31 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_enter(LBS_DEB_TX); + lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); + + if (priv->dnld_sent) { + lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", + priv->dnld_sent); + goto done; + } + + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) { + lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", + priv->psstate == PS_STATE_SLEEP?"":"pre-"); + goto done; + } + if (priv->surpriseremoved) return -1; if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); - ret = -1; - goto done; + goto done_tx; } + ret = 0; memset(plocaltxpd, 0, sizeof(struct txpd)); plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); @@ -130,12 +145,12 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) if (ret) { lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); - goto done; + goto done_tx; } - lbs_deb_tx("SendSinglePacket succeeds\n"); + lbs_deb_tx("%s succeeds\n", __func__); -done: +done_tx: if (!ret) { priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len; @@ -159,39 +174,6 @@ done: dev_kfree_skb_any(skb); } - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - - -/** - * @brief This function checks the conditions and sends packet to IF - * layer if everything is ok. - * - * @param priv A pointer to struct lbs_private structure - * @return n/a - */ -int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) -{ - int ret = -1; - - lbs_deb_enter(LBS_DEB_TX); - lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - - if (priv->dnld_sent) { - lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", - priv->dnld_sent); - goto done; - } - - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", - priv->psstate == PS_STATE_SLEEP?"":"pre-"); - goto done; - } - - ret = SendSinglePacket(priv, skb); done: lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); return ret; -- cgit v1.2.3 From a9bdce6564b25268af7315d3dd17f4f5b6435a45 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 12:52:19 -0500 Subject: libertas: move lbs_hard_start_xmit() into tx.c ... where it can shortly be merged with lbs_process_tx()... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/decl.h | 2 +- drivers/net/wireless/libertas/main.c | 32 -------------------------------- drivers/net/wireless/libertas/tx.c | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 34 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index b0945140ba1..fcb5a851290 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -50,10 +50,10 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb); /** The proc fs interface */ int lbs_process_rx_command(struct lbs_private *priv); -int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb); void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, struct cmd_ctrl_node *ptempcmd); +int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index c6389951824..d311d5773f0 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -515,38 +515,6 @@ static int lbs_close(struct net_device *dev) return 0; } - -static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - int ret = 0; - struct lbs_private *priv = dev->priv; - - lbs_deb_enter(LBS_DEB_TX); - - /* We could return NETDEV_TX_BUSY here, but I'd actually - like to get the point where we can BUG() */ - if (priv->dnld_sent) { - lbs_pr_err("%s while dnld_sent\n", __func__); - priv->stats.tx_dropped++; - goto done; - } - if (priv->currenttxskb) { - lbs_pr_err("%s while TX skb pending\n", __func__); - priv->stats.tx_dropped++; - goto done; - } - - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); - - if (lbs_process_tx(priv, skb) == 0) - dev->trans_start = jiffies; -done: - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - /** * @brief Mark mesh packets and handover them to lbs_hard_start_xmit * diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 10596f3bb59..336544cdeca 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -56,7 +56,7 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) * @param skb A pointer to skb which includes TX packet * @return 0 or -1 */ -int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) +static int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) { int ret = -1; struct txpd localtxpd; @@ -179,6 +179,37 @@ done: return ret; } +int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) +{ + int ret = 0; + struct lbs_private *priv = dev->priv; + + lbs_deb_enter(LBS_DEB_TX); + + /* We could return NETDEV_TX_BUSY here, but I'd actually + like to get the point where we can BUG() */ + if (priv->dnld_sent) { + lbs_pr_err("%s while dnld_sent\n", __func__); + priv->stats.tx_dropped++; + goto done; + } + if (priv->currenttxskb) { + lbs_pr_err("%s while TX skb pending\n", __func__); + priv->stats.tx_dropped++; + goto done; + } + + netif_stop_queue(priv->dev); + if (priv->mesh_dev) + netif_stop_queue(priv->mesh_dev); + + if (lbs_process_tx(priv, skb) == 0) + dev->trans_start = jiffies; +done: + lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); + return ret; +} + /** * @brief This function sends to the host the last transmitted packet, * filling the radiotap headers with transmission information. -- cgit v1.2.3 From 8af23b2f96dc3dabbc791c75f7c98a7b0d287177 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 12:57:14 -0500 Subject: libertas: kill lbs_process_tx() by merging it into lbs_hard_start_xmit() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 45 +++++++++++--------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 336544cdeca..7bc21243825 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -56,8 +56,9 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) * @param skb A pointer to skb which includes TX packet * @return 0 or -1 */ -static int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) +int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { + struct lbs_private *priv = dev->priv; int ret = -1; struct txpd localtxpd; struct txpd *plocaltxpd = &localtxpd; @@ -70,12 +71,21 @@ static int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); + netif_stop_queue(priv->dev); + if (priv->mesh_dev) + netif_stop_queue(priv->mesh_dev); + if (priv->dnld_sent) { lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", priv->dnld_sent); goto done; } + if (priv->currenttxskb) { + lbs_pr_err("%s while TX skb pending\n", __func__); + goto done; + } + if ((priv->psstate == PS_STATE_SLEEP) || (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", @@ -154,6 +164,8 @@ done_tx: if (!ret) { priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len; + + dev->trans_start = jiffies; } else { priv->stats.tx_dropped++; priv->stats.tx_errors++; @@ -179,37 +191,6 @@ done: return ret; } -int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - int ret = 0; - struct lbs_private *priv = dev->priv; - - lbs_deb_enter(LBS_DEB_TX); - - /* We could return NETDEV_TX_BUSY here, but I'd actually - like to get the point where we can BUG() */ - if (priv->dnld_sent) { - lbs_pr_err("%s while dnld_sent\n", __func__); - priv->stats.tx_dropped++; - goto done; - } - if (priv->currenttxskb) { - lbs_pr_err("%s while TX skb pending\n", __func__); - priv->stats.tx_dropped++; - goto done; - } - - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); - - if (lbs_process_tx(priv, skb) == 0) - dev->trans_start = jiffies; -done: - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - /** * @brief This function sends to the host the last transmitted packet, * filling the radiotap headers with transmission information. -- cgit v1.2.3 From a2b62dc1f17db16034cd4eee0f14e6e56065547c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 14:37:59 -0500 Subject: libertas: clean up lbs_hard_start_xmit() Having merged the nest of functions into one, now we can clean it up and fix the error handling, and the duplication -- and at least make a start on the locking. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 133 ++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 70 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 7bc21243825..aefe52419ba 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -58,22 +58,16 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) */ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { + unsigned long flags; struct lbs_private *priv = dev->priv; - int ret = -1; - struct txpd localtxpd; - struct txpd *plocaltxpd = &localtxpd; - u8 *p802x_hdr; - struct tx_radiotap_hdr *pradiotap_hdr; - u32 new_rate; - u8 *ptr = priv->tmptxbuf; + struct txpd *txpd; + char *p802x_hdr; + uint16_t pkt_len; + int ret; lbs_deb_enter(LBS_DEB_TX); - lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); + ret = NETDEV_TX_BUSY; if (priv->dnld_sent) { lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", @@ -94,98 +88,97 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) } if (priv->surpriseremoved) - return -1; + goto drop; if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); - goto done_tx; + /* We'll never manage to send this one; drop it and return 'OK' */ + goto drop; } - ret = 0; - memset(plocaltxpd, 0, sizeof(struct txpd)); - - plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); + lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - /* offset of actual data */ - plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); + txpd = (void *)priv->tmptxbuf; + memset(txpd, 0, sizeof(struct txpd)); p802x_hdr = skb->data; - if (priv->monitormode != LBS_MONITOR_OFF) { + pkt_len = skb->len; - /* locate radiotap header */ - pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data; + if (priv->monitormode != LBS_MONITOR_OFF) { + struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; /* set txpd fields from the radiotap header */ - new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); - if (new_rate != 0) { - /* use new tx_control[4:0] */ - plocaltxpd->tx_control = cpu_to_le32(new_rate); - } + txpd->tx_control = cpu_to_le32(convert_radiotap_rate_to_mv(rtap_hdr->rate)); /* skip the radiotap header */ - p802x_hdr += sizeof(struct tx_radiotap_hdr); - plocaltxpd->tx_packet_length = - cpu_to_le16(le16_to_cpu(plocaltxpd->tx_packet_length) - - sizeof(struct tx_radiotap_hdr)); + p802x_hdr += sizeof(*rtap_hdr); + pkt_len -= sizeof(*rtap_hdr); + /* copy destination address from 802.11 header */ + memcpy(txpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); + } else { + /* copy destination address from 802.3 header */ + memcpy(txpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); } - /* copy destination address from 802.3 or 802.11 header */ - if (priv->monitormode != LBS_MONITOR_OFF) - memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); - else - memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); - lbs_deb_hex(LBS_DEB_TX, "txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); + txpd->tx_packet_length = cpu_to_le16(pkt_len); + txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); - if (IS_MESH_FRAME(skb)) { - plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); - } + if (dev == priv->mesh_dev) + txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); - memcpy(ptr, plocaltxpd, sizeof(struct txpd)); + lbs_deb_hex(LBS_DEB_TX, "txpd", (u8 *) &txpd, sizeof(struct txpd)); - ptr += sizeof(struct txpd); + lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); - memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); - ret = priv->hw_host_to_card(priv, MVMS_DAT, - priv->tmptxbuf, - le16_to_cpu(plocaltxpd->tx_packet_length) + - sizeof(struct txpd)); + memcpy(&txpd[1], p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - if (ret) { - lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); - goto done_tx; - } + /* We need to protect against the queues being restarted before + we get round to stopping them */ + spin_lock_irqsave(&priv->driver_lock, flags); - lbs_deb_tx("%s succeeds\n", __func__); + ret = priv->hw_host_to_card(priv, MVMS_DAT, priv->tmptxbuf, + pkt_len + sizeof(struct txpd)); -done_tx: if (!ret) { + lbs_deb_tx("%s succeeds\n", __func__); + + /* Stop processing outgoing pkts before submitting */ + netif_stop_queue(priv->dev); + if (priv->mesh_dev) + netif_stop_queue(priv->mesh_dev); + priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len; - dev->trans_start = jiffies; - } else { - priv->stats.tx_dropped++; - priv->stats.tx_errors++; + dev->trans_start = jiffies; + + if (priv->monitormode != LBS_MONITOR_OFF) { + /* Keep the skb to echo it back once Tx feedback is + received from FW */ + skb_orphan(skb); + + /* Keep the skb around for when we get feedback */ + priv->currenttxskb = skb; + } } + + spin_unlock_irqrestore(&priv->driver_lock, flags); - if (!ret && priv->monitormode != LBS_MONITOR_OFF) { - /* Keep the skb to echo it back once Tx feedback is - received from FW */ - skb_orphan(skb); - /* stop processing outgoing pkts */ - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); + if (ret) { + lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); +drop: + priv->stats.tx_dropped++; + priv->stats.tx_errors++; - /* Keep the skb around for when we get feedback */ - priv->currenttxskb = skb; - } else { dev_kfree_skb_any(skb); } + /* Even if we dropped the packet, return OK. Otherwise the + packet gets requeued. */ + ret = NETDEV_TX_OK; + done: lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); return ret; -- cgit v1.2.3 From 198cefb9320ea0aa1be43a93b398435447583081 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 15:04:19 -0500 Subject: libertas: kill lbs_pre_start_xmit(), lib_mesh_pre_start_xmit() These wrappers only do two things. Firstly, they set the frame type, which isn't necessary since lbs_hard_start_xmit() gets to see which device it belongs to anyway. Secondly, they return -EOPNOTSUPP if the device is in monitor mode. Which is a strange thing to do and will provide nasty warnings from qdisc_restart(). And lbs_hard_start_xmit() seems to have code to cope with monitor mode anyway. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 50 ++---------------------------------- 1 file changed, 2 insertions(+), 48 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index d311d5773f0..5c8cb0079d4 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -515,52 +515,6 @@ static int lbs_close(struct net_device *dev) return 0; } -/** - * @brief Mark mesh packets and handover them to lbs_hard_start_xmit - * - */ -static int lbs_mesh_pre_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct lbs_private *priv = dev->priv; - int ret; - - lbs_deb_enter(LBS_DEB_MESH); - if (priv->monitormode != LBS_MONITOR_OFF) { - netif_stop_queue(dev); - return -EOPNOTSUPP; - } - - SET_MESH_FRAME(skb); - - ret = lbs_hard_start_xmit(skb, priv->mesh_dev); - lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); - return ret; -} - -/** - * @brief Mark non-mesh packets and handover them to lbs_hard_start_xmit - * - */ -static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct lbs_private *priv = dev->priv; - int ret; - - lbs_deb_enter(LBS_DEB_TX); - - if (priv->monitormode != LBS_MONITOR_OFF) { - netif_stop_queue(dev); - return -EOPNOTSUPP; - } - - UNSET_MESH_FRAME(skb); - - ret = lbs_hard_start_xmit(skb, dev); - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - static void lbs_tx_timeout(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; @@ -1104,7 +1058,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) /* Setup the OS Interface to our functions */ dev->open = lbs_open; - dev->hard_start_xmit = lbs_pre_start_xmit; + dev->hard_start_xmit = lbs_hard_start_xmit; dev->stop = lbs_close; dev->set_mac_address = lbs_set_mac_address; dev->tx_timeout = lbs_tx_timeout; @@ -1276,7 +1230,7 @@ int lbs_add_mesh(struct lbs_private *priv, struct device *dev) priv->mesh_dev = mesh_dev; mesh_dev->open = lbs_mesh_open; - mesh_dev->hard_start_xmit = lbs_mesh_pre_start_xmit; + mesh_dev->hard_start_xmit = lbs_hard_start_xmit; mesh_dev->stop = lbs_mesh_close; mesh_dev->get_stats = lbs_get_stats; mesh_dev->set_mac_address = lbs_set_mac_address; -- cgit v1.2.3 From d9268fb9a124d067cf93710a85bb6c158d131c97 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 16:22:21 -0500 Subject: libertas: stop using ieee80211 for radiotap device There seems to be no point in doing it as an ieee80211 device instead of a normal netdev, and when we override its ->priv and then call free_ieee80211() it has a distressing tendency to crash horribly. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 2 -- drivers/net/wireless/libertas/main.c | 36 +++++++++++++++--------------------- 2 files changed, 15 insertions(+), 23 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index a9c3adc421b..04cf33da589 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -10,7 +10,6 @@ #include #include #include -#include #include "defs.h" #include "scan.h" @@ -114,7 +113,6 @@ struct lbs_private { struct net_device_stats stats; struct net_device *mesh_dev; /* Virtual device */ struct net_device *rtap_net_dev; - struct ieee80211_device *ieee; struct iw_statistics wstats; struct lbs_mesh_stats mstats; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 5c8cb0079d4..55dce8dbd0d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1448,7 +1448,7 @@ static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) { struct lbs_private *priv = dev->priv; - return &priv->ieee->stats; + return &priv->stats; } @@ -1457,42 +1457,36 @@ void lbs_remove_rtap(struct lbs_private *priv) if (priv->rtap_net_dev == NULL) return; unregister_netdev(priv->rtap_net_dev); - free_ieee80211(priv->rtap_net_dev); + free_netdev(priv->rtap_net_dev); priv->rtap_net_dev = NULL; } int lbs_add_rtap(struct lbs_private *priv) { int rc = 0; + struct net_device *rtap_dev; if (priv->rtap_net_dev) return -EPERM; - priv->rtap_net_dev = alloc_ieee80211(0); - if (priv->rtap_net_dev == NULL) + rtap_dev = alloc_netdev(0, "rtap%d", ether_setup); + if (rtap_dev == NULL) return -ENOMEM; + rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; + rtap_dev->open = lbs_rtap_open; + rtap_dev->stop = lbs_rtap_stop; + rtap_dev->get_stats = lbs_rtap_get_stats; + rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; + rtap_dev->set_multicast_list = lbs_set_multicast_list; + rtap_dev->priv = priv; - priv->ieee = netdev_priv(priv->rtap_net_dev); - - strcpy(priv->rtap_net_dev->name, "rtap%d"); - - priv->rtap_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; - priv->rtap_net_dev->open = lbs_rtap_open; - priv->rtap_net_dev->stop = lbs_rtap_stop; - priv->rtap_net_dev->get_stats = lbs_rtap_get_stats; - priv->rtap_net_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; - priv->rtap_net_dev->set_multicast_list = lbs_set_multicast_list; - priv->rtap_net_dev->priv = priv; - - priv->ieee->iw_mode = IW_MODE_MONITOR; - - rc = register_netdev(priv->rtap_net_dev); + rc = register_netdev(rtap_dev); if (rc) { - free_ieee80211(priv->rtap_net_dev); - priv->rtap_net_dev = NULL; + free_netdev(rtap_dev); return rc; } + priv->rtap_net_dev = rtap_dev; return 0; } -- cgit v1.2.3 From 121947c62ab049bfaeb8fadc9908834b5a99daf0 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 19:54:11 -0500 Subject: libertas: set dev_addr on rtap device This lets us bring it up, because eth_validate_addr() succeeds instead of returning -EINVAL. And finally monitor mode seems to (mostly) work. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 55dce8dbd0d..e9c6b4ffd8e 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1473,6 +1473,7 @@ int lbs_add_rtap(struct lbs_private *priv) if (rtap_dev == NULL) return -ENOMEM; + memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN); rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; rtap_dev->open = lbs_rtap_open; rtap_dev->stop = lbs_rtap_stop; -- cgit v1.2.3 From a97bcfed96b563f56f55dbccee70e09bd2800414 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 22:00:55 -0500 Subject: libertas: TX packet is radiotap iff it comes from rtap_dev Fix one of the barriers to simultaneous radiotap and normal operation -- stop misinterpreting the TX packets on the normal devices. We're also going to have to clone the incoming skbs and feed them into both devices, and there seem to be firmware problems with staying associated too. But this is a reasonable start... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index aefe52419ba..c2881a9907c 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -105,7 +105,7 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) p802x_hdr = skb->data; pkt_len = skb->len; - if (priv->monitormode != LBS_MONITOR_OFF) { + if (dev == priv->rtap_net_dev) { struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; /* set txpd fields from the radiotap header */ -- cgit v1.2.3 From 45c24903b7026ec99c059d690f3618e3f95f2790 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 22:02:46 -0500 Subject: libertas: free successfully transmitted skbs again I was so busy cleaning up the failure modes that I accidentally forgot to make sure we still free them in the success case. Oops. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index c2881a9907c..300aa05edeb 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -161,7 +161,9 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) /* Keep the skb around for when we get feedback */ priv->currenttxskb = skb; - } + } else + dev_kfree_skb_any(skb); + } spin_unlock_irqrestore(&priv->driver_lock, flags); -- cgit v1.2.3 From b8d40bc9c9099943cbcf18d285bf241f1f080a44 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 23:44:43 -0500 Subject: libertas: refactor the 'should I sleep?' decision in lbs_thread() This was making my brain hurt. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index e9c6b4ffd8e..42b64b5ad08 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -722,6 +722,8 @@ static int lbs_thread(void *data) set_freezable(); for (;;) { + int shouldsleep; + lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", priv->intcounter, priv->currenttxskb, priv->dnld_sent); @@ -729,8 +731,22 @@ static int lbs_thread(void *data) set_current_state(TASK_INTERRUPTIBLE); spin_lock_irq(&priv->driver_lock); - if ((priv->psstate == PS_STATE_SLEEP) || - (!priv->intcounter && (priv->dnld_sent || priv->cur_cmd || list_empty(&priv->cmdpendingq)))) { + if (priv->surpriseremoved) + shouldsleep = 0; /* Bye */ + else if (priv->psstate == PS_STATE_SLEEP) + shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ + else if (priv->intcounter) + shouldsleep = 0; /* Interrupt pending. Deal with it now */ + else if (priv->dnld_sent) + shouldsleep = 1; /* Something is en route to the device already */ + else if (priv->cur_cmd) + shouldsleep = 1; /* Can't send a command; one already running */ + else if (!list_empty(&priv->cmdpendingq)) + shouldsleep = 0; /* We have a command to send */ + else + shouldsleep = 1; /* No command */ + + if (shouldsleep) { lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", priv->connect_status, priv->intcounter, priv->psmode, priv->psstate); -- cgit v1.2.3 From 2eb188a1c57ae79283cee951c317bd191cf1ca56 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 9 Dec 2007 23:54:27 -0500 Subject: libertas: Move actual transmission to main thread The locking issues with TX, especially TX from multiple netdevs, get _so_ much easier if you do it like this. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 5 +- drivers/net/wireless/libertas/main.c | 24 ++++++++ drivers/net/wireless/libertas/tx.c | 103 +++++++++++++++-------------------- 3 files changed, 71 insertions(+), 61 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 04cf33da589..468140512a6 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -164,7 +164,10 @@ struct lbs_private { struct mutex lock; - u8 tmptxbuf[LBS_UPLD_SIZE]; + /* TX packet ready to be sent... */ + int tx_pending_len; /* -1 while building packet */ + + u8 tx_pending_buf[LBS_UPLD_SIZE]; /* protected by hard_start_xmit serialization */ /** command-related variables */ diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 42b64b5ad08..f16c93ba6ef 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -739,6 +739,8 @@ static int lbs_thread(void *data) shouldsleep = 0; /* Interrupt pending. Deal with it now */ else if (priv->dnld_sent) shouldsleep = 1; /* Something is en route to the device already */ + else if (priv->tx_pending_len > 0) + shouldsleep = 0; /* We've a packet to send */ else if (priv->cur_cmd) shouldsleep = 1; /* Can't send a command; one already running */ else if (!list_empty(&priv->cmdpendingq)) @@ -852,6 +854,28 @@ static int lbs_thread(void *data) */ if (!list_empty(&priv->cmdpendingq)) wake_up_all(&priv->cmd_pending); + + spin_lock_irq(&priv->driver_lock); + if (!priv->dnld_sent && priv->tx_pending_len > 0) { + int ret = priv->hw_host_to_card(priv, MVMS_DAT, + priv->tx_pending_buf, + priv->tx_pending_len); + if (ret) { + lbs_deb_tx("host_to_card failed %d\n", ret); + priv->dnld_sent = DNLD_RES_RECEIVED; + } + priv->tx_pending_len = 0; + if (!priv->currenttxskb) { + /* We can wake the queues immediately if we aren't + waiting for TX feedback */ + if (priv->connect_status == LBS_CONNECTED) + netif_wake_queue(priv->dev); + if (priv->mesh_dev && + priv->mesh_connect_status == LBS_CONNECTED) + netif_wake_queue(priv->mesh_dev); + } + } + spin_unlock_irq(&priv->driver_lock); } del_timer(&priv->command_timer); diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 300aa05edeb..e2141f0a67d 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -67,39 +67,45 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) lbs_deb_enter(LBS_DEB_TX); - ret = NETDEV_TX_BUSY; - - if (priv->dnld_sent) { - lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", - priv->dnld_sent); - goto done; - } - - if (priv->currenttxskb) { - lbs_pr_err("%s while TX skb pending\n", __func__); - goto done; - } + ret = NETDEV_TX_OK; - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", - priv->psstate == PS_STATE_SLEEP?"":"pre-"); - goto done; - } + /* We need to protect against the queues being restarted before + we get round to stopping them */ + spin_lock_irqsave(&priv->driver_lock, flags); if (priv->surpriseremoved) - goto drop; + goto free; if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); /* We'll never manage to send this one; drop it and return 'OK' */ - goto drop; + + priv->stats.tx_dropped++; + priv->stats.tx_errors++; + goto free; + } + + + netif_stop_queue(priv->dev); + if (priv->mesh_dev) + netif_stop_queue(priv->mesh_dev); + + if (priv->tx_pending_len) { + /* This can happen if packets come in on the mesh and eth + device simultaneously -- there's no mutual exclusion on + hard_start_xmit() calls between devices. */ + lbs_deb_tx("Packet on %s while busy\n", dev->name); + ret = NETDEV_TX_BUSY; + goto unlock; } + priv->tx_pending_len = -1; + spin_unlock_irqrestore(&priv->driver_lock, flags); + lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - txpd = (void *)priv->tmptxbuf; + txpd = (void *)priv->tx_pending_buf; memset(txpd, 0, sizeof(struct txpd)); p802x_hdr = skb->data; @@ -134,54 +140,31 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(&txpd[1], p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - /* We need to protect against the queues being restarted before - we get round to stopping them */ spin_lock_irqsave(&priv->driver_lock, flags); + priv->tx_pending_len = pkt_len + sizeof(struct txpd); - ret = priv->hw_host_to_card(priv, MVMS_DAT, priv->tmptxbuf, - pkt_len + sizeof(struct txpd)); - - if (!ret) { - lbs_deb_tx("%s succeeds\n", __func__); - - /* Stop processing outgoing pkts before submitting */ - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); - - priv->stats.tx_packets++; - priv->stats.tx_bytes += skb->len; - - dev->trans_start = jiffies; + lbs_deb_tx("%s lined up packet\n", __func__); - if (priv->monitormode != LBS_MONITOR_OFF) { - /* Keep the skb to echo it back once Tx feedback is - received from FW */ - skb_orphan(skb); + priv->stats.tx_packets++; + priv->stats.tx_bytes += skb->len; - /* Keep the skb around for when we get feedback */ - priv->currenttxskb = skb; - } else - dev_kfree_skb_any(skb); - - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); + dev->trans_start = jiffies; - if (ret) { - lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); -drop: - priv->stats.tx_dropped++; - priv->stats.tx_errors++; + if (priv->monitormode != LBS_MONITOR_OFF) { + /* Keep the skb to echo it back once Tx feedback is + received from FW */ + skb_orphan(skb); + /* Keep the skb around for when we get feedback */ + priv->currenttxskb = skb; + } else { + free: dev_kfree_skb_any(skb); } + unlock: + spin_unlock_irqrestore(&priv->driver_lock, flags); + wake_up(&priv->waitq); - /* Even if we dropped the packet, return OK. Otherwise the - packet gets requeued. */ - ret = NETDEV_TX_OK; - -done: lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); return ret; } -- cgit v1.2.3 From 180be755aec37483337f64bfca3d4b02f5c8fef4 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 00:05:37 -0500 Subject: libertas: remove unreachable code from process_rxed_802_11_packet() The function is only ever called if we're in rtap mode. So the bit in it which is conditional on rtap mode seems a little superfluous. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/rx.c | 75 ++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 43 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 58e83110812..90a21996e82 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -355,52 +355,41 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); /* create the exported radio header */ - if (priv->monitormode == LBS_MONITOR_OFF) { - /* no radio header */ - /* chop the rxpd */ - skb_pull(skb, sizeof(struct rxpd)); - } - else { - /* radiotap header */ - radiotap_hdr.hdr.it_version = 0; - /* XXX must check this value for pad */ - radiotap_hdr.hdr.it_pad = 0; - radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr)); - radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT); - /* unknown values */ - radiotap_hdr.flags = 0; - radiotap_hdr.chan_freq = 0; - radiotap_hdr.chan_flags = 0; - radiotap_hdr.antenna = 0; - /* known values */ - radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate); - /* XXX must check no carryout */ - radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; - radiotap_hdr.rx_flags = 0; - if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) - radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; - //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); - - /* chop the rxpd */ - skb_pull(skb, sizeof(struct rxpd)); - - /* add space for the new radio header */ - if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && - pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, - GFP_ATOMIC)) { - lbs_pr_alert("%s: couldn't pskb_expand_head\n", - __func__); - } - - pradiotap_hdr = - (struct rx_radiotap_hdr *)skb_push(skb, - sizeof(struct - rx_radiotap_hdr)); - memcpy(pradiotap_hdr, &radiotap_hdr, - sizeof(struct rx_radiotap_hdr)); + /* radiotap header */ + radiotap_hdr.hdr.it_version = 0; + /* XXX must check this value for pad */ + radiotap_hdr.hdr.it_pad = 0; + radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr)); + radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT); + /* unknown values */ + radiotap_hdr.flags = 0; + radiotap_hdr.chan_freq = 0; + radiotap_hdr.chan_flags = 0; + radiotap_hdr.antenna = 0; + /* known values */ + radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate); + /* XXX must check no carryout */ + radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; + radiotap_hdr.rx_flags = 0; + if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) + radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; + //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); + + /* chop the rxpd */ + skb_pull(skb, sizeof(struct rxpd)); + + /* add space for the new radio header */ + if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && + pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, + GFP_ATOMIC)) { + lbs_pr_alert("%s: couldn't pskb_expand_head\n", + __func__); } + pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr)); + memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr)); + /* Take the data rate from the rxpd structure * only if the rate is auto */ -- cgit v1.2.3 From 7bf02c2985ced746f8b8956dbe4b0384edb41846 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 00:17:28 -0500 Subject: libertas: fix error cases in lbs_process_rxed_802_11_packet() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/rx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 90a21996e82..141069fa67f 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -337,9 +337,10 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, // lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { - lbs_deb_rx("rx err: frame received wit bad length\n"); + lbs_deb_rx("rx err: frame received with bad length\n"); priv->stats.rx_length_errors++; - ret = 0; + ret = -EINVAL; + kfree(skb); goto done; } @@ -381,10 +382,11 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, /* add space for the new radio header */ if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && - pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, - GFP_ATOMIC)) { - lbs_pr_alert("%s: couldn't pskb_expand_head\n", - __func__); + pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) { + lbs_pr_alert("%s: couldn't pskb_expand_head\n", __func__); + ret = -ENOMEM; + kfree_skb(skb); + goto done; } pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr)); -- cgit v1.2.3 From 6f93a8e7e41c2d29749242f983f41e3f6a75b40b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 00:49:26 -0500 Subject: libertas: kill lbs_upload_tx_packet() It replaces two lines of code. And even for those it has to make inferences about things (i.e. which device) which the caller would have just known. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/decl.h | 2 -- drivers/net/wireless/libertas/rx.c | 32 +++++++++----------------------- drivers/net/wireless/libertas/tx.c | 8 +++++++- 3 files changed, 16 insertions(+), 26 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index fcb5a851290..e8387c7ec02 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -46,8 +46,6 @@ void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen); -void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb); - /** The proc fs interface */ int lbs_process_rx_command(struct lbs_private *priv); void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 141069fa67f..6332fd451a1 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -131,22 +131,6 @@ static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd) lbs_deb_leave(LBS_DEB_RX); } -void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) -{ - lbs_deb_rx("skb->data %p\n", skb->data); - - if (priv->monitormode != LBS_MONITOR_OFF) { - skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); - } else { - if (priv->mesh_dev && IS_MESH_FRAME(skb)) - skb->protocol = eth_type_trans(skb, priv->mesh_dev); - else - skb->protocol = eth_type_trans(skb, priv->dev); - } - skb->ip_summed = CHECKSUM_NONE; - netif_rx(skb); -} - /** * @brief This function processes received packet and forwards it * to kernel/upper layer @@ -158,7 +142,7 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb) int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) { int ret = 0; - + struct net_device *dev = priv->dev; struct rxpackethdr *p_rx_pkt; struct rxpd *p_rx_pd; @@ -169,15 +153,15 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_enter(LBS_DEB_RX); + skb->ip_summed = CHECKSUM_NONE; + if (priv->monitormode != LBS_MONITOR_OFF) return process_rxed_802_11_packet(priv, skb); p_rx_pkt = (struct rxpackethdr *) skb->data; p_rx_pd = &p_rx_pkt->rx_pd; - if (p_rx_pd->rx_control & RxPD_MESH_FRAME) - SET_MESH_FRAME(skb); - else - UNSET_MESH_FRAME(skb); + if (priv->mesh_dev && (p_rx_pd->rx_control & RxPD_MESH_FRAME)) + dev = priv->mesh_dev; lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, min_t(unsigned int, skb->len, 100)); @@ -262,7 +246,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) priv->stats.rx_bytes += skb->len; priv->stats.rx_packets++; - lbs_upload_rx_packet(priv, skb); + skb->protocol = eth_type_trans(skb, dev); + netif_rx(skb); ret = 0; done: @@ -404,7 +389,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, priv->stats.rx_bytes += skb->len; priv->stats.rx_packets++; - lbs_upload_rx_packet(priv, skb); + skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); + netif_rx(skb); ret = 0; diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index e2141f0a67d..8a1a3965f1c 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -2,6 +2,7 @@ * This file contains the handling of TX in wlan driver. */ #include +#include #include "hostcmd.h" #include "radiotap.h" @@ -203,7 +204,12 @@ void lbs_send_tx_feedback(struct lbs_private *priv) try_count = (status >> 16) & 0xff; radiotap_hdr->data_retries = (try_count) ? (1 + priv->txretrycount - try_count) : 0; - lbs_upload_rx_packet(priv, priv->currenttxskb); + + + priv->currenttxskb->protocol = eth_type_trans(priv->currenttxskb, + priv->rtap_net_dev); + netif_rx(priv->currenttxskb); + priv->currenttxskb = NULL; if (priv->connect_status == LBS_CONNECTED) -- cgit v1.2.3 From c3f949618d01d6c40a0267ae8c01695cc2de08e2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 00:51:35 -0500 Subject: libertas: kill (IS,SET,UNSET)_MESH_FRAME. No need for these any more. We've collapsed all the unneeded nests of functions which needed to keep track of which device the skb belonged to. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/defs.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 82423842a70..04db6af72a5 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h @@ -257,10 +257,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in #define MAX_LEDS 8 -#define IS_MESH_FRAME(x) (x->cb[6]) -#define SET_MESH_FRAME(x) (x->cb[6]=1) -#define UNSET_MESH_FRAME(x) (x->cb[6]=0) - /** Global Variable Declaration */ extern const char lbs_driver_version[]; extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; -- cgit v1.2.3 From b6b8abe4ddec2cfb3471ea60f965a137cd4d529d Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Mon, 10 Dec 2007 12:19:55 +0100 Subject: libertas: fix use-after-free error Previously, the display of subscribed events could be wrong. Signed-off-by: Holger Schurig Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/debugfs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 745191a6896..c5130a2581f 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -410,30 +410,32 @@ static ssize_t lbs_threshold_read( char *buf = (char *)addr; u8 value; u8 freq; + int events = 0; - struct cmd_ds_802_11_subscribe_event *events = kzalloc( + struct cmd_ds_802_11_subscribe_event *subscribed = kzalloc( sizeof(struct cmd_ds_802_11_subscribe_event), GFP_KERNEL); struct mrvlietypes_thresholds *got; res = lbs_prepare_and_send_command(priv, CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_GET, - CMD_OPTION_WAITFORRSP, 0, events); + CMD_OPTION_WAITFORRSP, 0, subscribed); if (res) { - kfree(events); + kfree(subscribed); return res; } - got = lbs_tlv_find(tlv_type, events->tlv, sizeof(events->tlv)); + got = lbs_tlv_find(tlv_type, subscribed->tlv, sizeof(subscribed->tlv)); if (got) { value = got->value; freq = got->freq; + events = le16_to_cpu(subscribed->events); } - kfree(events); + kfree(subscribed); if (got) pos += snprintf(buf, len, "%d %d %d\n", value, freq, - !!(le16_to_cpu(events->events) & event_mask)); + !!(events & event_mask)); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); -- cgit v1.2.3 From 1309b55b4de18bbfe19c73225a5481d6cdc8a463 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 13:36:10 -0500 Subject: libertas: add opaque extra argument to cmd callback function This will be useful for letting callbacks do stuff like copying the response into a buffer provided by the caller of lbs_cmd() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 6 +++++- drivers/net/wireless/libertas/cmdresp.c | 11 ++++++----- drivers/net/wireless/libertas/decl.h | 3 ++- drivers/net/wireless/libertas/hostcmd.h | 3 ++- drivers/net/wireless/libertas/if_usb.c | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 49a9aeee2b6..228e3fee20f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1642,6 +1642,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) ptempnode->wait_option = 0; ptempnode->pdata_buf = NULL; ptempnode->callback = NULL; + ptempnode->callback_arg = 0; if (ptempnode->bufvirtualaddr != NULL) memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); @@ -1670,6 +1671,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; ptempnode->callback = NULL; + ptempnode->callback_arg = 0; lbs_deb_leave(LBS_DEB_HOST); } @@ -1993,7 +1995,8 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) */ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)) + int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), + unsigned long callback_arg) { struct cmd_ctrl_node *cmdnode; struct cmd_ds_gen *cmdptr; @@ -2028,6 +2031,7 @@ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; cmdnode->wait_option = CMD_OPTION_WAITFORRSP; cmdnode->callback = callback; + cmdnode->callback_arg = callback_arg; /* Set sequence number, clean result, move to buffer */ priv->seqnum++; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index ab6e729efac..7bad257fd9c 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -552,12 +552,13 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, return 0; } -static inline int handle_cmd_response(u16 respcmd, - struct cmd_ds_command *resp, - struct lbs_private *priv) +static inline int handle_cmd_response(struct lbs_private *priv, + unsigned long dummy, + struct cmd_ds_command *resp) { int ret = 0; unsigned long flags; + uint16_t respcmd = le16_to_cpu(resp->command); lbs_deb_enter(LBS_DEB_HOST); @@ -861,9 +862,9 @@ int lbs_process_rx_command(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); if (priv->cur_cmd && priv->cur_cmd->callback) - ret = priv->cur_cmd->callback(respcmd, resp, priv); + ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, resp); else - ret = handle_cmd_response(respcmd, resp, priv); + ret = handle_cmd_response(priv, 0, resp); spin_lock_irqsave(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index e8387c7ec02..a086d0c6dfe 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -24,7 +24,8 @@ void lbs_send_tx_feedback(struct lbs_private *priv); int lbs_free_cmd_buffer(struct lbs_private *priv); int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)); + int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), + unsigned long callback_arg); int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index f1c1d3f106c..ed502b74fa3 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -71,7 +71,8 @@ struct cmd_ctrl_node { u16 wait_option; /* command response */ void *pdata_buf; - int (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv); + int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp); + unsigned long callback_arg; /* command data */ u8 *bufvirtualaddr; /* wait queue */ diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 141d185ac01..f59fd73468f 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -108,7 +108,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; - if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL)) + if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL, 0)) lbs_deb_usb("Setting boot2 version failed\n"); } -- cgit v1.2.3 From 4f679496567809ce1e95730c25274e1832537f4b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 14:58:37 -0500 Subject: libertas: clean up lbs_interrupt() Make it take struct lbs_private as argument; that's all it wants anyway, and all callers were starting off from that. Don't wake the netif queues, because those should be handled elsewhere. And sort out the locking, with a big nasty warning for those who don't have the driver_lock locked when they call it. Oh, and fix if_cs.c to lock the driver_lock before calling it. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/decl.h | 2 +- drivers/net/wireless/libertas/if_cs.c | 5 +++-- drivers/net/wireless/libertas/if_sdio.c | 4 ++-- drivers/net/wireless/libertas/if_usb.c | 4 ++-- drivers/net/wireless/libertas/main.c | 19 +++++++++---------- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index a086d0c6dfe..82727a87ea9 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -39,7 +39,7 @@ void lbs_queue_cmd(struct lbs_private *priv, int lbs_allocate_cmd_buffer(struct lbs_private *priv); int lbs_execute_next_command(struct lbs_private *priv); int lbs_process_event(struct lbs_private *priv); -void lbs_interrupt(struct net_device *); +void lbs_interrupt(struct lbs_private *priv); int lbs_set_radio_control(struct lbs_private *priv); u32 lbs_fw_index_to_data_rate(u8 index); u8 lbs_data_rate_to_fw_index(u32 rate); diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 49a01780dd0..2acbe5dcff7 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -264,8 +264,9 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) /* clear interrupt */ if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); } - - lbs_interrupt(card->priv->dev); + spin_lock(&card->priv->driver_lock); + lbs_interrupt(card->priv); + spin_unlock(&card->priv->driver_lock); return IRQ_HANDLED; } diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 24239609367..1ed72b9b6bf 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -154,7 +154,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, card->int_cause |= MRVDRV_CMD_UPLD_RDY; - lbs_interrupt(card->priv->dev); + lbs_interrupt(card->priv); ret = 0; @@ -236,7 +236,7 @@ static int if_sdio_handle_event(struct if_sdio_card *card, card->event = event; card->int_cause |= MRVDRV_CARDEVENT; - lbs_interrupt(card->priv->dev); + lbs_interrupt(card->priv); spin_unlock_irqrestore(&card->priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index f59fd73468f..1c23166783f 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -632,7 +632,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, priv->upld_len); kfree_skb(skb); - lbs_interrupt(priv->dev); + lbs_interrupt(priv); spin_unlock(&priv->driver_lock); lbs_deb_usbd(&cardp->udev->dev, @@ -705,7 +705,7 @@ static void if_usb_receive(struct urb *urb) cardp->usb_event_cause <<= 3; cardp->usb_int_cause |= MRVDRV_CARDEVENT; kfree_skb(skb); - lbs_interrupt(priv->dev); + lbs_interrupt(priv); spin_unlock(&priv->driver_lock); goto rx_exit; default: diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index f16c93ba6ef..2797149649c 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1408,23 +1408,22 @@ out: * @param dev A pointer to net_device structure * @return n/a */ -void lbs_interrupt(struct net_device *dev) +void lbs_interrupt(struct lbs_private *priv) { - struct lbs_private *priv = dev->priv; - lbs_deb_enter(LBS_DEB_THREAD); - lbs_deb_thread("lbs_interrupt: intcounter=%d\n", - priv->intcounter); + lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter); + + if (spin_trylock(&priv->driver_lock)) { + spin_unlock(&priv->driver_lock); + printk(KERN_CRIT "%s called without driver_lock held\n", __func__); + WARN_ON(1); + } priv->intcounter++; - if (priv->psstate == PS_STATE_SLEEP) { + if (priv->psstate == PS_STATE_SLEEP) priv->psstate = PS_STATE_AWAKE; - netif_wake_queue(dev); - if (priv->mesh_dev) - netif_wake_queue(priv->mesh_dev); - } wake_up_interruptible(&priv->waitq); -- cgit v1.2.3 From 14e865ba5d9e9adc90363e572743ac238935ba38 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 10 Dec 2007 15:11:23 -0500 Subject: libertas: make lbs_cmd() usage nicer Define a macro that relieves the caller from having to use sizeof on the command structure when calling lbs_cmd(), and move the prototype of __lbs_cmd() to a new cmd.h file. Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 8 ++++---- drivers/net/wireless/libertas/cmd.h | 16 ++++++++++++++++ drivers/net/wireless/libertas/decl.h | 4 ---- drivers/net/wireless/libertas/if_usb.c | 3 ++- 4 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 drivers/net/wireless/libertas/cmd.h (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 228e3fee20f..c7c226c0950 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1994,9 +1994,9 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * the result code from the firmware */ -int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), - unsigned long callback_arg) +int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), + unsigned long callback_arg) { struct cmd_ctrl_node *cmdnode; struct cmd_ds_gen *cmdptr; @@ -2066,6 +2066,6 @@ done: lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); return ret; } -EXPORT_SYMBOL_GPL(lbs_cmd); +EXPORT_SYMBOL_GPL(__lbs_cmd); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h new file mode 100644 index 00000000000..546db499648 --- /dev/null +++ b/drivers/net/wireless/libertas/cmd.h @@ -0,0 +1,16 @@ +/* Copyright (C) 2007, Red Hat, Inc. */ + +#ifndef _LBS_CMD_H_ +#define _LBS_CMD_H_ + +#include "hostcmd.h" +#include "dev.h" + +#define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \ + __lbs_cmd(priv, cmdnr, &cmd, sizeof(cmd), callback, callback_arg) + +int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), + unsigned long callback_arg); + +#endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 82727a87ea9..33c8305b5c0 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -23,10 +23,6 @@ void lbs_send_tx_feedback(struct lbs_private *priv); int lbs_free_cmd_buffer(struct lbs_private *priv); -int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), - unsigned long callback_arg); - int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_no, u16 cmd_action, diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 1c23166783f..8ff57a6f251 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -13,6 +13,7 @@ #include "decl.h" #include "defs.h" #include "dev.h" +#include "cmd.h" #include "if_usb.h" #define MESSAGE_HEADER_LEN 4 @@ -108,7 +109,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; - if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL, 0)) + if (lbs_cmd(priv, CMD_SET_BOOT2_VER, b2_cmd, NULL, 0)) lbs_deb_usb("Setting boot2 version failed\n"); } -- cgit v1.2.3 From b31d8b90dcc6fbe39147863d13b93a8d49d2b341 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 15:25:42 -0500 Subject: libertas: remove pre_open_check() The firmware is always initialised before we register the netdevices. It's not possible for pre_open_check() to fail. One day we might try loading firmware in ->open(), but still it won't be just a _check_, like this. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2797149649c..3d9de7a1bfc 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -366,34 +366,6 @@ static struct attribute_group lbs_mesh_attr_group = { .attrs = lbs_mesh_sysfs_entries, }; -/** - * @brief Check if the device can be open and wait if necessary. - * - * @param dev A pointer to net_device structure - * @return 0 - * - * For USB adapter, on some systems the device open handler will be - * called before FW ready. Use the following flag check and wait - * function to work around the issue. - * - */ -static int pre_open_check(struct net_device *dev) -{ - struct lbs_private *priv = (struct lbs_private *) dev->priv; - int i = 0; - - while (!priv->fw_ready && i < 20) { - i++; - msleep_interruptible(100); - } - if (!priv->fw_ready) { - lbs_pr_err("firmware not ready\n"); - return -1; - } - - return 0; -} - /** * @brief This function opens the device * @@ -433,8 +405,6 @@ static int lbs_mesh_open(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv ; - if (pre_open_check(dev) == -1) - return -1; priv->mesh_open = 1 ; netif_wake_queue(priv->mesh_dev); @@ -457,8 +427,6 @@ static int lbs_open(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv ; - if(pre_open_check(dev) == -1) - return -1; priv->infra_open = 1 ; netif_wake_queue(priv->dev); if (priv->open == 0) -- cgit v1.2.3 From 852e1f2a2627274102a3c2dc70a6547aeab99cb6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 10 Dec 2007 15:24:47 -0500 Subject: libertas: clean up is_command_allowed_in_ps() Total overkill to have an array when there's only one command in it. Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index c7c226c0950..2efba570804 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -19,26 +19,20 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, u16 wait_option, void *pdata_buf); -static u16 commands_allowed_in_ps[] = { - CMD_802_11_RSSI, -}; - /** - * @brief This function checks if the commans is allowed - * in PS mode not. + * @brief Checks whether a command is allowed in Power Save mode * * @param command the command ID - * @return TRUE or FALSE + * @return 1 if allowed, 0 if not allowed */ -static u8 is_command_allowed_in_ps(__le16 command) +static u8 is_command_allowed_in_ps(u16 cmd) { - int i; - - for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) { - if (command == cpu_to_le16(commands_allowed_in_ps[i])) - return 1; + switch (cmd) { + case CMD_802_11_RSSI: + return 1; + default: + break; } - return 0; } @@ -1715,7 +1709,7 @@ int lbs_execute_next_command(struct lbs_private *priv) if (cmdnode) { cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; - if (is_command_allowed_in_ps(cmdptr->command)) { + if (is_command_allowed_in_ps(le16_to_cpu(cmdptr->command))) { if ((priv->psstate == PS_STATE_SLEEP) || (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( -- cgit v1.2.3 From 8552855f9860b222673e86a88de2543f53f83dc2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 16:38:18 -0500 Subject: libertas: make rtap and normal modes mutually exclusive, clean up open/stop Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/main.c | 133 +++++++++++++---------------------- 2 files changed, 50 insertions(+), 84 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 468140512a6..9921d0cd6f1 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -99,7 +99,6 @@ struct lbs_mesh_stats { /** Private structure for the MV device */ struct lbs_private { - int open; int mesh_open; int infra_open; int mesh_autostart_enabled; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 3d9de7a1bfc..88664024bf8 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -274,6 +274,8 @@ static ssize_t lbs_rtap_set(struct device *dev, if(priv->monitormode == monitor_mode) return strlen(buf); if (priv->monitormode == LBS_MONITOR_OFF) { + if (priv->infra_open || priv->mesh_open) + return -EBUSY; if (priv->mode == IW_MODE_INFRA) lbs_send_deauthentication(priv); else if (priv->mode == IW_MODE_ADHOC) @@ -367,84 +369,42 @@ static struct attribute_group lbs_mesh_attr_group = { }; /** - * @brief This function opens the device + * @brief This function opens the ethX or mshX interface * * @param dev A pointer to net_device structure - * @return 0 + * @return 0 or -EBUSY if monitor mode active */ static int lbs_dev_open(struct net_device *dev) { - struct lbs_private *priv = (struct lbs_private *) dev->priv; - - lbs_deb_enter(LBS_DEB_NET); + struct lbs_private *priv = (struct lbs_private *) dev->priv ; + int ret = 0; - priv->open = 1; + spin_lock_irq(&priv->driver_lock); - if (priv->connect_status == LBS_CONNECTED) - netif_carrier_on(priv->dev); - else - netif_carrier_off(priv->dev); + if (priv->monitormode != LBS_MONITOR_OFF) { + ret = -EBUSY; + goto out; + } - if (priv->mesh_dev) { - if (priv->mesh_connect_status == LBS_CONNECTED) - netif_carrier_on(priv->mesh_dev); + if (dev == priv->mesh_dev) { + priv->mesh_open = 1; + priv->mesh_connect_status = LBS_CONNECTED; + netif_carrier_on(dev); + } else { + priv->infra_open = 1; + + if (priv->connect_status == LBS_CONNECTED) + netif_carrier_on(dev); else - netif_carrier_off(priv->mesh_dev); + netif_carrier_off(dev); } - lbs_deb_leave(LBS_DEB_NET); - return 0; -} -/** - * @brief This function opens the mshX interface - * - * @param dev A pointer to net_device structure - * @return 0 - */ -static int lbs_mesh_open(struct net_device *dev) -{ - struct lbs_private *priv = (struct lbs_private *) dev->priv ; - - priv->mesh_open = 1 ; - netif_wake_queue(priv->mesh_dev); - - priv->mesh_connect_status = LBS_CONNECTED; - - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - if (priv->infra_open == 0) - return lbs_dev_open(priv->dev) ; - return 0; -} - -/** - * @brief This function opens the ethX interface - * - * @param dev A pointer to net_device structure - * @return 0 - */ -static int lbs_open(struct net_device *dev) -{ - struct lbs_private *priv = (struct lbs_private *) dev->priv ; - - priv->infra_open = 1 ; - netif_wake_queue(priv->dev); - if (priv->open == 0) - return lbs_dev_open(priv->dev) ; - return 0; -} + if (!priv->tx_pending_len) + netif_wake_queue(dev); + out: -static int lbs_dev_close(struct net_device *dev) -{ - struct lbs_private *priv = dev->priv; - - lbs_deb_enter(LBS_DEB_NET); - - netif_carrier_off(priv->dev); - priv->open = 0; - - lbs_deb_leave(LBS_DEB_NET); - return 0; + spin_unlock_irq(&priv->driver_lock); + return ret; } /** @@ -453,16 +413,20 @@ static int lbs_dev_close(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int lbs_mesh_close(struct net_device *dev) +static int lbs_mesh_stop(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) (dev->priv); + spin_lock_irq(&priv->driver_lock); + priv->mesh_open = 0; - netif_stop_queue(priv->mesh_dev); - if (priv->infra_open == 0) - return lbs_dev_close(dev); - else - return 0; + priv->mesh_connect_status = LBS_DISCONNECTED; + + netif_stop_queue(dev); + netif_carrier_off(dev); + + spin_unlock_irq(&priv->driver_lock); + return 0; } /** @@ -471,16 +435,18 @@ static int lbs_mesh_close(struct net_device *dev) * @param dev A pointer to net_device structure * @return 0 */ -static int lbs_close(struct net_device *dev) +static int lbs_eth_stop(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; - netif_stop_queue(dev); + spin_lock_irq(&priv->driver_lock); + priv->infra_open = 0; - if (priv->mesh_open == 0) - return lbs_dev_close(dev); - else - return 0; + + netif_stop_queue(dev); + + spin_unlock_irq(&priv->driver_lock); + return 0; } static void lbs_tx_timeout(struct net_device *dev) @@ -1065,9 +1031,9 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) priv->infra_open = 0; /* Setup the OS Interface to our functions */ - dev->open = lbs_open; + dev->open = lbs_dev_open; dev->hard_start_xmit = lbs_hard_start_xmit; - dev->stop = lbs_close; + dev->stop = lbs_eth_stop; dev->set_mac_address = lbs_set_mac_address; dev->tx_timeout = lbs_tx_timeout; dev->get_stats = lbs_get_stats; @@ -1237,9 +1203,9 @@ int lbs_add_mesh(struct lbs_private *priv, struct device *dev) mesh_dev->priv = priv; priv->mesh_dev = mesh_dev; - mesh_dev->open = lbs_mesh_open; + mesh_dev->open = lbs_dev_open; mesh_dev->hard_start_xmit = lbs_hard_start_xmit; - mesh_dev->stop = lbs_mesh_close; + mesh_dev->stop = lbs_mesh_stop; mesh_dev->get_stats = lbs_get_stats; mesh_dev->set_mac_address = lbs_set_mac_address; mesh_dev->ethtool_ops = &lbs_ethtool_ops; @@ -1436,6 +1402,7 @@ static void __exit lbs_exit_module(void) static int lbs_rtap_open(struct net_device *dev) { + /* Yes, _stop_ the queue. Because we don't support injection */ netif_carrier_off(dev); netif_stop_queue(dev); return 0; @@ -1449,7 +1416,7 @@ static int lbs_rtap_stop(struct net_device *dev) static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { netif_stop_queue(dev); - return -EOPNOTSUPP; + return NETDEV_TX_BUSY; } static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) -- cgit v1.2.3 From c8ba39d0605200c81f43c59418871e036d973685 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Dec 2007 18:53:34 -0500 Subject: libertas: improve reliability of firmware reloading on USB Increase the delay between issuing the RESET command and the usb reset, and be prepared to discard more than one 'normal' packet from it before it resets. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 8ff57a6f251..0a3795048c2 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -389,9 +389,9 @@ static int if_usb_reset_device(struct usb_card_rec *cardp) cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT); usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); - msleep(10); + msleep(100); ret = usb_reset_device(cardp->udev); - msleep(10); + msleep(100); lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); @@ -500,7 +500,7 @@ static void if_usb_receive_fwload(struct urb *urb) return; } - if (cardp->bootcmdresp == 0) { + if (cardp->bootcmdresp <= 0) { memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, sizeof(bootcmdresp)); if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { -- cgit v1.2.3 From 4f82f5c853e314dfe877b87b4c1e4b127ee9a34b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 00:07:58 -0500 Subject: libertas: switch to a waitqueue and timer for handling USB firmware load No need to busy-wait, even if we did have a 100ms delay in the loop. This makes it easier to support the new 'firmware ready' event which is in the new firmware, too. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 38 +++++++++++++++++++++++----------- drivers/net/wireless/libertas/if_usb.h | 5 +++++ 2 files changed, 31 insertions(+), 12 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 0a3795048c2..a086653803f 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -113,7 +113,18 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) lbs_deb_usb("Setting boot2 version failed\n"); } +void if_usb_fw_timeo(unsigned long priv) +{ + struct usb_card_rec *cardp = (void *)priv; + if (cardp->fwdnldover) { + lbs_deb_usb("Download complete, no event. Assuming success\n"); + } else { + lbs_pr_err("Download timed out\n"); + cardp->surprise_removed = 1; + } + wake_up(&cardp->fw_wq); +} /** * @brief sets the configuration values * @param ifnum interface number @@ -138,6 +149,9 @@ static int if_usb_probe(struct usb_interface *intf, goto error; } + setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); + init_waitqueue_head(&cardp->fw_wq); + cardp->udev = udev; iface_desc = intf->cur_altsetting; @@ -296,7 +310,7 @@ static void if_usb_disconnect(struct usb_interface *intf) * @param priv pointer to struct lbs_private * @return 0 */ -static int if_prog_firmware(struct usb_card_rec *cardp) +static int if_usb_send_fw_pkt(struct usb_card_rec *cardp) { struct FWData *fwdata; struct fwheader *fwheader; @@ -566,19 +580,21 @@ static void if_usb_receive_fwload(struct urb *urb) kfree_skb(skb); + /* reschedule timer for 200ms hence */ + mod_timer(&cardp->fw_timeout, jiffies + (HZ/5)); + if (cardp->fwfinalblk) { cardp->fwdnldover = 1; goto exit; } - if_prog_firmware(cardp); + if_usb_send_fw_pkt(cardp); if_usb_submit_rx_urb_fwload(cardp); -exit: + exit: kfree(syncfwheader); return; - } #define MRVDRV_MIN_PKT_LEN 30 @@ -911,15 +927,13 @@ restart: cardp->totalbytes = 0; cardp->fwfinalblk = 0; - if_prog_firmware(cardp); + /* Send the first firmware packet... */ + if_usb_send_fw_pkt(cardp); - do { - lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n"); - i++; - msleep_interruptible(100); - if (cardp->surprise_removed || i >= 20) - break; - } while (!cardp->fwdnldover); + /* ... and wait for the process to complete */ + wait_event_interruptible(cardp->fw_wq, cardp->surprise_removed || cardp->fwdnldover); + + del_timer_sync(&cardp->fw_timeout); if (!cardp->fwdnldover) { lbs_pr_info("failed to load fw, resetting device!\n"); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 940a369f1fe..224c957e292 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -1,6 +1,9 @@ #ifndef _LBS_IF_USB_H #define _LBS_IF_USB_H +#include +#include + /** * This file contains definition for USB interface. */ @@ -56,6 +59,8 @@ struct usb_card_rec { u8 bulk_out_endpointAddr; const struct firmware *fw; + struct timer_list fw_timeout; + wait_queue_head_t fw_wq; u8 CRC_OK; u32 fwseqnum; u32 lastseqnum; -- cgit v1.2.3 From b15152a4033d4c82015bb79c6b81eeb0a2edeeea Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 11:55:37 -0500 Subject: libertas: don't run thread while firmware not yet ready Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 88664024bf8..9a231099212 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -671,6 +671,8 @@ static int lbs_thread(void *data) shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ else if (priv->intcounter) shouldsleep = 0; /* Interrupt pending. Deal with it now */ + else if (!priv->fw_ready) + shouldsleep = 1; /* Firmware not ready. We're waiting for it */ else if (priv->dnld_sent) shouldsleep = 1; /* Something is en route to the device already */ else if (priv->tx_pending_len > 0) @@ -753,6 +755,9 @@ static int lbs_thread(void *data) } else spin_unlock_irq(&priv->driver_lock); + if (!priv->fw_ready) + continue; + /* Check if we need to confirm Sleep Request received previously */ if (priv->psstate == PS_STATE_PRE_SLEEP && !priv->dnld_sent && !priv->cur_cmd) { -- cgit v1.2.3 From 7ad994dec7d36c319cb35cbf3a920d3bda96e6b0 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 12:33:30 -0500 Subject: libertas: clean up direct command handling Move direct command handling through __lbs_cmd() over to using the header as the first member of the command structure, and only define the __lbs_cmd() callback in one place rather than 3. Convert boot2 version command to new usage. Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 22 ++++++++++++---------- drivers/net/wireless/libertas/cmd.h | 8 +++++--- drivers/net/wireless/libertas/cmdresp.c | 7 ++++--- drivers/net/wireless/libertas/hostcmd.h | 12 ++++++++++-- 4 files changed, 31 insertions(+), 18 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 2efba570804..78870c77042 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1988,12 +1988,13 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * the result code from the firmware */ -int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), +int __lbs_cmd(struct lbs_private *priv, uint16_t command, + struct cmd_header *in_cmd, int in_cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg) { struct cmd_ctrl_node *cmdnode; - struct cmd_ds_gen *cmdptr; + struct cmd_header *send_cmd; unsigned long flags; int ret = 0; @@ -2012,7 +2013,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_siz } cmdnode = lbs_get_cmd_ctrl_node(priv); - if (cmdnode == NULL) { lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); @@ -2022,18 +2022,20 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_siz goto done; } - cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; + send_cmd = (struct cmd_header *) cmdnode->bufvirtualaddr; cmdnode->wait_option = CMD_OPTION_WAITFORRSP; cmdnode->callback = callback; cmdnode->callback_arg = callback_arg; + /* Copy the incoming command to the buffer */ + memcpy(send_cmd, in_cmd, in_cmd_size); + /* Set sequence number, clean result, move to buffer */ priv->seqnum++; - cmdptr->command = cpu_to_le16(command); - cmdptr->size = cpu_to_le16(cmd_size + S_DS_GEN); - cmdptr->seqnum = cpu_to_le16(priv->seqnum); - cmdptr->result = 0; - memcpy(cmdptr->cmdresp, cmd, cmd_size); + send_cmd->command = cpu_to_le16(command); + send_cmd->size = cpu_to_le16(in_cmd_size); + send_cmd->seqnum = cpu_to_le16(priv->seqnum); + send_cmd->result = 0; lbs_deb_host("PREP_CMD: command 0x%04x\n", command); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 546db499648..259d3e87193 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -7,10 +7,12 @@ #include "dev.h" #define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \ - __lbs_cmd(priv, cmdnr, &cmd, sizeof(cmd), callback, callback_arg) + __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \ + callback, callback_arg) -int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), +int __lbs_cmd(struct lbs_private *priv, uint16_t command, + struct cmd_header *in_cmd, int in_cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg); #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 7bad257fd9c..91136697f69 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -861,9 +861,10 @@ int lbs_process_rx_command(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); - if (priv->cur_cmd && priv->cur_cmd->callback) - ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, resp); - else + if (priv->cur_cmd && priv->cur_cmd->callback) { + ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, + (struct cmd_header *) resp); + } else ret = handle_cmd_response(priv, 0, resp); spin_lock_irqsave(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index ed502b74fa3..93ac46a05c5 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -65,13 +65,20 @@ struct rxpd { u8 reserved[3]; }; +struct cmd_header { + __le16 command; + __le16 size; + __le16 seqnum; + __le16 result; +} __attribute__ ((packed)); + struct cmd_ctrl_node { struct list_head list; /* wait for finish or not */ u16 wait_option; /* command response */ void *pdata_buf; - int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp); + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); unsigned long callback_arg; /* command data */ u8 *bufvirtualaddr; @@ -424,6 +431,8 @@ struct cmd_ds_802_11_monitor_mode { }; struct cmd_ds_set_boot2_ver { + struct cmd_header hdr; + __le16 action; __le16 version; }; @@ -678,7 +687,6 @@ struct cmd_ds_command { struct cmd_ds_bt_access bt; struct cmd_ds_fwt_access fwt; struct cmd_ds_mesh_access mesh; - struct cmd_ds_set_boot2_ver boot2_ver; struct cmd_ds_get_tsf gettsf; struct cmd_ds_802_11_subscribe_event subscribe_event; struct cmd_ds_802_11_beacon_control bcn_ctrl; -- cgit v1.2.3 From a8bdcd71fd33e4a919f9f0cb32207c644b70853f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 12:40:35 -0500 Subject: libertas: add simple copyback command callback A simple callback which copies the response back into the command buffer that was used to send the command to the card. Will allow for direct command processing outside the mega-switches in cmd.c and cmdresp.c. Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 29 ++++++++++++++++++++++++++++- drivers/net/wireless/libertas/cmd.h | 7 +++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 78870c77042..c4b32a05de1 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1971,6 +1971,34 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) } +/** + * @brief Simple callback that copies response back into command + * + * @param priv A pointer to struct lbs_private structure + * @param extra A pointer to the original command structure for which + * 'resp' is a response + * @param resp A pointer to the command response + * + * @return 0 on success, error on failure + */ +int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, + struct cmd_header *resp) +{ + struct cmd_header *buf = (void *)extra; + uint16_t copy_len; + + lbs_deb_enter(LBS_DEB_CMD); + + copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size)); + lbs_deb_cmd("Copying back %u bytes; command response was %u bytes, " + "copy back buffer was %u bytes", copy_len, resp->size, + buf->size); + memcpy(buf, resp, copy_len); + + lbs_deb_leave(LBS_DEB_CMD); + return 0; +} + /** * @brief Simple way to call firmware functions * @@ -1987,7 +2015,6 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * @return -1 in case of a higher level error, otherwise * the result code from the firmware */ - int __lbs_cmd(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 259d3e87193..72857a1a248 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -10,9 +10,16 @@ __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \ callback, callback_arg) +#define lbs_cmd_with_response(priv, cmdnr, cmd) \ + __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \ + lbs_cmd_copyback, (unsigned long) &cmd) + int __lbs_cmd(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg); +int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, + struct cmd_header *resp); + #endif /* _LBS_CMD_H */ -- cgit v1.2.3 From 6e66f03ff78b23d845920739373b1561c546b13f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 12:42:16 -0500 Subject: libertas: convert GET_HW_SPEC to a direct command Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 76 +++++++++++++++++++++++++++++---- drivers/net/wireless/libertas/cmd.h | 2 + drivers/net/wireless/libertas/cmdresp.c | 67 ----------------------------- drivers/net/wireless/libertas/hostcmd.h | 3 +- drivers/net/wireless/libertas/main.c | 6 +-- 5 files changed, 73 insertions(+), 81 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index c4b32a05de1..bb940cce3a7 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -11,6 +11,7 @@ #include "dev.h" #include "join.h" #include "wext.h" +#include "cmd.h" static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode); struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); @@ -36,18 +37,78 @@ static u8 is_command_allowed_in_ps(u16 cmd) return 0; } -static int lbs_cmd_hw_spec(struct lbs_private *priv, struct cmd_ds_command *cmd) +/** + * @brief Updates the hardware details like MAC address and regulatory region + * + * @param priv A pointer to struct lbs_private structure + * + * @return 0 on success, error on failure + */ +int lbs_update_hw_spec(struct lbs_private *priv) { - struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; + struct cmd_ds_get_hw_spec cmd; + int ret = -1; + u32 i; + DECLARE_MAC_BUF(mac); lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_GET_HW_SPEC); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); - memcpy(hwspec->permanentaddr, priv->current_addr, ETH_ALEN); + memset(&cmd, 0, sizeof(cmd)); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); + ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, cmd); + if (ret) + goto out; + + priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); + memcpy(priv->fwreleasenumber, cmd.fwreleasenumber, 4); + + lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", + priv->fwreleasenumber[2], priv->fwreleasenumber[1], + priv->fwreleasenumber[0], priv->fwreleasenumber[3]); + lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", + print_mac(mac, cmd.permanentaddr)); + lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", + cmd.hwifversion, cmd.version); + + /* Clamp region code to 8-bit since FW spec indicates that it should + * only ever be 8-bit, even though the field size is 16-bit. Some firmware + * returns non-zero high 8 bits here. + */ + priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; + + for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { + /* use the region code to search for the index */ + if (priv->regioncode == lbs_region_code_to_index[i]) + break; + } + /* if it's unidentified region code, use the default (USA) */ + if (i >= MRVDRV_MAX_REGION_CODE) { + priv->regioncode = 0x10; + lbs_pr_info("unidentified region code; using the default (USA)\n"); + } + + if (priv->current_addr[0] == 0xff) + memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); + + memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); + if (priv->mesh_dev) + memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); + + if (lbs_set_regiontable(priv, priv->regioncode, 0)) { + ret = -1; + goto out; + } + + if (lbs_set_universaltable(priv, 0)) { + ret = -1; + goto out; + } + +out: lbs_deb_leave(LBS_DEB_CMD); - return 0; + return ret; } static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv, @@ -1223,9 +1284,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdptr->result = 0; switch (cmd_no) { - case CMD_GET_HW_SPEC: - ret = lbs_cmd_hw_spec(priv, cmdptr); - break; case CMD_802_11_PS_MODE: ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action); break; diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 72857a1a248..b8e5d21329a 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -22,4 +22,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, struct cmd_header *resp); +int lbs_update_hw_spec(struct lbs_private *priv); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 91136697f69..671e323764c 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -145,69 +145,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv, return ret; } -static int lbs_ret_get_hw_spec(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - u32 i; - struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; - int ret = 0; - DECLARE_MAC_BUF(mac); - - lbs_deb_enter(LBS_DEB_CMD); - - priv->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); - - memcpy(priv->fwreleasenumber, hwspec->fwreleasenumber, 4); - - lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", - priv->fwreleasenumber[2], priv->fwreleasenumber[1], - priv->fwreleasenumber[0], priv->fwreleasenumber[3]); - lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", - print_mac(mac, hwspec->permanentaddr)); - lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", - hwspec->hwifversion, hwspec->version); - - /* Clamp region code to 8-bit since FW spec indicates that it should - * only ever be 8-bit, even though the field size is 16-bit. Some firmware - * returns non-zero high 8 bits here. - */ - priv->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF; - - for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { - /* use the region code to search for the index */ - if (priv->regioncode == lbs_region_code_to_index[i]) { - break; - } - } - - /* if it's unidentified region code, use the default (USA) */ - if (i >= MRVDRV_MAX_REGION_CODE) { - priv->regioncode = 0x10; - lbs_pr_info("unidentified region code; using the default (USA)\n"); - } - - if (priv->current_addr[0] == 0xff) - memmove(priv->current_addr, hwspec->permanentaddr, ETH_ALEN); - - memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); - if (priv->mesh_dev) - memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); - - if (lbs_set_regiontable(priv, priv->regioncode, 0)) { - ret = -1; - goto done; - } - - if (lbs_set_universaltable(priv, 0)) { - ret = -1; - goto done; - } - -done: - lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, struct cmd_ds_command *resp) { @@ -569,10 +506,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ret = lbs_ret_reg_access(priv, respcmd, resp); break; - case CMD_RET(CMD_GET_HW_SPEC): - ret = lbs_ret_get_hw_spec(priv, resp); - break; - case CMD_RET(CMD_802_11_SCAN): ret = lbs_ret_80211_scan(priv, resp); break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 93ac46a05c5..a87c2174bbf 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -119,6 +119,8 @@ struct cmd_ds_gen { * This structure defines the response for the GET_HW_SPEC command */ struct cmd_ds_get_hw_spec { + struct cmd_header hdr; + /* HW Interface version number */ __le16 hwifversion; /* HW version number */ @@ -637,7 +639,6 @@ struct cmd_ds_command { /* command Body */ union { - struct cmd_ds_get_hw_spec hwspec; struct cmd_ds_802_11_ps_mode psmode; struct cmd_ds_802_11_scan scan; struct cmd_ds_802_11_scan_rsp scanresp; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9a231099212..9f6c119c2d1 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -22,6 +22,7 @@ #include "debugfs.h" #include "assoc.h" #include "join.h" +#include "cmd.h" #define DRIVER_RELEASE_VERSION "323.p0" const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION @@ -843,10 +844,7 @@ static int lbs_setup_firmware(struct lbs_private *priv) * Read MAC address from HW */ memset(priv->current_addr, 0xff, ETH_ALEN); - - ret = lbs_prepare_and_send_command(priv, CMD_GET_HW_SPEC, - 0, CMD_OPTION_WAITFORRSP, 0, NULL); - + ret = lbs_update_hw_spec(priv); if (ret) { ret = -1; goto done; -- cgit v1.2.3 From 6bc822b5164e66ab9b93f96172df8902bfd37618 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 12:53:43 -0500 Subject: libertas: switch USB cardp->priv to 'struct lbs_private *' and resulting fix Amazing what interesting things the compiler will tell you if you let it know what types you expect to be passing around. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 2 +- drivers/net/wireless/libertas/if_usb.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index a086653803f..6cd6c962937 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -1003,7 +1003,7 @@ static int if_usb_resume(struct usb_interface *intf) cardp->rx_urb_recall = 0; - if_usb_submit_rx_urb(cardp->priv); + if_usb_submit_rx_urb(cardp); netif_device_attach(cardp->eth_dev); netif_device_attach(priv->mesh_dev); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 224c957e292..f028df1d018 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -4,6 +4,8 @@ #include #include +struct lbs_private; + /** * This file contains definition for USB interface. */ @@ -48,7 +50,7 @@ struct usb_card_rec { struct net_device *eth_dev; struct usb_device *udev; struct urb *rx_urb, *tx_urb; - void *priv; + struct lbs_private *priv; struct read_cb_info rinfo; int bulk_in_size; -- cgit v1.2.3 From 10bca0d5f4829a8acd9a7a51cb7b35e38b23280a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 12:54:43 -0500 Subject: libertas: move removal of lbs_rtap file to lbs_stop_card() This prevents us from trying to remove it when it didn't exist, in the error case. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9f6c119c2d1..212cce34227 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1089,7 +1089,6 @@ int lbs_remove_card(struct lbs_private *priv) lbs_remove_rtap(priv); dev = priv->dev; - device_remove_file(&dev->dev, &dev_attr_lbs_rtap); cancel_delayed_work(&priv->scan_work); cancel_delayed_work(&priv->assoc_work); @@ -1167,6 +1166,7 @@ int lbs_stop_card(struct lbs_private *priv) netif_carrier_off(priv->dev); lbs_debugfs_remove_one(priv); + device_remove_file(&dev->dev, &dev_attr_lbs_rtap); /* Flush pending command nodes */ spin_lock_irqsave(&priv->driver_lock, flags); -- cgit v1.2.3 From c9cd6f9d630c4422d5f7eb8018b28846e25dba20 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 13:15:25 -0500 Subject: libertas: wait for 'firmware ready' event from firmware after loading Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/host.h | 1 + drivers/net/wireless/libertas/if_usb.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 4828bbf6639..b23af194b42 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -304,5 +304,6 @@ enum cmd_mesh_access_opts { #define MACREG_INT_CODE_RSSI_HIGH 28 #define MACREG_INT_CODE_SNR_HIGH 29 #define MACREG_INT_CODE_MESH_AUTO_STARTED 35 +#define MACREG_INT_CODE_FIRMWARE_READY 48 #endif diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 6cd6c962937..c94b6dfa20f 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -230,6 +230,7 @@ static int if_usb_probe(struct usb_interface *intf, goto err_prog_firmware; cardp->priv = priv; + cardp->priv->fw_ready = 1; if (lbs_add_mesh(priv, &udev->dev)) goto err_add_mesh; @@ -241,10 +242,7 @@ static int if_usb_probe(struct usb_interface *intf, priv->hw_read_event_cause = if_usb_read_event_cause; priv->boot2_version = udev->descriptor.bcdDevice; - /* Delay 200 ms to waiting for the FW ready */ if_usb_submit_rx_urb(cardp); - msleep_interruptible(200); - priv->fw_ready = 1; if (lbs_start_card(priv)) goto err_start_card; @@ -514,6 +512,21 @@ static void if_usb_receive_fwload(struct urb *urb) return; } + if (cardp->fwdnldover) { + __le32 *tmp = (__le32 *)(skb->data + IPFIELD_ALIGN_OFFSET); + + if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && + tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { + lbs_pr_info("Firmware ready event received\n"); + wake_up(&cardp->fw_wq); + } else { + lbs_deb_usb("Waiting for confirmation; got %x %x\n", le32_to_cpu(tmp[0]), + le32_to_cpu(tmp[1])); + if_usb_submit_rx_urb_fwload(cardp); + } + kfree_skb(skb); + return; + } if (cardp->bootcmdresp <= 0) { memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, sizeof(bootcmdresp)); @@ -529,7 +542,8 @@ static void if_usb_receive_fwload(struct urb *urb) if (bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_REQUEST) || bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_DATA) || bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_INDICATION)) { - lbs_pr_info("Firmware already seems alive; resetting\n"); + if (!cardp->bootcmdresp) + lbs_pr_info("Firmware already seems alive; resetting\n"); cardp->bootcmdresp = -1; } else { lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", @@ -590,8 +604,9 @@ static void if_usb_receive_fwload(struct urb *urb) if_usb_send_fw_pkt(cardp); - if_usb_submit_rx_urb_fwload(cardp); exit: + if_usb_submit_rx_urb_fwload(cardp); + kfree(syncfwheader); return; @@ -934,6 +949,7 @@ restart: wait_event_interruptible(cardp->fw_wq, cardp->surprise_removed || cardp->fwdnldover); del_timer_sync(&cardp->fw_timeout); + usb_kill_urb(cardp->rx_urb); if (!cardp->fwdnldover) { lbs_pr_info("failed to load fw, resetting device!\n"); -- cgit v1.2.3 From ddac452680a5164bb47d61ea54f596ddaf3aea7d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 13:49:39 -0500 Subject: libertas: rename and re-type bufvirtualaddr to cmdbuf Make it a struct cmd_header, since that's what it is, and clean up the places that it's used. Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 133 ++++++++++++++------------------ drivers/net/wireless/libertas/cmdresp.c | 14 ++-- drivers/net/wireless/libertas/defs.h | 4 +- drivers/net/wireless/libertas/hostcmd.h | 2 +- drivers/net/wireless/libertas/if_cs.c | 4 +- drivers/net/wireless/libertas/if_sdio.c | 4 +- drivers/net/wireless/libertas/if_usb.c | 4 +- drivers/net/wireless/libertas/main.c | 14 ++-- 8 files changed, 79 insertions(+), 100 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index bb940cce3a7..79a8d0d48bf 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1028,24 +1028,18 @@ void lbs_queue_cmd(struct lbs_private *priv, u8 addtail) { unsigned long flags; - struct cmd_ds_command *cmdptr; lbs_deb_enter(LBS_DEB_HOST); - if (!cmdnode) { - lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n"); - goto done; - } - - cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; - if (!cmdptr) { - lbs_deb_host("QUEUE_CMD: cmdptr is NULL\n"); + if (!cmdnode || !cmdnode->cmdbuf) { + lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n"); goto done; } /* Exit_PS command needs to be queued in the header always. */ - if (le16_to_cpu(cmdptr->command) == CMD_802_11_PS_MODE) { - struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; + if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { + struct cmd_ds_802_11_ps_mode *psm = (void *) cmdnode->cmdbuf; + if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { if (priv->psstate != PS_STATE_FULL_POWER) addtail = 0; @@ -1062,7 +1056,7 @@ void lbs_queue_cmd(struct lbs_private *priv, spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", - le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command)); + le16_to_cpu(cmdnode->cmdbuf->command)); done: lbs_deb_leave(LBS_DEB_HOST); @@ -1079,7 +1073,7 @@ static int DownloadcommandToStation(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode) { unsigned long flags; - struct cmd_ds_command *cmdptr; + struct cmd_header *cmd; int ret = -1; u16 cmdsize; u16 command; @@ -1091,10 +1085,10 @@ static int DownloadcommandToStation(struct lbs_private *priv, goto done; } - cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; + cmd = cmdnode->cmdbuf; spin_lock_irqsave(&priv->driver_lock, flags); - if (!cmdptr || !cmdptr->size) { + if (!cmd || !cmd->size) { lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n"); __lbs_cleanup_and_insert_cmd(priv, cmdnode); spin_unlock_irqrestore(&priv->driver_lock, flags); @@ -1105,16 +1099,16 @@ static int DownloadcommandToStation(struct lbs_private *priv, priv->cur_cmd_retcode = 0; spin_unlock_irqrestore(&priv->driver_lock, flags); - cmdsize = le16_to_cpu(cmdptr->size); - command = le16_to_cpu(cmdptr->command); + cmdsize = le16_to_cpu(cmd->size); + command = le16_to_cpu(cmd->command); lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n", command, cmdsize, jiffies); - lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize); + lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); cmdnode->cmdwaitqwoken = 0; - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); + ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); if (ret != 0) { lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n"); @@ -1265,7 +1259,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf); - cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; + cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no); @@ -1556,41 +1550,35 @@ EXPORT_SYMBOL_GPL(lbs_prepare_and_send_command); int lbs_allocate_cmd_buffer(struct lbs_private *priv) { int ret = 0; - u32 ulbufsize; + u32 bufsize; u32 i; - struct cmd_ctrl_node *tempcmd_array; - u8 *ptempvirtualaddr; + struct cmd_ctrl_node *cmdarray; lbs_deb_enter(LBS_DEB_HOST); - /* Allocate and initialize cmdCtrlNode */ - ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; - - if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) { + /* Allocate and initialize the command array */ + bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; + if (!(cmdarray = kzalloc(bufsize, GFP_KERNEL))) { lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n"); ret = -1; goto done; } - priv->cmd_array = tempcmd_array; + priv->cmd_array = cmdarray; - /* Allocate and initialize command buffers */ - ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; - for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { - if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) { + /* Allocate and initialize each command buffer in the command array */ + for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { + cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); + if (!cmdarray[i].cmdbuf) { lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); ret = -1; goto done; } - - /* Update command buffer virtual */ - tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr; } - for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { - init_waitqueue_head(&tempcmd_array[i].cmdwait_q); - lbs_cleanup_and_insert_cmd(priv, &tempcmd_array[i]); + for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { + init_waitqueue_head(&cmdarray[i].cmdwait_q); + lbs_cleanup_and_insert_cmd(priv, &cmdarray[i]); } - ret = 0; done: @@ -1606,9 +1594,8 @@ done: */ int lbs_free_cmd_buffer(struct lbs_private *priv) { - u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ + struct cmd_ctrl_node *cmdarray; unsigned int i; - struct cmd_ctrl_node *tempcmd_array; lbs_deb_enter(LBS_DEB_HOST); @@ -1618,14 +1605,13 @@ int lbs_free_cmd_buffer(struct lbs_private *priv) goto done; } - tempcmd_array = priv->cmd_array; + cmdarray = priv->cmd_array; /* Release shared memory buffers */ - ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; - for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { - if (tempcmd_array[i].bufvirtualaddr) { - kfree(tempcmd_array[i].bufvirtualaddr); - tempcmd_array[i].bufvirtualaddr = NULL; + for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { + if (cmdarray[i].cmdbuf) { + kfree(cmdarray[i].cmdbuf); + cmdarray[i].cmdbuf = NULL; } } @@ -1683,21 +1669,21 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) * @param ptempnode A pointer to cmdCtrlNode structure * @return n/a */ -static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) +static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) { lbs_deb_enter(LBS_DEB_HOST); - if (!ptempnode) + if (!cmdnode) return; - ptempnode->cmdwaitqwoken = 1; - wake_up_interruptible(&ptempnode->cmdwait_q); - ptempnode->wait_option = 0; - ptempnode->pdata_buf = NULL; - ptempnode->callback = NULL; - ptempnode->callback_arg = 0; + cmdnode->cmdwaitqwoken = 1; + wake_up_interruptible(&cmdnode->cmdwait_q); + cmdnode->wait_option = 0; + cmdnode->pdata_buf = NULL; + cmdnode->callback = NULL; + cmdnode->callback_arg = 0; - if (ptempnode->bufvirtualaddr != NULL) - memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); + if (cmdnode->cmdbuf != NULL) + memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); lbs_deb_leave(LBS_DEB_HOST); } @@ -1739,7 +1725,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv, int lbs_execute_next_command(struct lbs_private *priv) { struct cmd_ctrl_node *cmdnode = NULL; - struct cmd_ds_command *cmdptr; + struct cmd_header *cmd; unsigned long flags; int ret = 0; @@ -1765,22 +1751,21 @@ int lbs_execute_next_command(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); if (cmdnode) { - cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; + cmd = cmdnode->cmdbuf; - if (is_command_allowed_in_ps(le16_to_cpu(cmdptr->command))) { + if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) { if ((priv->psstate == PS_STATE_SLEEP) || (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n", - le16_to_cpu(cmdptr->command), + le16_to_cpu(cmd->command), priv->psstate); ret = -1; goto done; } lbs_deb_host("EXEC_NEXT_CMD: OK to send command " - "0x%04x in psstate %d\n", - le16_to_cpu(cmdptr->command), - priv->psstate); + "0x%04x in psstate %d\n", + le16_to_cpu(cmd->command), priv->psstate); } else if (priv->psstate != PS_STATE_FULL_POWER) { /* * 1. Non-PS command: @@ -1793,8 +1778,7 @@ int lbs_execute_next_command(struct lbs_private *priv) * otherwise send this command down to firmware * immediately. */ - if (cmdptr->command != - cpu_to_le16(CMD_802_11_PS_MODE)) { + if (cmd->command != cpu_to_le16(CMD_802_11_PS_MODE)) { /* Prepare to send Exit PS, * this non PS command will be sent later */ if ((priv->psstate == PS_STATE_SLEEP) @@ -1813,8 +1797,7 @@ int lbs_execute_next_command(struct lbs_private *priv) * PS command. Ignore it if it is not Exit_PS. * otherwise send it down immediately. */ - struct cmd_ds_802_11_ps_mode *psm = - &cmdptr->params.psmode; + struct cmd_ds_802_11_ps_mode *psm = (void *)cmd; lbs_deb_host( "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", @@ -1848,7 +1831,7 @@ int lbs_execute_next_command(struct lbs_private *priv) } list_del(&cmdnode->list); lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", - le16_to_cpu(cmdptr->command)); + le16_to_cpu(cmd->command)); DownloadcommandToStation(priv, cmdnode); } else { /* @@ -2079,7 +2062,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, unsigned long callback_arg) { struct cmd_ctrl_node *cmdnode; - struct cmd_header *send_cmd; unsigned long flags; int ret = 0; @@ -2107,20 +2089,19 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, goto done; } - send_cmd = (struct cmd_header *) cmdnode->bufvirtualaddr; cmdnode->wait_option = CMD_OPTION_WAITFORRSP; cmdnode->callback = callback; cmdnode->callback_arg = callback_arg; /* Copy the incoming command to the buffer */ - memcpy(send_cmd, in_cmd, in_cmd_size); + memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); /* Set sequence number, clean result, move to buffer */ priv->seqnum++; - send_cmd->command = cpu_to_le16(command); - send_cmd->size = cpu_to_le16(in_cmd_size); - send_cmd->seqnum = cpu_to_le16(priv->seqnum); - send_cmd->result = 0; + cmdnode->cmdbuf->command = cpu_to_le16(command); + cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); + cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); + cmdnode->cmdbuf->result = 0; lbs_deb_host("PREP_CMD: command 0x%04x\n", command); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 671e323764c..b4cd7b79f54 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -491,8 +491,9 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, static inline int handle_cmd_response(struct lbs_private *priv, unsigned long dummy, - struct cmd_ds_command *resp) + struct cmd_header *cmd_response) { + struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; int ret = 0; unsigned long flags; uint16_t respcmd = le16_to_cpu(resp->command); @@ -673,7 +674,7 @@ static inline int handle_cmd_response(struct lbs_private *priv, int lbs_process_rx_command(struct lbs_private *priv) { u16 respcmd; - struct cmd_ds_command *resp; + struct cmd_header *resp; int ret = 0; ulong flags; u16 result; @@ -692,15 +693,14 @@ int lbs_process_rx_command(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } - resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr); + resp = priv->cur_cmd->cmdbuf; respcmd = le16_to_cpu(resp->command); result = le16_to_cpu(resp->result); lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n", respcmd, priv->upld_len, jiffies); - lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", priv->cur_cmd->bufvirtualaddr, - priv->upld_len); + lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len); if (!(respcmd & 0x8000)) { lbs_deb_host("invalid response!\n"); @@ -716,7 +716,7 @@ int lbs_process_rx_command(struct lbs_private *priv) priv->cur_cmd_retcode = result; if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { - struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; + struct cmd_ds_802_11_ps_mode *psmode = (void *) resp; u16 action = le16_to_cpu(psmode->action); lbs_deb_host( @@ -796,7 +796,7 @@ int lbs_process_rx_command(struct lbs_private *priv) if (priv->cur_cmd && priv->cur_cmd->callback) { ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, - (struct cmd_header *) resp); + resp); } else ret = handle_cmd_response(priv, 0, resp); diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 04db6af72a5..9b98ae720bc 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h @@ -132,8 +132,8 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in */ #define MRVDRV_MAX_MULTICAST_LIST_SIZE 32 -#define MRVDRV_NUM_OF_CMD_BUFFER 10 -#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) +#define LBS_NUM_CMD_BUFFERS 10 +#define LBS_CMD_BUFFER_SIZE (2 * 1024) #define MRVDRV_MAX_CHANNEL_SIZE 14 #define MRVDRV_ASSOCIATION_TIME_OUT 255 #define MRVDRV_SNAP_HEADER_LEN 8 diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index a87c2174bbf..e5e2106cd5a 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -81,7 +81,7 @@ struct cmd_ctrl_node { int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); unsigned long callback_arg; /* command data */ - u8 *bufvirtualaddr; + struct cmd_header *cmdbuf; /* wait queue */ u16 cmdwaitqwoken; wait_queue_head_t cmdwait_q; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 2acbe5dcff7..58143637c73 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -364,7 +364,7 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) } *len = if_cs_read16(priv->card, IF_CS_C_CMD_LEN); - if ((*len == 0) || (*len > MRVDRV_SIZE_OF_CMD_BUFFER)) { + if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) { lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len); goto out; } @@ -683,7 +683,7 @@ sbi_get_int_status_exit: cmdbuf = priv->upld_buf; priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY; } else { - cmdbuf = priv->cur_cmd->bufvirtualaddr; + cmdbuf = (u8 *) priv->cur_cmd->cmdbuf; } ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len); diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 1ed72b9b6bf..7f829c86c45 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -142,14 +142,14 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, goto out; } - if (size > MRVDRV_SIZE_OF_CMD_BUFFER) { + if (size > LBS_CMD_BUFFER_SIZE) { lbs_deb_sdio("response packet too large (%d bytes)\n", (int)size); ret = -E2BIG; goto out; } - memcpy(card->priv->cur_cmd->bufvirtualaddr, buffer, size); + memcpy(card->priv->cur_cmd->cmdbuf, buffer, size); card->priv->upld_len = size; card->int_cause |= MRVDRV_CMD_UPLD_RDY; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index c94b6dfa20f..5f2d944312a 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -639,7 +639,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, struct lbs_private *priv) { u8 *cmdbuf; - if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { + if (recvlength > LBS_CMD_BUFFER_SIZE) { lbs_deb_usbd(&cardp->udev->dev, "The receive buffer is too large\n"); kfree_skb(skb); @@ -656,7 +656,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, cmdbuf = priv->upld_buf; priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; } else - cmdbuf = priv->cur_cmd->bufvirtualaddr; + cmdbuf = (u8 *) priv->cur_cmd->cmdbuf; cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 212cce34227..a081b91fb9b 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -890,23 +890,21 @@ done: static void command_timer_fn(unsigned long data) { struct lbs_private *priv = (struct lbs_private *)data; - struct cmd_ctrl_node *ptempnode; - struct cmd_ds_command *cmd; + struct cmd_ctrl_node *node; unsigned long flags; - ptempnode = priv->cur_cmd; - if (ptempnode == NULL) { + node = priv->cur_cmd; + if (node == NULL) { lbs_deb_fw("ptempnode empty\n"); return; } - cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; - if (!cmd) { + if (!node->cmdbuf) { lbs_deb_fw("cmd is NULL\n"); return; } - lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command); + lbs_deb_fw("command_timer_fn fired, cmd %x\n", node->cmdbuf->command); if (!priv->fw_ready) return; @@ -916,7 +914,7 @@ static void command_timer_fn(unsigned long data) spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_fw("re-sending same command because of timeout\n"); - lbs_queue_cmd(priv, ptempnode, 0); + lbs_queue_cmd(priv, node, 0); wake_up_interruptible(&priv->waitq); -- cgit v1.2.3 From ad9d7a7f3cc73a6288920cc17c807f56bd8327fc Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 15:22:27 -0500 Subject: libertas: fix debug output in lbs_cmd_copyback() function. Bad dcbw. Always test on big-endian, or at least use sparse. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 79a8d0d48bf..eeb09e05903 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -2023,7 +2023,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) * @return 0 on success, error on failure */ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp) + struct cmd_header *resp) { struct cmd_header *buf = (void *)extra; uint16_t copy_len; @@ -2032,8 +2032,8 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size)); lbs_deb_cmd("Copying back %u bytes; command response was %u bytes, " - "copy back buffer was %u bytes", copy_len, resp->size, - buf->size); + "copy back buffer was %u bytes\n", copy_len, + le16_to_cpu(resp->size), le16_to_cpu(buf->size)); memcpy(buf, resp, copy_len); lbs_deb_leave(LBS_DEB_CMD); -- cgit v1.2.3 From 301eacbf30e33f461701df91cb250d3fc24c5fe5 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 15:23:59 -0500 Subject: libertas: convert CMD_MESH_ACCESS to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 28 +++++++++-------------- drivers/net/wireless/libertas/cmd.h | 3 +++ drivers/net/wireless/libertas/cmdresp.c | 5 ----- drivers/net/wireless/libertas/hostcmd.h | 3 ++- drivers/net/wireless/libertas/if_usb.c | 11 +++------ drivers/net/wireless/libertas/main.c | 40 ++++++++++++++++----------------- 6 files changed, 39 insertions(+), 51 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index eeb09e05903..9d621fe7f08 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -976,27 +976,25 @@ static int lbs_cmd_fwt_access(struct lbs_private *priv, return 0; } -static int lbs_cmd_mesh_access(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) +int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, + struct cmd_ds_mesh_access *cmd) { - struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; + int ret; + lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); - cmd->command = cpu_to_le16(CMD_MESH_ACCESS); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); - cmd->result = 0; + cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); + cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); + cmd->hdr.result = 0; - if (pdata_buf) - memcpy(mesh_access, pdata_buf, sizeof(*mesh_access)); - else - memset(mesh_access, 0, sizeof(*mesh_access)); + cmd->action = cpu_to_le16(cmd_action); - mesh_access->action = cpu_to_le16(cmd_action); + ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, (*cmd)); lbs_deb_leave(LBS_DEB_CMD); - return 0; + return ret; } +EXPORT_SYMBOL_GPL(lbs_mesh_access); static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, struct cmd_ds_command *cmd, @@ -1486,10 +1484,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf); break; - case CMD_MESH_ACCESS: - ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf); - break; - case CMD_GET_TSF: cmdptr->command = cpu_to_le16(CMD_GET_TSF); cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index b8e5d21329a..716f25be5b3 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -24,4 +24,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, int lbs_update_hw_spec(struct lbs_private *priv); +int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, + struct cmd_ds_mesh_access *cmd); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index b4cd7b79f54..6ff705b49dd 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -653,11 +653,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, sizeof(resp->params.fwt)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; - case CMD_RET(CMD_MESH_ACCESS): - if (priv->cur_cmd->pdata_buf) - memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh, - sizeof(resp->params.mesh)); - break; case CMD_RET(CMD_802_11_BEACON_CTRL): ret = lbs_ret_802_11_bcn_ctrl(priv, resp); break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index e5e2106cd5a..d9b151a2880 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -623,6 +623,8 @@ struct cmd_ds_fwt_access { } __attribute__ ((packed)); struct cmd_ds_mesh_access { + struct cmd_header hdr; + __le16 action; __le32 data[32]; /* last position reserved */ } __attribute__ ((packed)); @@ -687,7 +689,6 @@ struct cmd_ds_command { struct cmd_tx_rate_query txrate; struct cmd_ds_bt_access bt; struct cmd_ds_fwt_access fwt; - struct cmd_ds_mesh_access mesh; struct cmd_ds_get_tsf gettsf; struct cmd_ds_802_11_subscribe_event subscribe_event; struct cmd_ds_802_11_beacon_control bcn_ctrl; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 5f2d944312a..a0866efb964 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -990,11 +990,9 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) */ struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); + mesh_access.data[0] = cpu_to_le32(1); - lbs_prepare_and_send_command(priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); } netif_device_detach(cardp->eth_dev); @@ -1031,10 +1029,7 @@ static int if_usb_resume(struct usb_interface *intf) struct cmd_ds_mesh_access mesh_access; memset(&mesh_access, 0, sizeof(mesh_access)); mesh_access.data[0] = cpu_to_le32(0); - lbs_prepare_and_send_command(priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); } lbs_deb_leave(LBS_DEB_USB); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index a081b91fb9b..7f6b3ccef0c 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -217,13 +217,15 @@ u8 lbs_data_rate_to_fw_index(u32 rate) static ssize_t lbs_anycast_get(struct device *dev, struct device_attribute *attr, char * buf) { + struct lbs_private *priv = to_net_dev(dev)->priv; struct cmd_ds_mesh_access mesh_access; + int ret; memset(&mesh_access, 0, sizeof(mesh_access)); - lbs_prepare_and_send_command(to_net_dev(dev)->priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_GET_ANYCAST, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + + ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access); + if (ret) + return ret; return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0])); } @@ -234,17 +236,19 @@ static ssize_t lbs_anycast_get(struct device *dev, static ssize_t lbs_anycast_set(struct device *dev, struct device_attribute *attr, const char * buf, size_t count) { + struct lbs_private *priv = to_net_dev(dev)->priv; struct cmd_ds_mesh_access mesh_access; uint32_t datum; + int ret; memset(&mesh_access, 0, sizeof(mesh_access)); sscanf(buf, "%x", &datum); mesh_access.data[0] = cpu_to_le32(datum); - lbs_prepare_and_send_command((to_net_dev(dev))->priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_SET_ANYCAST, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access); + if (ret) + return ret; + return strlen(buf); } @@ -323,14 +327,15 @@ static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); static ssize_t lbs_autostart_enabled_get(struct device *dev, struct device_attribute *attr, char * buf) { + struct lbs_private *priv = to_net_dev(dev)->priv; struct cmd_ds_mesh_access mesh_access; + int ret; memset(&mesh_access, 0, sizeof(mesh_access)); - lbs_prepare_and_send_command(to_net_dev(dev)->priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_GET_AUTOSTART_ENABLED, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, &mesh_access); + if (ret) + return ret; return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); } @@ -346,10 +351,7 @@ static ssize_t lbs_autostart_enabled_set(struct device *dev, sscanf(buf, "%d", &datum); mesh_access.data[0] = cpu_to_le32(datum); - ret = lbs_prepare_and_send_command(priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); if (ret == 0) priv->mesh_autostart_enabled = datum ? 1 : 0; @@ -866,10 +868,8 @@ static int lbs_setup_firmware(struct lbs_private *priv) if (priv->mesh_dev) { memset(&mesh_access, 0, sizeof(mesh_access)); mesh_access.data[0] = cpu_to_le32(0); - ret = lbs_prepare_and_send_command(priv, - CMD_MESH_ACCESS, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); + ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, + &mesh_access); if (ret) { ret = -1; goto done; -- cgit v1.2.3 From 0f1c8232e839e215e38055cd8ae79225ab178185 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 15:28:18 -0500 Subject: libertas: remove casts from lbs_cmd() and lbs_cmd_with_response() macros If stupid people like me give it arguments with the wrong type (like a pointer to the structure, for example, instead of the structure itself), then we should probably notice that at compile time. Otherwise, much confusion ensues. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 716f25be5b3..950acce3baa 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -7,11 +7,11 @@ #include "dev.h" #define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \ - __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \ + __lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ callback, callback_arg) #define lbs_cmd_with_response(priv, cmdnr, cmd) \ - __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \ + __lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ lbs_cmd_copyback, (unsigned long) &cmd) int __lbs_cmd(struct lbs_private *priv, uint16_t command, -- cgit v1.2.3 From 79a9a37c1eb13bd645ec423c0c30b70838e7bf93 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 15:29:10 -0500 Subject: libertas: fix case of FWT_ACCESS_LIST_ROUTE and FWT_ACCESS_LIST_NEIGHBOR commands Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/host.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index b23af194b42..cc5f9bf6cf2 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -247,8 +247,8 @@ enum cmd_fwt_access_opts { CMD_ACT_FWT_ACCESS_DEL, CMD_ACT_FWT_ACCESS_LOOKUP, CMD_ACT_FWT_ACCESS_LIST, - CMD_ACT_FWT_ACCESS_LIST_route, - CMD_ACT_FWT_ACCESS_LIST_neighbor, + CMD_ACT_FWT_ACCESS_LIST_ROUTE, + CMD_ACT_FWT_ACCESS_LIST_NEIGHBOR, CMD_ACT_FWT_ACCESS_RESET, CMD_ACT_FWT_ACCESS_CLEANUP, CMD_ACT_FWT_ACCESS_TIME, -- cgit v1.2.3 From 8e3c91bb70372da692a5fefae9f698c94bb1e641 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 15:50:59 -0500 Subject: libertas: convert DATA_RATE to a direct command Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 93 ++++++++++++++++++++++++++------- drivers/net/wireless/libertas/cmd.h | 3 ++ drivers/net/wireless/libertas/cmdresp.c | 23 -------- drivers/net/wireless/libertas/hostcmd.h | 3 +- drivers/net/wireless/libertas/main.c | 8 +-- drivers/net/wireless/libertas/wext.c | 9 ++-- 6 files changed, 83 insertions(+), 56 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 9d621fe7f08..eff78792fc6 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -706,30 +706,86 @@ static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, return 0; } -static int lbs_cmd_802_11_data_rate(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action) +/** + * @brief Get the current data rate + * + * @param priv A pointer to struct lbs_private structure + * + * @return The data rate on success, error on failure + */ +int lbs_get_data_rate(struct lbs_private *priv) { - struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; + struct cmd_ds_802_11_data_rate cmd; + int ret = -1; lbs_deb_enter(LBS_DEB_CMD); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + - S_DS_GEN); - cmd->command = cpu_to_le16(CMD_802_11_DATA_RATE); - memset(pdatarate, 0, sizeof(struct cmd_ds_802_11_data_rate)); - pdatarate->action = cpu_to_le16(cmd_action); - - if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) { - pdatarate->rates[0] = lbs_data_rate_to_fw_index(priv->cur_rate); - lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", - priv->cur_rate); - } else if (cmd_action == CMD_ACT_SET_TX_AUTO) { + memset(&cmd, 0, sizeof(cmd)); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(CMD_ACT_GET_TX_RATE); + + ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); + if (ret) + goto out; + + lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) &cmd, sizeof (cmd)); + + ret = (int) lbs_fw_index_to_data_rate(cmd.rates[0]); + lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", ret); + +out: + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); + return ret; +} + +/** + * @brief Set the data rate + * + * @param priv A pointer to struct lbs_private structure + * @param rate The desired data rate, or 0 to clear a locked rate + * + * @return 0 on success, error on failure + */ +int lbs_set_data_rate(struct lbs_private *priv, u8 rate) +{ + struct cmd_ds_802_11_data_rate cmd; + int ret = 0; + + lbs_deb_enter(LBS_DEB_CMD); + + memset(&cmd, 0, sizeof(cmd)); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + + if (rate > 0) { + cmd.action = cpu_to_le16(CMD_ACT_SET_TX_FIX_RATE); + cmd.rates[0] = lbs_data_rate_to_fw_index(rate); + if (cmd.rates[0] == 0) { + lbs_deb_cmd("DATA_RATE: invalid requested rate of" + " 0x%02X\n", rate); + ret = 0; + goto out; + } + lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", cmd.rates[0]); + } else { + cmd.action = cpu_to_le16(CMD_ACT_SET_TX_AUTO); lbs_deb_cmd("DATA_RATE: setting auto\n"); } - lbs_deb_leave(LBS_DEB_CMD); - return 0; + ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); + if (ret) + goto out; + + lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) &cmd, sizeof (cmd)); + + /* FIXME: get actual rates FW can do if this command actually returns + * all data rates supported. + */ + priv->cur_rate = lbs_fw_index_to_data_rate(cmd.rates[0]); + lbs_deb_cmd("DATA_RATE: current rate is 0x%02x\n", priv->cur_rate); + +out: + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); + return ret; } static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, @@ -1348,9 +1404,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_802_11_radio_control(priv, cmdptr, cmd_action); break; - case CMD_802_11_DATA_RATE: - ret = lbs_cmd_802_11_data_rate(priv, cmdptr, cmd_action); - break; case CMD_802_11_RATE_ADAPT_RATESET: ret = lbs_cmd_802_11_rate_adapt_rateset(priv, cmdptr, cmd_action); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 950acce3baa..4bd6f56281f 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -27,4 +27,7 @@ int lbs_update_hw_spec(struct lbs_private *priv); int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, struct cmd_ds_mesh_access *cmd); +int lbs_get_data_rate(struct lbs_private *priv); +int lbs_set_data_rate(struct lbs_private *priv, u8 rate); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 6ff705b49dd..797c943457e 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -325,26 +325,6 @@ static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv, return 0; } -static int lbs_ret_802_11_data_rate(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; - - lbs_deb_enter(LBS_DEB_CMD); - - lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) pdatarate, - sizeof(struct cmd_ds_802_11_data_rate)); - - /* FIXME: get actual rates FW can do if this command actually returns - * all data rates supported. - */ - priv->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); - lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", priv->cur_rate); - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - static int lbs_ret_802_11_rf_channel(struct lbs_private *priv, struct cmd_ds_command *resp) { @@ -565,9 +545,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ret = lbs_ret_802_11_enable_rsn(priv, resp); break; - case CMD_RET(CMD_802_11_DATA_RATE): - ret = lbs_ret_802_11_data_rate(priv, resp); - break; case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index d9b151a2880..d51010c47b5 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -461,6 +461,8 @@ struct PS_CMD_ConfirmSleep { }; struct cmd_ds_802_11_data_rate { + struct cmd_header hdr; + __le16 action; __le16 reserved; u8 rates[MAX_RATES]; @@ -659,7 +661,6 @@ struct cmd_ds_command { struct cmd_ds_802_11_rf_tx_power txp; struct cmd_ds_802_11_rf_antenna rant; struct cmd_ds_802_11_monitor_mode monitor; - struct cmd_ds_802_11_data_rate drate; struct cmd_ds_802_11_rate_adapt_rateset rateset; struct cmd_ds_mac_multicast_adr madr; struct cmd_ds_802_11_ad_hoc_join adj; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 7f6b3ccef0c..2fe7ad0f832 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -854,12 +854,8 @@ static int lbs_setup_firmware(struct lbs_private *priv) lbs_set_mac_packet_filter(priv); - /* Get the supported Data rates */ - ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, - CMD_ACT_GET_TX_RATE, - CMD_OPTION_WAITFORRSP, 0, NULL); - - if (ret) { + ret = lbs_get_data_rate(priv); + if (ret < 0) { ret = -1; goto done; } diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 1e0b2245db5..e44c0ce804e 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -19,6 +19,7 @@ #include "join.h" #include "wext.h" #include "assoc.h" +#include "cmd.h" static inline void lbs_postpone_association_work(struct lbs_private *priv) @@ -962,8 +963,7 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct lbs_private *priv = dev->priv; - u32 new_rate; - u16 action; + u8 new_rate = 0; int ret = -EINVAL; u8 rates[MAX_RATES + 1]; @@ -972,7 +972,6 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, /* Auto rate? */ if (vwrq->value == -1) { - action = CMD_ACT_SET_TX_AUTO; priv->auto_rate = 1; priv->cur_rate = 0; } else { @@ -989,12 +988,10 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, } priv->cur_rate = new_rate; - action = CMD_ACT_SET_TX_FIX_RATE; priv->auto_rate = 0; } - ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, - action, CMD_OPTION_WAITFORRSP, 0, NULL); + ret = lbs_set_data_rate(priv, new_rate); out: lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); -- cgit v1.2.3 From 2dd4b26264d48f10e802cc9f2d75542be5a3c7fa Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 16:54:15 -0500 Subject: libertas: convert RF_CHANNEL to a direct command Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 23 ++++++----- drivers/net/wireless/libertas/cmd.c | 71 ++++++++++++++++++++++++--------- drivers/net/wireless/libertas/cmd.h | 3 ++ drivers/net/wireless/libertas/cmdresp.c | 25 ------------ drivers/net/wireless/libertas/hostcmd.h | 10 +++-- 5 files changed, 75 insertions(+), 57 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 63bd692c723..bd9cfe118c4 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -9,6 +9,7 @@ #include "decl.h" #include "hostcmd.h" #include "host.h" +#include "cmd.h" static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; @@ -165,11 +166,14 @@ done: static int update_channel(struct lbs_private *priv) { int ret; + /* the channel in f/w could be out of sync, get the current channel */ lbs_deb_enter(LBS_DEB_ASSOC); - ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, - CMD_OPT_802_11_RF_CHANNEL_GET, - CMD_OPTION_WAITFORRSP, 0, NULL); + + ret = lbs_get_channel(priv); + if (ret > 0) + priv->curbssparams.channel = (u8) ret; + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } @@ -203,17 +207,16 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_assoc("ASSOC: channel: %d -> %d\n", priv->curbssparams.channel, assoc_req->channel); - ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, - CMD_OPT_802_11_RF_CHANNEL_SET, - CMD_OPTION_WAITFORRSP, 0, &assoc_req->channel); - if (ret < 0) { + ret = lbs_set_channel(priv, assoc_req->channel); + if (ret < 0) lbs_deb_assoc("ASSOC: channel: error setting channel."); - } + /* FIXME: shouldn't need to grab the channel _again_ after setting + * it since the firmware is supposed to return the new channel, but + * whatever... */ ret = update_channel(priv); - if (ret < 0) { + if (ret < 0) lbs_deb_assoc("ASSOC: channel: error getting channel."); - } if (assoc_req->channel != priv->curbssparams.channel) { lbs_deb_assoc("ASSOC: channel: failed to update channel to %d", diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index eff78792fc6..32f9f880a15 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -810,25 +810,65 @@ static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, return 0; } -static int lbs_cmd_802_11_rf_channel(struct lbs_private *priv, - struct cmd_ds_command *cmd, - int option, void *pdata_buf) +/** + * @brief Get the radio channel + * + * @param priv A pointer to struct lbs_private structure + * + * @return The channel on success, error on failure + */ +int lbs_get_channel(struct lbs_private *priv) { - struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; + struct cmd_ds_802_11_rf_channel cmd; + int ret = 0; lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_802_11_RF_CHANNEL); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) + - S_DS_GEN); - if (option == CMD_OPT_802_11_RF_CHANNEL_SET) { - rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); - } + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); - rfchan->action = cpu_to_le16(option); + ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); + if (ret) + goto out; - lbs_deb_leave(LBS_DEB_CMD); - return 0; + lbs_deb_cmd("current radio channel is %d\n", cmd.channel); + ret = (int) cmd.channel; + +out: + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); + return ret; +} + +/** + * @brief Set the radio channel + * + * @param priv A pointer to struct lbs_private structure + * @param channel The desired channel, or 0 to clear a locked channel + * + * @return 0 on success, error on failure + */ +int lbs_set_channel(struct lbs_private *priv, u8 channel) +{ + struct cmd_ds_802_11_rf_channel cmd; + u8 old_channel = priv->curbssparams.channel; + int ret = 0; + + lbs_deb_enter(LBS_DEB_CMD); + + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); + cmd.channel = cpu_to_le16(channel); + + ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); + if (ret) + goto out; + + priv->curbssparams.channel = cmd.channel; + lbs_deb_cmd("channel switch from %d to %d\n", old_channel, cmd.channel); + +out: + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); + return ret; } static int lbs_cmd_802_11_rssi(struct lbs_private *priv, @@ -1390,11 +1430,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); break; - case CMD_802_11_RF_CHANNEL: - ret = lbs_cmd_802_11_rf_channel(priv, cmdptr, - cmd_action, pdata_buf); - break; - case CMD_802_11_RF_TX_POWER: ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr, cmd_action, pdata_buf); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 4bd6f56281f..5b02d73c8a0 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -30,4 +30,7 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, int lbs_get_data_rate(struct lbs_private *priv); int lbs_set_data_rate(struct lbs_private *priv, u8 rate); +int lbs_get_channel(struct lbs_private *priv); +int lbs_set_channel(struct lbs_private *priv, u8 channel); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 797c943457e..bf9941ecc23 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -325,28 +325,6 @@ static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv, return 0; } -static int lbs_ret_802_11_rf_channel(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; - u16 action = le16_to_cpu(rfchannel->action); - u16 newchannel = le16_to_cpu(rfchannel->currentchannel); - - lbs_deb_enter(LBS_DEB_CMD); - - if (action == CMD_OPT_802_11_RF_CHANNEL_GET - && priv->curbssparams.channel != newchannel) { - lbs_deb_cmd("channel switch from %d to %d\n", - priv->curbssparams.channel, newchannel); - - /* Update the channel again */ - priv->curbssparams.channel = newchannel; - } - - lbs_deb_enter(LBS_DEB_CMD); - return 0; -} - static int lbs_ret_802_11_rssi(struct lbs_private *priv, struct cmd_ds_command *resp) { @@ -548,9 +526,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); break; - case CMD_RET(CMD_802_11_RF_CHANNEL): - ret = lbs_ret_802_11_rf_channel(priv, resp); - break; case CMD_RET(CMD_802_11_RSSI): ret = lbs_ret_802_11_rssi(priv, resp); diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index d51010c47b5..7acb6511667 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -386,11 +386,13 @@ struct cmd_ds_802_11_inactivity_timeout { }; struct cmd_ds_802_11_rf_channel { + struct cmd_header hdr; + __le16 action; - __le16 currentchannel; - __le16 rftype; - __le16 reserved; - u8 channellist[32]; + __le16 channel; + __le16 rftype; /* unused */ + __le16 reserved; /* unused */ + u8 channellist[32]; /* unused */ }; struct cmd_ds_802_11_rssi { -- cgit v1.2.3 From cb182a602802b36ff992afe238e1a3eafc0956b2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 11 Dec 2007 17:35:51 -0500 Subject: libertas: endianness fixes for get_channel/set_channel Signed-off-by: Dan Williams Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 32f9f880a15..0f07c2ab9ca 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -831,8 +831,8 @@ int lbs_get_channel(struct lbs_private *priv) if (ret) goto out; - lbs_deb_cmd("current radio channel is %d\n", cmd.channel); - ret = (int) cmd.channel; + ret = le16_to_cpu(cmd.channel); + lbs_deb_cmd("current radio channel is %d\n", ret); out: lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); @@ -863,8 +863,9 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel) if (ret) goto out; - priv->curbssparams.channel = cmd.channel; - lbs_deb_cmd("channel switch from %d to %d\n", old_channel, cmd.channel); + priv->curbssparams.channel = (uint8_t) le16_to_cpu(cmd.channel); + lbs_deb_cmd("channel switch from %d to %d\n", old_channel, + priv->curbssparams.channel); out: lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); -- cgit v1.2.3 From 2fd6cfe307557f3022b47288db3dc094c076e539 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 17:44:10 -0500 Subject: libertas: make some more functions static sparse was getting on my tits. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 12 ++++++------ drivers/net/wireless/libertas/if_usb.c | 2 +- drivers/net/wireless/libertas/main.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 0f07c2ab9ca..2228feccb24 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -14,8 +14,8 @@ #include "cmd.h" static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode); -struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); -void lbs_set_cmd_ctrl_node(struct lbs_private *priv, +static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); +static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, u16 wait_option, void *pdata_buf); @@ -1716,7 +1716,7 @@ done: * @param priv A pointer to struct lbs_private structure * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL */ -struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) +static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) { struct cmd_ctrl_node *tempnode; unsigned long flags; @@ -1780,9 +1780,9 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ -void lbs_set_cmd_ctrl_node(struct lbs_private *priv, - struct cmd_ctrl_node *ptempnode, - u16 wait_option, void *pdata_buf) +static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, + struct cmd_ctrl_node *ptempnode, + u16 wait_option, void *pdata_buf) { lbs_deb_enter(LBS_DEB_HOST); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index a0866efb964..7c57ff44ad0 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -113,7 +113,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) lbs_deb_usb("Setting boot2 version failed\n"); } -void if_usb_fw_timeo(unsigned long priv) +static void if_usb_fw_timeo(unsigned long priv) { struct usb_card_rec *cardp = (void *)priv; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2fe7ad0f832..c51d3af131f 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -252,8 +252,8 @@ static ssize_t lbs_anycast_set(struct device *dev, return strlen(buf); } -int lbs_add_rtap(struct lbs_private *priv); -void lbs_remove_rtap(struct lbs_private *priv); +static int lbs_add_rtap(struct lbs_private *priv); +static void lbs_remove_rtap(struct lbs_private *priv); /** * Get function for sysfs attribute rtap @@ -1423,7 +1423,7 @@ static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) } -void lbs_remove_rtap(struct lbs_private *priv) +static void lbs_remove_rtap(struct lbs_private *priv) { if (priv->rtap_net_dev == NULL) return; @@ -1432,7 +1432,7 @@ void lbs_remove_rtap(struct lbs_private *priv) priv->rtap_net_dev = NULL; } -int lbs_add_rtap(struct lbs_private *priv) +static int lbs_add_rtap(struct lbs_private *priv) { int rc = 0; struct net_device *rtap_dev; -- cgit v1.2.3 From e7240acae372727aa8eb3a67ca7b189dd261136a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 17:54:36 -0500 Subject: libertas: fix sparse endianness warnings in scan.c Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/scan.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 8b6ce61aba4..92d84c72e2a 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -709,7 +709,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, if (*bytesleft >= sizeof(beaconsize)) { /* Extract & convert beacon size from the command buffer */ - beaconsize = le16_to_cpu(get_unaligned((u16 *)*pbeaconinfo)); + beaconsize = le16_to_cpu(get_unaligned((__le16 *)*pbeaconinfo)); *bytesleft -= sizeof(beaconsize); *pbeaconinfo += sizeof(beaconsize); } @@ -823,7 +823,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, case MFIE_TYPE_IBSS_SET: pibss = (struct ieeetypes_ibssparamset *) pos; - bss->atimwindow = le32_to_cpu(pibss->atimwindow); + bss->atimwindow = le16_to_cpu(pibss->atimwindow); memmove(&bss->ssparamset.ibssparamset, pibss, sizeof(struct ieeetypes_ibssparamset)); lbs_deb_scan("got IBSS IE\n"); @@ -1562,12 +1562,11 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp) goto done; } - bytesleft = le16_to_cpu(get_unaligned((u16*)&pscan->bssdescriptsize)); + bytesleft = le16_to_cpu(pscan->bssdescriptsize); lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft); - scanrespsize = le16_to_cpu(get_unaligned((u16*)&resp->size)); - lbs_deb_scan("SCAN_RESP: scan results %d\n", - pscan->nr_sets); + scanrespsize = le16_to_cpu(resp->size); + lbs_deb_scan("SCAN_RESP: scan results %d\n", pscan->nr_sets); pbssinfo = pscan->bssdesc_and_tlvbuffer; -- cgit v1.2.3 From 23a397ac821ab0aa263bda47131bb0628e49101a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 18:56:42 -0500 Subject: libertas: add lbs_mesh sysfs attribute for enabling mesh Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 17 ++++++++ drivers/net/wireless/libertas/cmd.h | 2 + drivers/net/wireless/libertas/decl.h | 2 - drivers/net/wireless/libertas/dev.h | 2 + drivers/net/wireless/libertas/host.h | 1 + drivers/net/wireless/libertas/hostcmd.h | 12 ++++++ drivers/net/wireless/libertas/if_usb.c | 6 --- drivers/net/wireless/libertas/main.c | 74 +++++++++++++++++++++++++++++---- 8 files changed, 99 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 2228feccb24..01d23493b4e 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1093,6 +1093,23 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, } EXPORT_SYMBOL_GPL(lbs_mesh_access); +int lbs_mesh_config(struct lbs_private *priv, int enable) +{ + struct cmd_ds_mesh_config cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.action = cpu_to_le16(enable); + cmd.channel = cpu_to_le16(priv->curbssparams.channel); + cmd.type = cpu_to_le16(0x100 + 37); + + if (enable) { + cmd.length = cpu_to_le16(priv->mesh_ssid_len); + memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); + } + + return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, cmd); +} + static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, struct cmd_ds_command *cmd, u16 cmd_action) diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 5b02d73c8a0..80714b51285 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -33,4 +33,6 @@ int lbs_set_data_rate(struct lbs_private *priv, u8 rate); int lbs_get_channel(struct lbs_private *priv); int lbs_set_channel(struct lbs_private *priv, u8 channel); +int lbs_mesh_config(struct lbs_private *priv, int enable); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 33c8305b5c0..9b0ef166185 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -74,8 +74,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev); int lbs_remove_card(struct lbs_private *priv); int lbs_start_card(struct lbs_private *priv); int lbs_stop_card(struct lbs_private *priv); -int lbs_add_mesh(struct lbs_private *priv, struct device *dev); -void lbs_remove_mesh(struct lbs_private *priv); int lbs_reset_device(struct lbs_private *priv); void lbs_host_to_card_done(struct lbs_private *priv); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 9921d0cd6f1..86b45a471fc 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -201,6 +201,8 @@ struct lbs_private { /** current ssid/bssid related parameters*/ struct current_bss_params curbssparams; + u8 mesh_ssid[IW_ESSID_MAX_SIZE + 1]; + u8 mesh_ssid_len; /* IW_MODE_* */ u8 mode; diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index cc5f9bf6cf2..fcd223807ba 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -113,6 +113,7 @@ #define CMD_802_11_MONITOR_MODE 0x0098 #define CMD_MESH_ACCESS 0x009b +#define CMD_MESH_CONFIG 0x00a3 #define CMD_SET_BOOT2_VER 0x00a5 diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 7acb6511667..aab5d64f32d 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -626,6 +626,18 @@ struct cmd_ds_fwt_access { u8 prec[ETH_ALEN]; } __attribute__ ((packed)); + +struct cmd_ds_mesh_config { + struct cmd_header hdr; + + __le16 action; + __le16 channel; + __le16 type; + __le16 length; + u8 data[128]; /* last position reserved */ +} __attribute__ ((packed)); + + struct cmd_ds_mesh_access { struct cmd_header hdr; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 7c57ff44ad0..351c7ea4318 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -232,9 +232,6 @@ static int if_usb_probe(struct usb_interface *intf, cardp->priv = priv; cardp->priv->fw_ready = 1; - if (lbs_add_mesh(priv, &udev->dev)) - goto err_add_mesh; - cardp->eth_dev = priv->dev; priv->hw_host_to_card = if_usb_host_to_card; @@ -255,8 +252,6 @@ static int if_usb_probe(struct usb_interface *intf, return 0; err_start_card: - lbs_remove_mesh(priv); -err_add_mesh: lbs_remove_card(priv); err_prog_firmware: if_usb_reset_device(cardp); @@ -286,7 +281,6 @@ static void if_usb_disconnect(struct usb_interface *intf) priv->surpriseremoved = 1; lbs_stop_card(priv); - lbs_remove_mesh(priv); lbs_remove_card(priv); } diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index c51d3af131f..fd76c46225d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -254,6 +254,9 @@ static ssize_t lbs_anycast_set(struct device *dev, static int lbs_add_rtap(struct lbs_private *priv); static void lbs_remove_rtap(struct lbs_private *priv); +static int lbs_add_mesh(struct lbs_private *priv); +static void lbs_remove_mesh(struct lbs_private *priv); + /** * Get function for sysfs attribute rtap @@ -312,11 +315,53 @@ static ssize_t lbs_rtap_set(struct device *dev, } /** - * lbs_rtap attribute to be exported per mshX interface - * through sysfs (/sys/class/net/mshX/libertas-rtap) + * lbs_rtap attribute to be exported per ethX interface + * through sysfs (/sys/class/net/ethX/lbs_rtap) */ -static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, - lbs_rtap_set ); +static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set ); + +/** + * Get function for sysfs attribute mesh + */ +static ssize_t lbs_mesh_get(struct device *dev, + struct device_attribute *attr, char * buf) +{ + struct lbs_private *priv = to_net_dev(dev)->priv; + return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev); +} + +/** + * Set function for sysfs attribute mesh + */ +static ssize_t lbs_mesh_set(struct device *dev, + struct device_attribute *attr, const char * buf, size_t count) +{ + struct lbs_private *priv = to_net_dev(dev)->priv; + int enable; + int ret; + + sscanf(buf, "%x", &enable); + enable = !!enable; + if (enable == !!priv->mesh_dev) + return count; + + ret = lbs_mesh_config(priv, enable); + if (ret) + return ret; + + if (enable) + lbs_add_mesh(priv); + else + lbs_remove_mesh(priv); + + return count; +} + +/** + * lbs_mesh attribute to be exported per ethX interface + * through sysfs (/sys/class/net/ethX/lbs_mesh) + */ +static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set); /** * anycast_mask attribute to be exported per mshX interface @@ -867,7 +912,9 @@ static int lbs_setup_firmware(struct lbs_private *priv) ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); if (ret) { - ret = -1; + printk("Mesh autostart set failed\n"); + ret = 0; + //ret = -1; goto done; } priv->mesh_autostart_enabled = 0; @@ -1059,6 +1106,9 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); INIT_WORK(&priv->sync_channel, lbs_sync_channel); + sprintf(priv->mesh_ssid, "mesh"); + priv->mesh_ssid_len = 4; + goto done; err_init_adapter: @@ -1080,6 +1130,7 @@ int lbs_remove_card(struct lbs_private *priv) lbs_deb_enter(LBS_DEB_MAIN); + lbs_remove_mesh(priv); lbs_remove_rtap(priv); dev = priv->dev; @@ -1133,6 +1184,8 @@ int lbs_start_card(struct lbs_private *priv) } if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) lbs_pr_err("cannot register lbs_rtap attribute\n"); + if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) + lbs_pr_err("cannot register lbs_mesh attribute\n"); lbs_debugfs_init_one(priv, dev); @@ -1161,6 +1214,7 @@ int lbs_stop_card(struct lbs_private *priv) lbs_debugfs_remove_one(priv); device_remove_file(&dev->dev, &dev_attr_lbs_rtap); + device_remove_file(&dev->dev, &dev_attr_lbs_mesh); /* Flush pending command nodes */ spin_lock_irqsave(&priv->driver_lock, flags); @@ -1184,7 +1238,7 @@ EXPORT_SYMBOL_GPL(lbs_stop_card); * @param priv A pointer to the struct lbs_private structure * @return 0 if successful, -X otherwise */ -int lbs_add_mesh(struct lbs_private *priv, struct device *dev) +static int lbs_add_mesh(struct lbs_private *priv) { struct net_device *mesh_dev = NULL; int ret = 0; @@ -1209,7 +1263,7 @@ int lbs_add_mesh(struct lbs_private *priv, struct device *dev) memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, sizeof(priv->dev->dev_addr)); - SET_NETDEV_DEV(priv->mesh_dev, dev); + SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); #ifdef WIRELESS_EXT mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; @@ -1242,7 +1296,7 @@ done: EXPORT_SYMBOL_GPL(lbs_add_mesh); -void lbs_remove_mesh(struct lbs_private *priv) +static void lbs_remove_mesh(struct lbs_private *priv) { struct net_device *mesh_dev; @@ -1252,6 +1306,8 @@ void lbs_remove_mesh(struct lbs_private *priv) goto out; mesh_dev = priv->mesh_dev; + if (!mesh_dev) + goto out; netif_stop_queue(mesh_dev); netif_carrier_off(priv->mesh_dev); @@ -1259,7 +1315,7 @@ void lbs_remove_mesh(struct lbs_private *priv) sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); unregister_netdev(mesh_dev); - priv->mesh_dev = NULL ; + priv->mesh_dev = NULL; free_netdev(mesh_dev); out: -- cgit v1.2.3 From 1f8a08342c8c1c90d0b752f28eb6f24ea7164cdb Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 18:57:49 -0500 Subject: libertas: kill references to mesh autostart Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 21 ------------- drivers/net/wireless/libertas/main.c | 54 ---------------------------------- 2 files changed, 75 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 351c7ea4318..b19a6c9c2a7 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -978,17 +978,6 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) if (priv->psstate != PS_STATE_FULL_POWER) return -1; - if (priv->mesh_dev && !priv->mesh_autostart_enabled) { - /* Mesh autostart must be activated while sleeping - * On resume it will go back to the current state - */ - struct cmd_ds_mesh_access mesh_access; - memset(&mesh_access, 0, sizeof(mesh_access)); - - mesh_access.data[0] = cpu_to_le32(1); - lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); - } - netif_device_detach(cardp->eth_dev); netif_device_detach(priv->mesh_dev); @@ -1016,16 +1005,6 @@ static int if_usb_resume(struct usb_interface *intf) netif_device_attach(cardp->eth_dev); netif_device_attach(priv->mesh_dev); - if (priv->mesh_dev && !priv->mesh_autostart_enabled) { - /* Mesh autostart was activated while sleeping - * Disable it if appropriate - */ - struct cmd_ds_mesh_access mesh_access; - memset(&mesh_access, 0, sizeof(mesh_access)); - mesh_access.data[0] = cpu_to_le32(0); - lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); - } - lbs_deb_leave(LBS_DEB_USB); return 0; } diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index fd76c46225d..bb685ac8e15 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -369,46 +369,8 @@ static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set); */ static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); -static ssize_t lbs_autostart_enabled_get(struct device *dev, - struct device_attribute *attr, char * buf) -{ - struct lbs_private *priv = to_net_dev(dev)->priv; - struct cmd_ds_mesh_access mesh_access; - int ret; - - memset(&mesh_access, 0, sizeof(mesh_access)); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, &mesh_access); - if (ret) - return ret; - return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); -} - -static ssize_t lbs_autostart_enabled_set(struct device *dev, - struct device_attribute *attr, const char * buf, size_t count) -{ - struct cmd_ds_mesh_access mesh_access; - uint32_t datum; - struct lbs_private *priv = (to_net_dev(dev))->priv; - int ret; - - memset(&mesh_access, 0, sizeof(mesh_access)); - sscanf(buf, "%d", &datum); - mesh_access.data[0] = cpu_to_le32(datum); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access); - if (ret == 0) - priv->mesh_autostart_enabled = datum ? 1 : 0; - - return strlen(buf); -} - -static DEVICE_ATTR(autostart_enabled, 0644, - lbs_autostart_enabled_get, lbs_autostart_enabled_set); - static struct attribute *lbs_mesh_sysfs_entries[] = { &dev_attr_anycast_mask.attr, - &dev_attr_autostart_enabled.attr, NULL, }; @@ -883,7 +845,6 @@ static int lbs_thread(void *data) static int lbs_setup_firmware(struct lbs_private *priv) { int ret = -1; - struct cmd_ds_mesh_access mesh_access; lbs_deb_enter(LBS_DEB_FW); @@ -905,21 +866,6 @@ static int lbs_setup_firmware(struct lbs_private *priv) goto done; } - /* Disable mesh autostart */ - if (priv->mesh_dev) { - memset(&mesh_access, 0, sizeof(mesh_access)); - mesh_access.data[0] = cpu_to_le32(0); - ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - &mesh_access); - if (ret) { - printk("Mesh autostart set failed\n"); - ret = 0; - //ret = -1; - goto done; - } - priv->mesh_autostart_enabled = 0; - } - ret = 0; done: lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); -- cgit v1.2.3 From 202f3f3ac90d8781ec1f37556c63aaf594b53581 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 18:36:35 -0500 Subject: libertas: kill rx_urb_recall and eth_dev members of struct usb_card_rec Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 12 ++---------- drivers/net/wireless/libertas/if_usb.h | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index b19a6c9c2a7..02192e8a15e 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -175,8 +175,6 @@ static int if_usb_probe(struct usb_interface *intf, "Rx URB allocation failed\n"); goto dealloc; } - cardp->rx_urb_recall = 0; - cardp->bulk_in_size = le16_to_cpu(endpoint->wMaxPacketSize); cardp->bulk_in_endpointAddr = @@ -232,8 +230,6 @@ static int if_usb_probe(struct usb_interface *intf, cardp->priv = priv; cardp->priv->fw_ready = 1; - cardp->eth_dev = priv->dev; - priv->hw_host_to_card = if_usb_host_to_card; priv->hw_get_int_status = if_usb_get_int_status; priv->hw_read_event_cause = if_usb_read_event_cause; @@ -978,15 +974,13 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) if (priv->psstate != PS_STATE_FULL_POWER) return -1; - netif_device_detach(cardp->eth_dev); + netif_device_detach(priv->dev); netif_device_detach(priv->mesh_dev); /* Unlink tx & rx urb */ usb_kill_urb(cardp->tx_urb); usb_kill_urb(cardp->rx_urb); - cardp->rx_urb_recall = 1; - lbs_deb_leave(LBS_DEB_USB); return 0; } @@ -998,11 +992,9 @@ static int if_usb_resume(struct usb_interface *intf) lbs_deb_enter(LBS_DEB_USB); - cardp->rx_urb_recall = 0; - if_usb_submit_rx_urb(cardp); - netif_device_attach(cardp->eth_dev); + netif_device_attach(priv->dev); netif_device_attach(priv->mesh_dev); lbs_deb_leave(LBS_DEB_USB); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index f028df1d018..668410f8205 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -47,7 +47,6 @@ struct read_cb_info { /** USB card description structure*/ struct usb_card_rec { - struct net_device *eth_dev; struct usb_device *udev; struct urb *rx_urb, *tx_urb; struct lbs_private *priv; @@ -75,8 +74,6 @@ struct usb_card_rec { u32 usb_event_cause; u8 usb_int_cause; - u8 rx_urb_recall; - s8 bootcmdresp; }; -- cgit v1.2.3 From 387a1f046fcaf299d93bb6de81257670a4442648 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 18:53:20 -0500 Subject: libertas: whitespace cleanup in host.h Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/host.h | 380 ++++++++++++++++------------------- 1 file changed, 178 insertions(+), 202 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index fcd223807ba..64178cff2f4 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -6,21 +6,21 @@ #define _LBS_HOST_H_ /** PUBLIC DEFINITIONS */ -#define DEFAULT_AD_HOC_CHANNEL 6 -#define DEFAULT_AD_HOC_CHANNEL_A 36 +#define DEFAULT_AD_HOC_CHANNEL 6 +#define DEFAULT_AD_HOC_CHANNEL_A 36 /** IEEE 802.11 oids */ -#define OID_802_11_SSID 0x00008002 -#define OID_802_11_INFRASTRUCTURE_MODE 0x00008008 -#define OID_802_11_FRAGMENTATION_THRESHOLD 0x00008009 -#define OID_802_11_RTS_THRESHOLD 0x0000800A -#define OID_802_11_TX_ANTENNA_SELECTED 0x0000800D -#define OID_802_11_SUPPORTED_RATES 0x0000800E -#define OID_802_11_STATISTICS 0x00008012 -#define OID_802_11_TX_RETRYCOUNT 0x0000801D -#define OID_802_11D_ENABLE 0x00008020 - -#define CMD_OPTION_WAITFORRSP 0x0002 +#define OID_802_11_SSID 0x00008002 +#define OID_802_11_INFRASTRUCTURE_MODE 0x00008008 +#define OID_802_11_FRAGMENTATION_THRESHOLD 0x00008009 +#define OID_802_11_RTS_THRESHOLD 0x0000800A +#define OID_802_11_TX_ANTENNA_SELECTED 0x0000800D +#define OID_802_11_SUPPORTED_RATES 0x0000800E +#define OID_802_11_STATISTICS 0x00008012 +#define OID_802_11_TX_RETRYCOUNT 0x0000801D +#define OID_802_11D_ENABLE 0x00008020 + +#define CMD_OPTION_WAITFORRSP 0x0002 /** Host command IDs */ @@ -30,203 +30,179 @@ #define CMD_RET(cmd) (0x8000 | cmd) /* Return command convention exceptions: */ -#define CMD_RET_802_11_ASSOCIATE 0x8012 +#define CMD_RET_802_11_ASSOCIATE 0x8012 /* Command codes */ -#define CMD_CODE_DNLD 0x0002 -#define CMD_GET_HW_SPEC 0x0003 -#define CMD_EEPROM_UPDATE 0x0004 -#define CMD_802_11_RESET 0x0005 -#define CMD_802_11_SCAN 0x0006 -#define CMD_802_11_GET_LOG 0x000b -#define CMD_MAC_MULTICAST_ADR 0x0010 -#define CMD_802_11_AUTHENTICATE 0x0011 -#define CMD_802_11_EEPROM_ACCESS 0x0059 -#define CMD_802_11_ASSOCIATE 0x0050 -#define CMD_802_11_SET_WEP 0x0013 -#define CMD_802_11_GET_STAT 0x0014 -#define CMD_802_3_GET_STAT 0x0015 -#define CMD_802_11_SNMP_MIB 0x0016 -#define CMD_MAC_REG_MAP 0x0017 -#define CMD_BBP_REG_MAP 0x0018 -#define CMD_MAC_REG_ACCESS 0x0019 -#define CMD_BBP_REG_ACCESS 0x001a -#define CMD_RF_REG_ACCESS 0x001b -#define CMD_802_11_RADIO_CONTROL 0x001c -#define CMD_802_11_RF_CHANNEL 0x001d -#define CMD_802_11_RF_TX_POWER 0x001e -#define CMD_802_11_RSSI 0x001f -#define CMD_802_11_RF_ANTENNA 0x0020 - -#define CMD_802_11_PS_MODE 0x0021 - -#define CMD_802_11_DATA_RATE 0x0022 -#define CMD_RF_REG_MAP 0x0023 -#define CMD_802_11_DEAUTHENTICATE 0x0024 -#define CMD_802_11_REASSOCIATE 0x0025 -#define CMD_802_11_DISASSOCIATE 0x0026 -#define CMD_MAC_CONTROL 0x0028 -#define CMD_802_11_AD_HOC_START 0x002b -#define CMD_802_11_AD_HOC_JOIN 0x002c - -#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e -#define CMD_802_11_ENABLE_RSN 0x002f -#define CMD_802_11_PAIRWISE_TSC 0x0036 -#define CMD_802_11_GROUP_TSC 0x0037 -#define CMD_802_11_KEY_MATERIAL 0x005e - -#define CMD_802_11_SET_AFC 0x003c -#define CMD_802_11_GET_AFC 0x003d - -#define CMD_802_11_AD_HOC_STOP 0x0040 - -#define CMD_802_11_BEACON_STOP 0x0049 - -#define CMD_802_11_MAC_ADDRESS 0x004D -#define CMD_802_11_EEPROM_ACCESS 0x0059 - -#define CMD_802_11_BAND_CONFIG 0x0058 - -#define CMD_802_11D_DOMAIN_INFO 0x005b - -#define CMD_802_11_SLEEP_PARAMS 0x0066 - -#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067 - -#define CMD_802_11_TPC_CFG 0x0072 -#define CMD_802_11_PWR_CFG 0x0073 - -#define CMD_802_11_LED_GPIO_CTRL 0x004e - -#define CMD_802_11_SUBSCRIBE_EVENT 0x0075 - -#define CMD_802_11_RATE_ADAPT_RATESET 0x0076 - -#define CMD_802_11_TX_RATE_QUERY 0x007f - -#define CMD_GET_TSF 0x0080 - -#define CMD_BT_ACCESS 0x0087 - -#define CMD_FWT_ACCESS 0x0095 - -#define CMD_802_11_MONITOR_MODE 0x0098 - -#define CMD_MESH_ACCESS 0x009b +#define CMD_CODE_DNLD 0x0002 +#define CMD_GET_HW_SPEC 0x0003 +#define CMD_EEPROM_UPDATE 0x0004 +#define CMD_802_11_RESET 0x0005 +#define CMD_802_11_SCAN 0x0006 +#define CMD_802_11_GET_LOG 0x000b +#define CMD_MAC_MULTICAST_ADR 0x0010 +#define CMD_802_11_AUTHENTICATE 0x0011 +#define CMD_802_11_EEPROM_ACCESS 0x0059 +#define CMD_802_11_ASSOCIATE 0x0050 +#define CMD_802_11_SET_WEP 0x0013 +#define CMD_802_11_GET_STAT 0x0014 +#define CMD_802_3_GET_STAT 0x0015 +#define CMD_802_11_SNMP_MIB 0x0016 +#define CMD_MAC_REG_MAP 0x0017 +#define CMD_BBP_REG_MAP 0x0018 +#define CMD_MAC_REG_ACCESS 0x0019 +#define CMD_BBP_REG_ACCESS 0x001a +#define CMD_RF_REG_ACCESS 0x001b +#define CMD_802_11_RADIO_CONTROL 0x001c +#define CMD_802_11_RF_CHANNEL 0x001d +#define CMD_802_11_RF_TX_POWER 0x001e +#define CMD_802_11_RSSI 0x001f +#define CMD_802_11_RF_ANTENNA 0x0020 +#define CMD_802_11_PS_MODE 0x0021 +#define CMD_802_11_DATA_RATE 0x0022 +#define CMD_RF_REG_MAP 0x0023 +#define CMD_802_11_DEAUTHENTICATE 0x0024 +#define CMD_802_11_REASSOCIATE 0x0025 +#define CMD_802_11_DISASSOCIATE 0x0026 +#define CMD_MAC_CONTROL 0x0028 +#define CMD_802_11_AD_HOC_START 0x002b +#define CMD_802_11_AD_HOC_JOIN 0x002c +#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e +#define CMD_802_11_ENABLE_RSN 0x002f +#define CMD_802_11_PAIRWISE_TSC 0x0036 +#define CMD_802_11_GROUP_TSC 0x0037 +#define CMD_802_11_SET_AFC 0x003c +#define CMD_802_11_GET_AFC 0x003d +#define CMD_802_11_AD_HOC_STOP 0x0040 +#define CMD_802_11_BEACON_STOP 0x0049 +#define CMD_802_11_MAC_ADDRESS 0x004d +#define CMD_802_11_LED_GPIO_CTRL 0x004e +#define CMD_802_11_EEPROM_ACCESS 0x0059 +#define CMD_802_11_BAND_CONFIG 0x0058 +#define CMD_802_11D_DOMAIN_INFO 0x005b +#define CMD_802_11_KEY_MATERIAL 0x005e +#define CMD_802_11_SLEEP_PARAMS 0x0066 +#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067 +#define CMD_802_11_TPC_CFG 0x0072 +#define CMD_802_11_PWR_CFG 0x0073 +#define CMD_802_11_SUBSCRIBE_EVENT 0x0075 +#define CMD_802_11_RATE_ADAPT_RATESET 0x0076 +#define CMD_802_11_TX_RATE_QUERY 0x007f +#define CMD_GET_TSF 0x0080 +#define CMD_BT_ACCESS 0x0087 +#define CMD_FWT_ACCESS 0x0095 +#define CMD_802_11_MONITOR_MODE 0x0098 +#define CMD_MESH_ACCESS 0x009b #define CMD_MESH_CONFIG 0x00a3 - -#define CMD_SET_BOOT2_VER 0x00a5 - -#define CMD_802_11_BEACON_CTRL 0x00b0 +#define CMD_SET_BOOT2_VER 0x00a5 +#define CMD_802_11_BEACON_CTRL 0x00b0 /* For the IEEE Power Save */ -#define CMD_SUBCMD_ENTER_PS 0x0030 -#define CMD_SUBCMD_EXIT_PS 0x0031 -#define CMD_SUBCMD_SLEEP_CONFIRMED 0x0034 -#define CMD_SUBCMD_FULL_POWERDOWN 0x0035 -#define CMD_SUBCMD_FULL_POWERUP 0x0036 - -#define CMD_ENABLE_RSN 0x0001 -#define CMD_DISABLE_RSN 0x0000 +#define CMD_SUBCMD_ENTER_PS 0x0030 +#define CMD_SUBCMD_EXIT_PS 0x0031 +#define CMD_SUBCMD_SLEEP_CONFIRMED 0x0034 +#define CMD_SUBCMD_FULL_POWERDOWN 0x0035 +#define CMD_SUBCMD_FULL_POWERUP 0x0036 -#define CMD_ACT_SET 0x0001 -#define CMD_ACT_GET 0x0000 +#define CMD_ENABLE_RSN 0x0001 +#define CMD_DISABLE_RSN 0x0000 -#define CMD_ACT_GET_AES (CMD_ACT_GET + 2) -#define CMD_ACT_SET_AES (CMD_ACT_SET + 2) -#define CMD_ACT_REMOVE_AES (CMD_ACT_SET + 3) +#define CMD_ACT_GET 0x0000 +#define CMD_ACT_SET 0x0001 +#define CMD_ACT_GET_AES 0x0002 +#define CMD_ACT_SET_AES 0x0003 +#define CMD_ACT_REMOVE_AES 0x0004 /* Define action or option for CMD_802_11_SET_WEP */ -#define CMD_ACT_ADD 0x0002 -#define CMD_ACT_REMOVE 0x0004 -#define CMD_ACT_USE_DEFAULT 0x0008 +#define CMD_ACT_ADD 0x0002 +#define CMD_ACT_REMOVE 0x0004 +#define CMD_ACT_USE_DEFAULT 0x0008 -#define CMD_TYPE_WEP_40_BIT 0x01 -#define CMD_TYPE_WEP_104_BIT 0x02 +#define CMD_TYPE_WEP_40_BIT 0x01 +#define CMD_TYPE_WEP_104_BIT 0x02 -#define CMD_NUM_OF_WEP_KEYS 4 +#define CMD_NUM_OF_WEP_KEYS 4 -#define CMD_WEP_KEY_INDEX_MASK 0x3fff +#define CMD_WEP_KEY_INDEX_MASK 0x3fff /* Define action or option for CMD_802_11_RESET */ -#define CMD_ACT_HALT 0x0003 +#define CMD_ACT_HALT 0x0003 /* Define action or option for CMD_802_11_SCAN */ -#define CMD_BSS_TYPE_BSS 0x0001 -#define CMD_BSS_TYPE_IBSS 0x0002 -#define CMD_BSS_TYPE_ANY 0x0003 +#define CMD_BSS_TYPE_BSS 0x0001 +#define CMD_BSS_TYPE_IBSS 0x0002 +#define CMD_BSS_TYPE_ANY 0x0003 /* Define action or option for CMD_802_11_SCAN */ -#define CMD_SCAN_TYPE_ACTIVE 0x0000 -#define CMD_SCAN_TYPE_PASSIVE 0x0001 +#define CMD_SCAN_TYPE_ACTIVE 0x0000 +#define CMD_SCAN_TYPE_PASSIVE 0x0001 #define CMD_SCAN_RADIO_TYPE_BG 0 -#define CMD_SCAN_PROBE_DELAY_TIME 0 +#define CMD_SCAN_PROBE_DELAY_TIME 0 /* Define action or option for CMD_MAC_CONTROL */ -#define CMD_ACT_MAC_RX_ON 0x0001 -#define CMD_ACT_MAC_TX_ON 0x0002 -#define CMD_ACT_MAC_LOOPBACK_ON 0x0004 -#define CMD_ACT_MAC_WEP_ENABLE 0x0008 -#define CMD_ACT_MAC_INT_ENABLE 0x0010 -#define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020 -#define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040 -#define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 -#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 -#define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400 +#define CMD_ACT_MAC_RX_ON 0x0001 +#define CMD_ACT_MAC_TX_ON 0x0002 +#define CMD_ACT_MAC_LOOPBACK_ON 0x0004 +#define CMD_ACT_MAC_WEP_ENABLE 0x0008 +#define CMD_ACT_MAC_INT_ENABLE 0x0010 +#define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020 +#define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040 +#define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 +#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 +#define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400 /* Define action or option for CMD_802_11_RADIO_CONTROL */ -#define CMD_TYPE_AUTO_PREAMBLE 0x0001 -#define CMD_TYPE_SHORT_PREAMBLE 0x0002 -#define CMD_TYPE_LONG_PREAMBLE 0x0003 +#define CMD_TYPE_AUTO_PREAMBLE 0x0001 +#define CMD_TYPE_SHORT_PREAMBLE 0x0002 +#define CMD_TYPE_LONG_PREAMBLE 0x0003 /* Event flags for CMD_802_11_SUBSCRIBE_EVENT */ -#define CMD_SUBSCRIBE_RSSI_LOW 0x0001 -#define CMD_SUBSCRIBE_SNR_LOW 0x0002 -#define CMD_SUBSCRIBE_FAILCOUNT 0x0004 -#define CMD_SUBSCRIBE_BCNMISS 0x0008 -#define CMD_SUBSCRIBE_RSSI_HIGH 0x0010 -#define CMD_SUBSCRIBE_SNR_HIGH 0x0020 +#define CMD_SUBSCRIBE_RSSI_LOW 0x0001 +#define CMD_SUBSCRIBE_SNR_LOW 0x0002 +#define CMD_SUBSCRIBE_FAILCOUNT 0x0004 +#define CMD_SUBSCRIBE_BCNMISS 0x0008 +#define CMD_SUBSCRIBE_RSSI_HIGH 0x0010 +#define CMD_SUBSCRIBE_SNR_HIGH 0x0020 -#define TURN_ON_RF 0x01 -#define RADIO_ON 0x01 -#define RADIO_OFF 0x00 +#define TURN_ON_RF 0x01 +#define RADIO_ON 0x01 +#define RADIO_OFF 0x00 -#define SET_AUTO_PREAMBLE 0x05 -#define SET_SHORT_PREAMBLE 0x03 -#define SET_LONG_PREAMBLE 0x01 +#define SET_AUTO_PREAMBLE 0x05 +#define SET_SHORT_PREAMBLE 0x03 +#define SET_LONG_PREAMBLE 0x01 /* Define action or option for CMD_802_11_RF_CHANNEL */ -#define CMD_OPT_802_11_RF_CHANNEL_GET 0x00 -#define CMD_OPT_802_11_RF_CHANNEL_SET 0x01 +#define CMD_OPT_802_11_RF_CHANNEL_GET 0x00 +#define CMD_OPT_802_11_RF_CHANNEL_SET 0x01 /* Define action or option for CMD_802_11_RF_TX_POWER */ -#define CMD_ACT_TX_POWER_OPT_GET 0x0000 -#define CMD_ACT_TX_POWER_OPT_SET_HIGH 0x8007 -#define CMD_ACT_TX_POWER_OPT_SET_MID 0x8004 -#define CMD_ACT_TX_POWER_OPT_SET_LOW 0x8000 +#define CMD_ACT_TX_POWER_OPT_GET 0x0000 +#define CMD_ACT_TX_POWER_OPT_SET_HIGH 0x8007 +#define CMD_ACT_TX_POWER_OPT_SET_MID 0x8004 +#define CMD_ACT_TX_POWER_OPT_SET_LOW 0x8000 -#define CMD_ACT_TX_POWER_INDEX_HIGH 0x0007 -#define CMD_ACT_TX_POWER_INDEX_MID 0x0004 -#define CMD_ACT_TX_POWER_INDEX_LOW 0x0000 +#define CMD_ACT_TX_POWER_INDEX_HIGH 0x0007 +#define CMD_ACT_TX_POWER_INDEX_MID 0x0004 +#define CMD_ACT_TX_POWER_INDEX_LOW 0x0000 /* Define action or option for CMD_802_11_DATA_RATE */ -#define CMD_ACT_SET_TX_AUTO 0x0000 -#define CMD_ACT_SET_TX_FIX_RATE 0x0001 -#define CMD_ACT_GET_TX_RATE 0x0002 +#define CMD_ACT_SET_TX_AUTO 0x0000 +#define CMD_ACT_SET_TX_FIX_RATE 0x0001 +#define CMD_ACT_GET_TX_RATE 0x0002 -#define CMD_ACT_SET_RX 0x0001 -#define CMD_ACT_SET_TX 0x0002 -#define CMD_ACT_SET_BOTH 0x0003 -#define CMD_ACT_GET_RX 0x0004 -#define CMD_ACT_GET_TX 0x0008 -#define CMD_ACT_GET_BOTH 0x000c +#define CMD_ACT_SET_RX 0x0001 +#define CMD_ACT_SET_TX 0x0002 +#define CMD_ACT_SET_BOTH 0x0003 +#define CMD_ACT_GET_RX 0x0004 +#define CMD_ACT_GET_TX 0x0008 +#define CMD_ACT_GET_BOTH 0x000c /* Define action or option for CMD_802_11_PS_MODE */ -#define CMD_TYPE_CAM 0x0000 -#define CMD_TYPE_MAX_PSP 0x0001 -#define CMD_TYPE_FAST_PSP 0x0002 +#define CMD_TYPE_CAM 0x0000 +#define CMD_TYPE_MAX_PSP 0x0001 +#define CMD_TYPE_FAST_PSP 0x0002 /* Define action or option for CMD_BT_ACCESS */ enum cmd_bt_access_opts { @@ -275,36 +251,36 @@ enum cmd_mesh_access_opts { }; /** Card Event definition */ -#define MACREG_INT_CODE_TX_PPA_FREE 0 -#define MACREG_INT_CODE_TX_DMA_DONE 1 -#define MACREG_INT_CODE_LINK_LOST_W_SCAN 2 -#define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3 -#define MACREG_INT_CODE_LINK_SENSED 4 -#define MACREG_INT_CODE_CMD_FINISHED 5 -#define MACREG_INT_CODE_MIB_CHANGED 6 -#define MACREG_INT_CODE_INIT_DONE 7 -#define MACREG_INT_CODE_DEAUTHENTICATED 8 -#define MACREG_INT_CODE_DISASSOCIATED 9 -#define MACREG_INT_CODE_PS_AWAKE 10 -#define MACREG_INT_CODE_PS_SLEEP 11 -#define MACREG_INT_CODE_MIC_ERR_MULTICAST 13 -#define MACREG_INT_CODE_MIC_ERR_UNICAST 14 -#define MACREG_INT_CODE_WM_AWAKE 15 -#define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16 -#define MACREG_INT_CODE_ADHOC_BCN_LOST 17 -#define MACREG_INT_CODE_HOST_AWAKE 18 -#define MACREG_INT_CODE_STOP_TX 19 -#define MACREG_INT_CODE_START_TX 20 -#define MACREG_INT_CODE_CHANNEL_SWITCH 21 -#define MACREG_INT_CODE_MEASUREMENT_RDY 22 -#define MACREG_INT_CODE_WMM_CHANGE 23 -#define MACREG_INT_CODE_BG_SCAN_REPORT 24 -#define MACREG_INT_CODE_RSSI_LOW 25 -#define MACREG_INT_CODE_SNR_LOW 26 -#define MACREG_INT_CODE_MAX_FAIL 27 -#define MACREG_INT_CODE_RSSI_HIGH 28 -#define MACREG_INT_CODE_SNR_HIGH 29 -#define MACREG_INT_CODE_MESH_AUTO_STARTED 35 -#define MACREG_INT_CODE_FIRMWARE_READY 48 +#define MACREG_INT_CODE_TX_PPA_FREE 0 +#define MACREG_INT_CODE_TX_DMA_DONE 1 +#define MACREG_INT_CODE_LINK_LOST_W_SCAN 2 +#define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3 +#define MACREG_INT_CODE_LINK_SENSED 4 +#define MACREG_INT_CODE_CMD_FINISHED 5 +#define MACREG_INT_CODE_MIB_CHANGED 6 +#define MACREG_INT_CODE_INIT_DONE 7 +#define MACREG_INT_CODE_DEAUTHENTICATED 8 +#define MACREG_INT_CODE_DISASSOCIATED 9 +#define MACREG_INT_CODE_PS_AWAKE 10 +#define MACREG_INT_CODE_PS_SLEEP 11 +#define MACREG_INT_CODE_MIC_ERR_MULTICAST 13 +#define MACREG_INT_CODE_MIC_ERR_UNICAST 14 +#define MACREG_INT_CODE_WM_AWAKE 15 +#define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16 +#define MACREG_INT_CODE_ADHOC_BCN_LOST 17 +#define MACREG_INT_CODE_HOST_AWAKE 18 +#define MACREG_INT_CODE_STOP_TX 19 +#define MACREG_INT_CODE_START_TX 20 +#define MACREG_INT_CODE_CHANNEL_SWITCH 21 +#define MACREG_INT_CODE_MEASUREMENT_RDY 22 +#define MACREG_INT_CODE_WMM_CHANGE 23 +#define MACREG_INT_CODE_BG_SCAN_REPORT 24 +#define MACREG_INT_CODE_RSSI_LOW 25 +#define MACREG_INT_CODE_SNR_LOW 26 +#define MACREG_INT_CODE_MAX_FAIL 27 +#define MACREG_INT_CODE_RSSI_HIGH 28 +#define MACREG_INT_CODE_SNR_HIGH 29 +#define MACREG_INT_CODE_MESH_AUTO_STARTED 35 +#define MACREG_INT_CODE_FIRMWARE_READY 48 #endif -- cgit v1.2.3 From f5956bf1e4575175135d636db1b7f3ab950e0dc3 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 19:30:57 -0500 Subject: libertas: allow get/set SSID on mshX device Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/wext.c | 52 ++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index e44c0ce804e..0a060726cf3 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -1917,6 +1917,54 @@ out: return ret; } +static int lbs_mesh_get_essid(struct net_device *dev, + struct iw_request_info *info, + struct iw_point *dwrq, char *extra) +{ + struct lbs_private *priv = dev->priv; + + lbs_deb_enter(LBS_DEB_WEXT); + + memcpy(extra, priv->mesh_ssid, priv->mesh_ssid_len); + + dwrq->length = priv->mesh_ssid_len; + + dwrq->flags = 1; /* active */ + + lbs_deb_leave(LBS_DEB_WEXT); + return 0; +} + +static int lbs_mesh_set_essid(struct net_device *dev, + struct iw_request_info *info, + struct iw_point *dwrq, char *extra) +{ + struct lbs_private *priv = dev->priv; + int ret = 0; + + lbs_deb_enter(LBS_DEB_WEXT); + + /* Check the size of the string */ + if (dwrq->length > IW_ESSID_MAX_SIZE) { + ret = -E2BIG; + goto out; + } + + if (!dwrq->flags || !dwrq->length) { + ret = -EINVAL; + goto out; + } else { + /* Specific SSID requested */ + memcpy(priv->mesh_ssid, extra, dwrq->length); + priv->mesh_ssid_len = dwrq->length; + } + + lbs_mesh_config(priv, 1); + out: + lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); + return ret; +} + /** * @brief Connect to the AP or Ad-hoc Network with specific bssid * @@ -2071,8 +2119,8 @@ static const iw_handler mesh_wlan_handler[] = { (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ (iw_handler) lbs_set_scan, /* SIOCSIWSCAN */ (iw_handler) lbs_get_scan, /* SIOCGIWSCAN */ - (iw_handler) NULL, /* SIOCSIWESSID */ - (iw_handler) NULL, /* SIOCGIWESSID */ + (iw_handler) lbs_mesh_set_essid,/* SIOCSIWESSID */ + (iw_handler) lbs_mesh_get_essid,/* SIOCGIWESSID */ (iw_handler) NULL, /* SIOCSIWNICKN */ (iw_handler) mesh_get_nick, /* SIOCGIWNICKN */ (iw_handler) NULL, /* -- hole -- */ -- cgit v1.2.3 From 823eaa2cc261e3723772aa4aaa4d76c5815b117f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 19:56:28 -0500 Subject: libertas: allow setting channel on mshX device Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/wext.c | 53 +++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 0a060726cf3..262d4cc5804 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -959,6 +959,57 @@ out: return ret; } +static int lbs_mesh_set_freq(struct net_device *dev, + struct iw_request_info *info, + struct iw_freq *fwrq, char *extra) +{ + struct lbs_private *priv = dev->priv; + struct chan_freq_power *cfp; + int ret = -EINVAL; + + lbs_deb_enter(LBS_DEB_WEXT); + + /* If setting by frequency, convert to a channel */ + if (fwrq->e == 1) { + long f = fwrq->m / 100000; + + cfp = find_cfp_by_band_and_freq(priv, 0, f); + if (!cfp) { + lbs_deb_wext("invalid freq %ld\n", f); + goto out; + } + + fwrq->e = 0; + fwrq->m = (int) cfp->channel; + } + + /* Setting by channel number */ + if (fwrq->m > 1000 || fwrq->e > 0) { + goto out; + } + + cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m); + if (!cfp) { + goto out; + } + + if (fwrq->m != priv->curbssparams.channel) { + lbs_deb_wext("mesh channel change forces eth disconnect\n"); + if (priv->mode == IW_MODE_INFRA) + lbs_send_deauthentication(priv); + else if (priv->mode == IW_MODE_ADHOC) + lbs_stop_adhoc_network(priv); + } + priv->curbssparams.channel = fwrq->m; + lbs_mesh_config(priv, 0); + lbs_mesh_config(priv, 1); + ret = 0; + +out: + lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); + return ret; +} + static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { @@ -2097,7 +2148,7 @@ static const iw_handler mesh_wlan_handler[] = { (iw_handler) lbs_get_name, /* SIOCGIWNAME */ (iw_handler) NULL, /* SIOCSIWNWID */ (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) lbs_set_freq, /* SIOCSIWFREQ */ + (iw_handler) lbs_mesh_set_freq, /* SIOCSIWFREQ */ (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ (iw_handler) NULL, /* SIOCSIWMODE */ (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ -- cgit v1.2.3 From 88ae2915ccff97466e7a1e542f4a4d01c46b23f6 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 19:57:05 -0500 Subject: libertas: add missing newline on debug message Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index bd9cfe118c4..a4b9756ebb7 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -219,7 +219,7 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_assoc("ASSOC: channel: error getting channel."); if (assoc_req->channel != priv->curbssparams.channel) { - lbs_deb_assoc("ASSOC: channel: failed to update channel to %d", + lbs_deb_assoc("ASSOC: channel: failed to update channel to %d\n", assoc_req->channel); goto done; } -- cgit v1.2.3 From 8642f1f06292c4f30c7870a693f9ae94252e7ff2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 20:03:01 -0500 Subject: libertas: disable mesh temporarily while setting eth channel/assoc Otherwise the device won't let us change channels. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index a4b9756ebb7..7b672fe62cf 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -204,6 +204,12 @@ static int assoc_helper_channel(struct lbs_private *priv, if (assoc_req->channel == priv->curbssparams.channel) goto done; + if (priv->mesh_dev) { + /* Disconnect mesh while associating -- otherwise it + won't let us change channels */ + lbs_mesh_config(priv, 0); + } + lbs_deb_assoc("ASSOC: channel: %d -> %d\n", priv->curbssparams.channel, assoc_req->channel); @@ -221,7 +227,7 @@ static int assoc_helper_channel(struct lbs_private *priv, if (assoc_req->channel != priv->curbssparams.channel) { lbs_deb_assoc("ASSOC: channel: failed to update channel to %d\n", assoc_req->channel); - goto done; + goto restore_mesh; } if ( assoc_req->secinfo.wep_enabled @@ -236,7 +242,11 @@ static int assoc_helper_channel(struct lbs_private *priv, /* Must restart/rejoin adhoc networks after channel change */ set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); -done: + restore_mesh: + if (priv->mesh_dev) + lbs_mesh_config(priv, 1); + + done: lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } -- cgit v1.2.3 From 06113c1c70349f5f888436ac2af28c707f4602ef Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 22:52:03 -0500 Subject: libertas: add debugging output to lbs_mesh_config() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 01d23493b4e..1cb42dc9001 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1106,7 +1106,9 @@ int lbs_mesh_config(struct lbs_private *priv, int enable) cmd.length = cpu_to_le16(priv->mesh_ssid_len); memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); } - + lbs_deb_cmd("mesh config channel %d SSID %s\n", + priv->curbssparams.channel, + escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, cmd); } -- cgit v1.2.3 From e1258177e437cb8b892622f2b7beedd4701540ac Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 11 Dec 2007 23:42:49 -0500 Subject: libertas: be more careful about command responses matching cur_cmd Especially in the light of OLPC trac #5461, in which the firmware starts sending us seemingly random command responses which bear little relation to the command we sent it. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 ++-- drivers/net/wireless/libertas/cmdresp.c | 36 ++++++++++++++++++++------------- drivers/net/wireless/libertas/if_usb.c | 1 + drivers/net/wireless/libertas/main.c | 2 +- 4 files changed, 26 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 1cb42dc9001..5ddb46a477a 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1216,8 +1216,8 @@ static int DownloadcommandToStation(struct lbs_private *priv, cmdsize = le16_to_cpu(cmd->size); command = le16_to_cpu(cmd->command); - lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n", - command, cmdsize, jiffies); + lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n", + command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); cmdnode->cmdwaitqwoken = 0; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index bf9941ecc23..53f73c4abdd 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -611,7 +611,7 @@ static inline int handle_cmd_response(struct lbs_private *priv, default: lbs_deb_host("CMD_RESP: unknown cmd response 0x%04x\n", - resp->command); + le16_to_cpu(resp->command)); break; } lbs_deb_leave(LBS_DEB_HOST); @@ -620,17 +620,14 @@ static inline int handle_cmd_response(struct lbs_private *priv, int lbs_process_rx_command(struct lbs_private *priv) { - u16 respcmd; + uint16_t respcmd, curcmd; struct cmd_header *resp; int ret = 0; - ulong flags; - u16 result; + unsigned long flags; + uint16_t result; lbs_deb_enter(LBS_DEB_HOST); - /* Now we got response from FW, cancel the command timer */ - del_timer(&priv->command_timer); - mutex_lock(&priv->lock); spin_lock_irqsave(&priv->driver_lock, flags); @@ -640,24 +637,35 @@ int lbs_process_rx_command(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } + + curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); + resp = priv->cur_cmd->cmdbuf; respcmd = le16_to_cpu(resp->command); result = le16_to_cpu(resp->result); - lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n", - respcmd, priv->upld_len, jiffies); + lbs_deb_host("CMD_RESP: response 0x%04x, seq %d, size %d, jiffies %lu\n", + respcmd, le16_to_cpu(resp->seqnum), priv->upld_len, jiffies); lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len); - if (!(respcmd & 0x8000)) { - lbs_deb_host("invalid response!\n"); - priv->cur_cmd_retcode = -1; - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { + lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n", + le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; goto done; } + if (respcmd != CMD_RET(curcmd) && + respcmd != CMD_802_11_ASSOCIATE && curcmd != CMD_RET_802_11_ASSOCIATE) { + lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); + spin_unlock_irqrestore(&priv->driver_lock, flags); + ret = -1; + goto done; + } + + /* Now we got response from FW, cancel the command timer */ + del_timer(&priv->command_timer); /* Store the response code to cur_cmd_retcode. */ priv->cur_cmd_retcode = result; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 02192e8a15e..6b8ac62e6f9 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -643,6 +643,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, /* take care of cur_cmd = NULL case by reading the * data to clear the interrupt */ if (!priv->cur_cmd) { + lbs_deb_hex(LBS_DEB_HOST, "Unsolicited CMD_RESP", (void *) recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); cmdbuf = priv->upld_buf; priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; } else diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index bb685ac8e15..cdf5934aaf8 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -893,7 +893,7 @@ static void command_timer_fn(unsigned long data) return; } - lbs_deb_fw("command_timer_fn fired, cmd %x\n", node->cmdbuf->command); + lbs_pr_info("command %x timed out\n", le16_to_cpu(node->cmdbuf->command)); if (!priv->fw_ready) return; -- cgit v1.2.3 From 23d36eec263d2c913ee651dc43472524397e4a0b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 00:14:21 -0500 Subject: libertas: add missing newlines in debugging statements Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 10 +++++----- drivers/net/wireless/libertas/cmd.c | 8 ++++---- drivers/net/wireless/libertas/if_usb.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 7b672fe62cf..21a56961742 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -198,7 +198,7 @@ static int assoc_helper_channel(struct lbs_private *priv, ret = update_channel(priv); if (ret < 0) { - lbs_deb_assoc("ASSOC: channel: error getting channel."); + lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); } if (assoc_req->channel == priv->curbssparams.channel) @@ -215,14 +215,14 @@ static int assoc_helper_channel(struct lbs_private *priv, ret = lbs_set_channel(priv, assoc_req->channel); if (ret < 0) - lbs_deb_assoc("ASSOC: channel: error setting channel."); + lbs_deb_assoc("ASSOC: channel: error setting channel.\n"); /* FIXME: shouldn't need to grab the channel _again_ after setting * it since the firmware is supposed to return the new channel, but * whatever... */ ret = update_channel(priv); if (ret < 0) - lbs_deb_assoc("ASSOC: channel: error getting channel."); + lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); if (assoc_req->channel != priv->curbssparams.channel) { lbs_deb_assoc("ASSOC: channel: failed to update channel to %d\n", @@ -240,7 +240,7 @@ static int assoc_helper_channel(struct lbs_private *priv, } /* Must restart/rejoin adhoc networks after channel change */ - set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); + set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); restore_mesh: if (priv->mesh_dev) @@ -334,7 +334,7 @@ static int assoc_helper_secinfo(struct lbs_private *priv, CMD_OPTION_WAITFORRSP, 0, &rsn); if (ret) { - lbs_deb_assoc("Failed to get RSN status: %d", ret); + lbs_deb_assoc("Failed to get RSN status: %d\n", ret); goto out; } diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 5ddb46a477a..8d8f9d9ba19 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -222,7 +222,7 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, int i; if (!assoc_req) { - lbs_deb_cmd("Invalid association request!"); + lbs_deb_cmd("Invalid association request!\n"); ret = -1; goto done; } @@ -2088,17 +2088,17 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) if (priv->dnld_sent) { allowed = 0; - lbs_deb_host("dnld_sent was set"); + lbs_deb_host("dnld_sent was set\n"); } spin_lock_irqsave(&priv->driver_lock, flags); if (priv->cur_cmd) { allowed = 0; - lbs_deb_host("cur_cmd was set"); + lbs_deb_host("cur_cmd was set\n"); } if (priv->intcounter > 0) { allowed = 0; - lbs_deb_host("intcounter %d", priv->intcounter); + lbs_deb_host("intcounter %d\n", priv->intcounter); } spin_unlock_irqrestore(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 6b8ac62e6f9..3f8b83cc0d2 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -220,7 +220,7 @@ static int if_usb_probe(struct usb_interface *intf, /* Upload firmware */ cardp->rinfo.cardp = cardp; if (if_usb_prog_firmware(cardp)) { - lbs_deb_usbd(&udev->dev, "FW upload failed"); + lbs_deb_usbd(&udev->dev, "FW upload failed\n"); goto err_prog_firmware; } -- cgit v1.2.3 From a27b9f96f21a2f15c423cca745f65de3db61e364 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 00:41:51 -0500 Subject: libertas: slight cleanup of netif queue stop/wake In particular, we shouldn't be waking the queues in lbs_host_to_card_done() any more. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 14 ++++++++------ drivers/net/wireless/libertas/join.c | 7 ++++--- drivers/net/wireless/libertas/main.c | 12 +----------- drivers/net/wireless/libertas/scan.c | 12 +++++++----- 4 files changed, 20 insertions(+), 25 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 53f73c4abdd..a809f8f9997 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -43,14 +43,15 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) msleep_interruptible(1000); wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - /* Free Tx and Rx packets */ - kfree_skb(priv->currenttxskb); - priv->currenttxskb = NULL; - /* report disconnect to upper layer */ netif_stop_queue(priv->dev); netif_carrier_off(priv->dev); + /* Free Tx and Rx packets */ + kfree_skb(priv->currenttxskb); + priv->currenttxskb = NULL; + priv->tx_pending_len = 0; + /* reset SNR/NF/RSSI values */ memset(priv->SNR, 0x00, sizeof(priv->SNR)); memset(priv->NF, 0x00, sizeof(priv->NF)); @@ -883,9 +884,10 @@ int lbs_process_event(struct lbs_private *priv) } lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); priv->mesh_connect_status = LBS_CONNECTED; - if (priv->mesh_open == 1) { - netif_wake_queue(priv->mesh_dev); + if (priv->mesh_open) { netif_carrier_on(priv->mesh_dev); + if (!priv->tx_pending_len) + netif_wake_queue(priv->mesh_dev); } priv->mode = IW_MODE_ADHOC; schedule_work(&priv->sync_channel); diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 14425d9a198..2d4508048b6 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -781,8 +781,8 @@ int lbs_ret_80211_associate(struct lbs_private *priv, priv->numSNRNF = 0; netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - + if (!priv->tx_pending_len) + netif_wake_queue(priv->dev); memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; @@ -865,7 +865,8 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, priv->curbssparams.ssid_len = bss->ssid_len; netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); + if (!priv->tx_pending_len) + netif_wake_queue(priv->dev); memset(&wrqu, 0, sizeof(wrqu)); memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index cdf5934aaf8..f9bdd123ec4 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -489,19 +489,9 @@ void lbs_host_to_card_done(struct lbs_private *priv) priv->dnld_sent = DNLD_RES_RECEIVED; /* Wake main thread if commands are pending */ - if (!priv->cur_cmd) + if (!priv->cur_cmd || priv->tx_pending_len > 0) wake_up_interruptible(&priv->waitq); - /* Don't wake netif queues if we're in monitor mode and - a TX packet is already pending, or if there are commands - queued to be sent. */ - if (!priv->currenttxskb && list_empty(&priv->cmdpendingq)) { - if (priv->dev && priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - - if (priv->mesh_dev && priv->mesh_connect_status == LBS_CONNECTED) - netif_wake_queue(priv->mesh_dev); - } spin_unlock_irqrestore(&priv->driver_lock, flags); } EXPORT_SYMBOL_GPL(lbs_host_to_card_done); diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 92d84c72e2a..9a61188b62e 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -590,13 +590,13 @@ int lbs_scan_networks(struct lbs_private *priv, netif_stop_queue(priv->dev); netif_carrier_off(priv->dev); if (priv->mesh_dev) { - netif_stop_queue(priv->mesh_dev); - netif_carrier_off(priv->mesh_dev); + netif_stop_queue(priv->mesh_dev); + netif_carrier_off(priv->mesh_dev); } /* Prepare to continue an interrupted scan */ lbs_deb_scan("chan_count %d, last_scanned_channel %d\n", - chan_count, priv->last_scanned_channel); + chan_count, priv->last_scanned_channel); curr_chans = chan_list; /* advance channel list by already-scanned-channels */ if (priv->last_scanned_channel > 0) { @@ -659,11 +659,13 @@ out2: out: if (priv->connect_status == LBS_CONNECTED) { netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); + if (!priv->tx_pending_len) + netif_wake_queue(priv->dev); } if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); + if (!priv->tx_pending_len) + netif_wake_queue(priv->mesh_dev); } kfree(chan_list); -- cgit v1.2.3 From 6ce4fd2a3a84e64a27c42aaa7de6e0e85dee3573 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 15:19:29 -0500 Subject: libertas: add lbs_host_sleep_cfg() command function Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 19 +++++++++++++++++++ drivers/net/wireless/libertas/cmd.h | 3 +++ drivers/net/wireless/libertas/defs.h | 7 +++++++ drivers/net/wireless/libertas/host.h | 2 ++ drivers/net/wireless/libertas/hostcmd.h | 7 +++++++ 5 files changed, 38 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 8d8f9d9ba19..2d7b646557c 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -111,6 +111,25 @@ out: return ret; } +int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, + uint8_t gpio, uint8_t gap) +{ + struct cmd_ds_host_sleep cmd_config; + int ret; + + cmd_config.criteria = cpu_to_le32(criteria); + cmd_config.gpio = gpio; + cmd_config.gap = gap; + + ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, cmd_config); + if (ret) { + lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); + return ret; + } + return ret; +} +EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); + static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action) diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 80714b51285..8d72c7e2525 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -35,4 +35,7 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel); int lbs_mesh_config(struct lbs_private *priv, int enable); +int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, + uint8_t gpio, uint8_t gap); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 9b98ae720bc..3053cc2160b 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h @@ -141,6 +141,13 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in #define LBS_UPLD_SIZE 2312 #define DEV_NAME_LEN 32 +/* Wake criteria for HOST_SLEEP_CFG command */ +#define EHS_WAKE_ON_BROADCAST_DATA 0x0001 +#define EHS_WAKE_ON_UNICAST_DATA 0x0002 +#define EHS_WAKE_ON_MAC_EVENT 0x0004 +#define EHS_WAKE_ON_MULTICAST_DATA 0x0008 +#define EHS_REMOVE_WAKEUP 0xFFFFFFFF + /** Misc constants */ /* This section defines 802.11 specific contants */ diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 64178cff2f4..fe000813f8d 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -73,6 +73,8 @@ #define CMD_802_11_SET_AFC 0x003c #define CMD_802_11_GET_AFC 0x003d #define CMD_802_11_AD_HOC_STOP 0x0040 +#define CMD_802_11_HOST_SLEEP_CFG 0x0043 +#define CMD_802_11_HOST_SLEEP_ACTIVATE 0x0045 #define CMD_802_11_BEACON_STOP 0x0049 #define CMD_802_11_MAC_ADDRESS 0x004d #define CMD_802_11_LED_GPIO_CTRL 0x004e diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index aab5d64f32d..aa4cea04014 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -540,6 +540,13 @@ struct MrvlIEtype_keyParamSet { u8 key[32]; }; +struct cmd_ds_host_sleep { + struct cmd_header hdr; + __le32 criteria; + uint8_t gpio; + uint8_t gap; +} __attribute__ ((packed)); + struct cmd_ds_802_11_key_material { __le16 action; struct MrvlIEtype_keyParamSet keyParamSet[2]; -- cgit v1.2.3 From 689442dca16eb27fee19074499d42845fe54c12a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 16:00:42 -0500 Subject: libertas: switch lbs_cmd() to take a _pointer_ to the command structure This way, it looks more like a normal function. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 17 +++++++++-------- drivers/net/wireless/libertas/cmd.h | 10 ++++------ drivers/net/wireless/libertas/if_usb.c | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 2d7b646557c..f87cecb4c57 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -56,7 +56,7 @@ int lbs_update_hw_spec(struct lbs_private *priv) memset(&cmd, 0, sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd)); memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); - ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, cmd); + ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); if (ret) goto out; @@ -121,7 +121,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, cmd_config.gpio = gpio; cmd_config.gap = gap; - ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, cmd_config); + ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config); if (ret) { lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); return ret; @@ -743,7 +743,7 @@ int lbs_get_data_rate(struct lbs_private *priv) cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.action = cpu_to_le16(CMD_ACT_GET_TX_RATE); - ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); + ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd); if (ret) goto out; @@ -790,7 +790,7 @@ int lbs_set_data_rate(struct lbs_private *priv, u8 rate) lbs_deb_cmd("DATA_RATE: setting auto\n"); } - ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); + ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd); if (ret) goto out; @@ -846,7 +846,7 @@ int lbs_get_channel(struct lbs_private *priv) cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); + ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); if (ret) goto out; @@ -878,7 +878,7 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel) cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); cmd.channel = cpu_to_le16(channel); - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); + ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); if (ret) goto out; @@ -1105,7 +1105,7 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, cmd->action = cpu_to_le16(cmd_action); - ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, (*cmd)); + ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, cmd); lbs_deb_leave(LBS_DEB_CMD); return ret; @@ -1128,7 +1128,7 @@ int lbs_mesh_config(struct lbs_private *priv, int enable) lbs_deb_cmd("mesh config channel %d SSID %s\n", priv->curbssparams.channel, escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); - return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, cmd); + return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, &cmd); } static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, @@ -2160,6 +2160,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, lbs_deb_leave(LBS_DEB_CMD); return 0; } +EXPORT_SYMBOL_GPL(lbs_cmd_copyback); /** * @brief Simple way to call firmware functions diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 8d72c7e2525..e800295479b 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -6,13 +6,11 @@ #include "hostcmd.h" #include "dev.h" -#define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \ - __lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ - callback, callback_arg) +#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) \ + __lbs_cmd(priv, cmdnr, &(cmd)->hdr, sizeof(*(cmd)), cb, cb_arg) -#define lbs_cmd_with_response(priv, cmdnr, cmd) \ - __lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ - lbs_cmd_copyback, (unsigned long) &cmd) +#define lbs_cmd_with_response(priv, cmdnr, cmd) \ + lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) int __lbs_cmd(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 3f8b83cc0d2..74fec9dfca0 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -109,7 +109,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; - if (lbs_cmd(priv, CMD_SET_BOOT2_VER, b2_cmd, NULL, 0)) + if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, NULL, 0)) lbs_deb_usb("Setting boot2 version failed\n"); } -- cgit v1.2.3 From f3db2bb411512d1ebd6233b3985d98f4fe7ea8a8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 16:04:12 -0500 Subject: libertas: make worker thread not freezable We want it to send the HOST_SLEEP_ACTIVATE command on the way down... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index f9bdd123ec4..dd432ea6194 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -653,8 +652,6 @@ static int lbs_thread(void *data) init_waitqueue_entry(&wait, current); - set_freezable(); - for (;;) { int shouldsleep; @@ -698,7 +695,6 @@ static int lbs_thread(void *data) set_current_state(TASK_RUNNING); remove_wait_queue(&priv->waitq, &wait); - try_to_freeze(); lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n", priv->intcounter, priv->currenttxskb, priv->dnld_sent); -- cgit v1.2.3 From ab25ecaea5459f2206dbae25106cff67a24d309e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 17:38:56 -0500 Subject: libertas: implement suspend and resume core methods We (ab)use priv->fw_ready to stop the worker thread from sending more commands or data after the response to the HOST_SLEEP_ACTIVATE command comes in. And we set it from the callback function _directly_ to ensure that the worker thread sees it immediately; if we did it in lbs_suspend() after waking up, that might be too late. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.h | 2 ++ drivers/net/wireless/libertas/main.c | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index e800295479b..e44a0db5048 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -35,5 +35,7 @@ int lbs_mesh_config(struct lbs_private *priv, int enable); int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, uint8_t gpio, uint8_t gap); +int lbs_suspend(struct lbs_private *priv); +int lbs_resume(struct lbs_private *priv); #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index dd432ea6194..1ea119ed3d2 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -820,6 +820,53 @@ static int lbs_thread(void *data) return 0; } +static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy, + struct cmd_header *cmd) +{ + lbs_deb_fw("HOST_SLEEP_ACTIVATE succeeded\n"); + + netif_device_detach(priv->dev); + if (priv->mesh_dev) + netif_device_detach(priv->mesh_dev); + + priv->fw_ready = 0; + return 0; +} + + +int lbs_suspend(struct lbs_private *priv) +{ + struct cmd_header cmd; + int ret; + + memset(&cmd, 0, sizeof(cmd)); + + ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd, + sizeof(cmd), lbs_suspend_callback, 0); + if (ret) + lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret); + + return ret; +} +EXPORT_SYMBOL_GPL(lbs_suspend); + +int lbs_resume(struct lbs_private *priv) +{ + priv->fw_ready = 1; + + /* Firmware doesn't seem to give us RX packets any more + until we send it some command. Might as well update */ + lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, + 0, 0, NULL); + + netif_device_attach(priv->dev); + if (priv->mesh_dev) + netif_device_attach(priv->mesh_dev); + + return 0; +} +EXPORT_SYMBOL_GPL(lbs_resume); + /** * @brief This function downloads firmware image, gets * HW spec from firmware and set basic parameters to -- cgit v1.2.3 From d1f7a5b8cfefdb443a05a9e3d636fe7fef57459a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 17:40:56 -0500 Subject: libertas: implement suspend/resume for USB devices Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 74fec9dfca0..15715a6b59e 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -242,6 +242,10 @@ static int if_usb_probe(struct usb_interface *intf, if_usb_set_boot2_ver(priv); + /* Set suspend/resume configuration: + wake via GPIO2 after a 20ms delay */ + lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA, 2, 20); + usb_get_dev(udev); usb_set_intfdata(intf, cardp); @@ -969,21 +973,24 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_card_rec *cardp = usb_get_intfdata(intf); struct lbs_private *priv = cardp->priv; + int ret; lbs_deb_enter(LBS_DEB_USB); if (priv->psstate != PS_STATE_FULL_POWER) return -1; - netif_device_detach(priv->dev); - netif_device_detach(priv->mesh_dev); + ret = lbs_suspend(priv); + if (ret) + goto out; /* Unlink tx & rx urb */ usb_kill_urb(cardp->tx_urb); usb_kill_urb(cardp->rx_urb); + out: lbs_deb_leave(LBS_DEB_USB); - return 0; + return ret; } static int if_usb_resume(struct usb_interface *intf) @@ -995,8 +1002,7 @@ static int if_usb_resume(struct usb_interface *intf) if_usb_submit_rx_urb(cardp); - netif_device_attach(priv->dev); - netif_device_attach(priv->mesh_dev); + lbs_resume(priv); lbs_deb_leave(LBS_DEB_USB); return 0; -- cgit v1.2.3 From 506e9025e030c441679fb1ae77fb0d6266c34443 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 20:06:06 -0500 Subject: libertas: add ethtool support for wake-on-lan configuration Also, check that suspend is refused if HOST_SLEEP_CFG hasn't been done. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 14 +++++----- drivers/net/wireless/libertas/cmd.h | 3 +-- drivers/net/wireless/libertas/dev.h | 5 ++++ drivers/net/wireless/libertas/ethtool.c | 47 +++++++++++++++++++++++++++++++++ drivers/net/wireless/libertas/if_usb.c | 6 ++--- drivers/net/wireless/libertas/main.c | 8 ++++++ 6 files changed, 72 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index f87cecb4c57..ddf15271244 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -111,21 +111,23 @@ out: return ret; } -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - uint8_t gpio, uint8_t gap) +int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria) { struct cmd_ds_host_sleep cmd_config; int ret; cmd_config.criteria = cpu_to_le32(criteria); - cmd_config.gpio = gpio; - cmd_config.gap = gap; + cmd_config.gpio = priv->wol_gpio; + cmd_config.gap = priv->wol_gap; ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config); - if (ret) { + if (!ret) { + lbs_deb_cmd("Set WOL criteria to %x\n", criteria); + priv->wol_criteria = criteria; + } else { lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); - return ret; } + return ret; } EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index e44a0db5048..55f2436574d 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -33,8 +33,7 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel); int lbs_mesh_config(struct lbs_private *priv, int enable); -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - uint8_t gpio, uint8_t gap); +int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria); int lbs_suspend(struct lbs_private *priv); int lbs_resume(struct lbs_private *priv); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 86b45a471fc..60a6a51d0dc 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -153,6 +153,11 @@ struct lbs_private { int (*hw_get_int_status) (struct lbs_private *priv, u8 *); int (*hw_read_event_cause) (struct lbs_private *); + /* Wake On LAN */ + uint32_t wol_criteria; + uint8_t wol_gpio; + uint8_t wol_gap; + /* was struct lbs_adapter from here... */ /** Wlan adapter data structure*/ diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index a54b4f406af..21e6f988ea8 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c @@ -8,6 +8,8 @@ #include "dev.h" #include "join.h" #include "wext.h" +#include "cmd.h" + static const char * mesh_stat_strings[]= { "drop_duplicate_bcast", "drop_ttl_zero", @@ -172,6 +174,49 @@ static void lbs_ethtool_get_strings(struct net_device *dev, lbs_deb_enter(LBS_DEB_ETHTOOL); } +static void lbs_ethtool_get_wol(struct net_device *dev, + struct ethtool_wolinfo *wol) +{ + struct lbs_private *priv = dev->priv; + + if (priv->wol_criteria == 0xffffffff) { + /* Interface driver didn't configure wake */ + wol->supported = wol->wolopts = 0; + return; + } + + wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY; + + if (priv->wol_criteria & EHS_WAKE_ON_UNICAST_DATA) + wol->wolopts |= WAKE_UCAST; + if (priv->wol_criteria & EHS_WAKE_ON_MULTICAST_DATA) + wol->wolopts |= WAKE_MCAST; + if (priv->wol_criteria & EHS_WAKE_ON_BROADCAST_DATA) + wol->wolopts |= WAKE_BCAST; + if (priv->wol_criteria & EHS_WAKE_ON_MAC_EVENT) + wol->wolopts |= WAKE_PHY; +} + +static int lbs_ethtool_set_wol(struct net_device *dev, + struct ethtool_wolinfo *wol) +{ + struct lbs_private *priv = dev->priv; + uint32_t criteria = 0; + + if (priv->wol_criteria == 0xffffffff && wol->wolopts) + return -EOPNOTSUPP; + + if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY)) + return -EOPNOTSUPP; + + if (wol->wolopts & WAKE_UCAST) criteria |= EHS_WAKE_ON_UNICAST_DATA; + if (wol->wolopts & WAKE_MCAST) criteria |= EHS_WAKE_ON_MULTICAST_DATA; + if (wol->wolopts & WAKE_BCAST) criteria |= EHS_WAKE_ON_BROADCAST_DATA; + if (wol->wolopts & WAKE_PHY) criteria |= EHS_WAKE_ON_MAC_EVENT; + + return lbs_host_sleep_cfg(priv, criteria); +} + struct ethtool_ops lbs_ethtool_ops = { .get_drvinfo = lbs_ethtool_get_drvinfo, .get_eeprom = lbs_ethtool_get_eeprom, @@ -179,5 +224,7 @@ struct ethtool_ops lbs_ethtool_ops = { .get_sset_count = lbs_ethtool_get_sset_count, .get_ethtool_stats = lbs_ethtool_get_stats, .get_strings = lbs_ethtool_get_strings, + .get_wol = lbs_ethtool_get_wol, + .set_wol = lbs_ethtool_set_wol, }; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 15715a6b59e..81914165259 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -242,9 +242,9 @@ static int if_usb_probe(struct usb_interface *intf, if_usb_set_boot2_ver(priv); - /* Set suspend/resume configuration: - wake via GPIO2 after a 20ms delay */ - lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA, 2, 20); + priv->wol_gpio = 2; /* Wake via GPIO2... */ + priv->wol_gap = 20; /* ... after 20ms */ + lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA); usb_get_dev(udev); usb_set_intfdata(intf, cardp); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 1ea119ed3d2..5e2f3296be3 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -839,6 +839,11 @@ int lbs_suspend(struct lbs_private *priv) struct cmd_header cmd; int ret; + if (priv->wol_criteria == 0xffffffff) { + lbs_pr_info("Suspend attempt without configuring wake params!\n"); + return -EINVAL; + } + memset(&cmd, 0, sizeof(cmd)); ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd, @@ -1088,6 +1093,9 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) sprintf(priv->mesh_ssid, "mesh"); priv->mesh_ssid_len = 4; + priv->wol_criteria = 0xffffffff; + priv->wol_gpio = 0xff; + goto done; err_init_adapter: -- cgit v1.2.3 From 9f4625776f96e26b15d98615337ea5916648b1e8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 22:50:21 -0500 Subject: libertas: make lbs_update_channel() function non-static We'll want to use this for meshfrobbing Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 8 ++++---- drivers/net/wireless/libertas/decl.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 21a56961742..ff976ebcd01 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -163,7 +163,7 @@ done: } -static int update_channel(struct lbs_private *priv) +int lbs_update_channel(struct lbs_private *priv) { int ret; @@ -184,7 +184,7 @@ void lbs_sync_channel(struct work_struct *work) sync_channel); lbs_deb_enter(LBS_DEB_ASSOC); - if (update_channel(priv) != 0) + if (lbs_update_channel(priv)) lbs_pr_info("Channel synchronization failed."); lbs_deb_leave(LBS_DEB_ASSOC); } @@ -196,7 +196,7 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_ASSOC); - ret = update_channel(priv); + ret = lbs_update_channel(priv); if (ret < 0) { lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); } @@ -220,7 +220,7 @@ static int assoc_helper_channel(struct lbs_private *priv, /* FIXME: shouldn't need to grab the channel _again_ after setting * it since the firmware is supposed to return the new channel, but * whatever... */ - ret = update_channel(priv); + ret = lbs_update_channel(priv); if (ret < 0) lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 9b0ef166185..45f081b6870 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -77,4 +77,5 @@ int lbs_stop_card(struct lbs_private *priv); int lbs_reset_device(struct lbs_private *priv); void lbs_host_to_card_done(struct lbs_private *priv); +int lbs_update_channel(struct lbs_private *priv); #endif -- cgit v1.2.3 From 020f3d0001cb249ceae623c1a7ae0c196326ef3f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 12 Dec 2007 23:29:13 -0500 Subject: libertas: cope with both old and new mesh TLV values Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 6 +++--- drivers/net/wireless/libertas/dev.h | 2 ++ drivers/net/wireless/libertas/main.c | 32 +++++++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index ddf15271244..c4299ae1774 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1121,14 +1121,14 @@ int lbs_mesh_config(struct lbs_private *priv, int enable) memset(&cmd, 0, sizeof(cmd)); cmd.action = cpu_to_le16(enable); cmd.channel = cpu_to_le16(priv->curbssparams.channel); - cmd.type = cpu_to_le16(0x100 + 37); + cmd.type = cpu_to_le16(priv->mesh_tlv); if (enable) { cmd.length = cpu_to_le16(priv->mesh_ssid_len); memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); } - lbs_deb_cmd("mesh config channel %d SSID %s\n", - priv->curbssparams.channel, + lbs_deb_cmd("mesh config enable %d TLV %x channel %d SSID %s\n", + enable, priv->mesh_tlv, priv->curbssparams.channel, escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, &cmd); } diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 60a6a51d0dc..e6f553d5d2c 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -206,6 +206,8 @@ struct lbs_private { /** current ssid/bssid related parameters*/ struct current_bss_params curbssparams; + + uint16_t mesh_tlv; u8 mesh_ssid[IW_ESSID_MAX_SIZE + 1]; u8 mesh_ssid_len; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 5e2f3296be3..2409df85c2e 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1171,8 +1171,33 @@ int lbs_start_card(struct lbs_private *priv) } if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) lbs_pr_err("cannot register lbs_rtap attribute\n"); - if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) - lbs_pr_err("cannot register lbs_mesh attribute\n"); + + /* Enable mesh, if supported, and work out which TLV it uses. + 0x100 + 291 is an unofficial value used in 5.110.20.pXX + 0x100 + 37 is the official value used in 5.110.21.pXX + but we check them in that order because 20.pXX doesn't + give an error -- it just silently fails. */ + + /* 5.110.20.pXX firmware will fail the command if the channel + doesn't match the existing channel. But only if the TLV + is correct. If the channel is wrong, _BOTH_ versions will + give an error to 0x100+291, and allow 0x100+37 to succeed. + It's just that 5.110.20.pXX will not have done anything + useful */ + + lbs_update_channel(priv); + priv->mesh_tlv = 0x100 + 291; + if (lbs_mesh_config(priv, 1)) { + priv->mesh_tlv = 0x100 + 37; + if (lbs_mesh_config(priv, 1)) + priv->mesh_tlv = 0; + } + if (priv->mesh_tlv) { + lbs_add_mesh(priv); + + if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) + lbs_pr_err("cannot register lbs_mesh attribute\n"); + } lbs_debugfs_init_one(priv, dev); @@ -1201,7 +1226,8 @@ int lbs_stop_card(struct lbs_private *priv) lbs_debugfs_remove_one(priv); device_remove_file(&dev->dev, &dev_attr_lbs_rtap); - device_remove_file(&dev->dev, &dev_attr_lbs_mesh); + if (priv->mesh_tlv) + device_remove_file(&dev->dev, &dev_attr_lbs_mesh); /* Flush pending command nodes */ spin_lock_irqsave(&priv->driver_lock, flags); -- cgit v1.2.3 From 860621347e88b23517fc4ec93fa5af940401c3ec Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 13 Dec 2007 00:32:36 -0500 Subject: libertas: pass channel argument directly to lbs_mesh_config() There is weirdness here; the firmware seems to refuse to change channels at will. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 11 ++++++----- drivers/net/wireless/libertas/cmd.c | 6 +++--- drivers/net/wireless/libertas/cmd.h | 2 +- drivers/net/wireless/libertas/main.c | 6 +++--- drivers/net/wireless/libertas/wext.c | 7 +++---- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index ff976ebcd01..cd8e043b16f 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -205,13 +205,14 @@ static int assoc_helper_channel(struct lbs_private *priv, goto done; if (priv->mesh_dev) { - /* Disconnect mesh while associating -- otherwise it - won't let us change channels */ - lbs_mesh_config(priv, 0); + /* Change mesh channel first; 21.p21 firmware won't let + you change channel otherwise (even though it'll return + an error to this */ + lbs_mesh_config(priv, 0, assoc_req->channel); } lbs_deb_assoc("ASSOC: channel: %d -> %d\n", - priv->curbssparams.channel, assoc_req->channel); + priv->curbssparams.channel, assoc_req->channel); ret = lbs_set_channel(priv, assoc_req->channel); if (ret < 0) @@ -244,7 +245,7 @@ static int assoc_helper_channel(struct lbs_private *priv, restore_mesh: if (priv->mesh_dev) - lbs_mesh_config(priv, 1); + lbs_mesh_config(priv, 1, priv->curbssparams.channel); done: lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index c4299ae1774..171acc27ffb 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1114,13 +1114,13 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, } EXPORT_SYMBOL_GPL(lbs_mesh_access); -int lbs_mesh_config(struct lbs_private *priv, int enable) +int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan) { struct cmd_ds_mesh_config cmd; memset(&cmd, 0, sizeof(cmd)); cmd.action = cpu_to_le16(enable); - cmd.channel = cpu_to_le16(priv->curbssparams.channel); + cmd.channel = cpu_to_le16(chan); cmd.type = cpu_to_le16(priv->mesh_tlv); if (enable) { @@ -1128,7 +1128,7 @@ int lbs_mesh_config(struct lbs_private *priv, int enable) memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); } lbs_deb_cmd("mesh config enable %d TLV %x channel %d SSID %s\n", - enable, priv->mesh_tlv, priv->curbssparams.channel, + enable, priv->mesh_tlv, chan, escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, &cmd); } diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 55f2436574d..a4aaa6b34a7 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -31,7 +31,7 @@ int lbs_set_data_rate(struct lbs_private *priv, u8 rate); int lbs_get_channel(struct lbs_private *priv); int lbs_set_channel(struct lbs_private *priv, u8 channel); -int lbs_mesh_config(struct lbs_private *priv, int enable); +int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan); int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria); int lbs_suspend(struct lbs_private *priv); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2409df85c2e..9232b975a42 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -344,7 +344,7 @@ static ssize_t lbs_mesh_set(struct device *dev, if (enable == !!priv->mesh_dev) return count; - ret = lbs_mesh_config(priv, enable); + ret = lbs_mesh_config(priv, enable, priv->curbssparams.channel); if (ret) return ret; @@ -1187,9 +1187,9 @@ int lbs_start_card(struct lbs_private *priv) lbs_update_channel(priv); priv->mesh_tlv = 0x100 + 291; - if (lbs_mesh_config(priv, 1)) { + if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) { priv->mesh_tlv = 0x100 + 37; - if (lbs_mesh_config(priv, 1)) + if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) priv->mesh_tlv = 0; } if (priv->mesh_tlv) { diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 262d4cc5804..b1e24723f2f 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -1000,9 +1000,8 @@ static int lbs_mesh_set_freq(struct net_device *dev, else if (priv->mode == IW_MODE_ADHOC) lbs_stop_adhoc_network(priv); } - priv->curbssparams.channel = fwrq->m; - lbs_mesh_config(priv, 0); - lbs_mesh_config(priv, 1); + lbs_mesh_config(priv, 1, fwrq->m); + lbs_update_channel(priv); ret = 0; out: @@ -2010,7 +2009,7 @@ static int lbs_mesh_set_essid(struct net_device *dev, priv->mesh_ssid_len = dwrq->length; } - lbs_mesh_config(priv, 1); + lbs_mesh_config(priv, 1, priv->curbssparams.channel); out: lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); return ret; -- cgit v1.2.3 From f5a3ea6f966700ae82504202fdd827f2d3c79e66 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 13 Dec 2007 01:53:57 -0500 Subject: libertas: use spin_is_locked() instead of spin_trylock() in lbs_interrupt() We get scary warnings on UP if we use spin_trylock() and find, as we hoped, that the lock in question is already locked. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9232b975a42..5d2bf539d4b 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1414,8 +1414,7 @@ void lbs_interrupt(struct lbs_private *priv) lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter); - if (spin_trylock(&priv->driver_lock)) { - spin_unlock(&priv->driver_lock); + if (!spin_is_locked(&priv->driver_lock)) { printk(KERN_CRIT "%s called without driver_lock held\n", __func__); WARN_ON(1); } -- cgit v1.2.3 From d9f88705a7ce2f9ef13d6656ee715493a663edfc Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 13 Dec 2007 21:48:00 -0500 Subject: libertas: don't exit worker thread until kthread_stop() is called The kthread code can't cope with a thread exiting of its own accord and then someone calling kthread_stop() for it. When the thread detects that it needs to die, make it wait for kthread_stop() to be called. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 5d2bf539d4b..b51513fb59e 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -662,8 +662,10 @@ static int lbs_thread(void *data) set_current_state(TASK_INTERRUPTIBLE); spin_lock_irq(&priv->driver_lock); - if (priv->surpriseremoved) + if (kthread_should_stop()) shouldsleep = 0; /* Bye */ + else if (priv->surpriseremoved) + shouldsleep = 1; /* We need to wait until we're _told_ to die */ else if (priv->psstate == PS_STATE_SLEEP) shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ else if (priv->intcounter) @@ -699,12 +701,15 @@ static int lbs_thread(void *data) lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n", priv->intcounter, priv->currenttxskb, priv->dnld_sent); - if (kthread_should_stop() || priv->surpriseremoved) { - lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n", - priv->surpriseremoved); + if (kthread_should_stop()) { + lbs_deb_thread("main-thread: break from main thread\n"); break; } + if (priv->surpriseremoved) { + lbs_deb_thread("adapter removed; waiting to die...\n"); + continue; + } spin_lock_irq(&priv->driver_lock); -- cgit v1.2.3 From b926d6b31e2dd8f1bc21a9576aff0e486e21d32a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 13 Dec 2007 21:53:16 -0500 Subject: libertas: stop attempting to reset devices on unload It wasn't working anyway -- by the time we get into if_usb_disconnect() the USB core has already stopped us talking to the thing; even if it's just on unload and the device still exists. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 81914165259..25925bd761d 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -278,16 +278,11 @@ static void if_usb_disconnect(struct usb_interface *intf) cardp->surprise_removed = 1; if (priv) { - priv->surpriseremoved = 1; lbs_stop_card(priv); lbs_remove_card(priv); } - /* this is (apparently?) necessary for future usage of the device */ - lbs_prepare_and_send_command(priv, CMD_802_11_RESET, CMD_ACT_HALT, - 0, 0, NULL); - /* Unlink and free urb */ if_usb_free(cardp); -- cgit v1.2.3 From eae86bf378de981696697426831bd9db68930740 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 14 Dec 2007 00:47:05 -0500 Subject: libertas: clean up if_usb driver It was just getting on my tits, really. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 428 ++++++++++++++------------------- drivers/net/wireless/libertas/if_usb.h | 95 ++++---- 2 files changed, 225 insertions(+), 298 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 25925bd761d..9cb9e031040 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -16,6 +16,9 @@ #include "cmd.h" #include "if_usb.h" +#define INSANEDEBUG 0 +#define lbs_deb_usb2(...) do { if (INSANEDEBUG) lbs_deb_usbd(__VA_ARGS__); } while (0) + #define MESSAGE_HEADER_LEN 4 static char *lbs_fw_name = "usb8388.bin"; @@ -32,17 +35,16 @@ MODULE_DEVICE_TABLE(usb, if_usb_table); static void if_usb_receive(struct urb *urb); static void if_usb_receive_fwload(struct urb *urb); -static int if_usb_prog_firmware(struct usb_card_rec *cardp); -static int if_usb_host_to_card(struct lbs_private *priv, - u8 type, - u8 *payload, - u16 nb); -static int if_usb_get_int_status(struct lbs_private *priv, u8 *); +static int if_usb_prog_firmware(struct if_usb_card *cardp); +static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type, + uint8_t *payload, uint16_t nb); +static int if_usb_get_int_status(struct lbs_private *priv, uint8_t *); static int if_usb_read_event_cause(struct lbs_private *); -static int usb_tx_block(struct usb_card_rec *cardp, u8 *payload, u16 nb); -static void if_usb_free(struct usb_card_rec *cardp); -static int if_usb_submit_rx_urb(struct usb_card_rec *cardp); -static int if_usb_reset_device(struct usb_card_rec *cardp); +static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, + uint16_t nb); +static void if_usb_free(struct if_usb_card *cardp); +static int if_usb_submit_rx_urb(struct if_usb_card *cardp); +static int if_usb_reset_device(struct if_usb_card *cardp); /** * @brief call back function to handle the status of the URB @@ -51,18 +53,16 @@ static int if_usb_reset_device(struct usb_card_rec *cardp); */ static void if_usb_write_bulk_callback(struct urb *urb) { - struct usb_card_rec *cardp = (struct usb_card_rec *) urb->context; + struct if_usb_card *cardp = (struct if_usb_card *) urb->context; /* handle the transmission complete validations */ if (urb->status == 0) { struct lbs_private *priv = cardp->priv; - /* - lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n"); - lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n", - urb->actual_length); - */ + lbs_deb_usb2(&urb->dev->dev, "URB status is successful\n"); + lbs_deb_usb2(&urb->dev->dev, "Actual length transmitted %d\n", + urb->actual_length); /* Used for both firmware TX and regular TX. priv isn't * valid at firmware load time. @@ -79,10 +79,10 @@ static void if_usb_write_bulk_callback(struct urb *urb) /** * @brief free tx/rx urb, skb and rx buffer - * @param cardp pointer usb_card_rec + * @param cardp pointer if_usb_card * @return N/A */ -static void if_usb_free(struct usb_card_rec *cardp) +static void if_usb_free(struct if_usb_card *cardp) { lbs_deb_enter(LBS_DEB_USB); @@ -96,8 +96,8 @@ static void if_usb_free(struct usb_card_rec *cardp) usb_free_urb(cardp->rx_urb); cardp->rx_urb = NULL; - kfree(cardp->bulk_out_buffer); - cardp->bulk_out_buffer = NULL; + kfree(cardp->ep_out_buf); + cardp->ep_out_buf = NULL; lbs_deb_leave(LBS_DEB_USB); } @@ -115,7 +115,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) static void if_usb_fw_timeo(unsigned long priv) { - struct usb_card_rec *cardp = (void *)priv; + struct if_usb_card *cardp = (void *)priv; if (cardp->fwdnldover) { lbs_deb_usb("Download complete, no event. Assuming success\n"); @@ -125,6 +125,7 @@ static void if_usb_fw_timeo(unsigned long priv) } wake_up(&cardp->fw_wq); } + /** * @brief sets the configuration values * @param ifnum interface number @@ -138,12 +139,12 @@ static int if_usb_probe(struct usb_interface *intf, struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; struct lbs_private *priv; - struct usb_card_rec *cardp; + struct if_usb_card *cardp; int i; udev = interface_to_usbdev(intf); - cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); + cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); if (!cardp) { lbs_pr_err("Out of memory allocating private data.\n"); goto error; @@ -156,7 +157,7 @@ static int if_usb_probe(struct usb_interface *intf, iface_desc = intf->cur_altsetting; lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" - " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", + " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", le16_to_cpu(udev->descriptor.bcdUSB), udev->descriptor.bDeviceClass, udev->descriptor.bDeviceSubClass, @@ -164,61 +165,40 @@ static int if_usb_probe(struct usb_interface *intf, for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { endpoint = &iface_desc->endpoint[i].desc; - if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == - USB_ENDPOINT_XFER_BULK)) { - /* we found a bulk in endpoint */ - lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", - le16_to_cpu(endpoint->wMaxPacketSize)); - if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) { - lbs_deb_usbd(&udev->dev, - "Rx URB allocation failed\n"); - goto dealloc; - } - cardp->bulk_in_size = - le16_to_cpu(endpoint->wMaxPacketSize); - cardp->bulk_in_endpointAddr = - (endpoint-> - bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); - lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", - endpoint->bEndpointAddress); - } + if (usb_endpoint_is_bulk_in(endpoint)) { + cardp->ep_in_size = le16_to_cpu(endpoint->wMaxPacketSize); + cardp->ep_in = usb_endpoint_num(endpoint); - if (((endpoint-> - bEndpointAddress & USB_ENDPOINT_DIR_MASK) == - USB_DIR_OUT) - && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == - USB_ENDPOINT_XFER_BULK)) { - /* We found bulk out endpoint */ - if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) { - lbs_deb_usbd(&udev->dev, - "Tx URB allocation failed\n"); - goto dealloc; - } + lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", cardp->ep_in); + lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", cardp->ep_in_size); - cardp->bulk_out_size = - le16_to_cpu(endpoint->wMaxPacketSize); - lbs_deb_usbd(&udev->dev, - "Bulk out size is %d\n", - le16_to_cpu(endpoint->wMaxPacketSize)); - cardp->bulk_out_endpointAddr = - endpoint->bEndpointAddress; - lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", - endpoint->bEndpointAddress); - cardp->bulk_out_buffer = - kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, - GFP_KERNEL); - - if (!cardp->bulk_out_buffer) { - lbs_deb_usbd(&udev->dev, - "Could not allocate buffer\n"); - goto dealloc; - } + } else if (usb_endpoint_is_bulk_out(endpoint)) { + cardp->ep_out_size = le16_to_cpu(endpoint->wMaxPacketSize); + cardp->ep_out = usb_endpoint_num(endpoint); + + lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", cardp->ep_out); + lbs_deb_usbd(&udev->dev, "Bulk out size is %d\n", cardp->ep_out_size); } } + if (!cardp->ep_out_size || !cardp->ep_in_size) { + lbs_deb_usbd(&udev->dev, "Endpoints not found\n"); + goto dealloc; + } + if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) { + lbs_deb_usbd(&udev->dev, "Rx URB allocation failed\n"); + goto dealloc; + } + if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) { + lbs_deb_usbd(&udev->dev, "Tx URB allocation failed\n"); + goto dealloc; + } + cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, GFP_KERNEL); + if (!cardp->ep_out_buf) { + lbs_deb_usbd(&udev->dev, "Could not allocate buffer\n"); + goto dealloc; + } /* Upload firmware */ - cardp->rinfo.cardp = cardp; if (if_usb_prog_firmware(cardp)) { lbs_deb_usbd(&udev->dev, "FW upload failed\n"); goto err_prog_firmware; @@ -269,12 +249,11 @@ error: */ static void if_usb_disconnect(struct usb_interface *intf) { - struct usb_card_rec *cardp = usb_get_intfdata(intf); + struct if_usb_card *cardp = usb_get_intfdata(intf); struct lbs_private *priv = (struct lbs_private *) cardp->priv; lbs_deb_enter(LBS_DEB_MAIN); - /* Update Surprise removed to TRUE */ cardp->surprise_removed = 1; if (priv) { @@ -297,98 +276,75 @@ static void if_usb_disconnect(struct usb_interface *intf) * @param priv pointer to struct lbs_private * @return 0 */ -static int if_usb_send_fw_pkt(struct usb_card_rec *cardp) +static int if_usb_send_fw_pkt(struct if_usb_card *cardp) { - struct FWData *fwdata; - struct fwheader *fwheader; - u8 *firmware = cardp->fw->data; - - fwdata = kmalloc(sizeof(struct FWData), GFP_ATOMIC); - - if (!fwdata) - return -1; - - fwheader = &fwdata->fwheader; + struct fwdata *fwdata = cardp->ep_out_buf; + uint8_t *firmware = cardp->fw->data; + /* If we got a CRC failure on the last block, back + up and retry it */ if (!cardp->CRC_OK) { cardp->totalbytes = cardp->fwlastblksent; - cardp->fwseqnum = cardp->lastseqnum - 1; + cardp->fwseqnum--; } - /* - lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n", - cardp->totalbytes); - */ + lbs_deb_usb2(&cardp->udev->dev, "totalbytes = %d\n", + cardp->totalbytes); - memcpy(fwheader, &firmware[cardp->totalbytes], + /* struct fwdata (which we sent to the card) has an + extra __le32 field in between the header and the data, + which is not in the struct fwheader in the actual + firmware binary. Insert the seqnum in the middle... */ + memcpy(&fwdata->hdr, &firmware[cardp->totalbytes], sizeof(struct fwheader)); cardp->fwlastblksent = cardp->totalbytes; cardp->totalbytes += sizeof(struct fwheader); - /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ memcpy(fwdata->data, &firmware[cardp->totalbytes], - le32_to_cpu(fwdata->fwheader.datalength)); + le32_to_cpu(fwdata->hdr.datalength)); - /* - lbs_deb_usbd(&cardp->udev->dev, - "Data length = %d\n", le32_to_cpu(fwdata->fwheader.datalength)); - */ + lbs_deb_usb2(&cardp->udev->dev, "Data length = %d\n", + le32_to_cpu(fwdata->hdr.datalength)); - cardp->fwseqnum = cardp->fwseqnum + 1; + fwdata->seqnum = cpu_to_le32(++cardp->fwseqnum); + cardp->totalbytes += le32_to_cpu(fwdata->hdr.datalength); - fwdata->seqnum = cpu_to_le32(cardp->fwseqnum); - cardp->lastseqnum = cardp->fwseqnum; - cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength); + usb_tx_block(cardp, cardp->ep_out_buf, sizeof(struct fwdata) + + le32_to_cpu(fwdata->hdr.datalength)); + + if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { + lbs_deb_usb2(&cardp->udev->dev, "There are data to follow\n"); + lbs_deb_usb2(&cardp->udev->dev, "seqnum = %d totalbytes = %d\n", + cardp->fwseqnum, cardp->totalbytes); + } else if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { + lbs_deb_usb2(&cardp->udev->dev, "Host has finished FW downloading\n"); + lbs_deb_usb2(&cardp->udev->dev, "Donwloading FW JUMP BLOCK\n"); - if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { - /* - lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n"); - lbs_deb_usbd(&cardp->udev->dev, - "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, - cardp->totalbytes); - */ - memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); - usb_tx_block(cardp, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); - - } else if (fwdata->fwheader.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { - /* - lbs_deb_usbd(&cardp->udev->dev, - "Host has finished FW downloading\n"); - lbs_deb_usbd(&cardp->udev->dev, - "Donwloading FW JUMP BLOCK\n"); - */ - memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); - usb_tx_block(cardp, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); cardp->fwfinalblk = 1; } - /* - lbs_deb_usbd(&cardp->udev->dev, - "The firmware download is done size is %d\n", - cardp->totalbytes); - */ - - kfree(fwdata); + lbs_deb_usb2(&cardp->udev->dev, "Firmware download done; size %d\n", + cardp->totalbytes); return 0; } -static int if_usb_reset_device(struct usb_card_rec *cardp) +static int if_usb_reset_device(struct if_usb_card *cardp) { - struct cmd_ds_command *cmd = (void *)&cardp->bulk_out_buffer[4]; + struct cmd_ds_command *cmd = cardp->ep_out_buf + 4; int ret; lbs_deb_enter(LBS_DEB_USB); - *(__le32 *)cardp->bulk_out_buffer = cpu_to_le32(CMD_TYPE_REQUEST); + *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); cmd->command = cpu_to_le16(CMD_802_11_RESET); cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); cmd->result = cpu_to_le16(0); cmd->seqnum = cpu_to_le16(0x5a5a); cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT); - usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); + usb_tx_block(cardp, cardp->ep_out_buf, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); msleep(100); ret = usb_reset_device(cardp->udev); @@ -406,7 +362,7 @@ static int if_usb_reset_device(struct usb_card_rec *cardp) * @param nb data length * @return 0 or -1 */ -static int usb_tx_block(struct usb_card_rec *cardp, u8 * payload, u16 nb) +static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, uint16_t nb) { int ret = -1; @@ -418,17 +374,16 @@ static int usb_tx_block(struct usb_card_rec *cardp, u8 * payload, u16 nb) usb_fill_bulk_urb(cardp->tx_urb, cardp->udev, usb_sndbulkpipe(cardp->udev, - cardp->bulk_out_endpointAddr), + cardp->ep_out), payload, nb, if_usb_write_bulk_callback, cardp); cardp->tx_urb->transfer_flags |= URB_ZERO_PACKET; if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { - /* transfer failed */ lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed: %d\n", ret); ret = -1; } else { - /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */ + lbs_deb_usb2(&cardp->udev->dev, "usb_submit_urb success\n"); ret = 0; } @@ -436,11 +391,10 @@ tx_ret: return ret; } -static int __if_usb_submit_rx_urb(struct usb_card_rec *cardp, +static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, void (*callbackfn)(struct urb *urb)) { struct sk_buff *skb; - struct read_cb_info *rinfo = &cardp->rinfo; int ret = -1; if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) { @@ -448,27 +402,25 @@ static int __if_usb_submit_rx_urb(struct usb_card_rec *cardp, goto rx_ret; } - rinfo->skb = skb; + cardp->rx_skb = skb; /* Fill the receive configuration URB and initialise the Rx call back */ usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, - usb_rcvbulkpipe(cardp->udev, - cardp->bulk_in_endpointAddr), + usb_rcvbulkpipe(cardp->udev, cardp->ep_in), (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET), MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, - rinfo); + cardp); cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; - /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */ + lbs_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { - /* handle failure conditions */ lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed: %d\n", ret); kfree_skb(skb); - rinfo->skb = NULL; + cardp->rx_skb = NULL; ret = -1; } else { - /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */ + lbs_deb_usb2(&cardp->udev->dev, "Submit Rx URB success\n"); ret = 0; } @@ -476,27 +428,26 @@ rx_ret: return ret; } -static int if_usb_submit_rx_urb_fwload(struct usb_card_rec *cardp) +static int if_usb_submit_rx_urb_fwload(struct if_usb_card *cardp) { return __if_usb_submit_rx_urb(cardp, &if_usb_receive_fwload); } -static int if_usb_submit_rx_urb(struct usb_card_rec *cardp) +static int if_usb_submit_rx_urb(struct if_usb_card *cardp) { return __if_usb_submit_rx_urb(cardp, &if_usb_receive); } static void if_usb_receive_fwload(struct urb *urb) { - struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; - struct sk_buff *skb = rinfo->skb; - struct usb_card_rec *cardp = (struct usb_card_rec *)rinfo->cardp; + struct if_usb_card *cardp = urb->context; + struct sk_buff *skb = cardp->rx_skb; struct fwsyncheader *syncfwheader; - struct bootcmdrespStr bootcmdresp; + struct bootcmdresp bootcmdresp; if (urb->status) { lbs_deb_usbd(&cardp->udev->dev, - "URB status is failed during fw load\n"); + "URB status is failed during fw load\n"); kfree_skb(skb); return; } @@ -509,8 +460,8 @@ static void if_usb_receive_fwload(struct urb *urb) lbs_pr_info("Firmware ready event received\n"); wake_up(&cardp->fw_wq); } else { - lbs_deb_usb("Waiting for confirmation; got %x %x\n", le32_to_cpu(tmp[0]), - le32_to_cpu(tmp[1])); + lbs_deb_usb("Waiting for confirmation; got %x %x\n", + le32_to_cpu(tmp[0]), le32_to_cpu(tmp[1])); if_usb_submit_rx_urb_fwload(cardp); } kfree_skb(skb); @@ -519,37 +470,36 @@ static void if_usb_receive_fwload(struct urb *urb) if (cardp->bootcmdresp <= 0) { memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, sizeof(bootcmdresp)); + if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { kfree_skb(skb); if_usb_submit_rx_urb_fwload(cardp); cardp->bootcmdresp = 1; lbs_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); + "Received valid boot command response\n"); return; } - if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { - if (bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_REQUEST) || - bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_DATA) || - bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_INDICATION)) { + if (bootcmdresp.magic != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { + if (bootcmdresp.magic == cpu_to_le32(CMD_TYPE_REQUEST) || + bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || + bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { if (!cardp->bootcmdresp) lbs_pr_info("Firmware already seems alive; resetting\n"); cardp->bootcmdresp = -1; } else { lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", - le32_to_cpu(bootcmdresp.u32magicnumber)); + le32_to_cpu(bootcmdresp.magic)); } - } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { - lbs_pr_info( - "boot cmd response cmd_tag error (%d)\n", - bootcmdresp.u8cmd_tag); - } else if (bootcmdresp.u8result != BOOT_CMD_RESP_OK) { - lbs_pr_info( - "boot cmd response result error (%d)\n", - bootcmdresp.u8result); + } else if (bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) { + lbs_pr_info("boot cmd response cmd_tag error (%d)\n", + bootcmdresp.cmd); + } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) { + lbs_pr_info("boot cmd response result error (%d)\n", + bootcmdresp.result); } else { cardp->bootcmdresp = 1; lbs_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); + "Received valid boot command response\n"); } kfree_skb(skb); if_usb_submit_rx_urb_fwload(cardp); @@ -564,20 +514,15 @@ static void if_usb_receive_fwload(struct urb *urb) } memcpy(syncfwheader, skb->data + IPFIELD_ALIGN_OFFSET, - sizeof(struct fwsyncheader)); + sizeof(struct fwsyncheader)); if (!syncfwheader->cmd) { - /* - lbs_deb_usbd(&cardp->udev->dev, - "FW received Blk with correct CRC\n"); - lbs_deb_usbd(&cardp->udev->dev, - "FW received Blk seqnum = %d\n", - syncfwheader->seqnum); - */ + lbs_deb_usb2(&cardp->udev->dev, "FW received Blk with correct CRC\n"); + lbs_deb_usb2(&cardp->udev->dev, "FW received Blk seqnum = %d\n", + le32_to_cpu(syncfwheader->seqnum)); cardp->CRC_OK = 1; } else { - lbs_deb_usbd(&cardp->udev->dev, - "FW received Blk with CRC error\n"); + lbs_deb_usbd(&cardp->udev->dev, "FW received Blk with CRC error\n"); cardp->CRC_OK = 0; } @@ -604,13 +549,12 @@ static void if_usb_receive_fwload(struct urb *urb) #define MRVDRV_MIN_PKT_LEN 30 static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, - struct usb_card_rec *cardp, + struct if_usb_card *cardp, struct lbs_private *priv) { - if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + - MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { - lbs_deb_usbd(&cardp->udev->dev, - "Packet length is Invalid\n"); + if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN + || recvlength < MRVDRV_MIN_PKT_LEN) { + lbs_deb_usbd(&cardp->udev->dev, "Packet length is Invalid\n"); kfree_skb(skb); return; } @@ -618,19 +562,21 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, skb_reserve(skb, IPFIELD_ALIGN_OFFSET); skb_put(skb, recvlength); skb_pull(skb, MESSAGE_HEADER_LEN); + lbs_process_rxed_packet(priv, skb); priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); } -static inline void process_cmdrequest(int recvlength, u8 *recvbuff, +static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, struct sk_buff *skb, - struct usb_card_rec *cardp, + struct if_usb_card *cardp, struct lbs_private *priv) { - u8 *cmdbuf; + uint8_t *cmdbuf; + if (recvlength > LBS_CMD_BUFFER_SIZE) { lbs_deb_usbd(&cardp->udev->dev, - "The receive buffer is too large\n"); + "The receive buffer is too large\n"); kfree_skb(skb); return; } @@ -642,16 +588,16 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, /* take care of cur_cmd = NULL case by reading the * data to clear the interrupt */ if (!priv->cur_cmd) { - lbs_deb_hex(LBS_DEB_HOST, "Unsolicited CMD_RESP", (void *) recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); + lbs_deb_hex(LBS_DEB_HOST, "Unsolicited CMD_RESP", + (void *) recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); cmdbuf = priv->upld_buf; priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; } else - cmdbuf = (u8 *) priv->cur_cmd->cmdbuf; + cmdbuf = (uint8_t *) priv->cur_cmd->cmdbuf; cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); - memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, - priv->upld_len); + memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); kfree_skb(skb); lbs_interrupt(priv); @@ -659,8 +605,6 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, lbs_deb_usbd(&cardp->udev->dev, "Wake up main thread to handle cmd response\n"); - - return; } /** @@ -672,30 +616,26 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, */ static void if_usb_receive(struct urb *urb) { - struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; - struct sk_buff *skb = rinfo->skb; - struct usb_card_rec *cardp = (struct usb_card_rec *) rinfo->cardp; + struct if_usb_card *cardp = urb->context; + struct sk_buff *skb = cardp->rx_skb; struct lbs_private *priv = cardp->priv; - int recvlength = urb->actual_length; - u8 *recvbuff = NULL; - u32 recvtype = 0; + uint8_t *recvbuff = NULL; + uint32_t recvtype = 0; + __le32 *pkt = (__le32 *)(skb->data + IPFIELD_ALIGN_OFFSET); lbs_deb_enter(LBS_DEB_USB); if (recvlength) { - __le32 tmp; - if (urb->status) { - lbs_deb_usbd(&cardp->udev->dev, - "URB status is failed\n"); + lbs_deb_usbd(&cardp->udev->dev, "RX URB failed: %d\n", + urb->status); kfree_skb(skb); goto setup_for_next; } recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; - memcpy(&tmp, recvbuff, sizeof(u32)); - recvtype = le32_to_cpu(tmp); + recvtype = le32_to_cpu(pkt[0]); lbs_deb_usbd(&cardp->udev->dev, "Recv length = 0x%x, Recv type = 0x%X\n", recvlength, recvtype); @@ -716,9 +656,13 @@ static void if_usb_receive(struct urb *urb) case CMD_TYPE_INDICATION: /* Event cause handling */ spin_lock(&priv->driver_lock); - cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN)); + + cardp->usb_event_cause = le32_to_cpu(pkt[1]); + lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", - cardp->usb_event_cause); + cardp->usb_event_cause); + + /* Icky undocumented magic special case */ if (cardp->usb_event_cause & 0xffff0000) { lbs_send_tx_feedback(priv); spin_unlock(&priv->driver_lock); @@ -732,7 +676,7 @@ static void if_usb_receive(struct urb *urb) goto rx_exit; default: lbs_deb_usbd(&cardp->udev->dev, "Unknown command type 0x%X\n", - recvtype); + recvtype); kfree_skb(skb); break; } @@ -751,55 +695,48 @@ rx_exit: * @param len number of bytes * @return 0 or -1 */ -static int if_usb_host_to_card(struct lbs_private *priv, - u8 type, - u8 *payload, - u16 nb) +static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type, + uint8_t *payload, uint16_t nb) { - struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; + struct if_usb_card *cardp = priv->card; lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type); lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb); if (type == MVMS_CMD) { - __le32 tmp = cpu_to_le32(CMD_TYPE_REQUEST); + *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); priv->dnld_sent = DNLD_CMD_SENT; - memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, - MESSAGE_HEADER_LEN); - } else { - __le32 tmp = cpu_to_le32(CMD_TYPE_DATA); + *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_DATA); priv->dnld_sent = DNLD_DATA_SENT; - memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, - MESSAGE_HEADER_LEN); } - memcpy((cardp->bulk_out_buffer + MESSAGE_HEADER_LEN), payload, nb); + memcpy((cardp->ep_out_buf + MESSAGE_HEADER_LEN), payload, nb); - return usb_tx_block(cardp, cardp->bulk_out_buffer, - nb + MESSAGE_HEADER_LEN); + return usb_tx_block(cardp, cardp->ep_out_buf, nb + MESSAGE_HEADER_LEN); } /* called with priv->driver_lock held */ -static int if_usb_get_int_status(struct lbs_private *priv, u8 *ireg) +static int if_usb_get_int_status(struct lbs_private *priv, uint8_t *ireg) { - struct usb_card_rec *cardp = priv->card; + struct if_usb_card *cardp = priv->card; *ireg = cardp->usb_int_cause; cardp->usb_int_cause = 0; - lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg); + lbs_deb_usbd(&cardp->udev->dev, "Int cause is 0x%X\n", *ireg); return 0; } static int if_usb_read_event_cause(struct lbs_private *priv) { - struct usb_card_rec *cardp = priv->card; + struct if_usb_card *cardp = priv->card; priv->eventcause = cardp->usb_event_cause; /* Re-submit rx urb here to avoid event lost issue */ if_usb_submit_rx_urb(cardp); + return 0; } @@ -809,20 +746,17 @@ static int if_usb_read_event_cause(struct lbs_private *priv) * 2:Boot from FW in EEPROM * @return 0 */ -static int if_usb_issue_boot_command(struct usb_card_rec *cardp, int ivalue) +static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue) { - struct bootcmdstr sbootcmd; - int i; + struct bootcmd *bootcmd = cardp->ep_out_buf; /* Prepare command */ - sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); - sbootcmd.u8cmd_tag = ivalue; - for (i=0; i<11; i++) - sbootcmd.au8dumy[i]=0x00; - memcpy(cardp->bulk_out_buffer, &sbootcmd, sizeof(struct bootcmdstr)); + bootcmd->magic = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); + bootcmd->cmd = ivalue; + memset(bootcmd->pad, 0, sizeof(bootcmd->pad)); /* Issue command */ - usb_tx_block(cardp, cardp->bulk_out_buffer, sizeof(struct bootcmdstr)); + usb_tx_block(cardp, cardp->ep_out_buf, sizeof(*bootcmd)); return 0; } @@ -835,10 +769,10 @@ static int if_usb_issue_boot_command(struct usb_card_rec *cardp, int ivalue) * len image length * @return 0 or -1 */ -static int check_fwfile_format(u8 *data, u32 totlen) +static int check_fwfile_format(uint8_t *data, uint32_t totlen) { - u32 bincmd, exit; - u32 blksize, offset, len; + uint32_t bincmd, exit; + uint32_t blksize, offset, len; int ret; ret = 1; @@ -876,7 +810,7 @@ static int check_fwfile_format(u8 *data, u32 totlen) } -static int if_usb_prog_firmware(struct usb_card_rec *cardp) +static int if_usb_prog_firmware(struct if_usb_card *cardp) { int i = 0; static int reset_count = 10; @@ -953,11 +887,11 @@ restart: goto release_fw; } -release_fw: + release_fw: release_firmware(cardp->fw); cardp->fw = NULL; -done: + done: lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); return ret; } @@ -966,7 +900,7 @@ done: #ifdef CONFIG_PM static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) { - struct usb_card_rec *cardp = usb_get_intfdata(intf); + struct if_usb_card *cardp = usb_get_intfdata(intf); struct lbs_private *priv = cardp->priv; int ret; @@ -990,7 +924,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) static int if_usb_resume(struct usb_interface *intf) { - struct usb_card_rec *cardp = usb_get_intfdata(intf); + struct if_usb_card *cardp = usb_get_intfdata(intf); struct lbs_private *priv = cardp->priv; lbs_deb_enter(LBS_DEB_USB); @@ -1041,5 +975,5 @@ module_init(if_usb_init_module); module_exit(if_usb_exit_module); MODULE_DESCRIPTION("8388 USB WLAN Driver"); -MODULE_AUTHOR("Marvell International Ltd."); +MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc."); MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 668410f8205..77066911230 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -9,72 +9,67 @@ struct lbs_private; /** * This file contains definition for USB interface. */ -#define CMD_TYPE_REQUEST 0xF00DFACE -#define CMD_TYPE_DATA 0xBEADC0DE -#define CMD_TYPE_INDICATION 0xBEEFFACE +#define CMD_TYPE_REQUEST 0xF00DFACE +#define CMD_TYPE_DATA 0xBEADC0DE +#define CMD_TYPE_INDICATION 0xBEEFFACE -#define IPFIELD_ALIGN_OFFSET 2 +#define IPFIELD_ALIGN_OFFSET 2 -#define BOOT_CMD_FW_BY_USB 0x01 -#define BOOT_CMD_FW_IN_EEPROM 0x02 -#define BOOT_CMD_UPDATE_BOOT2 0x03 -#define BOOT_CMD_UPDATE_FW 0x04 -#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */ +#define BOOT_CMD_FW_BY_USB 0x01 +#define BOOT_CMD_FW_IN_EEPROM 0x02 +#define BOOT_CMD_UPDATE_BOOT2 0x03 +#define BOOT_CMD_UPDATE_FW 0x04 +#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */ -struct bootcmdstr +struct bootcmd { - __le32 u32magicnumber; - u8 u8cmd_tag; - u8 au8dumy[11]; + __le32 magic; + uint8_t cmd; + uint8_t pad[11]; }; -#define BOOT_CMD_RESP_OK 0x0001 -#define BOOT_CMD_RESP_FAIL 0x0000 +#define BOOT_CMD_RESP_OK 0x0001 +#define BOOT_CMD_RESP_FAIL 0x0000 -struct bootcmdrespStr +struct bootcmdresp { - __le32 u32magicnumber; - u8 u8cmd_tag; - u8 u8result; - u8 au8dumy[2]; -}; - -/* read callback private data */ -struct read_cb_info { - struct usb_card_rec *cardp; - struct sk_buff *skb; + __le32 magic; + uint8_t cmd; + uint8_t result; + uint8_t pad[2]; }; /** USB card description structure*/ -struct usb_card_rec { +struct if_usb_card { struct usb_device *udev; struct urb *rx_urb, *tx_urb; struct lbs_private *priv; - struct read_cb_info rinfo; - int bulk_in_size; - u8 bulk_in_endpointAddr; + struct sk_buff *rx_skb; + uint32_t usb_event_cause; + uint8_t usb_int_cause; + + uint8_t ep_in; + uint8_t ep_out; - u8 *bulk_out_buffer; - int bulk_out_size; - u8 bulk_out_endpointAddr; + int8_t bootcmdresp; + + int ep_in_size; + + void *ep_out_buf; + int ep_out_size; const struct firmware *fw; struct timer_list fw_timeout; wait_queue_head_t fw_wq; - u8 CRC_OK; - u32 fwseqnum; - u32 lastseqnum; - u32 totalbytes; - u32 fwlastblksent; - u8 fwdnldover; - u8 fwfinalblk; - u8 surprise_removed; - - u32 usb_event_cause; - u8 usb_int_cause; - - s8 bootcmdresp; + uint32_t fwseqnum; + uint32_t totalbytes; + uint32_t fwlastblksent; + uint8_t CRC_OK; + uint8_t fwdnldover; + uint8_t fwfinalblk; + uint8_t surprise_removed; + }; /** fwheader */ @@ -87,10 +82,10 @@ struct fwheader { #define FW_MAX_DATA_BLK_SIZE 600 /** FWData */ -struct FWData { - struct fwheader fwheader; +struct fwdata { + struct fwheader hdr; __le32 seqnum; - u8 data[FW_MAX_DATA_BLK_SIZE]; + uint8_t data[0]; }; /** fwsyncheader */ @@ -102,7 +97,5 @@ struct fwsyncheader { #define FW_HAS_DATA_TO_RECV 0x00000001 #define FW_HAS_LAST_BLOCK 0x00000004 -#define FW_DATA_XMIT_SIZE \ - sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32) #endif -- cgit v1.2.3 From 7e226272fcf9c1ec8b67fac995ce4227f4f76971 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 14 Dec 2007 22:53:41 -0500 Subject: libertas: kill whitespace at end of lines Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 2 +- drivers/net/wireless/libertas/cmd.h | 4 ++-- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/net/wireless/libertas/if_sdio.c | 2 +- drivers/net/wireless/libertas/if_usb.c | 4 ++-- drivers/net/wireless/libertas/main.c | 14 +++++++------- drivers/net/wireless/libertas/tx.c | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 171acc27ffb..ffef7212621 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1122,7 +1122,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan) cmd.action = cpu_to_le16(enable); cmd.channel = cpu_to_le16(chan); cmd.type = cpu_to_le16(priv->mesh_tlv); - + if (enable) { cmd.length = cpu_to_le16(priv->mesh_ssid_len); memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index a4aaa6b34a7..999fabe5964 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -11,9 +11,9 @@ #define lbs_cmd_with_response(priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) - + int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, + struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg); diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index c5130a2581f..f2781596714 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -296,7 +296,7 @@ static ssize_t lbs_setuserscan(struct file *file, if (!buf) return -ENOMEM; - + buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 7f829c86c45..9225546b9d4 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -19,7 +19,7 @@ * current block size. * * As SDIO is still new to the kernel, it is unfortunately common with - * bugs in the host controllers related to that. One such bug is that + * bugs in the host controllers related to that. One such bug is that * controllers cannot do transfers that aren't a multiple of 4 bytes. * If you don't have time to fix the host controller driver, you can * work around the problem by modifying if_sdio_host_to_card() and diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 9cb9e031040..396ce676cad 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -152,7 +152,7 @@ static int if_usb_probe(struct usb_interface *intf, setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); init_waitqueue_head(&cardp->fw_wq); - + cardp->udev = udev; iface_desc = intf->cur_altsetting; @@ -871,7 +871,7 @@ restart: /* ... and wait for the process to complete */ wait_event_interruptible(cardp->fw_wq, cardp->surprise_removed || cardp->fwdnldover); - + del_timer_sync(&cardp->fw_timeout); usb_kill_urb(cardp->rx_urb); diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index b51513fb59e..0dc7de6a067 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -255,7 +255,7 @@ static int lbs_add_rtap(struct lbs_private *priv); static void lbs_remove_rtap(struct lbs_private *priv); static int lbs_add_mesh(struct lbs_private *priv); static void lbs_remove_mesh(struct lbs_private *priv); - + /** * Get function for sysfs attribute rtap @@ -347,7 +347,7 @@ static ssize_t lbs_mesh_set(struct device *dev, ret = lbs_mesh_config(priv, enable, priv->curbssparams.channel); if (ret) return ret; - + if (enable) lbs_add_mesh(priv); else @@ -401,7 +401,7 @@ static int lbs_dev_open(struct net_device *dev) netif_carrier_on(dev); } else { priv->infra_open = 1; - + if (priv->connect_status == LBS_CONNECTED) netif_carrier_on(dev); else @@ -433,7 +433,7 @@ static int lbs_mesh_stop(struct net_device *dev) netif_stop_queue(dev); netif_carrier_off(dev); - + spin_unlock_irq(&priv->driver_lock); return 0; } @@ -453,7 +453,7 @@ static int lbs_eth_stop(struct net_device *dev) priv->infra_open = 0; netif_stop_queue(dev); - + spin_unlock_irq(&priv->driver_lock); return 0; } @@ -850,7 +850,7 @@ int lbs_suspend(struct lbs_private *priv) } memset(&cmd, 0, sizeof(cmd)); - + ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd, sizeof(cmd), lbs_suspend_callback, 0); if (ret) @@ -1180,7 +1180,7 @@ int lbs_start_card(struct lbs_private *priv) /* Enable mesh, if supported, and work out which TLV it uses. 0x100 + 291 is an unofficial value used in 5.110.20.pXX 0x100 + 37 is the official value used in 5.110.21.pXX - but we check them in that order because 20.pXX doesn't + but we check them in that order because 20.pXX doesn't give an error -- it just silently fails. */ /* 5.110.20.pXX firmware will fail the command if the channel diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 8a1a3965f1c..00d95f75bd8 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -93,8 +93,8 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) netif_stop_queue(priv->mesh_dev); if (priv->tx_pending_len) { - /* This can happen if packets come in on the mesh and eth - device simultaneously -- there's no mutual exclusion on + /* This can happen if packets come in on the mesh and eth + device simultaneously -- there's no mutual exclusion on hard_start_xmit() calls between devices. */ lbs_deb_tx("Packet on %s while busy\n", dev->name); ret = NETDEV_TX_BUSY; -- cgit v1.2.3 From 8e5b6b2d32304f4d6a096a6dfae23d12dc6f9287 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 14 Dec 2007 23:08:13 -0500 Subject: libertas: kill unused wait_option field in struct cmd_ctrl_node Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 12 ++++-------- drivers/net/wireless/libertas/hostcmd.h | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index ffef7212621..5ceb331147f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -17,7 +17,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode); static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, - u16 wait_option, void *pdata_buf); + void *pdata_buf); /** @@ -1392,7 +1392,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, goto done; } - lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf); cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; @@ -1554,7 +1554,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, case CMD_802_11_INACTIVITY_TIMEOUT: ret = lbs_cmd_802_11_inactivity_timeout(priv, cmdptr, cmd_action, pdata_buf); - lbs_set_cmd_ctrl_node(priv, cmdnode, 0, pdata_buf); + lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf); break; case CMD_802_11_TPC_CFG: @@ -1800,7 +1800,6 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) return; cmdnode->cmdwaitqwoken = 1; wake_up_interruptible(&cmdnode->cmdwait_q); - cmdnode->wait_option = 0; cmdnode->pdata_buf = NULL; cmdnode->callback = NULL; cmdnode->callback_arg = 0; @@ -1816,20 +1815,18 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) * * @param priv A pointer to struct lbs_private structure * @param ptempnode A pointer to cmd_ctrl_node structure - * @param wait_option wait option: wait response or not * @param pdata_buf A pointer to informaion buffer * @return 0 or -1 */ static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, - u16 wait_option, void *pdata_buf) + void *pdata_buf) { lbs_deb_enter(LBS_DEB_HOST); if (!ptempnode) return; - ptempnode->wait_option = wait_option; ptempnode->pdata_buf = pdata_buf; ptempnode->callback = NULL; ptempnode->callback_arg = 0; @@ -2213,7 +2210,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, goto done; } - cmdnode->wait_option = CMD_OPTION_WAITFORRSP; cmdnode->callback = callback; cmdnode->callback_arg = callback_arg; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index aa4cea04014..1b31250fdab 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -74,8 +74,6 @@ struct cmd_header { struct cmd_ctrl_node { struct list_head list; - /* wait for finish or not */ - u16 wait_option; /* command response */ void *pdata_buf; int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); -- cgit v1.2.3 From d9896ee14768e3dd6ce2f57a0d518b5b18a924a1 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 00:09:25 -0500 Subject: libertas: rename and clean up DownloadcommandToStation Call it lbs_submit_command(), remove a bunch of things which can be (or, in the case of zeroing ->cmdwaitqwoken, already are) done elsewhere. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 5ceb331147f..4dc6bbe5f11 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1170,6 +1170,10 @@ void lbs_queue_cmd(struct lbs_private *priv, lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n"); goto done; } + if (!cmdnode->cmdbuf->size) { + lbs_deb_host("DNLD_CMD: cmd size is zero\n"); + goto done; + } /* Exit_PS command needs to be queued in the header always. */ if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { @@ -1197,15 +1201,8 @@ done: lbs_deb_leave(LBS_DEB_HOST); } -/* - * TODO: Fix the issue when DownloadcommandToStation is being called the - * second time when the command times out. All the cmdptr->xxx are in little - * endian and therefore all the comparissions will fail. - * For now - we are not performing the endian conversion the second time - but - * for PS and DEEP_SLEEP we need to worry - */ -static int DownloadcommandToStation(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) +static int lbs_submit_command(struct lbs_private *priv, + struct cmd_ctrl_node *cmdnode) { unsigned long flags; struct cmd_header *cmd; @@ -1215,21 +1212,9 @@ static int DownloadcommandToStation(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_HOST); - if (!priv || !cmdnode) { - lbs_deb_host("DNLD_CMD: priv or cmdmode is NULL\n"); - goto done; - } - cmd = cmdnode->cmdbuf; spin_lock_irqsave(&priv->driver_lock, flags); - if (!cmd || !cmd->size) { - lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n"); - __lbs_cleanup_and_insert_cmd(priv, cmdnode); - spin_unlock_irqrestore(&priv->driver_lock, flags); - goto done; - } - priv->cur_cmd = cmdnode; priv->cur_cmd_retcode = 0; spin_unlock_irqrestore(&priv->driver_lock, flags); @@ -1241,12 +1226,9 @@ static int DownloadcommandToStation(struct lbs_private *priv, command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); - cmdnode->cmdwaitqwoken = 0; - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); - - if (ret != 0) { - lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n"); + if (ret) { + lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); spin_lock_irqsave(&priv->driver_lock, flags); priv->cur_cmd_retcode = ret; __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); @@ -1952,7 +1934,7 @@ int lbs_execute_next_command(struct lbs_private *priv) list_del(&cmdnode->list); lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", le16_to_cpu(cmd->command)); - DownloadcommandToStation(priv, cmdnode); + lbs_submit_command(priv, cmdnode); } else { /* * check if in power save mode, if yes, put the device back -- cgit v1.2.3 From b23b2061e5758d4827630ee900b4b290376d0059 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 01:22:09 -0500 Subject: libertas: don't use __lbs_cmd() with empty callback in if_usb.c We're about to change semantics, leaving callers of lbs_prepare_and_send_command() with the old broken priv->cur_cmd_retcode crap. The existence of the callback command will be the trigger for the new semantics when handling the response. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 396ce676cad..cf882517cea 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -109,7 +109,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; - if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, NULL, 0)) + if (lbs_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) lbs_deb_usb("Setting boot2 version failed\n"); } -- cgit v1.2.3 From c4ab41272b55a08741d2e68966aae700e2e6d597 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 00:41:51 -0500 Subject: libertas: remove some pointless checks for cmdnode buffer being present We allocate them all at the same time, at startup. If they go missing, we have more serious things to worry about, and the resulting oops will be a perfectly acceptable result. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4dc6bbe5f11..4ffb84a403b 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1166,8 +1166,8 @@ void lbs_queue_cmd(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_HOST); - if (!cmdnode || !cmdnode->cmdbuf) { - lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n"); + if (!cmdnode) { + lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n"); goto done; } if (!cmdnode->cmdbuf->size) { @@ -1195,7 +1195,7 @@ void lbs_queue_cmd(struct lbs_private *priv, spin_unlock_irqrestore(&priv->driver_lock, flags); lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", - le16_to_cpu(cmdnode->cmdbuf->command)); + le16_to_cpu(cmdnode->cmdbuf->command)); done: lbs_deb_leave(LBS_DEB_HOST); @@ -1380,13 +1380,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no); - if (!cmdptr) { - lbs_deb_host("PREP_CMD: cmdptr is NULL\n"); - lbs_cleanup_and_insert_cmd(priv, cmdnode); - ret = -1; - goto done; - } - /* Set sequence number, command and INT option */ priv->seqnum++; cmdptr->seqnum = cpu_to_le16(priv->seqnum); @@ -1786,8 +1779,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) cmdnode->callback = NULL; cmdnode->callback_arg = 0; - if (cmdnode->cmdbuf != NULL) - memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); + memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); lbs_deb_leave(LBS_DEB_HOST); } -- cgit v1.2.3 From 183aeac1c49869ba9a14c7ead86ce268da397a0e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 01:52:54 -0500 Subject: libertas: introduce and use lbs_complete_command() for command completion Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 25 ++++++++++++++++++------- drivers/net/wireless/libertas/cmdresp.c | 10 +++------- drivers/net/wireless/libertas/decl.h | 5 ++--- 3 files changed, 23 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4ffb84a403b..9c73902ca86 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1230,9 +1230,7 @@ static int lbs_submit_command(struct lbs_private *priv, if (ret) { lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); spin_lock_irqsave(&priv->driver_lock, flags); - priv->cur_cmd_retcode = ret; - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + lbs_complete_command(priv, priv->cur_cmd, ret); spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } @@ -1275,8 +1273,8 @@ static int lbs_cmd_mac_control(struct lbs_private *priv, * This function inserts command node to cmdfreeq * after cleans it. Requires priv->driver_lock held. */ -void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd) +static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *ptempcmd) { if (!ptempcmd) @@ -1296,6 +1294,15 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, spin_unlock_irqrestore(&priv->driver_lock, flags); } +void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, + int result) +{ + if (cmd == priv->cur_cmd) + priv->cur_cmd_retcode = result; + __lbs_cleanup_and_insert_cmd(priv, cmd); + priv->cur_cmd = NULL; +} + int lbs_set_radio_control(struct lbs_private *priv) { int ret = 0; @@ -1901,7 +1908,9 @@ int lbs_execute_next_command(struct lbs_private *priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); list_del(&cmdnode->list); - lbs_cleanup_and_insert_cmd(priv, cmdnode); + spin_lock_irqsave(&priv->driver_lock, flags); + lbs_complete_command(priv, cmdnode, 0); + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = 0; goto done; @@ -1912,7 +1921,9 @@ int lbs_execute_next_command(struct lbs_private *priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); list_del(&cmdnode->list); - lbs_cleanup_and_insert_cmd(priv, cmdnode); + spin_lock_irqsave(&priv->driver_lock, flags); + lbs_complete_command(priv, cmdnode, 0); + spin_unlock_irqrestore(&priv->driver_lock, flags); priv->needtowakeup = 1; ret = 0; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index a809f8f9997..89f83165e04 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -717,8 +717,7 @@ int lbs_process_rx_command(struct lbs_private *priv) lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); } - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + lbs_complete_command(priv, priv->cur_cmd, result); spin_unlock_irqrestore(&priv->driver_lock, flags); ret = 0; @@ -739,9 +738,7 @@ int lbs_process_rx_command(struct lbs_private *priv) break; } - - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + lbs_complete_command(priv, priv->cur_cmd, result); spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; @@ -760,8 +757,7 @@ int lbs_process_rx_command(struct lbs_private *priv) if (priv->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + lbs_complete_command(priv, priv->cur_cmd, result); } spin_unlock_irqrestore(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 45f081b6870..5dd5c9e0928 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -45,9 +45,8 @@ void lbs_get_fwversion(struct lbs_private *priv, /** The proc fs interface */ int lbs_process_rx_command(struct lbs_private *priv); -void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd); - +void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, + int result); int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); -- cgit v1.2.3 From ecfe9b487c0d3f6b7ad58006888a56f01ae52b58 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 01:57:12 -0500 Subject: libertas: don't re-initialise cmdnode when taking it off the free queue We initialise it when we add it to the queue. No need to do it again. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 9c73902ca86..fd321ddf596 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1761,9 +1761,6 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) spin_unlock_irqrestore(&priv->driver_lock, flags); - if (tempnode) - cleanup_cmdnode(tempnode); - lbs_deb_leave(LBS_DEB_HOST); return tempnode; } -- cgit v1.2.3 From 5ba2f8a0217cd6116fcbac056b360bb0db045379 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 02:02:56 -0500 Subject: libertas: kill cleanup_cmdnode() Move the wakeup into lbs_complete_command(), and leave the other bits in __lbs_cleanup_and_insert_cmd() which was the only caller now anyway. There are two remaining direct callers of lbs_cleanup_and_insert_cmd(), and they are both fine without the wakeup. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 39 ++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index fd321ddf596..4c0bd9f5c19 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -13,7 +13,6 @@ #include "wext.h" #include "cmd.h" -static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode); static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, struct cmd_ctrl_node *ptempnode, @@ -1274,14 +1273,22 @@ static int lbs_cmd_mac_control(struct lbs_private *priv, * after cleans it. Requires priv->driver_lock held. */ static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd) + struct cmd_ctrl_node *cmdnode) { + lbs_deb_enter(LBS_DEB_HOST); - if (!ptempcmd) - return; + if (!cmdnode) + goto out; - cleanup_cmdnode(ptempcmd); - list_add_tail(&ptempcmd->list, &priv->cmdfreeq); + cmdnode->pdata_buf = NULL; + cmdnode->callback = NULL; + cmdnode->callback_arg = 0; + + memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); + + list_add_tail(&cmdnode->list, &priv->cmdfreeq); + out: + lbs_deb_leave(LBS_DEB_HOST); } static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, @@ -1299,6 +1306,10 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, { if (cmd == priv->cur_cmd) priv->cur_cmd_retcode = result; + + cmd->cmdwaitqwoken = 1; + wake_up_interruptible(&cmd->cmdwait_q); + __lbs_cleanup_and_insert_cmd(priv, cmd); priv->cur_cmd = NULL; } @@ -1771,22 +1782,6 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) * @param ptempnode A pointer to cmdCtrlNode structure * @return n/a */ -static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode) -{ - lbs_deb_enter(LBS_DEB_HOST); - - if (!cmdnode) - return; - cmdnode->cmdwaitqwoken = 1; - wake_up_interruptible(&cmdnode->cmdwait_q); - cmdnode->pdata_buf = NULL; - cmdnode->callback = NULL; - cmdnode->callback_arg = 0; - - memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); - - lbs_deb_leave(LBS_DEB_HOST); -} /** * @brief This function initializes the command node. -- cgit v1.2.3 From ad12d0f418b7d3bbc6d1ccc4ff0858361cf0aafe Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 02:06:16 -0500 Subject: libertas: let __lbs_cmd() free its own cmdnode Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4c0bd9f5c19..e7f07c3098f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1310,7 +1310,8 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, cmd->cmdwaitqwoken = 1; wake_up_interruptible(&cmd->cmdwait_q); - __lbs_cleanup_and_insert_cmd(priv, cmd); + if (!cmd->callback) + __lbs_cleanup_and_insert_cmd(priv, cmd); priv->cur_cmd = NULL; } @@ -2219,6 +2220,7 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, priv->cur_cmd_retcode = 0; ret = -1; } + __lbs_cleanup_and_insert_cmd(priv, cmdnode); spin_unlock_irqrestore(&priv->driver_lock, flags); done: -- cgit v1.2.3 From 75567670c66329a111c2b4f12d6c1fc02b3b14d2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 02:38:17 -0500 Subject: libertas: kill pdata_buf member of struct cmd_ctrl_node We can use the callback_arg for it; that's the way we're heading anyway... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 +--- drivers/net/wireless/libertas/cmdresp.c | 26 +++++++++++++------------- drivers/net/wireless/libertas/hostcmd.h | 1 - 3 files changed, 14 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index e7f07c3098f..f2e027b5810 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1280,7 +1280,6 @@ static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, if (!cmdnode) goto out; - cmdnode->pdata_buf = NULL; cmdnode->callback = NULL; cmdnode->callback_arg = 0; @@ -1801,9 +1800,8 @@ static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, if (!ptempnode) return; - ptempnode->pdata_buf = pdata_buf; ptempnode->callback = NULL; - ptempnode->callback_arg = 0; + ptempnode->callback_arg = (unsigned long)pdata_buf; lbs_deb_leave(LBS_DEB_HOST); } diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 89f83165e04..4c22e784951 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -399,13 +399,13 @@ static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, struct cmd_ds_command *resp) { struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; - u32 * pdata_buf = priv->cur_cmd->pdata_buf; + uint32_t * pdata_buf = (uint32_t *)priv->cur_cmd->callback_arg; lbs_deb_enter(LBS_DEB_CMD); if (enable_rsn->action == cpu_to_le16(CMD_ACT_GET)) { if (pdata_buf) - *pdata_buf = (u32) le16_to_cpu(enable_rsn->enable); + *pdata_buf = (uint32_t) le16_to_cpu(enable_rsn->enable); } lbs_deb_leave(LBS_DEB_CMD); @@ -435,7 +435,7 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, struct cmd_ds_802_11_subscribe_event *cmd_event = &resp->params.subscribe_event; struct cmd_ds_802_11_subscribe_event *dst_event = - priv->cur_cmd->pdata_buf; + (void *)priv->cur_cmd->callback_arg; lbs_deb_enter(LBS_DEB_CMD); @@ -505,7 +505,7 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_SET_AFC): case CMD_RET(CMD_802_11_GET_AFC): spin_lock_irqsave(&priv->driver_lock, flags); - memmove(priv->cur_cmd->pdata_buf, &resp->params.afc, + memmove((void *)priv->cur_cmd->callback_arg, &resp->params.afc, sizeof(struct cmd_ds_802_11_afc)); spin_unlock_irqrestore(&priv->driver_lock, flags); @@ -557,20 +557,20 @@ static inline int handle_cmd_response(struct lbs_private *priv, break; case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): spin_lock_irqsave(&priv->driver_lock, flags); - *((u16 *) priv->cur_cmd->pdata_buf) = + *((uint16_t *) priv->cur_cmd->callback_arg) = le16_to_cpu(resp->params.inactivity_timeout.timeout); spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_802_11_TPC_CFG): spin_lock_irqsave(&priv->driver_lock, flags); - memmove(priv->cur_cmd->pdata_buf, &resp->params.tpccfg, + memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, sizeof(struct cmd_ds_802_11_tpc_cfg)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_802_11_LED_GPIO_CTRL): spin_lock_irqsave(&priv->driver_lock, flags); - memmove(priv->cur_cmd->pdata_buf, &resp->params.ledgpio, + memmove((void *)priv->cur_cmd->callback_arg, &resp->params.ledgpio, sizeof(struct cmd_ds_802_11_led_ctrl)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; @@ -580,7 +580,7 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_PWR_CFG): spin_lock_irqsave(&priv->driver_lock, flags); - memmove(priv->cur_cmd->pdata_buf, &resp->params.pwrcfg, + memmove((void *)priv->cur_cmd->callback_arg, &resp->params.pwrcfg, sizeof(struct cmd_ds_802_11_pwr_cfg)); spin_unlock_irqrestore(&priv->driver_lock, flags); @@ -588,21 +588,21 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_GET_TSF): spin_lock_irqsave(&priv->driver_lock, flags); - memcpy(priv->cur_cmd->pdata_buf, + memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.gettsf.tsfvalue, sizeof(u64)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_BT_ACCESS): spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd->pdata_buf) - memcpy(priv->cur_cmd->pdata_buf, + if (priv->cur_cmd->callback_arg) + memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.bt.addr1, 2 * ETH_ALEN); spin_unlock_irqrestore(&priv->driver_lock, flags); break; case CMD_RET(CMD_FWT_ACCESS): spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd->pdata_buf) - memcpy(priv->cur_cmd->pdata_buf, &resp->params.fwt, + if (priv->cur_cmd->callback_arg) + memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt, sizeof(resp->params.fwt)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 1b31250fdab..719da737aaf 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -75,7 +75,6 @@ struct cmd_header { struct cmd_ctrl_node { struct list_head list; /* command response */ - void *pdata_buf; int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); unsigned long callback_arg; /* command data */ -- cgit v1.2.3 From ae125bf8278249b8c44168c5183f551c3ed28b84 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 04:22:52 -0500 Subject: libertas: store command result in cmdnode instead of priv->cur_cmd_retcode ... at least for users of __lbs_cmd(). Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 12 ++++++------ drivers/net/wireless/libertas/hostcmd.h | 1 + drivers/net/wireless/libertas/main.c | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index f2e027b5810..c8f1bd58359 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1173,6 +1173,7 @@ void lbs_queue_cmd(struct lbs_private *priv, lbs_deb_host("DNLD_CMD: cmd size is zero\n"); goto done; } + cmdnode->result = 0; /* Exit_PS command needs to be queued in the header always. */ if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { @@ -1306,6 +1307,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, if (cmd == priv->cur_cmd) priv->cur_cmd_retcode = result; + cmd->result = result; cmd->cmdwaitqwoken = 1; wake_up_interruptible(&cmd->cmdwait_q); @@ -2212,12 +2214,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd_retcode) { - lbs_deb_host("PREP_CMD: command failed with return code %d\n", - priv->cur_cmd_retcode); - priv->cur_cmd_retcode = 0; - ret = -1; - } + ret = cmdnode->result; + if (ret) + lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n", + command, ret); __lbs_cleanup_and_insert_cmd(priv, cmdnode); spin_unlock_irqrestore(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 719da737aaf..ea4d484b2ba 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -74,6 +74,7 @@ struct cmd_header { struct cmd_ctrl_node { struct list_head list; + int result; /* command response */ int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); unsigned long callback_arg; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 0dc7de6a067..839ffe818c1 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1237,6 +1237,7 @@ int lbs_stop_card(struct lbs_private *priv) /* Flush pending command nodes */ spin_lock_irqsave(&priv->driver_lock, flags); list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { + cmdnode->result = -ENOENT; cmdnode->cmdwaitqwoken = 1; wake_up_interruptible(&cmdnode->cmdwait_q); } -- cgit v1.2.3 From 3399ea5f239d49522212db179bca4de9e84b09df Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 03:09:33 -0500 Subject: libertas: add __lbs_cmd_async() for asynchronous command submission Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 60 ++++++++++++++++++------------------- drivers/net/wireless/libertas/cmd.h | 6 ++++ 2 files changed, 36 insertions(+), 30 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index c8f1bd58359..3079b3f2476 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -2139,42 +2139,18 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, } EXPORT_SYMBOL_GPL(lbs_cmd_copyback); -/** - * @brief Simple way to call firmware functions - * - * @param priv A pointer to struct lbs_private structure - * @param psmode one of the many CMD_802_11_xxxx - * @param cmd pointer to the parameters structure for above command - * (this should not include the command, size, sequence - * and result fields from struct cmd_ds_gen) - * @param cmd_size size structure pointed to by cmd - * @param rsp pointer to an area where the result should be placed - * @param rsp_size pointer to the size of the rsp area. If the firmware - * returns fewer bytes, then this *rsp_size will be - * changed to the actual size. - * @return -1 in case of a higher level error, otherwise - * the result code from the firmware - */ -int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg) +struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, + struct cmd_header *in_cmd, int in_cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), + unsigned long callback_arg) { struct cmd_ctrl_node *cmdnode; - unsigned long flags; - int ret = 0; lbs_deb_enter(LBS_DEB_HOST); - if (!priv) { - lbs_deb_host("PREP_CMD: priv is NULL\n"); - ret = -1; - goto done; - } - if (priv->surpriseremoved) { lbs_deb_host("PREP_CMD: card removed\n"); - ret = -1; + cmdnode = ERR_PTR(-ENOENT); goto done; } @@ -2184,7 +2160,7 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, /* Wake up main thread to execute next command */ wake_up_interruptible(&priv->waitq); - ret = -1; + cmdnode = ERR_PTR(-ENOBUFS); goto done; } @@ -2210,6 +2186,29 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, lbs_queue_cmd(priv, cmdnode, 1); wake_up_interruptible(&priv->waitq); + done: + lbs_deb_leave_args(LBS_DEB_HOST, "ret %p", cmdnode); + return cmdnode; +} + +int __lbs_cmd(struct lbs_private *priv, uint16_t command, + struct cmd_header *in_cmd, int in_cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), + unsigned long callback_arg) +{ + struct cmd_ctrl_node *cmdnode; + unsigned long flags; + int ret = 0; + + lbs_deb_enter(LBS_DEB_HOST); + + cmdnode = __lbs_cmd_async(priv, command, in_cmd, in_cmd_size, + callback, callback_arg); + if (IS_ERR(cmdnode)) { + ret = PTR_ERR(cmdnode); + goto done; + } + might_sleep(); wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); @@ -2218,6 +2217,7 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, if (ret) lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n", command, ret); + __lbs_cleanup_and_insert_cmd(priv, cmdnode); spin_unlock_irqrestore(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 999fabe5964..2f4c1ec5039 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -12,6 +12,12 @@ #define lbs_cmd_with_response(priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) +/* __lbs_cmd() will free the cmdnode and return success/failure. + __lbs_cmd_async() requires that the callback free the cmdnode */ +struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, + struct cmd_header *in_cmd, int in_cmd_size, + int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), + unsigned long callback_arg); int __lbs_cmd(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), -- cgit v1.2.3 From 9fae899c2b5dc224042da63b14118abdb22ae9b6 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 03:46:44 -0500 Subject: libertas: ensure response buffer size is always set for lbs_cmd_with_response Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 +++- drivers/net/wireless/libertas/cmd.h | 4 ++++ drivers/net/wireless/libertas/if_usb.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3079b3f2476..c3d7f60f93f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -115,6 +115,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria) struct cmd_ds_host_sleep cmd_config; int ret; + cmd_config.hdr.size = cpu_to_le16(sizeof(cmd_config)); cmd_config.criteria = cpu_to_le32(criteria); cmd_config.gpio = priv->wol_gpio; cmd_config.gap = priv->wol_gap; @@ -1101,7 +1102,7 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); - cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); + cmd->hdr.size = cpu_to_le16(sizeof(*cmd)); cmd->hdr.result = 0; cmd->action = cpu_to_le16(cmd_action); @@ -1121,6 +1122,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan) cmd.action = cpu_to_le16(enable); cmd.channel = cpu_to_le16(chan); cmd.type = cpu_to_le16(priv->mesh_tlv); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); if (enable) { cmd.length = cpu_to_le16(priv->mesh_ssid_len); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 2f4c1ec5039..e334f0e623a 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -9,6 +9,10 @@ #define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) \ __lbs_cmd(priv, cmdnr, &(cmd)->hdr, sizeof(*(cmd)), cb, cb_arg) + +/* lbs_cmd_with_response() infers the size of the command to be _sent_ + and requires that the caller sets cmd->size to the (LE) size of + the _response_ buffer. */ #define lbs_cmd_with_response(priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index cf882517cea..8bc23b3ae64 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -106,6 +106,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) { struct cmd_ds_set_boot2_ver b2_cmd; + b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); b2_cmd.action = 0; b2_cmd.version = priv->boot2_version; -- cgit v1.2.3 From 2a345099a4fbe551a1982630b3d89c85fa5a341d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 19:33:43 -0500 Subject: libertas: handle command timeout in main thread instead of directly in timer And handle the case where it times out more than once, too, instead of locking up for ever. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 6 ++++ drivers/net/wireless/libertas/dev.h | 2 ++ drivers/net/wireless/libertas/main.c | 52 +++++++++++++++++++-------------- 3 files changed, 38 insertions(+), 22 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 4c22e784951..ef63c376c55 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -667,6 +667,12 @@ int lbs_process_rx_command(struct lbs_private *priv) /* Now we got response from FW, cancel the command timer */ del_timer(&priv->command_timer); + priv->cmd_timed_out = 0; + if (priv->nr_retries) { + lbs_pr_info("Received result %x to command %x after %d retries\n", + result, curcmd, priv->nr_retries); + priv->nr_retries = 0; + } /* Store the response code to cur_cmd_retcode. */ priv->cur_cmd_retcode = result; diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index e6f553d5d2c..465080fd060 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -201,6 +201,8 @@ struct lbs_private { /** Timers */ struct timer_list command_timer; + int nr_retries; + int cmd_timed_out; u8 hisregcpy; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 839ffe818c1..9677b0d7716 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -670,6 +670,8 @@ static int lbs_thread(void *data) shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ else if (priv->intcounter) shouldsleep = 0; /* Interrupt pending. Deal with it now */ + else if (priv->cmd_timed_out) + shouldsleep = 0; /* Command timed out. Recover */ else if (!priv->fw_ready) shouldsleep = 1; /* Firmware not ready. We're waiting for it */ else if (priv->dnld_sent) @@ -740,6 +742,26 @@ static int lbs_thread(void *data) spin_lock_irq(&priv->driver_lock); } + if (priv->cmd_timed_out && priv->cur_cmd) { + struct cmd_ctrl_node *cmdnode = priv->cur_cmd; + + if (++priv->nr_retries > 10) { + lbs_pr_info("Excessive timeouts submitting command %x\n", + le16_to_cpu(cmdnode->cmdbuf->command)); + lbs_complete_command(priv, cmdnode, -ETIMEDOUT); + priv->nr_retries = 0; + } else { + priv->cur_cmd = NULL; + lbs_pr_info("requeueing command %x due to timeout (#%d)\n", + le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries); + + /* Stick it back at the _top_ of the pending queue + for immediate resubmission */ + list_add(&cmdnode->list, &priv->cmdpendingq); + } + } + priv->cmd_timed_out = 0; + /* Any Card Event */ if (priv->hisregcpy & MRVDRV_CARDEVENT) { lbs_deb_thread("main-thread: Card Event Activity\n"); @@ -922,35 +944,21 @@ done: static void command_timer_fn(unsigned long data) { struct lbs_private *priv = (struct lbs_private *)data; - struct cmd_ctrl_node *node; unsigned long flags; - node = priv->cur_cmd; - if (node == NULL) { - lbs_deb_fw("ptempnode empty\n"); - return; - } + spin_lock_irqsave(&priv->driver_lock, flags); - if (!node->cmdbuf) { - lbs_deb_fw("cmd is NULL\n"); - return; + if (!priv->cur_cmd) { + lbs_pr_info("Command timer expired; no pending command\n"); + goto out; } - lbs_pr_info("command %x timed out\n", le16_to_cpu(node->cmdbuf->command)); - - if (!priv->fw_ready) - return; - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->cur_cmd = NULL; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_fw("re-sending same command because of timeout\n"); - lbs_queue_cmd(priv, node, 0); + lbs_pr_info("Command %x timed out\n", le16_to_cpu(priv->cur_cmd->cmdbuf->command)); + priv->cmd_timed_out = 1; wake_up_interruptible(&priv->waitq); - - return; + out: + spin_unlock_irqrestore(&priv->driver_lock, flags); } static int lbs_init_adapter(struct lbs_private *priv) -- cgit v1.2.3 From 681ffbb7d42435332fff0812145c7050d6153925 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 15 Dec 2007 20:04:54 -0500 Subject: libertas: kill 'addtail' argument to lbs_queue_cmd() and make it static Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 14 +++++--------- drivers/net/wireless/libertas/decl.h | 4 ---- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index c3d7f60f93f..7682b9d27de 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1155,15 +1155,11 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, return 0; } -/* - * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for - * the command timer, because it does not account for queued commands. - */ -void lbs_queue_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode, - u8 addtail) +static void lbs_queue_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *cmdnode) { unsigned long flags; + int addtail = 1; lbs_deb_enter(LBS_DEB_HOST); @@ -1635,7 +1631,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(priv, cmdnode, 1); + lbs_queue_cmd(priv, cmdnode); wake_up_interruptible(&priv->waitq); if (wait_option & CMD_OPTION_WAITFORRSP) { @@ -2185,7 +2181,7 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command * because the caller of lbs_cmd() sets up all of *cmd for us. */ cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(priv, cmdnode, 1); + lbs_queue_cmd(priv, cmdnode); wake_up_interruptible(&priv->waitq); done: diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 5dd5c9e0928..aaacd9bd6bd 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h @@ -28,10 +28,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, u16 cmd_action, u16 wait_option, u32 cmd_oid, void *pdata_buf); -void lbs_queue_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode, - u8 addtail); - int lbs_allocate_cmd_buffer(struct lbs_private *priv); int lbs_execute_next_command(struct lbs_private *priv); int lbs_process_event(struct lbs_private *priv); -- cgit v1.2.3 From d1a469fd1b7335572a3803b6ba4ce3783a74532b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 16 Dec 2007 17:21:00 -0500 Subject: libertas: fix return from lbs_update_channel() If we return the channel number in a 'ret' variable where anything non-zero is later interpreted as an error, that isn't nice. It breaks WPA, for a start. OLPC trac #5485 Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index cd8e043b16f..882e51c16a7 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -167,13 +167,14 @@ int lbs_update_channel(struct lbs_private *priv) { int ret; - /* the channel in f/w could be out of sync, get the current channel */ + /* the channel in f/w could be out of sync; get the current channel */ lbs_deb_enter(LBS_DEB_ASSOC); ret = lbs_get_channel(priv); - if (ret > 0) - priv->curbssparams.channel = (u8) ret; - + if (ret > 0) { + priv->curbssparams.channel = ret; + ret = 0; + } lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } @@ -197,8 +198,9 @@ static int assoc_helper_channel(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_ASSOC); ret = lbs_update_channel(priv); - if (ret < 0) { + if (ret) { lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); + goto done; } if (assoc_req->channel == priv->curbssparams.channel) @@ -222,8 +224,10 @@ static int assoc_helper_channel(struct lbs_private *priv, * it since the firmware is supposed to return the new channel, but * whatever... */ ret = lbs_update_channel(priv); - if (ret < 0) + if (ret) { lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); + goto done; + } if (assoc_req->channel != priv->curbssparams.channel) { lbs_deb_assoc("ASSOC: channel: failed to update channel to %d\n", -- cgit v1.2.3 From c6ad3738c689c2e64af2b74c1f407c9323ba40dd Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 16 Dec 2007 21:43:40 -0500 Subject: libertas: add SLEEP_PERIOD and FW_WAKE_METHOD command definitions Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/host.h | 2 ++ drivers/net/wireless/libertas/hostcmd.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index fe000813f8d..bdf9017a173 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -84,8 +84,10 @@ #define CMD_802_11_KEY_MATERIAL 0x005e #define CMD_802_11_SLEEP_PARAMS 0x0066 #define CMD_802_11_INACTIVITY_TIMEOUT 0x0067 +#define CMD_802_11_SLEEP_PERIOD 0x0068 #define CMD_802_11_TPC_CFG 0x0072 #define CMD_802_11_PWR_CFG 0x0073 +#define CMD_802_11_FW_WAKE_METHOD 0x0074 #define CMD_802_11_SUBSCRIBE_EVENT 0x0075 #define CMD_802_11_RATE_ADAPT_RATESET 0x0076 #define CMD_802_11_TX_RATE_QUERY 0x007f diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index ea4d484b2ba..b38502f8ddd 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -439,6 +439,20 @@ struct cmd_ds_set_boot2_ver { __le16 version; }; +struct cmd_ds_802_11_fw_wake_method { + struct cmd_header hdr; + + __le16 action; + __le16 method; +}; + +struct cmd_ds_802_11_sleep_period { + struct cmd_header hdr; + + __le16 action; + __le16 period; +}; + struct cmd_ds_802_11_ps_mode { __le16 action; __le16 nullpktinterval; -- cgit v1.2.3 From 38bfab1a01c66cb1a5001dc702b0856b2f942fd5 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 16 Dec 2007 23:26:54 -0500 Subject: libertas: fix buffer handling of PS_MODE commands and responses Commit 5b8845345e7385d2eb37fac22ba9ab6905988be5 (or, in case the git workflow is broken and patches get recommitted, the commit entitled 'libertas: rename and re-type bufvirtualaddr to cmdbuf' by dcbw), introduced a number of bugs where we once had a pointer to a command _payload_, but now we use the pointer to the command header instead. The fix isn't wonderfully pretty for now, but it'll get better when we finish converting all commands so the structures include the header. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 4 ++-- drivers/net/wireless/libertas/cmdresp.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 7682b9d27de..2765b9c2085 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1175,7 +1175,7 @@ static void lbs_queue_cmd(struct lbs_private *priv, /* Exit_PS command needs to be queued in the header always. */ if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { - struct cmd_ds_802_11_ps_mode *psm = (void *) cmdnode->cmdbuf; + struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf[1]; if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { if (priv->psstate != PS_STATE_FULL_POWER) @@ -1889,7 +1889,7 @@ int lbs_execute_next_command(struct lbs_private *priv) * PS command. Ignore it if it is not Exit_PS. * otherwise send it down immediately. */ - struct cmd_ds_802_11_ps_mode *psm = (void *)cmd; + struct cmd_ds_802_11_ps_mode *psm = (void *)&cmd[1]; lbs_deb_host( "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index ef63c376c55..c05fef04c43 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -678,7 +678,7 @@ int lbs_process_rx_command(struct lbs_private *priv) priv->cur_cmd_retcode = result; if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { - struct cmd_ds_802_11_ps_mode *psmode = (void *) resp; + struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; u16 action = le16_to_cpu(psmode->action); lbs_deb_host( -- cgit v1.2.3 From 24dba5f39194c57f98090d1ee504be5740dc521c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 12:35:28 -0500 Subject: libertas: don't clear priv->dnld_sent after sending sleep confirm DNLD_RES_RECEIVED is a bit of a misnomer -- we never wait for the result to be received; it's purely representing the state of the TX path, and in this case the TX path is definitely busy. Of course, that means that we don't actually care about DATA_SENT vs. CMD_SENT either, but that's a can of worms for another day... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 2765b9c2085..10c60bab41f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -2000,7 +2000,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size); ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); - priv->dnld_sent = DNLD_RES_RECEIVED; spin_lock_irqsave(&priv->driver_lock, flags); if (priv->intcounter || priv->currenttxskb) -- cgit v1.2.3 From b47ef2438dea2ddad4561152aa8007a2d95e8157 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 13:26:42 -0500 Subject: libertas: handle HOST_AWAKE event by sending WAKEUP_CONFIRM command lbs_send_confirmwake() is a bit ugly but matches the way we confirm sleep. We'll deal with that whole thing later. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 30 +++++++++++++++++++++++++++++- drivers/net/wireless/libertas/dev.h | 1 + drivers/net/wireless/libertas/host.h | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index c05fef04c43..8f9eda4d1be 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -773,6 +773,30 @@ done: return ret; } +static int lbs_send_confirmwake(struct lbs_private *priv) +{ + struct cmd_header *cmd = &priv->lbs_ps_confirm_wake; + int ret = 0; + + lbs_deb_enter(LBS_DEB_HOST); + + cmd->command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM); + cmd->size = cpu_to_le16(sizeof(*cmd)); + cmd->seqnum = cpu_to_le16(++priv->seqnum); + cmd->result = 0; + + lbs_deb_host("SEND_WAKEC_CMD: before download\n"); + + lbs_deb_hex(LBS_DEB_HOST, "wake confirm command", (void *)cmd, sizeof(*cmd)); + + ret = priv->hw_host_to_card(priv, MVMS_CMD, (void *)cmd, sizeof(*cmd)); + if (ret) + lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n"); + + lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); + return ret; +} + int lbs_process_event(struct lbs_private *priv) { int ret = 0; @@ -821,9 +845,13 @@ int lbs_process_event(struct lbs_private *priv) break; + case MACREG_INT_CODE_HOST_AWAKE: + lbs_deb_cmd("EVENT: HOST_AWAKE\n"); + lbs_send_confirmwake(priv); + break; + case MACREG_INT_CODE_PS_AWAKE: lbs_deb_cmd("EVENT: awake\n"); - /* handle unexpected PS AWAKE event */ if (priv->psstate == PS_STATE_FULL_POWER) { lbs_deb_cmd( diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 465080fd060..fe504575735 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -263,6 +263,7 @@ struct lbs_private { u8 needtowakeup; struct PS_CMD_ConfirmSleep lbs_ps_confirm_sleep; + struct cmd_header lbs_ps_confirm_wake; struct assoc_request * pending_assoc_req; struct assoc_request * in_progress_assoc_req; diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index bdf9017a173..4c03e12fd6a 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -74,6 +74,7 @@ #define CMD_802_11_GET_AFC 0x003d #define CMD_802_11_AD_HOC_STOP 0x0040 #define CMD_802_11_HOST_SLEEP_CFG 0x0043 +#define CMD_802_11_WAKEUP_CONFIRM 0x0044 #define CMD_802_11_HOST_SLEEP_ACTIVATE 0x0045 #define CMD_802_11_BEACON_STOP 0x0049 #define CMD_802_11_MAC_ADDRESS 0x004d -- cgit v1.2.3 From b2c57eee66592e22327bf39b42c4e3dc24708213 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 14:41:13 -0500 Subject: libertas: allow for PS mode to be disabled when firmware doesn't support it Otherwise, we go into an endless busy loop trying to enable PS mode when the command queue is empty, dealing with the error response, and then trying to enable PS mode again because the command queue is empty.... it doesn't really save much power. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 1 + drivers/net/wireless/libertas/host.h | 5 +++++ drivers/net/wireless/libertas/wext.c | 7 +++++++ 3 files changed, 13 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index fe504575735..1c6ec4d6198 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -260,6 +260,7 @@ struct lbs_private { u16 psmode; /* Wlan802_11PowermodeCAM=disable Wlan802_11PowermodeMAX_PSP=enable */ u32 psstate; + char ps_supported; u8 needtowakeup; struct PS_CMD_ConfirmSleep lbs_ps_confirm_sleep; diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 4c03e12fd6a..1aa04076b1a 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -209,6 +209,11 @@ #define CMD_TYPE_MAX_PSP 0x0001 #define CMD_TYPE_FAST_PSP 0x0002 +/* Options for CMD_802_11_FW_WAKE_METHOD */ +#define CMD_WAKE_METHOD_UNCHANGED 0x0000 +#define CMD_WAKE_METHOD_COMMAND_INT 0x0001 +#define CMD_WAKE_METHOD_GPIO 0x0002 + /* Define action or option for CMD_BT_ACCESS */ enum cmd_bt_access_opts { /* The bt commands start at 5 instead of 1 because the old dft commands diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index b1e24723f2f..3e8d555ba3a 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -734,6 +734,13 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, lbs_deb_enter(LBS_DEB_WEXT); + if (!priv->ps_supported) { + if (vwrq->disabled) + return 0; + else + return -EINVAL; + } + /* PS is currently supported only in Infrastructure mode * Remove this check if it is to be supported in IBSS mode also */ -- cgit v1.2.3 From 4694961cc2f868d6061be3b2c3d1fcf39584ff17 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 14:42:33 -0500 Subject: libertas: Check for PS mode support on USB devices Move the various firmware setup bits into a separate function, which used to do just boot2 version. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 8bc23b3ae64..3931fe6267c 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -102,9 +102,10 @@ static void if_usb_free(struct if_usb_card *cardp) lbs_deb_leave(LBS_DEB_USB); } -static void if_usb_set_boot2_ver(struct lbs_private *priv) +static void if_usb_setup_firmware(struct lbs_private *priv) { struct cmd_ds_set_boot2_ver b2_cmd; + struct cmd_ds_802_11_fw_wake_method wake_method; b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); b2_cmd.action = 0; @@ -112,6 +113,25 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) if (lbs_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) lbs_deb_usb("Setting boot2 version failed\n"); + + priv->wol_gpio = 2; /* Wake via GPIO2... */ + priv->wol_gap = 20; /* ... after 20ms */ + lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA); + + wake_method.hdr.size = cpu_to_le16(sizeof(wake_method)); + wake_method.action = cpu_to_le16(CMD_ACT_GET); + if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) { + lbs_pr_info("Firmware does not seem to support PS mode\n"); + } else { + if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) { + lbs_deb_usb("Firmware seems to support PS with wake-via-command\n"); + priv->ps_supported = 1; + } else { + /* The versions which boot up this way don't seem to + work even if we set it to the command interrupt */ + lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n"); + } + } } static void if_usb_fw_timeo(unsigned long priv) @@ -221,11 +241,7 @@ static int if_usb_probe(struct usb_interface *intf, if (lbs_start_card(priv)) goto err_start_card; - if_usb_set_boot2_ver(priv); - - priv->wol_gpio = 2; /* Wake via GPIO2... */ - priv->wol_gap = 20; /* ... after 20ms */ - lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA); + if_usb_setup_firmware(priv); usb_get_dev(udev); usb_set_intfdata(intf, cardp); -- cgit v1.2.3 From ac4cced6e850496b66c0825b7f74d51ef02c6371 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 15:12:49 -0500 Subject: libertas: reduce explicit references to priv->cur_cmd->cmdbuf We have a local variable 'resp' which we use for this. So use it, instead of typing the whole thing. In preparation for actually using priv->upld_buf for the responses instead... Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 8f9eda4d1be..d305e982c50 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -639,10 +639,10 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); - resp = priv->cur_cmd->cmdbuf; + curcmd = le16_to_cpu(resp->command); + respcmd = le16_to_cpu(resp->command); result = le16_to_cpu(resp->result); @@ -650,9 +650,9 @@ int lbs_process_rx_command(struct lbs_private *priv) respcmd, le16_to_cpu(resp->seqnum), priv->upld_len, jiffies); lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len); - if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { + if (resp->seqnum != resp->seqnum) { lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n", - le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); + le16_to_cpu(resp->seqnum), le16_to_cpu(resp->seqnum)); spin_unlock_irqrestore(&priv->driver_lock, flags); ret = -1; goto done; -- cgit v1.2.3 From 7003b078c82d141216deecef4de154711a107aab Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 15:22:43 -0500 Subject: libertas: use priv->upld_buf for command responses If we don't scribble over the command we sent, then we can retry it when the firmware responds with 0x0004 (which means -EAGAIN). Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 2 +- drivers/net/wireless/libertas/if_cs.c | 10 +--------- drivers/net/wireless/libertas/if_sdio.c | 8 +------- drivers/net/wireless/libertas/if_usb.c | 14 +------------- 4 files changed, 4 insertions(+), 30 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d305e982c50..4d384612afa 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -639,7 +639,7 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - resp = priv->cur_cmd->cmdbuf; + resp = (void *)priv->upld_buf; curcmd = le16_to_cpu(resp->command); diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 58143637c73..4b5ab9a6b97 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -647,7 +647,6 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg) struct if_cs_card *card = (struct if_cs_card *)priv->card; int ret = 0; u16 int_cause; - u8 *cmdbuf; *ireg = 0; lbs_deb_enter(LBS_DEB_CS); @@ -679,14 +678,7 @@ sbi_get_int_status_exit: /* Card has a command result for us */ if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { spin_lock(&priv->driver_lock); - if (!priv->cur_cmd) { - cmdbuf = priv->upld_buf; - priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY; - } else { - cmdbuf = (u8 *) priv->cur_cmd->cmdbuf; - } - - ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len); + ret = if_cs_receive_cmdres(priv, priv->upld_buf, &priv->upld_len); spin_unlock(&priv->driver_lock); if (ret < 0) lbs_pr_err("could not receive cmd from card\n"); diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 9225546b9d4..eed73204bcc 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -136,12 +136,6 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, spin_lock_irqsave(&card->priv->driver_lock, flags); - if (!card->priv->cur_cmd) { - lbs_deb_sdio("discarding spurious response\n"); - ret = 0; - goto out; - } - if (size > LBS_CMD_BUFFER_SIZE) { lbs_deb_sdio("response packet too large (%d bytes)\n", (int)size); @@ -149,7 +143,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, goto out; } - memcpy(card->priv->cur_cmd->cmdbuf, buffer, size); + memcpy(card->priv->upld_buf, buffer, size); card->priv->upld_len = size; card->int_cause |= MRVDRV_CMD_UPLD_RDY; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 3931fe6267c..7db8e6c35dc 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -589,8 +589,6 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, struct if_usb_card *cardp, struct lbs_private *priv) { - uint8_t *cmdbuf; - if (recvlength > LBS_CMD_BUFFER_SIZE) { lbs_deb_usbd(&cardp->udev->dev, "The receive buffer is too large\n"); @@ -602,19 +600,9 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, BUG(); spin_lock(&priv->driver_lock); - /* take care of cur_cmd = NULL case by reading the - * data to clear the interrupt */ - if (!priv->cur_cmd) { - lbs_deb_hex(LBS_DEB_HOST, "Unsolicited CMD_RESP", - (void *) recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); - cmdbuf = priv->upld_buf; - priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; - } else - cmdbuf = (uint8_t *) priv->cur_cmd->cmdbuf; - cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); - memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); + memcpy(priv->upld_buf, recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); kfree_skb(skb); lbs_interrupt(priv); -- cgit v1.2.3 From 8538823f7c692c98e8b7e19cb580faa56e25e89f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 15:41:30 -0500 Subject: libertas: discard DEFER responses to commands; let the timeout trigger When the firmware returns 0x0004, it wants us to try again later. We can achieve that simply by throwing out the response and letting the command timeout code kick in. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 4d384612afa..0cd96628293 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -665,6 +665,16 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } + if (resp->result == cpu_to_le16(0x0004)) { + /* 0x0004 means -EAGAIN. Drop the response, let it time out + and be resubmitted */ + lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n", + le16_to_cpu(resp->command)); + spin_unlock_irqrestore(&priv->driver_lock, flags); + ret = -1; + goto done; + } + /* Now we got response from FW, cancel the command timer */ del_timer(&priv->command_timer); priv->cmd_timed_out = 0; -- cgit v1.2.3 From 18c52e7c3e3d0e7fbddd0334b58030bb89554cb9 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 16:03:58 -0500 Subject: libertas: make lbs_submit_command always 'succeed' and set command timer Even if it fails, we want to wait a while and try again, with an ultimate timeout if it the condition persists. So again, just use the standard command timeout behaviour. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 42 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 10c60bab41f..0ae98513ba8 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1199,14 +1199,15 @@ done: lbs_deb_leave(LBS_DEB_HOST); } -static int lbs_submit_command(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) +static void lbs_submit_command(struct lbs_private *priv, + struct cmd_ctrl_node *cmdnode) { unsigned long flags; struct cmd_header *cmd; - int ret = -1; - u16 cmdsize; - u16 command; + uint16_t cmdsize; + uint16_t command; + int timeo = 5 * HZ; + int ret; lbs_deb_enter(LBS_DEB_HOST); @@ -1220,33 +1221,30 @@ static int lbs_submit_command(struct lbs_private *priv, cmdsize = le16_to_cpu(cmd->size); command = le16_to_cpu(cmd->command); + /* These commands take longer */ + if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE || + command == CMD_802_11_AUTHENTICATE) + timeo = 10 * HZ; + lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n", command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); + if (ret) { lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); - spin_lock_irqsave(&priv->driver_lock, flags); - lbs_complete_command(priv, priv->cur_cmd, ret); - spin_unlock_irqrestore(&priv->driver_lock, flags); - goto done; - } - - lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", command, jiffies); + /* Let the timer kick in and retry, and potentially reset + the whole thing if the condition persists */ + timeo = HZ; + } else + lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", + command, jiffies); /* Setup the timer after transmit command */ - if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE - || command == CMD_802_11_ASSOCIATE) - mod_timer(&priv->command_timer, jiffies + (10*HZ)); - else - mod_timer(&priv->command_timer, jiffies + (5*HZ)); - - ret = 0; + mod_timer(&priv->command_timer, jiffies + timeo); -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; + lbs_deb_leave(LBS_DEB_HOST); } static int lbs_cmd_mac_control(struct lbs_private *priv, -- cgit v1.2.3 From 354eca9820f1efbf11978585640f1b2e92d4c5b4 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 19:22:40 -0500 Subject: libertas: submit RSSI command on tx timeout, to check whether module is dead We don't necessarily want to reset the device on a TX timeout. But more often than not, the real cause is that the firmware has crapped itself, not just that the network is busy. So submit any harmless command, and if _that_ times out, then the error handling code will reset the module, as appropriate. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9677b0d7716..74353e1d72f 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -476,6 +476,13 @@ static void lbs_tx_timeout(struct net_device *dev) to kick it somehow? */ lbs_host_to_card_done(priv); + /* More often than not, this actually happens because the + firmware has crapped itself -- rather than just a very + busy medium. So send a harmless command, and if/when + _that_ times out, we'll kick it in the head. */ + lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, + 0, 0, NULL); + lbs_deb_leave(LBS_DEB_TX); } -- cgit v1.2.3 From a7c458906542aacdda7289bb21f527a2dc4097ca Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 22:43:48 -0500 Subject: libertas: convert RADIO_CONTROL to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 76 ++++++++++++--------------------- drivers/net/wireless/libertas/cmdresp.c | 1 - drivers/net/wireless/libertas/hostcmd.h | 4 +- 3 files changed, 29 insertions(+), 52 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 0ae98513ba8..3a7b82f99cb 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -603,45 +603,6 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, return 0; } -static int lbs_cmd_802_11_radio_control(struct lbs_private *priv, - struct cmd_ds_command *cmd, - int cmd_action) -{ - struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd->size = - cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) + - S_DS_GEN); - cmd->command = cpu_to_le16(CMD_802_11_RADIO_CONTROL); - - pradiocontrol->action = cpu_to_le16(cmd_action); - - switch (priv->preamble) { - case CMD_TYPE_SHORT_PREAMBLE: - pradiocontrol->control = cpu_to_le16(SET_SHORT_PREAMBLE); - break; - - case CMD_TYPE_LONG_PREAMBLE: - pradiocontrol->control = cpu_to_le16(SET_LONG_PREAMBLE); - break; - - case CMD_TYPE_AUTO_PREAMBLE: - default: - pradiocontrol->control = cpu_to_le16(SET_AUTO_PREAMBLE); - break; - } - - if (priv->radioon) - pradiocontrol->control |= cpu_to_le16(TURN_ON_RF); - else - pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv, struct cmd_ds_command *cmd, u16 cmd_action, void *pdata_buf) @@ -1315,16 +1276,37 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, int lbs_set_radio_control(struct lbs_private *priv) { int ret = 0; + struct cmd_ds_802_11_radio_control cmd; lbs_deb_enter(LBS_DEB_CMD); - ret = lbs_prepare_and_send_command(priv, - CMD_802_11_RADIO_CONTROL, - CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, NULL); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(CMD_ACT_SET); + + switch (priv->preamble) { + case CMD_TYPE_SHORT_PREAMBLE: + cmd.control = cpu_to_le16(SET_SHORT_PREAMBLE); + break; + + case CMD_TYPE_LONG_PREAMBLE: + cmd.control = cpu_to_le16(SET_LONG_PREAMBLE); + break; + + case CMD_TYPE_AUTO_PREAMBLE: + default: + cmd.control = cpu_to_le16(SET_AUTO_PREAMBLE); + break; + } - lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", - priv->radioon, priv->preamble); + if (priv->radioon) + cmd.control |= cpu_to_le16(TURN_ON_RF); + else + cmd.control &= cpu_to_le16(~TURN_ON_RF); + + lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", priv->radioon, + priv->preamble); + + ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return ret; @@ -1467,10 +1449,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmd_action, pdata_buf); break; - case CMD_802_11_RADIO_CONTROL: - ret = lbs_cmd_802_11_radio_control(priv, cmdptr, cmd_action); - break; - case CMD_802_11_RATE_ADAPT_RATESET: ret = lbs_cmd_802_11_rate_adapt_rateset(priv, cmdptr, cmd_action); diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 0cd96628293..7c9ffc511b5 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -516,7 +516,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_SET_WEP): case CMD_RET(CMD_802_11_RESET): case CMD_RET(CMD_802_11_AUTHENTICATE): - case CMD_RET(CMD_802_11_RADIO_CONTROL): case CMD_RET(CMD_802_11_BEACON_STOP): break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index b38502f8ddd..8cc4d778e46 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -342,6 +342,8 @@ struct cmd_ds_rf_reg_access { }; struct cmd_ds_802_11_radio_control { + struct cmd_header hdr; + __le16 action; __le16 control; }; @@ -697,8 +699,6 @@ struct cmd_ds_command { struct cmd_ds_802_11_rate_adapt_rateset rateset; struct cmd_ds_mac_multicast_adr madr; struct cmd_ds_802_11_ad_hoc_join adj; - struct cmd_ds_802_11_radio_control radio; - struct cmd_ds_802_11_rf_channel rfchannel; struct cmd_ds_802_11_rssi rssi; struct cmd_ds_802_11_rssi_rsp rssirsp; struct cmd_ds_802_11_disassociate dassociate; -- cgit v1.2.3 From 6e5cc4fb35c45a8f8478d25c4e89e8d9c543056e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 23:04:37 -0500 Subject: libertas: convert INACTIVITY_TIMEOUT to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 34 ++++++++++++++++----------------- drivers/net/wireless/libertas/cmd.h | 3 +++ drivers/net/wireless/libertas/cmdresp.c | 7 ------- drivers/net/wireless/libertas/hostcmd.h | 3 ++- 4 files changed, 21 insertions(+), 26 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3a7b82f99cb..57d17077a6d 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -171,27 +171,30 @@ static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv, return 0; } -static int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) +int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, + uint16_t cmd_action, uint16_t *timeout) { - u16 *timeout = pdata_buf; + struct cmd_ds_802_11_inactivity_timeout cmd; + int ret; lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT); - cmd->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_inactivity_timeout) - + S_DS_GEN); + cmd.hdr.command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); + cmd.action = cpu_to_le16(cmd_action); - if (cmd_action) - cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout); + if (cmd_action == CMD_ACT_SET) + cmd.timeout = cpu_to_le16(*timeout); else - cmd->params.inactivity_timeout.timeout = 0; + cmd.timeout = 0; - lbs_deb_leave(LBS_DEB_CMD); + ret = lbs_cmd_with_response(priv, CMD_802_11_INACTIVITY_TIMEOUT, &cmd); + + if (!ret) + *timeout = le16_to_cpu(cmd.timeout); + + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return 0; } @@ -1520,11 +1523,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, case CMD_802_11_SLEEP_PARAMS: ret = lbs_cmd_802_11_sleep_params(priv, cmdptr, cmd_action); break; - case CMD_802_11_INACTIVITY_TIMEOUT: - ret = lbs_cmd_802_11_inactivity_timeout(priv, cmdptr, - cmd_action, pdata_buf); - lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf); - break; case CMD_802_11_TPC_CFG: cmdptr->command = cpu_to_le16(CMD_802_11_TPC_CFG); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index e334f0e623a..50821e76a88 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -47,4 +47,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria); int lbs_suspend(struct lbs_private *priv); int lbs_resume(struct lbs_private *priv); +int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, + uint16_t cmd_action, uint16_t *timeout); + #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 7c9ffc511b5..f7fb8c74014 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -554,13 +554,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_SLEEP_PARAMS): ret = lbs_ret_802_11_sleep_params(priv, resp); break; - case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): - spin_lock_irqsave(&priv->driver_lock, flags); - *((uint16_t *) priv->cur_cmd->callback_arg) = - le16_to_cpu(resp->params.inactivity_timeout.timeout); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - case CMD_RET(CMD_802_11_TPC_CFG): spin_lock_irqsave(&priv->driver_lock, flags); memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 8cc4d778e46..2ad32bc2cf2 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -378,6 +378,8 @@ struct cmd_ds_802_11_sleep_params { }; struct cmd_ds_802_11_inactivity_timeout { + struct cmd_header hdr; + /* ACT_GET/ACT_SET */ __le16 action; @@ -714,7 +716,6 @@ struct cmd_ds_command { struct cmd_ds_802_11d_domain_info domaininforesp; struct cmd_ds_802_11_sleep_params sleep_params; - struct cmd_ds_802_11_inactivity_timeout inactivity_timeout; struct cmd_ds_802_11_tpc_cfg tpccfg; struct cmd_ds_802_11_pwr_cfg pwrcfg; struct cmd_ds_802_11_afc afc; -- cgit v1.2.3 From 3fbe104cecdb8c812976fdb0cc41be65491b85ee Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Dec 2007 23:48:31 -0500 Subject: libertas: convert SLEEP_PARAMS to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 56 ++++++++++++++++------------ drivers/net/wireless/libertas/cmd.h | 2 + drivers/net/wireless/libertas/cmdresp.c | 26 ------------- drivers/net/wireless/libertas/debugfs.c | 66 +++++++++++++++------------------ drivers/net/wireless/libertas/dev.h | 15 +++----- drivers/net/wireless/libertas/hostcmd.h | 7 ++-- 6 files changed, 74 insertions(+), 98 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 57d17077a6d..3d9ad0ec954 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -198,33 +198,45 @@ int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, return 0; } -static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action) +int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, + struct sleep_params *sp) { - struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; + struct cmd_ds_802_11_sleep_params cmd; + int ret; lbs_deb_enter(LBS_DEB_CMD); - cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + - S_DS_GEN); - cmd->command = cpu_to_le16(CMD_802_11_SLEEP_PARAMS); - if (cmd_action == CMD_ACT_GET) { - memset(&priv->sp, 0, sizeof(struct sleep_params)); - memset(sp, 0, sizeof(struct cmd_ds_802_11_sleep_params)); - sp->action = cpu_to_le16(cmd_action); - } else if (cmd_action == CMD_ACT_SET) { - sp->action = cpu_to_le16(cmd_action); - sp->error = cpu_to_le16(priv->sp.sp_error); - sp->offset = cpu_to_le16(priv->sp.sp_offset); - sp->stabletime = cpu_to_le16(priv->sp.sp_stabletime); - sp->calcontrol = (u8) priv->sp.sp_calcontrol; - sp->externalsleepclk = (u8) priv->sp.sp_extsleepclk; - sp->reserved = cpu_to_le16(priv->sp.sp_reserved); + memset(&cmd, 0, sizeof(cmd)); + } else { + cmd.error = cpu_to_le16(sp->sp_error); + cmd.offset = cpu_to_le16(sp->sp_offset); + cmd.stabletime = cpu_to_le16(sp->sp_stabletime); + cmd.calcontrol = sp->sp_calcontrol; + cmd.externalsleepclk = sp->sp_extsleepclk; + cmd.reserved = cpu_to_le16(sp->sp_reserved); } + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(cmd_action); - lbs_deb_leave(LBS_DEB_CMD); + ret = lbs_cmd_with_response(priv, CMD_802_11_SLEEP_PARAMS, &cmd); + + if (!ret) { + lbs_deb_cmd("error 0x%x, offset 0x%x, stabletime 0x%x, " + "calcontrol 0x%x extsleepclk 0x%x\n", + le16_to_cpu(cmd.error), le16_to_cpu(cmd.offset), + le16_to_cpu(cmd.stabletime), cmd.calcontrol, + cmd.externalsleepclk); + + sp->sp_error = le16_to_cpu(cmd.error); + sp->sp_offset = le16_to_cpu(cmd.offset); + sp->sp_stabletime = le16_to_cpu(cmd.stabletime); + sp->sp_calcontrol = cmd.calcontrol; + sp->sp_extsleepclk = cmd.externalsleepclk; + sp->sp_reserved = le16_to_cpu(cmd.reserved); + } + + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return 0; } @@ -1520,10 +1532,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmd_no, cmd_action); break; - case CMD_802_11_SLEEP_PARAMS: - ret = lbs_cmd_802_11_sleep_params(priv, cmdptr, cmd_action); - break; - case CMD_802_11_TPC_CFG: cmdptr->command = cpu_to_le16(CMD_802_11_TPC_CFG); cmdptr->size = diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 50821e76a88..ca09b1803d1 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -49,5 +49,7 @@ int lbs_resume(struct lbs_private *priv); int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, uint16_t cmd_action, uint16_t *timeout); +int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, + struct sleep_params *sp); #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index f7fb8c74014..40615a88dc8 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -146,29 +146,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv, return ret; } -static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; - - lbs_deb_enter(LBS_DEB_CMD); - - lbs_deb_cmd("error 0x%x, offset 0x%x, stabletime 0x%x, calcontrol 0x%x " - "extsleepclk 0x%x\n", le16_to_cpu(sp->error), - le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), - sp->calcontrol, sp->externalsleepclk); - - priv->sp.sp_error = le16_to_cpu(sp->error); - priv->sp.sp_offset = le16_to_cpu(sp->offset); - priv->sp.sp_stabletime = le16_to_cpu(sp->stabletime); - priv->sp.sp_calcontrol = sp->calcontrol; - priv->sp.sp_extsleepclk = sp->externalsleepclk; - priv->sp.sp_reserved = le16_to_cpu(sp->reserved); - - lbs_deb_enter(LBS_DEB_CMD); - return 0; -} - static int lbs_ret_802_11_stat(struct lbs_private *priv, struct cmd_ds_command *resp) { @@ -551,9 +528,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ret = lbs_ret_802_11d_domain_info(priv, resp); break; - case CMD_RET(CMD_802_11_SLEEP_PARAMS): - ret = lbs_ret_802_11_sleep_params(priv, resp); - break; case CMD_RET(CMD_802_11_TPC_CFG): spin_lock_irqsave(&priv->driver_lock, flags); memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index f2781596714..44be3929c02 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -10,6 +10,7 @@ #include "decl.h" #include "host.h" #include "debugfs.h" +#include "cmd.h" static struct dentry *lbs_dir; static char *szStates[] = { @@ -103,71 +104,64 @@ static ssize_t lbs_sleepparams_write(struct file *file, loff_t *ppos) { struct lbs_private *priv = file->private_data; - ssize_t buf_size, res; + ssize_t buf_size, ret; + struct sleep_params sp; int p1, p2, p3, p4, p5, p6; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; buf_size = min(count, len - 1); if (copy_from_user(buf, user_buf, buf_size)) { - res = -EFAULT; + ret = -EFAULT; goto out_unlock; } - res = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6); - if (res != 6) { - res = -EFAULT; + ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6); + if (ret != 6) { + ret = -EINVAL; goto out_unlock; } - priv->sp.sp_error = p1; - priv->sp.sp_offset = p2; - priv->sp.sp_stabletime = p3; - priv->sp.sp_calcontrol = p4; - priv->sp.sp_extsleepclk = p5; - priv->sp.sp_reserved = p6; - - res = lbs_prepare_and_send_command(priv, - CMD_802_11_SLEEP_PARAMS, - CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, NULL); - - if (!res) - res = count; - else - res = -EINVAL; + sp.sp_error = p1; + sp.sp_offset = p2; + sp.sp_stabletime = p3; + sp.sp_calcontrol = p4; + sp.sp_extsleepclk = p5; + sp.sp_reserved = p6; + + ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_SET, &sp); + if (!ret) + ret = count; + else if (ret > 0) + ret = -EINVAL; out_unlock: free_page(addr); - return res; + return ret; } static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; - ssize_t res; + ssize_t ret; size_t pos = 0; + struct sleep_params sp; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; - res = lbs_prepare_and_send_command(priv, - CMD_802_11_SLEEP_PARAMS, - CMD_ACT_GET, - CMD_OPTION_WAITFORRSP, 0, NULL); - if (res) { - res = -EFAULT; + ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp); + if (ret) goto out_unlock; - } - pos += snprintf(buf, len, "%d %d %d %d %d %d\n", priv->sp.sp_error, - priv->sp.sp_offset, priv->sp.sp_stabletime, - priv->sp.sp_calcontrol, priv->sp.sp_extsleepclk, - priv->sp.sp_reserved); + pos += snprintf(buf, len, "%d %d %d %d %d %d\n", sp.sp_error, + sp.sp_offset, sp.sp_stabletime, + sp.sp_calcontrol, sp.sp_extsleepclk, + sp.sp_reserved); - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); + ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); out_unlock: free_page(addr); - return res; + return ret; } static ssize_t lbs_extscan(struct file *file, const char __user *userbuf, diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 1c6ec4d6198..362975189e9 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -77,12 +77,12 @@ struct current_bss_params { /** sleep_params */ struct sleep_params { - u16 sp_error; - u16 sp_offset; - u16 sp_stabletime; - u8 sp_calcontrol; - u8 sp_extsleepclk; - u16 sp_reserved; + uint16_t sp_error; + uint16_t sp_offset; + uint16_t sp_stabletime; + uint8_t sp_calcontrol; + uint8_t sp_extsleepclk; + uint16_t sp_reserved; }; /* Mesh statistics */ @@ -300,9 +300,6 @@ struct lbs_private { u8 cur_rate; u8 auto_rate; - /** sleep_params */ - struct sleep_params sp; - /** RF calibration data */ #define MAX_REGION_CHANNEL_NUM 2 diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 2ad32bc2cf2..855c2d0df86 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -355,6 +355,8 @@ struct cmd_ds_802_11_beacon_control { }; struct cmd_ds_802_11_sleep_params { + struct cmd_header hdr; + /* ACT_GET/ACT_SET */ __le16 action; @@ -368,10 +370,10 @@ struct cmd_ds_802_11_sleep_params { __le16 stabletime; /* control periodic calibration */ - u8 calcontrol; + uint8_t calcontrol; /* control the use of external sleep clock */ - u8 externalsleepclk; + uint8_t externalsleepclk; /* reserved field, should be set to zero */ __le16 reserved; @@ -715,7 +717,6 @@ struct cmd_ds_command { struct cmd_ds_802_11d_domain_info domaininfo; struct cmd_ds_802_11d_domain_info domaininforesp; - struct cmd_ds_802_11_sleep_params sleep_params; struct cmd_ds_802_11_tpc_cfg tpccfg; struct cmd_ds_802_11_pwr_cfg pwrcfg; struct cmd_ds_802_11_afc afc; -- cgit v1.2.3 From f70dd4515a8ad9c9d59ebb8c1d1fa2c610fb4020 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 18 Dec 2007 00:18:05 -0500 Subject: libertas: convert SET_WEP to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 26 +++++---------- drivers/net/wireless/libertas/cmd.c | 57 ++++++++++++--------------------- drivers/net/wireless/libertas/cmd.h | 2 ++ drivers/net/wireless/libertas/cmdresp.c | 1 - drivers/net/wireless/libertas/hostcmd.h | 7 ++-- 5 files changed, 34 insertions(+), 59 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 882e51c16a7..e91cd6724de 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -258,7 +258,7 @@ static int assoc_helper_channel(struct lbs_private *priv, static int assoc_helper_wep_keys(struct lbs_private *priv, - struct assoc_request * assoc_req) + struct assoc_request *assoc_req) { int i; int ret = 0; @@ -266,22 +266,11 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, lbs_deb_enter(LBS_DEB_ASSOC); /* Set or remove WEP keys */ - if ( assoc_req->wep_keys[0].len - || assoc_req->wep_keys[1].len - || assoc_req->wep_keys[2].len - || assoc_req->wep_keys[3].len) { - ret = lbs_prepare_and_send_command(priv, - CMD_802_11_SET_WEP, - CMD_ACT_ADD, - CMD_OPTION_WAITFORRSP, - 0, assoc_req); - } else { - ret = lbs_prepare_and_send_command(priv, - CMD_802_11_SET_WEP, - CMD_ACT_REMOVE, - CMD_OPTION_WAITFORRSP, - 0, NULL); - } + if (assoc_req->wep_keys[0].len || assoc_req->wep_keys[1].len || + assoc_req->wep_keys[2].len || assoc_req->wep_keys[3].len) + ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_ADD, assoc_req); + else + ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_REMOVE, assoc_req); if (ret) goto out; @@ -291,6 +280,7 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; else priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; + ret = lbs_set_mac_packet_filter(priv); if (ret) goto out; @@ -300,7 +290,7 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, /* Copy WEP keys into priv wep key fields */ for (i = 0; i < 4; i++) { memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i], - sizeof(struct enc_key)); + sizeof(struct enc_key)); } priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx; diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3d9ad0ec954..05e25cef5fe 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -240,74 +240,61 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, return 0; } -static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u32 cmd_act, - void * pdata_buf) +int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, + struct assoc_request *assoc) { - struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep; + struct cmd_ds_802_11_set_wep cmd; int ret = 0; - struct assoc_request * assoc_req = pdata_buf; lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_802_11_SET_WEP); - cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN); - - if (cmd_act == CMD_ACT_ADD) { - int i; + cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - if (!assoc_req) { - lbs_deb_cmd("Invalid association request!\n"); - ret = -1; - goto done; - } + cmd.action = cpu_to_le16(cmd_action); - wep->action = cpu_to_le16(CMD_ACT_ADD); + if (cmd_action == CMD_ACT_ADD) { + int i; /* default tx key index */ - wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx & - (u32)CMD_WEP_KEY_INDEX_MASK)); + cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx & + CMD_WEP_KEY_INDEX_MASK); /* Copy key types and material to host command structure */ for (i = 0; i < 4; i++) { - struct enc_key * pkey = &assoc_req->wep_keys[i]; + struct enc_key *pkey = &assoc->wep_keys[i]; switch (pkey->len) { case KEY_LEN_WEP_40: - wep->keytype[i] = CMD_TYPE_WEP_40_BIT; - memmove(&wep->keymaterial[i], pkey->key, - pkey->len); + cmd.keytype[i] = CMD_TYPE_WEP_40_BIT; + memmove(cmd.keymaterial[i], pkey->key, pkey->len); lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i); break; case KEY_LEN_WEP_104: - wep->keytype[i] = CMD_TYPE_WEP_104_BIT; - memmove(&wep->keymaterial[i], pkey->key, - pkey->len); + cmd.keytype[i] = CMD_TYPE_WEP_104_BIT; + memmove(cmd.keymaterial[i], pkey->key, pkey->len); lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i); break; case 0: break; default: lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n", - i, pkey->len); + i, pkey->len); ret = -1; goto done; break; } } - } else if (cmd_act == CMD_ACT_REMOVE) { + } else if (cmd_action == CMD_ACT_REMOVE) { /* ACT_REMOVE clears _all_ WEP keys */ - wep->action = cpu_to_le16(CMD_ACT_REMOVE); /* default tx key index */ - wep->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx & - (u32)CMD_WEP_KEY_INDEX_MASK)); + cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx & + CMD_WEP_KEY_INDEX_MASK); lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx); } - ret = 0; - + ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); done: lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); return ret; @@ -1422,10 +1409,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_80211_deauthenticate(priv, cmdptr); break; - case CMD_802_11_SET_WEP: - ret = lbs_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf); - break; - case CMD_802_11_AD_HOC_START: ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); break; diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index ca09b1803d1..d9947c3a507 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -51,5 +51,7 @@ int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, uint16_t cmd_action, uint16_t *timeout); int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, struct sleep_params *sp); +int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, + struct assoc_request *assoc); #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 40615a88dc8..d670a811af0 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -490,7 +490,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_MAC_MULTICAST_ADR): case CMD_RET(CMD_MAC_CONTROL): - case CMD_RET(CMD_802_11_SET_WEP): case CMD_RET(CMD_802_11_RESET): case CMD_RET(CMD_802_11_AUTHENTICATE): case CMD_RET(CMD_802_11_BEACON_STOP): diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 855c2d0df86..6d76634f1e1 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -256,6 +256,8 @@ struct cmd_ds_802_11_ad_hoc_result { }; struct cmd_ds_802_11_set_wep { + struct cmd_header hdr; + /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ __le16 action; @@ -263,8 +265,8 @@ struct cmd_ds_802_11_set_wep { __le16 keyindex; /* 40, 128bit or TXWEP */ - u8 keytype[4]; - u8 keymaterial[4][16]; + uint8_t keytype[4]; + uint8_t keymaterial[4][16]; }; struct cmd_ds_802_3_get_stat { @@ -688,7 +690,6 @@ struct cmd_ds_command { struct cmd_ds_mac_control macctrl; struct cmd_ds_802_11_associate associate; struct cmd_ds_802_11_deauthenticate deauth; - struct cmd_ds_802_11_set_wep wep; struct cmd_ds_802_11_ad_hoc_start ads; struct cmd_ds_802_11_reset reset; struct cmd_ds_802_11_ad_hoc_result result; -- cgit v1.2.3 From 4f59abf190b15350167bec5382dda205030ac9d0 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 18 Dec 2007 00:47:17 -0500 Subject: libertas: convert ENABLE_RSN to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/assoc.c | 19 +++++-------------- drivers/net/wireless/libertas/cmd.c | 32 ++++++++++++++------------------ drivers/net/wireless/libertas/cmd.h | 2 ++ drivers/net/wireless/libertas/cmdresp.c | 21 --------------------- drivers/net/wireless/libertas/hostcmd.h | 3 ++- 5 files changed, 23 insertions(+), 54 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index e91cd6724de..c622e9b63cd 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c @@ -305,8 +305,8 @@ static int assoc_helper_secinfo(struct lbs_private *priv, struct assoc_request * assoc_req) { int ret = 0; - u32 do_wpa; - u32 rsn = 0; + uint16_t do_wpa; + uint16_t rsn = 0; lbs_deb_enter(LBS_DEB_ASSOC); @@ -323,28 +323,19 @@ static int assoc_helper_secinfo(struct lbs_private *priv, */ /* Get RSN enabled/disabled */ - ret = lbs_prepare_and_send_command(priv, - CMD_802_11_ENABLE_RSN, - CMD_ACT_GET, - CMD_OPTION_WAITFORRSP, - 0, &rsn); + ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_GET, &rsn); if (ret) { lbs_deb_assoc("Failed to get RSN status: %d\n", ret); goto out; } /* Don't re-enable RSN if it's already enabled */ - do_wpa = (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled); + do_wpa = assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled; if (do_wpa == rsn) goto out; /* Set RSN enabled/disabled */ - rsn = do_wpa; - ret = lbs_prepare_and_send_command(priv, - CMD_802_11_ENABLE_RSN, - CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, - 0, &rsn); + ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_SET, &do_wpa); out: lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 05e25cef5fe..5d2c928fdd3 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -300,30 +300,31 @@ done: return ret; } -static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, - struct cmd_ds_command *cmd, - u16 cmd_action, - void * pdata_buf) +int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, + uint16_t *enable) { - struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; - u32 * enable = pdata_buf; + struct cmd_ds_802_11_enable_rsn cmd; + int ret; lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_802_11_ENABLE_RSN); - cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); - penableRSN->action = cpu_to_le16(cmd_action); + cmd.hdr.size = cpu_to_le16(sizeof(cmd)); + cmd.action = cpu_to_le16(cmd_action); if (cmd_action == CMD_ACT_SET) { if (*enable) - penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN); + cmd.enable = cpu_to_le16(CMD_ENABLE_RSN); else - penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN); + cmd.enable = cpu_to_le16(CMD_DISABLE_RSN); lbs_deb_cmd("ENABLE_RSN: %d\n", *enable); } - lbs_deb_leave(LBS_DEB_CMD); - return 0; + ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd); + if (!ret && cmd_action == CMD_ACT_GET) + *enable = le16_to_cpu(cmd.enable); + + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); + return ret; } @@ -1473,11 +1474,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); break; - case CMD_802_11_ENABLE_RSN: - ret = lbs_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, - pdata_buf); - break; - case CMD_802_11_KEY_MATERIAL: ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action, cmd_oid, pdata_buf); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index d9947c3a507..6efb81ec597 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -53,5 +53,7 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, struct sleep_params *sp); int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, struct assoc_request *assoc); +int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, + uint16_t *enable); #endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d670a811af0..8b71926d7a9 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -372,23 +372,6 @@ static int lbs_ret_get_log(struct lbs_private *priv, return 0; } -static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; - uint32_t * pdata_buf = (uint32_t *)priv->cur_cmd->callback_arg; - - lbs_deb_enter(LBS_DEB_CMD); - - if (enable_rsn->action == cpu_to_le16(CMD_ACT_GET)) { - if (pdata_buf) - *pdata_buf = (uint32_t) le16_to_cpu(enable_rsn->enable); - } - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, struct cmd_ds_command *resp) { @@ -495,10 +478,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, case CMD_RET(CMD_802_11_BEACON_STOP): break; - case CMD_RET(CMD_802_11_ENABLE_RSN): - ret = lbs_ret_802_11_enable_rsn(priv, resp); - break; - case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); break; diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 6d76634f1e1..fffec11d065 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -536,6 +536,8 @@ struct cmd_ds_802_11_ad_hoc_join { } __attribute__ ((packed)); struct cmd_ds_802_11_enable_rsn { + struct cmd_header hdr; + __le16 action; __le16 enable; } __attribute__ ((packed)); @@ -708,7 +710,6 @@ struct cmd_ds_command { struct cmd_ds_802_11_rssi_rsp rssirsp; struct cmd_ds_802_11_disassociate dassociate; struct cmd_ds_802_11_mac_address macadd; - struct cmd_ds_802_11_enable_rsn enbrsn; struct cmd_ds_802_11_key_material keymaterial; struct cmd_ds_mac_reg_access macreg; struct cmd_ds_bbp_reg_access bbpreg; -- cgit v1.2.3 From f15ebb63b36eca5fa68fabd04ab2f7840bc67205 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 19 Dec 2007 13:03:19 +0000 Subject: libertas: change inference about buffer size in lbs_cmd() sizeof(*cmd) is going to give the total size of the data structure that we allocated, more often than not. But the size of the command to be _sent_ could be a lot smaller, as it is in the KEY_MATERIAL and SUBSCRIBE_EVENT commands for example. So swap them round; let the caller set the _command_ size explicitly in the header, and infer the maximum response size from the data structure. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 6efb81ec597..b9ab85cc791 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h @@ -6,13 +6,15 @@ #include "hostcmd.h" #include "dev.h" -#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) \ - __lbs_cmd(priv, cmdnr, &(cmd)->hdr, sizeof(*(cmd)), cb, cb_arg) +/* lbs_cmd() infers the size of the buffer to copy data back into, from + the size of the target of the pointer. Since the command to be sent + may often be smaller, that size is set in cmd->size by the caller.*/ +#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ + uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ + (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ + __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ +}) - -/* lbs_cmd_with_response() infers the size of the command to be _sent_ - and requires that the caller sets cmd->size to the (LE) size of - the _response_ buffer. */ #define lbs_cmd_with_response(priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) -- cgit v1.2.3 From 5844d12ea30bacae9224db6561a16e86ad31c6e5 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 18 Dec 2007 02:01:37 -0500 Subject: libertas: convert SUBSCRIBE_EVENT to a direct command Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 52 +----- drivers/net/wireless/libertas/cmdresp.c | 22 --- drivers/net/wireless/libertas/debugfs.c | 282 +++++++++++++++----------------- drivers/net/wireless/libertas/hostcmd.h | 5 +- 4 files changed, 135 insertions(+), 226 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 5d2c928fdd3..4d06dec6cd4 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -327,53 +327,6 @@ int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, return ret; } - -static ssize_t lbs_tlv_size(const u8 *tlv, u16 size) -{ - ssize_t pos = 0; - struct mrvlietypesheader *tlv_h; - while (pos < size) { - u16 length; - tlv_h = (struct mrvlietypesheader *) tlv; - if (tlv_h->len == 0) - return pos; - length = le16_to_cpu(tlv_h->len) + - sizeof(struct mrvlietypesheader); - pos += length; - tlv += length; - } - return pos; -} - - -static void lbs_cmd_802_11_subscribe_event(struct lbs_private *priv, - struct cmd_ds_command *cmd, u16 cmd_action, - void *pdata_buf) -{ - struct cmd_ds_802_11_subscribe_event *events = - (struct cmd_ds_802_11_subscribe_event *) pdata_buf; - - /* pdata_buf points to a struct cmd_ds_802_11_subscribe_event and room - * for various Marvell TLVs */ - - lbs_deb_enter(LBS_DEB_CMD); - - cmd->size = cpu_to_le16(sizeof(*events) - - sizeof(events->tlv) - + S_DS_GEN); - cmd->params.subscribe_event.action = cpu_to_le16(cmd_action); - if (cmd_action == CMD_ACT_GET) { - cmd->params.subscribe_event.events = 0; - } else { - ssize_t sz = lbs_tlv_size(events->tlv, sizeof(events->tlv)); - cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + sz); - cmd->params.subscribe_event.events = events->events; - memcpy(cmd->params.subscribe_event.tlv, events->tlv, sz); - } - - lbs_deb_leave(LBS_DEB_CMD); -} - static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, struct enc_key * pkey) { @@ -1545,10 +1498,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret = 0; break; } - case CMD_802_11_SUBSCRIBE_EVENT: - lbs_cmd_802_11_subscribe_event(priv, cmdptr, - cmd_action, pdata_buf); - break; + case CMD_802_11_PWR_CFG: cmdptr->command = cpu_to_le16(CMD_802_11_PWR_CFG); cmdptr->size = diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 8b71926d7a9..159216a9190 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -389,25 +389,6 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, return 0; } -static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_subscribe_event *cmd_event = - &resp->params.subscribe_event; - struct cmd_ds_802_11_subscribe_event *dst_event = - (void *)priv->cur_cmd->callback_arg; - - lbs_deb_enter(LBS_DEB_CMD); - - if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) { - dst_event->events = cmd_event->events; - memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv)); - } - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - static inline int handle_cmd_response(struct lbs_private *priv, unsigned long dummy, struct cmd_header *cmd_response) @@ -518,9 +499,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, sizeof(struct cmd_ds_802_11_led_ctrl)); spin_unlock_irqrestore(&priv->driver_lock, flags); break; - case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT): - ret = lbs_ret_802_11_subscribe_event(priv, resp); - break; case CMD_RET(CMD_802_11_PWR_CFG): spin_lock_irqsave(&priv->driver_lock, flags); diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 44be3929c02..fd67b770dd7 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -347,20 +347,19 @@ static ssize_t lbs_setuserscan(struct file *file, * and returns a pointer to the first data byte of the TLV, or to NULL * if the TLV hasn't been found. */ -static void *lbs_tlv_find(u16 tlv_type, const u8 *tlv, u16 size) +static void *lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size) { - __le16 le_type = cpu_to_le16(tlv_type); - ssize_t pos = 0; struct mrvlietypesheader *tlv_h; + uint16_t length; + ssize_t pos = 0; + while (pos < size) { - u16 length; tlv_h = (struct mrvlietypesheader *) tlv; - if (tlv_h->type == le_type) - return tlv_h; - if (tlv_h->len == 0) + if (!tlv_h->len) return NULL; - length = le16_to_cpu(tlv_h->len) + - sizeof(struct mrvlietypesheader); + if (tlv_h->type == cpu_to_le16(tlv_type)) + return tlv_h; + length = le16_to_cpu(tlv_h->len) + sizeof(*tlv_h); pos += length; tlv += length; } @@ -368,100 +367,100 @@ static void *lbs_tlv_find(u16 tlv_type, const u8 *tlv, u16 size) } -/* - * This just gets the bitmap of currently subscribed events. Used when - * adding an additonal event subscription. - */ -static u16 lbs_get_events_bitmap(struct lbs_private *priv) -{ - ssize_t res; - - struct cmd_ds_802_11_subscribe_event *events = kzalloc( - sizeof(struct cmd_ds_802_11_subscribe_event), - GFP_KERNEL); - - res = lbs_prepare_and_send_command(priv, - CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_GET, - CMD_OPTION_WAITFORRSP, 0, events); - - if (res) { - kfree(events); - return 0; - } - return le16_to_cpu(events->events); -} - - -static ssize_t lbs_threshold_read( - u16 tlv_type, u16 event_mask, - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, + struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { + struct cmd_ds_802_11_subscribe_event *subscribed; + struct mrvlietypes_thresholds *got; struct lbs_private *priv = file->private_data; - ssize_t res = 0; + ssize_t ret = 0; size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf; u8 value; u8 freq; int events = 0; - struct cmd_ds_802_11_subscribe_event *subscribed = kzalloc( - sizeof(struct cmd_ds_802_11_subscribe_event), - GFP_KERNEL); - struct mrvlietypes_thresholds *got; + buf = (char *)get_zeroed_page(GFP_KERNEL); + if (!buf) + return -ENOMEM; - res = lbs_prepare_and_send_command(priv, - CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_GET, - CMD_OPTION_WAITFORRSP, 0, subscribed); - if (res) { - kfree(subscribed); - return res; + subscribed = kzalloc(sizeof(*subscribed), GFP_KERNEL); + if (!subscribed) { + ret = -ENOMEM; + goto out_page; } + subscribed->hdr.size = cpu_to_le16(sizeof(*subscribed)); + subscribed->action = cpu_to_le16(CMD_ACT_GET); + + ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, subscribed); + if (ret) + goto out_cmd; + got = lbs_tlv_find(tlv_type, subscribed->tlv, sizeof(subscribed->tlv)); if (got) { value = got->value; freq = got->freq; events = le16_to_cpu(subscribed->events); - } - kfree(subscribed); - if (got) pos += snprintf(buf, len, "%d %d %d\n", value, freq, - !!(events & event_mask)); + !!(events & event_mask)); + } - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); + ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return res; + out_cmd: + kfree(subscribed); + + out_page: + free_page((unsigned long)buf); + return ret; } -static ssize_t lbs_threshold_write( - u16 tlv_type, u16 event_mask, - struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, + struct file *file, + const char __user *userbuf, size_t count, + loff_t *ppos) { - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - int value, freq, curr_mask, new_mask; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; struct cmd_ds_802_11_subscribe_event *events; + struct mrvlietypes_thresholds *tlv; + struct lbs_private *priv = file->private_data; + ssize_t buf_size; + int value, freq, new_mask; + uint16_t curr_mask; + char *buf; + int ret; + + buf = (char *)get_zeroed_page(GFP_KERNEL); + if (!buf) + return -ENOMEM; buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; + ret = -EFAULT; + goto out_page; } - res = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); - if (res != 3) { - res = -EFAULT; - goto out_unlock; + ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); + if (ret != 3) { + ret = -EINVAL; + goto out_page; } - curr_mask = lbs_get_events_bitmap(priv); + events = kzalloc(sizeof(*events), GFP_KERNEL); + if (!events) { + ret = -ENOMEM; + goto out_page; + } + + events->hdr.size = cpu_to_le16(sizeof(*events)); + events->action = cpu_to_le16(CMD_ACT_GET); + + ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); + if (ret) + goto out_events; + + curr_mask = le16_to_cpu(events->events); if (new_mask) new_mask = curr_mask | event_mask; @@ -469,147 +468,128 @@ static ssize_t lbs_threshold_write( new_mask = curr_mask & ~event_mask; /* Now everything is set and we can send stuff down to the firmware */ - events = kzalloc( - sizeof(struct cmd_ds_802_11_subscribe_event), - GFP_KERNEL); - if (events) { - struct mrvlietypes_thresholds *tlv = - (struct mrvlietypes_thresholds *) events->tlv; - events->action = cpu_to_le16(CMD_ACT_SET); - events->events = cpu_to_le16(new_mask); - tlv->header.type = cpu_to_le16(tlv_type); - tlv->header.len = cpu_to_le16( - sizeof(struct mrvlietypes_thresholds) - - sizeof(struct mrvlietypesheader)); - tlv->value = value; - if (tlv_type != TLV_TYPE_BCNMISS) - tlv->freq = freq; - lbs_prepare_and_send_command(priv, - CMD_802_11_SUBSCRIBE_EVENT, CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, events); - kfree(events); - } - res = count; -out_unlock: - free_page(addr); - return res; + tlv = (void *)events->tlv; + + events->action = cpu_to_le16(CMD_ACT_SET); + events->events = cpu_to_le16(new_mask); + tlv->header.type = cpu_to_le16(tlv_type); + tlv->header.len = cpu_to_le16(sizeof(*tlv) - sizeof(tlv->header)); + tlv->value = value; + if (tlv_type != TLV_TYPE_BCNMISS) + tlv->freq = freq; + + /* The command header, the event mask, and the one TLV */ + events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 2 + sizeof(*tlv)); + + ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); + + if (!ret) + ret = count; + out_events: + kfree(events); + out_page: + free_page((unsigned long)buf); + return ret; } -static ssize_t lbs_lowrssi_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_lowrssi_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_lowrssi_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_lowsnr_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_lowsnr_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_lowsnr_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_failcount_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_failcount_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_highrssi_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_highrssi_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_highsnr_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_highsnr_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_highsnr_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_bcnmiss_read( - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_read(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } -static ssize_t lbs_bcnmiss_write( - struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, + size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); + file, userbuf, count, ppos); } - - - - - static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index fffec11d065..be325eda6a4 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -156,6 +156,8 @@ struct cmd_ds_802_11_reset { }; struct cmd_ds_802_11_subscribe_event { + struct cmd_header hdr; + __le16 action; __le16 events; @@ -164,7 +166,7 @@ struct cmd_ds_802_11_subscribe_event { * 40 bytes. However, future firmware might add additional TLVs, so I * bump this up a bit. */ - u8 tlv[128]; + uint8_t tlv[128]; }; /* @@ -728,7 +730,6 @@ struct cmd_ds_command { struct cmd_ds_bt_access bt; struct cmd_ds_fwt_access fwt; struct cmd_ds_get_tsf gettsf; - struct cmd_ds_802_11_subscribe_event subscribe_event; struct cmd_ds_802_11_beacon_control bcn_ctrl; } params; } __attribute__ ((packed)); -- cgit v1.2.3 From 7e94041ca17685cf12c658b8edc008dd0bdb00c7 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 18 Dec 2007 11:41:43 +0000 Subject: libertas: remove check for driver_lock in lbs_interrupt() Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 74353e1d72f..91b2f2398a6 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1435,11 +1435,6 @@ void lbs_interrupt(struct lbs_private *priv) lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter); - if (!spin_is_locked(&priv->driver_lock)) { - printk(KERN_CRIT "%s called without driver_lock held\n", __func__); - WARN_ON(1); - } - priv->intcounter++; if (priv->psstate == PS_STATE_SLEEP) -- cgit v1.2.3 From ae3e0fcf901e4b7df87aef7ab39093e142a8de8b Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 16 Jan 2008 15:48:44 +0100 Subject: libertas cs/sdio: fix 'NOHZ: local_softirq_pending 08' message netif_rx should be called only from interrupt context. if_cs and if_sdio receive packets from other contexts, and thus should call netif_rx_ni. Signed-off-by: Marc Pignat Acked-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 6332fd451a1..149557a478a 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -247,7 +247,10 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) priv->stats.rx_packets++; skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); + if (in_interrupt()) + netif_rx(skb); + else + netif_rx_ni(skb); ret = 0; done: -- cgit v1.2.3 From 4365929d176b47a78d10aca0d1dee2afdfcbe4f2 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 16 Jan 2008 15:52:58 +0100 Subject: libertas: move cardspecific data to driver boot2_version is purely USB specific, so move it to struct if_usb_card. Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/if_usb.c | 5 +++-- drivers/net/wireless/libertas/if_usb.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 362975189e9..c1c9733c5f9 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -102,7 +102,6 @@ struct lbs_private { int mesh_open; int infra_open; int mesh_autostart_enabled; - __le16 boot2_version; char name[DEV_NAME_LEN]; diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 7db8e6c35dc..75aed9d0736 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -104,12 +104,13 @@ static void if_usb_free(struct if_usb_card *cardp) static void if_usb_setup_firmware(struct lbs_private *priv) { + struct if_usb_card *cardp = priv->card; struct cmd_ds_set_boot2_ver b2_cmd; struct cmd_ds_802_11_fw_wake_method wake_method; b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); b2_cmd.action = 0; - b2_cmd.version = priv->boot2_version; + b2_cmd.version = cardp->boot2_version; if (lbs_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) lbs_deb_usb("Setting boot2 version failed\n"); @@ -234,7 +235,7 @@ static int if_usb_probe(struct usb_interface *intf, priv->hw_host_to_card = if_usb_host_to_card; priv->hw_get_int_status = if_usb_get_int_status; priv->hw_read_event_cause = if_usb_read_event_cause; - priv->boot2_version = udev->descriptor.bcdDevice; + cardp->boot2_version = udev->descriptor.bcdDevice; if_usb_submit_rx_urb(cardp); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 77066911230..e4829a391eb 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h @@ -70,6 +70,7 @@ struct if_usb_card { uint8_t fwfinalblk; uint8_t surprise_removed; + __le16 boot2_version; }; /** fwheader */ -- cgit v1.2.3 From dac10a9f286c75cffa75c7ec8b05d566a6ece95e Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 16 Jan 2008 15:55:22 +0100 Subject: libertas: always show firmware release Always shows the firmware release. Also converts the firmware release into something that is easily comparable. Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmd.c | 23 +++++++++++++++++------ drivers/net/wireless/libertas/dev.h | 2 +- drivers/net/wireless/libertas/hostcmd.h | 4 ++-- drivers/net/wireless/libertas/wext.c | 16 +++++----------- 4 files changed, 25 insertions(+), 20 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4d06dec6cd4..eab020338fd 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -60,13 +60,24 @@ int lbs_update_hw_spec(struct lbs_private *priv) goto out; priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); - memcpy(priv->fwreleasenumber, cmd.fwreleasenumber, 4); - lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", - priv->fwreleasenumber[2], priv->fwreleasenumber[1], - priv->fwreleasenumber[0], priv->fwreleasenumber[3]); - lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", - print_mac(mac, cmd.permanentaddr)); + /* The firmware release is in an interesting format: the patch + * level is in the most significant nibble ... so fix that: */ + priv->fwrelease = le32_to_cpu(cmd.fwrelease); + priv->fwrelease = (priv->fwrelease << 8) | + (priv->fwrelease >> 24 & 0xff); + + /* Some firmware capabilities: + * CF card firmware 5.0.16p0: cap 0x00000303 + * USB dongle firmware 5.110.17p2: cap 0x00000303 + */ + printk("libertas: %s, fw %u.%u.%up%u, cap 0x%08x\n", + print_mac(mac, cmd.permanentaddr), + priv->fwrelease >> 24 & 0xff, + priv->fwrelease >> 16 & 0xff, + priv->fwrelease >> 8 & 0xff, + priv->fwrelease & 0xff, + priv->fwcapinfo); lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", cmd.hwifversion, cmd.version); diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index c1c9733c5f9..58d7ef6b5ff 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -161,7 +161,7 @@ struct lbs_private { /** Wlan adapter data structure*/ /** STATUS variables */ - u8 fwreleasenumber[4]; + u32 fwrelease; u32 fwcapinfo; /* protected with big lock */ diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index be325eda6a4..d35b015b665 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h @@ -136,8 +136,8 @@ struct cmd_ds_get_hw_spec { /* Number of antenna used */ __le16 nr_antenna; - /* FW release number, example 1,2,3,4 = 3.2.1p4 */ - u8 fwreleasenumber[4]; + /* FW release number, example 0x01030304 = 2.3.4p1 */ + __le32 fwrelease; /* Base Address of TxPD queue */ __le32 wcb_base; diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 3e8d555ba3a..e8bfc26b10a 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -2071,17 +2071,11 @@ void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen) mutex_lock(&priv->lock); - if (priv->fwreleasenumber[3] == 0) - sprintf(fwver, "%u.%u.%u", - priv->fwreleasenumber[2], - priv->fwreleasenumber[1], - priv->fwreleasenumber[0]); - else - sprintf(fwver, "%u.%u.%u.p%u", - priv->fwreleasenumber[2], - priv->fwreleasenumber[1], - priv->fwreleasenumber[0], - priv->fwreleasenumber[3]); + sprintf(fwver, "%u.%u.%u.p%u", + priv->fwrelease >> 24 & 0xff, + priv->fwrelease >> 16 & 0xff, + priv->fwrelease >> 8 & 0xff, + priv->fwrelease & 0xff); mutex_unlock(&priv->lock); snprintf(fwversion, maxlen, fwver); -- cgit v1.2.3 From c9d1be36197bf638be68cec6685c68e462273b65 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 16 Jan 2008 15:57:44 +0100 Subject: libertas: don't blindly try mesh The CF card only has a very old firmware (5.0.16p0). This firmware doesn't know anything about mesh config. However, current code blindly calls mesh_config when the card is inserted. So check the firmware version before issuing this command. Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 91b2f2398a6..8f3e661db98 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1192,31 +1192,35 @@ int lbs_start_card(struct lbs_private *priv) if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) lbs_pr_err("cannot register lbs_rtap attribute\n"); - /* Enable mesh, if supported, and work out which TLV it uses. - 0x100 + 291 is an unofficial value used in 5.110.20.pXX - 0x100 + 37 is the official value used in 5.110.21.pXX - but we check them in that order because 20.pXX doesn't - give an error -- it just silently fails. */ - - /* 5.110.20.pXX firmware will fail the command if the channel - doesn't match the existing channel. But only if the TLV - is correct. If the channel is wrong, _BOTH_ versions will - give an error to 0x100+291, and allow 0x100+37 to succeed. - It's just that 5.110.20.pXX will not have done anything - useful */ - lbs_update_channel(priv); - priv->mesh_tlv = 0x100 + 291; - if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) { - priv->mesh_tlv = 0x100 + 37; - if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) - priv->mesh_tlv = 0; - } - if (priv->mesh_tlv) { - lbs_add_mesh(priv); - if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) - lbs_pr_err("cannot register lbs_mesh attribute\n"); + /* 5.0.16p0 is known to NOT support any mesh */ + if (priv->fwrelease > 0x05001000) { + /* Enable mesh, if supported, and work out which TLV it uses. + 0x100 + 291 is an unofficial value used in 5.110.20.pXX + 0x100 + 37 is the official value used in 5.110.21.pXX + but we check them in that order because 20.pXX doesn't + give an error -- it just silently fails. */ + + /* 5.110.20.pXX firmware will fail the command if the channel + doesn't match the existing channel. But only if the TLV + is correct. If the channel is wrong, _BOTH_ versions will + give an error to 0x100+291, and allow 0x100+37 to succeed. + It's just that 5.110.20.pXX will not have done anything + useful */ + + priv->mesh_tlv = 0x100 + 291; + if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) { + priv->mesh_tlv = 0x100 + 37; + if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) + priv->mesh_tlv = 0; + } + if (priv->mesh_tlv) { + lbs_add_mesh(priv); + + if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) + lbs_pr_err("cannot register lbs_mesh attribute\n"); + } } lbs_debugfs_init_one(priv, dev); -- cgit v1.2.3 From 61d30020dc2c49d36d95f3efb8b5ed727e459087 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 16 Jan 2008 15:59:52 +0100 Subject: libertas: pepper main with debug statement libertas: re-pepper debug statementThe recent fluff of updates didn't put proper lbs_deb_enter/leave calls into the source code. Add them where appropriate. Also contains some whitespace changes. Signed-off-by: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/main.c | 144 ++++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 62 deletions(-) (limited to 'drivers/net/wireless/libertas') diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 8f3e661db98..84fb49ca0fa 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -388,6 +388,8 @@ static int lbs_dev_open(struct net_device *dev) struct lbs_private *priv = (struct lbs_private *) dev->priv ; int ret = 0; + lbs_deb_enter(LBS_DEB_NET); + spin_lock_irq(&priv->driver_lock); if (priv->monitormode != LBS_MONITOR_OFF) { @@ -413,6 +415,7 @@ static int lbs_dev_open(struct net_device *dev) out: spin_unlock_irq(&priv->driver_lock); + lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); return ret; } @@ -426,6 +429,7 @@ static int lbs_mesh_stop(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) (dev->priv); + lbs_deb_enter(LBS_DEB_MESH); spin_lock_irq(&priv->driver_lock); priv->mesh_open = 0; @@ -435,6 +439,8 @@ static int lbs_mesh_stop(struct net_device *dev) netif_carrier_off(dev); spin_unlock_irq(&priv->driver_lock); + + lbs_deb_leave(LBS_DEB_MESH); return 0; } @@ -448,13 +454,14 @@ static int lbs_eth_stop(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; - spin_lock_irq(&priv->driver_lock); + lbs_deb_enter(LBS_DEB_NET); + spin_lock_irq(&priv->driver_lock); priv->infra_open = 0; - netif_stop_queue(dev); - spin_unlock_irq(&priv->driver_lock); + + lbs_deb_leave(LBS_DEB_NET); return 0; } @@ -490,6 +497,8 @@ void lbs_host_to_card_done(struct lbs_private *priv) { unsigned long flags; + lbs_deb_enter(LBS_DEB_THREAD); + spin_lock_irqsave(&priv->driver_lock, flags); priv->dnld_sent = DNLD_RES_RECEIVED; @@ -499,6 +508,7 @@ void lbs_host_to_card_done(struct lbs_private *priv) wake_up_interruptible(&priv->waitq); spin_unlock_irqrestore(&priv->driver_lock, flags); + lbs_deb_leave(LBS_DEB_THREAD); } EXPORT_SYMBOL_GPL(lbs_host_to_card_done); @@ -512,6 +522,7 @@ static struct net_device_stats *lbs_get_stats(struct net_device *dev) { struct lbs_private *priv = (struct lbs_private *) dev->priv; + lbs_deb_enter(LBS_DEB_NET); return &priv->stats; } @@ -564,9 +575,7 @@ static int lbs_copy_multicast_address(struct lbs_private *priv, memcpy(&priv->multicastlist[i], mcptr->dmi_addr, ETH_ALEN); mcptr = mcptr->next; } - return i; - } static void lbs_set_multicast_list(struct net_device *dev) @@ -620,7 +629,7 @@ static void lbs_set_multicast_list(struct net_device *dev) dev->mc_count); for (i = 0; i < dev->mc_count; i++) { - lbs_deb_net("Multicast address %d:%s\n", + lbs_deb_net("Multicast address %d: %s\n", i, print_mac(mac, priv->multicastlist[i])); } @@ -857,22 +866,24 @@ static int lbs_thread(void *data) static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy, struct cmd_header *cmd) { - lbs_deb_fw("HOST_SLEEP_ACTIVATE succeeded\n"); + lbs_deb_enter(LBS_DEB_FW); netif_device_detach(priv->dev); if (priv->mesh_dev) netif_device_detach(priv->mesh_dev); priv->fw_ready = 0; + lbs_deb_leave(LBS_DEB_FW); return 0; } - int lbs_suspend(struct lbs_private *priv) { struct cmd_header cmd; int ret; + lbs_deb_enter(LBS_DEB_FW); + if (priv->wol_criteria == 0xffffffff) { lbs_pr_info("Suspend attempt without configuring wake params!\n"); return -EINVAL; @@ -885,12 +896,15 @@ int lbs_suspend(struct lbs_private *priv) if (ret) lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret); + lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); return ret; } EXPORT_SYMBOL_GPL(lbs_suspend); int lbs_resume(struct lbs_private *priv) { + lbs_deb_enter(LBS_DEB_FW); + priv->fw_ready = 1; /* Firmware doesn't seem to give us RX packets any more @@ -902,6 +916,7 @@ int lbs_resume(struct lbs_private *priv) if (priv->mesh_dev) netif_device_attach(priv->mesh_dev); + lbs_deb_leave(LBS_DEB_FW); return 0; } EXPORT_SYMBOL_GPL(lbs_resume); @@ -953,6 +968,7 @@ static void command_timer_fn(unsigned long data) struct lbs_private *priv = (struct lbs_private *)data; unsigned long flags; + lbs_deb_enter(LBS_DEB_CMD); spin_lock_irqsave(&priv->driver_lock, flags); if (!priv->cur_cmd) { @@ -964,8 +980,9 @@ static void command_timer_fn(unsigned long data) priv->cmd_timed_out = 1; wake_up_interruptible(&priv->waitq); - out: +out: spin_unlock_irqrestore(&priv->driver_lock, flags); + lbs_deb_leave(LBS_DEB_CMD); } static int lbs_init_adapter(struct lbs_private *priv) @@ -973,6 +990,8 @@ static int lbs_init_adapter(struct lbs_private *priv) size_t bufsize; int i, ret = 0; + lbs_deb_enter(LBS_DEB_MAIN); + /* Allocate buffer to store the BSSID list */ bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); priv->networks = kzalloc(bufsize, GFP_KERNEL); @@ -1015,7 +1034,7 @@ static int lbs_init_adapter(struct lbs_private *priv) mutex_init(&priv->lock); setup_timer(&priv->command_timer, command_timer_fn, - (unsigned long)priv); + (unsigned long)priv); INIT_LIST_HEAD(&priv->cmdfreeq); INIT_LIST_HEAD(&priv->cmdpendingq); @@ -1030,20 +1049,21 @@ static int lbs_init_adapter(struct lbs_private *priv) } out: + lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); + return ret; } static void lbs_free_adapter(struct lbs_private *priv) { - lbs_deb_fw("free command buffer\n"); - lbs_free_cmd_buffer(priv); + lbs_deb_enter(LBS_DEB_MAIN); - lbs_deb_fw("free command_timer\n"); + lbs_free_cmd_buffer(priv); del_timer(&priv->command_timer); - - lbs_deb_fw("free scan results table\n"); kfree(priv->networks); priv->networks = NULL; + + lbs_deb_leave(LBS_DEB_MAIN); } /** @@ -1058,7 +1078,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) struct net_device *dev = NULL; struct lbs_private *priv = NULL; - lbs_deb_enter(LBS_DEB_NET); + lbs_deb_enter(LBS_DEB_MAIN); /* Allocate an Ethernet device and register it */ dev = alloc_etherdev(sizeof(struct lbs_private)); @@ -1124,7 +1144,7 @@ err_init_adapter: priv = NULL; done: - lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); + lbs_deb_leave_args(LBS_DEB_MAIN, "priv %p", priv); return priv; } EXPORT_SYMBOL_GPL(lbs_add_card); @@ -1338,26 +1358,19 @@ static void lbs_remove_mesh(struct lbs_private *priv) { struct net_device *mesh_dev; - lbs_deb_enter(LBS_DEB_MAIN); - - if (!priv) - goto out; mesh_dev = priv->mesh_dev; if (!mesh_dev) - goto out; + return; + lbs_deb_enter(LBS_DEB_MESH); netif_stop_queue(mesh_dev); netif_carrier_off(priv->mesh_dev); - sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); unregister_netdev(mesh_dev); - priv->mesh_dev = NULL; free_netdev(mesh_dev); - -out: - lbs_deb_leave(LBS_DEB_MAIN); + lbs_deb_leave(LBS_DEB_MESH); } EXPORT_SYMBOL_GPL(lbs_remove_mesh); @@ -1404,22 +1417,20 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) memset(priv->region_channel, 0, sizeof(priv->region_channel)); - { - cfp = lbs_get_region_cfp_table(region, band, &cfp_no); - if (cfp != NULL) { - priv->region_channel[i].nrcfp = cfp_no; - priv->region_channel[i].CFP = cfp; - } else { - lbs_deb_main("wrong region code %#x in band B/G\n", - region); - ret = -1; - goto out; - } - priv->region_channel[i].valid = 1; - priv->region_channel[i].region = region; - priv->region_channel[i].band = band; - i++; + cfp = lbs_get_region_cfp_table(region, band, &cfp_no); + if (cfp != NULL) { + priv->region_channel[i].nrcfp = cfp_no; + priv->region_channel[i].CFP = cfp; + } else { + lbs_deb_main("wrong region code %#x in band B/G\n", + region); + ret = -1; + goto out; } + priv->region_channel[i].valid = 1; + priv->region_channel[i].region = region; + priv->region_channel[i].band = band; + i++; out: lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); return ret; @@ -1438,12 +1449,9 @@ void lbs_interrupt(struct lbs_private *priv) lbs_deb_enter(LBS_DEB_THREAD); lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter); - priv->intcounter++; - if (priv->psstate == PS_STATE_SLEEP) priv->psstate = PS_STATE_AWAKE; - wake_up_interruptible(&priv->waitq); lbs_deb_leave(LBS_DEB_THREAD); @@ -1475,9 +1483,7 @@ static int __init lbs_init_module(void) static void __exit lbs_exit_module(void) { lbs_deb_enter(LBS_DEB_MAIN); - lbs_debugfs_remove(); - lbs_deb_leave(LBS_DEB_MAIN); } @@ -1488,49 +1494,61 @@ static void __exit lbs_exit_module(void) static int lbs_rtap_open(struct net_device *dev) { /* Yes, _stop_ the queue. Because we don't support injection */ - netif_carrier_off(dev); - netif_stop_queue(dev); - return 0; + lbs_deb_enter(LBS_DEB_MAIN); + netif_carrier_off(dev); + netif_stop_queue(dev); + lbs_deb_leave(LBS_DEB_LEAVE); + return 0; } static int lbs_rtap_stop(struct net_device *dev) { - return 0; + lbs_deb_enter(LBS_DEB_MAIN); + lbs_deb_leave(LBS_DEB_MAIN); + return 0; } static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { - netif_stop_queue(dev); - return NETDEV_TX_BUSY; + netif_stop_queue(dev); + return NETDEV_TX_BUSY; } static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) { struct lbs_private *priv = dev->priv; + lbs_deb_enter(LBS_DEB_NET); return &priv->stats; } static void lbs_remove_rtap(struct lbs_private *priv) { + lbs_deb_enter(LBS_DEB_MAIN); if (priv->rtap_net_dev == NULL) return; unregister_netdev(priv->rtap_net_dev); free_netdev(priv->rtap_net_dev); priv->rtap_net_dev = NULL; + lbs_deb_leave(LBS_DEB_MAIN); } static int lbs_add_rtap(struct lbs_private *priv) { - int rc = 0; + int ret = 0; struct net_device *rtap_dev; - if (priv->rtap_net_dev) - return -EPERM; + lbs_deb_enter(LBS_DEB_MAIN); + if (priv->rtap_net_dev) { + ret = -EPERM; + goto out; + } rtap_dev = alloc_netdev(0, "rtap%d", ether_setup); - if (rtap_dev == NULL) - return -ENOMEM; + if (rtap_dev == NULL) { + ret = -ENOMEM; + goto out; + } memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN); rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; @@ -1541,14 +1559,16 @@ static int lbs_add_rtap(struct lbs_private *priv) rtap_dev->set_multicast_list = lbs_set_multicast_list; rtap_dev->priv = priv; - rc = register_netdev(rtap_dev); - if (rc) { + ret = register_netdev(rtap_dev); + if (ret) { free_netdev(rtap_dev); - return rc; + goto out; } priv->rtap_net_dev = rtap_dev; - return 0; +out: + lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); + return ret; } -- cgit v1.2.3