Commit 8035cad7 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/Fix_Aerial_TBSize' into integration_2024_w26

parents 3b69bc27 8159abdc
...@@ -1074,7 +1074,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, ...@@ -1074,7 +1074,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
for (; k < total_number_of_tlvs; ++k) { for (; k < total_number_of_tlvs; ++k) {
if (value->TLVs[k].length > 0) { if (value->TLVs[k].length > 0) {
if (value->TLVs[k].length % 4 != 0) { if (value->TLVs[k].length % 4 != 0) {
if (!pusharray32(value->TLVs[k].value.direct, 16384, ((value->TLVs[k].length + 3) / 4) - 1, ppWriteData, data_end)) { if (!pusharray32(value->TLVs[k].value.direct,
(dataBufLen + 3) / 4,
((value->TLVs[k].length + 3) / 4) - 1,
ppWriteData,
data_end)) {
return 0; return 0;
} }
int bytesToAdd = 4 - (4 - (value->TLVs[k].length % 4)) % 4; int bytesToAdd = 4 - (4 - (value->TLVs[k].length % 4)) % 4;
...@@ -1088,7 +1092,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, ...@@ -1088,7 +1092,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
} }
} else { } else {
// no padding needed // no padding needed
if (!pusharray32(value->TLVs[k].value.direct, 16384, ((value->TLVs[k].length + 3) / 4), ppWriteData, data_end)) { if (!pusharray32(value->TLVs[k].value.direct,
(dataBufLen + 3) / 4,
((value->TLVs[k].length + 3) / 4),
ppWriteData,
data_end)) {
return 0; return 0;
} }
} }
...@@ -1109,7 +1117,7 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, ...@@ -1109,7 +1117,7 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
uintptr_t msgEnd = (uintptr_t)pPacketBodyField; uintptr_t msgEnd = (uintptr_t)pPacketBodyField;
uint32_t packedMsgLen = msgEnd - msgHead; uint32_t packedMsgLen = msgEnd - msgHead;
uint16_t packedMsgLen16; uint16_t packedMsgLen16;
if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) { if (packedMsgLen > packedBufLen + dataBufLen) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
return 0; return 0;
} else { } else {
...@@ -1123,17 +1131,6 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, ...@@ -1123,17 +1131,6 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
if (!push32(packedMsgLen, &pPackedLengthField, pPackMessageEnd)) if (!push32(packedMsgLen, &pPackedLengthField, pPackMessageEnd))
return 0; return 0;
if (1) {
// quick test
if (pMessageHeader->message_length != packedMsgLen) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"nfapi packedMsgLen(%d) != message_length(%d) id %d\n",
packedMsgLen,
pMessageHeader->message_length,
pMessageHeader->message_id);
}
}
return (packedMsgLen16); return (packedMsgLen16);
} }
...@@ -1289,9 +1286,14 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t ...@@ -1289,9 +1286,14 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t
{ {
uint8_t FAPI_buffer[1024 * 64]; uint8_t FAPI_buffer[1024 * 64];
// Check if TX_DATA request, if true, need to pack to data_buf // Check if TX_DATA request, if true, need to pack to data_buf
if (header->message_id if (header->message_id == NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST) {
== NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST) { nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t *)header;
uint8_t FAPI_data_buffer[1024 * 64]; uint64_t size = 0;
for (int i = 0; i < pNfapiMsg->Number_of_PDUs; ++i) {
size += pNfapiMsg->pdu_list[i].PDU_length;
}
AssertFatal(size <= 1024 * 1024 * 2, "Message data larger than available buffer, tried to pack %"PRId64 ,size);
uint8_t FAPI_data_buffer[1024 * 1024 * 2]; // 2MB
uint32_t data_len = 0; uint32_t data_len = 0;
int32_t len_FAPI = aerial_pack_tx_data_request(header, int32_t len_FAPI = aerial_pack_tx_data_request(header,
FAPI_buffer, FAPI_buffer,
...@@ -1300,12 +1302,13 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t ...@@ -1300,12 +1302,13 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t
sizeof(FAPI_data_buffer), sizeof(FAPI_data_buffer),
&vnf_p7->_public.codec_config, &vnf_p7->_public.codec_config,
&data_len); &data_len);
if (len_FAPI <=0) { if (len_FAPI <= 0) {
LOG_E(NFAPI_VNF,"Problem packing TX_DATA_request\n"); LOG_E(NFAPI_VNF, "Problem packing TX_DATA_request\n");
return len_FAPI; return len_FAPI;
} else {
int retval = aerial_send_P7_msg_with_data(FAPI_buffer, len_FAPI, FAPI_data_buffer, data_len, header);
return retval;
} }
else
return aerial_send_P7_msg_with_data(FAPI_buffer, len_FAPI, FAPI_data_buffer, data_len, header);
} else { } else {
// Create and send FAPI P7 message // Create and send FAPI P7 message
int len_FAPI = fapi_nr_p7_message_pack(header, FAPI_buffer, sizeof(FAPI_buffer), &vnf_p7->_public.codec_config); int len_FAPI = fapi_nr_p7_message_pack(header, FAPI_buffer, sizeof(FAPI_buffer), &vnf_p7->_public.codec_config);
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
typedef struct { typedef struct {
/// Value: 0 -> 1, 0: Payload is carried directly in the value field, 1: Pointer to payload is in the value field /// Value: 0 -> 1, 0: Payload is carried directly in the value field, 1: Pointer to payload is in the value field
uint16_t tag; uint16_t tag;
/// Length of the actual payload in bytes, without the padding bytes Value: 0 → 65535 /// Length of the actual payload in bytes, without the padding bytes Value: 0 → 0xFFFFFFFF
uint16_t length; /// Note: This change to uint32_t is a deviation from version 10.02 of the SCF222 standard
uint32_t length;
union { union {
uint32_t *ptr; uint32_t *ptr;
uint32_t direct[38016]; uint32_t direct[38016];
......
...@@ -2017,8 +2017,7 @@ static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8 ...@@ -2017,8 +2017,7 @@ static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8
static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{ {
nfapi_nr_pdu_t *value = (nfapi_nr_pdu_t *)tlv; nfapi_nr_pdu_t *value = (nfapi_nr_pdu_t *)tlv;
AssertFatal(value->PDU_length <= 0xFFFF,"TX_DATA.request PDU_Length should be within 16 bit, according to SCF222.10.02"); if (!(push32(value->PDU_length, ppWritePackedMsg, end) && push16(value->PDU_index, ppWritePackedMsg, end)
if (!(push16(value->PDU_length, ppWritePackedMsg, end) && push16(value->PDU_index, ppWritePackedMsg, end)
&& push32(value->num_TLV, ppWritePackedMsg, end))) && push32(value->num_TLV, ppWritePackedMsg, end)))
return 0; return 0;
...@@ -2026,12 +2025,16 @@ static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg ...@@ -2026,12 +2025,16 @@ static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg
uint16_t total_number_of_tlvs = value->num_TLV; uint16_t total_number_of_tlvs = value->num_TLV;
for (; i < total_number_of_tlvs; ++i) { for (; i < total_number_of_tlvs; ++i) {
if (!(push16(value->TLVs[i].tag, ppWritePackedMsg, end) && push16(value->TLVs[i].length, ppWritePackedMsg, end))) if (!(push16(value->TLVs[i].tag, ppWritePackedMsg, end) && push32(value->TLVs[i].length, ppWritePackedMsg, end)))
return 0; return 0;
switch (value->TLVs[i].tag) { switch (value->TLVs[i].tag) {
case 0: { case 0: {
if (!pusharray32(value->TLVs[i].value.direct, 16384, (value->TLVs[i].length + 3) / 4, ppWritePackedMsg, end)) { if (!pusharray32(value->TLVs[i].value.direct,
(value->TLVs[i].length + 3) / 4,
(value->TLVs[i].length + 3) / 4,
ppWritePackedMsg,
end)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n", __FUNCTION__, __LINE__, value->TLVs[i].length); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n", __FUNCTION__, __LINE__, value->TLVs[i].length);
return 0; return 0;
} }
...@@ -2039,7 +2042,11 @@ static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg ...@@ -2039,7 +2042,11 @@ static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg
} }
case 1: { case 1: {
if (!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length, value->TLVs[i].length, ppWritePackedMsg, end)) { if (!pusharray32(value->TLVs[i].value.ptr,
(value->TLVs[i].length + 3) / 4,
(value->TLVs[i].length + 3) / 4,
ppWritePackedMsg,
end)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n", __FUNCTION__, __LINE__, value->TLVs[i].length); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n", __FUNCTION__, __LINE__, value->TLVs[i].length);
return 0; return 0;
} }
...@@ -5903,18 +5910,15 @@ static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, v ...@@ -5903,18 +5910,15 @@ static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, v
static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) { static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) {
nfapi_nr_pdu_t *pNfapiMsg = (nfapi_nr_pdu_t *)msg; nfapi_nr_pdu_t *pNfapiMsg = (nfapi_nr_pdu_t *)msg;
if(!(pull16(ppReadPackedMsg, (uint16_t *)&pNfapiMsg->PDU_length, end) && if (!(pull32(ppReadPackedMsg, &pNfapiMsg->PDU_length, end) && pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end)
pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) && && pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end)))
pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end)
))
return 0; return 0;
uint16_t i = 0; uint16_t i = 0;
uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV; uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV;
for(; i < total_number_of_tlvs; ++i) { for(; i < total_number_of_tlvs; ++i) {
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end) && if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end) && pull32(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end)))
pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end)))
return 0; return 0;
switch(pNfapiMsg->TLVs[i].tag) { switch(pNfapiMsg->TLVs[i].tag) {
...@@ -5928,9 +5932,11 @@ static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t ...@@ -5928,9 +5932,11 @@ static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t
} }
case 1: { case 1: {
if (!pullarray32(ppReadPackedMsg,pNfapiMsg->TLVs[i].value.ptr, if (!pullarray32(ppReadPackedMsg,
pNfapiMsg->TLVs[i].length, pNfapiMsg->TLVs[i].value.ptr,
pNfapiMsg->TLVs[i].length, end)) (pNfapiMsg->TLVs[i].length + 3) / 4,
(pNfapiMsg->TLVs[i].length + 3) / 4,
end))
return 0; return 0;
break; break;
......
...@@ -5200,9 +5200,9 @@ bool supported_bw_comparison(int bw_mhz, NR_SupportedBandwidth_t *supported_BW, ...@@ -5200,9 +5200,9 @@ bool supported_bw_comparison(int bw_mhz, NR_SupportedBandwidth_t *supported_BW,
return false; return false;
} }
uint16_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length) uint32_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length)
{ {
uint8_t pdu_length = 8; // 2 bytes PDU_Length + 2 bytes PDU_Index + 4 bytes num_TLV uint32_t pdu_length = 8; // 2 bytes PDU_Length + 2 bytes PDU_Index + 4 bytes num_TLV
// For each TLV, add 2 bytes tag + 2 bytes length + value size without padding // For each TLV, add 2 bytes tag + 2 bytes length + value size without padding
pdu_length += (num_TLV * 4) + total_length; pdu_length += (num_TLV * 4) + total_length;
return pdu_length; return pdu_length;
......
...@@ -311,7 +311,7 @@ void compute_csi_bitlen(const NR_CSI_MeasConfig_t *csi_MeasConfig, nr_csi_report ...@@ -311,7 +311,7 @@ void compute_csi_bitlen(const NR_CSI_MeasConfig_t *csi_MeasConfig, nr_csi_report
uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report); uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report);
uint16_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length); uint32_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length);
rnti_t nr_get_ra_rnti(uint8_t s_id, uint8_t t_id, uint8_t f_id, uint8_t ul_carrier_id); rnti_t nr_get_ra_rnti(uint8_t s_id, uint8_t t_id, uint8_t f_id, uint8_t ul_carrier_id);
......
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