Commit 0165ffd1 authored by Melissa Elkadi's avatar Melissa Elkadi

Merge branch 'episys/master-sa' into episys/mel/debug-thorughput-new-sa-master

parents ca336ea9 817fc792
......@@ -955,6 +955,17 @@ static void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request)
}
}
static uint16_t get_message_id(const uint8_t *buffer, ssize_t len)
{
if (len < 4)
return 0;
// Unpack 2 bytes message_id from buffer.
uint16_t v;
memcpy(&v, buffer + 2, sizeof(v));
return ntohs(v);
}
void *nrue_standalone_pnf_task(void *context)
{
struct sockaddr_in server_address;
......@@ -998,14 +1009,22 @@ void *nrue_standalone_pnf_task(void *context)
abort();
}
}
else if (len == sizeof(nr_phy_channel_params_t))
else if (get_message_id((const uint8_t *)buffer, len) == 0x0FFF) // 0x0FFF : channel info identifier.
{
nr_phy_channel_params_t *ch_info = CALLOC(1, sizeof(*ch_info));
memcpy(ch_info, buffer, sizeof(*ch_info));
slot_rnti_mcs[NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot)].sinr = ch_info->sinr;
LOG_D(NR_PHY, "Received_SINR = %f, sfn:slot %d:%d\n",
ch_info->sinr, NFAPI_SFNSLOT2SFN(ch_info->sfn_slot), NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot));
if (ch_info->nb_of_sinrs > 1)
LOG_W(NR_PHY, "Expecting at most one SINR.\n");
// TODO: Update sinr field of slot_rnti_mcs to be array.
for (int i = 0; i < ch_info->nb_of_sinrs; ++i)
{
slot_rnti_mcs[NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot)].sinr = ch_info->sinr[i];
LOG_D(NR_PHY, "Received_SINR[%d] = %f, sfn:slot %d:%d\n",
i, ch_info->sinr[i], NFAPI_SFNSLOT2SFN(ch_info->sfn_slot), NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot));
}
if (!put_queue(&nr_chan_param_queue, ch_info))
{
......
......@@ -45,13 +45,16 @@
#define NUM_SINR 100
#define NUM_BLER_COL 13
#define NUM_NFAPI_SLOT 20
#define NR_NUM_LAYER 1
typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t;
typedef struct nr_phy_channel_params_t
{
uint16_t sfn_slot;
float sinr;
uint16_t message_id;
uint16_t nb_of_sinrs;
float sinr[NR_NUM_LAYER];
// Incomplete, need all channel parameters
} nr_phy_channel_params_t;
......
......@@ -1259,6 +1259,17 @@ void ue_init_standalone_socket(int tx_port, int rx_port)
}
}
static uint16_t get_message_id(const uint8_t *buffer, ssize_t len)
{
if (len < 4)
return 0;
// Unpack 2 bytes message_id from buffer.
uint16_t v;
memcpy(&v, buffer + 2, sizeof(v));
return ntohs(v);
}
void *ue_standalone_pnf_task(void *context)
{
struct sockaddr_in server_address;
......@@ -1301,7 +1312,7 @@ void *ue_standalone_pnf_task(void *context)
abort();
}
}
else if (len == sizeof(phy_channel_params_t))
else if (get_message_id((const uint8_t *)buffer, len) == 0x0FFF) // 0x0FFF : channel info identifier.
{
phy_channel_params_t ch_info;
memcpy(&ch_info, buffer, sizeof(phy_channel_params_t));
......@@ -1314,8 +1325,15 @@ void *ue_standalone_pnf_task(void *context)
uint16_t sf = ch_info.sfn_sf & 15;
assert(sf < 10);
sf_rnti_mcs[sf].sinr = ch_info.sinr;
LOG_D(MAC, "Received_SINR = %f\n",ch_info.sinr);
if (ch_info.nb_of_sinrs > 1)
LOG_W(MAC, "Expecting at most one SINR.\n");
// TODO: Update sinr field of slot_rnti_mcs to be array.
for (int i = 0; i < ch_info.nb_of_sinrs; ++i)
{
sf_rnti_mcs[sf].sinr = ch_info.sinr[i];
LOG_D(MAC, "Received_SINR[%d] = %f\n", i, ch_info.sinr[i]);
}
}
else
{
......
......@@ -24,6 +24,7 @@
#define NUM_MCS 28
#define NUM_SINR 100
#define NUM_BLER_COL 13
#define LTE_NUM_LAYER 1
// this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
......@@ -126,7 +127,9 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
typedef struct phy_channel_params_t
{
uint16_t sfn_sf;
float sinr;
uint16_t message_id;
uint16_t nb_of_sinrs;
float sinr[LTE_NUM_LAYER];
// Incomplete, need all channel parameters
} phy_channel_params_t;
......
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