From 2421b71d6809d67c6f2a6dd9e4181a6a10e0ef94 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Thu, 11 Jul 2019 16:27:40 +0200 Subject: [PATCH] x2ap/sctp: increase buffer size The 5G phone OPPO has a very big UE capability (> 2KB). We need bigger buffers to transfer this, especially in x2 handover. Also the sctp messages need a bigger buffer. Note: in sctp, we didn't check for partial messages, it's now done. When detected, we exit. To be redone differently if needed. (Look for "if (!(flags & MSG_EOR))".) --- openair2/COMMON/x2ap_messages_types.h | 2 +- openair2/RRC/LTE/rrc_eNB.c | 4 ++-- openair2/X2AP/x2ap_eNB_handler.c | 4 ++-- openair3/SCTP/sctp_default_values.h | 2 +- openair3/SCTP/sctp_eNB_task.c | 5 +++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index d284f4d0b9d..5a35b85fdb4 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -205,7 +205,7 @@ typedef struct x2ap_handover_req_s { x2ap_lastvisitedcell_info_t lastvisitedcell_info; - uint8_t rrc_buffer[1024 /* arbitrary, big enough */]; + uint8_t rrc_buffer[8192 /* arbitrary, big enough */]; int rrc_buffer_size; int target_assoc_id; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 5b989915917..ac22da1b426 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -4614,10 +4614,10 @@ rrc_eNB_generate_HandoverPreparationInformation( uint8_t *buffer, int *_size ) { - memset(buffer, 0, RRC_BUF_SIZE); + memset(buffer, 0, 8192); char *ho_buf = (char *) buffer; int ho_size; - ho_size = do_HandoverPreparation(ho_buf, 1024, ue_context_pP->ue_context.UE_Capability, ue_context_pP->ue_context.UE_Capability_size); + ho_size = do_HandoverPreparation(ho_buf, 8192, ue_context_pP->ue_context.UE_Capability, ue_context_pP->ue_context.UE_Capability_size); *_size = ho_size; } diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 2a44501a337..41d92a695e0 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -730,7 +730,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, X2AP_RRC_Context_t *c = &ie->value.choice.UE_ContextInformation.rRC_Context; - if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_ack_s*/) + if (c->size > 8192 /* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_s */) { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); } memcpy(X2AP_HANDOVER_REQ(msg).rrc_buffer, c->buf, c->size); @@ -821,7 +821,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, X2AP_TargeteNBtoSource_eNBTransparentContainer_t *c = &ie->value.choice.TargeteNBtoSource_eNBTransparentContainer; - if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_ack_s*/) + if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_ack_s */) { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); } memcpy(X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer, c->buf, c->size); diff --git a/openair3/SCTP/sctp_default_values.h b/openair3/SCTP/sctp_default_values.h index 5008ea0b72b..528ffb5a051 100644 --- a/openair3/SCTP/sctp_default_values.h +++ b/openair3/SCTP/sctp_default_values.h @@ -26,6 +26,6 @@ #define SCTP_IN_STREAMS (16) #define SCTP_MAX_ATTEMPTS (2) #define SCTP_TIMEOUT (5) -#define SCTP_RECV_BUFFER_SIZE (1024) +#define SCTP_RECV_BUFFER_SIZE (8192) #endif /* SCTP_DEFAULT_VALUES_H_ */ diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index e9348881783..3cb64254fcc 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -955,6 +955,11 @@ sctp_eNB_read_from_socket( return; } + if (!(flags & MSG_EOR)) { + SCTP_ERROR("fatal: partial SCTP messages are not handled\n"); + exit(1); + } + if (flags & MSG_NOTIFICATION) { union sctp_notification *snp; snp = (union sctp_notification *)buffer; -- GitLab