From 69ccc900e89ddea4711d86861aec4d7452d9dfbb Mon Sep 17 00:00:00 2001
From: fnabet <fabrice.nabet@alcatelonetouch.com>
Date: Wed, 16 Nov 2016 18:24:04 +0100
Subject: [PATCH] fix BSR long size and fill
---
openair2/LAYER2/MAC/defs.h | 9 ++++-----
openair2/LAYER2/MAC/ue_procedures.c | 8 +++-----
targets/SIMU/USER/oaisim.c | 2 ++
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 336f3f1039..82907eb40a 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -223,11 +223,10 @@ typedef struct {
typedef BSR_SHORT BSR_TRUNCATED;
/*!\brief mac control element: long buffer status report for all logical channel group ID*/
typedef struct {
- uint32_t Buffer_size3:6;
- uint32_t Buffer_size2:6;
- uint32_t Buffer_size1:6;
- uint32_t Buffer_size0:6;
- uint32_t padding:8;
+ uint8_t Buffer_size3:6;
+ uint8_t Buffer_size2:6;
+ uint8_t Buffer_size1:6;
+ uint8_t Buffer_size0:6;
} __attribute__((__packed__))BSR_LONG;
#define BSR_LONG_SIZE (sizeof(BSR_LONG))
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index c2701c5f39..65bb4c09aa 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -1147,8 +1147,6 @@ unsigned char generate_ulsch_header(uint8_t *mac_header,
*(ce_ptr) = (long_bsr->Buffer_size0 << 2) | ((long_bsr->Buffer_size1 & 0x30) >> 4);
*(ce_ptr + 1) = ((long_bsr->Buffer_size1 & 0x0F) << 4) | ((long_bsr->Buffer_size2 & 0x3C) >> 2);
*(ce_ptr + 2) = ((long_bsr->Buffer_size2 & 0x03) << 2) | (long_bsr->Buffer_size3 & 0x3F);
- /* Padding */
- *(ce_ptr + 3) = 0;
ce_ptr += BSR_LONG_SIZE;
// printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
@@ -1347,7 +1345,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
bsr_ce_len = sizeof(BSR_SHORT); //1 byte
}
else{
- bsr_ce_len = sizeof(BSR_LONG); //3 bytes
+ bsr_ce_len = BSR_LONG_SIZE; //3 bytes
}
bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED);
@@ -1601,7 +1599,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
bsr_s = NULL;
bsr_l = NULL ;
//TO DO : compute padding or truncated BSR
- } else if (bsr_ce_len == sizeof(BSR_LONG)) {
+ } else if (bsr_ce_len == BSR_LONG_SIZE) {
bsr_s = NULL;
bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0];
bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1];
@@ -2194,7 +2192,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,ui
}
if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) {
num_lcid +=1;
- bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ;
+ bsr_len = (num_lcid >= 2 ) ? BSR_LONG_SIZE : sizeof(BSR_SHORT) ;
}
else if (rlc_status.bytes_in_buffer) {
LOG_I(MAC,"pdu smaller than TBS! pdu=%d TBS=%d lcid=%d rlc buffer=%d bsr len=%d num lcid=%d\n",pdu,buflen,lcid,rlc_status.bytes_in_buffer,bsr_len, num_lcid);
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 79cd2fcc38..f136c605f8 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -122,6 +122,8 @@ char smbv_ip[16];
//#define K 2 /* averaging coefficient */
//#define TARGET_SF_TIME_NS 1000000 /* 1ms = 1000000 ns */
+uint8_t usim_test = 0;
+
frame_t frame = 0;
char stats_buffer[16384];
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
--
GitLab