Commit e7e48144 authored by fnabet's avatar fnabet

Remove RLC header size from UE L2 buffer occupancy

parent fbe109a6
...@@ -2265,7 +2265,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra ...@@ -2265,7 +2265,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra
rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO, rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
lcid, lcid,
0); 0xFFFF); //TBS is not used in RLC at this step, set a special value for debug
lcid_bytes_in_buffer[lcid] = rlc_status.bytes_in_buffer; lcid_bytes_in_buffer[lcid] = rlc_status.bytes_in_buffer;
......
...@@ -152,9 +152,6 @@ rlc_am_get_buffer_occupancy_in_bytes ( ...@@ -152,9 +152,6 @@ rlc_am_get_buffer_occupancy_in_bytes (
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t * const rlc_pP) rlc_am_entity_t * const rlc_pP)
{ {
uint32_t max_li_overhead;
uint32_t header_overhead;
// priority of control trafic // priority of control trafic
rlc_pP->status_buffer_occupancy = 0; rlc_pP->status_buffer_occupancy = 0;
if ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK)) { if ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK)) {
...@@ -168,21 +165,6 @@ rlc_am_get_buffer_occupancy_in_bytes ( ...@@ -168,21 +165,6 @@ rlc_am_get_buffer_occupancy_in_bytes (
#endif #endif
} }
// data traffic
if (rlc_pP->nb_sdu_no_segmented <= 1) {
max_li_overhead = 0;
} else {
/* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
uint32_t num_li = rlc_pP->nb_sdu_no_segmented - 1;
max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
}
if (rlc_pP->sdu_buffer_occupancy == 0) {
header_overhead = 0;
} else {
header_overhead = 2;
}
#if TRACE_RLC_AM_BO #if TRACE_RLC_AM_BO
...@@ -192,13 +174,13 @@ rlc_am_get_buffer_occupancy_in_bytes ( ...@@ -192,13 +174,13 @@ rlc_am_get_buffer_occupancy_in_bytes (
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->sdu_buffer_occupancy, rlc_pP->sdu_buffer_occupancy,
max_li_overhead, 0,
header_overhead, 0,
rlc_pP->nb_sdu_no_segmented); rlc_pP->nb_sdu_no_segmented);
} }
#endif #endif
return rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead; return rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
...@@ -645,7 +627,8 @@ rlc_am_mac_status_indication ( ...@@ -645,7 +627,8 @@ rlc_am_mac_status_indication (
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
void * const rlc_pP, void * const rlc_pP,
const uint16_t tb_sizeP, const uint16_t tb_sizeP,
struct mac_status_ind tx_statusP) struct mac_status_ind tx_statusP,
const eNB_flag_t enb_flagP)
{ {
struct mac_status_resp status_resp; struct mac_status_resp status_resp;
uint16_t sdu_size = 0; uint16_t sdu_size = 0;
...@@ -681,6 +664,26 @@ rlc_am_mac_status_indication ( ...@@ -681,6 +664,26 @@ rlc_am_mac_status_indication (
status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, rlc); status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, rlc);
// For eNB scheduler : Add Max RLC header size for new PDU
// For UE : do not add RLC header part to be compliant with BSR definition in 36.321
if (enb_flagP == ENB_FLAG_YES) {
uint32_t max_li_overhead = 0;
uint32_t header_overhead = 0;
if (rlc->nb_sdu_no_segmented > 1) {
/* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
uint32_t num_li = rlc->nb_sdu_no_segmented - 1;
max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
}
if (rlc->sdu_buffer_occupancy > 0) {
header_overhead = 2;
}
status_resp.buffer_occupancy_in_bytes += (header_overhead + max_li_overhead);
}
if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) { if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes; //status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
...@@ -768,7 +771,8 @@ rlc_am_set_nb_bytes_requested_by_mac ( ...@@ -768,7 +771,8 @@ rlc_am_set_nb_bytes_requested_by_mac (
struct mac_data_req struct mac_data_req
rlc_am_mac_data_request ( rlc_am_mac_data_request (
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
void * const rlc_pP void * const rlc_pP,
const eNB_flag_t enb_flagP
) )
{ {
struct mac_data_req data_req; struct mac_data_req data_req;
...@@ -806,7 +810,10 @@ rlc_am_mac_data_request ( ...@@ -806,7 +810,10 @@ rlc_am_mac_data_request (
data_req.data.nb_elements); data_req.data.nb_elements);
} }
if (enb_flagP) {
// redundant in UE MAC Tx processing and not used in eNB ...
data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p); data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p);
}
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state; data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
#if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR #if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR
......
...@@ -267,15 +267,16 @@ private_rlc_am( void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP,v ...@@ -267,15 +267,16 @@ private_rlc_am( void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP,v
*/ */
protected_rlc_am( void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind);) protected_rlc_am( void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind);)
/*! \fn struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) /*! \fn struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP)
* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission. * \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
* \param[in] ctxt_pP Running context. * \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission. * \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission.
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \param[in] enb_flagP eNB or UE flag indication.
* \return The maximum number of bytes that can be served by RLC instance to MAC. * \return The maximum number of bytes that can be served by RLC instance to MAC.
*/ */
public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP, void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP, void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP);)
/*! \fn void rlc_am_set_nb_bytes_requested_by_mac (void * const rlc_pP,const tb_size_t tb_sizeP) /*! \fn void rlc_am_set_nb_bytes_requested_by_mac (void * const rlc_pP,const tb_size_t tb_sizeP)
* \brief Set available TBS for RLC Tx just before am_mac_data_request. Used for UE only. * \brief Set available TBS for RLC Tx just before am_mac_data_request. Used for UE only.
...@@ -284,13 +285,14 @@ public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (const pro ...@@ -284,13 +285,14 @@ public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (const pro
*/ */
public_rlc_am( void rlc_am_set_nb_bytes_requested_by_mac (void * const rlc_pP,const tb_size_t tb_sizeP);) public_rlc_am( void rlc_am_set_nb_bytes_requested_by_mac (void * const rlc_pP,const tb_size_t tb_sizeP);)
/*! \fn struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP) /*! \fn struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP,const eNB_flag_t enb_flagP)
* \brief Gives PDUs to lower layer MAC. * \brief Gives PDUs to lower layer MAC.
* \param[in] ctxt_pP Running context. * \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] enb_flagP eNB or UE flag
* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission. * \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
*/ */
public_rlc_am( struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP);) public_rlc_am( struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP,const eNB_flag_t enb_flagP);)
/*! \fn void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP) /*! \fn void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP)
* \brief Receive PDUs from lower layer MAC. * \brief Receive PDUs from lower layer MAC.
......
...@@ -434,7 +434,6 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP ...@@ -434,7 +434,6 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
int32_t diff_time=0; int32_t diff_time=0;
rlc_um_entity_t *rlc_p = NULL; rlc_um_entity_t *rlc_p = NULL;
mem_block_t *mb_p = NULL; mem_block_t *mb_p = NULL;
unsigned int max_li_overhead = 0;
status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_pdus = 0;
status_resp.buffer_occupancy_in_bytes = 0; status_resp.buffer_occupancy_in_bytes = 0;
...@@ -454,20 +453,11 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP ...@@ -454,20 +453,11 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) { if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) {
//Fix on full Header size if (enb_flagP == ENB_FLAG_YES) {
if (enb_flagP == ENB_FLAG_NO) /* For eNB: add minimum RLC UM header size for the scheduler */
{ /* For UE : RLC header part is not taken into account for BSR reporting (cf 36.321) */
// compute Length Indicator overhead to inform MAC of maximum full RLC PDU size according to stored SDUs status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
// For UE scheduler
// Could be useful for eNB: to be checked
if (rlc_p->input_sdus.nb_elements <= 1) {
max_li_overhead = 0;
} else {
unsigned int num_li = rlc_p->input_sdus.nb_elements - 1;
max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
}
} }
status_resp.buffer_occupancy_in_bytes += (rlc_p->tx_header_min_length_in_bytes + max_li_overhead);
status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements; status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time; diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time;
...@@ -532,7 +522,7 @@ rlc_um_set_nb_bytes_requested_by_mac ( ...@@ -532,7 +522,7 @@ rlc_um_set_nb_bytes_requested_by_mac (
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_data_req struct mac_data_req
rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP) rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,const eNB_flag_t enb_flagP)
{ {
struct mac_data_req data_req; struct mac_data_req data_req;
int16_t tb_size_in_bytes; int16_t tb_size_in_bytes;
...@@ -554,11 +544,14 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP) ...@@ -554,11 +544,14 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP)
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data); list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
if (enb_flagP) {
// redundant in UE MAC Tx processing and not used in eNB scheduler ...
data_req.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (l_rlc_p); data_req.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (l_rlc_p);
if (data_req.buffer_occupancy_in_bytes > 0) { if (data_req.buffer_occupancy_in_bytes > 0) {
data_req.buffer_occupancy_in_bytes += l_rlc_p->tx_header_min_length_in_bytes; data_req.buffer_occupancy_in_bytes += l_rlc_p->tx_header_min_length_in_bytes;
} }
}
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state; data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
......
...@@ -195,13 +195,14 @@ public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const pro ...@@ -195,13 +195,14 @@ public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const pro
*/ */
public_rlc_um( void rlc_um_set_nb_bytes_requested_by_mac (rlc_um_entity_t * const rlc_pP, const tb_size_t tb_sizeP);) public_rlc_um( void rlc_um_set_nb_bytes_requested_by_mac (rlc_um_entity_t * const rlc_pP, const tb_size_t tb_sizeP);)
/*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) /*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,const eNB_flag_t enb_flagP)
* \brief Gives PDUs to lower layer MAC. * \brief Gives PDUs to lower layer MAC.
* \param[in] ctxt_pP Running context. * \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] enb_flagP eNB or UE flag.
* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission. * \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
*/ */
public_rlc_um( struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);) public_rlc_um( struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,const eNB_flag_t enb_flagP);)
/*! \fn void rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,struct mac_data_ind data_indP) /*! \fn void rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,struct mac_data_ind data_indP)
......
...@@ -191,13 +191,13 @@ tbs_size_t mac_rlc_data_req( ...@@ -191,13 +191,13 @@ tbs_size_t mac_rlc_data_req(
case RLC_MODE_AM: case RLC_MODE_AM:
if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP); if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP);
data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am); data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP);
ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data); ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
break; break;
case RLC_MODE_UM: case RLC_MODE_UM:
if (!enb_flagP) rlc_um_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.um,tb_sizeP); if (!enb_flagP) rlc_um_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.um,tb_sizeP);
data_request = rlc_um_mac_data_request(&ctxt, &rlc_union_p->rlc.um); data_request = rlc_um_mac_data_request(&ctxt, &rlc_union_p->rlc.um,enb_flagP);
ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data); ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data);
break; break;
...@@ -401,7 +401,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( ...@@ -401,7 +401,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
break; break;
case RLC_MODE_AM: case RLC_MODE_AM:
status_resp = rlc_am_mac_status_indication(&ctxt, &rlc_union_p->rlc.am, tb_sizeP, tx_status); status_resp = rlc_am_mac_status_indication(&ctxt, &rlc_union_p->rlc.am, tb_sizeP, tx_status,enb_flagP);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send; mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
......
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