diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-08-22 13:29:08 +0000 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-08-22 13:29:08 +0000 |
commit | fb771c0cf876ad58c50551b90dacc0b5689dae05 (patch) | |
tree | 1191636f678761d37d4c7959ae9d5edbde46e28c /src/lib/dev.c | |
parent | 589b91b7422d3923045c3422a5b790b26162439a (diff) | |
parent | 514791e5c6ded690aaf6dc43709dd02bc6a2ff6a (diff) | |
download | ouroboros-fb771c0cf876ad58c50551b90dacc0b5689dae05.tar.gz ouroboros-fb771c0cf876ad58c50551b90dacc0b5689dae05.zip |
Merged in sandervrijders/ouroboros/be-tw (pull request #560)
Be tw
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r-- | src/lib/dev.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index 1018f556..52a56097 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -83,11 +83,7 @@ struct frcti { uint64_t rcv_lwe; uint64_t rcv_rwe; - bool resource_control; - bool reliable; - bool error_check; - bool ordered; - bool partial; + uint8_t conf_flags; }; struct port { @@ -121,7 +117,6 @@ struct { struct shm_flow_set * fqset; struct timerwheel * tw; - int tw_users; struct bmp * fds; struct bmp * fqueues; @@ -317,6 +312,12 @@ static int frcti_write(int fd, frcti = &(ai.frcti[fd]); + pthread_rwlock_unlock(&ai.lock); + + timerwheel_move(ai.tw); + + pthread_rwlock_rdlock(&ai.lock); + /* * Set the DRF in the first packet of a new run of SDUs, * otherwise simply recharge the timer. @@ -337,7 +338,7 @@ static int frcti_write(int fd, pci.seqno = frcti->snd_lwe++; pci.type |= PDU_TYPE_DATA; - if (frct_pci_ser(sdb, &pci, frcti->error_check)) + if (frct_pci_ser(sdb, &pci, frcti->conf_flags & CONF_ERROR_CHECK)) return -1; if (finalize_write(fd, shm_du_buff_get_idx(sdb))) @@ -368,6 +369,8 @@ static ssize_t frcti_read(int fd) struct frct_pci pci; struct shm_du_buff * sdb; + timerwheel_move(ai.tw); + pthread_rwlock_rdlock(&ai.lock); if (ai.flows[fd].oflags & FLOW_O_NONBLOCK) { @@ -399,7 +402,7 @@ static ssize_t frcti_read(int fd) sdb = shm_rdrbuff_get(ai.rdrb, idx); /* SDU may be corrupted. */ - if (frct_pci_des(sdb, &pci, frcti->error_check)) { + if (frct_pci_des(sdb, &pci, frcti->conf_flags & CONF_ERROR_CHECK)) { pthread_rwlock_unlock(&ai.lock); shm_rdrbuff_remove(ai.rdrb, idx); return -1; @@ -460,6 +463,8 @@ static int frcti_event_wait(struct flow_set * set, assert(fq); assert(timeout); + timerwheel_move(ai.tw); + /* * FIXME: Return the fq only if a data SDU * for the application is available. |