diff options
| author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-01-03 11:57:59 +0100 | 
|---|---|---|
| committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-01-03 12:12:49 +0100 | 
| commit | 5ab96126078cb9166356beaff3458404664274ed (patch) | |
| tree | 4734c9872a5b9b4b4cb12e9fab82bdb255a6591a /src/irmd | |
| parent | 4ccd3e2c8af00963ac6d88aac587de016300ed90 (diff) | |
| download | ouroboros-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.
Diffstat (limited to 'src/irmd')
| -rw-r--r-- | src/irmd/ipcp.c | 6 | ||||
| -rw-r--r-- | src/irmd/main.c | 33 | ||||
| -rw-r--r-- | src/irmd/registry.h | 2 | 
3 files changed, 25 insertions, 16 deletions
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;  | 
