]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Merge branch 'master' of rtime.felk.cvut.cz:/can-benchmark
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 17 Dec 2010 16:18:32 +0000 (17:18 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 17 Dec 2010 16:18:32 +0000 (17:18 +0100)
gw-tests/vcan.sh
latester/latester.c

index 8bade7ecf17328438973e43e1dde8535547f368c..c87ebaf51533238fa91a54ebf2ecf4d62b8c5884 100755 (executable)
@@ -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
 }
index b7bb38b49bea7489d0bbe3a08d060155dc6e98d0..61b2b433f45afe5c20bba5bc5830ff82a99ca83a 100644 (file)
@@ -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);
                }
        }