]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - ugw/ugw.c
ugw: Use send() instead of poll() in mmap()-based TX
[can-benchmark.git] / ugw / ugw.c
index 0aefe7e8a0b1d6b1a44635905c43f3779b2059e4..e2c04ef7f7e9581d86fc70cff41b41f06190dc9a 100644 (file)
--- a/ugw/ugw.c
+++ b/ugw/ugw.c
@@ -233,18 +233,14 @@ void init_write(struct out_ctx *ctx)
 int out_packet_tx(struct out_ctx *ctx, struct can_frame *cf)
 {
        volatile struct tpacket2_hdr *hdr = ctx->ptr + ctx->current*FRAME_SIZE;
-       int ret = -1;
 
        if (ctx->from_in == NOP)
                return 0;
 
-
        while (hdr->tp_status != TP_STATUS_AVAILABLE) {
-               struct pollfd pfd = {.fd = ctx->s, .revents = 0,
-                                    .events = POLLIN|POLLRDNORM|POLLERR };
-               ret = CHECK(poll(&pfd, 1, -1));
+               CHECK(send(ctx->s, NULL, 0, 0));
        }
-       (void)ret;
+
        //struct sockaddr_ll *addr = (void*)hdr + TPACKET_HDRLEN - sizeof(struct sockaddr_ll);
        struct can_frame *cf_mmap = (void*)hdr + TPACKET_HDRLEN  - sizeof(struct sockaddr_ll);
        *cf_mmap = *cf;
@@ -253,7 +249,7 @@ int out_packet_tx(struct out_ctx *ctx, struct can_frame *cf)
        ctx->current = (ctx->current + 1) % FRAME_NR;
 
        if (ctx->from_in == SEND){
-               ret = CHECK(send(ctx->s, NULL, 0, 0));
+               CHECK(send(ctx->s, NULL, 0, 0));
                return 0;
        }
        return 0;