Commit 2ba307c4 authored by Joanne Hugé's avatar Joanne Hugé

Remove poll wake-up for signal emission and XPD

parent 3f5754b5
This diff is collapsed.
......@@ -8,7 +8,6 @@ typedef struct ingress_param {
int use_timestamps;
int enable_ts_tracemark;
int xdp_polling_mode;
uint64_t interval;
size_t tx_buffer_len;
......
......@@ -48,9 +48,6 @@ typedef struct thread_param {
uint64_t start_ts;
int poll;
int poll_margin;
} thread_param_t;
typedef struct main_params {
......@@ -93,7 +90,7 @@ static char ts_tracemark_buf[64];
static void help(char *argv[]) {
printf(
"Usage: %s [-f IF -a CPU -p PRIO -i USEC -r USEC] [-b CLIENT_IP] [-d "
"BUF_LEN -cgtv] [-T LATENCY_THRESHOLD -G] [-x POLL_MODE -X]\n\n"
"BUF_LEN -cgtv] [-T LATENCY_THRESHOLD -G] [-xX]\n\n"
" -h Show help\n"
" -f IF Set the network interface to be used\n"
" -a CPU Pin the real time thread to CPU\n"
......@@ -103,13 +100,11 @@ static void help(char *argv[]) {
" -d BUF_LEN Set the length of tx buffer\n"
" -c Receive timestamp and emit signal\n"
" -s NS Common start time reference\n"
" -P USEC Do polling to wakeup signal thread with specified margin\n"
" -C Receive timestamp and print difference with current time\n"
" -b CLIENT_IP Server side RTT\n"
" -g Print histograms to sdtout on exit\n"
" -t Enable timestamps\n"
" -x POLL_MODE Use AF_XDP sockets\n"
" POLL_MODE: 0 for polling, 1 for combination of both\n"
" -x Use AF_XDP sockets\n"
" -X Trace during XDP packet reception\n"
" -T THRESHOLD Enable tracing until THRESHOLD is reached\n"
" -M Send tracemark when packet is received\n"
......@@ -119,30 +114,13 @@ static void help(char *argv[]) {
argv[0]);
}
static void poll_wakeup(struct timespec ts, int margin) {
int ret;
struct timespec ts_prev, current;
ts_prev = ts;
substract_ns(&ts_prev, margin * 1000);
ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &ts_prev, NULL);
if (ret) {
fprintf(stderr, "clock_nanosleep returned error: %d, aborting...\n", ret);
exit(EXIT_FAILURE);
}
do {
clock_gettime(CLOCK_REALTIME, &current);
} while(calcdiff_ns_signed(ts, current) > 1000);
}
static void *emit_signal_thread(void *p) {
(void)p;
cpu_set_t mask;
struct timespec current;
struct timespec previous_emit, previous_ts;
int64_t emit_diff, ts_diff;
int ret;
// Set thread CPU affinity
if (thread_params.affinity_cpu) {
......@@ -157,15 +135,18 @@ static void *emit_signal_thread(void *p) {
for (int i = 0;;i++) {
pthread_cond_wait(&emit_signal_ts_received, &emit_signal_mutex);
clock_gettime(CLOCK_REALTIME, &current);
poll_wakeup(emit_signal_next, thread_params.poll_margin);
ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &emit_signal_next, NULL);
if (ret) {
fprintf(stderr, "clock_nanosleep returned error: %d, aborting...\n", ret);
exit(EXIT_FAILURE);
}
toggle_gpio();
clock_gettime(CLOCK_REALTIME, &current);
// Check if something went wrong
if(i > 0) {
clock_gettime(CLOCK_REALTIME, &current);
emit_diff = calcdiff_ns_signed(current, previous_emit);
ts_diff = calcdiff_ns_signed(emit_signal_next, previous_ts);
if((emit_diff < ((int64_t)thread_params.interval) - ERROR_MARGIN_NS) ||
......@@ -397,8 +378,6 @@ int main(int argc, char *argv[]) {
thread_params.affinity_cpu = 0;
thread_params.enable_diff_ts = 0;
thread_params.enable_receive_tracemark = 0;
thread_params.poll = 0;
thread_params.poll_margin = 75;
thread_params.start_ts = 0;
main_params.refresh_rate = 50000;
main_params.verbose = 0;
......@@ -557,7 +536,7 @@ static void process_options(int argc, char *argv[]) {
int network_if_specified = 0;
for (;;) {
int c = getopt(argc, argv, "a:b:cCs:d:f:ghi:p:r:tvx:XT:GMSP:");
int c = getopt(argc, argv, "a:b:cCs:d:f:ghi:p:r:tvxXT:GMS");
if (c == -1) break;
......@@ -613,7 +592,6 @@ static void process_options(int argc, char *argv[]) {
break;
case 'x':
tsn_task = XDP_TASK;
ingress_params.xdp_polling_mode = atoi(optarg);
break;
case 'X':
main_params.enable_xdp_tracing = 1;
......@@ -628,10 +606,6 @@ static void process_options(int argc, char *argv[]) {
case 'S':
ingress_params.enable_ts_tracemark = 1;
break;
case 'P':
thread_params.poll = 1;
thread_params.poll_margin = atoi(optarg);
break;
}
}
......
......@@ -10,18 +10,14 @@ usage() {
cat << ENDUSAGE
Usage: $0 [-h] [-I if] [SERVER] | TCPDUMP [TRACE_OPTS]
-h Show help
SERVER: -bct ((-x | -X) POLL) -g INTERVAL -a CPU
SERVER: -bctX -g INTERVAL -a CPU
Options passed to the C server program (everything here is optional)
-b Send back packets for round trip measurements
-c USEC Emit a signal on GPIO at the timestamp given in packet, specify interval
(to be used with -c option in client program)
-O USEC Do polling to wakeup signal thread with specified margin
-C USEC Measure difference between current time and timestamp sent in tx data
-t Use SO_TIMESTAMPS to see how much time packet spent in kernel
-x POLL Use XDP sockets, with a global libbpf installation
-X POLL Use XDP sockets, with libbpf located in \$HOME/libbpf folder
POLL: Polling mode used in server program, 0 to poll with poll function,
1 to do active polling
-X Use XDP sockets, with libbpf located in \$HOME/libbpf folder
-s NS Specify a CLOCK_REALTIME timestamp at which client should start
(to be used with PTP) (interval needs to be specified with -j)
-j USEC Specify interval (used with -s)
......@@ -60,7 +56,7 @@ tracecmd_events="-e irq -e sched -e net -e napi"
tracecmd_opts=""
cpu=1
while getopts "j:a:b:c:C:htx:X:s:d:i:g:I:T:E:P:B:MSQO:" opt; do
while getopts "j:a:b:c:C:htx:Xs:d:i:g:I:T:E:P:B:MSQ" opt; do
case "${opt}" in
h )
usage
......@@ -78,9 +74,6 @@ while getopts "j:a:b:c:C:htx:X:s:d:i:g:I:T:E:P:B:MSQO:" opt; do
c )
server_options+=" -c -i ${OPTARG}"
;;
O )
server_options+=" -P ${OPTARG} "
;;
C )
server_options+=" -C -i ${OPTARG}"
;;
......@@ -107,7 +100,7 @@ while getopts "j:a:b:c:C:htx:X:s:d:i:g:I:T:E:P:B:MSQO:" opt; do
interface="${OPTARG}"
;;
X )
server_options+=" -x ${OPTARG}"
server_options+=" -x "
make_opts=" -e WITH_GIT_XDP=1"
;;
s )
......
......@@ -4,13 +4,12 @@ script_dir=$(dirname $(realpath $0))
usage() {
cat << ENDUSAGE
Usage: $0 [-h] [-i USEC -c USEC -t MSEC] [-T] BOARD1_HOSTNAME BOARD2_HOSTNAME
Usage: $0 [-h] [-i USEC -c USEC -t MSEC] [-TX] BOARD1_HOSTNAME BOARD2_HOSTNAME
-h Show help
-i USEC Specify which interval to use in client
-c USEC Specify which offset to use for the timestamp in the packet
-t MSEC Set the start timestamp offset
-P USEC Do polling to wakeup signal thread with specified margin
-X POLL_MODE Use XDP with specified poll mode
-X Use XDP
-T Enable tracing on the boards
BOARD_HOSTNAME Uses /etc/hosts to find the IP address associated to the hostname
ENDUSAGE
......@@ -23,7 +22,7 @@ interval=1000
server_opts=""
ts_offset=2000
while getopts "hc:i:o:rt:TP:X:" opt; do
while getopts "hc:i:o:rt:TX" opt; do
case "${opt}" in
h )
usage
......@@ -40,11 +39,8 @@ while getopts "hc:i:o:rt:TP:X:" opt; do
T )
enable_tracing=1
;;
P )
server_opts+=" -P ${OPTARG} "
;;
X )
server_opts+=" -X ${OPTARG} "
server_opts+=" -X "
;;
* )
usage
......
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