Commit ebee0e12 authored by David Price's avatar David Price
Browse files

Now seem to be getting uplink data, but it is error'd

parent 9f781408
......@@ -924,7 +924,7 @@ void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req)
{
LOG_D(PHY,"[PNF] hi dci0 request sfn_sf:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
LOG_D(PHY,"[PNF] hi dci0 request sfn_sf:%d dci:%d hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
//phy_info* phy = (phy_info*)(pnf_p7->user_data);
......@@ -933,7 +933,7 @@ int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
for (int i=0; i<req->hi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi; i++)
{
LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
//LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)
{
......@@ -1866,7 +1866,7 @@ int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind)
int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
LOG_E(PHY,"%s() retval:%d\n", __FUNCTION__, retval);
LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval);
//free(ind.rx_indication_body.rx_pdu_list);
......
......@@ -551,7 +551,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf)
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10;
LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] proc_rxtx[instance_cnt_rxtx:%d rx:%d%d]\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx, proc_rxtx->frame_rx, proc_rxtx->subframe_rx);
LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] proc_rxtx[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx, proc_rxtx->frame_rx, proc_rxtx->subframe_rx);
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
......@@ -704,14 +704,16 @@ int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_
*dest_ind = *ind;
dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
LOG_E(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
if (ind->crc_indication_body.number_of_crcs==0)
LOG_E(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++)
{
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
LOG_D(MAC, "%s() PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
__FUNCTION__,
NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
i,
ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
......@@ -729,7 +731,10 @@ int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t*
{
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
if (ind->rx_indication_body.number_of_pdus==0)
{
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
}
pthread_mutex_lock(&eNB->UL_INFO_mutex);
......@@ -751,8 +756,9 @@ int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t*
memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
LOG_E(PHY, "%s() handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
LOG_E(PHY, "%s() NFAPI SFN/SF:%d PDUs:%d [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
__FUNCTION__,
NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i,
dest_pdu->rx_ue_information.handle,
dest_pdu->rx_ue_information.rnti,
dest_pdu->rx_indication_rel8.length,
......@@ -780,17 +786,17 @@ int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t*
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_sr_indication_t *dest_ind = &eNB->UL_INFO.sr_ind;
nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
nfapi_sr_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
*dest_ind = *ind;
dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list;
for (i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++)
for (int i=0;i<eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs;i++)
{
nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i];
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
......@@ -1382,7 +1388,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, dl_config_req->header.message_id);
LOG_D(PHY, "[VNF] %s() DL_CONFIG p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d pdcch:%d dci:%d pdu:%d pdsch_rnti:%d pcfich:%d\n", __FUNCTION__, p7_config, dl_config_req->header.phy_id, dl_config_req->header.message_id, NFAPI_SFNSF2DEC(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols, dl_config_req->dl_config_request_body.number_dci, dl_config_req->dl_config_request_body.number_pdu, dl_config_req->dl_config_request_body.number_pdsch_rnti, dl_config_req->dl_config_request_body.transmission_power_pcfich);
LOG_D(PHY, "[VNF] %s() DL_CONFIG sfn_sf:%d pdcch:%d dci:%d pdu:%d pdsch_rnti:%d pcfich:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols, dl_config_req->dl_config_request_body.number_dci, dl_config_req->dl_config_request_body.number_pdu, dl_config_req->dl_config_request_body.number_pdsch_rnti, dl_config_req->dl_config_request_body.transmission_power_pcfich);
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
......@@ -1404,7 +1410,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
LOG_D(PHY, "[VNF] %s() TX_REQ p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, p7_config, tx_req->header.phy_id, tx_req->header.message_id, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
......@@ -1426,7 +1432,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req)
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d number_of_dci:%d number_of_hi:%d\n", __FUNCTION__, p7_config, hi_dci0_req->header.phy_id, hi_dci0_req->header.message_id, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
......@@ -1451,8 +1457,8 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req)
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
LOG_D(PHY, "[VNF] %s() UL_CONFIG p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
__FUNCTION__, p7_config, ul_config_req->header.phy_id, ul_config_req->header.message_id, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf),
LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
__FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf),
ul_config_req->ul_config_request_body.number_of_pdus,
ul_config_req->ul_config_request_body.rach_prach_frequency_resources,
ul_config_req->ul_config_request_body.srs_present);
......
......@@ -817,7 +817,7 @@ typedef struct {
uint8_t narrowband;
/// number of PRB pairs for MPDCCH
uint8_t number_of_prb_pairs;
/// mpdcch resource assignement (combinatorial index r)
/// mpdcch resource assignment (combinatorial index r)
uint8_t resource_block_assignment;
/// transmission type (0=localized,1=distributed)
uint8_t transmission_type;
......
......@@ -623,6 +623,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu, eNB->pdcch_vars[subframe&1].num_pdcch_symbols);
int do_oai =0;
int dont_send =0;
if ((subframe_select(fp,ul_subframe)==SF_UL) ||
(fp->frame_type == FDD)) {
......@@ -666,7 +667,15 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
// handle_nfapi_mch_dl_pdu(eNB,dl_config_pdu);
break;
case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
LOG_D(PHY,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d data:%p\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index, TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
{
nfapi_dl_config_dlsch_pdu_rel8_t *dlsch_pdu_rel8 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8;
uint16_t pdu_index = dlsch_pdu_rel8->pdu_index;
uint16_t tx_pdus = TX_req->tx_request_body.number_of_pdus;
uint16_t invalid_pdu = pdu_index == -1;
uint8_t *sdu = invalid_pdu ? NULL : pdu_index >= tx_pdus ? NULL : TX_req->tx_request_body.tx_pdu_list[pdu_index].segments[0].segment_data;
LOG_D(PHY,"%s() [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n",
__FUNCTION__, i, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, dlsch_pdu_rel8->transport_blocks, pdu_index, sdu);
/*
AssertFatal(dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index<TX_req->tx_request_body.number_of_pdus,
......@@ -674,14 +683,20 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
TX_req->tx_request_body.number_of_pdus);
*/
AssertFatal((dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks<3) &&
(dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks>0),
"dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = %d not in [1,2]\n",
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks);
handle_nfapi_dlsch_pdu(eNB,proc,dl_config_pdu,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks-1,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index == -1 ? NULL
: TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
AssertFatal((dlsch_pdu_rel8->transport_blocks<3) &&
(dlsch_pdu_rel8->transport_blocks>0),
"dlsch_pdu_rel8->transport_blocks = %d not in [1,2]\n",
dlsch_pdu_rel8->transport_blocks);
if (sdu != NULL)
{
handle_nfapi_dlsch_pdu(eNB,proc,dl_config_pdu, dlsch_pdu_rel8->transport_blocks-1, sdu);
}
else
{
dont_send=1;
LOG_E(MAC,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE sdu is NULL DL_CFG:SFN/SF:%d:pdu_index:%d TX_REQ:SFN/SF:%d:pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(DL_req->sfn_sf), pdu_index, NFAPI_SFNSF2DEC(TX_req->sfn_sf), tx_pdus);
}
// Send the data first so that the DL_CONFIG can just pluck it out of the buffer
// DJP - OAI was here - moved to bottom
......@@ -697,6 +712,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
subframe);
} */
}
break;
case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
// handle_nfapi_pch_pdu(eNB,dl_config_pdu);
......@@ -717,7 +733,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
}
if (nfapi_mode && do_oai) {
if (nfapi_mode && do_oai && !dont_send) {
oai_nfapi_tx_req(Sched_INFO->TX_req);
oai_nfapi_dl_config_req(Sched_INFO->DL_req); // DJP - .dl_config_request_body.dl_config_pdu_list[0]); // DJP - FIXME TODO - yuk - only copes with 1 pdu
......
......@@ -788,8 +788,8 @@ void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,u
nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body;
nfapi_sr_indication_pdu_t *pdu = &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs];
sr_ind.sfn_sf = frame<<4|subframe;
sr_ind.header.message_id = NFAPI_RX_SR_INDICATION;
sr_ind->sfn_sf = frame<<4|subframe;
sr_ind->header.message_id = NFAPI_RX_SR_INDICATION;
sr_ind_body->tl.tag = NFAPI_SR_INDICATION_BODY_TAG;
......
......@@ -106,6 +106,7 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
extern void mac_top_init_eNB(void );
extern uint8_t nfapi_mode;
extern uint8_t sf_ahead;
......@@ -390,6 +391,7 @@ void RCconfig_macrlc() {
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
nfapi_mode = 2;
sf_ahead=3;
printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
......
......@@ -63,6 +63,7 @@
#include "T.h"
extern uint8_t nfapi_mode;
extern uint8_t sf_ahead;
extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset)
......@@ -664,10 +665,9 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
// set HARQ process round to 0 for this UE
if (cc->tdd_Config) RA_template->harq_pid = ((frameP*10)+subframeP)%10;
else RA_template->harq_pid = ((frameP*10)+subframeP)&7;
if (cc->tdd_Config) RA_template->harq_pid = ((RA_template->Msg4_frame*10)+RA_template->Msg4_subframe)%10;
else RA_template->harq_pid = ((RA_template->Msg4_frame*10)+RA_template->Msg4_subframe)&7;
// Get RRCConnectionSetup for Piggyback
rrc_sdu_length = mac_rrc_data_req(module_idP,
CC_idP,
......@@ -683,8 +683,8 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
"[MAC][eNB Scheduler] CCCH not allocated\n");
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n",
module_idP, CC_idP, frameP, subframeP,UE_id, rrc_sdu_length);
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d MSG4:SFN/SF:%d%d UE_id %d, rrc_sdu_length %d\n",
module_idP, CC_idP, frameP, subframeP,RA_template->Msg4_frame,RA_template->Msg4_subframe,UE_id, rrc_sdu_length);
#ifdef Rel14
......@@ -711,7 +711,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
first_rb = narrowband_to_first_rb(&cc[CC_idP],RA_template->msg34_narrowband);
if ((RA_template->msg4_mpdcch_repetition_cnt == 0) &&
(mpdcch_sf_condition(eNB,CC_idP,frameP,subframeP,rmax,TYPE2,-1)>0)){
(mpdcch_sf_condition(eNB,CC_idP,RA_template->Msg4_frame,RA_template->Msg4_subframe,rmax,TYPE2,-1)>0)){
// MPDCCH configuration for RAR
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
......@@ -732,7 +732,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = RA_template->RA_rnti;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (RA_template->rach_resource_type < 3) ? 1 : 2;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId; /// Check this is still N_id_cell for type2 common
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP*10)+subframeP;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (RA_template->Msg4_frame*10)+RA_template->Msg4_subframe;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6,0,6);// check if not getRIV(N_RB_DL,first_rb,6);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of Msg4, 208 bits with N1A_PRB=3
......@@ -765,7 +765,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
dl_req_body->number_pdu++;
dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_req->sfn_sf = (frameP<<4)+subframeP;
dl_req->sfn_sf = (RA_template->Msg4_frame<<4)+RA_template->Msg4_subframe;
dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
} //repetition_count==0 && SF condition met
......@@ -774,9 +774,9 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
if (RA_template->msg4_mpdcch_repetition_cnt==reps) { // this is the last mpdcch repetition
if (cc[CC_idP].tdd_Config==NULL) { // FDD case
// wait 2 subframes for PDSCH transmission
if (subframeP>7) RA_template->Msg4_frame = (frameP+1)&1023;
if (RA_template->Msg4_subframe>7) RA_template->Msg4_frame = (frameP+1)&1023;
else RA_template->Msg4_frame = frameP;
RA_template->Msg4_subframe = (subframeP+2)%10;
RA_template->Msg4_subframe = (RA_template->Msg4_subframe+2)%10;
}
else {
AssertFatal(1==0,"TDD case not done yet\n");
......@@ -939,7 +939,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
else
#endif
{ // This is normal LTE case
if ((RA_template->Msg4_frame == frameP) && (RA_template->Msg4_subframe == subframeP)) {
if (1){ // || (RA_template->Msg4_frame == frameP) && (RA_template->Msg4_subframe == subframeP)) {
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP,RA_template->rnti);
......@@ -986,9 +986,10 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
1, // ndi
0, // rv
0); // vrb_flag
LOG_D(MAC,"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
LOG_D(MAC,"Frame %d, subframe %d: Msg4 SFN/SF:%d%d DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
frameP,
subframeP,
RA_template->Msg4_frame, RA_template->Msg4_subframe,
dl_req_body->number_pdu,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type,
......@@ -999,31 +1000,48 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
"resource_block_coding %u < 8192\n",
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
if (!CCE_allocation_infeasible(module_idP,CC_idP,1,
subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
RA_template->Msg4_subframe,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
RA_template->rnti)) {
dl_req_body->number_dci++;
dl_req_body->number_pdu++;
dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_req->sfn_sf = frameP<<4|subframeP;
dl_req->sfn_sf = RA_template->Msg4_frame<<4|RA_template->Msg4_subframe;
dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
RA_template->generate_Msg4=0;
RA_template->wait_ack_Msg4=1;
uint16_t orig_Msg4_frame = RA_template->Msg4_frame;
uint16_t orig_Msg4_subframe = RA_template->Msg4_subframe;
// increment Absolute subframe by 8 for Msg4 retransmission
LOG_D(MAC,"Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n",
frameP,subframeP,RA_template->Msg4_frame,RA_template->Msg4_subframe);
if (RA_template->Msg4_subframe > 1) RA_template->Msg4_frame++;
RA_template->Msg4_frame&=1023;
RA_template->Msg4_subframe = (RA_template->Msg4_subframe+8)%10;
LOG_D(MAC,"Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
//if (RA_template->Msg4_subframe > 1) RA_template->Msg4_frame++;
//RA_template->Msg4_frame&=1023;
//RA_template->Msg4_subframe = (RA_template->Msg4_subframe+8)%10;
// Expect +8 for TX->UL:ACK
uint16_t retrans_frame = RA_template->Msg4_frame;
uint16_t retrans_subframe = RA_template->Msg4_subframe;
add_subframe(&retrans_frame, &retrans_subframe, 8+sf_ahead);
RA_template->Msg4_frame = retrans_frame;
RA_template->Msg4_subframe = retrans_subframe;
LOG_D(MAC,"Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
frameP,subframeP,RA_template->Msg4_frame,RA_template->Msg4_subframe);
lcid=0;
// DJP - FIXME TODO TDD broken
//
// put HARQ process round to 0
if (cc->tdd_Config) RA_template->harq_pid = ((frameP*10)+subframeP)%10;
else RA_template->harq_pid = ((frameP*10)+subframeP)&7;
if (cc->tdd_Config) RA_template->harq_pid = ((RA_template->Msg4_frame*10)+RA_template->Msg4_subframe)%10;
else RA_template->harq_pid = dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process;
//else RA_template->harq_pid = ((RA_template->Msg4_frame*10)+RA_template->Msg4_subframe)&7;
UE_list->UE_sched_ctrl[UE_id].round[CC_idP][RA_template->harq_pid] = 0;
if ((RA_template->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
......@@ -1034,8 +1052,8 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
msg4_post_padding = RA_template->msg4_TBsize - rrc_sdu_length - msg4_header -1;
}
LOG_D(MAC,"[eNB %d][RAPROC] CC_idP %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
module_idP,CC_idP,frameP,subframeP,RA_template->msg4_TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding);
LOG_D(MAC,"[eNB %d][RAPROC] CC_idP %d Frame %d subframeP %d Msg4 : SFN/SF:%d%d TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
module_idP,CC_idP,frameP,subframeP,orig_Msg4_frame,orig_Msg4_subframe,RA_template->msg4_TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding);
DevAssert( UE_id != UE_INDEX_INVALID ); // FIXME not sure how to gracefully return
// CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
......@@ -1081,7 +1099,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
// DL request
eNB->TX_req[CC_idP].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_idP].tx_request_body,
(frameP*10)+subframeP,
(orig_Msg4_frame*10)+orig_Msg4_subframe,
rrc_sdu_length,
eNB->pdu_index[CC_idP],
eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]);
......@@ -1094,7 +1112,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
fill_nfapi_uci_acknak(module_idP,
CC_idP,
RA_template->rnti,
(frameP*10)+subframeP,
(orig_Msg4_frame*10)+orig_Msg4_subframe,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
......@@ -1300,8 +1318,8 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP)
if (RA_template->RA_active == TRUE) {
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA %d is active (generate RAR %d, generate_Msg4 %d, wait_ack_Msg4 %d, rnti %x)\n",
module_idP,frameP,subframeP,CC_id,i,RA_template->generate_rar,RA_template->generate_Msg4,RA_template->wait_ack_Msg4, RA_template->rnti);
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA %d is active (generate RAR %d, generate_Msg4 %d[SFN/SF:%d%d], wait_ack_Msg4 %d, rnti %x)\n",
module_idP,frameP,subframeP,CC_id,i,RA_template->generate_rar,RA_template->generate_Msg4,RA_template->Msg4_frame,RA_template->Msg4_subframe,RA_template->wait_ack_Msg4, RA_template->rnti);
if (RA_template->generate_rar == 1) generate_Msg2(module_idP,CC_id,frameP,subframeP,RA_template);
else if (RA_template->generate_Msg4 == 1) generate_Msg4(module_idP,CC_id,frameP,subframeP,RA_template);
......
......@@ -543,8 +543,6 @@ schedule_ue_spec(
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
//LOG_D(MAC,"%s() BEFORE mbsfn_flag[CC_id]:%d dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, mbsfn_flag[CC_id], dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
if (mbsfn_flag[CC_id]>0)
continue;
......@@ -586,7 +584,6 @@ schedule_ue_spec(
}
} /* if (continue_flag != 1 */
//LOG_D(MAC,"%s() BEFORE mbsfn_flag[CC_id]:%d dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, mbsfn_flag[CC_id], dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated
CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,aggregation,rnti)
) {
......@@ -604,7 +601,6 @@ schedule_ue_spec(
set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
}
//LOG_D(MAC,"%s() BEFORE mbsfn_flag[CC_id]:%d continue_flag:%d dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, mbsfn_flag[CC_id], continue_flag, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
if (continue_flag == 1 ) {
//LOG_D(MAC,"[eNB %d] Frame %d : UE %d on CC_id %d: continue flag - add_ue_dlsch_info\n", module_idP, frameP, UE_id, CC_id);
add_ue_dlsch_info(module_idP,
......@@ -612,10 +608,8 @@ schedule_ue_spec(
UE_id,
subframeP,
S_DL_NONE);
//LOG_D(MAC,"%s() BEFORE mbsfn_flag[CC_id]:%d continue_flag:%d dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, mbsfn_flag[CC_id], continue_flag, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
continue;
}
//LOG_D(MAC,"%s() BEFORE mbsfn_flag[CC_id]:%d continue_flag:%d dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, mbsfn_flag[CC_id], continue_flag, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
#if 0
......@@ -724,7 +718,6 @@ schedule_ue_spec(
}
*/
LOG_D(MAC,"%s() BEFORE dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
switch (get_tmode(module_idP,CC_id,UE_id)) {
case 1:
case 2:
......@@ -797,9 +790,7 @@ schedule_ue_spec(
LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n",eNB->pdu_index[CC_id],round);
LOG_D(MAC,"%s() BEFORE dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
LOG_D(MAC,"%s() BEFORE dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
// No TX request for retransmission (check if null request for FAPI)
}
else {
......@@ -1235,8 +1226,6 @@ schedule_ue_spec(
tpc = 1; //0
}
LOG_D(MAC,"%s() BEFORE 2 dl_config dci:%d pdu:%d\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
......@@ -1314,14 +1303,12 @@ schedule_ue_spec(
0, //number of PRBs treated as one subband, not used here
0 // number of beamforming vectors, not used here
);
LOG_D(MAC,"%s() BEFORE dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body,
(frameP*10)+subframeP,
TBS,
eNB->pdu_index[CC_id],
eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]);
LOG_D(MAC,"%s() BEFORE dl_config dci:%d pdu:%d TX_REQ[pdus:%d]\n", __FUNCTION__, dl_req->number_dci, dl_req->number_pdu, eNB->TX_req[CC_id].tx_request_body.number_of_pdus);
LOG_D(MAC,"SFN/SF:%d Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",NFAPI_SFNSF2DEC(eNB->TX_req[CC_id].sfn_sf), eNB->pdu_index[CC_id]);
eNB->pdu_index[CC_id]++;
......
......@@ -454,6 +454,8 @@ abort();
// Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different
RA_template->Msg4_frame = frameP + ((subframeP>5) ? 1 : 0);
RA_template->Msg4_subframe = (subframeP+4)%10;
LOG_D(MAC,"CCCH: rnti matches RA_active : Msg4 scheduled for frame:%d subframe:%d (current frame:%d subframe:%d)\n",RA_template->Msg4_frame, RA_template->Msg4_subframe,frameP,subframeP);
} // if process is active
} // loop on RA processes
......@@ -567,7 +569,7 @@ abort();
}
// Program ACK for PHICH
LOG_D(MAC,"SFN/SF:%d/%d Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",frameP,subframeP,rntiP,harq_pid,first_rb);
LOG_D(MAC,"SFN/SF:%d%d Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",frameP,subframeP,rntiP,harq_pid,first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_idP];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci+hi_dci0_req_body->number_of_hi];
......
......@@ -178,7 +178,7 @@ void _store_dlsch_buffer (module_id_t Mod_id,
*/
if (UE_template->dl_buffer_info[i]>0)
LOG_D(MAC,
"[eNB %d][SLICE %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
"[eNB %d][SLICE %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmented %d \n",
Mod_id, slice_id,frameP, subframeP, UE_id,
i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
UE_template->dl_buffer_head_sdu_creation_time[i],
......@@ -275,7 +275,7 @@ void _assign_rbs_required (module_id_t Mod_id,
TBS = mac_xface->get_TBS_DL(cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)], nb_rbs_required[CC_id][UE_id]);
nb_rbs_allowed_slice[CC_id][slice_id] = flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],
flexran_get_N_RB_DL(Mod_id, CC_id));
LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
LOG_D(MAC,"[preprocessor] start RB assignment for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total,
nb_rbs_required[CC_id][UE_id], flexran_get_ue_wcqi(Mod_id, UE_id), TBS);
......@@ -548,11 +548,11 @@ void _dlsch_scheduler_pre_processor (module_id_t Mod_id,
}
// hypotetical assignement
// hypotetical assignment
/*
* If schedule is enabled and if the priority of the UEs is modified
* The average rbs per logical channel per user will depend on the level of
* priority. Concerning the hypothetical assignement, we should assign more
* priority. Concerning the hypothetical assignment, we should assign more
* rbs to prioritized users. Maybe, we can do a mapping between the
* average rbs per user and the level of priority or multiply the average rbs
* per user by a coefficient which represents the degree of priority.
......
......@@ -144,7 +144,7 @@ void store_dlsch_buffer (module_id_t Mod_id,
*/
if (UE_template->dl_buffer_info[i]>0)
LOG_D(MAC,
"[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
"[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmented %d \n",
Mod_id, frameP, subframeP, UE_id,
i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
UE_template->dl_buffer_head_sdu_creation_time[i],
......@@ -230,7 +230,7 @@ void assign_rbs_required (module_id_t Mod_id,
TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]);
LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
LOG_D(MAC,"[preprocessor] start RB assignment for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total,
nb_rbs_required[CC_id][UE_id],eNB_UE_stats->dlsch_mcs1,TBS);
......@@ -607,7 +607,7 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
/*
* If schedule is enabled and if the priority of the UEs is modified
* The average rbs per logical channel per user will depend on the level of
* priority. Concerning the hypothetical assignement, we should assign more
* priority. Concerning the hypothetical assignment, we should assign more
* rbs to prioritized users. Maybe, we can do a mapping between the
* average rbs per user and the level of priority or multiply the average rbs
* per user by a coefficient which represents the degree of priority.
......
......@@ -66,9 +66,12 @@ void handle_sr(UL_IND_t *UL_info) {
int i;
if (nfapi_mode == 1)
if (nfapi_mode == 1) // PNF
{
oai_nfapi_sr_indication(&UL_info->sr_ind);
if