aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/srv6
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-11-13 16:34:13 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-11-14 15:54:01 +0000
commit178cf493d009995b28fdf220f04c98860ff79a9b (patch)
tree097c1be82b8f6fa9bc04b9b1e193158e2e4997eb /src/vnet/srv6
parent6917b94f2146aa51195a6a2a1ccd8416a1d74bf3 (diff)
Remove c-11 memcpy checks from perf-critical code
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/srv6')
-rwxr-xr-xsrc/vnet/srv6/sr.h3
-rwxr-xr-xsrc/vnet/srv6/sr_policy_rewrite.c422
-rwxr-xr-xsrc/vnet/srv6/sr_steering.c4
3 files changed, 216 insertions, 213 deletions
diff --git a/src/vnet/srv6/sr.h b/src/vnet/srv6/sr.h
index 1a30cf3e3e0..2353b284363 100755
--- a/src/vnet/srv6/sr.h
+++ b/src/vnet/srv6/sr.h
@@ -310,7 +310,8 @@ ip6_sr_compute_rewrite_string_insert (ip6_address_t * sl)
addrp = srh->segments + vec_len (sl);
vec_foreach (this_address, sl)
{
- clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ clib_memcpy_fast (addrp->as_u8, this_address->as_u8,
+ sizeof (ip6_address_t));
addrp--;
}
return rs;
diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c
index c80b9c4505a..e9c42211209 100755
--- a/src/vnet/srv6/sr_policy_rewrite.c
+++ b/src/vnet/srv6/sr_policy_rewrite.c
@@ -115,7 +115,7 @@ static ip6_address_t sr_pr_encaps_src;
void
sr_set_source (ip6_address_t * address)
{
- clib_memcpy (&sr_pr_encaps_src, address, sizeof (sr_pr_encaps_src));
+ clib_memcpy_fast (&sr_pr_encaps_src, address, sizeof (sr_pr_encaps_src));
}
static clib_error_t *
@@ -192,8 +192,8 @@ compute_rewrite_encaps (ip6_address_t * sl)
addrp = srh->segments + vec_len (sl) - 1;
vec_foreach (this_address, sl)
{
- clib_memcpy (addrp->as_u8, this_address->as_u8,
- sizeof (ip6_address_t));
+ clib_memcpy_fast (addrp->as_u8, this_address->as_u8,
+ sizeof (ip6_address_t));
addrp--;
}
}
@@ -234,7 +234,8 @@ compute_rewrite_insert (ip6_address_t * sl)
addrp = srh->segments + vec_len (sl);
vec_foreach (this_address, sl)
{
- clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ clib_memcpy_fast (addrp->as_u8, this_address->as_u8,
+ sizeof (ip6_address_t));
addrp--;
}
return rs;
@@ -272,7 +273,8 @@ compute_rewrite_bsid (ip6_address_t * sl)
addrp = srh->segments + vec_len (sl) - 1;
vec_foreach (this_address, sl)
{
- clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ clib_memcpy_fast (addrp->as_u8, this_address->as_u8,
+ sizeof (ip6_address_t));
addrp--;
}
return rs;
@@ -589,7 +591,7 @@ sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments,
/* Add an SR policy object */
pool_get (sm->sr_policies, sr_policy);
clib_memset (sr_policy, 0, sizeof (*sr_policy));
- clib_memcpy (&sr_policy->bsid, bsid, sizeof (ip6_address_t));
+ clib_memcpy_fast (&sr_policy->bsid, bsid, sizeof (ip6_address_t));
sr_policy->type = behavior;
sr_policy->fib_table = (fib_table != (u32) ~ 0 ? fib_table : 0); //Is default FIB 0 ?
sr_policy->is_encap = is_encap;
@@ -852,8 +854,8 @@ sr_policy_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (unformat (input, "next %U", unformat_ip6_address, &next_address))
{
vec_add2 (segments, this_seg, 1);
- clib_memcpy (this_seg->as_u8, next_address.as_u8,
- sizeof (*this_seg));
+ clib_memcpy_fast (this_seg->as_u8, next_address.as_u8,
+ sizeof (*this_seg));
}
else if (unformat (input, "add sl"))
operation = 1;
@@ -1159,14 +1161,14 @@ sr_policy_rewrite_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
ip2_encap = vlib_buffer_get_current (b2);
ip3_encap = vlib_buffer_get_current (b3);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
- clib_memcpy (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
- sl1->rewrite, vec_len (sl1->rewrite));
- clib_memcpy (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
- sl2->rewrite, vec_len (sl2->rewrite));
- clib_memcpy (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
- sl3->rewrite, vec_len (sl3->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
+ sl1->rewrite, vec_len (sl1->rewrite));
+ clib_memcpy_fast (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
+ sl2->rewrite, vec_len (sl2->rewrite));
+ clib_memcpy_fast (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
+ sl3->rewrite, vec_len (sl3->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite));
@@ -1189,40 +1191,40 @@ sr_policy_rewrite_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -1257,8 +1259,8 @@ sr_policy_rewrite_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
ip0_encap = vlib_buffer_get_current (b0);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
ip0 = vlib_buffer_get_current (b0);
@@ -1270,10 +1272,10 @@ sr_policy_rewrite_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
encap_pkts++;
@@ -1442,14 +1444,14 @@ sr_policy_rewrite_encaps_v4 (vlib_main_t * vm, vlib_node_runtime_t * node,
ip2_encap = vlib_buffer_get_current (b2);
ip3_encap = vlib_buffer_get_current (b3);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
- clib_memcpy (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
- sl1->rewrite, vec_len (sl1->rewrite));
- clib_memcpy (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
- sl2->rewrite, vec_len (sl2->rewrite));
- clib_memcpy (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
- sl3->rewrite, vec_len (sl3->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
+ sl1->rewrite, vec_len (sl1->rewrite));
+ clib_memcpy_fast (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
+ sl2->rewrite, vec_len (sl2->rewrite));
+ clib_memcpy_fast (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
+ sl3->rewrite, vec_len (sl3->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite));
@@ -1472,40 +1474,40 @@ sr_policy_rewrite_encaps_v4 (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -1541,8 +1543,8 @@ sr_policy_rewrite_encaps_v4 (vlib_main_t * vm, vlib_node_runtime_t * node,
ip0_encap = vlib_buffer_get_current (b0);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
ip0 = vlib_buffer_get_current (b0);
@@ -1554,10 +1556,10 @@ sr_policy_rewrite_encaps_v4 (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
encap_pkts++;
@@ -1799,14 +1801,14 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
en2 = vlib_buffer_get_current (b2);
en3 = vlib_buffer_get_current (b3);
- clib_memcpy (((u8 *) en0) - vec_len (sl0->rewrite), sl0->rewrite,
- vec_len (sl0->rewrite));
- clib_memcpy (((u8 *) en1) - vec_len (sl1->rewrite), sl1->rewrite,
- vec_len (sl1->rewrite));
- clib_memcpy (((u8 *) en2) - vec_len (sl2->rewrite), sl2->rewrite,
- vec_len (sl2->rewrite));
- clib_memcpy (((u8 *) en3) - vec_len (sl3->rewrite), sl3->rewrite,
- vec_len (sl3->rewrite));
+ clib_memcpy_fast (((u8 *) en0) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) en1) - vec_len (sl1->rewrite),
+ sl1->rewrite, vec_len (sl1->rewrite));
+ clib_memcpy_fast (((u8 *) en2) - vec_len (sl2->rewrite),
+ sl2->rewrite, vec_len (sl2->rewrite));
+ clib_memcpy_fast (((u8 *) en3) - vec_len (sl3->rewrite),
+ sl3->rewrite, vec_len (sl3->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite));
@@ -1868,40 +1870,40 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -1955,8 +1957,8 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
en0 = vlib_buffer_get_current (b0);
- clib_memcpy (((u8 *) en0) - vec_len (sl0->rewrite), sl0->rewrite,
- vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) en0) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
@@ -1978,10 +1980,10 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
encap_pkts++;
@@ -2145,23 +2147,23 @@ sr_policy_rewrite_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
else
sr3 = (ip6_sr_header_t *) (ip3 + 1);
- clib_memcpy ((u8 *) ip0 - vec_len (sl0->rewrite), (u8 *) ip0,
- (void *) sr0 - (void *) ip0);
- clib_memcpy ((u8 *) ip1 - vec_len (sl1->rewrite), (u8 *) ip1,
- (void *) sr1 - (void *) ip1);
- clib_memcpy ((u8 *) ip2 - vec_len (sl2->rewrite), (u8 *) ip2,
- (void *) sr2 - (void *) ip2);
- clib_memcpy ((u8 *) ip3 - vec_len (sl3->rewrite), (u8 *) ip3,
- (void *) sr3 - (void *) ip3);
-
- clib_memcpy (((u8 *) sr0 - vec_len (sl0->rewrite)), sl0->rewrite,
- vec_len (sl0->rewrite));
- clib_memcpy (((u8 *) sr1 - vec_len (sl1->rewrite)), sl1->rewrite,
- vec_len (sl1->rewrite));
- clib_memcpy (((u8 *) sr2 - vec_len (sl2->rewrite)), sl2->rewrite,
- vec_len (sl2->rewrite));
- clib_memcpy (((u8 *) sr3 - vec_len (sl3->rewrite)), sl3->rewrite,
- vec_len (sl3->rewrite));
+ clib_memcpy_fast ((u8 *) ip0 - vec_len (sl0->rewrite), (u8 *) ip0,
+ (void *) sr0 - (void *) ip0);
+ clib_memcpy_fast ((u8 *) ip1 - vec_len (sl1->rewrite), (u8 *) ip1,
+ (void *) sr1 - (void *) ip1);
+ clib_memcpy_fast ((u8 *) ip2 - vec_len (sl2->rewrite), (u8 *) ip2,
+ (void *) sr2 - (void *) ip2);
+ clib_memcpy_fast ((u8 *) ip3 - vec_len (sl3->rewrite), (u8 *) ip3,
+ (void *) sr3 - (void *) ip3);
+
+ clib_memcpy_fast (((u8 *) sr0 - vec_len (sl0->rewrite)),
+ sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) sr1 - vec_len (sl1->rewrite)),
+ sl1->rewrite, vec_len (sl1->rewrite));
+ clib_memcpy_fast (((u8 *) sr2 - vec_len (sl2->rewrite)),
+ sl2->rewrite, vec_len (sl2->rewrite));
+ clib_memcpy_fast (((u8 *) sr3 - vec_len (sl3->rewrite)),
+ sl3->rewrite, vec_len (sl3->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite));
@@ -2284,40 +2286,40 @@ sr_policy_rewrite_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -2360,10 +2362,10 @@ sr_policy_rewrite_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
else
sr0 = (ip6_sr_header_t *) (ip0 + 1);
- clib_memcpy ((u8 *) ip0 - vec_len (sl0->rewrite), (u8 *) ip0,
- (void *) sr0 - (void *) ip0);
- clib_memcpy (((u8 *) sr0 - vec_len (sl0->rewrite)), sl0->rewrite,
- vec_len (sl0->rewrite));
+ clib_memcpy_fast ((u8 *) ip0 - vec_len (sl0->rewrite), (u8 *) ip0,
+ (void *) sr0 - (void *) ip0);
+ clib_memcpy_fast (((u8 *) sr0 - vec_len (sl0->rewrite)),
+ sl0->rewrite, vec_len (sl0->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
@@ -2400,10 +2402,10 @@ sr_policy_rewrite_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
insert_pkts++;
@@ -2567,23 +2569,23 @@ sr_policy_rewrite_b_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
else
sr3 = (ip6_sr_header_t *) (ip3 + 1);
- clib_memcpy ((u8 *) ip0 - vec_len (sl0->rewrite_bsid), (u8 *) ip0,
- (void *) sr0 - (void *) ip0);
- clib_memcpy ((u8 *) ip1 - vec_len (sl1->rewrite_bsid), (u8 *) ip1,
- (void *) sr1 - (void *) ip1);
- clib_memcpy ((u8 *) ip2 - vec_len (sl2->rewrite_bsid), (u8 *) ip2,
- (void *) sr2 - (void *) ip2);
- clib_memcpy ((u8 *) ip3 - vec_len (sl3->rewrite_bsid), (u8 *) ip3,
- (void *) sr3 - (void *) ip3);
-
- clib_memcpy (((u8 *) sr0 - vec_len (sl0->rewrite_bsid)),
- sl0->rewrite_bsid, vec_len (sl0->rewrite_bsid));
- clib_memcpy (((u8 *) sr1 - vec_len (sl1->rewrite_bsid)),
- sl1->rewrite_bsid, vec_len (sl1->rewrite_bsid));
- clib_memcpy (((u8 *) sr2 - vec_len (sl2->rewrite_bsid)),
- sl2->rewrite_bsid, vec_len (sl2->rewrite_bsid));
- clib_memcpy (((u8 *) sr3 - vec_len (sl3->rewrite_bsid)),
- sl3->rewrite_bsid, vec_len (sl3->rewrite_bsid));
+ clib_memcpy_fast ((u8 *) ip0 - vec_len (sl0->rewrite_bsid),
+ (u8 *) ip0, (void *) sr0 - (void *) ip0);
+ clib_memcpy_fast ((u8 *) ip1 - vec_len (sl1->rewrite_bsid),
+ (u8 *) ip1, (void *) sr1 - (void *) ip1);
+ clib_memcpy_fast ((u8 *) ip2 - vec_len (sl2->rewrite_bsid),
+ (u8 *) ip2, (void *) sr2 - (void *) ip2);
+ clib_memcpy_fast ((u8 *) ip3 - vec_len (sl3->rewrite_bsid),
+ (u8 *) ip3, (void *) sr3 - (void *) ip3);
+
+ clib_memcpy_fast (((u8 *) sr0 - vec_len (sl0->rewrite_bsid)),
+ sl0->rewrite_bsid, vec_len (sl0->rewrite_bsid));
+ clib_memcpy_fast (((u8 *) sr1 - vec_len (sl1->rewrite_bsid)),
+ sl1->rewrite_bsid, vec_len (sl1->rewrite_bsid));
+ clib_memcpy_fast (((u8 *) sr2 - vec_len (sl2->rewrite_bsid)),
+ sl2->rewrite_bsid, vec_len (sl2->rewrite_bsid));
+ clib_memcpy_fast (((u8 *) sr3 - vec_len (sl3->rewrite_bsid)),
+ sl3->rewrite_bsid, vec_len (sl3->rewrite_bsid));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite_bsid));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite_bsid));
@@ -2697,40 +2699,40 @@ sr_policy_rewrite_b_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -2773,10 +2775,10 @@ sr_policy_rewrite_b_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
else
sr0 = (ip6_sr_header_t *) (ip0 + 1);
- clib_memcpy ((u8 *) ip0 - vec_len (sl0->rewrite_bsid), (u8 *) ip0,
- (void *) sr0 - (void *) ip0);
- clib_memcpy (((u8 *) sr0 - vec_len (sl0->rewrite_bsid)),
- sl0->rewrite_bsid, vec_len (sl0->rewrite_bsid));
+ clib_memcpy_fast ((u8 *) ip0 - vec_len (sl0->rewrite_bsid),
+ (u8 *) ip0, (void *) sr0 - (void *) ip0);
+ clib_memcpy_fast (((u8 *) sr0 - vec_len (sl0->rewrite_bsid)),
+ sl0->rewrite_bsid, vec_len (sl0->rewrite_bsid));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite_bsid));
@@ -2811,10 +2813,10 @@ sr_policy_rewrite_b_insert (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
insert_pkts++;
@@ -2997,14 +2999,14 @@ sr_policy_rewrite_b_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
end_bsid_encaps_srh_processing (node, b2, ip2_encap, sr2, &next2);
end_bsid_encaps_srh_processing (node, b3, ip3_encap, sr3, &next3);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
- clib_memcpy (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
- sl1->rewrite, vec_len (sl1->rewrite));
- clib_memcpy (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
- sl2->rewrite, vec_len (sl2->rewrite));
- clib_memcpy (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
- sl3->rewrite, vec_len (sl3->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip1_encap) - vec_len (sl1->rewrite),
+ sl1->rewrite, vec_len (sl1->rewrite));
+ clib_memcpy_fast (((u8 *) ip2_encap) - vec_len (sl2->rewrite),
+ sl2->rewrite, vec_len (sl2->rewrite));
+ clib_memcpy_fast (((u8 *) ip3_encap) - vec_len (sl3->rewrite),
+ sl3->rewrite, vec_len (sl3->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
vlib_buffer_advance (b1, -(word) vec_len (sl1->rewrite));
@@ -3027,40 +3029,40 @@ sr_policy_rewrite_b_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip1->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip1->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b2->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b2, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip2->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip2->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip2->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip2->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
if (PREDICT_FALSE (b3->flags & VLIB_BUFFER_IS_TRACED))
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b3, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip3->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip3->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip3->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip3->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
}
@@ -3100,8 +3102,8 @@ sr_policy_rewrite_b_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
IP_PROTOCOL_IPV6_ROUTE);
end_bsid_encaps_srh_processing (node, b0, ip0_encap, sr0, &next0);
- clib_memcpy (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
- sl0->rewrite, vec_len (sl0->rewrite));
+ clib_memcpy_fast (((u8 *) ip0_encap) - vec_len (sl0->rewrite),
+ sl0->rewrite, vec_len (sl0->rewrite));
vlib_buffer_advance (b0, -(word) vec_len (sl0->rewrite));
ip0 = vlib_buffer_get_current (b0);
@@ -3113,10 +3115,10 @@ sr_policy_rewrite_b_encaps (vlib_main_t * vm, vlib_node_runtime_t * node,
{
sr_policy_rewrite_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
- sizeof (tr->src.as_u8));
- clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
- sizeof (tr->dst.as_u8));
+ clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
+ sizeof (tr->src.as_u8));
+ clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
+ sizeof (tr->dst.as_u8));
}
encap_pkts++;
diff --git a/src/vnet/srv6/sr_steering.c b/src/vnet/srv6/sr_steering.c
index d44bbae576f..66186e9fca8 100755
--- a/src/vnet/srv6/sr_steering.c
+++ b/src/vnet/srv6/sr_steering.c
@@ -249,8 +249,8 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
{
- clib_memcpy (&steer_pl->classify.l3.prefix, prefix,
- sizeof (ip46_address_t));
+ clib_memcpy_fast (&steer_pl->classify.l3.prefix, prefix,
+ sizeof (ip46_address_t));
steer_pl->classify.l3.mask_width = mask_width;
steer_pl->classify.l3.fib_table =
(table_id != (u32) ~ 0 ? table_id : 0);