summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/dt_pci.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-02-13 18:16:28 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-02-13 19:15:07 +0100
commite095d0ade3035c714768266755c9c61acfc2ad0f (patch)
tree9b3fccffb5a8669bdb71bee1d266e3c441d66703 /src/ipcpd/normal/dt_pci.c
parent068a13ca7c1fdaefbfc4e846aaa8eefe9eb1d821 (diff)
downloadouroboros-e095d0ade3035c714768266755c9c61acfc2ad0f.tar.gz
ouroboros-e095d0ade3035c714768266755c9c61acfc2ad0f.zip
ipcpd: Revise Data Transfer component0.10.0
This makes the TTL non-optional and allows the maximum (initial) value of the TTL to be specified at bootstrap (the default is set to 60). The fd in the DT PCI is now called EID (Endpoint ID). The names "dif" and "ae" have been replaced by "layer" and "component" respectively in all sources. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/dt_pci.c')
-rw-r--r--src/ipcpd/normal/dt_pci.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/src/ipcpd/normal/dt_pci.c b/src/ipcpd/normal/dt_pci.c
index 77fa048e..76304668 100644
--- a/src/ipcpd/normal/dt_pci.c
+++ b/src/ipcpd/normal/dt_pci.c
@@ -1,7 +1,7 @@
/*
* Ouroboros - Copyright (C) 2016 - 2018
*
- * Protocol Control Information of Data Transfer AE
+ * Protocol Control Information of Data Transfer Component
*
* Dimitri Staessens <dimitri.staessens@ugent.be>
* Sander Vrijders <sander.vrijders@ugent.be>
@@ -28,36 +28,32 @@
#include <string.h>
#include <assert.h>
-#define DEFAULT_TTL 60
-
struct {
uint8_t addr_size;
- uint8_t fd_size;
- bool has_ttl;
+ uint8_t eid_size;
size_t head_size;
- /* offsets */
+ /* Offsets */
size_t qc_o;
size_t ttl_o;
- size_t fd_o;
+ size_t eid_o;
+
+ /* Initial TTL value */
+ uint8_t max_ttl;
} dt_pci_info;
int dt_pci_init(uint8_t addr_size,
- uint8_t fd_size,
- bool has_ttl)
+ uint8_t eid_size,
+ uint8_t max_ttl)
{
dt_pci_info.addr_size = addr_size;
- dt_pci_info.fd_size = fd_size;
- dt_pci_info.has_ttl = has_ttl;
-
- dt_pci_info.qc_o = dt_pci_info.addr_size;
- dt_pci_info.ttl_o = dt_pci_info.qc_o + QOS_LEN;
- if (dt_pci_info.has_ttl)
- dt_pci_info.fd_o = dt_pci_info.ttl_o + TTL_LEN;
- else
- dt_pci_info.fd_o = dt_pci_info.ttl_o;
+ dt_pci_info.eid_size = eid_size;
+ dt_pci_info.max_ttl = max_ttl;
- dt_pci_info.head_size = dt_pci_info.fd_o + dt_pci_info.fd_size;
+ dt_pci_info.qc_o = dt_pci_info.addr_size;
+ dt_pci_info.ttl_o = dt_pci_info.qc_o + QOS_LEN;
+ dt_pci_info.eid_o = dt_pci_info.ttl_o + TTL_LEN;
+ dt_pci_info.head_size = dt_pci_info.eid_o + dt_pci_info.eid_size;
return 0;
}
@@ -70,7 +66,7 @@ int dt_pci_ser(struct shm_du_buff * sdb,
struct dt_pci * dt_pci)
{
uint8_t * head;
- uint8_t ttl = DEFAULT_TTL;
+ uint8_t ttl = dt_pci_info.max_ttl;
assert(sdb);
assert(dt_pci);
@@ -79,12 +75,11 @@ int dt_pci_ser(struct shm_du_buff * sdb,
if (head == NULL)
return -EPERM;
- /* FIXME: Add check and operations for Big Endian machines */
+ /* FIXME: Add check and operations for Big Endian machines. */
memcpy(head, &dt_pci->dst_addr, dt_pci_info.addr_size);
memcpy(head + dt_pci_info.qc_o, &dt_pci->qc, QOS_LEN);
- if (dt_pci_info.has_ttl)
- memcpy(head + dt_pci_info.ttl_o, &ttl, TTL_LEN);
- memcpy(head + dt_pci_info.fd_o, &dt_pci->fd, dt_pci_info.fd_size);
+ memcpy(head + dt_pci_info.ttl_o, &ttl, TTL_LEN);
+ memcpy(head + dt_pci_info.eid_o, &dt_pci->eid, dt_pci_info.eid_size);
return 0;
}
@@ -99,18 +94,14 @@ void dt_pci_des(struct shm_du_buff * sdb,
head = shm_du_buff_head(sdb);
- /* FIXME: Add check and operations for Big Endian machines */
+ /* Decrease TTL */
+ --*(head + dt_pci_info.ttl_o);
+
+ /* FIXME: Add check and operations for Big Endian machines. */
memcpy(&dt_pci->dst_addr, head, dt_pci_info.addr_size);
memcpy(&dt_pci->qc, head + dt_pci_info.qc_o, QOS_LEN);
-
- if (dt_pci_info.has_ttl) {
- --*(head + dt_pci_info.ttl_o); /* decrease TTL */
- memcpy(&dt_pci->ttl, head + dt_pci_info.ttl_o, TTL_LEN);
- } else {
- dt_pci->ttl = 1;
- }
-
- memcpy(&dt_pci->fd, head + dt_pci_info.fd_o, dt_pci_info.fd_size);
+ memcpy(&dt_pci->ttl, head + dt_pci_info.ttl_o, TTL_LEN);
+ memcpy(&dt_pci->eid, head + dt_pci_info.eid_o, dt_pci_info.eid_size);
}
void dt_pci_shrink(struct shm_du_buff * sdb)