Commit 9a4a1f60 authored by Aniq's avatar Aniq

Added UL_DCI packing and unpacking fns

parent 2ccabd54
...@@ -28,14 +28,14 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase> ...@@ -28,14 +28,14 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase>
* In the switch case, change the labels as well as the pack functions: * In the switch case, change the labels as well as the pack functions:
* `pack_dl_config_request` becomes `pack_dl_tti_request` [x] * `pack_dl_config_request` becomes `pack_dl_tti_request` [x]
* `pack_ul_config_request` becomes `pack_ul_tti_request` [x] * `pack_ul_config_request` becomes `pack_ul_tti_request` [x]
* `pack_hi_dci0_request` becomes `pack_ul_dci_request` * `pack_hi_dci0_request` becomes `pack_ul_dci_request` [x]
* `pack_tx_request` becomes `pack_tx_data_request` [x] * `pack_tx_request` becomes `pack_tx_data_request` [x]
### Task-B [unpacking] ### Task-B [unpacking]
* Modify `nfapi_p7_message_unpack()` in `nfapi_p7.c` * Modify `nfapi_p7_message_unpack()` in `nfapi_p7.c`
* `unpack_dl_tti_request` [x] * `unpack_dl_tti_request` [x]
* `unpack_ul_tti_request` [x] * `unpack_ul_tti_request` [x]
* `unpack_ul_dci_request` * `unpack_ul_dci_request` [x]
* `unpack_tx_data_request` [x] * `unpack_tx_data_request` [x]
* Similarly change all the `unpack` functions within the switch-case block. * Similarly change all the `unpack` functions within the switch-case block.
...@@ -44,14 +44,19 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase> ...@@ -44,14 +44,19 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase>
* this is where the unpack functions are called * this is where the unpack functions are called
* `dl_tti_request` [x] * `dl_tti_request` [x]
* `ul_tti_request` [x] * `ul_tti_request` [x]
* `ul_dci_request` * `ul_dci_request` [x]
* `tx_data_request` [x] * `tx_data_request` [x]
* `nfapi_p7_message_unpack()` is called in `pnf_handle_dl_config_request()` in pnf_p7.c, so we need to add
* `pnf_handle_dl_tti_request`
* `pnf_handle_ul_tti_request`
* `pnf_handle_ul_dci_request`
* `pnf_handle_tx_data_request`
to handle DL P7 messages at pnf
### Task-C ### Task-C
* Write the `ul_tti` alternative for `nfapi_vnf_p7_ul_config_req()` in `vnf_p7_interface.c` and other such functions. * Write the `ul_tti` alternative for `nfapi_vnf_p7_ul_config_req()` in `vnf_p7_interface.c` and other such functions.
* `dl_tti` is present as `nr_dl_config` [x] * `dl_tti` is present as `nr_dl_config` [x]
* `ul_tti` [x] * `ul_tti` [x]
* `ul_dci` * `ul_dci` [x]
* `tx_data` [x] * `tx_data` [x]
* Resolve the hard-coded areas in source code. [`HIGH-PRIORITY`] [x] * Resolve the hard-coded areas in source code. [`HIGH-PRIORITY`] [x]
...@@ -59,7 +64,7 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase> ...@@ -59,7 +64,7 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase>
* Write the `ul_tti` equivalent for `oai_nfapi_dl_config_req` in `nfapi_vnf.c` and other such functions. * Write the `ul_tti` equivalent for `oai_nfapi_dl_config_req` in `nfapi_vnf.c` and other such functions.
* `dl_tti` is present as `nr_dl_config` [x] * `dl_tti` is present as `nr_dl_config` [x]
* `ul_tti` is present as `oai_nfapi_ul_tti_req()` [x] * `ul_tti` is present as `oai_nfapi_ul_tti_req()` [x]
* `ul_dci` * `ul_dci` is present as `oai_nfapi_ul_dci_req()` [x]
* `tx_data` is present as `oai_nfapi_tx_data_req()` [x] * `tx_data` is present as `oai_nfapi_tx_data_req()` [x]
* Check if `nr_schedule_response()` needs to be upgraded [x] * Check if `nr_schedule_response()` needs to be upgraded [x]
......
...@@ -141,6 +141,12 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr) ...@@ -141,6 +141,12 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
} }
// todo : for now these just malloc/free need to move to a memory cache // todo : for now these just malloc/free need to move to a memory cache
nfapi_nr_dl_tti_request_t* allocate_nfapi_dl_tti_request(pnf_p7_t* pnf_p7)
{
void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_nr_dl_tti_request_t));
//printf("%s() ptr:%p\n", __FUNCTION__, ptr);
return ptr;
}
nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7) nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7)
{ {
void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t)); void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
...@@ -1350,7 +1356,99 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) ...@@ -1350,7 +1356,99 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
// P7 messages // P7 messages
// #if 0
void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n");
nfapi_nr_dl_tti_request_t* req = allocate_nfapi_dl_tti_request(pnf_p7);
if(req == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_tti_request structure\n");
return;
}
int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config));
if(unpack_result == 0)
{
if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return;
}
#if 0
if (
0 &&
(NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0
)
)
NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n",
NFAPI_SFNSF2DEC(req->sfn_sf),
req->dl_config_request_body.number_pdcch_ofdm_symbols,
req->dl_config_request_body.number_dci,
req->dl_config_request_body.number_pdu,
req->dl_config_request_body.number_pdsch_rnti,
req->dl_config_request_body.transmission_power_pcfich
);
#endif
if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
{
uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
// if there is already an dl_config_req make sure we free it.
if(pnf_p7->subframe_buffer[buffer_index].dl_config_req != 0)
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_sf:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), buffer_index);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
deallocate_nfapi_dl_config_request(pnf_p7->subframe_buffer[buffer_index].dl_config_req, pnf_p7);
}
// saving dl_config_request in subframe buffer
pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
pnf_p7->subframe_buffer[buffer_index].dl_config_req = req;
pnf_p7->stats.dl_conf_ontime++;
}
else
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "NOT storing dl_config_req SFN/SF %d\n", req->sfn_sf);
deallocate_nfapi_dl_config_request(req, pnf_p7);
if(pnf_p7->_public.timing_info_mode_aperiodic)
{
pnf_p7->timing_info_aperiodic_send = 1;
}
pnf_p7->stats.dl_conf_late++;
}
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return;
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack dl_config_req");
deallocate_nfapi_dl_config_request(req, pnf_p7);
}
}
#endif
void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
{ {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n"); //NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n");
......
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