Commit c1f14990 authored by gauthier's avatar gauthier
Browse files

Old rev code


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7372 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0bd3c9ec
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/***************************************************************************
rlc_am_constant.h -
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
# ifndef __RLC_AM_CONSTANT_H__
# define __RLC_AM_CONSTANT_H__
# define RLC_AM_LOCATION_UTRAN 0xBA
# define RLC_AM_LOCATION_UE 0x01
//----------------------------------------------------------
// AMD DATA, CONTROL PDU parameters
//----------------------------------------------------------
# define NB_MAX_SUFI 30
# define SUFI_MAX_SIZE 40
// SUFI field (4 bits)
# define RLC_AM_SUFI_NO_MORE 0x0
# define RLC_AM_SUFI_WINDOW 0x1
# define RLC_AM_SUFI_ACK 0x2
# define RLC_AM_SUFI_LIST 0x3
# define RLC_AM_SUFI_BITMAP 0x4
# define RLC_AM_SUFI_RLIST 0x5
# define RLC_AM_SUFI_MRW 0x6
# define RLC_AM_SUFI_MRW_ACK 0x7
# define RLC_AM_SUFI_NO_MORE_SIZE 4
//in bits
# define RLC_AM_SUFI_ACK_SIZE 16
//in bits
# define RLC_AM_SUFI_LIST_SIZE_MIN 24
//in bits
# define RLC_AM_SUFI_BITMAP_SIZE_MIN 28
//in bits
//----------------------------------------------------------
// values for ack field of struct rlc_am_tx_pdu_management
// this struct is mapped on the misc field of each pdu
# define RLC_AM_PDU_ACK_NO_EVENT 0
# define RLC_AM_PDU_ACK_EVENT 1
# define RLC_AM_PDU_NACK_EVENT -1
//----------------------------------------------------------
# define RLC_AM_SEND_MRW_OFF 0x0F
# define RLC_AM_SEND_MRW_ON 0xF0
//----------------------------------------------------------
// SN Field
# define RLC_AM_SN_1ST_PART_MASK 0x7F
# define RLC_AM_SN_2ND_PART_MASK 0xF8
//----------------------------------------------------------
// Polling bit (values shifted 2 bits left)
# define RLC_AM_P_STATUS_REPORT_NOT_REQUESTED 0
# define RLC_AM_P_STATUS_REPORT_REQUESTED 4
# define RLC_AM_P_STATUS_REPORT_MASK 4
//----------------------------------------------------------
// li field (values shifted 1 bit left)
# define RLC_AM_SEGMENT_NB_MAX_LI_PER_PDU 32
//----------------------------------------------------------
// shifted 3 bits left
# define RLC_AM_RESET_SEQUENCE_NUMBER_MASK 0x08
# define RLC_AM_TIMER_POLL_TIME_OUT_EVENT 0x001
# define RLC_AM_TIMER_POLL_PROHIBIT_TIME_OUT_EVENT 0x002
# define RLC_AM_TIMER_EPC_TIME_OUT_EVENT 0x004
# define RLC_AM_TIMER_DISCARD_TIME_OUT_EVENT 0x008
# define RLC_AM_TIMER_POLL_PERIODIC_TIME_OUT_EVENT 0x010
# define RLC_AM_TIMER_STATUS_PROHIBIT_TIME_OUT_EVENT 0x020
# define RLC_AM_TIMER_STATUS_PERIODIC_TIME_OUT_EVENT 0x040
# define RLC_AM_TIMER_RST_TIME_OUT_EVENT 0x080
# define RLC_AM_TIMER_MRW_TIME_OUT_EVENT 0x100
//----------------------------------------------------------
# define RLC_AM_SDU_SEGMENTS_SUBMITTED_TO_LOWER_LAYER 0xFF
// for sdu_header_copy
# define RLC_AM_SN_INVALID 0xFFFF
// PDU transmission
# define RLC_AM_PDU_COPY_LOCATION_RETRANSMISSION_BUFFER_TO_SEND 0x10
# define RLC_AM_PDU_COPY_LOCATION_PDUS_TO_MAC_LAYER 0x20
# define RLC_AM_PDU_COPY_LOCATION_MASK 0xF0
//----------------------------------------------------------
// Events defined for state model of the acknowledged mode entity
# define RLC_AM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT 0x00
# define RLC_AM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT 0x01
# define RLC_AM_RECEIVE_CRLC_SUSPEND_REQ_EVENT 0x10
# define RLC_AM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT 0x11
# define RLC_AM_RECEIVE_CRLC_RESUME_REQ_EVENT 0x12
# define RLC_AM_RECEIVE_RESET_EVENT 0x20
# define RLC_AM_TRANSMIT_RESET_EVENT 0x21
# define RLC_AM_RECEIVE_RESET_ACK_EVENT 0x22
# define RLC_AM_TRANSMIT_RESET_ACK_EVENT 0x23
//----------------------------------------------------------
# define RLC_AM_TRAFFIC_NOT_ALLOWED 0x00
# define RLC_AM_TRAFFIC_ALLOWED_FOR_STATUS 0xC0
// mutual exclusion of set bits with next value
# define RLC_AM_TRAFFIC_ALLOWED_FOR_DATA 0x0D
// mutual exclusion of set bits with previous value
# define RLC_AM_DCCH_ID 0xC0
// mutual exclusion of set bits with next value
# define RLC_AM_DTCH_ID 0x0D
// mutual exclusion of set bits with previous value
//----------------------------------------------------------
// for status report of transmission by MAC layer
# define RLC_AM_STATUS_PDU_TYPE 0x0001
# define RLC_AM_FIRST_STATUS_PDU_TYPE 0x0011
# define RLC_AM_LAST_STATUS_PDU_TYPE 0x0021
# define RLC_AM_MRW_STATUS_PDU_TYPE 0x0040
# define RLC_AM_RESET_PDU_TYPE 0x0080
# define RLC_AM_RESET_ACK_PDU_TYPE 0x0100
# define RLC_AM_DATA_POLL_PDU_TYPE 0x1800
# define RLC_AM_DATA_PDU_TYPE 0x1000
//----------------------------------------------------------
// TIMER EPC
# define TIMER_EPC_STATE_IDLE 0x00
# define TIMER_EPC_STATE_TIMER_ARMED 0x01
# define TIMER_EPC_STATE_TIMED_OUT 0x02
# define TIMER_EPC_STATE_VR_EP_COUNTING_DOWN 0x04
# define TIMER_EPC_STATE_VR_EP_EQUAL_ZERO 0x08
# define TIMER_EPC_PDU_STATUS_SUBMITTED_LOWER_LAYER_EVENT 0x01
# define TIMER_EPC_PDU_STATUS_TRANSMITED_EVENT 0x02
# define TIMER_EPC_TIMER_TIMED_OUT_EVENT 0x04
# define TIMER_EPC_VR_EP_EQUAL_ZERO_EVENT 0x08
# endif
This diff is collapsed.
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/***************************************************************************
rlc_am_control_primitives_proto_extern.h -
-------------------
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
# ifndef __RLC_AM_CONTROL_PRIMITIVES_H__
# define __RLC_AM_CONTROL_PRIMITIVES_H__
//-----------------------------------------------------------------------------
# include "rlc_am_entity.h"
# include "mem_block.h"
# include "rrm_config_structs.h"
//-----------------------------------------------------------------------------
extern void config_req_rlc_am (struct rlc_am_entity *rlcP, module_id_t module_idP, rlc_am_info_t * config_amP, uint8_t rb_idP, rb_type_t rb_typeP);
extern void send_rlc_am_control_primitive (struct rlc_am_entity *rlcP, module_id_t module_idP, mem_block_t * cprimitiveP);
extern void init_rlc_am (struct rlc_am_entity *rlcP);
extern void rlc_am_reset_state_variables (struct rlc_am_entity *rlcP);
extern void rlc_am_alloc_buffers_after_establishment (struct rlc_am_entity *rlcP);
extern void rlc_am_discard_all_pdus (struct rlc_am_entity *rlcP);
extern void rlc_am_stop_all_timers (struct rlc_am_entity *rlcP);
extern void rlc_am_free_all_resources (struct rlc_am_entity *rlcP);
extern void rlc_am_set_configured_parameters (struct rlc_am_entity *rlcP, mem_block_t * cprimitiveP);
//extern void rlc_am_probing_get_buffer_occupancy_measurements (struct rlc_am_entity *rlcP, probing_report_traffic_rb_parameters *reportP, int measurement_indexP);
# endif
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/***************************************************************************
rlc_am_demux.c -
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
#include "rtos_header.h"
#include "platform_types.h"
//-----------------------------------------------------------------------------
//#include "mac_log_interface_struct.h"
#include "LAYER2/RLC/rlc.h"
#include "mac_primitives.h"
#include "list.h"
#include "rlc_am_entity.h"
#include "rlc_am_structs.h"
#include "rlc_am_constants.h"
#include "rlc_am_receiver_proto_extern.h"
#include "rlc_am_reset_proto_extern.h"
#include "rlc_am_status_proto_extern.h"
#include "rlc_am_timers_proto_extern.h"
#include "LAYER2/MAC/extern.h"
#define DEBUG_DEMUX_RESET
#define DEBUG_DEMUX
//-----------------------------------------------------------------------------
void
rlc_am_demux_routing (struct rlc_am_entity *rlcP, unsigned int traffic_typeP, struct mac_data_ind data_indP)
{
//-----------------------------------------------------------------------------
struct rlc_am_pdu_header *data;
struct rlc_am_reset_header *control;
mem_block_t *tb;
uint8_t *first_byte;
uint16_t tb_size_in_bytes;
uint8_t first_bit;
uint8_t bits_to_shift;
uint8_t bits_to_shift_last_loop;
uint8_t data_received;
int index;
//-------------------------------------------------------
// D A T A P D U
//-------------------------------------------------------
data_received = 0;
while ((tb = list_remove_head (&data_indP.data))) {
if (!(((struct mac_tb_ind *) (tb->data))->error_indication)) {
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
tb_size_in_bytes = data_indP.tb_size >> 3;
first_bit = ((struct mac_tb_ind *) (tb->data))->first_bit;
if (first_bit > 0) {
// shift data of transport_block TO CHECK
bits_to_shift_last_loop = 0;
while ((tb_size_in_bytes)) {
bits_to_shift = first_byte[tb_size_in_bytes] >> (8 - first_bit);
first_byte[tb_size_in_bytes] = (first_byte[tb_size_in_bytes] << first_bit) | (bits_to_shift_last_loop);
tb_size_in_bytes -= 1;
bits_to_shift_last_loop = bits_to_shift;
}
first_byte[0] = (first_byte[0] << first_bit) | (bits_to_shift_last_loop);
}
((struct rlc_am_rx_pdu_management *) (tb->data))->first_byte = first_byte;
data = (struct rlc_am_pdu_header *) (first_byte);
if ((data->byte1 & RLC_DC_MASK) == RLC_DC_DATA_PDU) {
#ifdef DEBUG_DEMUX
msg ("[RLC_AM][RB %d][DEMUX] RX AMD PDU Frame %d\n", rlcP->rb_id, Mac_rlc_xface->frame);
for (index=0; index < rlcP->pdu_size ; index++) {
msg("%02X.",first_byte[index]);
}
msg("\n");
#endif
rlcP->stat_rx_data_pdu += 1;
if (traffic_typeP & RLC_AM_TRAFFIC_ALLOWED_FOR_DATA) {
((struct rlc_am_rx_pdu_management *) (tb->data))->piggybacked_processed = 0;
receiver_retransmission_management (rlcP, tb, data);
// pdu is data;
data_received = 1;
} else {
#ifdef DEBUG_DEMUX
msg ("[RLC_AM][RB %d][DEMUX] DROP DATA TB NOT ALLOWED IN PROTOCOL STATE 0x%02X\n", rlcP->rb_id, rlcP->protocol_state);
#endif
free_mem_block (tb);
}
} else {
rlcP->stat_rx_control_pdu += 1;
control = (struct rlc_am_reset_header *) first_byte;
if ((control->byte1 & RLC_PDU_TYPE_MASK) == RLC_PDU_TYPE_STATUS) {
if (traffic_typeP & RLC_AM_TRAFFIC_ALLOWED_FOR_DATA) {
#ifdef DEBUG_DEMUX
msg ("[RLC_AM][RB %d][DEMUX] RX STATUS PDU ON DTCH Frame %d\n", rlcP->rb_id, Mac_rlc_xface->frame);
#endif
rlc_am_process_status_info (rlcP, &(control->byte1));
}
} else if ((control->byte1 & RLC_PDU_TYPE_MASK) == RLC_PDU_TYPE_RESET) {
#ifdef DEBUG_DEMUX_RESET
msg ("[RLC_AM][RB %d][DEMUX] RX RESET PDU Frame %d\n", rlcP->rb_id, Mac_rlc_xface->frame);
#endif
process_reset (tb, control, rlcP);
} else if ((control->byte1 & RLC_PDU_TYPE_MASK) == RLC_PDU_TYPE_RESET_ACK) {
#ifdef DEBUG_DEMUX_RESET
msg ("[RLC_AM][RB %d][DEMUX] RX RESET ACK PDU Frame %d\n", rlcP->rb_id, Mac_rlc_xface->frame);
#endif
process_reset_ack (tb, control, rlcP);
#ifndef USER_MODE
rlc_info_t Rlc_info_am_config1;
Rlc_info_am_config1.rlc_mode=RLC_AM;
Rlc_info_am_config1.rlc.rlc_am_info.sdu_discard_mode = SDU_DISCARD_MODE_RESET;//SDU_DISCARD_MODE_MAX_DAT_RETRANSMISSION;//
Rlc_info_am_config1.rlc.rlc_am_info.timer_poll = 0;
Rlc_info_am_config1.rlc.rlc_am_info.timer_poll_prohibit = 0;
Rlc_info_am_config1.rlc.rlc_am_info.timer_discard = 500;
Rlc_info_am_config1.rlc.rlc_am_info.timer_poll_periodic = 0;
Rlc_info_am_config1.rlc.rlc_am_info.timer_status_prohibit = 250;
Rlc_info_am_config1.rlc.rlc_am_info.timer_status_periodic = 500;
Rlc_info_am_config1.rlc.rlc_am_info.timer_rst = 250;//250
Rlc_info_am_config1.rlc.rlc_am_info.max_rst = 500;//500
Rlc_info_am_config1.rlc.rlc_am_info.timer_mrw = 0;
Rlc_info_am_config1.rlc.rlc_am_info.pdu_size = 32; //416; // in bits
//Rlc_info_am.rlc.rlc_am_info.in_sequence_delivery = 1;//boolean
Rlc_info_am_config1.rlc.rlc_am_info.max_dat = 32;//127;
Rlc_info_am_config1.rlc.rlc_am_info.poll_pdu = 0;
Rlc_info_am_config1.rlc.rlc_am_info.poll_sdu = 0;//256;/
Rlc_info_am_config1.rlc.rlc_am_info.poll_window = 80;//128
Rlc_info_am_config1.rlc.rlc_am_info.tx_window_size = 512;
Rlc_info_am_config1.rlc.rlc_am_info.rx_window_size = 512;
Rlc_info_am_config1.rlc.rlc_am_info.max_mrw = 8;
Rlc_info_am_config1.rlc.rlc_am_info.last_transmission_pdu_poll_trigger = 1;//boolean
Rlc_info_am_config1.rlc.rlc_am_info.last_retransmission_pdu_poll_trigger = 1;//boolean
Rlc_info_am_config1.rlc.rlc_am_info.send_mrw = 1;//boolean*
Mac_rlc_xface->rrc_rlc_config_req(0,CONFIG_ACTION_REMOVE,rlcP->rb_id,RADIO_ACCESS_BEARER,Rlc_info_am_config1);
Mac_rlc_xface->rrc_rlc_config_req(0,CONFIG_ACTION_ADD,rlcP->rb_id,RADIO_ACCESS_BEARER,Rlc_info_am_config1);
#endif
}
free_mem_block (tb);
}
} else {
#ifdef BENCH_QOS_L2
fprintf (bench_l2, "[PDU RX ERROR] FRAME %d RLC-AM %p\n", Mac_rlc_xface->frame, rlcP);
#endif
#ifdef DEBUG_DEMUX
msg ("[RLC_AM][RB %d][DEMUX] RX PDU WITH ERROR INDICATION\n", rlcP->rb_id);
#endif
rlcP->stat_rx_error_pdu += 1;
free_mem_block (tb);
}
}
if ((data_received)) { //avoid call
if (traffic_typeP & RLC_AM_TRAFFIC_ALLOWED_FOR_DATA) {
if (rlcP->pdu_size <= 126) {
#ifdef DEBUG_DEMUX
msg("[RLC_AM][RB %d] Calling process_receiver_buffer_7\n",rlcP->rb_id);
#endif
process_receiver_buffer_7 (rlcP);
} else {
#ifdef DEBUG_DEMUX
msg("[RLC_AM][RB %d] Calling process_receiver_buffer_15\n",rlcP->rb_id);
#endif
process_receiver_buffer_15 (rlcP);
}
}
}
}
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/***************************************************************************
rlc_am_demux_proto_extern.h -
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
# ifndef __RLC_AM_DEMUX_PROTO_EXTERN_H__
# define __RLC_AM_DEMUX_PROTO_EXTERN_H__
//-----------------------------------------------------------------------------
# include "rlc_am_entity.h"
# include "mac_primitives.h"
//-----------------------------------------------------------------------------
extern void rlc_am_demux_routing (struct rlc_am_entity *rlcP, unsigned int traffic_typeP, struct mac_data_ind data_indP);
# endif
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/***************************************************************************
rlc_am_discard_notif.c -
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
#define RLC_AM_C
#include "rtos_header.h"
#include "platform_types.h"
//-----------------------------------------------------------------------------
#include "rlc.h"
#include "rlc_primitives.h"
#include "rlc_am_status_proto_extern.h"
#include "umts_timer_struct.h"
#include "umts_timer_proto_extern.h"
#include "rlc_am_discard_tx_proto_extern.h"
#include "rlc_am_reset_proto_extern.h"
#include "LAYER2/MAC/extern.h"
//-----------------------------------------------------------------------------
void rlc_am_discard_notify_mrw_ack_time_out (struct rlc_am_entity* rlcP, mem_block_t* discard_procedureP);
void rlc_am_discard_notify_sdu_time_out (struct rlc_am_entity* rlcP, mem_block_t* sduP);
void rlc_am_discard_notify_max_dat_pdu (struct rlc_am_entity* rlcP, mem_block_t* mbP);
//-----------------------------------------------------------------------------
// handler for timer
//-----------------------------------------------------------------------------
void
rlc_am_discard_notify_mrw_ack_time_out (struct rlc_am_entity* rlcP, mem_block_t* discard_procedureP)
{
//-----------------------------------------------------------------------------
/* from 3GPP TS 25.322 V5.5.0
If Timer_MRW expires before the discard procedure is terminated, the Sender shall:
- if VT(MRW)<MaxMRW-1:
- set the MRW SUFI as previously transmitted (even if additional SDUs were discarded in the mean-time);
- include the MRW SUFI in a new status report (if other SUFIs are included, their contents shall be updated);
- transmit the status report by either including it in a STATUS PDU or piggybacked in an AMD PDU;
- increment VT(MRW) by one;
- restart Timer_MRW for this discard procedure.
If the number of retransmission of an MRW SUFI (i.e. VT(MRW)) equals MaxMRW, the Sender shall:
- terminate the SDU discard with explicit signalling procedure;
- stop the timer Timer_MRW;
- deliver an error indication to upper layers;
- initiate the RLC RESET procedure */
rlcP->timer_mrw = NULL;
#ifdef DEBUG_RLC_AM_DISCARD
msg ("[RLC_AM][RB %d][DISCARD] NOTIF MRW_ACK TIME OUT VT(MRW) %d PROCEDURE %p\n", rlcP->rb_id, rlcP->vt_mrw, discard_procedureP);
#endif
if ((rlcP->protocol_state & (RLC_RESET_PENDING_STATE | RLC_RESET_AND_SUSPEND_STATE)) == 0) {
// check the number of retransmission of the status pdu
if (rlcP->vt_mrw < (rlcP->max_mrw - 1)) {
rlc_am_schedule_procedure (rlcP);
#ifdef DEBUG_RLC_AM_DISCARD
msg ("[RLC_AM %p][DISCARD] NOTIF MRW_ACK TIME OUT REARM TIMER\n", rlcP);
#endif
rlcP->vt_mrw += 1;
} else {
// TO DO : "deliver an error indication to upper layers"
#ifdef DEBUG_RESET
msg ("\n[RLC_AM][RB %d][DISCARD] NOTIF MRW_ACK TIME OUT MAX_MRW REACHED -> RESET\n", rlcP->rb_id);
#endif
send_reset_pdu (rlcP);
}
}
}
// handler for timer
//-----------------------------------------------------------------------------
void
rlc_am_discard_check_sdu_time_out (struct rlc_am_entity* rlcP)
{
//-----------------------------------------------------------------------------
mem_block_t* sdu;
mem_block_t* pdu;
int discard_go_on;
int last_removed_pdu_sn;
int sn;
// TIMER BASED DISCARD
if ((rlcP->sdu_discard_mode & RLC_SDU_DISCARD_TIMER_BASED_EXPLICIT)
&& ((rlcP->protocol_state & (RLC_RESET_PENDING_STATE | RLC_RESET_AND_SUSPEND_STATE)) == 0)) {
/* from 3GPP TS 25.322 V5.0.0 p68
- if "Timer based SDU discard with explicit signalling" is configured:
- discard all SDUs up to and including the SDU for which the timer Timer_Discard expired.
- discard all AMD PDUs including segments of the discarded SDUs, unless they also carry a segment of a SDU
whose timer has not expired;
- if more than 15 discarded SDUs are to be informed to the Receiver:
- if "Send MRW" is not configured:
- assemble an MRW SUFI with the discard information of the SDUs.
- otherwise ("Send MRW" is configured):
- assemble an MRW SUFI with the discard information of the first 15 SDUs; and