Commit b53bdac5 authored by hsum's avatar hsum Committed by Robert Schmidt

Fix P5 packing and unpacking issue for TDD table

In the previous patch, an issue was identified where the number of slots in the TDD table was hardcoded inconsistently during packing and unpacking. This led to a mismatch in the number of slots processed, causing errors during execution.

Upon further investigation, it was found that the number of slots in the TDD table should be determined dynamically based on the value of mu, derived from the configured tdd-UL-DL-ConfigurationCommon.

To address this issue, this commit introduces dynamic allocation of memory for the TDD table during unpacking based on the value of mu. Additionally, the packing process now calculates the number of slots to pack dynamically, ensuring consistency between packing and unpacking.

This change resolves the discrepancy in the number of slots processed during packing and unpacking, ensuring that the PNF receives a complete and accurate TDD table.
parent f8a2df4a
......@@ -1590,6 +1590,7 @@ static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_
static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
{
uint8_t *pNumTLVFields = (uint8_t *)*ppWritePackedMsg;
uint8_t mu;
nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t *)msg;
uint8_t numTLVs = 0;
......@@ -1717,6 +1718,7 @@ static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
numTLVs++;
}
mu = pNfapiMsg->ssb_config.scs_common.value;
retval &= pack_nr_tlv(NFAPI_NR_CONFIG_SCS_COMMON_TAG,
&(pNfapiMsg->ssb_config.scs_common),
ppWritePackedMsg,
......@@ -1880,7 +1882,7 @@ static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
&pack_uint8_tlv_value);
numTLVs++;
// END TDD Table
for (int i = 0; i < 40; i++) {
for (int i = 0; i < 2*(1<<mu)*10; i++) {
for (int k = 0; k < 14; k++) {
pack_nr_tlv(NFAPI_NR_CONFIG_SLOT_CONFIG_TAG,
&(pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config),
......@@ -3131,12 +3133,10 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end,
nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t *)msg;
// Memory allocations
pNfapiMsg->tdd_table.max_tdd_periodicity_list =
(nfapi_nr_max_tdd_periodicity_t *)malloc(40 * sizeof(nfapi_nr_max_tdd_periodicity_t));
for (int i = 0; i < 40; i++) {
pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list =
(nfapi_nr_max_tdd_periodicity_t *)malloc(1 * sizeof(nfapi_nr_max_tdd_periodicity_t));
// Initialize first, and upon receiving the SCS, reallocate memory to the correct size.
pNfapiMsg->tdd_table.max_tdd_periodicity_list[0].max_num_of_symbol_per_slot_list =
(nfapi_nr_max_num_of_symbol_per_slot_t *)malloc(14 * sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
}
pNfapiMsg->prach_config.num_prach_fd_occasions_list =
(nfapi_nr_num_prach_fd_occasions_t *)calloc(10, sizeof(nfapi_nr_num_prach_fd_occasions_t));
// unpack TLVs
......@@ -3341,6 +3341,19 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end,
tdd_periodicity_idx++;
}
break;
case NFAPI_NR_CONFIG_SCS_COMMON_TAG:
printf("*** have tag %x, idx %ld\n", generic_tl.tag, idx);
assert(idx <= sizeof(unpack_fns) / sizeof(unpack_fns[0]));
result = (*unpack_fns[idx].unpack_func)(tl, ppReadPackedMsg, end);
uint8_t mu = pNfapiMsg->ssb_config.scs_common.value;
// Memory allocations
pNfapiMsg->tdd_table.max_tdd_periodicity_list =
(nfapi_nr_max_tdd_periodicity_t *)malloc(2*(1<<mu)*10 * sizeof(nfapi_nr_max_tdd_periodicity_t));
for (int i = 0; i < 2*(1<<mu)*10; i++) {
pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list =
(nfapi_nr_max_num_of_symbol_per_slot_t *)malloc(14 * sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
}
break;
default:
/* unpack based on unpack_fns table above, this is a normal case */
printf("*** have tag %x, idx %ld\n", generic_tl.tag, idx);
......
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