summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-12-10 18:11:20 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-12-12 11:38:00 +0100
commit132d2145a6e89ac0f4454ba7f257a910da2ef674 (patch)
treeeb77f04a381ea5f8a869aff3b798c32acfb7e91e /src/ipcpd/unicast
parent54f632767df709f6afb87ba37c7ee0b71a2bdbce (diff)
downloadouroboros-132d2145a6e89ac0f4454ba7f257a910da2ef674.tar.gz
ouroboros-132d2145a6e89ac0f4454ba7f257a910da2ef674.zip
ipcpd: Pass previous ECN value in congestion API
The previous value of the ECN field should be passed to the congestion notification function. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast')
-rw-r--r--src/ipcpd/unicast/ca.c7
-rw-r--r--src/ipcpd/unicast/ca.h5
-rw-r--r--src/ipcpd/unicast/dt.c6
-rw-r--r--src/ipcpd/unicast/pol-ca-ops.h5
-rw-r--r--src/ipcpd/unicast/pol/ca-mb-ecn.c9
-rw-r--r--src/ipcpd/unicast/pol/ca-mb-ecn.h5
-rw-r--r--src/ipcpd/unicast/pol/ca-nop.c6
-rw-r--r--src/ipcpd/unicast/pol/ca-nop.h5
8 files changed, 30 insertions, 18 deletions
diff --git a/src/ipcpd/unicast/ca.c b/src/ipcpd/unicast/ca.c
index 73de14a5..3add2a7d 100644
--- a/src/ipcpd/unicast/ca.c
+++ b/src/ipcpd/unicast/ca.c
@@ -92,10 +92,11 @@ void ca_wnd_wait(ca_wnd_t wnd)
return ca.ops->wnd_wait(wnd);
}
-uint8_t ca_calc_ecn(int fd,
- size_t len)
+int ca_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len)
{
- return ca.ops->calc_ecn(fd, len);
+ return ca.ops->calc_ecn(fd, ecn, len);
}
ssize_t ca_print_stats(void * ctx,
diff --git a/src/ipcpd/unicast/ca.h b/src/ipcpd/unicast/ca.h
index 7e3ab384..0604a161 100644
--- a/src/ipcpd/unicast/ca.h
+++ b/src/ipcpd/unicast/ca.h
@@ -55,8 +55,9 @@ void ca_ctx_update_ece(void * ctx,
void ca_wnd_wait(ca_wnd_t wnd);
-uint8_t ca_calc_ecn(int fd,
- size_t len);
+int ca_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len);
ssize_t ca_print_stats(void * ctx,
char * buf,
diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c
index 90318487..1360371a 100644
--- a/src/ipcpd/unicast/dt.c
+++ b/src/ipcpd/unicast/dt.c
@@ -480,7 +480,7 @@ static void packet_handler(int fd,
return;
}
- *(head + dt_pci_info.ecn_o) |= ca_calc_ecn(ofd, len);
+ (void) ca_calc_ecn(ofd, head + dt_pci_info.ecn_o, len);
ret = ipcp_flow_write(ofd, sdb);
if (ret < 0) {
@@ -814,7 +814,9 @@ int dt_write_packet(uint64_t dst_addr,
dt_pci.dst_addr = dst_addr;
dt_pci.qc = qc;
dt_pci.eid = eid;
- dt_pci.ecn = ca_calc_ecn(fd, len);
+ dt_pci.ecn = 0;
+
+ (void) ca_calc_ecn(fd, &dt_pci.ecn, len);
dt_pci_ser(head, &dt_pci);
diff --git a/src/ipcpd/unicast/pol-ca-ops.h b/src/ipcpd/unicast/pol-ca-ops.h
index 69bd0d21..1e7c48b9 100644
--- a/src/ipcpd/unicast/pol-ca-ops.h
+++ b/src/ipcpd/unicast/pol-ca-ops.h
@@ -43,8 +43,9 @@ struct pol_ca_ops {
void (* wnd_wait)(ca_wnd_t wnd);
- uint8_t (* calc_ecn)(int fd,
- size_t len);
+ int (* calc_ecn)(int fd,
+ uint8_t * ecn,
+ size_t len);
/* Optional, can be NULL */
ssize_t (* print_stats)(void * ctx,
diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.c b/src/ipcpd/unicast/pol/ca-mb-ecn.c
index 1baaca7a..1791e42a 100644
--- a/src/ipcpd/unicast/pol/ca-mb-ecn.c
+++ b/src/ipcpd/unicast/pol/ca-mb-ecn.c
@@ -222,8 +222,9 @@ void mb_ecn_ctx_update_ece(void * _ctx,
ctx->tx_cav = true;
}
-uint8_t mb_ecn_calc_ecn(int fd,
- size_t len)
+int mb_ecn_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len)
{
size_t q;
@@ -231,7 +232,9 @@ uint8_t mb_ecn_calc_ecn(int fd,
q = ipcp_flow_queued(fd);
- return (uint8_t) (q >> ECN_Q_SHFT);
+ *ecn |= (uint8_t) (q >> ECN_Q_SHFT);
+
+ return 0;
}
ssize_t mb_ecn_print_stats(void * _ctx,
diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.h b/src/ipcpd/unicast/pol/ca-mb-ecn.h
index 945b0df5..30dba4a2 100644
--- a/src/ipcpd/unicast/pol/ca-mb-ecn.h
+++ b/src/ipcpd/unicast/pol/ca-mb-ecn.h
@@ -42,8 +42,9 @@ void mb_ecn_ctx_update_ece(void * ctx,
void mb_ecn_wnd_wait(ca_wnd_t wnd);
-uint8_t mb_ecn_calc_ecn(int fd,
- size_t len);
+int mb_ecn_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len);
ssize_t mb_ecn_print_stats(void * ctx,
char * buf,
diff --git a/src/ipcpd/unicast/pol/ca-nop.c b/src/ipcpd/unicast/pol/ca-nop.c
index 15b253ca..ce210cfb 100644
--- a/src/ipcpd/unicast/pol/ca-nop.c
+++ b/src/ipcpd/unicast/pol/ca-nop.c
@@ -84,11 +84,13 @@ void nop_ctx_update_ece(void * ctx,
}
-uint8_t nop_calc_ecn(int fd,
- size_t len)
+int nop_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len)
{
(void) fd;
(void) len;
+ (void) ecn;
return 0;
}
diff --git a/src/ipcpd/unicast/pol/ca-nop.h b/src/ipcpd/unicast/pol/ca-nop.h
index baf649d8..859b52dc 100644
--- a/src/ipcpd/unicast/pol/ca-nop.h
+++ b/src/ipcpd/unicast/pol/ca-nop.h
@@ -42,8 +42,9 @@ void nop_ctx_update_ece(void * ctx,
void nop_wnd_wait(ca_wnd_t wnd);
-uint8_t nop_calc_ecn(int fd,
- size_t len);
+int nop_calc_ecn(int fd,
+ uint8_t * ecn,
+ size_t len);
extern struct pol_ca_ops nop_ca_ops;