aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-05-18 22:16:11 +0200
committerDamjan Marion <damarion@cisco.com>2022-05-19 18:32:23 +0200
commitcada9eb7894117db898f7c4def92cba5511baa4f (patch)
tree4cf552e2ad9e67b8bbc144eb5c6cb9aad0a8424b /src/vnet
parentbf95e3efde3402cf2f7beaf6d70433646cc68280 (diff)
api: refactor api data storage
single struct to hold all api handler, flags, etc. Provide functions to toggle flags instead of writing directly to internal data. Type: refactor Change-Id: I4730d7290e57489de8eda34a72211527e015b721 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/classify/classify_api.c7
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c4
-rw-r--r--src/vnet/interface_api.c25
-rw-r--r--src/vnet/ip/ip_api.c8
-rw-r--r--src/vnet/l2/l2_api.c2
-rw-r--r--src/vnet/mpls/mpls_api.c3
-rw-r--r--src/vnet/vxlan-gpe/vxlan_gpe_api.c4
-rw-r--r--src/vnet/vxlan/vxlan_api.c3
8 files changed, 31 insertions, 25 deletions
diff --git a/src/vnet/classify/classify_api.c b/src/vnet/classify/classify_api.c
index 0f9243c0365..53e3cb6c349 100644
--- a/src/vnet/classify/classify_api.c
+++ b/src/vnet/classify/classify_api.c
@@ -966,9 +966,10 @@ classify_api_hookup (vlib_main_t * vm)
/*
* Trace space for classifier mask+match
*/
- am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_TABLE].size += 5 * sizeof (u32x4);
- am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_SESSION].size +=
- 5 * sizeof (u32x4);
+ vl_api_increase_msg_trace_size (am, VL_API_CLASSIFY_ADD_DEL_TABLE,
+ 5 * sizeof (u32x4));
+ vl_api_increase_msg_trace_size (am, VL_API_CLASSIFY_ADD_DEL_SESSION,
+ 5 * sizeof (u32x4));
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 6dd9da08a23..cc1896b108a 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -330,8 +330,8 @@ vhost_user_api_hookup (vlib_main_t * vm)
{
api_main_t *am = vlibapi_get_main ();
/* Mark CREATE_VHOST_USER_IF as mp safe */
- am->is_mp_safe[VL_API_CREATE_VHOST_USER_IF] = 1;
- am->is_mp_safe[VL_API_CREATE_VHOST_USER_IF_V2] = 1;
+ vl_api_set_msg_thread_safe (am, VL_API_CREATE_VHOST_USER_IF, 1);
+ vl_api_set_msg_thread_safe (am, VL_API_CREATE_VHOST_USER_IF_V2, 1);
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 29f98f7851f..5766f2ca21f 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -1630,21 +1630,24 @@ interface_api_hookup (vlib_main_t * vm)
REPLY_MSG_ID_BASE = setup_message_id_table ();
/* Mark these APIs as mp safe */
- am->is_mp_safe[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DUMP] = 1;
- am->is_mp_safe[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DETAILS] = 1;
- am->is_mp_safe[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_TAG_ADD_DEL] = 1;
- am->is_mp_safe[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_SET_INTERFACE_NAME] =
- 1;
+ vl_api_set_msg_thread_safe (am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DUMP,
+ 1);
+ vl_api_set_msg_thread_safe (
+ am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DETAILS, 1);
+ vl_api_set_msg_thread_safe (
+ am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_TAG_ADD_DEL, 1);
+ vl_api_set_msg_thread_safe (
+ am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_SET_INTERFACE_NAME, 1);
/* Do not replay VL_API_SW_INTERFACE_DUMP messages */
- am->api_trace_cfg[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DUMP]
- .replay_enable = 0;
+ vl_api_allow_msg_replay (am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_DUMP,
+ 0);
/* Mark these APIs as autoendian */
- am->is_autoendian[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_SET_TX_PLACEMENT] =
- 1;
- am->is_autoendian[REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_TX_PLACEMENT_GET] =
- 1;
+ vl_api_set_msg_autoendian (
+ am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_SET_TX_PLACEMENT, 1);
+ vl_api_set_msg_autoendian (
+ am, REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_TX_PLACEMENT_GET, 1);
return 0;
}
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index ae4ee0cec52..e03b0103391 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -2119,10 +2119,10 @@ ip_api_hookup (vlib_main_t * vm)
/*
* Mark the route add/del API as MP safe
*/
- am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL] = 1;
- am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_REPLY] = 1;
- am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2] = 1;
- am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2_REPLY] = 1;
+ vl_api_set_msg_thread_safe (am, VL_API_IP_ROUTE_ADD_DEL, 1);
+ vl_api_set_msg_thread_safe (am, VL_API_IP_ROUTE_ADD_DEL_REPLY, 1);
+ vl_api_set_msg_thread_safe (am, VL_API_IP_ROUTE_ADD_DEL_V2, 1);
+ vl_api_set_msg_thread_safe (am, VL_API_IP_ROUTE_ADD_DEL_V2_REPLY, 1);
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index 5a0432de43d..c555a17d5ea 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -1281,7 +1281,7 @@ l2_api_hookup (vlib_main_t * vm)
api_main_t *am = vlibapi_get_main ();
/* Mark VL_API_BRIDGE_DOMAIN_DUMP as mp safe */
- am->is_mp_safe[VL_API_BRIDGE_DOMAIN_DUMP] = 1;
+ vl_api_set_msg_thread_safe (am, VL_API_BRIDGE_DOMAIN_DUMP, 1);
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 4efb61786ad..fac52827e1d 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -508,7 +508,8 @@ mpls_api_hookup (vlib_main_t * vm)
/*
* Trace space for 8 MPLS encap labels
*/
- am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 * sizeof (u32);
+ vl_api_increase_msg_trace_size (am, VL_API_MPLS_TUNNEL_ADD_DEL,
+ 8 * sizeof (u32));
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/vxlan-gpe/vxlan_gpe_api.c b/src/vnet/vxlan-gpe/vxlan_gpe_api.c
index 9423b2745be..e9cf17f270b 100644
--- a/src/vnet/vxlan-gpe/vxlan_gpe_api.c
+++ b/src/vnet/vxlan-gpe/vxlan_gpe_api.c
@@ -342,8 +342,8 @@ vxlan_gpe_api_hookup (vlib_main_t * vm)
{
api_main_t *am = vlibapi_get_main ();
- am->api_trace_cfg[VL_API_VXLAN_GPE_ADD_DEL_TUNNEL].size +=
- 17 * sizeof (u32);
+ vl_api_increase_msg_trace_size (am, VL_API_VXLAN_GPE_ADD_DEL_TUNNEL,
+ 17 * sizeof (u32));
/*
* Set up the (msg_name, crc, message-id) table
diff --git a/src/vnet/vxlan/vxlan_api.c b/src/vnet/vxlan/vxlan_api.c
index c97597a2ef2..56fd654951f 100644
--- a/src/vnet/vxlan/vxlan_api.c
+++ b/src/vnet/vxlan/vxlan_api.c
@@ -354,7 +354,8 @@ vxlan_api_hookup (vlib_main_t * vm)
{
api_main_t *am = vlibapi_get_main ();
- am->api_trace_cfg[VL_API_VXLAN_ADD_DEL_TUNNEL].size += 16 * sizeof (u32);
+ vl_api_increase_msg_trace_size (am, VL_API_VXLAN_ADD_DEL_TUNNEL,
+ 16 * sizeof (u32));
/*
* Set up the (msg_name, crc, message-id) table