summaryrefslogtreecommitdiff
path: root/src/ipcpd/eth
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/eth
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/eth')
-rw-r--r--src/ipcpd/eth/CMakeLists.txt2
-rw-r--r--src/ipcpd/eth/eth.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/ipcpd/eth/CMakeLists.txt b/src/ipcpd/eth/CMakeLists.txt
index d7105b4f..d57e1848 100644
--- a/src/ipcpd/eth/CMakeLists.txt
+++ b/src/ipcpd/eth/CMakeLists.txt
@@ -85,6 +85,8 @@ if (HAVE_ETH)
"Bypass the Qdisc in the kernel when using raw sockets")
set(IPCP_ETH_LO_MTU 1500 CACHE STRING
"Restrict Ethernet MTU over loopback interfaces")
+ set(IPCP_ETH_MPL 5 CACHE STRING
+ "Default maximum packet lifetime for the Ethernet IPCPs, in seconds")
set(ETH_LLC_SOURCES
# Add source files here
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index 8b34d303..f62bd0a7 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -575,6 +575,7 @@ static int eth_ipcp_req(uint8_t * r_addr,
struct timespec ts = {0, ALLOC_TIMEO * MILLION};
struct timespec abstime;
int fd;
+ time_t mpl = IPCP_ETH_MPL;
clock_gettime(PTHREAD_COND_CLOCK, &abstime);
@@ -594,7 +595,7 @@ static int eth_ipcp_req(uint8_t * r_addr,
}
/* reply to IRM, called under lock to prevent race */
- 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_err("Could not get new flow from IRMd.");
@@ -636,8 +637,9 @@ static int eth_ipcp_alloc_reply(uint8_t * r_addr,
const void * data,
size_t len)
{
- int ret = 0;
- int fd = -1;
+ int ret = 0;
+ int fd = -1;
+ time_t mpl = IPCP_ETH_MPL;
pthread_rwlock_wrlock(&eth_data.flows_lock);
@@ -672,7 +674,7 @@ static int eth_ipcp_alloc_reply(uint8_t * r_addr,
#elif defined(BUILD_ETH_LLC)
log_dbg("Flow reply, fd %d, SSAP %d, DSAP %d.", fd, ssap, dsap);
#endif
- if ((ret = ipcp_flow_alloc_reply(fd, response, data, len)) < 0)
+ if ((ret = ipcp_flow_alloc_reply(fd, response, mpl, data, len)) < 0)
return -1;
return ret;