Commit abefe1a0 authored by MaheshK1995's avatar MaheshK1995

Added custom error codes for p5

parent e3a05b9a
...@@ -32,3 +32,7 @@ ...@@ -32,3 +32,7 @@
* `ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);` sloc: 1428 in `nr-ru.c` * `ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);` sloc: 1428 in `nr-ru.c`
* the `ru->rfdevice` has all members zero or null. * the `ru->rfdevice` has all members zero or null.
* This issue was solved by adding `sdr_addrs` to config file of PNF. * This issue was solved by adding `sdr_addrs` to config file of PNF.
* `if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1`
* throws segmentation error
* `max_tdd_periodicity_list` is not assigned memory
...@@ -419,7 +419,7 @@ int pnf_config_request(nfapi_pnf_config_t *config, nfapi_pnf_config_request_t *r ...@@ -419,7 +419,7 @@ int pnf_config_request(nfapi_pnf_config_t *config, nfapi_pnf_config_request_t *r
void nfapi_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) { void nfapi_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) {
printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id); printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id);
nfapi_start_response_t start_resp; nfapi_nr_start_response_scf_t start_resp;
memset(&start_resp, 0, sizeof(start_resp)); memset(&start_resp, 0, sizeof(start_resp));
start_resp.header.message_id = NFAPI_START_RESPONSE; start_resp.header.message_id = NFAPI_START_RESPONSE;
start_resp.header.phy_id = phy_id; start_resp.header.phy_id = phy_id;
......
...@@ -1017,14 +1017,6 @@ extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw); ...@@ -1017,14 +1017,6 @@ extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp) { int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp) {
#ifdef TEST
if(resp->cell_param.phy_state.tl.tag == NFAPI_NR_PARAM_TLV_PHY_STATE_TAG)
printf("\n\nMatched\n\n");
// like this we can check for all the tags
#endif
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info *vnf = (vnf_info *)(config->user_data); vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs; vnf_p7_info *p7_vnf = vnf->p7_vnfs;
...@@ -1093,7 +1085,7 @@ int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_respo ...@@ -1093,7 +1085,7 @@ int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_respo
return 0; return 0;
} }
int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) { int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) {
printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info *vnf = (vnf_info *)(config->user_data); vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs; pnf_info *pnf = vnf->pnfs;
......
...@@ -85,11 +85,6 @@ typedef struct { ...@@ -85,11 +85,6 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_param_request_t; } nfapi_nr_param_request_t;
typedef enum {
NFAPI_NR_PARAM_MSG_OK = 0,
NFAPI_NR_PARAM_MSG_INVALID_STATE
} nfapi_nr_param_errors_e;
/*typedef struct { /*typedef struct {
nfapi_nr_param_errors_e error_code; nfapi_nr_param_errors_e error_code;
...@@ -263,12 +258,6 @@ typedef struct ...@@ -263,12 +258,6 @@ typedef struct
//-------------------------------------------// //-------------------------------------------//
//3.3.2 CONFIG //3.3.2 CONFIG
typedef enum {
NFAPI_NR_CONFIG_MSG_OK = 0,
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
} nfapi_nr_config_errors_e;
/*typedef struct { /*typedef struct {
nfapi_nr_config_errors_e error_code; nfapi_nr_config_errors_e error_code;
uint8_t number_of_invalid_tlvs_that_can_only_be_configured_in_idle; uint8_t number_of_invalid_tlvs_that_can_only_be_configured_in_idle;
...@@ -448,6 +437,25 @@ typedef struct ...@@ -448,6 +437,25 @@ typedef struct
} nfapi_nr_measurement_config_t; } nfapi_nr_measurement_config_t;
// ERROR enums
typedef enum { // Table 2-22
NFAPI_NR_PARAM_MSG_OK = 0,
NFAPI_NR_PARAM_MSG_INVALID_STATE
} nfapi_nr_param_errors_e;
typedef enum { // Table 2-25
NFAPI_NR_CONFIG_MSG_OK = 0,
NFAPI_NR_CONFIG_MSG_INVALID_STATE, //The CONFIG.request was received when the PHY was not in the IDLE state or the CONFIGURED state.
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
} nfapi_nr_config_errors_e;
typedef enum { // Table 2-27
NFAPI_NR_START_MSG_OK = 0,
NFAPI_NR_START_MSG_INVALID_STATE
} nfapi_nr_start_errors_e;
/* PARAM.REQUEST */ /* PARAM.REQUEST */
typedef struct { typedef struct {
nfapi_p4_p5_message_header_t header; nfapi_p4_p5_message_header_t header;
...@@ -479,7 +487,7 @@ typedef struct { ...@@ -479,7 +487,7 @@ typedef struct {
/* CONFIG.REQUEST */ /* CONFIG.REQUEST */
typedef struct { typedef struct {
nfapi_p4_p5_message_header_t header; nfapi_p4_p5_message_header_t header;
nfapi_nr_param_errors_e error_code; nfapi_nr_param_errors_e error_code; // TODO: check if needed
uint8_t num_tlv; uint8_t num_tlv;
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
...@@ -497,10 +505,9 @@ typedef struct { ...@@ -497,10 +505,9 @@ typedef struct {
/* CONFIG.RESPONSE */ /* CONFIG.RESPONSE */
typedef struct { typedef struct {
// TODO: add here
nfapi_p4_p5_message_header_t header; nfapi_p4_p5_message_header_t header;
nfapi_nr_param_errors_e error_code; nfapi_nr_config_errors_e error_code;
uint8_t num_invalid_tlvs; //uint8_t num_invalid_tlvs;
// TODO: add list of invalid/unsupported TLVs (see Table 3.18) // TODO: add list of invalid/unsupported TLVs (see Table 3.18)
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_config_response_scf_t; } nfapi_nr_config_response_scf_t;
...@@ -513,9 +520,11 @@ typedef struct { ...@@ -513,9 +520,11 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_start_request_scf_t; } nfapi_nr_start_request_scf_t;
typedef enum { typedef struct {
NFAPI_NR_START_MSG_INVALID_STATE nfapi_p4_p5_message_header_t header;
} nfapi_nr_start_errors_e; nfapi_nr_start_errors_e error_code;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_start_response_scf_t;
//3.3.4 STOP //3.3.4 STOP
...@@ -524,6 +533,7 @@ typedef struct { ...@@ -524,6 +533,7 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_stop_request_t; } nfapi_nr_stop_request_t;
typedef struct { typedef struct {
nfapi_p4_p5_message_header_t header; nfapi_p4_p5_message_header_t header;
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
......
...@@ -871,7 +871,7 @@ static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t ...@@ -871,7 +871,7 @@ static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t
static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config) static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
{ {
nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t*)msg; nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t*)msg;
return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) && return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) ); pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
...@@ -1809,7 +1809,7 @@ static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, voi ...@@ -1809,7 +1809,7 @@ static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, voi
static uint8_t unpack_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config) static uint8_t unpack_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
{ {
nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t*)msg; nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t*)msg;
unpack_tlv_t unpack_fns[] = unpack_tlv_t unpack_fns[] =
{ {
...@@ -1957,8 +1957,8 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen ...@@ -1957,8 +1957,8 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
break; break;
case NFAPI_START_RESPONSE: case NFAPI_START_RESPONSE:
if (unpackedBufLen >= sizeof(nfapi_start_response_t)) if (unpackedBufLen >= sizeof(nfapi_nr_start_response_scf_t))
retLen = sizeof(nfapi_start_response_t); retLen = sizeof(nfapi_nr_start_response_scf_t);
break; break;
case NFAPI_STOP_REQUEST: case NFAPI_STOP_REQUEST:
......
...@@ -421,7 +421,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_s ...@@ -421,7 +421,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_s
* \return 0 for success, -1 for failure * \return 0 for success, -1 for failure
* *
*/ */
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp); int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp);
/*! Send the STOP.response /*! Send the STOP.response
* \param config A pointer to a pnf configuraiton * \param config A pointer to a pnf configuraiton
......
...@@ -210,7 +210,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_s ...@@ -210,7 +210,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_s
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_config_response_scf_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_config_response_scf_t));
} }
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp) int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp)
{ {
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL)
{ {
...@@ -234,7 +234,7 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res ...@@ -234,7 +234,7 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
return -1; return -1;
} }
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_start_response_scf_t));
} }
int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp) int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp)
......
...@@ -286,7 +286,7 @@ typedef struct nfapi_vnf_config ...@@ -286,7 +286,7 @@ typedef struct nfapi_vnf_config
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp); int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp);
/*! A callback for the STOP.resp /*! A callback for the STOP.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
......
...@@ -302,6 +302,7 @@ void vnf_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_ ...@@ -302,6 +302,7 @@ void vnf_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx) void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
{ {
// ensure it's valid // ensure it's valid
if (pRecvMsg == NULL || config == NULL) if (pRecvMsg == NULL || config == NULL)
{ {
...@@ -316,11 +317,15 @@ void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config ...@@ -316,11 +317,15 @@ void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 ) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
{ {
// check the error code:
if (msg.error_code == NFAPI_MSG_OK){
if(config->config_resp) if(config->config_resp)
{ {
(config->config_resp)(config, p5_idx, &msg); (config->config_resp)(config, p5_idx, &msg);
} }
} }
}
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
...@@ -343,16 +348,18 @@ void vnf_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_ ...@@ -343,16 +348,18 @@ void vnf_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received START_RESPONSE\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Received START_RESPONSE\n");
nfapi_start_response_t msg; nfapi_nr_start_response_scf_t msg;
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
{ { // check the error code
if (msg.error_code == NFAPI_MSG_OK){
if(config->start_resp) if(config->start_resp)
{ {
(config->start_resp)(config, p5_idx, &msg); (config->start_resp)(config, p5_idx, &msg);
} }
} }
}
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
......
...@@ -311,7 +311,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { ...@@ -311,7 +311,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
*********************************************************************/ *********************************************************************/
int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) { int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) {
/* for FFD all slot can be considered as an uplink */ /* for FDD all slot can be considered as an uplink */
int mu = cfg->ssb_config.scs_common.value,check_slot=0; int mu = cfg->ssb_config.scs_common.value,check_slot=0;
if (cfg->cell_config.frame_duplex_type.value == FDD) { if (cfg->cell_config.frame_duplex_type.value == FDD) {
......
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