Commit e46031fe authored by Cedric Roux's avatar Cedric Roux

Merge remote-tracking branch 'origin/T-tracer-macpdu2wireshark_w43' into...

Merge remote-tracking branch 'origin/T-tracer-macpdu2wireshark_w43' into develop_integration_2018_w44
parents e4b0b3a7 bbacffa7
...@@ -75,8 +75,12 @@ ID = ENB_PHY_MSG3_ALLOCATION ...@@ -75,8 +75,12 @@ ID = ENB_PHY_MSG3_ALLOCATION
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
ID = ENB_PHY_INITIATE_RA_PROCEDURE ID = ENB_PHY_INITIATE_RA_PROCEDURE
DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles
GROUP = ALL:PHY:ENB GROUP = ALL:PHY:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay
ID = ENB_PHY_MIB
DESC = MIB data
GROUP = ALL:PHY:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,frame : int,subframe : buffer,data
#MAC logs #MAC logs
ID = ENB_MAC_UE_DL_SDU ID = ENB_MAC_UE_DL_SDU
...@@ -97,7 +101,7 @@ ID = ENB_MAC_UE_UL_PDU ...@@ -97,7 +101,7 @@ ID = ENB_MAC_UE_UL_PDU
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu
ID = ENB_MAC_UE_UL_PDU_WITH_DATA ID = ENB_MAC_UE_UL_PDU_WITH_DATA
DESC = MAC uplink UE received PDU DESC = MAC uplink UE received PDU
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data
ID = ENB_MAC_UE_UL_SDU ID = ENB_MAC_UE_UL_SDU
DESC = MAC uplink UE received SDU DESC = MAC uplink UE received SDU
...@@ -113,12 +117,16 @@ ID = ENB_MAC_UE_UL_CE ...@@ -113,12 +117,16 @@ ID = ENB_MAC_UE_UL_CE
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce
ID = ENB_MAC_UE_DL_PDU_WITH_DATA ID = ENB_MAC_UE_DL_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE DESC = MAC downlink PDU for an UE
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = ENB_MAC_SCHEDULING_REQUEST ID = ENB_MAC_SCHEDULING_REQUEST
DESC = MAC scheduling request detected for an UE DESC = MAC scheduling request detected for an UE
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB
FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti
ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE
GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
#RLC logs #RLC logs
ID = ENB_RLC_DL ID = ENB_RLC_DL
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
#define DEFAULT_IP "127.0.0.1" #define DEFAULT_IP "127.0.0.1"
#define DEFAULT_PORT 9999 #define DEFAULT_PORT 9999
#define NO_PREAMBLE -1
int no_sib = 0;
int no_mib = 0;
typedef struct { typedef struct {
int socket; int socket;
struct sockaddr_in to; struct sockaddr_in to;
...@@ -28,11 +33,24 @@ typedef struct { ...@@ -28,11 +33,24 @@ typedef struct {
int dl_frame; int dl_frame;
int dl_subframe; int dl_subframe;
int dl_data; int dl_data;
/* mib */
int mib_frame;
int mib_subframe;
int mib_data;
/* RA preamble */
int preamble_frame;
int preamble_subframe;
int preamble_preamble;
/* RAR */
int rar_rnti;
int rar_frame;
int rar_subframe;
int rar_data;
} ev_data; } ev_data;
void ul(void *_d, event e) void trace(ev_data *d, int direction, int rnti_type, int rnti,
int frame, int subframe, void *buf, int bufsize, int preamble)
{ {
ev_data *d = _d;
ssize_t ret; ssize_t ret;
int fsf; int fsf;
int i; int i;
...@@ -41,66 +59,92 @@ void ul(void *_d, event e) ...@@ -41,66 +59,92 @@ void ul(void *_d, event e)
PUTS(&d->buf, MAC_LTE_START_STRING); PUTS(&d->buf, MAC_LTE_START_STRING);
PUTC(&d->buf, FDD_RADIO); PUTC(&d->buf, FDD_RADIO);
PUTC(&d->buf, DIRECTION_UPLINK); PUTC(&d->buf, direction);
PUTC(&d->buf, C_RNTI); PUTC(&d->buf, rnti_type);
if (rnti_type == C_RNTI || rnti_type == RA_RNTI) {
PUTC(&d->buf, MAC_LTE_RNTI_TAG); PUTC(&d->buf, MAC_LTE_RNTI_TAG);
PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255); PUTC(&d->buf, (rnti>>8) & 255);
PUTC(&d->buf, e.e[d->ul_rnti].i & 255); PUTC(&d->buf, rnti & 255);
}
/* for newer version of wireshark? */ /* for newer version of wireshark? */
fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i; fsf = (frame << 4) + subframe;
/* for older version? */ /* for older version? */
fsf = e.e[d->ul_subframe].i; //fsf = subframe;
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG); PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
PUTC(&d->buf, (fsf>>8) & 255); PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255); PUTC(&d->buf, fsf & 255);
if (preamble != NO_PREAMBLE) {
PUTC(&d->buf, MAC_LTE_SEND_PREAMBLE_TAG);
PUTC(&d->buf, preamble);
PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */
}
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
for (i = 0; i < e.e[d->ul_data].bsize; i++) for (i = 0; i < bufsize; i++)
PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]); PUTC(&d->buf, ((char*)buf)[i]);
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0, ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in)); (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
if (ret != d->buf.osize) abort(); if (ret != d->buf.osize) abort();
} }
void ul(void *_d, event e)
{
ev_data *d = _d;
trace(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
e.e[d->ul_data].b, e.e[d->ul_data].bsize,
NO_PREAMBLE);
}
void dl(void *_d, event e) void dl(void *_d, event e)
{ {
ev_data *d = _d; ev_data *d = _d;
ssize_t ret;
int fsf;
int i;
d->buf.osize = 0; if (e.e[d->dl_rnti].i == 0xffff && no_sib) return;
PUTS(&d->buf, MAC_LTE_START_STRING); trace(d, DIRECTION_DOWNLINK,
PUTC(&d->buf, FDD_RADIO); e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
PUTC(&d->buf, DIRECTION_DOWNLINK); e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
PUTC(&d->buf, C_RNTI); e.e[d->dl_data].b, e.e[d->dl_data].bsize,
NO_PREAMBLE);
}
PUTC(&d->buf, MAC_LTE_RNTI_TAG); void mib(void *_d, event e)
PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255); {
PUTC(&d->buf, e.e[d->dl_rnti].i & 255); ev_data *d = _d;
/* for newer version of wireshark? */ if (no_mib) return;
fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
/* for older version? */
fsf = e.e[d->dl_subframe].i;
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255);
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); trace(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
for (i = 0; i < e.e[d->dl_data].bsize; i++) e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]); e.e[d->mib_data].b, e.e[d->mib_data].bsize,
NO_PREAMBLE);
}
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0, void preamble(void *_d, event e)
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in)); {
if (ret != d->buf.osize) abort(); ev_data *d = _d;
trace(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
NULL, 0,
e.e[d->preamble_preamble].i);
}
void rar(void *_d, event e)
{
ev_data *d = _d;
trace(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
e.e[d->rar_data].b, e.e[d->rar_data].bsize,
NO_PREAMBLE);
} }
void setup_data(ev_data *d, void *database, int ul_id, int dl_id) void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
int preamble_id, int rar_id)
{ {
database_event_format f; database_event_format f;
int i; int i;
...@@ -115,6 +159,19 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id) ...@@ -115,6 +159,19 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
d->dl_subframe = -1; d->dl_subframe = -1;
d->dl_data = -1; d->dl_data = -1;
d->mib_frame = -1;
d->mib_subframe = -1;
d->mib_data = -1;
d->preamble_frame = -1;
d->preamble_subframe = -1;
d->preamble_preamble = -1;
d->rar_rnti = -1;
d->rar_frame = -1;
d->rar_subframe = -1;
d->rar_data = -1;
#define G(var_name, var_type, var) \ #define G(var_name, var_type, var) \
if (!strcmp(f.name[i], var_name)) { \ if (!strcmp(f.name[i], var_name)) { \
if (strcmp(f.type[i], var_type)) goto error; \ if (strcmp(f.type[i], var_type)) goto error; \
...@@ -144,6 +201,37 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id) ...@@ -144,6 +201,37 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 || if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 ||
d->dl_data == -1) goto error; d->dl_data == -1) goto error;
/* MIB: frame, subframe, data */
f = get_format(database, mib_id);
for (i = 0; i < f.count; i++) {
G("frame", "int", d->mib_frame);
G("subframe", "int", d->mib_subframe);
G("data", "buffer", d->mib_data);
}
if (d->mib_frame == -1 || d->mib_subframe == -1 || d->mib_data == -1)
goto error;
/* preamble: frame, subframe, preamble */
f = get_format(database, preamble_id);
for (i = 0; i < f.count; i++) {
G("frame", "int", d->preamble_frame);
G("subframe", "int", d->preamble_subframe);
G("preamble", "int", d->preamble_preamble);
}
if (d->preamble_frame == -1 || d->preamble_subframe == -1 ||
d->preamble_preamble == -1) goto error;
/* rar: rnti, frame, subframe, data */
f = get_format(database, rar_id);
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->rar_rnti);
G("frame", "int", d->rar_frame);
G("subframe", "int", d->rar_subframe);
G("data", "buffer", d->rar_data);
}
if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 ||
d->rar_data == -1) goto error;
#undef G #undef G
return; return;
...@@ -179,7 +267,9 @@ void usage(void) ...@@ -179,7 +267,9 @@ void usage(void)
" -d <database file> this option is mandatory\n" " -d <database file> this option is mandatory\n"
" -i <dump file> read events from this dump file\n" " -i <dump file> read events from this dump file\n"
" -ip <IP address> send packets to this IP address (default %s)\n" " -ip <IP address> send packets to this IP address (default %s)\n"
" -p <port> send packets to this port (default %d)\n", " -p <port> send packets to this port (default %d)\n"
" -no-mib do not report MIB\n"
" -no-sib do not report SIBs\n",
DEFAULT_IP, DEFAULT_IP,
DEFAULT_PORT DEFAULT_PORT
); );
...@@ -194,7 +284,7 @@ int main(int n, char **v) ...@@ -194,7 +284,7 @@ int main(int n, char **v)
event_handler *h; event_handler *h;
int in; int in;
int i; int i;
int ul_id, dl_id; int ul_id, dl_id, mib_id = -1, preamble_id, rar_id;
ev_data d; ev_data d;
char *ip = DEFAULT_IP; char *ip = DEFAULT_IP;
int port = DEFAULT_PORT; int port = DEFAULT_PORT;
...@@ -209,6 +299,8 @@ int main(int n, char **v) ...@@ -209,6 +299,8 @@ int main(int n, char **v)
{ if (i > n-2) usage(); input_filename = v[++i]; continue; } { if (i > n-2) usage(); input_filename = v[++i]; continue; }
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; } if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; } if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
if (!strcmp(v[i], "-no-mib")) { no_mib = 1; continue; }
if (!strcmp(v[i], "-no-sib")) { no_sib = 1; continue; }
usage(); usage();
} }
...@@ -232,10 +324,16 @@ int main(int n, char **v) ...@@ -232,10 +324,16 @@ int main(int n, char **v)
ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA"); ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA"); dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id); mib_id = event_id_from_name(database, "ENB_PHY_MIB");
preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE");
rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id);
register_handler_function(h, ul_id, ul, &d); register_handler_function(h, ul_id, ul, &d);
register_handler_function(h, dl_id, dl, &d); register_handler_function(h, dl_id, dl, &d);
register_handler_function(h, mib_id, mib, &d);
register_handler_function(h, preamble_id, preamble, &d);
register_handler_function(h, rar_id, rar, &d);
d.socket = socket(AF_INET, SOCK_DGRAM, 0); d.socket = socket(AF_INET, SOCK_DGRAM, 0);
if (d.socket == -1) { perror("socket"); exit(1); } if (d.socket == -1) { perror("socket"); exit(1); }
...@@ -253,7 +351,8 @@ int main(int n, char **v) ...@@ -253,7 +351,8 @@ int main(int n, char **v)
event e; event e;
e = get_event(in, &ebuf, database); e = get_event(in, &ebuf, database);
if (e.type == -1) break; if (e.type == -1) break;
if (!(e.type == ul_id || e.type == dl_id)) continue; if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
e.type == preamble_id || e.type == rar_id)) continue;
handle_event(h, e); handle_event(h, e);
} }
......
...@@ -254,6 +254,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) { ...@@ -254,6 +254,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
if (eNB->pbch_configured!=1) return; if (eNB->pbch_configured!=1) return;
eNB->pbch_configured=0; eNB->pbch_configured=0;
} }
T(T_ENB_PHY_MIB, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_BUFFER(pbch_pdu, 3));
generate_pbch(&eNB->pbch, generate_pbch(&eNB->pbch,
txdataF, txdataF,
AMP, AMP,
......
...@@ -584,6 +584,11 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, ...@@ -584,6 +584,11 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
ra->state = WAITMSG3; ra->state = WAITMSG3;
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP); LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP);
T(T_ENB_MAC_UE_DL_RAR_PDU_WITH_DATA, T_INT(module_idP),
T_INT(CC_idP), T_INT(ra->RA_rnti), T_INT(frameP),
T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ),
T_BUFFER(cc[CC_idP].RAR_pdu.payload, 7));
// DL request // DL request
mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP; mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
TX_req = TX_req =
......
...@@ -758,6 +758,9 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -758,6 +758,9 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
module_idP, CC_id, frameP, subframeP); module_idP, CC_id, frameP, subframeP);
} }
T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(0xffff),
T_INT(frameP), T_INT(subframeP), T_INT(0), T_BUFFER(cc->BCCH_pdu.payload, bcch_sdu_length));
if (opt_enabled == 1) { if (opt_enabled == 1) {
trace_pdu(DIRECTION_DOWNLINK, trace_pdu(DIRECTION_DOWNLINK,
&cc->BCCH_pdu.payload[0], &cc->BCCH_pdu.payload[0],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment