aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYohanPipereau <ypiperea@cisco.com>2019-03-15 11:23:07 +0100
committerYohanPipereau <ypiperea@cisco.com>2019-03-19 20:27:11 +0100
commit7dd61fc820323344c7479dd767a2ee0f84abd810 (patch)
treec8708178c67bfb0c94af11e90ce8075828ebf7a8
parent5776cb5567b68470f23acafb4bec3d01833ce6df (diff)
Suppress compiler Warnings for scvpp
-Unused Warnings for callbacks are suppressed with UNUSED maccro -Remove unused function. Change-Id: Ic31a1b40d59a4d9c4fc638452dee36586d1dacd5 Signed-off-by: YohanPipereau <ypiperea@cisco.com>
-rw-r--r--src/scvpp/src/sc_vpp_comm.h7
-rw-r--r--src/scvpp/src/sc_vpp_interface.c30
-rw-r--r--src/scvpp/src/sc_vpp_ip.c117
-rw-r--r--src/scvpp/src/sc_vpp_nat.c20
4 files changed, 25 insertions, 149 deletions
diff --git a/src/scvpp/src/sc_vpp_comm.h b/src/scvpp/src/sc_vpp_comm.h
index 649295d..2405259 100644
--- a/src/scvpp/src/sc_vpp_comm.h
+++ b/src/scvpp/src/sc_vpp_comm.h
@@ -64,11 +64,17 @@ DEFINE_VAPI_MSG_IDS_VPE_API_JSON;
ARG_CHECK(retval, arg3); \
ARG_CHECK(retval, arg4)
+/* Suppress compiler warning about unused variable.
+ * This must be used only for callback function else suppress your unused
+ * parameter in function prototype. */
+#define UNUSED(x) (void)x
+
#define VAPI_RETVAL_CB(api_name) \
static vapi_error_e \
api_name##_cb (vapi_ctx_t ctx, void *caller_ctx, vapi_error_e rv, bool is_last, \
vapi_payload_##api_name##_reply * reply) \
{ \
+ UNUSED(ctx); UNUSED(caller_ctx); UNUSED(rv); UNUSED(is_last); \
return reply->retval; \
}
@@ -77,6 +83,7 @@ static vapi_error_e \
api_name##_cb (vapi_ctx_t ctx, void *caller_ctx, vapi_error_e rv, bool is_last, \
vapi_payload_##api_name##_reply * reply) \
{ \
+ UNUSED(ctx); UNUSED(rv); UNUSED(is_last); \
if (caller_ctx) \
{ \
vapi_payload_##api_name##_reply * passed = (vapi_payload_##api_name##_reply *)caller_ctx; \
diff --git a/src/scvpp/src/sc_vpp_interface.c b/src/scvpp/src/sc_vpp_interface.c
index 73b29ae..bc5befc 100644
--- a/src/scvpp/src/sc_vpp_interface.c
+++ b/src/scvpp/src/sc_vpp_interface.c
@@ -43,6 +43,8 @@ sw_interface_dump_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
vapi_error_e rv, bool is_last,
vapi_payload_sw_interface_details *reply)
{
+ UNUSED(rv); UNUSED(ctx); UNUSED(is_last);
+
vapi_payload_sw_interface_details *passed;
ARG_CHECK(-EINVAL, callback_ctx);
@@ -83,6 +85,7 @@ interface_dump_all_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
vapi_error_e rv, bool is_last,
vapi_payload_sw_interface_details * reply)
{
+ UNUSED(ctx); UNUSED(rv);
dump_all_ctx *dctx = callback_ctx;
if (is_last)
@@ -100,7 +103,8 @@ interface_dump_all_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
vpp_interface_t * iface = &dctx->intfcArray[dctx->num_ifs];
iface->sw_if_index = reply->sw_if_index;
- strncpy(iface->interface_name, reply->interface_name, VPP_INTFC_NAME_LEN);
+ strncpy(iface->interface_name, (char*) reply->interface_name,
+ VPP_INTFC_NAME_LEN);
iface->l2_address_length = reply->l2_address_length;
memcpy(iface->l2_address, reply->l2_address, reply->l2_address_length );
iface->link_speed = reply->link_speed;
@@ -145,6 +149,8 @@ get_interface_id_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
vapi_error_e rv, bool is_last,
vapi_payload_sw_interface_details * reply)
{
+ UNUSED(ctx); UNUSED(rv);
+
sw_interface_details_query_t *dctx = callback_ctx;
assert(dctx);
@@ -225,28 +231,6 @@ bin_api_sw_interface_set_flags(uint32_t if_index, uint8_t up)
return rv;
}
-VAPI_RETVAL_CB(sw_interface_set_l2_bridge);
-
-//set interface l2 bridge <interface> <bridge-domain-id> [bvi|uu-fwd] [shg]
-static vapi_error_e
-bin_api_sw_interface_set_l2_bridge(u32 bd_id, u32 rx_sw_if_index, bool enable)
-{
- vapi_msg_sw_interface_set_l2_bridge *mp;
- vapi_error_e rv;
-
- mp = vapi_alloc_sw_interface_set_l2_bridge (g_vapi_ctx_instance);
- assert(NULL != mp);
-
- mp->payload.enable = enable;
- mp->payload.bd_id = bd_id;
- mp->payload.rx_sw_if_index = rx_sw_if_index;
-
- VAPI_CALL(vapi_sw_interface_set_l2_bridge (g_vapi_ctx_instance, mp,
- sw_interface_set_l2_bridge_cb, NULL));
-
- return rv;
-}
-
int interface_enable(const char *interface_name, const bool enable)
{
ARG_CHECK(-1, interface_name);
diff --git a/src/scvpp/src/sc_vpp_ip.c b/src/scvpp/src/sc_vpp_ip.c
index 77e79fb..0dfd108 100644
--- a/src/scvpp/src/sc_vpp_ip.c
+++ b/src/scvpp/src/sc_vpp_ip.c
@@ -53,25 +53,6 @@ bin_api_sw_interface_add_del_address(u32 sw_if_index, bool is_add, bool is_ipv6,
return rv;
}
-static vapi_error_e
-bin_api_sw_interface_del_all_address(u32 sw_if_index)
-{
- vapi_msg_sw_interface_add_del_address *mp;
- vapi_error_e rv;
-
- mp = vapi_alloc_sw_interface_add_del_address(g_vapi_ctx_instance);
- assert(NULL != mp);
-
- mp->payload.sw_if_index = sw_if_index;
- mp->payload.is_add = 0;
- mp->payload.del_all = 1;
-
- VAPI_CALL(vapi_sw_interface_add_del_address(g_vapi_ctx_instance, mp,
- sw_interface_add_del_address_cb, NULL));
-
- return rv;
-}
-
VAPI_COPY_CB(ip_add_del_route)
static vapi_error_e
@@ -115,104 +96,10 @@ bin_api_ip_add_del_route(vapi_payload_ip_add_del_route_reply * reply,
}
static vapi_error_e
-ip_fib_dump_cb(struct vapi_ctx_s *ctx, void *callback_ctx, vapi_error_e rv,
- bool is_last, vapi_payload_ip_fib_details * reply)
-{
- if (is_last)
- {
- assert (NULL == reply);
- }
- else
- {
- assert (NULL != reply);
-
- /*
- typedef struct __attribute__ ((__packed__)) {
- u32 table_id;
- u8 table_name[64];
- u8 address_length;
- u8 address[4];
- u32 count;
- u32 stats_index;
- vapi_type_fib_path path[0];
- } vapi_payload_ip_fib_details;
- */
-
- for (u32 i = 0; i < reply->count; ++i)
- {
- /*
- typedef struct __attribute__((__packed__)) {
- u32 sw_if_index;
- u32 table_id;
- u8 weight;
- u8 preference;
- u8 is_local;
- u8 is_drop;
- u8 is_udp_encap;
- u8 is_unreach;
- u8 is_prohibit;
- u8 is_resolve_host;
- u8 is_resolve_attached;
- u8 is_dvr;
- u8 is_source_lookup;
- u8 afi;
- u8 next_hop[16];
- u32 next_hop_id;
- u32 rpf_id;
- u32 via_label;
- u8 n_labels;
- vapi_type_fib_mpls_label label_stack[16];
- } vapi_type_fib_path;
-
- │493 case FIB_PATH_TYPE_ATTACHED_NEXT_HOP: │
-b+>│494 s = format (s, "%U", format_ip46_address, │
- │495 &path->attached_next_hop.fp_nh, │
- │496 IP46_TYPE_ANY);
-
- */
-
- }
- }
-
- return VAPI_OK;
-}
-
-static vapi_error_e
-bin_api_ip_fib_dump()
-{
- vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx_instance);
- assert(NULL != mp);
-
- //ip route add 2.2.2.2/24 via 5.5.5.5
- //show ip fib table 0 2.2.2.0/24 detail
-
- vapi_error_e rv;
- VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx_instance, mp, ip_fib_dump_cb, NULL));
-
- return rv;
-}
-
-VAPI_RETVAL_CB(ip_table_add_del)
-
-static vapi_error_e
-bin_api_table_add_del(u8 is_add, u32 table_id)
-{
- vapi_msg_ip_table_add_del *mp = vapi_alloc_ip_table_add_del(g_vapi_ctx_instance);
- assert(NULL != mp);
-
- mp->payload.is_add = is_add;
- mp->payload.table_id = table_id;
-
- vapi_error_e rv;
- VAPI_CALL(vapi_ip_table_add_del(g_vapi_ctx_instance, mp, ip_table_add_del_cb, NULL));
-
- return rv;
-}
-
-static vapi_error_e
ip_address_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx, vapi_error_e rv,
bool is_last, vapi_payload_ip_address_details *reply)
{
+ UNUSED(rv);
ARG_CHECK3(VAPI_EINVAL, ctx, callback_ctx, reply);
//copy dump reply in callback context
@@ -262,7 +149,7 @@ int ipv46_address_dump(const char *interface_name, char *ip_addr,
if (!get_interface_id(&query))
return -EINVAL;
- rv = bin_api_ip_address_dump(query.sw_interface_details.sw_if_index, false, &dctx);
+ rv = bin_api_ip_address_dump(query.sw_interface_details.sw_if_index, is_ipv6, &dctx);
if (rv != VAPI_OK)
return -EAGAIN;
diff --git a/src/scvpp/src/sc_vpp_nat.c b/src/scvpp/src/sc_vpp_nat.c
index 1944684..e4bf2b7 100644
--- a/src/scvpp/src/sc_vpp_nat.c
+++ b/src/scvpp/src/sc_vpp_nat.c
@@ -24,13 +24,12 @@
DEFINE_VAPI_MSG_IDS_NAT_API_JSON
static vapi_error_e
-nat44_interface_dump_cb(
- __attribute__((unused)) struct vapi_ctx_s *ctx,
- void *callback_ctx,
- __attribute__((unused)) vapi_error_e rv,
- bool is_last,
- vapi_payload_nat44_interface_details *reply)
+nat44_interface_dump_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
+ vapi_error_e rv, bool is_last,
+ vapi_payload_nat44_interface_details *reply)
{
+ UNUSED(ctx);
+ UNUSED(rv);
vapi_payload_nat44_interface_details *dctx = callback_ctx;
assert(dctx);
@@ -138,12 +137,11 @@ bin_api_nat44_add_del_static_mapping(
}
static vapi_error_e nat44_static_mapping_dump_cb(
- __attribute__((unused)) struct vapi_ctx_s *ctx,
- void *callback_ctx,
- __attribute__((unused)) vapi_error_e rv,
- bool is_last,
- vapi_payload_nat44_static_mapping_details *reply)
+ struct vapi_ctx_s *ctx, void *callback_ctx, vapi_error_e rv,
+ bool is_last,vapi_payload_nat44_static_mapping_details *reply)
{
+ UNUSED(rv);
+ UNUSED(ctx);
vapi_payload_nat44_static_mapping_details *dctx = callback_ctx;
assert(dctx);