summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-03-06 15:15:51 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-03-08 17:40:17 +0100
commit40ca5385e97f393d0c231446f117ad43465735a7 (patch)
tree019bfcefe5899c545403648807372d7b2e97ee73 /src/ipcpd/local
parent22526848c5a7b48f8b45988bdfbc6e0ce7a9f712 (diff)
downloadouroboros-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/ipcpd/local')
-rw-r--r--src/ipcpd/local/CMakeLists.txt2
-rw-r--r--src/ipcpd/local/main.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ipcpd/local/CMakeLists.txt b/src/ipcpd/local/CMakeLists.txt
index a84f4f1b..10fd0120 100644
--- a/src/ipcpd/local/CMakeLists.txt
+++ b/src/ipcpd/local/CMakeLists.txt
@@ -13,6 +13,8 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
set(IPCP_LOCAL_TARGET ipcpd-local CACHE INTERNAL "")
+set(IPCP_LOCAL_MPL 2 CACHE STRING
+ "Default maximum packet lifetime for the Ethernet IPCPs, in seconds")
set(LOCAL_SOURCES
# Add source files here
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index c0e0b702..20f06ef8 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -204,6 +204,7 @@ static int ipcp_local_flow_alloc(int fd,
struct timespec ts = {0, ALLOC_TIMEOUT * MILLION};
struct timespec abstime;
int out_fd = -1;
+ time_t mpl = IPCP_LOCAL_MPL;
log_dbg("Allocating flow to " HASH_FMT " on fd %d.", HASH_VAL(dst), fd);
assert(dst);
@@ -227,7 +228,8 @@ static int ipcp_local_flow_alloc(int fd,
assert(ipcpi.alloc_id == -1);
- out_fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, data, len);
+ out_fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, mpl,
+ data, len);
if (out_fd < 0) {
pthread_mutex_unlock(&ipcpi.alloc_lock);
log_dbg("Flow allocation failed: %d", out_fd);
@@ -261,6 +263,7 @@ static int ipcp_local_flow_alloc_resp(int fd,
struct timespec ts = {0, ALLOC_TIMEOUT * MILLION};
struct timespec abstime;
int out_fd = -1;
+ time_t mpl = IPCP_LOCAL_MPL;
clock_gettime(PTHREAD_COND_CLOCK, &abstime);
@@ -303,7 +306,7 @@ static int ipcp_local_flow_alloc_resp(int fd,
fset_add(local_data.flows, fd);
- if (ipcp_flow_alloc_reply(out_fd, response, data, len) < 0)
+ if (ipcp_flow_alloc_reply(out_fd, response, mpl, data, len) < 0)
return -1;
log_info("Flow allocation completed, fds (%d, %d).", out_fd, fd);