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

[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
Loading
Loading
Loading
Loading
+71 −66
Original line number Diff line number Diff line
@@ -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;
}
+48 −51
Original line number Diff line number Diff line
@@ -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);
}


+124 −125

File changed.

Preview size limit exceeded, changes collapsed.

+79 −79

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -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;
	}
Loading