Commit 9012b28a authored by Holger Schurig's avatar Holger Schurig Committed by John W. Linville

[PATCH] libertas: make debug configurable

The debug output of libertas was either not present or it was overwhelming.
This patch adds the possibility to specify a bitmask for the area of
interest. One should then only get the desired output.
Signed-off-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 46868202
......@@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
for (i = 0; i < cfp_no; i++) {
if ((cfp + i)->channel == firstchan) {
lbs_pr_debug(1, "firstchan found\n");
lbs_deb_11d("firstchan found\n");
break;
}
}
......@@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan,
for (i = 0; i < nr_chan; i++) {
if (chan == chanpwr[i].chan) {
lbs_pr_debug(1, "11D: Found Chan:%d\n", chan);
lbs_deb_11d("11D: Found Chan:%d\n", chan);
return 1;
}
}
lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan);
lbs_deb_11d("11D: Not Find Chan:%d\n", chan);
return 0;
}
......@@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
COUNTRY_CODE_LEN);
lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan);
lbs_deb_11d("11D:nrchan=%d\n", nr_chan);
lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
sizeof(struct parsed_region_chan_11d));
......@@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
}
domaininfo->nr_subband = nr_subband;
lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband);
lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
COUNTRY_CODE_LEN + 1 +
sizeof(struct ieeetypes_subbandset) * nr_subband);
......@@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
struct chan_freq_power *cfp;
if (region_chan == NULL) {
lbs_pr_debug(1, "11D: region_chan is NULL\n");
lbs_deb_11d("11D: region_chan is NULL\n");
return;
}
cfp = region_chan->CFP;
if (cfp == NULL) {
lbs_pr_debug(1, "11D: cfp equal NULL \n");
lbs_deb_11d("11D: cfp equal NULL \n");
return;
}
......@@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
memcpy(parsed_region_chan->countrycode,
wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
parsed_region_chan->band);
for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
parsed_region_chan->chanpwr[i].chan = cfp->channel;
parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n",
lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n",
parsed_region_chan->chanpwr[i].chan,
parsed_region_chan->chanpwr[i].pwr);
}
parsed_region_chan->nr_chan = region_chan->nrcfp;
lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
return;
}
......@@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
struct chan_freq_power *cfp;
int cfp_no;
u8 idx;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
if (cfp == NULL)
......@@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
if (chan == (cfp + idx)->channel) {
/* If Mrvl Chip Supported? */
if ((cfp + idx)->unsupported) {
return 0;
ret = 0;
} else {
return 1;
ret = 1;
}
goto done;
}
}
/*chan is not in the region table */
LEAVE();
return 0;
done:
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
return ret;
}
/**
......@@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
u8 j, i;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
/*validation Rules:
1. valid region Code
......@@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
if ((*(countryinfo->countrycode)) == 0
|| (countryinfo->len <= COUNTRY_CODE_LEN)) {
/* No region Info or Wrong region info: treat as No 11D info */
LEAVE();
return 0;
goto done;
}
/*Step1: check region_code */
parsed_region_chan->region = region =
wlan_region_2_code(countryinfo->countrycode);
lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region);
lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region);
lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
COUNTRY_CODE_LEN);
......@@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
if (countryinfo->subband[j].firstchan <= lastchan) {
/*Step2&3. Check First Chan Num increment and no overlap */
lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n",
lbs_deb_11d("11D: Chan[%d>%d] Overlap\n",
countryinfo->subband[j].firstchan, lastchan);
continue;
}
......@@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
/* Chan is not found in UN table */
lbs_pr_debug(1, "chan is not supported: %d \n", i);
lbs_deb_11d("chan is not supported: %d \n", i);
break;
}
......@@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
idx++;
} else {
/*not supported and ignore the chan */
lbs_pr_debug(1,
lbs_deb_11d(
"11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
i, curchan, region, band);
}
......@@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
parsed_region_chan->nr_chan = idx;
lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan);
lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan);
lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
LEAVE();
done:
lbs_deb_enter(LBS_DEB_11D);
return 0;
}
......@@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan,
{
u8 scan_type = cmd_scan_type_passive;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
if (wlan_channel_known_11d(chan, parsed_region_chan)) {
lbs_pr_debug(1, "11D: Found and do Active Scan\n");
lbs_deb_11d("11D: Found and do Active Scan\n");
scan_type = cmd_scan_type_active;
} else {
lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n");
lbs_deb_11d("11D: Not Find and do Passive Scan\n");
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type);
return scan_type;
}
......@@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag)
OID_802_11D_ENABLE,
&priv->adapter->enable11d);
if (ret)
lbs_pr_debug(1, "11D: Fail to enable 11D \n");
lbs_deb_11d("11D: Fail to enable 11D \n");
return 0;
}
......@@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv)
int ret;
if (!priv->adapter->enable11d) {
lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n");
lbs_deb_11d("11D: dnld domain Info with 11d disabled\n");
return 0;
}
......@@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv)
cmd_act_set,
cmd_option_waitforrsp, 0, NULL);
if (ret)
lbs_pr_debug(1, "11D: Fail to dnld domain Info\n");
lbs_deb_11d("11D: Fail to dnld domain Info\n");
return ret;
}
......@@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band)
adapter->universal_channel[i].nrcfp =
sizeof(channel_freq_power_UN_BG) / size;
lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n",
lbs_deb_11d("11D: BG-band nrcfp=%d\n",
adapter->universal_channel[i].nrcfp);
adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
......@@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
u8 nr_subband = adapter->domainreg.nr_subband;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
lbs_pr_debug(1, "nr_subband=%x\n", nr_subband);
lbs_deb_11d("nr_subband=%x\n", nr_subband);
cmd->command = cpu_to_le16(cmdno);
pdomaininfo->action = cpu_to_le16(cmdoption);
......@@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
(int)(cmd->size));
LEAVE();
return 0;
goto done;
}
domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
......@@ -569,8 +572,8 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size));
LEAVE();
done:
lbs_deb_enter(LBS_DEB_11D);
return 0;
}
......@@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
int data = 0;
int *val;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
data = SUBCMD_DATA(wrq);
lbs_pr_debug(1, "enable 11D: %s\n",
lbs_deb_11d("enable 11D: %s\n",
(data == 1) ? "enable" : "Disable");
wlan_enable_11d(priv, data);
val = (int *)wrq->u.name;
*val = priv->adapter->enable11d;
LEAVE();
lbs_deb_enter(LBS_DEB_11D);
return 0;
}
......@@ -615,7 +618,7 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
s16 ret = 0;
u8 nr_subband = 0;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
(int)le16_to_cpu(resp->size));
......@@ -623,10 +626,10 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset);
/* countrycode 3 bytes */
lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband);
lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n");
lbs_deb_11d("Invalid Numrer of Subband returned!!\n");
return -1;
}
......@@ -637,12 +640,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
case cmd_act_get:
break;
default:
lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action);
lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
ret = -1;
break;
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
return ret;
}
......@@ -656,7 +659,7 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
int ret;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_11D);
if (priv->adapter->enable11d) {
memset(&adapter->parsed_region_chan, 0,
sizeof(struct parsed_region_chan_11d));
......@@ -665,9 +668,8 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
&adapter->parsed_region_chan);
if (ret == -1) {
lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n");
LEAVE();
return ret;
lbs_deb_11d("11D: Err Parse domain_info from AP..\n");
goto done;
}
memset(&adapter->domainreg, 0,
......@@ -678,13 +680,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
ret = set_domain_info_11d(priv);
if (ret) {
lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
LEAVE();
return ret;
lbs_deb_11d("11D: Err set domainInfo to FW\n");
goto done;
}
}
LEAVE();
return 0;
ret = 0;
done:
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
return ret;
}
/**
......@@ -699,8 +703,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
struct region_channel *region_chan;
u8 j;
ENTER();
lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
lbs_deb_enter(LBS_DEB_11D);
lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
if (priv->adapter->enable11d) {
/* update parsed_region_chan_11; dnld domaininf to FW */
......@@ -709,7 +713,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
sizeof(adapter->region_channel[0]); j++) {
region_chan = &adapter->region_channel[j];
lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j,
lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j,
region_chan->band);
if (!region_chan || !region_chan->valid
......@@ -722,10 +726,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
if (j >= sizeof(adapter->region_channel) /
sizeof(adapter->region_channel[0])) {
lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n",
lbs_deb_11d("11D:region_chan not found. band[%d]\n",
adapter->curbssparams.band);
LEAVE();
return -1;
ret = -1;
goto done;
}
memset(&adapter->parsed_region_chan, 0,
......@@ -742,13 +746,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
ret = set_domain_info_11d(priv);
if (ret) {
lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
LEAVE();
return ret;
lbs_deb_11d("11D: Err set domainInfo to FW\n");
goto done;
}
}
ret = 0;
LEAVE();
return 0;
done:
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
return ret;
}
......@@ -20,9 +20,9 @@ static int assoc_helper_essid(wlan_private *priv,
int ret = 0;
int i;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid);
if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->prescan) {
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
......@@ -31,7 +31,7 @@ static int assoc_helper_essid(wlan_private *priv,
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
NULL, IW_MODE_INFRA);
if (i >= 0) {
lbs_pr_debug(1,
lbs_deb_assoc(
"SSID found in scan list ... associating...\n");
ret = wlan_associate(priv, &adapter->scantable[i]);
......@@ -41,7 +41,7 @@ static int assoc_helper_essid(wlan_private *priv,
ETH_ALEN);
}
} else {
lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
lbs_deb_assoc("SSID '%s' not found; cannot associate\n",
assoc_req->ssid.ssid);
}
} else if (assoc_req->mode == IW_MODE_ADHOC) {
......@@ -54,18 +54,18 @@ static int assoc_helper_essid(wlan_private *priv,
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
IW_MODE_ADHOC);
if (i >= 0) {
lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
lbs_deb_assoc("SSID found at %d in List, so join\n", ret);
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
} else {
/* else send START command */
lbs_pr_debug(1, "SSID not found in list, so creating adhoc"
lbs_deb_assoc("SSID not found in list, so creating adhoc"
" with SSID '%s'\n", assoc_req->ssid.ssid);
libertas_start_adhoc_network(priv, &assoc_req->ssid);
}
memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -76,23 +76,21 @@ static int assoc_helper_bssid(wlan_private *priv,
wlan_adapter *adapter = priv->adapter;
int i, ret = 0;
ENTER();
lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n",
lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n",
MAC_ARG(assoc_req->bssid));
/* Search for index position in list for requested MAC */
i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
assoc_req->mode);
if (i < 0) {
lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, "
lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
"cannot associate.\n", MAC_ARG(assoc_req->bssid));
goto out;
}
if (assoc_req->mode == IW_MODE_INFRA) {
ret = wlan_associate(priv, &adapter->scantable[i]);
lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
lbs_deb_assoc("ASSOC: return from wlan_associate(bssd) was %d\n", ret);
} else if (assoc_req->mode == IW_MODE_ADHOC) {
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
}
......@@ -100,7 +98,7 @@ static int assoc_helper_bssid(wlan_private *priv,
sizeof(struct WLAN_802_11_SSID));
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -118,7 +116,7 @@ static int assoc_helper_associate(wlan_private *priv,
ret = assoc_helper_bssid(priv, assoc_req);
done = 1;
if (ret) {
lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
}
}
}
......@@ -126,7 +124,7 @@ static int assoc_helper_associate(wlan_private *priv,
if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
ret = assoc_helper_essid(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
}
}
......@@ -140,12 +138,10 @@ static int assoc_helper_mode(wlan_private *priv,
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
if (assoc_req->mode == adapter->mode) {
LEAVE();
return 0;
}
if (assoc_req->mode == adapter->mode)
goto done;
if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->psstate != PS_STATE_FULL_POWER)
......@@ -160,7 +156,8 @@ static int assoc_helper_mode(wlan_private *priv,
OID_802_11_INFRASTRUCTURE_MODE,
(void *) (size_t) assoc_req->mode);
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -172,7 +169,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
int i;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
/* Set or remove WEP keys */
if ( assoc_req->wep_keys[0].len
......@@ -216,7 +213,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
mutex_unlock(&adapter->lock);
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -226,14 +223,14 @@ static int assoc_helper_secinfo(wlan_private *priv,
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
memcpy(&adapter->secinfo, &assoc_req->secinfo,
sizeof(struct wlan_802_11_security));
ret = libertas_set_mac_packet_filter(priv);
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -243,7 +240,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
{
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
/* enable/Disable RSN */
ret = libertas_prepare_and_send_command(priv,
......@@ -261,7 +258,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
0, assoc_req);
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -272,7 +269,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
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);
......@@ -282,7 +279,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
adapter->wpa_ie_len = 0;
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
return ret;
}
......@@ -294,21 +291,21 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
return 0;
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
lbs_pr_debug(1, "Deauthenticating due to new SSID in "
lbs_deb_assoc("Deauthenticating due to new SSID in "
" configuration request.\n");
return 1;
}
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
lbs_pr_debug(1, "Deauthenticating due to updated security "
lbs_deb_assoc("Deauthenticating due to updated security "
"info in configuration request.\n");
return 1;
}
}
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
lbs_pr_debug(1, "Deauthenticating due to new BSSID in "
lbs_deb_assoc("Deauthenticating due to new BSSID in "
" configuration request.\n");
return 1;
}
......@@ -353,19 +350,17 @@ void libertas_association_worker(struct work_struct *work)
int ret = 0;
int find_any_ssid = 0;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
mutex_lock(&adapter->lock);
assoc_req = adapter->assoc_req;
adapter->assoc_req = NULL;
mutex_unlock(&adapter->lock);
if (!assoc_req) {
LEAVE();
return;
}
if (!assoc_req)
goto done;
lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n",
lbs_deb_assoc("ASSOC: starting new association request: flags = 0x%lX\n",
assoc_req->flags);
/* If 'any' SSID was specified, find an SSID to associate with */
......@@ -386,7 +381,7 @@ void libertas_association_worker(struct work_struct *work)
ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
assoc_req->mode, &new_mode);
if (ret) {
lbs_pr_debug(1, "Could not find best network\n");
lbs_deb_assoc("Could not find best network\n");
ret = -ENETUNREACH;
goto out;
}
......@@ -406,7 +401,7 @@ void libertas_association_worker(struct work_struct *work)
if (should_deauth_infrastructure(adapter, assoc_req)) {
ret = libertas_send_deauthentication(priv);
if (ret) {
lbs_pr_debug(1, "Deauthentication due to new "
lbs_deb_assoc("Deauthentication due to new "
"configuration request failed: %d\n",
ret);
}
......@@ -415,7 +410,7 @@ void libertas_association_worker(struct work_struct *work)
if (should_stop_adhoc(adapter, assoc_req)) {
ret = libertas_stop_adhoc_network(priv);
if (ret) {
lbs_pr_debug(1, "Teardown of AdHoc network due to "
lbs_deb_assoc("Teardown of AdHoc network due to "
"new configuration request failed: %d\n",
ret);
}
......@@ -427,7 +422,7 @@ void libertas_association_worker(struct work_struct *work)
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
ret = assoc_helper_mode(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
goto out;
}
}
......@@ -436,7 +431,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
|| test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
ret = assoc_helper_wep_keys(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
goto out;
}
}
......@@ -444,7 +439,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
ret = assoc_helper_secinfo(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
goto out;
}
}
......@@ -452,7 +447,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
ret = assoc_helper_wpa_ie(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
goto out;
}
}
......@@ -461,7 +456,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
|| test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
ret = assoc_helper_wpa_keys(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
goto out;
}
}
......@@ -475,19 +470,19 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
ret = assoc_helper_associate(priv, assoc_req);
if (ret) {
lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n",
lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
ret);
success = 0;
}
if (adapter->connect_status != libertas_connected) {
lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, "
lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
"not connected.\n");
success = 0;
}
if (success) {
lbs_pr_debug(1, "ASSOC: association attempt successful. "
lbs_deb_assoc("ASSOC: association attempt successful. "
"Associated to '%s' (" MAC_FMT ")\n",
assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid));
libertas_prepare_and_send_command(priv,
......@@ -505,11 +500,13 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
out:
if (ret) {
lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n",
lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
ret);
}
kfree(assoc_req);
LEAVE();
done:
lbs_deb_leave(LBS_DEB_ASSOC);
}
......
......@@ -44,14 +44,14 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd)
{
struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec;
ENTER();
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->adapter->current_addr, ETH_ALEN);
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -63,7 +63,7 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
u16 action = cmd_action;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_ps_mode);
cmd->size =
......@@ -73,8 +73,8 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
psm->multipledtim = 0;
switch (action) {
case cmd_subcmd_enter_ps:
lbs_pr_debug(1, "PS command:" "SubCode- Enter PS\n");
lbs_pr_debug(1, "locallisteninterval = %d\n",
lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
lbs_deb_cmd("locallisteninterval = %d\n",
adapter->locallisteninterval);
psm->locallisteninterval =
......@@ -86,18 +86,18 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
break;
case cmd_subcmd_exit_ps:
lbs_pr_debug(1, "PS command:" "SubCode- Exit PS\n");
lbs_deb_cmd("PS command:" "SubCode- Exit PS\n");
break;
case cmd_subcmd_sleep_confirmed:
lbs_pr_debug(1, "PS command: SubCode- sleep confirm\n");
lbs_deb_cmd("PS command: SubCode- sleep confirm\n");
break;
default:
break;
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -130,7 +130,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->size =
cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
......@@ -151,7 +151,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
sp->reserved = cpu_to_le16(adapter->sp.sp_reserved);
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -165,7 +165,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
int ret = 0;
struct assoc_request * assoc_req = pdata_buf;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_set_wep);
cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep))
......@@ -175,7 +175,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
int i;
if (!assoc_req) {
lbs_pr_debug(1, "Invalid association request!");
lbs_deb_cmd("Invalid association request!");
ret = -1;
goto done;
}
......@@ -187,7 +187,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
(assoc_req->wep_tx_keyidx &
(u32)cmd_WEP_KEY_INDEX_MASK));
lbs_pr_debug(1, "Tx key Index: %u\n", wep->keyindex);
lbs_deb_cmd("Tx key Index: %u\n", wep->keyindex);
/* Copy key types and material to host command structure */
for (i = 0; i < 4; i++) {
......@@ -207,7 +207,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
case 0:
break;
default:
lbs_pr_debug(1, "Invalid WEP key %d length of %d\n",
lbs_deb_cmd("Invalid WEP key %d length of %d\n",
i, pkey->len);
ret = -1;
goto done;
......@@ -227,7 +227,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
ret = 0;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -290,7 +290,7 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
int ret = 0;
int index = 0;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_key_material);
pkeymaterial->action = cpu_to_le16(cmd_action);
......@@ -323,7 +323,7 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
ret = 0;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -369,9 +369,9 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
u8 ucTemp;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
cmd->command = cpu_to_le16(cmd_802_11_snmp_mib);
cmd->size =
......@@ -477,16 +477,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
break;
}
lbs_pr_debug(1,
lbs_deb_cmd(
"SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
cmd->command, cmd->size, cmd->seqnum, cmd->result);
lbs_pr_debug(1,
lbs_deb_cmd(
"SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n",
pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize,
*(u16 *) pSNMPMIB->value);
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -498,7 +498,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
struct cmd_ds_802_11_radio_control *pradiocontrol =
&cmd->params.radio;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->size =
cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) +
......@@ -527,7 +527,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
else
pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -538,7 +538,7 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->size =
cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) +
......@@ -546,7 +546,7 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power);
prtp->action = cmd_action;
lbs_pr_debug(1, "RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size,
lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size,
cmd->command, prtp->action);
switch (cmd_action) {
......@@ -572,7 +572,8 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
break;
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -610,13 +611,13 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
+ S_DS_GEN);
cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset);
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
rateadapt->action = cmd_action;
rateadapt->enablehwauto = adapter->enablehwauto;
rateadapt->bitmap = adapter->ratebitmap;
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -628,7 +629,7 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
u16 action = cmd_action;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
......@@ -642,13 +643,13 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
if (action == cmd_act_set_tx_fix_rate) {
pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate);
lbs_pr_debug(1, "Setting FW for fixed rate 0x%02X\n",
lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n",
adapter->datarate);
} else if (action == cmd_act_set_tx_auto) {
lbs_pr_debug(1, "Setting FW for AUTO rate\n");
lbs_deb_cmd("Setting FW for AUTO rate\n");
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -719,7 +720,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
{
struct wlan_offset_value *offval;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
offval = (struct wlan_offset_value *)pdata_buf;
......@@ -785,7 +786,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
break;
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -818,7 +819,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
{
struct wlan_ioctl_regrdwr *ea = pdata_buf;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_eeprom_access);
cmd->size =
......@@ -839,7 +840,7 @@ static int wlan_cmd_bt_access(wlan_private * priv,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
lbs_pr_debug(1, "BT CMD(%d)\n", cmd_action);
lbs_deb_cmd("BT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_bt_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access)
......@@ -872,7 +873,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action);
lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_fwt_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access)
......@@ -894,7 +895,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action);
lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_mesh_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access)
......@@ -916,16 +917,16 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
unsigned long flags;
struct cmd_ds_command *cmdptr;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (!cmdnode) {
lbs_pr_debug(1, "QUEUE_CMD: cmdnode is NULL\n");
lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n");
goto done;
}
cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
if (!cmdptr) {
lbs_pr_debug(1, "QUEUE_CMD: cmdptr is NULL\n");
lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n");
goto done;
}
......@@ -948,13 +949,12 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
cmdnode,
((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command);
done:
LEAVE();
return;
lbs_deb_leave(LBS_DEB_CMD);
}
/*
......@@ -974,10 +974,10 @@ static int DownloadcommandToStation(wlan_private * priv,
u16 cmdsize;
u16 command;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (!adapter || !cmdnode) {
lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n",
lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n",
adapter, cmdnode);
if (cmdnode) {
spin_lock_irqsave(&adapter->driver_lock, flags);
......@@ -993,7 +993,7 @@ static int DownloadcommandToStation(wlan_private * priv,
spin_lock_irqsave(&adapter->driver_lock, flags);
if (!cmdptr || !cmdptr->size) {
lbs_pr_debug(1, "DNLD_CMD: cmdptr is Null or cmd size is Zero, "
lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, "
"Not sending\n");
__libertas_cleanup_and_insert_cmd(priv, cmdnode);
spin_unlock_irqrestore(&adapter->driver_lock, flags);
......@@ -1004,7 +1004,7 @@ static int DownloadcommandToStation(wlan_private * priv,
adapter->cur_cmd = cmdnode;
adapter->cur_cmd_retcode = 0;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_pr_debug(1, "DNLD_CMD:: Before download, size of cmd = %d\n",
lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
cmdptr->size);
cmdsize = cmdptr->size;
......@@ -1017,7 +1017,7 @@ static int DownloadcommandToStation(wlan_private * priv,
ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
if (ret != 0) {
lbs_pr_debug(1, "DNLD_CMD: Host to Card failed\n");
lbs_deb_cmd("DNLD_CMD: Host to Card failed\n");
spin_lock_irqsave(&adapter->driver_lock, flags);
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
adapter->cur_cmd = NULL;
......@@ -1026,7 +1026,7 @@ static int DownloadcommandToStation(wlan_private * priv,
goto done;
}
lbs_pr_debug(1, "DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
lbs_deb_cmd("DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize);
/* Setup the timer after transmit command */
......@@ -1039,8 +1039,8 @@ static int DownloadcommandToStation(wlan_private * priv,
ret = 0;
done:
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -1049,17 +1049,17 @@ static int wlan_cmd_mac_control(wlan_private * priv,
{
struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
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);
lbs_pr_debug(1, "wlan_cmd_mac_control(): action=0x%X size=%d\n",
lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n",
mac->action, cmd->size);
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -1093,17 +1093,17 @@ int libertas_set_radio_control(wlan_private * priv)
{
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_radio_control,
cmd_act_set,
cmd_option_waitforrsp, 0, NULL);
lbs_pr_debug(1, "RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
priv->adapter->radioon, priv->adapter->preamble);
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -1111,16 +1111,16 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
{
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "libertas_set_mac_packet_filter value = %x\n",
lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n",
priv->adapter->currentpacketfilter);
/* Send MAC control command to station */
ret = libertas_prepare_and_send_command(priv,
cmd_mac_control, 0, 0, 0, NULL);
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -1146,16 +1146,16 @@ int libertas_prepare_and_send_command(wlan_private * priv,
struct cmd_ds_command *cmdptr;
unsigned long flags;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (!adapter) {
lbs_pr_debug(1, "PREP_CMD: adapter is Null\n");
lbs_deb_cmd("PREP_CMD: adapter is Null\n");
ret = -1;
goto done;
}
if (adapter->surpriseremoved) {
lbs_pr_debug(1, "PREP_CMD: Card is Removed\n");
lbs_deb_cmd("PREP_CMD: Card is Removed\n");
ret = -1;
goto done;
}
......@@ -1163,7 +1163,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
cmdnode = libertas_get_free_cmd_ctrl_node(priv);
if (cmdnode == NULL) {
lbs_pr_debug(1, "PREP_CMD: No free cmdnode\n");
lbs_deb_cmd("PREP_CMD: No free cmdnode\n");
/* Wake up main thread to execute next command */
wake_up_interruptible(&priv->mainthread.waitq);
......@@ -1175,11 +1175,11 @@ int libertas_prepare_and_send_command(wlan_private * priv,
cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
cmdptr, cmd_no);
if (!cmdptr) {
lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
libertas_cleanup_and_insert_cmd(priv, cmdnode);
ret = -1;
goto done;
......@@ -1421,14 +1421,14 @@ int libertas_prepare_and_send_command(wlan_private * priv,
ret = 0;
break;
default:
lbs_pr_debug(1, "PREP_CMD: unknown command- %#x\n", cmd_no);
lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no);
ret = -1;
break;
}
/* return error, since the command preparation failed */
if (ret != 0) {
lbs_pr_debug(1, "PREP_CMD: command preparation failed\n");
lbs_deb_cmd("PREP_CMD: command preparation failed\n");
libertas_cleanup_and_insert_cmd(priv, cmdnode);
ret = -1;
goto done;
......@@ -1441,7 +1441,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
wake_up_interruptible(&priv->mainthread.waitq);
if (wait_option & cmd_option_waitforrsp) {
lbs_pr_debug(1, "PREP_CMD: Wait for CMD response\n");
lbs_deb_cmd("PREP_CMD: Wait for CMD response\n");
might_sleep();
wait_event_interruptible(cmdnode->cmdwait_q,
cmdnode->cmdwaitqwoken);
......@@ -1449,7 +1449,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
spin_lock_irqsave(&adapter->driver_lock, flags);
if (adapter->cur_cmd_retcode) {
lbs_pr_debug(1, "PREP_CMD: command failed with return code=%d\n",
lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n",
adapter->cur_cmd_retcode);
adapter->cur_cmd_retcode = 0;
ret = -1;
......@@ -1457,7 +1457,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
spin_unlock_irqrestore(&adapter->driver_lock, flags);
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -1477,13 +1477,13 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
u8 *ptempvirtualaddr;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
/* Allocate and initialize cmdCtrlNode */
ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) {
lbs_pr_debug(1,
lbs_deb_cmd(
"ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
ret = -1;
goto done;
......@@ -1496,7 +1496,7 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) {
lbs_pr_debug(1,
lbs_deb_cmd(
"ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
ret = -1;
goto done;
......@@ -1514,8 +1514,9 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
}
ret = 0;
done:
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -1532,11 +1533,11 @@ int libertas_free_cmd_buffer(wlan_private * priv)
struct cmd_ctrl_node *tempcmd_array;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
/* need to check if cmd array is allocated or not */
if (adapter->cmd_array == NULL) {
lbs_pr_debug(1, "FREE_CMD_BUF: cmd_array is Null\n");
lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n");
goto done;
}
......@@ -1546,7 +1547,7 @@ int libertas_free_cmd_buffer(wlan_private * priv)
ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
if (tempcmd_array[i].bufvirtualaddr) {
lbs_pr_debug(1, "Free all the array\n");
lbs_deb_cmd("Free all the array\n");
kfree(tempcmd_array[i].bufvirtualaddr);
tempcmd_array[i].bufvirtualaddr = NULL;
}
......@@ -1554,13 +1555,13 @@ int libertas_free_cmd_buffer(wlan_private * priv)
/* Release cmd_ctrl_node */
if (adapter->cmd_array) {
lbs_pr_debug(1, "Free cmd_array\n");
lbs_deb_cmd("Free cmd_array\n");
kfree(adapter->cmd_array);
adapter->cmd_array = NULL;
}
done:
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
......@@ -1586,16 +1587,18 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next;
list_del((struct list_head *)tempnode);
} else {
lbs_pr_debug(1, "GET_CMD_NODE: cmd_ctrl_node is not available\n");
lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n");
tempnode = NULL;
}
spin_unlock_irqrestore(&adapter->driver_lock, flags);
if (tempnode) {
/*
lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n");
lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n",
tempnode);
*/
cleanup_cmdnode(tempnode);
}
......@@ -1638,7 +1641,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
struct cmd_ctrl_node *ptempnode,
u32 cmd_oid, u16 wait_option, void *pdata_buf)
{
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (!ptempnode)
return;
......@@ -1647,7 +1650,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
ptempnode->wait_option = wait_option;
ptempnode->pdata_buf = pdata_buf;
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
}
/**
......@@ -1666,7 +1669,7 @@ int libertas_execute_next_command(wlan_private * priv)
unsigned long flags;
int ret = 0;
lbs_pr_debug(1, "libertas_execute_next_command\n");
lbs_deb_cmd("libertas_execute_next_command\n");
spin_lock_irqsave(&adapter->driver_lock, flags);
......@@ -1685,7 +1688,7 @@ int libertas_execute_next_command(wlan_private * priv)
spin_unlock_irqrestore(&adapter->driver_lock, flags);
if (cmdnode) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: Got next command from cmdpendingq\n");
cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
......@@ -1693,13 +1696,13 @@ int libertas_execute_next_command(wlan_private * priv)
if ((adapter->psstate == PS_STATE_SLEEP)
|| (adapter->psstate == PS_STATE_PRE_SLEEP)
) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n",
cmdptr->command, adapter->psstate);
ret = -1;
goto done;
}
lbs_pr_debug(1, "EXEC_NEXT_CMD: OK to send command "
lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command "
"0x%x in psstate %d\n",
cmdptr->command, adapter->psstate);
} else if (adapter->psstate != PS_STATE_FULL_POWER) {
......@@ -1737,12 +1740,12 @@ int libertas_execute_next_command(wlan_private * priv)
struct cmd_ds_802_11_ps_mode *psm =
&cmdptr->params.psmode;
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: PS cmd- action=0x%x\n",
psm->action);
if (psm->action !=
cpu_to_le16(cmd_subcmd_exit_ps)) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: Ignore Enter PS cmd\n");
list_del((struct list_head *)cmdnode);
libertas_cleanup_and_insert_cmd(priv, cmdnode);
......@@ -1754,7 +1757,7 @@ int libertas_execute_next_command(wlan_private * priv)
if ((adapter->psstate == PS_STATE_SLEEP)
|| (adapter->psstate == PS_STATE_PRE_SLEEP)
) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n");
list_del((struct list_head *)cmdnode);
libertas_cleanup_and_insert_cmd(priv, cmdnode);
......@@ -1764,12 +1767,12 @@ int libertas_execute_next_command(wlan_private * priv)
goto done;
}
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: Sending Exit_PS down...\n");
}
}
list_del((struct list_head *)cmdnode);
lbs_pr_debug(1, "EXEC_NEXT_CMD: Sending 0x%04X command\n",
lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n",
cmdptr->command);
DownloadcommandToStation(priv, cmdnode);
} else {
......@@ -1785,13 +1788,13 @@ int libertas_execute_next_command(wlan_private * priv)
/* check for valid WPA group keys */
if (adapter->wpa_mcast_key.len
|| adapter->wpa_unicast_key.len) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: WPA enabled and GTK_SET"
" go back to PS_SLEEP");
libertas_ps_sleep(priv, 0);
}
} else {
lbs_pr_debug(1,
lbs_deb_cmd(
"EXEC_NEXT_CMD: command PendQ is empty,"
" go back to PS_SLEEP");
libertas_ps_sleep(priv, 0);
......@@ -1809,7 +1812,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
union iwreq_data iwrq;
u8 buf[50];
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
memset(&iwrq, 0, sizeof(union iwreq_data));
memset(buf, 0, sizeof(buf));
......@@ -1819,15 +1822,14 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
/* Send Event to upper layer */
lbs_pr_debug(1, "Event Indication string = %s\n",
lbs_deb_cmd("Event Indication string = %s\n",
(char *)buf);
lbs_pr_debug(1, "Event Indication String length = %d\n", iwrq.data.length);
lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length);
lbs_pr_debug(1, "Sending wireless event IWEVCUSTOM for %s\n", str);
lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str);
wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf);
LEAVE();
return;
lbs_deb_leave(LBS_DEB_CMD);
}
static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
......@@ -1836,9 +1838,9 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
size);
lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size);
......@@ -1848,7 +1850,7 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
spin_lock_irqsave(&adapter->driver_lock, flags);
if (adapter->intcounter || adapter->currenttxskb)
lbs_pr_debug(1, "SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
adapter->intcounter, adapter->currenttxskb);
spin_unlock_irqrestore(&adapter->driver_lock, flags);
......@@ -1860,23 +1862,22 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
if (!adapter->intcounter) {
adapter->psstate = PS_STATE_SLEEP;
} else {
lbs_pr_debug(1, "SEND_SLEEPC_CMD: After sent,IntC=%d\n",
lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n",
adapter->intcounter);
}
spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_pr_debug(1, "SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
lbs_pr_debug(1, "+");
lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
lbs_deb_cmd("+");
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
void libertas_ps_sleep(wlan_private * priv, int wait_option)
{
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
/*
* PS is currently supported only in Infrastructure mode
......@@ -1886,8 +1887,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
cmd_subcmd_enter_ps, wait_option, 0, NULL);
LEAVE();
return;
lbs_deb_leave(LBS_DEB_CMD);
}
/**
......@@ -1901,18 +1901,17 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option)
{
enum WLAN_802_11_POWER_MODE Localpsmode;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
Localpsmode = wlan802_11powermodecam;
lbs_pr_debug(1, "Exit_PS: Localpsmode = %d\n", Localpsmode);
lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", Localpsmode);
libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
cmd_subcmd_exit_ps,
wait_option, 0, &Localpsmode);
LEAVE();
return;
lbs_deb_leave(LBS_DEB_CMD);
}
/**
......@@ -1929,31 +1928,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode)
wlan_adapter *adapter = priv->adapter;
u8 allowed = 1;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (priv->wlan_dev.dnld_sent) {
allowed = 0;
lbs_pr_debug(1, "D");
lbs_deb_cmd("D");
}
spin_lock_irqsave(&adapter->driver_lock, flags);
if (adapter->cur_cmd) {
allowed = 0;
lbs_pr_debug(1, "C");
lbs_deb_cmd("C");
}
if (adapter->intcounter > 0) {
allowed = 0;
lbs_pr_debug(1, "I%d", adapter->intcounter);
lbs_deb_cmd("I%d", adapter->intcounter);
}
spin_unlock_irqrestore(&adapter->driver_lock, flags);
if (allowed) {
lbs_pr_debug(1, "Sending libertas_ps_confirm_sleep\n");
lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n");
sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep,
sizeof(struct PS_CMD_ConfirmSleep));
} else {
lbs_pr_debug(1, "Sleep Confirm has been delayed\n");
lbs_deb_cmd("Sleep Confirm has been delayed\n");
}
LEAVE();
lbs_deb_leave(LBS_DEB_CMD);
}
......@@ -32,7 +32,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
if (adapter->connect_status != libertas_connected)
return;
lbs_pr_debug(1, "Handles disconnect event.\n");
lbs_deb_cmd("Handles disconnect event.\n");
memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
......@@ -62,10 +62,10 @@ void libertas_mac_event_disconnected(wlan_private * priv)
adapter->nextSNRNF = 0;
adapter->numSNRNF = 0;
adapter->rxpd_rate = 0;
lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n",
lbs_deb_cmd("Current SSID=%s, ssid length=%u\n",
adapter->curbssparams.ssid.ssid,
adapter->curbssparams.ssid.ssidlength);
lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n",
lbs_deb_cmd("Previous SSID=%s, ssid length=%u\n",
adapter->previousssid.ssid, adapter->previousssid.ssidlength);
/* reset internal flags */
......@@ -90,7 +90,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
if (adapter->psstate != PS_STATE_FULL_POWER) {
/* make firmware to exit PS mode */
lbs_pr_debug(1, "Disconnected, so exit PS mode.\n");
lbs_deb_cmd("Disconnected, so exit PS mode.\n");
libertas_ps_wakeup(priv, 0);
}
}
......@@ -122,9 +122,10 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
static int wlan_ret_reg_access(wlan_private * priv,
u16 type, struct cmd_ds_command *resp)
{
int ret = 0;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
switch (type) {
case cmd_ret_mac_reg_access:
......@@ -165,12 +166,11 @@ static int wlan_ret_reg_access(wlan_private * priv,
}
default:
LEAVE();
return -1;
ret = -1;
}
LEAVE();
return 0;
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
static int wlan_ret_get_hw_spec(wlan_private * priv,
......@@ -181,19 +181,19 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
adapter->fwreleasenumber = hwspec->fwreleasenumber;
lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
adapter->fwreleasenumber);
lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
hwspec->permanentaddr[0], hwspec->permanentaddr[1],
hwspec->permanentaddr[2], hwspec->permanentaddr[3],
hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
hwspec->hwifversion, hwspec->version);
adapter->regioncode = le16_to_cpu(hwspec->regioncode);
......@@ -232,8 +232,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
goto done;
}
done:
LEAVE();
done:
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -243,9 +243,9 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n"
lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
" extsleepclk=%x\n", sp->error, sp->offset,
sp->stabletime, sp->calcontrol, sp->externalsleepclk);
adapter->sp.sp_error = le16_to_cpu(sp->error);
......@@ -255,7 +255,7 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk);
adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -281,11 +281,11 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
u16 oid = le16_to_cpu(smib->oid);
u16 querytype = le16_to_cpu(smib->querytype);
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
querytype);
lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n",
lbs_deb_cmd("SNMP_RESP: Buf size = %x\n",
le16_to_cpu(smib->bufsize));
if (querytype == cmd_act_get) {
......@@ -294,21 +294,21 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
priv->adapter->fragthsd =
le16_to_cpu(*
((unsigned short *)(smib->value)));
lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n",
lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
priv->adapter->fragthsd);
break;
case rtsthresh_i:
priv->adapter->rtsthsd =
le16_to_cpu(*
((unsigned short *)(smib->value)));
lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n",
lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
priv->adapter->rtsthsd);
break;
case short_retrylim_i:
priv->adapter->txretrycount =
le16_to_cpu(*
((unsigned short *)(smib->value)));
lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n",
lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
priv->adapter->rtsthsd);
break;
default:
......@@ -316,7 +316,7 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
}
}
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -328,7 +328,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
u16 action = le16_to_cpu(pkeymaterial->action);
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
/* Copy the returned key to driver private data */
if (action == cmd_act_get) {
......@@ -371,7 +371,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
}
}
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -381,11 +381,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -395,13 +395,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel);
lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -420,7 +420,7 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
adapter->txantennamode =
le16_to_cpu(pAntenna->antennamode);
lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
action, le16_to_cpu(pAntenna->antennamode));
return 0;
......@@ -433,15 +433,14 @@ static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
&resp->params.rateset;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (rates->action == cmd_act_get) {
adapter->enablehwauto = rates->enablehwauto;
adapter->ratebitmap = rates->bitmap;
}
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -452,7 +451,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
u8 dot11datarate;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
(u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
......@@ -464,7 +463,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
}
adapter->datarate = libertas_index_to_data_rate(dot11datarate);
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -477,18 +476,18 @@ static int wlan_ret_802_11_rf_channel(wlan_private * priv,
u16 action = le16_to_cpu(rfchannel->action);
u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
if (action == cmd_opt_802_11_rf_channel_get
&& adapter->curbssparams.channel != newchannel) {
lbs_pr_debug(1, "channel Switch: %d to %d\n",
lbs_deb_cmd("channel Switch: %d to %d\n",
adapter->curbssparams.channel, newchannel);
/* Update the channel again */
adapter->curbssparams.channel = newchannel;
}
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -515,7 +514,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n",
lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
return 0;
......@@ -528,11 +527,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
struct wlan_ioctl_regrdwr *pbuf;
pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
lbs_pr_debug(1, "eeprom read len=%x\n",
lbs_deb_cmd("eeprom read len=%x\n",
le16_to_cpu(resp->params.rdeeprom.bytecount));
if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
pbuf->NOB = 0;
lbs_pr_debug(1, "eeprom read return length is too big\n");
lbs_deb_cmd("eeprom read return length is too big\n");
return -1;
}
pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
......@@ -553,13 +552,13 @@ static int wlan_ret_get_log(wlan_private * priv,
(struct cmd_ds_802_11_get_log *)&resp->params.glog;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
/* TODO Convert it to Big Endian before copy */
memcpy(&adapter->logmsg, logmessage,
sizeof(struct cmd_ds_802_11_get_log));
LEAVE();
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
......@@ -663,7 +662,7 @@ static inline int handle_cmd_response(u16 respcmd,
break;
case cmd_ret_802_11_key_material:
lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n");
lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
ret = wlan_ret_802_11_key_material(priv, resp);
break;
......@@ -739,7 +738,7 @@ static inline int handle_cmd_response(u16 respcmd,
priv->adapter->txrate = resp->params.txrate.txrate;
break;
default:
lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n",
lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
resp->command);
break;
}
......@@ -755,9 +754,9 @@ int libertas_process_rx_command(wlan_private * priv)
ulong flags;
u16 result;
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies);
lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
/* Now we got response from FW, cancel the command timer */
del_timer(&adapter->command_timer);
......@@ -766,7 +765,7 @@ int libertas_process_rx_command(wlan_private * priv)
spin_lock_irqsave(&adapter->driver_lock, flags);
if (!adapter->cur_cmd) {
lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
ret = -1;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
goto done;
......@@ -780,11 +779,11 @@ int libertas_process_rx_command(wlan_private * priv)
result = le16_to_cpu(resp->result);
lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd,
lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
result, priv->wlan_dev.upld_len);
if (!(respcmd & 0x8000)) {
lbs_pr_debug(1, "Invalid response to command!");
lbs_deb_cmd("Invalid response to command!");
adapter->cur_cmd_retcode = -1;
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
adapter->nr_cmd_pending--;
......@@ -801,13 +800,13 @@ int libertas_process_rx_command(wlan_private * priv)
struct cmd_ds_802_11_ps_mode *psmode;
psmode = &resp->params.psmode;
lbs_pr_debug(1,
lbs_deb_cmd(
"CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
resp->result, psmode->action);
psmode->action = cpu_to_le16(psmode->action);
if (result) {
lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
resp->result);
if (adapter->mode == IW_MODE_ADHOC) {
/*
......@@ -823,13 +822,13 @@ int libertas_process_rx_command(wlan_private * priv)
adapter->needtowakeup = 0;
adapter->psstate = PS_STATE_AWAKE;
lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n");
lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
if (adapter->connect_status != libertas_connected) {
/*
* When Deauth Event received before Enter_PS command
* response, We need to wake up the firmware.
*/
lbs_pr_debug(1,
lbs_deb_cmd(
"Disconnected, Going to invoke libertas_ps_wakeup\n");
mutex_unlock(&adapter->lock);
......@@ -841,9 +840,9 @@ int libertas_process_rx_command(wlan_private * priv)
} else if (psmode->action == cmd_subcmd_exit_ps) {
adapter->needtowakeup = 0;
adapter->psstate = PS_STATE_FULL_POWER;
lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n");
lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
} else {
lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n",
lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n",
psmode->action);
}
......@@ -865,7 +864,7 @@ int libertas_process_rx_command(wlan_private * priv)
/* If the command is not successful, cleanup and return failure */
if ((result != 0 || !(respcmd & 0x8000))) {
lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n",
lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
resp->command, resp->result);
/*
* Handling errors here
......@@ -873,7 +872,7 @@ int libertas_process_rx_command(wlan_private * priv)
switch (respcmd) {
case cmd_ret_hw_spec_info:
case cmd_ret_802_11_reset:
lbs_pr_debug(1, "CMD_RESP: Reset command failed\n");
lbs_deb_cmd("CMD_RESP: Reset command failed\n");
break;
}
......@@ -903,7 +902,7 @@ int libertas_process_rx_command(wlan_private * priv)
done:
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -917,37 +916,37 @@ int libertas_process_event(wlan_private * priv)
eventcause = adapter->eventcause;
spin_unlock_irq(&adapter->driver_lock);
ENTER();
lbs_deb_enter(LBS_DEB_CMD);
lbs_pr_debug(1, "EVENT Cause %x\n", eventcause);
lbs_deb_cmd("EVENT Cause %x\n", eventcause);
switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
case MACREG_INT_CODE_LINK_SENSED:
lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n");
lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
break;
case MACREG_INT_CODE_DEAUTHENTICATED:
lbs_pr_debug(1, "EVENT: Deauthenticated\n");
lbs_deb_cmd("EVENT: Deauthenticated\n");
libertas_mac_event_disconnected(priv);
break;
case MACREG_INT_CODE_DISASSOCIATED:
lbs_pr_debug(1, "EVENT: Disassociated\n");
lbs_deb_cmd("EVENT: Disassociated\n");
libertas_mac_event_disconnected(priv);
break;
case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
lbs_pr_debug(1, "EVENT: Link lost\n");
lbs_deb_cmd("EVENT: Link lost\n");
libertas_mac_event_disconnected(priv);
break;
case MACREG_INT_CODE_PS_SLEEP:
lbs_pr_debug(1, "EVENT: SLEEP\n");
lbs_pr_debug(1, "_");
lbs_deb_cmd("EVENT: SLEEP\n");
lbs_deb_cmd("_");
/* handle unexpected PS SLEEP event */
if (adapter->psstate == PS_STATE_FULL_POWER) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EVENT: In FULL POWER mode - ignore PS SLEEP\n");
break;
}
......@@ -958,12 +957,12 @@ int libertas_process_event(wlan_private * priv)
break;
case MACREG_INT_CODE_PS_AWAKE:
lbs_pr_debug(1, "EVENT: AWAKE \n");
lbs_pr_debug(1, "|");
lbs_deb_cmd("EVENT: AWAKE \n");
lbs_deb_cmd("|");
/* handle unexpected PS AWAKE event */
if (adapter->psstate == PS_STATE_FULL_POWER) {
lbs_pr_debug(1,
lbs_deb_cmd(
"EVENT: In FULL POWER mode - ignore PS AWAKE\n");
break;
}
......@@ -977,18 +976,18 @@ int libertas_process_event(wlan_private * priv)
* adapter->needtowakeup will be set to FALSE
* in libertas_ps_wakeup()
*/
lbs_pr_debug(1, "Waking up...\n");
lbs_deb_cmd("Waking up...\n");
libertas_ps_wakeup(priv, 0);
}
break;
case MACREG_INT_CODE_MIC_ERR_UNICAST:
lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n");
lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
break;
case MACREG_INT_CODE_MIC_ERR_MULTICAST:
lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n");
lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
break;
case MACREG_INT_CODE_MIB_CHANGED:
......@@ -996,7 +995,7 @@ int libertas_process_event(wlan_private * priv)
break;
case MACREG_INT_CODE_ADHOC_BCN_LOST:
lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n");
lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
break;
case MACREG_INT_CODE_RSSI_LOW:
......@@ -1024,6 +1023,7 @@ int libertas_process_event(wlan_private * priv)
spin_lock_irq(&adapter->driver_lock);
adapter->eventcause = 0;
spin_unlock_irq(&adapter->driver_lock);
LEAVE();
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}
......@@ -402,11 +402,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
u16 wait_option = cmd_option_waitforrsp;
if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n");
lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
return -ENOMEM;
}
if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
lbs_pr_debug(1, "failed to allocate response buffer!\n");
lbs_deb_debugfs("failed to allocate response buffer!\n");
return -ENOMEM;
}
libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
......@@ -1864,7 +1864,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
return 0;
if (copy_from_user(pdata, buf, cnt)) {
lbs_pr_debug(1, "Copy from user failed\n");
lbs_deb_debugfs("Copy from user failed\n");
kfree(pdata);
return 0;
}
......
......@@ -7,14 +7,77 @@
#include <linux/spinlock.h>
extern unsigned int libertas_debug;
#ifdef CONFIG_LIBERTAS_DEBUG
#define DEBUG
#define PROC_DEBUG
#endif
#define DRV_NAME "usb8xxx"
#define DRV_NAME "usb8xxx"
#define LBS_DEB_ENTER (1<<0)
#define LBS_DEB_LEAVE (1<<1)
#define LBS_DEB_MAIN (1<<2)
#define LBS_DEB_NET (1<<3)
#define LBS_DEB_MESH (1<<4)
#define LBS_DEB_WEXT (1<<5)
#define LBS_DEB_IOCTL (1<<6)
#define LBS_DEB_SCAN (1<<7)
#define LBS_DEB_ASSOC (1<<8)
#define LBS_DEB_JOIN (1<<9)
#define LBS_DEB_11D (1<<10)
#define LBS_DEB_DEBUGFS (1<<11)
#define LBS_DEB_ETHTOOL (1<<12)
#define LBS_DEB_HOST (1<<13)
#define LBS_DEB_CMD (1<<14)
#define LBS_DEB_RX (1<<15)
#define LBS_DEB_TX (1<<16)
#define LBS_DEB_FW (1<<17)
#define LBS_DEB_USB (1<<18)
#define LBS_DEB_CS (1<<19)
#define LBS_DEB_THREAD (1<<20)
#define LBS_DEB_HEX (1<<21)
extern unsigned int libertas_debug_flags;
#ifdef DEBUG
#define LBS_DEB_LL(grp, fmt, args...) \
do { if ((libertas_debug_flags & (grp)) == (grp)) \
printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
in_interrupt() ? " (INT)" : "", ## args); } while (0)
#else
#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
#endif
#define lbs_deb_enter(grp) \
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s() %d enter\n", __FUNCTION__, __LINE__);
#define lbs_deb_enter_args(grp, fmt, args...) \
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
#define lbs_deb_leave(grp) \
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
#define lbs_deb_leave_args(grp, fmt, args...) \
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
__FUNCTION__, __LINE__, ##args);
#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
#define lbs_pr_info(format, args...) \
printk(KERN_INFO DRV_NAME": " format, ## args)
......@@ -24,37 +87,25 @@ extern unsigned int libertas_debug;
printk(KERN_ALERT DRV_NAME": " format, ## args)
#ifdef DEBUG
#define lbs_pr_debug(level, format, args...) \
do { if (libertas_debug >= level) \
printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
#define lbs_dev_dbg(level, device, format, args...) \
lbs_pr_debug(level, "%s: " format, \
(device)->bus_id , ## args)
static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
{
int i = 0;
if (!libertas_debug)
if (!(libertas_debug_flags & LBS_DEB_HEX))
return;
printk(KERN_DEBUG "%s: ", prompt);
for (i = 1; i <= len; i++) {
printk(KERN_DEBUG "%02x ", (u8) * buf);
printk("%02x ", (u8) * buf);
buf++;
}
printk("\n");
}
#else
#define lbs_pr_debug(level, format, args...) do {} while (0)
#define lbs_dev_dbg(level, device, format, args...) do {} while (0)
#define lbs_dbg_hex(x,y,z) do {} while (0)
#endif
#define ENTER() lbs_pr_debug(1, "Enter: %s:%i\n", \
__FUNCTION__, __LINE__)
#define LEAVE() lbs_pr_debug(1, "Leave: %s:%i\n", \
__FUNCTION__, __LINE__)
/** Buffer Constants */
......
......@@ -69,7 +69,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
/* +14 is for action, offset, and NOB in
* response */
lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n",
lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
regctrl.action, regctrl.offset, regctrl.NOB);
ret = libertas_prepare_and_send_command(priv,
......@@ -81,8 +81,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
if (ret) {
if (adapter->prdeeprom)
kfree(adapter->prdeeprom);
LEAVE();
return ret;
goto done;
}
mdelay(10);
......@@ -101,7 +100,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
kfree(adapter->prdeeprom);
// mutex_unlock(&priv->mutex);
return 0;
ret = 0;
done:
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
return ret;
}
static void libertas_ethtool_get_stats(struct net_device * dev,
......@@ -109,7 +112,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
{
wlan_private *priv = dev->priv;
ENTER();
lbs_deb_enter(LBS_DEB_ETHTOOL);
stats->cmd = ETHTOOL_GSTATS;
BUG_ON(stats->n_stats != MESH_STATS_NUM);
......@@ -122,7 +125,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
data[5] = priv->mstats.fwd_bcast_cnt;
data[6] = priv->mstats.drop_blind;
LEAVE();
lbs_deb_enter(LBS_DEB_ETHTOOL);
}
static int libertas_ethtool_get_stats_count(struct net_device * dev)
......@@ -131,15 +134,16 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
wlan_private *priv = dev->priv;
struct cmd_ds_mesh_access mesh_access;
ENTER();
lbs_deb_enter(LBS_DEB_ETHTOOL);
/* Get Mesh Statistics */
ret = libertas_prepare_and_send_command(priv,
cmd_mesh_access, cmd_act_mesh_get_stats,
cmd_option_waitforrsp, 0, &mesh_access);
if (ret) {
LEAVE();
return 0;
ret = 0;
goto done;
}
priv->mstats.fwd_drop_rbt = mesh_access.data[0];
......@@ -150,8 +154,11 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
priv->mstats.drop_blind = mesh_access.data[6];
LEAVE();
return MESH_STATS_NUM;
ret = MESH_STATS_NUM;
done:
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
return ret;
}
static void libertas_ethtool_get_strings (struct net_device * dev,
......@@ -160,7 +167,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
{
int i;
ENTER();
lbs_deb_enter(LBS_DEB_ETHTOOL);
switch (stringset) {
case ETH_SS_STATS:
for (i=0; i < MESH_STATS_NUM; i++) {
......@@ -170,7 +178,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
}
break;
}
LEAVE();
lbs_deb_enter(LBS_DEB_ETHTOOL);
}
struct ethtool_ops libertas_ethtool_ops = {
......
......@@ -20,8 +20,8 @@
char *libertas_fw_name = NULL;
module_param_named(fw_name, libertas_fw_name, charp, 0644);
unsigned int libertas_debug = 0;
module_param(libertas_debug, int, 0);
unsigned int libertas_debug_flags = 0;
module_param_named(debug, libertas_debug_flags, int, 0);
/**
* @brief This function checks the validity of Boot2/FW image.
......@@ -61,9 +61,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
} while (!exit);
if (ret)
lbs_pr_err("bin file format check FAIL...\n");
lbs_pr_err("firmware file format check FAIL\n");
else
lbs_pr_debug(1, "bin file format check PASS...\n");
lbs_deb_fw("firmware file format check PASS\n");
return ret;
}
......@@ -81,13 +81,13 @@ static int wlan_setup_station_hw(wlan_private * priv)
int ret = -1;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_FW);
if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
priv->hotplug_device)) < 0) {
lbs_pr_err("request_firmware() failed, error code = %#x\n",
lbs_pr_err("request_firmware() failed with %#x\n",
ret);
lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name);
lbs_pr_err("firmware %s not found\n", libertas_fw_name);
goto done;
}
......@@ -101,7 +101,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
release_firmware(priv->firmware);
if (ret) {
lbs_pr_debug(1, "Bootloader in invalid state!\n");
lbs_deb_fw("bootloader in invalid state\n");
ret = -1;
goto done;
}
......@@ -133,9 +133,8 @@ static int wlan_setup_station_hw(wlan_private * priv)
ret = 0;
done:
LEAVE();
return (ret);
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret;
}
static int wlan_allocate_adapter(wlan_private * priv)
......@@ -264,7 +263,7 @@ int libertas_init_fw(wlan_private * priv)
int ret = -1;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_FW);
/* Allocate adapter structure */
if ((ret = wlan_allocate_adapter(priv)) != 0)
......@@ -288,7 +287,7 @@ int libertas_init_fw(wlan_private * priv)
ret = 0;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret;
}
......@@ -297,25 +296,24 @@ void libertas_free_adapter(wlan_private * priv)
wlan_adapter *adapter = priv->adapter;
if (!adapter) {
lbs_pr_debug(1, "Why double free adapter?:)\n");
lbs_deb_fw("why double free adapter?\n");
return;
}
lbs_pr_debug(1, "Free command buffer\n");
lbs_deb_fw("free command buffer\n");
libertas_free_cmd_buffer(priv);
lbs_pr_debug(1, "Free commandTimer\n");
lbs_deb_fw("free command_timer\n");
del_timer(&adapter->command_timer);
lbs_pr_debug(1, "Free scantable\n");
lbs_deb_fw("free scantable\n");
if (adapter->scantable) {
kfree(adapter->scantable);
adapter->scantable = NULL;
}
lbs_pr_debug(1, "Free adapter\n");
/* Free the adapter object itself */
lbs_deb_fw("free adapter\n");
kfree(adapter);
priv->adapter = NULL;
}
......@@ -334,17 +332,17 @@ static void command_timer_fn(unsigned long data)
ptempnode = adapter->cur_cmd;
if (ptempnode == NULL) {
lbs_pr_debug(1, "PTempnode Empty\n");
lbs_deb_fw("ptempnode empty\n");
return;
}
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
if (!cmd) {
lbs_pr_debug(1, "cmd is NULL\n");
lbs_deb_fw("cmd is NULL\n");
return;
}
lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command);
lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
if (!adapter->fw_ready)
return;
......@@ -353,7 +351,7 @@ static void command_timer_fn(unsigned long data)
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_pr_debug(1, "Re-sending same command as it timeout...!\n");
lbs_deb_fw("re-sending same command because of timeout\n");
libertas_queue_cmd(adapter, ptempnode, 0);
wake_up_interruptible(&priv->mainthread.waitq);
......
......@@ -46,9 +46,11 @@ static void if_usb_write_bulk_callback(struct urb *urb)
/* print the failure status number for debug */
lbs_pr_info("URB in failure status\n");
} else {
lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n");
lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n",
/*
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);
*/
priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
/* Wake main thread if commands are pending */
if (!adapter->cur_cmd)
......@@ -67,7 +69,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
*/
void if_usb_free(struct usb_card_rec *cardp)
{
ENTER();
lbs_deb_enter(LBS_DEB_USB);
/* Unlink tx & rx urb */
usb_kill_urb(cardp->tx_urb);
......@@ -82,8 +84,7 @@ void if_usb_free(struct usb_card_rec *cardp)
kfree(cardp->bulk_out_buffer);
cardp->bulk_out_buffer = NULL;
LEAVE();
return;
lbs_deb_leave(LBS_DEB_USB);
}
/**
......@@ -113,7 +114,7 @@ static int if_usb_probe(struct usb_interface *intf,
usb_cardp->udev = udev;
iface_desc = intf->cur_altsetting;
lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
udev->descriptor.bcdUSB,
udev->descriptor.bDeviceClass,
......@@ -126,12 +127,12 @@ static int if_usb_probe(struct usb_interface *intf,
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) {
/* we found a bulk in endpoint */
lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n",
lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
endpoint->wMaxPacketSize);
if (!
(usb_cardp->rx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
lbs_dev_dbg(1, &udev->dev,
lbs_deb_usbd(&udev->dev,
"Rx URB allocation failed\n");
goto dealloc;
}
......@@ -142,7 +143,7 @@ static int if_usb_probe(struct usb_interface *intf,
usb_cardp->bulk_in_endpointAddr =
(endpoint->
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n",
lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n",
endpoint->bEndpointAddress);
}
......@@ -155,26 +156,26 @@ static int if_usb_probe(struct usb_interface *intf,
if (!
(usb_cardp->tx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
lbs_dev_dbg(1,&udev->dev,
lbs_deb_usbd(&udev->dev,
"Tx URB allocation failed\n");
goto dealloc;
}
usb_cardp->bulk_out_size =
endpoint->wMaxPacketSize;
lbs_dev_dbg(1, &udev->dev,
lbs_deb_usbd(&udev->dev,
"Bulk out size is %d\n",
endpoint->wMaxPacketSize);
usb_cardp->bulk_out_endpointAddr =
endpoint->bEndpointAddress;
lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n",
lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
endpoint->bEndpointAddress);
usb_cardp->bulk_out_buffer =
kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
GFP_KERNEL);
if (!usb_cardp->bulk_out_buffer) {
lbs_dev_dbg(1, &udev->dev,
lbs_deb_usbd(&udev->dev,
"Could not allocate buffer\n");
goto dealloc;
}
......@@ -226,7 +227,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
adapter->surpriseremoved = 1;
/* card is removed and we can call wlan_remove_card */
lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n");
lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
wlan_remove_card(cardp);
/* Unlink and free urb */
......@@ -262,8 +263,10 @@ static int if_prog_firmware(wlan_private * priv)
cardp->fwseqnum = cardp->lastseqnum - 1;
}
lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n",
/*
lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n",
cardp->totalbytes);
*/
memcpy(fwheader, &firmware[cardp->totalbytes],
sizeof(struct fwheader));
......@@ -271,12 +274,14 @@ static int if_prog_firmware(wlan_private * priv)
cardp->fwlastblksent = cardp->totalbytes;
cardp->totalbytes += sizeof(struct fwheader);
lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n");
/* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
memcpy(fwdata->data, &firmware[cardp->totalbytes],
fwdata->fwheader.datalength);
lbs_dev_dbg(2, &cardp->udev->dev,
/*
lbs_deb_usbd(&cardp->udev->dev,
"Data length = %d\n", fwdata->fwheader.datalength);
*/
cardp->fwseqnum = cardp->fwseqnum + 1;
......@@ -285,26 +290,32 @@ static int if_prog_firmware(wlan_private * priv)
cardp->totalbytes += fwdata->fwheader.datalength;
if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) {
lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n");
lbs_dev_dbg(2, &cardp->udev->dev,
/*
lbs_deb_usbd(&cardp->udev->dev, "There is 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(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
} else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) {
lbs_dev_dbg(2, &cardp->udev->dev,
/*
lbs_deb_usbd(&cardp->udev->dev,
"Host has finished FW downloading\n");
lbs_dev_dbg(2, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Donwloading FW JUMP BLOCK\n");
*/
memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
cardp->fwfinalblk = 1;
}
lbs_dev_dbg(2, &cardp->udev->dev,
/*
lbs_deb_usbd(&cardp->udev->dev,
"The firmware download is done size is %d\n",
cardp->totalbytes);
*/
kfree(fwdata);
......@@ -340,7 +351,7 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
/* check if device is removed */
if (priv->adapter->surpriseremoved) {
lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n");
lbs_deb_usbd(&cardp->udev->dev, "Device removed\n");
goto tx_ret;
}
......@@ -353,10 +364,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
/* transfer failed */
lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n");
lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n");
ret = -1;
} else {
lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n");
/* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */
ret = 0;
}
......@@ -390,13 +401,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb);
/* 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_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n");
lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
ret = -1;
} else {
lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n");
/* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
ret = 0;
}
......@@ -424,7 +435,7 @@ static void if_usb_receive_fwload(struct urb *urb)
struct bootcmdrespStr bootcmdresp;
if (urb->status) {
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"URB status is failed during fw load\n");
kfree_skb(skb);
return;
......@@ -437,7 +448,7 @@ static void if_usb_receive_fwload(struct urb *urb)
kfree_skb(skb);
if_usb_submit_rx_urb_fwload(priv);
cardp->bootcmdresp = 1;
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Received valid boot command response\n");
return;
}
......@@ -455,7 +466,7 @@ static void if_usb_receive_fwload(struct urb *urb)
bootcmdresp.u8result);
} else {
cardp->bootcmdresp = 1;
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Received valid boot command response\n");
}
kfree_skb(skb);
......@@ -465,7 +476,7 @@ static void if_usb_receive_fwload(struct urb *urb)
syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
if (!syncfwheader) {
lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n");
lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n");
kfree_skb(skb);
return;
}
......@@ -474,14 +485,16 @@ static void if_usb_receive_fwload(struct urb *urb)
sizeof(struct fwsyncheader));
if (!syncfwheader->cmd) {
lbs_dev_dbg(2, &cardp->udev->dev,
/*
lbs_deb_usbd(&cardp->udev->dev,
"FW received Blk with correct CRC\n");
lbs_dev_dbg(2, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"FW received Blk seqnum = %d\n",
syncfwheader->seqnum);
*/
cardp->CRC_OK = 1;
} else {
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"FW received Blk with CRC error\n");
cardp->CRC_OK = 0;
}
......@@ -511,7 +524,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
{
if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Packet length is Invalid\n");
kfree_skb(skb);
return;
......@@ -531,7 +544,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
{
u8 *cmdbuf;
if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"The receive buffer is too large\n");
kfree_skb(skb);
return;
......@@ -558,7 +571,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
libertas_interrupt(priv->wlan_dev.netdev);
spin_unlock(&priv->adapter->driver_lock);
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Wake up main thread to handle cmd response\n");
return;
......@@ -582,11 +595,11 @@ static void if_usb_receive(struct urb *urb)
u8 *recvbuff = NULL;
u32 recvtype;
ENTER();
lbs_deb_enter(LBS_DEB_USB);
if (recvlength) {
if (urb->status) {
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"URB status is failed\n");
kfree_skb(skb);
goto setup_for_next;
......@@ -594,12 +607,12 @@ static void if_usb_receive(struct urb *urb)
recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
memcpy(&recvtype, recvbuff, sizeof(u32));
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Recv length = 0x%x\n", recvlength);
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Receive type = 0x%X\n", recvtype);
recvtype = le32_to_cpu(recvtype);
lbs_dev_dbg(1, &cardp->udev->dev,
lbs_deb_usbd(&cardp->udev->dev,
"Receive type after = 0x%X\n", recvtype);
} else if (urb->status)
goto rx_exit;
......@@ -618,7 +631,7 @@ static void if_usb_receive(struct urb *urb)
/* Event cause handling */
spin_lock(&priv->adapter->driver_lock);
cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN);
lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n",
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);
......@@ -639,8 +652,7 @@ static void if_usb_receive(struct urb *urb)
setup_for_next:
if_usb_submit_rx_urb(priv);
rx_exit:
LEAVE();
return;
lbs_deb_leave(LBS_DEB_USB);
}
/**
......@@ -657,8 +669,8 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
u32 tmp;
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type);
lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb);
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) {
tmp = cpu_to_le32(CMD_TYPE_REQUEST);
......@@ -689,7 +701,7 @@ int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg)
*ireg = cardp->usb_int_cause;
cardp->usb_int_cause = 0;
lbs_dev_dbg(1, &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;
}
......@@ -736,9 +748,9 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
*/
int libertas_sbi_register_dev(wlan_private * priv)
{
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
ENTER();
lbs_deb_enter(LBS_DEB_USB);
cardp->priv = priv;
cardp->eth_dev = priv->wlan_dev.netdev;
......@@ -746,10 +758,10 @@ int libertas_sbi_register_dev(wlan_private * priv)
SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n",
lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
cardp->udev);
LEAVE();
lbs_deb_leave(LBS_DEB_USB);
return 0;
}
......@@ -760,16 +772,17 @@ int libertas_sbi_prog_firmware(wlan_private * priv)
struct usb_card_rec *cardp = priv->wlan_dev.card;
int i = 0;
static int reset_count = 10;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_USB);
cardp->rinfo.priv = priv;
restart:
if (if_usb_submit_rx_urb_fwload(priv) < 0) {
lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n");
LEAVE();
return -1;
lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
ret = -1;
goto done;
}
cardp->bootcmdresp = 0;
......@@ -807,7 +820,7 @@ int libertas_sbi_prog_firmware(wlan_private * priv)
if_prog_firmware(priv);
do {
lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n");
lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n");
i++;
msleep_interruptible(100);
if (priv->adapter->surpriseremoved || i >= 20)
......@@ -822,8 +835,8 @@ int libertas_sbi_prog_firmware(wlan_private * priv)
}
lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
LEAVE();
return -1;
ret = -1;
goto done;
}
if_usb_submit_rx_urb(priv);
......@@ -833,8 +846,9 @@ int libertas_sbi_prog_firmware(wlan_private * priv)
priv->adapter->fw_ready = 1;
LEAVE();
return 0;
done:
lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
return ret;
}
/**
......@@ -854,7 +868,7 @@ 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;
ENTER();
lbs_deb_enter(LBS_DEB_USB);
if (priv->adapter->psstate != PS_STATE_FULL_POWER)
return -1;
......@@ -867,7 +881,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
cardp->rx_urb_recall = 1;
LEAVE();
lbs_deb_leave(LBS_DEB_USB);
return 0;
}
......@@ -875,7 +889,7 @@ static int if_usb_resume(struct usb_interface *intf)
{
struct usb_card_rec *cardp = usb_get_intfdata(intf);
ENTER();
lbs_deb_enter(LBS_DEB_USB);
cardp->rx_urb_recall = 0;
......@@ -883,7 +897,7 @@ static int if_usb_resume(struct usb_interface *intf)
netif_device_attach(cardp->eth_dev);
LEAVE();
lbs_deb_leave(LBS_DEB_USB);
return 0;
}
#else
......
......@@ -30,6 +30,7 @@
static int wlan_set_region(wlan_private * priv, u16 region_code)
{
int i;
int ret = 0;
for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
// use the region code to search for the index
......@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
// if it's unidentified region code
if (i >= MRVDRV_MAX_REGION_CODE) {
lbs_pr_debug(1, "region Code not identified\n");
LEAVE();
return -1;
lbs_deb_ioctl("region Code not identified\n");
ret = -1;
goto done;
}
if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
LEAVE();
return -EINVAL;
ret = -EINVAL;
}
return 0;
done:
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
return ret;
}
static inline int hex2int(char c)
......@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
char ethaddrs_str[18];
char *pos;
u8 ethaddr[ETH_ALEN];
int ret;
lbs_deb_enter(LBS_DEB_IOCTL);
ENTER();
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
sizeof(ethaddrs_str)))
return -EFAULT;
......@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
return -EINVAL;
}
lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str);
LEAVE();
return (libertas_prepare_and_send_command(priv, cmd_bt_access,
lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
cmd_act_bt_access_add,
cmd_option_waitforrsp, 0, ethaddr));
cmd_option_waitforrsp, 0, ethaddr);
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
return ret;
}
/**
......@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
u8 ethaddr[ETH_ALEN];
char *pos;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
sizeof(ethaddrs_str)))
return -EFAULT;
......@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
return -EINVAL;
}
lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str);
lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
return (libertas_prepare_and_send_command(priv,
cmd_bt_access,
cmd_act_bt_access_del,
cmd_option_waitforrsp, 0, ethaddr));
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
*/
static int wlan_bt_reset_ioctl(wlan_private * priv)
{
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
lbs_pr_alert( "BT: resetting\n");
......@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv)
cmd_act_bt_access_reset,
cmd_option_waitforrsp, 0, NULL));
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -216,10 +223,10 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
char *pbuf = outstr;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
lbs_pr_debug(1, "Copy from user failed\n");
lbs_deb_ioctl("Copy from user failed\n");
return -1;
}
param.id = simple_strtoul(outstr, NULL, 10);
......@@ -246,11 +253,11 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
wrq->u.data.length = strlen(outstr);
if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
wrq->u.data.length)) {
lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n");
lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
return -EFAULT;
}
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -278,8 +285,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
char in_str[128];
static struct cmd_ds_fwt_access fwt_access;
char *ptr;
int ret;
lbs_deb_enter(LBS_DEB_IOCTL);
ENTER();
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -348,20 +357,22 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
char ethaddr1_str[18], ethaddr2_str[18];
eth_addr2str(fwt_access.da, ethaddr1_str);
eth_addr2str(fwt_access.ra, ethaddr2_str);
lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
fwt_access.dir, ethaddr2_str);
lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
fwt_access.sleepmode, fwt_access.snr);
}
#endif
LEAVE();
return (libertas_prepare_and_send_command(priv, cmd_fwt_access,
cmd_act_fwt_access_add,
cmd_option_waitforrsp, 0,
(void *)&fwt_access));
ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
cmd_act_fwt_access_add,
cmd_option_waitforrsp, 0,
(void *)&fwt_access);
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
return ret;
}
/**
......@@ -376,8 +387,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
char in_str[64];
static struct cmd_ds_fwt_access fwt_access;
char *ptr;
int ret;
lbs_deb_enter(LBS_DEB_IOCTL);
ENTER();
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -399,20 +412,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
#ifdef DEBUG
{
char ethaddr1_str[18], ethaddr2_str[18];
lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str);
lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
eth_addr2str(fwt_access.da, ethaddr1_str);
eth_addr2str(fwt_access.ra, ethaddr2_str);
lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
ethaddr2_str, fwt_access.dir);
}
#endif
LEAVE();
return (libertas_prepare_and_send_command(priv,
cmd_fwt_access,
cmd_act_fwt_access_del,
cmd_option_waitforrsp, 0,
(void *)&fwt_access));
ret = libertas_prepare_and_send_command(priv,
cmd_fwt_access,
cmd_act_fwt_access_del,
cmd_option_waitforrsp, 0,
(void *)&fwt_access);
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
return ret;
}
......@@ -453,7 +467,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
static char out_str[128];
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -465,9 +480,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
#ifdef DEBUG
{
char ethaddr1_str[18];
lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str);
lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
eth_addr2str(fwt_access.da, ethaddr1_str);
lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
}
#endif
......@@ -485,11 +500,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
wrq->u.data.length = strlen(out_str);
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
wrq->u.data.length)) {
lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n");
lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
return -EFAULT;
}
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -500,7 +515,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
*/
static int wlan_fwt_reset_ioctl(wlan_private * priv)
{
lbs_pr_debug(1, "FWT: resetting\n");
lbs_deb_ioctl("FWT: resetting\n");
return (libertas_prepare_and_send_command(priv,
cmd_fwt_access,
......@@ -524,7 +539,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
char *pbuf = out_str;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -532,8 +548,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
#ifdef DEBUG
{
lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str);
lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
}
#endif
......@@ -549,11 +565,11 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
wrq->u.data.length = strlen(out_str);
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
wrq->u.data.length)) {
lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n");
lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
return -EFAULT;
}
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -573,7 +589,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
char *pbuf = out_str;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -581,8 +598,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
#ifdef DEBUG
{
lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str);
lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
}
#endif
......@@ -608,11 +625,11 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
wrq->u.data.length = strlen(out_str);
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
wrq->u.data.length)) {
lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n");
lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
return -EFAULT;
}
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -632,7 +649,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
char *pbuf = out_str;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
return -EFAULT;
......@@ -641,8 +659,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
#ifdef DEBUG
{
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str);
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
}
#endif
......@@ -663,11 +681,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
wrq->u.data.length = strlen(out_str);
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
wrq->u.data.length)) {
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n");
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
return -EFAULT;
}
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -684,9 +702,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
static struct cmd_ds_fwt_access fwt_access;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
lbs_pr_debug(1, "FWT: cleaning up\n");
lbs_deb_ioctl("FWT: cleaning up\n");
memset(&fwt_access, 0, sizeof(fwt_access));
......@@ -700,7 +718,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
else
return -EFAULT;
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -716,9 +734,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
static struct cmd_ds_fwt_access fwt_access;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
lbs_pr_debug(1, "FWT: getting time\n");
lbs_deb_ioctl("FWT: getting time\n");
memset(&fwt_access, 0, sizeof(fwt_access));
......@@ -732,7 +750,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
else
return -EFAULT;
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -748,7 +766,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
struct cmd_ds_mesh_access mesh_access;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
memset(&mesh_access, 0, sizeof(mesh_access));
......@@ -762,7 +780,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
else
return -EFAULT;
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return 0;
}
......@@ -777,7 +795,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
struct cmd_ds_mesh_access mesh_access;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
if( (ttl > 0xff) || (ttl < 0) )
return -EINVAL;
......@@ -793,7 +811,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
if (ret != 0)
ret = -EFAULT;
LEAVE();
lbs_deb_leave(LBS_DEB_IOCTL);
return ret;
}
......@@ -815,9 +833,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
wlan_adapter *adapter = priv->adapter;
struct iwreq *wrq = (struct iwreq *)req;
ENTER();
lbs_deb_enter(LBS_DEB_IOCTL);
lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
switch (cmd) {
case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
switch (wrq->u.data.flags) {
......@@ -937,7 +955,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
(data, wrq->u.data.pointer,
sizeof(int) *
wrq->u.data.length)) {
lbs_pr_debug(1,
lbs_deb_ioctl(
"Copy from user failed\n");
return -EFAULT;
}
......@@ -970,7 +988,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
if (copy_to_user(wrq->u.data.pointer, data,
sizeof(int) *
gpio->header.len)) {
lbs_pr_debug(1, "Copy to user failed\n");
lbs_deb_ioctl("Copy to user failed\n");
return -EFAULT;
}
......@@ -984,7 +1002,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
ret = -EINVAL;
break;
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
return ret;
}
......
......@@ -60,7 +60,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1,
lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
lbs_dbg_hex("Common rates:", ptr, rate1_size);
lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate);
lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate);
if (!adapter->is_datarate_auto) {
while (*ptr) {
......@@ -109,16 +109,14 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
wlan_adapter *adapter = priv->adapter;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
0, cmd_option_waitforrsp,
0, pbssdesc->macaddress);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto done;
/* set preamble to firmware */
if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble)
......@@ -131,7 +129,8 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
0, cmd_option_waitforrsp, 0, pbssdesc);
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
......@@ -150,19 +149,19 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
adapter->adhoccreate = 1;
if (!adapter->capinfo.shortpreamble) {
lbs_pr_debug(1, "AdhocStart: Long preamble\n");
lbs_deb_join("AdhocStart: Long preamble\n");
adapter->preamble = cmd_type_long_preamble;
} else {
lbs_pr_debug(1, "AdhocStart: Short preamble\n");
lbs_deb_join("AdhocStart: Short preamble\n");
adapter->preamble = cmd_type_short_preamble;
}
libertas_set_radio_control(priv);
lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel);
lbs_pr_debug(1, "curbssparams.channel = %d\n",
lbs_deb_join("Adhoc channel = %d\n", adapter->adhocchannel);
lbs_deb_join("curbssparams.channel = %d\n",
adapter->curbssparams.channel);
lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band);
lbs_deb_join("curbssparams.band = %d\n", adapter->curbssparams.band);
ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
0, cmd_option_waitforrsp, 0, adhocssid);
......@@ -184,12 +183,12 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
wlan_adapter *adapter = priv->adapter;
int ret = 0;
lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n",
lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n",
adapter->curbssparams.ssid.ssid);
lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
adapter->curbssparams.ssid.ssidlength);
lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid);
lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n",
lbs_deb_join("libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid);
lbs_deb_join("libertas_join_adhoc_network: ssid len =%u\n",
pbssdesc->ssid.ssidlength);
/* check if the requested SSID is already joined */
......@@ -197,7 +196,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
&& !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
&& (adapter->mode == IW_MODE_ADHOC)) {
lbs_pr_debug(1,
lbs_deb_join(
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
"not attempting to re-join");
......@@ -207,18 +206,18 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
/*Use shortpreamble only when both creator and card supports
short preamble */
if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
lbs_pr_debug(1, "AdhocJoin: Long preamble\n");
lbs_deb_join("AdhocJoin: Long preamble\n");
adapter->preamble = cmd_type_long_preamble;
} else {
lbs_pr_debug(1, "AdhocJoin: Short preamble\n");
lbs_deb_join("AdhocJoin: Short preamble\n");
adapter->preamble = cmd_type_short_preamble;
}
libertas_set_radio_control(priv);
lbs_pr_debug(1, "curbssparams.channel = %d\n",
lbs_deb_join("curbssparams.channel = %d\n",
adapter->curbssparams.channel);
lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band);
lbs_deb_join("curbssparams.band = %c\n", adapter->curbssparams.band);
adapter->adhoccreate = 0;
......@@ -281,14 +280,14 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
pauthenticate->authtype = 0x80;
break;
default:
lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n",
lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
adapter->secinfo.auth_mode);
goto out;
}
memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
lbs_deb_join("AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
ret = 0;
......@@ -302,7 +301,7 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
cmd->size =
......@@ -317,7 +316,7 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
#define REASON_CODE_STA_LEAVING 3
dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
LEAVE();
lbs_deb_leave(LBS_DEB_JOIN);
return 0;
}
......@@ -338,7 +337,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
struct mrvlietypes_ratesparamset *rates;
struct mrvlietypes_rsnparamset *rsn;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
pbssdesc = pdata_buf;
pos = (u8 *) passo;
......@@ -427,7 +426,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
memcpy(&adapter->curbssparams.datarates, &rates->rates,
min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len));
lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
/* set IBSS field */
if (pbssdesc->mode == IW_MODE_INFRA) {
......@@ -445,13 +444,13 @@ int libertas_cmd_80211_associate(wlan_private * priv,
/* set the capability info at last */
memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo));
tmpcap &= CAPINFO_MASK;
lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK);
tmpcap = cpu_to_le16(tmpcap);
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
done:
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
......@@ -467,7 +466,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
struct bss_descriptor *pbssdesc;
struct WLAN_802_11_SSID *ssid = pssid;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
if (!adapter) {
ret = -1;
......@@ -495,7 +494,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength);
lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE);
memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength);
......@@ -516,7 +515,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
WARN_ON(!adapter->adhocchannel);
lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n",
lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
adapter->adhocchannel);
adapter->curbssparams.channel = adapter->adhocchannel;
......@@ -547,11 +546,11 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
/* set up privacy in adapter->scantable[i] */
if (adapter->secinfo.wep_enabled) {
lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n");
lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
pbssdesc->privacy = wlan802_11privfilter8021xWEP;
adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
} else {
lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n");
lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
pbssdesc->privacy = wlan802_11privfilteracceptall;
}
......@@ -574,14 +573,14 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
memcpy(&adapter->curbssparams.datarates,
&adhs->datarate, adapter->curbssparams.numofrates);
lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
adhs->datarate[0], adhs->datarate[1],
adhs->datarate[2], adhs->datarate[3]);
lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n");
lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
if (libertas_create_dnld_countryinfo_11d(priv)) {
lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
ret = -1;
goto done;
}
......@@ -596,7 +595,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
ret = 0;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
......@@ -622,7 +621,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
u16 tmpcap;
int i;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
adapter->pattemptedbssdesc = pbssdesc;
......@@ -647,13 +646,13 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo));
tmpcap &= CAPINFO_MASK;
lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK);
memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
sizeof(struct ieeetypes_capinfo));
/* information on BSSID descriptor passed to FW */
lbs_pr_debug(1,
lbs_deb_join(
"ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n",
padhocjoin->bssdescriptor.BSSID[0],
padhocjoin->bssdescriptor.BSSID[1],
......@@ -685,7 +684,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
sizeof(padhocjoin->bssdescriptor.datarates),
card_rates, card_rates_size)) {
lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n");
lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
ret = -1;
goto done;
}
......@@ -742,8 +741,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
memcpy(&padhocjoin->bssdescriptor.cap,
&tmpcap, sizeof(struct ieeetypes_capinfo));
done:
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
......@@ -756,7 +755,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
struct ieeetypes_assocrsp *passocrsp;
struct bss_descriptor *pbssdesc;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
......@@ -764,9 +763,8 @@ int libertas_ret_80211_associate(wlan_private * priv,
libertas_mac_event_disconnected(priv);
lbs_pr_debug(1,
"ASSOC_RESP: Association failed, status code = %d\n",
passocrsp->statuscode);
lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
passocrsp->statuscode);
ret = -1;
goto done;
......@@ -781,7 +779,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
/* Set the attempted BSSID Index to current */
pbssdesc = adapter->pattemptedbssdesc;
lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
lbs_deb_join("ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
/* Set the new SSID to current SSID */
memcpy(&adapter->curbssparams.ssid,
......@@ -795,7 +793,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
memcpy(&adapter->curbssparams.bssdescriptor,
pbssdesc, sizeof(struct bss_descriptor));
lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n",
lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
adapter->currentpacketfilter);
adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
......@@ -809,25 +807,25 @@ int libertas_ret_80211_associate(wlan_private * priv,
netif_carrier_on(priv->wlan_dev.netdev);
netif_wake_queue(priv->wlan_dev.netdev);
lbs_pr_debug(1, "ASSOC_RESP: Associated \n");
lbs_deb_join("ASSOC_RESP: Associated \n");
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
done:
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
int libertas_ret_80211_disassociate(wlan_private * priv,
struct cmd_ds_command *resp)
{
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
libertas_mac_event_disconnected(priv);
LEAVE();
lbs_deb_leave(LBS_DEB_JOIN);
return 0;
}
......@@ -842,13 +840,13 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
union iwreq_data wrqu;
struct bss_descriptor *pbssdesc;
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
padhocresult = &resp->params.result;
lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size));
lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command);
lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result);
lbs_deb_join("ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size));
lbs_deb_join("ADHOC_S_RESP: command = %x\n", command);
lbs_deb_join("ADHOC_S_RESP: result = %x\n", result);
pbssdesc = adapter->pattemptedbssdesc;
......@@ -856,7 +854,7 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
* Join result code 0 --> SUCCESS
*/
if (result) {
lbs_pr_debug(1, "ADHOC_RESP failed\n");
lbs_deb_join("ADHOC_RESP failed\n");
if (adapter->connect_status == libertas_connected) {
libertas_mac_event_disconnected(priv);
}
......@@ -864,15 +862,15 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
memset(&adapter->curbssparams.bssdescriptor,
0x00, sizeof(adapter->curbssparams.bssdescriptor));
LEAVE();
return -1;
ret = -1;
goto done;
}
/*
* Now the join cmd should be successful
* If BSSID has changed use SSID to compare instead of BSSID
*/
lbs_pr_debug(1, "ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid);
lbs_deb_join("ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid);
/* Send a Media Connected event, according to the Spec */
adapter->connect_status = libertas_connected;
......@@ -906,24 +904,25 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n");
lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel);
lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->adhocchannel);
lbs_deb_join("ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
padhocresult->BSSID[0], padhocresult->BSSID[1],
padhocresult->BSSID[2], padhocresult->BSSID[3],
padhocresult->BSSID[4], padhocresult->BSSID[5]);
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
return ret;
}
int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
struct cmd_ds_command *resp)
{
ENTER();
lbs_deb_enter(LBS_DEB_JOIN);
libertas_mac_event_disconnected(priv);
LEAVE();
lbs_deb_leave(LBS_DEB_JOIN);
return 0;
}
......@@ -11,6 +11,7 @@
#include <linux/if_arp.h>
#include <net/iw_handler.h>
#include <net/ieee80211.h>
#include "host.h"
#include "sbi.h"
......@@ -227,7 +228,8 @@ static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get,
* function to work around the issue.
*
*/
static int pre_open_check(struct net_device *dev) {
static int pre_open_check(struct net_device *dev)
{
wlan_private *priv = (wlan_private *) dev->priv;
wlan_adapter *adapter = priv->adapter;
int i = 0;
......@@ -237,8 +239,7 @@ static int pre_open_check(struct net_device *dev) {
msleep_interruptible(100);
}
if (!adapter->fw_ready) {
lbs_pr_info("FW not ready, pre_open_check() return failure\n");
LEAVE();
lbs_pr_err("firmware not ready\n");
return -1;
}
......@@ -256,8 +257,7 @@ static int wlan_dev_open(struct net_device *dev)
wlan_private *priv = (wlan_private *) dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
priv->open = 1;
......@@ -266,7 +266,7 @@ static int wlan_dev_open(struct net_device *dev)
} else
netif_carrier_off(priv->wlan_dev.netdev);
LEAVE();
lbs_deb_leave(LBS_DEB_NET);
return 0;
}
/**
......@@ -311,12 +311,12 @@ static int wlan_dev_close(struct net_device *dev)
{
wlan_private *priv = dev->priv;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
netif_carrier_off(priv->wlan_dev.netdev);
priv->open = 0;
LEAVE();
lbs_deb_leave(LBS_DEB_NET);
return 0;
}
......@@ -361,7 +361,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
int ret = 0;
wlan_private *priv = dev->priv;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
priv->stats.tx_dropped++;
......@@ -373,7 +373,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (libertas_process_tx(priv, skb) == 0)
dev->trans_start = jiffies;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
return ret;
}
......@@ -384,31 +384,41 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
wlan_private *priv = dev->priv;
ENTER();
int ret;
lbs_deb_enter(LBS_DEB_MESH);
SET_MESH_FRAME(skb);
LEAVE();
return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev);
ret = wlan_hard_start_xmit(skb, priv->wlan_dev.netdev);
lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
return ret;
}
/**
* @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit
*
*/
static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) {
ENTER();
static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
int ret;
lbs_deb_enter(LBS_DEB_NET);
UNSET_MESH_FRAME(skb);
LEAVE();
return wlan_hard_start_xmit(skb, dev);
ret = wlan_hard_start_xmit(skb, dev);
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
return ret;
}
static void wlan_tx_timeout(struct net_device *dev)
{
wlan_private *priv = (wlan_private *) dev->priv;
ENTER();
lbs_deb_enter(LBS_DEB_TX);
lbs_pr_err("tx watch dog timeout!\n");
lbs_pr_err("tx watch dog timeout\n");
priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
dev->trans_start = jiffies;
......@@ -424,7 +434,7 @@ static void wlan_tx_timeout(struct net_device *dev)
} else if (priv->adapter->connect_status == libertas_connected)
netif_wake_queue(priv->wlan_dev.netdev);
LEAVE();
lbs_deb_leave(LBS_DEB_TX);
}
/**
......@@ -447,7 +457,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
wlan_adapter *adapter = priv->adapter;
struct sockaddr *phwaddr = addr;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
memset(adapter->current_addr, 0, ETH_ALEN);
......@@ -462,7 +472,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
cmd_option_waitforrsp, 0, NULL);
if (ret) {
lbs_pr_debug(1, "set mac address failed.\n");
lbs_deb_net("set MAC address failed\n");
ret = -1;
goto done;
}
......@@ -472,7 +482,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
return ret;
}
......@@ -497,12 +507,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
wlan_adapter *adapter = priv->adapter;
int oldpacketfilter;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
oldpacketfilter = adapter->currentpacketfilter;
if (dev->flags & IFF_PROMISC) {
lbs_pr_debug(1, "enable Promiscuous mode\n");
lbs_deb_net("enable promiscuous mode\n");
adapter->currentpacketfilter |=
cmd_act_mac_promiscuous_enable;
adapter->currentpacketfilter &=
......@@ -515,7 +525,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
if (dev->flags & IFF_ALLMULTI || dev->mc_count >
MRVDRV_MAX_MULTICAST_LIST_SIZE) {
lbs_pr_debug(1, "Enabling All Multicast!\n");
lbs_deb_net( "enabling all multicast\n");
adapter->currentpacketfilter |=
cmd_act_mac_all_multicast_enable;
adapter->currentpacketfilter &=
......@@ -525,8 +535,8 @@ static void wlan_set_multicast_list(struct net_device *dev)
~cmd_act_mac_all_multicast_enable;
if (!dev->mc_count) {
lbs_pr_debug(1, "No multicast addresses - "
"disabling multicast!\n");
lbs_deb_net("no multicast addresses, "
"disabling multicast\n");
adapter->currentpacketfilter &=
~cmd_act_mac_multicast_enable;
} else {
......@@ -538,12 +548,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
adapter->nr_of_multicastmacaddr =
wlan_copy_multicast_address(adapter, dev);
lbs_pr_debug(1, "Multicast addresses: %d\n",
lbs_deb_net("multicast addresses: %d\n",
dev->mc_count);
for (i = 0; i < dev->mc_count; i++) {
lbs_pr_debug(1, "Multicast address %d:"
"%x %x %x %x %x %x\n", i,
lbs_deb_net("Multicast address %d:"
MAC_FMT "\n", i,
adapter->multicastlist[i][0],
adapter->multicastlist[i][1],
adapter->multicastlist[i][2],
......@@ -551,7 +561,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
adapter->multicastlist[i][4],
adapter->multicastlist[i][5]);
}
/* set multicast addresses to firmware */
/* send multicast addresses to firmware */
libertas_prepare_and_send_command(priv,
cmd_mac_multicast_adr,
cmd_act_set, 0, 0,
......@@ -564,13 +574,13 @@ static void wlan_set_multicast_list(struct net_device *dev)
libertas_set_mac_packet_filter(priv);
}
LEAVE();
lbs_deb_leave(LBS_DEB_NET);
}
/**
* @brief This function hanldes the major job in WLAN driver.
* it handles the event generated by firmware, rx data received
* from firmware and tx data sent from kernel.
* @brief This function handles the major jobs in the WLAN 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
* @return 0
......@@ -583,14 +593,14 @@ static int wlan_service_main_thread(void *data)
wait_queue_t wait;
u8 ireg = 0;
ENTER();
lbs_deb_enter(LBS_DEB_THREAD);
wlan_activate_thread(thread);
init_waitqueue_entry(&wait, current);
for (;;) {
lbs_pr_debug(1, "main-thread 111: intcounter=%d "
lbs_deb_thread( "main-thread 111: intcounter=%d "
"currenttxskb=%p dnld_sent=%d\n",
adapter->intcounter,
adapter->currenttxskb, priv->wlan_dev.dnld_sent);
......@@ -602,7 +612,7 @@ static int wlan_service_main_thread(void *data)
(!adapter->intcounter
&& (priv->wlan_dev.dnld_sent || adapter->cur_cmd ||
list_empty(&adapter->cmdpendingq)))) {
lbs_pr_debug(1,
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);
......@@ -612,7 +622,7 @@ static int wlan_service_main_thread(void *data)
spin_unlock_irq(&adapter->driver_lock);
lbs_pr_debug(1,
lbs_deb_thread(
"main-thread 222 (waking up): intcounter=%d currenttxskb=%p "
"dnld_sent=%d\n", adapter->intcounter,
adapter->currenttxskb, priv->wlan_dev.dnld_sent);
......@@ -621,14 +631,14 @@ static int wlan_service_main_thread(void *data)
remove_wait_queue(&thread->waitq, &wait);
try_to_freeze();
lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p "
lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p "
"dnld_sent=%d\n",
adapter->intcounter,
adapter->currenttxskb, priv->wlan_dev.dnld_sent);
if (kthread_should_stop()
|| adapter->surpriseremoved) {
lbs_pr_debug(1,
lbs_deb_thread(
"main-thread: break from main thread: surpriseremoved=0x%x\n",
adapter->surpriseremoved);
break;
......@@ -642,7 +652,7 @@ static int wlan_service_main_thread(void *data)
int_status = libertas_sbi_get_int_status(priv, &ireg);
if (int_status) {
lbs_pr_debug(1,
lbs_deb_thread(
"main-thread: reading HOST_INT_STATUS_REG failed\n");
spin_unlock_irq(&adapter->driver_lock);
continue;
......@@ -650,14 +660,14 @@ static int wlan_service_main_thread(void *data)
adapter->hisregcpy |= ireg;
}
lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p "
lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p "
"dnld_sent=%d\n",
adapter->intcounter,
adapter->currenttxskb, priv->wlan_dev.dnld_sent);
/* command response? */
if (adapter->hisregcpy & his_cmdupldrdy) {
lbs_pr_debug(1, "main-thread: cmd response ready.\n");
lbs_deb_thread("main-thread: cmd response ready\n");
adapter->hisregcpy &= ~his_cmdupldrdy;
spin_unlock_irq(&adapter->driver_lock);
......@@ -667,13 +677,13 @@ static int wlan_service_main_thread(void *data)
/* Any Card Event */
if (adapter->hisregcpy & his_cardevent) {
lbs_pr_debug(1, "main-thread: Card Event Activity.\n");
lbs_deb_thread("main-thread: Card Event Activity\n");
adapter->hisregcpy &= ~his_cardevent;
if (libertas_sbi_read_event_cause(priv)) {
lbs_pr_alert(
"main-thread: libertas_sbi_read_event_cause failed.\n");
"main-thread: libertas_sbi_read_event_cause failed\n");
spin_unlock_irq(&adapter->driver_lock);
continue;
}
......@@ -687,7 +697,7 @@ static int wlan_service_main_thread(void *data)
if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) {
if (adapter->connect_status ==
libertas_connected) {
lbs_pr_debug(1,
lbs_deb_thread(
"main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p "
"dnld_sent=%d cur_cmd=%p, confirm now\n",
adapter->intcounter,
......@@ -735,7 +745,7 @@ static int wlan_service_main_thread(void *data)
wake_up_all(&adapter->cmd_pending);
wlan_deactivate_thread(thread);
LEAVE();
lbs_deb_leave(LBS_DEB_THREAD);
return 0;
}
......@@ -752,11 +762,11 @@ wlan_private *wlan_add_card(void *card)
struct net_device *mesh_dev = NULL;
wlan_private *priv = NULL;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
/* Allocate an Ethernet device and register it */
if (!(dev = alloc_etherdev(sizeof(wlan_private)))) {
lbs_pr_alert( "Init ethernet device failed!\n");
lbs_pr_err("init ethX device failed\n");
return NULL;
}
......@@ -764,13 +774,13 @@ wlan_private *wlan_add_card(void *card)
/* allocate buffer for wlan_adapter */
if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n");
lbs_pr_err("allocate buffer for wlan_adapter failed\n");
goto err_kmalloc;
}
/* Allocate a virtual mesh device */
if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
lbs_pr_debug(1, "Init ethernet device failed!\n");
lbs_deb_mesh("init mshX device failed\n");
return NULL;
}
......@@ -827,7 +837,7 @@ wlan_private *wlan_add_card(void *card)
init_waitqueue_head(&priv->adapter->cmd_pending);
priv->adapter->nr_cmd_pending = 0;
lbs_pr_debug(1, "Starting kthread...\n");
lbs_deb_thread("Starting kthread...\n");
priv->mainthread.priv = priv;
wlan_create_thread(wlan_service_main_thread,
&priv->mainthread, "wlan_main_service");
......@@ -842,28 +852,28 @@ wlan_private *wlan_add_card(void *card)
* IRQ.
*/
if (libertas_sbi_register_dev(priv) < 0) {
lbs_pr_info("failed to register wlan device!\n");
lbs_pr_err("failed to register WLAN device\n");
goto err_registerdev;
}
/* init FW and HW */
if (libertas_init_fw(priv)) {
lbs_pr_debug(1, "Firmware Init failed\n");
lbs_pr_err("firmware init failed\n");
goto err_registerdev;
}
if (register_netdev(dev)) {
lbs_pr_err("Cannot register network device!\n");
lbs_pr_err("cannot register ethX device\n");
goto err_init_fw;
}
/* Register virtual mesh interface */
if (register_netdev(mesh_dev)) {
lbs_pr_info("Cannot register mesh virtual interface!\n");
lbs_pr_err("cannot register mshX virtual interface\n");
goto err_init_fw;
}
lbs_pr_info("%s: Marvell Wlan 802.11 adapter\n", dev->name);
lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
libertas_debugfs_init_one(priv, dev);
......@@ -874,7 +884,7 @@ wlan_private *wlan_add_card(void *card)
if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp))
goto err_create_file;
LEAVE();
lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
return priv;
err_create_file:
......@@ -891,7 +901,7 @@ wlan_private *wlan_add_card(void *card)
free_netdev(dev);
free_netdev(mesh_dev);
LEAVE();
lbs_deb_leave_args(LBS_DEB_NET, "priv NULL");
return NULL;
}
......@@ -900,6 +910,8 @@ static void wake_pending_cmdnodes(wlan_private *priv)
struct cmd_ctrl_node *cmdnode;
unsigned long flags;
lbs_deb_enter(LBS_DEB_CMD);
spin_lock_irqsave(&priv->adapter->driver_lock, flags);
list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) {
cmdnode->cmdwaitqwoken = 1;
......@@ -918,19 +930,15 @@ int wlan_remove_card(void *card)
union iwreq_data wrqu;
int i;
ENTER();
lbs_deb_enter(LBS_DEB_NET);
if (!priv) {
LEAVE();
return 0;
}
if (!priv)
goto out;
adapter = priv->adapter;
if (!adapter) {
LEAVE();
return 0;
}
if (!adapter)
goto out;
dev = priv->wlan_dev.netdev;
mesh_dev = priv->mesh_dev;
......@@ -964,7 +972,7 @@ int wlan_remove_card(void *card)
libertas_debugfs_remove_one(priv);
lbs_pr_debug(1, "Free adapter\n");
lbs_deb_net("free adapter\n");
libertas_free_adapter(priv);
for (i = 0; i<libertas_found; i++) {
......@@ -975,14 +983,15 @@ int wlan_remove_card(void *card)
}
}
lbs_pr_debug(1, "Unregister finish\n");
lbs_deb_net("unregister finish\n");
priv->wlan_dev.netdev = NULL;
priv->mesh_dev = NULL ;
free_netdev(mesh_dev);
free_netdev(dev);
LEAVE();
out:
lbs_deb_leave(LBS_DEB_NET);
return 0;
}
......@@ -999,33 +1008,34 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c
{
int i, end;
ENTER();
lbs_deb_enter(LBS_DEB_MAIN);
end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table);
for (i = 0; i < end ; i++) {
lbs_pr_debug(1, "region_cfp_table[i].region=%d\n",
lbs_deb_main("region_cfp_table[i].region=%d\n",
region_cfp_table[i].region);
if (region_cfp_table[i].region == region) {
*cfp_no = region_cfp_table[i].cfp_no_BG;
LEAVE();
lbs_deb_leave(LBS_DEB_MAIN);
return region_cfp_table[i].cfp_BG;
}
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL");
return NULL;
}
int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
{
wlan_adapter *adapter = priv->adapter;
int ret = 0;
int i = 0;
struct chan_freq_power *cfp;
int cfp_no;
ENTER();
lbs_deb_enter(LBS_DEB_MAIN);
memset(adapter->region_channel, 0, sizeof(adapter->region_channel));
......@@ -1035,17 +1045,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
adapter->region_channel[i].nrcfp = cfp_no;
adapter->region_channel[i].CFP = cfp;
} else {
lbs_pr_debug(1, "wrong region code %#x in band B-G\n",
lbs_deb_main("wrong region code %#x in band B/G\n",
region);
return -1;
ret = -1;
goto out;
}
adapter->region_channel[i].valid = 1;
adapter->region_channel[i].region = region;
adapter->region_channel[i].band = band;
i++;
}
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
return ret;
}
/**
......@@ -1060,9 +1072,9 @@ void libertas_interrupt(struct net_device *dev)
{
wlan_private *priv = dev->priv;
ENTER();
lbs_deb_enter(LBS_DEB_MAIN);
lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n",
lbs_deb_main("libertas_interrupt: intcounter=%d\n",
priv->adapter->intcounter);
priv->adapter->intcounter++;
......@@ -1074,14 +1086,14 @@ void libertas_interrupt(struct net_device *dev)
wake_up_interruptible(&priv->mainthread.waitq);
LEAVE();
lbs_deb_leave(LBS_DEB_MAIN);
}
static int wlan_init_module(void)
{
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_MAIN);
if (libertas_fw_name == NULL) {
libertas_fw_name = default_fw_name;
......@@ -1092,11 +1104,9 @@ static int wlan_init_module(void)
if (libertas_sbi_register()) {
ret = -1;
libertas_debugfs_remove();
goto done;
}
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
return ret;
}
......@@ -1104,7 +1114,7 @@ static void wlan_cleanup_module(void)
{
int i;
ENTER();
lbs_deb_enter(LBS_DEB_MAIN);
for (i = 0; i<libertas_found; i++) {
wlan_private *priv = libertas_devs[i]->priv;
......@@ -1114,7 +1124,7 @@ static void wlan_cleanup_module(void)
libertas_sbi_unregister();
libertas_debugfs_remove();
LEAVE();
lbs_deb_leave(LBS_DEB_MAIN);
}
module_init(wlan_init_module);
......
......@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
{
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_RX);
lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf);
lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n",
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);
......@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *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;
lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n",
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);
......@@ -133,12 +133,12 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
LEAVE();
lbs_deb_leave(LBS_DEB_RX);
}
void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
{
lbs_pr_debug(1, "skb->data=%p\n", skb->data);
lbs_deb_rx("skb->data %p\n", skb->data);
if(IS_MESH_FRAME(skb))
skb->dev = priv->mesh_dev;
......@@ -171,7 +171,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
ENTER();
lbs_deb_enter(LBS_DEB_RX);
if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
lbs_dbg_hex("RX packet: ", skb->data,
......@@ -191,7 +191,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
min_t(unsigned int, skb->len, 100));
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
lbs_deb_rx("rx err: frame received with bad length\n");
priv->stats.rx_length_errors++;
ret = 0;
goto done;
......@@ -201,14 +201,14 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
* Check rxpd status and update 802.3 stat,
*/
if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
lbs_pr_debug(1, "RX error: frame received with bad status\n");
lbs_pr_alert("rxpd Not OK\n");
lbs_deb_rx("rx err: frame received with bad status\n");
lbs_pr_alert("rxpd not ok\n");
priv->stats.rx_errors++;
ret = 0;
goto done;
}
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
......@@ -266,7 +266,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, p_rx_pd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++;
......@@ -274,8 +274,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
ret = 0;
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
return ret;
}
......@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
case 11: /* 54 Mbps */
return 108;
}
lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate);
lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
return 0;
}
......@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
struct rx_radiotap_hdr radiotap_hdr;
struct rx_radiotap_hdr *pradiotap_hdr;
ENTER();
lbs_deb_enter(LBS_DEB_RX);
p_rx_pkt = (struct rx80211packethdr *) skb->data;
prxpd = &p_rx_pkt->rx_pd;
......@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
// lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
lbs_deb_rx("rx err: frame received wit bad length\n");
priv->stats.rx_length_errors++;
ret = 0;
goto done;
......@@ -354,11 +353,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
* Check rxpd status and update 802.3 stat,
*/
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
//lbs_pr_debug(1, "RX error: frame received with bad status\n");
//lbs_deb_rx("rx err: frame received with bad status\n");
priv->stats.rx_errors++;
}
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
/* create the exported radio header */
......@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
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",
lbs_pr_alert("%s: couldn't pskb_expand_head\n",
__func__);
}
......@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
default:
/* unknown header */
lbs_pr_alert( "Unknown radiomode (%i)\n",
lbs_pr_alert("Unknown radiomode %i\n",
priv->adapter->radiomode);
/* don't export any header */
/* chop the rxpd */
......@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, prxpd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
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);
ret = 0;
done:
LEAVE();
return (ret);
done:
skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
return ret;
}
......@@ -86,7 +86,7 @@
*/
static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
{
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
if (adapter->scantable[index].mode == mode) {
if ( !adapter->secinfo.wep_enabled
......@@ -96,15 +96,13 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
&& adapter->scantable[index].rsn_ie[0] != WPA2_IE
&& !adapter->scantable[index].privacy) {
/* no security */
LEAVE();
return index;
goto done;
} else if ( adapter->secinfo.wep_enabled
&& !adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled
&& adapter->scantable[index].privacy) {
/* static WEP enabled */
LEAVE();
return index;
goto done;
} else if ( !adapter->secinfo.wep_enabled
&& adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled
......@@ -113,7 +111,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
&& adapter->scantable[index].privacy */
) {
/* WPA enabled */
lbs_pr_debug(1,
lbs_deb_scan(
"is_network_compatible() WPA: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
"privacy=%#x\n", index,
......@@ -123,8 +121,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d",
adapter->scantable[index].privacy);
LEAVE();
return index;
goto done;
} else if ( !adapter->secinfo.wep_enabled
&& !adapter->secinfo.WPAenabled
&& adapter->secinfo.WPA2enabled
......@@ -133,7 +130,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
&& adapter->scantable[index].privacy */
) {
/* WPA2 enabled */
lbs_pr_debug(1,
lbs_deb_scan(
"is_network_compatible() WPA2: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
"privacy=%#x\n", index,
......@@ -143,8 +140,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d",
adapter->scantable[index].privacy);
LEAVE();
return index;
goto done;
} else if ( !adapter->secinfo.wep_enabled
&& !adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled
......@@ -152,19 +148,18 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
&& (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
&& adapter->scantable[index].privacy) {
/* dynamic WEP enabled */
lbs_pr_debug(1,
lbs_deb_scan(
"is_network_compatible() dynamic WEP: index=%d "
"wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
index,
adapter->scantable[index].wpa_ie[0],
adapter->scantable[index].rsn_ie[0],
adapter->scantable[index].privacy);
LEAVE();
return index;
goto done;
}
/* security doesn't match */
lbs_pr_debug(1,
lbs_deb_scan(
"is_network_compatible() FAILED: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
index,
......@@ -174,13 +169,16 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d",
adapter->scantable[index].privacy);
LEAVE();
return -ECONNREFUSED;
index = -ECONNREFUSED;
goto done;
}
/* mode doesn't match */
LEAVE();
return -ENETUNREACH;
index = -ENETUNREACH;
done:
lbs_deb_leave_args(LBS_DEB_SCAN, "index %d", index);
return index;
}
/**
......@@ -246,7 +244,7 @@ static void wlan_scan_process_results(wlan_private * priv)
}
for (i = 0; i < adapter->numinscantable; i++) {
lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, "
lbs_deb_scan("Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, "
"RSSI[%03d], SSID[%s]\n",
i,
adapter->scantable[i].macaddress[0],
......@@ -529,7 +527,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
if (puserscanin && puserscanin->chanlist[0].channumber) {
lbs_pr_debug(1, "Scan: Using supplied channel list\n");
lbs_deb_scan("Scan: Using supplied channel list\n");
for (chanidx = 0;
chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
......@@ -573,11 +571,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
==
priv->adapter->curbssparams.channel)) {
*pscancurrentonly = 1;
lbs_pr_debug(1, "Scan: Scanning current channel only");
lbs_deb_scan("Scan: Scanning current channel only");
}
} else {
lbs_pr_debug(1, "Scan: Creating full region channel list\n");
lbs_deb_scan("Scan: Creating full region channel list\n");
wlan_scan_create_channel_list(priv, pscanchanlist,
*pfilteredscan);
}
......@@ -626,10 +624,10 @@ static int wlan_scan_channel_list(wlan_private * priv,
int scanned = 0;
union iwreq_data wrqu;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) {
lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n",
lbs_deb_scan("Scan: Null detect: %p, %p, %p\n",
pscancfgout, pchantlvout, pscanchanlist);
return -1;
}
......@@ -663,7 +661,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
while (tlvidx < maxchanperscan && ptmpchan->channumber
&& !doneearly && scanned < 2) {
lbs_pr_debug(1,
lbs_deb_scan(
"Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
ptmpchan->channumber, ptmpchan->radiotype,
ptmpchan->chanscanmode.passivescan,
......@@ -726,7 +724,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
0, 0, pscancfgout);
if (scanned >= 2 && !full_scan) {
priv->adapter->last_scanned_channel = ptmpchan->channumber;
return 0;
ret = 0;
goto done;
}
scanned = 0;
}
......@@ -736,7 +735,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
memset(&wrqu, 0, sizeof(union iwreq_data));
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
LEAVE();
done:
lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
}
......@@ -767,7 +767,7 @@ int wlan_scan_networks(wlan_private * priv,
int maxchanperscan;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
......@@ -836,7 +836,7 @@ int wlan_scan_networks(wlan_private * priv,
if (scan_chan_list)
kfree(scan_chan_list);
LEAVE();
lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
}
......@@ -867,7 +867,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
tlvbufleft = tlvbufsize;
*ptsftlv = NULL;
lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize);
while (tlvbufleft >= sizeof(struct mrvlietypesheader)) {
......@@ -880,7 +880,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
break;
default:
lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n",
lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n",
tlvtype);
/* Give up, this seems corrupted */
return;
......@@ -921,13 +921,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
u16 beaconsize;
u8 founddatarateie;
int bytesleftforcurrentbeacon;
int ret;
struct IE_WPA *pIe;
const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
struct ieeetypes_countryinfoset *pcountryinfo;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
founddatarateie = 0;
ratesize = 0;
......@@ -959,7 +960,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
bytesleftforcurrentbeacon = beaconsize;
memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
lbs_deb_scan("InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
pBSSEntry->macaddress[2], pBSSEntry->macaddress[3],
pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]);
......@@ -968,7 +969,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
bytesleftforcurrentbeacon -= ETH_ALEN;
if (bytesleftforcurrentbeacon < 12) {
lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n");
lbs_deb_scan("InterpretIE: Not enough bytes left\n");
return -1;
}
......@@ -979,7 +980,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
/* RSSI is 1 byte long */
pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr));
lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr);
lbs_deb_scan("InterpretIE: RSSI=%02X\n", *pcurrentptr);
pcurrentptr += 1;
bytesleftforcurrentbeacon -= 1;
......@@ -997,7 +998,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
/* capability information is 2 bytes long */
memcpy(&fixedie.capabilities, pcurrentptr, 2);
lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n",
lbs_deb_scan("InterpretIE: fixedie.capabilities=0x%X\n",
fixedie.capabilities);
fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
......@@ -1006,14 +1007,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
bytesleftforcurrentbeacon -= 2;
/* rest of the current buffer are IE's */
lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n",
lbs_deb_scan("InterpretIE: IElength for this AP = %d\n",
bytesleftforcurrentbeacon);
lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr,
bytesleftforcurrentbeacon);
if (pcap->privacy) {
lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n");
lbs_deb_scan("InterpretIE: AP WEP enabled\n");
pBSSEntry->privacy = wlan802_11privfilter8021xWEP;
} else {
pBSSEntry->privacy = wlan802_11privfilteracceptall;
......@@ -1031,7 +1032,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
elemlen = *((u8 *) pcurrentptr + 1);
if (bytesleftforcurrentbeacon < elemlen) {
lbs_pr_debug(1, "InterpretIE: error in processing IE, "
lbs_deb_scan("InterpretIE: error in processing IE, "
"bytes left < IE length\n");
bytesleftforcurrentbeacon = 0;
continue;
......@@ -1043,7 +1044,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
pBSSEntry->ssid.ssidlength = elemlen;
memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2),
elemlen);
lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid);
lbs_deb_scan("ssid: %32s", pBSSEntry->ssid.ssid);
break;
case SUPPORTED_RATES:
......@@ -1056,7 +1057,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
break;
case EXTRA_IE:
lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n");
lbs_deb_scan("InterpretIE: EXTRA_IE Found!\n");
pBSSEntry->extra_ie = 1;
break;
......@@ -1108,12 +1109,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
if (pcountryinfo->len <
sizeof(pcountryinfo->countrycode)
|| pcountryinfo->len > 254) {
lbs_pr_debug(1, "InterpretIE: 11D- Err "
lbs_deb_scan("InterpretIE: 11D- Err "
"CountryInfo len =%d min=%zd max=254\n",
pcountryinfo->len,
sizeof(pcountryinfo->countrycode));
LEAVE();
return -1;
ret = -1;
goto done;
}
memcpy(&pBSSEntry->countryinfo,
......@@ -1188,8 +1189,11 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
bytesleftforcurrentbeacon -= (elemlen + 2);
} /* while (bytesleftforcurrentbeacon > 2) */
ret = 0;
return 0;
done:
lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
}
/**
......@@ -1228,7 +1232,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
if (!bssid)
return -EFAULT;
lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n",
lbs_deb_scan("FindBSSID: Num of BSSIDs = %d\n",
adapter->numinscantable);
/* Look through the scan table for a compatible match. The ret return
......@@ -1272,7 +1276,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
int i;
int j;
lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable);
lbs_deb_scan("Num of Entries in Table = %d\n", adapter->numinscantable);
for (i = 0; i < adapter->numinscantable; i++) {
if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) &&
......@@ -1337,9 +1341,9 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
u8 bestrssi = 0;
int i;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable);
lbs_deb_scan("Num of BSSIDs = %d\n", adapter->numinscantable);
for (i = 0; i < adapter->numinscantable; i++) {
switch (mode) {
......@@ -1366,7 +1370,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
}
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_SCAN, "bestnet %d", bestnet);
return bestnet;
}
......@@ -1387,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
struct bss_descriptor *preqbssid;
int i;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
......@@ -1412,7 +1416,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
}
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
}
......@@ -1432,14 +1436,14 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_SCAN);
wlan_scan_networks(priv, NULL, 0);
if (adapter->surpriseremoved)
return -1;
LEAVE();
lbs_deb_leave(LBS_DEB_SCAN);
return 0;
}
......@@ -1459,7 +1463,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
wlan_adapter *adapter = priv->adapter;
struct wlan_ioctl_user_scan_cfg scancfg;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
if (prequestedssid == NULL) {
return -1;
......@@ -1476,7 +1480,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
return -1;
wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
LEAVE();
lbs_deb_leave(LBS_DEB_ASSOC);
return 0;
}
......@@ -1493,7 +1497,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
{
struct wlan_ioctl_user_scan_cfg scancfg;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
if (bssid == NULL) {
return -1;
......@@ -1509,7 +1513,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
wait_event_interruptible(priv->adapter->cmd_pending,
!priv->adapter->nr_cmd_pending);
LEAVE();
lbs_deb_leave(LBS_DEB_ASSOC);
return 0;
}
......@@ -1546,7 +1550,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
u8 buf[16 + 256 * 2];
u8 *ptr;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
/*
* if there's either commands in the queue or one being
......@@ -1561,10 +1565,10 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
}
if (adapter->connect_status == libertas_connected)
lbs_pr_debug(1, "Current ssid: %32s\n",
lbs_deb_scan("Current ssid: %32s\n",
adapter->curbssparams.ssid.ssid);
lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n",
lbs_deb_scan("Scan: Get: numinscantable = %d\n",
adapter->numinscantable);
/* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP.
......@@ -1574,7 +1578,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
*/
for (i = 0; i < adapter->numinscantable; i++) {
if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p "
lbs_deb_scan("i=%d break out: current_ev=%p end_buf=%p "
"MAX_SCAN_CELL_SIZE=%zd\n",
i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
break;
......@@ -1582,13 +1586,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
pscantable = &adapter->scantable[i];
lbs_pr_debug(1, "i=%d ssid: %32s\n", i, pscantable->ssid.ssid);
lbs_deb_scan("i=%d ssid: %32s\n", i, pscantable->ssid.ssid);
cfp =
libertas_find_cfp_by_band_and_channel(adapter, 0,
pscantable->channel);
if (!cfp) {
lbs_pr_debug(1, "Invalid channel number %d\n",
lbs_deb_scan("Invalid channel number %d\n",
pscantable->channel);
continue;
}
......@@ -1767,9 +1771,9 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
ptr += sprintf(ptr, "extra_ie");
iwe.u.data.length = strlen(buf);
lbs_pr_debug(1, "iwe.u.data.length %d\n",
lbs_deb_scan("iwe.u.data.length %d\n",
iwe.u.data.length);
lbs_pr_debug(1, "BUF: %s \n", buf);
lbs_deb_scan("BUF: %s \n", buf);
iwe.cmd = IWEVCUSTOM;
iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
......@@ -1790,7 +1794,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
dwrq->length = (current_ev - extra);
dwrq->flags = 0;
LEAVE();
lbs_deb_leave(LBS_DEB_ASSOC);
return 0;
}
......@@ -1820,7 +1824,7 @@ int libertas_cmd_80211_scan(wlan_private * priv,
struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
struct wlan_scan_cmd_config *pscancfg;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
pscancfg = pdata_buf;
......@@ -1836,9 +1840,10 @@ int libertas_cmd_80211_scan(wlan_private * priv,
+ sizeof(pscan->BSSID)
+ pscancfg->tlvbufferlen + S_DS_GEN);
lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
cmd->command, cmd->size, cmd->seqnum);
LEAVE();
lbs_deb_leave(LBS_DEB_ASSOC);
return 0;
}
......@@ -1881,24 +1886,25 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
int idx;
int tlvbufsize;
u64 tsfval;
int ret;
ENTER();
lbs_deb_enter(LBS_DEB_ASSOC);
pscan = &resp->params.scanresp;
if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) {
lbs_pr_debug(1,
lbs_deb_scan(
"SCAN_RESP: Invalid number of AP returned (%d)!!\n",
pscan->nr_sets);
LEAVE();
return -1;
ret = -1;
goto done;
}
bytesleft = le16_to_cpu(pscan->bssdescriptsize);
lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft);
lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
scanrespsize = le16_to_cpu(resp->size);
lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n",
lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n",
pscan->nr_sets);
numintable = adapter->numinscantable;
......@@ -1935,7 +1941,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
0)
&& CHECK_SSID_IS_VALID(&newbssentry.ssid)) {
lbs_pr_debug(1,
lbs_deb_scan(
"SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
newbssentry.macaddress[0],
newbssentry.macaddress[1],
......@@ -1968,7 +1974,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
ssid,
newbssentry.ssid.ssidlength) ==
0)) {
lbs_pr_debug(1,
lbs_deb_scan(
"SCAN_RESP: Duplicate of index: %d\n",
bssIdx);
break;
......@@ -2012,18 +2018,20 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
} else {
/* error parsing/interpreting the scan response, skipped */
lbs_pr_debug(1, "SCAN_RESP: "
lbs_deb_scan("SCAN_RESP: "
"InterpretBSSDescriptionWithIE returned ERROR\n");
}
}
lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n",
lbs_deb_scan("SCAN_RESP: Scanned %2d APs, %d valid, %d total\n",
pscan->nr_sets, numintable - adapter->numinscantable,
numintable);
/* Update the total number of BSSIDs in the scan table */
adapter->numinscantable = numintable;
ret = 0;
LEAVE();
return 0;
done:
lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
}
......@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
static inline void wlan_deactivate_thread(struct wlan_thread * thr)
{
ENTER();
lbs_deb_enter(LBS_DEB_THREAD);
thr->pid = 0;
LEAVE();
lbs_deb_leave(LBS_DEB_THREAD);
}
static inline void wlan_create_thread(int (*wlanfunc) (void *),
......@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
static inline int wlan_terminate_thread(struct wlan_thread * thr)
{
ENTER();
lbs_deb_enter(LBS_DEB_THREAD);
/* Check if the thread is active or not */
if (!thr->pid) {
......@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
}
kthread_stop(thr->task);
LEAVE();
lbs_deb_leave(LBS_DEB_THREAD);
return 0;
}
......
......@@ -68,7 +68,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
u32 new_rate;
u8 *ptr = priv->adapter->tmptxbuf;
ENTER();
lbs_deb_enter(LBS_DEB_TX);
if (priv->adapter->surpriseremoved)
return -1;
......@@ -78,7 +78,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
min_t(unsigned int, skb->len, 100));
if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n",
lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
ret = -1;
goto done;
......@@ -138,13 +138,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
sizeof(struct txpd));
if (ret) {
lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret);
lbs_deb_tx("tx err: libertas_sbi_host_to_card returned 0x%X\n", ret);
goto done;
}
lbs_pr_debug(1, "SendSinglePacket succeeds\n");
lbs_deb_tx("SendSinglePacket succeeds\n");
done:
done:
if (!ret) {
priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
......@@ -166,7 +166,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
priv->adapter->currenttxskb = NULL;
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret;
}
......@@ -214,8 +214,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
{
int ret = -1;
ENTER();
lbs_deb_enter(LBS_DEB_TX);
lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
if (priv->wlan_dev.dnld_sent) {
......@@ -234,7 +233,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
ret = SendSinglePacket(priv, skb);
done:
LEAVE();
lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret;
}
......
......@@ -110,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
}
if (!cfp && channel)
lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find "
"cfp by band %d & channel %d\n", band, channel);
lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
"cfp by band %d / channel %d\n", band, channel);
return cfp;
}
......@@ -151,8 +151,8 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
}
if (!cfp && freq)
lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by "
"band %d & freq %d\n", band, freq);
lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
"band %d / freq %d\n", band, freq);
return cfp;
}
......@@ -168,7 +168,7 @@ static int updatecurrentchannel(wlan_private * priv)
cmd_opt_802_11_rf_channel_get,
cmd_option_waitforrsp, 0, NULL);
lbs_pr_debug(1, "Current channel = %d\n",
lbs_deb_wext("current channel %d\n",
priv->adapter->curbssparams.channel);
return ret;
......@@ -176,7 +176,7 @@ static int updatecurrentchannel(wlan_private * priv)
static int setcurrentchannel(wlan_private * priv, int channel)
{
lbs_pr_debug(1, "Set channel = %d\n", channel);
lbs_deb_wext("set channel %d\n", channel);
/*
** Current channel is not set to adhocchannel requested, set channel
......@@ -197,11 +197,10 @@ static int changeadhocchannel(wlan_private * priv, int channel)
if (adapter->curbssparams.channel == adapter->adhocchannel) {
/* adhocchannel is set to the current channel already */
LEAVE();
return 0;
goto out;
}
lbs_pr_debug(1, "Updating channel from %d to %d\n",
lbs_deb_wext("updating channel from %d to %d\n",
adapter->curbssparams.channel, adapter->adhocchannel);
setcurrentchannel(priv, adapter->adhocchannel);
......@@ -209,30 +208,29 @@ static int changeadhocchannel(wlan_private * priv, int channel)
updatecurrentchannel(priv);
if (adapter->curbssparams.channel != adapter->adhocchannel) {
lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n",
lbs_deb_wext("failed to updated channel to %d, channel = %d\n",
adapter->adhocchannel, adapter->curbssparams.channel);
LEAVE();
return -1;
ret = -1;
goto out;
}
if (adapter->connect_status == libertas_connected) {
int i;
struct WLAN_802_11_SSID curadhocssid;
lbs_pr_debug(1, "channel Changed while in an IBSS\n");
lbs_deb_wext("channel changed while in IBSS\n");
/* Copy the current ssid */
memcpy(&curadhocssid, &adapter->curbssparams.ssid,
sizeof(struct WLAN_802_11_SSID));
/* Exit Adhoc mode */
lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n");
lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
ret = libertas_stop_adhoc_network(priv);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
/* Scan for the network, do not save previous results. Stale
* scan data will cause us to join a non-existant adhoc network
*/
......@@ -243,20 +241,21 @@ static int changeadhocchannel(wlan_private * priv, int channel)
IW_MODE_ADHOC);
if (i >= 0) {
lbs_pr_debug(1, "SSID found at %d in List,"
lbs_deb_wext("SSID found at %d in list,"
"so join\n", i);
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
} else {
// else send START command
lbs_pr_debug(1, "SSID not found in list, "
"so creating adhoc with ssid = %s\n",
lbs_deb_wext("SSID not found in list, "
"creating AdHoc with SSID '%s'\n",
curadhocssid.ssid);
libertas_start_adhoc_network(priv, &curadhocssid);
} // end of else (START command)
}
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
/**
......@@ -271,10 +270,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
int ret = 0;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (adapter->radioon != option) {
lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off");
lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
adapter->radioon = option;
ret = libertas_prepare_and_send_command(priv,
......@@ -283,7 +282,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
cmd_option_waitforrsp, 0, NULL);
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -320,15 +319,15 @@ static int get_active_data_rates(wlan_adapter * adapter,
{
int k = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (adapter->connect_status != libertas_connected) {
if (adapter->mode == IW_MODE_INFRA) {
lbs_pr_debug(1, "Infra\n");
lbs_deb_wext("infra\n");
k = copyrates(rates, k, libertas_supported_rates,
sizeof(libertas_supported_rates));
} else {
lbs_pr_debug(1, "Adhoc G\n");
lbs_deb_wext("Adhoc G\n");
k = copyrates(rates, k, libertas_adhoc_rates_g,
sizeof(libertas_adhoc_rates_g));
}
......@@ -337,8 +336,7 @@ static int get_active_data_rates(wlan_adapter * adapter,
adapter->curbssparams.numofrates);
}
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k);
return k;
}
......@@ -350,7 +348,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
char mrvl[6] = { "MRVL-" };
int cnt;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
strcpy(cwrq, mrvl);
......@@ -368,8 +366,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
}
*cwrq = '\0';
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -380,14 +377,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
wlan_adapter *adapter = priv->adapter;
struct chan_freq_power *cfp;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
adapter->curbssparams.channel);
if (!cfp) {
if (adapter->curbssparams.channel)
lbs_pr_debug(1, "Invalid channel=%d\n",
lbs_deb_wext("invalid channel %d\n",
adapter->curbssparams.channel);
return -EINVAL;
}
......@@ -395,9 +392,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
fwrq->m = (long)cfp->freq * 100000;
fwrq->e = 1;
lbs_pr_debug(1, "freq=%u\n", fwrq->m);
LEAVE();
lbs_deb_wext("freq %u\n", fwrq->m);
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -407,7 +403,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (adapter->connect_status == libertas_connected) {
memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
......@@ -416,7 +412,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
}
awrq->sa_family = ARPHRD_ETHER;
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -426,7 +422,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/*
* Check the size of the string
......@@ -441,7 +437,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
memcpy(adapter->nodename, extra, dwrq->length);
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -451,7 +447,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/*
* Get the Nick Name saved
......@@ -472,7 +468,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
*/
dwrq->length = strlen(extra) + 1;
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -484,7 +480,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
wlan_adapter *adapter = priv->adapter;
int rthr = vwrq->value;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->disabled) {
adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
......@@ -498,7 +494,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
cmd_act_set, cmd_option_waitforrsp,
OID_802_11_RTS_THRESHOLD, &rthr);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -509,24 +505,23 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
adapter->rtsthsd = 0;
ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
cmd_act_get, cmd_option_waitforrsp,
OID_802_11_RTS_THRESHOLD, NULL);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
vwrq->value = adapter->rtsthsd;
vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
|| (vwrq->value > MRVDRV_RTS_MAX_VALUE));
vwrq->fixed = 1;
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
......@@ -537,7 +532,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->disabled) {
adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
......@@ -551,7 +546,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
cmd_act_set, cmd_option_waitforrsp,
OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -562,24 +558,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
adapter->fragthsd = 0;
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_snmp_mib,
cmd_act_get, cmd_option_waitforrsp,
OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
vwrq->value = adapter->fragthsd;
vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
|| (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
vwrq->fixed = 1;
LEAVE();
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -589,11 +584,11 @@ static int wlan_get_mode(struct net_device *dev,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
*uwrq = adapter->mode;
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -605,19 +600,17 @@ static int wlan_get_txpow(struct net_device *dev,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_rf_tx_power,
cmd_act_tx_power_opt_get,
cmd_option_waitforrsp, 0, NULL);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel);
lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
vwrq->value = adapter->txpowerlevel;
vwrq->fixed = 1;
if (adapter->radioon) {
......@@ -627,8 +620,9 @@ static int wlan_get_txpow(struct net_device *dev,
vwrq->disabled = 1;
}
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
......@@ -638,7 +632,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->flags == IW_RETRY_LIMIT) {
/* The MAC has a 4-bit Total_Tx_Count register
......@@ -656,16 +650,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
cmd_option_waitforrsp,
OID_802_11_TX_RETRYCOUNT, NULL);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
} else {
return -EOPNOTSUPP;
}
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
......@@ -675,16 +668,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
wlan_adapter *adapter = priv->adapter;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
adapter->txretrycount = 0;
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_snmp_mib,
cmd_act_get, cmd_option_waitforrsp,
OID_802_11_TX_RETRYCOUNT, NULL);
if (ret) {
LEAVE();
return ret;
}
if (ret)
goto out;
vwrq->disabled = 0;
if (!vwrq->flags) {
vwrq->flags = IW_RETRY_LIMIT;
......@@ -692,8 +685,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
vwrq->value = adapter->txretrycount - 1;
}
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
static inline void sort_channels(struct iw_freq *freq, int num)
......@@ -747,7 +741,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
u8 flag = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
......@@ -763,7 +757,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
range->bitrate[i] = (rates[i] & 0x7f) * 500000;
}
range->num_bitrates = i;
lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES,
lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES,
range->num_bitrates);
range->num_frequency = 0;
......@@ -776,18 +770,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
&adapter->parsed_region_chan;
if (parsed_region_chan == NULL) {
lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n");
LEAVE();
return 0;
lbs_deb_wext("11d: parsed_region_chan is NULL\n");
goto out;
}
band = parsed_region_chan->band;
lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band,
lbs_deb_wext("band %d, nr_char %d\n", band,
parsed_region_chan->nr_chan);
for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
&& (i < parsed_region_chan->nr_chan); i++) {
chan_no = parsed_region_chan->chanpwr[i].chan;
lbs_pr_debug(1, "chan_no=%d\n", chan_no);
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;
......@@ -816,7 +809,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
}
}
lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n",
lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
IW_MAX_FREQUENCIES, range->num_frequency);
range->num_channels = range->num_frequency;
......@@ -911,7 +904,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
| IW_ENC_CAPA_CIPHER_CCMP;
}
LEAVE();
out:
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -921,7 +915,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/* PS is currently supported only in Infrastructure mode
* Remove this check if it is to be supported in IBSS mode also
......@@ -937,11 +931,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
}
if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
lbs_pr_debug(1,
"Setting power timeout command is not supported\n");
lbs_deb_wext(
"setting power timeout is not supported\n");
return -EINVAL;
} else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
lbs_pr_debug(1, "Setting power period command is not supported\n");
lbs_deb_wext("setting power period not supported\n");
return -EINVAL;
}
......@@ -955,7 +949,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
libertas_ps_sleep(priv, cmd_option_waitforrsp);
}
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -966,19 +960,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
wlan_adapter *adapter = priv->adapter;
int mode;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
mode = adapter->psmode;
if ((vwrq->disabled = (mode == wlan802_11powermodecam))
|| adapter->connect_status == libertas_disconnected) {
LEAVE();
return 0;
|| adapter->connect_status == libertas_disconnected)
{
goto out;
}
vwrq->value = 0;
LEAVE();
out:
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -1133,7 +1128,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
u8 rssi;
u32 tx_retries;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
priv->wstats.status = adapter->mode;
......@@ -1153,8 +1148,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
}
lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level);
lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise);
lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise);
rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
if (rssi < 15)
......@@ -1217,7 +1212,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
}
LEAVE ();
lbs_deb_leave(LBS_DEB_WEXT);
return &priv->wstats;
......@@ -1232,7 +1227,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
int rc = -EINPROGRESS; /* Call commit handler */
struct chan_freq_power *cfp;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/*
* If setting by frequency, convert to a channel
......@@ -1244,7 +1239,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
cfp = find_cfp_by_band_and_freq(adapter, 0, f);
if (!cfp) {
lbs_pr_debug(1, "Invalid freq=%ld\n", f);
lbs_deb_wext("invalid freq %ld\n", f);
return -EINVAL;
}
......@@ -1275,7 +1270,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
* command to set WEP in firmware
*/
if (adapter->secinfo.wep_enabled) {
lbs_pr_debug(1, "set_freq: WEP enabled\n");
lbs_deb_wext("set_freq: WEP enabled\n");
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_set_wep,
cmd_act_add,
......@@ -1284,8 +1279,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
NULL);
if (ret) {
LEAVE();
return ret;
rc = ret;
goto out;
}
adapter->currentpacketfilter |=
......@@ -1299,7 +1294,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
}
}
LEAVE();
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", rc);
return rc;
}
......@@ -1346,9 +1342,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
u8 rates[WLAN_SUPPORTED_RATES];
u8 *rate;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value);
lbs_deb_wext("vwrq->value %d\n", vwrq->value);
if (vwrq->value == -1) {
action = cmd_act_set_tx_auto; // Auto
......@@ -1365,15 +1361,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
get_active_data_rates(adapter, rates);
rate = rates;
while (*rate) {
lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate,
lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate,
data_rate);
if ((*rate & 0x7f) == (data_rate & 0x7f))
break;
rate++;
}
if (!*rate) {
lbs_pr_alert( "The fixed data rate 0x%X is out "
"of range.\n", data_rate);
lbs_pr_alert("fixed data rate 0x%X out "
"of range\n", data_rate);
return -EINVAL;
}
......@@ -1385,7 +1381,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
action, cmd_option_waitforrsp, 0, NULL);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1395,7 +1391,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (adapter->is_datarate_auto) {
vwrq->fixed = 0;
......@@ -1405,7 +1401,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
vwrq->value = adapter->datarate * 500000;
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -1417,12 +1413,12 @@ static int wlan_set_mode(struct net_device *dev,
wlan_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if ( (*uwrq != IW_MODE_ADHOC)
&& (*uwrq != IW_MODE_INFRA)
&& (*uwrq != IW_MODE_AUTO)) {
lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq);
ret = -EINVAL;
goto out;
}
......@@ -1436,12 +1432,12 @@ static int wlan_set_mode(struct net_device *dev,
assoc_req->mode = *uwrq;
set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
wlan_postpone_association_work(priv);
lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
}
mutex_unlock(&adapter->lock);
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1463,9 +1459,9 @@ static int wlan_get_encode(struct net_device *dev,
wlan_adapter *adapter = priv->adapter;
int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n",
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 = 0;
......@@ -1521,13 +1517,13 @@ static int wlan_get_encode(struct net_device *dev,
dwrq->flags |= IW_ENCODE_NOKEY;
lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n",
lbs_deb_wext("key: " MAC_FMT ", keylen %d\n",
extra[0], extra[1], extra[2],
extra[3], extra[4], extra[5], dwrq->length);
lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags);
lbs_deb_wext("return flags 0x%x\n", dwrq->flags);
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -1547,20 +1543,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
u16 index,
int set_tx_key)
{
int ret = 0;
struct WLAN_802_11_KEY *pkey;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/* Paranoid validation of key index */
if (index > 3) {
LEAVE();
return -EINVAL;
ret = -EINVAL;
goto out;
}
/* validate max key length */
if (key_length > KEY_LEN_WEP_104) {
LEAVE();
return -EINVAL;
ret = -EINVAL;
goto out;
}
pkey = &assoc_req->wep_keys[index];
......@@ -1578,17 +1575,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
if (set_tx_key) {
/* Ensure the chosen key is valid */
if (!pkey->len) {
lbs_pr_debug(1, "key not set, so cannot enable it\n");
LEAVE();
return -EINVAL;
lbs_deb_wext("key not set, so cannot enable it\n");
ret = -EINVAL;
goto out;
}
assoc_req->wep_tx_keyidx = index;
}
assoc_req->secinfo.wep_enabled = 1;
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
static int validate_key_index(u16 def_index, u16 raw_index,
......@@ -1644,7 +1642,7 @@ static int wlan_set_encode(struct net_device *dev,
struct assoc_request * assoc_req;
u16 is_default = 0, index = 0, set_tx_key = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
mutex_lock(&adapter->lock);
assoc_req = wlan_get_association_request(adapter);
......@@ -1696,7 +1694,7 @@ static int wlan_set_encode(struct net_device *dev,
}
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1720,7 +1718,7 @@ static int wlan_get_encodeext(struct net_device *dev,
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int index, max_key_len;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
max_key_len = dwrq->length - sizeof(*ext);
if (max_key_len < 0)
......@@ -1783,7 +1781,7 @@ static int wlan_get_encodeext(struct net_device *dev,
ret = 0;
out:
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1808,7 +1806,7 @@ static int wlan_set_encodeext(struct net_device *dev,
int alg = ext->alg;
struct assoc_request * assoc_req;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
mutex_lock(&adapter->lock);
assoc_req = wlan_get_association_request(adapter);
......@@ -1863,8 +1861,8 @@ static int wlan_set_encodeext(struct net_device *dev,
&& (ext->key_len != KEY_LEN_WPA_TKIP))
|| ((alg == IW_ENCODE_ALG_CCMP)
&& (ext->key_len != KEY_LEN_WPA_AES))) {
lbs_pr_debug(1, "Invalid size %d for key of alg"
"type %d.\n",
lbs_deb_wext("invalid size %d for key of alg"
"type %d\n",
ext->key_len,
alg);
ret = -EINVAL;
......@@ -1913,7 +1911,7 @@ static int wlan_set_encodeext(struct net_device *dev,
}
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1928,7 +1926,7 @@ static int wlan_set_genie(struct net_device *dev,
int ret = 0;
struct assoc_request * assoc_req;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
mutex_lock(&adapter->lock);
assoc_req = wlan_get_association_request(adapter);
......@@ -1960,7 +1958,7 @@ static int wlan_set_genie(struct net_device *dev,
}
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -1969,27 +1967,28 @@ static int wlan_get_genie(struct net_device *dev,
struct iw_point *dwrq,
char *extra)
{
int ret = 0;
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (adapter->wpa_ie_len == 0) {
dwrq->length = 0;
LEAVE();
return 0;
goto out;
}
if (dwrq->length < adapter->wpa_ie_len) {
LEAVE();
return -E2BIG;
ret = -E2BIG;
goto out;
}
dwrq->length = adapter->wpa_ie_len;
memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
LEAVE();
return 0;
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -2004,7 +2003,7 @@ static int wlan_set_auth(struct net_device *dev,
int ret = 0;
int updated = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
mutex_lock(&adapter->lock);
assoc_req = wlan_get_association_request(adapter);
......@@ -2096,7 +2095,7 @@ static int wlan_set_auth(struct net_device *dev,
}
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -2105,10 +2104,11 @@ static int wlan_get_auth(struct net_device *dev,
struct iw_param *dwrq,
char *extra)
{
int ret = 0;
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
switch (dwrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
......@@ -2138,12 +2138,11 @@ static int wlan_get_auth(struct net_device *dev,
break;
default:
LEAVE();
return -EOPNOTSUPP;
ret = -EOPNOTSUPP;
}
LEAVE();
return 0;
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -2156,7 +2155,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
u16 dbm;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->disabled) {
wlan_radio_ioctl(priv, RADIO_OFF);
......@@ -2177,14 +2176,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
if (vwrq->fixed == 0)
dbm = 0xffff;
lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm);
lbs_deb_wext("txpower set %d dbm\n", dbm);
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_rf_tx_power,
cmd_act_tx_power_opt_set_low,
cmd_option_waitforrsp, 0, (void *)&dbm);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -2194,7 +2193,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/*
* Note : if dwrq->flags != 0, we should get the relevant SSID from
* the SSID list...
......@@ -2224,7 +2224,7 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
dwrq->flags = 1; /* active */
LEAVE();
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
}
......@@ -2238,7 +2238,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
struct assoc_request * assoc_req;
int ssid_len = dwrq->length;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
/*
* WE-20 and earlier NULL pad the end of the SSID and increment
......@@ -2264,7 +2264,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
ssid.ssidlength = ssid_len;
}
lbs_pr_debug(1, "Requested new SSID = %s\n",
lbs_deb_wext("requested new SSID '%s'\n",
(ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
out:
......@@ -2289,7 +2289,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
mutex_unlock(&adapter->lock);
LEAVE();
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
}
......@@ -2310,12 +2310,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
struct assoc_request * assoc_req;
int ret = 0;
ENTER();
lbs_deb_enter(LBS_DEB_WEXT);
if (awrq->sa_family != ARPHRD_ETHER)
return -EINVAL;
lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
mutex_lock(&adapter->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment