diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2019-08-21 10:51:21 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-09-09 14:29:48 +0000 |
commit | 546f955b3dad6c0866a8ba778d0cfe1ef43d81d4 (patch) | |
tree | 6113bab6ae3dec547b6cc6467b0fb8db114e7728 /src/plugins/memif/memif.api | |
parent | bdf3ebe358787ef240dc9fadc515dfd178dfef7b (diff) |
memif: API cleanup
Use consistent API types.
memif_create now enables zero-copy by default.
Add no_zero_copy param to memif_create which
if set, disables zero copy.
Type: refactor
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Change-Id: I11df8b9212c40de179ee71dc9da14039b982ede5
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/plugins/memif/memif.api')
-rw-r--r-- | src/plugins/memif/memif.api | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/src/plugins/memif/memif.api b/src/plugins/memif/memif.api index 6a61ee110ae..4c4b587aac7 100644 --- a/src/plugins/memif/memif.api +++ b/src/plugins/memif/memif.api @@ -1,3 +1,4 @@ +/* Hey Emacs use -*- mode: C -*- */ /* * Copyright (c) 2017 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,23 @@ * limitations under the License. */ -option version = "2.0.0"; +option version = "3.0.0"; + +import "vnet/interface_types.api"; +import "vnet/ethernet/ethernet_types.api"; + +enum memif_role +{ + MEMIF_ROLE_API_MASTER = 0, + MEMIF_ROLE_API_SLAVE = 1, +}; + +enum memif_mode +{ + MEMIF_MODE_API_ETHERNET = 0, + MEMIF_MODE_API_IP = 1, + MEMIF_MODE_API_PUNT_INJECT = 2, +}; /** \brief Create or remove named socket file for memif interfaces @param client_index - opaque cookie to identify the sender @@ -28,9 +45,9 @@ autoreply define memif_socket_filename_add_del { u32 client_index; u32 context; - u8 is_add; /* 0 = remove, 1 = add association */ + bool is_add; /* 0 = remove, 1 = add association */ u32 socket_id; /* unique non-0 id for given socket file name */ - u8 socket_filename[128]; /* NUL terminated filename */ + string socket_filename[108]; /* NUL terminated filename */ }; /** \brief Create memory interface @@ -46,23 +63,26 @@ autoreply define memif_socket_filename_add_del establishment @param ring_size - the number of entries of RX/TX rings @param buffer_size - size of the buffer allocated for each ring entry + @param no_zero_copy - if true, disable zero copy @param hw_addr - interface MAC address + @param secret - optional, default is "", max length 24 */ define memif_create { u32 client_index; u32 context; - u8 role; /* 0 = master, 1 = slave */ - u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */ + vl_api_memif_role_t role; /* 0 = master, 1 = slave */ + vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */ u8 rx_queues; /* optional, default is 1 */ u8 tx_queues; /* optional, default is 1 */ u32 id; /* optional, default is 0 */ u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */ - u8 secret[24]; /* optional, default is "" */ u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */ u16 buffer_size; /* optional, default is 2048 bytes */ - u8 hw_addr[6]; /* optional, randomly generated if not defined */ + bool no_zero_copy; /* disable zero copy */ + vl_api_mac_address_t hw_addr; /* optional, randomly generated if zero */ + string secret[24]; /* optional, default is "", max length 24 */ }; /** \brief Create memory interface response @@ -74,7 +94,7 @@ define memif_create_reply { u32 context; i32 retval; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** \brief Delete memory interface @@ -87,7 +107,7 @@ autoreply define memif_delete u32 client_index; u32 context; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** \brief Memory interface details structure @@ -99,7 +119,7 @@ define memif_socket_filename_details { u32 context; u32 socket_id; - u8 socket_filename[128]; + string socket_filename[108]; }; /** \brief Dump the table of socket ids and corresponding filenames @@ -115,38 +135,38 @@ define memif_socket_filename_dump /** \brief Memory interface details structure @param context - sender context, to match reply w/ request (memif_dump) @param sw_if_index - index of the interface - @param if_name - name of the interface @param hw_addr - interface MAC address @param id - id associated with the interface @param role - role of the interface in the connection (master/slave) @param mode - interface mode + @param zero_copy - zero copy flag present @param socket_id - id of the socket filename used by this interface to establish new connections @param ring_size - the number of entries of RX/TX rings @param buffer_size - size of the buffer allocated for each ring entry - @param admin_up_down - interface administrative status - @param link_up_down - interface link status + @param flags - interface_status flags + @param if_name - name of the interface */ define memif_details { u32 context; - u32 sw_if_index; - u8 if_name[64]; - u8 hw_addr[6]; + vl_api_interface_index_t sw_if_index; + vl_api_mac_address_t hw_addr; /* memif specific parameters */ u32 id; - u8 role; /* 0 = master, 1 = slave */ - u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */ + vl_api_memif_role_t role; /* 0 = master, 1 = slave */ + vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */ + bool zero_copy; u32 socket_id; u32 ring_size; u16 buffer_size; /* optional, default is 2048 bytes */ - /* 1 = up, 0 = down */ - u8 admin_up_down; - u8 link_up_down; + vl_api_if_status_flags_t flags; + + string if_name[64]; }; /** \brief Dump all memory interfaces |