summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2018-06-05 14:42:49 +0200
committerSander Vrijders <[email protected]>2018-06-05 15:00:21 +0200
commitf9bd3b31c8152b037bf1dbc3409a017d57d4a2e6 (patch)
treec1a5946c76a9ac6066b8d4d162cb13b29a8bd8d3 /src/lib
parent635ffc5c1c8da07f3f34218280d6a25a29c78bc7 (diff)
downloadouroboros-f9bd3b31c8152b037bf1dbc3409a017d57d4a2e6.tar.gz
ouroboros-f9bd3b31c8152b037bf1dbc3409a017d57d4a2e6.zip
lib: Add a QOS_RAW QoS cube
This adds a QoS cube that allows sending packets directly over a raw flow, without an FRCT state machine. Flow allocation with a NULL qosspec will now default to such raw flows. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dev.c30
-rw-r--r--src/lib/qoscube.c18
2 files changed, 34 insertions, 14 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 4a1c6688..ee82bbaa 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -486,6 +486,7 @@ int flow_accept(qosspec_t * qs,
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg;
int fd;
+ qoscube_t qc;
msg.code = IRM_MSG_CODE__IRM_FLOW_ACCEPT;
msg.has_pid = true;
@@ -519,6 +520,8 @@ int flow_accept(qosspec_t * qs,
return -EIRMD;
}
+ qc = recv_msg->qoscube;
+
fd = flow_init(recv_msg->port_id, recv_msg->pid, recv_msg->qoscube);
irm_msg__free_unpacked(recv_msg, NULL);
@@ -532,11 +535,13 @@ int flow_accept(qosspec_t * qs,
assert(ai.flows[fd].frcti == NULL);
- ai.flows[fd].frcti = frcti_create(fd);
- if (ai.flows[fd].frcti == NULL) {
- flow_fini(fd);
- pthread_rwlock_unlock(&ai.lock);
- return -ENOMEM;
+ if (qc != QOS_CUBE_RAW) {
+ ai.flows[fd].frcti = frcti_create(fd);
+ if (ai.flows[fd].frcti == NULL) {
+ flow_fini(fd);
+ pthread_rwlock_unlock(&ai.lock);
+ return -ENOMEM;
+ }
}
if (qs != NULL)
@@ -553,7 +558,7 @@ int flow_alloc(const char * dst,
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg;
- qoscube_t qc = QOS_CUBE_BE;
+ qoscube_t qc = QOS_CUBE_RAW;
int fd;
msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC;
@@ -603,14 +608,15 @@ int flow_alloc(const char * dst,
pthread_rwlock_wrlock(&ai.lock);
- /* FIXME: check if FRCT is needed based on qc? */
assert(ai.flows[fd].frcti == NULL);
- ai.flows[fd].frcti = frcti_create(fd);
- if (ai.flows[fd].frcti == NULL) {
- flow_fini(fd);
- pthread_rwlock_unlock(&ai.lock);
- return -ENOMEM;
+ if (qc != QOS_CUBE_RAW) {
+ ai.flows[fd].frcti = frcti_create(fd);
+ if (ai.flows[fd].frcti == NULL) {
+ flow_fini(fd);
+ pthread_rwlock_unlock(&ai.lock);
+ return -ENOMEM;
+ }
}
pthread_rwlock_unlock(&ai.lock);
diff --git a/src/lib/qoscube.c b/src/lib/qoscube.c
index 8e6a8df9..00210625 100644
--- a/src/lib/qoscube.c
+++ b/src/lib/qoscube.c
@@ -24,10 +24,19 @@
#include <string.h>
+static struct qos_spec qos_raw = {
+ .delay = UINT32_MAX,
+ .bandwidth = UINT64_MAX,
+ .availability = 0,
+ .in_order = 0,
+ .maximum_interruption = UINT32_MAX
+};
+
static struct qos_spec qos_best_effort = {
.delay = UINT32_MAX,
.bandwidth = UINT64_MAX,
.availability = 0,
+ .in_order = 1,
.maximum_interruption = UINT32_MAX
};
@@ -35,6 +44,7 @@ static struct qos_spec qos_video = {
.delay = 100,
.bandwidth = UINT64_MAX,
.availability = 3,
+ .in_order = 1,
.maximum_interruption = 100
};
@@ -42,6 +52,7 @@ static struct qos_spec qos_voice = {
.delay = 10,
.bandwidth = 100000,
.availability = 5,
+ .in_order = 1,
.maximum_interruption = 50
};
@@ -57,8 +68,10 @@ qoscube_t qos_spec_to_cube(qosspec_t qs)
qs.availability >= qos_video.availability &&
qs.maximum_interruption <= qos_video.maximum_interruption)
return QOS_CUBE_VIDEO;
- else
+ else if (qs.in_order == 1)
return QOS_CUBE_BE;
+ else
+ return QOS_CUBE_RAW;
}
qosspec_t qos_cube_to_spec(qoscube_t qc)
@@ -69,7 +82,8 @@ qosspec_t qos_cube_to_spec(qoscube_t qc)
case QOS_CUBE_VIDEO:
return qos_video;
case QOS_CUBE_BE:
- default:
return qos_best_effort;
+ default:
+ return qos_raw;
}
}