aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c57
-rw-r--r--src/vat/vat.h24
-rw-r--r--src/vlibapi/api_types.h4
-rw-r--r--src/vnet/bonding/bond_api.c3
-rw-r--r--src/vnet/devices/tap/tapv2_api.c3
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c3
-rw-r--r--src/vnet/devices/virtio/virtio_api.c3
-rw-r--r--src/vnet/ethernet/ethernet_types_api.h1
-rw-r--r--src/vnet/interface.api221
-rw-r--r--src/vnet/interface_api.c112
-rw-r--r--src/vnet/interface_types.api45
-rw-r--r--src/vnet/ip/ip_types_api.h1
-rw-r--r--src/vpp-api/vapi/vapi_json_parser.py2
-rw-r--r--src/vpp/api/custom_dump.c35
14 files changed, 234 insertions, 280 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 99862681d5a..cef60e05725 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -934,11 +934,14 @@ static void vl_api_sw_interface_details_t_handler
sub->sw_if_index = ntohl (mp->sw_if_index);
sub->sub_id = ntohl (mp->sub_id);
- sub->raw_flags = ntohl (mp->sub_if_flags & SUB_IF_API_FLAG_MASK_VNET);
-
+ sub->sub_dot1ad = mp->sub_dot1ad;
sub->sub_number_of_tags = mp->sub_number_of_tags;
sub->sub_outer_vlan_id = ntohs (mp->sub_outer_vlan_id);
sub->sub_inner_vlan_id = ntohs (mp->sub_inner_vlan_id);
+ sub->sub_exact_match = mp->sub_exact_match;
+ sub->sub_default = mp->sub_default;
+ sub->sub_outer_vlan_id_any = mp->sub_outer_vlan_id_any;
+ sub->sub_inner_vlan_id_any = mp->sub_inner_vlan_id_any;
/* vlan tag rewrite */
sub->vtr_op = ntohl (mp->vtr_op);
@@ -965,28 +968,37 @@ static void vl_api_sw_interface_details_t_handler_json
vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
vat_json_object_add_uint (node, "sup_sw_if_index",
ntohl (mp->sup_sw_if_index));
+ vat_json_object_add_uint (node, "l2_address_length",
+ ntohl (mp->l2_address_length));
vat_json_object_add_bytes (node, "l2_address", mp->l2_address,
sizeof (mp->l2_address));
vat_json_object_add_string_copy (node, "interface_name",
- mp->interface_name.buf);
- vat_json_object_add_uint (node, "flags", mp->flags);
+ mp->interface_name);
+ vat_json_object_add_uint (node, "admin_up_down", mp->admin_up_down);
+ vat_json_object_add_uint (node, "link_up_down", mp->link_up_down);
vat_json_object_add_uint (node, "link_duplex", mp->link_duplex);
vat_json_object_add_uint (node, "link_speed", mp->link_speed);
vat_json_object_add_uint (node, "mtu", ntohs (mp->link_mtu));
vat_json_object_add_uint (node, "sub_id", ntohl (mp->sub_id));
+ vat_json_object_add_uint (node, "sub_dot1ad", mp->sub_dot1ad);
vat_json_object_add_uint (node, "sub_number_of_tags",
mp->sub_number_of_tags);
vat_json_object_add_uint (node, "sub_outer_vlan_id",
ntohs (mp->sub_outer_vlan_id));
vat_json_object_add_uint (node, "sub_inner_vlan_id",
ntohs (mp->sub_inner_vlan_id));
- vat_json_object_add_uint (node, "sub_if_flags", ntohl (mp->sub_if_flags));
+ vat_json_object_add_uint (node, "sub_exact_match", mp->sub_exact_match);
+ vat_json_object_add_uint (node, "sub_default", mp->sub_default);
+ vat_json_object_add_uint (node, "sub_outer_vlan_id_any",
+ mp->sub_outer_vlan_id_any);
+ vat_json_object_add_uint (node, "sub_inner_vlan_id_any",
+ mp->sub_inner_vlan_id_any);
vat_json_object_add_uint (node, "vtr_op", ntohl (mp->vtr_op));
vat_json_object_add_uint (node, "vtr_push_dot1q",
ntohl (mp->vtr_push_dot1q));
vat_json_object_add_uint (node, "vtr_tag1", ntohl (mp->vtr_tag1));
vat_json_object_add_uint (node, "vtr_tag2", ntohl (mp->vtr_tag2));
- if (ntohl (mp->sub_if_flags) & SUB_IF_API_FLAG_DOT1AH)
+ if (mp->sub_dot1ah)
{
vat_json_object_add_string_copy (node, "pbb_vtr_dmac",
format (0, "%U",
@@ -1009,10 +1021,8 @@ static void vl_api_sw_interface_event_t_handler
if (vam->interface_event_display)
errmsg ("interface flags: sw_if_index %d %s %s",
ntohl (mp->sw_if_index),
- ((ntohl (mp->flags)) & IF_STATUS_API_FLAG_ADMIN_UP) ?
- "admin-up" : "admin-down",
- ((ntohl (mp->flags)) & IF_STATUS_API_FLAG_LINK_UP) ?
- "link-up" : "link-down");
+ mp->admin_up_down ? "admin-up" : "admin-down",
+ mp->link_up_down ? "link-up" : "link-down");
}
#endif
@@ -5992,7 +6002,7 @@ api_sw_interface_set_flags (vat_main_t * vam)
/* Construct the API message */
M (SW_INTERFACE_SET_FLAGS, mp);
mp->sw_if_index = ntohl (sw_if_index);
- mp->flags = ntohl ((admin_up) ? IF_STATUS_API_FLAG_ADMIN_UP : 0);
+ mp->admin_up_down = admin_up;
/* send it... */
S (mp);
@@ -6284,15 +6294,14 @@ api_sw_interface_add_del_address (vat_main_t * vam)
mp->del_all = del_all;
if (v6_address_set)
{
- mp->prefix.address.af = ADDRESS_IP6;
- clib_memcpy (mp->prefix.address.un.ip6, &v6address, sizeof (v6address));
+ mp->is_ipv6 = 1;
+ clib_memcpy (mp->address, &v6address, sizeof (v6address));
}
else
{
- mp->prefix.address.af = ADDRESS_IP4;
- clib_memcpy (mp->prefix.address.un.ip4, &v4address, sizeof (v4address));
+ clib_memcpy (mp->address, &v4address, sizeof (v4address));
}
- mp->prefix.address_length = address_length;
+ mp->address_length = address_length;
/* send it... */
S (mp);
@@ -9427,16 +9436,6 @@ _(default_sub) \
_(outer_vlan_id_any) \
_(inner_vlan_id_any)
-#define foreach_create_subif_flag \
-_(0, "no_tags") \
-_(1, "one_tag") \
-_(2, "two_tags") \
-_(3, "dot1ad") \
-_(4, "exact_match") \
-_(5, "default_sub") \
-_(6, "outer_vlan_id_any") \
-_(7, "inner_vlan_id_any")
-
static int
api_create_subif (vat_main_t * vam)
{
@@ -9499,8 +9498,8 @@ api_create_subif (vat_main_t * vam)
mp->sw_if_index = ntohl (sw_if_index);
mp->sub_id = ntohl (sub_id);
-#define _(a,b) mp->sub_if_flags |= (1 << a);
- foreach_create_subif_flag;
+#define _(a) mp->a = a;
+ foreach_create_subif_bit;
#undef _
mp->outer_vlan_id = ntohs (outer_vlan_id);
@@ -20828,7 +20827,7 @@ api_sw_interface_tag_add_del (vat_main_t * vam)
mp->sw_if_index = ntohl (sw_if_index);
mp->is_add = enable;
if (enable)
- vl_api_to_api_string (strlen ((char *) tag), tag, &mp->tag);
+ strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
vec_free (tag);
S (mp);
diff --git a/src/vat/vat.h b/src/vat/vat.h
index d380abeaf12..c9384a1ce57 100644
--- a/src/vat/vat.h
+++ b/src/vat/vat.h
@@ -47,27 +47,17 @@ typedef struct
*/
u32 sub_id;
+ /* 0 = dot1q, 1=dot1ad */
+ u8 sub_dot1ad;
+
/* Number of tags 0-2 */
u8 sub_number_of_tags;
u16 sub_outer_vlan_id;
u16 sub_inner_vlan_id;
-
- union
- {
- u16 raw_flags;
- struct
- {
- u16 no_tags:1;
- u16 one_tag:1;
- u16 two_tags:1;
- /* 0 = dot1q, 1=dot1ad */
- u16 sub_dot1ad:1;
- u16 sub_exact_match:1;
- u16 sub_default:1;
- u16 sub_outer_vlan_id_any:1;
- u16 sub_inner_vlan_id_any:1;
- };
- };
+ u8 sub_exact_match;
+ u8 sub_default;
+ u8 sub_outer_vlan_id_any;
+ u8 sub_inner_vlan_id_any;
/* vlan tag rewrite */
u32 vtr_op;
diff --git a/src/vlibapi/api_types.h b/src/vlibapi/api_types.h
index c4d8f3bd060..406ccfa6745 100644
--- a/src/vlibapi/api_types.h
+++ b/src/vlibapi/api_types.h
@@ -20,8 +20,6 @@
#ifndef included_api_types_h
#define included_api_types_h
-#include <stdbool.h>
-
#include <vppinfra/types.h>
#include <arpa/inet.h>
#include <string.h>
@@ -41,7 +39,7 @@ vl_api_to_api_string (u32 len, const char *buf, vl_api_string_t * str)
return len + sizeof (u32);
}
-/* Return a pointer to the API string (not nul terminated) */
+/* Return a pointer to the API string (not nul terminated */
static inline u8 *
vl_api_from_api_string (vl_api_string_t * astr)
{
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c
index 958e594a4b1..50bae5d528d 100644
--- a/src/vnet/bonding/bond_api.c
+++ b/src/vnet/bonding/bond_api.c
@@ -63,7 +63,8 @@ bond_send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
- mp->flags = 0;
+ mp->admin_up_down = 0;
+ mp->link_up_down = 0;
mp->deleted = 1;
vl_msg_api_send_shmem (q, (u8 *) & mp);
}
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index 8f1633ca91e..1260afdd24f 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -148,7 +148,8 @@ tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
- mp->flags = 0;
+ mp->admin_up_down = 0;
+ mp->link_up_down = 0;
mp->deleted = 1;
vl_api_send_msg (reg, (u8 *) mp);
}
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 8f0b9d90f53..acfb3e089f4 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -62,7 +62,8 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
- mp->flags = 0;
+ mp->admin_up_down = 0;
+ mp->link_up_down = 0;
mp->deleted = 1;
vl_api_send_msg (reg, (u8 *) mp);
}
diff --git a/src/vnet/devices/virtio/virtio_api.c b/src/vnet/devices/virtio/virtio_api.c
index b2ac471e9e9..5035799befe 100644
--- a/src/vnet/devices/virtio/virtio_api.c
+++ b/src/vnet/devices/virtio/virtio_api.c
@@ -97,7 +97,8 @@ virtio_pci_send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = htonl (sw_if_index);
- mp->flags = 0;
+ mp->admin_up_down = 0;
+ mp->link_up_down = 0;
mp->deleted = 1;
vl_api_send_msg (reg, (u8 *) mp);
}
diff --git a/src/vnet/ethernet/ethernet_types_api.h b/src/vnet/ethernet/ethernet_types_api.h
index 8bd8b7e514e..e2c638d1fec 100644
--- a/src/vnet/ethernet/ethernet_types_api.h
+++ b/src/vnet/ethernet/ethernet_types_api.h
@@ -21,7 +21,6 @@
*/
#include <vnet/ethernet/mac_address.h>
-#include <vlibapi/api_types.h>
extern void mac_address_decode (const u8 * in, mac_address_t * out);
extern void mac_address_encode (const mac_address_t * in, u8 * out);
diff --git a/src/vnet/interface.api b/src/vnet/interface.api
index cae2b65778e..1af323e0a44 100644
--- a/src/vnet/interface.api
+++ b/src/vnet/interface.api
@@ -14,11 +14,9 @@
* limitations under the License.
*/
-option version = "3.0.0";
+option version = "2.2.0";
import "vnet/interface_types.api";
-import "vnet/ethernet/ethernet_types.api";
-import "vnet/ip/ip_types.api";
service {
rpc want_interface_events returns want_interface_events_reply
@@ -29,15 +27,16 @@ service {
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param sw_if_index - index of the interface to set flags on
- @param flags - interface_status flags
- (only IF_STATUS_API_FLAG_ADMIN_UP used in config)
+ @param admin_up_down - set the admin state, 1 = up, 0 = down
+ @param link_up_down - Oper state sent on change event, not used in config.
*/
autoreply define sw_interface_set_flags
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- vl_api_if_status_flags_t flags;
+ u32 sw_if_index;
+ /* 1 = up, 0 = down */
+ u8 admin_up_down;
};
/** \brief Set interface physical MTU
@@ -50,7 +49,7 @@ autoreply define hw_interface_set_mtu
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u16 mtu;
};
@@ -59,8 +58,9 @@ autoreply define sw_interface_set_mtu
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
+ u32 sw_if_index;
+ /* $$$$ Replace with enum */
+ u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
};
/** \brief Set IP4 directed broadcast
@@ -73,8 +73,8 @@ autoreply define sw_interface_set_ip_directed_broadcast
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- bool enable;
+ u32 sw_if_index;
+ u8 enable;
};
@@ -82,16 +82,18 @@ autoreply define sw_interface_set_ip_directed_broadcast
@param client_index - opaque cookie to identify the sender
@param pid - client pid registered to receive notification
@param sw_if_index - index of the interface of the event
- @param flags - interface_status flags
+ @param admin_up_down - The administrative state; 1 = up, 0 = down
+ @param link_up_down - The operational state; 1 = up, 0 = down
@param deleted - interface was deleted
*/
define sw_interface_event
{
u32 client_index;
u32 pid;
- vl_api_interface_index_t sw_if_index;
- vl_api_if_status_flags_t flags;
- bool deleted;
+ u32 sw_if_index;
+ u8 admin_up_down;
+ u8 link_up_down;
+ u8 deleted;
};
/** \brief Register for interface events
@@ -108,19 +110,25 @@ autoreply define want_interface_events
u32 pid;
};
-/** \brief Interface details structure (fix this)
+/** \brief Interface details structure (fix this)
@param sw_if_index - index of the interface
- @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
- @param l2_address - the interface's l2 address
- @param flags - interface_status flags
+ @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
+ @param l2_address_length - length of the interface's l2 address
+ @param pid - the interface's l2 address
+ @param interface_name - name of the interface
@param link_duplex - 1 if half duplex, 2 if full duplex
@param link_speed - value in kbps
@param link_MTU - max. transmission unit
- @param sub_id - A number 0-N to uniquely identify this subif on super if
+ @param sub_if_id - A number 0-N to uniquely identify this subif on super if
+ @param sub_dot1ad - 0 = dot1q, 1 = dot1ad
+ @param sub_dot1ah - 1 = dot1ah, 0 = otherwise
@param sub_number_of_tags - Number of tags (0 - 2)
@param sub_outer_vlan_id
@param sub_inner_vlan_id
- @param sub_if_flags - sub interface flags
+ @param sub_exact_match
+ @param sub_default
+ @param sub_outer_vlan_id_any
+ @param sub_inner_vlan_id_any
@param vtr_op - vlan tag rewrite operation
@param vtr_push_dot1q
@param vtr_tag1
@@ -130,25 +138,29 @@ autoreply define want_interface_events
@param pbb_b_smac[6] - B-tag local mac address
@param pbb_b_vlanid - B-tag vlanid
@param pbb_i_sid - I-tag service id
- @param interface_name - name of the interface
- @param tag - an ascii tag
*/
define sw_interface_details
{
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
/* index of sup interface (e.g. hw interface).
equal to sw_if_index for super hw interface. */
u32 sup_sw_if_index;
/* Layer 2 address, if applicable */
- vl_api_mac_address_t l2_address;
+ u32 l2_address_length;
+ u8 l2_address[8];
+
+ /* Interface name */
+ u8 interface_name[64];
- vl_api_if_status_flags_t flags;
+ /* 1 = up, 0 = down */
+ u8 admin_up_down;
+ u8 link_up_down;
/* 1 = half duplex, 2 = full duplex */
- vl_api_link_duplex_t link_duplex;
+ u8 link_duplex;
/* link speed in kbps */
u32 link_speed;
@@ -157,34 +169,38 @@ define sw_interface_details
u16 link_mtu;
/* Per protocol MTUs */
- u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
+ u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
/* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
u32 sub_id;
+ /* 0 = dot1q, 1=dot1ad */
+ u8 sub_dot1ad;
+ /* 1 = dot1h, 1=otherwise */
+ u8 sub_dot1ah;
+
/* Number of tags 0-2 */
u8 sub_number_of_tags;
u16 sub_outer_vlan_id;
u16 sub_inner_vlan_id;
-
- vl_api_sub_if_flags_t sub_if_flags;
+ u8 sub_exact_match;
+ u8 sub_default;
+ u8 sub_outer_vlan_id_any;
+ u8 sub_inner_vlan_id_any;
/* vlan tag rewrite state */
u32 vtr_op;
u32 vtr_push_dot1q; // ethertype of first pushed tag is dot1q/dot1ad
u32 vtr_tag1; // first pushed tag
u32 vtr_tag2; // second pushed tag
-
+ u8 tag[64];
+
/* pbb tag rewrite info */
u16 outer_tag;
- vl_api_mac_address_t b_dmac;
- vl_api_mac_address_t b_smac;
+ u8 b_dmac[6];
+ u8 b_smac[6];
u16 b_vlanid;
u32 i_sid;
-
- /* Interface name */
- string interface_name;
- string tag;
};
/** \brief Request all or filtered subset of sw_interface_details
@@ -198,27 +214,30 @@ define sw_interface_dump
{
u32 client_index;
u32 context;
- bool name_filter_valid;
- string name_filter;
+ u8 name_filter_valid;
+ u8 name_filter[49];
};
/** \brief Set or delete one or all ip addresses on a specified interface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
- @param sw_if_index - index of the interface to add/del addresses
+ @param sw_if_index - index of the interface to add/del addresses
@param is_add - add address if non-zero, else delete
+ @param is_ipv6 - if non-zero the address is ipv6, else ipv4
@param del_all - if non-zero delete all addresses on the interface
- @param prefix - address + a prefix length for the implied connected route
+ @param address_length - address length in bytes, 4 for ip4, 16 for ip6
+ @param address - array of address bytes
*/
autoreply define sw_interface_add_del_address
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- bool is_add;
-
- bool del_all;
- vl_api_prefix_t prefix;
+ u32 sw_if_index;
+ u8 is_add;
+ u8 is_ipv6;
+ u8 del_all;
+ u8 address_length;
+ u8 address[16];
};
/** \brief Associate the specified interface with a fib table
@@ -232,8 +251,8 @@ autoreply define sw_interface_set_table
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- bool is_ipv6;
+ u32 sw_if_index;
+ u8 is_ipv6;
u32 vrf_id;
};
@@ -246,8 +265,8 @@ define sw_interface_get_table
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- bool is_ipv6;
+ u32 sw_if_index;
+ u8 is_ipv6;
};
/** \brief Reply to get_sw_interface_vrf
@@ -272,9 +291,9 @@ autoreply define sw_interface_set_unnumbered
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index; /* use this intfc address */
- vl_api_interface_index_t unnumbered_sw_if_index; /* on this interface */
- bool is_add;
+ u32 sw_if_index; /* use this intfc address */
+ u32 unnumbered_sw_if_index; /* on this interface */
+ u8 is_add;
};
/** \brief Clear interface statistics
@@ -286,7 +305,7 @@ autoreply define sw_interface_clear_stats
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Set / clear software interface tag
@@ -296,13 +315,13 @@ autoreply define sw_interface_clear_stats
@param add_del - 1 = add, 0 = delete
@param tag - an ascii tag
*/
-autoreply define sw_interface_tag_add_del
+autoreply define sw_interface_tag_add_del
{
- u32 client_index;
- u32 context;
- bool is_add;
- vl_api_interface_index_t sw_if_index;
- string tag;
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u32 sw_if_index;
+ u8 tag[64];
};
/** \brief Set an interface's MAC address
@@ -313,10 +332,10 @@ autoreply define sw_interface_tag_add_del
*/
autoreply define sw_interface_set_mac_address
{
- u32 client_index;
- u32 context;
- vl_api_interface_index_t sw_if_index;
- vl_api_mac_address_t mac_address;
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
+ u8 mac_address[6];
};
/** \brief Get interface's MAC address
@@ -326,9 +345,9 @@ autoreply define sw_interface_set_mac_address
*/
define sw_interface_get_mac_address
{
- u32 client_index;
- u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
};
/** \brief Reply for get interface's MAC address request
@@ -338,9 +357,9 @@ define sw_interface_get_mac_address
*/
define sw_interface_get_mac_address_reply
{
- u32 context;
- i32 retval;
- vl_api_mac_address_t mac_address;
+ u32 context;
+ i32 retval;
+ u8 mac_address[6];
};
/** \brief Set an interface's rx-mode
@@ -355,12 +374,12 @@ define sw_interface_get_mac_address_reply
*/
autoreply define sw_interface_set_rx_mode
{
- u32 client_index;
- u32 context;
- vl_api_interface_index_t sw_if_index;
- bool queue_id_valid;
- u32 queue_id;
- vl_api_rx_mode_t mode;
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
+ u8 queue_id_valid;
+ u32 queue_id;
+ u8 mode;
};
/** \brief Set an interface's rx-placement
@@ -378,10 +397,10 @@ autoreply define sw_interface_set_rx_placement
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u32 queue_id;
u32 worker_id;
- bool is_main;
+ u8 is_main;
};
/** \brief dump the rx queue placement of interface(s)
@@ -394,7 +413,7 @@ define sw_interface_rx_placement_dump
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief show the interface's queue - thread placement
@@ -416,10 +435,10 @@ define sw_interface_rx_placement_details
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u32 queue_id;
u32 worker_id;
- vl_api_rx_mode_t mode;
+ u8 mode;
};
/* Gross kludge, DGMS */
@@ -427,7 +446,7 @@ autoreply define interface_name_renumber
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u32 new_show_dev_instance;
};
@@ -435,10 +454,18 @@ define create_subif
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u32 sub_id;
- vl_api_sub_if_flags_t sub_if_flags;
+ /* These fields map directly onto the subif template */
+ u8 no_tags;
+ u8 one_tag;
+ u8 two_tags;
+ u8 dot1ad; // 0 = dot1q, 1=dot1ad
+ u8 exact_match;
+ u8 default_sub;
+ u8 outer_vlan_id_any;
+ u8 inner_vlan_id_any;
u16 outer_vlan_id;
u16 inner_vlan_id;
};
@@ -447,7 +474,7 @@ define create_subif_reply
{
u32 context;
i32 retval;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Create a new subinterface with the given vlan id
@@ -460,7 +487,7 @@ define create_vlan_subif
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
u32 vlan_id;
};
@@ -473,7 +500,7 @@ define create_vlan_subif_reply
{
u32 context;
i32 retval;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Delete sub interface request
@@ -484,7 +511,7 @@ define create_vlan_subif_reply
autoreply define delete_subif {
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Create loopback interface request
@@ -496,7 +523,7 @@ define create_loopback
{
u32 client_index;
u32 context;
- vl_api_mac_address_t mac_address;
+ u8 mac_address[6];
};
/** \brief Create loopback interface response
@@ -508,7 +535,7 @@ define create_loopback_reply
{
u32 context;
i32 retval;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Create loopback interface instance request
@@ -522,8 +549,8 @@ define create_loopback_instance
{
u32 client_index;
u32 context;
- vl_api_mac_address_t mac_address;
- bool is_specified;
+ u8 mac_address[6];
+ u8 is_specified;
u32 user_instance;
};
@@ -536,7 +563,7 @@ define create_loopback_instance_reply
{
u32 context;
i32 retval;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Delete loopback interface request
@@ -548,7 +575,7 @@ autoreply define delete_loopback
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
+ u32 sw_if_index;
};
/** \brief Enable or disable detailed interface stats
@@ -562,8 +589,8 @@ autoreply define collect_detailed_interface_stats
{
u32 client_index;
u32 context;
- vl_api_interface_index_t sw_if_index;
- bool enable_disable;
+ u32 sw_if_index;
+ u8 enable_disable;
};
/*
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index eb5b57346ce..bd5588e2625 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -31,11 +31,6 @@
#include <vnet/fib/fib_api.h>
#include <vnet/mfib/mfib_table.h>
-#include <vlibapi/api_types.h>
-
-#include <vnet/ip/ip_types_api.h>
-#include <vnet/ethernet/ethernet_types_api.h>
-
#define vl_typedefs /* define message structures */
#include <vnet/vnet_all_api_h.h>
#undef vl_typedefs
@@ -92,9 +87,7 @@ vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
VALIDATE_SW_IF_INDEX (mp);
- flags =
- ((ntohl (mp->flags)) & IF_STATUS_API_FLAG_ADMIN_UP) ?
- VNET_SW_INTERFACE_FLAG_ADMIN_UP : 0;
+ flags = mp->admin_up_down ? VNET_SW_INTERFACE_FLAG_ADMIN_UP : 0;
error = vnet_sw_interface_set_flags (vnm, ntohl (mp->sw_if_index), flags);
if (error)
@@ -200,24 +193,13 @@ send_sw_interface_details (vpe_api_main_t * am,
vnet_hw_interface_t *hi =
vnet_get_sup_hw_interface (am->vnet_main, swif->sw_if_index);
- uint32_t if_name_len = strlen ((char *) interface_name);
- u8 *tag = vnet_get_sw_interface_tag (vnet_get_main (), swif->sw_if_index);
- uint32_t tag_len = 0;
- if (tag != NULL)
- tag_len = strlen ((char *) tag);
- vl_api_sw_interface_details_t *mp =
- vl_msg_api_alloc (sizeof (*mp) + if_name_len + tag_len);
- clib_memset (mp, 0, sizeof (*mp) + if_name_len + tag_len);
+ vl_api_sw_interface_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DETAILS);
mp->sw_if_index = ntohl (swif->sw_if_index);
mp->sup_sw_if_index = ntohl (swif->sup_sw_if_index);
-
- mp->flags |= (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
- IF_STATUS_API_FLAG_ADMIN_UP : 0;
- mp->flags |= (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ?
- IF_STATUS_API_FLAG_LINK_UP : 0;
- mp->flags = ntohl (mp->flags);
-
+ mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0;
+ mp->link_up_down = (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ? 1 : 0;
mp->link_duplex = ((hi->flags & VNET_HW_INTERFACE_FLAG_DUPLEX_MASK) >>
VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT);
mp->link_speed = ntohl (hi->link_speed);
@@ -229,6 +211,9 @@ send_sw_interface_details (vpe_api_main_t * am,
mp->context = context;
+ strncpy ((char *) mp->interface_name,
+ (char *) interface_name, ARRAY_LEN (mp->interface_name) - 1);
+
/* Send the L2 address for ethernet physical intfcs */
if (swif->sup_sw_if_index == swif->sw_if_index
&& hi->hw_class_index == ethernet_hw_interface_class.index)
@@ -238,18 +223,22 @@ send_sw_interface_details (vpe_api_main_t * am,
ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
ASSERT (sizeof (mp->l2_address) >= sizeof (ei->address));
- mac_address_encode ((mac_address_t *) ei->address, mp->l2_address);
+ clib_memcpy (mp->l2_address, ei->address, sizeof (ei->address));
+ mp->l2_address_length = ntohl (sizeof (ei->address));
}
else if (swif->sup_sw_if_index != swif->sw_if_index)
{
vnet_sub_interface_t *sub = &swif->sub;
mp->sub_id = ntohl (sub->id);
+ mp->sub_dot1ad = sub->eth.flags.dot1ad;
mp->sub_number_of_tags =
sub->eth.flags.one_tag + sub->eth.flags.two_tags * 2;
mp->sub_outer_vlan_id = ntohs (sub->eth.outer_vlan_id);
mp->sub_inner_vlan_id = ntohs (sub->eth.inner_vlan_id);
- mp->sub_if_flags =
- ntohl (sub->eth.raw_flags & SUB_IF_API_FLAG_MASK_VNET);
+ mp->sub_exact_match = sub->eth.flags.exact_match;
+ mp->sub_default = sub->eth.flags.default_sub;
+ mp->sub_outer_vlan_id_any = sub->eth.flags.outer_vlan_id_any;
+ mp->sub_inner_vlan_id_any = sub->eth.flags.inner_vlan_id_any;
/* vlan tag rewrite data */
u32 vtr_op = L2_VTR_DISABLED;
@@ -283,19 +272,18 @@ send_sw_interface_details (vpe_api_main_t * am,
if (!l2pbb_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
&vtr_op, &outer_tag, &eth_hdr, &b_vlanid, &i_sid))
{
- mp->sub_if_flags |= ntohl (SUB_IF_API_FLAG_DOT1AH);
- mac_address_encode ((mac_address_t *) eth_hdr.dst_address, mp->b_dmac);
- mac_address_encode ((mac_address_t *) eth_hdr.src_address, mp->b_smac);
+ mp->sub_dot1ah = 1;
+ clib_memcpy (mp->b_dmac, eth_hdr.dst_address,
+ sizeof (eth_hdr.dst_address));
+ clib_memcpy (mp->b_smac, eth_hdr.src_address,
+ sizeof (eth_hdr.src_address));
mp->b_vlanid = b_vlanid;
mp->i_sid = i_sid;
}
- char *p = (char *) &mp->interface_name;
- p +=
- vl_api_to_api_string (if_name_len, (char *) interface_name,
- (vl_api_string_t *) p);
- if (tag != NULL)
- vl_api_to_api_string (tag_len, (char *) tag, (vl_api_string_t *) p);
+ u8 *tag = vnet_get_sw_interface_tag (vnet_get_main (), swif->sw_if_index);
+ if (tag)
+ strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
vl_api_send_msg (rp, (u8 *) mp);
}
@@ -319,8 +307,8 @@ vl_api_sw_interface_dump_t_handler (vl_api_sw_interface_dump_t * mp)
u8 *filter = 0, *name = 0;
if (mp->name_filter_valid)
{
- filter =
- format (0, "%s%c", vl_api_from_api_string_c (&mp->name_filter), 0);
+ mp->name_filter[ARRAY_LEN (mp->name_filter) - 1] = 0;
+ filter = format (0, "%s%c", mp->name_filter, 0);
}
char *strcasestr (char *, char *); /* lnx hdr file botch */
@@ -354,7 +342,6 @@ static void
int rv = 0;
u32 is_del;
clib_error_t *error = 0;
- ip46_address_t address;
VALIDATE_SW_IF_INDEX (mp);
@@ -363,14 +350,14 @@ static void
if (mp->del_all)
ip_del_all_interface_addresses (vm, ntohl (mp->sw_if_index));
- else if (ip_address_decode (&mp->prefix.address, &address) == IP46_TYPE_IP6)
+ else if (mp->is_ipv6)
error = ip6_add_del_interface_address (vm, ntohl (mp->sw_if_index),
- (void *) &address.ip6,
- mp->prefix.address_length, is_del);
+ (void *) mp->address,
+ mp->address_length, is_del);
else
error = ip4_add_del_interface_address (vm, ntohl (mp->sw_if_index),
- (void *) &address.ip4,
- mp->prefix.address_length, is_del);
+ (void *) mp->address,
+ mp->address_length, is_del);
if (error)
{
@@ -737,13 +724,8 @@ send_sw_interface_event (vpe_api_main_t * am,
mp->client_index = reg->client_index;
mp->pid = reg->client_pid;
- mp->flags = 0;
- mp->flags |= (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
- IF_STATUS_API_FLAG_ADMIN_UP : 0;
- mp->flags |= (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ?
- IF_STATUS_API_FLAG_LINK_UP : 0;
- mp->flags = ntohl (mp->flags);
-
+ mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0;
+ mp->link_up_down = (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ? 1 : 0;
vl_api_send_msg (vl_reg, (u8 *) mp);
}
@@ -866,13 +848,14 @@ static void vl_api_sw_interface_tag_add_del_t_handler
if (mp->is_add)
{
- if (vl_api_from_api_string_c (&mp->tag)[0] == 0)
+ if (mp->tag[0] == 0)
{
rv = VNET_API_ERROR_INVALID_VALUE;
goto out;
}
- tag = format (0, "%s%c", vl_api_from_api_string_c (&mp->tag), 0);
+ mp->tag[ARRAY_LEN (mp->tag) - 1] = 0;
+ tag = format (0, "%s%c", mp->tag, 0);
vnet_set_sw_interface_tag (vnm, tag, sw_if_index);
}
else
@@ -892,14 +875,12 @@ static void vl_api_sw_interface_set_mac_address_t_handler
vnet_sw_interface_t *si;
clib_error_t *error;
int rv = 0;
- mac_address_t mac;
VALIDATE_SW_IF_INDEX (mp);
si = vnet_get_sw_interface (vnm, sw_if_index);
- mac_address_decode (mp->mac_address, &mac);
- error =
- vnet_hw_interface_change_mac_address (vnm, si->hw_if_index, (u8 *) & mac);
+ error = vnet_hw_interface_change_mac_address (vnm, si->hw_if_index,
+ mp->mac_address);
if (error)
{
rv = VNET_API_ERROR_UNIMPLEMENTED;
@@ -939,7 +920,7 @@ static void vl_api_sw_interface_get_mac_address_t_handler
rmp->context = mp->context;
rmp->retval = htonl (rv);
if (!rv && eth_if)
- mac_address_encode ((mac_address_t *) eth_if->address, rmp->mac_address);
+ memcpy (rmp->mac_address, eth_if->address, 6);
vl_api_send_msg (reg, (u8 *) rmp);
}
@@ -1231,7 +1212,14 @@ vl_api_create_subif_t_handler (vl_api_create_subif_t * mp)
template.flood_class = VNET_FLOOD_CLASS_NORMAL;
template.sup_sw_if_index = sw_if_index;
template.sub.id = sub_id;
- template.sub.eth.raw_flags = ntohl (mp->sub_if_flags);
+ template.sub.eth.flags.no_tags = mp->no_tags;
+ template.sub.eth.flags.one_tag = mp->one_tag;
+ template.sub.eth.flags.two_tags = mp->two_tags;
+ template.sub.eth.flags.dot1ad = mp->dot1ad;
+ template.sub.eth.flags.exact_match = mp->exact_match;
+ template.sub.eth.flags.default_sub = mp->default_sub;
+ template.sub.eth.flags.outer_vlan_id_any = mp->outer_vlan_id_any;
+ template.sub.eth.flags.inner_vlan_id_any = mp->inner_vlan_id_any;
template.sub.eth.outer_vlan_id = ntohs (mp->outer_vlan_id);
template.sub.eth.inner_vlan_id = ntohs (mp->inner_vlan_id);
@@ -1295,10 +1283,8 @@ vl_api_create_loopback_t_handler (vl_api_create_loopback_t * mp)
vl_api_create_loopback_reply_t *rmp;
u32 sw_if_index;
int rv;
- mac_address_t mac;
- mac_address_decode (mp->mac_address, &mac);
- rv = vnet_create_loopback_interface (&sw_if_index, (u8 *) & mac, 0, 0);
+ rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address, 0, 0);
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_CREATE_LOOPBACK_REPLY,
@@ -1316,10 +1302,8 @@ static void vl_api_create_loopback_instance_t_handler
u8 is_specified = mp->is_specified;
u32 user_instance = ntohl (mp->user_instance);
int rv;
- mac_address_t mac;
- mac_address_decode (mp->mac_address, &mac);
- rv = vnet_create_loopback_interface (&sw_if_index, (u8 *) & mac,
+ rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address,
is_specified, user_instance);
/* *INDENT-OFF* */
diff --git a/src/vnet/interface_types.api b/src/vnet/interface_types.api
index 6e79044306f..f6fb4219ef8 100644
--- a/src/vnet/interface_types.api
+++ b/src/vnet/interface_types.api
@@ -16,48 +16,3 @@
typedef u32 interface_index;
-enum if_status_flags
-{
- IF_STATUS_API_FLAG_ADMIN_UP = 1,
- IF_STATUS_API_FLAG_LINK_UP = 2,
-};
-
-/* Per protocol MTU */
-enum mtu_proto
-{
- MTU_PROTO_API_L3, /* Default payload MTU (without L2 headers) */
- MTU_PROTO_API_IP4, /* Per-protocol MTUs overriding default */
- MTU_PROTO_API_IP6,
- MTU_PROTO_API_MPLS,
- MTU_PROTO_API_N,
-};
-
-enum link_duplex
-{
- LINK_DUPLEX_API_UNKNOWN = 0,
- LINK_DUPLEX_API_HALF = 1,
- LINK_DUPLEX_API_FULL = 2,
-};
-
-enum sub_if_flags
-{
- SUB_IF_API_FLAG_NO_TAGS = 1,
- SUB_IF_API_FLAG_ONE_TAG = 2,
- SUB_IF_API_FLAG_TWO_TAGS = 4,
- SUB_IF_API_FLAG_DOT1AD = 8,
- SUB_IF_API_FLAG_EXACT_MATCH = 16,
- SUB_IF_API_FLAG_DEFAULT = 32,
- SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY = 64,
- SUB_IF_API_FLAG_INNER_VLAN_ID_ANY = 128,
- SUB_IF_API_FLAG_MASK_VNET = 254, /* use with vnet_sub_interface_t raw_flags */
- SUB_IF_API_FLAG_DOT1AH = 256,
-};
-
-enum rx_mode
-{
- RX_MODE_API_UNKNOWN = 0,
- RX_MODE_API_POLLING,
- RX_MODE_API_INTERRUPT,
- RX_MODE_API_ADAPTIVE,
- RX_MODE_API_DEFAULT,
-};
diff --git a/src/vnet/ip/ip_types_api.h b/src/vnet/ip/ip_types_api.h
index 53a9b597050..a67134c9a86 100644
--- a/src/vnet/ip/ip_types_api.h
+++ b/src/vnet/ip/ip_types_api.h
@@ -23,7 +23,6 @@
#include <vnet/ip/ip.h>
#include <vnet/fib/fib_types.h>
#include <vnet/mfib/mfib_types.h>
-#include <vlibapi/api_types.h>
/**
* Forward declarations so we need not #include the API definitions here
diff --git a/src/vpp-api/vapi/vapi_json_parser.py b/src/vpp-api/vapi/vapi_json_parser.py
index fda3f75d9c1..2c08b90a93b 100644
--- a/src/vpp-api/vapi/vapi_json_parser.py
+++ b/src/vpp-api/vapi/vapi_json_parser.py
@@ -298,7 +298,7 @@ class JsonParser(object):
x: simple_type_class(x) for x in [
'i8', 'i16', 'i32', 'i64',
'u8', 'u16', 'u32', 'u64',
- 'f64', 'bool'
+ 'f64'
]
}
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index fa7091d310e..ab98954abbc 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -112,7 +112,7 @@ static void *vl_api_sw_interface_set_flags_t_print
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
- if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
+ if (mp->admin_up_down)
s = format (s, "admin-up ");
else
s = format (s, "admin-down ");
@@ -159,12 +159,12 @@ static void *vl_api_sw_interface_event_t_print
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
- if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
+ if (mp->admin_up_down)
s = format (s, "admin-up ");
else
s = format (s, "admin-down ");
- if (ntohl (mp->flags) & IF_STATUS_API_FLAG_LINK_UP)
+ if (mp->link_up_down)
s = format (s, "link-up");
else
s = format (s, "link-down");
@@ -179,18 +179,17 @@ static void *vl_api_sw_interface_add_del_address_t_print
(vl_api_sw_interface_add_del_address_t * mp, void *handle)
{
u8 *s;
- ip46_address_t address;
s = format (0, "SCRIPT: sw_interface_add_del_address ");
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
- if (ip_address_decode (&mp->prefix.address, &address) == IP46_TYPE_IP6)
+ if (mp->is_ipv6)
s = format (s, "%U/%d ", format_ip6_address,
- (ip6_address_t *) & address.ip6, mp->prefix.address_length);
+ (ip6_address_t *) mp->address, mp->address_length);
else
s = format (s, "%U/%d ", format_ip4_address,
- (ip4_address_t *) & address.ip4, mp->prefix.address_length);
+ (ip4_address_t *) mp->address, mp->address_length);
if (mp->is_add == 0)
s = format (s, "del ");
@@ -1061,15 +1060,15 @@ static void *vl_api_create_vlan_subif_t_print
FINISH;
}
-#define foreach_create_subif_flag \
-_(0, "no_tags") \
-_(1, "one_tag") \
-_(2, "two_tags") \
-_(3, "dot1ad") \
-_(4, "exact_match") \
-_(5, "default_sub") \
-_(6, "outer_vlan_id_any") \
-_(7, "inner_vlan_id_any")
+#define foreach_create_subif_bit \
+_(no_tags) \
+_(one_tag) \
+_(two_tags) \
+_(dot1ad) \
+_(exact_match) \
+_(default_sub) \
+_(outer_vlan_id_any) \
+_(inner_vlan_id_any)
static void *vl_api_create_subif_t_print
(vl_api_create_subif_t * mp, void *handle)
@@ -1088,8 +1087,8 @@ static void *vl_api_create_subif_t_print
if (mp->inner_vlan_id)
s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
-#define _(a,b) if (mp->sub_if_flags & (1 << a)) s = format (s, "%s ", b);
- foreach_create_subif_flag;
+#define _(a) if (mp->a) s = format (s, "%s ", #a);
+ foreach_create_subif_bit;
#undef _
FINISH;