Commit 0033859f authored by Javier Morgade's avatar Javier Morgade

Merge remote-tracking branch 'origin/new_rlc' into fed4fire_fec5_cdn-x-all

Signed-off-by: default avatarJavier Morgade <javier.morgade@ieee.org>
parents e227a763 9759746e
......@@ -288,7 +288,7 @@ MCEs = (
mnc_length = 2;
}
service_id=0;
lcid=8; #this must be properly defined lcid:8+service:0 -> rab_id:8
lcid=5; #this must be properly defined lcid:8+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5
}
);
}
......
......@@ -259,7 +259,7 @@ MCEs = (
mnc_length = 2;
}
service_id=0; #keep this allways as 0 (workaround for TUN if)
lcid=6; #this must be properly defined lcid:6+service:0 -> rab_id:6
lcid=5; #this must be properly defined lcid:6+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5
}
);
}
......
......@@ -259,7 +259,7 @@ MCEs = (
mnc_length = 2;
}
service_id=0; #keep this allways as 0 (workaround for TUN if)
lcid=6; #this must be properly defined lcid:6+service:0 -> rab_id:6
lcid=5; #this must be properly defined lcid:6+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5
}
);
}
......
......@@ -76,6 +76,11 @@ nullPointer:common/utils/T/local_tracer.c:243
// first iteration of the loop
nullPointer:common/utils/T/tracer/multi.c:264
nullPointer:common/utils/T/tracer/multi.c:265
//-----------------------------------------------------------------------------
// this file is used for testing the RLC V2 implementation, this error is
// not a problem, the programmer has to know what she does when writing
// the tests
arrayIndexOutOfBounds:openair2/LAYER2/rlc_v2/tests/test.c:401
//
//*****************************************************************************
//
......
......@@ -731,7 +731,6 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}")
##############################################################
add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
......@@ -834,7 +833,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
##########################
# RRC LAYER OPTIONS
##########################
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, configure params are actually set in rrc_eNB.c:rrc_eNB_generate_defaultRRCConnectionReconfiguration(...)")
add_boolean_option(RRC_DEFAULT_RAB_IS_AM True "set the RLC mode to AM for the default bearer, otherwise it is UM.")
##########################
......@@ -1443,23 +1442,7 @@ add_library(PHY_MEX ${PHY_MEX_UE})
#Layer 2 library
#####################
set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE)
set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LTE)
set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0)
set(L2_SRC
${OPENAIR2_DIR}/LAYER2/openair2_proc.c
${PDCP_DIR}/pdcp.c
${PDCP_DIR}/pdcp_fifo.c
${PDCP_DIR}/pdcp_sequence_manager.c
${PDCP_DIR}/pdcp_primitives.c
${PDCP_DIR}/pdcp_util.c
${PDCP_DIR}/pdcp_security.c
${PDCP_DIR}/pdcp_netlink.c
set(RLC_ENB_V1
${RLC_AM_DIR}/rlc_am.c
${RLC_AM_DIR}/rlc_am_init.c
${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
......@@ -1487,6 +1470,35 @@ set(L2_SRC
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
)
set(RLC_ENB_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
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_entity.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_entity_am.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_entity_um.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_pdu.c
${OPENAIR2_DIR}/LAYER2/rlc_v2/rlc_sdu.c
)
set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE)
set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LTE)
set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0)
set(L2_SRC
${OPENAIR2_DIR}/LAYER2/openair2_proc.c
${PDCP_DIR}/pdcp.c
${PDCP_DIR}/pdcp_fifo.c
${PDCP_DIR}/pdcp_sequence_manager.c
${PDCP_DIR}/pdcp_primitives.c
${PDCP_DIR}/pdcp_util.c
${PDCP_DIR}/pdcp_security.c
${PDCP_DIR}/pdcp_netlink.c
${RLC_ENB_V2}
# ${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_S1AP.c
......
#!/bin/bash
# use UP and DOWN arrow keys to scroll the view displayed by timeplot
while read -n 1 key
do
case "$key" in
'B' )
kill -SIGUSR1 `ps aux|grep timeplot|grep -v grep|grep -v sh|tr -s ' ' :|cut -f 2 -d :`
;;
'A' )
kill -SIGUSR2 `ps aux|grep timeplot|grep -v grep|grep -v sh|tr -s ' ' :|cut -f 2 -d :`
;;
esac
done
......@@ -13,7 +13,8 @@ void usage(void)
"options:\n"
" -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n",
" -p <port> connect to given port (default %d)\n"
" -e <event> event to trace (default VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER)\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
......@@ -47,6 +48,7 @@ int main(int n, char **v)
int ev_fun;
int start_valid = 0;
struct timespec start_time, stop_time, delta_time;
char *name = "VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER";
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
......@@ -55,6 +57,7 @@ int main(int n, char **v)
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-e")) { if (i > n-2) usage(); name = v[++i]; continue; }
usage();
}
......@@ -71,10 +74,9 @@ int main(int n, char **v)
is_on = calloc(number_of_events, sizeof(int));
if (is_on == NULL) abort();
on_off(database, "VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER", is_on, 1);
on_off(database, name, is_on, 1);
ev_fun = event_id_from_name(database,
"VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER");
ev_fun = event_id_from_name(database, name);
socket = connect_to(ip, port);
......
......@@ -28,6 +28,7 @@ int bins[50];
#define N 1000
int data[N];
long start = 100;
void plot(void)
{
......@@ -45,7 +46,8 @@ void plot(void)
if (data[i] < vmin) vmin = data[i];
if (data[i] > vmax) vmax = data[i];
vavg += data[i];
int ms2 = data[i]/binsize_ns;
int ms2 = (data[i] - start * 1000)/binsize_ns;
if (ms2 < 0) ms2 = 0;
if (ms2 > 49) ms2 = 49;
bins[ms2]++;
if (bins[ms2] > max) max = bins[ms2];
......@@ -55,7 +57,7 @@ void plot(void)
GOTO(1,1);
for (i = 0; i < 50; i++) {
double binend = (i+1) * binsize_ns / 1000.;
double binend = (i+1) * binsize_ns / 1000. + start;
int k;
int width = bins[i] * 70 / max;
/* force at least width of 1 if some point is there */
......@@ -68,11 +70,23 @@ void plot(void)
printf("min %d ns max %d ns avg %ld ns\n", vmin, vmax, vavg);
}
void up(int x)
{
start += 5;
}
void down(int x)
{
start -= 5;
}
int main(void)
{
int i;
int pos = 0;
signal(SIGINT, sig);
signal(SIGUSR1, up);
signal(SIGUSR2, down);
RESET();
HIDE_CURSOR();
while (!feof(stdin)) {
......
......@@ -75,3 +75,6 @@ MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd
// eNB: realtime -> RRC messages
MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process)
// eNB: RLC -> RRC messages
MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication)
......@@ -85,6 +85,8 @@
#define RRC_SUBFRAME_PROCESS(mSGpTR) (mSGpTR)->ittiMsg.rrc_subframe_process
#define RLC_SDU_INDICATION(mSGpTR) (mSGpTR)->ittiMsg.rlc_sdu_indication
//-------------------------------------------------------------------------------------------//
typedef struct RrcStateInd_s {
Rrc_State_t state;
......@@ -423,4 +425,12 @@ typedef struct rrc_subframe_process_s {
int CC_id;
} RrcSubframeProcess;
// eNB: RLC -> RRC messages
typedef struct rlc_sdu_indication_s {
int rnti;
int is_successful;
int srb_id;
int message_id;
} RlcSduIndication;
#endif /* RRC_MESSAGES_TYPES_H_ */
......@@ -690,7 +690,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9;
rlc_status =
mac_rlc_status_ind(module_idP, 0, frameP, subframeP,
mac_rlc_status_ind(module_idP, 0xfffd, frameP, subframeP,
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
//MTCH,
......@@ -717,7 +717,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
TBS - header_len_mcch - header_len_msi -
sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0xfffd, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
(char *)
&mch_buffer[sdu_length_total]
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -1497,7 +1497,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9;
rlc_status =
mac_rlc_status_ind(module_idP, 0, frameP, subframeP,
mac_rlc_status_ind(module_idP, 0xfffd, frameP, subframeP,
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
//MTCH,
......@@ -1524,7 +1524,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
TBS - header_len_mcch - header_len_msi -
sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0xfffd, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
(char *)
&mch_buffer[sdu_length_total]
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......
RLC AM
======
- 36.322 5.4 Re-establishment procedure
when possible, reassemble RLC SDUs from any byte segments of AMD PDUs
with SN < VR(MR) in the receiving side, remove RLC headers when doing
so and deliver all reassembled RLC SDUs to upper layer in ascending order
of the RLC SN, if not delivered before;
- 36.322 5.2.3 Status reporting
delay triggering the STATUS report until x < VR(MS) or x >= VR(MR)
- 36.322 5.1.3.2.3 Actions when a RLC data PDU is placed in the reception
buffer
[...] and in-sequence byte segments of the AMD PDU with SN = VR(R) [...]
- use SOstart/SOend in NACK reporting, do not NACK full PDU if
parts of it have been received
/*
* 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.1 (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
*/
#include "rlc.h"
int decode_t_reordering(int v)
{
static int tab[32] = {
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85,
90, 95, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 1600
};
if (v < 0 || v > 31) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
int decode_t_status_prohibit(int v)
{
static int tab[62] = {
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90,
95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165,
170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240,
245, 250, 300, 350, 400, 450, 500, 800, 1000, 1200, 1600, 2000, 2400
};
if (v < 0 || v > 61) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
int decode_t_poll_retransmit(int v)
{
static int tab[59] = {
5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170,
175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245,
250, 300, 350, 400, 450, 500, 800, 1000, 2000, 4000
};
if (v < 0 || v > 58) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
int decode_poll_pdu(int v)
{
static int tab[8] = {
4, 8, 16, 32, 64, 128, 256, -1 /* -1 means infinity */
};
if (v < 0 || v > 7) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
int decode_poll_byte(int v)
{
static int tab[15] = {
25, 50, 75, 100, 125, 250, 375, 500, 750, 1000, 1250, 1500, 2000, 3000,
-1 /* -1 means infinity */
};
if (v < 0 || v > 14) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (tab[v] == -1) return -1;
return tab[v] * 1024;
}
int decode_max_retx_threshold(int v)
{
static int tab[8] = {
1, 2, 3, 4, 6, 8, 16, 32
};
if (v < 0 || v > 7) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
int decode_sn_field_length(int v)
{
static int tab[2] = {
5, 10
};
if (v < 0 || v > 1) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
return tab[v];
}
/*
* 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.1 (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
*/
#ifndef _ASN1_UTILS_H_
#define _ASN1_UTILS_H_
int decode_t_reordering(int v);
int decode_t_status_prohibit(int v);
int decode_t_poll_retransmit(int v);
int decode_poll_pdu(int v);
int decode_poll_byte(int v);
int decode_max_retx_threshold(int v);
int decode_sn_field_length(int v);
#endif /* _ASN1_UTILS_H_ */
/*
* 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.1 (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
*/
#include "rlc_entity.h"
#include <stdlib.h>
#include "rlc_entity_am.h"
#include "rlc_entity_um.h"
#include "LOG/log.h"
rlc_entity_t *new_rlc_entity_am(
int rx_maxsize,
int tx_maxsize,
void (*deliver_sdu)(void *deliver_sdu_data, struct rlc_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
void (*sdu_successful_delivery)(void *sdu_successful_delivery_data,
struct rlc_entity_t *entity,
int sdu_id),
void *sdu_successful_delivery_data,
void (*max_retx_reached)(void *max_retx_reached_data,
struct rlc_entity_t *entity),
void *max_retx_reached_data,
int t_reordering,
int t_status_prohibit,
int t_poll_retransmit,
int poll_pdu,
int poll_byte,
int max_retx_threshold)
{
rlc_entity_am_t *ret;
ret = calloc(1, sizeof(rlc_entity_am_t));
if (ret == NULL) {
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->common.recv_pdu = rlc_entity_am_recv_pdu;
ret->common.buffer_status = rlc_entity_am_buffer_status;
ret->common.generate_pdu = rlc_entity_am_generate_pdu;
ret->common.recv_sdu = rlc_entity_am_recv_sdu;
ret->common.set_time = rlc_entity_am_set_time;
ret->common.discard_sdu = rlc_entity_am_discard_sdu;
ret->common.reestablishment = rlc_entity_am_reestablishment;
ret->common.delete = rlc_entity_am_delete;
ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data;
ret->common.sdu_successful_delivery = sdu_successful_delivery;
ret->common.sdu_successful_delivery_data = sdu_successful_delivery_data;
ret->common.max_retx_reached = max_retx_reached;
ret->common.max_retx_reached_data = max_retx_reached_data;
ret->rx_maxsize = rx_maxsize;
ret->tx_maxsize = tx_maxsize;
ret->t_reordering = t_reordering;
ret->t_status_prohibit = t_status_prohibit;
ret->t_poll_retransmit = t_poll_retransmit;
ret->poll_pdu = poll_pdu;
ret->poll_byte = poll_byte;
ret->max_retx_threshold = max_retx_threshold;
return (rlc_entity_t *)ret;
}
rlc_entity_t *new_rlc_entity_um(
int rx_maxsize,
int tx_maxsize,
void (*deliver_sdu)(void *deliver_sdu_data, struct rlc_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
int t_reordering,
int sn_field_length)
{
rlc_entity_um_t *ret;
ret = calloc(1, sizeof(rlc_entity_um_t));
if (ret == NULL) {
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->common.recv_pdu = rlc_entity_um_recv_pdu;
ret->common.buffer_status = rlc_entity_um_buffer_status;
ret->common.generate_pdu = rlc_entity_um_generate_pdu;
ret->common.recv_sdu = rlc_entity_um_recv_sdu;
ret->common.set_time = rlc_entity_um_set_time;
ret->common.discard_sdu = rlc_entity_um_discard_sdu;
ret->common.reestablishment = rlc_entity_um_reestablishment;
ret->common.delete = rlc_entity_um_delete;
ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data;
ret->sn_field_length = sn_field_length;
ret->rx_maxsize = rx_maxsize;
ret->tx_maxsize = tx_maxsize;
ret->t_reordering = t_reordering;
if (sn_field_length == 5)
ret->sn_modulus = 32;
else if (sn_field_length == 10)
ret->sn_modulus = 1024;
else {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->window_size = ret->sn_modulus / 2;
return (rlc_entity_t *)ret;
}
/*
* 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.1 (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
*/
#ifndef _RLC_ENTITY_H_
#define _RLC_ENTITY_H_
#include <stdint.h>
#define SDU_MAX 16000 /* maximum PDCP SDU size is 8188, let's take more */
typedef struct {
int status_size;
int tx_size;
int retx_size;
} rlc_entity_buffer_status_t;
typedef struct rlc_entity_t {
/* functions provided by the RLC module */
void (*recv_pdu)(struct rlc_entity_t *entity, char *buffer, int size);
rlc_entity_buffer_status_t (*buffer_status)(
struct rlc_entity_t *entity, int maxsize);
int (*generate_pdu)(struct rlc_entity_t *entity, char *buffer, int size);
void (*recv_sdu)(struct rlc_entity_t *entity, char *buffer, int size,
int sdu_id);
void (*set_time)(struct rlc_entity_t *entity, uint64_t now);
void (*discard_sdu)(struct rlc_entity_t *entity, int sdu_id);
void (*reestablishment)(struct rlc_entity_t *entity);
void (*delete)(struct rlc_entity_t *entity);
/* callbacks provided to the RLC module */
void (*deliver_sdu)(void *deliver_sdu_data, struct rlc_entity_t *entity,
char *buf, int size);
void *deliver_sdu_data;
void (*sdu_successful_delivery)(void *sdu_successful_delivery_data,
struct rlc_entity_t *entity,
int sdu_id);
void *sdu_successful_delivery_data;
void (*max_retx_reached)(void *max_retx_reached_data,
struct rlc_entity_t *entity);
void *max_retx_reached_data;
} rlc_entity_t;
rlc_entity_t *new_rlc_entity_am(
int rx_maxsize,
int tx_maxsize,
void (*deliver_sdu)(void *deliver_sdu_data, struct rlc_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
void (*sdu_successful_delivery)(void *sdu_successful_delivery_data,
struct rlc_entity_t *entity,
int sdu_id),
void *sdu_successful_delivery_data,
void (*max_retx_reached)(void *max_retx_reached_data,
struct rlc_entity_t *entity),
void *max_retx_reached_data,
int t_reordering,
int t_status_prohibit,
int t_poll_retransmit,
int poll_pdu,
int poll_byte,
int max_retx_threshold);
rlc_entity_t *new_rlc_entity_um(
int rx_maxsize,
int tx_maxsize,
void (*deliver_sdu)(void *deliver_sdu_data, struct rlc_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
int t_reordering,
int sn_field_length);
#endif /* _RLC_ENTITY_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* 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.1 (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
*/
#ifndef _RLC_ENTITY_UM_H_
#define _RLC_ENTITY_UM_H_
#include "rlc_entity.h"
#include "rlc_pdu.h"
#include "rlc_sdu.h"
typedef struct {
char sdu[SDU_MAX]; /* sdu is reassembled here */
int sdu_pos; /* next byte to put in sdu */
/* decoder of current PDU */
rlc_pdu_decoder_t dec;
int sn;
int sdu_head_missing;
} rlc_um_reassemble_t;
typedef struct {
rlc_entity_t common;
/* configuration */
int t_reordering;
int sn_field_length;
int sn_modulus; /* 1024 for sn_field_length == 10, 32 for 5 */
int window_size; /* 512 for sn_field_length == 10, 16 for 5 */
/* runtime rx */
int vr_ur;
int vr_ux;
int vr_uh;
/* runtime tx */
int vt_us;
/* set to the latest know time by the user of the module. Unit: ms */
uint64_t t_current;
/* timers (stores the TTI of activation, 0 means not active) */
uint64_t t_reordering_start;
/* rx management */
rlc_rx_pdu_segment_t *rx_list;
int rx_size;
int rx_maxsize;
/* reassembly management */
rlc_um_reassemble_t reassemble;
/* tx management */
rlc_sdu_t *tx_list;
rlc_sdu_t *tx_end;
int tx_size;
int tx_maxsize;
} rlc_entity_um_t;
void rlc_entity_um_recv_sdu(rlc_entity_t *_entity, char *buffer, int size,
int sdu_id);
void rlc_entity_um_recv_pdu(rlc_entity_t *entity, char *buffer, int size);
rlc_entity_buffer_status_t rlc_entity_um_buffer_status(
rlc_entity_t *entity, int maxsize);
int rlc_entity_um_generate_pdu(rlc_entity_t *_entity, char *buffer, int size);
void rlc_entity_um_set_time(rlc_entity_t *entity, uint64_t now);
void rlc_entity_um_discard_sdu(rlc_entity_t *entity, int sdu_id);
void rlc_entity_um_reestablishment(rlc_entity_t *entity);
void rlc_entity_um_delete(rlc_entity_t *entity);
#endif /* _RLC_ENTITY_UM_H_ */
This diff is collapsed.
/*
* 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.1 (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
*/
#include "rlc_pdu.h"
#include <stdlib.h>
#include <string.h>
#include "LOG/log.h"
/**************************************************************************/
/* RX PDU segment and segment list */
/**************************************************************************/
rlc_rx_pdu_segment_t *rlc_rx_new_pdu_segment(int sn, int so, int size,
int is_last, char *data, int data_offset)
{
rlc_rx_pdu_segment_t *ret = malloc(sizeof(rlc_rx_pdu_segment_t));
if (ret == NULL) {
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->sn = sn;
ret->so = so;
ret->size = size;
ret->is_last = is_last;
ret->next = NULL;
ret->data = malloc(size);
if (ret->data == NULL) {
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
memcpy(ret->data, data, size);
ret->data_offset = data_offset;
return ret;
}
void rlc_rx_free_pdu_segment(rlc_rx_pdu_segment_t *pdu_segment)
{
free(pdu_segment->data);
free(pdu_segment);
}
rlc_rx_pdu_segment_t *rlc_rx_pdu_segment_list_add(
int (*sn_compare)(void *, int, int), void *sn_compare_data,
rlc_rx_pdu_segment_t *list, rlc_rx_pdu_segment_t *pdu_segment)
{
rlc_rx_pdu_segment_t head;
rlc_rx_pdu_segment_t *cur;
rlc_rx_pdu_segment_t *prev;
head.next = list;
cur = list;
prev = &head;
/* order is by 'sn', if 'sn' is the same then order is by 'so' */
while (cur != NULL) {
/* check if 'pdu_segment' is before 'cur' in the list */
if (sn_compare(sn_compare_data, cur->sn, pdu_segment->sn) > 0 ||
(cur->sn == pdu_segment->sn && cur->so > pdu_segment->so)) {
break;
}
prev = cur;
cur = cur->next;
}
prev->next = pdu_segment;
pdu_segment->next = cur;
return head.next;
}
/**************************************************************************/
/* TX PDU management */
/**************************************************************************/
rlc_tx_pdu_segment_t *rlc_tx_new_pdu(void)
{
rlc_tx_pdu_segment_t *ret = calloc(1, sizeof(rlc_tx_pdu_segment_t));
if (ret == NULL) {
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->retx_count = -1;
return ret;
}
void rlc_tx_free_pdu(rlc_tx_pdu_segment_t *pdu)
{
free(pdu);
}
rlc_tx_pdu_segment_t *rlc_tx_pdu_list_append(rlc_tx_pdu_segment_t *list,
rlc_tx_pdu_segment_t *pdu)
{
rlc_tx_pdu_segment_t head;
rlc_tx_pdu_segment_t *cur;
head.next = list;
cur = &head;
while (cur->next != NULL) {
cur = cur->next;
}
cur->next = pdu;
return head.next;
}
rlc_tx_pdu_segment_t *rlc_tx_pdu_list_add(
int (*sn_compare)(void *, int, int), void *sn_compare_data,
rlc_tx_pdu_segment_t *list, rlc_tx_pdu_segment_t *pdu_segment)
{
rlc_tx_pdu_segment_t head;
rlc_tx_pdu_segment_t *cur;
rlc_tx_pdu_segment_t *prev;
head.next = list;
cur = list;
prev = &head;
/* order is by 'sn', if 'sn' is the same then order is by 'so' */
while (cur != NULL) {
/* check if 'pdu_segment' is before 'cur' in the list */
if (sn_compare(sn_compare_data, cur->sn, pdu_segment->sn) > 0 ||
(cur->sn == pdu_segment->sn && cur->so > pdu_segment->so)) {
break;
}
prev = cur;
cur = cur->next;
}
prev->next = pdu_segment;
pdu_segment->next = cur;
return head.next;
}
/**************************************************************************/
/* PDU decoder */
/**************************************************************************/
void rlc_pdu_decoder_init(rlc_pdu_decoder_t *decoder, char *buffer, int size)
{
decoder->error = 0;
decoder->byte = 0;
decoder->bit = 0;
decoder->buffer = buffer;
decoder->size = size;
}
static int get_bit(rlc_pdu_decoder_t *decoder)
{
int ret;
if (decoder->byte >= decoder->size) {
decoder->error = 1;
return 0;
}
ret = (decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1;
decoder->bit++;
if (decoder->bit == 8) {
decoder->bit = 0;
decoder->byte++;
}
return ret;
}
int rlc_pdu_decoder_get_bits(rlc_pdu_decoder_t *decoder, int count)
{
int ret = 0;
int i;
if (count > 31) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
for (i = 0; i < count; i++) {
ret <<= 1;
ret |= get_bit(decoder);
if (decoder->error) return -1;
}
return ret;
}
void rlc_pdu_decoder_align(rlc_pdu_decoder_t *decoder)
{
if (decoder->bit) {
decoder->bit = 0;
decoder->byte++;
}
}
/**************************************************************************/
/* PDU encoder */
/**************************************************************************/
void rlc_pdu_encoder_init(rlc_pdu_encoder_t *encoder, char *buffer, int size)
{
encoder->byte = 0;
encoder->bit = 0;
encoder->buffer = buffer;
encoder->size = size;
}
static void put_bit(rlc_pdu_encoder_t *encoder, int bit)
{
if (encoder->byte == encoder->size) {
LOG_E(RLC, "%s:%d:%s: fatal, buffer full\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
encoder->buffer[encoder->byte] <<= 1;
if (bit)
encoder->buffer[encoder->byte] |= 1;
encoder->bit++;
if (encoder->bit == 8) {
encoder->bit = 0;
encoder->byte++;
}
}
void rlc_pdu_encoder_put_bits(rlc_pdu_encoder_t *encoder, int value, int count)
{
int i;
int x;
if (count > 31) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
x = 1 << (count - 1);
for (i = 0; i < count; i++, x >>= 1)
put_bit(encoder, value & x);
}
void rlc_pdu_encoder_align(rlc_pdu_encoder_t *encoder)
{
while (encoder->bit)
put_bit(encoder, 0);
}
/*
* 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.1 (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
*/
#ifndef _RLC_PDU_H_
#define _RLC_PDU_H_
/**************************************************************************/
/* RX PDU segment and segment list */
/**************************************************************************/
typedef struct rlc_rx_pdu_segment_t {
int sn;
int so;
int size;
int is_last;
char *data;
int data_offset;
struct rlc_rx_pdu_segment_t *next;
} rlc_rx_pdu_segment_t;
rlc_rx_pdu_segment_t *rlc_rx_new_pdu_segment(int sn, int so, int size,
int is_last, char *data, int data_offset);
void rlc_rx_free_pdu_segment(rlc_rx_pdu_segment_t *pdu_segment);
rlc_rx_pdu_segment_t *rlc_rx_pdu_segment_list_add(
int (*sn_compare)(void *, int, int), void *sn_compare_data,
rlc_rx_pdu_segment_t *list, rlc_rx_pdu_segment_t *pdu_segment);
/**************************************************************************/
/* TX PDU management */
/**************************************************************************/
typedef struct rlc_tx_pdu_segment_t {
int sn;
void *start_sdu; /* real type is rlc_sdu_t * */
int sdu_start_byte; /* starting byte in 'start_sdu' */
int so; /* starting byte of the segment in full PDU */
int data_size; /* number of data bytes (exclude header) */
int is_segment;
int is_last;
int retx_count;
struct rlc_tx_pdu_segment_t *next;
} rlc_tx_pdu_segment_t;
rlc_tx_pdu_segment_t *rlc_tx_new_pdu(void);
void rlc_tx_free_pdu(rlc_tx_pdu_segment_t *pdu);
rlc_tx_pdu_segment_t *rlc_tx_pdu_list_append(rlc_tx_pdu_segment_t *list,
rlc_tx_pdu_segment_t *pdu);
rlc_tx_pdu_segment_t *rlc_tx_pdu_list_add(
int (*sn_compare)(void *, int, int), void *sn_compare_data,
rlc_tx_pdu_segment_t *list, rlc_tx_pdu_segment_t *pdu_segment);
/**************************************************************************/
/* PDU decoder */
/**************************************************************************/
typedef struct {
int error;
int byte; /* next byte to decode */
int bit; /* next bit in next byte to decode */
char *buffer;
int size;
} rlc_pdu_decoder_t;
void rlc_pdu_decoder_init(rlc_pdu_decoder_t *decoder, char *buffer, int size);
#define rlc_pdu_decoder_in_error(d) ((d)->error == 1)
int rlc_pdu_decoder_get_bits(rlc_pdu_decoder_t *decoder, int count);
void rlc_pdu_decoder_align(rlc_pdu_decoder_t *decoder);
/**************************************************************************/
/* PDU encoder */
/**************************************************************************/
typedef struct {
int byte; /* next byte to encode */
int bit; /* next bit in next byte to encode */
char *buffer;
int size;
} rlc_pdu_encoder_t;
void rlc_pdu_encoder_init(rlc_pdu_encoder_t *encoder, char *buffer, int size);
void rlc_pdu_encoder_put_bits(rlc_pdu_encoder_t *encoder, int value, int count);
void rlc_pdu_encoder_align(rlc_pdu_encoder_t *encoder);
#endif /* _RLC_PDU_H_ */
/*
* 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.1 (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
*/
#include "rlc_sdu.h"
#include <stdlib.h>
#include <string.h>
#include "LOG/log.h"
rlc_sdu_t *rlc_new_sdu(char *buffer, int size, int upper_layer_id)
{
rlc_sdu_t *ret = calloc(1, sizeof(rlc_sdu_t));
if (ret == NULL)
goto oom;
ret->upper_layer_id = upper_layer_id;
ret->data = malloc(size);
if (ret->data == NULL)
goto oom;
memcpy(ret->data, buffer, size);
ret->size = size;
return ret;
oom:
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
void rlc_free_sdu(rlc_sdu_t *sdu)
{
free(sdu->data);
free(sdu);
}
void rlc_sdu_list_add(rlc_sdu_t **list, rlc_sdu_t **end, rlc_sdu_t *sdu)
{
if (*list == NULL) {
*list = sdu;
*end = sdu;
return;
}
(*end)->next = sdu;
*end = sdu;
}
/*
* 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.1 (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
*/
#ifndef _RLC_SDU_H_
#define _RLC_SDU_H_
typedef struct rlc_sdu_t {
int upper_layer_id;
char *data;
int size;
/* next_byte indicates the starting byte to use to construct a new PDU */
int next_byte;
int acked_bytes;
struct rlc_sdu_t *next;
} rlc_sdu_t;
rlc_sdu_t *rlc_new_sdu(char *buffer, int size, int upper_layer_id);
void rlc_free_sdu(rlc_sdu_t *sdu);
void rlc_sdu_list_add(rlc_sdu_t **list, rlc_sdu_t **end, rlc_sdu_t *sdu);
#endif /* _RLC_SDU_H_ */
This diff is collapsed.
/*
* 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.1 (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
*/
#ifndef _RLC_UE_MANAGER_H_
#define _RLC_UE_MANAGER_H_
#include "rlc_entity.h"
typedef void rlc_ue_manager_t;
typedef struct rlc_ue_t {
int rnti;
/* due to openair calling status_ind/data_req, we need to keep this.
* To be considered 'hackish'.
*/
int saved_status_ind_tb_size[2+5];
rlc_entity_t *srb[2];
rlc_entity_t *drb[5];
} rlc_ue_t;
/***********************************************************************/
/* manager functions */
/***********************************************************************/
rlc_ue_manager_t *new_rlc_ue_manager(void);
void rlc_manager_lock(rlc_ue_manager_t *m);
void rlc_manager_unlock(rlc_ue_manager_t *m);
rlc_ue_t *rlc_manager_get_ue(rlc_ue_manager_t *m, int rnti);
void rlc_manager_remove_ue(rlc_ue_manager_t *m, int rnti);
/***********************************************************************/
/* ue functions */
/***********************************************************************/
void rlc_ue_add_srb_rlc_entity(rlc_ue_t *ue, int srb_id, rlc_entity_t *entity);
void rlc_ue_add_drb_rlc_entity(rlc_ue_t *ue, int drb_id, rlc_entity_t *entity);
#endif /* _RLC_UE_MANAGER_H_ */
#ifndef _LOG_H_
#define _LOG_H_
#include <stdio.h>
#define LOG_E(x, ...) printf(__VA_ARGS__)
#define LOG_D(x, ...) printf(__VA_ARGS__)
#define LOG_W(x, ...) printf(__VA_ARGS__)
#endif /* _LOG_H_ */
CC=gcc
CFLAGS=-Wall -g --coverage -I.
LIB=rlc_entity.o rlc_entity_am.o rlc_entity_um.o rlc_pdu.o rlc_sdu.o
tests:
@./run_tests.sh
all: clean_run $(TEST).run
%.run: $(TEST).bin
#valgrind ./$(TEST).bin > $(TEST).run_pre 2> $(TEST).valgrind
./$(TEST).bin > $(TEST).run_pre
grep ^TEST $(TEST).run_pre > $(TEST).run
gunzip -c $(TEST).txt.gz > $(TEST).txt
diff -q $(TEST).txt $(TEST).run
$(TEST).bin: $(TEST).o $(LIB)
$(CC) $(CFLAGS) -o $@ $^
%.o: ../%.c
$(CC) $(CFLAGS) -I.. -c -o $@ $<
$(TEST).o: test.c
$(CC) $(CFLAGS) -c -o $@ $< -DTEST='"$(TEST).h"'
clean_run:
rm -f $(TEST).run $(TEST).bin $(TEST).o
clean:
rm -f *.o *.bin *.run *.run_pre *.gcov *.gcda *.gcno test*.txt a.out \
*.valgrind
To run tests, simply type: make
Each test is made of:
testXX.h definition of the test
testXX.txt.gz compressed expected output of the test
At runtime, we generate:
testXX.run actual output of the test
test.c is the test driving program.
Only the output lines of the test program starting with "TEST" are
stored into testXX.txt and testXX.run.
A test is considered a success if testXX.txt and testXX.run are equal.
Only failed tests are reported.
How to define a new test?
1 - get the ID
Look in the file run_tests.sh, the variable test_count gives you
the number of existing tests. The ID of your test has to be
test_count + 1.
2 - create files
Create the file test<ID>.h containing the test, then generate test<ID>.run
by running 'make all TEST=test<ID>' and copy test<ID>.run to test<ID>.txt.
Then compress this file (gzip -9 test<ID>.txt). Be sure that the output
is correct, of course.
For the file names, replace <ID> by the actual number of the test.
For example, if your test ID is 47, then name the files test47.h and
test47.txt. And run 'make all TEST=test47' to generate test47.run.
The available instructions for a test are described at the top of test.c.
This diff is collapsed.
#!/bin/sh
test_count=45
for i in `seq $test_count`
do
make all TEST=test$i >/dev/null 2>/dev/null
if [ $? != 0 ]
then
echo TEST $i FAILURE
fi
done
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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