L1-emul UE: Make independent of numerology
Similarly as the parent commit(s): - remove hardcoding to specific numerology - avoid conversion when we don't need it
This commit is contained in:
+15
-11
@@ -190,18 +190,21 @@ void init_nrUE_standalone_thread(int ue_idx)
|
||||
pthread_setname_np(phy_thread, "oai:nrue-stand-phy");
|
||||
}
|
||||
|
||||
static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
|
||||
static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn, int slot)
|
||||
{
|
||||
struct sfn_slot_s sfn_slot = {.sfn = sfn, .slot = slot};
|
||||
nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
|
||||
nfapi_nr_dl_tti_request_t *dl_tti_request = get_queue(&nr_dl_tti_req_queue);
|
||||
nfapi_nr_ul_dci_request_t *ul_dci_request = get_queue(&nr_ul_dci_req_queue);
|
||||
|
||||
for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++) {
|
||||
LOG_D(NR_MAC,
|
||||
"Try to get a ul_tti_req by matching CRC active SFN_SLOT %d from queue with %lu items\n",
|
||||
sfn_slot,
|
||||
"Try to get a ul_tti_req by matching CRC active sfn/slot %d.%d from queue with %lu items\n",
|
||||
sfn,
|
||||
slot,
|
||||
nr_ul_tti_req_queue.num_items);
|
||||
nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot);
|
||||
struct sfn_slot_s sfn_sf = {.sfn = mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn, .slot = mac->nr_ue_emul_l1.harq[i].active_ul_harq_slot };
|
||||
nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_sf);
|
||||
if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0) {
|
||||
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc);
|
||||
free_and_zero(ul_tti_request_crc);
|
||||
@@ -217,11 +220,11 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
|
||||
free_and_zero(rach_ind);
|
||||
}
|
||||
if (dl_tti_request) {
|
||||
int dl_tti_sfn_slot = NFAPI_SFNSLOT2HEX(dl_tti_request->SFN, dl_tti_request->Slot);
|
||||
nfapi_nr_tx_data_request_t *tx_data_request = unqueue_matching(&nr_tx_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &dl_tti_sfn_slot);
|
||||
struct sfn_slot_s sfn_slot = {.sfn = dl_tti_request->SFN, .slot = dl_tti_request->Slot};
|
||||
nfapi_nr_tx_data_request_t *tx_data_request = unqueue_matching(&nr_tx_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
|
||||
if (!tx_data_request) {
|
||||
LOG_E(NR_MAC, "[%d %d] No corresponding tx_data_request for given dl_tti_request sfn/slot\n",
|
||||
NFAPI_SFNSLOT2SFN(dl_tti_sfn_slot), NFAPI_SFNSLOT2SLOT(dl_tti_sfn_slot));
|
||||
LOG_E(NR_MAC, "[%d.%d] No corresponding tx_data_request for given dl_tti_request sfn/slot\n",
|
||||
dl_tti_request->SFN, dl_tti_request->Slot);
|
||||
if (get_softmodem_params()->nsa)
|
||||
save_nr_measurement_info(dl_tti_request);
|
||||
free_and_zero(dl_tti_request);
|
||||
@@ -263,7 +266,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++) {
|
||||
mac->nr_ue_emul_l1.harq[i].active = false;
|
||||
mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot = -1;
|
||||
mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn = -1;
|
||||
mac->nr_ue_emul_l1.harq[i].active_ul_harq_slot = -1;
|
||||
}
|
||||
|
||||
while (!oai_exit) {
|
||||
@@ -301,7 +305,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
|
||||
if (IS_SA_MODE(get_softmodem_params()) && mac->mib == NULL) {
|
||||
LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n");
|
||||
nr_ue_dl_indication(&mac->dl_info);
|
||||
process_queued_nr_nfapi_msgs(mac, sfn_slot);
|
||||
process_queued_nr_nfapi_msgs(mac, frame, slot);
|
||||
}
|
||||
|
||||
int CC_id = 0;
|
||||
@@ -341,7 +345,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
|
||||
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot);
|
||||
nr_ue_ul_scheduler(mac, &ul_info);
|
||||
}
|
||||
process_queued_nr_nfapi_msgs(mac, sfn_slot);
|
||||
process_queued_nr_nfapi_msgs(mac, frame, slot);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -178,10 +178,11 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
|
||||
crc_ind->crc_list[j].tb_crc_status = 0;
|
||||
crc_ind->crc_list[j].timing_advance = 31;
|
||||
crc_ind->crc_list[j].ul_cqi = 255;
|
||||
AssertFatal(mac->nr_ue_emul_l1.harq[crc_ind->crc_list[j].harq_id].active_ul_harq_sfn_slot == -1,
|
||||
emul_l1_harq_t *harq = &mac->nr_ue_emul_l1.harq[crc_ind->crc_list[j].harq_id];
|
||||
AssertFatal(harq->active_ul_harq_sfn == -1 && harq->active_ul_harq_slot == -1,
|
||||
"We did not send an active CRC when we should have!\n");
|
||||
mac->nr_ue_emul_l1.harq[crc_ind->crc_list[j].harq_id].active_ul_harq_sfn_slot =
|
||||
NFAPI_SFNSLOT2HEX(crc_ind->sfn, crc_ind->slot);
|
||||
harq->active_ul_harq_sfn = crc_ind->sfn;
|
||||
harq->active_ul_harq_slot = crc_ind->slot;
|
||||
LOG_D(NR_MAC,
|
||||
"This is sched sfn/sl [%d %d] and crc sfn/sl [%d %d] with mcs_index in ul_cqi -> %d\n",
|
||||
frame,
|
||||
|
||||
@@ -325,7 +325,8 @@ typedef struct {
|
||||
NRUE MAC layer already does in get_downlink_ack(). */
|
||||
int active_dl_harq_sfn;
|
||||
int active_dl_harq_slot;
|
||||
int active_ul_harq_sfn_slot;
|
||||
int active_ul_harq_sfn;
|
||||
int active_ul_harq_slot;
|
||||
bool active;
|
||||
} emul_l1_harq_t;
|
||||
|
||||
|
||||
@@ -275,59 +275,59 @@ void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id)
|
||||
}
|
||||
}
|
||||
|
||||
bool sfn_slot_matcher(void *wanted, void *candidate)
|
||||
bool sfn_slot_matcher(void *sfn_slot_s, void *candidate)
|
||||
{
|
||||
nfapi_p7_message_header_t *msg = candidate;
|
||||
int sfn_sf = *(int*)wanted;
|
||||
const struct sfn_slot_s *sfn_sf = (const struct sfn_slot_s *)sfn_slot_s;
|
||||
|
||||
switch (msg->message_id)
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
{
|
||||
nfapi_nr_rach_indication_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->slot;
|
||||
return sfn_sf->sfn == ind->sfn && sfn_sf->slot == ind->slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
{
|
||||
nfapi_nr_rx_data_indication_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->slot;
|
||||
return sfn_sf->sfn == ind->sfn && sfn_sf->slot == ind->slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
|
||||
{
|
||||
nfapi_nr_crc_indication_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->slot;
|
||||
return sfn_sf->sfn == ind->sfn && sfn_sf->slot == ind->slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
|
||||
{
|
||||
nfapi_nr_uci_indication_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->slot;
|
||||
return sfn_sf->sfn == ind->sfn && sfn_sf->slot == ind->slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
{
|
||||
nfapi_nr_dl_tti_request_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->SFN && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->Slot;
|
||||
return sfn_sf->sfn == ind->SFN && sfn_sf->slot == ind->Slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
|
||||
{
|
||||
nfapi_nr_tx_data_request_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->SFN && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->Slot;
|
||||
return sfn_sf->sfn == ind->SFN && sfn_sf->slot == ind->Slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
{
|
||||
nfapi_nr_ul_dci_request_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->SFN && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->Slot;
|
||||
return sfn_sf->sfn == ind->SFN && sfn_sf->slot == ind->Slot;
|
||||
}
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
{
|
||||
nfapi_nr_ul_tti_request_t *ind = candidate;
|
||||
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->SFN && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->Slot;
|
||||
return sfn_sf->sfn == ind->SFN && sfn_sf->slot == ind->Slot;
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -630,10 +630,11 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
|
||||
dl_info->slot = ul_dci_req->Slot;
|
||||
}
|
||||
|
||||
static bool send_crc_ind_and_rx_ind(int sfn_slot)
|
||||
static bool send_crc_ind_and_rx_ind(int sfn, int slot)
|
||||
{
|
||||
bool sent_crc_rx = true;
|
||||
|
||||
struct sfn_slot_s sfn_slot = {.sfn = sfn, .slot = slot};
|
||||
nfapi_nr_rx_data_indication_t *rx_ind = unqueue_matching(&nr_rx_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
|
||||
nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&nr_crc_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
|
||||
|
||||
@@ -642,8 +643,9 @@ static bool send_crc_ind_and_rx_ind(int sfn_slot)
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
for (int i = 0; i < crc_ind->number_crcs; i++) {
|
||||
int harq_pid = crc_ind->crc_list[i].harq_id;
|
||||
LOG_T(NR_MAC, "Resetting harq_pid %d active_ul_harq_sfn_slot\n", harq_pid);
|
||||
mac->nr_ue_emul_l1.harq[harq_pid].active_ul_harq_sfn_slot = -1;
|
||||
LOG_T(NR_MAC, "Resetting harq_pid %d active_ul_harq_sfn/slot\n", harq_pid);
|
||||
mac->nr_ue_emul_l1.harq[harq_pid].active_ul_harq_sfn = -1;
|
||||
mac->nr_ue_emul_l1.harq[harq_pid].active_ul_harq_slot = -1;
|
||||
}
|
||||
NR_UL_IND_t UL_INFO = {
|
||||
.crc_ind = *crc_ind,
|
||||
@@ -671,12 +673,11 @@ static bool send_crc_ind_and_rx_ind(int sfn_slot)
|
||||
static void copy_ul_tti_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_ul_tti_request_t *ul_tti_req)
|
||||
{
|
||||
int num_pdus = ul_tti_req->n_pdus;
|
||||
int sfn_slot = NFAPI_SFNSLOT2HEX(ul_tti_req->SFN, ul_tti_req->Slot);
|
||||
AssertFatal(num_pdus >= 0, "Invalid ul_tti_request number of PDUS\n");
|
||||
AssertFatal(num_pdus <= sizeof(ul_tti_req->pdus_list) / sizeof(ul_tti_req->pdus_list[0]),
|
||||
"Too many pdus %d in ul_tti_req\n", num_pdus);
|
||||
|
||||
if (!send_crc_ind_and_rx_ind(sfn_slot))
|
||||
if (!send_crc_ind_and_rx_ind(ul_tti_req->SFN, ul_tti_req->Slot))
|
||||
{
|
||||
LOG_T(NR_MAC, "CRC_RX ind not sent\n");
|
||||
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_req))
|
||||
@@ -1018,8 +1019,7 @@ void *nrue_standalone_pnf_task(void *context)
|
||||
uint16_t *sfn_slot = CALLOC(1, sizeof(*sfn_slot));
|
||||
memcpy(sfn_slot, buffer, sizeof(*sfn_slot));
|
||||
|
||||
LOG_D(NR_PHY, "Received from proxy sfn %d slot %d\n",
|
||||
NFAPI_SFNSLOT2SFN(*sfn_slot), NFAPI_SFNSLOT2SLOT(*sfn_slot));
|
||||
LOG_D(NR_PHY, "Received from proxy sfn_slot %x\n", *sfn_slot);
|
||||
|
||||
if (!put_queue(&nr_sfn_slot_queue, sfn_slot))
|
||||
{
|
||||
|
||||
@@ -312,7 +312,11 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
|
||||
nfapi_nr_ul_dci_request_t *ul_dci_request,
|
||||
nfapi_nr_ul_tti_request_t *ul_tti_request);
|
||||
|
||||
bool sfn_slot_matcher(void *wanted, void *candidate);
|
||||
struct sfn_slot_s {
|
||||
int sfn;
|
||||
int slot;
|
||||
};
|
||||
bool sfn_slot_matcher(void *sfn_slot_s, void *candidate);
|
||||
|
||||
/**\brief interface between L1/L2, indicating the downlink related information, like dci_ind and rx_req
|
||||
\param dl_info including dci_ind and rx_request messages*/
|
||||
|
||||
Reference in New Issue
Block a user