Merge branch 'develop' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop
This commit is contained in:
@@ -298,6 +298,12 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
|
||||
int UE_id = find_UE_id(mod_idP,rntiP);
|
||||
int pCC_id = UE_PCCID(mod_idP,UE_id);
|
||||
|
||||
if (UE_id == -1) {
|
||||
LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n", rntiP);
|
||||
mac_phy_remove_ue(mod_idP,rntiP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",UE_id,pCC_id, rntiP);
|
||||
dump_ue_list(UE_list,0);
|
||||
|
||||
@@ -320,7 +326,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
|
||||
for (i=UE_list->head; i>=0; i=UE_list->next[i]) {
|
||||
if (i == UE_id) {
|
||||
// link prev to next in Active list
|
||||
//if (prev==UE_list->head)
|
||||
if (i==UE_list->head) {
|
||||
UE_list->head = UE_list->next[i];
|
||||
} else {
|
||||
@@ -345,7 +350,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
|
||||
for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
|
||||
if (i == UE_id) {
|
||||
// link prev to next in Active list
|
||||
if (prev==UE_list->head_ul) {
|
||||
if (i==UE_list->head_ul) {
|
||||
UE_list->head_ul = UE_list->next_ul[i];
|
||||
} else {
|
||||
UE_list->next_ul[prev] = UE_list->next_ul[i];
|
||||
|
||||
@@ -130,6 +130,8 @@ void rx_sdu(
|
||||
|
||||
T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
|
||||
T_INT(harq_pidP), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu));
|
||||
T(T_ENB_MAC_UE_UL_PDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
|
||||
T_INT(harq_pidP), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu), T_BUFFER(sduP, sdu_lenP));
|
||||
|
||||
eNB->eNB_stats[CC_idP].ulsch_bytes_rx=sdu_lenP;
|
||||
eNB->eNB_stats[CC_idP].total_ulsch_bytes_rx+=sdu_lenP;
|
||||
@@ -313,6 +315,8 @@ void rx_sdu(
|
||||
|
||||
T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
|
||||
T_INT(rx_lcids[i]), T_INT(rx_lengths[i]));
|
||||
T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
|
||||
T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, rx_lengths[i]));
|
||||
|
||||
switch (rx_lcids[i]) {
|
||||
case CCCH :
|
||||
|
||||
@@ -103,7 +103,7 @@ rlc_am_get_buffer_occupancy_in_bytes (
|
||||
}
|
||||
|
||||
#endif
|
||||
return rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead;
|
||||
return rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
|
||||
@@ -719,12 +719,12 @@ mac_eNB_get_rrc_status(
|
||||
}
|
||||
}
|
||||
|
||||
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
|
||||
const int CC_idP,
|
||||
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP) {
|
||||
|
||||
const rnti_t rntiP)
|
||||
{
|
||||
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
|
||||
ue_context_p = rrc_eNB_get_ue_context(
|
||||
&eNB_rrc_inst[Mod_instP],
|
||||
@@ -735,34 +735,30 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
|
||||
ue_context_p->ue_context.ul_failure_timer=1;
|
||||
}
|
||||
else {
|
||||
LOG_W(RRC,"Frame %d, Subframe %d: UE %x unknown \n",frameP,subframeP,rntiP);
|
||||
rrc_mac_remove_ue(Mod_instP,rntiP);
|
||||
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
|
||||
}
|
||||
|
||||
rrc_mac_remove_ue(Mod_instP,rntiP);
|
||||
}
|
||||
|
||||
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP) {
|
||||
|
||||
const rnti_t rntiP)
|
||||
{
|
||||
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
|
||||
ue_context_p = rrc_eNB_get_ue_context(
|
||||
&eNB_rrc_inst[Mod_instP],
|
||||
rntiP);
|
||||
|
||||
|
||||
|
||||
if (ue_context_p != NULL) {
|
||||
LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n",rntiP);
|
||||
ue_context_p->ue_context.ul_failure_timer=0;
|
||||
LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n",
|
||||
frameP, subframeP, rntiP);
|
||||
ue_context_p->ue_context.ul_failure_timer = 0;
|
||||
} else {
|
||||
LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",
|
||||
frameP, subframeP, rntiP);
|
||||
}
|
||||
else {
|
||||
LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",rntiP);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
|
||||
@@ -3795,14 +3795,29 @@ rrc_eNB_decode_ccch(
|
||||
//#warning "TODO: stmsi_exist: remove UE from MAC/PHY (how?)"
|
||||
LOG_I(RRC," S-TMSI exists, ue_context_p %p\n",ue_context_p);
|
||||
stmsi_received=1;
|
||||
/* replace rnti in the context */
|
||||
/* for that, remove the context from the RB tree */
|
||||
RB_REMOVE(rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head, ue_context_p);
|
||||
/* and insert again, after changing rnti everywhere it has to be changed */
|
||||
ue_context_p->ue_id_rnti = ctxt_pP->rnti;
|
||||
ue_context_p->ue_context.rnti = ctxt_pP->rnti;
|
||||
RB_INSERT(rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head, ue_context_p);
|
||||
/* reset timers */
|
||||
ue_context_p->ue_context.ul_failure_timer = 0;
|
||||
ue_context_p->ue_context.ue_release_timer = 0;
|
||||
// AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)");
|
||||
// ue_context_p = NULL;
|
||||
} else {
|
||||
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE;
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code;
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi;
|
||||
if (ue_context_p == NULL)
|
||||
LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
if (ue_context_p != NULL) {
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE;
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code;
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
|
||||
@@ -377,6 +377,8 @@ extern int ouput_vcd;
|
||||
|
||||
#if T_TRACER
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#define VCD_SIGNAL_DUMPER_INIT(x) /* nothing */
|
||||
#define VCD_SIGNAL_DUMPER_CLOSE() /* nothing */
|
||||
#define VCD_SIGNAL_DUMPER_CREATE_HEADER() /* nothing */
|
||||
|
||||
+52
-89
@@ -137,27 +137,15 @@ typedef guint8 gboolean;
|
||||
|
||||
//static unsigned char g_PDUBuffer[1600];
|
||||
//static unsigned int g_PDUOffset;
|
||||
#ifdef JUMBO_FRAME
|
||||
static unsigned char g_frameBuffer[9000];
|
||||
#else
|
||||
static unsigned char g_frameBuffer[1600];
|
||||
#endif
|
||||
//static unsigned char g_fileBuffer[1600];
|
||||
static unsigned int g_frameOffset;
|
||||
|
||||
|
||||
char in_ip[40];
|
||||
char in_path[100];
|
||||
static uint16_t in_port;
|
||||
FILE *file_fd = NULL;
|
||||
|
||||
trace_mode_t opt_type = OPT_NONE;
|
||||
static radio_type_t radio_type;
|
||||
static unsigned int subframesSinceCaptureStart;
|
||||
// double timing_perf[250];
|
||||
// clock_t timing_in[250];
|
||||
// clock_t timing_out[250];
|
||||
int test=0;
|
||||
int init_value=0;
|
||||
|
||||
static int g_socksd = -1;/* UDP socket used for sending frames */
|
||||
static struct sockaddr_in g_serv_addr;
|
||||
@@ -277,66 +265,73 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
guint8 oob_event, guint8 oob_event_value,
|
||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size)
|
||||
{
|
||||
#ifdef JUMBO_FRAME
|
||||
static unsigned char frameBuffer[9000];
|
||||
#else
|
||||
static unsigned char frameBuffer[1600];
|
||||
#endif
|
||||
static unsigned int frameOffset;
|
||||
|
||||
ssize_t bytesSent;
|
||||
g_frameOffset = 0;
|
||||
frameOffset = 0;
|
||||
uint16_t tmp16;
|
||||
|
||||
/********************************************************************/
|
||||
/* Fixed start to each frame (allowing heuristic dissector to work) */
|
||||
/* Not NULL terminated */
|
||||
memset(g_frameBuffer+g_frameOffset, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
||||
memset(frameBuffer+frameOffset, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
||||
|
||||
memcpy(g_frameBuffer+g_frameOffset, MAC_LTE_START_STRING,
|
||||
memcpy(frameBuffer+frameOffset, MAC_LTE_START_STRING,
|
||||
strlen(MAC_LTE_START_STRING));
|
||||
g_frameOffset += strlen(MAC_LTE_START_STRING);
|
||||
frameOffset += strlen(MAC_LTE_START_STRING);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
|
||||
g_frameBuffer[g_frameOffset++] = radioType;
|
||||
g_frameBuffer[g_frameOffset++] = direction;
|
||||
g_frameBuffer[g_frameOffset++] = rntiType;
|
||||
frameBuffer[frameOffset++] = radioType;
|
||||
frameBuffer[frameOffset++] = direction;
|
||||
frameBuffer[frameOffset++] = rntiType;
|
||||
|
||||
/*************************************/
|
||||
/* Now optional fields */
|
||||
|
||||
/* RNTI */
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_RNTI_TAG;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_RNTI_TAG;
|
||||
tmp16 = htons(rnti);
|
||||
memcpy(g_frameBuffer+g_frameOffset, &tmp16, 2);
|
||||
g_frameOffset += 2;
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
|
||||
/* UEId */
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_UEID_TAG;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_UEID_TAG;
|
||||
tmp16 = htons(ueid);
|
||||
memcpy(g_frameBuffer+g_frameOffset, &tmp16, 2);
|
||||
g_frameOffset += 2;
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
|
||||
/* Subframe number */
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_SUBFRAME_TAG;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_SUBFRAME_TAG;
|
||||
tmp16 = htons(subframeNumber); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||
memcpy(g_frameBuffer+g_frameOffset, &tmp16, 2);
|
||||
g_frameOffset += 2;
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||
g_frameBuffer[g_frameOffset++] = crcStatus;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||
frameBuffer[frameOffset++] = crcStatus;
|
||||
|
||||
#ifdef WIRESHARK_DEV
|
||||
g_frameOffset += 2;
|
||||
frameOffset += 2;
|
||||
tmp16 = htons(subframeNumber); // subframe
|
||||
memcpy(g_frameBuffer+g_frameOffset, &tmp16, 2);
|
||||
g_frameOffset += 2;
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
#endif
|
||||
|
||||
/***********************************************************/
|
||||
/* For these optional fields, no need to encode if value is default */
|
||||
if (!isPredefinedData) {
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_PREDEFINED_DATA_TAG;
|
||||
g_frameBuffer[g_frameOffset++] = isPredefinedData;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_PREDEFINED_DATA_TAG;
|
||||
frameBuffer[frameOffset++] = isPredefinedData;
|
||||
}
|
||||
|
||||
if (retx != 0) {
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_RETX_TAG;
|
||||
g_frameBuffer[g_frameOffset++] = retx;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_RETX_TAG;
|
||||
frameBuffer[frameOffset++] = retx;
|
||||
}
|
||||
|
||||
#ifdef WIRESHARK_DEV
|
||||
@@ -347,19 +342,19 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
switch (oob_event) {
|
||||
case ltemac_send_preamble :
|
||||
LOG_D(OPT,"oob event %d %d\n",ltemac_send_preamble );
|
||||
//g_frameBuffer[g_frameOffset++]=0;
|
||||
//g_frameBuffer[g_frameOffset++]=0;
|
||||
//g_frameBuffer[g_frameOffset++]=0;
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_OOB_EVENT_TAG;
|
||||
g_frameBuffer[g_frameOffset++]=ltemac_send_preamble;
|
||||
g_frameBuffer[g_frameOffset++]=rnti; // is the preamble
|
||||
g_frameBuffer[g_frameOffset++]=oob_event_value;
|
||||
//frameBuffer[frameOffset++]=0;
|
||||
//frameBuffer[frameOffset++]=0;
|
||||
//frameBuffer[frameOffset++]=0;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_OOB_EVENT_TAG;
|
||||
frameBuffer[frameOffset++]=ltemac_send_preamble;
|
||||
frameBuffer[frameOffset++]=rnti; // is the preamble
|
||||
frameBuffer[frameOffset++]=oob_event_value;
|
||||
break;
|
||||
|
||||
case ltemac_send_sr:
|
||||
g_frameBuffer[g_frameOffset++]=ltemac_send_sr;
|
||||
g_frameOffset+=2;
|
||||
g_frameBuffer[g_frameOffset++]=oob_event_value;
|
||||
frameBuffer[frameOffset++]=ltemac_send_sr;
|
||||
frameOffset+=2;
|
||||
frameBuffer[frameOffset++]=oob_event_value;
|
||||
break;
|
||||
|
||||
case ltemac_sr_failure:
|
||||
@@ -372,23 +367,23 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
#endif
|
||||
/***************************************/
|
||||
/* Now write the MAC PDU */
|
||||
g_frameBuffer[g_frameOffset++] = MAC_LTE_PAYLOAD_TAG;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG;
|
||||
|
||||
/* Append actual PDU */
|
||||
//memcpy(g_frameBuffer+g_frameOffset, g_PDUBuffer, g_PDUOffset);
|
||||
//g_frameOffset += g_PDUOffset;
|
||||
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
|
||||
//frameOffset += g_PDUOffset;
|
||||
if (pdu_buffer != NULL) {
|
||||
memcpy(g_frameBuffer+g_frameOffset, (void*)pdu_buffer, pdu_buffer_size);
|
||||
g_frameOffset += pdu_buffer_size;
|
||||
memcpy(frameBuffer+frameOffset, (void*)pdu_buffer, pdu_buffer_size);
|
||||
frameOffset += pdu_buffer_size;
|
||||
}
|
||||
|
||||
/* Send out the data over the UDP socket */
|
||||
bytesSent = sendto(g_socksd, g_frameBuffer, g_frameOffset, 0,
|
||||
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
|
||||
(const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
|
||||
|
||||
if (bytesSent != g_frameOffset) {
|
||||
if (bytesSent != frameOffset) {
|
||||
LOG_W(OPT, "sendto() failed (not a thread-safe func)- expected %d bytes, got %d (errno=%d)\n",
|
||||
g_frameOffset, bytesSent, errno);
|
||||
frameOffset, bytesSent, errno);
|
||||
//exit(1);
|
||||
}
|
||||
}
|
||||
@@ -509,6 +504,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
/*---------------------------------------------------*/
|
||||
int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p)
|
||||
{
|
||||
uint16_t in_port;
|
||||
subframesSinceCaptureStart = 0;
|
||||
|
||||
if (path != NULL) {
|
||||
@@ -612,37 +608,4 @@ void terminate_opt(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
double *timing_analyzer(int index, int direction ){
|
||||
//
|
||||
int i;
|
||||
if (direction==0)// in
|
||||
{
|
||||
timing_in[index]=clock();
|
||||
//if(timing_out[index+100]>timing_in[index+100]);
|
||||
//timing_perf[index+100] +=(double)((double)(timing_out[index+100]-timing_in[index+100])/(double)CLOCKS_PER_SEC);
|
||||
}
|
||||
else
|
||||
{
|
||||
timing_out[index]=clock();
|
||||
if(index==5)timing_perf[index]=0;
|
||||
timing_perf[index] +=(double)((double)(timing_out[index]-timing_in[index])/(((double)CLOCKS_PER_SEC)/1000000));
|
||||
|
||||
//LOG_I(OPT,"timing_analyser index %d =%f\n",index,timing_perf[index]);
|
||||
init_value++;
|
||||
if(init_value==500)
|
||||
{
|
||||
for(i=0;i<6;i++)
|
||||
{
|
||||
LOG_I(OPT,"timing_analyser index %d =%f\n",i,timing_perf[i]);
|
||||
}
|
||||
init_value=0;
|
||||
}
|
||||
|
||||
return(&timing_perf[0]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user