Skip to content

Commit

Permalink
Changes in fapi start_request msg as per OAI code base
Browse files Browse the repository at this point in the history
Change-Id: I5c146d31c918c8b52992bc9faa8b6d503fa040e7
Signed-off-by: pborla <[email protected]>
  • Loading branch information
pborla committed Aug 28, 2024
1 parent f44161a commit eb836e0
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 32 deletions.
94 changes: 65 additions & 29 deletions src/5gnrmac/lwr_mac_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,8 @@ uint8_t lwr_mac_procIqSamplesReqEvt(void *msg)
}
#endif

#ifdef OAI_TESTING
#ifdef OAI_TESTING
#define TLV_ALIGN(_tlv_size) (32-_tlv_size)
/*******************************************************************
*
* @brief Build FAPI Config Req as per OAI code and send to PHY
Expand Down Expand Up @@ -2078,65 +2079,65 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg)
msgLen = sizeof(configReq->number_of_tlvs);

fillTlvs(&configReq->tlvs[index++], FAPI_DL_BANDWIDTH_TAG, \
sizeof(uint16_t), macCfgParams.carrCfg.dlBw, &msgLen);
sizeof(uint16_t), macCfgParams.carrCfg.dlBw << TLV_ALIGN(16) , &msgLen);
dlFreq = convertArfcnToFreqKhz(macCfgParams.carrCfg.arfcnDL);
fillTlvs(&configReq->tlvs[index++], FAPI_DL_FREQUENCY_TAG, \
sizeof(uint32_t), dlFreq, &msgLen);
sizeof(uint32_t), dlFreq << TLV_ALIGN(32), &msgLen);
/* Due to bug in Intel FT code, commenting TLVs that are are not
* needed to avoid error. Must be uncommented when FT bug is fixed */
//fillTlvs(&configReq->tlvs[index++], FAPI_DL_K0_TAG, \
sizeof(uint16_t), macCfgParams.dlCarrCfg.k0[0], &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_DL_GRIDSIZE_TAG, \
sizeof(uint16_t), macCfgParams.dlCarrCfg.gridSize[0], &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_NUM_TX_ANT_TAG, \
sizeof(uint16_t), macCfgParams.carrCfg.numTxAnt, &msgLen);
sizeof(uint16_t), macCfgParams.carrCfg.numTxAnt << TLV_ALIGN(16), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_BANDWIDTH_TAG, \
sizeof(uint16_t), macCfgParams.carrCfg.ulBw, &msgLen);
sizeof(uint16_t), macCfgParams.carrCfg.ulBw << TLV_ALIGN(16), &msgLen);
ulFreq = convertArfcnToFreqKhz(macCfgParams.carrCfg.arfcnUL);
fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_FREQUENCY_TAG, \
sizeof(uint32_t), ulFreq, &msgLen);
sizeof(uint32_t), ulFreq << TLV_ALIGN(32), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_UL_K0_TAG, \
sizeof(uint16_t), macCfgParams.ulCarrCfg.k0[0], &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_UL_GRID_SIZE_TAG, \
sizeof(uint16_t), macCfgParams.ulCarrCfg.gridSize[0], &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_NUM_RX_ANT_TAG, \
sizeof(uint16_t), macCfgParams.carrCfg.numRxAnt, &msgLen);
sizeof(uint16_t), macCfgParams.carrCfg.numRxAnt << TLV_ALIGN(16), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG, \
sizeof(uint8_t), macCfgParams.freqShft, &msgLen);

/* fill cell config */
fillTlvs(&configReq->tlvs[index++], FAPI_PHY_CELL_ID_TAG, \
sizeof(uint16_t), macCfgParams.cellCfg.phyCellId, &msgLen);
sizeof(uint16_t), macCfgParams.cellCfg.phyCellId << TLV_ALIGN(16), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_FRAME_DUPLEX_TYPE_TAG, \
sizeof(uint8_t), macCfgParams.cellCfg.dupType, &msgLen);
sizeof(uint8_t), macCfgParams.cellCfg.dupType << TLV_ALIGN(8), &msgLen);

/* fill SSB configuration */
fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_POWER_TAG, \
sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr, &msgLen);
sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr << TLV_ALIGN(32), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_BCH_PAYLOAD_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.bchPayloadFlag, &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_SCS_COMMON_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn, &msgLen);
sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn << TLV_ALIGN(8), &msgLen);

/* fill PRACH configuration */
//fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SEQUENCE_LENGTH_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.prachSeqLen, &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SUBC_SPACING_TAG, \
sizeof(uint8_t), convertScsValToScsEnum(macCfgParams.prachCfg.prachSubcSpacing), &msgLen);
sizeof(uint8_t), convertScsValToScsEnum(macCfgParams.prachCfg.prachSubcSpacing) << TLV_ALIGN(8), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_RESTRICTED_SET_CONFIG_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg, &msgLen);
sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg << TLV_ALIGN(8), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_NUM_PRACH_FD_OCCASIONS_TAG,
sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm, &msgLen);
sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm << TLV_ALIGN(8), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_CONFIG_INDEX_TAG,
sizeof(uint8_t), macCfgParams.prachCfg.prachCfgIdx, &msgLen);
sizeof(uint8_t), macCfgParams.prachCfg.prachCfgIdx << TLV_ALIGN(8), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG, \
sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx, &msgLen);
sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx << TLV_ALIGN(16), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_NUM_ROOT_SEQUENCES_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numRootSeq, &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_K1_TAG, \
sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1 << TLV_ALIGN(16), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ZERO_CORR_CONF_TAG , \
sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg << TLV_ALIGN(8), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen);
/* if(macCfgParams.prachCfg.fdm[0].numUnusedRootSeq)
Expand All @@ -2152,28 +2153,28 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg)
}*/

fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PER_RACH_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach << TLV_ALIGN(8), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, \
sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen);

/* fill SSB table */
fillTlvs(&configReq->tlvs[index++], FAPI_SSB_OFFSET_POINT_A_TAG, \
sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA, &msgLen);
sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA << TLV_ALIGN(16), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_BETA_PSS_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.betaPss, &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PERIOD_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.ssbPeriod, &msgLen);
sizeof(uint8_t), macCfgParams.ssbCfg.ssbPeriod << TLV_ALIGN(8), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_SSB_SUBCARRIER_OFFSET_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.ssbScOffset, &msgLen);
sizeof(uint8_t), macCfgParams.ssbCfg.ssbScOffset << TLV_ALIGN(8), &msgLen);

setMibPdu(macCfgParams.ssbCfg.mibPdu, &mib, 0);
fillTlvs(&configReq->tlvs[index++], FAPI_MIB_TAG , \
sizeof(uint32_t), mib, &msgLen);
sizeof(uint32_t), mib << TLV_ALIGN(32), &msgLen);

fillTlvs(&configReq->tlvs[index++], FAPI_SSB_MASK_TAG, \
sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0], &msgLen);
sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0] << TLV_ALIGN(32), &msgLen);
fillTlvs(&configReq->tlvs[index++], FAPI_BEAM_ID_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.beamId[0], &msgLen);
sizeof(uint8_t), macCfgParams.ssbCfg.beamId[0] << TLV_ALIGN(8), &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, \
sizeof(uint8_t), macCfgParams.ssbCfg.multCarrBand, &msgLen);
//fillTlvs(&configReq->tlvs[index++], FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG, \
Expand All @@ -2182,7 +2183,7 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg)
#ifdef NR_TDD
/* fill TDD table */
fillTlvs(&configReq->tlvs[index++], FAPI_TDD_PERIOD_TAG, \
sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod, &msgLen);
sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod << TLV_ALIGN(8), &msgLen);
for(slotIdx =0 ;slotIdx < MAX_TDD_PERIODICITY_SLOTS; slotIdx++)
{
for(symbolIdx = 0; symbolIdx < MAX_SYMB_PER_SLOT; symbolIdx++)
Expand All @@ -2192,7 +2193,7 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg)
(slotIdx == macCfgParams.tddCfg.nrOfDlSlots && symbolIdx < macCfgParams.tddCfg.nrOfDlSymbols))
{
fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \
sizeof(uint8_t), DL_SYMBOL, &msgLen);
sizeof(uint8_t), DL_SYMBOL << TLV_ALIGN(8), &msgLen);
}

/*Fill Full-FLEXI SLOT and as well as Flexi Symbols in 1 slot preceding FULL-UL slot*/
Expand All @@ -2201,13 +2202,13 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg)
symbolIdx < (MAX_SYMB_PER_SLOT - macCfgParams.tddCfg.nrOfUlSymbols)))
{
fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \
sizeof(uint8_t), FLEXI_SYMBOL, &msgLen);
sizeof(uint8_t), FLEXI_SYMBOL << TLV_ALIGN(8), &msgLen);
}
/*Fill Partial UL symbols and Full-UL slot*/
else
{
fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \
sizeof(uint8_t), UL_SYMBOL, &msgLen);
sizeof(uint8_t), UL_SYMBOL << TLV_ALIGN(8), &msgLen);
}
}
}
Expand Down Expand Up @@ -2589,6 +2590,7 @@ uint8_t lwr_mac_procConfigRspEvt(void *msg)
* ****************************************************************/
uint8_t lwr_mac_procStartReqEvt(void *msg)
{
#ifndef OAI_TESTING
#ifdef INTEL_FAPI
#ifdef CALL_FLOW_DEBUG_LOG
DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : START_REQ\n");
Expand Down Expand Up @@ -2652,6 +2654,40 @@ uint8_t lwr_mac_procStartReqEvt(void *msg)
DU_LOG("\nDEBUG --> LWR_MAC: Sending Start Request to Phy");
LwrMacSendToL1(headerElem);
#endif
#else
fapi_msg_header_t *msgHeader;
fapi_start_req_t *startReq;
p_fapi_api_queue_elem_t headerElem;
p_fapi_api_queue_elem_t startReqElem;

/* Fill FAPI config req */
LWR_MAC_ALLOC(startReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_start_req_t)));
if(!startReqElem)
{
DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for start req");
return RFAILED;
}
FILL_FAPI_LIST_ELEM(startReqElem, NULLP, FAPI_START_REQUEST, 1, sizeof(fapi_start_req_t));
startReq = (fapi_start_req_t *)(startReqElem + 1);
memset(startReq, 0, sizeof(fapi_start_req_t));
fillMsgHeader(&startReq->header, FAPI_START_REQUEST, sizeof(fapi_start_req_t));
/* Fill message header */
LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
if(!headerElem)
{
DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for vendor msg in config req");
LWR_MAC_FREE(startReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_start_req_t)));
return RFAILED;
}
FILL_FAPI_LIST_ELEM(headerElem, startReqElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
sizeof(fapi_msg_header_t));
msgHeader = (fapi_msg_header_t *)(headerElem + 1);
msgHeader->num_msg = 1; /* Start req msg */
msgHeader->handle = 0;
/* Send to PHY */
DU_LOG("\nDEBUG --> LWR_MAC: Sending Start Request to Phy");
LwrMacSendToL1(headerElem);
#endif
return ROK;
} /* lwr_mac_procStartReqEvt */

Expand Down
3 changes: 2 additions & 1 deletion src/5gnrmac/lwr_mac_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
uint16_t fillDlTtiReq(SlotTimingInfo currTimingInfo);
typedef uint8_t (*lwrMacFsmHdlr)(void *);
void lwrMacLayerInit(Region region, Pool pool);

uint16_t reverseBytes16(uint16_t num);
uint32_t reverseBytes32(uint32_t num);
#endif

/**********************************************************************
Expand Down
6 changes: 5 additions & 1 deletion src/5gnrmac/lwr_mac_handle_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,14 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
fapi_msg_t *header = NULLP;
header = (fapi_msg_t *)msg;

#ifdef OAI_TESTING
header->msg_id = reverseBytes16(header->msg_id);
header->length = reverseBytes32(header->length);
#endif
#ifdef CALL_FLOW_DEBUG_LOG
callFlowFromPhyToLwrMac(header->msg_id);
#endif

DU_LOG("\n\nINFO --> LWR_MAC: PHY has received message 0x%02x\n\n", header->msg_id);
switch(header->msg_id)
{
#ifdef INTEL_TIMER_MODE
Expand Down
3 changes: 2 additions & 1 deletion src/5gnrmac/lwr_mac_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,12 @@ void LwrMacRecvPhyMsg()
l1Msg = WLS_Get(wlsHdlr, &msgSize, &msgType, &flag);
if(l1Msg)
{

l1MsgPtr = WLS_PA2VA(wlsHdlr, l1Msg);
currElem = (p_fapi_api_queue_elem_t) l1MsgPtr;
if(currElem->msg_type != FAPI_VENDOR_MSG_HEADER_IND)
{
procPhyMessages(currElem->msg_type, 0, (void *)(currElem + 1));
procPhyMessages(currElem->msg_type, 0, (void *)(currElem + 1));
}
WLS_MEM_FREE(currElem, LWR_MAC_WLS_BUF_SIZE);
}
Expand Down

0 comments on commit eb836e0

Please sign in to comment.