Commit 69ccc900 authored by fnabet's avatar fnabet
Browse files

fix BSR long size and fill

parent 2965d79d
...@@ -223,11 +223,10 @@ typedef struct { ...@@ -223,11 +223,10 @@ typedef struct {
typedef BSR_SHORT BSR_TRUNCATED; typedef BSR_SHORT BSR_TRUNCATED;
/*!\brief mac control element: long buffer status report for all logical channel group ID*/ /*!\brief mac control element: long buffer status report for all logical channel group ID*/
typedef struct { typedef struct {
uint32_t Buffer_size3:6; uint8_t Buffer_size3:6;
uint32_t Buffer_size2:6; uint8_t Buffer_size2:6;
uint32_t Buffer_size1:6; uint8_t Buffer_size1:6;
uint32_t Buffer_size0:6; uint8_t Buffer_size0:6;
uint32_t padding:8;
} __attribute__((__packed__))BSR_LONG; } __attribute__((__packed__))BSR_LONG;
#define BSR_LONG_SIZE (sizeof(BSR_LONG)) #define BSR_LONG_SIZE (sizeof(BSR_LONG))
......
...@@ -1147,8 +1147,6 @@ unsigned char generate_ulsch_header(uint8_t *mac_header, ...@@ -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) = (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 + 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); *(ce_ptr + 2) = ((long_bsr->Buffer_size2 & 0x03) << 2) | (long_bsr->Buffer_size3 & 0x3F);
/* Padding */
*(ce_ptr + 3) = 0;
ce_ptr += BSR_LONG_SIZE; ce_ptr += BSR_LONG_SIZE;
// printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements); // 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 ...@@ -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 bsr_ce_len = sizeof(BSR_SHORT); //1 byte
} }
else{ 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); 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 ...@@ -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_s = NULL;
bsr_l = NULL ; bsr_l = NULL ;
//TO DO : compute padding or truncated BSR //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_s = NULL;
bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; 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]; 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 ...@@ -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 ) ) { if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) {
num_lcid +=1; 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) { 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); 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);
......
...@@ -122,6 +122,8 @@ char smbv_ip[16]; ...@@ -122,6 +122,8 @@ char smbv_ip[16];
//#define K 2 /* averaging coefficient */ //#define K 2 /* averaging coefficient */
//#define TARGET_SF_TIME_NS 1000000 /* 1ms = 1000000 ns */ //#define TARGET_SF_TIME_NS 1000000 /* 1ms = 1000000 ns */
uint8_t usim_test = 0;
frame_t frame = 0; frame_t frame = 0;
char stats_buffer[16384]; char stats_buffer[16384];
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs]; channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
......
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