summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-02-28 14:06:01 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-02-28 14:15:53 +0100
commiteb8ed5e4ebef1b34bc6dd749fb7210cac618a9fe (patch)
tree17d4e6e5cb6f69c583056fa47d81630ba318b93d /src/lib
parent4159e60f9b61dd5c8ac33cd2dea3ff81945c06ce (diff)
downloadouroboros-eb8ed5e4ebef1b34bc6dd749fb7210cac618a9fe.tar.gz
ouroboros-eb8ed5e4ebef1b34bc6dd749fb7210cac618a9fe.zip
lib: Add fccntl operation to get queue lengths
This adds the FLOWGRXQLEN and FLOWGTXQLEN operations to fccntl to get the number of packets that are in the receive and transmit buffers respectively. The flow statistics are updated to show these queue lengths. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 99ab4359..7e829a5f 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -670,6 +670,7 @@ int fccntl(int fd,
qosspec_t * qs;
uint32_t rx_acl;
uint32_t tx_acl;
+ size_t * qlen;
struct flow * flow;
if (fd < 0 || fd >= PROG_MAX_FLOWS)
@@ -728,6 +729,14 @@ int fccntl(int fd,
goto einval;
*qs = flow->spec;
break;
+ case FLOWGRXQLEN:
+ qlen = va_arg(l, size_t *);
+ *qlen = shm_rbuff_queued(flow->rx_rb);
+ break;
+ case FLOWGTXQLEN:
+ qlen = va_arg(l, size_t *);
+ *qlen = shm_rbuff_queued(flow->rx_rb);
+ break;
case FLOWSFLAGS:
flow->oflags = va_arg(l, uint32_t);
rx_acl = shm_rbuff_get_acl(flow->rx_rb);