diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2022-03-06 15:15:51 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2022-03-08 17:40:17 +0100 |
commit | 40ca5385e97f393d0c231446f117ad43465735a7 (patch) | |
tree | 019bfcefe5899c545403648807372d7b2e97ee73 /src/irmd | |
parent | 22526848c5a7b48f8b45988bdfbc6e0ce7a9f712 (diff) | |
download | ouroboros-40ca5385e97f393d0c231446f117ad43465735a7.tar.gz ouroboros-40ca5385e97f393d0c231446f117ad43465735a7.zip |
ipdpd: Pass MPL to application at flow_allocation
The maximum packet lifetime (MPL) is a property of the flow that needs
to be passed to the reliable transmission protocol (FRCP) for its
correct operation. Previously, the value of MPL was set fixed as one
of the (fixed) Delta-t parameters. This patch makes the MPL a property
of the layer, and it can now be set per layer-type at build time.
This is a step towards a proper MPL estimator in the flow allocator.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd')
-rw-r--r-- | src/irmd/irm_flow.c | 1 | ||||
-rw-r--r-- | src/irmd/irm_flow.h | 1 | ||||
-rw-r--r-- | src/irmd/main.c | 24 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c index 75df7a80..1ffff53c 100644 --- a/src/irmd/irm_flow.c +++ b/src/irmd/irm_flow.c @@ -62,6 +62,7 @@ struct irm_flow * irm_flow_create(pid_t n_pid, f->n_pid = n_pid; f->n_1_pid = n_1_pid; f->flow_id = flow_id; + f->mpl = 0; f->qs = qs; f->data = NULL; f->len = 0; diff --git a/src/irmd/irm_flow.h b/src/irmd/irm_flow.h index 35e7dc2c..42b19d8d 100644 --- a/src/irmd/irm_flow.h +++ b/src/irmd/irm_flow.h @@ -48,6 +48,7 @@ struct irm_flow { pid_t n_1_pid; qosspec_t qs; + time_t mpl; void * data; size_t len; diff --git a/src/irmd/main.c b/src/irmd/main.c index 4b70c88b..fdbc25a7 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1353,11 +1353,13 @@ static int flow_accept(pid_t pid, f_out->flow_id = f->flow_id; f_out->n_pid = f->n_pid; f_out->n_1_pid = f->n_1_pid; + f_out->qs = f->qs; + f_out->mpl = f->mpl; f_out->data = f->data; /* pass owner */ f_out->len = f->len; - f_out->qs = f->qs; - f->data = NULL; - f->len = 0; + + f->data = NULL; + f->len = 0; pthread_rwlock_unlock(&irmd.flows_lock); @@ -1476,6 +1478,7 @@ static int flow_alloc(pid_t pid, f_out->n_1_pid = f->n_1_pid; f_out->data = f->data; /* pass owner */ f_out->len = f->len; + f_out->mpl = f->mpl; f->data = NULL; f->len = 0; @@ -1567,6 +1570,7 @@ static pid_t auto_execute(char ** argv) static int flow_req_arr(pid_t pid, struct irm_flow * f_out, const uint8_t * hash, + time_t mpl, qosspec_t qs, const void * data, size_t len) @@ -1681,6 +1685,8 @@ static int flow_req_arr(pid_t pid, return -1; } + f->mpl = mpl; + if (len != 0) { assert(data); f->data = malloc(len); @@ -1732,19 +1738,21 @@ static int flow_req_arr(pid_t pid, static int flow_alloc_reply(int flow_id, int response, + time_t mpl, const void * data, size_t len) { struct irm_flow * f; pthread_rwlock_wrlock(&irmd.flows_lock); - f = get_irm_flow(flow_id); if (f == NULL) { pthread_rwlock_unlock(&irmd.flows_lock); return -1; } + f->mpl = mpl; + if (!response) irm_flow_set_state(f, FLOW_ALLOCATED); else @@ -2168,6 +2176,8 @@ static void * mainloop(void * o) ret_msg->has_pk = true; ret_msg->pk.data = e.data; ret_msg->pk.len = e.len; + ret_msg->has_mpl = true; + ret_msg->mpl = e.mpl; } break; case IRM_MSG_CODE__IRM_FLOW_ALLOC: @@ -2185,6 +2195,8 @@ static void * mainloop(void * o) ret_msg->has_pk = true; ret_msg->pk.data = e.data; ret_msg->pk.len = e.len; + ret_msg->has_mpl = true; + ret_msg->mpl = e.mpl; } break; case IRM_MSG_CODE__IRM_FLOW_JOIN: @@ -2197,6 +2209,8 @@ static void * mainloop(void * o) ret_msg->flow_id = e.flow_id; ret_msg->has_pid = true; ret_msg->pid = e.n_1_pid; + ret_msg->has_mpl = true; + ret_msg->mpl = e.mpl; } break; case IRM_MSG_CODE__IRM_FLOW_DEALLOC: @@ -2210,6 +2224,7 @@ static void * mainloop(void * o) result = flow_req_arr(msg->pid, &e, msg->hash.data, + msg->mpl, msg_to_spec(msg->qosspec), msg->pk.data, msg->pk.len); @@ -2225,6 +2240,7 @@ static void * mainloop(void * o) : msg->pk.data == NULL); result = flow_alloc_reply(msg->flow_id, msg->response, + msg->mpl, msg->pk.data, msg->pk.len); break; |