diff options
| author | Rajesh Chauhan <rajeshc@qca.qualcomm.com> | 2014-08-15 18:16:09 -0700 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-08-18 23:41:11 -0700 |
| commit | b6ffcf64ec3199079604d2f7e02f358b677e78b7 (patch) | |
| tree | a7b6b768071d563b4d7a6bf7d7d9ae09276d5c25 | |
| parent | 61310106281ee1ef2215837bbafee62749ada45a (diff) | |
qcacld: Pass Operating class for the Preferred TDLS Offchannel to target
Pass Operating class for the Preferred TDLS Offchannel to target.
Move static table of operating classes from LIM to regdomain.
Change-Id: Ie4c94e96716a6839b325e4b03552ae7b9d20884c
CRs-Fixed: 710529
| -rw-r--r-- | CORE/MAC/src/pe/lim/limProcessTdls.c | 293 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limUtils.h | 17 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/regdomain.c | 154 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/regdomain_common.h | 30 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 9 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrApiRoam.c | 139 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_Api.c | 15 | ||||
| -rw-r--r-- | CORE/WDA/inc/legacy/halMsgApi.h | 1 |
8 files changed, 389 insertions, 269 deletions
diff --git a/CORE/MAC/src/pe/lim/limProcessTdls.c b/CORE/MAC/src/pe/lim/limProcessTdls.c index fb8058ff464d..25e1c339d7fb 100644 --- a/CORE/MAC/src/pe/lim/limProcessTdls.c +++ b/CORE/MAC/src/pe/lim/limProcessTdls.c @@ -81,6 +81,7 @@ #include "limAssocUtils.h" #include "dphHashTable.h" #include "wlan_qct_wda.h" +#include "regdomain_common.h" /* define NO_PAD_TDLS_MIN_8023_SIZE to NOT padding: See CR#447630 There was IOT issue with cisco 1252 open mode, where it pads @@ -118,79 +119,6 @@ tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac, tDot11fIEVHTCaps *pPeerVHTCaps, tpPESession psessionEntry); ePhyChanBondState limGetHTCBState(ePhyChanBondState aniCBMode); -/*only 31 op classes are available, 1 entry for current op class*/ -static tDot11fIESuppOperatingClasses op_classes = {0}; - -op_class_map_t global_op_class[] = { - {81, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, - {82, 25, BW20, {14}}, - {83, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, - {84, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, - {115, 20, BW20, {36, 40, 44, 48}}, - {116, 40, BW40PLUS, {36, 44}}, - {117, 40, BW40MINUS, {40, 48}}, - {118, 20, BW20, {52, 56, 60, 64}}, - {119, 40, BW40PLUS, {52, 60}}, - {120, 40, BW40MINUS, {56, 64}}, - {121, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, - {122, 40, BW40PLUS, {100, 108, 116, 124, 132}}, - {123, 40, BW40MINUS, {104, 112, 120, 128, 136}}, - {125, 20, BW20, {149, 153, 157, 161, 165, 169}}, - {126, 40, BW40PLUS, {149, 157}}, - {127, 40, BW40MINUS, {153, 161}}, - {0, 0, 0, {0}}, - -};/*end global_op_class*/ - -op_class_map_t us_op_class[] = { - {1, 20, BW20, {36, 40, 44, 48}}, - {2, 20, BW20, {52, 56, 60, 64}}, - {4, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, - {5, 20, BW20, {149, 153, 157, 161, 165}}, - {22, 40, BW40PLUS, {36, 44}}, - {23, 40, BW40PLUS, {52, 60}}, - {24, 40, BW40PLUS, {100, 108, 116, 124, 132}}, - {26, 40, BW40PLUS, {149, 157}}, - {27, 40, BW40MINUS, {40, 48}}, - {28, 40, BW40MINUS, {56, 64}}, - {29, 40, BW40MINUS, {104, 112, 120, 128, 136}}, - {31, 40, BW40MINUS, {153, 161}}, - {32, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7}}, - {33, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11}}, - {0, 0, 0, {0}}, -};/*end us_op_class*/ - -op_class_map_t euro_op_class[] = { - {1, 20, BW20, {36, 40, 44, 48}}, - {2, 20, BW20, {52, 56, 60, 64}}, - {3, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, - {4, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, - {5, 40, BW40PLUS, {36, 44}}, - {6, 40, BW40PLUS, {52, 60}}, - {7, 40, BW40PLUS, {100, 108, 116, 124, 132}}, - {8, 40, BW40MINUS, {40, 48}}, - {9, 40, BW40MINUS, {56, 64}}, - {10, 40, BW40MINUS, {104, 112, 120, 128, 136}}, - {11, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, - {12, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, - {17, 20, BW20, {149, 153, 157, 161, 165, 169}}, - {0, 0, 0, {0}}, -};/*end euro_op_class*/ - -op_class_map_t japan_op_class[] = { - {1, 20, BW20, {36, 40, 44, 48}}, - {30, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, - {31, 25, BW20, {14}}, - {32, 20, BW20, {52, 56, 60, 64}}, - {34, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, - {36, 40, BW40PLUS, {36, 44}}, - {37, 40, BW40PLUS, {52, 60}}, - {39, 40, BW40PLUS, {100, 108, 116, 124, 132}}, - {41, 40, BW40MINUS, {40, 48}}, - {42, 40, BW40MINUS, {56, 64}}, - {44, 40, BW40MINUS, {104, 112, 120, 128, 136}}, - {0, 0, 0, {0}}, -};/*end japan_op_class*/ /* * TDLS data frames will go out/come in as non-qos data. @@ -2460,7 +2388,10 @@ void PopulateDot11fTdlsOffchannelParams(tpAniSirGlobal pMac, tANI_U8 validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; tANI_U8 i; tANI_U8 valid_count = 0; + tANI_U8 chanOffset; tANI_U8 op_class; + tANI_U8 numClasses; + tANI_U8 classes[SIR_MAC_MAX_SUPP_OPER_CLASSES]; if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, validChan, &numChans) != eSIR_SUCCESS) { @@ -2489,33 +2420,58 @@ void PopulateDot11fTdlsOffchannelParams(tpAniSirGlobal pMac, suppChannels->num_bands = valid_count; suppChannels->present = 1 ; - /*Get present operating class based on current operating channel*/ - op_class = limGetOPClassFromChannel( - pMac->scan.countryCodeCurrent, - psessionEntry->currentOperChannel, - psessionEntry->htSecondaryChannelOffset); + + /* find channel offset and get op class for current operating channel */ + switch (psessionEntry->htSecondaryChannelOffset) + { + case PHY_SINGLE_CHANNEL_CENTERED: + chanOffset = BW20; + break; + + case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: + chanOffset = BW40_LOW_PRIMARY; + break; + + case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: + chanOffset = BW40_HIGH_PRIMARY; + break; + + default: + chanOffset = BWALL; + break; + + } + + op_class = regdm_get_opclass_from_channel(pMac->scan.countryCodeCurrent, + psessionEntry->currentOperChannel, + chanOffset); if (op_class == 0) { - PELOGE(limLog(pMac, LOGE, FL("Present Operating class is Wrong!!!"));) + PELOGE(limLog(pMac, LOGE, FL("Present Operating class is wrong, countryCodeCurrent: %s, currentOperChannel: %d, htSecondaryChannelOffset: %d, chanOffset: %d"), + pMac->scan.countryCodeCurrent, + psessionEntry->currentOperChannel, + psessionEntry->htSecondaryChannelOffset, + chanOffset);) } else { - PELOGE(limLog(pMac, LOG1, FL("Present Operating channel=%d offset=%d class=%d"), + PELOGE(limLog(pMac, LOG1, FL("Present Operating channel: %d chanOffset: %d, op class=%d"), psessionEntry->currentOperChannel, - psessionEntry->htSecondaryChannelOffset, + chanOffset, op_class);) } suppOperClasses->present = 1; suppOperClasses->classes[0] = op_class; - /*Fill operating classes from static array*/ - suppOperClasses->num_classes = op_classes.num_classes; - for ( i = 0U; i < suppOperClasses->num_classes; i++) - { - suppOperClasses->classes[i+1] = op_classes.classes[i]; + regdm_get_curr_opclasses(&numClasses, &classes[0]); + + for (i = 0; i < numClasses; i++) + { + suppOperClasses->classes[i+1] = classes[i]; } - /*increment for present operating class*/ - suppOperClasses->num_classes++; + /* add one for present operating class, added in the beginning */ + suppOperClasses->num_classes = numClasses + 1; + return ; } /* @@ -3096,165 +3052,4 @@ tSirRetStatus limDeleteTDLSPeers(tpAniSirGlobal pMac, tpPESession psessionEntry) return eSIR_SUCCESS; } - -tANI_U8 limGetOPClassFromChannel(tANI_U8 *country, - tANI_U8 channel, - tANI_U8 offset) -{ - op_class_map_t *class = NULL; - tANI_U16 i = 0; - - if (VOS_TRUE == vos_mem_compare(country,"US", 2)) { - - class = us_op_class; - - } else if (VOS_TRUE == vos_mem_compare(country,"EU", 2)) { - - class = euro_op_class; - - } else if (VOS_TRUE == vos_mem_compare(country,"JP", 2)) { - - class = japan_op_class; - - } else { - - class = global_op_class; - - } - - while (class->op_class) - { - if ((offset == class->offset) || (offset == BWALL)) - { - for (i=0; (i < 15 && class->channels[i]); i++) - { - if (channel == class->channels[i]) - return class->op_class; - } - } - class++; - } - return 0; -} - -tANI_BOOLEAN CheckAndAddOP(tANI_U8 class) -{ - tANI_U8 i; - - for (i=0; i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); i++) - { - /*0 is an invalid class. If class is already present ignore*/ - if (class == op_classes.classes[i]) - return FALSE; - if(op_classes.classes[i] == 0) - { - return TRUE; - } - } - //limLog(pMac, LOGE, FL("No space left for class = %d"), class); - return FALSE; -} - -void limInitOperatingClasses( tHalHandle hHal ) -{ - - tANI_U8 Index = 0; - tANI_U8 class = 0; - tANI_U8 i = 0; - tANI_U8 j = 0; - tANI_U8 swap = 0; - tANI_U8 numChannels = 0; - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - limLog(pMac, LOG1, FL("Current Country = %c%c"), - pMac->scan.countryCodeCurrent[0], - pMac->scan.countryCodeCurrent[1]); - - vos_mem_set(op_classes.classes, sizeof(op_classes.classes), 0); - numChannels = pMac->scan.baseChannels.numChannels; - limLog(pMac, LOG1, "Num of base ch =%d", numChannels); - for ( Index = 0; - Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); - Index++) - { - class = limGetOPClassFromChannel( - pMac->scan.countryCodeCurrent, - pMac->scan.baseChannels.channelList[ Index ], - BWALL); - limLog(pMac, LOG4, "ch=%d <=> %d=class", - pMac->scan.baseChannels.channelList[ Index ], - class); - if (CheckAndAddOP(class)) - { - op_classes.classes[i]= class; - i++; - } - } - - numChannels = pMac->scan.base20MHzChannels.numChannels; - limLog(pMac, LOG1, "Num of 20MHz ch =%d", numChannels); - for ( Index = 0; - Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); - Index++) - { - class = limGetOPClassFromChannel( - pMac->scan.countryCodeCurrent, - pMac->scan.base20MHzChannels.channelList[ Index ], - BWALL); - limLog(pMac, LOG4, "ch=%d <=> %d=class", - pMac->scan.base20MHzChannels.channelList[ Index ], - class); - if (CheckAndAddOP(class)) - { - op_classes.classes[i]= class; - i++; - } - } - - numChannels = pMac->scan.base40MHzChannels.numChannels; - limLog(pMac, LOG1, "Num of 40MHz ch =%d", numChannels); - for ( Index = 0; - Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); - Index++) - { - class = limGetOPClassFromChannel( - pMac->scan.countryCodeCurrent, - pMac->scan.base40MHzChannels.channelList[ Index ], - BWALL); - limLog(pMac, LOG4, "ch=%d <=> %d=class", - pMac->scan.base40MHzChannels.channelList[ Index ], - class); - if (CheckAndAddOP(class)) - { - op_classes.classes[i]= class; - i++; - } - } - - op_classes.num_classes = i; - limLog(pMac, LOG1, "Total number of Unique supported classes =%d", - op_classes.num_classes); - /*as per spec the operating classes should be in ascending order*/ - /*Bubble sort is fine as we don't have many classes*/ - for (i = 0 ; i < ( op_classes.num_classes - 1 ); i++) - { - for (j = 0 ; j < op_classes.num_classes - i - 1; j++) - { - /* For decreasing order use < */ - if (op_classes.classes[j] > op_classes.classes[j+1]) - { - swap = op_classes.classes[j]; - op_classes.classes[j] = op_classes.classes[j+1]; - op_classes.classes[j+1] = swap; - } - } - } - for (i=0; i < op_classes.num_classes; i++) - { - - limLog(pMac, LOG1, "supported op_class[%d]=%d", i, - op_classes.classes[i]); - - } -} - #endif diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h index 660d495914bf..1b88c5fdbfa0 100644 --- a/CORE/MAC/src/pe/lim/limUtils.h +++ b/CORE/MAC/src/pe/lim/limUtils.h @@ -102,19 +102,6 @@ typedef union uPmfSaQueryTimerId } tPmfSaQueryTimerId, *tpPmfSaQueryTimerId; #endif -typedef enum offset { - BW20, - BW40PLUS, - BW40MINUS, - BWALL -} offset_t; - -typedef struct op_class_map { - tANI_U8 op_class; - tANI_U8 ch_spacing; - offset_t offset; - tANI_U8 channels[15]; -}op_class_map_t; // LIM utility functions void limGetBssidFromPkt(tpAniSirGlobal, tANI_U8 *, tANI_U8 *, tANI_U32 *); char * limDot11ReasonStr(tANI_U16 reasonCode); @@ -599,8 +586,4 @@ void limSetProtectedBit(tpAniSirGlobal pMac, tANI_U8* lim_get_ie_ptr(tANI_U8 *pIes, int length, tANI_U8 eid); -void limInitOperatingClasses(tHalHandle hHal); -tANI_U8 limGetOPClassFromChannel(tANI_U8 *country, - tANI_U8 channel, - tANI_U8 offset); #endif /* __LIM_UTILS_H */ diff --git a/CORE/SERVICES/WMA/regdomain.c b/CORE/SERVICES/WMA/regdomain.c index 897a5ac11bb3..39bbe313aadb 100644 --- a/CORE/SERVICES/WMA/regdomain.c +++ b/CORE/SERVICES/WMA/regdomain.c @@ -72,6 +72,83 @@ #define N(a) (sizeof(a)/sizeof(a[0])) +static regdm_supp_op_classes regdm_curr_supp_opp_classes = {0}; + +/* Global Operating Classes */ +regdm_op_class_map_t global_op_class[] = { + {81, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {82, 25, BW20, {14}}, + {83, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, + {84, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {115, 20, BW20, {36, 40, 44, 48}}, + {116, 40, BW40_LOW_PRIMARY, {36, 44}}, + {117, 40, BW40_HIGH_PRIMARY, {40, 48}}, + {118, 20, BW20, {52, 56, 60, 64}}, + {119, 40, BW40_LOW_PRIMARY, {52, 60}}, + {120, 40, BW40_HIGH_PRIMARY, {56, 64}}, + {121, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, + {122, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}}, + {123, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}}, + {125, 20, BW20, {149, 153, 157, 161, 165, 169}}, + {126, 40, BW40_LOW_PRIMARY, {149, 157}}, + {127, 40, BW40_HIGH_PRIMARY, {153, 161}}, + {0, 0, 0, {0}}, +}; + +/* Operating Classes in US */ +regdm_op_class_map_t us_op_class[] = { + {1, 20, BW20, {36, 40, 44, 48}}, + {2, 20, BW20, {52, 56, 60, 64}}, + {4, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, + {5, 20, BW20, {149, 153, 157, 161, 165}}, + {12, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}, + {22, 40, BW40_LOW_PRIMARY, {36, 44}}, + {23, 40, BW40_LOW_PRIMARY, {52, 60}}, + {24, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}}, + {26, 40, BW40_LOW_PRIMARY, {149, 157}}, + {27, 40, BW40_HIGH_PRIMARY, {40, 48}}, + {28, 40, BW40_HIGH_PRIMARY, {56, 64}}, + {29, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}}, + {31, 40, BW40_HIGH_PRIMARY, {153, 161}}, + {32, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7}}, + {33, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11}}, + {0, 0, 0, {0}}, +}; + +/* Operating Classes in Europe */ +regdm_op_class_map_t euro_op_class[] = { + {1, 20, BW20, {36, 40, 44, 48}}, + {2, 20, BW20, {52, 56, 60, 64}}, + {3, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, + {4, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {5, 40, BW40_LOW_PRIMARY, {36, 44}}, + {6, 40, BW40_LOW_PRIMARY, {52, 60}}, + {7, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}}, + {8, 40, BW40_HIGH_PRIMARY, {40, 48}}, + {9, 40, BW40_HIGH_PRIMARY, {56, 64}}, + {10, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}}, + {11, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, + {12, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {17, 20, BW20, {149, 153, 157, 161, 165, 169}}, + {0, 0, 0, {0}}, +}; + +/* Operating Classes in Japan */ +regdm_op_class_map_t japan_op_class[] = { + {1, 20, BW20, {36, 40, 44, 48}}, + {30, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {31, 25, BW20, {14}}, + {32, 20, BW20, {52, 56, 60, 64}}, + {34, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, + {36, 40, BW40_LOW_PRIMARY, {36, 44}}, + {37, 40, BW40_LOW_PRIMARY, {52, 60}}, + {39, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}}, + {41, 40, BW40_HIGH_PRIMARY, {40, 48}}, + {42, 40, BW40_HIGH_PRIMARY, {56, 64}}, + {44, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}}, + {0, 0, 0, {0}}, +}; + /* * By default, the regdomain tables reference the common tables * from regdomain_common.h. These default tables can be replaced @@ -524,3 +601,80 @@ u_int16_t get_regdmn_5g(u_int32_t reg_dmn) __func__, reg_dmn); return 0; } + +/* + * Get operating class for a given channel + */ +u_int16_t regdm_get_opclass_from_channel(u_int8_t *country, u_int8_t channel, + u_int8_t offset) +{ + regdm_op_class_map_t *class = NULL; + u_int16_t i = 0; + + if (0 == adf_os_mem_cmp(country,"US", 2)) { + class = us_op_class; + } else if (0 == adf_os_mem_cmp(country,"EU", 2)) { + class = euro_op_class; + } else if (0 == adf_os_mem_cmp(country,"JP", 2)) { + class = japan_op_class; + } else { + class = global_op_class; + } + + while (class->op_class) { + if ((offset == class->offset) || (offset == BWALL)) { + for (i = 0; + (i < MAX_CHANNELS_PER_OPERATING_CLASS && + class->channels[i]); + i++) { + if (channel == class->channels[i]) + return class->op_class; + } + } + class++; + } + return 0; +} + +/* + * Set current operating classes per country, regdomain + */ +u_int16_t regdm_set_curr_opclasses(u_int8_t num_classes, u_int8_t *class) +{ + u_int8_t i; + + if (SIR_MAC_MAX_SUPP_OPER_CLASSES < num_classes) { + adf_os_print(KERN_ERR "%s: Invalid numClasses (%d)\n", + __func__, num_classes); + return -1; + } + + for (i = 0 ; i < num_classes; i++) { + regdm_curr_supp_opp_classes.classes[i] = class[i]; + } + regdm_curr_supp_opp_classes.num_classes = num_classes; + + return 0; +} + +/* + * Get current operating classes + */ +u_int16_t regdm_get_curr_opclasses(u_int8_t *num_classes, u_int8_t *class) +{ + u_int8_t i; + + if (!num_classes || !class) { + adf_os_print(KERN_ERR "%s: Either num_classes or class is null\n", + __func__); + return -1; + } + + for (i = 0 ; i < regdm_curr_supp_opp_classes.num_classes; i++) { + class[i] = regdm_curr_supp_opp_classes.classes[i]; + } + + *num_classes = regdm_curr_supp_opp_classes.num_classes; + + return 0; +} diff --git a/CORE/SERVICES/WMA/regdomain_common.h b/CORE/SERVICES/WMA/regdomain_common.h index c96708eb2747..913799ff3dad 100644 --- a/CORE/SERVICES/WMA/regdomain_common.h +++ b/CORE/SERVICES/WMA/regdomain_common.h @@ -79,6 +79,9 @@ #include "_ieee80211_common.h" #include <a_types.h> #include "wlan_defs.h" + +#define MAX_CHANNELS_PER_OPERATING_CLASS 15 + enum EnumRd { /* * The following regulatory domain definitions are @@ -1832,3 +1835,30 @@ static const struct cmode modes[] = { { REGDMN_MODE_11AC_VHT40_2G, IEEE80211_CHAN_11AC_VHT40_2G}, { REGDMN_MODE_11AC_VHT80_2G, IEEE80211_CHAN_11AC_VHT80_2G}, }; + +typedef enum offset +{ + BW20 = 0, + BW40_LOW_PRIMARY = 1, + BW40_HIGH_PRIMARY = 3, + BWALL +} offset_t; + +typedef struct _regdm_op_class_map +{ + u_int8_t op_class; + u_int8_t ch_spacing; + offset_t offset; + u_int8_t channels[MAX_CHANNELS_PER_OPERATING_CLASS]; +} regdm_op_class_map_t; + +typedef struct _regdm_supp_op_classes { + u_int8_t num_classes; + u_int8_t classes[SIR_MAC_MAX_SUPP_OPER_CLASSES]; +} regdm_supp_op_classes; + +u_int16_t regdm_get_opclass_from_channel(u_int8_t *country, u_int8_t channel, + u_int8_t offset); +u_int16_t regdm_set_curr_opclasses(u_int8_t num_classes, u_int8_t *class); +u_int16_t regdm_get_curr_opclasses(u_int8_t *num_classes, u_int8_t *class); + diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 1c7909abf48b..fca023e8a41d 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -25505,16 +25505,23 @@ static int wma_update_tdls_peer_state(WMA_HANDLE handle, peerStateParams->peerCap.peerOffChanSupport; peer_cap->peer_curr_operclass = peerStateParams->peerCap.peerCurrOperClass; + /* self curr operclass is not being used and so pass op class for + * preferred off chan in it. + */ peer_cap->self_curr_operclass = - peerStateParams->peerCap.selfCurrOperClass; + peerStateParams->peerCap.opClassForPrefOffChan; peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; peer_cap->peer_operclass_len = peerStateParams->peerCap.peerOperClassLen; + WMA_LOGD("%s: peer_operclass_len: %d", + __func__, peer_cap->peer_operclass_len); for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { peer_cap->peer_operclass[i] = peerStateParams->peerCap.peerOperClass[i]; + WMA_LOGD("%s: peer_operclass[%d]: %d", + __func__, i, peer_cap->peer_operclass[i]); } peer_cap->is_peer_responder = diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 8300785f5906..5e4c1122e436 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -67,6 +67,8 @@ #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) #include "csrEse.h" #endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */ +#include "regdomain_common.h" + #define CSR_NUM_IBSS_START_CHANNELS_50 4 #define CSR_NUM_IBSS_START_CHANNELS_24 3 #define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD ( 5 * VOS_TIMER_TO_SEC_UNIT ) // 5 seconds, for WPA, WPA2, CCKM @@ -258,6 +260,7 @@ extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); extern void btampEstablishLogLinkHdlr(void* pMsg); static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); +void csrInitOperatingClasses(tHalHandle hHal); //Initialize global variables static void csrRoamInitGlobals(tpAniSirGlobal pMac) @@ -467,7 +470,7 @@ eHalStatus csrUpdateChannelList(tpAniSirGlobal pMac) bufLen = sizeof(tSirUpdateChanList) + (sizeof(tSirUpdateChanParam) * (numChan - 1)); - limInitOperatingClasses((tHalHandle)pMac); + csrInitOperatingClasses((tHalHandle)pMac); pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen); if (!pChanList) { @@ -2334,7 +2337,7 @@ eHalStatus csrInitChannelList( tHalHandle hHal ) csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); // Apply the base channel list, power info, and set the Country code... csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); - limInitOperatingClasses(hHal); + csrInitOperatingClasses(hHal); return (status); } eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, @@ -18529,3 +18532,135 @@ err_synch_rsp: pFTRoamOffloadSynchRsp->pbssDescription = NULL; } #endif + +void csrInitOperatingClasses(tHalHandle hHal) +{ + tANI_U8 Index = 0; + tANI_U8 class = 0; + tANI_U8 i = 0; + tANI_U8 j = 0; + tANI_U8 swap = 0; + tANI_U8 numChannels = 0; + tANI_U8 numClasses = 0; + tANI_BOOLEAN found; + tANI_U8 opClasses[SIR_MAC_MAX_SUPP_OPER_CLASSES]; + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + + smsLog(pMac, LOG1, FL("Current Country = %c%c"), + pMac->scan.countryCodeCurrent[0], + pMac->scan.countryCodeCurrent[1]); + + for (j = 0; j < SIR_MAC_MAX_SUPP_OPER_CLASSES; j++) { + opClasses[j] = 0; + } + + numChannels = pMac->scan.baseChannels.numChannels; + + smsLog(pMac, LOG1, FL("Num of base channels %d"), numChannels); + + for (Index = 0; + Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); + Index++) { + class = regdm_get_opclass_from_channel(pMac->scan.countryCodeCurrent, + pMac->scan.baseChannels.channelList[Index], + BWALL); + smsLog(pMac, LOG4, FL("for chan %d, op class: %d"), + pMac->scan.baseChannels.channelList[Index], + class); + + found = FALSE; + for (j = 0 ; j < SIR_MAC_MAX_SUPP_OPER_CLASSES - 1; j++) { + if (opClasses[j] == class) { + found = TRUE; + break; + } + } + if (!found) { + opClasses[i]= class; + i++; + } + } + + numChannels = pMac->scan.base20MHzChannels.numChannels; + + smsLog(pMac, LOG1, FL("Num of 20MHz channels %d"), numChannels); + + for (Index = 0; + Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); + Index++) { + class = regdm_get_opclass_from_channel(pMac->scan.countryCodeCurrent, + pMac->scan.base20MHzChannels.channelList[Index], + BWALL); + smsLog(pMac, LOG4, FL("for chan %d, op class: %d"), + pMac->scan.base20MHzChannels.channelList[ Index ], + class); + + found = FALSE; + for (j = 0 ; j < SIR_MAC_MAX_SUPP_OPER_CLASSES - 1; j++) { + if (opClasses[j] == class) { + found = TRUE; + break; + } + } + if (!found) { + opClasses[i]= class; + i++; + } + } + + numChannels = pMac->scan.base40MHzChannels.numChannels; + + smsLog(pMac, LOG1, FL("Num of 40MHz channels %d"), numChannels); + + for (Index = 0; + Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); + Index++) { + class = regdm_get_opclass_from_channel(pMac->scan.countryCodeCurrent, + pMac->scan.base40MHzChannels.channelList[Index], + BWALL); + smsLog(pMac, LOG4, FL("for chan %d, op class: %d"), + pMac->scan.base40MHzChannels.channelList[ Index ], + class); + + found = FALSE; + for (j = 0 ; j < SIR_MAC_MAX_SUPP_OPER_CLASSES - 1; j++) { + if (opClasses[j] == class) { + found = TRUE; + break; + } + } + if (!found) { + opClasses[i]= class; + i++; + } + } + + numClasses = i; + + /* As per spec the operating classes should be in ascending order. + * Bubble sort is fine since we don't have many classes + */ + for (i = 0 ; i < (numClasses - 1); i++) { + for (j = 0 ; j < (numClasses - i - 1); j++) { + /* For decreasing order use < */ + if (opClasses[j] > opClasses[j+1]) { + swap = opClasses[j]; + opClasses[j] = opClasses[j+1]; + opClasses[j+1] = swap; + } + } + } + + smsLog(pMac, LOG1, FL("Total number of unique supported op classes %d"), + numClasses); + for (i = 0; i < numClasses; i++) { + smsLog(pMac, LOG1, FL("supported opClasses[%d] = %d"), i, + opClasses[i]); + } + + /* Set the ordered list of op classes in regdomain + * for use by other modules + */ + regdm_set_curr_opclasses(numClasses, &opClasses[0]); +} + diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index ff94cb955692..761fd7dc8af2 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -72,6 +72,7 @@ #ifdef WLAN_FEATURE_NAN #include "nan_Api.h" #endif +#include "regdomain_common.h" extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb); @@ -10937,6 +10938,7 @@ eHalStatus sme_UpdateTdlsPeerState(tHalHandle hHal, tANI_U8 num; tANI_U8 chanId; tANI_U8 i; + tANI_U8 preOffChanOffset; if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) { @@ -11033,6 +11035,19 @@ eHalStatus sme_UpdateTdlsPeerState(tHalHandle hHal, pTdlsPeerStateParams->peerCap.prefOffChanBandwidth = peerStateParams->peerCap.prefOffChanBandwidth; + /* Ideally better to get offset from ini or userspace, for now + * in case of 40MHz, assume lower primary + */ + if (pTdlsPeerStateParams->peerCap.prefOffChanBandwidth == 20) + preOffChanOffset = BW20; + else + preOffChanOffset = BW40_LOW_PRIMARY; + + pTdlsPeerStateParams->peerCap.opClassForPrefOffChan = + regdm_get_opclass_from_channel(pMac->scan.countryCodeCurrent, + pTdlsPeerStateParams->peerCap.prefOffChanNum, + preOffChanOffset); + vosMessage.type = WDA_UPDATE_TDLS_PEER_STATE; vosMessage.reserved = 0; vosMessage.bodyptr = pTdlsPeerStateParams; diff --git a/CORE/WDA/inc/legacy/halMsgApi.h b/CORE/WDA/inc/legacy/halMsgApi.h index c692075e1675..063a0649f958 100644 --- a/CORE/WDA/inc/legacy/halMsgApi.h +++ b/CORE/WDA/inc/legacy/halMsgApi.h @@ -1431,6 +1431,7 @@ typedef struct { tANI_U8 peerOperClass[HAL_TDLS_MAX_SUPP_OPER_CLASSES]; tANI_U8 prefOffChanNum; tANI_U8 prefOffChanBandwidth; + tANI_U8 opClassForPrefOffChan; } tTdlsPeerCapParams; typedef struct sTdlsPeerStateParams |
