Commit 645bcc5e authored by Andrew Burger's avatar Andrew Burger

Merge branch 'episys/andrew/ul_config_req_filtering' into 'episys/master'

Episys/andrew/ul config req filtering

See merge request aburger/openairinterface5g!2
parents ee8781f7 ec4a0551
...@@ -963,8 +963,38 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, ...@@ -963,8 +963,38 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
return 0; return 0;
} }
int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) static bool is_my_ul_config_req(nfapi_ul_config_request_t *req)
{ {
bool is_my_rnti = false;
const rnti_t rnti = UE_mac_inst[0].crnti; // 0 for standalone pnf mode - Andrew
for (int i = 0; i < req->ul_config_request_body.number_of_pdus; i++)
{
nfapi_ul_config_request_pdu_t *pdu = &req->ul_config_request_body.ul_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if ((pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE && pdu->ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE && pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE && pdu->ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE && pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE && pdu->uci_cqi_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE && pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti) ||
(pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE && pdu->uci_cqi_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti))
{
is_my_rnti = true;
break;
}
else
{
LOG_D(MAC, "UNKNOWN UL_CONFIG_REQ PDU_TYPE: %d or RNTI is not mine \n", pdu_type);
}
}
return is_my_rnti;
}
int memcpy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_ul_config_request_t *req)
{
if (!is_my_ul_config_req(req)) return 0;
nfapi_ul_config_request_t *p = malloc(sizeof(nfapi_ul_config_request_t)); nfapi_ul_config_request_t *p = malloc(sizeof(nfapi_ul_config_request_t));
p->sfn_sf = req->sfn_sf; p->sfn_sf = req->sfn_sf;
...@@ -980,14 +1010,17 @@ int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, n ...@@ -980,14 +1010,17 @@ int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, n
p->ul_config_request_body.ul_config_pdu_list = p->ul_config_request_body.ul_config_pdu_list =
calloc(req->ul_config_request_body.number_of_pdus, calloc(req->ul_config_request_body.number_of_pdus,
sizeof(nfapi_ul_config_request_pdu_t)); sizeof(nfapi_ul_config_request_pdu_t));
for (int i = 0; i < p->ul_config_request_body.number_of_pdus; i++) { for (int i = 0; i < p->ul_config_request_body.number_of_pdus; i++)
{
p->ul_config_request_body.ul_config_pdu_list[i] = p->ul_config_request_body.ul_config_pdu_list[i] =
req->ul_config_request_body.ul_config_pdu_list[i]; req->ul_config_request_body.ul_config_pdu_list[i];
} }
if (!put_queue(&ul_config_req_queue, p)) { if (!put_queue(&ul_config_req_queue, p))
{
free(p); free(p);
} }
return 0; return 0;
} }
...@@ -1224,6 +1257,8 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1224,6 +1257,8 @@ void *ue_standalone_pnf_task(void *context)
else else
{ {
// check to see if dl_config_req is null // check to see if dl_config_req is null
LOG_D(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4,
dl_config_req.sfn_sf & 15);
memcpy_dl_config_req(NULL, NULL, &dl_config_req); memcpy_dl_config_req(NULL, NULL, &dl_config_req);
} }
break; break;
...@@ -1240,6 +1275,8 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1240,6 +1275,8 @@ void *ue_standalone_pnf_task(void *context)
else else
{ {
// check to see if tx_req is null // check to see if tx_req is null
LOG_D(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4,
tx_req.sfn_sf & 15);
memcpy_tx_req(NULL, &tx_req); memcpy_tx_req(NULL, &tx_req);
} }
break; break;
......
...@@ -128,13 +128,10 @@ void hi_dci0_req_UE_MAC(int sfn, ...@@ -128,13 +128,10 @@ void hi_dci0_req_UE_MAC(int sfn,
int memcpy_dl_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req); int memcpy_dl_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req);
int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req); int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req);
int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req); int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req);
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req); int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req);
void UE_config_stub_pnf(void); void UE_config_stub_pnf(void);
......
...@@ -516,7 +516,7 @@ int main ( int argc, char **argv ) ...@@ -516,7 +516,7 @@ int main ( int argc, char **argv )
{ {
struct sched_param param = struct sched_param param =
{ {
.sched_priority = sched_get_priority_max(SCHED_RR) .sched_priority = 1
}; };
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 ) if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{ {
......
...@@ -976,12 +976,21 @@ uint64_t clock_usec(void) ...@@ -976,12 +976,21 @@ uint64_t clock_usec(void)
{ {
struct timespec t; struct timespec t;
if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) if (clock_gettime(CLOCK_MONOTONIC, &t) == -1)
{ {
abort(); abort();
} }
return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
} }
static void reset_queue(queue_t *q)
{
void *p;
while ((p = get_queue(q)) != NULL)
{
free(p);
}
}
/*! /*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4. * \brief This is the UE thread for RX subframe n and TX subframe n+4.
* This thread performs the phy_procedures_UE_RX() on every received slot. * This thread performs the phy_procedures_UE_RX() on every received slot.
...@@ -1042,6 +1051,12 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1042,6 +1051,12 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
int num_lone = 0; int num_lone = 0;
int last_sfn_sf = -1; int last_sfn_sf = -1;
LOG_I(MAC, "Clearing Queues\n");
reset_queue(&dl_config_req_queue);
reset_queue(&ul_config_req_queue);
reset_queue(&tx_req_pdu_queue);
reset_queue(&hi_dci0_req_queue);
while (!oai_exit) { while (!oai_exit) {
bool sent_any = false; bool sent_any = false;
if (sem_wait(&sfn_semaphore) != 0) { if (sem_wait(&sfn_semaphore) != 0) {
...@@ -1173,7 +1188,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1173,7 +1188,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
for (ue_index = 0; ue_index < ue_num; ue_index++) { for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0]; UE = PHY_vars_UE_g[ue_Mod_id][0];
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
...@@ -1205,6 +1220,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1205,6 +1220,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// Prepare the future Tx data // Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
(UE->frame_parms.frame_type == FDD)) (UE->frame_parms.frame_type == FDD))
{
if (UE->mode != loop_through_memory) if (UE->mode != loop_through_memory)
{ {
// We make the start of RA between consecutive UEs differ by 20 frames // We make the start of RA between consecutive UEs differ by 20 frames
...@@ -1218,42 +1234,55 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1218,42 +1234,55 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH)
{ //&& ue_Mod_id == next_Mod_id) { { //&& ue_Mod_id == next_Mod_id) {
next_ra_frame++; next_ra_frame++;
if (next_ra_frame > 500) { if (next_ra_frame > 500)
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1)
{ {
// The one working strangely... // check if we have PRACH opportunity
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1)
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
if (prach_resources != NULL)
{ {
LOG_I(MAC, "preamble_received_tar_power: %d\n", // The one working strangely...
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); if (prach_resources != NULL)
fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); {
sent_any = true; LOG_I(MAC, "preamble_received_tar_power: %d\n",
Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew
next_Mod_id = ue_Mod_id + 1; LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
//next_ra_frame = (rx_frame + 20)%1000; fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
next_ra_frame = 0; sent_any = true;
Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
next_Mod_id = ue_Mod_id + 1;
//next_ra_frame = (rx_frame + 20)%1000;
next_ra_frame = 0;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
} }
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
} }
} // mode is PRACH } // mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic. // Generate UL_indications which correspond to UL traffic.
if (ul_config_req != NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ if (ul_config_req != NULL)
{ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
} }
} }
phy_procedures_UE_SL_RX(UE, proc); phy_procedures_UE_SL_RX(UE, proc);
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) }
else
{
LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL)
{
LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf));
}
}
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) { if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
......
...@@ -545,7 +545,7 @@ void init_pdcp(void) { ...@@ -545,7 +545,7 @@ void init_pdcp(void) {
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
struct sched_param param = struct sched_param param =
{ {
.sched_priority = sched_get_priority_max(SCHED_RR) .sched_priority = 1
}; };
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 ) if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment