Commit ba1c0eea authored by Joanne Hugé's avatar Joanne Hugé

Fix SO_TXTIME socket configuration issue, and disable Werror

parent 97a93f13
...@@ -12,7 +12,7 @@ CLIENT_SRCS += send_packet.c ...@@ -12,7 +12,7 @@ CLIENT_SRCS += send_packet.c
SERVER_OBJS = $(SERVER_SRCS:%.c=%.o) SERVER_OBJS = $(SERVER_SRCS:%.c=%.o)
CLIENT_OBJS = $(CLIENT_SRCS:%.c=%.o) CLIENT_OBJS = $(CLIENT_SRCS:%.c=%.o)
CFLAGS = -Og -g -Wall -Werror -Wextra CFLAGS = -Og -g -Wall -Wextra
CFLAGS += -MD -MP CFLAGS += -MD -MP
CFLAGS += -I $(SRCDIR) CFLAGS += -I $(SRCDIR)
CFLAGS += -std=gnu99 CFLAGS += -std=gnu99
......
...@@ -81,7 +81,7 @@ static void *packet_sending_thread(void *p) { ...@@ -81,7 +81,7 @@ static void *packet_sending_thread(void *p) {
clock_gettime(CLOCK_ID, &next); clock_gettime(CLOCK_ID, &next);
next_txtime = next.tv_sec * NSEC_PER_SEC + next.tv_nsec; next_txtime = next.tv_sec * NSEC_PER_SEC + next.tv_nsec;
// Wait around 1 second // Wait around 1 second
next_txtime += (NSEC_PER_SEC / param->interval) * param->interval; next_txtime += (10 * NSEC_PER_SEC / param->interval) * param->interval;
// Send packet while thread is sleeping // Send packet while thread is sleeping
next_txtime += (param->interval) / 2; next_txtime += (param->interval) / 2;
...@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { ...@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {
// Process bash options // Process bash options
process_options(argc, argv, &param, &main_param); process_options(argc, argv, &param, &main_param);
init_udp_etf(param.enable_affinity, param.network_if); init_udp_etf(param.enable_etf, param.network_if);
usleep(10000); usleep(10000);
......
...@@ -133,7 +133,7 @@ void init_udp_etf(int use_etf, char *network_if) { ...@@ -133,7 +133,7 @@ void init_udp_etf(int use_etf, char *network_if) {
if (use_etf) { if (use_etf) {
sk_txtime.clockid = CLOCK_ID; sk_txtime.clockid = CLOCK_ID;
sk_txtime.flags = 0; sk_txtime.flags = 1;
// sk_txtime.flags = SOF_TXTIME_REPORT_ERRORS; // sk_txtime.flags = SOF_TXTIME_REPORT_ERRORS;
if (setsockopt(fd, SOL_SOCKET, SO_TXTIME, &sk_txtime, sizeof(sk_txtime))) if (setsockopt(fd, SOL_SOCKET, SO_TXTIME, &sk_txtime, sizeof(sk_txtime)))
...@@ -174,8 +174,9 @@ void send_udp_packet_etf(int use_etf, uint64_t txtime, const char *server_ip) { ...@@ -174,8 +174,9 @@ void send_udp_packet_etf(int use_etf, uint64_t txtime, const char *server_ip) {
cmsg = CMSG_FIRSTHDR(&msg); cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_TXTIME; cmsg->cmsg_type = SCM_TXTIME;
cmsg->cmsg_len = CMSG_LEN(sizeof(__u64)); cmsg->cmsg_len = CMSG_LEN(sizeof(uint64_t));
*((__u64 *)CMSG_DATA(cmsg)) = txtime; *((uint64_t *)CMSG_DATA(cmsg)) = txtime;
msg.msg_controllen = cmsg->cmsg_len;
} }
sendmsgerr = sendmsg(fd, &msg, 0); sendmsgerr = sendmsg(fd, &msg, 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