reset for remerging

This commit is contained in:
Wang Tsu-Han
2018-07-30 11:24:08 +02:00
parent 0b405e3d2b
commit aa00a4734a
516 changed files with 11979 additions and 768789 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef GTPV1_U_MESSAGES_TYPES_H_
#define GTPV1_U_MESSAGES_TYPES_H_
#include "asn1_constants.h"
#include "asn_constant.h"
#define GTPV1U_MAX_BEARERS_PER_UE max_val_DRB_Identity
+2 -2
View File
@@ -365,7 +365,7 @@ typedef struct {
#endif
);
unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, const unsigned int,char*
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,uint32_t
,uint32_t
#endif
@@ -373,7 +373,7 @@ typedef struct {
void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, sub_frame_t subframeP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP,
logical_chan_id_t channel_idP, tb_size_t tb_sizeP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,uint32_t sourceL2Id
,uint32_t destinationL2Id
#endif
+11 -4
View File
@@ -29,9 +29,9 @@
***************************************************************************/
#ifdef CMAKER
#include "asn1_constants.h"
#include "asn_constant.h"
#else
#include "RRC/LITE/MESSAGES/asn1_constants.h"
#include "RRC/LTE/MESSAGES/asn1_constants.h"
#endif
#ifndef __PLATFORM_CONSTANTS_H__
@@ -67,16 +67,23 @@
# define MAX_MODULES NB_MODULES_MAX
#ifdef LARGE_SCALE
#ifndef UE_EXPANSION
# ifdef LARGE_SCALE
# define MAX_MOBILES_PER_ENB 128
# define MAX_MOBILES_PER_ENB_NB_IoT 128
# define MAX_eNB 2
#else
# else
# define MAX_MOBILES_PER_ENB 16
# define MAX_MOBILES_PER_ENB_NB_IoT 16
# define MAX_eNB 2
# endif
#else
# define MAX_MOBILES_PER_ENB 256
# define MAX_MOBILES_PER_ENB_NB_IoT 256
# define MAX_eNB 2
#endif
#define MAX_MANAGED_ENB_PER_MOBILE 2
///NB-IOT
+1 -1
View File
@@ -68,7 +68,7 @@ typedef int32_t sdu_size_t;
typedef uint32_t frame_t;
typedef int32_t sframe_t;
typedef uint32_t sub_frame_t;
typedef uint8_t module_id_t;
typedef uint16_t module_id_t;
typedef uint8_t slice_id_t;
typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t;
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef RAL_MESSAGES_TYPES_H_
#define RAL_MESSAGES_TYPES_H_
#include "asn1_constants.h"
#include "asn_constant.h"
#include "platform_types.h"
#include "commonDef.h"
/* 802.21 mappings with the RRC protocol :
+6 -8
View File
@@ -35,7 +35,7 @@
#ifdef CMAKER
#include "SystemInformationBlockType2.h"
#else
#include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h"
#endif
#include "SL-OffsetIndicator-r12.h"
#include "SubframeBitmapSL-r12.h"
@@ -123,9 +123,9 @@ typedef struct RrcConfigurationReq_s {
long pucch_delta_shift[MAX_NUM_CCs];
long pucch_nRB_CQI[MAX_NUM_CCs];
long pucch_nCS_AN[MAX_NUM_CCs];
#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
//#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
long pucch_n1_AN[MAX_NUM_CCs];
#endif
//#endif
long pdsch_referenceSignalPower[MAX_NUM_CCs];
long pdsch_p_b[MAX_NUM_CCs];
long pusch_n_SB[MAX_NUM_CCs];
@@ -174,6 +174,7 @@ typedef struct RrcConfigurationReq_s {
long ue_TimersAndConstants_n310[MAX_NUM_CCs];
long ue_TimersAndConstants_n311[MAX_NUM_CCs];
long ue_TransmissionMode[MAX_NUM_CCs];
long ue_multiple_max[MAX_NUM_CCs];
//TTN - for D2D
//SIB18
@@ -219,13 +220,10 @@ typedef struct RrcConfigurationReq_s {
char* discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs];
long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[MAX_NUM_CCs];
long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[MAX_NUM_CCs];
} RrcConfigurationReq;
#define MAX_NUM_NBIOT_CELEVELS 3
typedef struct NbIoTRrcConfigurationReq_s {
uint32_t cell_identity;
+1 -1
View File
@@ -38,7 +38,7 @@ MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgTex
MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log)
MESSAGE_DEF(S1AP_E_RAB_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log)
MESSAGE_DEF(S1AP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log)
/* eNB application layer -> S1AP messages */
MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req)
+12 -1
View File
@@ -53,7 +53,10 @@
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
#define CONFIG_STRING_MACRLC_SCHED_MODE "scheduler_mode"
#define CONFIG_STRING_MACRLC_PHY_TEST_MODE "phy_test_mode"
#define CONFIG_MACRLC_PUSCH10xSNR "puSch10xSnr"
#define CONFIG_MACRLC_PUCCH10xSNR "puCch10xSnr"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* MacRLC configuration parameters */
@@ -77,6 +80,10 @@
{CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_SCHED_MODE, NULL, 0, strptr:NULL, defstrval:"default", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_PHY_TEST_MODE, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
{CONFIG_MACRLC_PUSCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
{CONFIG_MACRLC_PUCCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
}
#define MACRLC_CC_IDX 0
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
@@ -95,4 +102,8 @@
#define MACRLC_REMOTE_S_PORTC_IDX 14
#define MACRLC_LOCAL_S_PORTD_IDX 15
#define MACRLC_REMOTE_S_PORTD_IDX 16
#define MACRLC_SCHED_MODE_IDX 17
#define MACRLC_PHY_TEST_IDX 18
#define MACRLC_PUSCH10xSNR_IDX 19
#define MACRLC_PUCCH10xSNR_IDX 20
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
+1 -1
View File
@@ -42,7 +42,7 @@
#endif
#include "SystemInformationBlockType2.h"
#include "PHY/extern.h"
#include "PHY/phy_extern.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
#include "common/config/config_userapi.h"
#include "RRC_config_tools.h"
+46 -48
View File
@@ -102,6 +102,7 @@ void RCconfig_flexran()
ue_TimersAndConstants_n310, ue_TimersAndConstants_n311,
ue_TransmissionMode;
int32_t ue_multiple_max = 0;
e_SL_CP_Len_r12 rxPool_sc_CP_Len;
e_SL_PeriodComm_r12 rxPool_sc_Period;
@@ -229,47 +230,6 @@ void RCconfig_flexran()
}
/*void UE_config_stub_pnf(void) {
int j;
paramdef_t L1_Params[] = L1PARAMS_DESC;
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
for (j=0; j<L1_ParamList.numelt; j++){
//nb_L1_CC = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr); // Number of component carriers is of no use for the
// phy_stub mode UE pnf. Maybe we can completely skip it.
if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
sf_ahead = 4; // Need 4 subframe gap between RX and TX
}
// Panos: Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst.
// Later I think we have to change that to attribute eth_params to a global element for all the UEs.
else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
stub_eth_params.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
stub_eth_params.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
stub_eth_params.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
stub_eth_params.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
stub_eth_params.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
stub_eth_params.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
stub_eth_params.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
stub_eth_params.transp_preference = ETH_UDP_MODE;
sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
//configure_nfapi_pnf(UE_mac_inst[0].eth_params_n.remote_addr, UE_mac_inst[0].eth_params_n.remote_portc, UE_mac_inst[0].eth_params_n.my_addr, UE_mac_inst[0].eth_params_n.my_portd, UE_mac_inst[0].eth_params_n.remote_portd);
configure_nfapi_pnf(stub_eth_params.remote_addr, stub_eth_params.remote_portc, stub_eth_params.my_addr, stub_eth_params.my_portd, stub_eth_params.remote_portd);
}
else { // other midhaul
}
}
}
else {
}
}*/
void RCconfig_L1(void) {
int i,j;
paramdef_t L1_Params[] = L1PARAMS_DESC;
@@ -337,7 +297,6 @@ void RCconfig_L1(void) {
configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n .remote_portd);
}
else { // other midhaul
//printf("Panos-D: RCconfig_L1 12 \n");
}
}// j=0..num_inst
printf("Initializing northbound interface for L1\n");
@@ -387,6 +346,8 @@ void RCconfig_macrlc() {
RC.nb_mac_CC = (int*)malloc(RC.nb_macrlc_inst*sizeof(int));
for (j=0;j<RC.nb_macrlc_inst;j++) {
RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr);
RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr);
RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
//RC.mac[j]->phy_test = *(MacRLC_ParamList.paramarray[j][MACRLC_PHY_TEST_IDX].iptr);
//printf("PHY_TEST = %d,%d\n", RC.mac[j]->phy_test, j);
@@ -427,7 +388,17 @@ void RCconfig_macrlc() {
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
} else { // other midhaul
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
}
}
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0){
global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0){
global_scheduler_mode=SCHED_MODE_FAIR_RR;
printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}else{
global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}
}// j=0..num_inst
} else {// MacRLC_ParamList.numelt > 0
AssertFatal (0,
@@ -521,6 +492,8 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
int32_t ue_TimersAndConstants_n311 = 0;
int32_t ue_TransmissionMode = 0;
int32_t ue_multiple_max = 0;
//TTN - for D2D
//SIB18
const char* rxPool_sc_CP_Len = NULL;
@@ -567,7 +540,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size = 0;
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
int32_t srb1_timer_poll_retransmit = 0;
int32_t srb1_timer_reordering = 0;
int32_t srb1_timer_status_prohibit = 0;
@@ -918,13 +890,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
RC.config_file_name, i, prach_zero_correlation);
RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset;
if ((prach_freq_offset <0) || (prach_freq_offset > 94))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n",
RC.config_file_name, i, prach_freq_offset);
RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1;
if ((pucch_delta_shift <1) || (pucch_delta_shift > 3))
@@ -946,7 +916,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n",
RC.config_file_name, i, pucch_nCS_AN);
#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
//#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[j] = pucch_n1_AN;
if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047))
@@ -954,7 +924,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n",
RC.config_file_name, i, pucch_n1_AN);
#endif
//#endif
RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower;
if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50))
@@ -1580,6 +1550,34 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
break;
}
RRC_CONFIGURATION_REQ (msg_p).ue_multiple_max[j] = ue_multiple_max;
switch (N_RB_DL) {
case 25:
if ((ue_multiple_max < 1) || (ue_multiple_max > 4))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..4!\n",
RC.config_file_name, i, ue_multiple_max);
break;
case 50:
if ((ue_multiple_max < 1) || (ue_multiple_max > 8))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n",
RC.config_file_name, i, ue_multiple_max);
break;
case 100:
if ((ue_multiple_max < 1) || (ue_multiple_max > 16))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n",
RC.config_file_name, i, ue_multiple_max);
break;
default:
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n",
RC.config_file_name, i, N_RB_DL);
break;
}
//TTN - for D2D
//SIB18
if (strcmp(rxPool_sc_CP_Len,"normal")==0) {
+1 -1
View File
@@ -44,7 +44,7 @@
#include "SystemInformationBlockType2.h"
#include "rrc_messages_types.h"
#else
#include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h"
#endif
#include "intertask_interface_types.h"
#include "RRC/LTE/rrc_defs.h"
+43 -1
View File
@@ -304,6 +304,7 @@ typedef enum {
#define ENB_CONFIG_STRING_UETIMERS_N310 "ue_TimersAndConstants_n310"
#define ENB_CONFIG_STRING_UETIMERS_N311 "ue_TimersAndConstants_n311"
#define ENB_CONFIG_STRING_UE_TRANSMISSION_MODE "ue_TransmissionMode"
#define ENB_CONFIG_STRING_UE_MULTIPLE_MAX "ue_multiple_max"
//TTN - for D2D
//SIB18
@@ -490,7 +491,7 @@ typedef enum {
{ENB_CONFIG_STRING_PUCCH_DELTA_SHIFT, NULL, 0, iptr:&pucch_delta_shift, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_PUCCH_NRB_CQI, NULL, 0, iptr:&pucch_nRB_CQI, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_PUCCH_NCS_AN, NULL, 0, iptr:&pucch_nCS_AN, defintval:0, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_PUCCH_N1_AN, NULL, 0, iptr:&pucch_n1_AN, defintval:32, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_PUCCH_N1_AN, NULL, 0, iptr:&pucch_n1_AN, defintval:0, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_PDSCH_RS_EPRE, NULL, 0, iptr:&pdsch_referenceSignalPower, defintval:-29, TYPE_INT, 0}, \
{ENB_CONFIG_STRING_PDSCH_PB, NULL, 0, iptr:&pdsch_p_b, defintval:0, TYPE_INT, 0}, \
{ENB_CONFIG_STRING_PUSCH_N_SB, NULL, 0, iptr:&pusch_n_SB, defintval:1, TYPE_INT, 0}, \
@@ -538,6 +539,7 @@ typedef enum {
{ENB_CONFIG_STRING_UETIMERS_N310, NULL, 0, iptr:&ue_TimersAndConstants_n310, defintval:20, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UETIMERS_N311, NULL, 0, iptr:&ue_TimersAndConstants_n311, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UE_TRANSMISSION_MODE, NULL, 0, iptr:&ue_TransmissionMode, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UE_MULTIPLE_MAX, NULL, 0, iptr:&ue_multiple_max, defintval:4, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_SC_CP_LEN, NULL, 0, strptr:(char **)&rxPool_sc_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_SC_PRIOD, NULL, 0, strptr:(char **)&rxPool_sc_Period, defstrval:"sf40", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_DATA_CP_LEN, NULL, 0, strptr:(char **)&rxPool_data_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \
@@ -808,4 +810,44 @@ typedef enum {
#define CONFIG_STRING_MACRLC_CONFIG "macrlc_config"
/* MACRLC configuration parameters names */
#define CONFIG_STRING_MACRLC_CC "num_cc"
#define CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE "tr_n_preference"
#define CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME "local_n_if_name"
#define CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS "local_n_address"
#define CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS "remote_n_address"
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTC "local_n_portc"
#define CONFIG_STRING_MACRLC_REMOTE_N_PORTC "remote_n_portc"
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD "local_n_portd"
#define CONFIG_STRING_MACRLC_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE "tr_s_preference"
#define CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME "local_s_if_name"
#define CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS "local_s_address"
#define CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS "remote_s_address"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTC "local_s_portc"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
#define CONFIG_STRING_MACRLC_SCHED_MODE "scheduler_mode"
#define CONFIG_STRING_MACRLC_PHY_TEST_MODE "phy_test_mode"
#define MACRLC_CC_IDX 0
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
#define MACRLC_LOCAL_N_IF_NAME_IDX 2
#define MACRLC_LOCAL_N_ADDRESS_IDX 3
#define MACRLC_REMOTE_N_ADDRESS_IDX 4
#define MACRLC_LOCAL_N_PORTC_IDX 5
#define MACRLC_REMOTE_N_PORTC_IDX 6
#define MACRLC_LOCAL_N_PORTD_IDX 7
#define MACRLC_REMOTE_N_PORTD_IDX 8
#define MACRLC_TRANSPORT_S_PREFERENCE_IDX 9
#define MACRLC_LOCAL_S_IF_NAME_IDX 10
#define MACRLC_LOCAL_S_ADDRESS_IDX 11
#define MACRLC_REMOTE_S_ADDRESS_IDX 12
#define MACRLC_LOCAL_S_PORTC_IDX 13
#define MACRLC_REMOTE_S_PORTC_IDX 14
#define MACRLC_LOCAL_S_PORTD_IDX 15
#define MACRLC_REMOTE_S_PORTD_IDX 16
#define MACRLC_SCHED_MODE_IDX 17
#define MACRLC_PHY_TEST_IDX 18
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
+1 -1
View File
@@ -102,7 +102,7 @@ typedef enum {
} ran_name_t;
typedef uint8_t xid_t;
typedef uint8_t mid_t; // module or enb id
typedef uint16_t mid_t; // module or enb id
typedef uint8_t lcid_t;
typedef int32_t err_code_t;
+3 -3
View File
@@ -141,7 +141,7 @@ rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logi
frame_t frame = flexran_get_current_frame(mod_id);
sub_frame_t subframe = flexran_get_current_subframe(mod_id);
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -154,7 +154,7 @@ rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, lo
frame_t frame = flexran_get_current_frame(mod_id);
sub_frame_t subframe = flexran_get_current_subframe(mod_id);
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -167,7 +167,7 @@ frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t chann
frame_t frame = flexran_get_current_frame(mod_id);
sub_frame_t subframe = flexran_get_current_subframe(mod_id);
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
+6 -5
View File
@@ -218,7 +218,7 @@ void config_mib(int Mod_idP,
cfg->rf_config.dl_channel_bandwidth.value = to_prb(dl_BandwidthP);
cfg->rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
cfg->num_tlv++;
LOG_E(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP);
LOG_D(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP);
cfg->rf_config.ul_channel_bandwidth.value = to_prb(dl_BandwidthP);
cfg->rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
@@ -727,7 +727,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
LOG_E(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib);
LOG_D(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib);
if (mib != NULL) {
if (RC.mac == NULL)
@@ -962,8 +962,8 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
}
#endif
LOG_E(MAC, "%s() %s:%d RC.mac[Mod_idP]->if_inst->PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.mac[Mod_idP]->if_inst->PHY_config_req);
LOG_D(MAC, "%s() %s:%d RC.mac[Mod_idP]->if_inst->PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.mac[Mod_idP]->if_inst->PHY_config_req);
// if in nFAPI mode
if (
@@ -987,6 +987,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
}
RC.mac[Mod_idP]->scheduler_mode = global_scheduler_mode;
return(0);
}
+27 -27
View File
@@ -21,7 +21,7 @@ typedef enum operationModeInf{
iNB_IoTand_DifferentPCI_r13 = 2,
guardband_r13 = 3,
standalone_r13 = 4
}operationModeInf_t;
} operationModeInf_t;
///SIB1_SchedulingInfo_NB_IoT_r13
typedef enum si_Periodicity{
@@ -32,14 +32,14 @@ typedef enum si_Periodicity{
si_Periodicity_rf1024=10240,
si_Periodicity_rf2048=20480,
si_Periodicity_rf4096=40960
}si_Periodicity_NB_IoT;
} si_Periodicity_NB_IoT;
typedef enum si_RepetitionPattern{
si_RepetitionPattern_every2ndRF=0,
si_RepetitionPattern_every4thRF,
si_RepetitionPattern_every8thRF,
si_RepetitionPattern_every16thRF
}si_RepetitionPattern_NB_IoT;
} si_RepetitionPattern_NB_IoT;
typedef enum sib_MappingInfo{
sib2_v=0x1,
@@ -48,7 +48,7 @@ typedef enum sib_MappingInfo{
sib5_v=0x8,
sib14_v=0x10,
sib16_v=0x20
}sib_MappingInfo_NB_IoT;
} sib_MappingInfo_NB_IoT;
typedef enum si_TB{
si_TB_56=2,
@@ -59,7 +59,7 @@ typedef enum si_TB{
si_TB_440=8,
si_TB_552=8,
si_TB_680=8
}si_TB_NB_IoT;
} si_TB_NB_IoT;
///RACH_ConfigCommon configuration
@@ -72,7 +72,7 @@ typedef enum ra_ResponseWindowSize{
ra_ResponseWindowSize_pp7=7,
ra_ResponseWindowSize_pp8=8,
ra_ResponseWindowSize_pp10=10
}ra_ResponseWindowSize_NB_IoT;
} ra_ResponseWindowSize_NB_IoT;
typedef enum mac_ContentionResolutionTimer{
mac_ContentionResolutionTimer_pp1=1,
@@ -83,7 +83,7 @@ typedef enum mac_ContentionResolutionTimer{
mac_ContentionResolutionTimer_pp16=16,
mac_ContentionResolutionTimer_pp32=32,
mac_ContentionResolutionTimer_pp64=64
}mac_ContentionResolutionTimer_NB_IoT;
} mac_ContentionResolutionTimer_NB_IoT;
///NPRACH_ConfigSIB configuration
@@ -96,7 +96,7 @@ typedef enum nprach_Periodicity{
nprach_Periodicity_ms640=640,
nprach_Periodicity_ms1280=1280,
nprach_Periodicity_ms2560=2560
}nprach_Periodicity_NB_IoT;
} nprach_Periodicity_NB_IoT;
typedef enum nprach_StartTime{
nprach_StartTime_ms8=8,
@@ -107,7 +107,7 @@ typedef enum nprach_StartTime{
nprach_StartTime_ms256=256,
nprach_StartTime_ms512=512,
nprach_StartTime_ms1024=1024
}nprach_StartTime_NB_IoT;
} nprach_StartTime_NB_IoT;
typedef enum nprach_SubcarrierOffset{
nprach_SubcarrierOffset_n0=0,
@@ -117,21 +117,21 @@ typedef enum nprach_SubcarrierOffset{
nprach_SubcarrierOffset_n2=2,
nprach_SubcarrierOffset_n18=18,
nprach_SubcarrierOffset_n34=34
}nprach_SubcarrierOffset_NB_IoT;
} nprach_SubcarrierOffset_NB_IoT;
typedef enum nprach_NumSubcarriers{
nprach_NumSubcarriers_n12=12,
nprach_NumSubcarriers_n24=24,
nprach_NumSubcarriers_n36=36,
nprach_NumSubcarriers_n48=48
}nprach_NumSubcarriers_NB_IoT;
} nprach_NumSubcarriers_NB_IoT;
typedef enum nprach_SubcarrierMSG3_RangeStart{
nprach_SubcarrierMSG3_RangeStart_zero=0,
nprach_SubcarrierMSG3_RangeStart_oneThird=1/3,
nprach_SubcarrierMSG3_RangeStart_twoThird=2/3,
nprach_SubcarrierMSG3_RangeStart_one=1
}nprach_SubcarrierMSG3_RangeStart_NB_IoT;
} nprach_SubcarrierMSG3_RangeStart_NB_IoT;
typedef enum maxNumPreambleAttemptCE{
maxNumPreambleAttemptCE_n3=3,
@@ -141,7 +141,7 @@ typedef enum maxNumPreambleAttemptCE{
maxNumPreambleAttemptCE_n7=7,
maxNumPreambleAttemptCE_n8=8,
maxNumPreambleAttemptCE_n10=10
}maxNumPreambleAttemptCE_NB_IoT;
} maxNumPreambleAttemptCE_NB_IoT;
typedef enum numRepetitionsPerPreambleAttempt{
numRepetitionsPerPreambleAttempt_n1=1,
@@ -152,7 +152,7 @@ typedef enum numRepetitionsPerPreambleAttempt{
numRepetitionsPerPreambleAttempt_n32=32,
numRepetitionsPerPreambleAttempt_n64=64,
numRepetitionsPerPreambleAttempt_n128=128
}numRepetitionsPerPreambleAttempt_NB_IoT;
} numRepetitionsPerPreambleAttempt_NB_IoT;
typedef enum npdcch_NumRepetitions_RA{
npdcch_NumRepetitions_RA_r1=1,
@@ -167,7 +167,7 @@ typedef enum npdcch_NumRepetitions_RA{
npdcch_NumRepetitions_RA_r512=512,
npdcch_NumRepetitions_RA_r1024=1024,
npdcch_NumRepetitions_RA_r2048=2048
}npdcch_NumRepetitions_RA_NB_IoT;
} npdcch_NumRepetitions_RA_NB_IoT;
typedef enum npdcch_StartSF_CSS_RA{
npdcch_StartSF_CSS_RA_v1dot5=3/2,
@@ -178,14 +178,14 @@ typedef enum npdcch_StartSF_CSS_RA{
npdcch_StartSF_CSS_RA_v32=32,
npdcch_StartSF_CSS_RA_v48=48,
npdcch_StartSF_CSS_RA_v64=64
}npdcch_StartSF_CSS_RA_NB_IoT;
} npdcch_StartSF_CSS_RA_NB_IoT;
typedef enum npdcch_Offset_RA{
zero=0,
oneEighth=1/8,
oneFourth=1/4,
threeEighth=3/8
}npdcch_Offset_RA_NB_IoT;
} npdcch_Offset_RA_NB_IoT;
typedef enum si_window_length_e{
ms160=160,
@@ -195,7 +195,7 @@ typedef enum si_window_length_e{
ms960=960,
ms1280=1280,
ms1600=1600
}si_window_length_t;
} si_window_length_t;
typedef enum si_periodicity_e{
rf64=640,
@@ -205,14 +205,14 @@ typedef enum si_periodicity_e{
rf1024=10240,
rf2048=20480,
rf4096=40960
}si_periodicity_t;
} si_periodicity_t;
typedef enum si_repetition_pattern_e{
every2ndRF=20,
every4thRF=40,
every8thRF=80,
every16thRF=160
}si_repetition_pattern_t;
} si_repetition_pattern_t;
typedef enum si_tb_e{
b56=2,
@@ -223,7 +223,7 @@ typedef enum si_tb_e{
b440=8,
b552=8,
b680=8
}si_tb_t;
} si_tb_t;
typedef struct sibs_NB_IoT_sched_s{
@@ -232,21 +232,21 @@ typedef struct sibs_NB_IoT_sched_s{
sib_MappingInfo_NB_IoT sib_mapping_info; //bit vector
si_tb_t si_tb;
}sibs_NB_IoT_sched_t;
} sibs_NB_IoT_sched_t;
///-------------------------------------------------------MAC--------------------------------------------------------------------///
typedef struct sib1_NB_IoT_sched_s{
int repetitions; // 4, 8, 16
int starting_rf;
}sib1_NB_IoT_sched_t;
} sib1_NB_IoT_sched_t;
typedef struct {
uint32_t mac_ra_ResponseWindowSize_NB_IoT;
uint32_t mac_ContentionResolutionTimer_NB_IoT;
}mac_RACH_ConfigCommon_NB_IoT;
} mac_RACH_ConfigCommon_NB_IoT;
typedef struct {
@@ -262,7 +262,7 @@ typedef struct {
uint32_t mac_npdcch_StartSF_CSS_RA_NB_IoT; // G
uint32_t mac_npdcch_Offset_RA_NB_IoT; // alpha offset
}mac_NPRACH_ConfigSIB_NB_IoT;
} mac_NPRACH_ConfigSIB_NB_IoT;
typedef struct{
//npdcch-NumRepetitions-r13
@@ -271,7 +271,7 @@ typedef struct{
double G;
//npdcch-Offset-USS-r13
double a_offset;
}npdcch_ConfigDedicated_NB_IoT;
} npdcch_ConfigDedicated_NB_IoT;
typedef struct rrc_config_NB_IoT_s{
@@ -296,6 +296,6 @@ typedef struct rrc_config_NB_IoT_s{
///NPDCCH Dedicated config
npdcch_ConfigDedicated_NB_IoT npdcch_ConfigDedicated[3];
}rrc_config_NB_IoT_t;
} rrc_config_NB_IoT_t;
#endif
+2 -2
View File
@@ -138,7 +138,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
#ifdef CBA
, uint8_t num_active_cba_groups, uint16_t cba_rnti
#endif
#if defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,config_action_t config_action
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
@@ -590,7 +590,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
//for D2D
#if defined(Rel10) || defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
switch (config_action) {
case CONFIG_ACTION_ADD:
if (sourceL2Id){
+62 -33
View File
@@ -51,6 +51,9 @@
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
/* for fair round robin SCHED */
#include "eNB_scheduler_fairRR.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
@@ -359,8 +362,9 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
// check uplink failure
if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 0) &&
(UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0)) {
LOG_I(MAC, "UE %d rnti %x: UL Failure timer %d \n", UE_id, rnti,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer == 1)
LOG_I(MAC, "UE %d rnti %x: UL Failure timer %d \n", UE_id, rnti,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
if (UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent == 0) {
UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 1;
@@ -385,23 +389,24 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
DL_req[CC_id].dl_config_request_body.number_dci++;
DL_req[CC_id].dl_config_request_body.number_pdu++;
DL_req[CC_id].dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
LOG_I(MAC,
LOG_D(MAC,
"UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",
UE_id, rnti,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer,
dl_config_pdu->dci_dl_pdu.
dci_dl_pdu_rel8.resource_block_coding);
} else { // ra_pdcch_sent==1
LOG_I(MAC,
LOG_D(MAC,
"UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",
UE_id, rnti,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer % 40) == 0) UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 0; // resend every 4 frames
if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer % 80) == 0) UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 0; // resend every 8 frames
}
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer++;
// check threshold
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 20000) {
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) {
// note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311)
// inform RRC of failure and clear timer
LOG_I(MAC,
"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
@@ -418,16 +423,6 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
}
}
} // ul_failure_timer>0
#if 0
/* U-plane inactivity timer is disabled. Uncomment to re-enable. */
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}// time > 60s
#endif
}
void
@@ -436,7 +431,7 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
{
nfapi_dl_config_request_t *DL_req = &eNB->DL_req[0];
nfapi_ul_config_request_t *UL_req = &eNB->UL_req[0];
nfapi_hi_dci0_request_t *HI_DCI0_req = &eNB->HI_DCI0_req[0];
nfapi_hi_dci0_request_t *HI_DCI0_req = &eNB->HI_DCI0_req[CC_idP][subframeP];
nfapi_tx_request_t *TX_req = &eNB->TX_req[0];
eNB->pdu_index[CC_idP] = 0;
@@ -449,8 +444,8 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0;
DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000;
HI_DCI0_req[CC_idP].hi_dci0_request_body.sfnsf = subframeP + (frameP<<4);
HI_DCI0_req[CC_idP].hi_dci0_request_body.number_of_dci = 0;
HI_DCI0_req->hi_dci0_request_body.sfnsf = subframeP + (frameP<<4);
HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
UL_req[CC_idP].ul_config_request_body.number_of_pdus = 0;
@@ -532,7 +527,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// refresh UE list based on UEs dropped by PHY in previous subframe
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (UE_list->active[i]) {
rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i);
@@ -570,14 +564,21 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_ENB; ue_id_l++) {
if (reestablish_rnti_map[ue_id_l][0] == rnti) {
// clear currentC-RNTI from map
reestablish_rnti_map[ue_id_l][0] = 0;
reestablish_rnti_map[ue_id_l][1] = 0;
break;
//clear reestablish_rnti_map
if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres >20){
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_ENB; ue_id_l++) {
if (reestablish_rnti_map[ue_id_l][0] == rnti) {
// clear currentC-RNTI from map
reestablish_rnti_map[ue_id_l][0] = 0;
reestablish_rnti_map[ue_id_l][1] = 0;
break;
}
}
}
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rnti, 0, 0,module_idP);
rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt);
}
// Note: This should not be done in the MAC!
for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) {
LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii];
@@ -617,13 +618,15 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
}
}
}
#if (!defined(PRE_SCD_THREAD))
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
NOT_A_RNTI, frameP, subframeP,
module_idP);
pdcp_run(&ctxt);
rrc_rx_tx(&ctxt, CC_id);
#endif
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
@@ -637,6 +640,22 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
#endif
static int debug_flag=0;
void (*schedule_ulsch_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe)=NULL;
void (*schedule_ue_spec_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, int *mbsfn_flag)=NULL;
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_DEFAULT){
schedule_ulsch_p = schedule_ulsch;
schedule_ue_spec_p = schedule_dlsch;
}else if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
memset(dlsch_ue_select, 0, sizeof(dlsch_ue_select));
schedule_ulsch_p = schedule_ulsch_fairRR;
schedule_ue_spec_p = schedule_ue_spec_fairRR;
}
if(debug_flag==0){
LOG_E(MAC,"SCHED_MODE=%d\n",RC.mac[module_idP]->scheduler_mode);
debug_flag=1;
}
// This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0)
@@ -653,17 +672,25 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// This schedules SRS in subframeP
schedule_SRS(module_idP, frameP, subframeP);
// This schedules ULSCH in subframeP (dci0)
schedule_ulsch(module_idP, frameP, subframeP);
if (schedule_ulsch_p != NULL) {
schedule_ulsch_p(module_idP, frameP, subframeP);
} else {
LOG_E(MAC," %s %d: schedule_ulsch_p is NULL, function not called\n",__FILE__,__LINE__);
}
// This schedules UCI_SR in subframeP
schedule_SR(module_idP, frameP, subframeP);
// This schedules UCI_CSI in subframeP
schedule_CSI(module_idP, frameP, subframeP);
// This schedules DLSCH in subframeP
schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status);
if (schedule_ue_spec_p != NULL) {
schedule_ue_spec_p(module_idP, frameP, subframeP, mbsfn_status);
} else {
LOG_E(MAC," %s %d: schedule_ue_spec_p is NULL, function not called\n",__FILE__,__LINE__);
}
}
else{
schedule_ulsch_phy_test(module_idP,frameP,subframeP);
//LOG_I(MAC,"frameP = %d .subframeP = %d\n", frameP, subframeP);/////////////*********added
schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
}
@@ -671,8 +698,10 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
flexran_agent_send_update_stats(module_idP);
// Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
allocate_CCEs(module_idP, CC_id, subframeP, 0);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
if(cc[CC_id].tdd_Config == NULL || !(is_UL_sf(&cc[CC_id],subframeP)))
allocate_CCEs(module_idP, CC_id, frameP, subframeP, 2);
}
stop_meas(&RC.mac[module_idP]->eNB_scheduler);
+82 -32
View File
@@ -50,6 +50,7 @@
#include "RRC/LTE/rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "SCHED/sched_common.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
@@ -62,6 +63,7 @@
#include "T.h"
#include "common/ran_context.h"
#include "LAYER2/MAC/eNB_scheduler_fairRR.h"
extern RAN_CONTEXT_t RC;
@@ -106,10 +108,10 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
nfapi_ul_config_request_t *ul_req;
nfapi_ul_config_request_body_t *ul_req_body;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_t *hi_dci0_req;
nfapi_hi_dci0_request_body_t *hi_dci0_req_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
uint8_t sf_ahead_dl;
uint8_t rvseq[4] = { 0, 2, 3, 1 };
@@ -211,6 +213,9 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
LOG_D(MAC, "MSG3: UL_CONFIG SFN/SF:%d number_of_pdus:%d ra->msg3_round:%d\n", NFAPI_SFNSF2DEC(ul_req->sfn_sf), ul_req_body->number_of_pdus, ra->msg3_round);
if (ra->msg3_round != 0) { // program HI too
sf_ahead_dl = ul_subframe2_k_phich(cc, subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_id][(subframeP+sf_ahead_dl)%10];
hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0,
sizeof(nfapi_hi_dci0_request_pdu_t));
@@ -225,7 +230,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 4);
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
if (nfapi_mode) {
@@ -283,7 +288,7 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
LOG_D(MAC,"absSF:%d absSF_Msg2:%d ra->rach_resource_type:%d\n",absSF,absSF_Msg2,ra->rach_resource_type);
if (absSF > absSF_Msg2)
if (absSF < absSF_Msg2)
return; // we're not ready yet, need to be to start ==
if (cc[CC_idP].radioResourceConfigCommon_BR) {
@@ -486,6 +491,9 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_length = 7;
TX_req->segments[0].segment_data = cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
set_dl_ue_select_msg2(CC_idP, 4, -1, ra->rnti);
}
}
}
@@ -587,6 +595,9 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_data =
cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
set_dl_ue_select_msg2(CC_idP, 4, -1, ra->rnti);
}
} // PDCCH CCE allocation is feasible
} // Msg2 frame/subframe condition
} // else BL/CE
@@ -693,17 +704,17 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
// set HARQ process round to 0 for this UE
if (cc->tdd_Config)
ra->harq_pid = ((frameP * 10) + subframeP) % 10;
else
ra->harq_pid = ((frameP * 10) + subframeP) & 7;
ra->harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
/* // Get RRCConnectionSetup for Piggyback
rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
&cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
AssertFatal(rrc_sdu_length > 0,
"[MAC][eNB Scheduler] CCCH not allocated\n");
if(rrc_sdu_length <= 0) {
LOG_D(MAC,"[MAC][eNB Scheduler] CCCH not allocated (%d)\n",rrc_sdu_length);
return;
}
//AssertFatal(rrc_sdu_length > 0,
//"[MAC][eNB Scheduler] CCCH not allocated\n");
LOG_D(MAC,
@@ -987,6 +998,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
module_idP, CC_idP, frameP, UE_RNTI(module_idP,UE_id),
rrc_sdu_length);
}
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
}
} // Msg4 frame/subframe
} // msg4_mpdcch_repetition_count
} // rach_resource_type > 0
@@ -994,7 +1008,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
#endif
{
// This is normal LTE case
LOG_D(MAC, "Panos-D: generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
// Get RRCConnectionSetup for Piggyback
@@ -1086,10 +1100,8 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
"Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n",
frameP, subframeP, ra->Msg4_frame,
ra->Msg4_subframe);
if (ra->Msg4_subframe > 1)
ra->Msg4_frame++;
ra->Msg4_frame &= 1023;
ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
get_retransmission_timing(mac->common_channels[CC_idP].tdd_Config,&ra->Msg4_frame,&ra->Msg4_subframe);
LOG_D(MAC,
"Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
frameP, subframeP, ra->Msg4_frame,
@@ -1097,9 +1109,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
lcid = 0;
// put HARQ process round to 0
if (cc->tdd_Config) ra->harq_pid = ((frameP * 10) + subframeP) % 10;
else
ra->harq_pid = ((frameP * 10) + subframeP) & 7;
ra->harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
if ((ra->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
@@ -1194,7 +1204,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
UE_id),
rrc_sdu_length);
}
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
}
} // CCE Allocation feasible
} // msg4 frame/subframe
} // else rach_resource_type
@@ -1316,7 +1328,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
ra->rnti, round, frameP, subframeP);
// DLSCH Config
//DJP - fix this pdu_index = -1
LOG_D(MAC, "Panos:D: check_Msg4_retransmission() before fill_nfapi_dlsch_config() with pdu_index = -1 \n");
LOG_D(MAC, "check_Msg4_retransmission() before fill_nfapi_dlsch_config() with pdu_index = -1 \n");
fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize,
-1
/* retransmission, no pdu_index */
@@ -1339,6 +1351,9 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
(cc->p_eNB == 1) ? 1 : 2, // transmission mode
1, // num_bf_prb_per_subband
1); // num_bf_vector
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
}
} else
LOG_D(MAC,
"msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n",
@@ -1355,10 +1370,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
dci_dl_pdu_rel8.cce_idx);
// prepare frame for retransmission
if (ra->Msg4_subframe > 1)
ra->Msg4_frame++;
ra->Msg4_frame &= 1023;
ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
get_retransmission_timing(mac->common_channels[CC_idP].tdd_Config,&ra->Msg4_frame,&ra->Msg4_subframe);
LOG_W(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n",
@@ -1376,6 +1388,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
UE_id = find_UE_id(module_idP, ra->rnti);
DevAssert(UE_id != -1);
mac->UE_list.UE_template[UE_PCCID(module_idP, UE_id)][UE_id].configured = TRUE;
cancel_ra_proc(module_idP, CC_idP, frameP, ra->rnti);
}
}
@@ -1406,7 +1419,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
if (ra->state == MSG2)
generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == MSG4)
else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == WAITMSG4ACK)
check_Msg4_retransmission(module_idP, CC_id, frameP,
@@ -1442,6 +1455,8 @@ initiate_ra_proc(module_id_t module_idP,
struct PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
static uint8_t failure_cnt = 0;
if (cc->radioResourceConfigCommon_BR
&& cc->radioResourceConfigCommon_BR->ext4) {
@@ -1494,11 +1509,22 @@ initiate_ra_proc(module_id_t module_idP,
ra[i].msg4_mpdcch_repetition_cnt = 0;
#endif
// DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
if (nfapi_mode)
offset = 7;
else
offset = 5;
//TODO Fill in other TDD config. What about nfapi_mode?
if(cc->tdd_Config!=NULL){
switch(cc->tdd_Config->subframeAssignment){
default: printf("%s:%d: TODO\n", __FILE__, __LINE__); abort();
case 1 :
offset = 6;
break;
}
}else{//FDD
// DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
if (nfapi_mode)
offset = 7;
else
offset = 5;
}
add_subframe(&msg2_frame, &msg2_subframe, offset);
@@ -1545,6 +1571,7 @@ initiate_ra_proc(module_id_t module_idP,
}
ra[i].RA_rnti = ra_rnti;
ra[i].preamble_index = preamble_index;
failure_cnt = 0;
LOG_D(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, state %d\n",
module_idP, CC_id, frameP, ra[i].Msg2_frame,
@@ -1557,6 +1584,13 @@ initiate_ra_proc(module_id_t module_idP,
LOG_E(MAC,
"[eNB %d][RAPROC] FAILURE: CC_id %d Frame %d Initiating RA procedure for preamble index %d\n",
module_idP, CC_id, frameP, preamble_index);
failure_cnt++;
if(failure_cnt > 20) {
LOG_E(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information\n", module_idP, CC_id, frameP);
clear_ra_proc(module_idP, CC_id, frameP);
}
}
void
@@ -1579,6 +1613,22 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
ra[i].RRC_timer = 20;
ra[i].rnti = 0;
ra[i].msg3_round = 0;
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Canceled RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti);
}
}
}
void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP)
{
unsigned char i;
RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0];
for (i = 0; i < NB_RA_PROC_MAX; i++) {
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti);
ra[i].state = IDLE;
ra[i].timing_offset = 0;
ra[i].RRC_timer = 20;
ra[i].rnti = 0;
ra[i].msg3_round = 0;
}
}
+86 -76
View File
@@ -368,21 +368,23 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
case 1:
switch (subframeP) {
case 0:
case 1:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI;
break;
case 4:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI;
break;
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI;
break;
case 5:
case 6:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
break;
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
break;
case 9:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
break;
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
break;
}
case 2:
@@ -595,12 +597,6 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
int header_length_last;
int header_length_total;
#if 0
if (UE_list->head == -1) {
return;
}
#endif
start_meas(&eNB->schedule_dlsch);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
@@ -632,8 +628,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
break;
case 6:
case 7:
if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4)
&& (tdd_sfa != 5))
if ((tdd_sfa != 3) && (tdd_sfa != 4) && (tdd_sfa != 5))
return;
break;
case 8:
@@ -642,8 +637,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
return;
break;
case 9:
if ((tdd_sfa != 1) && (tdd_sfa != 3) && (tdd_sfa != 4)
&& (tdd_sfa != 6))
if (tdd_sfa == 0)
return;
break;
@@ -761,19 +755,10 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
CC_id, UE_id, subframeP, S_DL_NONE);
continue;
}
#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
#if 0
/* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
/* if we don't add it, next allocations may succeed but overall allocations may fail */
/* will be removed at the end of this function */
add_ue_spec_dci(&eNB->common_channels[CC_id].DCI_pdu, &(char[]) {
0}, rnti, 1, aggregation, 1, format1, 0);
#endif
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
if (cc->tdd_Config) harq_pid = ((frameP * 10) + subframeP) % 10;
else harq_pid = ((frameP * 10) + subframeP) & 7;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
round = ue_sched_ctl->round[CC_id][harq_pid];
@@ -832,7 +817,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
if (cc[CC_id].tdd_Config != NULL) {
UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(module_idP, CC_id, rnti,
UE_list->UE_template[CC_id][UE_id].DAI);
UE_list->UE_template[CC_id][UE_id].DAI, subframeP);
LOG_D(MAC,
"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
CC_id, subframeP, UE_id,
@@ -1005,7 +990,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH,
TBS - ta_len - header_length_total - sdu_length_total - 3
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -1020,11 +1005,62 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH,
TBS, //not used
(char *)&dlsch_buffer[0]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
pthread_mutex_lock(&rrc_release_freelist);
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){
uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 3;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 1->3\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
}
}
}
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 4;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
}
}
}
if(release_total >= rrc_release_info.num_UEs)
break;
}
}
pthread_mutex_unlock(&rrc_release_freelist);
RA_t *ra = &eNB->common_channels[CC_id].ra[0];
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) {
if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]){
ra[ra_ii].crnti_harq_pid = harq_pid;
ra[ra_ii].state = MSGCRNTI_ACK;
break;
}
}
}
}
T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP),
T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH),
@@ -1063,7 +1099,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1,
TBS - ta_len - header_length_total - sdu_length_total - 3
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -1079,7 +1115,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1,
TBS, //not used
(char *)&dlsch_buffer[sdu_length_total]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -1134,7 +1170,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
MBMS_FLAG_NO,
lcid,
TBS - ta_len - header_length_total - sdu_length_total - 3
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -1152,7 +1188,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid,
TBS, //not used
(char *)&dlsch_buffer[sdu_length_total]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -1316,12 +1352,6 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
dlsch_buffer, sdu_length_total);
// memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
#if 0
// fill remainder of DLSCH with random data
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char) (taus() & 0xff);
}
#endif
// fill remainder of DLSCH with 0
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
@@ -1368,18 +1398,18 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
if (cc[CC_id].tdd_Config != NULL) { // TDD
UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(module_idP, CC_id, rnti,
UE_list->UE_template[CC_id][UE_id].
DAI);
UE_list->UE_template[CC_id][UE_id].DAI,
subframeP);
}
// do PUCCH power control
// this is the normalized RX power
eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
/* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
normalized_rx_power = ue_sched_ctl->pucch1_snr[CC_id];
target_rx_power = 208;
/* unit is not dBm, it's special from nfapi */
// converting to dBm: ToDo: Noise power hard coded to 30
normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30;
target_rx_power= eNB->puCch10xSnr/10 + 30;
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
@@ -1583,8 +1613,7 @@ fill_DLSCH_dci(module_id_t module_idP,
// clear scheduling flag
eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING;
rnti = UE_RNTI(module_idP, UE_id);
if (cc->tdd_Config) harq_pid = ((frameP * 10) + subframeP) % 10;
else harq_pid = ((frameP * 10) + subframeP) & 7;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
/// Synchronizing rballoc with rballoc_sub
@@ -1663,12 +1692,12 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP,
//------------------------------------------------------------------------------
void
update_ul_dci(module_id_t module_idP,
uint8_t CC_idP, rnti_t rntiP, uint8_t daiP)
uint8_t CC_idP, rnti_t rntiP, uint8_t daiP, sub_frame_t subframe)
//------------------------------------------------------------------------------
{
nfapi_hi_dci0_request_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP];
&RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframe];
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0];
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_idP];
@@ -1677,7 +1706,7 @@ update_ul_dci(module_id_t module_idP,
if (cc->tdd_Config != NULL) { // TDD
for (i = 0;
i <HI_DCI0_req->hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_dci;
i <HI_DCI0_req->hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_hi;
i++) {
if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) &&
@@ -1816,21 +1845,9 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
LOG_D(MAC,"[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n", module_idP, frameP, subframeP, CC_id,i, pcch_sdu_length);
#ifdef FORMAT1C
//NO SIB
if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
(subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
switch (n_rb_dl) {
#if 0
case 6:
n_gap = n_rb_dl/2; /* expect: 3 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));; /* expect: 6 */
first_rb = 0;
break;
case 15:
n_gap = GAP_MAP[2][0]; /* expect: 8 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 14 */
first_rb = 6;
break;
#endif
case 25:
n_gap = GAP_MAP[3][0]; /* expect: 12 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */
@@ -1857,18 +1874,6 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
}
} else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging
switch (n_rb_dl) {
#if 0
case 6:
n_gap = n_rb_dl/2; /* expect: 3 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));; /* expect: 6 */
first_rb = 0;
break;
case 15:
n_gap = GAP_MAP[2][0]; /* expect: 8 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 14 */
first_rb = 10;
break;
#endif
case 25:
n_gap = GAP_MAP[3][0]; /* expect: 12 */
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */
@@ -1935,7 +1940,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
}
#else
//NO SIB
if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
(subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
switch (n_rb_dl) {
case 25:
@@ -2027,6 +2032,10 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP);
dl_req->number_dci++;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
@@ -2067,6 +2076,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
TX_req->num_segments = 1;
TX_req->segments[0].segment_length = pcch_sdu_length;
TX_req->segments[0].segment_data = cc[CC_id].PCCH_pdu.payload;
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
} else {
LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP);
+2 -2
View File
@@ -633,7 +633,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
MTCH,
TBS - header_len_mcch - header_len_msi -
sdu_length_total - header_len_mtch
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -652,7 +652,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES, MTCH, 0, //not used
(char *)
&mch_buffer[sdu_length_total]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
+32 -22
View File
@@ -94,7 +94,7 @@ schedule_ue_spec_phy_test(
nb_rb = conv_nprb(0,rb_alloc,N_RB_DL);
TBS = get_TBS_DL(mcs,nb_rb);
/*LOG_I(MAC,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d harq_pid=%d (rb_alloc=%x, N_RB_DL=%d) pdu_number = %d \n", frameP, subframeP, nb_rb, TBS, mcs, harq_pid, rb_alloc, N_RB_DL, dl_req->number_pdu);*////////////********LOG_D to LOG_I
LOG_D(MAC,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d harq_pid=%d (rb_alloc=%x, N_RB_DL=%d) pdu_number = %d \n", frameP, subframeP, nb_rb, TBS, mcs, harq_pid, rb_alloc, N_RB_DL, dl_req->number_pdu);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
@@ -124,8 +124,8 @@ schedule_ue_spec_phy_test(
LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n",
module_idP,CC_id,harq_pid,dai,mcs);
} else {
/*LOG_I(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n",
module_idP,CC_id,harq_pid,mcs);*////////////********added
LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n",
module_idP,CC_id,harq_pid,mcs);
}
LOG_D(MAC,"Checking feasibility pdu %d (new sdu)\n",dl_req->number_pdu);
@@ -135,7 +135,6 @@ schedule_ue_spec_phy_test(
//ue_sched_ctl->round[CC_id][harq_pid] = 0;
dl_req->number_dci++;
dl_req->number_pdu++;
//LOG_I(MAC,"phy-test DL number of dci = %d pdu = %d \n", dl_req->number_dci, dl_req->number_pdu);////////////********added
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
//eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
@@ -151,7 +150,6 @@ schedule_ue_spec_phy_test(
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated is NULL\n");
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n");
*/
//LOG_I(MAC,"pdu_index = %d \n", eNB->pdu_index[CC_id]);////////////********added
fill_nfapi_dlsch_config(eNB,
@@ -205,25 +203,28 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
int32_t target_rx_power= 178;
int CC_id = 0;
int nb_rb = 96;
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list=&eNB->UE_list;
eNB_MAC_INST *mac = RC.mac[module_idP];
COMMON_channels_t *cc = &mac->common_channels[0];
UE_list_t *UE_list=&mac->UE_list;
UE_TEMPLATE *UE_template;
UE_sched_ctrl *UE_sched_ctrl;
int sched_frame=frameP;
int sched_subframe = (subframeP+4)%10;
uint16_t ul_req_index;
uint8_t dlsch_flag;
if (sched_subframe<subframeP) sched_frame++;
nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id][subframeP];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
//nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[0];;
nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req[CC_id].ul_config_request_body;
nfapi_ul_config_request_body_t *ul_req = &mac->UL_req[CC_id].ul_config_request_body;
eNB->UL_req[CC_id].sfn_sf = (sched_frame<<4) + sched_subframe;
eNB->HI_DCI0_req[CC_id].sfn_sf = (frameP<<4)+subframeP;
//mac->UL_req[CC_id].sfn_sf = (sched_frame<<4) + sched_subframe;
hi_dci0_req->sfn_sf = (frameP << 4) + subframeP;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//rnti = UE_RNTI(module_idP,UE_id);
@@ -237,7 +238,6 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
harq_pid = subframe2harqpid(&cc[CC_id],sched_frame,sched_subframe);
//LOG_I(MAC,"Scheduling for frame %d, subframe %d => harq_pid %d\n",sched_frame,sched_subframe,harq_pid);////////////********added
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->TBS_UL[harq_pid];
@@ -247,7 +247,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
//compute the expected ULSCH RX power (for the stats)
// this is the normalized RX power and this should be constant (regardless of mcs
normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30;
// new transmission
@@ -283,7 +283,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
// save it for a potential retransmission
UE_template->cshift[harq_pid] = cshift;
hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi];
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu);
@@ -300,18 +300,28 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframe];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid;
eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++;
hi_dci0_req_body->number_of_dci++;
ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0;ul_req_index < ul_req->number_of_pdus;ul_req_index++){
if(ul_req->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
dlsch_flag = 1;
LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
break;
}
}
// Add UL_config PDUs
fill_nfapi_ulsch_config_request_rel8(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus],
fill_nfapi_ulsch_config_request_rel8(& ul_req->ul_config_pdu_list[ul_req_index],
cqi_req,
cc,
0,//UE_template->physicalConfigDedicated,
get_tmode(module_idP,CC_id,UE_id),
eNB->ul_handle,
mac->ul_handle,//eNB->ul_handle,
rnti,
first_rb[CC_id], // resource_block_start
nb_rb, // number_of_resource_blocks
@@ -327,9 +337,9 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
0, // n_srs
get_TBS_UL(mcs,nb_rb)
);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus],
fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req_index],
UE_template->rach_resource_type>2 ? 2 : 1,
1, //total_number_of_repetitions
1, //repetition_number
@@ -337,7 +347,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
}
#endif
ul_req->number_of_pdus = 1;
eNB->ul_handle++;
mac->ul_handle++;
+505 -106
View File
@@ -55,8 +55,10 @@
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
extern uint16_t frame_cnt;
#include "common/ran_context.h"
#include "SCHED/sched_common.h"
extern RAN_CONTEXT_t RC;
@@ -555,11 +557,61 @@ int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP)
}
}
int is_S_sf(COMMON_channels_t * ccP, sub_frame_t subframeP)
{
// if FDD return dummy value
if (ccP->tdd_Config == NULL)
return (0);
switch (subframeP) {
case 1:
return (1);
break;
case 6:
if(ccP->tdd_Config->subframeAssignment == 0 || ccP->tdd_Config->subframeAssignment == 1
|| ccP->tdd_Config->subframeAssignment == 2 || ccP->tdd_Config->subframeAssignment == 6)
return (1);
break;
default:
return (0);
break;
}
return 0;
}
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe){
if(cc->tdd_Config){//TODO fill other tdd config
switch(cc->tdd_Config->subframeAssignment){
case 0:
break;
case 1:
if(ul_subframe == 2 || ul_subframe == 7)
return 4;
else if(ul_subframe == 3 || ul_subframe == 8)
return 6;
else return 255;
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
}
return 4; //idk sf_ahead?
}
uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
{
uint16_t sf, f, nextf;
if (cc->tdd_Config == NULL) { //FDD n+4
if (cc->tdd_Config == NULL) { //FDD n+4
return ((dlsch_absSF + 4) % 10240);
} else {
sf = dlsch_absSF % 10;
@@ -568,72 +620,93 @@ uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
switch (cc->tdd_Config->subframeAssignment) {
case 0:
AssertFatal(1 == 0, "SFA 0 to be filled in now, :-)\n");
if ((sf == 0) || (sf == 5))
return ((10 * f) + sf + 4)% 10240; // ACK/NAK in SF 4,9 same frame
else if (sf == 6)
return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 1)
return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 0\n",
sf);
break;
case 1:
if ((sf == 5) || (sf == 6))
return ((10 * nextf) + 2); // ACK/NAK in SF 2 next frame
return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 9)
return ((10 * nextf) + 3); // ACK/NAK in SF 3 next frame
return ((10 * nextf) + 3)% 10240; // ACK/NAK in SF 3 next frame
else if ((sf == 0) || (sf == 1))
return ((10 * f) + 2); // ACK/NAK in SF 7 same frame
return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else if (sf == 4)
return ((10 * f) + 8)% 10240; // ACK/NAK in SF 8 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n",
sf);
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 1\n",
sf);
break;
case 2:
if ((sf == 4) || (sf == 5) || (sf == 6) || (sf == 8))
return ((10 * nextf) + 2); // ACK/NAK in SF 2 next frame
return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 9)
return ((10 * nextf) + 7); // ACK/NAK in SF 7 next frame
return ((10 * nextf) + 7)% 10240; // ACK/NAK in SF 7 next frame
else if ((sf == 0) || (sf == 1) || (sf == 3))
return ((10 * f) + 7); // ACK/NAK in SF 7 same frame
return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n",
sf);
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 2\n",
sf);
break;
case 3:
if ((sf == 5) || (sf == 6) || (sf == 7) || (sf == 8)
|| (sf == 9))
return ((10 * nextf) + (sf >> 1)); // ACK/NAK in 2,3,4 resp. next frame
|| (sf == 9))
return ((10 * nextf) + ((sf-1) >> 1))% 10240; // ACK/NAK in 2,3,4 resp. next frame
else if (sf == 1)
return ((10 * nextf) + 2); // ACK/NAK in 2 next frame
return ((10 * nextf) + 2)% 10240; // ACK/NAK in 2 next frame
else if (sf == 0)
return ((10 * f) + 4); // ACK/NAK in 4 same frame
return ((10 * f) + 4)% 10240; // ACK/NAK in 4 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n",
sf);
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n",
sf);
break;
case 4:
if ((sf == 6) || (sf == 7) || (sf == 8) || (sf == 9))
return (((10 * nextf) + 3) % 10240); // ACK/NAK in SF 3 next frame
return (((10 * nextf) + 3) % 10240); // ACK/NAK in SF 3 next frame
else if ((sf == 0) || (sf == 1) || (sf == 4) || (sf == 5))
return (((10 * nextf) + 2) % 10240); // ACK/NAK in SF 2 next frame
return (((10 * nextf) + 2) % 10240); // ACK/NAK in SF 2 next frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 4\n",
sf);
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 4\n",
sf);
break;
case 5:
if ((sf == 0) || (sf == 1) || (sf == 3) || (sf == 4)
|| (sf == 5) || (sf == 6) || (sf == 7) || (sf == 8))
return (((10 * nextf) + 2) % 10240); // ACK/NAK in SF 3 next frame
|| (sf == 5) || (sf == 6) || (sf == 7) || (sf == 8))
return (((10 * nextf) + 2) % 10240); // ACK/NAK in SF 3 next frame
else if (sf == 9)
return (((10 * (1 + nextf)) + 2) % 10240); // ACK/NAK in SF 2 next frame
return (((10 * (1 + nextf)) + 2) % 10240); // ACK/NAK in SF 2 next frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 5\n",
sf);
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 5\n",
sf);
break;
case 6:
AssertFatal(1 == 0, "SFA 6 To be filled in now, :-)\n");
if ((sf == 5) || (sf == 6))
return ((10 * f) + sf + 7)% 10240; // ACK/NAK in SF 2,3 next frame
else if (sf == 9)
return ((10 * nextf) + 4)% 10240; // ACK/NAK in SF 4 next frame
else if ((sf == 1) || (sf == 0))
return ((10 * f) + sf + 7)% 10240; // ACK/NAK in SF 7 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 6\n",
sf);
break;
default:
AssertFatal(1 == 0, "Illegal TDD subframe Assigment %d\n",
(int) cc->tdd_Config->subframeAssignment);
(int) cc->tdd_Config->subframeAssignment);
break;
}
}
@@ -1156,7 +1229,7 @@ program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
}
}
if (ulsch_harq_information) fill_nfapi_ulsch_harq_information(module_idP, CC_idP, rnti, ulsch_harq_information);
if (ulsch_harq_information) fill_nfapi_ulsch_harq_information(module_idP, CC_idP, rnti, ulsch_harq_information, subframeP);
if (harq_information) fill_nfapi_harq_information(module_idP, CC_idP,
rnti,
@@ -1164,9 +1237,9 @@ program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
harq_information, cce_idx);
}
uint8_t get_V_UL_DAI(module_id_t module_idP, int CC_idP, uint16_t rntiP)
uint8_t get_V_UL_DAI(module_id_t module_idP, int CC_idP, uint16_t rntiP,sub_frame_t subframeP)
{
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframeP].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[0];
for (int i = 0; i < HI_DCI0_req->number_of_dci; i++) {
@@ -1181,7 +1254,8 @@ void
fill_nfapi_ulsch_harq_information(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information *harq_information)
nfapi_ul_config_ulsch_harq_information *harq_information,
sub_frame_t subframeP)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
@@ -1232,7 +1306,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
harq_information->harq_information_rel10.harq_size = 1;
else {
if (harq_information->harq_information_rel10.ack_nack_mode == 1)
harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP);
harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP, subframeP);
else
harq_information->harq_information_rel10.harq_size = 1;
}
@@ -1242,7 +1316,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
harq_information->harq_information_rel10.harq_size = 2;
} else {
if (harq_information->harq_information_rel10.ack_nack_mode == 1)
harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP);
harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP, subframeP);
else
harq_information->harq_information_rel10.harq_size = 2;
}
@@ -1250,6 +1324,26 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
} // get Tmode
}
uint8_t Np[6][4]= {{0,1,3,5},
{0,3,8,13},
{0,5,13,22},
{0,11,27,44},
{0,16,41,66},
{0,22,55,88}};
// This is part of the PUCCH allocation procedure (see Section 10.1 36.213)
uint16_t getNp(int dl_Bandwidth,uint8_t nCCE,uint8_t plus1)
{
AssertFatal(dl_Bandwidth<6,"dl_Bandwidth %d>5\n",dl_Bandwidth);
if (nCCE>=Np[dl_Bandwidth][2])
return(Np[dl_Bandwidth][2+plus1]);
else if (nCCE>=Np[dl_Bandwidth][1])
return(Np[dl_Bandwidth][1+plus1]);
else
return(Np[dl_Bandwidth][0+plus1]);
}
void
fill_nfapi_harq_information(module_id_t module_idP,
int CC_idP,
@@ -1266,13 +1360,6 @@ fill_nfapi_harq_information(module_id_t module_idP,
AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
AssertFatal(UE_list != NULL, "UE_list is null\n");
#if 0
/* TODO: revisit, don't use Assert, it's perfectly possible to
* have physicalConfigDedicated NULL here
*/
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
"physicalConfigDedicated for rnti %x is null\n", rntiP);
#endif
harq_information->harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
harq_information->harq_information_rel11.num_ant_ports = 1;
@@ -1284,19 +1371,22 @@ fill_nfapi_harq_information(module_id_t module_idP,
case 6:
case 7:
if (cc->tdd_Config != NULL) {
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
"pucch_ConfigDedicated is null for TDD!\n");
if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
// AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
// "pucch_ConfigDedicated is null for TDD!\n");
if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL
&& UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL
&& (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
&& (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing))
{
harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK
harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing
} else {
harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK
harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling
{
harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK
harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing
} else {
harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK
harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling
}
harq_information->harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
harq_information->harq_information_rel10_tdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
harq_information->harq_information_rel10_tdd.n_pucch_1_0 = getNp(cc->mib->message.dl_Bandwidth,cce_idxP,0) +
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1;
} else {
harq_information->harq_information_rel9_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
@@ -1374,7 +1464,7 @@ void
fill_nfapi_dlsch_config(eNB_MAC_INST * eNB,
nfapi_dl_config_request_body_t * dl_req,
uint16_t length,
uint16_t pdu_index,
int16_t pdu_index,
uint16_t rnti,
uint8_t resource_allocation_type,
uint8_t
@@ -1434,7 +1524,7 @@ uint16_t
fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,
uint16_t absSF,
uint16_t pdu_length,
uint16_t pdu_index,
int16_t pdu_index,
uint8_t *pdu)
{
nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
@@ -1485,7 +1575,8 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pd
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = number_of_resource_blocks;
if (mcs < 11) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2;
else if (mcs < 21) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 4;
else ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 6;
else if(mcs < 29) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 6;
else ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = cyclic_shift_2_for_drms;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = frequency_hopping_enabled_flag;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = frequency_hopping_bits;
@@ -1902,7 +1993,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP)
//------------------------------------------------------------------------------
{
int i;
int j;
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
int UE_id = find_UE_id(mod_idP,rntiP);
@@ -1967,17 +2057,30 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP)
eNB_dlsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
// check if this has an RA process active
RA_t *ra;
for (i = 0; i < NB_RA_PROC_MAX; i++) {
ra = (RA_t *) & RC.mac[mod_idP]->common_channels[pCC_id].ra[i];
if (ra->rnti == rntiP) {
ra->state = IDLE;
ra->timing_offset = 0;
ra->RRC_timer = 20;
ra->rnti = 0;
//break;
if(find_RA_id(mod_idP, pCC_id, rntiP) != -1) {
cancel_ra_proc(mod_idP, pCC_id, 0, rntiP);
}
pthread_mutex_lock(&rrc_release_freelist);
if(rrc_release_info.num_UEs > 0){
uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rntiP){
rrc_release_info.RRC_release_ctrl[release_num].flag = 0;
rrc_release_info.num_UEs--;
release_total--;
}
if(release_total >= rrc_release_info.num_UEs){
break;
}
}
}
pthread_mutex_unlock(&rrc_release_freelist);
return 0;
}
@@ -2766,13 +2869,13 @@ get_nCCE_max(COMMON_channels_t * cc, int num_pdcch_symbols, int subframe)
// Allocate the CCEs
int
allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, int test_onlyP)
{
int *CCE_table = RC.mac[module_idP]->CCE_table[CC_idP];
nfapi_dl_config_request_body_t *DL_req =
&RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
nfapi_hi_dci0_request_body_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
&RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframeP].hi_dci0_request_body;
nfapi_dl_config_request_pdu_t *dl_config_pdu =
&DL_req->dl_config_pdu_list[0];
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
@@ -2783,6 +2886,17 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
int fCCE;
int i, j, idci;
int nCCE = 0;
int max_symbol;
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
int ackNAK_absSF = get_pucch1_absSF(cc, (frameP*10+subframeP));
if (cc->tdd_Config!=NULL && is_S_sf(cc,subframeP) > 0)
max_symbol = 2;
else
max_symbol = 3;
nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body;
LOG_D(MAC,
"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",
@@ -2811,7 +2925,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
if (nCCE +
(dl_config_pdu[i].dci_dl_pdu.
dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3)
if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed;
LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -2833,7 +2947,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP);
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n",
subframeP,
@@ -2876,7 +2990,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
// the allocation is feasible, rnti rule passes
nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level;
LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
if (test_onlyP == 0) {
if ((test_onlyP%2) == 0) {
dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
LOG_D(MAC,
"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",
@@ -2904,7 +3018,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
nCCE, nCCE_max, DL_req->number_pdcch_ofdm_symbols);
if (nCCE + (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level) > nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3)
if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed;
LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -2925,7 +3039,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.
rnti, subframeP);
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n",
subframeP,
@@ -2965,7 +3079,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
// the allocation is feasible, rnti rule passes
nCCE += hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level;
LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
if (test_onlyP == 0) {
if ((test_onlyP%2) == 0) {
hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.cce_index = fCCE;
LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
subframeP, test_onlyP);
@@ -2989,7 +3103,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
DL_req->number_pdcch_ofdm_symbols);
if (nCCE + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3)
if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed;
LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -3007,7 +3121,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP);
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_I(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n",
subframeP,
@@ -3015,7 +3129,7 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
rnti);
for (j = 0; j <= i; j++) {
if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
LOG_I(MAC,
LOG_D(MAC,
"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
j,
DL_req->number_dci + HI_DCI0_req->number_of_dci,
@@ -3047,11 +3161,25 @@ allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
// the allocation is feasible, rnti rule passes
nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level;
LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
if (test_onlyP == 0) {
if ((test_onlyP%2) == 0) {
dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
subframeP, test_onlyP);
}
if ((test_onlyP/2) == 1) {
for(int ack_int = 0;ack_int < ul_req->number_of_pdus; ack_int++){
if(((ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) ||
(ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)) &&
(ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.ue_information.ue_information_rel8.rnti == dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti)){
if (cc->tdd_Config==NULL)
ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 =
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + fCCE;
else
ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.harq_information.harq_information_rel10_tdd.n_pucch_1_0 =
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + fCCE + getNp(cc->mib->message.dl_Bandwidth,fCCE,0) ;
}
}
}
idci++;
}
} // for i = 0 ... num_DL_DCIs
@@ -3134,7 +3262,7 @@ CCE_allocation_infeasible(int module_idP,
{
nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
nfapi_dl_config_request_pdu_t *dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu];
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframe].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi];
int ret;
boolean_t res = FALSE;
@@ -3158,7 +3286,7 @@ CCE_allocation_infeasible(int module_idP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
aggregation_level,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type);
ret = allocate_CCEs(module_idP, CC_idP, subframe, 0);
ret = allocate_CCEs(module_idP, CC_idP, 0, subframe, 0);
if (ret == -1) res = TRUE;
DL_req->number_pdu--;
}
@@ -3173,7 +3301,7 @@ CCE_allocation_infeasible(int module_idP,
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
HI_DCI0_req->number_of_dci++;
ret = allocate_CCEs(module_idP, CC_idP, subframe, 0);
ret = allocate_CCEs(module_idP, CC_idP, 0, subframe, 0);
if (ret == -1) res = TRUE;
HI_DCI0_req->number_of_dci--;
}
@@ -3181,6 +3309,204 @@ CCE_allocation_infeasible(int module_idP,
return res;
}
void get_retransmission_timing(TDD_Config_t *tdd_Config, frame_t *frameP,
sub_frame_t *subframeP)
{
if (tdd_Config == NULL)
{
if (*subframeP > 1)
*frameP = (*frameP + 1) % 1024;
*subframeP = (*subframeP + 8) % 10;
}
else
{
switch (tdd_Config->subframeAssignment)//TODO fill in other TDD configs
{
default: printf("%s:%d: TODO\n", __FILE__, __LINE__); abort();
case 1:
if (*subframeP == 0 || *subframeP == 5)
{
*subframeP += 19;
*frameP = (*frameP + *subframeP/10) % 1024;
*subframeP %= 10;
}
else if (*subframeP == 4 || *subframeP == 9)
{
*subframeP += 16;
*frameP = (*frameP + *subframeP/10) % 1024;
*subframeP %= 10;
}
else
{
AssertFatal(2 == 1,
"Illegal dl subframe %d for tdd config %ld\n", *subframeP,
tdd_Config->subframeAssignment);
}
break;
}
}
}
uint8_t get_dl_subframe_count(int tdd_config_sfa, sub_frame_t subframeP){
uint8_t tdd1[10] = {1,-1,-1,-1,2,3,-1,-1,-1,4}; // special subframes 1,6 are excluded
switch(tdd_config_sfa){// TODO fill in other tdd configs
case 1 :
return tdd1[subframeP];
break;
}
return -1;
}
uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP){
int harq_pid;
if(tdd_Config){
switch(tdd_Config->subframeAssignment){ //TODO fill in other tdd config
case 1:
harq_pid = (((frame_cnt*1024 + abs_frameP) * 4) - 1 + get_dl_subframe_count(tdd_Config->subframeAssignment,subframeP))%7;//4 dl subframe in a frame
if(harq_pid < 0)
harq_pid += 7;
LOG_D(MAC,"[frame_subframe2_dl_harq_pid] (%d,%d) calculate harq_pid ((( %d * 1024 + %d) *4) - 1 + %d) = %d \n",
(abs_frameP+1024)%1024,subframeP,frame_cnt,abs_frameP,
get_dl_subframe_count(tdd_Config->subframeAssignment,subframeP),harq_pid);
return harq_pid;
break;
}
}else{
return ((abs_frameP*10)+subframeP)&7;
}
return -1;
}
unsigned char ul_ACK_subframe2M(TDD_Config_t *tdd_Config,unsigned char subframe)
{
if (tdd_Config == NULL) {
return(1);
} else {
switch (tdd_Config->subframeAssignment) {
case 1:
return 1; // don't ACK special subframe for now
if (subframe == 2) { // ACK subframes 5 and 6
return(2);
} else if (subframe == 3) { // ACK subframe 9
return(1); // To be updated
} else if (subframe == 7) { // ACK subframes 0 and 1
return(2); // To be updated
} else if (subframe == 8) { // ACK subframe 4
return(1); // To be updated
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
case 3:
if (subframe == 2) { // ACK subframes 5 and 6
return(2); // should be 3
} else if (subframe == 3) { // ACK subframes 7 and 8
return(2); // To be updated
} else if (subframe == 4) { // ACK subframes 9 and 0
return(2);
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
case 4:
if (subframe == 2) { // ACK subframes 0,4 and 5
return(3); // should be 4
} else if (subframe == 3) { // ACK subframes 6,7,8 and 9
return(4);
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
case 5:
if (subframe == 2) { // ACK subframes 0,3,4,5,6,7,8 and 9
return(8); // should be 3
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
}
}
return(0);
}
unsigned char ul_ACK_subframe2dl_subframe(TDD_Config_t *tdd_Config,unsigned char subframe,unsigned char ACK_index)
{
if (tdd_Config == NULL) {
return((subframe<4) ? subframe+6 : subframe-4);
} else {
switch (tdd_Config->subframeAssignment) {
case 3:
if (subframe == 2) { // ACK subframes 5 and 6
if (ACK_index==2)
return(1);
return(5+ACK_index);
} else if (subframe == 3) { // ACK subframes 7 and 8
return(7+ACK_index); // To be updated
} else if (subframe == 4) { // ACK subframes 9 and 0
return((9+ACK_index)%10);
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config->subframeAssignment %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
case 4:
if (subframe == 2) { // ACK subframes 0, 4 and 5
//if (ACK_index==2)
// return(1); TBC
if (ACK_index==2)
return(0);
return(4+ACK_index);
} else if (subframe == 3) { // ACK subframes 6, 7 8 and 9
return(6+ACK_index); // To be updated
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
case 1:
if (subframe == 2) { // ACK subframes 5 and 6
return(5+ACK_index);
} else if (subframe == 3) { // ACK subframe 9
return(9); // To be updated
} else if (subframe == 7) { // ACK subframes 0 and 1
return(ACK_index); // To be updated
} else if (subframe == 8) { // ACK subframe 4
return(4); // To be updated
} else {
AssertFatal(1==0,"illegal subframe %d for tdd_config %d\n",
subframe,tdd_Config->subframeAssignment);
}
break;
}
}
return(0);
}
void
extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
@@ -3198,9 +3524,12 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
int pCCid = UE_list->pCC_id[UE_id];
int spatial_bundling = 0;
int tmode[5];
int i, j;
int i, j, m;
uint8_t *pdu;
sub_frame_t subframe_tx;
int frame_tx;
uint8_t harq_pid;
#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0))
if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL &&
UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL &&
@@ -3211,21 +3540,66 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
&& (format == 1))))
spatial_bundling = 1;
#endif
for (i = 0; i < numCC; i++)
tmode[i] = get_tmode(mod_idP, i, UE_id);
if (cc->tdd_Config) {
harq_indication_tdd = (nfapi_harq_indication_tdd_rel13_t *) harq_indication;
// pdu = &harq_indication_tdd->harq_tb_n[0];
num_ack_nak = harq_indication_tdd->number_of_ack_nack;
switch (harq_indication_tdd->mode) {
case 0: // Format 1a/b
AssertFatal(numCC == 1,
"numCC %d > 1, should not be using Format1a/b\n",
numCC);
case 0: // Format 1a/b bundling
AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n", numCC);
int M = ul_ACK_subframe2M(cc->tdd_Config,subframeP);
for(m=0;m<M;m++){
subframe_tx = ul_ACK_subframe2dl_subframe(cc->tdd_Config,subframeP,m);
if(frameP==1023&&subframeP>5)
frame_tx=-1;
else
frame_tx = subframeP < 4 ? frameP -1 : frameP;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
if(num_ack_nak==1){
if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
}else{ //nack
if( sched_ctl->round[CC_idP][harq_pid]<8) sched_ctl->round[CC_idP][harq_pid]++;
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
}
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}else{
if(sched_ctl->round[CC_idP][harq_pid] == 7){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}
}
break;
}
}
}
break;
case 1: // Channel Selection
break;
@@ -3241,7 +3615,7 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
num_ack_nak = harq_indication_fdd->number_of_ack_nack;
pdu = &harq_indication_fdd->harq_tb_n[0];
uint8_t harq_pid = ((10 * frameP) + subframeP + 10236) & 7;
harq_pid = ((10 * frameP) + subframeP + 10236) & 7;
LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]);
@@ -3265,6 +3639,22 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
LOG_D(MAC, "Received %d for harq_pid %d\n", pdu[0],
harq_pid);
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) &&
(ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",pdu[0],rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
if(pdu[0] == 1){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}else{
if(sched_ctl->round[CC_idP][harq_pid] == 7){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}
}
break;
}
}
if (pdu[0] == 1) { // ACK
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
@@ -3274,6 +3664,16 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
if (sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
} else {
// one or two ACK/NAK bits
@@ -4011,6 +4411,10 @@ cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
extract_pusch_csi(mod_idP, CC_idP, UE_id, frameP, subframeP,
pdu, rel9->length);
LOG_D(MAC,"Frame %d Subframe %d update CQI:%d\n",frameP,subframeP,sched_ctl->dl_cqi[CC_idP]);
sched_ctl->cqi_req_flag &= (~(1 << subframeP));
sched_ctl->cqi_received = 1;
}
// timing advance
@@ -4036,14 +4440,6 @@ SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP,
"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",
mod_idP, rntiP, frameP, subframeP, UE_id, cc_idP);
#if 0
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
/* for the moment don't use ul_cqi from SR, value is too different from harq */
sched_ctl->pucch1_snr[cc_idP] = ul_cqi;
sched_ctl->pucch1_cqi_update[cc_idP] = 1;
#endif
UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
@@ -4089,8 +4485,11 @@ static int nack_or_dtx_reported(
int i;
if (cc->tdd_Config) {
AssertFatal(0==1, "TDD to be done. FAPI structures (see nfapi_harq_indication_tdd_rel13_t) are not clean. To be cleaned as well?\n");
abort();
nfapi_harq_indication_tdd_rel13_t *hi = &harq_pdu->harq_indication_tdd_rel13;
for (i = 0; i < hi->number_of_ack_nack; hi++)
if (hi->harq_data[0].bundling.value_0 != 1) //only bundling is used for tdd for now
return 1;
return 0;
} else {
nfapi_harq_indication_fdd_rel13_t *hi = &harq_pdu->harq_indication_fdd_rel13;
for (i = 0; i < hi->number_of_ack_nack; hi++)
+204 -96
View File
@@ -107,6 +107,7 @@ char *ul_scheduler_type[MAX_NUM_SLICES] = {"schedule_ulsch_rnti",
"schedule_ulsch_rnti",
"schedule_ulsch_rnti"
};
extern mui_t rrc_eNB_mui;
/* Slice Function Pointer */
slice_scheduler_ul slice_sched_ul[MAX_NUM_SLICES] = {0};
@@ -157,8 +158,8 @@ rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1) {
LOG_D(MAC,
"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
enb_mod_idP, harq_pid, CC_idP,
"[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
enb_mod_idP, harq_pid, CC_idP,frameP,subframeP,
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
current_rnti, UE_id, ul_cqi);
@@ -190,12 +191,16 @@ rx_sdu(const module_id_t enb_mod_idP,
if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0)
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
} else { // we've got an error
LOG_D(MAC,
"[eNB %d][PUSCH %d] CC_id %d ULSCH in error in round %d, ul_cqi %d\n",
enb_mod_idP, harq_pid, CC_idP,
LOG_I(MAC,
"[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d\n",
enb_mod_idP, harq_pid, CC_idP,frameP,subframeP,
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
ul_cqi);
if(ul_cqi>200){ // too high energy pattern
UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi;
}
// AssertFatal(1==0,"ulsch in error\n");
if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) {
UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid));
@@ -207,6 +212,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid];
if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0)
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
if (find_RA_id(enb_mod_idP, CC_idP, current_rnti) != -1)
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
} else
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
@@ -216,7 +224,9 @@ rx_sdu(const module_id_t enb_mod_idP,
LOG_D(MAC,
"Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n",
current_rnti, harq_pid, first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP];
nfapi_hi_dci0_request_t *hi_dci0_req;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
@@ -230,7 +240,7 @@ rx_sdu(const module_id_t enb_mod_idP,
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4);
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
return;
@@ -260,7 +270,7 @@ rx_sdu(const module_id_t enb_mod_idP,
(int) mac->common_channels[CC_idP].
radioResourceConfigCommon->rach_ConfigCommon.
maxHARQ_Msg3Tx);
if (ra[RA_id].msg3_round == mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
}
@@ -268,8 +278,9 @@ rx_sdu(const module_id_t enb_mod_idP,
first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
ra[RA_id].msg3_round++;
// prepare handling of retransmission
ra[RA_id].Msg3_frame = (ra[RA_id].Msg3_frame + ((ra[RA_id].Msg3_subframe > 1) ? 1 : 0)) % 1024;
ra[RA_id].Msg3_subframe = (ra[RA_id].Msg3_subframe + 8) % 10;
get_Msg3allocret(&mac->common_channels[CC_idP],
ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame,
&ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe);
add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP);
}
@@ -278,13 +289,19 @@ rx_sdu(const module_id_t enb_mod_idP,
return;
}
} else {
LOG_D(MAC,
LOG_W(MAC,
"Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n",
current_rnti);////////////******** LOG_W into LOG_D
current_rnti);
return;
}
payload_ptr = parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths, sdu_lenP);
if(payload_ptr == NULL){
LOG_E(MAC,"[eNB %d][PUSCH %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n",
enb_mod_idP, harq_pid, CC_idP,current_rnti, UE_id);
return;
}
T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP),
T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu));
@@ -332,8 +349,8 @@ rx_sdu(const module_id_t enb_mod_idP,
enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i,
num_ce, old_rnti, old_UE_id);
/* receiving CRNTI means that the current rnti has to go away */
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
current_rnti);
//cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
// current_rnti);
if (old_UE_id != -1) {
/* TODO: if the UE did random access (followed by a MAC uplink with
* CRNTI) because none of its scheduling request was granted, then
@@ -346,16 +363,45 @@ rx_sdu(const module_id_t enb_mod_idP,
* We have to take care of this. As the code is, nothing is done and
* the UE state in the eNB is wrong.
*/
UE_id = old_UE_id;
UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0;
mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
subframeP, old_rnti);
}
current_rnti = old_rnti;
}
for (ii = 0; ii < NB_RA_PROC_MAX; ii++) {
ra = &mac->common_channels[CC_idP].ra[ii];
if ((ra->rnti == current_rnti) && (ra->state != IDLE)) {
mac_rrc_data_ind(enb_mod_idP,
CC_idP,
frameP, subframeP,
old_rnti,
DCCH,
(uint8_t *) payload_ptr,
rx_lengths[i],
0);
// prepare transmission of Msg4(RRCConnectionReconfiguration)
ra->state = MSGCRNTI;
LOG_I(MAC,
"[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) RRCConnectionReconfiguration(Msg4)\n",
enb_mod_idP, frameP, subframeP, CC_idP, old_rnti, old_UE_id);
UE_id = old_UE_id;
current_rnti = old_rnti;
ra->rnti = old_rnti;
ra->crnti_rrc_mui = rrc_eNB_mui-1;
ra->crnti_harq_pid = -1;
//clear timer
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0;
mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
subframeP, old_rnti);
}
UE_list->UE_template[CC_idP][UE_id].ul_SR = 1;
UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 1;
break;
}
}
} else {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti);
}
crnti_rx = 1;
payload_ptr += 2;
break;
@@ -550,8 +596,9 @@ rx_sdu(const module_id_t enb_mod_idP,
ra[ii].rach_resource_type
#endif
)) == -1) {
AssertFatal(1 == 0,
"[MAC][eNB] Max user count reached\n");
LOG_E(MAC,"[MAC][eNB] Max user count reached\n");
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti);
break;
// kill RA procedure
} else
LOG_D(MAC,
@@ -584,10 +631,22 @@ rx_sdu(const module_id_t enb_mod_idP,
// Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different
ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
ra->Msg4_subframe = (subframeP + 4) % 10;
if(mac->common_channels[CC_idP].tdd_Config!=NULL){
switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment){
case 1:
ra->Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0);
ra->Msg4_subframe = (subframeP + 7) % 10;
break;
default: printf("%s:%d: TODO\n", __FILE__, __LINE__); abort();
// TODO need to be complete for other tdd configs.
}
}else{
// Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different
ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
ra->Msg4_subframe = (subframeP + 4) % 10;
}
UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0;
} // if process is active
} // loop on RA processes
@@ -714,7 +773,10 @@ rx_sdu(const module_id_t enb_mod_idP,
LOG_D(MAC,
"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",
current_rnti, harq_pid, first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP];
nfapi_hi_dci0_request_t *hi_dci0_req;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
@@ -728,7 +790,7 @@ rx_sdu(const module_id_t enb_mod_idP,
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4);
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
/* NN--> FK: we could either check the payload, or use a phy helper to detect a false msg3 */
@@ -848,7 +910,8 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
ce_len++;
} else {
LOG_E(MAC, "unknown CE %d \n", lcid);
AssertFatal(1 == 0, "unknown CE");
//AssertFatal(1 == 0, "unknown CE");
return NULL;
}
}
}
@@ -895,6 +958,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
start_meas(&mac->schedule_ulsch);
int sched_frame=frameP;
int sched_subframe = (subframeP + 4) % 10;
cc = &mac->common_channels[0];
@@ -904,8 +968,10 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
tdd_sfa = cc->tdd_Config->subframeAssignment;
switch (subframeP) {
case 0:
if ((tdd_sfa == 0) || (tdd_sfa == 3) || (tdd_sfa == 6))
if ((tdd_sfa == 0) || (tdd_sfa == 3))
sched_subframe = 4;
else if (tdd_sfa == 6)
sched_subframe = 7;
else
return;
break;
@@ -914,6 +980,8 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
sched_subframe = 7;
else if (tdd_sfa == 6)
sched_subframe = 8;
else
return;
break;
default:
return;
@@ -936,12 +1004,12 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
if (tdd_sfa == 0)
sched_subframe = 9;
else if (tdd_sfa == 6)
sched_subframe = 3;
sched_subframe = 2;
else
return;
break;
case 6:
if (tdd_sfa == 1)
if (tdd_sfa == 0 || tdd_sfa == 1)
sched_subframe = 2;
else if (tdd_sfa == 6)
sched_subframe = 3;
@@ -951,21 +1019,23 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
case 7:
return;
case 8:
if ((tdd_sfa >= 2) || (tdd_sfa <= 5))
sched_subframe = 2;
if ((tdd_sfa >= 2) && (tdd_sfa <= 5))
sched_subframe = 2;
else
return;
return;
break;
case 9:
if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4))
sched_subframe = 3;
sched_subframe = 3;
else if (tdd_sfa == 6)
sched_subframe = 4;
sched_subframe = 4;
else
return;
return;
break;
}
}
if (sched_subframe < subframeP) sched_frame++;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
@@ -1112,8 +1182,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
uint8_t status = 0;
uint8_t rb_table_index = -1;
uint32_t cqi_req, cshift, ndi, tpc;
int32_t normalized_rx_power;
int32_t target_rx_power = -90;
int32_t normalized_rx_power, target_rx_power;
static int32_t tpc_accumulated = 0;
int n;
int CC_id = 0;
@@ -1126,19 +1195,21 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_sched_ctrl *UE_sched_ctrl;
int sched_frame = frameP;
int rvidx_tab[4] = { 0, 2, 3, 1 };
uint16_t ul_req_index;
uint8_t dlsch_flag;
if (sched_subframeP < subframeP)
sched_frame++;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id];
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id][subframeP];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
nfapi_ul_config_request_t *ul_req_tmp = &mac->UL_req_tmp[CC_id][sched_subframeP];
nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body;
nfapi_ul_config_ulsch_harq_information *ulsch_harq_information;
//LOG_D(MAC, "entering ulsch preprocesor\n");
ulsch_scheduler_pre_processor(module_idP, slice_id, frameP, subframeP, first_rb);
ulsch_scheduler_pre_processor(module_idP, slice_id, frameP, subframeP, sched_subframeP, first_rb);
//LOG_D(MAC, "exiting ulsch preprocesor\n");
@@ -1261,25 +1332,32 @@ schedule_ulsch_rnti(module_id_t module_idP,
// reset the scheduling request
UE_template->ul_SR = 0;
status = mac_eNB_get_rrc_status(module_idP, rnti);
if (status < RRC_CONNECTED)
cqi_req = 0;
else if (UE_sched_ctrl->cqi_req_timer > 30) {
if (nfapi_mode) {
cqi_req = 0;
} else {
cqi_req = 1;
cqi_req = 0;
if (status >= RRC_CONNECTED && UE_sched_ctrl->cqi_req_timer > 30) {
if (UE_sched_ctrl->cqi_received == 0) {
if (nfapi_mode) {
cqi_req = 0;
} else {
cqi_req = 1;
UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP;
}
}
UE_sched_ctrl->cqi_req_timer = 0;
} else
cqi_req = 0;
else if (UE_sched_ctrl->cqi_received == 1) {
UE_sched_ctrl->cqi_req_flag = 0;
UE_sched_ctrl->cqi_received = 0;
UE_sched_ctrl->cqi_req_timer = 0;
}
}
//power control
//compute the expected ULSCH RX power (for the stats)
// this is the normalized RX power and this should be constant (regardless of mcs
normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
target_rx_power = 178;
//is not in dBm, unit from nfapi, converting to dBm: ToDo: Noise power hard coded to 30
normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30;
target_rx_power= mac->puSch10xSnr/10 + 30;
//printf("\n mac->puSch10xSnr = %d, normalized_rx_power = %d, target_rx_power = %d \n",mac->puSch10xSnr,normalized_rx_power,target_rx_power);
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe;
@@ -1404,9 +1482,10 @@ schedule_ulsch_rnti(module_id_t module_idP,
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid;
hi_dci0_req_body->number_of_dci++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP, subframeP, 4);
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday!
@@ -1418,8 +1497,18 @@ schedule_ulsch_rnti(module_id_t module_idP,
harq_pid, frameP, subframeP, UE_id, rnti,
sched_frame, sched_subframeP);
ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
dlsch_flag = 1;
LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
break;
}
}
// Add UL_config PDUs
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb[CC_id], // resource_block_start
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb[CC_id], // resource_block_start
rb_table[rb_table_index], // number_of_resource_blocks
UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
@@ -1437,29 +1526,48 @@ schedule_ulsch_rnti(module_id_t module_idP,
[rb_table_index]));
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
1, //repetition_number
(frameP *
10) +
subframeP);
}
#endif
if(dlsch_flag == 1){
if(cqi_req == 1){
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index];
}else{
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index];
}
fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP);
}else{
ul_req_tmp_body->number_of_pdus++;
}
ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST;
ul_req_tmp_body->number_of_pdus++;
ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
mac->ul_handle++;
uint16_t ul_sched_frame = sched_frame;
uint16_t ul_sched_subframeP = sched_subframeP;
add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2);
//add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2);
ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP;
add_ue_ulsch_info(module_idP,
CC_id, UE_id, subframeP,
S_UL_SCHEDULED);
//LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP, CC_id, frameP, subframeP, UE_id);
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP, CC_id, frameP, subframeP, UE_id);
LOG_D(MAC,"[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n", harq_pid,frameP,subframeP,ul_sched_frame,ul_sched_subframeP,cqi_req,UE_id,rnti);
// increment first rb for next UE allocation
@@ -1472,40 +1580,21 @@ schedule_ulsch_rnti(module_id_t module_idP,
T_INT(first_rb[CC_id]),
T_INT(rb_table[rb_table_index]), T_INT(round));
#if 0
/* This is done in rx_sdu, as it has to.
* Since the code is a bit different, let's keep this version here for review, in case of problem.
*/
// fill in NAK information
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0,
sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = UE_template->first_rb_ul[harq_pid];
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = UE_template->cshift[harq_pid];
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0);
hi_dci0_req->sfn_sf = frameP<<4|subframeP;
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
LOG_D(MAC,
"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
module_idP, harq_pid, rnti, CC_id, frameP,
subframeP, UE_id, UE_template->mcs_UL[harq_pid],
UE_template->first_rb_ul[harq_pid],
UE_template->nb_rb_ul[harq_pid],
UE_template->TBS_UL[harq_pid], round);
#endif
// Add UL_config PDUs
LOG_D(MAC,
"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
harq_pid, frameP, subframeP, UE_id, rnti,
sched_frame, sched_subframeP);
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, UE_template->first_rb_ul[harq_pid], // resource_block_start
ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
dlsch_flag = 1;
LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
break;
}
}
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, UE_template->first_rb_ul[harq_pid], // resource_block_start
UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
@@ -1520,14 +1609,33 @@ schedule_ulsch_rnti(module_id_t module_idP,
TBS_UL[harq_pid]);
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
1, //repetition_number
(frameP *
10) +
subframeP);
}
#endif
ul_req_tmp_body->number_of_pdus++;
if(dlsch_flag == 1){
if(cqi_req == 1){
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid];
}else{
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid];
}
fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP);
}else{
ul_req_tmp_body->number_of_pdus++;
}
mac->ul_handle++;
ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+70 -20
View File
@@ -87,7 +87,7 @@
#define PCCH_PAYLOAD_SIZE_MAX 128
#define RAR_PAYLOAD_SIZE_MAX 128
#define SCH_PAYLOAD_SIZE_MAX 4096
#define SCH_PAYLOAD_SIZE_MAX 8192
#define DCH_PAYLOAD_SIZE_MAX 4096
/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB)
@@ -130,11 +130,7 @@
/*!\brief Maximum number od control elemenets */
#define MAX_NUM_CE 5
/*!\brief Maximum number of random access process */
#if defined(USRP_REC_PLAY)
#define NB_RA_PROC_MAX 1
#else
#define NB_RA_PROC_MAX 4
#endif
/*!\brief size of buffer status report table */
#define BSR_TABLE_SIZE 64
/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
@@ -328,7 +324,6 @@ typedef struct {
uint8_t Buffer_size0:6;
} __attribute__ ((__packed__)) BSR_LONG;
// Panos:
/*!\brief mac control element: sidelink buffer status report */
typedef struct {
uint8_t DST_1:4;
@@ -511,7 +506,9 @@ typedef enum {
MSG2,
WAITMSG3,
MSG4,
WAITMSG4ACK
WAITMSG4ACK,
MSGCRNTI,
MSGCRNTI_ACK
} RA_state;
/*!\brief UE ULSCH scheduling states*/
@@ -541,6 +538,12 @@ typedef enum {
CBA_RS /// random allocation
} CBA_POLICY;
/*!\brief scheduler mode */
typedef enum {
SCHED_MODE_DEFAULT = 0, /// default cheduler
SCHED_MODE_FAIR_RR /// fair raund robin
} SCHEDULER_MODES;
/*! \brief temporary struct for ULSCH sched */
typedef struct {
@@ -948,7 +951,10 @@ typedef struct {
int16_t ta_update;
uint16_t ul_consecutive_errors;
int32_t context_active_timer;
/// timer for regular CQI request on PUSCH
int32_t cqi_req_timer;
/// indicator that CQI was received on PUSCH when requested
int32_t cqi_received;
int32_t ul_inactivity_timer;
int32_t ul_failure_timer;
uint32_t ue_reestablishment_reject_timer;
@@ -984,7 +990,9 @@ typedef struct {
uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX];
uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX];
uint8_t dl_cqi[NFAPI_CC_MAX];
int32_t uplane_inactivity_timer;
int32_t uplane_inactivity_timer;
uint8_t crnti_reconfigurationcomplete_flag;
uint8_t cqi_req_flag;
} UE_sched_ctrl;
/*! \brief eNB template for the Random access information */
typedef struct {
@@ -1043,6 +1051,8 @@ typedef struct {
uint8_t msg2_narrowband;
uint8_t msg34_narrowband;
#endif
int32_t crnti_rrc_mui;
int8_t crnti_harq_pid;
} RA_t;
@@ -1092,6 +1102,22 @@ typedef struct {
} UE_list_t;
/*! \brief deleting control information*/
typedef struct {
///rnti of UE
rnti_t rnti;
///remove UE context flag
boolean_t removeContextFlg;
} UE_free_ctrl;
/*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/
typedef struct {
/// deleting control info
UE_free_ctrl UE_free_ctrl[NUMBER_OF_UE_MAX+1];
int num_UEs;
int head_freelist; ///the head position of the delete list
int tail_freelist; ///the tail position of the delete list
} UE_free_list_t;
/*! \brief eNB common channels */
typedef struct {
int physCellId;
@@ -1180,7 +1206,7 @@ typedef struct eNB_MAC_INST_s {
/// Common cell resources
COMMON_channels_t common_channels[NFAPI_CC_MAX];
/// current PDU index (BCH,MCH,DLSCH)
uint16_t pdu_index[NFAPI_CC_MAX];
int16_t pdu_index[NFAPI_CC_MAX];
/// NFAPI Config Request Structure
nfapi_config_request_t config[NFAPI_CC_MAX];
@@ -1201,9 +1227,9 @@ typedef struct eNB_MAC_INST_s {
nfapi_ul_config_request_t UL_req_tmp[NFAPI_CC_MAX][10];
/// Preallocated HI_DCI0 pdu list
nfapi_hi_dci0_request_pdu_t
hi_dci0_pdu_list[NFAPI_CC_MAX][MAX_NUM_HI_DCI0_PDU];
hi_dci0_pdu_list[NFAPI_CC_MAX][10][MAX_NUM_HI_DCI0_PDU];
/// NFAPI HI/DCI0 Config Request Structure
nfapi_hi_dci0_request_t HI_DCI0_req[NFAPI_CC_MAX];
nfapi_hi_dci0_request_t HI_DCI0_req[NFAPI_CC_MAX][10];
/// Prealocated TX pdu list
nfapi_tx_request_pdu_t
tx_request_pdu[NFAPI_CC_MAX][MAX_NUM_TX_REQUEST_PDU];
@@ -1242,6 +1268,13 @@ typedef struct eNB_MAC_INST_s {
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
/// processing time of eNB PCH scheduler
time_stats_t schedule_pch;
UE_free_list_t UE_free_list;
/// for scheduling selection
SCHEDULER_MODES scheduler_mode;
int32_t puSch10xSnr;
int32_t puCch10xSnr;
} eNB_MAC_INST;
/*
@@ -1400,12 +1433,12 @@ typedef struct {
RAR_PDU RAR_pdu;
/// Incoming DLSCH pdu for PHY
DLSCH_PDU DLSCH_pdu[MAX_MOBILES_PER_ENB][2];
#ifdef Rel14
int sltx_active;
SLSCH_t slsch;
SLDCH_t sldch;
ULSCH_PDU slsch_pdu;
int slsch_lcid;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int sltx_active;
SLSCH_t slsch;
SLDCH_t sldch;
ULSCH_PDU slsch_pdu;
int slsch_lcid;
#endif
/// number of attempt for rach
uint8_t RA_attempt_number;
@@ -1491,13 +1524,13 @@ typedef struct {
time_stats_t rx_si;
/// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind)
time_stats_t rx_p;
/// Panos: Mutex for nfapi UL_INFO
/// Mutex for nfapi UL_INFO
pthread_mutex_t UL_INFO_mutex;
/// Panos: UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE
/// UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE
/// where the UE_mode originally is for the full stack operation mode. The transitions between the states of the UE_Mode
/// will be triggered within phy_stub_ue.c in this case
UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_eNB_MAX];
/// Panos: Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated
/// Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated
/// after the reception of NFAPI_UL_CONFIG_ULSCH_PDU_TYPE.
uint8_t first_ULSCH_Tx;
uint8_t SI_Decoded;
@@ -1513,6 +1546,23 @@ typedef struct {
uint8_t n_adj_cells;
} neigh_cell_id_t;
typedef struct {
volatile uint8_t flag;
rnti_t rnti;
mui_t rrc_eNB_mui;
}RRC_release_ctrl;
typedef struct {
uint16_t num_UEs;
RRC_release_ctrl RRC_release_ctrl[NUMBER_OF_UE_MAX];
} RRC_release_list_t;
typedef struct {
uint8_t rrc_mui_num;
mui_t rrc_mui[128];
}mac_rlc_am_muilist_t;
#include "mac_proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
+10
View File
@@ -76,4 +76,14 @@ extern uint32_t RRC_CONNECTION_FLAG;
extern uint8_t rb_table[34];
#if defined(PRE_SCD_THREAD)
extern uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern uint8_t dlsch_ue_select_tbl_in_use;
extern uint8_t new_dlsch_ue_select_tbl_in_use;
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
extern mac_rlc_am_muilist_t rlc_am_mui;
extern SCHEDULER_MODES global_scheduler_mode;
#endif //DEF_H
+42 -12
View File
@@ -135,8 +135,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t f
@param subframe Index of subframe
@param mbsfn_flag Indicates that this subframe is for MCH/MCCH
*/
void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP,
sub_frame_t subframe, int *mbsfn_flag);
void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
/** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies
@param Mod_id Instance ID of eNB
@@ -314,6 +313,9 @@ void cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
@param Msg3_frame frame where scheduling takes place
@param Msg3_subframe subframe where scheduling takes place
*/
void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP);
void set_msg3_subframe(module_id_t Mod_id,
int CC_id,
int frame,
@@ -427,7 +429,7 @@ int get_nCCE_offset(int *CCE_table,
const unsigned short rnti,
const unsigned char subframe);
int allocate_CCEs(int module_idP, int CC_idP, int subframe, int test_only);
int allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, int test_only);
boolean_t CCE_allocation_infeasible(int module_idP,
int CC_idP,
@@ -439,6 +441,7 @@ void set_ue_dai(sub_frame_t subframeP,
int UE_id,
uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list);
uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP);
/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
@param Mod_id Instance ID of eNB
@param frame Frame index
@@ -543,7 +546,7 @@ void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
@param[out] sync_area return the sync area
@param[out] mcch_active flag indicating whether this MCCH is active in this SF
*/
int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame,
int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
sub_frame_t subframe, uint8_t eNB_index,
uint8_t * sync_area, uint8_t * mcch_active);
@@ -673,6 +676,8 @@ int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid
);
int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP);
void store_dlsch_buffer(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframeP);
void assign_rbs_required(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframe, uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], int min_rb_unit[NFAPI_CC_MAX]);
int maxround(module_id_t Mod_id, uint16_t rnti, int frame,
sub_frame_t subframe, uint8_t ul_flag);
@@ -683,9 +688,17 @@ int UE_num_active_CC(UE_list_t * listP, int ue_idP);
int UE_PCCID(module_id_t mod_idP, int ue_idP);
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
uint8_t find_rb_table_index(uint8_t average_rbs);
void set_ul_DAI(int module_idP,
int UE_idP,
int CC_idP,
int frameP,
int subframeP);
void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP,
sub_frame_t subframeP,
unsigned char sched_subframeP,
uint16_t * first_rb);
void store_ulsch_buffer(module_id_t module_idP, int frameP,
sub_frame_t subframeP);
@@ -694,6 +707,7 @@ void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
sub_frame_t subframeP, uint16_t * first_rb);
void adjust_bsr_info(int buffer_occupancy, uint16_t TBS,
UE_TEMPLATE * UE_template);
int phy_stats_exist(module_id_t Mod_id, int rnti);
void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP);
@@ -860,7 +874,7 @@ uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG,
uint8_t * rballoc);
void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti,
uint8_t dai);
uint8_t dai, sub_frame_t subframe);
int get_bw_index(module_id_t module_id, uint8_t CC_id);
@@ -1018,10 +1032,10 @@ int rrc_mac_config_req_ue(module_id_t module_idP,
,
uint8_t num_active_cba_groups, uint16_t cba_rnti
#endif
#if defined(Rel14)
,config_action_t config_action
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,config_action_t config_action
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#endif
);
@@ -1046,6 +1060,12 @@ uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart,
int get_phich_resource_times6(COMMON_channels_t * cc);
uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP);
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe);
unsigned char ul_ACK_subframe2M(TDD_Config_t *tdd_Config,unsigned char subframe);
int to_rbg(int dl_Bandwidth);
int to_prb(int dl_Bandwidth);
@@ -1091,7 +1111,7 @@ void extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id,
uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t * tx_req_body,
uint16_t absSF, uint16_t pdu_length,
uint16_t pdu_index, uint8_t * pdu);
int16_t pdu_index, uint8_t * pdu);
void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *
ul_config_pdu, uint8_t cqi_req,
@@ -1131,7 +1151,7 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
void fill_nfapi_dlsch_config(eNB_MAC_INST * eNB,
nfapi_dl_config_request_body_t * dl_req,
uint16_t length, uint16_t pdu_index,
uint16_t length, int16_t pdu_index,
uint16_t rnti,
uint8_t resource_allocation_type,
uint8_t
@@ -1165,7 +1185,8 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information
* harq_information);
* harq_information,
sub_frame_t subframeP);
uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
int CC_idP,
@@ -1214,11 +1235,20 @@ uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn);
int32_t get_uldl_offset(int eutra_bandP);
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
uint8_t HO_active);
#if defined(PRE_SCD_THREAD)
void pre_scd_nb_rbs_required( module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int min_rb_unit[MAX_NUM_CCs],
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
#endif
/*Slice related functions */
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
int ue_slice_membership(int UE_id, int slice_id);
/* from here: prototypes to get rid of compilation warnings: doc to be written by function author */
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe);
#endif
/** @}*/
+2
View File
@@ -142,4 +142,6 @@ DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
mac_rlc_am_muilist_t rlc_am_mui;
SCHEDULER_MODES global_scheduler_mode;
#endif
+21 -15
View File
@@ -58,23 +58,28 @@ void mac_top_init_eNB(void)
RC.nb_macrlc_inst);
if (RC.nb_macrlc_inst > 0) {
RC.mac =
(eNB_MAC_INST **) malloc16(RC.nb_macrlc_inst *
sizeof(eNB_MAC_INST *));
if (RC.mac == NULL){
RC.mac =
(eNB_MAC_INST **) malloc16(RC.nb_macrlc_inst *
sizeof(eNB_MAC_INST *));
bzero(RC.mac, RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *));
}
AssertFatal(RC.mac != NULL,
"can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *),
RC.nb_macrlc_inst, sizeof(eNB_MAC_INST));
for (i = 0; i < RC.nb_macrlc_inst; i++) {
RC.mac[i] = (eNB_MAC_INST *) malloc16(sizeof(eNB_MAC_INST));
AssertFatal(RC.mac != NULL,
"can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *),
RC.nb_macrlc_inst, sizeof(eNB_MAC_INST));
LOG_D(MAC,
"[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",
sizeof(eNB_MAC_INST), RC.nb_macrlc_inst, RC.mac);
bzero(RC.mac[i], sizeof(eNB_MAC_INST));
if (RC.mac[i] == NULL) {
RC.mac[i] = (eNB_MAC_INST *) malloc16(sizeof(eNB_MAC_INST));
AssertFatal(RC.mac[i] != NULL,
"can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *),
RC.nb_macrlc_inst, sizeof(eNB_MAC_INST));
LOG_D(MAC,
"[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",
sizeof(eNB_MAC_INST), RC.nb_macrlc_inst, RC.mac);
bzero(RC.mac[i], sizeof(eNB_MAC_INST));
}
RC.mac[i]->Mod_id = i;
for (j = 0; j < MAX_NUM_CCs; j++) {
RC.mac[i]->DL_req[j].dl_config_request_body.
@@ -85,9 +90,10 @@ void mac_top_init_eNB(void)
RC.mac[i]->UL_req_tmp[j][k].
ul_config_request_body.ul_config_pdu_list =
RC.mac[i]->ul_config_pdu_list_tmp[j][k];
RC.mac[i]->HI_DCI0_req[j].
hi_dci0_request_body.hi_dci0_pdu_list =
RC.mac[i]->hi_dci0_pdu_list[j];
for(int sf=0;sf<10;sf++){
RC.mac[i]->HI_DCI0_req[j][sf].hi_dci0_request_body.hi_dci0_pdu_list =RC.mac[i]->hi_dci0_pdu_list[j][sf];
}
RC.mac[i]->TX_req[j].tx_request_body.tx_pdu_list =
RC.mac[i]->tx_request_pdu[j];
RC.mac[i]->ul_handle = 0;
+12 -234
View File
@@ -129,12 +129,12 @@ store_dlsch_buffer(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP,
rnti = UE_RNTI(Mod_id, UE_id);
for (i = 0; i < MAX_NUM_LCID; i++) { // loop over all the logical channels
for (i = 0; i < MAX_NUM_LCID; i++) { // loop over all the logical channels
rlc_status =
mac_rlc_status_ind(Mod_id, rnti, Mod_id, frameP, subframeP,
ENB_FLAG_YES, MBMS_FLAG_NO, i, 0
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -318,10 +318,8 @@ maxround(module_id_t Mod_id, uint16_t rnti, int frame,
cc = &RC.mac[Mod_id]->common_channels[CC_id];
UE_id = find_UE_id(Mod_id, rnti);
if (cc->tdd_Config)
harq_pid = ((frame * 10) + subframe) % 10;
else
harq_pid = ((frame * 10) + subframe) & 7;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame ,subframe);
round = UE_list->UE_sched_ctrl[UE_id].round[CC_id][harq_pid];
if (round > round_max) {
@@ -432,36 +430,6 @@ static int ue_dl_compare(const void *_a, const void *_b, void *_params)
}
return 0;
#if 0
/* The above order derives from the following. */
if (round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (round2 == round1) {
// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
// for(j=0;j<MAX_NUM_LCID;j++){
// if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
// eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
// first check the buffer status for SRB1 and SRB2
if ((UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] +
UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) <
(UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] +
UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (UE_list->UE_template[pCC_id1]
[UE_id1].dl_buffer_head_sdu_creation_time_max <
UE_list->UE_template[pCC_id2]
[UE_id2].dl_buffer_head_sdu_creation_time_max) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (cqi1 < cqi2) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
}
}
#endif
}
void decode_sorting_policy(module_id_t Mod_idP, slice_id_t slice_id) {
@@ -501,8 +469,6 @@ void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t
continue;
if ((rnti = UE_RNTI(Mod_idP, i)) == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
continue;
if (!ue_slice_membership(i, slice_id))
continue;
@@ -522,78 +488,6 @@ void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t
} else {
UE_list->head = -1;
}
#if 0
int UE_id1, UE_id2;
int pCC_id1, pCC_id2;
int cqi1, cqi2, round1, round2;
int i = 0, ii = 0; //,j=0;
rnti_t rnti1, rnti2;
UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
for (i = UE_list->head; i >= 0; i = UE_list->next[i]) {
for (ii = UE_list->next[i]; ii >= 0; ii = UE_list->next[ii]) {
UE_id1 = i;
rnti1 = UE_RNTI(Mod_idP, UE_id1);
if (rnti1 == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1)
continue;
pCC_id1 = UE_PCCID(Mod_idP, UE_id1);
cqi1 = maxcqi(Mod_idP, UE_id1); //
round1 = maxround(Mod_idP, rnti1, frameP, subframeP, 0);
UE_id2 = ii;
rnti2 = UE_RNTI(Mod_idP, UE_id2);
if (rnti2 == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
continue;
cqi2 = maxcqi(Mod_idP, UE_id2);
round2 = maxround(Mod_idP, rnti2, frameP, subframeP, 0); //mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0);
pCC_id2 = UE_PCCID(Mod_idP, UE_id2);
if (round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (round2 == round1) {
// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
// for(j=0;j<MAX_NUM_LCID;j++){
// if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
// eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
// first check the buffer status for SRB1 and SRB2
if ((UE_list->UE_template[pCC_id1][UE_id1].
dl_buffer_info[1] +
UE_list->UE_template[pCC_id1][UE_id1].
dl_buffer_info[2]) <
(UE_list->UE_template[pCC_id2][UE_id2].
dl_buffer_info[1] +
UE_list->UE_template[pCC_id2][UE_id2].
dl_buffer_info[2])) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (UE_list->UE_template[pCC_id1]
[UE_id1].dl_buffer_head_sdu_creation_time_max <
UE_list->UE_template[pCC_id2]
[UE_id2].dl_buffer_head_sdu_creation_time_max) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (UE_list->UE_template[pCC_id1][UE_id1].
dl_buffer_total <
UE_list->UE_template[pCC_id2][UE_id2].
dl_buffer_total) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
} else if (cqi1 < cqi2) {
swap_UEs(UE_list, UE_id1, UE_id2, 0);
}
}
}
}
#endif
}
void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
@@ -638,8 +532,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
if (rnti == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
continue;
if (!ue_slice_membership(UE_id, slice_id))
continue;
@@ -719,8 +611,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
if (rnti == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
continue;
if (!ue_slice_membership(UE_id, slice_id))
continue;
@@ -728,11 +618,7 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
CC_id = UE_list->ordered_CCids[ii][UE_id];
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
cc = &RC.mac[Mod_id]->common_channels[CC_id];
// TODO Can we use subframe2harqpid() here?
if (cc->tdd_Config)
harq_pid = ((frameP * 10) + subframeP) % 10;
else
harq_pid = ((frameP * 10) + subframeP) & 7;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
round = ue_sched_ctl->round[CC_id][harq_pid];
// control channel or retransmission
@@ -797,8 +683,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
// LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
if (rnti == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
continue;
if (!ue_slice_membership(UE_id, slice_id))
continue;
@@ -1401,11 +1285,12 @@ dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
/// ULSCH PRE_PROCESSOR
void
ulsch_scheduler_pre_processor(module_id_t module_idP,
slice_id_t slice_id, int frameP,
sub_frame_t subframeP, uint16_t * first_rb)
void ulsch_scheduler_pre_processor(module_id_t module_idP,
slice_id_t slice_id,
int frameP,
sub_frame_t subframeP,
unsigned char sched_subframeP,
uint16_t *first_rb)
{
int16_t i;
@@ -1530,7 +1415,7 @@ ulsch_scheduler_pre_processor(module_id_t module_idP,
CC_id = UE_list->ordered_ULCCids[n][UE_id];
UE_template = &UE_list->UE_template[CC_id][UE_id];
harq_pid = subframe2harqpid(&RC.mac[module_idP]->common_channels[CC_id],
frameP, subframeP);
frameP, sched_subframeP);
// mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL);
@@ -1601,23 +1486,8 @@ ulsch_scheduler_pre_processor(module_id_t module_idP,
}
}
}
#if 0
/* this logging is wrong, ue_sched_ctl may not be valid here
* TODO: fix
*/
for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) {
if (total_allocated_rbs[CC_id] > 0) {
LOG_D(MAC, "[eNB %d] total RB allocated for all UEs = %d/%d\n",
module_idP, total_allocated_rbs[CC_id],
ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]);
}
}
#endif
}
void
assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
sub_frame_t subframeP, uint16_t * first_rb)
@@ -1801,31 +1671,6 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params)
return 1;
return 0;
#if 0
/* The above order derives from the following.
* The last case is not handled: "if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 )"
* I don't think it makes a big difference.
*/
if (round2 > round1) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (round2 == round1) {
if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer <
UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (UE_list->UE_template[pCCid1][UE_id1].
pre_assigned_mcs_ul <
UE_list->UE_template[pCCid2][UE_id2].
pre_assigned_mcs_ul) {
if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
}
}
}
#endif
}
void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP)
@@ -1860,71 +1705,4 @@ void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP)
} else {
UE_list->head_ul = -1;
}
#if 0
int UE_id1, UE_id2;
int pCCid1, pCCid2;
int round1, round2;
int i = 0, ii = 0;
rnti_t rnti1, rnti2;
UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
//LOG_I(MAC,"sort ue ul i %d\n",i);
for (ii = UE_list->next_ul[i]; ii >= 0; ii = UE_list->next_ul[ii]) {
//LOG_I(MAC,"sort ul ue 2 ii %d\n",ii);
UE_id1 = i;
rnti1 = UE_RNTI(module_idP, UE_id1);
if (rnti1 == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
continue;
pCCid1 = UE_PCCID(module_idP, UE_id1);
round1 = maxround(module_idP, rnti1, frameP, subframeP, 1);
UE_id2 = ii;
rnti2 = UE_RNTI(module_idP, UE_id2);
if (rnti2 == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
continue;
pCCid2 = UE_PCCID(module_idP, UE_id2);
round2 = maxround(module_idP, rnti2, frameP, subframeP, 1);
if (round2 > round1) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (round2 == round1) {
if (UE_list->
UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
UE_list->UE_template[pCCid2][UE_id2].
ul_buffer_info[LCGID0]) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (UE_list->UE_template[pCCid1][UE_id1].
ul_total_buffer <
UE_list->UE_template[pCCid2][UE_id2].
ul_total_buffer) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
} else if (UE_list->
UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul
<
UE_list->
UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
{
if (UE_list->UE_template[pCCid2][UE_id2].
ul_total_buffer > 0) {
swap_UEs(UE_list, UE_id1, UE_id2, 1);
}
}
}
}
}
#endif
}
+1 -1
View File
@@ -33,7 +33,7 @@
#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
#include "COMMON/platform_types.h"
#include "openair2/RRC/LITE/defs_NB_IoT.h"
#include "openair2/RRC/LTE/defs_NB_IoT.h"
/** \addtogroup _mac
* @{
*/
+4 -4
View File
@@ -299,8 +299,8 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
uint8_t Size = 0;
UE_MODE_t UE_mode;
// Panos: Modification for phy_stub_ue operation
if(nfapi_mode == 3) { // Panos: phy_stub_ue mode
// Modification for phy_stub_ue operation
if(nfapi_mode == 3) { // phy_stub_ue mode
UE_mode = UE_mac_inst[module_idP].UE_mode[0];
LOG_D(MAC, "ue_get_rach , UE_mode: %d", UE_mode);
}
@@ -410,7 +410,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
UE_mac_inst[module_idP].crnti,
eNB_indexP, frameP, subframeP,
ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -431,7 +431,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_indexP, frameP, ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6, //not used
(char *) &ulsch_buff[0]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
+11 -1
View File
@@ -71,7 +71,16 @@ fill_rar(const module_id_t module_idP,
ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
ra->msg3_first_rb = 6;
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if(N_RB_UL == 25){
ra->msg3_first_rb = 1;
}else{
if (cc->tdd_Config && N_RB_UL == 100) {
ra->msg3_first_rb = 3;
} else {
ra->msg3_first_rb = 2;
}
}
ra->msg3_nb_rb = 1;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
@@ -80,6 +89,7 @@ fill_rar(const module_id_t module_idP,
ra->msg3_TPC = 3;
ra->msg3_ULdelay = 0;
ra->msg3_cqireq = 0;
ra->msg3_round = 0;
rar[2] |= ((ra->msg3_mcs & 0x8) >> 3); // mcs 10
rar[3] =
(((ra->msg3_mcs & 0x7) << 5)) | ((ra->msg3_TPC & 7) << 2) |
+1 -1
View File
@@ -93,7 +93,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
}
LOG_I(MAC,
"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
"[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
#ifdef DEBUG_RAR
+10 -33
View File
@@ -475,8 +475,8 @@ ue_send_sdu(module_id_t module_idP,
LOG_E(MAC,
"[UE %d][RAPROC] Contention detected, RA failed\n",
module_idP);
if(nfapi_mode == 3) { // Panos: phy_stub mode
// Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
if(nfapi_mode == 3) { // phy_stub mode
// Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode BACK to PRACH 1\n");
UE_mac_inst[module_idP].UE_mode[eNB_index] = PRACH;
@@ -502,7 +502,7 @@ ue_send_sdu(module_id_t module_idP,
RA_contention_resolution_timer_active = 0;
if(nfapi_mode == 3) // phy_stub mode
{
//Panos: Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH
// Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH
UE_mac_inst[module_idP].UE_mode[eNB_index] = PUSCH;
}
else { // Full stack mode
@@ -519,7 +519,7 @@ ue_send_sdu(module_id_t module_idP,
payload_ptr[0]);
#endif
// Panos: Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct?
// Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct?
if (nfapi_mode!=3)
{
process_timing_advance(module_idP,CC_id,payload_ptr[0]);
@@ -881,17 +881,6 @@ void ue_send_sl_sdu(module_id_t module_idP,
} else { //SL_DISCOVERY
uint16_t len = sdu_len;
LOG_I( MAC, "SL DISCOVERY \n");
// Panos: Ask TTN if we should be calling mac_rrc_data_ind_ue() instead of mac_rrc_data_ind() now!
/*mac_rrc_data_ind(module_idP,
CC_id,
frameP,subframeP,
UE_mac_inst[module_idP].crnti,
SL_DISCOVERY,
sdu, //(uint8_t*)&UE_mac_inst[Mod_id].SL_Discovery[0].Rx_buffer.Payload[0],
len,
ENB_FLAG_NO,
eNB_index,
0);*/
mac_rrc_data_ind_ue(module_idP,
CC_id,
frameP,subframeP,
@@ -1623,7 +1612,6 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t * ulsch_buffer, uint16_t buflen, uint8_t * access_mode)
{
//LOG_I(MAC, "Panos-D: UE[%d] In ue_get_sdu() 1 \n", module_idP);
uint8_t total_rlc_pdu_header_len = 0, rlc_pdu_header_len_last = 0;
uint16_t buflen_remain = 0;
uint8_t bsr_len = 0, bsr_ce_len = 0, bsr_header_len = 0;
@@ -1853,7 +1841,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
lcid,
buflen_remain,
(char *)&ulsch_buff[sdu_length_total]
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -1997,7 +1985,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
// build PHR and update the timers
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
if(nfapi_mode ==3){
//Panos: Substitute with a static value for the MAC layer abstraction (phy_stub mode)
//Substitute with a static value for the MAC layer abstraction (phy_stub mode)
phr_p->PH = 40;
}
else{
@@ -2212,7 +2200,6 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
buflen - sdu_length_total - payload_offset);
// cycle through SDUs and place in ulsch_buffer
if (sdu_length_total) {
//LOG_I(MAC, "Panos-D: [UE %d] ue_get_sdu() 2 before copying to ulsch_buffer, SFN/SF: %d/%d \n \n \n", module_idP, frameP, subframe);
memcpy(&ulsch_buffer[payload_offset], ulsch_buff,
sdu_length_total);
}
@@ -2466,8 +2453,8 @@ ue_scheduler(const module_id_t module_idP,
LOG_E(MAC,
"Module id %u Contention resolution timer expired, RA failed\n",
module_idP);
if(nfapi_mode == 3) { // Panos: phy_stub mode
// Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
if(nfapi_mode == 3) { // phy_stub mode
// Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n");
UE_mac_inst[module_idP].UE_mode[eNB_indexP] = PRACH;
@@ -2840,7 +2827,7 @@ update_bsr(module_id_t module_idP, frame_t frameP,
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,
0xFFFF //TBS is not used in RLC at this step, set a special value for debug
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -3201,16 +3188,6 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t
//UE_MAC_INST *ue = &UE_mac_inst[Mod_id];
SLDCH_t *sldch = &UE_mac_inst[Mod_id].sldch;
// Panos: Ask TTN if we should be calling mac_rrc_data_req_ue() instead of mac_rrc_data_req() now!
/*sldch->payload_length = mac_rrc_data_req(Mod_id,
CC_id,
frame_tx,
SL_DISCOVERY,
1,
(char*)(sldch->payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0],
0,
0, //eNB_indexP
0);*/
sldch->payload_length = mac_rrc_data_req_ue(Mod_id,
CC_id,
@@ -3291,7 +3268,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
ue->slsch_lcid,
req,
(char*)(ue->slsch_pdu.payload + sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG))
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,ue->sourceL2Id,
ue->destinationL2Id
#endif
+7 -36
View File
@@ -83,7 +83,7 @@ boolean_t pdcp_data_req(
const sdu_size_t sdu_buffer_sizeP,
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#endif
@@ -170,7 +170,7 @@ boolean_t pdcp_data_req(
sdu_buffer_sizeP);
#endif
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -360,7 +360,7 @@ boolean_t pdcp_data_req(
LOG_F(PDCP,"\n");
#endif
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,sourceL2Id
,destinationL2Id
#endif
@@ -595,9 +595,7 @@ pdcp_data_ind(
}
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
#if 0
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
#endif
/* if (dc == PDCP_DATA_PDU )
LOG_D(PDCP, "Passing piggybacked SDU to NAS driver...\n");
else
@@ -612,13 +610,9 @@ pdcp_data_ind(
* XXX Till we implement in-sequence delivery and duplicate discarding
* mechanism all out-of-order packets will be delivered to RRC/IP
*/
#if 0
LOG_D(PDCP, "Ignoring PDU...\n");
free_mem_block(sdu_buffer, __func__);
LOG_W(PDCP, "Ignoring PDU...\n");
free_mem_block(sdu_buffer_pP, __func__);
return FALSE;
#else
//LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n");
#endif
}
// SRB1/2: control-plane data
@@ -866,7 +860,7 @@ pdcp_data_ind(
void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){
uint8_t pdcp_uid = 0;
uint16_t pdcp_uid = 0;
uint8_t rb_id = 0;
// these stats are measured for both eNB and UE on per seond basis
@@ -982,7 +976,7 @@ pdcp_run (
RRC_DCCH_DATA_REQ (msg_p).sdu_size,
RRC_DCCH_DATA_REQ (msg_p).sdu_p,
RRC_DCCH_DATA_REQ (msg_p).mode
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, NULL, NULL
#endif
);
@@ -1019,29 +1013,6 @@ pdcp_run (
}
} while(msg_p != NULL);
# if 0
{
MessageDef *msg_resp_p;
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
itti_send_msg_to_task(TASK_RRC_ENB, 1, msg_resp_p);
}
{
MessageDef *msg_resp_p;
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
itti_send_msg_to_task(TASK_ENB_APP, 2, msg_resp_p);
}
{
MessageDef *msg_resp_p;
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p);
}
# endif
#endif
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
+82 -126
View File
@@ -34,34 +34,6 @@
#ifndef __PDCP_H__
# define __PDCP_H__
//-----------------------------------------------------------------------------
# ifdef PDCP_C
# define private_pdcp(x) x
# define protected_pdcp(x) x
# define public_pdcp(x) x
# else
# define private_pdcp(x)
# define public_pdcp(x) extern x
# ifdef PDCP_FIFO_C
# define protected_pdcp(x) extern x
# else
# define protected_pdcp(x)
# endif
# endif
# ifdef PDCP_FIFO_C
# define private_pdcp_fifo(x) x
# define protected_pdcp_fifo(x) x
# define public_pdcp_fifo(x) x
# else
# define private_pdcp_fifo(x)
# define public_pdcp_fifo(x) extern x
# ifdef PDCP_C
# define protected_pdcp_fifo(x) extern x
# else
# define protected_pdcp_fifo(x)
# endif
# endif
//-----------------------------------------------------------------------------
#ifndef NON_ACCESS_STRATUM
#include "UTIL/MEM/mem_block.h"
#include "UTIL/LISTS/list.h"
@@ -94,41 +66,41 @@ extern int pdcp_instance_cnt;
int init_pdcp_thread(void);
void cleanup_pdcp_thread(void);
public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]);
public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
uint32_t Pdcp_stats_rx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP));
void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP);
/*Packet Probing for agent PDCP*/
//public_pdcp(uint64_t *pdcp_packet_counter);
//public_pdcp(uint64_t *pdcp_size_packet);
//uint64_t *pdcp_packet_counter;
//uint64_t *pdcp_size_packet;
typedef struct pdcp_enb_s {
// used for eNB stats generation
uint16_t uid[MAX_MOBILES_PER_ENB];
@@ -141,7 +113,7 @@ typedef struct pdcp_enb_s {
} pdcp_enb_t;
public_pdcp(pdcp_enb_t pdcp_enb[MAX_NUM_CCs]);
pdcp_enb_t pdcp_enb[MAX_NUM_CCs];
typedef struct pdcp_stats_s {
time_stats_t pdcp_run;
@@ -251,7 +223,7 @@ typedef struct pdcp_mbms_s {
* \note None
* @ingroup _pdcp
*/
public_pdcp(boolean_t pdcp_data_req(
boolean_t pdcp_data_req(
protocol_ctxt_t* ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_id,
@@ -260,11 +232,11 @@ public_pdcp(boolean_t pdcp_data_req(
const sdu_size_t sdu_buffer_size,
unsigned char* const sdu_buffer,
const pdcp_transmission_mode_t mode
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#endif
));
);
/*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t)
* \brief This functions handles data transfer indications coming from RLC
@@ -279,13 +251,13 @@ public_pdcp(boolean_t pdcp_data_req(
* \note None
* @ingroup _pdcp
*/
public_pdcp(boolean_t pdcp_data_ind(
boolean_t pdcp_data_ind(
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_id,
const sdu_size_t sdu_buffer_size,
mem_block_t* const sdu_buffer));
mem_block_t* const sdu_buffer);
/*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t)
* \brief This functions initializes relevant PDCP entity
@@ -297,12 +269,12 @@ public_pdcp(boolean_t pdcp_data_ind(
* \note None
* @ingroup _pdcp
*/
public_pdcp(void rrc_pdcp_config_req (
void rrc_pdcp_config_req (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const uint32_t actionP,
const rb_id_t rb_idP,
const uint8_t security_modeP);)
const uint8_t security_modeP);
/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer.
@@ -318,8 +290,7 @@ public_pdcp(void rrc_pdcp_config_req (
* \param[in] defaultDRB Default DRB ID
* \return A status about the processing, OK or error code.
*/
public_pdcp(
boolean_t rrc_pdcp_config_asn1_req (
boolean_t rrc_pdcp_config_asn1_req (
const protocol_ctxt_t* const ctxt_pP,
SRB_ToAddModList_t *const srb2add_list,
DRB_ToAddModList_t *const drb2add_list,
@@ -332,7 +303,7 @@ public_pdcp(
,PMCH_InfoList_r9_t *pmch_InfoList_r9
#endif
,rb_id_t *const defaultDRB
));
);
/*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode)
* \brief Function for RRC to configure a Radio Bearer.
@@ -354,7 +325,7 @@ public_pdcp(
* \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code.
*/
public_pdcp(boolean_t pdcp_config_req_asn1 (
boolean_t pdcp_config_req_asn1 (
const protocol_ctxt_t* const ctxt_pP,
pdcp_t *const pdcp_pP,
const srb_flag_t srb_flagP,
@@ -369,22 +340,22 @@ public_pdcp(boolean_t pdcp_config_req_asn1 (
const uint8_t security_mode,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const kUPenc));
uint8_t *const kUPenc);
/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function (for RRC) to add a new UE in PDCP module
* \param[in] ctxt_pP Running context.
* \return A status about the processing, OK or error code.
*/
public_pdcp(void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP));
void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP);
/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function for RRC to remove UE from PDCP module hashtable
* \param[in] ctxt_pP Running context.
* \return A status about the processing, OK or error code.
*/
public_pdcp(boolean_t pdcp_remove_UE(
const protocol_ctxt_t* const ctxt_pP));
boolean_t pdcp_remove_UE(
const protocol_ctxt_t* const ctxt_pP);
/*! \fn void rrc_pdcp_config_release( const protocol_ctxt_t* const, rb_id_t)
* \brief This functions is unused
@@ -394,7 +365,7 @@ public_pdcp(boolean_t pdcp_remove_UE(
* \note None
* @ingroup _pdcp
*/
//public_pdcp(void rrc_pdcp_config_release ( const protocol_ctxt_t* const ctxt_pP, rb_id_t);)
//void rrc_pdcp_config_release ( const protocol_ctxt_t* const ctxt_pP, rb_id_t);
/*! \fn void pdcp_run(const protocol_ctxt_t* const ctxt_pP)
* \brief Runs PDCP entity to let it handle incoming/outgoing SDUs
@@ -403,27 +374,23 @@ public_pdcp(boolean_t pdcp_remove_UE(
* \note None
* @ingroup _pdcp
*/
public_pdcp(void pdcp_run (
const protocol_ctxt_t* const ctxt_pP);)
public_pdcp(int pdcp_module_init (void);)
public_pdcp(void pdcp_module_cleanup (void);)
public_pdcp(void pdcp_layer_init (void);)
public_pdcp(void pdcp_layer_cleanup (void);)
void pdcp_run (
const protocol_ctxt_t* const ctxt_pP);
int pdcp_module_init (void);
void pdcp_module_cleanup (void);
void pdcp_layer_init (void);
void pdcp_layer_cleanup (void);
#if defined(PDCP_USE_NETLINK_QUEUES)
public_pdcp(int pdcp_netlink_init (void);)
int pdcp_netlink_init (void);
#endif
#define PDCP2NW_DRIVER_FIFO 21
#define NW_DRIVER2PDCP_FIFO 22
protected_pdcp_fifo(int pdcp_fifo_flush_sdus (
const protocol_ctxt_t* const ctxt_pP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (
const protocol_ctxt_t* const ctxt_pP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (
const protocol_ctxt_t* const ctxt_pP);)
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (
const protocol_ctxt_t* const ctxt_pP);)
int pdcp_fifo_flush_sdus ( const protocol_ctxt_t* const ctxt_pP);
int pdcp_fifo_read_input_sdus_remaining_bytes ( const protocol_ctxt_t* const ctxt_pP);
int pdcp_fifo_read_input_sdus ( const protocol_ctxt_t* const ctxt_pP);
void pdcp_fifo_read_input_sdus_from_otg ( const protocol_ctxt_t* const ctxt_pP);
//-----------------------------------------------------------------------------
@@ -437,7 +404,7 @@ typedef struct pdcp_data_req_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t traffic_type;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
@@ -448,7 +415,7 @@ typedef struct pdcp_data_ind_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t dummy_traffic_type;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
@@ -462,7 +429,7 @@ struct pdcp_netlink_element_s {
};
//TTN for D2D (PC5S)
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
#define PDCP_SOCKET_PORT_NO 9999 //temporary value
#define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value
int pdcp_pc5_sockfd;
@@ -497,17 +464,6 @@ typedef struct {
#endif
#if 0
/*
* Missing PDU information struct, a copy of this will be enqueued
* into pdcp.missing_pdus for every missing PDU
*/
typedef struct pdcp_missing_pdu_info_t {
pdcp_sn_t sequence_number;
} pdcp_missing_pdu_info_t;
#endif
/*
* PDCP limit values
*/
@@ -531,31 +487,31 @@ typedef struct pdcp_missing_pdu_info_t {
#define PDCP_SN_12BIT 12
protected_pdcp(signed int pdcp_2_nas_irq;)
public_pdcp(pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB];)
public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];)
//protected_pdcp(pdcp_t pdcp_array_srb_ue[MAX_MOBILES_PER_ENB][2];)
//protected_pdcp(pdcp_t pdcp_array_drb_ue[MAX_MOBILES_PER_ENB][maxDRB];)
//public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][2];)
//protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][maxDRB];)
signed int pdcp_2_nas_irq;
pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB];
pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];
//pdcp_t pdcp_array_srb_ue[MAX_MOBILES_PER_ENB][2];
//pdcp_t pdcp_array_drb_ue[MAX_MOBILES_PER_ENB][maxDRB];
//pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][2];
//pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][maxDRB];
// for UE code conly
protected_pdcp(rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB];)
protected_pdcp(rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB];) // for noS1 mode
protected_pdcp(unsigned int pdcp_eNB_UE_instance_to_rnti_index;)
rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB];
rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode
unsigned int pdcp_eNB_UE_instance_to_rnti_index;
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
#endif
protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;)
protected_pdcp(sdu_size_t pdcp_output_header_bytes_to_write;)
protected_pdcp(list_t pdcp_sdu_list;)
protected_pdcp(int pdcp_sent_a_sdu;)
protected_pdcp(pdcp_data_req_header_t pdcp_input_header;)
protected_pdcp(unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE];)
protected_pdcp(sdu_size_t pdcp_input_index_header;)
protected_pdcp(sdu_size_t pdcp_input_sdu_size_read;)
protected_pdcp(sdu_size_t pdcp_input_sdu_remaining_size_to_read;)
sdu_size_t pdcp_output_sdu_bytes_to_write;
sdu_size_t pdcp_output_header_bytes_to_write;
list_t pdcp_sdu_list;
int pdcp_sent_a_sdu;
pdcp_data_req_header_t pdcp_input_header;
unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE];
sdu_size_t pdcp_input_index_header;
sdu_size_t pdcp_input_sdu_size_read;
sdu_size_t pdcp_input_sdu_remaining_size_to_read;
#define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \
((hash_key_t)mODULE_iD | \
@@ -586,7 +542,7 @@ protected_pdcp(sdu_size_t pdcp_input_sdu_remaining_size_to_read;)
(((hash_key_t)(sESSION_ID)) << 37) | \
(((hash_key_t)(0x0000000000000001)) << 63))
public_pdcp(hash_table_t *pdcp_coll_p;)
hash_table_t *pdcp_coll_p;
#endif
/*@}*/
@@ -45,6 +45,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP
mem_block *mb;
mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__);
if(mb==NULL) return;
((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP;
+14 -15
View File
@@ -202,7 +202,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
cont = 0;
//TTN - for D2D (PC5S)
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
sidelink_pc5s_element *sl_pc5s_msg_recv = NULL;
char send_buf[BUFSIZE];
int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
@@ -452,7 +452,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, NULL, NULL
#endif
);
@@ -488,10 +488,9 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_t* pdcp_p = NULL;
//TTN for D2D (PC5S)
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int prose_addr_len;
char send_buf[BUFSIZE], receive_buf[BUFSIZE];
// Panos: Remove the following definitions due to warnings of unused variables.
//int optval;
int bytes_received;
sidelink_pc5s_element *sl_pc5s_msg_recv = NULL;
@@ -568,7 +567,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
data_p->pdcp_read_header.data_size,
data_p->data,
pdcp_mode
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -596,7 +595,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
data_p->pdcp_read_header.data_size,
data_p->data,
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -613,7 +612,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
data_p->pdcp_read_header.data_size,
data_p->data,
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -633,7 +632,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
//TTN for D2D (PC5S)
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
prose_addr_len = sizeof(prose_pdcp_addr);
// receive a message from ProSe App
memset(receive_buf, 0, BUFSIZE);
@@ -775,7 +774,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pc5s_header->data_size,
(unsigned char *)receive_buf,
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pc5s_header->sourceL2Id
,&pc5s_header->destinationL2Id
#endif
@@ -833,7 +832,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pc5s_header->data_size,
(unsigned char *)receive_buf,
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pc5s_header->sourceL2Id
,&pc5s_header->destinationL2Id
#endif
@@ -980,7 +979,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -1017,7 +1016,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
@@ -1083,7 +1082,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pdcp_read_header_g.sourceL2Id
,&pdcp_read_header_g.destinationL2Id
#endif
@@ -1141,7 +1140,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pdcp_read_header_g.sourceL2Id
,&pdcp_read_header_g.destinationL2Id
#endif
@@ -1189,7 +1188,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP)
}
//TTN for D2D (PC5S)
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
void
pdcp_pc5_socket_init() {
@@ -53,7 +53,7 @@ extern int reception_from_rohc_bs(void);
extern BOOL pdcp_data_ind (module_id_t module_idP, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sduP, uint8_t is_data_plane);
extern BOOL pdcp_data_req (module_id_t module_id, uint32_t frame, uint8_t eNB_flag, rb_id_t rab_id, uint32_t muiP, uint32_t confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer,
uint8_t is_data_pdu
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#endif
@@ -128,9 +128,7 @@ boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity)
* Update sequence numbering state and Hyper Frame Number if SN has already reached
* its max value (see 5.1 PDCP Data Transfer Procedures)
*/
#if 0
LOG_D(PDCP, "Advancing RX window...\n");
#endif
if (pdcp_entity->next_pdcp_rx_sn == pdcp_calculate_max_seq_num_for_given_size(pdcp_entity->seq_num_size)) {
pdcp_entity->next_pdcp_rx_sn = 0;
@@ -152,9 +150,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
uint16_t reordering_window = 0;
#if 0
LOG_D(PDCP, "Incoming RX Sequence number is %04d\n", seq_num);
#endif
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE || pdcp_is_seq_num_valid(seq_num, pdcp_entity->seq_num_size) == FALSE) {
return FALSE;
@@ -165,9 +161,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
* (and to build PDCP Control PDU for PDCP status report)
*/
if (pdcp_mark_current_pdu_as_received(seq_num, pdcp_entity) == TRUE) {
#if 0
LOG_I(PDCP, "Received sequence number successfuly marked\n");
#endif
LOG_D(PDCP, "Received sequence number successfuly marked\n");
} else {
LOG_W(PDCP, "Cannot mark received sequence number on the bitmap!\n");
}
@@ -192,13 +186,11 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
// same the old next_pdcp_rx_sn to revert otherwise
pdcp_entity->next_pdcp_rx_sn_before_integrity = pdcp_entity->next_pdcp_rx_sn;
#if 0
if (seq_num != pdcp_entity->next_pdcp_rx_sn) {
LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num);
}
#endif
//set Next_PDCP_RX_SN to the received PDCP SN +1 ;
pdcp_entity->next_pdcp_rx_sn = seq_num;
pdcp_advance_rx_window(pdcp_entity); // + 1, and check if it is larger than Maximum_PDCP_SN:
@@ -247,9 +239,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
//set Next_PDCP_RX_SN to the received PDCP SN +1 ;
pdcp_entity->next_pdcp_rx_sn = seq_num;
pdcp_advance_rx_window(pdcp_entity); // + 1, anc check if it is larger than Maximum_PDCP_SN:
#if 0
LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num);
#endif
} else if (seq_num < pdcp_entity->next_pdcp_rx_sn) {
// use COUNT based on RX_HFN and the received PDCP SN for deciphering the PDCP PDU;
pdcp_entity->rx_hfn_offset = 0;
@@ -311,12 +301,8 @@ boolean_t pdcp_mark_current_pdu_as_received(uint16_t seq_num, pdcp_t* pdcp_entit
/*
* Set relevant bit
*/
#if 0
LOG_D(PDCP, "Marking %d. bit of %d. octet of status bitmap\n", (seq_num % 8) + 1, octet_index);
#endif
util_mark_nth_bit_of_octet(&pdcp_entity->missing_pdu_bitmap[octet_index], seq_num % 8);
#if 0
util_print_binary_representation((uint8_t*)"Current state of relevant octet: ", pdcp_entity->missing_pdu_bitmap[octet_index]);
#endif
return TRUE;
}
+5 -3
View File
@@ -200,7 +200,7 @@ void
config_req_rlc_am (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
rlc_am_info_t * const config_am_pP,
const rlc_am_info_t * config_am_pP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
)
@@ -509,6 +509,7 @@ rlc_am_rx (
default:
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state);
list_free (&data_indP.data);
}
}
@@ -551,7 +552,9 @@ rlc_am_mac_status_indication (
rlc->last_absolute_subframe_status_indication = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
rlc->nb_bytes_requested_by_mac = tb_sizeP;
if (tb_sizeP > 0) {
rlc->nb_bytes_requested_by_mac = tb_sizeP;
}
status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, rlc);
@@ -585,7 +588,6 @@ rlc_am_mac_status_indication (
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) {
+26 -35
View File
@@ -35,21 +35,6 @@
# ifndef __RLC_AM_H__
# define __RLC_AM_H__
# ifdef RLC_AM_C
# define private_rlc_am(x)
# define protected_rlc_am(x)
# define public_rlc_am(x)
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am(x)
# define protected_rlc_am(x) extern x
# define public_rlc_am(x) extern x
# else
# define private_rlc_am(x)
# define protected_rlc_am(x)
# define public_rlc_am(x) extern x
# endif
# endif
# include "platform_types.h"
# include "rlc_def.h"
# include "rlc_def_lte.h"
@@ -117,9 +102,9 @@
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
public_rlc_am(void rlc_am_release (
void rlc_am_release (
const protocol_ctxt_t* const ctxtP,
rlc_am_entity_t * const rlc_pP);)
rlc_am_entity_t * const rlc_pP);
/** @addtogroup _rlc_am_init_impl_
* @{
@@ -133,12 +118,14 @@ public_rlc_am(void rlc_am_release (
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_am(void config_req_rlc_am (
const protocol_ctxt_t* const ctxtP,
const srb_flag_t srb_flagP,
const rlc_am_info_t * const config_amP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
void
config_req_rlc_am (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rlc_am_info_t * config_am_pP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
);
/*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP)
* \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs
@@ -148,12 +135,12 @@ public_rlc_am(void config_req_rlc_am (
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_am(void config_req_rlc_am_asn1 (
void config_req_rlc_am_asn1 (
const protocol_ctxt_t* const ctxtP,
const srb_flag_t srb_flagP,
const struct RLC_Config__am * const config_amP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
const logical_chan_id_t chan_idP);
/** @} */
@@ -218,7 +205,7 @@ public_rlc_am(void config_req_rlc_am_asn1 (
* \param[out] stat_timer_poll_retransmit_timed_out Number of times the timer "poll_retransmit" has timed-out.
* \param[out] stat_timer_status_prohibit_timed_out Number of times the timer "status_prohibit" has timed-out.
*/
public_rlc_am(void rlc_am_stat_req (
void rlc_am_stat_req (
const protocol_ctxt_t* const ctxtP,
rlc_am_entity_t * const rlc_pP,
unsigned int* stat_tx_pdcp_sdu,
@@ -247,14 +234,18 @@ public_rlc_am(void rlc_am_stat_req (
unsigned int* stat_rx_control_bytes,
unsigned int* stat_timer_reordering_timed_out,
unsigned int* stat_timer_poll_retransmit_timed_out,
unsigned int* stat_timer_status_prohibit_timed_out);)
unsigned int* stat_timer_status_prohibit_timed_out);
/*! \fn void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP, void * const rlc_pP)
* \brief Request the segmentation of SDUs based on status previously sent by MAC.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
private_rlc_am( void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP,void * const rlc_pP);)
void
rlc_am_get_pdus (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t * const rlc_pP
);
/*! \fn void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indication)
* \brief Process the received PDUs from lower layer.
@@ -262,7 +253,7 @@ private_rlc_am( void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP,v
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] data_indication PDUs from MAC.
*/
protected_rlc_am( void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind);)
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,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.
@@ -273,14 +264,14 @@ protected_rlc_am( void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void *
* \param[in] enb_flagP eNB or UE flag indication.
* \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,const eNB_flag_t enb_flagP);)
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)
* \brief Set available TBS for RLC Tx just before am_mac_data_request. Used for UE only.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] tb_sizeP Available Tx Transport Block size in bytes.
*/
public_rlc_am( void rlc_am_set_nb_bytes_requested_by_mac (void * const rlc_pP,const tb_size_t tb_sizeP);)
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,const eNB_flag_t enb_flagP)
* \brief Gives PDUs to lower layer MAC.
@@ -289,7 +280,7 @@ public_rlc_am( void rlc_am_set_nb_bytes_requested_by_mac (void * const
* \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.
*/
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);)
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)
* \brief Receive PDUs from lower layer MAC.
@@ -297,14 +288,14 @@ public_rlc_am( struct mac_data_req rlc_am_mac_data_request (const protocol_ct
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] data_indP PDUs from MAC.
*/
public_rlc_am( void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP);)
void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP);
/*! \fn uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP)
* \brief Get Tx Buffer Occupancy.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
public_rlc_am( uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP);)
uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP);
/*! \fn void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP)
* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
@@ -312,6 +303,6 @@ public_rlc_am( uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] sduP SDU. (A struct rlc_am_data_req is mapped on sduP->data.)
*/
public_rlc_am( void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP);)
void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP);
/** @} */
# endif
+16 -2
View File
@@ -42,8 +42,17 @@ void rlc_am_free_in_sdu(
{
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
/* BugFix: SDU shall have been already freed during initial PDU segmentation or concatenation !! */
//Assertion(eNB)_PRAN_DesignDocument_annex No.761
if(rlcP->input_sdus[index_in_bufferP].mem_block != NULL)
{
LOG_E(RLC, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
index_in_bufferP,rlcP->channel_id);
return;
}
/*
AssertFatal(rlcP->input_sdus[index_in_bufferP].mem_block == NULL, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
index_in_bufferP,rlcP->channel_id);
*/
/*
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
@@ -121,8 +130,13 @@ rlc_am_pdu_sdu_data_cnf(
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].nb_sdus; pdu_sdu_index++) {
sdu_index = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].sdus_index[pdu_sdu_index];
assert(sdu_index >= 0);
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
//assert(sdu_index >= 0);
//assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
if(sdu_index < 0 || sdu_index >= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
LOG_E(RLC, "sdu_index error. sdu_index %d, pdu_sdu_index %d\n", sdu_index, pdu_sdu_index);
continue;
}
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
if ((rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) &&
+4 -20
View File
@@ -34,22 +34,6 @@
*/
# ifndef __RLC_AM_IN_SDU_H__
# define __RLC_AM_IN_SDU_H__
//-----------------------------------------------------------------------------
# ifdef RLC_AM_IN_SDU_C
# define private_rlc_am_in_sdu(x) x
# define protected_rlc_am_in_sdu(x) x
# define public_rlc_am_in_sdu(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_in_sdu(x)
# define protected_rlc_am_in_sdu(x) extern x
# define public_rlc_am_in_sdu(x) extern x
# else
# define private_rlc_am_in_sdu(x)
# define protected_rlc_am_in_sdu(x)
# define public_rlc_am_in_sdu(x) extern x
# endif
# endif
/*! \fn void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
* \brief Free a higher layer SDU stored in input_sdus[] buffer.
* \param[in] ctxtP Running context.
@@ -57,7 +41,7 @@
* \param[in] index_in_bufferP Position index of the SDU.
* \note Update also the RLC AM instance variables nb_sdu, current_sdu_index, nb_sdu_no_segmented.
*/
protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);)
void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);
/*! \fn void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
@@ -67,7 +51,7 @@ protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (const protocol_ctxt_t* con
* \param[in] index_in_bufferP Position index of the SDU.
* \note This procedure is called when the SDU segmentation is done for this SDU. Update also the RLC AM instance variable nb_sdu_no_segmented.
*/
protected_rlc_am_in_sdu(void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);)
void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);
/*! \fn signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP)
@@ -76,7 +60,7 @@ protected_rlc_am_in_sdu(void rlc_am_free_in_sdu_data (const protocol_ctxt_t* con
* \param[in] rlcP RLC AM protocol instance pointer.
* \return 1 if the buffer is empty, else 0.
*/
protected_rlc_am_in_sdu(signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP);)
signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP);
/*! \fn void rlc_am_pdu_sdu_data_cnf(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,const rlc_sn_t snP)
* \brief Process SDU cnf of a ACKED PDU for all SDUs concatenated in this PDU.
@@ -84,6 +68,6 @@ protected_rlc_am_in_sdu(signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t*
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] snP Sequence number of the PDU.
*/
protected_rlc_am_in_sdu(void rlc_am_pdu_sdu_data_cnf(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,const rlc_sn_t snP);)
void rlc_am_pdu_sdu_data_cnf(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,const rlc_sn_t snP);
/** @} */
# endif
+5 -20
View File
@@ -37,21 +37,6 @@
# include "UTIL/MEM/mem_block.h"
//-----------------------------------------------------------------------------
# ifdef RLC_AM_INIT_C
# define private_rlc_am_init(x) x
# define protected_rlc_am_init(x) x
# define public_rlc_am_init(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_init(x)
# define protected_rlc_am_init(x) extern x
# define public_rlc_am_init(x) extern x
# else
# define private_rlc_am_init(x)
# define protected_rlc_am_init(x)
# define public_rlc_am_init(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "platform_types.h"
#include "platform_constants.h"
@@ -76,13 +61,13 @@ typedef volatile struct {
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
public_rlc_am_init( void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t* rlc_pP);)
void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t* rlc_pP);
/*! \fn void rlc_am_cleanup(rlc_am_entity_t *const rlc_pP)
* \brief Free all memory resources allocated and kept by this RLC AM instance.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlc_pP);)
void rlc_am_cleanup(rlc_am_entity_t* rlc_pP);
/*! \fn void rlc_am_configure(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint16_t max_retx_thresholdP, uint16_t poll_pduP, uint16_t poll_byteP, uint32_t t_poll_retransmitP, uint32_t t_reorderingP, uint32_t t_status_prohibitP)
* \brief Set RLC AM protocol parameters.
@@ -96,14 +81,14 @@ AMD PDU.
* \param[in] t_reorderingP This timer is used by the receiving side of an AM RLC entity in order to detect loss of RLC PDUs at lower layer, value in frames.
* \param[in] t_status_prohibitP This timer is used by the receiving side of an AM RLC entity in order to prohibit transmission of a STATUS PDU, value in frames.
*/
public_rlc_am_init( void rlc_am_configure(const protocol_ctxt_t* const ctxtP,
void rlc_am_configure(const protocol_ctxt_t* const ctxtP,
rlc_am_entity_t * const rlc_pP,
const uint16_t max_retx_thresholdP,
const uint16_t poll_pduP,
const uint16_t poll_byteP,
const uint32_t t_poll_retransmitP,
const uint32_t t_reorderingP,
const uint32_t t_status_prohibitP);)
const uint32_t t_status_prohibitP);
/*! \fn void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
@@ -114,6 +99,6 @@ public_rlc_am_init( void rlc_am_configure(const protocol_ctxt_t* const ctxtP,
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP);)
void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP);
/** @} */
#endif
@@ -57,7 +57,12 @@ rlc_am_reassembly (
if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
rlc_pP->output_sdu_size_to_write = 0;
assert(rlc_pP->output_sdu_in_construction != NULL);
//assert(rlc_pP->output_sdu_in_construction != NULL);
if(rlc_pP->output_sdu_in_construction == NULL) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] output_sdu_in_construction is NULL\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
return;
}
}
if (rlc_pP->output_sdu_in_construction != NULL) {
@@ -198,10 +203,16 @@ rlc_am_send_sdu (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
//free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
//Assertion(eNB)_PRAN_DesignDocument_annex No.764
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->output_sdu_size_to_write);
/*
AssertFatal(3==4,
PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->output_sdu_size_to_write);
*/
}
rlc_pP->output_sdu_size_to_write = 0;
@@ -270,7 +281,9 @@ rlc_am_reassemble_pdu(
break;
default:
assert(0 != 0);
//Assertion(eNB)_PRAN_DesignDocument_annex No.1428
LOG_E(RLC, "RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
// assert(0 != 0);
}
} else {
switch (pdu_info->fi) {
@@ -386,7 +399,9 @@ rlc_am_reassemble_pdu(
break;
default:
assert(1 != 1);
//Assertion(eNB)_PRAN_DesignDocument_annex No.1429
LOG_E(RLC, "not RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
// assert(1 != 1);
}
}
@@ -34,27 +34,12 @@
*/
#ifndef __RLC_AM_REASSEMBLY_H__
# define __RLC_AM_REASSEMBLY_H__
# ifdef RLC_AM_REASSEMBLY_C
# define private_rlc_am_reassembly(x) x
# define protected_rlc_am_reassembly(x) x
# define public_rlc_am_reassembly(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_reassembly(x)
# define protected_rlc_am_reassembly(x) extern x
# define public_rlc_am_reassembly(x) extern x
# else
# define private_rlc_am_reassembly(x)
# define protected_rlc_am_reassembly(x)
# define public_rlc_am_reassembly(x) extern x
# endif
# endif
/*! \fn void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
* \brief Reset the data cursor index in the output SDU buffer to zero.
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);)
void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);
/*! \fn void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pPuint8_t * srcP, int32_t lengthP)
* \brief Concatenate datas at the tail of the output SDU in construction. This SDU in construction will be sent to higher layer.
@@ -63,14 +48,14 @@ private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (const protocol_ctxt_t* co
* \param[in] srcP Pointer on data to be reassemblied.
* \param[in] lengthP Length of data to be reassemblied.
*/
private_rlc_am_reassembly( void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint8_t * srcP, int32_t lengthP);)
void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint8_t * srcP, int32_t lengthP);
/*! \fn void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP)
* \brief Send the output SDU in construction to higher layer.
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
private_rlc_am_reassembly( void rlc_am_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);)
void rlc_am_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);
/*! \fn void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const mem_block_t* const tb_pP,boolean_t free_rlc_pdu)
* \brief Reassembly a RLC AM PDU, depending of the content of this PDU, data will be reassemblied to the current output SDU, the current will be sent to higher layers or not, after or before the reassembly, or no send of SDU will be triggered, depending on FI field in PDU header.
@@ -79,7 +64,7 @@ private_rlc_am_reassembly( void rlc_am_send_sdu (const protocol_ctxt_t* co
* \param[in] tb_pP RLC AM PDU embedded in a mem_block_t.
* \param[in] free_rlc_pdu Flag for freeing RLC AM PDU after reassembly.
*/
protected_rlc_am_reassembly( void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, mem_block_t* const tb_pP,boolean_t free_rlc_pdu);)
void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, mem_block_t* const tb_pP,boolean_t free_rlc_pdu);
/** @} */
#endif
@@ -47,9 +47,15 @@ rlc_am_get_data_pdu_infos(
pdu_info_pP->d_c = header_pP->b1 >> 7;
pdu_info_pP->num_li = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.766
if(pdu_info_pP->d_c == 0)
{
LOG_E(RLC, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
return -2;
}
/*
AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
*/
pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01;
pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01;
pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
@@ -264,9 +270,17 @@ rlc_am_receive_routing (
rlc_pP->stat_rx_control_pdu += 1;
rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes);
// Test if remaining bytes not processed (up to know, highest probability is bug in MAC)
//Assertion(eNB)_PRAN_DesignDocument_annex No.767
if(tb_size_in_bytes != 0)
{
LOG_E(RLC, "Remaining %d bytes following a control PDU\n",
tb_size_in_bytes);
}
/*
AssertFatal( tb_size_in_bytes == 0,
"Remaining %d bytes following a control PDU",
tb_size_in_bytes);
*/
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n",
@@ -396,14 +410,20 @@ rlc_am_receive_process_data_pdu (
}
if (pdu_info_p->sn == rlc_pP->vr_r) {
mem_block_t* cursor_p = rlc_pP->receiver_buffer.head;
rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
if( (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) == (pdu_cursor_mgnt_p->all_segments_received)){
if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) {
rlc_am_rx_update_vr_r(ctxt_pP, rlc_pP, tb_pP);
rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
}
reassemble = rlc_am_rx_check_vr_reassemble(ctxt_pP, rlc_pP);
//TODO : optimization : check whether a reassembly is needed by looking at LI, FI, SO, etc...
}else{
LOG_E(RLC, "BAD all_segments_received!!! discard buffer!!!\n");
/* Discard received block if out of window, duplicate or header error */
free_mem_block (tb_pP, __func__);
}
}
//FNA: fix check VrX out of receiving window
@@ -34,21 +34,6 @@
*/
# ifndef __RLC_AM_RECEIVER_H__
# define __RLC_AM_RECEIVER_H__
# ifdef RLC_AM_RECEIVER_C
# define private_rlc_am_receiver(x) x
# define protected_rlc_am_receiver(x) x
# define public_rlc_am_receiver(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_receiver(x)
# define protected_rlc_am_receiver(x) extern x
# define public_rlc_am_receiver(x) extern x
# else
# define private_rlc_am_receiver(x)
# define protected_rlc_am_receiver(x)
# define public_rlc_am_receiver(x) extern x
# endif
# endif
/*! \fn signed int rlc_am_get_data_pdu_infos( const protocol_ctxt_t* const ctxt_pP, const rlc_am_entity_t * const rlc_pP,rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
* \param[in] ctxt_pP Running context.
@@ -58,12 +43,12 @@
* \param[in] pdu_infoP Structure containing extracted informations from PDU.
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
*/
protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(
signed int rlc_am_get_data_pdu_infos(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t * const rlc_pP,
rlc_am_pdu_sn_10_t* headerP,
int16_t sizeP,
rlc_am_pdu_info_t* pdu_infoP));
rlc_am_pdu_info_t* pdu_infoP);
/*! \fn void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP)
* \brief Display RLC AM PDU informations.
@@ -71,7 +56,7 @@ protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] pdu_infoP Structure containing extracted informations of a PDU.
*/
protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP);)
void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP);
/*! \fn void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP)
* \brief Update RLC AM protocol variable VR(MS).
@@ -80,7 +65,7 @@ protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(const protocol_ctx
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
* \note It is assumed that the sequence number of the transport block is equal to VR(MS)
*/
protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);)
void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);
/*! \fn void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP)
* \brief Update RLC AM protocol variable VR(R).
@@ -89,7 +74,7 @@ protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* co
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
* \note It is assumed that the sequence number of the transport block is equal to VR(R)
*/
protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);)
void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);
/*! \fn void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP)
* \brief Convert transport blocks received from MAC layer into RLC AM PDUs, and dispatch to the right processing block these PDUS upon their type (CONTROL/DATA).
@@ -97,7 +82,7 @@ protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (const protocol_ctxt_t* co
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] data_indP Transport blocks received from MAC layer.
*/
protected_rlc_am_receiver( void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP));
void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP);
/*! \fn void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)
* \brief Process an incoming data PDU received from MAC layer.
@@ -107,7 +92,7 @@ protected_rlc_am_receiver( void rlc_am_receive_routing (const protocol_ctxt_t* c
* \param[in] first_byteP Pointer on first byte of the PDU.
* \param[in] tb_size_in_bytesP Transport block size in bytes (same as PDU size in bytes).
*/
private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP,
uint16_t tb_size_in_bytesP));
void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP,
uint16_t tb_size_in_bytesP);
/** @} */
# endif
+174 -613
View File
@@ -60,10 +60,14 @@ boolean_t rlc_am_nack_pdu (
sdu_size_t pdu_data_to_retx = 0;
if (mb_p != NULL) {
assert(so_startP <= so_endP);
//assert(so_startP <= so_endP);
if(so_startP > so_endP) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, so_startP %d, so_endP %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),so_startP, so_endP);
status = FALSE;
}
// Handle full PDU NACK first
if ((so_startP == 0) && (so_endP == 0x7FFF)) {
else if ((so_startP == 0) && (so_endP == 0x7FFF)) {
if ((prev_nack_snP != snP) && (tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
pdu_data_to_retx = tx_data_pdu_buffer_p->payload_size;
/* Increment VtReTxNext if this is the first NACK or if some segments have already been transmitted */
@@ -82,12 +86,17 @@ boolean_t rlc_am_nack_pdu (
snP,
so_stopP);
#endif
assert(tx_data_pdu_buffer_p->nack_so_start < tx_data_pdu_buffer_p->payload_size);
//assert(tx_data_pdu_buffer_p->nack_so_start < tx_data_pdu_buffer_p->payload_size);
if(tx_data_pdu_buffer_p->nack_so_start >= tx_data_pdu_buffer_p->payload_size){
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, nack_so_start %d, payload_size %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->payload_size);
status = FALSE;
}
}
else {
status = FALSE;
}
}
}
else if (tx_data_pdu_buffer_p->flags.max_retransmit == 0) {
// Handle Segment offset
if (so_endP == 0x7FFF) {
@@ -163,36 +172,6 @@ boolean_t rlc_am_nack_pdu (
rlc_pP->retrans_num_pdus ++;
}
}
/* TODO: Move this part in UL SCH processing */
#if 0
if (rlc_pP->tx_data_pdu_buffer[snP].retx_count >= rlc_pP->max_retx_threshold) {
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP].nb_sdus; pdu_sdu_index++) {
sdu_index = rlc_pP->tx_data_pdu_buffer[snP].sdus_index[pdu_sdu_index];
assert(pdu_sdu_index < RLC_AM_MAX_SDU_IN_PDU);
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
if (rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) {
#if TEST_RLC_AM
rlc_am_v9_3_0_test_data_conf (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_NO);
#else
rlc_data_conf(ctxt_pP, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_NO, rlc_pP->is_data_plane);
#endif
rlc_pP->stat_tx_pdcp_sdu_discarded += 1;
rlc_pP->stat_tx_pdcp_bytes_discarded += rlc_pP->input_sdus[sdu_index].sdu_size;
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
"0 "PROTOCOL_RLC_AM_MSC_FMT" Dropped SDU mui %u cause max_retx %u reached",\
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP),
rlc_pP->input_sdus[sdu_index].mui,
rlc_pP->max_retx_threshold);
rlc_am_free_in_sdu(ctxt_pP, rlc_pP, sdu_index);
}
}
}
#endif
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU SN %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -225,9 +204,18 @@ void rlc_am_ack_pdu (
}
if (tx_data_pdu_buffer->retx_payload_size) {
//Assertion(eNB)_PRAN_DesignDocument_annex No.768
if(tx_data_pdu_buffer->flags.ack != 0)
{
LOG_E(RLC, "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return;
}
/*
AssertFatal (tx_data_pdu_buffer->flags.ack == 0,
"RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_buffer->retx_payload_size;
tx_data_pdu_buffer->retx_payload_size = 0;
tx_data_pdu_buffer->num_holes = 0;
@@ -256,15 +244,23 @@ mem_block_t* rlc_am_retransmit_get_copy (
const rlc_sn_t snP)
{
mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block;
//Assertion(eNB)_PRAN_DesignDocument_annex No.784
if(mb_original_p == NULL)
{
LOG_E(RLC,"RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (mb_original_p != NULL, "RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE];
/* We need to allocate a new buffer and copy to it because header content may change for Polling bit */
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size, __func__);
if(mb_copy == NULL) return NULL;
memcpy(mb_copy->data, mb_original_p->data, size);
rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
@@ -295,20 +291,43 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
uint8_t li_bit_offset = 4; /* toggle between 0 and 4 */
uint8_t li_jump_offset = 1; /* toggle between 1 and 2 */
//Assertion(eNB)_PRAN_DesignDocument_annex No.774
if(mb_original_p == NULL)
{
LOG_E(RLC,"RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (mb_original_p != NULL, "RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
//Assertion(eNB)_PRAN_DesignDocument_annex No.775
if(pdu_mngt->payload != mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size)
{
LOG_E(RLC,"RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (pdu_mngt->payload == mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size,
"RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
*/
/* Init ReTx Hole list if not configured, ie the whole PDU has to be retransmitted */
if (pdu_mngt->num_holes == 0)
{
//Assertion(eNB)_PRAN_DesignDocument_annex No.776
if(pdu_mngt->retx_payload_size != pdu_mngt->payload_size)
{
LOG_E(RLC,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (pdu_mngt->retx_payload_size == pdu_mngt->payload_size,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
pdu_mngt->retx_hole_index = 0;
pdu_mngt->hole_so_start[0] = 0;
pdu_mngt->hole_so_stop[0] = pdu_mngt->payload_size - 1;
@@ -318,11 +337,18 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Init SO Start and SO Stop */
retx_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index];
retx_so_stop = pdu_mngt->hole_so_stop[pdu_mngt->retx_hole_index];
//Assertion(eNB)_PRAN_DesignDocument_annex No.777
if((retx_so_start > retx_so_stop) || (retx_so_stop - retx_so_start + 1 > pdu_mngt->payload_size))
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((retx_so_start <= retx_so_stop) && (retx_so_stop - retx_so_start + 1 <= pdu_mngt->payload_size),
"RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
*/
/* Init FI to the same value as original PDU */
fi_start = (!(RLC_AM_PDU_GET_FI_START(*(pdu_mngt->first_byte))));
fi_end = (!(RLC_AM_PDU_GET_FI_END(*(pdu_mngt->first_byte))));
@@ -339,6 +365,7 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
*payload_sizeP = retx_so_stop - retx_so_start + 1;
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + *payload_sizeP;
@@ -408,8 +435,17 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Set FI Start if retx_so_start = cumulated data size */
fi_start = TRUE;
/* there must be at least one SDU more */
//Assertion(eNB)_PRAN_DesignDocument_annex No.778
if(sdu_index >= pdu_mngt->nb_sdus)
{
LOG_E(RLC,"RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (sdu_index < pdu_mngt->nb_sdus, "RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
*/
if (sdu_index < pdu_mngt->nb_sdus - 1)
{
temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
@@ -487,17 +523,33 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Set number of LIs in the segment */
num_LIs_pdu_segment = sdu_segment_index - 1;
//Assertion(eNB)_PRAN_DesignDocument_annex No.779
if(num_LIs_pdu_segment > pdu_mngt->nb_sdus - 1)
{
LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (num_LIs_pdu_segment <= pdu_mngt->nb_sdus - 1, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
*/
/* Bound to available TBS taking into account min PDU segment header*/
sdu_segment_index = 0;
while ((sdu_segment_index < num_LIs_pdu_segment + 1) && (rlc_pP->nb_bytes_requested_by_mac > *payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index)))
{
//Assertion(eNB)_PRAN_DesignDocument_annex No.780
if(sdus_segment_size[sdu_segment_index] <= 0)
{
LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
sdu_segment_index++;
continue;
}
/*
AssertFatal (sdus_segment_size[sdu_segment_index] > 0, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
*/
/* Add next sdu_segment_index to data part */
if (RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index) + (*payload_sizeP) + sdus_segment_size[sdu_segment_index] <= rlc_pP->nb_bytes_requested_by_mac)
{
@@ -519,11 +571,18 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* update retx_so_stop */
retx_so_stop = retx_so_start + (*payload_sizeP) - 1;
//Assertion(eNB)_PRAN_DesignDocument_annex No.781
if((retx_so_stop > pdu_mngt->payload_size - 1) || (retx_so_stop - retx_so_start + 1 >= pdu_mngt->payload_size))
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((retx_so_stop <= pdu_mngt->payload_size - 1) && (retx_so_stop - retx_so_start + 1 < pdu_mngt->payload_size),
"RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
*/
/* init FI End to FALSE if retx_so_stop is not end of PDU */
if (retx_so_stop != pdu_mngt->payload_size - 1)
{
@@ -541,16 +600,33 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
fi_end = TRUE;
}
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.782
if(data_size != *payload_sizeP)
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
data_size,*payload_sizeP,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (data_size == *payload_sizeP, "RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
data_size,*payload_sizeP,sn,rlc_pP->channel_id);
*/
/* Allocation */
//Assertion(eNB)_PRAN_DesignDocument_annex No.783
if(header_segment_length + *payload_sizeP > pdu_mngt->header_and_payload_size + 2)
{
LOG_E(RLC, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (header_segment_length + *payload_sizeP <= pdu_mngt->header_and_payload_size + 2, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
*/
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + header_segment_length + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = header_segment_length + *payload_sizeP;
@@ -662,472 +738,6 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
return mem_pdu_segment_p;
}
#if 0
//-----------------------------------------------------------------------------
mem_block_t* rlc_am_retransmit_get_subsegment(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
sdu_size_t * const sizeP /* in-out*/)
{
// 5.2 ARQ procedures
// ARQ procedures are only performed by an AM RLC entity.
// 5.2.1 Retransmission
// The transmitting side of an AM RLC entity can receive a negative acknowledgement (notification of reception failure
// by its peer AM RLC entity) for an AMD PDU or a portion of an AMD PDU by the following:
// - STATUS PDU from its peer AM RLC entity.
//
// When receiving a negative acknowledgement for an AMD PDU or a portion of an AMD PDU by a STATUS PDU from
// its peer AM RLC entity, the transmitting side of the AM RLC entity shall:
// - if the SN of the corresponding AMD PDU falls within the range VT(A) <= SN < VT(S):
// - consider the AMD PDU or the portion of the AMD PDU for which a negative acknowledgement was
// received for retransmission.
//
// When an AMD PDU or a portion of an AMD PDU is considered for retransmission, the transmitting side of the AM
// RLC entity shall:
// - if the AMD PDU is considered for retransmission for the first time:
// - set the RETX_COUNT associated with the AMD PDU to zero;
// - else, if it (the AMD PDU or the portion of the AMD PDU that is considered for retransmission) is not pending
// for retransmission already, or a portion of it is not pending for retransmission already:
// - increment the RETX_COUNT;
// - if RETX_COUNT = maxRetxThreshold:
// - indicate to upper layers that max retransmission has been reached.
//
// When retransmitting an AMD PDU, the transmitting side of an AM RLC entity shall:
// - if the AMD PDU can entirely fit within the total size of RLC PDU(s) indicated by lower layer at the particular
// transmission opportunity:
// - deliver the AMD PDU as it is except for the P field (the P field should be set according to sub clause 5.2.2) to
// lower layer;
// - otherwise:
// - segment the AMD PDU, form a new AMD PDU segment which will fit within the total size of RLC PDU(s)
// indicated by lower layer at the particular transmission opportunity and deliver the new AMD PDU segment
// to lower layer.
//
// When retransmitting a portion of an AMD PDU, the transmitting side of an AM RLC entity shall:
// - segment the portion of the AMD PDU as necessary, form a new AMD PDU segment which will fit within the
// total size of RLC PDU(s) indicated by lower layer at the particular transmission opportunity and deliver the new
// AMD PDU segment to lower layer.
//
// When forming a new AMD PDU segment, the transmitting side of an AM RLC entity shall:
// - only map the Data field of the original AMD PDU to the Data field of the new AMD PDU segment;
// - set the header of the new AMD PDU segment in accordance with the description in sub clause 6.;
// - set the P field according to sub clause 5.2.2.
mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_info_t pdu_info;
int max_copy_payload_size;
//LG avoid WARNING int test_max_copy_payload_size;
int test_pdu_copy_size = 0;
((struct mac_tb_req*)(mb_sub_segment_p->data))->data_ptr = (uint8_t*)&(mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
if (rlc_am_get_data_pdu_infos(ctxt_pP, rlc_pP, pdu_original_p, rlc_pP->tx_data_pdu_buffer[snP].header_and_payload_size, &pdu_info) >= 0) {
int li_index = 0;
int start_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
int stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL PDU SN %04d:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP);
rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, &pdu_info);
// all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes
// to the last byte of the AMD PDU)
if (stop_offset == 0x7FFF) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] UPDATED RETRANS PDU SN %04d nack_so_stop FROM 0x7FFF to %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
stop_offset);
}
// FIXED PART AMD PDU SEGMENT HEADER
// 6.2.1.5 AMD PDU segment
// AMD PDU segment consists of a Data field and an AMD PDU segment header.
//
// AMD PDU segment header consists of a fixed part (fields that are present for every AMD PDU segment) and an
// extension part (fields that are present for an AMD PDU segment when necessary). The fixed part of the AMD PDU
// segment header itself is byte aligned and consists of a D/C, a RF, a P, a FI, an E, a SN, a LSF and a SO. The extension
// part of the AMD PDU segment header itself is byte aligned and consists of E(s) and LI(s).
//
// An AMD PDU segment header consists of an extension part only when more than one Data field elements are present
// in the AMD PDU segment, in which case an E and a LI are present for every Data field element except the last.
// Furthermore, when an AMD PDU segment header consists of an odd number of LI(s), four padding bits follow after the
// last LI.
pdu_sub_segment_p->b1 = (pdu_original_p->b1 & 0x83) | 0x40;
pdu_sub_segment_p->b2 = pdu_original_p->b2;
pdu_sub_segment_p->data[0] = ((uint8_t)(start_offset >> 8));
pdu_sub_segment_p->data[1] = ((uint8_t)(start_offset & 0xFF));
*sizeP = *sizeP - 4;
int continue_fill_pdu_with_pdu = 1;
int test_pdu_remaining_size = *sizeP;
int test_num_li = 0;
int fill_num_li ;
int test_li_sum = 0;
int not_test_fi = 0; // by default not 1st byte and not last byte af a SDU
int test_start_offset;
unsigned int test_li_length_in_bytes = 1;
int16_t test_li_list[RLC_AM_MAX_SDU_IN_PDU];
uint8_t* fill_payload_p;
//int test_fi_last_byte_pdu_is_last_byte_sdu = 0;
//int test_fi_first_byte_pdu_is_first_byte_sdu = 0;
rlc_am_e_li_t* e_li_sub_segment = (rlc_am_e_li_t*)(&pdu_sub_segment_p->data[2]);
//int first_enter_in_start_offset_lt_li_sum = 1;
int not_fi_original = ((pdu_original_p->b1 & 0x18) >> 3) ^ 3;
//-------------------------------------------------------
// set MAX payload size that can be copied
// first constraint : the size of the hole to retransmit
rlc_am_get_next_hole(ctxt_pP, rlc_pP, snP, &start_offset, &stop_offset);
max_copy_payload_size = stop_offset - start_offset + 1;
assert(max_copy_payload_size > 0);
assert(test_pdu_remaining_size > 0);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] HOLE FOUND SO %d -> %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
start_offset,
stop_offset);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL FI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
(pdu_original_p->b1 & 0x18) >> 3);
// second constraint the size of the pdu_p requested by MAC layer
if (max_copy_payload_size > test_pdu_remaining_size) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
test_pdu_remaining_size);
max_copy_payload_size = test_pdu_remaining_size;
}
if (start_offset == 0) {
not_test_fi = (not_fi_original & 0x02);
}
test_start_offset = start_offset;
//.find the li corresponding to the nack_so_start (start_offset)
if (pdu_info.num_li > 0) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL NUM LI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_info.num_li);
while ((li_index < pdu_info.num_li) && (continue_fill_pdu_with_pdu)) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] FIND LI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_info.li_list[li_index]);
if (max_copy_payload_size > test_pdu_remaining_size) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
test_pdu_remaining_size);
max_copy_payload_size = test_pdu_remaining_size;
}
assert(max_copy_payload_size >= 0);
assert(test_pdu_remaining_size >= 0);
test_li_sum += pdu_info.li_list[li_index];
//---------------------------------------------------------------
if (test_start_offset < test_li_sum) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] test_start_offset < test_li_sum %d < %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset,
test_li_sum);
/*if (test_max_copy_payload_size > (test_li_sum - test_start_offset)) {
#if TRACE_RLC_AM_RESEGMENT
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] CUT test_max_copy_payload_size with test_li_sum - test_start_offset %d -> %d\n",ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, test_max_copy_payload_size, test_li_sum - test_start_offset);
#endif
test_max_copy_payload_size = test_li_sum - test_start_offset;
}*/
if ((max_copy_payload_size + test_start_offset) < test_li_sum) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (max_copy_payload_size %d + test_start_offset %d) < test_li_sum %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
test_start_offset,
test_li_sum);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset ,
test_start_offset + max_copy_payload_size - 1,
max_copy_payload_size );
assert(max_copy_payload_size > 0);
continue_fill_pdu_with_pdu = 0;
test_pdu_copy_size = test_pdu_copy_size + max_copy_payload_size;
test_start_offset = test_start_offset + max_copy_payload_size;
not_test_fi = not_test_fi & 0x02; // clear b0, last byte does not correspond to last byte of a SDU
max_copy_payload_size = 0;
} else if ((max_copy_payload_size + test_start_offset) == test_li_sum) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (max_copy_payload_size + test_start_offset) == test_li_sum %d == %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
(max_copy_payload_size + test_start_offset) ,
test_li_sum);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset ,
test_start_offset + max_copy_payload_size - 1,
max_copy_payload_size );
assert(max_copy_payload_size > 0);
continue_fill_pdu_with_pdu = 0;
test_pdu_copy_size = test_pdu_copy_size + max_copy_payload_size;
test_start_offset = test_start_offset + max_copy_payload_size;
not_test_fi = not_test_fi | 0x01;// set b0, last byte does correspond to last byte of a SDU
max_copy_payload_size = 0;
} else if ((max_copy_payload_size + test_start_offset - (test_li_length_in_bytes ^ 3)) > test_li_sum) {
LOG_T(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (max_copy_payload_size + test_start_offset - (test_li_length_in_bytes ^ 3)) > test_li_sum %d > %d\n SET LI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
(max_copy_payload_size + test_start_offset) + (test_li_length_in_bytes ^ 3),
test_li_sum,
test_li_sum - test_start_offset);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset ,
test_li_sum - 1,
test_li_sum - test_start_offset );
assert((test_li_sum - test_start_offset) > 0);
test_li_list[test_num_li++] = test_li_sum - test_start_offset;
test_pdu_copy_size = test_pdu_copy_size + test_li_sum - test_start_offset;
test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
test_pdu_remaining_size = test_pdu_remaining_size - test_li_sum + test_start_offset -
test_li_length_in_bytes;
max_copy_payload_size = max_copy_payload_size - test_li_sum + test_start_offset - test_li_length_in_bytes;
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] NOW max_copy_payload_size %d BYTES test_start_offset %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
test_li_sum);
// normally the next while itereation will add bytes to PDU
//not_test_fi = not_test_fi | 0x01; // set b0, last byte does correspond to last byte of a SDU
test_start_offset = test_li_sum;
} else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (test_max_copy_payload_size + test_start_offset ) > test_li_sum %d > %d\n NO REMAINING SIZE FOR LI",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
(max_copy_payload_size + test_start_offset),
test_li_sum);
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset ,
test_li_sum - 1,
test_li_sum - test_start_offset );
assert((test_li_sum - test_start_offset) > 0);
continue_fill_pdu_with_pdu = 0;
test_pdu_copy_size = test_pdu_copy_size + test_li_sum - test_start_offset;
test_pdu_remaining_size = test_pdu_remaining_size - test_li_sum + test_start_offset;
max_copy_payload_size = max_copy_payload_size - test_li_sum + test_start_offset;
test_start_offset = test_li_sum;
not_test_fi = not_test_fi | 0x01; // set b0, last byte does correspond to last byte of a SDU
}
//---------------------------------------------------------------
// start offset start at the begining of a SDU
// and it cant be the first data field of the original PDU
} else if (test_start_offset == test_li_sum) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (test_start_offset == test_li_sum) %d == %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_start_offset ,
test_li_sum);
if ((test_num_li == 0) && (test_pdu_copy_size == 0)) {
not_test_fi = not_test_fi | 0x02; // set b1, first byte does correspond to first byte of a SDU
}
}
li_index = li_index + 1;
}
if ((continue_fill_pdu_with_pdu > 0) &&
(li_index == pdu_info.num_li) &&
(pdu_info.hidden_size > 0) &&
(test_pdu_remaining_size > 0) &&
(max_copy_payload_size > 0) ) {
if (max_copy_payload_size > test_pdu_remaining_size) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] TRYING HIDDEN SIZE...CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
test_pdu_remaining_size);
max_copy_payload_size = test_pdu_remaining_size;
}
// remaining bytes to fill, redundant check, but ...
if ((max_copy_payload_size + test_start_offset) >= (pdu_info.hidden_size + test_li_sum)) {
test_pdu_copy_size += (pdu_info.hidden_size + test_li_sum - test_start_offset);
LOG_T(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPYING WHOLE REMAINING SIZE %d (max_copy_payload_size %d, test_start_offset %d, pdu_info.hidden_size %d test_li_sum %d test_pdu_copy_size %d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_info.hidden_size + test_li_sum - test_start_offset,
max_copy_payload_size,
test_start_offset,
pdu_info.hidden_size,
test_li_sum,
test_pdu_copy_size);
test_start_offset = pdu_info.hidden_size + test_li_sum;
not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU
} else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPYING REMAINING SIZE %d (/%d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
max_copy_payload_size,
pdu_info.hidden_size);
test_pdu_copy_size += max_copy_payload_size;
test_start_offset = test_start_offset + max_copy_payload_size;
not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU
}
}
} else { // num_li == 0
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (num_li == 0)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
test_pdu_copy_size = max_copy_payload_size;
if ((stop_offset == (start_offset + max_copy_payload_size - 1)) && (stop_offset == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU
} else {
not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU
}
}
//---------------------------------------------------------------
/*if (stop_offset == (rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
test_fi = (test_fi & 0x02) | (fi_original & 0x01);
}*/
//---------------------------------------------------------------
// write FI field in header
//---------------------------------------------------------------
pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | (((not_test_fi << 3) ^ 0x18) & 0x18);
//---------------------------------------------------------------
// fill the segment pdu_p with Lis and data
//---------------------------------------------------------------
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), test_num_li);
if (test_num_li > 0) {
pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | 0x04; // set E bit
test_li_length_in_bytes = 1;
for (fill_num_li=0; fill_num_li < test_num_li; fill_num_li++) {
test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
if (test_li_length_in_bytes == 2) {
if (fill_num_li == (test_num_li - 1)) {
e_li_sub_segment->b1 = 0;
} else {
e_li_sub_segment->b1 = 0x80;
}
e_li_sub_segment->b1 = e_li_sub_segment->b1 | (test_li_list[fill_num_li] >> 4);
e_li_sub_segment->b2 = test_li_list[fill_num_li] << 4;
fill_payload_p = (uint8_t*)(&e_li_sub_segment->b3);
*sizeP = *sizeP - 2;
} else {
if (fill_num_li != (test_num_li - 1)) {
e_li_sub_segment->b2 = e_li_sub_segment->b2 | 0x08;
}
e_li_sub_segment->b2 = e_li_sub_segment->b2 | (test_li_list[fill_num_li] >> 8);
e_li_sub_segment->b3 = test_li_list[fill_num_li] & 0xFF;
e_li_sub_segment++;
fill_payload_p = (uint8_t*)e_li_sub_segment;
*sizeP = *sizeP - 1;
}
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD LI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_li_list[fill_num_li]);
}
} else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD NO LI\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
fill_payload_p = (uint8_t*)e_li_sub_segment;
}
//---------------------------------------------------------------
// copy payload to retransmit
//---------------------------------------------------------------
memcpy(fill_payload_p,
&rlc_pP->tx_data_pdu_buffer[snP].payload[start_offset],
test_pdu_copy_size);
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (tb_size_t)(((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1));
// set LSF
if ((test_pdu_copy_size + start_offset) == rlc_pP->tx_data_pdu_buffer[snP].payload_size) {
pdu_sub_segment_p->data[0] = pdu_sub_segment_p->data[0] | 0x80;
rlc_pP->tx_data_pdu_buffer[snP].flags.retransmit = 0;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES LSF!\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
start_offset,
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size,
test_pdu_copy_size);
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
start_offset,
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size,
test_pdu_copy_size);
}
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] *sizeP %d = *sizeP %d - test_pdu_copy_size %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
*sizeP - test_pdu_copy_size, *sizeP,
test_pdu_copy_size);
*sizeP = *sizeP - test_pdu_copy_size;
//---------------------------------------------------------------
// update nack_so_start
//---------------------------------------------------------------
rlc_am_remove_hole(ctxt_pP, rlc_pP, snP, start_offset, test_pdu_copy_size+start_offset - 1);
//rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start + test_pdu_copy_size;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d NOW nack_so_start %d nack_so_stop %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
/*if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start == rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
}*/
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COULD NOT GET INFO FOR DATA PDU SN %04d -> RETURN NULL\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP);
return NULL;
}
return mb_sub_segment_p;
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d BUT NO PDU AVAILABLE -> RETURN NULL\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP);
assert(3==4);
return NULL;
}
}
#endif
//-----------------------------------------------------------------------------
void rlc_am_tx_buffer_display (
const protocol_ctxt_t* const ctxt_pP,
@@ -1170,7 +780,11 @@ void rlc_am_tx_buffer_display (
LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->nack_so_stop);
} else {
for (i=0; i<tx_data_pdu_buffer_p->num_holes; i++) {
assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
//assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
if(i >= RLC_AM_MAX_HOLES_REPORT_PER_PDU) {
LOG_E(RLC, "num_holes error. %d %d %d\n", tx_data_pdu_buffer_p->num_holes, i, RLC_AM_MAX_HOLES_REPORT_PER_PDU);
break;
}
LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->hole_so_start[i], tx_data_pdu_buffer_p->hole_so_stop[i]);
}
}
@@ -1193,22 +807,50 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
rlc_sn_t sn_end = rlc_pP->vt_s;
mem_block_t* pdu_p = NULL;
rlc_am_tx_data_pdu_management_t* tx_data_pdu_management;
//Assertion(eNB)_PRAN_DesignDocument_annex No.769
if((rlc_pP->retrans_num_pdus <= 0) || (rlc_pP->vt_a == rlc_pP->vt_s))
{
LOG_E(RLC, "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((rlc_pP->retrans_num_pdus > 0) && (rlc_pP->vt_a != rlc_pP->vt_s), "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
do
{
tx_data_pdu_management = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
if ((tx_data_pdu_management->flags.retransmit) && (tx_data_pdu_management->flags.max_retransmit == 0))
{
//Assertion(eNB)_PRAN_DesignDocument_annex No.770
if(tx_data_pdu_management->sn != sn)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.771
else if(tx_data_pdu_management->flags.transmitted != 1)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.772
else if(tx_data_pdu_management->retx_payload_size <= 0)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
else
{
/*
AssertFatal (tx_data_pdu_management->sn == sn, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
AssertFatal (tx_data_pdu_management->flags.transmitted == 1, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
AssertFatal (tx_data_pdu_management->retx_payload_size > 0, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
/* Either the whole RLC PDU is to be transmitted and there is enough MAC TBS or there is minimum TBS size for transmitting 1 AM PDU segment */
if ((tx_data_pdu_management->retx_payload_size == tx_data_pdu_management->payload_size) && (rlc_pP->nb_bytes_requested_by_mac >= tx_data_pdu_management->header_and_payload_size))
{
@@ -1256,9 +898,18 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
if (pdu_p != NULL)
{
//Assertion(eNB)_PRAN_DesignDocument_annex No.773
if((tx_data_pdu_management->retx_payload_size < pdu_data_size)|| (rlc_pP->retrans_num_bytes_to_retransmit < pdu_data_size))
{
LOG_E(RLC, "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
}
else
{
/*
AssertFatal ((tx_data_pdu_management->retx_payload_size >= pdu_data_size) && (rlc_pP->retrans_num_bytes_to_retransmit >= pdu_data_size), "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
*/
tx_data_pdu_management->retx_payload_size -= pdu_data_size;
rlc_pP->retrans_num_bytes_to_retransmit -= pdu_data_size;
if (tx_data_pdu_management->retx_payload_size == 0)
@@ -1276,6 +927,7 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
rlc_pP->stat_tx_retransmit_bytes += pdu_data_size;
rlc_pP->stat_tx_retransmit_bytes_by_status += pdu_data_size;
}//Assertion(eNB)_PRAN_DesignDocument_annex No.773
}
}
else
@@ -1300,101 +952,10 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
break;
}
}//Assertion(eNB)_PRAN_DesignDocument_annex No.770 No.771 No.772
}
sn = RLC_AM_NEXT_SN(sn);
} while((sn != sn_end) && (rlc_pP->retrans_num_pdus > 0));
return pdu_p;
}
#if 0
//-----------------------------------------------------------------------------
void rlc_am_retransmit_any_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP)
{
rlc_sn_t sn = (rlc_pP->vt_s - 1) & RLC_AM_SN_MASK;
rlc_sn_t sn_end = (rlc_pP->vt_a - 1) & RLC_AM_SN_MASK;
int found_pdu = 0;
rlc_sn_t found_pdu_sn = 0; // avoid warning
mem_block_t* pdu_p = NULL;
rlc_am_pdu_sn_10_t* pdu_sn_10_p = NULL;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] rlc_am_retransmit_any_pdu()\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
while (sn != sn_end) {
if (rlc_pP->tx_data_pdu_buffer[sn].mem_block != NULL) {
if (!found_pdu) {
found_pdu = 1;
found_pdu_sn = sn;
}
if (rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] RE-SEND DATA PDU SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
sn);
#if MESSAGE_CHART_GENERATOR_RLC_MAC
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
"0 "PROTOCOL_RLC_AM_MSC_FMT" RTX any pdu found SN %u",\
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), sn);
#endif
rlc_am_nack_pdu (ctxt_pP, rlc_pP, sn, 0, 0x7FFF);
// no need for update rlc_pP->nb_bytes_requested_by_mac
pdu_p = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, sn);
pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size,false);
//BugFix: polling is checked and done in function above !
//pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20;
//BugFix : pdu_without_poll and byte_without_poll are reset only if a Poll is transmitted
//rlc_pP->c_pdu_without_poll = 0;
//rlc_pP->c_byte_without_poll = 0;
//rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK;
rlc_pP->stat_tx_data_pdu += 1;
rlc_pP->stat_tx_retransmit_pdu += 1;
rlc_pP->stat_tx_data_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
rlc_pP->stat_tx_retransmit_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
return;
}
}
sn = (sn - 1) & RLC_AM_SN_MASK;
}
// no pdu_p with correct size has been found
// so re-segment a pdu_p if possible
if (found_pdu) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] SEND SEGMENT OF DATA PDU SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
found_pdu_sn);
if (rlc_pP->nb_bytes_requested_by_mac > 4) {
#if MESSAGE_CHART_GENERATOR_RLC_MAC
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
"0 "PROTOCOL_RLC_AM_MSC_FMT" RTX any pdu found SN %u (subseg)",\
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), found_pdu_sn);
#endif
rlc_am_nack_pdu (ctxt_pP, rlc_pP, found_pdu_sn, 0, 0x7FFF);
pdu_p = rlc_am_retransmit_get_subsegment(ctxt_pP, rlc_pP, found_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac);
pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[found_pdu_sn].header_and_payload_size,false);
pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20;
rlc_pP->c_pdu_without_poll = 0;
rlc_pP->c_byte_without_poll = 0;
//rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK;
rlc_pP->stat_tx_data_pdu += 1;
rlc_pP->stat_tx_retransmit_pdu += 1;
rlc_pP->stat_tx_data_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
rlc_pP->stat_tx_retransmit_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
return;
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] ... BUT NOT ENOUGH BYTES ALLOWED BY MAC %0d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->nb_bytes_requested_by_mac);
}
}
}
#endif
@@ -35,21 +35,6 @@
# ifndef __RLC_AM_RETRANSMIT_H__
# define __RLC_AM_RETRANSMIT_H__
//-----------------------------------------------------------------------------
# ifdef RLC_AM_RETRANSMIT_C
# define private_rlc_am_retransmit(x) x
# define protected_rlc_am_retransmit(x) x
# define public_rlc_am_retransmit(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_retransmit(x)
# define protected_rlc_am_retransmit(x) extern x
# define public_rlc_am_retransmit(x) extern x
# else
# define private_rlc_am_retransmit(x)
# define protected_rlc_am_retransmit(x)
# define public_rlc_am_retransmit(x) extern x
# endif
# endif
/*! \fn boolean_t rlc_am_nack_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, int16_t snP, int16_t prev_nack_snP,sdu_size_t so_startP, sdu_size_t so_endP)
* \brief The RLC AM PDU which have the sequence number snP is marked NACKed with segment offset fields.
* \param[in] ctxtP Running context.
@@ -61,13 +46,13 @@
* \return OK/KO
* \note It may appear a new hole in the retransmission buffer depending on the segment offset informations. Depending on the state of the retransmission buffer, negative confirmation can be sent to higher layers about the drop by the RLC AM instance of a particular SDU.
*/
protected_rlc_am_retransmit(boolean_t rlc_am_nack_pdu (
boolean_t rlc_am_nack_pdu (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
const rlc_sn_t prev_nack_snP,
sdu_size_t so_startP,
sdu_size_t so_endP);)
sdu_size_t so_endP);
/*! \fn void rlc_am_ack_pdu (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP, rlc_sn_t snP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
@@ -77,11 +62,11 @@ protected_rlc_am_retransmit(boolean_t rlc_am_nack_pdu (
* \param[in] free_pdu Boolean indicating that the PDU can be freed because smaller than new vtA.
* \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU.
*/
protected_rlc_am_retransmit(void rlc_am_ack_pdu (
void rlc_am_ack_pdu (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
boolean_t free_pdu);)
boolean_t free_pdu);
/*! \fn mem_block_t* rlc_am_retransmit_get_copy (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, rlc_sn_t snP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
@@ -90,12 +75,10 @@ protected_rlc_am_retransmit(void rlc_am_ack_pdu (
* \param[in] snP Sequence number of the PDU to be copied.
* \return A copy of the PDU having sequence number equal to parameter snP.
*/
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (
mem_block_t* rlc_am_retransmit_get_copy (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP));
#if 0
const rlc_sn_t snP);
/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP,rlc_sn_t snP, sdu_size_t *sizeP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
* \param[in] ctxtP Running context.
@@ -104,32 +87,29 @@ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (
* \param[in,out] sizeP Maximum size allowed for the subsegment, it is updated with the amount of bytes not used (sizeP[out] = sizeP[in] - size of segment).
* \return A copy of a segment of the PDU having sequence number equal to parameter snP.
*/
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (
mem_block_t* rlc_am_retransmit_get_subsegment (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
sdu_size_t *const sizeP));
#endif
sdu_size_t *const sizeP);
/*! \fn mem_block_t* rlc_am_get_pdu_to_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP)
* \brief Find a PDU or PDU segment to retransmit.
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC AM protocol instance pointer.
* \return A copy of the retransmitted PDU or PDU segment or NULL if TBS was not big enough
*/
protected_rlc_am_retransmit(mem_block_t* rlc_am_get_pdu_to_retransmit(
mem_block_t* rlc_am_get_pdu_to_retransmit(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlcP);)
#if 0
rlc_am_entity_t* const rlcP);
/*! \fn void rlc_am_retransmit_any_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP)
* \brief Retransmit any PDU in order to unblock peer entity, if no suitable PDU is found (depending on requested MAC size) to be retransmitted, then try to retransmit a subsegment of any PDU.
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC AM protocol instance pointer.
*/
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(
void rlc_am_retransmit_any_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlcP);)
#endif
rlc_am_entity_t* const rlcP);
/*! \fn void rlc_am_tx_buffer_display (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* rlcP, char* message_pP)
* \brief Display the dump of the retransmission buffer.
@@ -137,9 +117,9 @@ protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] message_pP Message to be displayed along with the display of the dump of the retransmission buffer.
*/
protected_rlc_am_retransmit(void rlc_am_tx_buffer_display (
void rlc_am_tx_buffer_display (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlcP,
char* const message_pP);)
char* const message_pP);
/** @} */
# endif
+108 -463
View File
@@ -53,8 +53,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
if (pdu_info_p->rf) {
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.785
if(pdu_cursor_mgnt_p->all_segments_received <= 0)
{
LOG_E(RLC, "AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received > 0,"AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == sn_ref) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -80,8 +89,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
if ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r)) {
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.786
if(pdu_cursor_mgnt_p->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -100,8 +118,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.787
if(pdu_cursor_mgnt_p->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
rlc_pP->vr_r,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
rlc_pP->vr_r,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -333,8 +360,15 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
/*****************************************************/
// 1) Find previous cursor to the PDU to insert
/*****************************************************/
//Assertion(eNB)_PRAN_DesignDocument_annex No.791
if(cursor_p == NULL)
{
LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
*/
do {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
@@ -483,11 +517,20 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
}
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.792
if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
} // end pdu_info_cursor_p->so == 0
else {
// Handle most likely case : PDU Segment without duplicate is inserted before first stored PDU segment
@@ -527,12 +570,20 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
so_end_segment = pdu_info_cursor_p->so - 1;
}
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.793
if((so_start_segment > so_end_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
*/
}
else {
// Second Case: Duplicate at the begining and potentially at the end
@@ -618,21 +669,38 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
so_end_segment = pdu_info_cursor_p->so - 1;
}
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.794
if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
}
} // end pdu_info_cursor_p->so != 0
/* Last step : duplicate bytes had been removed, build a new PDU segment */
//Assertion(eNB)_PRAN_DesignDocument_annex No.795
if((pdu_rx_info_p->so == so_start_segment) && (so_end_segment == pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((pdu_rx_info_p->so != so_start_segment) || (so_end_segment != pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
mem_block_t* trunc_segment = create_new_segment_from_pdu(tb_pP,so_start_segment - pdu_rx_info_p->so,so_end_segment - so_start_segment + 1);
if (trunc_segment != NULL) {
LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] CREATE SEGMENT FROM SEGMENT OFFSET=%d DATA LENGTH=%d SN=%d\n",
@@ -672,8 +740,15 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu(
/*****************************************************/
// 1) Find previous cursor to the PDU to insert
/*****************************************************/
//Assertion(eNB)_PRAN_DesignDocument_annex No.788
if(cursor_p == NULL)
{
LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
*/
do {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
@@ -749,9 +824,25 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu(
else {
/* First update cursor until discontinuity */
previous_cursor_p = cursor_p;
//Assertion(eNB)_PRAN_DesignDocument_annex No.789
if(pdu_info_cursor_p->rf == 0)
{
LOG_E(RLC, "AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(pdu_info_cursor_p->rf != 0,"AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
*/
//Assertion(eNB)_PRAN_DesignDocument_annex No.790
if(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
return RLC_AM_DATA_PDU_STATUS_SN_DUPLICATE;
}
/*
AssertFatal(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received == 0,
"AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
*/
sdu_size_t next_waited_so = 0;
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (pdu_info_cursor_p->so == next_waited_so)) {
next_waited_so += pdu_info_cursor_p->payload_size;
@@ -836,459 +927,6 @@ rlc_am_rx_list_check_duplicate_insert_pdu(
return pdu_status;
}
#if 0
// returns 0 if success
// returns neg value if failure
//-----------------------------------------------------------------------------
signed int
rlc_am_rx_list_insert_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP,
mem_block_t* const tb_pP)
{
rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
rlc_am_pdu_info_t* pdu_info_previous_cursor_p = NULL;
mem_block_t* cursor_p = NULL;
mem_block_t* previous_cursor_p = NULL;
cursor_p = rlc_pP->receiver_buffer.head;
// it is assumed this pdu is in rx window
//TODO : check for duplicate
// should be rewrite
/* look for previous SN */
if (cursor_p) {
if (rlc_pP->vr_mr < rlc_pP->vr_r) {
if (pdu_info_p->sn >= rlc_pP->vr_r) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn >= rlc_pP->vr_r)) { // LG added =
if (pdu_info_p->sn < pdu_info_cursor_p->sn) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_p->sn) {
if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) >= pdu_info_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
if (pdu_info_cursor_p->rf == 0) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_p->so + pdu_info_p->payload_size - 1) < pdu_info_cursor_p->so) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_p->so <= pdu_info_cursor_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
previous_cursor_p = cursor_p;
cursor_p = cursor_p->next;
if (cursor_p != NULL) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
}
}
if (cursor_p != NULL) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else {
if (pdu_info_cursor_p->rf == 0) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
} else if ((pdu_info_p->rf == 1) && (pdu_info_cursor_p->rf == 1) && (pdu_info_p->sn == pdu_info_cursor_p->sn)) {
if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else if (pdu_info_p->sn != pdu_info_cursor_p->sn) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
}
}
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else { // (pdu_info_p->sn < rlc_pP->vr_r)
cursor_p = rlc_pP->receiver_buffer.tail;
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn < rlc_pP->vr_r)) {
//pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
if (pdu_info_p->sn > pdu_info_cursor_p->sn) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__, pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_p->so + pdu_info_p->payload_size - 1) >= pdu_info_previous_cursor_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
if (pdu_info_cursor_p->rf == 0) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
if ((pdu_info_p->so + pdu_info_p->payload_size - 1) < pdu_info_previous_cursor_p->so) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_cursor_p->so <= pdu_info_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
previous_cursor_p = cursor_p;
cursor_p = cursor_p->previous;
if (cursor_p != NULL) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
}
}
if (cursor_p != NULL) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn < vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else {
if (pdu_info_cursor_p->rf == 0) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
} else if ((pdu_info_p->rf == 1) && (pdu_info_cursor_p->rf == 1) && (pdu_info_p->sn == pdu_info_cursor_p->sn)) {
if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else if (pdu_info_p->sn != pdu_info_cursor_p->sn) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
}
}
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else { // (pdu_info_p->vr_mr > rlc_pP->vr_r), > and not >=
// FAR MORE SIMPLE CASE
while (cursor_p != NULL) {
//msg ("[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d cursor_p %p\n", ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, __LINE__, cursor_p);
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
if (pdu_info_p->sn < pdu_info_cursor_p->sn) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_p->sn) {
if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) >= pdu_info_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) > vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
if (pdu_info_cursor_p->rf == 0) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
} else if (pdu_info_p->rf == 1) {
if ((pdu_info_p->so + pdu_info_p->payload_size - 1) < pdu_info_cursor_p->so) {
if (previous_cursor_p != NULL) {
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] PREVIOUS SO %d PAYLOAD SIZE %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_info_previous_cursor_p->so,
pdu_info_previous_cursor_p->payload_size);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn,
pdu_info_p->so);
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
return 0;
} else if (pdu_info_p->so <= pdu_info_cursor_p->so) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
}
previous_cursor_p = cursor_p;
cursor_p = cursor_p->next;
}
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))(last inserted)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
// pdu_info_cursor_p can not be NULL here
if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) {
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -2;
}
} else {
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
return 0;
}
}
} else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (only inserted)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
list2_add_head(tb_pP, &rlc_pP->receiver_buffer);
return 0;
}
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED @4\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_info_p->sn);
return -1;
}
#endif
//-----------------------------------------------------------------------------
void
@@ -1558,7 +1196,8 @@ list2_insert_before_element (
return element_to_insert_pP;
} else {
assert(2==1);
//assert(2==1);
LOG_E(RLC, "list2_insert_before_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
return NULL;
}
}
@@ -1585,7 +1224,8 @@ list2_insert_after_element (
return element_to_insert_pP;
} else {
assert(2==1);
//assert(2==1);
LOG_E(RLC, "list2_insert_after_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
return NULL;
}
}
@@ -1635,7 +1275,12 @@ rlc_am_rx_list_display (
//if (cursor_p == cursor_p->next) {
// rlc_am_v9_3_0_test_print_trace();
//}
assert(cursor_p != cursor_p->next);
//assert(cursor_p != cursor_p->next);
if(cursor_p == cursor_p->next)
{
LOG_E(RLC, "rlc_am_rx_list_display error. cursor_p %p, cursor_p->next %p\n", cursor_p, cursor_p->next);
break;
}
cursor_p = cursor_p->next;
loop++;
}
+9 -27
View File
@@ -38,22 +38,6 @@
# include "UTIL/MEM/mem_block.h"
//-----------------------------------------------------------------------------
# ifdef RLC_AM_RX_LIST_C
# define private_rlc_am_rx_list(x) x
# define protected_rlc_am_rx_list(x) x
# define public_rlc_am_rx_list(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_rx_list(x)
# define protected_rlc_am_rx_list(x) extern x
# define public_rlc_am_rx_list(x) extern x
# else
# define private_rlc_am_rx_list(x)
# define protected_rlc_am_rx_list(x)
# define public_rlc_am_rx_list(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "platform_types.h"
#include "platform_constants.h"
//#include "PHY/defs.h"
@@ -66,9 +50,8 @@
* \param[in] tbP A PDU embedded in a mem_block_t.
* \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted.
*/
protected_rlc_am_rx_list( rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP);)
rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP);
#if 0
/*! \fn signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP , mem_block_t* const tbP)
* \brief Insert a PDU in the RX buffer (implemented with a list).
* \param[in] ctxt_pP Running context.
@@ -76,8 +59,7 @@ protected_rlc_am_rx_list( rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_
* \param[in] tbP A PDU embedded in a mem_block_t.
* \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted.
*/
protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);)
#endif
signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);
/*! \fn boolean_t rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP)
* \brief Check if reassembly taking into account potential new vrR value
@@ -85,7 +67,7 @@ protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(const protocol_ct
* \param[in] rlcP RLC AM protocol instance pointer.
* \return TRUE if reassembly must be done, FALSE else
*/
protected_rlc_am_rx_list( boolean_t rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP);)
boolean_t rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP)
* \brief Check if all sub-segments of a PDU are received, if yes then call rlc_am_rx_mark_all_segments_received() procedure.
@@ -93,7 +75,7 @@ protected_rlc_am_rx_list( boolean_t rlc_am_rx_check_vr_reassemble(const protocol
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] tbP A PDU embedded in a mem_block_t.
*/
protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);)
void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);
/*! \fn void rlc_am_rx_mark_all_segments_received (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP)
* \brief Mark all PDUs having the same sequence number as first_segment_tbP with the information that all segments have been received.
@@ -101,14 +83,14 @@ protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(const protocol_
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] first_segment_tbP A PDU embedded in a mem_block_t, it is the first PDU in the RX buffer (list) that have its sequence number.
*/
protected_rlc_am_rx_list( void rlc_am_rx_mark_all_segments_received(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP);)
void rlc_am_rx_mark_all_segments_received(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP);
/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP)
* \brief Reassembly all SDUS that it is possible to reassembly by parsing the RX buffer and looking for PDUs having the flag 'all segments received'.
* \param[in] ctxt_pP Running context.
* \param[in] rlcP RLC AM protocol instance pointer.
*/
protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP);)
void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP);
/*! \fn mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP)
* \brief Insert a PDU embedded in a mem_block_t in a list at a position before a designated element of the list.
@@ -116,7 +98,7 @@ protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(const protocol
* \param[in] elementP Element in the list.
* \param[in] listP List where elements are linked.
*/
public_rlc_am_rx_list( mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);)
mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);
/*! \fn mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP)
* \brief Insert a PDU embedded in a mem_block_t in a list at a position after a designated element of the list.
@@ -124,13 +106,13 @@ public_rlc_am_rx_list( mem_block_t* list2_insert_before_element (mem_block_t * e
* \param[in] elementP Element in the list.
* \param[in] listP List where elements are linked.
*/
public_rlc_am_rx_list( mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);)
mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);
/*! \fn void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP)
* \brief Display the dump of the RX buffer.
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] messageP Message to be displayed along with the display of the dump of the RX buffer.
*/
protected_rlc_am_rx_list( void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP);)
void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP);
/** @} */
#endif
+23 -4
View File
@@ -299,7 +299,12 @@ void rlc_am_segment_10 (
pdu_mngt_p->sdus_index[pdu_mngt_p->nb_sdus++] = sdu_buffer_index;
sdu_mngt_p->pdus_index[sdu_mngt_p->nb_pdus++] = rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE;
assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
//assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
if(sdu_mngt_p->nb_pdus >= RLC_AM_MAX_SDU_FRAGMENTS) {
LOG_E(RLC,PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] loop error. %d %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), sdu_mngt_p->nb_pdus, RLC_AM_MAX_SDU_FRAGMENTS);
break;
}
sdu_buffer_index = (sdu_buffer_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
}
@@ -353,6 +358,8 @@ void rlc_am_segment_10 (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size);
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size;
@@ -371,6 +378,9 @@ void rlc_am_segment_10 (
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size;
@@ -387,6 +397,8 @@ void rlc_am_segment_10 (
continue_fill_pdu_with_sdu = 0;
pdu_remaining_size = 0;
} else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -462,11 +474,14 @@ void rlc_am_segment_10 (
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
}
} else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
sdu_mngt_p->sdu_remaining_size,
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
assert(1!=1);
//assert(1!=1);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
@@ -520,7 +535,11 @@ void rlc_am_segment_10 (
pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
//#warning "why 3000: changed to RLC_SDU_MAX_SIZE "
assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE );
//assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE );
if(pdu_tb_req_p->tb_size >= RLC_SDU_MAX_SIZE) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] tb_size error. %d, %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_tb_req_p->tb_size, RLC_SDU_MAX_SIZE);
}
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt_p->payload_size,true);
//list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list);
+2 -17
View File
@@ -35,21 +35,6 @@
# ifndef __RLC_AM_SEGMENT_H__
# define __RLC_AM_SEGMENT_H__
//-----------------------------------------------------------------------------
# ifdef RLC_AM_SEGMENT_C
# define private_rlc_am_segment(x) x
# define protected_rlc_am_segment(x) x
# define public_rlc_am_segment(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_segment(x)
# define protected_rlc_am_segment(x) extern x
# define public_rlc_am_segment(x) extern x
# else
# define private_rlc_am_segment(x)
# define protected_rlc_am_segment(x)
# define public_rlc_am_segment(x) extern x
# endif
# endif
/*! \fn void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP,boolean_t is_new_pdu)
* \brief Set or not the poll bit in the PDU header depending on RLC AM protocol variables.
@@ -58,13 +43,13 @@
* \param[in] pduP Pointer on the header of the PDU in order to be able to set the poll bit if necessary.
* \param[in] payload_sizeP Size of the payload of the PDU.
*/
protected_rlc_am_segment(void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP,boolean_t is_new_pdu);)
void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP,boolean_t is_new_pdu);
/*! \fn void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP)
* \brief Segment a PDU with 10 bits sequence number, based on segmentation information given by MAC (size to transmit).
* \param[in] ctxt_pP Running context.
* \param[in] rlcP RLC AM protocol instance pointer.
*/
protected_rlc_am_segment(void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *const rlcP);)
void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *const rlcP);
/** @} */
# endif
@@ -19,301 +19,4 @@
* contact@openairinterface.org
*/
#if 0
#define RLC_AM_MODULE 1
#define RLC_AM_SEGMENT_HOLES_C 1
//-----------------------------------------------------------------------------
#include "rlc_am.h"
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
//-----------------------------------------------------------------------------
void rlc_am_clear_holes (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP)
{
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
}
//-----------------------------------------------------------------------------
void rlc_am_shift_down_holes (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const int indexP)
{
int i;
for (i=indexP; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1; i++) {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1];
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1];
}
rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1;
}
//-----------------------------------------------------------------------------
void rlc_am_shift_up_holes (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const int indexP)
{
// shift include indexP
int i;
for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i > indexP; i--) {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
}
rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes + 1;
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
}
//-----------------------------------------------------------------------------
void rlc_am_remove_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_stopP)
{
int i;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_start %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
so_startP,
so_stopP,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
#endif
assert(so_startP <= so_stopP);
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
assert(so_startP == rlc_pP->tx_data_pdu_buffer[snP].nack_so_start);
assert(so_stopP <= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
so_stopP+1);
#endif
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_stopP+1;
if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start >= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
}
} else {
// normally should be removed in increasing order...
for (i = 0; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes; i++) {
if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
if (so_stopP >= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
rlc_am_shift_down_holes(ctxt_pP, rlc_pP, snP, i);
i = i - 1;
} else {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = so_stopP;
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
} else {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
}
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif
return;
}
} else if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
// BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES
rlc_am_shift_up_holes(ctxt_pP, rlc_pP, snP, i+1);
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1] = so_startP+1;
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i];
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP - 1;
} else {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP;
}
}
}
}
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
} else {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
}
}
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
}
//-----------------------------------------------------------------------------
void rlc_am_get_next_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
sdu_size_t* const so_startP,
sdu_size_t* const so_stopP)
{
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
*so_startP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
*so_stopP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
*so_startP,
*so_stopP);
#endif
} else {
*so_startP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
*so_stopP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[0];
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
*so_startP,
*so_stopP,
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif
}
}
//-----------------------------------------------------------------------------
void rlc_am_add_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
sdu_size_t so_stopP)
{
int i, hole_index;
assert(so_startP <= so_stopP);
assert(so_startP < 0x7FFF);
assert(so_stopP <= 0x7FFF);
// if global NACK
if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1))) {
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] SN %04d GLOBAL NACK 0->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
so_stopP);
#endif
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
return;
}
if (so_stopP == 0x7FFF) {
so_stopP = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
}
// first hole
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0] = so_startP;
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop [0] = so_stopP;
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 1;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP,
so_startP,
so_stopP);
#endif
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
return;
}
hole_index = 0;
while (hole_index < rlc_pP->tx_data_pdu_buffer[snP].num_holes) {
if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index]) {
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
if (hole_index > 0) {
assert(so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index-1]);
}
for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i >= hole_index; i--) {
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
}
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
// update nack "window" vars nack_so_start, nack_so_stop
if (hole_index == 0) {
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
}
rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->tx_data_pdu_buffer[snP].num_holes,
snP,
so_startP,
so_stopP);
#endif
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
return;
}
hole_index = hole_index + 1;
}
// if here insert to the "tail"
if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index - 1]) {
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
// update nack "window" vars nack_so_start, nack_so_stop
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->tx_data_pdu_buffer[snP].num_holes,
snP,
so_startP,
so_stopP);
#endif
} else {
assert(1==2);
}
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
}
#endif
/* This file is empty. Might be deleted ? */
@@ -32,35 +32,19 @@
* @ingroup _rlc_am_internal_segment_impl_
* @{
*/
#if 0
#ifndef __RLC_AM_SEGMENT_HOLES_H__
# define __RLC_AM_SEGMENT_HOLES_H__
//-----------------------------------------------------------------------------
# ifdef RLC_AM_SEGMENT_HOLES_C
# define private_rlc_am_segments_holes(x) x
# define protected_rlc_am_segments_holes(x) x
# define public_rlc_am_segments_holes(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_segments_holes(x)
# define protected_rlc_am_segments_holes(x) extern x
# define public_rlc_am_segments_holes(x) extern x
# else
# define private_rlc_am_segments_holes(x)
# define protected_rlc_am_segments_holes(x)
# define public_rlc_am_segments_holes(x) extern x
# endif
# endif
/*! \fn void rlc_am_clear_holes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP)
* \brief Remove all marked holes for PDU with sequence number "snP".
* \param[in] ctxt_pP Running context.
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] snP Sequence number.
*/
protected_rlc_am_segments_holes(void rlc_am_clear_holes (
void rlc_am_clear_holes (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn void rlc_am_remove_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
* \brief Remove for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
@@ -70,12 +54,12 @@ protected_rlc_am_segments_holes(void rlc_am_clear_holes (
* \param[in] so_startP Start of segment offset.
* \param[in] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_remove_hole (
void rlc_am_remove_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_stopP);)
const sdu_size_t so_stopP);
/*! \fn void rlc_am_get_next_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t* so_startP, sdu_size_t* so_stopP)
* \brief Get for PDU with sequence number "snP" the first hole start and stop parameters.
@@ -85,12 +69,12 @@ protected_rlc_am_segments_holes(void rlc_am_remove_hole (
* \param[in,out] so_startP Start of segment offset.
* \param[in,out] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_get_next_hole (
void rlc_am_get_next_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
sdu_size_t* const so_startP,
sdu_size_t* const so_stopP);)
sdu_size_t* const so_stopP);
/*! \fn void rlc_am_add_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
* \brief Mark for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
@@ -100,12 +84,11 @@ protected_rlc_am_segments_holes(void rlc_am_get_next_hole (
* \param[in,out] so_startP Start of segment offset.
* \param[in,out] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_add_hole (
void rlc_am_add_hole (
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
sdu_size_t so_stopP);)
sdu_size_t so_stopP);
/** @} */
#endif
#endif
@@ -153,7 +153,10 @@ rlc_am_write16_bit_field(
signed int bits_to_writeP,
const uint16_t valueP)
{
assert(bits_to_writeP <= 16);
//assert(bits_to_writeP <= 16);
if(bits_to_writeP > 16) {
LOG_E(RLC, "bits_to_writeP error. %d\n", bits_to_writeP);
}
if (bits_to_writeP > 8) {
rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP - 8, (uint8_t)(valueP >> 8));
@@ -211,6 +214,9 @@ rlc_am_get_control_pdu_infos(
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
nack_to_read = 0;
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][FIRST]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0;
}
@@ -224,7 +230,9 @@ rlc_am_get_control_pdu_infos(
} else {
*total_size_pP = *total_size_pP - 2;
}
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][SECOND]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0;
} else {
return -1;
@@ -308,8 +316,13 @@ rlc_am_receive_process_control_pdu(
// POLL_SN:
// - if t-PollRetransmit is running:
// - stop and reset t-PollRetransmit.
assert(ack_sn < RLC_AM_SN_MODULO);
assert(rlc_pP->control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU);
//assert(ack_sn < RLC_AM_SN_MODULO);
//assert(rlc_pP->control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU);
if(ack_sn >= RLC_AM_SN_MODULO || rlc_pP->control_pdu_info.num_nack >= RLC_AM_MAX_NACK_IN_STATUS_PDU) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" illegal ack_sn %d, num_nack %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), ack_sn, rlc_pP->control_pdu_info.num_nack);
return;
}
/* Note : ackSn can be equal to current vtA only in case the status pdu contains a list of nack_sn with same value = vtA with SOStart/SOEnd */
/* and meaning the report is not complete due to not enough ressources to fill all SOStart/SOEnd of this NACK_SN */
@@ -387,13 +400,15 @@ rlc_am_receive_process_control_pdu(
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s);
*tb_size_in_bytes_pP = 0;
status = FALSE;
}
} else {
LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
*tb_size_in_bytes_pP = 0;
status = FALSE;
}
@@ -610,10 +625,13 @@ rlc_am_send_status_pdu(
/* Now process all Segments of sn_cursor if PDU not fully received */
if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) {
AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
//AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
if(sn_nack != sn_cursor){
LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
}
/* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */
if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
else if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
/* Init loop flags */
/* Check lsf */
segment_loop_end = (pdu_info_cursor_p->lsf == 1);
@@ -756,8 +774,14 @@ rlc_am_send_status_pdu(
} // End main while NACK_SN
/* Clear E1 of last nack_sn entry */
AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
// AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
// rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
if (!((control_pdu_info.num_nack) || (all_segments_received == 0))){
LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
return;
}
if (control_pdu_info.num_nack) {
control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
}
@@ -795,8 +819,13 @@ rlc_am_send_status_pdu(
/* encode the control pdu */
pdu_size = (nb_bits_transmitted + 7) >> 3;
AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
// AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
// pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
if(pdu_size > rlc_pP->nb_bytes_requested_by_mac){
LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
return;
}
#if TRACE_RLC_AM_STATUS_CREATION
@@ -806,6 +835,7 @@ rlc_am_send_status_pdu(
pdu_size);
#endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
if(tb_p == NULL) return;
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
@@ -824,8 +854,14 @@ rlc_am_send_status_pdu(
nb_bits_to_transmit >> 3);
#endif
AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
// AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
// pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
if(pdu_size != ((nb_bits_transmitted + 7) >> 3)){
LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
pdu_size = 0;
return;
}
// remaining bytes to transmit for RLC (retrans pdus and new data pdus)
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
@@ -837,344 +873,3 @@ rlc_am_send_status_pdu(
}
#if 0
//-----------------------------------------------------------------------------
void
rlc_am_send_status_pdu_backup(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP
)
{
// When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
// - if t-StatusProhibit is not running:
// - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
// - else:
// - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
// STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
// deliver it to lower layer;
//
// When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
// - start t-StatusProhibit.
//
// When constructing a STATUS PDU, the AM RLC entity shall:
// - for the AMD PDUs with SN such that VR(R) <= SN < VR(MR) that has not been completely received yet, in
// increasing SN of PDUs and increasing byte segment order within PDUs, starting with SN = VR(R) up to
// the point where the resulting STATUS PDU still fits to the total size of RLC PDU(s) indicated by lower layer:
// - for an AMD PDU for which no byte segments have been received yet::
// - include in the STATUS PDU a NACK_SN which is set to the SN of the AMD PDU;
// - for a continuous sequence of byte segments of a partly received AMD PDU that have not been received yet:
// - include in the STATUS PDU a set of NACK_SN, SOstart and SOend
// - set the ACK_SN to the SN of the next not received RLC Data PDU which is not indicated as missing in the
// resulting STATUS PDU.
signed int nb_bits_to_transmit = rlc_pP->nb_bytes_requested_by_mac << 3;
rlc_am_control_pdu_info_t control_pdu_info;
rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
rlc_sn_t previous_sn_cursor = (rlc_pP->vr_r - 1) & RLC_AM_SN_MASK;
rlc_sn_t sn_cursor = 0;
mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
int all_segments_received = 0;
int waited_so = 0;
mem_block_t *tb_p = NULL;
sdu_size_t pdu_size = 0;
memset(&control_pdu_info, 0, sizeof(rlc_am_control_pdu_info_t));
// header size
nb_bits_to_transmit = nb_bits_to_transmit - 15;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
nb_bits_to_transmit);
rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
#endif
if (cursor_p != NULL) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
sn_cursor = pdu_info_cursor_p->sn;
while (!(RLC_AM_SN_IN_WINDOW(sn_cursor, rlc_pP->vr_r))) {
cursor_p = cursor_p->next;
previous_sn_cursor = sn_cursor;
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
sn_cursor = pdu_info_cursor_p->sn;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d FIND VR(R) <= SN sn_cursor %04d -> %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
previous_sn_cursor,
sn_cursor);
#endif
}
// 12 bits = size of NACK_SN field + E1, E2 bits
// 42 bits = size of NACK_SN field + SO_START, SO_END fields, E1, E2 bits
while ((cursor_p != NULL) && (nb_bits_to_transmit >= 12)) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
sn_cursor = pdu_info_cursor_p->sn;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d LOOPING sn_cursor %04d previous sn_cursor %04d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
sn_cursor,
previous_sn_cursor);
#endif
// -------------------------------------------------------------------------------
// case resegmentation : several PDUs related to the same SN queued in list
// -------------------------------------------------------------------------------
if (sn_cursor == previous_sn_cursor) {
do {
cursor_p = cursor_p->next;
if (cursor_p != NULL) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
sn_cursor = pdu_info_cursor_p->sn;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NOW sn_cursor %04d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
sn_cursor);
#endif
} else {
if (all_segments_received) {
control_pdu_info.ack_sn = (sn_cursor + 1) & RLC_AM_SN_MASK;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn);
#endif
} else {
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d (CASE PREVIOUS SN)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn);
#endif
}
goto end_push_nack;
}
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
}
// -------------------------------------------------------------------------------
// simple case, PDU(s) is/are missing
// -------------------------------------------------------------------------------
while (((previous_sn_cursor + 1) & RLC_AM_SN_MASK) != sn_cursor) {
if (nb_bits_to_transmit > 12) {
previous_sn_cursor = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = previous_sn_cursor;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7ff;
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 0;
control_pdu_info.num_nack += 1;
nb_bits_to_transmit = nb_bits_to_transmit - 12;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
previous_sn_cursor);
#endif
} else {
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NO MORE BITS FOR SENDING NACK %04d -> ABORT AND SET FINAL ACK %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
previous_sn_cursor,
control_pdu_info.ack_sn);
#endif
goto end_push_nack;
}
}
// -------------------------------------------------------------------------------
// not so simple case, a resegmented PDU(s) is missing
// -------------------------------------------------------------------------------
if (all_segments_received == 0) {
waited_so = 0;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] if (all_segments_received == 0) \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
#endif
do {
if (pdu_info_cursor_p->so > waited_so) {
if (nb_bits_to_transmit >= 42) {
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
control_pdu_info.num_nack += 1;
nb_bits_to_transmit = nb_bits_to_transmit - 42;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d (CASE SO %d > WAITED SO %d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
sn_cursor,
waited_so,
pdu_info_cursor_p->so - 1,
pdu_info_cursor_p->so,
waited_so);
#endif
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
//waited_so = 0x7FF;
waited_so = 0x7FFF;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO 0x7FFF)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__, sn_cursor);
#endif
//break;
} else {
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @1\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
sn_cursor,
waited_so);
#endif
}
} else {
control_pdu_info.ack_sn = sn_cursor;
goto end_push_nack;
}
} else { //else { // pdu_info_cursor_p->so <= waited_so
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
//waited_so = 0x7FF;
waited_so = 0x7FFF;
}
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @2\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
sn_cursor, waited_so);
#endif
}
cursor_p = cursor_p->next;
if (cursor_p != NULL) {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
previous_sn_cursor = sn_cursor;
sn_cursor = pdu_info_cursor_p->sn;
} else {
// LG control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
control_pdu_info.ack_sn = previous_sn_cursor;
goto end_push_nack;
}
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
// may be last segment of PDU not received
//if ((sn_cursor != previous_sn_cursor) && (waited_so != 0x7FF)) {
if ((sn_cursor != previous_sn_cursor) && (waited_so != 0x7FFF)) {
if (nb_bits_to_transmit >= 42) {
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = previous_sn_cursor;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
//control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7FF;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7FFF;
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
control_pdu_info.num_nack += 1;
nb_bits_to_transmit = nb_bits_to_transmit - 42;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
previous_sn_cursor,
waited_so,
0x7FFF);
#endif
} else {
control_pdu_info.ack_sn = previous_sn_cursor;
goto end_push_nack;
}
}
waited_so = 0;
} else {
waited_so = 0;
cursor_p = cursor_p->next;
previous_sn_cursor = sn_cursor;
}
}
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
} else {
control_pdu_info.ack_sn = rlc_pP->vr_r;
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn);
#endif
}
end_push_nack:
if (control_pdu_info.num_nack > 0) {
control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
}
//msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] nb_bits_to_transmit %d\n",
// rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame,nb_bits_to_transmit);
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn,
control_pdu_info.num_nack);
#endif
// encode the control pdu
pdu_size = rlc_pP->nb_bytes_requested_by_mac - ((nb_bits_to_transmit - 7 )>> 3);
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d forecast pdu_size %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_size);
#endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
// warning reuse of pdu_size
pdu_size = rlc_am_write_status_pdu(ctxt_pP, rlc_pP,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb_p->data))->data_ptr), &control_pdu_info);
((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
//assert((((struct mac_tb_req*)(tb_p->data))->tb_size) < 3000);
#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_size,
rlc_pP->nb_bytes_requested_by_mac,
nb_bits_to_transmit >> 3);
#endif
assert(pdu_size == (rlc_pP->nb_bytes_requested_by_mac - (nb_bits_to_transmit >> 3)));
// remaining bytes to transmit for RLC (retrans pdus and new data pdus)
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
// put pdu in trans
list_add_head(tb_p, &rlc_pP->control_pdu_list);
rlc_pP->stat_tx_control_pdu += 1;
rlc_pP->stat_tx_control_bytes += pdu_size;
}
#endif
@@ -37,21 +37,6 @@
# include "UTIL/MEM/mem_block.h"
//-----------------------------------------------------------------------------
# ifdef RLC_AM_STATUS_REPORT_C
# define private_rlc_am_status_report(x) x
# define protected_rlc_am_status_report(x) x
# define public_rlc_am_status_report(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_status_report(x)
# define protected_rlc_am_status_report(x) extern x
# define public_rlc_am_status_report(x) extern x
# else
# define private_rlc_am_status_report(x)
# define protected_rlc_am_status_report(x)
# define public_rlc_am_status_report(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "platform_types.h"
#include "platform_constants.h"
@@ -65,7 +50,7 @@
* \param[in] bits_to_readP Number of bits to read (max 16).
* \return Value read on 16 bits, bits read are shifted to least significant bits of returned short value.
*/
protected_rlc_am_status_report( uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP);)
uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP);
/*! \fn void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP)
* \brief Write N bits (max 8) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index.
@@ -74,7 +59,7 @@ protected_rlc_am_status_report( uint16_t rlc_am_read_bit_field
* \param[in] bits_to_writeP Number of bits to write (max 8).
* \param[in] valueP Value to write.
*/
protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP);)
void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP);
/*! \fn void rlc_am_write16_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint16_t valueP)
* \brief Write N bits (max 16) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index.
@@ -83,11 +68,11 @@ protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dat
* \param[in] bits_to_writeP Number of bits to write (max 16).
* \param[in] valueP Value to write.
*/
protected_rlc_am_status_report(void rlc_am_write16_bit_field(
void rlc_am_write16_bit_field(
uint8_t** dataP,
unsigned int* bit_posP,
signed int bits_to_writeP,
const uint16_t valueP);)
const uint16_t valueP);
/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* const headerP, sdu_size_t * const total_sizeP, rlc_am_control_pdu_info_t* const pdu_infoP)
* \brief Retrieve control PDU informations from a serialized control PDU.
@@ -95,16 +80,16 @@ protected_rlc_am_status_report(void rlc_am_write16_bit_field(
* \param[in] total_size_pP Pointer on PDU size in bytes.
* \param[in,out] pdu_infoP Struct containing interpreted PDU control informations.
*/
protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (
signed int rlc_am_get_control_pdu_infos (
rlc_am_pdu_sn_10_t* const headerP,
sdu_size_t * const total_size_pP,
rlc_am_control_pdu_info_t* const pdu_infoP);)
rlc_am_control_pdu_info_t* const pdu_infoP);
/*! \fn void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP)
* \brief Dump on LOG output the informations contained in the pdu_infoP structure.
* \param[in] pdu_infoP Struct containing interpreted PDU control informations.
*/
protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP);)
void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP);
/*! \fn void rlc_am_receive_process_control_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, mem_block_t* const tbP, uint8_t* first_byte, const uint16_t tb_size_in_bytes)
* \brief Process the informations contained in the control PDU.
@@ -114,12 +99,12 @@ protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(const rlc_
* \param[in] first_byte Pointer on first byte of control PDU.
* \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes.
*/
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(
void rlc_am_receive_process_control_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP,
mem_block_t* const tbP,
uint8_t** first_byte,
sdu_size_t * const tb_size_in_bytes);)
sdu_size_t * const tb_size_in_bytes);
/*! \fn int rlc_am_write_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* const pdu_infoP)
* \brief Remove all marked holes for PDU with sequence number "snP".
@@ -129,19 +114,19 @@ protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(
* \param[in] pdu_infoP Struct containing PDU control informations elements.
* \return The number of bytes that have been written.
*/
protected_rlc_am_status_report(int rlc_am_write_status_pdu(
int rlc_am_write_status_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P,
rlc_am_control_pdu_info_t* const pdu_infoP);)
rlc_am_control_pdu_info_t* const pdu_infoP);
/*! \fn void rlc_am_send_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Send a status PDU based on the receiver buffer content.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_status_report(void rlc_am_send_status_pdu(
void rlc_am_send_status_pdu(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP);)
rlc_am_entity_t *const rlc_pP);
/** @} */
#endif
+2 -2
View File
@@ -534,7 +534,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
}
//-----------------------------------------------------------------------------
@@ -577,7 +577,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
data_indP->no_tb += 1;
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
} else {
printf("[RLC-LOOP] DROPPING 1 TB\n");
+14 -29
View File
@@ -32,34 +32,19 @@
*/
# ifndef __RLC_AM_TEST_H__
# define __RLC_AM_TEST_H__
# ifdef RLC_AM_TEST_C
# define private_rlc_am_test(x) x
# define protected_rlc_am_test(x) x
# define public_rlc_am_test(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_test(x)
# define protected_rlc_am_test(x) extern x
# define public_rlc_am_test(x) extern x
# else
# define private_rlc_am_test(x)
# define protected_rlc_am_test(x)
# define public_rlc_am_test(x) extern x
# endif
# endif
public_rlc_am_test(rlc_am_entity_t g_am_tx;)
public_rlc_am_test(rlc_am_entity_t g_am_rx;)
rlc_am_entity_t g_am_tx;
rlc_am_entity_t g_am_rx;
protected_rlc_am_test(void rlc_am_v9_3_0_test_windows();)
protected_rlc_am_test(void rlc_am_v9_3_0_test_read_write_bit_field();)
protected_rlc_am_test(void rlc_am_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);)
protected_rlc_am_test(void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP);)
protected_rlc_am_test(void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,rlc_am_entity_t *am_RxP,
uint16_t bytes_txP,uint16_t bytes_rxP);)
protected_rlc_am_test(void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);)
protected_rlc_am_test(void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
mem_block_t *sduP);)
protected_rlc_am_test(void rlc_am_v9_3_0_test_tx_rx();)
public_rlc_am_test( void rlc_am_v9_3_0_test_print_trace (void);)
public_rlc_am_test( void rlc_am_v9_3_0_test());
void rlc_am_v9_3_0_test_windows();
void rlc_am_v9_3_0_test_read_write_bit_field();
void rlc_am_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP);
void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,rlc_am_entity_t *am_RxP,
uint16_t bytes_txP,uint16_t bytes_rxP);
void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);
void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
mem_block_t *sduP);
void rlc_am_v9_3_0_test_tx_rx();
void rlc_am_v9_3_0_test_print_trace (void);
void rlc_am_v9_3_0_test();
# endif
@@ -87,9 +87,16 @@ rlc_am_check_timer_poll_retransmit(
/* Look for the first retransmittable PDU starting from vtS - 1 */
while (sn != sn_end) {
tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
//AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
// sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
if(tx_data_pdu_buffer_p->mem_block == NULL){
LOG_E(RLC, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
sn = RLC_AM_PREV_SN(sn);
continue;
}
if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
tx_data_pdu_buffer_p->flags.retransmit = 1;
tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size;
@@ -35,21 +35,6 @@
#ifndef __RLC_AM_TIMER_POLL_RETRANSMIT_H__
# define __RLC_AM_TIMER_POLL_RETRANSMIT_H__
# ifdef RLC_AM_TIMER_POLL_RETRANSMIT_C
# define private_rlc_am_timer_poll_retransmit(x) x
# define protected_rlc_am_timer_poll_retransmit(x) x
# define public_rlc_am_timer_poll_retransmit(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_timer_poll_retransmit(x)
# define protected_rlc_am_timer_poll_retransmit(x) extern x
# define public_rlc_am_timer_poll_retransmit(x) extern x
# else
# define private_rlc_am_timer_poll_retransmit(x)
# define protected_rlc_am_timer_poll_retransmit(x)
# define public_rlc_am_timer_poll_retransmit(x) extern x
# endif
# endif
/*! \fn void rlc_am_check_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Check if timer Poll-retransmit has timed-out, if so it is stopped and has the status "timed-out".
@@ -57,9 +42,9 @@
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(
void rlc_am_check_timer_poll_retransmit(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP));
rlc_am_entity_t* const rlc_pP);
/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Boolean function, check if timer Poll-retransmit has timed-out.
@@ -67,9 +52,9 @@ protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \return 1 if timer Poll-retransmit has timed-out, else 0.
*/
protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(
int rlc_am_is_timer_poll_retransmit_timed_out(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP);)
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Stop and reset the timer Poll-retransmit.
@@ -77,9 +62,9 @@ protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_time
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit(
void rlc_am_stop_and_reset_timer_poll_retransmit(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP);)
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_start_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Re-arm (based on RLC AM config parameter) and start timer Poll-retransmit.
@@ -87,9 +72,9 @@ protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_ret
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(
void rlc_am_start_timer_poll_retransmit(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP);)
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_init_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
* \brief Initialize the timer Poll-retransmit with RLC AM time-out config parameter.
@@ -97,9 +82,9 @@ protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] time_outP Time-out in frame units.
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit(
void rlc_am_init_timer_poll_retransmit(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP,
const uint32_t time_outP);)
const uint32_t time_outP);
/** @} */
#endif
@@ -70,7 +70,12 @@ rlc_am_check_timer_reordering(
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP));
#endif
AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
//AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
if(rlc_pP->vr_x == RLC_SN_UNDEFINED){
LOG_E(RLC, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
return;
}
rlc_pP->t_reordering.running = 0;
rlc_pP->t_reordering.timed_out = 1;
@@ -81,8 +86,12 @@ rlc_am_check_timer_reordering(
cursor = rlc_pP->receiver_buffer.head;
rlc_usn_t vr_ms_new = rlc_pP->vr_x;
AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
//AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
if(cursor == NULL){
LOG_E(RLC, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
return;
}
/* go to memblock up to vrX*/
pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
while ((cursor != NULL) && (RLC_AM_DIFF_SN(pdu_info->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(vr_ms_new,rlc_pP->vr_r))) {
@@ -34,48 +34,33 @@
*/
#ifndef __RLC_AM_TIMER_REORDERING_H__
# define __RLC_AM_TIMER_REORDERING_H__
# ifdef RLC_AM_TIMER_POLL_REORDERING_C
# define private_rlc_am_timer_reordering(x) x
# define protected_rlc_am_timer_reordering(x) x
# define public_rlc_am_timer_reordering(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_timer_reordering(x)
# define protected_rlc_am_timer_reordering(x) extern x
# define public_rlc_am_timer_reordering(x) extern x
# else
# define private_rlc_am_timer_reordering(x)
# define protected_rlc_am_timer_reordering(x)
# define public_rlc_am_timer_reordering(x) extern x
# endif
# endif
/*! \fn void rlc_am_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_reordering(void rlc_am_check_timer_reordering(
void rlc_am_check_timer_reordering(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP));
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Stop and reset the timer reordering.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_reordering(void rlc_am_stop_and_reset_timer_reordering(
void rlc_am_stop_and_reset_timer_reordering(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP);)
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Re-arm (based on RLC AM config parameter) and start timer reordering.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering(
void rlc_am_start_timer_reordering(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP);)
rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
* \brief Initialize the timer reordering with RLC AM time-out config parameter.
@@ -83,9 +68,9 @@ protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering(
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] time_outP Time-out in frameP units.
*/
protected_rlc_am_timer_reordering(void rlc_am_init_timer_reordering(
void rlc_am_init_timer_reordering(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t* const rlc_pP,
const uint32_t time_outP);)
const uint32_t time_outP);
/** @} */
#endif
@@ -34,42 +34,28 @@
*/
#ifndef __RLC_AM_TIMER_STATUS_PROHIBIT_H__
# define __RLC_AM_TIMER_STATUS_PROHIBIT_H__
# ifdef RLC_AM_TIMER_STATUS_PROHIBIT_C
# define private_rlc_am_timer_status_prohibit(x) x
# define protected_rlc_am_timer_status_prohibit(x) x
# define public_rlc_am_timer_status_prohibit(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_timer_status_prohibit(x)
# define protected_rlc_am_timer_status_prohibit(x) extern x
# define public_rlc_am_timer_status_prohibit(x) extern x
# else
# define private_rlc_am_timer_status_prohibit(x)
# define protected_rlc_am_timer_status_prohibit(x)
# define public_rlc_am_timer_status_prohibit(x) extern x
# endif
# endif
/*! \fn void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Check if timer status-prohibit has timed-out, if so it is stopped and has the status "timed-out".
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_status_prohibit(void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP));
void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Stop and reset the timer status-prohibit.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_status_prohibit(void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);)
void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
* \brief Re-arm (based on RLC AM config parameter) and start timer status-prohibit.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC AM protocol instance pointer.
*/
protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);)
void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
/*! \fn void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
* \brief Initialize the timer status-prohibit with RLC AM time-out config parameter.
@@ -77,6 +63,6 @@ protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(c
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] time_outP Time-out in frameP units.
*/
protected_rlc_am_timer_status_prohibit(void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP);)
void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP);
/** @} */
#endif
+14 -29
View File
@@ -35,21 +35,6 @@
# ifndef __RLC_AM_WINDOWS_H__
# define __RLC_AM_WINDOWS_H__
//-----------------------------------------------------------------------------
# ifdef RLC_AM_WINDOWS_C
# define private_rlc_am_windows(x) x
# define protected_rlc_am_windows(x) x
# define public_rlc_am_windows(x) x
# else
# ifdef RLC_AM_MODULE
# define private_rlc_am_windows(x)
# define protected_rlc_am_windows(x) extern x
# define public_rlc_am_windows(x) extern x
# else
# define private_rlc_am_windows(x)
# define protected_rlc_am_windows(x)
# define public_rlc_am_windows(x) extern x
# endif
# endif
/*! \fn signed int rlc_am_in_tx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
* \brief Boolean function, check if sequence number is VT(A) <= snP < VT(MS).
@@ -58,10 +43,10 @@
* \param[in] snP Sequence number.
* \return 1 if snP in tx window, else 0.
*/
protected_rlc_am_windows(signed int rlc_am_in_tx_window(
signed int rlc_am_in_tx_window(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn signed int rlc_am_in_rx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
* \brief Boolean function, check if sequence number is VR(R) <= snP < VR(MR).
@@ -70,10 +55,10 @@ protected_rlc_am_windows(signed int rlc_am_in_tx_window(
* \param[in] snP Sequence number.
* \return 1 if snP in rx window, else 0.
*/
protected_rlc_am_windows(signed int rlc_am_in_rx_window(
signed int rlc_am_in_rx_window(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn signed int rlc_am_sn_gte_vr_h (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
* \brief Boolean function, check if sequence number is greater than or equal VR(R).
@@ -82,10 +67,10 @@ protected_rlc_am_windows(signed int rlc_am_in_rx_window(
* \param[in] snP Sequence number.
* \return 1 if sequence number is greater than or equal VR(R), else 0.
*/
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h (
signed int rlc_am_sn_gte_vr_h (
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn signed int rlc_am_sn_gte_vr_x (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
* \brief Boolean function, check if sequence number is greater than or equal VR(X).
@@ -94,10 +79,10 @@ protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h (
* \param[in] snP Sequence number.
* \return 1 if sequence number is greater than or equal VR(X), else 0.
*/
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x (
signed int rlc_am_sn_gte_vr_x (
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn signed int rlc_am_sn_gt_vr_ms (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
* \brief Boolean function, check if sequence number is greater than VR(MS).
@@ -106,10 +91,10 @@ protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x (
* \param[in] snP Sequence number.
* \return 1 if sequence number is greater than VR(MS), else 0.
*/
protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms(
signed int rlc_am_sn_gt_vr_ms(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t snP);)
const rlc_sn_t snP);
/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P)
* \brief Boolean function, in the context of the tx window, check if sn1P is greater than sn2P.
@@ -119,11 +104,11 @@ protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms(
* \param[in] sn2P Sequence number.
* \return 1 if sn1P is greater than sn2P, else 0.
*/
protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2(
signed int rlc_am_tx_sn1_gt_sn2(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t sn1P,
const rlc_sn_t sn2P);)
const rlc_sn_t sn2P);
/*! \fn signed int rlc_am_rx_sn1_gt_sn2(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P)
* \brief Boolean function, in the context of the rx window, check if sn1P is greater than sn2P.
@@ -133,10 +118,10 @@ protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2(
* \param[in] sn2P Sequence number.
* \return 1 if sn1P is greater than sn2P, else 0.
*/
protected_rlc_am_windows(signed int rlc_am_rx_sn1_gt_sn2(
signed int rlc_am_rx_sn1_gt_sn2(
const protocol_ctxt_t* const ctxt_pP,
const rlc_am_entity_t* const rlc_pP,
const rlc_sn_t sn1P,
const rlc_sn_t sn2P);)
const rlc_sn_t sn2P);
/** @} */
# endif
+18 -32
View File
@@ -34,21 +34,6 @@
*/
# ifndef __RLC_TM_H__
# define __RLC_TM_H__
# ifdef RLC_TM_C
# define private_rlc_tm(x)
# define protected_rlc_tm(x)
# define public_rlc_tm(x)
# else
# ifdef RLC_TM_MODULE
# define private_rlc_tm(x)
# define protected_rlc_tm(x) extern x
# define public_rlc_tm(x) extern x
# else
# define private_rlc_tm(x)
# define protected_rlc_tm(x)
# define public_rlc_tm(x) extern x
# endif
# endif
# include "platform_types.h"
# include "rlc_def.h"
# include "rlc_def_lte.h"
@@ -75,21 +60,21 @@
* \param[in] srcP SDU data pointer.
* \param[in] length_in_bitsP Length of SDU in bits.
*/
private_rlc_tm(void rlc_tm_send_sdu (
void rlc_tm_send_sdu (
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t * const rlc_pP,
const boolean_t error_indicationP,
uint8_t * const srcP,
const sdu_size_t length_in_bitsP);)
const sdu_size_t length_in_bitsP);
/*! \fn void rlc_tm_no_segment (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
* \brief Schedule a SDU to be transmited by lower layers.
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
private_rlc_tm(void rlc_tm_no_segment (
void rlc_tm_no_segment (
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t *const rlcP);)
rlc_tm_entity_t *const rlcP);
/*! \fn void rlc_tm_rx (const protocol_ctxt_t* const ctxt_pP,void *const rlcP, struct mac_data_ind data_indP)
* \brief Process the received PDUs from lower layer.
@@ -97,10 +82,10 @@ private_rlc_tm(void rlc_tm_no_segment (
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] data_indP PDUs from MAC.
*/
private_rlc_tm( void rlc_tm_rx (
void rlc_tm_rx (
const protocol_ctxt_t* const ctxt_pP,
void *const rlcP,
struct mac_data_ind data_indP);)
struct mac_data_ind data_indP);
/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void * const rlcP, const uint16_t tbs_sizeP, struct mac_status_ind tx_statusP)
@@ -111,11 +96,12 @@ private_rlc_tm( void rlc_tm_rx (
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \return The maximum number of bytes that can be served by RLC instance to MAC.
*/
public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication (
const protocol_ctxt_t* const ctxt_pP,
void * const rlcP,
const uint16_t tb_sizeP,
struct mac_status_ind tx_statusP);)
struct mac_status_resp
rlc_tm_mac_status_indication (
const protocol_ctxt_t* const ctxt_pP,
void * const rlc_pP,
const tb_size_t tb_sizeP,
struct mac_status_ind tx_statusP);
/*! \fn struct mac_data_req rlc_tm_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void * const rlcP)
@@ -124,9 +110,9 @@ public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication (
* \param[in] rlcP RLC TM protocol instance pointer.
* \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_tm( struct mac_data_req rlc_tm_mac_data_request (
struct mac_data_req rlc_tm_mac_data_request (
const protocol_ctxt_t* const ctxt_pP,
void * const rlcP);)
void * const rlcP);
/*! \fn void rlc_tm_mac_data_indication (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, struct mac_data_ind data_indP)
@@ -135,10 +121,10 @@ public_rlc_tm( struct mac_data_req rlc_tm_mac_data_request (
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] data_indP PDUs from MAC.
*/
public_rlc_tm( void rlc_tm_mac_data_indication (
void rlc_tm_mac_data_indication (
const protocol_ctxt_t* const ctxt_pP,
void * const rlcP,
struct mac_data_ind data_indP);)
struct mac_data_ind data_indP);
/*! \fn void rlc_tm_data_req (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, mem_block_t * const sduP)
@@ -147,10 +133,10 @@ public_rlc_tm( void rlc_tm_mac_data_indication (
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] sduP SDU. (A struct rlc_tm_data_req is mapped on sduP->data.)
*/
public_rlc_tm( void rlc_tm_data_req (
void rlc_tm_data_req (
const protocol_ctxt_t* const ctxt_pP,
void * const rlcP,
mem_block_t * const sduP);)
mem_block_t * const sduP);
/** @} */
# endif
@@ -83,6 +83,7 @@ void rlc_tm_init (
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
if(rlcP->input_sdus_alloc == NULL) return;
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
}
+12 -27
View File
@@ -42,21 +42,6 @@
//# include "rlc.h"
# include "platform_types.h"
//-----------------------------------------------------------------------------
# ifdef RLC_TM_INIT_C
# define private_rlc_tm_init(x) x
# define protected_rlc_tm_init(x) x
# define public_rlc_tm_init(x) x
# else
# ifdef RLC_TM_MODULE
# define private_rlc_tm_init(x)
# define protected_rlc_tm_init(x) extern x
# define public_rlc_tm_init(x) extern x
# else
# define private_rlc_tm_init(x)
# define protected_rlc_tm_init(x)
# define public_rlc_tm_init(x) extern x
# endif
# endif
typedef volatile struct rlc_tm_info_s {
uint8_t is_uplink_downlink;
@@ -75,35 +60,35 @@ typedef volatile struct rlc_tm_info_s {
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_tm_init( void config_req_rlc_tm (
void config_req_rlc_tm (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rlc_tm_info_t * const config_tmP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
const logical_chan_id_t chan_idP);
/*! \fn void rlc_tm_init (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
* \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
protected_rlc_tm_init(void rlc_tm_init (
void rlc_tm_init (
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t * const rlcP);)
rlc_tm_entity_t * const rlcP);
/*! \fn void rlc_tm_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
* \brief Reset protocol variables and state variables to initial values.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
protected_rlc_tm_init(void rlc_tm_reset_state_variables (
void rlc_tm_reset_state_variables (
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t * const rlcP);)
rlc_tm_entity_t * const rlcP);
/*! \fn void rlc_tm_cleanup(rlc_tm_entity_t * const rlcP)
* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC TM instance.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
public_rlc_tm_init( void rlc_tm_cleanup(
rlc_tm_entity_t * const rlcP);)
void rlc_tm_cleanup(
rlc_tm_entity_t * const rlcP);
/*! \fn void rlc_tm_configure(const protocol_ctxt_t* const ctxt_pP,rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP)
* \brief Configure RLC TM protocol parameters.
@@ -111,10 +96,10 @@ public_rlc_tm_init( void rlc_tm_cleanup(
* \param[in] is_uplink_downlinkP Is this instance is TRANSMITTER_ONLY,
RECEIVER_ONLY, or TRANSMITTER_AND_RECEIVER.
*/
protected_rlc_tm_init(void rlc_tm_configure(
void rlc_tm_configure(
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t * const rlcP,
const boolean_t is_uplink_downlinkP);)
const boolean_t is_uplink_downlinkP);
/*! \fn void rlc_tm_set_debug_infos(const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP, const rb_id_t rb_idP, const srb_flag_t srb_flagP)
* \brief Set debug informations for a RLC TM protocol instance, these informations are only for trace purpose.
@@ -123,12 +108,12 @@ protected_rlc_tm_init(void rlc_tm_configure(
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier
*/
protected_rlc_tm_init(void rlc_tm_set_debug_infos(
void rlc_tm_set_debug_infos(
const protocol_ctxt_t* const ctxt_pP,
rlc_tm_entity_t * const rlcP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
const logical_chan_id_t chan_idP);
/** @} */
# endif
+8 -1
View File
@@ -421,6 +421,7 @@ rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE %02X hex\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
l_rlc_p->protocol_state);
list_free (&data_indP.data);
}
}
@@ -567,7 +568,13 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,cons
l_rlc_p->stat_tx_data_pdu += 1;
l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes;
AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes);
//AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes);
if(tb_size_in_bytes <= 0) {
LOG_E(RLC, "RLC UM PDU LENGTH %d\n", tb_size_in_bytes);
tb_p = tb_p->next;
continue;
}
#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
#endif
+36 -44
View File
@@ -34,21 +34,6 @@
*/
# ifndef __RLC_UM_H__
# define __RLC_UM_H__
# ifdef RLC_UM_C
# define private_rlc_um(x)
# define protected_rlc_um(x)
# define public_rlc_um(x)
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um(x)
# define protected_rlc_um(x) extern x
# define public_rlc_um(x) extern x
# else
# define private_rlc_um(x)
# define protected_rlc_um(x)
# define public_rlc_um(x) extern x
# endif
# endif
# include <errno.h>
# include "platform_types.h"
# include "rlc_def.h"
@@ -141,40 +126,40 @@
* \param[out] stat_rx_data_bytes_out_of_window Number of data bytes received out of the receive window.
* \param[out] stat_timer_reordering_timed_out Number of times the timer "reordering" has timed-out.
*/
public_rlc_um(void rlc_um_stat_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,
unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded,
unsigned int* stat_tx_pdcp_bytes_discarded,
unsigned int* stat_tx_data_pdu,
unsigned int* stat_tx_data_bytes,
unsigned int* stat_rx_pdcp_sdu,
unsigned int* stat_rx_pdcp_bytes,
unsigned int* stat_rx_data_pdus_duplicate,
unsigned int* stat_rx_data_bytes_duplicate,
unsigned int* stat_rx_data_pdu,
unsigned int* stat_rx_data_bytes,
unsigned int* stat_rx_data_pdu_dropped,
unsigned int* stat_rx_data_bytes_dropped,
unsigned int* stat_rx_data_pdu_out_of_window,
unsigned int* stat_rx_data_bytes_out_of_window,
unsigned int* stat_timer_reordering_timed_out);)
void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded,
unsigned int* stat_tx_pdcp_bytes_discarded,
unsigned int* stat_tx_data_pdu,
unsigned int* stat_tx_data_bytes,
unsigned int* stat_rx_pdcp_sdu,
unsigned int* stat_rx_pdcp_bytes,
unsigned int* stat_rx_data_pdus_duplicate,
unsigned int* stat_rx_data_bytes_duplicate,
unsigned int* stat_rx_data_pdu,
unsigned int* stat_rx_data_bytes,
unsigned int* stat_rx_data_pdu_dropped,
unsigned int* stat_rx_data_bytes_dropped,
unsigned int* stat_rx_data_pdu_out_of_window,
unsigned int* stat_rx_data_bytes_out_of_window,
unsigned int* stat_timer_reordering_timed_out);
/*! \fn void rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Request the segmentation of SDUs based on status previously sent by MAC.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
private_rlc_um( void rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);)
void
rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, void *argP);
/*! \fn void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indication)
* \brief Process the received PDUs from lower layer.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] data_indication PDUs from MAC.
*/
protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indication);)
void
rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind data_indP);
/*! \fn struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP)
* \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.
@@ -183,14 +168,19 @@ protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \return The maximum number of bytes that can be served by RLC instance to MAC.
*/
public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP, const eNB_flag_t enb_flagP);)
struct mac_status_resp
rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP);
/*! \fn void rlc_um_set_nb_bytes_requested_by_mac (rlc_um_entity_t * const rlc_pP, const tb_size_t tb_sizeP)
* \brief Set available TBS size for MAC Tx.
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] tb_sizeP remaining TBS in bytes.
*/
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);)
void
rlc_um_set_nb_bytes_requested_by_mac (
void * 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,const eNB_flag_t enb_flagP)
* \brief Gives PDUs to lower layer MAC.
@@ -199,8 +189,8 @@ public_rlc_um( void rlc_um_set_nb_bytes_requested_by_mac (rlc_um_entity_t
* \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.
*/
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);)
struct mac_data_req
rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *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)
* \brief Receive PDUs from lower layer MAC.
@@ -208,13 +198,12 @@ public_rlc_um( struct mac_data_req rlc_um_mac_data_request (const protocol_ct
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] data_indP PDUs from MAC.
*/
public_rlc_um( 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 uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
* \brief Gets Tx Buffer Occupancy.
* \param[in] rlc_pP RLC UM protocol instance pointer.)
*/
public_rlc_um( uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP);)
uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP);
/*! \fn void rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *sduP)
* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
@@ -222,6 +211,9 @@ public_rlc_um( uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] sduP SDU. (A struct rlc_um_data_req is mapped on sduP->data.)
*/
public_rlc_um( void rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *sduP);)
void
rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP);
void
rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP) ;
/** @} */
# endif
@@ -94,7 +94,7 @@ void config_req_rlc_um_asn1 (
const DL_UM_RLC_t * const dl_rlc_pP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
@@ -111,16 +111,31 @@ void config_req_rlc_um_asn1 (
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if (mbms_flagP) {
AssertFatal(dl_rlc_pP, "No RLC UM DL config");
AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present");
//AssertFatal(dl_rlc_pP, "No RLC UM DL config");
if(dl_rlc_pP == NULL) {
LOG_E(RLC, "No RLC UM DL config\n");
return;
}
//AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present");
if(ul_rlc_pP != NULL) {
LOG_E(RLC, "RLC UM UL config present\n");
return;
}
key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u",
ctxt_pP->module_id,
ctxt_pP->rnti,
ctxt_pP->enb_flag,
mbms_service_idP,
mbms_session_idP);
//AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u",
// ctxt_pP->module_id,
// ctxt_pP->rnti,
// ctxt_pP->enb_flag,
// mbms_service_idP,
// mbms_session_idP);
if(h_rc != HASH_TABLE_OK) {
LOG_E(RLC, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u\n",
ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
return;
}
rlc_p = &rlc_union_p->rlc.um;
}
if ((sourceL2Id >0 ) && (destinationL2Id >0)){
@@ -131,12 +146,17 @@ void config_req_rlc_um_asn1 (
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u",
ctxt_pP->module_id,
ctxt_pP->rnti,
ctxt_pP->enb_flag,
rb_idP,
srb_flagP);
//AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u",
// ctxt_pP->module_id,
// ctxt_pP->rnti,
// ctxt_pP->enb_flag,
// rb_idP,
// srb_flagP);
if(h_rc != HASH_TABLE_OK) {
LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u\n",
ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
return;
}
rlc_p = &rlc_union_p->rlc.um;
//-----------------------------------------------------------------------------
@@ -277,7 +297,11 @@ rlc_um_init (
)
{
AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)");
//AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)");
if(rlc_pP == NULL) {
LOG_E(RLC, "Bad RLC UM pointer (NULL)\n");
return;
}
if (rlc_pP->initialized) {
LOG_D(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [INIT] ALREADY DONE, DOING NOTHING\n",
@@ -43,21 +43,6 @@
# include "DL-UM-RLC.h"
# include "UL-UM-RLC.h"
//-----------------------------------------------------------------------------
# ifdef RLC_UM_CONTROL_PRIMITIVES_C
# define private_rlc_um_control_primitives(x) x
# define protected_rlc_um_control_primitives(x) x
# define public_rlc_um_control_primitives(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_control_primitives(x)
# define protected_rlc_um_control_primitives(x) extern x
# define public_rlc_um_control_primitives(x) extern x
# else
# define private_rlc_um_control_primitives(x)
# define protected_rlc_um_control_primitives(x)
# define public_rlc_um_control_primitives(x) extern x
# endif
# endif
typedef volatile struct {
uint32_t is_uplink_downlink;
@@ -79,12 +64,12 @@ typedef volatile struct {
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_um_control_primitives( void config_req_rlc_um (
void config_req_rlc_um (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rlc_um_info_t * const config_umP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
const logical_chan_id_t chan_idP);
/*! \fn void config_req_rlc_um_asn1 (
* const protocol_ctxt_t* const ctxt_pP,
@@ -106,7 +91,7 @@ public_rlc_um_control_primitives( void config_req_rlc_um (
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (
void config_req_rlc_um_asn1 (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
@@ -116,36 +101,36 @@ public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (
const DL_UM_RLC_t * const dl_rlc_pP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
);)
);
/*! \fn void rlc_um_init (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state.
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
protected_rlc_um_control_primitives(void rlc_um_init (
void rlc_um_init (
const protocol_ctxt_t* const ctxt_pP,
rlc_um_entity_t * const rlc_pP);)
rlc_um_entity_t * const rlc_pP);
/*! \fn void rlc_um_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Reset protocol variables and state variables to initial values.
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
protected_rlc_um_control_primitives(void rlc_um_reset_state_variables (
void rlc_um_reset_state_variables (
const protocol_ctxt_t* const ctxt_pP,
rlc_um_entity_t * const rlc_pP);)
rlc_um_entity_t * const rlc_pP);
/*! \fn void rlc_um_cleanup(rlc_um_entity_t * const rlc_pP)
* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC UM instance.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
public_rlc_um_control_primitives( void rlc_um_cleanup(
rlc_um_entity_t * const rlc_pP);)
void rlc_um_cleanup(
rlc_um_entity_t * const rlc_pP);
/*! \fn void rlc_um_configure(
* const protocol_ctxt_t* const ctxt_pP,
@@ -162,13 +147,13 @@ public_rlc_um_control_primitives( void rlc_um_cleanup(
* \param[in] tx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in transmission.
* \param[in] is_mXchP Is the radio bearer for MCCH, MTCH.
*/
protected_rlc_um_control_primitives(void rlc_um_configure(
void rlc_um_configure(
const protocol_ctxt_t* const ctxt_pP,
rlc_um_entity_t *const rlc_pP,
const uint32_t timer_reorderingP,
const uint32_t rx_sn_field_lengthP,
const uint32_t tx_sn_field_lengthP,
const uint32_t is_mXchP);)
const uint32_t is_mXchP);
/*! \fn void rlc_um_set_debug_infos(
* const protocol_ctxt_t* const ctxt_pP,
@@ -182,11 +167,11 @@ protected_rlc_um_control_primitives(void rlc_um_configure(
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Transport channel identifier.
*/
protected_rlc_um_control_primitives(void rlc_um_set_debug_infos(
void rlc_um_set_debug_infos(
const protocol_ctxt_t* const ctxt_pP,
rlc_um_entity_t * const rlc_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);)
const logical_chan_id_t chan_idP);
/** @} */
# endif
+57 -22
View File
@@ -32,7 +32,6 @@
#include "list.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//-----------------------------------------------------------------------------
signed int rlc_um_get_pdu_infos(
const protocol_ctxt_t* const ctxt_pP,
@@ -47,7 +46,11 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->num_li = 0;
AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP);
//AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP);
if(total_sizeP <= 0) {
LOG_E(RLC, "RLC UM PDU LENGTH %d\n", total_sizeP);
return -1;
}
if (sn_lengthP == 10) {
pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
@@ -62,7 +65,11 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->header_size = 1;
pdu_info_pP->payload = &header_pP->b2;
} else {
AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP);
//AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP);
if(!(sn_lengthP == 5 || sn_lengthP == 10)) {
LOG_E(RLC, "RLC UM SN LENGTH %d\n", sn_lengthP);
return -1;
}
}
@@ -77,15 +84,23 @@ signed int rlc_um_get_pdu_infos(
li_length_in_bytes = li_length_in_bytes ^ 3;
if (li_length_in_bytes == 2) {
AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP),
"DECODING PDU TOO FAR PDU size %d", total_sizeP);
//AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP),
// "DECODING PDU TOO FAR PDU size %d", total_sizeP);
if(total_sizeP < ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP)) {
LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
return -1;
}
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b1 << 4)) & 0x07F0;
pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li_p->b2 >> 4)) & 0x000F);
li_to_read = e_li_p->b1 & 0x80;
pdu_info_pP->header_size += 2;
} else {
AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP),
"DECODING PDU TOO FAR PDU size %d", total_sizeP);
//AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP),
// "DECODING PDU TOO FAR PDU size %d", total_sizeP);
if(total_sizeP < ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP)) {
LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
return -1;
}
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b2 << 8)) & 0x0700;
pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li_p->b3;
li_to_read = e_li_p->b2 & 0x08;
@@ -93,10 +108,16 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->header_size += 1;
}
AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU,
PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ",
//AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU,
// PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ",
// PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
// pdu_info_pP->sn);
if(pdu_info_pP->num_li > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs \n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
pdu_info_pP->sn);
return -1;
}
sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li];
pdu_info_pP->num_li = pdu_info_pP->num_li + 1;
@@ -308,9 +329,17 @@ rlc_um_try_reassembly(
__LINE__);
#endif
}
AssertFatal(size >= 0, "invalid size!");
AssertFatal((e==0) || (e==1), "invalid e!");
AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!");
//AssertFatal(size >= 0, "invalid size!");
//AssertFatal((e==0) || (e==1), "invalid e!");
//AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!");
if((size < 0) || ((e!=0) && (e!=1)) || ((fi < 0) || (fi > 3))){
LOG_E(RLC, "invalid size %d, e %d, fi %d\n", size, e, fi);
sn = (sn + 1) % rlc_pP->rx_sn_modulo;
if ((sn == rlc_pP->vr_uh) || (sn == end_snP)) {
continue_reassembly = 0;
}
continue;
}
if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
switch (fi) {
@@ -400,11 +429,14 @@ rlc_um_try_reassembly(
break;
default:
AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
fi,
__FILE__,
__LINE__);
//AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
// PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
// fi,
// __FILE__,
// __LINE__);
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), fi, __FILE__, __LINE__);
}
} else {
if (rlc_um_read_length_indicators(&data_p, e_li_p, li_array, &num_li, &size ) >= 0) {
@@ -543,11 +575,14 @@ rlc_um_try_reassembly(
// data_p is already ok, done by last loop above
rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
} else {
AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
size,
__FILE__,
__LINE__);
//AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
// PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
// size,
// __FILE__,
// __LINE__);
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), size, __FILE__, __LINE__);
//rlc_pP->stat_rx_data_pdu_dropped += 1;
rlc_pP->stat_rx_data_bytes_dropped += size;
}
+15 -30
View File
@@ -40,21 +40,6 @@
# include "rlc_um_constants.h"
# include "list.h"
//-----------------------------------------------------------------------------
# ifdef RLC_UM_DAR_C
# define private_rlc_um_dar(x) x
# define protected_rlc_um_dar(x) x
# define public_rlc_um_dar(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_dar(x)
# define protected_rlc_um_dar(x) extern x
# define public_rlc_um_dar(x) extern x
# else
# define private_rlc_um_dar(x)
# define protected_rlc_um_dar(x)
# define public_rlc_um_dar(x) extern x
# endif
# endif
/*! \fn signed int rlc_um_get_pdu_infos(const protocol_ctxt_t* const ctxt_pP,const rlc_um_entity_t * const rlc_pP,rlc_um_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP)
* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
* \param[in] ctxt_pP Running context.
@@ -65,13 +50,13 @@
* \param[in] sn_lengthP Sequence number length in bits in PDU header (5 or 10).
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
*/
protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(
signed int rlc_um_get_pdu_infos(
const protocol_ctxt_t* const ctxt_pP,
const rlc_um_entity_t * const rlc_pP,
rlc_um_pdu_sn_10_t * const header_pP,
const sdu_size_t total_sizeP,
rlc_um_pdu_info_t * const pdu_info_pP,
const uint8_t sn_lengthP));
const uint8_t sn_lengthP);
/*! \fn int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)
* \brief Reset protocol variables and state variables to initial values.
@@ -82,7 +67,7 @@ protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(
* \param[in,out] data_size_pP Pointer on data size.
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
*/
private_rlc_um_dar( int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP));
int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP);
/*! \fn void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, rlc_sn_t start_snP, rlc_sn_t end_snP)
* \brief Try reassembly PDUs from DAR buffer, starting at sequence number snP.
@@ -92,7 +77,7 @@ private_rlc_um_dar( int rlc_um_read_length_indicators(unsigned char**data_ppP,
* \param[in] start_snP First PDU to be reassemblied if possible.
* \param[in] end_snP Last excluded highest sequence number of PDU to be reassemblied.
*/
private_rlc_um_dar( void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t start_snP, const rlc_sn_t end_snP));
void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t start_snP, const rlc_sn_t end_snP);
/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t * const rlc_pP,frame_t frameP)
* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
@@ -100,7 +85,7 @@ private_rlc_um_dar( void rlc_um_try_reassembly (const protocol_ctxt_t* con
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] frameP Frame index
*/
protected_rlc_um_dar(void rlc_um_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP));
void rlc_um_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);
/*! \fn void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Stop and reset the timer reordering.
@@ -108,7 +93,7 @@ protected_rlc_um_dar(void rlc_um_check_timer_reordering(const protocol_ctxt_t* c
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] frameP Frame index.
*/
protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);)
void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);
/*! \fn void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Re-arm (based on RLC UM config parameter) and start timer reordering.
@@ -116,7 +101,7 @@ protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(const protocol_
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] frameP Frame index.
*/
protected_rlc_um_dar(void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);)
void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);
/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t * const rlc_pP, const uint32_t ms_durationP)
* \brief Initialize the timer reordering with RLC UM time-out config parameter.
@@ -124,14 +109,14 @@ protected_rlc_um_dar(void rlc_um_start_timer_reordering(const protocol_ctxt_t* c
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] ms_durationP Duration in milliseconds units.
*/
protected_rlc_um_dar(void rlc_um_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint32_t ms_durationP);)
void rlc_um_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint32_t ms_durationP);
/*! \fn void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,)
* \brief Check if t-Reordering expires and take the appropriate actions as described in 3GPP specifications.
* \param[in] ctxt_pP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP));
void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t * const rlc_pP, uint16_t snP)
* \brief Remove the PDU with sequence number snP from the DAR buffer and return it.
@@ -140,7 +125,7 @@ protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(const protocol_ctxt_
* \param[in] snP Sequence number.
* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
*/
private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP));
mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP);
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP)
* \brief Get the PDU with sequence number snP from the DAR buffer.
@@ -149,7 +134,7 @@ private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protoc
* \param[in] snP Sequence number.
* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
*/
protected_rlc_um_dar(mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP));
mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP);
/*! \fn signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP)
* \brief Compute if the sequence number of a PDU is in a window .
@@ -160,7 +145,7 @@ protected_rlc_um_dar(mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_
* \param[in] higher_boundP Higher bound of a window.
* \return -2 if lower_boundP > sn, -1 if higher_boundP < sn, 0 if lower_boundP < sn < higher_boundP, 1 if lower_boundP == sn, 2 if higher_boundP == sn, 3 if higher_boundP == sn == lower_boundP.
*/
protected_rlc_um_dar(signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP));
signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP);
/*! \fn signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP)
* \brief Compute if the sequence number of a PDU is in a window .
@@ -169,7 +154,7 @@ protected_rlc_um_dar(signed int rlc_um_in_window(const protocol_ctxt_t* const ct
* \param[in] snP Sequence number of a theorical PDU.
* \return 0 if snP is in reordering window, else -1.
*/
protected_rlc_um_dar(signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP));
signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP);
/*! \fn void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP, const sdu_size_t tb_sizeP)
* \brief Apply the DAR process for a PDU: put it in DAR buffer and try to reassembly or discard it.
@@ -179,7 +164,7 @@ protected_rlc_um_dar(signed int rlc_um_in_reordering_window(const protocol_ctxt_
* \param[in] pdu_pP Pointer on the header of the UM PDU.
* \param[in] tb_sizeP Size of the UM PDU.
*/
protected_rlc_um_dar(void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t * pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP,
const sdu_size_t tb_sizeP));
void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t * pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP,
const sdu_size_t tb_sizeP);
/** @} */
# endif
+1 -1
View File
@@ -52,7 +52,7 @@ rlc_um_fsm_notify_event (
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
eventP);
AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE");
//AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE");
return 0;
}
+1 -16
View File
@@ -35,21 +35,6 @@
# ifndef __RLC_UM_FSM_PROTO_EXTERN_H__
# define __RLC_UM_FSM_PROTO_EXTERN_H__
//-----------------------------------------------------------------------------
# ifdef RLC_UM_FSM_C
# define private_rlc_um_fsm(x) x
# define protected_rlc_um_fsm(x) x
# define public_rlc_um_fsm(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_fsm(x)
# define protected_rlc_um_fsm(x) extern x
# define public_rlc_um_fsm(x) extern x
# else
# define private_rlc_um_fsm(x)
# define protected_rlc_um_fsm(x)
# define public_rlc_um_fsm(x) extern x
# endif
# endif
# include "platform_types.h"
# include "rlc_um_entity.h"
//-----------------------------------------------------------------------------
@@ -65,6 +50,6 @@
* \return 1 if no error was encountered, 0 if the event was not processed.
* \Note This FSM is not LTE 9.3.0 compliant, it has to be modified or removed.
*/
protected_rlc_um_fsm(int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP));
int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP);
/** @} */
# endif
@@ -35,21 +35,6 @@
# ifndef __RLC_UM_REASSEMBLY_PROTO_EXTERN_H__
# define __RLC_UM_REASSEMBLY_PROTO_EXTERN_H__
//-----------------------------------------------------------------------------
# ifdef RLC_UM_REASSEMBLY_C
# define private_rlc_um_reassembly(x) x
# define protected_rlc_um_reassembly(x) x
# define public_rlc_um_reassembly(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_reassembly(x)
# define protected_rlc_um_reassembly(x) extern x
# define public_rlc_um_reassembly(x) extern x
# else
# define private_rlc_um_reassembly(x)
# define protected_rlc_um_reassembly(x)
# define public_rlc_um_reassembly(x) extern x
# endif
# endif
# include "rlc_um_entity.h"
//-----------------------------------------------------------------------------
/*! \fn void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
@@ -57,7 +42,7 @@
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_reassembly(void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP));
void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
/*! \fn void rlc_um_reassembly (uint8_t * srcP, int32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame)
* \brief Reassembly lengthP bytes to the end of the SDU in construction.
@@ -66,13 +51,13 @@ protected_rlc_um_reassembly(void rlc_um_clear_rx_sdu (const protocol_ctxt_t* con
* \param[in] srcP Pointer on data to be reassemblied.
* \param[in] lengthP Length to reassembly.
*/
protected_rlc_um_reassembly(void rlc_um_reassembly (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t * srcP, int32_t lengthP));
void rlc_um_reassembly (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t * srcP, int32_t lengthP);
/*! \fn void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
* \brief Send SDU if any reassemblied to upper layer.
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_reassembly(void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP));
void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
/** @} */
# endif
@@ -33,22 +33,6 @@
*/
# ifndef __RLC_UM_RECEIVER_PROTO_EXTERN_H__
# define __RLC_UM_RECEIVER_PROTO_EXTERN_H__
# ifdef RLC_UM_RECEIVER_C
# define private_rlc_um_receiver(x) x
# define protected_rlc_um_receiver(x) x
# define public_rlc_um_receiver(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_receiver(x)
# define protected_rlc_um_receiver(x) extern x
# define public_rlc_um_receiver(x) extern x
# else
# define private_rlc_um_receiver(x)
# define protected_rlc_um_receiver(x)
# define public_rlc_um_receiver(x) extern x
# endif
# endif
# include "rlc_um_entity.h"
# include "mac_primitives.h"
@@ -57,7 +41,7 @@
* \param[in] ctxtP Running context.
* \param[in] rlc_pP RLC UM protocol instance pointer.
*/
protected_rlc_um_receiver( void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP);)
void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP);
/*! \fn void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP)
* \brief Handle the MAC data indication, retreive the transport blocks and send them one by one to the DAR process.
@@ -65,6 +49,6 @@ protected_rlc_um_receiver( void rlc_um_display_rx_window(const protocol_ctxt_t*
* \param[in] rlc_pP RLC UM protocol instance pointer.
* \param[in] data_indP Data indication structure containing transport block received from MAC layer.
*/
protected_rlc_um_receiver( void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP));
void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP);
/** @} */
# endif
+12 -6
View File
@@ -411,7 +411,11 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
#if TRACE_RLC_PAYLOAD
rlc_util_print_hex_octets(RLC, pdu_mem_p->data, data_pdu_size);
#endif
AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
//AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
if(pdu_tb_req_p->tb_size <= 0) {
LOG_E(RLC, "SEGMENT10: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
break;
}
pdu_p = NULL;
pdu_mem_p = NULL;
@@ -744,13 +748,11 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
sdu_mngt_p = NULL;
} else {
#if TRACE_RLC_UM_SEGMENT
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
sdu_mngt_p->sdu_remaining_size,
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
#endif
assert(1!=1);
//assert(1!=1);
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
// reduce the size of the PDU
continue_fill_pdu_with_sdu = 0;
@@ -792,7 +794,11 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
#if TRACE_RLC_PAYLOAD
rlc_util_print_hex_octets(RLC, (unsigned char*)pdu_mem_p->data, data_pdu_size);
#endif
AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
//AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
if(pdu_tb_req_p->tb_size <= 0) {
LOG_E(RLC, "SEGMENT5: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
break;
}
pdu_p = NULL;
pdu_mem_p = NULL;
+2 -17
View File
@@ -40,27 +40,12 @@
# include "rlc_um_constants.h"
# include "list.h"
//-----------------------------------------------------------------------------
# ifdef RLC_UM_SEGMENT_C
# define private_rlc_um_segment(x) x
# define protected_rlc_um_segment(x) x
# define public_rlc_um_segment(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_segment(x)
# define protected_rlc_um_segment(x) extern x
# define public_rlc_um_segment(x) extern x
# else
# define private_rlc_um_segment(x)
# define protected_rlc_um_segment(x)
# define public_rlc_um_segment(x) extern x
# endif
# endif
/*! \fn void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
* \brief Segmentation procedure with 10 bits sequence number, segment the first SDU in buffer and create a PDU of the size (nb_bytes_to_transmit) requested by MAC if possible and put it in the list "pdus_to_mac_layer".
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_segment(void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP));
void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
/*! \fn void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
@@ -68,6 +53,6 @@ protected_rlc_um_segment(void rlc_um_segment_10 (const protocol_ctxt_t* const ct
* \param[in] ctxtP Running context.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_segment(void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP));
void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
/** @} */
# endif
+3 -4
View File
@@ -317,7 +317,7 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP)
assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
}
@@ -406,9 +406,8 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
if (*drop_countP == 0) {
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
if (tb_dst != NULL) {
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
//printf("[RLC-LOOP] Testing tb_dst (1)\n");
check_free_mem_block(tb_dst, __func__);
tb_dst->next = NULL;
@@ -427,7 +426,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
check_free_mem_block(tb_dst, __func__);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
} else {
printf("[RLC-LOOP] DROPPING 1 TB\n");
+17 -32
View File
@@ -21,37 +21,22 @@
# ifndef __RLC_UM_TEST_H__
# define __RLC_UM_TEST_H__
# ifdef RLC_UM_TEST_C
# define private_rlc_um_test(x) x
# define protected_rlc_um_test(x) x
# define public_rlc_um_test(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_test(x)
# define protected_rlc_um_test(x) extern x
# define public_rlc_um_test(x) extern x
# else
# define private_rlc_um_test(x)
# define protected_rlc_um_test(x)
# define public_rlc_um_test(x) extern x
# endif
# endif
public_rlc_um_test(rlc_um_entity_t um_tx;)
public_rlc_um_test(rlc_um_entity_t um_rx;)
rlc_um_entity_t um_tx;
rlc_um_entity_t um_rx;
protected_rlc_um_test(void rlc_um_v9_3_0_test_windows_5(void);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_windows_10(void);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,rlc_um_entity_t *um_RxP, uint16_t bytes_txP,uint16_t bytes_rxP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP, rlc_um_entity_t *um_rxP, uint16_t bytes_txP, uint16_t bytes_rxP, signed int time_tx_delayedP,
signed int time_rx_delayedP, int is_frame_incrementedP);)
protected_rlc_um_test(void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind* data_ind_rxP, signed int time_tx_delayedP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
mem_block_t *sduP);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_tx_rx_10(void);)
protected_rlc_um_test(void rlc_um_v9_3_0_test_tx_rx_5(void);)
public_rlc_um_test( void rlc_um_v9_3_0_test_print_trace (void);)
public_rlc_um_test( void rlc_um_v9_3_0_test(void));
void rlc_um_v9_3_0_test_windows_5(void);
void rlc_um_v9_3_0_test_windows_10(void);
void rlc_um_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP);
void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,rlc_um_entity_t *um_RxP, uint16_t bytes_txP,uint16_t bytes_rxP);
void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP, rlc_um_entity_t *um_rxP, uint16_t bytes_txP, uint16_t bytes_rxP, signed int time_tx_delayedP,
signed int time_rx_delayedP, int is_frame_incrementedP);
void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind* data_ind_rxP, signed int time_tx_delayedP);
void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);
void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
mem_block_t *sduP);
void rlc_um_v9_3_0_test_tx_rx_10(void);
void rlc_um_v9_3_0_test_tx_rx_5(void);
void rlc_um_v9_3_0_test_print_trace (void);
void rlc_um_v9_3_0_test(void);
# endif
@@ -37,21 +37,6 @@
# include "rlc_um_structs.h"
# include "rlc_um_constants.h"
//-----------------------------------------------------------------------------
# ifdef RLC_UM_VERY_SIMPLE_TEST_C
# define private_rlc_um_very_simple_test(x) x
# define protected_rlc_um_very_simple_test(x) x
# define public_rlc_um_very_simple_test(x) x
# else
# ifdef RLC_UM_MODULE
# define private_rlc_um_very_simple_test(x)
# define protected_rlc_um_very_simple_test(x) extern x
# define public_rlc_um_very_simple_test(x) extern x
# else
# define private_rlc_um_very_simple_test(x)
# define protected_rlc_um_very_simple_test(x)
# define public_rlc_um_very_simple_test(x) extern x
# endif
# endif
#define RLC_UM_TEST_SDU_TYPE_TCPIP 0
#define RLC_UM_TEST_SDU_TYPE_VOIP 1
#define RLC_UM_TEST_SDU_TYPE_SMALL 2
@@ -61,5 +46,5 @@
#define voip_sdu "Nos tests montrent que le nouveau Toshiba MK7559GSXP, un disque dur de 750 Go"
#define very_small_sdu "NoS tEsTs MoNtReNt"
public_rlc_um_very_simple_test(void rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int sdu_typeP));
void rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int sdu_typeP);
# endif
+41 -9
View File
@@ -30,6 +30,7 @@
#include "rlc.h"
#include "mem_block.h"
#include "../MAC/mac_extern.h"
#include "LAYER2/RLC/UM_v9.3.0/rlc_um.h"
#include "UTIL/LOG/log.h"
#include "UTIL/OCG/OCG_vars.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
@@ -135,7 +136,12 @@ rlc_op_status_t rlc_stat_req (
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -221,8 +227,7 @@ rlc_op_status_t rlc_stat_req (
*stat_rx_data_bytes_out_of_window = 0;
*stat_timer_poll_retransmit_timed_out = 0;
*stat_timer_status_prohibit_timed_out = 0;
rlc_um_stat_req (ctxt_pP,
&rlc_union_p->rlc.um,
rlc_um_stat_req (&rlc_union_p->rlc.um,
stat_tx_pdcp_sdu,
stat_tx_pdcp_bytes,
stat_tx_pdcp_sdu_discarded,
@@ -315,7 +320,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
confirm_t confirmP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id
#endif
@@ -353,13 +358,30 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#endif
if (MBMS_flagP) {
AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
//AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
if(rb_idP >= NB_RB_MBMS_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else {
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
}
DevAssert(sdu_pP != NULL);
DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
//DevAssert(sdu_pP != NULL);
if(sdu_pP == NULL){
LOG_E(RLC, "sdu_pP == NULL\n");
return RLC_OP_STATUS_BAD_PARAMETER;
}
//DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
if(sdu_sizeP <= 0) {
LOG_E(RLC, "sdu_sizeP %d, file %s, line %d\n", sdu_sizeP, __FILE__ ,__LINE__);
return RLC_OP_STATUS_BAD_PARAMETER;
}
#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
@@ -396,6 +418,8 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
} else {
rlc_mode = RLC_MODE_NONE;
//AssertFatal (0 , "RLC not configured key %ju\n", key);
LOG_E(RLC, "not configured key %lu\n", key);
return RLC_OP_STATUS_OUT_OF_RESSOURCES;
}
if (MBMS_flagP == 0) {
@@ -440,6 +464,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
return RLC_OP_STATUS_OK;
} else {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_INTERNAL_ERROR;
}
@@ -473,6 +498,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
return RLC_OP_STATUS_OK;
} else {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_INTERNAL_ERROR;
}
@@ -495,6 +521,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
} else {
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_INTERNAL_ERROR;
}
@@ -529,6 +556,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
return RLC_OP_STATUS_OK;
} else {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else {
@@ -622,7 +650,11 @@ rlc_module_init (void)
rlc_rrc_data_conf = NULL;
rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union);
AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
//AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
if(rlc_coll_p == NULL) {
LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
return -1;
}
for (module_id1=0; module_id1 < MAX_MOBILES_PER_ENB; module_id1++) {
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+50 -91
View File
@@ -44,7 +44,7 @@
# include "rlc_am_structs.h"
# include "rlc_tm_structs.h"
# include "rlc_um_structs.h"
# include "asn1_constants.h"
# include "asn_constant.h"
# include "UTIL/LOG/log.h"
# include "mem_block.h"
//# include "PHY/defs.h"
@@ -59,49 +59,8 @@
#include "PMCH-InfoList-r9.h"
#endif
#ifdef CMAKER
typedef uint64_t hash_key_t;
#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
#endif
//-----------------------------------------------------------------------------
# ifdef RLC_MAC_C
# define private_rlc_mac(x) x
# define public_rlc_mac(x) x
# else
# define private_rlc_mac(x)
# define public_rlc_mac(x) extern x
# endif
# ifdef RLC_MPLS_C
# define private_rlc_mpls(x) x
# define public_rlc_mpls(x) x
# else
# define private_rlc_mpls(x)
# define public_rlc_mpls(x) extern x
# endif
# ifdef RLC_RRC_C
# define private_rlc_rrc(x) x
# define public_rlc_rrc(x) x
# else
# define private_rlc_rrc(x)
# define public_rlc_rrc(x) extern x
# endif
# ifdef RLC_C
# define private_rlc(x) x
# define protected_rlc(x) x
# define public_rlc(x) x
# else
# define private_rlc(x)
# if defined(RLC_MAC_C) || defined(RLC_MPLS_C) || defined(RLC_RRC_C) || defined(RLC_AM_C) || defined(RLC_TM_C) || defined(RLC_UM_C) || defined (PDCP_C)
# define protected_rlc(x) extern x
# else
# define protected_rlc(x)
# endif
# define public_rlc(x) extern x
# endif
//-----------------------------------------------------------------------------
#define RLC_OP_STATUS_OK 1
@@ -176,17 +135,17 @@ typedef struct {
#define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount)
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_ENB)
protected_rlc(void (*rlc_rrc_data_ind)(
void (*rlc_rrc_data_ind)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
const uint8_t * const sduP);)
const uint8_t * const sduP);
protected_rlc(void (*rlc_rrc_data_conf)(
void (*rlc_rrc_data_conf)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP);)
const rlc_tx_status_t statusP);
typedef void (rrc_data_ind_cb_t)(
const protocol_ctxt_t* const ctxtP,
@@ -234,10 +193,10 @@ typedef struct rlc_mbms_id_s {
# define maxSessionPerPMCH 1
# endif
#endif
//public_rlc(rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
//public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
//rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
//rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
#define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD]
;
@@ -253,8 +212,8 @@ public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RL
rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \
} while (0);
public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
#define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \
@@ -302,7 +261,7 @@ public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX];
(((hash_key_t)(sESSION_ID)) << 37) | \
(((hash_key_t)(0x0000000000000001)) << 63))
public_rlc(hash_table_t *rlc_coll_p;)
hash_table_t *rlc_coll_p;
/*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP)
* \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC.
@@ -310,7 +269,7 @@ public_rlc(hash_table_t *rlc_coll_p;)
* \param[in] transport_blocksP List of transport blocks.
* \return The amount of bytes that have been written due to serialization.
*/
private_rlc_mac(tbs_size_t mac_rlc_serialize_tb (char*, list_t);)
tbs_size_t mac_rlc_serialize_tb (char*, list_t);
/*! \fn struct mac_data_ind mac_rlc_deserialize_tb (char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcsP)
* \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC.
@@ -320,7 +279,7 @@ private_rlc_mac(tbs_size_t mac_rlc_serialize_tb (char*, list_t);)
* \param[in] crcsP Array of CRC for each transport block.
* \return A mac_data_ind structure containing a list of transport blocks.
*/
private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, num_tb_t, crc_t *);)
struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, num_tb_t, crc_t *);
//-----------------------------------------------------------------------------
@@ -336,14 +295,14 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
* \param[in] pmch_info_listP eMBMS pmch info list to be created.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
rlc_op_status_t rrc_rlc_config_asn1_req (
const protocol_ctxt_t* const,
const SRB_ToAddModList_t* const ,
const DRB_ToAddModList_t* const ,
const DRB_ToReleaseList_t* const ,
const PMCH_InfoList_r9_t * const pmch_info_listP ,
const uint32_t ,
const uint32_t );)
const uint32_t );
#else
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t* const ctxtP, const SRB_ToAddModList_t* const srb2add_listP, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP)
* \brief Function for RRC to configure a Radio Bearer.
@@ -353,11 +312,11 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
* \param[in] drb2release_listP DRB configuration list to be released.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
rlc_op_status_t rrc_rlc_config_asn1_req (
const protocol_ctxt_t* const,
const SRB_ToAddModList_t* const ,
const DRB_ToAddModList_t* const ,
const DRB_ToReleaseList_t* const );)
const DRB_ToReleaseList_t* const );
#endif
@@ -366,8 +325,8 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
* struct pointed by of the rlcu_pP parameter. Free the rlc_union_t struct also.
* \param[in] rlcu_pP Pointer on the rlc_union_t struct.
*/
public_rlc_rrc(void
rb_free_rlc_union (void *rlcu_pP);)
void
rb_free_rlc_union (void *rlcu_pP);
/*! \fn rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const ctxtP)
@@ -375,7 +334,7 @@ public_rlc_rrc(void
* \param[in] ctxtP Running context.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const);)
rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const);
/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP)
@@ -386,7 +345,7 @@ public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const);
* \param[in] rb_idP Radio bearer identifier.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t, const rb_id_t );)
rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t, const rb_id_t );
/*! \fn rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP)
* \brief Add a RLC protocol instance to a radio bearer.
@@ -398,12 +357,12 @@ public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* cons
* \param[in] rlc_modeP Mode of RLC (AM, UM, TM).
* \return A status about the processing, OK or error code.
*/
private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t
#ifdef Rel14
rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id,
const uint32_t destinationL2Id
#endif
);)
);
/*! \fn rlc_op_status_t rrc_rlc_config_req (
const protocol_ctxt_t* const ctxtP,
@@ -421,13 +380,13 @@ private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const
* \param[in] rlc_infoP RLC configuration parameters issued from Radio Resource Manager.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (
rlc_op_status_t rrc_rlc_config_req (
const protocol_ctxt_t* const,
const srb_flag_t,
const MBMS_flag_t,
config_action_t,
const rb_id_t,
rlc_info_t );)
rlc_info_t );
/*! \fn rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t* const ctxtP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP)
* \brief Function for RRC to send a SDU through a Signalling Radio Bearer.
@@ -440,14 +399,14 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (
* \param[in] sduP SDU.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t* const , const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);)
rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t* const , const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
* \brief This function is called by RRC to register its DATA-INDICATE and DATA-CONFIRM handlers to RLC layer.
* \param[in] rrc_data_indP Pointer on RRC data indicate function.
* \param[in] rrc_data_confP Pointer on RRC data confirm callback function.
*/
public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP);)
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP);
//-----------------------------------------------------------------------------
// PUBLIC INTERFACE WITH MAC
@@ -464,12 +423,12 @@ public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_d
* \param [in,out] bufferP Memory area to fill with the bytes requested by MAC.
* \return A status about the processing, OK or error code.
*/
public_rlc_mac(tbs_size_t mac_rlc_data_req (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, const tb_size_t,char*
#ifdef Rel14
tbs_size_t mac_rlc_data_req (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, const tb_size_t,char*
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
);)
);
/*! \fn void mac_rlc_data_ind (const module_id_t mod_idP, const rnti_t rntiP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, uint32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
* \brief Interface with MAC layer, deserialize the transport blocks sent by MAC, then map data indication to the RLC instance corresponding to the radio bearer identifier.
@@ -484,8 +443,8 @@ public_rlc_mac(tbs_size_t mac_rlc_data_req (const module_id_t, co
* \param[in] num_tbP Number of transport blocks.
* \param[in] crcs Array of CRC decoding.
*/
public_rlc_mac(void mac_rlc_data_ind (const module_id_t, const rnti_t, const eNB_index_t,const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, char*, tb_size_t, num_tb_t,
crc_t* );)
void mac_rlc_data_ind (const module_id_t, const rnti_t, const eNB_index_t,const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, char*, tb_size_t, num_tb_t,
crc_t* );
/*! \fn mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t mod_idP, const rnti_t rntiP, const frame_t frameP, const sub_frame_t subframeP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, tb_size_t tb_sizeP)
* \brief Interface with MAC layer, request and set the number of bytes scheduled for transmission by the RLC instance corresponding to the radio bearer identifier.
@@ -499,12 +458,12 @@ public_rlc_mac(void mac_rlc_data_ind (const module_id_t, co
* \param[in] tb_sizeP Size of a transport block set in bytes.
* \return The maximum number of bytes that the RLC instance can send in the next transmission sequence.
*/
public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const sub_frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, tb_size_t
#ifdef Rel14
mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const sub_frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, tb_size_t
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
);)
);
/*! \fn 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)
* \brief Interface with MAC layer, UE only: request and get the number of bytes scheduled for transmission by the RLC instance corresponding to the radio bearer identifier.
@@ -516,7 +475,7 @@ public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t, co
* \param[in] channel_idP Logical Channel identifier.
* \return The maximum number of bytes that the RLC instance can send in the next transmission sequence.
*/
public_rlc_mac(rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const sub_frame_t, const eNB_flag_t, const logical_chan_id_t );)
rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const sub_frame_t, const eNB_flag_t, const logical_chan_id_t );
//-----------------------------------------------------------------------------
// RLC methods
//-----------------------------------------------------------------------------
@@ -527,10 +486,10 @@ public_rlc_mac(rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const mod
* @param dataP Pointer to data buffer to be displayed
* @param sizeP Number of octets in data buffer
*/
public_rlc(void rlc_util_print_hex_octets(
void rlc_util_print_hex_octets(
const comp_name_t componentP,
unsigned char* const dataP,
const signed long sizeP);)
const signed long sizeP);
@@ -546,7 +505,7 @@ public_rlc(void rlc_util_print_hex_octets(
* \param[in] sduP SDU.
* \return A status about the processing, OK or error code.
*/
public_rlc(rlc_op_status_t rlc_data_req (
rlc_op_status_t rlc_data_req (
const protocol_ctxt_t* const,
const srb_flag_t,
const MBMS_flag_t ,
@@ -555,11 +514,11 @@ public_rlc(rlc_op_status_t rlc_data_req (
const confirm_t ,
const sdu_size_t ,
mem_block_t * const
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t * const
,const uint32_t * const
#endif
);)
);
/*! \fn void rlc_data_ind (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, mem_block_t* sduP) {
* \brief Interface with higher layers, route SDUs coming from RLC protocol instances to upper layer instance.
@@ -570,13 +529,13 @@ public_rlc(rlc_op_status_t rlc_data_req (
* \param[in] sdu_sizeP Size of SDU in bytes.
* \param[in] sduP SDU.
*/
public_rlc(void rlc_data_ind(
void rlc_data_ind(
const protocol_ctxt_t* const,
const srb_flag_t,
const MBMS_flag_t ,
const rb_id_t,
const sdu_size_t,
mem_block_t* const);)
mem_block_t* const);
/*! \fn void rlc_data_conf (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP)
@@ -587,12 +546,12 @@ public_rlc(void rlc_data_ind(
* \param[in] muiP Message Unit identifier.
* \param[in] statusP Status of the transmission (RLC_SDU_CONFIRM_YES, RLC_SDU_CONFIRM_NO).
*/
public_rlc(void rlc_data_conf(
void rlc_data_conf(
const protocol_ctxt_t* const,
const srb_flag_t,
const rb_id_t,
const mui_t,
const rlc_tx_status_t );)
const rlc_tx_status_t );
/*! \fn rlc_op_status_t rlc_stat_req (
@@ -662,7 +621,7 @@ public_rlc(void rlc_data_conf(
* \param[out] stat_timer_status_prohibit_timed_out Number of times the timer "status_prohibit" has timed-out.
*/
public_rlc(rlc_op_status_t rlc_stat_req (
rlc_op_status_t rlc_stat_req (
const protocol_ctxt_t* const ctxtP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
@@ -693,12 +652,12 @@ public_rlc(rlc_op_status_t rlc_stat_req (
unsigned int* const stat_rx_control_bytes,
unsigned int* const stat_timer_reordering_timed_out,
unsigned int* const stat_timer_poll_retransmit_timed_out,
unsigned int* const stat_timer_status_prohibit_timed_out);)
unsigned int* const stat_timer_status_prohibit_timed_out);
/*! \fn int rlc_module_init(void)
* \brief RAZ the memory of the RLC layer, initialize the memory pool manager (mem_block_t structures mainly used in RLC module).
*/
public_rlc(int rlc_module_init(void);)
int rlc_module_init(void);
/** @} */
+26 -13
View File
@@ -30,6 +30,7 @@
//-----------------------------------------------------------------------------
#define RLC_MAC_C
#include "rlc.h"
#include "LAYER2/RLC/UM_v9.3.0/rlc_um.h"
#include "LAYER2/MAC/mac_extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/OCG/OCG_vars.h"
@@ -127,7 +128,7 @@ tbs_size_t mac_rlc_data_req(
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
char *buffer_pP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
@@ -157,9 +158,17 @@ tbs_size_t mac_rlc_data_req(
#endif // DEBUG_MAC_INTERFACE
if (MBMS_flagP) {
AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
//AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
if(channel_idP >= RLC_MAX_MBMS_LC){
LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
return 0;
}
} else {
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
//AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
if(channel_idP >= NB_RB_MAX){
LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
return 0;
}
}
if (MBMS_flagP) {
@@ -171,7 +180,7 @@ tbs_size_t mac_rlc_data_req(
}
} else {
key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if ((sourceL2Id > 0) && (destinationL2Id > 0))
key = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag);
#endif
@@ -183,7 +192,8 @@ tbs_size_t mac_rlc_data_req(
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
//AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
LOG_E(RLC, "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
}
switch (rlc_mode) {
@@ -192,6 +202,7 @@ tbs_size_t mac_rlc_data_req(
break;
case RLC_MODE_AM:
rlc_am_mui.rrc_mui_num = 0;
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,enb_flagP);
ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
@@ -224,7 +235,7 @@ tbs_size_t mac_rlc_data_req(
void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const module_id_t eNB_index,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
@@ -289,6 +300,7 @@ void mac_rlc_data_ind (
switch (rlc_mode) {
case RLC_MODE_NONE:
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
list_free (&data_ind.data);
break;
case RLC_MODE_AM:
@@ -318,7 +330,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
@@ -351,25 +363,22 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else {
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if ((sourceL2Id > 0) && (destinationL2Id > 0)) {
key = RLC_COLL_KEY_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag);
} else
#endif
{
//LOG_I(RLC, "Panos-D mac_rlc_status_ind 1 enb_flagP: %d, channel_idP: %d, srb_flag: %d \n", enb_flagP, channel_idP, srb_flag);
key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
}
}
//LOG_I(RLC, "Panos-D mac_rlc_status_ind 2 enb_flagP: %d, channel_idP: %d, srb_flag: %d \n", enb_flagP, channel_idP, srb_flag);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
//LOG_D(RLC , "Panos-D: mac_rlc_status_ind() In RLC_MODE_NONE \n");
//LOG_W(RLC , "[%s] RLC not configured lcid %u module %u!\n", __FUNCTION__, channel_idP, module_idP);
//LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
}
@@ -441,8 +450,12 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
/* Assumptions : for UE only */
/* At each TTI, Buffer Occupancy is first computed in mac_rlc_status_ind called by MAC ue_scheduler() function */
/* Then this function is called during MAC multiplexing ue_get_sdu(), and it may be call several times for the same bearer if it is in AM mode and there are several PDU types to transmit */
AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP);
//AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP);
if(enb_flagP != FALSE){
LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP);
return 0;
}
key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
+1 -1
View File
@@ -41,7 +41,7 @@ rlc_op_status_t mpls_rlc_data_req (
//-----------------------------------------------------------------------------
// third arg should be set to 1 or 0
return rlc_data_req(ctxtP, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
+50 -26
View File
@@ -107,7 +107,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_am:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -127,7 +127,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Bi_Directional:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -141,7 +141,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC,
rb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -155,7 +155,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Uni_Directional_UL:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -169,7 +169,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
rb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -183,7 +183,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Uni_Directional_DL:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -197,7 +197,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
NULL,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC,
rb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -230,7 +230,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
config_am_pP->ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t4;
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -299,7 +299,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_am:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -315,7 +315,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Bi_Directional:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,sourceL2Id,
destinationL2Id
#endif
@@ -329,7 +329,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC,
drb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,sourceL2Id,
destinationL2Id
#endif
@@ -340,7 +340,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Uni_Directional_UL:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -354,7 +354,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
drb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -364,7 +364,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case RLC_Config_PR_um_Uni_Directional_DL:
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -378,7 +378,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
NULL,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC,
drb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -444,7 +444,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
rb_id,
lc_id,
RLC_MODE_UM, 0, 0);
AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED");
//AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED");
if(rlc_union_p == NULL){
LOG_E(RLC, "ADD MBMS RLC UM FAILED\n");
}
}
LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n",
@@ -466,7 +469,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
NULL,
&dl_um_rlc,
rb_id, lc_id
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
#endif
);
@@ -586,7 +589,11 @@ rlc_op_status_t rrc_rlc_remove_rlc (
}
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -647,7 +654,7 @@ rlc_union_t* rrc_rlc_add_rlc (
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP,
const rlc_mode_t rlc_modeP
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id,
const uint32_t destinationL2Id
#endif
@@ -667,8 +674,17 @@ rlc_union_t* rrc_rlc_add_rlc (
if (MBMS_flagP == FALSE) {
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
//AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return NULL;
}
if(chan_idP >= RLC_MAX_LC){
LOG_E(RLC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
return NULL;
}
}
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
@@ -709,8 +725,12 @@ rlc_union_t* rrc_rlc_add_rlc (
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ");
return rlc_union_p;
//AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ");
if(rlc_union_p->mode != rlc_modeP){
LOG_E(RLC, "Error rrc_rlc_add_rlc , already exist but RLC mode differ\n");
return NULL;
}
return rlc_union_p;
} else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
rlc_union_p = calloc(1, sizeof(rlc_union_t));
h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p);
@@ -772,13 +792,17 @@ rlc_op_status_t rrc_rlc_config_req (
PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_idP);
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
switch (actionP) {
case CONFIG_ACTION_ADD:
if (rrc_rlc_add_rlc(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0,
0
#endif
@@ -857,7 +881,7 @@ rlc_op_status_t rrc_rlc_data_req (
if (sdu != NULL) {
memcpy (sdu->data, sduP, sdu_sizeP);
return rlc_data_req(ctxt_pP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
);
+1 -1
View File
@@ -248,7 +248,7 @@ ue_ip_common_ip2wireless(
//---------------------------------------------------------------------------
struct pdcp_data_req_header_s pdcph;
ue_ip_priv_t *priv_p=netdev_priv(ue_ip_dev[instP]);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
ipversion_t *ipv_p = NULL;
unsigned int hard_header_len = 0;
unsigned char *src_addr = 0;
+25 -6
View File
@@ -99,15 +99,29 @@ void *ue_ip_interrupt(void)
}
#endif //NETLINK
//---------------------------------------------------------------------------
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
void ue_ip_timer(struct timer_list *t)
#else
void ue_ip_timer(unsigned long dataP)
#endif
{
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p=(ue_ip_priv_t *)dataP;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
ue_ip_priv_t *priv_p = from_timer(priv_p, t, timer);
#else
ue_ip_priv_t *priv_p = (ue_ip_priv_t *)dataP;
#endif
spin_lock(&priv_p->lock);
(priv_p->timer).function=ue_ip_timer;
(priv_p->timer).expires=jiffies+UE_IP_TIMER_TICK;
(priv_p->timer).data=dataP;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
mod_timer(&priv_p->timer, jiffies + UE_IP_TIMER_TICK);
#else
(priv_p->timer).function = ue_ip_timer;
(priv_p->timer).expires = jiffies + UE_IP_TIMER_TICK;
(priv_p->timer).data = dataP;
add_timer(&priv_p->timer);
#endif
spin_unlock(&priv_p->lock);
return;
// add_timer(&gpriv->timer);
@@ -137,10 +151,15 @@ int ue_ip_open(struct net_device *dev_pP)
netif_wake_queue(dev_pP);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
timer_setup(&(priv_p->timer), ue_ip_timer, 0);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
#else
init_timer(&priv_p->timer);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
(priv_p->timer).data = (unsigned long)priv_p;
(priv_p->timer).function = ue_ip_timer;
#endif
//add_timer(&priv_p->timer);
printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev_pP->name);
@@ -236,7 +255,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
// End debug information
netif_stop_queue(dev_pP);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update(dev_pP);
#else
dev_pP->trans_start = jiffies;
@@ -312,7 +331,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
(priv_p->stats).tx_errors++;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update(dev_pP);
#else
dev_pP->trans_start = jiffies;
+3 -2
View File
@@ -57,6 +57,7 @@
#include "platform_types.h"
#include "sap.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
typedef struct ue_ip_priv_s {
int irq;
@@ -89,7 +90,7 @@ typedef struct pdcp_data_req_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t traffic_type;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
@@ -100,7 +101,7 @@ typedef struct pdcp_data_ind_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t dummy_traffic_type;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
+12 -24
View File
@@ -17,7 +17,7 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint8_t nfapi_mode;
extern uint16_t sf_ahead;
uint16_t frame_cnt=0;
void handle_rach(UL_IND_t *UL_info) {
int i;
@@ -237,24 +237,6 @@ void handle_ulsch(UL_IND_t *UL_info) {
#define C do { size = 0; put(0); } while (0)
#define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0)
#if 0
/* eats lots of ms at startup, disrupts realtime */
static char *s;
static int size;
static int maxsize;
static void put(char x)
{
if (size == maxsize) {
maxsize += 32768;
s = realloc(s, maxsize); if (s == NULL) abort();
}
s[size++] = x;
}
#else
/* eats nothing at startup, but fixed size */
#define SMAX 65536
static char s[SMAX];
@@ -267,8 +249,6 @@ static void put(char x)
s[size++] = x;
}
#endif
static void append_string(char *t)
{
size--;
@@ -546,6 +526,10 @@ void UL_indication(UL_IND_t *UL_info)
UL_info->frame,UL_info->subframe,
module_id,CC_id,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
if(UL_info->frame==1023&&UL_info->subframe==6){ // dl scheduling (0,0)
frame_cnt= (frame_cnt + 1)%7; // to prevent frame_cnt get too big
LOG_D(MAC,"current (%d,%d) frame count dl is %d\n",UL_info->frame,UL_info->subframe,frame_cnt);
}
if (nfapi_mode != 1)
{
@@ -574,7 +558,11 @@ void UL_indication(UL_IND_t *UL_info)
handle_harq(UL_info);
// clear HI prior to handling ULSCH
mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi = 0;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_id] , UL_info->subframe);
if(sf_ahead_dl!=255){
mac->HI_DCI0_req[CC_id][(UL_info->subframe+sf_ahead_dl)%10].hi_dci0_request_body.number_of_hi = 0;
LOG_D(MAC,"current (%d,%d) clear HI_DCI0_req[0][%d]\n",UL_info->frame,UL_info->subframe,(UL_info->subframe+sf_ahead_dl)%10);
}
handle_ulsch(UL_info);
@@ -593,9 +581,9 @@ void UL_indication(UL_IND_t *UL_info)
sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024;
sched_info->subframe = (UL_info->subframe+sf_ahead)%10;
sched_info->DL_req = &mac->DL_req[CC_id];
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id];
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id][sched_info->subframe];
if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0))
(is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe)>0))
sched_info->UL_req = &mac->UL_req[CC_id];
else
sched_info->UL_req = NULL;
+2 -2
View File
@@ -192,14 +192,14 @@ typedef struct{
}UE_MAC_BCH_indication_body_t;
// Panos: Corresponding to inputs of MAC functions: ue_send_sdu(), ue_decode_si(), ue_decode_p().
// Corresponding to inputs of MAC functions: ue_send_sdu(), ue_decode_si(), ue_decode_p().
typedef struct{
uint8_t* data;
uint16_t data_len;
}UE_MAC_dlsch_pdu;
// Panos: Corresponding to inputs of MAC function: process_rar().
// Corresponding to inputs of MAC function: process_rar().
typedef struct{
rnti_t ra_rnti;
uint8_t* rar_input_buffer; // Originating from PHY
+22 -35
View File
@@ -68,7 +68,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
pdu->data = ulsch_buffer;
// estimate timing advance for MAC
//sync_pos = lte_est_timing_advance_pusch(eNB,UE_id);
timing_advance_update = 0; //Panos: Don't know what to put here
timing_advance_update = 0; // Don't know what to put here
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
int SNRtimes10 = 640;
@@ -105,10 +105,10 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti; //UE_mac_inst[Mod_id].crnti;; //Panos: Is this the right RNTI?
pdu->rx_ue_information.rnti = rnti; //UE_mac_inst[Mod_id].crnti
// Panos dependency from PHY not sure how to substitute this. Should we hardcode it?
// dependency from PHY not sure how to substitute this. Should we hardcode it?
//int SNRtimes10 = dB_fixed_times10(stat) - 200;//(10*eNB->measurements.n0_power_dB[0]);
int SNRtimes10 = 640;
@@ -130,7 +130,7 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_
pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
//Panos: REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE!
// REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE!
nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs];
UL_INFO->crc_ind.sfn_sf = frame<<4| subframe;
@@ -172,9 +172,9 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
UL_INFO->rach_ind.rach_indication_body.preamble_list = (nfapi_preamble_pdu_t*)malloc(UL_INFO->rach_ind.rach_indication_body.number_of_preambles*sizeof(nfapi_preamble_pdu_t));
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance = 0; //Panos: Not sure about that
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance = 0; // Not sure about that
//Panos: The two following should get extracted from the call to get_prach_resources().
//The two following should get extracted from the call to get_prach_resources().
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble = ra_PreambleIndex;
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti = ra_RNTI;
//UL_INFO->rach_ind.rach_indication_body.number_of_preambles++;
@@ -191,7 +191,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti,
UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel13.rach_resource_type);
//Panos: This function is currently defined only in the nfapi-RU-RAU-split so we should call it when we merge
// This function is currently defined only in the nfapi-RU-RAU-split so we should call it when we merge
// with that branch.
oai_nfapi_rach_ind(&UL_INFO->rach_ind);
free(UL_INFO->rach_ind.rach_indication_body.preamble_list);
@@ -210,12 +210,12 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti;
//Panos: Since we assume that CRC flag is always 0 (ACK) I guess that data_offset should always be 0.
// Since we assume that CRC flag is always 0 (ACK) I guess that data_offset should always be 0.
pdu->cqi_indication_rel9.data_offset = 0;
// by default set O to rank 1 value
//pdu->cqi_indication_rel9.length = (ulsch_harq->Or1>>3) + ((ulsch_harq->Or1&7) > 0 ? 1 : 0);
// Panos: Not useful field for our case
// Not useful field for our case
pdu->cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG;
pdu->cqi_indication_rel9.length = 0;
pdu->cqi_indication_rel9.ri[0] = 0;
@@ -225,7 +225,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
pdu->cqi_indication_rel9.number_of_cc_reported = 1;
pdu->ul_cqi_information.channel = 1; // PUSCH
//Panos: Not sure how to substitute this. This should be the actual CQI value? So can
// Not sure how to substitute this. This should be the actual CQI value? So can
// we hardcode it to a specific value?
//memcpy((void*)raw_pdu->pdu,ulsch_harq->o,pdu->cqi_indication_rel9.length);
raw_pdu->pdu[0] = 7;
@@ -255,18 +255,18 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti;
//Panos: For now we consider only FDD
// For now we consider only FDD
//if (eNB->frame_parms.frame_type == FDD) {
pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
pdu->harq_indication_fdd_rel13.mode = 0;
pdu->harq_indication_fdd_rel13.number_of_ack_nack = harq_information->harq_information_rel10.harq_size;
//Panos: Could this be wrong? Is the number_of_ack_nack field equivalent to O_ACK?
// Could this be wrong? Is the number_of_ack_nack field equivalent to O_ACK?
//pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
for (i=0;i<harq_information->harq_information_rel10.harq_size;i++) {
pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 1; //Panos: Assuming always an ACK (No NACK or DTX)
pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 1; // Assuming always an ACK (No NACK or DTX)
}
@@ -319,7 +319,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->harq_indication_fdd_rel13.number_of_ack_nack = 1;
//AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; //Panos: Assuming always an ACK (No NACK or DTX)
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; // Assuming always an ACK (No NACK or DTX)
}
@@ -328,8 +328,8 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
pdu->harq_indication_fdd_rel13.mode = 0;
pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2;
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; //Panos: Assuming always an ACK (No NACK or DTX)
pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; //Panos: Assuming always an ACK (No NACK or DTX)
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; // Assuming always an ACK (No NACK or DTX)
pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX)
}
else AssertFatal(1==0,"only format 1a/b for now, received \n");
@@ -362,15 +362,14 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti);
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index);
Msg3_transmitted(Mod_id, 0, frame, 0);
// Panos: Modification
// Modification
UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
// Panos: This should be done after the reception of the respective hi_dci0
// This should be done after the reception of the respective hi_dci0
//UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
}
else {
//LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 2.3 \n");
ue_get_sdu( Mod_id, 0, frame, subframe, 0, ulsch_buffer, buflen, &access_mode);
fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti);
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, ulsch_buffer,buflen, rnti, index);
@@ -393,12 +392,11 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index);
Msg3_transmitted(Mod_id, 0, frame, 0);
//UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
// Panos: Modification
// Modification
UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
}
else {
//LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 3.1 \n");
ue_get_sdu( Mod_id, 0, frame, subframe, 0, ulsch_buffer, buflen, &access_mode);
fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti);
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, ulsch_buffer,buflen, rnti, index);
@@ -421,7 +419,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index);
Msg3_transmitted(Mod_id, 0, frame, 0);
//UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
// Panos: Modification
// Modification
UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
}
@@ -448,7 +446,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index);
Msg3_transmitted(Mod_id, 0, frame, 0);
//UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
// Panos: Modification
// Modification
UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
}
@@ -788,13 +786,9 @@ int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req, module_id_t Mod_id)
int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req)
{
//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t));
//LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1, Mod_id:%d \n", Mod_id);
//UE_mac_inst[Mod_id].dl_config_req->header = req->header;
dl_config_req->sfn_sf = req->sfn_sf;
@@ -822,10 +816,6 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
{
//LOG_D(MAC, "Panos-D: memcpy_ul_config_req 1 \n");
//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
@@ -857,8 +847,6 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
{
//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
tx_req_num_elems = req->tx_request_body.number_of_pdus;
tx_request_pdu_list = (nfapi_tx_request_pdu_t*) calloc(tx_req_num_elems, sizeof(nfapi_tx_request_pdu_t));
@@ -884,7 +872,6 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
{
//if(req!=0){
//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
hi_dci0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
@@ -929,7 +916,7 @@ void UE_config_stub_pnf(void) {
if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
sf_ahead = 4; // Need 4 subframe gap between RX and TX
}
// Panos: Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst.
// Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst.
// Later I think we have to change that to attribute eth_params to a global element for all the UEs.
else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
stub_eth_params.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
+2 -2
View File
@@ -21,7 +21,7 @@ UL_IND_t *UL_INFO;
nfapi_tx_request_pdu_t* tx_request_pdu_list;
// New
/// Panos: Pointers to config_request types. Used from nfapi callback functions.
/// Pointers to config_request types. Used from nfapi callback functions.
nfapi_dl_config_request_t* dl_config_req;
nfapi_ul_config_request_t* ul_config_req;
nfapi_hi_dci0_request_t* hi_dci0_req;
@@ -35,7 +35,7 @@ eth_params_t stub_eth_params;
// Panos: This function should return all the sched_response config messages which concern a specific UE. Inside this
// This function should return all the sched_response config messages which concern a specific UE. Inside this
// function we should somehow make the translation of config message's rnti to Mod_ID.
Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id);
@@ -38,7 +38,7 @@
#ifdef CELLULAR
#include "rrc_L2_proto.h"
#else
#include "RRC/LITE/defs.h"
#include "RRC/LTE/defs.h"
#endif //CELLULAR
#include "COMMON/mac_rrc_primitives.h"
#include "openair_rrc_L2_interface.h"
+13 -145
View File
@@ -96,30 +96,6 @@ mac_rrc_data_req(
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib1_size > sdu_size) {
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
@@ -137,30 +113,6 @@ mac_rrc_data_req(
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib23_size > sdu_size) {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
sib23_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
@@ -179,6 +131,7 @@ mac_rrc_data_req(
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
NULL,
(void*)mib,
carrier->MIB,
24);
@@ -205,28 +158,6 @@ mac_rrc_data_req(
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
@@ -243,28 +174,6 @@ mac_rrc_data_req(
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
@@ -280,32 +189,6 @@ mac_rrc_data_req(
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
@@ -376,42 +259,27 @@ mac_rrc_data_ind(
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_lenP > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = sdu_lenP;
}
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
}
#else
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}
#endif
}
if((srb_idP & RAB_OFFSET) == DCCH) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP);
if(ue_context_p){
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,
ue_context_p,
0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
}
}
return(0);

Some files were not shown because too many files have changed in this diff Show More