From 40ca5385e97f393d0c231446f117ad43465735a7 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Mar 2022 15:15:51 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/ipcpd/unicast/CMakeLists.txt | 2 ++ src/ipcpd/unicast/fa.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ipcpd/unicast') diff --git a/src/ipcpd/unicast/CMakeLists.txt b/src/ipcpd/unicast/CMakeLists.txt index f4887160..e1fe1074 100644 --- a/src/ipcpd/unicast/CMakeLists.txt +++ b/src/ipcpd/unicast/CMakeLists.txt @@ -13,6 +13,8 @@ include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_BINARY_DIR}/include) set(IPCP_UNICAST_TARGET ipcpd-unicast CACHE INTERNAL "") +set(IPCP_UNICAST_MPL 60 CACHE STRING + "Default maximum packet lifetime for the unicast IPCP, in seconds") protobuf_generate_c(KAD_PROTO_SRCS KAD_PROTO_HDRS dir/kademlia.proto) diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c index d59b9760..eb467a90 100644 --- a/src/ipcpd/unicast/fa.c +++ b/src/ipcpd/unicast/fa.c @@ -477,6 +477,7 @@ static int fa_wait_irmd_alloc(uint8_t * dst, struct timespec ts = {0, TIMEOUT * 1000}; struct timespec abstime; int fd; + time_t mpl = IPCP_UNICAST_MPL; clock_gettime(PTHREAD_COND_CLOCK, &abstime); @@ -497,7 +498,7 @@ static int fa_wait_irmd_alloc(uint8_t * dst, assert(ipcpi.alloc_id == -1); - fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, data, len); + fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, mpl, data, len); if (fd < 0) { pthread_mutex_unlock(&ipcpi.alloc_lock); log_dbg("Failed to get fd for flow."); @@ -598,6 +599,7 @@ static int fa_handle_flow_reply(struct fa_msg * msg, struct fa_flow * flow; uint8_t * data; /* Piggbacked data on flow alloc request. */ size_t dlen; /* Length of piggybacked data. */ + time_t mpl = IPCP_UNICAST_MPL; assert(len >= sizeof(*msg)); @@ -623,7 +625,7 @@ static int fa_handle_flow_reply(struct fa_msg * msg, pthread_rwlock_unlock(&fa.flows_lock); - if (ipcp_flow_alloc_reply(fd, msg->response, data, dlen)) + if (ipcp_flow_alloc_reply(fd, msg->response, mpl, data, dlen)) return -EIRMD; return 0; -- cgit v1.2.3