Commit 34ea6c7a authored by Rúben Soares Silva's avatar Rúben Soares Silva

Fix packing/unpacking procedures for PARAM.response

Added missing support for packing/unpacking tag 0x001C (supportedMaxModulationOrderDl)

Now properly handles tag 0x0005 (NumConfigTLVsToReport) and subsequent TLVs that come after this value ( Table 3-9 SCF 222.10.02 )
parent 61a3125d
......@@ -856,6 +856,19 @@ int unpack_nr_tlv_list(unpack_tlv_t unpack_fns[],
for (idx = 0; idx < size; ++idx) {
if (unpack_fns[idx].tag == generic_tl.tag) { // match the extracted tag value with all the tags in unpack_fn list
tagMatch = 1;
if (generic_tl.tag == NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG) {
// padding and sub tlvs handled already
nfapi_nr_cell_param_t *cellParamTable = (nfapi_nr_cell_param_t *)unpack_fns[idx].tlv;
cellParamTable->num_config_tlvs_to_report.tl.tag = generic_tl.tag;
cellParamTable->num_config_tlvs_to_report.tl.length = generic_tl.length;
int result = (*unpack_fns[idx].unpack_func)(unpack_fns[idx].tlv, ppReadPackedMsg, end);
if (result == 0) {
return 0;
}
continue;
}
nfapi_tl_t *tl = (nfapi_tl_t *)(unpack_fns[idx].tlv);
tl->tag = generic_tl.tag;
tl->length = generic_tl.length;
......
......@@ -665,7 +665,7 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
{
printf("\nRUNNING pack_param_response\n");
nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
return (push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end)
uint8_t retval = push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end)
&& pack_nr_tlv(NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG,
&(pNfapiMsg->cell_param.release_capability),
ppWritePackedMsg,
......@@ -690,8 +690,30 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
&(pNfapiMsg->cell_param.num_config_tlvs_to_report),
ppWritePackedMsg,
end,
&pack_uint16_tlv_value)
&& pack_nr_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG,
&pack_uint16_tlv_value);
for (int i = 0; i < pNfapiMsg->cell_param.num_config_tlvs_to_report.value; ++i) {
/*retval &= pack_nr_tlv(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag,
&(pNfapiMsg->cell_param.config_tlvs_to_report_list[i]),
ppWritePackedMsg,
end,
&pack_uint8_tlv_value);*/
retval &= push16(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, ppWritePackedMsg, end);
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length, ppWritePackedMsg, end);
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].value, ppWritePackedMsg, end);
// Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
int padding = get_tlv_padding(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length);
NFAPI_TRACE(NFAPI_TRACE_DEBUG,
"TLV 0x%x with padding of %d bytes\n",
pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag,
padding);
if (padding != 0) {
memset(*ppWritePackedMsg, 0, padding);
(*ppWritePackedMsg) += padding;
}
}
retval &= pack_nr_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG,
&(pNfapiMsg->carrier_param.cyclic_prefix),
ppWritePackedMsg,
end,
......@@ -801,6 +823,11 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
ppWritePackedMsg,
end,
&pack_uint8_tlv_value)
&& pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG,
&(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl),
ppWritePackedMsg,
end,
&pack_uint8_tlv_value)
&& pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG,
&(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl),
ppWritePackedMsg,
......@@ -915,7 +942,7 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
&(pNfapiMsg->prach_param.prach_short_formats),
ppWritePackedMsg,
end,
&pack_uint8_tlv_value)
&pack_uint16_tlv_value)
&& pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG,
&(pNfapiMsg->prach_param.prach_restricted_sets),
ppWritePackedMsg,
......@@ -978,7 +1005,8 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
ppWritePackedMsg,
end,
&pack_uint8_tlv_value)
&& pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
&& pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return retval;
}
static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
......@@ -2586,6 +2614,41 @@ static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, vo
config,
&pNfapiMsg->vendor_extension));
}
static uint8_t unpack_config_tlvs_to_report(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
uint8_t *pStartOfValue = *ppReadPackedMsg;
nfapi_nr_cell_param_t *cellParamTable = (nfapi_nr_cell_param_t *)tlv;
uint8_t retval = pull16(ppReadPackedMsg, &cellParamTable->num_config_tlvs_to_report.value, end);
// check if the length was right;
if (cellParamTable->num_config_tlvs_to_report.tl.length != (*ppReadPackedMsg - pStartOfValue)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"Warning tlv tag 0x%x length %d not equal to unpack %ld\n",
cellParamTable->num_config_tlvs_to_report.tl.tag,
cellParamTable->num_config_tlvs_to_report.tl.length,
(*ppReadPackedMsg - pStartOfValue));
}
// Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
int padding = get_tlv_padding(cellParamTable->num_config_tlvs_to_report.tl.length);
if (padding != 0) {
(*ppReadPackedMsg) += padding;
}
// after this value, get the tlv list
cellParamTable->config_tlvs_to_report_list = calloc(cellParamTable->num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *));
for (int i = 0; i < cellParamTable->num_config_tlvs_to_report.value; ++i) {
pull16(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].tl.tag, end);
pull8(ppReadPackedMsg, (uint8_t *)&cellParamTable->config_tlvs_to_report_list[i].tl.length, end);
pull8(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].value, end);
// Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
padding = get_tlv_padding(cellParamTable->config_tlvs_to_report_list[i].tl.length);
if (padding != 0) {
(*ppReadPackedMsg) += padding;
}
}
return retval;
}
uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
......@@ -2595,9 +2658,7 @@ uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *
{NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state), &unpack_uint16_tlv_value},
{NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG,
&(pNfapiMsg->cell_param.num_config_tlvs_to_report),
&unpack_uint16_tlv_value},
{NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param), &unpack_config_tlvs_to_report},
{NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG,
......@@ -2638,6 +2699,9 @@ uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *
{NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG,
&(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch),
&unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG,
&(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl),
&unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG,
&(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols),
......@@ -2676,7 +2740,7 @@ uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *
&unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint16_tlv_value},
{NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), &unpack_uint8_tlv_value},
{NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG,
&(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot),
......@@ -2701,7 +2765,7 @@ uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *
printf("\n Read message unpack_param_response: ");
while (ptr < end) {
printf(" %02x ", *ptr);
printf(" 0x%02x", *ptr);
ptr++;
}
......
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