Commit 8bd6588a authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/new_rlc' into develop_integration_2019_w44

parents 4de7624c cba6c72f
......@@ -1442,7 +1442,7 @@ add_library(PHY_MEX ${PHY_MEX_UE})
#Layer 2 library
#####################
set(RLC_ENB_V1
set(RLC_V1
${RLC_AM_DIR}/rlc_am.c
${RLC_AM_DIR}/rlc_am_init.c
${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
......@@ -1471,7 +1471,7 @@ set(RLC_ENB_V1
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
)
set(RLC_ENB_V2
set(RLC_V2
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_oai_api.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/asn1_utils.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_ue_manager.c
......@@ -1498,7 +1498,7 @@ set(L2_SRC
${PDCP_DIR}/pdcp_util.c
${PDCP_DIR}/pdcp_security.c
${PDCP_DIR}/pdcp_netlink.c
${RLC_ENB_V2}
${RLC_V2}
# ${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_S1AP.c
......@@ -1518,33 +1518,7 @@ set(L2_SRC_UE
${PDCP_DIR}/pdcp_util.c
${PDCP_DIR}/pdcp_security.c
${PDCP_DIR}/pdcp_netlink.c
${RLC_AM_DIR}/rlc_am.c
${RLC_AM_DIR}/rlc_am_init.c
${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
${RLC_AM_DIR}/rlc_am_timer_reordering.c
${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c
${RLC_AM_DIR}/rlc_am_segment.c
${RLC_AM_DIR}/rlc_am_segments_holes.c
${RLC_AM_DIR}/rlc_am_in_sdu.c
${RLC_AM_DIR}/rlc_am_receiver.c
${RLC_AM_DIR}/rlc_am_retransmit.c
${RLC_AM_DIR}/rlc_am_windows.c
${RLC_AM_DIR}/rlc_am_rx_list.c
${RLC_AM_DIR}/rlc_am_reassembly.c
${RLC_AM_DIR}/rlc_am_status_report.c
${RLC_TM_DIR}/rlc_tm.c
${RLC_TM_DIR}/rlc_tm_init.c
${RLC_UM_DIR}/rlc_um.c
${RLC_UM_DIR}/rlc_um_fsm.c
${RLC_UM_DIR}/rlc_um_control_primitives.c
${RLC_UM_DIR}/rlc_um_segment.c
${RLC_UM_DIR}/rlc_um_reassembly.c
${RLC_UM_DIR}/rlc_um_receiver.c
${RLC_UM_DIR}/rlc_um_dar.c
${RLC_DIR}/rlc_mac.c
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
${RLC_V2}
${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_common.c
${RRC_DIR}/L2_interface_common.c
......
......@@ -146,7 +146,7 @@ void mac_top_init_eNB(void)
RC.mac = mac;
AssertFatal(rlc_module_init() == 0,
AssertFatal(rlc_module_init(1) == 0,
"Could not initialize RLC layer\n");
// These should be out of here later
......@@ -184,7 +184,7 @@ int rlcmac_init_global_param(void)
LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
if (rlc_module_init() != 0) {
if (rlc_module_init(1) != 0) {
return (-1);
}
......
......@@ -110,7 +110,7 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer,
int rlcmac_init_global_param_ue(void) {
LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
if (rlc_module_init() != 0) {
if (rlc_module_init(0) != 0) {
return (-1);
}
......
......@@ -630,7 +630,8 @@ void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP,
}
//-----------------------------------------------------------------------------
int
rlc_module_init (void) {
rlc_module_init (int enb_flag) { /* enb_flag is unused, but needed for binary
* compatibility with rlc_v2 */
//-----------------------------------------------------------------------------
int k;
module_id_t module_id1;
......
......@@ -654,10 +654,10 @@ rlc_op_status_t rlc_stat_req (
unsigned int* const stat_timer_poll_retransmit_timed_out,
unsigned int* const stat_timer_status_prohibit_timed_out);
/*! \fn int rlc_module_init(void)
/*! \fn int rlc_module_init(int enb_flag)
* \brief RAZ the memory of the RLC layer, initialize the memory pool manager (mem_block_t structures mainly used in RLC module).
*/
int rlc_module_init(void);
int rlc_module_init(int enb_flag);
/** @} */
......
......@@ -53,7 +53,7 @@ void mac_rlc_data_ind (
rlc_ue_t *ue;
rlc_entity_t *rb;
if (module_idP != 0 || eNB_index != 0 || enb_flagP != 1 || MBMS_flagP != 0) {
if (module_idP != 0 || eNB_index != 0 || /*enb_flagP != 1 ||*/ MBMS_flagP != 0) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
......@@ -102,6 +102,8 @@ tbs_size_t mac_rlc_data_req(
int ret;
rlc_ue_t *ue;
rlc_entity_t *rb;
int is_enb;
int maxsize;
rlc_manager_lock(rlc_ue_manager);
ue = rlc_manager_get_ue(rlc_ue_manager, rntiP);
......@@ -118,7 +120,13 @@ tbs_size_t mac_rlc_data_req(
if (rb != NULL) {
rb->set_time(rb, rlc_current_time);
ret = rb->generate_pdu(rb, buffer_pP, ue->saved_status_ind_tb_size[channel_idP - 1]);
/* UE does not seem to use saved_status_ind_tb_size */
is_enb = rlc_manager_get_enb_flag(rlc_ue_manager);
if (is_enb)
maxsize = ue->saved_status_ind_tb_size[channel_idP - 1];
else
maxsize = tb_sizeP;
ret = rb->generate_pdu(rb, buffer_pP, maxsize);
} else {
LOG_E(RLC, "%s:%d:%s: fatal: data req for unknown RB\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
......@@ -201,6 +209,61 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
return ret;
}
rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const sub_frame_t subframeP,
const eNB_flag_t enb_flagP,
const logical_chan_id_t channel_idP)
{
rlc_ue_t *ue;
rlc_buffer_occupancy_t ret;
rlc_entity_t *rb;
if (enb_flagP) {
LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP);
exit(1);
}
/* TODO: handle time a bit more properly */
if (rlc_current_time_last_frame != frameP ||
rlc_current_time_last_subframe != subframeP) {
rlc_current_time++;
rlc_current_time_last_frame = frameP;
rlc_current_time_last_subframe = subframeP;
}
rlc_manager_lock(rlc_ue_manager);
ue = rlc_manager_get_ue(rlc_ue_manager, rntiP);
switch (channel_idP) {
case 1 ... 2: rb = ue->srb[channel_idP - 1]; break;
case 3 ... 7: rb = ue->drb[channel_idP - 3]; break;
default: rb = NULL; break;
}
if (rb != NULL) {
rlc_entity_buffer_status_t buf_stat;
rb->set_time(rb, rlc_current_time);
/* 36.321 deals with BSR values up to 3000000 bytes, after what it
* reports '> 3000000' (table 6.1.3.1-2). Passing 4000000 is thus
* more than enough.
*/
buf_stat = rb->buffer_status(rb, 4000000);
ret = buf_stat.status_size
+ buf_stat.retx_size
+ buf_stat.tx_size;
} else {
ret = 0;
}
rlc_manager_unlock(rlc_ue_manager);
return ret;
}
int oai_emulation;
rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
......@@ -260,7 +323,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
return RLC_OP_STATUS_OK;
}
int rlc_module_init(void)
int rlc_module_init(int enb_flag)
{
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static int inited = 0;
......@@ -274,7 +337,7 @@ int rlc_module_init(void)
inited = 1;
rlc_ue_manager = new_rlc_ue_manager();
rlc_ue_manager = new_rlc_ue_manager(enb_flag);
if (pthread_mutex_unlock(&lock)) abort();
......@@ -293,6 +356,7 @@ static void deliver_sdu(void *_ue, rlc_entity_t *entity, char *buf, int size)
protocol_ctxt_t ctx;
mem_block_t *memblock;
int i;
int is_enb;
/* is it SRB? */
for (i = 0; i < 2; i++) {
......@@ -338,11 +402,15 @@ rb_found:
/* used fields? */
ctx.module_id = 0;
ctx.rnti = ue->rnti;
ctx.enb_flag = 1;
is_enb = rlc_manager_get_enb_flag(rlc_ue_manager);
ctx.enb_flag = is_enb;
if (is_enb) {
T(T_ENB_RLC_UL,
T_INT(0 /*ctxt_pP->module_id*/),
T_INT(ue->rnti), T_INT(rb_id), T_INT(size));
}
if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__);
......@@ -357,6 +425,7 @@ static void successful_delivery(void *_ue, rlc_entity_t *entity, int sdu_id)
int is_srb;
int rb_id;
MessageDef *msg;
int is_enb;
/* is it SRB? */
for (i = 0; i < 2; i++) {
......@@ -390,6 +459,10 @@ rb_found:
if (is_srb == 0)
return;
is_enb = rlc_manager_get_enb_flag(rlc_ue_manager);
if (!is_enb)
return;
msg = itti_alloc_new_message(TASK_RLC_ENB, RLC_SDU_INDICATION);
RLC_SDU_INDICATION(msg).rnti = ue->rnti;
RLC_SDU_INDICATION(msg).is_successful = 1;
......@@ -406,6 +479,7 @@ static void max_retx_reached(void *_ue, rlc_entity_t *entity)
int is_srb;
int rb_id;
MessageDef *msg;
int is_enb;
/* is it SRB? */
for (i = 0; i < 2; i++) {
......@@ -438,6 +512,10 @@ rb_found:
if (is_srb == 0)
return;
is_enb = rlc_manager_get_enb_flag(rlc_ue_manager);
if (!is_enb)
return;
msg = itti_alloc_new_message(TASK_RLC_ENB, RLC_SDU_INDICATION);
RLC_SDU_INDICATION(msg).rnti = ue->rnti;
RLC_SDU_INDICATION(msg).is_successful = 0;
......@@ -721,7 +799,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
int rnti = ctxt_pP->rnti;
int i,j;
if (ctxt_pP->enb_flag != 1 || ctxt_pP->module_id != 0 /*||
if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %d %d %d %d)\n", __FUNCTION__,
......@@ -832,10 +910,6 @@ rlc_op_status_t rrc_rlc_config_req (
LOG_E(RLC, "%s:%d:%s: todo (mbms not supported)\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (!ctxt_pP->enb_flag) {
LOG_E(RLC, "%s:%d:%s: todo (only eNB supported, not UE)\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (actionP != CONFIG_ACTION_REMOVE) {
LOG_E(RLC, "%s:%d:%s: todo (only CONFIG_ACTION_REMOVE supported)\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
......@@ -894,4 +968,3 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
return RLC_OP_STATUS_OK;
}
......@@ -31,9 +31,10 @@ typedef struct {
pthread_mutex_t lock;
rlc_ue_t **ue_list;
int ue_count;
int enb_flag;
} rlc_ue_manager_internal_t;
rlc_ue_manager_t *new_rlc_ue_manager(void)
rlc_ue_manager_t *new_rlc_ue_manager(int enb_flag)
{
rlc_ue_manager_internal_t *ret;
......@@ -44,10 +45,17 @@ rlc_ue_manager_t *new_rlc_ue_manager(void)
}
if (pthread_mutex_init(&ret->lock, NULL)) abort();
ret->enb_flag = enb_flag;
return ret;
}
int rlc_manager_get_enb_flag(rlc_ue_manager_t *_m)
{
rlc_ue_manager_internal_t *m = _m;
return m->enb_flag;
}
void rlc_manager_lock(rlc_ue_manager_t *_m)
{
rlc_ue_manager_internal_t *m = _m;
......
......@@ -40,7 +40,9 @@ typedef struct rlc_ue_t {
/* manager functions */
/***********************************************************************/
rlc_ue_manager_t *new_rlc_ue_manager(void);
rlc_ue_manager_t *new_rlc_ue_manager(int enb_flag);
int rlc_manager_get_enb_flag(rlc_ue_manager_t *m);
void rlc_manager_lock(rlc_ue_manager_t *m);
void rlc_manager_unlock(rlc_ue_manager_t *m);
......
......@@ -226,7 +226,7 @@ int main(int argc, char **argv)
mac_xface = malloc(sizeof(MAC_xface));
Mac_rlc_xface = (MAC_RLC_XFACE*)malloc16(sizeof(MAC_RLC_XFACE));
rlc_module_init ();
rlc_module_init (1);
pdcp_module_init();
logInit();
......
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