Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OAI-RAN-5G-sheduler_MaxTBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAQ5G-PFC
OAI-RAN-5G-sheduler_MaxTBS
Commits
ee5d8c60
Commit
ee5d8c60
authored
9 years ago
by
Cedric Roux
Browse files
Options
Downloads
Patches
Plain Diff
prepare forwarder
parent
2bd870af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
T.h
+13
-0
13 additions, 0 deletions
T.h
tracer/Makefile
+1
-1
1 addition, 1 deletion
tracer/Makefile
tracer/defs.h
+3
-0
3 additions, 0 deletions
tracer/defs.h
tracer/forward.c
+10
-0
10 additions, 0 deletions
tracer/forward.c
tracer/main.c
+57
-1
57 additions, 1 deletion
tracer/main.c
with
84 additions
and
2 deletions
T.h
+
13
−
0
View file @
ee5d8c60
...
@@ -115,11 +115,24 @@ extern T_cache_t *T_cache;
...
@@ -115,11 +115,24 @@ extern T_cache_t *T_cache;
#define T_ACTIVE(x) T_active[(intptr_t)x]
#define T_ACTIVE(x) T_active[(intptr_t)x]
#ifdef T_USE_SHARED_MEMORY
#define T_SEND() \
#define T_SEND() \
T_cache[T_LOCAL_slot].busy = 1; \
T_cache[T_LOCAL_slot].busy = 1; \
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
T_send(T_LOCAL_buf, T_LOCAL_size)
T_send(T_LOCAL_buf, T_LOCAL_size)
#else
/* T_USE_SHARED_MEMORY */
/* when not using shared memory, wait for send to finish */
#define T_SEND() \
T_cache[T_LOCAL_slot].busy = 1; \
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
T_send(T_LOCAL_buf, T_LOCAL_size); \
while (T_cache[T_LOCAL_slot].busy) usleep(1*1000)
#endif
/* T_USE_SHARED_MEMORY */
#define T_CHECK_SIZE(len, argnum) \
#define T_CHECK_SIZE(len, argnum) \
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
...
...
This diff is collapsed.
Click to expand it.
tracer/Makefile
+
1
−
1
View file @
ee5d8c60
...
@@ -10,7 +10,7 @@ CFLAGS += -DT_USE_SHARED_MEMORY
...
@@ -10,7 +10,7 @@ CFLAGS += -DT_USE_SHARED_MEMORY
LIBS
+=
-lrt
LIBS
+=
-lrt
PROG
=
tracer
PROG
=
tracer
OBJS
=
main.o plot.o database.o
OBJS
=
main.o plot.o database.o
forward.o
$(PROG)
:
$(OBJS)
$(PROG)
:
$(OBJS)
$(
CC
)
$(
CFLAGS
)
-o
$(
PROG
)
$(
OBJS
)
$(
LIBS
)
$(
CC
)
$(
CFLAGS
)
-o
$(
PROG
)
$(
OBJS
)
$(
LIBS
)
...
...
This diff is collapsed.
Click to expand it.
tracer/defs.h
+
3
−
0
View file @
ee5d8c60
...
@@ -21,4 +21,7 @@ void list_ids(void *database);
...
@@ -21,4 +21,7 @@ void list_ids(void *database);
void
list_groups
(
void
*
database
);
void
list_groups
(
void
*
database
);
void
on_off
(
void
*
d
,
char
*
item
,
int
*
a
,
int
onoff
);
void
on_off
(
void
*
d
,
char
*
item
,
int
*
a
,
int
onoff
);
void
*
forwarder
(
char
*
ip
,
int
port
);
void
forward
(
void
*
forwarder
,
char
*
buf
,
int
size
);
#endif
/* _TRACER_DEFS_H_ */
#endif
/* _TRACER_DEFS_H_ */
This diff is collapsed.
Click to expand it.
tracer/forward.c
0 → 100644
+
10
−
0
View file @
ee5d8c60
#include
"defs.h"
void
*
forwarder
(
char
*
ip
,
int
port
)
{
return
0
;
}
void
forward
(
void
*
_fowarder
,
char
*
buf
,
int
size
)
{
}
This diff is collapsed.
Click to expand it.
tracer/main.c
+
57
−
1
View file @
ee5d8c60
...
@@ -371,7 +371,7 @@ void init_shm(void)
...
@@ -371,7 +371,7 @@ void init_shm(void)
void
usage
(
void
)
void
usage
(
void
)
{
{
printf
(
printf
(
"options:
\n
"
"
common
options:
\n
"
" -d <database file> this option is mandatory
\n
"
" -d <database file> this option is mandatory
\n
"
" -li print IDs in the database
\n
"
" -li print IDs in the database
\n
"
" -lg print GROUPs in the database
\n
"
" -lg print GROUPs in the database
\n
"
...
@@ -383,6 +383,10 @@ void usage(void)
...
@@ -383,6 +383,10 @@ void usage(void)
" -OFF turn all logs OFF
\n
"
" -OFF turn all logs OFF
\n
"
"note: you may pass several -on/-off/-ON/-OFF, they will be processed in order
\n
"
"note: you may pass several -on/-off/-ON/-OFF, they will be processed in order
\n
"
" by default, all is off
\n
"
" by default, all is off
\n
"
"
\n
"
"remote mode options: in this mode you run a local tracer and a remote one
\n
"
" -r remote side
\n
"
" -l <IP address> <port> local side (forwards packets to remote IP:port)
\n
"
);
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -403,6 +407,13 @@ int main(int n, char **v)
...
@@ -403,6 +407,13 @@ int main(int n, char **v)
int
*
on_off_action
;
int
*
on_off_action
;
int
on_off_n
=
0
;
int
on_off_n
=
0
;
int
is_on
[
T_NUMBER_OF_IDS
];
int
is_on
[
T_NUMBER_OF_IDS
];
int
remote_local
=
0
;
int
remote_remote
=
0
;
char
*
remote_ip
=
NULL
;
int
remote_port
=
-
1
;
#ifdef T_USE_SHARED_MEMORY
void
*
f
;
#endif
memset
(
is_on
,
0
,
sizeof
(
is_on
));
memset
(
is_on
,
0
,
sizeof
(
is_on
));
...
@@ -425,10 +436,43 @@ int main(int n, char **v)
...
@@ -425,10 +436,43 @@ int main(int n, char **v)
{
on_off_name
[
on_off_n
]
=
NULL
;
on_off_action
[
on_off_n
++
]
=
1
;
continue
;
}
{
on_off_name
[
on_off_n
]
=
NULL
;
on_off_action
[
on_off_n
++
]
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-OFF"
))
if
(
!
strcmp
(
v
[
i
],
"-OFF"
))
{
on_off_name
[
on_off_n
]
=
NULL
;
on_off_action
[
on_off_n
++
]
=
0
;
continue
;
}
{
on_off_name
[
on_off_n
]
=
NULL
;
on_off_action
[
on_off_n
++
]
=
0
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-r"
))
{
remote_remote
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-l"
))
{
if
(
i
>
n
-
3
)
usage
();
remote_local
=
1
;
remote_ip
=
v
[
++
i
];
remote_port
=
atoi
(
v
[
++
i
]);
continue
;
}
printf
(
"ERROR: unknown option %s
\n
"
,
v
[
i
]);
printf
(
"ERROR: unknown option %s
\n
"
,
v
[
i
]);
usage
();
usage
();
}
}
#ifndef T_USE_SHARED_MEMORY
/* gcc shut up */
(
void
)
remote_port
;
(
void
)
remote_ip
;
#endif
#ifdef T_USE_SHARED_MEMORY
if
(
remote_remote
)
{
printf
(
"ERROR: remote 'remote side' does not run with shared memory
\n
"
);
printf
(
"recompile without T_USE_SHARED_MEMORY (edit Makefile)
\n
"
);
exit
(
1
);
}
#endif
if
(
remote_remote
)
{
/* TODO: setup 'secure' connection with remote part */
}
#ifndef T_USE_SHARED_MEMORY
if
(
remote_local
)
{
printf
(
"ERROR: remote 'local side' does not run without shared memory
\n
"
);
printf
(
"recompile with T_USE_SHARED_MEMORY (edit Makefile)
\n
"
);
exit
(
1
);
}
#endif
#ifdef T_USE_SHARED_MEMORY
if
(
remote_local
)
f
=
forwarder
(
remote_ip
,
remote_port
);
#endif
if
(
database_filename
==
NULL
)
{
if
(
database_filename
==
NULL
)
{
printf
(
"ERROR: provide a database file (-d)
\n
"
);
printf
(
"ERROR: provide a database file (-d)
\n
"
);
exit
(
1
);
exit
(
1
);
...
@@ -479,6 +523,18 @@ int main(int n, char **v)
...
@@ -479,6 +523,18 @@ int main(int n, char **v)
#ifdef T_USE_SHARED_MEMORY
#ifdef T_USE_SHARED_MEMORY
wait_message
();
wait_message
();
#endif
#endif
#ifdef T_USE_SHARED_MEMORY
if
(
remote_local
)
{
forward
(
f
,
T_cache
[
T_busylist_head
].
buffer
,
T_cache
[
T_busylist_head
].
length
);
T_cache
[
T_busylist_head
].
busy
=
0
;
T_busylist_head
++
;
T_busylist_head
&=
T_CACHE_SIZE
-
1
;
continue
;
}
#endif
get_message
(
s
);
get_message
(
s
);
}
}
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment