diff options
author | Veronika Kabatova <veronicca114@gmail.com> | 2014-10-25 21:53:38 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-28 08:11:14 (GMT) |
commit | 1e06c3a492107ca392798ccf835288969ea269ec (patch) | |
tree | b63fc30ad53694d89959f32f44ade8e9f0e3bd92 /drivers/staging/vt6655 | |
parent | af969c84571d9d9140122f5f7c8c615e64d2d7fa (diff) | |
download | linux-1e06c3a492107ca392798ccf835288969ea269ec.tar.xz |
staging: vt6655: iwctl.c: Comments fixes
Replace C99 "//" comments by "/* */", remove comments about
adding code, remove commented code (one left there for
debugging of the function)
Signed-off-by: Veronika Kabatova <veronicca114@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r-- | drivers/staging/vt6655/iwctl.c | 510 |
1 files changed, 220 insertions, 290 deletions
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index cc261d7..cbcb152a 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -46,11 +46,10 @@ #endif #include <net/iw_handler.h> -extern unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester +extern unsigned short TxRate_iwconfig; /*--------------------- Static Definitions -------------------------*/ -//2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #define SUPPORTED_WIRELESS_EXT 18 #else @@ -109,10 +108,8 @@ static int iwctl_commit(struct net_device *dev, return 0; } -/* - * Wireless Handler : get protocol name - */ +/* Wireless Handler : get protocol name */ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, char *wrq, @@ -122,10 +119,7 @@ int iwctl_giwname(struct net_device *dev, return 0; } -/* - * Wireless Handler : set scan - */ - +/* Wireless Handler : set scan */ static int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -139,8 +133,8 @@ static int iwctl_siwscan(struct net_device *dev, pr_debug(" SIOCSIWSCAN\n"); - if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! -//send scan event to wpa_Supplicant + if (pDevice->byReAssocCount > 0) { /* reject scan when re-associating! */ +/* send scan event to wpa_Supplicant */ union iwreq_data wrqu; PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); @@ -152,9 +146,9 @@ static int iwctl_siwscan(struct net_device *dev, spin_lock_irq(&pDevice->lock); BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); -//mike add: active scan OR passive scan OR desire_ssid scan +/* active scan OR passive scan OR desire_ssid scan */ if (wrq->length == sizeof(struct iw_scan_req)) { - if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan + if (wrq->flags & IW_SCAN_THIS_ESSID) { /* desire_ssid scan */ memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)abyScanSSID; pItemSSID->byElementID = WLAN_EID_SSID; @@ -171,10 +165,10 @@ static int iwctl_siwscan(struct net_device *dev, spin_unlock_irq(&pDevice->lock); return 0; - } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan + } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { /* passive scan */ pMgmt->eScanType = WMAC_SCAN_PASSIVE; } - } else { //active scan + } else { /* active scan */ pMgmt->eScanType = WMAC_SCAN_ACTIVE; } @@ -185,10 +179,7 @@ static int iwctl_siwscan(struct net_device *dev, return 0; } -/* - * Wireless Handler : get scan results - */ - +/* Wireless Handler : get scan results */ static int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -210,7 +201,7 @@ static int iwctl_giwscan(struct net_device *dev, pr_debug(" SIOCGIWSCAN\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { - // In scanning.. + /* In scanning.. */ return -EAGAIN; } pBSS = &(pMgmt->sBSSList[0]); @@ -219,20 +210,20 @@ static int iwctl_giwscan(struct net_device *dev, break; pBSS = &(pMgmt->sBSSList[jj]); if (pBSS->bActive) { - //ADD mac address + /* ADD mac address */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); - //ADD ssid + /* ADD ssid */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; iwe.u.data.length = pItemSSID->len; iwe.u.data.flags = 1; current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID); - //ADD mode + /* ADD mode */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) @@ -242,7 +233,7 @@ static int iwctl_giwscan(struct net_device *dev, iwe.len = IW_EV_UINT_LEN; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - //ADD frequency + /* ADD frequency */ pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; memset(&iwe, 0, sizeof(iwe)); @@ -251,7 +242,6 @@ static int iwctl_giwscan(struct net_device *dev, iwe.u.freq.e = 0; iwe.u.freq.i = 0; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); - //2008-0409-04, <Add> by Einsn Liu { int f = (int)pBSS->uChannel - 1; @@ -260,13 +250,12 @@ static int iwctl_giwscan(struct net_device *dev, iwe.u.freq.e = 1; } current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); - //ADD quality + /* ADD quality */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm); iwe.u.qual.level = ldBm; iwe.u.qual.noise = 0; -//2008-0409-01, <Add> by Einsn Liu if (-ldBm < 50) iwe.u.qual.qual = 100; else if (-ldBm > 90) @@ -296,14 +285,14 @@ static int iwctl_giwscan(struct net_device *dev, for (kk = 0; kk < 12; kk++) { if (pSuppRates->abyRates[kk] == 0) break; - // Bit rate given in 500 kb/s units (+ 0x80) + /* Bit rate given in 500 kb/s units (+ 0x80) */ iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } for (kk = 0; kk < 8; kk++) { if (pExtSuppRates->abyRates[kk] == 0) break; - // Bit rate given in 500 kb/s units (+ 0x80) + /* Bit rate given in 500 kb/s units (+ 0x80) */ iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } @@ -332,16 +321,13 @@ static int iwctl_giwscan(struct net_device *dev, } } - }// for + } wrq->length = current_ev - extra; return 0; } -/* - * Wireless Handler : set frequency or channel - */ - +/* Wireless Handler : set frequency or channel */ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, @@ -352,7 +338,7 @@ int iwctl_siwfreq(struct net_device *dev, pr_debug(" SIOCSIWFREQ\n"); - // If setting by frequency, convert to a channel + /* If setting by frequency, convert to a channel */ if ((wrq->e == 1) && (wrq->m >= (int) 2.412e8) && (wrq->m <= (int) 2.487e8)) { @@ -364,7 +350,7 @@ int iwctl_siwfreq(struct net_device *dev, wrq->e = 0; wrq->m = c + 1; } - // Setting by channel number + /* Setting by channel number */ if ((wrq->m > 14) || (wrq->e > 0)) rc = -EOPNOTSUPP; else { @@ -375,11 +361,10 @@ int iwctl_siwfreq(struct net_device *dev, dev->name, wrq->m); rc = -EINVAL; } else { - // Yes ! We can set it !!! + /* Yes ! We can set it !!! */ pr_debug(" Set to channel = %d\n", channel); pDevice->uChannel = channel; - //2007-0207-04,<Add> by EinsnLiu - //Make change effect at once + /* Make change effect at once */ pDevice->bCommit = true; } } @@ -387,10 +372,7 @@ int iwctl_siwfreq(struct net_device *dev, return rc; } -/* - * Wireless Handler : get frequency or channel - */ - +/* Wireless Handler : get frequency or channel */ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, @@ -418,10 +400,7 @@ int iwctl_giwfreq(struct net_device *dev, return 0; } -/* - * Wireless Handler : set operation mode - */ - +/* Wireless Handler : set operation mode */ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, @@ -475,10 +454,7 @@ int iwctl_siwmode(struct net_device *dev, return rc; } -/* - * Wireless Handler : get operation mode - */ - +/* Wireless Handler : get operation mode */ int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, @@ -488,7 +464,7 @@ int iwctl_giwmode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); pr_debug(" SIOCGIWMODE\n"); - // If not managed, assume it's ad-hoc + /* If not managed, assume it's ad-hoc */ switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: *wmode = IW_MODE_INFRA; @@ -509,10 +485,7 @@ int iwctl_giwmode(struct net_device *dev, return 0; } -/* - * Wireless Handler : get capability range - */ - +/* Wireless Handler : get capability range */ int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -529,16 +502,18 @@ int iwctl_giwrange(struct net_device *dev, range->min_nwid = 0x0000; range->max_nwid = 0x0000; range->num_channels = 14; - // Should be based on cap_rid.country to give only - // what the current card support + /* + * Should be based on cap_rid.country to give only + * what the current card supports + */ k = 0; for (i = 0; i < 14; i++) { - range->freq[k].i = i + 1; // List index + range->freq[k].i = i + 1; /* List index */ range->freq[k].m = frequency_list[i] * 100000; - range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10 + range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */ } range->num_frequency = k; - // Hum... Should put the right values there + /* Hum... Should put the right values there */ #ifdef Calcu_LinkQual range->max_qual.qual = 100; #else @@ -555,9 +530,10 @@ int iwctl_giwrange(struct net_device *dev, } range->num_bitrates = i; - // Set an indication of the max TCP throughput - // in bit/s that we can expect using this interface. - // May be use for QoS stuff... Jean II + /* + * Set an indication of the max TCP throughput in bit/s that we + * can expect using this interface. May be used for QoS stuff + */ if (i > 2) range->throughput = 5 * 1000 * 1000; else @@ -568,29 +544,29 @@ int iwctl_giwrange(struct net_device *dev, range->min_frag = 256; range->max_frag = 2312; - // the encoding capabilities + /* the encoding capabilities */ range->num_encoding_sizes = 3; - // 64(40) bits WEP + /* 64(40) bits WEP */ range->encoding_size[0] = 5; - // 128(104) bits WEP + /* 128(104) bits WEP */ range->encoding_size[1] = 13; - // 256 bits for WPA-PSK + /* 256 bits for WPA-PSK */ range->encoding_size[2] = 32; - // 4 keys are allowed + /* 4 keys are allowed */ range->max_encoding_tokens = 4; range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; range->min_pmp = 0; - range->max_pmp = 1000000;// 1 secs + range->max_pmp = 1000000; /* 1 secs */ range->min_pmt = 0; - range->max_pmt = 1000000;// 1 secs + range->max_pmt = 1000000; /* 1 secs */ range->pmp_flags = IW_POWER_PERIOD; range->pmt_flags = IW_POWER_TIMEOUT; range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; - // Transmit Power - values are in mW + /* Transmit Power - values are in mW */ range->txpower[0] = 100; range->num_txpower = 1; @@ -604,21 +580,20 @@ int iwctl_giwrange(struct net_device *dev, range->max_retry = 65535; range->min_r_time = 1024; range->max_r_time = 65535 * 1024; - // Experimental measurements - boundary 11/5.5 Mb/s - // Note : with or without the (local->rssi), results - // are somewhat different. - Jean II + /* + * Experimental measurements - boundary 11/5.5 Mb/s + * Note : with or without the (local->rssi), results + * are somewhat different. - Jean II + */ range->avg_qual.qual = 6; - range->avg_qual.level = 176; // -80 dBm + range->avg_qual.level = 176; /* -80 dBm */ range->avg_qual.noise = 0; } return 0; } -/* - * Wireless Handler : set ap mac address - */ - +/* Wireless Handler : set ap mac address */ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, @@ -631,26 +606,26 @@ int iwctl_siwap(struct net_device *dev, pr_debug(" SIOCSIWAP\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { - // In scanning.. + /* In scanning.. */ pr_debug("SIOCSIWAP(??)-->In scanning..\n"); } if (wrq->sa_family != ARPHRD_ETHER) rc = -EINVAL; else { memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); - //2008-0409-05, <Add> by Einsn Liu if ((pDevice->bLinkPass == true) && (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6) == 0)) { return rc; } - //mike :add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) { PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); return rc; } - //mike add: if desired AP is hidden ssid(there are two same BSSID in list), - // then ignore,because you don't known which one to be connect with?? + /* if desired AP is hidden ssid(there are two same BSSID in + * list), then ignore,because you don't known which one + * to be connected with?? + */ { unsigned int ii, uSameBssidNum = 0; @@ -661,7 +636,7 @@ int iwctl_siwap(struct net_device *dev, uSameBssidNum++; } } - if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + if (uSameBssidNum >= 2) { /* hit: desired AP is in hidden ssid mode!!! */ PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); return rc; } @@ -674,10 +649,7 @@ int iwctl_siwap(struct net_device *dev, return rc; } -/* - * Wireless Handler : get ap mac address - */ - +/* Wireless Handler : get ap mac address */ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, @@ -689,7 +661,6 @@ int iwctl_giwap(struct net_device *dev, pr_debug(" SIOCGIWAP\n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); - //2008-0410,<Modify> by Einsn Liu if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) memset(wrq->sa_data, 0, 6); @@ -701,10 +672,7 @@ int iwctl_giwap(struct net_device *dev, return 0; } -/* - * Wireless Handler : get ap list - */ - +/* Wireless Handler : get ap list */ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -774,10 +742,7 @@ exit: return rc; } -/* - * Wireless Handler : set essid - */ - +/* Wireless Handler : set essid */ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -786,18 +751,17 @@ int iwctl_siwessid(struct net_device *dev, struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - //2008-0409-05, <Add> by Einsn Liu unsigned char len; pr_debug(" SIOCSIWESSID\n"); pDevice->fWPA_Authened = false; if (pMgmt->eScanState == WMAC_IS_SCANNING) { - // In scanning.. + /* In scanning.. */ pr_debug("SIOCSIWESSID(??)-->In scanning..\n"); } - // Check if we asked for `any' + /* Check if we asked for 'any' */ if (wrq->flags == 0) { - // Just send an empty SSID list + /* Just send an empty SSID list */ memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF, 6); PRINT_K("set essid to 'any'\n"); @@ -805,7 +769,7 @@ int iwctl_siwessid(struct net_device *dev, return 0; #endif } else { - // Set the SSID + /* Set the SSID */ memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; @@ -817,21 +781,22 @@ int iwctl_siwessid(struct net_device *dev, } else pItemSSID->len = wrq->length; pr_debug("set essid to %s\n", pItemSSID->abySSID); - //2008-0409-05, <Add> by Einsn Liu len = (pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) ? pItemSSID->len : ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len; if ((pDevice->bLinkPass == true) && (memcmp(pItemSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, len) == 0)) return 0; - //mike:need clear desiredBSSID + /* need clear desiredBSSID */ if (pItemSSID->len == 0) { memset(pMgmt->abyDesireBSSID, 0xFF, 6); return 0; } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //Wext wil order another command of siwap to link with desired AP, - //so here need not associate?? + /* + * Wext wil order another command of siwap to link with desired + * AP, so here need not associate?? + */ if (pDevice->bWPASuppWextEnabled == true) { /*******search if in hidden ssid mode ****/ { @@ -852,8 +817,12 @@ int iwctl_siwessid(struct net_device *dev, pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); - } else { //mike:to find out if that desired SSID is a hidden-ssid AP , - // by means of judging if there are two same BSSID exist in list ? + } else { /* + * to find out if that desired SSID + * is a hidden-ssid AP, by means of + * judging if there are two same + * BSSID exist in list ? + */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, @@ -861,10 +830,10 @@ int iwctl_siwessid(struct net_device *dev, uSameBssidNum++; } } - if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + if (uSameBssidNum >= 2) { /* hit: desired AP is in hidden ssid mode!!! */ pr_debug("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *)pDevice); - pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! + pMgmt->eScanType = WMAC_SCAN_PASSIVE; /* this scan type, you'll submit scan result! */ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } @@ -883,10 +852,7 @@ int iwctl_siwessid(struct net_device *dev, return 0; } -/* - * Wireless Handler : get essid - */ - +/* Wireless Handler : get essid */ int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -898,25 +864,23 @@ int iwctl_giwessid(struct net_device *dev, pr_debug(" SIOCGIWESSID\n"); - // Note : if wrq->u.data.flags != 0, we should - // get the relevant SSID from the SSID list... + /* + * Note : if wrq->u.data.flags != 0, we should get the relevant SSID + * from the SSID list... + */ - // Get the current SSID + /* Get the current SSID */ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; memcpy(extra, pItemSSID->abySSID , pItemSSID->len); extra[pItemSSID->len] = '\0'; wrq->length = pItemSSID->len + 1; - //2008-0409-03, <Add> by Einsn Liu wrq->length = pItemSSID->len; - wrq->flags = 1; // active + wrq->flags = 1; /* active */ return 0; } -/* - * Wireless Handler : set data rate - */ - +/* Wireless Handler : set data rate */ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -934,19 +898,18 @@ int iwctl_siwrate(struct net_device *dev, return rc; } - // First : get a valid bit rate value + /* First : get a valid bit rate value */ - // Which type of value + /* Which type of value */ if ((wrq->value < 13) && (wrq->value >= 0)) { - // Setting by rate index - // Find value in the magic rate table + /* Setting by rate index, Find value in the magic rate table */ brate = wrq->value; } else { - // Setting by frequency value + /* Setting by frequency value */ u8 normvalue = (u8) (wrq->value/500000); - // Check if rate is valid + /* Check if rate is valid */ for (i = 0; i < 13; i++) { if (normvalue == abySupportedRates[i]) { brate = i; @@ -954,9 +917,9 @@ int iwctl_siwrate(struct net_device *dev, } } } - // -1 designed the max rate (mostly auto mode) + /* -1 designed the max rate (mostly auto mode) */ if (wrq->value == -1) { - // Get the highest available rate + /* Get the highest available rate */ for (i = 0; i < 13; i++) { if (abySupportedRates[i] == 0) break; @@ -965,17 +928,15 @@ int iwctl_siwrate(struct net_device *dev, brate = i - 1; } - // Check that it is valid - // brate is index of abySupportedRates[] + /* Check that it is valid, brate is index of abySupportedRates[] */ if (brate > 13) { rc = -EINVAL; return rc; } - // Now, check if we want a fixed or auto value + /* Now, check if we want a fixed or auto value */ if (wrq->fixed != 0) { - // Fixed mode - // One rate, fixed + /* Fixed mode, One rate, fixed */ pr_debug("Rate Fix\n"); pDevice->bFixRate = true; if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { @@ -995,25 +956,18 @@ int iwctl_siwrate(struct net_device *dev, return rc; } -/* - * Wireless Handler : get data rate - */ - +/* Wireless Handler : get data rate */ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { struct vnt_private *pDevice = netdev_priv(dev); -//2007-0118-05,<Mark> by EinsnLiu -//Mark the unnecessary sentences. -// PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - +/* Mark the unnecessary sentences. */ pr_debug(" SIOCGIWRATE\n"); { unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; int brate = 0; -//2008-5-8 <modify> by chester if (pDevice->bLinkPass) { if (pDevice->bFixRate == true) { if (pDevice->uConnectionRate < 13) { @@ -1032,7 +986,7 @@ int iwctl_giwrate(struct net_device *dev, } else brate = 0; wrq->value = brate * 500000; - // If more than one rate, set auto + /* If more than one rate, set auto */ if (pDevice->bFixRate == true) wrq->fixed = true; } @@ -1040,10 +994,7 @@ int iwctl_giwrate(struct net_device *dev, return 0; } -/* - * Wireless Handler : set rts threshold - */ - +/* Wireless Handler : set rts threshold */ int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1069,10 +1020,7 @@ int iwctl_siwrts(struct net_device *dev, return 0; } -/* - * Wireless Handler : get rts - */ - +/* Wireless Handler : get rts */ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1088,10 +1036,7 @@ int iwctl_giwrts(struct net_device *dev, return 0; } -/* - * Wireless Handler : set fragment threshold - */ - +/* Wireless Handler : set fragment threshold */ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1108,17 +1053,14 @@ int iwctl_siwfrag(struct net_device *dev, if ((fthr < 256) || (fthr > 2312)) { rc = -EINVAL; } else { - fthr &= ~0x1; // Get an even value + fthr &= ~0x1; /* Get an even value */ pDevice->wFragmentationThreshold = (u16)fthr; } return rc; } -/* - * Wireless Handler : get fragment threshold - */ - +/* Wireless Handler : get fragment threshold */ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1134,9 +1076,7 @@ int iwctl_giwfrag(struct net_device *dev, return 0; } -/* - * Wireless Handler : set retry threshold - */ +/* Wireless Handler : set retry threshold */ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1158,7 +1098,7 @@ int iwctl_siwretry(struct net_device *dev, else if (wrq->flags & IW_RETRY_MIN) pDevice->byShortRetryLimit = wrq->value; else { - // No modifier : set both + /* No modifier : set both */ pDevice->byShortRetryLimit = wrq->value; pDevice->byLongRetryLimit = wrq->value; } @@ -1169,9 +1109,7 @@ int iwctl_siwretry(struct net_device *dev, return rc; } -/* - * Wireless Handler : get retry threshold - */ +/* Wireless Handler : get retry threshold */ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1180,12 +1118,12 @@ int iwctl_giwretry(struct net_device *dev, struct vnt_private *pDevice = netdev_priv(dev); pr_debug(" SIOCGIWRETRY\n"); - wrq->disabled = 0; // Can't be disabled + wrq->disabled = 0; /* Can't be disabled */ - // Note : by default, display the min retry number + /* Note : by default, display the min retry number */ if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { wrq->flags = IW_RETRY_LIFETIME; - wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms + wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; /* ms */ } else if ((wrq->flags & IW_RETRY_MAX)) { wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrq->value = (int)pDevice->byLongRetryLimit; @@ -1199,9 +1137,7 @@ int iwctl_giwretry(struct net_device *dev, return 0; } -/* - * Wireless Handler : set encode mode - */ +/* Wireless Handler : set encode mode */ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -1213,28 +1149,30 @@ int iwctl_siwencode(struct net_device *dev, int ii, uu, rc = 0; int index = (wrq->flags & IW_ENCODE_INDEX); -//2007-0207-07,<Modify> by EinsnLiu -//There are some problems when using iwconfig encode/key command to set the WEP key. -//I almost rewrite this function. -//now it support:(assume the wireless interface's name is eth0) -//iwconfig eth0 key [1] 1122334455 open /*set key stirng to index 1,and driver using key index is set to 1*/ -//iwconfig eth0 key [3] /*set driver using key index to 3,the key string no change */ -//iwconfig eth0 key 1122334455 /*set key string to driver using index*/ -//iwconfig eth0 key restricted /*enable share key*/ +/* + * There are some problems when using iwconfig encode/key command to set the + * WEP key. I almost rewrite this function. Now it supports: (assume the + * wireless interface's name is eth0) + * iwconfig eth0 key [1] 1122334455 open -> set key stirng to index 1, and + driver using key index is set to 1 + * iwconfig eth0 key [3] -> set driver using key index to 3,the key string no change + * iwconfig eth0 key 1122334455 -> set key string to driver using index + * iwconfig eth0 key restricted -> enable share key + */ PSKeyTable pkeytab; pr_debug(" SIOCSIWENCODE\n"); if ((wrq->flags & IW_ENCODE_DISABLED) == 0) { - //Not disable encryption + /* Not disable encryption */ if (dwKeyIndex > WLAN_WEP_NKEYS) { rc = -EINVAL; return rc; } - if (dwKeyIndex < 1 && ((wrq->flags & IW_ENCODE_NOKEY) == 0)) {//set default key + if (dwKeyIndex < 1 && ((wrq->flags & IW_ENCODE_NOKEY) == 0)) { /* set default key */ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) dwKeyIndex = pDevice->byKeyIndex; else @@ -1243,13 +1181,13 @@ int iwctl_siwencode(struct net_device *dev, dwKeyIndex--; } - // Check the size of the key + /* Check the size of the key */ if (wrq->length > WLAN_WEP232_KEYLEN) { rc = -EINVAL; return rc; } - if (wrq->length > 0) {//have key + if (wrq->length > 0) { /* have key */ if (wrq->length == WLAN_WEP232_KEYLEN) { pr_debug("Set 232 bit wep key\n"); @@ -1258,7 +1196,7 @@ int iwctl_siwencode(struct net_device *dev, } else if (wrq->length == WLAN_WEP40_KEYLEN) { pr_debug("Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); - } else {//no support length + } else { /* no support length */ rc = -EINVAL; return rc; } @@ -1289,8 +1227,11 @@ int iwctl_siwencode(struct net_device *dev, pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } else if (index > 0) { - //when the length is 0 the request only changes the default transmit key index - //check the new key if it has a non zero length + /* + * when the length is 0 the request only changes the + * default transmit key index, check the new key if it + * has a non zero length + */ if (pDevice->bEncryptionEnable == false) { rc = -EINVAL; return rc; @@ -1307,7 +1248,7 @@ int iwctl_siwencode(struct net_device *dev, pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex = dwKeyIndex | (1 << 31); } - } else {//disable the key + } else { /* disable the key */ pr_debug("Disable WEP function\n"); if (pDevice->bEncryptionEnable == false) return 0; @@ -1321,7 +1262,6 @@ int iwctl_siwencode(struct net_device *dev, spin_unlock_irq(&pDevice->lock); } } -//End Modify,Einsn if (wrq->flags & IW_ENCODE_RESTRICTED) { pr_debug("Enable WEP & ShareKey System\n"); @@ -1351,7 +1291,7 @@ int iwctl_giwencode(struct net_device *dev, if (index > WLAN_WEP_NKEYS) return -EINVAL; - if (index < 1) {//get default key + if (index < 1) { /* get default key */ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) index = pDevice->byKeyIndex; else @@ -1361,9 +1301,9 @@ int iwctl_giwencode(struct net_device *dev, } memset(abyKey, 0, WLAN_WEP232_KEYLEN); - // Check encryption mode + /* Check encryption mode */ wrq->flags = IW_ENCODE_NOKEY; - // Is WEP enabled ??? + /* Is WEP enabled ??? */ if (pDevice->bEncryptionEnable) wrq->flags |= IW_ENCODE_ENABLED; else @@ -1376,7 +1316,7 @@ int iwctl_giwencode(struct net_device *dev, wrq->length = 0; if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled || - pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) {//get wpa pairwise key + pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) { /* get wpa pairwise key */ if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) { wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); @@ -1393,9 +1333,7 @@ int iwctl_giwencode(struct net_device *dev, return 0; } -/* - * Wireless Handler : set power mode - */ +/* Wireless Handler : set power mode */ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1443,9 +1381,7 @@ int iwctl_siwpower(struct net_device *dev, return rc; } -/* - * Wireless Handler : get power mode - */ +/* Wireless Handler : get power mode */ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1473,9 +1409,7 @@ int iwctl_giwpower(struct net_device *dev, return 0; } -/* - * Wireless Handler : get Sensitivity - */ +/* Wireless Handler : get Sensitivity */ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1497,7 +1431,6 @@ int iwctl_giwsens(struct net_device *dev, return 0; } -//2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT int iwctl_siwauth(struct net_device *dev, @@ -1508,7 +1441,7 @@ int iwctl_siwauth(struct net_device *dev, struct vnt_private *pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; - static int wpa_version = 0; //must be static to save the last value,einsn liu + static int wpa_version = 0; /* must be static to save the last value */ static int pairwise = 0; pr_debug(" SIOCSIWAUTH\n"); @@ -1532,7 +1465,7 @@ int iwctl_siwauth(struct net_device *dev, else if (pairwise == IW_AUTH_CIPHER_WEP40 || pairwise == IW_AUTH_CIPHER_WEP104) pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; else if (pairwise == IW_AUTH_CIPHER_NONE) - ; /* do nothing,einsn liu */ + ; /* do nothing */ else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; @@ -1645,7 +1578,7 @@ int iwctl_siwgenie(struct net_device *dev, pMgmt->wWPAIELen = 0; } -out://not completely ...not necessary in wpa_supplicant 0.5.8 +out: /* not completely ...not necessary in wpa_supplicant 0.5.8 */ return ret; } @@ -1682,7 +1615,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct vnt_private *pDevice = netdev_priv(dev); struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct viawget_wpa_param *param = NULL; -//original member +/* original member */ enum wpa_alg alg_name; u8 addr[6]; int key_idx, set_tx = 0; @@ -1699,7 +1632,7 @@ int iwctl_siwencodeext(struct net_device *dev, if (param == NULL) return -ENOMEM; -//recover alg_name +/* recover alg_name */ switch (ext->alg) { case IW_ENCODE_ALG_NONE: alg_name = WPA_ALG_NONE; @@ -1718,19 +1651,19 @@ int iwctl_siwencodeext(struct net_device *dev, ret = -ENOMEM; goto error; } -//recover addr +/* recover addr */ ether_addr_copy(addr, ext->addr.sa_data); -//recover key_idx +/* recover key_idx */ key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; -//recover set_tx +/* recover set_tx */ if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) set_tx = 1; -//recover seq,seq_len +/* recover seq,seq_len */ if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { seq_len = IW_ENCODE_SEQ_MAX_SIZE; memcpy(seq, ext->rx_seq, seq_len); } -//recover key,key_len +/* recover key,key_len */ if (ext->key_len) { key_len = ext->key_len; memcpy(key, &ext->key[0], key_len); @@ -1740,7 +1673,7 @@ int iwctl_siwencodeext(struct net_device *dev, if (key_len > 0) { memcpy(key_array, key, key_len); if (key_len == 32) { - // notice ! the oder + /* notice ! the oder */ memcpy(&key_array[16], &key[24], 8); memcpy(&key_array[24], &key[16], 8); } @@ -1756,8 +1689,10 @@ int iwctl_siwencodeext(struct net_device *dev, param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq_len = seq_len; -//****set if current action is Network Manager count?? -//****this method is so foolish,but there is no other way??? +/* + * set if current action is Network Manager count?? this method is so + * foolish,but there is no other way??? + */ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { if (param->u.wpa_key.key_index == 0) pDevice->bwextcount++; @@ -1777,7 +1712,6 @@ int iwctl_siwencodeext(struct net_device *dev, pDevice->bwextcount = 0; pDevice->bWPASuppWextEnabled = true; } -//****** spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, true); @@ -1817,13 +1751,15 @@ int iwctl_siwmlme(struct net_device *dev, } switch (mime.cmd) { case IW_MLME_DEAUTH: - //this command seems to be not complete,please test it --einsnliu - //bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason); + /* + * this command seems to be not complete,please test it --einsnliu + * bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason); + */ break; case IW_MLME_DISASSOC: if (pDevice->bLinkPass == true) { pr_debug("iwctl_siwmlme--->send DISASSOCIATE\n"); - //clear related flags + /* clear related flags */ memset(pMgmt->abyDesireBSSID, 0xFF, 6); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); @@ -1838,76 +1774,70 @@ int iwctl_siwmlme(struct net_device *dev, #endif -/*------------------------------------------------------------------*/ -/* - * Structures to export the Wireless Handlers - */ - +/* Structures to export the Wireless Handlers */ static const iw_handler iwctl_handler[] = { - (iw_handler) iwctl_commit, // SIOCSIWCOMMIT - (iw_handler) NULL, // SIOCGIWNAME - (iw_handler) NULL, // SIOCSIWNWID - (iw_handler) NULL, // SIOCGIWNWID - (iw_handler) NULL, // SIOCSIWFREQ - (iw_handler) NULL, // SIOCGIWFREQ - (iw_handler) NULL, // SIOCSIWMODE - (iw_handler) NULL, // SIOCGIWMODE - (iw_handler) NULL, // SIOCSIWSENS - (iw_handler) NULL, // SIOCGIWSENS - (iw_handler) NULL, // SIOCSIWRANGE - (iw_handler) iwctl_giwrange, // SIOCGIWRANGE - (iw_handler) NULL, // SIOCSIWPRIV - (iw_handler) NULL, // SIOCGIWPRIV - (iw_handler) NULL, // SIOCSIWSTATS - (iw_handler) NULL, // SIOCGIWSTATS - (iw_handler) NULL, // SIOCSIWSPY - (iw_handler) NULL, // SIOCGIWSPY - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWAP - (iw_handler) NULL, // SIOCGIWAP - (iw_handler) NULL, // -- hole -- 0x16 - (iw_handler) NULL, // SIOCGIWAPLIST - (iw_handler) iwctl_siwscan, // SIOCSIWSCAN - (iw_handler) iwctl_giwscan, // SIOCGIWSCAN - (iw_handler) NULL, // SIOCSIWESSID - (iw_handler) NULL, // SIOCGIWESSID - (iw_handler) NULL, // SIOCSIWNICKN - (iw_handler) NULL, // SIOCGIWNICKN - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWRATE 0x20 - (iw_handler) NULL, // SIOCGIWRATE - (iw_handler) NULL, // SIOCSIWRTS - (iw_handler) NULL, // SIOCGIWRTS - (iw_handler) NULL, // SIOCSIWFRAG - (iw_handler) NULL, // SIOCGIWFRAG - (iw_handler) NULL, // SIOCSIWTXPOW - (iw_handler) NULL, // SIOCGIWTXPOW - (iw_handler) NULL, // SIOCSIWRETRY - (iw_handler) NULL, // SIOCGIWRETRY - (iw_handler) NULL, // SIOCSIWENCODE - (iw_handler) NULL, // SIOCGIWENCODE - (iw_handler) NULL, // SIOCSIWPOWER - (iw_handler) NULL, // SIOCGIWPOWER - -//2008-0409-07, <Add> by Einsn Liu - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWGENIE - (iw_handler) NULL, // SIOCGIWGENIE - (iw_handler) NULL, // SIOCSIWAUTH - (iw_handler) NULL, // SIOCGIWAUTH - (iw_handler) NULL, // SIOCSIWENCODEEXT - (iw_handler) NULL, // SIOCGIWENCODEEXT - (iw_handler) NULL, // SIOCSIWPMKSA - (iw_handler) NULL, // -- hole -- + (iw_handler) iwctl_commit, /* SIOCSIWCOMMIT */ + (iw_handler) NULL, /* SIOCGIWNAME */ + (iw_handler) NULL, /* SIOCSIWNWID */ + (iw_handler) NULL, /* SIOCGIWNWID */ + (iw_handler) NULL, /* SIOCSIWFREQ */ + (iw_handler) NULL, /* SIOCGIWFREQ */ + (iw_handler) NULL, /* SIOCSIWMODE */ + (iw_handler) NULL, /* SIOCGIWMODE */ + (iw_handler) NULL, /* SIOCSIWSENS */ + (iw_handler) NULL, /* SIOCGIWSENS */ + (iw_handler) NULL, /* SIOCSIWRANGE */ + (iw_handler) iwctl_giwrange, /* SIOCGIWRANGE */ + (iw_handler) NULL, /* SIOCSIWPRIV */ + (iw_handler) NULL, /* SIOCGIWPRIV */ + (iw_handler) NULL, /* SIOCSIWSTATS */ + (iw_handler) NULL, /* SIOCGIWSTATS */ + (iw_handler) NULL, /* SIOCSIWSPY */ + (iw_handler) NULL, /* SIOCGIWSPY */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWAP */ + (iw_handler) NULL, /* SIOCGIWAP */ + (iw_handler) NULL, /* -- hole -- 0x16 */ + (iw_handler) NULL, /* SIOCGIWAPLIST */ + (iw_handler) iwctl_siwscan, /* SIOCSIWSCAN */ + (iw_handler) iwctl_giwscan, /* SIOCGIWSCAN */ + (iw_handler) NULL, /* SIOCSIWESSID */ + (iw_handler) NULL, /* SIOCGIWESSID */ + (iw_handler) NULL, /* SIOCSIWNICKN */ + (iw_handler) NULL, /* SIOCGIWNICKN */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWRATE 0x20 */ + (iw_handler) NULL, /* SIOCGIWRATE */ + (iw_handler) NULL, /* SIOCSIWRTS */ + (iw_handler) NULL, /* SIOCGIWRTS */ + (iw_handler) NULL, /* SIOCSIWFRAG */ + (iw_handler) NULL, /* SIOCGIWFRAG */ + (iw_handler) NULL, /* SIOCSIWTXPOW */ + (iw_handler) NULL, /* SIOCGIWTXPOW */ + (iw_handler) NULL, /* SIOCSIWRETRY */ + (iw_handler) NULL, /* SIOCGIWRETRY */ + (iw_handler) NULL, /* SIOCSIWENCODE */ + (iw_handler) NULL, /* SIOCGIWENCODE */ + (iw_handler) NULL, /* SIOCSIWPOWER */ + (iw_handler) NULL, /* SIOCGIWPOWER */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWGENIE */ + (iw_handler) NULL, /* SIOCGIWGENIE */ + (iw_handler) NULL, /* SIOCSIWAUTH */ + (iw_handler) NULL, /* SIOCGIWAUTH */ + (iw_handler) NULL, /* SIOCSIWENCODEEXT */ + (iw_handler) NULL, /* SIOCGIWENCODEEXT */ + (iw_handler) NULL, /* SIOCSIWPMKSA */ + (iw_handler) NULL, /* -- hole -- */ }; static const iw_handler iwctl_private_handler[] = { - NULL, // SIOCIWFIRSTPRIV + NULL, /* SIOCIWFIRSTPRIV */ }; struct iw_priv_args iwctl_private_args[] = { |