diff options
author | dimitri staessens <[email protected]> | 2017-04-26 11:57:56 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-04-26 12:01:52 +0200 |
commit | e2c8623e66d66f4b9c8619349d11375a32ac2134 (patch) | |
tree | 4e4d3b4f8da805ca9f0f0733977ff678c064660f /src/ipcpd/normal | |
parent | ea16fc664673d65c0e3e51591258be4d3b8be406 (diff) | |
download | ouroboros-e2c8623e66d66f4b9c8619349d11375a32ac2134.tar.gz ouroboros-e2c8623e66d66f4b9c8619349d11375a32ac2134.zip |
lib: Add call to reserve blocks in rdrbuff
This adds a call ipcp_sdb_reserve to reserve memory in the rdrbuff
without directly writing to a flow. The ipcp_flow_del function was
renamed to ipcp_sdb_release. The functions operating on sdbs are moved
to their own header.
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r-- | src/ipcpd/normal/dt.c | 12 | ||||
-rw-r--r-- | src/ipcpd/normal/fa.c | 2 | ||||
-rw-r--r-- | src/ipcpd/normal/frct.c | 10 | ||||
-rw-r--r-- | src/ipcpd/normal/shm_pci.h | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c index 593064f4..6ac73a93 100644 --- a/src/ipcpd/normal/dt.c +++ b/src/ipcpd/normal/dt.c @@ -93,7 +93,7 @@ static int sdu_handler(int fd, if (pci.dst_addr != ipcpi.dt_addr) { if (pci.ttl == 0) { log_dbg("TTL was zero."); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return 0; } @@ -103,7 +103,7 @@ static int sdu_handler(int fd, if (fd < 0) { pff_unlock(dt.pff[qc]); log_err("No next hop for %" PRIu64, pci.dst_addr); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } @@ -111,7 +111,7 @@ static int sdu_handler(int fd, if (ipcp_flow_write(fd, sdb)) { log_err("Failed to write SDU to fd %d.", fd); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } } else { @@ -268,7 +268,7 @@ int dt_write_sdu(struct pci * pci, pff_unlock(dt.pff[pci->qos_id]); log_err("Could not get nhop for address %" PRIu64, pci->dst_addr); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } @@ -276,13 +276,13 @@ int dt_write_sdu(struct pci * pci, if (shm_pci_ser(sdb, pci)) { log_err("Failed to serialize PDU."); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } if (ipcp_flow_write(fd, sdb)) { log_err("Failed to write SDU to fd %d.", fd); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c index 6c3df7a1..131100db 100644 --- a/src/ipcpd/normal/fa.c +++ b/src/ipcpd/normal/fa.c @@ -61,7 +61,7 @@ static int sdu_handler(int fd, if (frct_i_write_sdu(fa.fd_to_cep_id[fd], sdb)) { pthread_rwlock_unlock(&fa.flows_lock); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); log_warn("Failed to hand SDU to FRCT."); return -1; } diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c index bfcde1b3..71e32bd1 100644 --- a/src/ipcpd/normal/frct.c +++ b/src/ipcpd/normal/frct.c @@ -229,7 +229,7 @@ int frct_post_sdu(struct pci * pci, pci->src_cep_id); if (instance == NULL) { pthread_mutex_unlock(&frct.instances_lock); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -ENOMEM; } id = instance->cep_id; @@ -237,7 +237,7 @@ int frct_post_sdu(struct pci * pci, instance = frct.instances[pci->dst_cep_id]; if (instance == NULL) { pthread_mutex_unlock(&frct.instances_lock); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } id = pci->dst_cep_id; @@ -253,16 +253,16 @@ int frct_post_sdu(struct pci * pci, if (fa_post_buf(id, &buf)) { log_err("Failed to hand buffer to FA."); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); } else { /* FIXME: Known cep-ids are delivered to FA (minimal DTP) */ if (fa_post_sdu(pci->dst_cep_id, sdb)) { log_err("Failed to hand SDU to FA."); - ipcp_flow_del(sdb); + ipcp_sdb_release(sdb); return -1; } } diff --git a/src/ipcpd/normal/shm_pci.h b/src/ipcpd/normal/shm_pci.h index 0c54c883..ff0b17ea 100644 --- a/src/ipcpd/normal/shm_pci.h +++ b/src/ipcpd/normal/shm_pci.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_NORMAL_SHM_PCI_H #define OUROBOROS_IPCPD_NORMAL_SHM_PCI_H -#include <ouroboros/shm_rdrbuff.h> +#include <ouroboros/shm_du_buff.h> #include <ouroboros/utils.h> #include <ouroboros/qos.h> |