Commit b91251d1 authored by Melissa Elkadi's avatar Melissa Elkadi

Changed nsa_send_standalone_msg() and sending RX

The send_standlone_msg will now be able to send
any type of uplink message and we fill the RX
indication in the stub_schedule_response and
are trying to send to gNB. Need to update the NR nfapi.
parent 0752dd20
......@@ -147,32 +147,32 @@ void init_nrUE_standalone_thread(int ue_idx)
static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_prach_pdu *prach_pdu)
{
nfapi_nr_rach_indication_t rach_ind;
memset(&rach_ind, 0, sizeof(rach_ind));
rach_ind.sfn = frame;
rach_ind.slot = slot;
rach_ind.header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
NR_UL_IND_t UL_INFO;
nfapi_nr_rach_indication_t *rach_ind = &UL_INFO.rach_ind;
rach_ind->sfn = frame;
rach_ind->slot = slot;
rach_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
uint8_t pdu_index = 0;
rach_ind.pdu_list = CALLOC(1, sizeof(*rach_ind.pdu_list));
rach_ind.number_of_pdus = 1;
rach_ind.pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id;
rach_ind.pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol;
rach_ind.pdu_list[pdu_index].slot_index = prach_pdu->prach_slot;
rach_ind.pdu_list[pdu_index].freq_index = prach_pdu->num_ra; //Melissa Fill these things from the prach pdu
rach_ind.pdu_list[pdu_index].avg_rssi = 128;
rach_ind.pdu_list[pdu_index].avg_snr = 0xff; // invalid for now
rach_ind.pdu_list[pdu_index].num_preamble = 1;
const int num_p = rach_ind.pdu_list[pdu_index].num_preamble;
rach_ind.pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t));
rach_ind.pdu_list[pdu_index].preamble_list[0].preamble_index = 63; //Melissa, need to get this out of rrc_reconfig_msg
rach_ind.pdu_list[pdu_index].preamble_list[0].timing_advance = 0;
rach_ind.pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
send_nsa_standalone_msg(&rach_ind);
free(rach_ind.pdu_list[pdu_index].preamble_list);
free(rach_ind.pdu_list);
rach_ind->pdu_list = CALLOC(1, sizeof(*rach_ind->pdu_list));
rach_ind->number_of_pdus = 1;
rach_ind->pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id;
rach_ind->pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol;
rach_ind->pdu_list[pdu_index].slot_index = prach_pdu->prach_slot;
rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; //Melissa Fill these things from the prach pdu
rach_ind->pdu_list[pdu_index].avg_rssi = 128;
rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now
rach_ind->pdu_list[pdu_index].num_preamble = 1;
const int num_p = rach_ind->pdu_list[pdu_index].num_preamble;
rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t));
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = 63; //Melissa, need to get this out of rrc_reconfig_msg
rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
send_nsa_standalone_msg(&UL_INFO, rach_ind->header.message_id);
free(rach_ind->pdu_list[pdu_index].preamble_list);
free(rach_ind->pdu_list);
}
static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
......
......@@ -55,46 +55,40 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
to get other information. Need rnti., Fill rx_ind that goes up on socket */
if(scheduled_response != NULL){
module_id_t module_id = scheduled_response->module_id;
uint8_t cc_id = scheduled_response->CC_id;
int slot = scheduled_response->slot;
int thread_id = scheduled_response->thread_id;
if (scheduled_response->ul_config != NULL){
fapi_nr_ul_config_request_t *ul_config = scheduled_response->ul_config;
for (int i = 0; i < ul_config->number_pdus; ++i)
{
LOG_I(PHY, "Melissa In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n",
LOG_I(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n",
__FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type;
uint8_t pucch_resource_id = 0;
uint8_t current_harq_pid = 0;
uint8_t format = 0;
uint8_t gNB_id = 0;
nfapi_nr_rx_data_indication_t rx_ind;
switch (pdu_type)
{
case (FAPI_NR_UL_CONFIG_TYPE_PUSCH):
{
NR_UL_IND_t UL_INFO;
nfapi_nr_rx_data_indication_t *rx_ind = &UL_INFO.rx_ind;
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
if (scheduled_response->tx_request) {
rx_ind.header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
rx_ind.slot = scheduled_response->tx_request->slot;
rx_ind.sfn = scheduled_response->tx_request->sfn;
rx_ind.number_of_pdus = scheduled_response->tx_request->number_of_pdus;
if (scheduled_response->tx_request)
{
rx_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
rx_ind->slot = scheduled_response->tx_request->slot;
rx_ind->sfn = scheduled_response->tx_request->sfn;
rx_ind->number_of_pdus = scheduled_response->tx_request->number_of_pdus;
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[i];
rx_ind.pdu_list = CALLOC(1, sizeof(*rx_ind.pdu_list));
rx_ind.pdu_list[i].pdu = tx_req_body->pdu;
rx_ind.pdu_list[i].pdu_length = tx_req_body->pdu_length;
rx_ind.pdu_list[i].rnti = pusch_config_pdu->rnti;
rx_ind.pdu_list[i].handle = pusch_config_pdu->handle;
rx_ind->pdu_list = CALLOC(1, sizeof(*rx_ind->pdu_list));
rx_ind->pdu_list[i].pdu = tx_req_body->pdu;
rx_ind->pdu_list[i].pdu_length = tx_req_body->pdu_length;
rx_ind->pdu_list[i].rnti = pusch_config_pdu->rnti;
rx_ind->pdu_list[i].handle = pusch_config_pdu->handle;
scheduled_response->tx_request->number_of_pdus = 0;
LOG_I(PHY, "Melissa In %s: Filled rx_ind with tx_req \n", __FUNCTION__);
LOG_I(PHY, "Melissa In %s: Filled rx_indwith tx_req \n", __FUNCTION__);
send_nsa_standalone_msg(&UL_INFO, rx_ind->header.message_id);
free(rx_ind->pdu_list);
}
break;
......
......@@ -34,6 +34,7 @@
#define __FAPI_NR_UE_L1_H__
#include "NR_IF_Module.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
/**\brief NR UE FAPI-like P7 messages, scheduled response from L2 indicating L1
\param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/
......
......@@ -941,7 +941,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
tx_req.tx_request_body[0].pdu_index = j;
tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ //Melissa change this accordingly
if (ra->ra_state != RA_SUCCEEDED && !ra->cfra || get_softmodem_params()->nsa && ra->cfra && ra->ra_state==RA_SUCCEEDED){ //Melissa change this accordingly
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
}
}
......
......@@ -127,23 +127,59 @@ void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
tx_port, rx_port, addr);
}
void send_nsa_standalone_msg(nfapi_nr_rach_indication_t *rach_ind)
void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id)
{
char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
int encoded_size = nfapi_nr_p7_message_pack(rach_ind, buffer, sizeof(buffer), NULL);
if (encoded_size <= 0)
switch(msg_id)
{
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
{
LOG_E(NR_MAC, "nfapi_nr_p7_message_pack has failed. Encoded size = %d\n", encoded_size);
return;
}
char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
LOG_I(NR_MAC, "Melissa, this is RACH header id :%d", UL_INFO->rach_ind.header.message_id);
int encoded_size = nfapi_nr_p7_message_pack(&UL_INFO->rach_ind, buffer, sizeof(buffer), NULL);
if (encoded_size <= 0)
{
LOG_E(NR_MAC, "nfapi_nr_p7_message_pack has failed. Encoded size = %d\n", encoded_size);
return;
}
LOG_I(NR_MAC, "NR_RACH_IND sent to Proxy, Size: %d Frame %d Slot %d Num PDUS %d\n", encoded_size,
rach_ind->sfn, rach_ind->slot, rach_ind->number_of_pdus);
if (send(ue_tx_sock_descriptor, buffer, encoded_size, 0) < 0)
LOG_I(NR_MAC, "NR_RACH_IND sent to Proxy, Size: %d Frame %d Slot %d Num PDUS %d\n", encoded_size,
UL_INFO->rach_ind.sfn, UL_INFO->rach_ind.slot, UL_INFO->rach_ind.number_of_pdus);
if (send(ue_tx_sock_descriptor, buffer, encoded_size, 0) < 0)
{
LOG_E(NR_MAC, "Send Proxy NR_UE failed\n");
return;
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
{
LOG_E(NR_MAC, "Send Proxy NR_UE failed\n");
return;
char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
LOG_I(NR_MAC, "Melissa, this is RX header id :%d", UL_INFO->rx_ind.header.message_id);
int encoded_size = nfapi_nr_p7_message_pack(&UL_INFO->rx_ind, buffer, sizeof(buffer), NULL);
if (encoded_size <= 0)
{
LOG_E(NR_MAC, "nfapi_nr_p7_message_pack has failed. Encoded size = %d\n", encoded_size);
return;
}
LOG_I(NR_MAC, "NR_RX_IND sent to Proxy, Size: %d Frame %d Slot %d Num PDUS %d\n", encoded_size,
UL_INFO->rx_ind.sfn, UL_INFO->rx_ind.slot, UL_INFO->rx_ind.number_of_pdus);
if (send(ue_tx_sock_descriptor, buffer, encoded_size, 0) < 0)
{
LOG_E(NR_MAC, "Send Proxy NR_UE failed\n");
return;
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
break;
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
break;
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
break;
default:
break;
}
}
static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request)
......
......@@ -39,6 +39,7 @@
#include "fapi_nr_ue_interface.h"
#include "openair2/PHY_INTERFACE/queue.h"
#include "nfapi_nr_interface_scf.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t;
......@@ -218,7 +219,7 @@ typedef struct nfapi_dl_tti_config_req_tx_data_req_t
nfapi_nr_tx_data_request_t *tx_data_req_pdu_list;
} nfapi_dl_tti_config_req_tx_data_req_t;
void send_nsa_standalone_msg(nfapi_nr_rach_indication_t *rach_ind);
void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id);
/**\brief done free of memory allocation by module_id and release to pointer pool.
\param module_id module id*/
......
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