diff options
author | Dimitri Staessens <[email protected]> | 2022-03-06 15:15:51 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2022-03-08 17:40:17 +0100 |
commit | 40ca5385e97f393d0c231446f117ad43465735a7 (patch) | |
tree | 019bfcefe5899c545403648807372d7b2e97ee73 /src/irmd/main.c | |
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 <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r-- | src/irmd/main.c | 24 |
1 files changed, 20 insertions, 4 deletions
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; |