void fapiMacConfigRsp(uint16_t cellId);
uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t prevElem);
uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem);
+uint16_t fillUlDciReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem);
+uint8_t lwr_mac_procStopReqEvt(SlotIndInfo slotInfo, p_fapi_api_queue_elem_t prevElem);
void lwrMacLayerInit(Region region, Pool pool)
{
*
********************************************************************/
-uint8_t lwr_mac_procStopReqEvt(void *msg)
+uint8_t lwr_mac_procStopReqEvt(SlotIndInfo slotInfo, p_fapi_api_queue_elem_t prevElem)
{
#ifdef INTEL_FAPI
- SlotIndInfo *slotInfo;
- fapi_msg_header_t *msgHeader;
fapi_stop_req_t *stopReq;
fapi_vendor_msg_t *vendorMsg;
- p_fapi_api_queue_elem_t headerElem;
p_fapi_api_queue_elem_t stopReqElem;
p_fapi_api_queue_elem_t vendorMsgElem;
- slotInfo = (SlotIndInfo *)msg;
-
/* Allocte And fill Vendor msg */
LWR_MAC_ALLOC(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t)));
if(!vendorMsgElem)
FILL_FAPI_LIST_ELEM(vendorMsgElem, NULLP, FAPI_VENDOR_MESSAGE, 1, sizeof(fapi_vendor_msg_t));
vendorMsg = (fapi_vendor_msg_t *)(vendorMsgElem + 1);
fillMsgHeader(&vendorMsg->header, FAPI_VENDOR_MESSAGE, sizeof(fapi_vendor_msg_t));
- vendorMsg->stop_req_vendor.sfn = slotInfo->sfn;
- vendorMsg->stop_req_vendor.slot = slotInfo->slot;
+ vendorMsg->stop_req_vendor.sfn = slotInfo.sfn;
+ vendorMsg->stop_req_vendor.slot = slotInfo.slot;
/* Fill FAPI stop req */
LWR_MAC_ALLOC(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t)));
memset(stopReq, 0, sizeof(fapi_stop_req_t));
fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, sizeof(fapi_stop_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 header in stop req");
- LWR_MAC_FREE(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t)));
- LWR_MAC_FREE(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t)));
- return RFAILED;
- }
- FILL_FAPI_LIST_ELEM(headerElem, stopReqElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
- sizeof(fapi_msg_header_t));
- msgHeader = (fapi_msg_header_t *)(headerElem + 1);
- msgHeader->num_msg = 2; /* Stop req msg and vendor specific msg */
- msgHeader->handle = 0;
-
/* Send to PHY */
DU_LOG("\nINFO --> LWR_MAC: Sending Stop Request to Phy");
- LwrMacSendToL1(headerElem);
+ prevElem->p_next = stopReqElem;
#endif
return ROK;
uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, MacCellCfg *macCellCfg,
PdschCfg pdschCfg)
{
- uint16_t payloadSize = 0;
+ uint32_t payloadSize = 0;
uint8_t *sib1Payload = NULLP;
fapi_api_queue_elem_t *payloadElem = NULLP;
#ifdef INTEL_WLS_MEM
/* fill the TLV */
payloadSize = pdschCfg.codeword[0].tbSize;
- pduDesc[pduIndex].tlvs[0].tl.tag = FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
- pduDesc[pduIndex].tlvs[0].tl.length = payloadSize;
+ pduDesc[pduIndex].tlvs[0].tl.tag = ((payloadSize & 0xff0000) >> 8) | FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
+ pduDesc[pduIndex].tlvs[0].tl.length = (payloadSize & 0x0000ffff);
LWR_MAC_ALLOC(sib1Payload, payloadSize);
if(sib1Payload == NULLP)
{
fapi_msg_header_t *msgHeader = NULLP;
p_fapi_api_queue_elem_t dlTtiElem;
p_fapi_api_queue_elem_t headerElem;
+ p_fapi_api_queue_elem_t prevElem;
if(lwrMacCb.phyState == PHY_STATE_RUNNING)
{
if(dlTtiElem)
{
FILL_FAPI_LIST_ELEM(dlTtiElem, NULLP, FAPI_DL_TTI_REQUEST, 1, \
- sizeof(fapi_dl_tti_req_t));
+ sizeof(fapi_dl_tti_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 header in DL TTI req");
- LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t)));
- return RFAILED;
- }
- FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
- sizeof(fapi_msg_header_t));
- msgHeader = (fapi_msg_header_t *)(headerElem + 1);
- msgHeader->num_msg = 1;
- msgHeader->handle = 0;
+ /* 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 header in DL TTI req");
+ LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t)));
+ return RFAILED;
+ }
+ FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
+ sizeof(fapi_msg_header_t));
+ msgHeader = (fapi_msg_header_t *)(headerElem + 1);
+ msgHeader->num_msg = 1;
+ msgHeader->handle = 0;
/* Fill Dl TTI Request */
- dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1);
- memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
- fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t));
-
- dlTtiReq->sfn = dlTtiReqTimingInfo.sfn;
- dlTtiReq->slot = dlTtiReqTimingInfo.slot;
- dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo); /* get total Pdus */
- nPdu = dlTtiReq->nPdus;
- dlTtiReq->nGroup = 0;
- if(dlTtiReq->nPdus > 0)
- {
- if(currDlSlot->dlInfo.isBroadcastPres)
- {
- if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
- {
- if(dlTtiReq->pdus != NULLP)
- {
- for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
- {
- fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
- currDlSlot, idx, dlTtiReq->sfn);
- numPduEncoded++;
- }
- }
- DU_LOG("\033[1;31m");
- DU_LOG("\nDEBUG --> LWR_MAC: MIB sent..");
- DU_LOG("\033[0m");
- }
- if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
- {
- /* Filling SIB1 param */
- if(numPduEncoded != nPdu)
- {
- rntiType = SI_RNTI_TYPE;
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
- rntiType, CORESET_TYPE0);
- numPduEncoded++;
- fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
- &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
- currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
- pduIndex);
- pduIndex++;
- numPduEncoded++;
- }
- DU_LOG("\033[1;34m");
+ dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1);
+ memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
+ fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t));
+
+ dlTtiReq->sfn = dlTtiReqTimingInfo.sfn;
+ dlTtiReq->slot = dlTtiReqTimingInfo.slot;
+ dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo); /* get total Pdus */
+ nPdu = dlTtiReq->nPdus;
+ dlTtiReq->nGroup = 0;
+ if(dlTtiReq->nPdus > 0)
+ {
+ if(currDlSlot->dlInfo.isBroadcastPres)
+ {
+ if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
+ {
+ if(dlTtiReq->pdus != NULLP)
+ {
+ for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
+ {
+ fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
+ currDlSlot, idx, dlTtiReq->sfn);
+ numPduEncoded++;
+ }
+ }
+ DU_LOG("\033[1;31m");
+ DU_LOG("\nDEBUG --> LWR_MAC: MIB sent..");
+ DU_LOG("\033[0m");
+ }
+ if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
+ {
+ /* Filling SIB1 param */
+ if(numPduEncoded != nPdu)
+ {
+ rntiType = SI_RNTI_TYPE;
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
+ rntiType, CORESET_TYPE0);
+ numPduEncoded++;
+ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+ &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
+ currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
+ pduIndex);
+ dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex;
+ pduIndex++;
+ numPduEncoded++;
+ }
+
+ DU_LOG("\033[1;34m");
DU_LOG("\nDEBUG --> LWR_MAC: SIB1 sent...");
- DU_LOG("\033[0m");
- }
- }
- if(currDlSlot->dlInfo.rarAlloc != NULLP)
- {
- /* Filling RAR param */
- rntiType = RA_RNTI_TYPE;
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
- numPduEncoded++;
- fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
- &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
- currDlSlot->dlInfo.rarAlloc->bwp,
- pduIndex);
- numPduEncoded++;
- pduIndex++;
-
- DU_LOG("\033[1;32m");
- DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
- DU_LOG("\033[0m");
- }
- if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
- {
- if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
- {
- /* Filling Msg4 param */
- DU_LOG("\033[1;32m");
- if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.isMsg4Pdu)
- {
- rntiType = TC_RNTI_TYPE;
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
- DU_LOG("\nDEBUG --> LWR_MAC: MSG4 sent...");
- }
- else
- {
- /* Filling other DL msg params */
- rntiType = C_RNTI_TYPE;
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE1);
- DU_LOG("\nDEBUG --> LWR_MAC: DL MSG sent...");
+ DU_LOG("\033[0m");
+ }
+ }
+ if(currDlSlot->dlInfo.rarAlloc != NULLP)
+ {
+ /* Filling RAR param */
+ rntiType = RA_RNTI_TYPE;
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+ numPduEncoded++;
+ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+ &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
+ currDlSlot->dlInfo.rarAlloc->bwp,
+ pduIndex);
+ numPduEncoded++;
+ pduIndex++;
+
+ DU_LOG("\033[1;32m");
+ DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
+ DU_LOG("\033[0m");
+ }
+ if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
+ {
+ if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
+ {
+ /* Filling Msg4 param */
+ DU_LOG("\033[1;32m");
+ if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.isMsg4Pdu)
+ {
+ rntiType = TC_RNTI_TYPE;
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+ DU_LOG("\nDEBUG --> LWR_MAC: MSG4 sent...");
}
- DU_LOG("\033[0m");
-
- numPduEncoded++;
- fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
- &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg,
- currDlSlot->dlInfo.dlMsgAlloc->bwp,
- pduIndex);
- numPduEncoded++;
- pduIndex++;
- }
+ else
+ {
+ /* Filling other DL msg params */
+ rntiType = C_RNTI_TYPE;
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE1);
+ DU_LOG("\nDEBUG --> LWR_MAC: DL MSG sent...");
+ }
+ DU_LOG("\033[0m");
+
+ numPduEncoded++;
+ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+ &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg,
+ currDlSlot->dlInfo.dlMsgAlloc->bwp,
+ pduIndex);
+ numPduEncoded++;
+ pduIndex++;
+ }
else
- {
+ {
MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc, sizeof(DlMsgAlloc));
- currDlSlot->dlInfo.dlMsgAlloc = NULLP;
- }
- }
+ currDlSlot->dlInfo.dlMsgAlloc = NULLP;
+ }
+ }
+
+ dlTtiReq->ue_grp_info[dlTtiReq->nGroup].nUe = MAX_NUM_UE_PER_TTI;
+ dlTtiReq->nGroup++;
#ifdef ODU_SLOT_IND_DEBUG_LOG
- DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request");
+ DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request");
#endif
- /* Intel L1 expects UL_TTI.request following DL_TTI.request */
- msgHeader->num_msg++;
+
+ /* Intel L1 expects UL_TTI.request following DL_TTI.request */
fillUlTtiReq(currTimingInfo, dlTtiElem);
- /* send Tx-DATA req message */
- msgHeader->num_msg++;
- sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, dlTtiElem->p_next);
- LwrMacSendToL1(headerElem);
- }
- else
- {
+ msgHeader->num_msg++;
+
+ /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+ fillUlDciReq(currTimingInfo, dlTtiElem->p_next);
+ msgHeader->num_msg++;
+
+ /* send Tx-DATA req message */
+ sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, dlTtiElem->p_next->p_next);
+ if(dlTtiElem->p_next->p_next->p_next)
+ {
+ msgHeader->num_msg++;
+ prevElem = dlTtiElem->p_next->p_next->p_next;
+ }
+ else
+ prevElem = dlTtiElem->p_next->p_next;
+ }
+ else
+ {
#ifdef ODU_SLOT_IND_DEBUG_LOG
- DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request");
+ DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request");
#endif
- /* Intel L1 expects UL_TTI.request following DL_TTI.request */
- msgHeader->num_msg++;
- fillUlTtiReq(currTimingInfo, dlTtiElem);
- LwrMacSendToL1(headerElem);
- }
- memset(currDlSlot, 0, sizeof(MacDlSlot));
- return ROK;
+ /* Intel L1 expects UL_TTI.request following DL_TTI.request */
+ fillUlTtiReq(currTimingInfo, dlTtiElem);
+ msgHeader->num_msg++;
+
+ /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+ fillUlDciReq(currTimingInfo, dlTtiElem->p_next);
+ msgHeader->num_msg++;
+
+ prevElem = dlTtiElem->p_next->p_next;
+ }
+
+ if(macCb.macCell[cellIdx]->state == CELL_TO_BE_STOPPED)
+ {
+ /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+ lwr_mac_procStopReqEvt(currTimingInfo, prevElem);
+ msgHeader->num_msg++;
+ macCb.macCell[cellIdx]->state = CELL_STOP_IN_PROGRESS;
+ }
+ LwrMacSendToL1(headerElem);
+ memset(currDlSlot, 0, sizeof(MacDlSlot));
+ return ROK;
}
else
{
- DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for DL TTI Request");
- memset(currDlSlot, 0, sizeof(MacDlSlot));
- return RFAILED;
+ DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for DL TTI Request");
+ memset(currDlSlot, 0, sizeof(MacDlSlot));
+ return RFAILED;
}
}
else
* RFAILED - failure
*
******************************************************************/
-uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
+uint16_t fillUlDciReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem)
{
#ifdef INTEL_FAPI
uint8_t cellIdx =0;
SlotIndInfo ulDciReqTimingInfo ={0};
MacDlSlot *currDlSlot = NULLP;
fapi_ul_dci_req_t *ulDciReq =NULLP;
- fapi_msg_header_t *msgHeader =NULLP;
p_fapi_api_queue_elem_t ulDciElem;
- p_fapi_api_queue_elem_t headerElem;
if(lwrMacCb.phyState == PHY_STATE_RUNNING)
{
memcpy(&ulDciReqTimingInfo, &currTimingInfo, sizeof(SlotIndInfo));
currDlSlot = &macCb.macCell[cellIdx]->dlSlot[ulDciReqTimingInfo.slot % MAX_SLOTS];
- if(currDlSlot->dlInfo.ulGrant != NULLP)
- {
LWR_MAC_ALLOC(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t)));
if(ulDciElem)
{
ulDciReq->sfn = ulDciReqTimingInfo.sfn;
ulDciReq->slot = ulDciReqTimingInfo.slot;
+ if(currDlSlot->dlInfo.ulGrant != NULLP)
+ {
ulDciReq->numPdus = 1; // No. of PDCCH PDUs
if(ulDciReq->numPdus > 0)
{
/* free UL GRANT at SCH */
MAC_FREE(currDlSlot->dlInfo.ulGrant, sizeof(DciInfo));
currDlSlot->dlInfo.ulGrant = NULLP;
-
- /* 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 UL DCI req header");
- LWR_MAC_FREE(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t)));
- return RFAILED;
- }
- FILL_FAPI_LIST_ELEM(headerElem, ulDciElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
- sizeof(fapi_msg_header_t));
- msgHeader = (fapi_msg_header_t *)(headerElem + 1);
- msgHeader->num_msg = 1;
- msgHeader->handle = 0;
+ }
#ifdef ODU_SLOT_IND_DEBUG_LOG
DU_LOG("\nDEBUG --> LWR_MAC: Sending UL DCI Request");
#endif
- LwrMacSendToL1(headerElem);
- }
}
- else
- {
- DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for UL DCI Request");
- memset(currDlSlot, 0, sizeof(MacDlSlot));
- return RFAILED;
- }
+ prevElem->p_next = ulDciElem;
}
}
else
lwr_mac_procConfigReqEvt,
lwr_mac_procConfigRspEvt,
lwr_mac_procInvalidEvt,
- lwr_mac_procStopReqEvt,
+ lwr_mac_procInvalidEvt,
}
};