diff options
| author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-08 16:34:19 +0200 | 
|---|---|---|
| committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-08 16:34:19 +0200 | 
| commit | 5812dfb832e513dc455a0d48624bcad62334d457 (patch) | |
| tree | 93a02e1b20f54bb869eadc856f201412c633315c /include | |
| parent | de8f2015cbd015b1cced366cb12c054be62c23b1 (diff) | |
| parent | 021af9e01ce6c6376534b33ef1a06ea4189028d4 (diff) | |
| download | ouroboros-5812dfb832e513dc455a0d48624bcad62334d457.tar.gz ouroboros-5812dfb832e513dc455a0d48624bcad62334d457.zip | |
Merged in dstaesse/ouroboros/be-fast-path (pull request #65)
irmd: flow allocation and fast path
Diffstat (limited to 'include')
| -rw-r--r-- | include/ouroboros/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | include/ouroboros/dev.h | 19 | ||||
| -rw-r--r-- | include/ouroboros/flow.h | 43 | ||||
| -rw-r--r-- | include/ouroboros/ipcp.h | 4 | ||||
| -rw-r--r-- | include/ouroboros/shm_ap_rbuff.h | 52 | ||||
| -rw-r--r-- | include/ouroboros/shm_du_map.h | 21 | ||||
| -rw-r--r-- | include/ouroboros/utils.h | 1 | 
7 files changed, 127 insertions, 14 deletions
| diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index cfa299ca..6a247e8e 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -15,6 +15,7 @@ set(HEADER_FILES          irm.h          list.h          logs.h +        shm_ap_rbuff.h          shm_du_map.h          sockets.h          utils.h diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index 414273ef..e857e211 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -24,29 +24,34 @@  #define OUROBOROS_DEV_H  #include <ouroboros/common.h> +#include <ouroboros/flow.h>  #define UNKNOWN_AP "__UNKNOWN_AP__"  #define UNKNOWN_AE "__UNKNOWN_AE__" +/* These calls should be removed once we write the ouroboros OS. */ +int     ap_init(char * ap_name); +void    ap_fini(); +  /* Returns file descriptor */ -int     ap_reg(char * ap_name, char ** difs, size_t difs_size); -int     ap_unreg(char * ap_name, char ** difs, size_t difs_size); +int     ap_reg(char ** difs, size_t difs_size); +int     ap_unreg(char ** difs, size_t difs_size);  /* Returns file descriptor (> 0) and client name(s) */ -int     flow_accept(int fd, char * ap_name, char * ae_name); +int     flow_accept(int fd, char ** ap_name, char ** ae_name);  int     flow_alloc_resp(int fd, int result);  /* Returns file descriptor */ -int     flow_alloc(char * dst_ap_name, char * src_ap_name, -                   char * src_ae_name, struct qos_spec * qos, -                   int oflags); +int     flow_alloc(char * dst_name, +                   char * src_ae_name, +                   struct qos_spec * qos);  /* If flow is accepted returns a value > 0 */  int     flow_alloc_res(int fd);  int     flow_dealloc(int fd);  /* Wraps around fnctl */ -int     flow_cntl(int fd, int oflags); +int     flow_cntl(int fd, int cmd, int oflags);  ssize_t flow_write(int fd, void * buf, size_t count);  ssize_t flow_read(int fd, void * buf, size_t count); diff --git a/include/ouroboros/flow.h b/include/ouroboros/flow.h new file mode 100644 index 00000000..ff9085f7 --- /dev/null +++ b/include/ouroboros/flow.h @@ -0,0 +1,43 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * Flows + * + *    Dimitri Staessens <dimitri.staessens@intec.ugent.be> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef OUROBOROS_FLOW_H +#define OUROBOROS_FLOW_H + +/* same values as fcntl.h */ +#define FLOW_O_RDONLY   00000000 +#define FLOW_O_WRONLY   00000001 +#define FLOW_O_RDWR     00000002 +#define FLOW_O_ACCMODE  00000003 + +#define FLOW_O_NONBLOCK 00004000 +#define FLOW_O_DEFAULT  00000002 + +#define FLOW_O_INVALID  (FLOW_O_WRONLY | FLOW_O_RDWR) + +enum flow_state { +        FLOW_NULL = 0, +        FLOW_ALLOCATED, +        FLOW_PENDING +}; + +#endif /* OUROBOROS_FLOW_H */ diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index e3c17bda..570eca67 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -61,13 +61,15 @@ int   ipcp_name_unreg(pid_t    pid,  int   ipcp_flow_alloc(pid_t             pid,                        uint32_t          port_id, +                      pid_t             n_pid,                        char *            dst_name,                        char *            src_ap_name,                        char *            src_ae_name,                        struct qos_spec * qos);  int   ipcp_flow_alloc_resp(pid_t    pid,                             uint32_t port_id, -                           int      result); +                           pid_t    n_pid, +                           int      response);  /* These operations go from the IPCP to the IRMd */ diff --git a/include/ouroboros/shm_ap_rbuff.h b/include/ouroboros/shm_ap_rbuff.h new file mode 100644 index 00000000..0ee3e81e --- /dev/null +++ b/include/ouroboros/shm_ap_rbuff.h @@ -0,0 +1,52 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * Ring buffer for application processes + * + *    Dimitri Staessens <dimitri.staessens@intec.ugent.be> + *    Sander Vrijders   <sander.vrijders@intec.ugent.be> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef OUROBOROS_SHM_AP_RBUFF_H +#define OUROBOROS_SHM_AP_RBUFF_H + +#ifndef SHM_AP_RBUFF +#define SHM_AP_RBUFF_PREFIX "ouroboros_rb_" +#endif + +#ifndef SHM_RBUFF_SIZE +#define SHM_RBUFF_SIZE (1 << 12) +#endif + +#include <sys/types.h> + +struct shm_ap_rbuff; + +struct rb_entry { +        size_t index; +        int    port_id; +}; + +struct shm_ap_rbuff * shm_ap_rbuff_create(); +struct shm_ap_rbuff * shm_ap_rbuff_open(); +void                  shm_ap_rbuff_close(struct shm_ap_rbuff * rb); +void                  shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb); +int                   shm_ap_rbuff_write(struct shm_ap_rbuff * rb, +                                         struct rb_entry * e); +struct rb_entry *     shm_ap_rbuff_read(); + +#endif /* OUROBOROS_SHM_AP_RBUFF_H */ diff --git a/include/ouroboros/shm_du_map.h b/include/ouroboros/shm_du_map.h index fb51768d..f575aa42 100644 --- a/include/ouroboros/shm_du_map.h +++ b/include/ouroboros/shm_du_map.h @@ -44,14 +44,23 @@ struct shm_du_map;  struct shm_du_map  * shm_du_map_create();  struct shm_du_map  * shm_du_map_open();  void                 shm_du_map_close(struct shm_du_map * dum); +void                 shm_du_map_destroy(struct shm_du_map * dum); -struct shm_du_buff * shm_create_du_buff(struct shm_du_map * dum, -                                        size_t              size, -                                        size_t              headspace, -                                        uint8_t           * data, -                                        size_t              len); -int                  shm_release_du_buff(struct shm_du_map  * dum); +/* returns the index of the buffer in the DU map */ +int shm_create_du_buff(struct shm_du_map * dum, +                       size_t              size, +                       size_t              headspace, +                       uint8_t           * data, +                       size_t              len); +/* FIXME: revise these */ +int       shm_du_map_read_sdu(uint8_t **           dst, +                               struct shm_du_map * dum, +                               size_t              idx); +int       shm_release_du_buff(struct shm_du_map  * dum, size_t idx); + + +/* FIXME: use shm_du_map * and index */  uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb,                                   size_t size);  uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb, diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index 2e5a4944..a1d2ac96 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -21,6 +21,7 @@   */  #define MAX(a,b) (a > b ? a : b) +#define MIN(a,b) (a < b ? a : b)  /*   * Returns the number of characters a uint would | 
