Update to odulow per maintenance bronze
[o-du/phy.git] / fapi_5g / source / api / fapi2phy / p5 / nr5g_fapi_proc_config_req.c
1 /******************************************************************************
2 *   Copyright (c) 2019 Intel.
3 *
4 *   Licensed under the Apache License, Version 2.0 (the "License");
5 *   you may not use this file except in compliance with the License.
6 *   You may obtain a copy of the License at
7 *
8 *       http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *   Unless required by applicable law or agreed to in writing, software
11 *   distributed under the License is distributed on an "AS IS" BASIS,
12 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *   See the License for the specific language governing permissions and
14 *   limitations under the License.
15 *
16 *******************************************************************************/
17
18 /**
19  * @file
20  * This file consist of implementation of FAPI CONFIG.request message.
21  *
22  **/
23
24 #include "nr5g_fapi_framework.h"
25 #include "gnb_l1_l2_api.h"
26 #include "nr5g_fapi_fapi2mac_api.h"
27 #include "nr5g_fapi_fapi2phy_api.h"
28 #include "nr5g_fapi_fapi2phy_p5_proc.h"
29 #include "nr5g_fapi_fapi2phy_p5_pvt_proc.h"
30 #include "nr5g_fapi_memory.h"
31
32  /** @ingroup group_source_api_p5_fapi2phy_proc
33  *
34  *  @param[in]  p_phy_instance Pointer to PHY instance.
35  *  @param[in]  p_fapi_req Pointer to FAPI CONFIG.request message structure.
36  *  @param[in]  p_fapi_vendor_msg Pointer to FAPI vendor message structure.
37  *  @return     Returns ::SUCCESS and ::FAILURE.
38  *
39  *  @description
40  *  This message instructs how the PHY should be configured.
41  *
42  *  The *carrier_aggregation_level* parameter is a vendor specific 
43  *  configuration and programmed through Vendor Specific Message structure 
44  *  ::fapi_config_req_vendor_msg_t 
45  *
46 **/
47 uint8_t nr5g_fapi_config_request(
48     p_nr5g_fapi_phy_instance_t p_phy_instance,
49     fapi_config_req_t * p_fapi_req,
50     fapi_vendor_msg_t * p_fapi_vendor_msg)
51 {
52     PCONFIGREQUESTStruct p_ia_config_req;
53     PMAC2PHY_QUEUE_EL p_list_elem;
54     nr5g_fapi_stats_t *p_stats;
55
56 #ifndef DEBUG_MODE
57     /* Below print is for better logging on console in radio mode. */
58     NR5G_FAPI_LOG(INFO_LOG, (""));
59 #endif
60
61     if (NULL == p_phy_instance) {
62         NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Invalid " "phy instance"));
63         return FAILURE;
64     }
65     p_stats = &p_phy_instance->stats;
66     p_stats->fapi_stats.fapi_config_req++;
67
68     if (NULL == p_fapi_req) {
69         NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Invalid fapi " "message"));
70         return FAILURE;
71     }
72
73     if (NULL == p_fapi_vendor_msg) {
74         NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Invalid fapi "
75                 "vendor message"));
76         return FAILURE;
77     }
78
79     if (FAPI_STATE_RUNNING == p_phy_instance->state) {
80         NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Message not "
81                 "supported by PHY in Running State"));
82         return FAILURE;
83     }
84
85     p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem((uint8_t)
86         MSG_TYPE_PHY_CONFIG_REQ, 1, (uint32_t) sizeof(CONFIGREQUESTStruct));
87     if (!p_list_elem) {
88         NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Unable to create "
89                 "list element. Out of memory!!!"));
90         return FAILURE;
91     }
92
93     p_ia_config_req = (PCONFIGREQUESTStruct) (p_list_elem + 1);
94     NR5G_FAPI_MEMSET(p_ia_config_req, sizeof(CONFIGREQUESTStruct), 0,
95         sizeof(CONFIGREQUESTStruct));
96     p_ia_config_req->sMsgHdr.nMessageType = MSG_TYPE_PHY_CONFIG_REQ;
97     p_ia_config_req->sMsgHdr.nMessageLen =
98         (uint16_t) sizeof(CONFIGREQUESTStruct);
99     p_ia_config_req->nCarrierIdx = p_phy_instance->phy_id;
100
101     nr5g_fapi_config_req_to_phy_translation(p_phy_instance, p_fapi_req,
102         p_ia_config_req);
103     /* Vendor Parameters */
104     if (p_fapi_vendor_msg) {
105         p_ia_config_req->nCarrierAggregationLevel =
106             p_fapi_vendor_msg->config_req_vendor.carrier_aggregation_level;
107         p_ia_config_req->nGroupHopFlag =
108             p_fapi_vendor_msg->config_req_vendor.group_hop_flag;
109         p_ia_config_req->nSequenceHopFlag =
110             p_fapi_vendor_msg->config_req_vendor.sequence_hop_flag;
111         p_ia_config_req->nHoppingId =
112             p_fapi_vendor_msg->config_req_vendor.hopping_id;
113     }
114
115     p_ia_config_req->nDLFftSize =
116         nr5g_fapi_calc_fft_size(p_ia_config_req->nSubcCommon,
117         p_ia_config_req->nDLBandwidth);
118     p_ia_config_req->nULFftSize =
119         nr5g_fapi_calc_fft_size(p_ia_config_req->nSubcCommon,
120         p_ia_config_req->nULBandwidth);
121     p_ia_config_req->nPrachNrofRxRU = p_ia_config_req->nNrOfRxAnt;
122
123     /* Add element to send list */
124     nr5g_fapi_fapi2phy_add_to_api_list(p_list_elem);
125
126     p_stats->iapi_stats.iapi_config_req++;
127     NR5G_FAPI_LOG(INFO_LOG, ("[CONFIG.request][%d]", p_phy_instance->phy_id));
128     return SUCCESS;
129 }
130
131  /** @ingroup group_source_api_p5_fapi2phy_proc
132  *
133  *  @param[in]  p_phy_instance Pointer to PHY instance.
134  *  @param[in]  p_fapi_req Pointer to FAPI CONFIG.request structure.
135  *  @param[in]  p_ia_config_req Pointer to IAPI CONFIG.request structure.
136  *  
137  *  @return     Returns ::SUCCESS and ::FAILURE.
138  *
139  *  @description
140  *  This function converts FAPI CONFIG.request TLVs to IAPI Config.request
141  *  structure.
142  *
143 **/
144 uint8_t nr5g_fapi_config_req_to_phy_translation(
145     p_nr5g_fapi_phy_instance_t p_phy_instance,
146     fapi_config_req_t * p_fapi_req,
147     PCONFIGREQUESTStruct p_ia_config_req)
148 {
149     fapi_uint32_tlv_t *tlvs = p_fapi_req->tlvs;
150     uint32_t i = 0, j = 0, k = 0;
151     uint32_t ss_pbch_power = 0;
152     uint32_t mib = 0;
153     uint32_t n_ssb_mask_idx = 0;
154     uint32_t n_beamid_idx = 0;
155     SLOTCONFIGStruct *p_sslot_Config = NULL;
156
157     while (i < p_fapi_req->number_of_tlvs) {
158         switch (tlvs[i].tl.tag) {
159             /***** Carrier Config *****/
160             case FAPI_DL_BANDWIDTH_TAG:
161                 p_ia_config_req->nDLBandwidth =
162                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
163                 break;
164
165             case FAPI_DL_FREQUENCY_TAG:
166                 p_ia_config_req->nDLAbsFrePointA = tlvs[i++].value;
167                 break;
168
169                 /* FAPI_DL_K0_TAG - NA */
170                 /* FAPI_DL_GRIDSIZE_TAG - NA */
171
172             case FAPI_NUM_TX_ANT_TAG:
173                 p_ia_config_req->nNrOfTxAnt =
174                     GETVLFRM32B(tlvs[i].value, tlvs[i].tl.length);
175                 p_ia_config_req->nNrOfDLPorts =
176                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
177                 break;
178
179             case FAPI_UPLINK_BANDWIDTH_TAG:
180                 p_ia_config_req->nULBandwidth =
181                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
182                 break;
183
184             case FAPI_UPLINK_FREQUENCY_TAG:
185                 p_ia_config_req->nULAbsFrePointA = tlvs[i++].value;
186                 break;
187
188                 /* FAPI_UL_K0_TAG - NA */
189                 /* FAPI_UL_GRIDSIZE_TAG - NA */
190
191             case FAPI_NUM_RX_ANT_TAG:
192                 p_phy_instance->phy_config.n_nr_of_rx_ant =
193                     p_ia_config_req->nNrOfRxAnt =
194                     GETVLFRM32B(tlvs[i].value, tlvs[i].tl.length);
195                 p_ia_config_req->nNrOfULPorts =
196                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
197                 break;
198
199                 /* FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG - NA */
200
201             /***** Cell Config *****/
202             case FAPI_PHY_CELL_ID_TAG:
203                 p_phy_instance->phy_config.phy_cell_id =
204                     p_ia_config_req->nPhyCellId =
205                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
206                 break;
207
208             case FAPI_FRAME_DUPLEX_TYPE_TAG:
209                 p_ia_config_req->nFrameDuplexType =
210                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
211                 break;
212
213             /***** SSB Config *****/
214             case FAPI_SS_PBCH_POWER_TAG:
215                 ss_pbch_power = tlvs[i++].value;
216                 if (0 == ss_pbch_power) {
217                     p_ia_config_req->nSSBPwr = 1;
218                 } else if (54002 == ss_pbch_power) {
219                     p_ia_config_req->nSSBPwr = 20000;
220                 } else {
221                     p_ia_config_req->nSSBPwr = ss_pbch_power - 54000;
222                 }
223                 break;
224
225                 /* FAPI_BCH_PAYLOAD_TAG - NA */
226
227             case FAPI_SCS_COMMON_TAG:
228                 p_ia_config_req->nSubcCommon =
229                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
230                 p_ia_config_req->nSSBSubcSpacing = p_ia_config_req->nSubcCommon;
231                 break;
232
233             /***** PRACH Config *****/
234             case FAPI_PRACH_SUBC_SPACING_TAG:
235                 p_ia_config_req->nPrachSubcSpacing =
236                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
237                 break;
238
239             case FAPI_RESTRICTED_SET_CONFIG_TAG:
240                 p_ia_config_req->nPrachRestrictSet =
241                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
242                 break;
243
244             case FAPI_NUM_PRACH_FD_OCCASIONS_TAG:
245                 p_ia_config_req->nPrachFdm =
246                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
247                 break;
248
249             case FAPI_PRACH_CONFIG_INDEX_TAG:
250                 p_ia_config_req->nPrachConfIdx =
251                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
252                 break;
253
254             case FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG:
255                 p_ia_config_req->nPrachRootSeqIdx =
256                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
257                 break;
258
259             case FAPI_K1_TAG:
260                 p_ia_config_req->nPrachFreqStart =
261                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
262                 break;
263
264             case FAPI_PRACH_ZERO_CORR_CONF_TAG:
265                 p_ia_config_req->nPrachZeroCorrConf =
266                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
267                 break;
268
269             case FAPI_SSB_PER_RACH_TAG:
270                 p_ia_config_req->nPrachSsbRach =
271                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
272                 break;
273             /***** SSB Table *****/
274             case FAPI_SSB_OFFSET_POINT_A_TAG:
275                 p_ia_config_req->nSSBPrbOffset =
276                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length) / (pow(2,
277                         p_ia_config_req->nSubcCommon));
278                 p_phy_instance->phy_config.nSSBPrbOffset =
279                     p_ia_config_req->nSSBPrbOffset;
280                 break;
281
282             case FAPI_SSB_PERIOD_TAG:
283                 p_ia_config_req->nSSBPeriod =
284                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
285                 break;
286
287             case FAPI_SSB_SUBCARRIER_OFFSET_TAG:
288                 p_ia_config_req->nSSBSubcOffset =
289                     (tlvs[i].value >> tlvs[i++].tl.length);
290                 break;
291
292             case FAPI_MIB_TAG:
293                 mib = tlvs[i++].value;
294                 p_ia_config_req->nMIB[0] = (uint8_t) (mib >> 24);
295                 p_ia_config_req->nMIB[1] = (uint8_t) (mib >> 16);
296                 p_ia_config_req->nMIB[2] = (uint8_t) (mib >> 8);
297                 break;
298
299             case FAPI_DMRS_TYPE_A_POS_TAG:
300                 p_ia_config_req->nDMRSTypeAPos =
301                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
302                 break;
303
304             case FAPI_SSB_MASK_TAG:
305                 if (n_ssb_mask_idx < 2) {
306                     p_ia_config_req->nSSBMask[n_ssb_mask_idx++] =
307                         tlvs[i++].value;
308                 }
309                 break;
310
311             case FAPI_BEAM_ID_TAG:
312                 if (n_beamid_idx < 64) {
313                     p_ia_config_req->nBeamId[n_beamid_idx++] =
314                         GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
315                 }
316                 break;
317
318                 /* FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG - NA */
319                 /* FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG - NA */
320
321             /***** TDD Table *****/
322             case FAPI_TDD_PERIOD_TAG:
323                 p_ia_config_req->nTddPeriod =
324                     nr5g_fapi_calc_phy_tdd_period((uint8_t)
325                     GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length),
326                     p_ia_config_req->nSubcCommon);
327                 break;
328
329             case FAPI_SLOT_CONFIG_TAG:
330                 for (j = 0; j < p_ia_config_req->nTddPeriod; j++) {
331                     p_sslot_Config = &p_ia_config_req->sSlotConfig[j];
332                     for (k = 0; k < MAX_NUM_OF_SYMBOL_PER_SLOT; k++) {
333                         p_sslot_Config->nSymbolType[k] =
334                             GETVLFRM32B(tlvs[i].value, tlvs[i++].tl.length);
335                     }
336                 }
337                 break;
338
339             /***** Measurement Config *****/
340                 /* FAPI_RSSI_MEASUREMENT_TAG - NA */
341
342             /***** Beamforming Table *****/
343
344             /***** Precoding Table *****/
345             default:
346                 {
347                     NR5G_FAPI_LOG(ERROR_LOG, ("[CONFIG.request] Unsupported "
348                             "TLV tag : 0x%x", tlvs[i].tl.tag));
349                 }
350                 break;
351         }
352     }
353     return SUCCESS;
354 }
355
356  /** @ingroup group_source_api_p5_fapi2phy_proc
357  *
358  *  @param[in]  fapi_tdd_period DL UL Transmission Periodicity. 
359  *  @param[in]  n_subc_common subcarrierSpacing for common.
360  *  
361  *  @return     IAPI *nTddPeriod*.
362  *
363  *  @description
364  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
365  *  structure.
366  *
367 **/
368 uint8_t nr5g_fapi_calc_phy_tdd_period(
369     uint8_t fapi_tdd_period,
370     uint8_t n_subc_common)
371 {
372     switch (n_subc_common) {
373         case 0:
374             return
375                 nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_0
376                 (fapi_tdd_period);
377         case 1:
378             return
379                 nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_1
380                 (fapi_tdd_period);
381         case 2:
382             return
383                 nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_2
384                 (fapi_tdd_period);
385         case 3:
386             return
387                 nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_3
388                 (fapi_tdd_period);
389         default:
390             break;
391     }
392
393     return 0;
394 }
395
396  /** @ingroup group_source_api_p5_fapi2phy_proc
397  *
398  *  @param[in]  fapi_tdd_period DL UL Transmission Periodicity. 
399  *  
400  *  @return     IAPI *nTddPeriod*.
401  *
402  *  @description
403  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
404  *  structure based on *subCarrierSpacingCommon - 0*.
405  *
406 **/
407 uint8_t nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_0(
408     uint8_t fapi_tdd_period)
409 {
410     if (2 == fapi_tdd_period)
411         return 1;
412     else if (4 == fapi_tdd_period)
413         return 2;
414     else if (6 == fapi_tdd_period)
415         return 5;
416     else if (7 == fapi_tdd_period)
417         return 10;
418     else
419         return 0;
420
421     return 0;
422 }
423
424  /** @ingroup group_source_api_p5_fapi2phy_proc
425  *
426  *  @param[in]  fapi_tdd_period DL UL Transmission Periodicity. 
427  *  
428  *  @return     IAPI *nTddPeriod*.
429  *
430  *  @description
431  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
432  *  structure based on *subCarrierSpacingCommon - 1*.
433  *
434 **/
435 uint8_t nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_1(
436     uint8_t fapi_tdd_period)
437 {
438     if (0 == fapi_tdd_period)
439         return 1;
440     else if (2 == fapi_tdd_period)
441         return 2;
442     else if (4 == fapi_tdd_period)
443         return 4;
444     else if (5 == fapi_tdd_period)
445         return 5;
446     else if (6 == fapi_tdd_period)
447         return 10;
448     else if (7 == fapi_tdd_period)
449         return 20;
450     else
451         return 0;
452
453     return 0;
454 }
455
456  /** @ingroup group_source_api_p5_fapi2phy_proc
457  *
458  *  @param[in]  fapi_tdd_period DL UL Transmission Periodicity. 
459  *  
460  *  @return     IAPI *nTddPeriod*.
461  *
462  *  @description
463  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
464  *  structure based on *subCarrierSpacingCommon - 2*.
465  *
466 **/
467 uint8_t nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_2(
468     uint8_t fapi_tdd_period)
469 {
470     if (0 == fapi_tdd_period)
471         return 2;
472     else if (2 == fapi_tdd_period)
473         return 4;
474     else if (3 == fapi_tdd_period)
475         return 5;
476     else if (4 == fapi_tdd_period)
477         return 8;
478     else if (5 == fapi_tdd_period)
479         return 10;
480     else if (6 == fapi_tdd_period)
481         return 20;
482     else if (7 == fapi_tdd_period)
483         return 40;
484     else
485         return 0;
486
487     return 0;
488 }
489
490  /** @ingroup group_source_api_p5_fapi2phy_proc
491  *
492  *  @param[in]  fapi_tdd_period DL UL Transmission Periodicity. 
493  *  
494  *  @return     IAPI *nTddPeriod*.
495  *
496  *  @description
497  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
498  *  structure based on *subCarrierSpacingCommon - 3*.
499  *
500 **/
501 uint8_t nr5g_fapi_calc_phy_tdd_period_for_n_subc_common_3(
502     uint8_t fapi_tdd_period)
503 {
504     if (0 == fapi_tdd_period)
505         return 4;
506     else if (1 == fapi_tdd_period)
507         return 5;
508     else if (2 == fapi_tdd_period)
509         return 8;
510     else if (3 == fapi_tdd_period)
511         return 10;
512     else if (4 == fapi_tdd_period)
513         return 16;
514     else if (5 == fapi_tdd_period)
515         return 20;
516     else if (6 == fapi_tdd_period)
517         return 40;
518     else if (7 == fapi_tdd_period)
519         return 80;
520     else
521         return 0;
522
523     return 0;
524 }
525
526  /** @ingroup group_source_api_p5_fapi2phy_proc
527  *
528  *  @param[in]  nSubcCommon  Sub carrier spacing
529  *  @param[in]  nDLBandwidth/ nULBandwidth  Sub carrier spacing
530  *  
531  *  
532  *  @return     IAPI FFT size for DL UL
533  *
534  *  @description
535  *  This function converts FAPI *TddPeriod* to IAPI *nTddPeriod* 
536  *  structure based on *subCarrierSpacingCommon - 3*.
537  *
538 **/
539 uint16_t nr5g_fapi_calc_fft_size(
540     uint8_t sub_carrier_common,
541     uint16_t bw)
542 {
543     if (FAPI_SUBCARRIER_SPACING_15 == sub_carrier_common) {
544         if (FAPI_BANDWIDTH_5_MHZ == bw)
545             return FAPI_FFT_SIZE_512;
546         else if (FAPI_BANDWIDTH_10_MHZ == bw)
547             return FAPI_FFT_SIZE_1024;
548         else if ((FAPI_BANDWIDTH_15_MHZ == bw) || (FAPI_BANDWIDTH_20_MHZ == bw))
549             return FAPI_FFT_SIZE_2048;
550         else if ((FAPI_BANDWIDTH_25_MHZ == bw) || (FAPI_BANDWIDTH_30_MHZ == bw)
551             || (FAPI_BANDWIDTH_40_MHZ == bw) || (FAPI_BANDWIDTH_50_MHZ == bw))
552             return FAPI_FFT_SIZE_4096;
553     } else if (FAPI_SUBCARRIER_SPACING_30 == sub_carrier_common) {
554         if ((FAPI_BANDWIDTH_5_MHZ == bw) || (FAPI_BANDWIDTH_10_MHZ == bw))
555             return FAPI_FFT_SIZE_512;
556         else if ((FAPI_BANDWIDTH_15_MHZ == bw) || (FAPI_BANDWIDTH_20_MHZ == bw))
557             return FAPI_FFT_SIZE_1024;
558         else if ((FAPI_BANDWIDTH_25_MHZ == bw) || (FAPI_BANDWIDTH_30_MHZ == bw)
559             || (FAPI_BANDWIDTH_40_MHZ == bw) || (FAPI_BANDWIDTH_50_MHZ == bw))
560             return FAPI_FFT_SIZE_2048;
561         else if ((FAPI_BANDWIDTH_60_MHZ == bw) || (FAPI_BANDWIDTH_70_MHZ == bw)
562             || (FAPI_BANDWIDTH_80_MHZ == bw) || ((FAPI_BANDWIDTH_90_MHZ == bw))
563             || (FAPI_BANDWIDTH_100_MHZ == bw))
564             return FAPI_FFT_SIZE_4096;
565     } else if (FAPI_SUBCARRIER_SPACING_60 == sub_carrier_common) {
566         if ((FAPI_BANDWIDTH_10_MHZ == bw) || (FAPI_BANDWIDTH_15_MHZ == bw) ||
567             (FAPI_BANDWIDTH_20_MHZ == bw) || (FAPI_BANDWIDTH_25_MHZ == bw))
568             return FAPI_FFT_SIZE_512;
569         else if ((FAPI_BANDWIDTH_30_MHZ == bw) || (FAPI_BANDWIDTH_40_MHZ == bw)
570             || (FAPI_BANDWIDTH_50_MHZ == bw))
571             return FAPI_FFT_SIZE_1024;
572         else if ((FAPI_BANDWIDTH_60_MHZ == bw) || (FAPI_BANDWIDTH_70_MHZ == bw)
573             || (FAPI_BANDWIDTH_80_MHZ == bw) || (FAPI_BANDWIDTH_90_MHZ == bw) ||
574             (FAPI_BANDWIDTH_100_MHZ == bw))
575             return FAPI_FFT_SIZE_2048;
576         else if (FAPI_BANDWIDTH_200_MHZ == bw)
577             return FAPI_FFT_SIZE_4096;
578     } else if (FAPI_SUBCARRIER_SPACING_120 == sub_carrier_common) {
579         if (FAPI_BANDWIDTH_50_MHZ == bw)
580             return FAPI_FFT_SIZE_512;
581         else if (FAPI_BANDWIDTH_100_MHZ == bw)
582             return FAPI_FFT_SIZE_1024;
583         else if (FAPI_BANDWIDTH_200_MHZ == bw)
584             return FAPI_FFT_SIZE_2048;
585         else if (FAPI_BANDWIDTH_400_MHZ == bw)
586             return FAPI_FFT_SIZE_4096;
587     } else {
588     }
589
590     return 0;
591 }