Changeset 19021


Ignore:
Timestamp:
04/13/12 11:24:35 (14 months ago)
Author:
BrainSlayer
Message:

calculate rates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/tools/site_survey_broadcom.c

    r19004 r19021  
    351351 
    352352        for (mcs_bit = 0; mcs_bit < 16 * 8; mcs_bit++) { 
    353                 unsigned int mcs_octet = mcs_bit/8; 
     353                unsigned int mcs_octet = mcs_bit / 8; 
    354354                unsigned int MCS_RATE_BIT = 1 << mcs_bit % 8; 
    355355                bool mcs_rate_idx_set; 
     
    358358 
    359359                if (!mcs_rate_idx_set) 
    360                         continue; 
     360                        break; 
    361361 
    362362                if (prev_bit != mcs_bit - 1) { 
     
    368368                prev_bit = mcs_bit; 
    369369        } 
    370  
    371370        if (prev_cont) { 
    372                 if (prev_bit == 7) return 150; 
    373                 if (prev_bit == 15) return 300; 
    374                 if (prev_bit == 23) return 450; 
    375                 if (prev_bit == 31) return 600; 
    376                 } 
     371                if (prev_bit == 7) 
     372                        return 150; 
     373                if (prev_bit == 15) 
     374                        return 300; 
     375                if (prev_bit == 23) 
     376                        return 450; 
     377                if (prev_bit == 31) 
     378                        return 600; 
     379        } 
    377380        return 0; 
    378381} 
    379382 
     383int get_legacy(unsigned char *rates, int count) 
     384{ 
     385        int r, b, i; 
     386        int maxrate = 0; 
     387        for (i = 0; i < count; i++) { 
     388                r = rates[i] & 0x7f; 
     389                //b = rates[i] & 0x80; 
     390                if (r == 0) 
     391                        break; 
     392                if (r > maxrate) 
     393                        maxrate = r; 
     394        } 
     395        return maxrate / 2; 
     396} 
    380397 
    381398int site_survey_main(int argc, char *argv[]) 
     
    446463                site_survey_lists[i].channel = bss_info->chanspec & 0xff; 
    447464#endif 
    448                 site_survey_lists[i].frequency = ieee80211_ieee2mhz(site_survey_lists[i].channel); 
     465                site_survey_lists[i].frequency = 
     466                    ieee80211_ieee2mhz(site_survey_lists[i].channel); 
    449467                site_survey_lists[i].RSSI = bss_info->RSSI; 
    450468                site_survey_lists[i].phy_noise = bss_info->phy_noise; 
    451469                site_survey_lists[i].beacon_period = bss_info->beacon_period; 
    452470                site_survey_lists[i].capability = bss_info->capability; 
    453                 site_survey_lists[i].rate_count = get_mcs_max(bss_info->basic_mcs); 
     471                site_survey_lists[i].rate_count = 
     472                    get_mcs_max(bss_info->basic_mcs); 
     473                if (!site_survey_lists[i].rate_count) 
     474                        site_survey_lists[i].rate_count = 
     475                            get_legacy(bss_info->rateset.rates, 
     476                                       bss_info->rateset.count); 
     477 
    454478                site_survey_lists[i].dtim_period = bss_info->dtim_period; 
    455479                strcpy(site_survey_lists[i].ENCINFO, getEncInfo(bss_info)); 
     
    508532        return FALSE; 
    509533} 
     534 
     535#ifdef TEST 
     536 
     537void main(int argc, char *argv[]) 
     538{ 
     539        site_survey_main(argc, argv); 
     540 
     541} 
     542 
     543#endif 
Note: See TracChangeset for help on using the changeset viewer.