summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-01-03 11:57:59 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-01-03 12:12:49 +0100
commit5ab96126078cb9166356beaff3458404664274ed (patch)
tree4734c9872a5b9b4b4cb12e9fab82bdb255a6591a
parent4ccd3e2c8af00963ac6d88aac587de016300ed90 (diff)
downloadouroboros-5ab96126078cb9166356beaff3458404664274ed.tar.gz
ouroboros-5ab96126078cb9166356beaff3458404664274ed.zip
lib, ipcpd, irmd: Proof of concept QoS
Now correctly relays the qoscube end-to-end in the stack. A simple function specifying the cube in the spec is used for initial testing. The translation is now done in dev.c, but it could be moved elsewhere when qos cabability matures and the need arises.
-rw-r--r--include/ouroboros/dev.h4
-rw-r--r--include/ouroboros/ipcp-dev.h3
-rw-r--r--include/ouroboros/qos.h4
-rw-r--r--include/ouroboros/shared.h3
-rw-r--r--src/ipcpd/ipcp.c2
-rw-r--r--src/ipcpd/local/main.c7
-rw-r--r--src/ipcpd/normal/flow_alloc.proto2
-rw-r--r--src/ipcpd/normal/fmgr.c11
-rw-r--r--src/ipcpd/shim-eth-llc/main.c24
-rw-r--r--src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto3
-rw-r--r--src/ipcpd/shim-udp/main.c32
-rw-r--r--src/ipcpd/shim-udp/shim_udp_messages.proto17
-rw-r--r--src/irmd/ipcp.c6
-rw-r--r--src/irmd/main.c33
-rw-r--r--src/irmd/registry.h2
-rw-r--r--src/lib/dev.c60
-rw-r--r--src/lib/ipcpd_messages.proto2
-rw-r--r--src/lib/irmd_messages.proto9
18 files changed, 139 insertions, 85 deletions
diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h
index 048d890e..9bb55529 100644
--- a/include/ouroboros/dev.h
+++ b/include/ouroboros/dev.h
@@ -36,7 +36,7 @@ void ap_fini(void);
/* Returns flow descriptor (> 0), client AE name and qos spec. */
int flow_accept(char ** ae_name,
- qosspec_t * qos);
+ qosspec_t * spec);
int flow_alloc_resp(int fd,
int response);
@@ -47,7 +47,7 @@ int flow_alloc_resp(int fd,
*/
int flow_alloc(char * dst_name,
char * src_ae_name,
- qosspec_t * qos);
+ qosspec_t * spec);
int flow_alloc_res(int fd);
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
index 61c1582b..fe6a99bd 100644
--- a/include/ouroboros/ipcp-dev.h
+++ b/include/ouroboros/ipcp-dev.h
@@ -30,7 +30,8 @@ int ipcp_create_r(pid_t api);
int ipcp_flow_req_arr(pid_t api,
char * dst_name,
- char * src_ae_name);
+ char * src_ae_name,
+ qoscube_t cube);
int ipcp_flow_alloc_reply(int fd,
int response);
diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h
index c301e61b..74e898da 100644
--- a/include/ouroboros/qos.h
+++ b/include/ouroboros/qos.h
@@ -25,10 +25,12 @@
#include <stdint.h>
-/* FIXME: may need revision */
typedef struct qos_spec {
uint32_t delay;
uint32_t jitter;
+
+ /* FIXME: define qosspecs */
+ int cube;
} qosspec_t;
#endif
diff --git a/include/ouroboros/shared.h b/include/ouroboros/shared.h
index 86dc3ede..2592134a 100644
--- a/include/ouroboros/shared.h
+++ b/include/ouroboros/shared.h
@@ -24,7 +24,8 @@
/* FIXME: To be decided which QoS cubes we support */
typedef enum qos_cube {
- QOS_CUBE_BE = 0,
+ QOS_CUBE_FRC = 0,
+ QOS_CUBE_BE,
QOS_CUBE_VIDEO,
QOS_CUBE_MAX
} qoscube_t;
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 8c0bd0bf..a2dc9e8f 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -198,7 +198,7 @@ static void * ipcp_main_loop(void * o)
ipcpi.ops->ipcp_flow_alloc(fd,
msg->dst_name,
msg->src_ae_name,
- msg->qos_cube);
+ msg->qoscube);
break;
case IPCP_MSG_CODE__IPCP_FLOW_ALLOC_RESP:
if (ipcpi.ops->ipcp_flow_alloc_resp == NULL) {
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index dc4e84ca..de8c72c2 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -219,13 +219,10 @@ static int ipcp_local_name_query(char * name)
static int ipcp_local_flow_alloc(int fd,
char * dst_name,
char * src_ae_name,
- qoscube_t qos)
+ qoscube_t cube)
{
int out_fd = -1;
- /* This ipcpd has all QoS */
- (void) qos;
-
LOG_DBG("Allocating flow to %s on fd %d.", dst_name, fd);
assert(dst_name);
@@ -241,7 +238,7 @@ static int ipcp_local_flow_alloc(int fd,
pthread_rwlock_wrlock(&local_data.lock);
- out_fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name);
+ out_fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube);
local_data.in_out[fd] = out_fd;
local_data.in_out[out_fd] = fd;
diff --git a/src/ipcpd/normal/flow_alloc.proto b/src/ipcpd/normal/flow_alloc.proto
index 5041d31a..02be47a0 100644
--- a/src/ipcpd/normal/flow_alloc.proto
+++ b/src/ipcpd/normal/flow_alloc.proto
@@ -32,6 +32,6 @@ message flow_alloc_msg {
required flow_alloc_code code = 1;
optional string dst_name = 2;
optional string src_ae_name = 3;
- optional uint32 qos_cube = 4;
+ optional uint32 qoscube = 4;
optional sint32 response = 5;
};
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index d8190572..4b24d5a1 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -351,7 +351,7 @@ int fmgr_fini()
int fmgr_np1_alloc(int fd,
char * dst_ap_name,
char * src_ae_name,
- qoscube_t qos)
+ qoscube_t cube)
{
cep_id_t cep_id;
buffer_t buf;
@@ -391,8 +391,8 @@ int fmgr_np1_alloc(int fd,
msg.code = FLOW_ALLOC_CODE__FLOW_REQ;
msg.dst_name = dst_ap_name;
msg.src_ae_name = src_ae_name;
- msg.qos_cube = qos;
- msg.has_qos_cube = true;
+ msg.has_qoscube = true;
+ msg.qoscube = cube;
buf.len = flow_alloc_msg__get_packed_size(&msg);
if (buf.len == 0) {
@@ -410,7 +410,7 @@ int fmgr_np1_alloc(int fd,
pthread_rwlock_wrlock(&fmgr.np1_flows_lock);
- cep_id = frct_i_create(addr, &buf, qos);
+ cep_id = frct_i_create(addr, &buf, cube);
if (cep_id == INVALID_CEP_ID) {
free(ro_data);
free(buf.data);
@@ -535,7 +535,8 @@ int fmgr_np1_post_buf(cep_id_t cep_id, buffer_t * buf)
case FLOW_ALLOC_CODE__FLOW_REQ:
fd = ipcp_flow_req_arr(getpid(),
msg->dst_name,
- msg->src_ae_name);
+ msg->src_ae_name,
+ msg->qoscube);
if (fd < 0) {
flow_alloc_msg__free_unpacked(msg, NULL);
LOG_ERR("Failed to get fd for flow.");
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index da0bf97e..ab25ffb1 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -315,7 +315,8 @@ static int eth_llc_ipcp_send_mgmt_frame(shim_eth_llc_msg_t * msg,
static int eth_llc_ipcp_sap_alloc(uint8_t * dst_addr,
uint8_t ssap,
char * dst_name,
- char * src_ae_name)
+ char * src_ae_name,
+ qoscube_t cube)
{
shim_eth_llc_msg_t msg = SHIM_ETH_LLC_MSG__INIT;
@@ -324,6 +325,8 @@ static int eth_llc_ipcp_sap_alloc(uint8_t * dst_addr,
msg.ssap = ssap;
msg.dst_name = dst_name;
msg.src_ae_name = src_ae_name;
+ msg.has_qoscube = true;
+ msg.qoscube = cube;
return eth_llc_ipcp_send_mgmt_frame(&msg, dst_addr);
}
@@ -349,7 +352,8 @@ static int eth_llc_ipcp_sap_alloc_resp(uint8_t * dst_addr,
static int eth_llc_ipcp_sap_req(uint8_t r_sap,
uint8_t * r_addr,
char * dst_name,
- char * src_ae_name)
+ char * src_ae_name,
+ qoscube_t cube)
{
int fd;
@@ -357,7 +361,7 @@ static int eth_llc_ipcp_sap_req(uint8_t r_sap,
pthread_rwlock_wrlock(&eth_llc_data.flows_lock);
/* reply to IRM */
- fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name);
+ fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube);
if (fd < 0) {
pthread_rwlock_unlock(&eth_llc_data.flows_lock);
pthread_rwlock_unlock(&ipcpi.state_lock);
@@ -464,7 +468,8 @@ static int eth_llc_ipcp_mgmt_frame(uint8_t * buf, size_t len, uint8_t * r_addr)
eth_llc_ipcp_sap_req(msg->ssap,
r_addr,
msg->dst_name,
- msg->src_ae_name);
+ msg->src_ae_name,
+ msg->qoscube);
}
break;
case SHIM_ETH_LLC_MSG_CODE__FLOW_REPLY:
@@ -934,7 +939,7 @@ static int eth_llc_ipcp_name_query(char * name)
static int eth_llc_ipcp_flow_alloc(int fd,
char * dst_name,
char * src_ae_name,
- qoscube_t qos)
+ qoscube_t cube)
{
uint8_t ssap = 0;
uint8_t r_addr[MAC_SIZE];
@@ -945,8 +950,10 @@ static int eth_llc_ipcp_flow_alloc(int fd,
if (dst_name == NULL || src_ae_name == NULL)
return -1;
- if (qos != QOS_CUBE_BE)
- LOG_DBG("QoS requested. Ethernet LLC can't do that. For now.");
+ if (cube != QOS_CUBE_BE && cube != QOS_CUBE_FRC) {
+ LOG_DBG("Unsupported QoS requested.");
+ return -1;
+ }
pthread_rwlock_rdlock(&ipcpi.state_lock);
@@ -983,7 +990,8 @@ static int eth_llc_ipcp_flow_alloc(int fd,
if (eth_llc_ipcp_sap_alloc(r_addr,
ssap,
dst_name,
- src_ae_name) < 0) {
+ src_ae_name,
+ cube) < 0) {
pthread_rwlock_rdlock(&ipcpi.state_lock);
pthread_rwlock_wrlock(&eth_llc_data.flows_lock);
bmp_release(eth_llc_data.saps, eth_llc_data.fd_to_ef[fd].sap);
diff --git a/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto b/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto
index 9eebf610..63ab4519 100644
--- a/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto
+++ b/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto
@@ -35,5 +35,6 @@ message shim_eth_llc_msg {
optional string src_ae_name = 3;
optional uint32 ssap = 4;
optional uint32 dsap = 5;
- optional sint32 response = 6;
+ optional uint32 qoscube = 6;
+ optional sint32 response = 7;
};
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index cdd02c49..12f586f0 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -196,10 +196,11 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, uint32_t dst_ip_addr)
return 0;
}
-static int ipcp_udp_port_alloc(uint32_t dst_ip_addr,
- uint16_t src_udp_port,
- char * dst_name,
- char * src_ae_name)
+static int ipcp_udp_port_alloc(uint32_t dst_ip_addr,
+ uint16_t src_udp_port,
+ char * dst_name,
+ char * src_ae_name,
+ qoscube_t cube)
{
shim_udp_msg_t msg = SHIM_UDP_MSG__INIT;
@@ -207,6 +208,8 @@ static int ipcp_udp_port_alloc(uint32_t dst_ip_addr,
msg.src_udp_port = src_udp_port;
msg.dst_name = dst_name;
msg.src_ae_name = src_ae_name;
+ msg.has_qoscube = true;
+ msg.qoscube = cube;
return send_shim_udp_msg(&msg, dst_ip_addr);
}
@@ -229,8 +232,9 @@ static int ipcp_udp_port_alloc_resp(uint32_t dst_ip_addr,
}
static int ipcp_udp_port_req(struct sockaddr_in * c_saddr,
- char * dst_name,
- char * src_ae_name)
+ char * dst_name,
+ char * src_ae_name,
+ qoscube_t cube)
{
int skfd;
int fd;
@@ -273,7 +277,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr,
pthread_rwlock_wrlock(&udp_data.flows_lock);
/* reply to IRM */
- fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name);
+ fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube);
if (fd < 0) {
pthread_rwlock_unlock(&udp_data.flows_lock);
pthread_rwlock_unlock(&ipcpi.state_lock);
@@ -395,7 +399,8 @@ static void * ipcp_udp_listener(void * o)
c_saddr.sin_port = msg->src_udp_port;
ipcp_udp_port_req(&c_saddr,
msg->dst_name,
- msg->src_ae_name);
+ msg->src_ae_name,
+ msg->qoscube);
break;
case SHIM_UDP_MSG_CODE__FLOW_REPLY:
ipcp_udp_port_alloc_reply(msg->src_udp_port,
@@ -947,7 +952,7 @@ static int ipcp_udp_name_query(char * name)
static int ipcp_udp_flow_alloc(int fd,
char * dst_name,
char * src_ae_name,
- qoscube_t qos)
+ qoscube_t cube)
{
struct sockaddr_in r_saddr; /* server address */
struct sockaddr_in f_saddr; /* flow */
@@ -966,8 +971,10 @@ static int ipcp_udp_flow_alloc(int fd,
return -1;
}
- if (qos != QOS_CUBE_BE)
- LOG_DBG("QoS requested. UDP/IP can't do that.");
+ if (cube != QOS_CUBE_BE && cube != QOS_CUBE_FRC) {
+ LOG_DBG("Unsupported QoS requested.");
+ return -1;
+ }
skfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
@@ -1030,7 +1037,8 @@ static int ipcp_udp_flow_alloc(int fd,
if (ipcp_udp_port_alloc(ip_addr,
f_saddr.sin_port,
dst_name,
- src_ae_name) < 0) {
+ src_ae_name,
+ cube) < 0) {
pthread_rwlock_rdlock(&ipcpi.state_lock);
pthread_rwlock_wrlock(&udp_data.flows_lock);
diff --git a/src/ipcpd/shim-udp/shim_udp_messages.proto b/src/ipcpd/shim-udp/shim_udp_messages.proto
index f5a23b82..cc535a60 100644
--- a/src/ipcpd/shim-udp/shim_udp_messages.proto
+++ b/src/ipcpd/shim-udp/shim_udp_messages.proto
@@ -23,15 +23,16 @@
syntax = "proto2";
enum shim_udp_msg_code {
- FLOW_REQ = 1;
- FLOW_REPLY = 2;
+ FLOW_REQ = 1;
+ FLOW_REPLY = 2;
};
message shim_udp_msg {
- required shim_udp_msg_code code = 1;
- optional string dst_name = 2;
- optional string src_ae_name = 4;
- required uint32 src_udp_port = 5;
- optional uint32 dst_udp_port = 6;
- optional sint32 response = 7;
+ required shim_udp_msg_code code = 1;
+ optional string dst_name = 2;
+ optional string src_ae_name = 4;
+ required uint32 src_udp_port = 5;
+ optional uint32 dst_udp_port = 6;
+ optional uint32 qoscube = 7;
+ optional sint32 response = 8;
};
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index a3e6eff8..07ae0dc2 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -330,7 +330,7 @@ int ipcp_flow_alloc(pid_t api,
pid_t n_api,
char * dst_name,
char * src_ae_name,
- qoscube_t qos)
+ qoscube_t cube)
{
ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
@@ -346,8 +346,8 @@ int ipcp_flow_alloc(pid_t api,
msg.api = n_api;
msg.src_ae_name = src_ae_name;
msg.dst_name = dst_name;
- msg.has_qos_cube = true;
- msg.qos_cube = qos;
+ msg.has_qoscube = true;
+ msg.qoscube = cube;
recv_msg = send_recv_ipcp_msg(api, &msg);
if (recv_msg == NULL)
diff --git a/src/irmd/main.c b/src/irmd/main.c
index c42f2d3c..30602123 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -944,7 +944,9 @@ static int api_announce(pid_t api, char * apn)
return 0;
}
-static struct irm_flow * flow_accept(pid_t api, char ** dst_ae_name)
+static struct irm_flow * flow_accept(pid_t api,
+ char ** dst_ae_name,
+ qoscube_t * cube)
{
struct irm_flow * f = NULL;
struct api_entry * e = NULL;
@@ -1028,6 +1030,8 @@ static struct irm_flow * flow_accept(pid_t api, char ** dst_ae_name)
return NULL;
}
+ *cube = re->qos;
+
if (dst_ae_name != NULL)
*dst_ae_name = re->req_ae_name;
@@ -1110,18 +1114,15 @@ static int flow_alloc_resp(pid_t n_api,
return ret;
}
-static struct irm_flow * flow_alloc(pid_t api,
- char * dst_name,
- char * src_ae_name,
- qosspec_t * qos)
+static struct irm_flow * flow_alloc(pid_t api,
+ char * dst_name,
+ char * src_ae_name,
+ qoscube_t cube)
{
struct irm_flow * f;
pid_t ipcp;
int port_id;
- /* FIXME: Map qosspec to qos_cube */
- (void) qos;
-
pthread_rwlock_rdlock(&irmd->state_lock);
if (irmd->state != IRMD_RUNNING) {
@@ -1164,7 +1165,7 @@ static struct irm_flow * flow_alloc(pid_t api,
pthread_rwlock_unlock(&irmd->state_lock);
if (ipcp_flow_alloc(ipcp, port_id, api,
- dst_name, src_ae_name, QOS_CUBE_BE) < 0) {
+ dst_name, src_ae_name, cube) < 0) {
pthread_rwlock_rdlock(&irmd->state_lock);
pthread_rwlock_wrlock(&irmd->flows_lock);
list_del(&f->next);
@@ -1314,7 +1315,8 @@ static pid_t auto_execute(char ** argv)
static struct irm_flow * flow_req_arr(pid_t api,
char * dst_name,
- char * ae_name)
+ char * ae_name,
+ qoscube_t cube)
{
struct reg_entry * re = NULL;
struct apn_entry * a = NULL;
@@ -1425,6 +1427,7 @@ static struct irm_flow * flow_req_arr(pid_t api,
pthread_rwlock_rdlock(&irmd->reg_lock);
re->req_ae_name = ae_name;
+ re->qos = cube;
reg_entry_set_state(re, REG_NAME_FLOW_ARRIVED);
e = api_table_get(&irmd->api_table, h_api);
@@ -1872,7 +1875,10 @@ void * mainloop(void * o)
msg->n_dif_name);
break;
case IRM_MSG_CODE__IRM_FLOW_ACCEPT:
- e = flow_accept(msg->api, &ret_msg.ae_name);
+ ret_msg.has_qoscube = true;
+ e = flow_accept(msg->api,
+ &ret_msg.ae_name,
+ (qoscube_t *) &ret_msg.qoscube);
if (e == NULL) {
ret_msg.has_result = true;
ret_msg.result = -1;
@@ -1893,7 +1899,7 @@ void * mainloop(void * o)
e = flow_alloc(msg->api,
msg->dst_name,
msg->ae_name,
- NULL);
+ msg->qoscube);
if (e == NULL) {
ret_msg.has_result = true;
ret_msg.result = -1;
@@ -1915,7 +1921,8 @@ void * mainloop(void * o)
case IRM_MSG_CODE__IPCP_FLOW_REQ_ARR:
e = flow_req_arr(msg->api,
msg->dst_name,
- msg->ae_name);
+ msg->ae_name,
+ msg->qoscube);
if (e == NULL) {
ret_msg.has_result = true;
ret_msg.result = -1;
diff --git a/src/irmd/registry.h b/src/irmd/registry.h
index 1cb1d921..20c06a51 100644
--- a/src/irmd/registry.h
+++ b/src/irmd/registry.h
@@ -25,6 +25,7 @@
#include <ouroboros/config.h>
#include <ouroboros/list.h>
#include <ouroboros/irm_config.h>
+#include <ouroboros/shared.h>
#include "api_table.h"
#include "apn_table.h"
@@ -62,6 +63,7 @@ struct reg_entry {
enum reg_name_state state;
char * req_ae_name;
+ qoscube_t qos;
int response;
pthread_cond_t state_cond;
pthread_mutex_t state_lock;
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 3a1df16d..91fc3c0a 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -133,7 +133,7 @@ struct flow {
struct shm_flow_set * set;
int port_id;
int oflags;
- qoscube_t qos;
+ qoscube_t cube;
pid_t api;
@@ -158,6 +158,23 @@ struct {
pthread_rwlock_t flows_lock;
} ai;
+/* FIXME: translate real spec to cube */
+static qoscube_t spec_to_cube(qosspec_t * spec)
+{
+ if (spec == NULL)
+ return QOS_CUBE_BE;
+
+ return spec->cube;
+}
+
+/* FIXME: fill real spec */
+static void fill_qosspec(qosspec_t * spec, qoscube_t cube)
+{
+ assert(spec);
+
+ spec->cube = cube;
+}
+
static int api_announce(char * ap_name)
{
irm_msg_t msg = IRM_MSG__INIT;
@@ -214,7 +231,7 @@ static void reset_flow(int fd)
ai.flows[fd].oflags = 0;
ai.flows[fd].api = -1;
ai.flows[fd].timesout = false;
- ai.flows[fd].qos = QOS_CUBE_BE;
+ ai.flows[fd].cube = QOS_CUBE_BE;
}
int ap_init(char * ap_name)
@@ -269,7 +286,7 @@ int ap_init(char * ap_name)
ai.flows[i].oflags = 0;
ai.flows[i].api = -1;
ai.flows[i].timesout = false;
- ai.flows[i].qos = QOS_CUBE_BE;
+ ai.flows[i].cube = QOS_CUBE_BE;
}
ai.ports = malloc(sizeof(*ai.ports) * IRMD_MAX_FLOWS);
@@ -340,14 +357,12 @@ void ap_fini()
pthread_rwlock_destroy(&ai.data_lock);
}
-int flow_accept(char ** ae_name, qosspec_t * qos)
+int flow_accept(char ** ae_name, qosspec_t * spec)
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg = NULL;
int fd = -1;
- (void) qos;
-
msg.code = IRM_MSG_CODE__IRM_FLOW_ACCEPT;
msg.has_api = true;
@@ -420,6 +435,10 @@ int flow_accept(char ** ae_name, qosspec_t * qos)
ai.flows[fd].port_id = recv_msg->port_id;
ai.flows[fd].oflags = FLOW_O_DEFAULT;
ai.flows[fd].api = recv_msg->api;
+ ai.flows[fd].cube = recv_msg->qoscube;
+
+ if (spec != NULL)
+ fill_qosspec(spec, ai.flows[fd].cube);
ai.ports[recv_msg->port_id].fd = fd;
ai.ports[recv_msg->port_id].state = PORT_ID_ASSIGNED;
@@ -479,15 +498,12 @@ int flow_alloc_resp(int fd, int response)
return ret;
}
-int flow_alloc(char * dst_name, char * src_ae_name, qosspec_t * qos)
+int flow_alloc(char * dst_name, char * src_ae_name, qosspec_t * spec)
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg = NULL;
int fd = -1;
- /* FIXME: add qos support */
- (void) qos;
-
if (dst_name == NULL)
return -EINVAL;
@@ -498,6 +514,8 @@ int flow_alloc(char * dst_name, char * src_ae_name, qosspec_t * qos)
msg.dst_name = dst_name;
msg.ae_name = src_ae_name;
msg.has_api = true;
+ msg.has_qoscube = true;
+ msg.qoscube = spec_to_cube(spec);
pthread_rwlock_rdlock(&ai.data_lock);
@@ -553,6 +571,7 @@ int flow_alloc(char * dst_name, char * src_ae_name, qosspec_t * qos)
ai.flows[fd].port_id = recv_msg->port_id;
ai.flows[fd].oflags = FLOW_O_DEFAULT;
ai.flows[fd].api = recv_msg->api;
+ ai.flows[fd].cube = recv_msg->qoscube;
ai.ports[recv_msg->port_id].fd = fd;
ai.ports[recv_msg->port_id].state = PORT_ID_ASSIGNED;
@@ -779,7 +798,7 @@ int flow_get_qosspec(int fd, qosspec_t * spec)
return -ENOTALLOC;
}
- /* FIXME: map cube to spec */
+ fill_qosspec(spec, ai.flows[fd].cube);
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
@@ -1201,7 +1220,10 @@ int ipcp_create_r(pid_t api)
return ret;
}
-int ipcp_flow_req_arr(pid_t api, char * dst_name, char * src_ae_name)
+int ipcp_flow_req_arr(pid_t api,
+ char * dst_name,
+ char * src_ae_name,
+ qoscube_t cube)
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg = NULL;
@@ -1211,11 +1233,13 @@ int ipcp_flow_req_arr(pid_t api, char * dst_name, char * src_ae_name)
if (dst_name == NULL || src_ae_name == NULL)
return -EINVAL;
- msg.code = IRM_MSG_CODE__IPCP_FLOW_REQ_ARR;
- msg.has_api = true;
- msg.api = api;
- msg.dst_name = dst_name;
- msg.ae_name = src_ae_name;
+ msg.code = IRM_MSG_CODE__IPCP_FLOW_REQ_ARR;
+ msg.has_api = true;
+ msg.api = api;
+ msg.dst_name = dst_name;
+ msg.ae_name = src_ae_name;
+ msg.has_qoscube = true;
+ msg.qoscube = cube;
pthread_rwlock_rdlock(&ai.data_lock);
pthread_rwlock_wrlock(&ai.flows_lock);
@@ -1432,7 +1456,7 @@ int ipcp_flow_get_qoscube(int fd, qoscube_t * cube)
return -ENOTALLOC;
}
- *cube = ai.flows[fd].qos;
+ *cube = ai.flows[fd].cube;
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto
index b5dd5370..09e959fa 100644
--- a/src/lib/ipcpd_messages.proto
+++ b/src/lib/ipcpd_messages.proto
@@ -45,7 +45,7 @@ message ipcp_msg {
optional sint32 port_id = 6;
optional string dst_name = 7;
optional string src_ae_name = 8;
- optional sint32 qos_cube = 9;
+ optional sint32 qoscube = 9;
optional dif_config_msg conf = 10;
optional sint32 fd = 11;
optional sint32 api = 12;
diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto
index fad6fbf1..74d08f9b 100644
--- a/src/lib/irmd_messages.proto
+++ b/src/lib/irmd_messages.proto
@@ -59,8 +59,9 @@ message irm_msg {
optional sint32 response = 8;
optional string dst_name = 9;
optional sint32 port_id = 10;
- optional dif_config_msg conf = 11;
- optional uint32 opts = 12;
- repeated sint32 apis = 13;
- optional sint32 result = 14;
+ optional sint32 qoscube = 11;
+ optional dif_config_msg conf = 12;
+ optional uint32 opts = 13;
+ repeated sint32 apis = 14;
+ optional sint32 result = 15;
};