Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangwenhui
OpenXG-RAN
Commits
319ae6fb
Commit
319ae6fb
authored
Nov 18, 2016
by
calvin wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bsr report inaccurate value
parent
3bd591bf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
73 deletions
+109
-73
openair2/LAYER2/MAC/config.c
openair2/LAYER2/MAC/config.c
+31
-22
openair2/LAYER2/MAC/defs.h
openair2/LAYER2/MAC/defs.h
+6
-2
openair2/LAYER2/MAC/proto.h
openair2/LAYER2/MAC/proto.h
+3
-3
openair2/LAYER2/MAC/ue_procedures.c
openair2/LAYER2/MAC/ue_procedures.c
+69
-46
No files found.
openair2/LAYER2/MAC/config.c
View file @
319ae6fb
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
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
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
* \author Navid Nikaein and Raymond Knopp
...
...
@@ -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
[
PERIODIC_BSR
]
=
0
;
UE_mac_inst
[
module_idP
].
retxBSRTimer_expires_flag
=
0
;
UE_mac_inst
[
module_idP
].
periodBSRTimer_expires_flag
=
0
;
// stop ongoing RACH procedure
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
...
...
@@ -247,12 +255,13 @@ rrc_mac_config_req(
UE_mac_inst
[
Mod_idP
].
scheduling_info
.
extendedPHR_r10
=
(
uint16_t
)
0
;
}
#endif
UE_mac_inst
[
Mod_idP
].
scheduling_info
.
periodicBSR_SF
=
0xFFFF
;
UE_mac_inst
[
Mod_idP
].
scheduling_info
.
retxBSR_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
=
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
[
PADDING_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
].
periodBSRTimer_expires_flag
=
0
;
LOG_D
(
MAC
,
"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)
\n
"
,
Mod_idP
,
...
...
openair2/LAYER2/MAC/defs.h
View file @
319ae6fb
...
...
@@ -133,6 +133,8 @@
/*!\brief maximum value for channel quality indicator */
#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_NOT_EMPTY 1
...
...
@@ -226,7 +228,6 @@ typedef struct {
uint32_t
Buffer_size2
:
6
;
uint32_t
Buffer_size1
:
6
;
uint32_t
Buffer_size0
:
6
;
uint32_t
padding
:
8
;
}
__attribute__
((
__packed__
))
BSR_LONG
;
#define BSR_LONG_SIZE (sizeof(BSR_LONG))
...
...
@@ -345,6 +346,7 @@ typedef enum {
PERIODIC_BSR
}
UE_FIRST_LEVEL_BSR_TYPE
;
/*! \brief Downlink SCH PDU Structure */
typedef
struct
{
int8_t
payload
[
8
][
SCH_PAYLOAD_SIZE_MAX
];
...
...
@@ -1096,6 +1098,8 @@ typedef struct {
uint8_t
BSR_reporting_active
[
BSR_TYPE_FIRST_LEVEL
];
/// retxBSR-Timer expires flag
uint8_t
retxBSRTimer_expires_flag
;
/// periodBSR-Timer expires flag
uint8_t
periodBSRTimer_expires_flag
;
/// MBSFN_Subframe Configuration
struct
MBSFN_SubframeConfig
*
mbsfn_SubframeConfig
[
8
];
// FIXME replace 8 by MAX_MBSFN_AREA?
...
...
openair2/LAYER2/MAC/proto.h
View file @
319ae6fb
...
...
@@ -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
);
/*! \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
\param[in] Mod_id instance of the UE
\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 buf
flen);
/*! \fn int get_bsr_type (module_id_t module_idP,
uint8_t eNB_index,frame_t frameP,uint16_t bu
flen);
\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] bufflen size of phy transport block
...
...
openair2/LAYER2/MAC/ue_procedures.c
View file @
319ae6fb
...
...
@@ -91,7 +91,7 @@ void ue_init_mac(module_id_t module_idP)
// default values as deined in 36.331 sec 9.2.2
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
.
retxBSR_Timer
=
MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf
256
0
;
UE_mac_inst
[
module_idP
].
scheduling_info
.
retxBSR_Timer
=
MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf
1024
0
;
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
.
prohibitPHR_Timer
=
MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20
;
...
...
@@ -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
.
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.
UE_mac_inst
[
module_idP
].
scheduling_info
.
periodicBSR_SF
=
0xFFFF
;
UE_mac_inst
[
module_idP
].
scheduling_info
.
retxBSR_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
=
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
[
PADDING_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
].
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
.
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
);
...
...
@@ -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
[
PERIODIC_BSR
]
=
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
);
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
num_sdus
=
1
;
//update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]);
//header_len +=2;
// update LCID remain buffer
UE_mac_inst
[
module_idP
].
scheduling_info
.
LCID_status
[
DCCH
]
=
LCID_EMPTY
;
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
];
}
else
{
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
{
dcch_header_len
=
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
}
else
{
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
++
;
}
else
{
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
dtch_header_len
=
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_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
}
else
{
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]);
num_sdus
++
;
}
else
{
...
...
@@ -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
)
{
bsr_s
=
NULL
;
bsr_l
=
NULL
;
bsr_t
=
NULL
;
}
else
if
(
(
lcgid
==
MAX_NUM_LCGID
)
&&
(
bsr_type
==
LONG_BSR
)
)
{
}
else
if
(
bsr_type
==
LONG_BSR
)
{
bsr_s
=
NULL
;
bsr_t
=
NULL
;
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
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
[
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
)
{
bsr_l
=
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
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
);
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
)
{
bsr_l
=
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
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
);
UE_mac_inst
[
module_idP
].
scheduling_info
.
BSR_bytes
[
lcgid
]
=
0
;
UE_mac_inst
[
module_idP
].
scheduling_info
.
BSR
[
lcgid
]
=
0
;
}
else
{
bsr_s
=
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
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
].
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
);
stop_meas
(
&
UE_mac_inst
[
module_idP
].
tx_ulsch_sdu
);
...
...
@@ -1789,7 +1802,7 @@ ue_scheduler(
/*
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
;
}
else
{
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
}
#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
num_active_lcgid
=
0
;
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
)
{
lcgid_tmp
=
lcgid
;
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
mac_rlc_status_resp_t
rlc_status
;
int
long_bsr_size
=
sizeof
(
SCH_SUBHEADER_FIXED
)
+
sizeof
(
BSR_LONG
);
int
short_bsr_size
=
sizeof
(
SCH_SUBHEADER_FIXED
)
+
sizeof
(
BSR_SHORT
);
int
bsr_group_id
[
MAX_NUM_LCGID
];
int
lcg_report_num
=
0
;
int
lcgid_have_bsr_report_flag
[
MAX_NUM_LCGID
];
int
num_lcg_id_with_data
=
0
;
int
new_data_arrived_flag
=
0
;
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
++
)
{
...
...
@@ -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
)
{
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
);
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
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
])
{
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
;
UE_mac_inst
[
module_idP
].
BSR_reporting_active
[
REGULAR_BSR
]
=
1
;
}
}
}
/*
// 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
))
{
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,
in which case the BSR is referred below to as "Regular BSR"
if (
pdu == 0
) {
/*
empty buffer, report 0 bsr reset eNB buffer
*/
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
;
}
*/
// 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
++
)
{
if
(
bsr_group_id
[
lcgid
]
>
0
)
{
lcg_report_num
++
;
printf
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid
bsr %d > 0
\n
"
,
lcgid
);
if
(
lcgid_have_bsr_report_flag
[
lcgid
]
==
1
)
{
num_lcg_id_with_data
++
;
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
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)) {
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
- 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
*/
if
((
UE_mac_inst
[
module_idP
].
BSR_reporting_active
[
REGULAR_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
;
}
else
{
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
*/
if
(
UE_mac_inst
[
module_idP
].
BSR_reporting_active
[
PADDING_BSR
]
==
1
)
{
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
;
}
else
{
bsr_type
=
SHORT_BSR
;
}
}
else
if
((
pdu
+
long_bsr_size
)
<=
buflen
)
{
if
(
lcg_report_num
>
1
)
{
if
(
num_lcg_id_with_data
>
1
)
{
bsr_type
=
LONG_BSR
;
}
else
{
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
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
"
,
module_idP
,
bsr_type
,
buflen
,
pdu
,
lcg_report_num
);
module_idP
,
bsr_type
,
buflen
,
pdu
,
num_lcg_id_with_data
);
}
return
bsr_type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment