Commit 319ae6fb authored by calvin wang's avatar calvin wang

fix bsr report inaccurate value

parent 3bd591bf
/* /*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more OpenAirInterface
* contributor license agreements. See the NOTICE file distributed with Copyright(c) 1999 - 2014 Eurecom
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under OpenAirInterface is free software: you can redistribute it and/or modify
* the OAI Public License, Version 1.0 (the "License"); you may not use this file it under the terms of the GNU General Public License as published by
* except in compliance with the License. the Free Software Foundation, either version 3 of the License, or
* You may obtain a copy of the License at (at your option) any later version.
*
* http://www.openairinterface.org/?page_id=698
* OpenAirInterface is distributed in the hope that it will be useful,
* Unless required by applicable law or agreed to in writing, software but WITHOUT ANY WARRANTY; without even the implied warranty of
* distributed under the License is distributed on an "AS IS" BASIS, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. GNU General Public License for more details.
* See the License for the specific language governing permissions and
* limitations under the License. You should have received a copy of the GNU General Public License
*------------------------------------------------------------------------------- along with OpenAirInterface.The full GNU General Public License is
* For more information about the OpenAirInterface (OAI) Software Alliance: included in this distribution in the file called "COPYING". If not,
* contact@openairinterface.org see <http://www.gnu.org/licenses/>.
*/
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file config.c /*! \file config.c
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures * \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
* \author Navid Nikaein and Raymond Knopp * \author Navid Nikaein and Raymond Knopp
...@@ -73,6 +80,7 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) ...@@ -73,6 +80,7 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index)
UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0;
UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0;
UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0;
UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0;
// stop ongoing RACH procedure // stop ongoing RACH procedure
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
...@@ -247,12 +255,13 @@ rrc_mac_config_req( ...@@ -247,12 +255,13 @@ rrc_mac_config_req(
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0;
} }
#endif #endif
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = 0xFFFF; UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = 0xFFFF; UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
UE_mac_inst[Mod_idP].BSR_reporting_active[REGULAR_BSR]=0; UE_mac_inst[Mod_idP].BSR_reporting_active[REGULAR_BSR]=0;
UE_mac_inst[Mod_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[Mod_idP].BSR_reporting_active[PADDING_BSR]=0;
UE_mac_inst[Mod_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[Mod_idP].BSR_reporting_active[PERIODIC_BSR]=0;
UE_mac_inst[Mod_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[Mod_idP].retxBSRTimer_expires_flag = 0;
UE_mac_inst[Mod_idP].periodBSRTimer_expires_flag = 0;
LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
Mod_idP, Mod_idP,
......
...@@ -133,6 +133,8 @@ ...@@ -133,6 +133,8 @@
/*!\brief maximum value for channel quality indicator */ /*!\brief maximum value for channel quality indicator */
#define MAX_CQI_VALUE 15 #define MAX_CQI_VALUE 15
//if value equal oxFFFF means counters are NOT active
#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
#define LCID_EMPTY 0 #define LCID_EMPTY 0
#define LCID_NOT_EMPTY 1 #define LCID_NOT_EMPTY 1
...@@ -226,7 +228,6 @@ typedef struct { ...@@ -226,7 +228,6 @@ typedef struct {
uint32_t Buffer_size2:6; uint32_t Buffer_size2:6;
uint32_t Buffer_size1:6; uint32_t Buffer_size1:6;
uint32_t Buffer_size0:6; uint32_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))
...@@ -345,6 +346,7 @@ typedef enum { ...@@ -345,6 +346,7 @@ typedef enum {
PERIODIC_BSR PERIODIC_BSR
} UE_FIRST_LEVEL_BSR_TYPE; } UE_FIRST_LEVEL_BSR_TYPE;
/*! \brief Downlink SCH PDU Structure */ /*! \brief Downlink SCH PDU Structure */
typedef struct { typedef struct {
int8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; int8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
...@@ -1096,7 +1098,9 @@ typedef struct { ...@@ -1096,7 +1098,9 @@ typedef struct {
uint8_t BSR_reporting_active[BSR_TYPE_FIRST_LEVEL]; uint8_t BSR_reporting_active[BSR_TYPE_FIRST_LEVEL];
/// retxBSR-Timer expires flag /// retxBSR-Timer expires flag
uint8_t retxBSRTimer_expires_flag; uint8_t retxBSRTimer_expires_flag;
/// periodBSR-Timer expires flag
uint8_t periodBSRTimer_expires_flag;
/// MBSFN_Subframe Configuration /// MBSFN_Subframe Configuration
struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
/// number of subframe allocation pattern available for MBSFN sync area /// number of subframe allocation pattern available for MBSFN sync area
......
...@@ -538,14 +538,14 @@ UE_L2_STATE_t ue_scheduler( ...@@ -538,14 +538,14 @@ UE_L2_STATE_t ue_scheduler(
*/ */
int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen); int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen);
/*! \fn int get_bsr_lcgid (module_id_t module_idP); /*! \fn int update_bsr_and_get_bsr_lcgid (module_id_t module_idP);
\brief determine the lcgid for the bsr \brief determine the lcgid for the bsr
\param[in] Mod_id instance of the UE \param[in] Mod_id instance of the UE
\param[out] lcgid \param[out] lcgid
*/ */
int get_bsr_lcgid (module_id_t module_idP); int update_bsr_and_get_bsr_lcgid (module_id_t module_idP);
/*! \fn int get_bsr_type (module_id_t module_idP,uint16_t bufflen); /*! \fn int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen);
\brief determine whether the bsr is short or long assuming that the MAC pdu is built \brief determine whether the bsr is short or long assuming that the MAC pdu is built
\param[in] Mod_id instance of the UE \param[in] Mod_id instance of the UE
\param[in] bufflen size of phy transport block \param[in] bufflen size of phy transport block
......
...@@ -91,7 +91,7 @@ void ue_init_mac(module_id_t module_idP) ...@@ -91,7 +91,7 @@ void ue_init_mac(module_id_t module_idP)
// default values as deined in 36.331 sec 9.2.2 // default values as deined in 36.331 sec 9.2.2
LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP);
//UE_mac_inst[module_idP].scheduling_info.macConfig=NULL; //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL;
UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240;
UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity; UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity;
UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
...@@ -107,13 +107,14 @@ void ue_init_mac(module_id_t module_idP) ...@@ -107,13 +107,14 @@ void ue_init_mac(module_id_t module_idP)
UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL;
UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL;
// set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW. // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW.
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = 0xFFFF; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = 0xFFFF; UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0;
UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0;
UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0;
UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0;
UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0;
UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer);
UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer);
UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange);
...@@ -320,6 +321,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i ...@@ -320,6 +321,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i
UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0;
UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0;
UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0;
UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0;
LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP);
return(0); return(0);
} }
...@@ -1359,12 +1361,25 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1359,12 +1361,25 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
num_sdus = 1; num_sdus = 1;
//update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]);
//header_len +=2; //header_len +=2;
// update LCID remain buffer
UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY;
if (rlc_status.bytes_in_buffer > sdu_lengths[0]) { if (rlc_status.bytes_in_buffer > sdu_lengths[0]) {
UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0];
} else { } else {
UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = 0; UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = 0;
} }
// update LCGID buffer, in order to get right BSR value
if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > sdu_lengths[0]) {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= sdu_lengths[0];
} else {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0;
LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n",
module_idP,frameP,subframe,
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]],
UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH],
rlc_status.bytes_in_buffer,DCCH);
}
} else { } else {
dcch_header_len=0; dcch_header_len=0;
num_sdus = 0; num_sdus = 0;
...@@ -1408,7 +1423,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1408,7 +1423,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
} else { } else {
UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = 0; UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = 0;
} }
if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] > sdu_lengths[num_sdus]) {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= sdu_lengths[num_sdus];
} else {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0;
}
num_sdus++; num_sdus++;
} else { } else {
dcch1_header_len =0; dcch1_header_len =0;
...@@ -1416,7 +1435,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1416,7 +1435,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
dtch_header_len=0; dtch_header_len=0;
dtch_header_len_last=0; dtch_header_len_last=0;
for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){ for (lcid=MAX_NUM_LCID-1; lcid>=DTCH ; lcid--){
dtch_header_len+=3; dtch_header_len+=3;
dtch_header_len_last=3; dtch_header_len_last=3;
...@@ -1469,7 +1488,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1469,7 +1488,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
} else { } else {
UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = 0; UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = 0;
} }
if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] > sdu_lengths[num_sdus]) {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus];
} else {
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0;
}
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~rlc_status.bytes_in_buffer %d,sdu_lengths[num_sdus] %d buflen %d all_pdu_len %d\n"
,rlc_status.bytes_in_buffer ,sdu_lengths[num_sdus],buflen, all_pdu_len);
//UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
num_sdus++; num_sdus++;
} else { } else {
...@@ -1481,13 +1506,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1481,13 +1506,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
} }
} }
lcgid= get_bsr_lcgid(module_idP); lcgid= update_bsr_and_get_bsr_lcgid(module_idP);
if (lcgid < 0 ) { if (lcgid < 0 ) {
bsr_s = NULL; bsr_s = NULL;
bsr_l = NULL; bsr_l = NULL;
bsr_t = NULL; bsr_t = NULL;
} else if ((lcgid ==MAX_NUM_LCGID) && (bsr_type == LONG_BSR)) { } else if (bsr_type == LONG_BSR) {
bsr_s = NULL; bsr_s = NULL;
bsr_t = NULL; bsr_t = 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];
...@@ -1500,15 +1525,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1500,15 +1525,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1],
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2],
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0;
} else if (bsr_type == SHORT_BSR) { } else if (bsr_type == SHORT_BSR) {
bsr_l = NULL; bsr_l = NULL;
bsr_t = NULL; bsr_t = NULL;
...@@ -1517,8 +1533,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1517,8 +1533,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
LOG_I(MAC,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[UE %d] Frame %d SubFrame %d,report SHORT BSR with level %d for LCGID %d\n", LOG_I(MAC,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[UE %d] Frame %d SubFrame %d,report SHORT BSR with level %d for LCGID %d\n",
module_idP, frameP, subframe, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); module_idP, frameP, subframe, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0;
} else if (bsr_type == TRUNCATED_BSR) { } else if (bsr_type == TRUNCATED_BSR) {
bsr_l = NULL; bsr_l = NULL;
bsr_s = NULL; bsr_s = NULL;
...@@ -1527,8 +1541,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1527,8 +1541,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n",
module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0;
UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0;
} else { } else {
bsr_s = NULL; bsr_s = NULL;
bsr_l = NULL; bsr_l = NULL;
...@@ -1620,6 +1632,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1620,6 +1632,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer);
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer);
UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0;
UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0;
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
...@@ -1789,7 +1802,7 @@ ue_scheduler( ...@@ -1789,7 +1802,7 @@ ue_scheduler(
/* /*
periodicBSR-Timer expires, in which case the BSR is referred below to as "Periodic BSR". periodicBSR-Timer expires, in which case the BSR is referred below to as "Periodic BSR".
*/ */
UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] = 1; UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 1;
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = periodicBSR_Timer_infinity_value; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = periodicBSR_Timer_infinity_value;
} else { } else {
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--;
...@@ -2057,16 +2070,18 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 ...@@ -2057,16 +2070,18 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8
} }
#endif #endif
int get_bsr_lcgid (module_id_t module_idP) //AFTER transmission update BSR value, and get witch LCGID have BSR
int update_bsr_and_get_bsr_lcgid (module_id_t module_idP)
{ {
int lcgid, lcgid_tmp=-1; int lcgid, lcgid_tmp=-1;
int num_active_lcgid = 0; int num_active_lcgid = 0;
for (lcgid = 0 ; lcgid < MAX_NUM_LCGID; lcgid++) { for (lcgid = 0 ; lcgid < MAX_NUM_LCGID; lcgid++) {
// update BSR value, then ue can reprot correct value
UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid]);
if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) { if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) {
lcgid_tmp = lcgid; lcgid_tmp = lcgid;
num_active_lcgid+=1; num_active_lcgid+=1;
printf("////////////////////////////////lcgid %d, BSR %d\n",lcgid,UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]);
} }
} }
...@@ -2087,12 +2102,12 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2087,12 +2102,12 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
mac_rlc_status_resp_t rlc_status; mac_rlc_status_resp_t rlc_status;
int long_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG); int long_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG);
int short_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT); int short_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT);
int bsr_group_id[MAX_NUM_LCGID]; int lcgid_have_bsr_report_flag[MAX_NUM_LCGID];
int lcg_report_num=0; int num_lcg_id_with_data=0;
int new_data_arrived_flag=0; int new_data_arrived_flag=0;
for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) {
bsr_group_id[lcgid] = 0; lcgid_have_bsr_report_flag[lcgid] = 0;
} }
for (lcid=DCCH; lcid<NB_RB_MAX ; lcid++) { for (lcid=DCCH; lcid<NB_RB_MAX ; lcid++) {
...@@ -2103,6 +2118,11 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2103,6 +2118,11 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
*/ */
if (UE_mac_inst[module_idP].retxBSRTimer_expires_flag == 1) { if (UE_mac_inst[module_idP].retxBSRTimer_expires_flag == 1) {
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1;
printf("retxBsrTimer flag %d, periodBsrTimer %d, regular bsr trigger\n",UE_mac_inst[module_idP].retxBSRTimer_expires_flag, UE_mac_inst[module_idP].periodBSRTimer_expires_flag);
}
if (UE_mac_inst[module_idP].periodBSRTimer_expires_flag == 1) {
UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] = 1;
printf("retxBsrTimer flag %d, periodBsrTimer %d, period bsr trigger\n",UE_mac_inst[module_idP].retxBSRTimer_expires_flag, UE_mac_inst[module_idP].periodBSRTimer_expires_flag);
} }
pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT); pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT);
if (rlc_status.bytes_in_buffer > 128 ) { if (rlc_status.bytes_in_buffer > 128 ) {
...@@ -2113,43 +2133,46 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2113,43 +2133,46 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
which belong to any LCG and for which data is already available for transmission which belong to any LCG and for which data is already available for transmission
*/ */
if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) { if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) {
bsr_group_id[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] ++; lcgid_have_bsr_report_flag[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 1;
new_data_arrived_flag = 1; new_data_arrived_flag = 1;
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1;
} }
} }
} }
/*
// one lcid buffer increased and all lcid buffer increased // one lcid buffer increased and all lcid buffer increased
if ((new_data_arrived_flag == 1) && (pdu > UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI)) { if ((new_data_arrived_flag == 1) && (pdu > UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI)) {
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1;
} }
*/
UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI = pdu;
/* or there is no data available for transmission for any of the logical channels which belong to a LCG, /* empty buffer, report 0 bsr reset eNB buffer
in which case the BSR is referred below to as "Regular BSR" */
if (pdu == 0) { if ((pdu == 0) && (UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI > 0)) {
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1;
} }
*/
// computed how many LCG has data available for transmission UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI = pdu;
// computed how many LCGID has data available for transmission
for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) {
if (bsr_group_id[lcgid] > 0) { if (lcgid_have_bsr_report_flag[lcgid] == 1) {
lcg_report_num ++; num_lcg_id_with_data ++;
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid bsr %d > 0\n",lcgid); printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid %d have bsr report\n",lcgid);
} }
} }
/* /*
UL resources are allocated and number of padding bits is equal to or larger than the size of the Buffer Status UL resources are allocated and number of padding bits is equal to or larger than the size of the Buffer Status
Report MAC control element plus its subheader, in which case the BSR is referred below to as "Padding BSR" Report MAC control element plus its subheader, in which case the BSR is referred below to as "Padding BSR"
*/
if ((pdu > 0) && ((pdu+long_bsr_size) <= buflen)) { if ((pdu > 0) && ((pdu+long_bsr_size) <= buflen)) {
UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 1; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 1;
} }
*/
if ((pdu+long_bsr_size) <= buflen) {
UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 0;
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 0;
UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 0;
//printf("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&ping test\n");
}
/* For Regular and Periodic BSR /* For Regular and Periodic BSR
- if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Long BSR; - if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Long BSR;
...@@ -2157,7 +2180,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2157,7 +2180,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
*/ */
if ((UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] == 1) if ((UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] == 1)
|| (UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] == 1)) { || (UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] == 1)) {
if (lcg_report_num > 1) { if (num_lcg_id_with_data > 1) {
bsr_type = LONG_BSR; bsr_type = LONG_BSR;
} else { } else {
bsr_type = SHORT_BSR; bsr_type = SHORT_BSR;
...@@ -2172,13 +2195,13 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2172,13 +2195,13 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
*/ */
if (UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] == 1) { if (UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] == 1) {
if (((pdu + short_bsr_size) <= buflen)&&(buflen<(pdu + long_bsr_size))) { if (((pdu + short_bsr_size) <= buflen)&&(buflen<(pdu + long_bsr_size))) {
if (lcg_report_num > 1) { if (num_lcg_id_with_data > 1) {
bsr_type = TRUNCATED_BSR; bsr_type = TRUNCATED_BSR;
} else { } else {
bsr_type = SHORT_BSR; bsr_type = SHORT_BSR;
} }
} else if ((pdu + long_bsr_size) <= buflen) { } else if ((pdu + long_bsr_size) <= buflen) {
if (lcg_report_num > 1) { if (num_lcg_id_with_data > 1) {
bsr_type = LONG_BSR; bsr_type = LONG_BSR;
} else { } else {
bsr_type = SHORT_BSR; bsr_type = SHORT_BSR;
...@@ -2189,7 +2212,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 ...@@ -2189,7 +2212,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1
if ( bsr_type > 0 ) { if ( bsr_type > 0 ) {
LOG_I(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n", LOG_I(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n",
module_idP, bsr_type, buflen, pdu, lcg_report_num); module_idP, bsr_type, buflen, pdu, num_lcg_id_with_data);
} }
return bsr_type; return bsr_type;
......
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