From 9012b28a407511fb355f6d2176a12d4653489672 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Fri, 25 May 2007 11:27:16 -0400 Subject: [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: Holger Schurig Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/11d.c | 137 +++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 66 deletions(-) (limited to 'drivers/net/wireless/libertas/11d.c') diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index e0ecc4d483b..ab76798df0e 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c @@ -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; } -- cgit v1.2.3