From: Michal Sojka Date: Fri, 17 Dec 2010 16:18:32 +0000 (+0100) Subject: Merge branch 'master' of rtime.felk.cvut.cz:/can-benchmark X-Git-Tag: fix-allnoconfig~201 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/commitdiff_plain/3ea7fae8477eb1f8a65e07a2e5f8c139110a2a81?hp=dc339fcb790e6956b559dc82992194eae6071611 Merge branch 'master' of rtime.felk.cvut.cz:/can-benchmark --- diff --git a/gw-tests/vcan.sh b/gw-tests/vcan.sh index 8bade7e..c87ebaf 100755 --- a/gw-tests/vcan.sh +++ b/gw-tests/vcan.sh @@ -14,7 +14,7 @@ main() { done sshgw cangw -A -s vcan0 -d can1 -f $(printf %x:C00007FF $i) - latester -d can0 -d can1 -d can2 -c $COUNT -i 0 -n hops$i + latester -d can0 -d can1 -d can2 -c $COUNT -i 0 $(traffic_and_length 2) -n hops$i done sshgw ip link del dev vcan0 } diff --git a/latester/latester.c b/latester/latester.c index b7bb38b..61b2b43 100644 --- a/latester/latester.c +++ b/latester/latester.c @@ -133,7 +133,7 @@ void sprint_canframe(char *buf , struct can_frame *cf, int sep) { } } -static inline struct msg_info *frame2info(struct can_frame *frame) +static inline uint16_t frame_index(struct can_frame *frame) { uint16_t idx; if (frame->can_dlc >= 2) { @@ -144,7 +144,12 @@ static inline struct msg_info *frame2info(struct can_frame *frame) error(1, 0, "%s error", __FUNCTION__); } - return &msg_infos[idx]; + return idx; +} + +static inline struct msg_info *frame2info(struct can_frame *frame) +{ + return &msg_infos[frame_index(frame)]; } static inline char *tstamp_str(const void *ctx, struct timespec *tstamp) @@ -606,13 +611,15 @@ void *measure_thread(void *arg) } pfd[0].revents = 0; - if (num_interfaces == 3 && pfd[1].revents != 0) { + if (num_interfaces == 3 && pfd[1].revents & POLLIN) { process_on_wire_rx(pfd[1].fd); pfd[1].revents = 0; } + if (num_interfaces == 3 && pfd[1].revents & ~POLLIN) + error(1, 0, "Unexpected pfd[1].revents: 0x%04x\n", pfd[1].revents); i = (num_interfaces == 2) ? 1 : 2; - if (pfd[i].revents != 0) { + if (pfd[i].revents & POLLIN) { consecutive_timeouts = 0; process_final_rx(pfd[i].fd); msg_in_progress--; @@ -622,6 +629,8 @@ void *measure_thread(void *arg) SEND(); } } + if (pfd[i].revents & ~POLLIN) + error(1, 0, "Unexpected pfd[%d].revents: 0x%04x\n", pfd[i].revents); } }