nFAPI/VNF: Correctly set message length when segmenting
The 5G nFAPI message length is 32bits. In particular tx_data.requests
can be longer than 64kB. When segmenting, we should correctly write the
message of the current segment (across all 32bits), because the
length would interpreted wrongly otherwise.
This fixes a bug in which tx_data.requests were discarded for 4-layer DL
MIMO on 100 MHz with this message:
P7 unpack message length is greater than the message buffer
Further, increase the type of various (segment-related) variables to 32
bits. Currently, the maximum segment size is sxt to 65000 bytes (and in
will likely remain, because the maximum UDP size is 65536);
nevertheless, increase it in case we will ever go beyond this.
See also commit dee68e6319 ("nFAPI: increase maximum segment size to
65000")
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t* buffer;
|
uint8_t* buffer;
|
||||||
uint16_t length;
|
uint32_t length;
|
||||||
} vnf_p7_rx_message_segment_t;
|
} vnf_p7_rx_message_segment_t;
|
||||||
|
|
||||||
typedef struct vnf_p7_rx_message vnf_p7_rx_message_t;
|
typedef struct vnf_p7_rx_message vnf_p7_rx_message_t;
|
||||||
|
|||||||
@@ -669,8 +669,8 @@ typedef struct nfapi_vnf_p7_config
|
|||||||
uint8_t checksum_enabled;
|
uint8_t checksum_enabled;
|
||||||
|
|
||||||
/*! The maxium size of a P7 segement. If a message is large that this it
|
/*! The maxium size of a P7 segement. If a message is large that this it
|
||||||
* will be segemented */
|
* will be segmented. Note: u32 to cover 4G and 5G. */
|
||||||
uint16_t segment_size;
|
uint32_t segment_size;
|
||||||
uint16_t max_num_segments;
|
uint16_t max_num_segments;
|
||||||
|
|
||||||
/*! Configuration option for the p7 pack unpack functions*/
|
/*! Configuration option for the p7 pack unpack functions*/
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_
|
|||||||
|
|
||||||
// segmenting the transmit
|
// segmenting the transmit
|
||||||
int msg_body_len = len - NFAPI_NR_P7_HEADER_LENGTH ;
|
int msg_body_len = len - NFAPI_NR_P7_HEADER_LENGTH ;
|
||||||
int seg_body_len = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH ;
|
uint32_t seg_body_len = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH ;
|
||||||
int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0);
|
int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0);
|
||||||
|
|
||||||
int segment = 0;
|
int segment = 0;
|
||||||
@@ -511,19 +511,21 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_
|
|||||||
for(segment = 0; segment < segment_count; ++segment)
|
for(segment = 0; segment < segment_count; ++segment)
|
||||||
{
|
{
|
||||||
uint8_t last = 0;
|
uint8_t last = 0;
|
||||||
uint16_t size = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
|
uint32_t size = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
|
||||||
if(segment + 1 == segment_count)
|
if(segment + 1 == segment_count)
|
||||||
{
|
{
|
||||||
last = 1;
|
last = 1;
|
||||||
size = (msg_body_len) - (seg_body_len * segment);
|
size = (msg_body_len) - (seg_body_len * segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t segment_size = size + NFAPI_NR_P7_HEADER_LENGTH;
|
uint32_t segment_size = size + NFAPI_NR_P7_HEADER_LENGTH;
|
||||||
|
|
||||||
// Update the header with the m and segement
|
// Update the header with the m and segement
|
||||||
memcpy(&tx_buffer[0], buffer, NFAPI_NR_P7_HEADER_LENGTH);
|
memcpy(&tx_buffer[0], buffer, NFAPI_NR_P7_HEADER_LENGTH);
|
||||||
|
|
||||||
// set the segment length
|
// set the segment length
|
||||||
|
tx_buffer[4] = (segment_size & 0xFF000000) >> 24;
|
||||||
|
tx_buffer[5] = (segment_size & 0xFF0000) >> 16;
|
||||||
tx_buffer[6] = (segment_size & 0xFF00) >> 8;
|
tx_buffer[6] = (segment_size & 0xFF00) >> 8;
|
||||||
tx_buffer[7] = (segment_size & 0xFF);
|
tx_buffer[7] = (segment_size & 0xFF);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user