From 21c33bb3078d323893834fe9897ea8ec1fbcbe59 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Mon, 2 May 2016 13:13:46 -0700 Subject: VPP-30 sr_replicate requires DPDK - added fix to disable functionality when no DPDK - may extend to support non-DPDK case in future. Change-Id: Ic8ad4eeb91c4866f3f102dd4a718898eb0419dee Signed-off-by: Keith Burns (alagalah) --- vnet/vnet/sr/sr.c | 17 +++++++++++++++++ vnet/vnet/sr/sr.h | 2 ++ vnet/vnet/sr/sr_replicate.c | 3 +++ vpp/api/api.c | 5 +++++ 4 files changed, 27 insertions(+) diff --git a/vnet/vnet/sr/sr.c b/vnet/vnet/sr/sr.c index e17b474e9e7..46318a27bbe 100644 --- a/vnet/vnet/sr/sr.c +++ b/vnet/vnet/sr/sr.c @@ -201,11 +201,18 @@ u8 * format_ip6_sr_header_with_length (u8 * s, va_list * args) return s; } +#if DPDK > 0 /* Cannot call replicate yet without DPDK */ #define foreach_sr_rewrite_next \ _(ERROR, "error-drop") \ _(IP6_LOOKUP, "ip6-lookup") \ _(SR_LOCAL, "sr-local") \ _(SR_REPLICATE,"sr-replicate") +#else +#define foreach_sr_rewrite_next \ +_(ERROR, "error-drop") \ +_(IP6_LOOKUP, "ip6-lookup") \ +_(SR_LOCAL, "sr-local") +#endif /* DPDK */ typedef enum { #define _(s,n) SR_REWRITE_NEXT_##s, @@ -519,6 +526,7 @@ sr_rewrite (vlib_main_t * vm, t0 = pool_elt_at_index (sm->tunnels, adj0->rewrite_header.sw_if_index); +#if DPDK > 0 /* Cannot call replication node yet without DPDK */ /* add a replication node */ if(PREDICT_FALSE(t0->policy_index != ~0)) { @@ -526,6 +534,7 @@ sr_rewrite (vlib_main_t * vm, next0=SR_REWRITE_NEXT_SR_REPLICATE; goto trace0; } +#endif /* DPDK */ ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= ((word) vec_len (t0->rewrite)) + b0->current_data); @@ -593,7 +602,9 @@ sr_rewrite (vlib_main_t * vm, } } +#if DPDK > 0 /* Cannot run replicate without DPDK and only replicate uses this label */ trace0: +#endif /* DPDK */ if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED)) { sr_rewrite_trace_t *tr = vlib_add_trace (vm, node, @@ -1584,7 +1595,11 @@ sr_add_del_multicast_map_command_fn (vlib_main_t * vm, a->multicast_address = &multicast_address; a->policy_name = policy_name; +#if DPDK > 0 /*Cannot call replicate or configure multicast map yet without DPDK */ rv = ip6_sr_add_del_multicastmap (a); +#else + return clib_error_return (0, "cannot use multicast replicate spray case without DPDK installed"); +#endif /* DPDK */ switch (rv) { @@ -1946,9 +1961,11 @@ static clib_error_t * sr_init (vlib_main_t * vm) sm->ip6_lookup_sr_next_index = vlib_node_add_next (vm, ip6_lookup_node->index, sr_rewrite_node.index); +#if DPDK > 0 /* Cannot run replicate without DPDK */ /* Add a disposition to sr_replicate for the sr multicast replicate node */ sm->ip6_lookup_sr_replicate_index = vlib_node_add_next (vm, ip6_lookup_node->index, sr_replicate_node.index); +#endif /* DPDK */ /* Add a disposition to ip6_rewrite for the sr dst address hack node */ sm->ip6_rewrite_sr_next_index = diff --git a/vnet/vnet/sr/sr.h b/vnet/vnet/sr/sr.h index 023ca243d7d..321f49a7321 100644 --- a/vnet/vnet/sr/sr.h +++ b/vnet/vnet/sr/sr.h @@ -187,7 +187,9 @@ format_function_t format_ip6_sr_header_with_length; vlib_node_registration_t ip6_sr_input_node; +#if DPDK > 0 vlib_node_registration_t sr_replicate_node; +#endif /* DPDK */ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a); int ip6_sr_add_del_policy (ip6_sr_add_del_policy_args_t * a); diff --git a/vnet/vnet/sr/sr_replicate.c b/vnet/vnet/sr/sr_replicate.c index e60b95624e1..7486d7c60a1 100644 --- a/vnet/vnet/sr/sr_replicate.c +++ b/vnet/vnet/sr/sr_replicate.c @@ -15,6 +15,7 @@ * limitations under the License. */ +#if DPDK > 0 /* Cannot run replicate without DPDK */ #include #include #include @@ -364,3 +365,5 @@ clib_error_t *sr_replicate_init (vlib_main_t *vm) } VLIB_INIT_FUNCTION(sr_replicate_init); + +#endif /* DPDK */ diff --git a/vpp/api/api.c b/vpp/api/api.c index 41f57602550..52616cce821 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -3506,7 +3506,12 @@ static void vl_api_sr_multicast_map_add_del_t_handler goto out; } +#if DPDK > 0 /* Cannot call replicate without DPDK */ rv = ip6_sr_add_del_multicastmap (a); +#else + clib_warning ("multicast replication without DPDK not implemented"); + rv = VNET_API_ERROR_UNIMPLEMENTED; +#endif /* DPDK */ out: -- cgit 1.2.3-korg