diff options
author | Dave Barach <dave@barachs.net> | 2018-11-13 16:34:13 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-11-14 15:54:01 +0000 |
commit | 178cf493d009995b28fdf220f04c98860ff79a9b (patch) | |
tree | 097c1be82b8f6fa9bc04b9b1e193158e2e4997eb /src/plugins | |
parent | 6917b94f2146aa51195a6a2a1ccd8416a1d74bf3 (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/plugins')
54 files changed, 358 insertions, 361 deletions
diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c index 8c1004e9212..aeec004d77a 100644 --- a/src/plugins/acl/hash_lookup.c +++ b/src/plugins/acl/hash_lookup.c @@ -280,7 +280,7 @@ assign_mask_type_index(acl_main_t *am, fa_5tuple_t *mask) if(~0 == mask_type_index) { pool_get_aligned (am->ace_mask_type_pool, mte, CLIB_CACHE_LINE_BYTES); mask_type_index = mte - am->ace_mask_type_pool; - clib_memcpy(&mte->mask, mask, sizeof(mte->mask)); + clib_memcpy_fast(&mte->mask, mask, sizeof(mte->mask)); mte->refcount = 0; /* @@ -1500,8 +1500,8 @@ split_partition(acl_main_t *am, u32 first_index, if(pae->mask_type_index != coll_mask_type_index) continue; /* Computing min_mask and max_mask for colliding rules */ if(i==0){ - clib_memcpy(min_tuple, mask, sizeof(fa_5tuple_t)); - clib_memcpy(max_tuple, mask, sizeof(fa_5tuple_t)); + clib_memcpy_fast(min_tuple, mask, sizeof(fa_5tuple_t)); + clib_memcpy_fast(max_tuple, mask, sizeof(fa_5tuple_t)); }else{ int j; for(j=0; j<2; j++){ diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c index 6bf1fe05f05..d95de2ec892 100644 --- a/src/plugins/avf/device.c +++ b/src/plugins/avf/device.c @@ -106,7 +106,7 @@ avf_aq_desc_enq (vlib_main_t * vm, avf_device_t * ad, avf_aq_desc_t * dt, int n_retry = 5; d = &ad->atq[ad->atq_next_slot]; - clib_memcpy (d, dt, sizeof (avf_aq_desc_t)); + clib_memcpy_fast (d, dt, sizeof (avf_aq_desc_t)); d->flags |= AVF_AQ_F_RD | AVF_AQ_F_SI; if (len) d->datalen = len; @@ -116,13 +116,13 @@ avf_aq_desc_enq (vlib_main_t * vm, avf_device_t * ad, avf_aq_desc_t * dt, pa = ad->atq_bufs_pa + ad->atq_next_slot * AVF_MBOX_BUF_SZ; d->addr_hi = (u32) (pa >> 32); d->addr_lo = (u32) pa; - clib_memcpy (ad->atq_bufs + ad->atq_next_slot * AVF_MBOX_BUF_SZ, data, - len); + clib_memcpy_fast (ad->atq_bufs + ad->atq_next_slot * AVF_MBOX_BUF_SZ, + data, len); d->flags |= AVF_AQ_F_BUF; } if (ad->flags & AVF_DEVICE_F_ELOG) - clib_memcpy (&dc, d, sizeof (avf_aq_desc_t)); + clib_memcpy_fast (&dc, d, sizeof (avf_aq_desc_t)); CLIB_MEMORY_BARRIER (); vlib_log_debug (am->log_class, "%U", format_hexdump, data, len); @@ -144,7 +144,7 @@ retry: goto retry; } - clib_memcpy (dt, d, sizeof (avf_aq_desc_t)); + clib_memcpy_fast (dt, d, sizeof (avf_aq_desc_t)); if (d->flags & AVF_AQ_F_ERR) return clib_error_return (0, "adminq enqueue error [opcode 0x%x, retval " "%d]", d->opcode, d->retval); @@ -398,7 +398,7 @@ retry: return clib_error_return (0, "event message error"); vec_add2 (ad->events, e, 1); - clib_memcpy (e, buf, sizeof (virtchnl_pf_event_t)); + clib_memcpy_fast (e, buf, sizeof (virtchnl_pf_event_t)); avf_arq_slot_init (ad, ad->arq_next_slot); ad->arq_next_slot++; n_retry = 5; @@ -425,7 +425,7 @@ retry: if (d->flags & AVF_AQ_F_BUF) { void *buf = ad->arq_bufs + ad->arq_next_slot * AVF_MBOX_BUF_SZ; - clib_memcpy (out, buf, out_len); + clib_memcpy_fast (out, buf, out_len); } avf_arq_slot_init (ad, ad->arq_next_slot); @@ -637,7 +637,7 @@ avf_op_add_eth_addr (vlib_main_t * vm, avf_device_t * ad, u8 count, u8 * macs) al->vsi_id = ad->vsi_id; al->num_elements = count; for (i = 0; i < count; i++) - clib_memcpy (&al->list[i].addr, macs + i * 6, 6); + clib_memcpy_fast (&al->list[i].addr, macs + i * 6, 6); return avf_send_to_pf (vm, ad, VIRTCHNL_OP_ADD_ETH_ADDR, msg, msg_len, 0, 0); } @@ -788,7 +788,7 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad, ad->rss_key_size = res.rss_key_size; ad->rss_lut_size = res.rss_lut_size; - clib_memcpy (ad->hwaddr, res.vsi_res[0].default_mac_addr, 6); + clib_memcpy_fast (ad->hwaddr, res.vsi_res[0].default_mac_addr, 6); /* * Disable VLAN stripping diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c index 6d39ed646b5..509b4970dad 100644 --- a/src/plugins/avf/input.c +++ b/src/plugins/avf/input.c @@ -258,14 +258,14 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node, vnet_buffer (bt)->feature_arc_index; } - clib_memcpy (vnet_buffer (b[0])->sw_if_index, - vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); - clib_memcpy (vnet_buffer (b[1])->sw_if_index, - vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); - clib_memcpy (vnet_buffer (b[2])->sw_if_index, - vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); - clib_memcpy (vnet_buffer (b[3])->sw_if_index, - vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); + clib_memcpy_fast (vnet_buffer (b[0])->sw_if_index, + vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); + clib_memcpy_fast (vnet_buffer (b[1])->sw_if_index, + vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); + clib_memcpy_fast (vnet_buffer (b[2])->sw_if_index, + vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); + clib_memcpy_fast (vnet_buffer (b[3])->sw_if_index, + vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[1]); @@ -295,8 +295,8 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node, vnet_buffer (bt)->feature_arc_index; } - clib_memcpy (vnet_buffer (b[0])->sw_if_index, - vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); + clib_memcpy_fast (vnet_buffer (b[0])->sw_if_index, + vnet_buffer (bt)->sw_if_index, 2 * sizeof (u32)); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]); @@ -392,7 +392,7 @@ avf_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, u64x4_store_unaligned (v, ptd->rx_vector + n_rxv); maybe_error |= !u64x4_is_all_zero (err4); - clib_memcpy (bi, rxq->bufs + rxq->next, 4 * sizeof (u32)); + clib_memcpy_fast (bi, rxq->bufs + rxq->next, 4 * sizeof (u32)); /* next */ rxq->next = (rxq->next + 4) & mask; @@ -486,7 +486,7 @@ avf_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next[0]; tr->hw_if_index = ad->hw_if_index; - clib_memcpy (&tr->rxve, rxve, sizeof (avf_rx_vector_entry_t)); + clib_memcpy_fast (&tr->rxve, rxve, sizeof (avf_rx_vector_entry_t)); /* next */ n_trace--; diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c index ea00df25a25..9b54f34a5b2 100644 --- a/src/plugins/dpdk/device/device.c +++ b/src/plugins/dpdk/device/device.c @@ -80,12 +80,13 @@ dpdk_tx_trace_buffer (dpdk_main_t * dm, vlib_node_runtime_t * node, t0->queue_index = queue_id; t0->device_index = xd->device_index; t0->buffer_index = vlib_get_buffer_index (vm, buffer); - clib_memcpy (&t0->mb, mb, sizeof (t0->mb)); - clib_memcpy (&t0->buffer, buffer, - sizeof (buffer[0]) - sizeof (buffer->pre_data)); - clib_memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data, - sizeof (t0->buffer.pre_data)); - clib_memcpy (&t0->data, mb->buf_addr + mb->data_off, sizeof (t0->data)); + clib_memcpy_fast (&t0->mb, mb, sizeof (t0->mb)); + clib_memcpy_fast (&t0->buffer, buffer, + sizeof (buffer[0]) - sizeof (buffer->pre_data)); + clib_memcpy_fast (t0->buffer.pre_data, buffer->data + buffer->current_data, + sizeof (t0->buffer.pre_data)); + clib_memcpy_fast (&t0->data, mb->buf_addr + mb->data_off, + sizeof (t0->data)); } static_always_inline void @@ -430,10 +431,10 @@ dpdk_clear_hw_interface_counters (u32 instance) */ dpdk_update_counters (xd, vlib_time_now (dm->vlib_main)); - clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats)); - clib_memcpy (xd->last_cleared_xstats, xd->xstats, - vec_len (xd->last_cleared_xstats) * - sizeof (xd->last_cleared_xstats[0])); + clib_memcpy_fast (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats)); + clib_memcpy_fast (xd->last_cleared_xstats, xd->xstats, + vec_len (xd->last_cleared_xstats) * + sizeof (xd->last_cleared_xstats[0])); } diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index e5db674ca6d..b44cd49142c 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -97,7 +97,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now) return; xd->time_last_stats_update = now ? now : xd->time_last_stats_update; - clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats)); + clib_memcpy_fast (&xd->last_stats, &xd->stats, sizeof (xd->last_stats)); rte_eth_stats_get (xd->port_id, &xd->stats); /* maybe bump interface rx no buffer counter */ diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c index 6612ce4e1ad..63f04b8323d 100644 --- a/src/plugins/dpdk/device/flow.c +++ b/src/plugins/dpdk/device/flow.c @@ -84,10 +84,10 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe) if (f->type == VNET_FLOW_TYPE_IP6_N_TUPLE) { vnet_flow_ip6_n_tuple_t *t6 = &f->ip6_n_tuple; - clib_memcpy (ip6[0].hdr.src_addr, &t6->src_addr.addr, 16); - clib_memcpy (ip6[1].hdr.src_addr, &t6->src_addr.mask, 16); - clib_memcpy (ip6[0].hdr.dst_addr, &t6->dst_addr.addr, 16); - clib_memcpy (ip6[1].hdr.dst_addr, &t6->dst_addr.mask, 16); + clib_memcpy_fast (ip6[0].hdr.src_addr, &t6->src_addr.addr, 16); + clib_memcpy_fast (ip6[1].hdr.src_addr, &t6->src_addr.mask, 16); + clib_memcpy_fast (ip6[0].hdr.dst_addr, &t6->dst_addr.addr, 16); + clib_memcpy_fast (ip6[1].hdr.dst_addr, &t6->dst_addr.mask, 16); item->type = RTE_FLOW_ITEM_TYPE_IPV6; item->spec = ip6; item->mask = ip6 + 1; @@ -183,9 +183,9 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe) raw[0].item.relative = 1; raw[0].item.length = vxlan_hdr_sz; - clib_memcpy (raw[0].val + raw_sz, &spec_hdr, vxlan_hdr_sz); + clib_memcpy_fast (raw[0].val + raw_sz, &spec_hdr, vxlan_hdr_sz); raw[0].item.pattern = raw[0].val + raw_sz; - clib_memcpy (raw[1].val + raw_sz, &mask_hdr, vxlan_hdr_sz); + clib_memcpy_fast (raw[1].val + raw_sz, &mask_hdr, vxlan_hdr_sz); raw[1].item.pattern = raw[1].val + raw_sz; vec_add2 (items, item, 1); diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index e28ad7f7108..6a3c1c936fc 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -304,7 +304,7 @@ dpdk_process_rx_burst (vlib_main_t * vm, dpdk_per_thread_data_t * ptd, while (n_left) { b[0] = vlib_buffer_from_rte_mbuf (mb[0]); - clib_memcpy (b[0], &ptd->buffer_template, 64); + clib_memcpy_fast (b[0], &ptd->buffer_template, 64); or_flags |= dpdk_ol_flags_extract (mb, flags, 1); flags += 1; @@ -549,12 +549,13 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd, t0->device_index = xd->device_index; t0->buffer_index = vlib_get_buffer_index (vm, b0); - clib_memcpy (&t0->mb, mb[0], sizeof t0->mb); - clib_memcpy (&t0->buffer, b0, sizeof b0[0] - sizeof b0->pre_data); - clib_memcpy (t0->buffer.pre_data, b0->data, - sizeof t0->buffer.pre_data); - clib_memcpy (&t0->data, mb[0]->buf_addr + mb[0]->data_off, - sizeof t0->data); + clib_memcpy_fast (&t0->mb, mb[0], sizeof t0->mb); + clib_memcpy_fast (&t0->buffer, b0, + sizeof b0[0] - sizeof b0->pre_data); + clib_memcpy_fast (t0->buffer.pre_data, b0->data, + sizeof t0->buffer.pre_data); + clib_memcpy_fast (&t0->data, mb[0]->buf_addr + mb[0]->data_off, + sizeof t0->data); n_trace--; n_left--; buffers++; diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c index 6d8d6bbeaf0..f0fa506debb 100644 --- a/src/plugins/dpdk/ipsec/esp_decrypt.c +++ b/src/plugins/dpdk/ipsec/esp_decrypt.c @@ -304,7 +304,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm, mb0->buf_physaddr + digest - ((u8 *) mb0->buf_addr); if (!is_aead && cipher_alg->alg == RTE_CRYPTO_CIPHER_AES_CBC) - clib_memcpy(icb, iv, 16); + clib_memcpy_fast(icb, iv, 16); else /* CTR/GCM */ { u32 *_iv = (u32 *) iv; @@ -316,7 +316,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm, { aad = priv->aad; u32 * _aad = (u32 *) aad; - clib_memcpy (aad, esp0, 8); + clib_memcpy_fast (aad, esp0, 8); /* _aad[3] should always be 0 */ if (PREDICT_FALSE (sa0->use_esn)) @@ -330,7 +330,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm, if (sa0->use_esn) { - clib_memcpy (priv->icv, digest, trunc_size); + clib_memcpy_fast (priv->icv, digest, trunc_size); u32 *_digest = (u32 *) digest; _digest[0] = clib_host_to_net_u32 (sa0->seq_hi); auth_len += sizeof(sa0->seq_hi); @@ -349,7 +349,7 @@ trace: esp_decrypt_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->crypto_alg = sa0->crypto_alg; tr->integ_alg = sa0->integ_alg; - clib_memcpy (tr->packet_data, vlib_buffer_get_current (b0), + clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b0), sizeof (esp_header_t)); } } @@ -647,7 +647,7 @@ dpdk_esp_decrypt_post_inline (vlib_main_t * vm, tr->crypto_alg = sa0->crypto_alg; tr->integ_alg = sa0->integ_alg; ih4 = vlib_buffer_get_current (b0); - clib_memcpy (tr->packet_data, ih4, sizeof (ip6_header_t)); + clib_memcpy_fast (tr->packet_data, ih4, sizeof (ip6_header_t)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c index fb3f2a41b48..2259b1b7b81 100644 --- a/src/plugins/dpdk/ipsec/esp_encrypt.c +++ b/src/plugins/dpdk/ipsec/esp_encrypt.c @@ -444,7 +444,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm, /* The extra pad bytes would be overwritten by the digest */ if (pad_bytes) - clib_memcpy (padding, pad_data, 16); + clib_memcpy_fast (padding, pad_data, 16); f0 = (esp_footer_t *) (padding + pad_bytes); f0->pad_length = pad_bytes; @@ -538,7 +538,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm, u8 *p = vlib_buffer_get_current (b0); if (!sa0->is_tunnel) p += vnet_buffer (b0)->ip.save_rewrite_length; - clib_memcpy (tr->packet_data, p, sizeof (tr->packet_data)); + clib_memcpy_fast (tr->packet_data, p, sizeof (tr->packet_data)); } } vlib_put_next_frame (vm, node, next_index, n_left_to_next); diff --git a/src/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c index 34f50aacbbc..79d37f8a75e 100644 --- a/src/plugins/flowprobe/node.c +++ b/src/plugins/flowprobe/node.c @@ -157,33 +157,33 @@ flowprobe_common_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) /* Ingress interface */ u32 rx_if = clib_host_to_net_u32 (e->key.rx_sw_if_index); - clib_memcpy (to_b->data + offset, &rx_if, sizeof (rx_if)); + clib_memcpy_fast (to_b->data + offset, &rx_if, sizeof (rx_if)); offset += sizeof (rx_if); /* Egress interface */ u32 tx_if = clib_host_to_net_u32 (e->key.tx_sw_if_index); - clib_memcpy (to_b->data + offset, &tx_if, sizeof (tx_if)); + clib_memcpy_fast (to_b->data + offset, &tx_if, sizeof (tx_if)); offset += sizeof (tx_if); /* packet delta count */ u64 packetdelta = clib_host_to_net_u64 (e->packetcount); - clib_memcpy (to_b->data + offset, &packetdelta, sizeof (u64)); + clib_memcpy_fast (to_b->data + offset, &packetdelta, sizeof (u64)); offset += sizeof (u64); /* flowStartNanoseconds */ u32 t = clib_host_to_net_u32 (e->flow_start.sec + NTP_TIMESTAMP); - clib_memcpy (to_b->data + offset, &t, sizeof (u32)); + clib_memcpy_fast (to_b->data + offset, &t, sizeof (u32)); offset += sizeof (u32); t = clib_host_to_net_u32 (e->flow_start.nsec); - clib_memcpy (to_b->data + offset, &t, sizeof (u32)); + clib_memcpy_fast (to_b->data + offset, &t, sizeof (u32)); offset += sizeof (u32); /* flowEndNanoseconds */ t = clib_host_to_net_u32 (e->flow_end.sec + NTP_TIMESTAMP); - clib_memcpy (to_b->data + offset, &t, sizeof (u32)); + clib_memcpy_fast (to_b->data + offset, &t, sizeof (u32)); offset += sizeof (u32); t = clib_host_to_net_u32 (e->flow_end.nsec); - clib_memcpy (to_b->data + offset, &t, sizeof (u32)); + clib_memcpy_fast (to_b->data + offset, &t, sizeof (u32)); offset += sizeof (u32); return offset - start; @@ -195,15 +195,15 @@ flowprobe_l2_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) u16 start = offset; /* src mac address */ - clib_memcpy (to_b->data + offset, &e->key.src_mac, 6); + clib_memcpy_fast (to_b->data + offset, &e->key.src_mac, 6); offset += 6; /* dst mac address */ - clib_memcpy (to_b->data + offset, &e->key.dst_mac, 6); + clib_memcpy_fast (to_b->data + offset, &e->key.dst_mac, 6); offset += 6; /* ethertype */ - clib_memcpy (to_b->data + offset, &e->key.ethertype, 2); + clib_memcpy_fast (to_b->data + offset, &e->key.ethertype, 2); offset += 2; return offset - start; @@ -215,13 +215,13 @@ flowprobe_l3_ip6_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) u16 start = offset; /* ip6 src address */ - clib_memcpy (to_b->data + offset, &e->key.src_address, - sizeof (ip6_address_t)); + clib_memcpy_fast (to_b->data + offset, &e->key.src_address, + sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); /* ip6 dst address */ - clib_memcpy (to_b->data + offset, &e->key.dst_address, - sizeof (ip6_address_t)); + clib_memcpy_fast (to_b->data + offset, &e->key.dst_address, + sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); /* Protocol */ @@ -229,7 +229,7 @@ flowprobe_l3_ip6_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) /* octetDeltaCount */ u64 octetdelta = clib_host_to_net_u64 (e->octetcount); - clib_memcpy (to_b->data + offset, &octetdelta, sizeof (u64)); + clib_memcpy_fast (to_b->data + offset, &octetdelta, sizeof (u64)); offset += sizeof (u64); return offset - start; @@ -241,13 +241,13 @@ flowprobe_l3_ip4_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) u16 start = offset; /* ip4 src address */ - clib_memcpy (to_b->data + offset, &e->key.src_address.ip4, - sizeof (ip4_address_t)); + clib_memcpy_fast (to_b->data + offset, &e->key.src_address.ip4, + sizeof (ip4_address_t)); offset += sizeof (ip4_address_t); /* ip4 dst address */ - clib_memcpy (to_b->data + offset, &e->key.dst_address.ip4, - sizeof (ip4_address_t)); + clib_memcpy_fast (to_b->data + offset, &e->key.dst_address.ip4, + sizeof (ip4_address_t)); offset += sizeof (ip4_address_t); /* Protocol */ @@ -255,7 +255,7 @@ flowprobe_l3_ip4_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) /* octetDeltaCount */ u64 octetdelta = clib_host_to_net_u64 (e->octetcount); - clib_memcpy (to_b->data + offset, &octetdelta, sizeof (u64)); + clib_memcpy_fast (to_b->data + offset, &octetdelta, sizeof (u64)); offset += sizeof (u64); return offset - start; @@ -267,16 +267,16 @@ flowprobe_l4_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) u16 start = offset; /* src port */ - clib_memcpy (to_b->data + offset, &e->key.src_port, 2); + clib_memcpy_fast (to_b->data + offset, &e->key.src_port, 2); offset += 2; /* dst port */ - clib_memcpy (to_b->data + offset, &e->key.dst_port, 2); + clib_memcpy_fast (to_b->data + offset, &e->key.dst_port, 2); offset += 2; /* tcp control bits */ u16 control_bits = htons (e->prot.tcp.flags); - clib_memcpy (to_b->data + offset, &control_bits, 2); + clib_memcpy_fast (to_b->data + offset, &control_bits, 2); offset += 2; return offset - start; @@ -394,8 +394,8 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, if (flags & FLOW_RECORD_L2) { - clib_memcpy (k.src_mac, eth->src_address, 6); - clib_memcpy (k.dst_mac, eth->dst_address, 6); + clib_memcpy_fast (k.src_mac, eth->src_address, 6); + clib_memcpy_fast (k.dst_mac, eth->dst_address, 6); k.ethertype = ethertype; } if (collect_ip6 && ethertype == ETHERNET_TYPE_IP6) @@ -450,8 +450,8 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, { t->rx_sw_if_index = k.rx_sw_if_index; t->tx_sw_if_index = k.tx_sw_if_index; - clib_memcpy (t->src_mac, k.src_mac, 6); - clib_memcpy (t->dst_mac, k.dst_mac, 6); + clib_memcpy_fast (t->src_mac, k.src_mac, 6); + clib_memcpy_fast (t->dst_mac, k.dst_mac, 6); t->ethertype = k.ethertype; t->src_address.ip4.as_u32 = k.src_address.ip4.as_u32; t->dst_address.ip4.as_u32 = k.dst_address.ip4.as_u32; diff --git a/src/plugins/gbp/gbp_learn.c b/src/plugins/gbp/gbp_learn.c index 883f3d1c862..cd6a15d955d 100644 --- a/src/plugins/gbp/gbp_learn.c +++ b/src/plugins/gbp/gbp_learn.c @@ -338,7 +338,7 @@ gbp_learn_l2 (vlib_main_t * vm, { gbp_learn_l2_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); - clib_memcpy (t->mac.bytes, eh0->src_address, 6); + clib_memcpy_fast (t->mac.bytes, eh0->src_address, 6); t->new = (NULL == ge0); t->throttled = t0; t->sw_if_index = sw_if_index0; diff --git a/src/plugins/gtpu/gtpu_decap.c b/src/plugins/gtpu/gtpu_decap.c index c4e6c85418e..b2ac553da9c 100644 --- a/src/plugins/gtpu/gtpu_decap.c +++ b/src/plugins/gtpu/gtpu_decap.c @@ -256,7 +256,7 @@ gtpu_input (vlib_main_t * vm, next0 = GTPU_INPUT_NEXT_DROP; goto trace0; } - clib_memcpy (&last_key6, &key6_0, sizeof(key6_0)); + clib_memcpy_fast (&last_key6, &key6_0, sizeof(key6_0)); tunnel_index0 = last_tunnel_index = p0[0]; } else @@ -432,7 +432,7 @@ gtpu_input (vlib_main_t * vm, goto trace1; } - clib_memcpy (&last_key6, &key6_1, sizeof(key6_1)); + clib_memcpy_fast (&last_key6, &key6_1, sizeof(key6_1)); tunnel_index1 = last_tunnel_index = p1[0]; } else @@ -659,7 +659,7 @@ gtpu_input (vlib_main_t * vm, next0 = GTPU_INPUT_NEXT_DROP; goto trace00; } - clib_memcpy (&last_key6, &key6_0, sizeof(key6_0)); + clib_memcpy_fast (&last_key6, &key6_0, sizeof(key6_0)); tunnel_index0 = last_tunnel_index = p0[0]; } else diff --git a/src/plugins/igmp/igmp_input.c b/src/plugins/igmp/igmp_input.c index 5f54a0ba223..83e11ec6cc5 100644 --- a/src/plugins/igmp/igmp_input.c +++ b/src/plugins/igmp/igmp_input.c @@ -203,8 +203,8 @@ igmp_input (vlib_main_t * vm, vlib_node_runtime_t * node, tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; - clib_memcpy (tr->packet_data, vlib_buffer_get_current (b), - sizeof (tr->packet_data)); + clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), + sizeof (tr->packet_data)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, @@ -280,8 +280,8 @@ igmp_parse_query (vlib_main_t * vm, vlib_node_runtime_t * node, tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; - clib_memcpy (tr->packet_data, vlib_buffer_get_current (b), - sizeof (tr->packet_data)); + clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), + sizeof (tr->packet_data)); } len = igmp_membership_query_v3_length (igmp); @@ -387,8 +387,8 @@ igmp_parse_report (vlib_main_t * vm, vlib_node_runtime_t * node, tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; - clib_memcpy (tr->packet_data, vlib_buffer_get_current (b), - sizeof (tr->packet_data)); + clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), + sizeof (tr->packet_data)); } /* diff --git a/src/plugins/igmp/igmp_pkt.c b/src/plugins/igmp/igmp_pkt.c index c2a5d0911c6..81b8ecb18bc 100644 --- a/src/plugins/igmp/igmp_pkt.c +++ b/src/plugins/igmp/igmp_pkt.c @@ -92,8 +92,8 @@ igmp_pkt_build_ip_header (igmp_pkt_build_t * bk, break; case IGMP_MSG_QUERY: if (group != NULL) - clib_memcpy (&ip4->dst_address, &group->key->ip4, - sizeof (ip4_address_t)); + clib_memcpy_fast (&ip4->dst_address, &group->key->ip4, + sizeof (ip4_address_t)); else ip4->dst_address.as_u32 = IGMP_GENERAL_QUERY_ADDRESS; break; diff --git a/src/plugins/ioam/export-common/ioam_export.h b/src/plugins/ioam/export-common/ioam_export.h index 511cb88a73b..672576ebded 100644 --- a/src/plugins/ioam/export-common/ioam_export.h +++ b/src/plugins/ioam/export-common/ioam_export.h @@ -117,7 +117,7 @@ ioam_export_get_my_buffer (ioam_export_main_t * em, u32 thread_id) inline static int ioam_export_buffer_add_header (ioam_export_main_t * em, vlib_buffer_t * b0) { - clib_memcpy (b0->data, em->record_header, vec_len (em->record_header)); + clib_memcpy_fast (b0->data, em->record_header, vec_len (em->record_header)); b0->current_data = 0; b0->current_length = vec_len (em->record_header); b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h index 717aaf11b8f..e75deba73f7 100644 --- a/src/plugins/ioam/ip6/ioam_cache.h +++ b/src/plugins/ioam/ip6/ioam_cache.h @@ -374,10 +374,10 @@ ioam_cache_add (vlib_buffer_t * b0, clib_memset (entry, 0, sizeof (*entry)); pool_index = entry - cm->ioam_rewrite_pool; - clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (entry->src_address.as_u64, ip0->src_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64, + sizeof (ip6_address_t)); entry->src_port = src_port; entry->dst_port = dst_port; entry->seq_no = seq_no; @@ -395,7 +395,7 @@ ioam_cache_add (vlib_buffer_t * b0, } e2e_id_offset = (u8 *) e2e - (u8 *) hbh0; /* setup e2e id option to insert v6 address of the node caching it */ - clib_memcpy (entry->ioam_rewrite_string, hbh0, rewrite_len); + clib_memcpy_fast (entry->ioam_rewrite_string, hbh0, rewrite_len); hbh0 = (ip6_hop_by_hop_header_t *) entry->ioam_rewrite_string; /* suffix rewrite string with e2e ID option */ @@ -657,10 +657,10 @@ ioam_cache_ts_add (ip6_header_t * ip0, clib_memset (entry, 0, sizeof (*entry)); *pool_index = entry - cm->ioam_ts_pool[thread_id]; - clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (entry->src_address.as_u64, ip0->src_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64, + sizeof (ip6_address_t)); entry->src_port = src_port; entry->dst_port = dst_port; entry->seq_no = seq_no; diff --git a/src/plugins/ioam/ip6/ioam_cache_node.c b/src/plugins/ioam/ip6/ioam_cache_node.c index dd27e127a09..59bc1a64811 100644 --- a/src/plugins/ioam/ip6/ioam_cache_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_node.c @@ -344,17 +344,17 @@ ip6_add_from_cache_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); srh0 = (ip6_sr_header_t *) ((u8 *) hbh0 + rewrite_len); /* $$$ tune, rewrite_len is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_len); - clib_memcpy (srh0, cm->sr_rewrite_template, sr_rewrite_len); + clib_memcpy_fast (hbh0, rewrite, rewrite_len); + clib_memcpy_fast (srh0, cm->sr_rewrite_template, sr_rewrite_len); /* Copy dst address into the DA slot in the segment list */ - clib_memcpy (srh0->segments, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (srh0->segments, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); /* Rewrite the ip6 dst address with the first hop */ - clib_memcpy (ip0->dst_address.as_u64, entry->next_hop.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (&srh0->segments[1], - (u8 *) hbh0 + entry->my_address_offset, - sizeof (ip6_address_t)); + clib_memcpy_fast (ip0->dst_address.as_u64, entry->next_hop.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (&srh0->segments[1], + (u8 *) hbh0 + entry->my_address_offset, + sizeof (ip6_address_t)); ioam_cache_entry_free (entry); /* Patch the protocol chain, insert the h-b-h (type 0) header */ diff --git a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c index 79ee58eccda..63bcaff14b2 100644 --- a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c @@ -415,7 +415,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); @@ -475,7 +475,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh1 = (ip6_hop_by_hop_header_t *) (ip1 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh1, rewrite, rewrite_length); + clib_memcpy_fast (hbh1, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh1 + cm->rewrite_pool_index_offset); @@ -581,7 +581,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c index 7a4580d804f..84900eb7e01 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c +++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c @@ -203,7 +203,7 @@ trace00: option_data) ? trace_len : ARRAY_LEN (t->fmt_trace. option_data); t->fmt_trace.trace_len = trace_len; - clib_memcpy (&(t->fmt_trace.option_data), gpe_ioam0, trace_len); + clib_memcpy_fast (&(t->fmt_trace.option_data), gpe_ioam0, trace_len); } /* Remove the iOAM header inside the VxLAN-GPE header */ diff --git a/src/plugins/ioam/udp-ping/udp_ping_util.c b/src/plugins/ioam/udp-ping/udp_ping_util.c index 55f48ea4999..d3612cd01e0 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_util.c +++ b/src/plugins/ioam/udp-ping/udp_ping_util.c @@ -266,7 +266,7 @@ udp_ping_send_ip6_pak (vlib_main_t * vm, ip46_udp_ping_flow * flow) int bogus; b0 = vlib_get_buffer (vm, buffers[i]); stats = flow->udp_data.stats + i; - clib_memcpy (b0->data, stats->ping_rewrite, stats->rewrite_len); + clib_memcpy_fast (b0->data, stats->ping_rewrite, stats->rewrite_len); b0->current_data = 0; b0->current_length = stats->rewrite_len; b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; diff --git a/src/plugins/lacp/node.c b/src/plugins/lacp/node.c index 447e85fd373..d86972666dc 100644 --- a/src/plugins/lacp/node.c +++ b/src/plugins/lacp/node.c @@ -102,7 +102,7 @@ lacp_node_fn (vlib_main_t * vm, ? b0->current_length : sizeof (t0->pkt); t0->len = len; t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; - clib_memcpy (&t0->pkt, vlib_buffer_get_current (b0), len); + clib_memcpy_fast (&t0->pkt, vlib_buffer_get_current (b0), len); } /* push this pkt to the next graph node, always error-drop */ vlib_set_next_frame_buffer (vm, node, next0, bi0); diff --git a/src/plugins/mactime/node.c b/src/plugins/mactime/node.c index 1d45a39e1ce..4d45dd54ef3 100644 --- a/src/plugins/mactime/node.c +++ b/src/plugins/mactime/node.c @@ -142,9 +142,9 @@ mactime_node_inline (vlib_main_t * vm, en0 = vlib_buffer_get_current (b0); kv.key = 0; if (is_tx) - clib_memcpy (&kv.key, en0->dst_address, 6); + clib_memcpy_fast (&kv.key, en0->dst_address, 6); else - clib_memcpy (&kv.key, en0->src_address, 6); + clib_memcpy_fast (&kv.key, en0->src_address, 6); /* Lookup the src/dst mac address */ if (clib_bihash_search_8_8 (lut, &kv, &kv) < 0) @@ -242,15 +242,16 @@ mactime_node_inline (vlib_main_t * vm, && (b0->flags & VLIB_BUFFER_IS_TRACED))) { mactime_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); - clib_memcpy (t->src_mac, en0->src_address, sizeof (t->src_mac)); + clib_memcpy_fast (t->src_mac, en0->src_address, + sizeof (t->src_mac)); t->next_index = next0; t->device_index = device_index0; if (dp) { - clib_memcpy (t->device_name, dp->device_name, - ARRAY_LEN (t->device_name)); + clib_memcpy_fast (t->device_name, dp->device_name, + ARRAY_LEN (t->device_name)); t->device_name[ARRAY_LEN (t->device_name) - 1] = 0; } } diff --git a/src/plugins/map/ip4_map.c b/src/plugins/map/ip4_map.c index 44392e820ba..fc47d0fee46 100644 --- a/src/plugins/map/ip4_map.c +++ b/src/plugins/map/ip4_map.c @@ -666,17 +666,16 @@ ip4_map_reass (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/map/ip6_map.c b/src/plugins/map/ip6_map.c index 5b80209ae0a..35b58110876 100644 --- a/src/plugins/map/ip6_map.c +++ b/src/plugins/map/ip6_map.c @@ -583,7 +583,7 @@ ip6_map_ip6_reass_prepare (vlib_main_t * vm, vlib_node_runtime_t * node, if (ip6_frag_hdr_offset (frag0)) { //Not first fragment, add the IPv4 header - clib_memcpy (ip40, &r->ip4_header, 20); + clib_memcpy_fast (ip40, &r->ip4_header, 20); } #ifdef MAP_IP6_REASS_COUNT_BYTES @@ -594,8 +594,8 @@ ip6_map_ip6_reass_prepare (vlib_main_t * vm, vlib_node_runtime_t * node, if (ip6_frag_hdr_more (frag0)) { //Not last fragment, we copy end of next - clib_memcpy (u8_ptr_add (ip60, p0->current_length), - r->fragments[i].next_data, 20); + clib_memcpy_fast (u8_ptr_add (ip60, p0->current_length), + r->fragments[i].next_data, 20); p0->current_length += 20; ip60->payload_length = u16_net_add (ip60->payload_length, 20); } @@ -976,17 +976,16 @@ ip6_map_ip4_reass (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c index 13caa368322..49796e47a8e 100644 --- a/src/plugins/map/map.c +++ b/src/plugins/map/map.c @@ -1807,7 +1807,7 @@ map_ip6_reass_add_fragment (map_ip6_reass_t * r, u32 pi, if (!prev_f) return -1; - clib_memcpy (prev_f->next_data, data_start, copied_len); + clib_memcpy_fast (prev_f->next_data, data_start, copied_len); prev_f->next_data_len = copied_len; prev_f->next_data_offset = data_offset; } @@ -1817,7 +1817,7 @@ map_ip6_reass_add_fragment (map_ip6_reass_t * r, u32 pi, return -1; if (r->ip4_header.ip_version_and_header_length == 0) - clib_memcpy (&r->ip4_header, data_start, sizeof (ip4_header_t)); + clib_memcpy_fast (&r->ip4_header, data_start, sizeof (ip4_header_t)); } if (data_len > 20) diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h index 1e07b59f762..c4cc855d2e2 100644 --- a/src/plugins/map/map.h +++ b/src/plugins/map/map.h @@ -538,7 +538,7 @@ ip4_map_t_embedded_address (map_domain_t *d, u8 offset = d->ip6_src_len == 64 ? 9 : 12; ip6->as_u64[0] = d->ip6_src.as_u64[0]; ip6->as_u64[1] = d->ip6_src.as_u64[1]; - clib_memcpy(&ip6->as_u8[offset], ip4, 4); + clib_memcpy_fast(&ip6->as_u8[offset], ip4, 4); } static_always_inline u32 diff --git a/src/plugins/marvell/pp2/input.c b/src/plugins/marvell/pp2/input.c index c1a0c624ea9..50f09633272 100644 --- a/src/plugins/marvell/pp2/input.c +++ b/src/plugins/marvell/pp2/input.c @@ -65,7 +65,7 @@ mrvl_pp2_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node, u32 next0, tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->next_index = next0; tr->hw_if_index = ppif->hw_if_index; - clib_memcpy (&tr->desc, d, sizeof (struct pp2_ppio_desc)); + clib_memcpy_fast (&tr->desc, d, sizeof (struct pp2_ppio_desc)); } static_always_inline u16 @@ -225,10 +225,10 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, next0 = next1 = ppif->per_interface_next_index; } - clib_memcpy (vnet_buffer (b0)->sw_if_index, sw_if_index, - sizeof (sw_if_index)); - clib_memcpy (vnet_buffer (b1)->sw_if_index, sw_if_index, - sizeof (sw_if_index)); + clib_memcpy_fast (vnet_buffer (b0)->sw_if_index, sw_if_index, + sizeof (sw_if_index)); + clib_memcpy_fast (vnet_buffer (b1)->sw_if_index, sw_if_index, + sizeof (sw_if_index)); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b1); @@ -271,8 +271,8 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, next0 = ppif->per_interface_next_index; } - clib_memcpy (vnet_buffer (b0)->sw_if_index, sw_if_index, - sizeof (sw_if_index)); + clib_memcpy_fast (vnet_buffer (b0)->sw_if_index, sw_if_index, + sizeof (sw_if_index)); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); diff --git a/src/plugins/marvell/pp2/output.c b/src/plugins/marvell/pp2/output.c index 18969a458e2..dbd106a5930 100644 --- a/src/plugins/marvell/pp2/output.c +++ b/src/plugins/marvell/pp2/output.c @@ -101,10 +101,10 @@ mrvl_pp2_interface_tx (vlib_main_t * vm, buffers = vlib_frame_vector_args (frame); u16 n_copy = clib_min (outq->size - slot, n_sent); - clib_memcpy (outq->buffers + slot, buffers, n_copy * sizeof (u32)); + clib_memcpy_fast (outq->buffers + slot, buffers, n_copy * sizeof (u32)); if (PREDICT_FALSE (n_copy < n_sent)) - clib_memcpy (outq->buffers, buffers + n_copy, - (n_sent - n_copy) * sizeof (u32)); + clib_memcpy_fast (outq->buffers, buffers + n_copy, + (n_sent - n_copy) * sizeof (u32)); outq->head += n_sent; } diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c index 9e4cd69b75f..28bf8259311 100644 --- a/src/plugins/memif/device.c +++ b/src/plugins/memif/device.c @@ -239,14 +239,14 @@ no_free_slots: b2 = vlib_get_buffer (vm, ptd->buffers[co[2].buffer_vec_index]); b3 = vlib_get_buffer (vm, ptd->buffers[co[3].buffer_vec_index]); - clib_memcpy (co[0].data, b0->data + co[0].buffer_offset, - co[0].data_len); - clib_memcpy (co[1].data, b1->data + co[1].buffer_offset, - co[1].data_len); - clib_memcpy (co[2].data, b2->data + co[2].buffer_offset, - co[2].data_len); - clib_memcpy (co[3].data, b3->data + co[3].buffer_offset, - co[3].data_len); + clib_memcpy_fast (co[0].data, b0->data + co[0].buffer_offset, + co[0].data_len); + clib_memcpy_fast (co[1].data, b1->data + co[1].buffer_offset, + co[1].data_len); + clib_memcpy_fast (co[2].data, b2->data + co[2].buffer_offset, + co[2].data_len); + clib_memcpy_fast (co[3].data, b3->data + co[3].buffer_offset, + co[3].data_len); co += 4; n_copy_op -= 4; @@ -254,8 +254,8 @@ no_free_slots: while (n_copy_op) { b0 = vlib_get_buffer (vm, ptd->buffers[co[0].buffer_vec_index]); - clib_memcpy (co[0].data, b0->data + co[0].buffer_offset, - co[0].data_len); + clib_memcpy_fast (co[0].data, b0->data + co[0].buffer_offset, + co[0].data_len); co += 1; n_copy_op -= 1; } diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c index 997ac8fcbad..8bd9fcddcb6 100644 --- a/src/plugins/memif/node.c +++ b/src/plugins/memif/node.c @@ -303,14 +303,14 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, b2 = vlib_get_buffer (vm, ptd->buffers[co[2].buffer_vec_index]); b3 = vlib_get_buffer (vm, ptd->buffers[co[3].buffer_vec_index]); - clib_memcpy (b0->data + co[0].buffer_offset, co[0].data, - co[0].data_len); - clib_memcpy (b1->data + co[1].buffer_offset, co[1].data, - co[1].data_len); - clib_memcpy (b2->data + co[2].buffer_offset, co[2].data, - co[2].data_len); - clib_memcpy (b3->data + co[3].buffer_offset, co[3].data, - co[3].data_len); + clib_memcpy_fast (b0->data + co[0].buffer_offset, co[0].data, + co[0].data_len); + clib_memcpy_fast (b1->data + co[1].buffer_offset, co[1].data, + co[1].data_len); + clib_memcpy_fast (b2->data + co[2].buffer_offset, co[2].data, + co[2].data_len); + clib_memcpy_fast (b3->data + co[3].buffer_offset, co[3].data, + co[3].data_len); co += 4; n_left -= 4; @@ -318,8 +318,8 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, while (n_left) { b0 = vlib_get_buffer (vm, ptd->buffers[co[0].buffer_vec_index]); - clib_memcpy (b0->data + co[0].buffer_offset, co[0].data, - co[0].data_len); + clib_memcpy_fast (b0->data + co[0].buffer_offset, co[0].data, + co[0].data_len); co += 1; n_left -= 1; } @@ -424,7 +424,7 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, fbvi[0] = po[0].first_buffer_vec_index; bi[0] = ptd->buffers[fbvi[0]]; b0 = vlib_get_buffer (vm, bi[0]); - clib_memcpy (b0, bt, 64); + clib_memcpy_fast (b0, bt, 64); b0->current_length = po->packet_len; n_rx_bytes += b0->current_length; @@ -783,10 +783,10 @@ refill: d2 = &ring->desc[s2]; d3 = &ring->desc[s3]; - clib_memcpy (d0, dt, sizeof (memif_desc_t)); - clib_memcpy (d1, dt, sizeof (memif_desc_t)); - clib_memcpy (d2, dt, sizeof (memif_desc_t)); - clib_memcpy (d3, dt, sizeof (memif_desc_t)); + clib_memcpy_fast (d0, dt, sizeof (memif_desc_t)); + clib_memcpy_fast (d1, dt, sizeof (memif_desc_t)); + clib_memcpy_fast (d2, dt, sizeof (memif_desc_t)); + clib_memcpy_fast (d3, dt, sizeof (memif_desc_t)); b0 = vlib_get_buffer (vm, mq->buffers[s0]); b1 = vlib_get_buffer (vm, mq->buffers[s1]); @@ -813,7 +813,7 @@ refill: { s0 = head++ & mask; d0 = &ring->desc[s0]; - clib_memcpy (d0, dt, sizeof (memif_desc_t)); + clib_memcpy_fast (d0, dt, sizeof (memif_desc_t)); b0 = vlib_get_buffer (vm, mq->buffers[s0]); d0->region = b0->buffer_pool_index + 1; d0->offset = diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c index cb169814eac..d4432d98016 100755 --- a/src/plugins/nat/in2out.c +++ b/src/plugins/nat/in2out.c @@ -1891,17 +1891,16 @@ nat44_in2out_reass_node_fn (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c index f9f8d776eb4..e32e1386d8d 100644 --- a/src/plugins/nat/in2out_ed.c +++ b/src/plugins/nat/in2out_ed.c @@ -2002,17 +2002,16 @@ nat44_ed_in2out_reass_node_fn_inline (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/nat44_classify.c b/src/plugins/nat/nat44_classify.c index 0e9863c02ac..8608fc532e2 100644 --- a/src/plugins/nat/nat44_classify.c +++ b/src/plugins/nat/nat44_classify.c @@ -374,17 +374,16 @@ nat44_classify_node_fn_inline (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c index 86c65edfbee..8bcca2b33d3 100644 --- a/src/plugins/nat/nat64.c +++ b/src/plugins/nat/nat64.c @@ -1018,7 +1018,7 @@ nat64_compose_ip6 (ip6_address_t * ip6, ip4_address_t * ip4, u32 fib_index) if (prefix) { - clib_memcpy (ip6, &p->prefix, sizeof (ip6_address_t)); + clib_memcpy_fast (ip6, &p->prefix, sizeof (ip6_address_t)); switch (p->plen) { case 32: @@ -1058,7 +1058,7 @@ nat64_compose_ip6 (ip6_address_t * ip6, ip4_address_t * ip4, u32 fib_index) } else { - clib_memcpy (ip6, well_known_prefix, sizeof (ip6_address_t)); + clib_memcpy_fast (ip6, well_known_prefix, sizeof (ip6_address_t)); ip6->as_u32[3] = ip4->as_u32; } } diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c index d19aab87983..0652f4481bc 100644 --- a/src/plugins/nat/nat64_in2out.c +++ b/src/plugins/nat/nat64_in2out.c @@ -1559,17 +1559,16 @@ nat64_in2out_reass_node_fn (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c index 79ff161b326..1c8df8a16db 100644 --- a/src/plugins/nat/nat64_out2in.c +++ b/src/plugins/nat/nat64_out2in.c @@ -842,17 +842,16 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/nat_inlines.h b/src/plugins/nat/nat_inlines.h index 4bdb2cb66d9..c0f16721173 100644 --- a/src/plugins/nat/nat_inlines.h +++ b/src/plugins/nat/nat_inlines.h @@ -371,7 +371,7 @@ mss_clamping (snat_main_t * sm, tcp_header_t * tcp, ip_csum_t * sum) *sum = ip_csum_update (*sum, mss, sm->mss_value_net, ip4_header_t, length); - clib_memcpy (data + 2, &sm->mss_value_net, 2); + clib_memcpy_fast (data + 2, &sm->mss_value_net, 2); } return; } diff --git a/src/plugins/nat/nat_ipfix_logging.c b/src/plugins/nat/nat_ipfix_logging.c index 8a3668e2759..042239fee85 100644 --- a/src/plugins/nat/nat_ipfix_logging.c +++ b/src/plugins/nat/nat_ipfix_logging.c @@ -674,28 +674,28 @@ snat_ipfix_logging_nat44_ses (u8 nat_event, u32 src_ip, u32 nat_src_ip, if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, &src_ip, sizeof (src_ip)); + clib_memcpy_fast (b0->data + offset, &src_ip, sizeof (src_ip)); offset += sizeof (src_ip); - clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); + clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); offset += sizeof (nat_src_ip); - clib_memcpy (b0->data + offset, &proto, sizeof (proto)); + clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto)); offset += sizeof (proto); - clib_memcpy (b0->data + offset, &src_port, sizeof (src_port)); + clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port)); offset += sizeof (src_port); - clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); + clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); offset += sizeof (nat_src_port); - clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id)); + clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id)); offset += sizeof (vrf_id); b0->current_length += NAT44_SESSION_CREATE_LEN; @@ -775,13 +775,13 @@ snat_ipfix_logging_addr_exhausted (u32 pool_id, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, &pool_id, sizeof (pool_id)); + clib_memcpy_fast (b0->data + offset, &pool_id, sizeof (pool_id)); offset += sizeof (pool_id); b0->current_length += NAT_ADDRESSES_EXHAUTED_LEN; @@ -862,19 +862,19 @@ snat_ipfix_logging_max_entries_per_usr (u32 limit, u32 src_ip, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, "a_event, sizeof (quota_event)); + clib_memcpy_fast (b0->data + offset, "a_event, sizeof (quota_event)); offset += sizeof (quota_event); - clib_memcpy (b0->data + offset, &limit, sizeof (limit)); + clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit)); offset += sizeof (limit); - clib_memcpy (b0->data + offset, &src_ip, sizeof (src_ip)); + clib_memcpy_fast (b0->data + offset, &src_ip, sizeof (src_ip)); offset += sizeof (src_ip); b0->current_length += MAX_ENTRIES_PER_USER_LEN; @@ -955,16 +955,16 @@ nat_ipfix_logging_max_ses (u32 limit, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, "a_event, sizeof (quota_event)); + clib_memcpy_fast (b0->data + offset, "a_event, sizeof (quota_event)); offset += sizeof (quota_event); - clib_memcpy (b0->data + offset, &limit, sizeof (limit)); + clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit)); offset += sizeof (limit); b0->current_length += MAX_SESSIONS_LEN; @@ -1045,16 +1045,16 @@ nat_ipfix_logging_max_bib (u32 limit, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, "a_event, sizeof (quota_event)); + clib_memcpy_fast (b0->data + offset, "a_event, sizeof (quota_event)); offset += sizeof (quota_event); - clib_memcpy (b0->data + offset, &limit, sizeof (limit)); + clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit)); offset += sizeof (limit); b0->current_length += MAX_BIBS_LEN; @@ -1135,19 +1135,19 @@ nat_ipfix_logging_max_frag_ip4 (u32 limit, u32 src, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, "a_event, sizeof (quota_event)); + clib_memcpy_fast (b0->data + offset, "a_event, sizeof (quota_event)); offset += sizeof (quota_event); - clib_memcpy (b0->data + offset, &limit, sizeof (limit)); + clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit)); offset += sizeof (limit); - clib_memcpy (b0->data + offset, &src, sizeof (src)); + clib_memcpy_fast (b0->data + offset, &src, sizeof (src)); offset += sizeof (src); b0->current_length += MAX_FRAGMENTS_IP4_LEN; @@ -1228,19 +1228,19 @@ nat_ipfix_logging_max_frag_ip6 (u32 limit, ip6_address_t * src, int do_flush) if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, "a_event, sizeof (quota_event)); + clib_memcpy_fast (b0->data + offset, "a_event, sizeof (quota_event)); offset += sizeof (quota_event); - clib_memcpy (b0->data + offset, &limit, sizeof (limit)); + clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit)); offset += sizeof (limit); - clib_memcpy (b0->data + offset, src, sizeof (ip6_address_t)); + clib_memcpy_fast (b0->data + offset, src, sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); b0->current_length += MAX_FRAGMENTS_IP6_LEN; @@ -1321,28 +1321,28 @@ nat_ipfix_logging_nat64_bibe (u8 nat_event, ip6_address_t * src_ip, if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, src_ip, sizeof (ip6_address_t)); + clib_memcpy_fast (b0->data + offset, src_ip, sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); - clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); + clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); offset += sizeof (nat_src_ip); - clib_memcpy (b0->data + offset, &proto, sizeof (proto)); + clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto)); offset += sizeof (proto); - clib_memcpy (b0->data + offset, &src_port, sizeof (src_port)); + clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port)); offset += sizeof (src_port); - clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); + clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); offset += sizeof (nat_src_port); - clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id)); + clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id)); offset += sizeof (vrf_id); b0->current_length += NAT64_BIB_LEN; @@ -1425,40 +1425,40 @@ nat_ipfix_logging_nat64_ses (u8 nat_event, ip6_address_t * src_ip, if (PREDICT_TRUE (do_flush == 0)) { u64 time_stamp = clib_host_to_net_u64 (now); - clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp)); + clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp)); offset += sizeof (time_stamp); - clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event)); + clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event)); offset += sizeof (nat_event); - clib_memcpy (b0->data + offset, src_ip, sizeof (ip6_address_t)); + clib_memcpy_fast (b0->data + offset, src_ip, sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); - clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); + clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip)); offset += sizeof (nat_src_ip); - clib_memcpy (b0->data + offset, &proto, sizeof (proto)); + clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto)); offset += sizeof (proto); - clib_memcpy (b0->data + offset, &src_port, sizeof (src_port)); + clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port)); offset += sizeof (src_port); - clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); + clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port)); offset += sizeof (nat_src_port); - clib_memcpy (b0->data + offset, dst_ip, sizeof (ip6_address_t)); + clib_memcpy_fast (b0->data + offset, dst_ip, sizeof (ip6_address_t)); offset += sizeof (ip6_address_t); - clib_memcpy (b0->data + offset, &nat_dst_ip, sizeof (nat_dst_ip)); + clib_memcpy_fast (b0->data + offset, &nat_dst_ip, sizeof (nat_dst_ip)); offset += sizeof (nat_dst_ip); - clib_memcpy (b0->data + offset, &dst_port, sizeof (dst_port)); + clib_memcpy_fast (b0->data + offset, &dst_port, sizeof (dst_port)); offset += sizeof (dst_port); - clib_memcpy (b0->data + offset, &nat_dst_port, sizeof (nat_dst_port)); + clib_memcpy_fast (b0->data + offset, &nat_dst_port, sizeof (nat_dst_port)); offset += sizeof (nat_dst_port); - clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id)); + clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id)); offset += sizeof (vrf_id); b0->current_length += NAT64_SES_LEN; diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c index c4d1fbf6900..9cace08c565 100755 --- a/src/plugins/nat/out2in.c +++ b/src/plugins/nat/out2in.c @@ -1568,17 +1568,16 @@ nat44_out2in_reass_node_fn (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nat/out2in_ed.c b/src/plugins/nat/out2in_ed.c index b2dbc513df6..55b34f5c2e8 100644 --- a/src/plugins/nat/out2in_ed.c +++ b/src/plugins/nat/out2in_ed.c @@ -1844,17 +1844,16 @@ nat44_ed_out2in_reass_node_fn (vlib_main_t * vm, u32 len = vec_len (fragments_to_loopback); if (len <= VLIB_FRAME_SIZE) { - clib_memcpy (from, fragments_to_loopback, - sizeof (u32) * len); + clib_memcpy_fast (from, fragments_to_loopback, + sizeof (u32) * len); n_left_from = len; vec_reset_length (fragments_to_loopback); } else { - clib_memcpy (from, - fragments_to_loopback + (len - - VLIB_FRAME_SIZE), - sizeof (u32) * VLIB_FRAME_SIZE); + clib_memcpy_fast (from, fragments_to_loopback + + (len - VLIB_FRAME_SIZE), + sizeof (u32) * VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c index 73b57f64e90..57e5e6cfa39 100644 --- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c +++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c @@ -242,7 +242,7 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index); t1->dst_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32; key4_copy = clib_mem_alloc (sizeof (*key4_copy)); clib_memset(key4_copy, 0, sizeof(*key4_copy)); - clib_memcpy (key4_copy, &key4, sizeof (*key4_copy)); + clib_memcpy_fast (key4_copy, &key4, sizeof (*key4_copy)); hash_set_mem (hm->dst_by_ip4, key4_copy, t1 - hm->dst_tunnels); /* * Attach to the FIB entry for the VxLAN-GPE destination diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c index 495bb16aab2..bd56a6ab7b1 100644 --- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c +++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c @@ -308,7 +308,8 @@ nsh_md2_ioam_trace_swap_handler (vlib_buffer_t * b, nsh_tlv_header_t * new_opt) { - clib_memcpy (new_opt, old_opt, new_opt->length + sizeof (nsh_tlv_header_t)); + clib_memcpy_fast (new_opt, old_opt, + new_opt->length + sizeof (nsh_tlv_header_t)); return nsh_md2_ioam_trace_data_list_handler (b, new_opt); } diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h index 8fbb3b7aaf7..77cc8792c93 100644 --- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h +++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h @@ -105,7 +105,7 @@ nsh_md2_ioam_encap_decap_ioam_v4_one_inline (vlib_main_t * vm, if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED)) { nsh_transit_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - clib_memcpy (&(tr->trace_data), nsh_hdr, (nsh_hdr->length * 4)); + clib_memcpy_fast (&(tr->trace_data), nsh_hdr, (nsh_hdr->length * 4)); } return; } diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c index d9b625cda04..b293b85db8a 100644 --- a/src/plugins/nsh/nsh.c +++ b/src/plugins/nsh/nsh.c @@ -1771,13 +1771,13 @@ nsh_input_map (vlib_main_t * vm, else if (node_type == NSH_AWARE_VNF_PROXY_TYPE) { /* Push dummy Eth header */ - clib_memcpy (dummy_eth0.dst_address, dummy_dst_address, 6); - clib_memcpy (dummy_eth0.src_address, dummy_src_address, 6); + clib_memcpy_fast (dummy_eth0.dst_address, dummy_dst_address, 6); + clib_memcpy_fast (dummy_eth0.src_address, dummy_src_address, 6); dummy_eth0.type = 0x0800; vlib_buffer_advance (b0, -(word) sizeof (ethernet_header_t)); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, &dummy_eth0, - (word) sizeof (ethernet_header_t)); + clib_memcpy_fast (hdr0, &dummy_eth0, + (word) sizeof (ethernet_header_t)); sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX]; nsp_nsi0 = nm->tunnel_index_by_sw_if_index[sw_if_index0]; @@ -1880,7 +1880,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b0, -(word) encap_hdr_len0); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, encap_hdr0, (word) encap_hdr_len0); + clib_memcpy_fast (hdr0, encap_hdr0, (word) encap_hdr_len0); goto trace0; } @@ -1892,7 +1892,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b0, -(word) encap_hdr_len0); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, encap_hdr0, (word) encap_hdr_len0); + clib_memcpy_fast (hdr0, encap_hdr0, (word) encap_hdr_len0); /* Manipulate MD2 */ if (PREDICT_FALSE (nsh_entry0->nsh_base.md_type == 2)) @@ -1909,8 +1909,8 @@ nsh_input_map (vlib_main_t * vm, { nsh_input_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - clib_memcpy (&(tr->trace_data), hdr0, - ((hdr0->length & NSH_LEN_MASK) * 4)); + clib_memcpy_fast (&(tr->trace_data), hdr0, + ((hdr0->length & NSH_LEN_MASK) * 4)); } /* Process packet 1 */ @@ -1936,13 +1936,13 @@ nsh_input_map (vlib_main_t * vm, else if (node_type == NSH_AWARE_VNF_PROXY_TYPE) { /* Push dummy Eth header */ - clib_memcpy (dummy_eth1.dst_address, dummy_dst_address, 6); - clib_memcpy (dummy_eth1.src_address, dummy_src_address, 6); + clib_memcpy_fast (dummy_eth1.dst_address, dummy_dst_address, 6); + clib_memcpy_fast (dummy_eth1.src_address, dummy_src_address, 6); dummy_eth1.type = 0x0800; vlib_buffer_advance (b1, -(word) sizeof (ethernet_header_t)); hdr1 = vlib_buffer_get_current (b1); - clib_memcpy (hdr1, &dummy_eth1, - (word) sizeof (ethernet_header_t)); + clib_memcpy_fast (hdr1, &dummy_eth1, + (word) sizeof (ethernet_header_t)); sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX]; nsp_nsi1 = nm->tunnel_index_by_sw_if_index[sw_if_index1]; @@ -2045,7 +2045,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b1, -(word) encap_hdr_len1); hdr1 = vlib_buffer_get_current (b1); - clib_memcpy (hdr1, encap_hdr1, (word) encap_hdr_len1); + clib_memcpy_fast (hdr1, encap_hdr1, (word) encap_hdr_len1); goto trace1; } @@ -2057,7 +2057,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b1, -(word) encap_hdr_len1); hdr1 = vlib_buffer_get_current (b1); - clib_memcpy (hdr1, encap_hdr1, (word) encap_hdr_len1); + clib_memcpy_fast (hdr1, encap_hdr1, (word) encap_hdr_len1); /* Manipulate MD2 */ if (PREDICT_FALSE (nsh_entry1->nsh_base.md_type == 2)) @@ -2074,8 +2074,8 @@ nsh_input_map (vlib_main_t * vm, { nsh_input_trace_t *tr = vlib_add_trace (vm, node, b1, sizeof (*tr)); - clib_memcpy (&(tr->trace_data), hdr1, - ((hdr1->length & NSH_LEN_MASK) * 4)); + clib_memcpy_fast (&(tr->trace_data), hdr1, + ((hdr1->length & NSH_LEN_MASK) * 4)); } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, @@ -2138,13 +2138,13 @@ nsh_input_map (vlib_main_t * vm, else if (node_type == NSH_AWARE_VNF_PROXY_TYPE) { /* Push dummy Eth header */ - clib_memcpy (dummy_eth0.dst_address, dummy_dst_address, 6); - clib_memcpy (dummy_eth0.src_address, dummy_src_address, 6); + clib_memcpy_fast (dummy_eth0.dst_address, dummy_dst_address, 6); + clib_memcpy_fast (dummy_eth0.src_address, dummy_src_address, 6); dummy_eth0.type = 0x0800; vlib_buffer_advance (b0, -(word) sizeof (ethernet_header_t)); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, &dummy_eth0, - (word) sizeof (ethernet_header_t)); + clib_memcpy_fast (hdr0, &dummy_eth0, + (word) sizeof (ethernet_header_t)); sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX]; nsp_nsi0 = nm->tunnel_index_by_sw_if_index[sw_if_index0]; @@ -2250,7 +2250,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b0, -(word) encap_hdr_len0); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, encap_hdr0, (word) encap_hdr_len0); + clib_memcpy_fast (hdr0, encap_hdr0, (word) encap_hdr_len0); goto trace00; } @@ -2262,7 +2262,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance (b0, -(word) encap_hdr_len0); hdr0 = vlib_buffer_get_current (b0); - clib_memcpy (hdr0, encap_hdr0, (word) encap_hdr_len0); + clib_memcpy_fast (hdr0, encap_hdr0, (word) encap_hdr_len0); /* Manipulate MD2 */ if (PREDICT_FALSE (nsh_entry0->nsh_base.md_type == 2)) { @@ -2277,8 +2277,8 @@ nsh_input_map (vlib_main_t * vm, { nsh_input_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - clib_memcpy (&(tr->trace_data[0]), hdr0, - ((hdr0->length & NSH_LEN_MASK) * 4)); + clib_memcpy_fast (&(tr->trace_data[0]), hdr0, + ((hdr0->length & NSH_LEN_MASK) * 4)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, diff --git a/src/plugins/nsh/nsh_pop.c b/src/plugins/nsh/nsh_pop.c index cd25bb9e3f7..682a92d178a 100644 --- a/src/plugins/nsh/nsh_pop.c +++ b/src/plugins/nsh/nsh_pop.c @@ -162,7 +162,7 @@ nsh_pop_inline (vlib_main_t * vm, if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED)) { nsh_input_trace_t *tr = vlib_add_trace(vm, node, b0, sizeof(*tr)); - clib_memcpy ( &(tr->trace_data), hdr0, (hdr0->length*4) ); + clib_memcpy_fast ( &(tr->trace_data), hdr0, (hdr0->length*4) ); } /* Process packet 1 */ @@ -216,7 +216,7 @@ nsh_pop_inline (vlib_main_t * vm, if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED)) { nsh_input_trace_t *tr = vlib_add_trace(vm, node, b1, sizeof(*tr)); - clib_memcpy ( &(tr->trace_data), hdr1, (hdr1->length*4) ); + clib_memcpy_fast ( &(tr->trace_data), hdr1, (hdr1->length*4) ); } vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, @@ -301,7 +301,7 @@ nsh_pop_inline (vlib_main_t * vm, if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED)) { nsh_input_trace_t *tr = vlib_add_trace(vm, node, b0, sizeof(*tr)); - clib_memcpy ( &(tr->trace_data[0]), hdr0, (hdr0->length*4) ); + clib_memcpy_fast ( &(tr->trace_data[0]), hdr0, (hdr0->length*4) ); } vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, diff --git a/src/plugins/nsim/node.c b/src/plugins/nsim/node.c index dfd0bf747f1..d6413778bf3 100644 --- a/src/plugins/nsim/node.c +++ b/src/plugins/nsim/node.c @@ -121,8 +121,8 @@ nsim_inline (vlib_main_t * vm, ? nsm->sw_if_index1 : nsm->sw_if_index0; ep->current_length = vlib_buffer_length_in_chain (vm, b[0]); ASSERT (ep->current_length <= WHEEL_ENTRY_DATA_SIZE); - clib_memcpy (ep->data, vlib_buffer_get_current (b[0]), - ep->current_length); + clib_memcpy_fast (ep->data, vlib_buffer_get_current (b[0]), + ep->current_length); } else /* out of wheel space, drop pkt */ { diff --git a/src/plugins/nsim/nsim_input.c b/src/plugins/nsim/nsim_input.c index 38c3891fd95..66bd8d10954 100644 --- a/src/plugins/nsim/nsim_input.c +++ b/src/plugins/nsim/nsim_input.c @@ -154,7 +154,7 @@ nsim_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, b0->current_length = ep->current_length; /* Copy data from the ring */ - clib_memcpy (b0->data, ep->data, ep->current_length); + clib_memcpy_fast (b0->data, ep->data, ep->current_length); b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; vnet_buffer (b0)->sw_if_index[VLIB_TX] = ep->tx_sw_if_index; vnet_buffer (b0)->sw_if_index[VLIB_RX] = diff --git a/src/plugins/perfmon/perfmon_periodic.c b/src/plugins/perfmon/perfmon_periodic.c index 329a75d7305..4e7e2378320 100644 --- a/src/plugins/perfmon/perfmon_periodic.c +++ b/src/plugins/perfmon/perfmon_periodic.c @@ -271,7 +271,7 @@ scrape_and_clear_counters (perfmon_main_t * pm) { n = nm->nodes[i]; nodes[i] = clib_mem_alloc (sizeof (*n)); - clib_memcpy (nodes[i], n, sizeof (*n)); + clib_memcpy_fast (nodes[i], n, sizeof (*n)); n->stats_total.perf_counter_ticks = 0; n->stats_total.perf_counter_vectors = 0; n->stats_last_clear.perf_counter_ticks = 0; diff --git a/src/plugins/pppoe/pppoe_cp_node.c b/src/plugins/pppoe/pppoe_cp_node.c index c73666de744..884d207d655 100644 --- a/src/plugins/pppoe/pppoe_cp_node.c +++ b/src/plugins/pppoe/pppoe_cp_node.c @@ -157,7 +157,7 @@ pppoe_cp_dispatch (vlib_main_t * vm, /* set src mac address */ si = vnet_get_sw_interface(vnm, tx_sw_if_index0); hi = vnet_get_hw_interface (vnm, si->hw_if_index); - clib_memcpy (vlib_buffer_get_current (b0)+6, hi->hw_address, 6); + clib_memcpy_fast (vlib_buffer_get_current (b0)+6, hi->hw_address, 6); } else { diff --git a/src/plugins/srv6-ad/node.c b/src/plugins/srv6-ad/node.c index 776d283dbe7..8f32ae0e49e 100644 --- a/src/plugins/srv6-ad/node.c +++ b/src/plugins/srv6-ad/node.c @@ -166,7 +166,7 @@ end_ad_processing (vlib_buffer_t * b0, { vec_validate (ls0_mem->rewrite, total_size - 1); } - clib_memcpy (ls0_mem->rewrite, ip0, total_size); + clib_memcpy_fast (ls0_mem->rewrite, ip0, total_size); ls0_mem->rw_len = total_size; /* Remove IP header and extensions */ @@ -349,8 +349,8 @@ srv6_ad2_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (ls0_mem->rw_len + b0->current_data)); - clib_memcpy (((u8 *) en0) - ls0_mem->rw_len, - ls0_mem->rewrite, ls0_mem->rw_len); + clib_memcpy_fast (((u8 *) en0) - ls0_mem->rw_len, + ls0_mem->rewrite, ls0_mem->rw_len); vlib_buffer_advance (b0, -(word) ls0_mem->rw_len); ip0 = vlib_buffer_get_current (b0); @@ -373,10 +373,10 @@ srv6_ad2_rewrite_fn (vlib_main_t * vm, } else { - 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); } } @@ -484,8 +484,8 @@ srv6_ad4_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (ls0_mem->rw_len + b0->current_data)); - clib_memcpy (((u8 *) ip0_encap) - ls0_mem->rw_len, - ls0_mem->rewrite, ls0_mem->rw_len); + clib_memcpy_fast (((u8 *) ip0_encap) - ls0_mem->rw_len, + ls0_mem->rewrite, ls0_mem->rw_len); vlib_buffer_advance (b0, -(word) ls0_mem->rw_len); ip0 = vlib_buffer_get_current (b0); @@ -516,10 +516,10 @@ srv6_ad4_rewrite_fn (vlib_main_t * vm, } else { - 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); } } @@ -626,8 +626,8 @@ srv6_ad6_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (ls0_mem->rw_len + b0->current_data)); - clib_memcpy (((u8 *) ip0_encap) - ls0_mem->rw_len, - ls0_mem->rewrite, ls0_mem->rw_len); + clib_memcpy_fast (((u8 *) ip0_encap) - ls0_mem->rw_len, + ls0_mem->rewrite, ls0_mem->rw_len); vlib_buffer_advance (b0, -(word) ls0_mem->rw_len); ip0 = vlib_buffer_get_current (b0); @@ -654,10 +654,10 @@ srv6_ad6_rewrite_fn (vlib_main_t * vm, } else { - 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); } } diff --git a/src/plugins/srv6-am/node.c b/src/plugins/srv6-am/node.c index 84014c5ee8d..dd71e60d5a2 100644 --- a/src/plugins/srv6-am/node.c +++ b/src/plugins/srv6-am/node.c @@ -306,10 +306,10 @@ srv6_am_rewrite_fn (vlib_main_t * vm, { srv6_am_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); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, diff --git a/src/plugins/srv6-as/node.c b/src/plugins/srv6-as/node.c index d81a7e88722..6f424fcca12 100644 --- a/src/plugins/srv6-as/node.c +++ b/src/plugins/srv6-as/node.c @@ -316,8 +316,8 @@ srv6_as2_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (vec_len (ls0_mem->rewrite) + b0->current_data)); - clib_memcpy (((u8 *) en0) - vec_len (ls0_mem->rewrite), - ls0_mem->rewrite, vec_len (ls0_mem->rewrite)); + clib_memcpy_fast (((u8 *) en0) - vec_len (ls0_mem->rewrite), + ls0_mem->rewrite, vec_len (ls0_mem->rewrite)); vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite)); ip0 = vlib_buffer_get_current (b0); @@ -340,10 +340,10 @@ srv6_as2_rewrite_fn (vlib_main_t * vm, } else { - 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); } } @@ -451,8 +451,9 @@ srv6_as4_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (vec_len (ls0_mem->rewrite) + b0->current_data)); - clib_memcpy (((u8 *) ip0_encap) - vec_len (ls0_mem->rewrite), - ls0_mem->rewrite, vec_len (ls0_mem->rewrite)); + clib_memcpy_fast (((u8 *) ip0_encap) - + vec_len (ls0_mem->rewrite), ls0_mem->rewrite, + vec_len (ls0_mem->rewrite)); vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite)); ip0 = vlib_buffer_get_current (b0); @@ -483,10 +484,10 @@ srv6_as4_rewrite_fn (vlib_main_t * vm, } else { - 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); } } @@ -593,8 +594,9 @@ srv6_as6_rewrite_fn (vlib_main_t * vm, ASSERT (VLIB_BUFFER_PRE_DATA_SIZE >= (vec_len (ls0_mem->rewrite) + b0->current_data)); - clib_memcpy (((u8 *) ip0_encap) - vec_len (ls0_mem->rewrite), - ls0_mem->rewrite, vec_len (ls0_mem->rewrite)); + clib_memcpy_fast (((u8 *) ip0_encap) - + vec_len (ls0_mem->rewrite), ls0_mem->rewrite, + vec_len (ls0_mem->rewrite)); vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite)); ip0 = vlib_buffer_get_current (b0); @@ -621,10 +623,10 @@ srv6_as6_rewrite_fn (vlib_main_t * vm, } else { - 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); } } diff --git a/src/plugins/stn/stn.c b/src/plugins/stn/stn.c index e3f56d38a15..6f5fbdb2866 100644 --- a/src/plugins/stn/stn.c +++ b/src/plugins/stn/stn.c @@ -141,9 +141,9 @@ stn_ip46_punt_fn (vlib_main_t * vm, vlib_buffer_advance(p0, -sizeof(*eth)); eth = (ethernet_header_t *) vlib_buffer_get_current(p0); if (is_ipv4) - clib_memcpy(eth, &stn_ip4_ethernet_header, sizeof(*eth)); + clib_memcpy_fast(eth, &stn_ip4_ethernet_header, sizeof(*eth)); else - clib_memcpy(eth, &stn_ip6_ethernet_header, sizeof(*eth)); + clib_memcpy_fast(eth, &stn_ip6_ethernet_header, sizeof(*eth)); } else { @@ -261,12 +261,12 @@ stn_init (vlib_main_t * vm) clib_bihash_init_16_8(&stn->rule_by_address_table, "stn addresses", 1024, 1<<20); - clib_memcpy(stn_ip4_ethernet_header.dst_address, stn_hw_addr_dst, 6); - clib_memcpy(stn_ip4_ethernet_header.src_address, stn_hw_addr_local, 6); + clib_memcpy_fast(stn_ip4_ethernet_header.dst_address, stn_hw_addr_dst, 6); + clib_memcpy_fast(stn_ip4_ethernet_header.src_address, stn_hw_addr_local, 6); stn_ip4_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP4); - clib_memcpy(stn_ip6_ethernet_header.dst_address, stn_hw_addr_dst, 6); - clib_memcpy(stn_ip6_ethernet_header.src_address, stn_hw_addr_local, 6); + clib_memcpy_fast(stn_ip6_ethernet_header.dst_address, stn_hw_addr_dst, 6); + clib_memcpy_fast(stn_ip6_ethernet_header.src_address, stn_hw_addr_local, 6); stn_ip6_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP6); return stn_api_init (vm, stn); diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c index 0bc1153e6dd..bbb80404019 100644 --- a/src/plugins/unittest/tcp_test.c +++ b/src/plugins/unittest/tcp_test.c @@ -1662,7 +1662,7 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input) tc->connection.rmt_port = 53764; tc->connection.proto = TRANSPORT_PROTO_TCP; tc->connection.is_ip4 = 1; - clib_memcpy (tc1, &tc->connection, sizeof (*tc1)); + clib_memcpy_fast (tc1, &tc->connection, sizeof (*tc1)); /* * Allocate fake session and connection 2 @@ -1683,7 +1683,7 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input) tc->connection.rmt_port = 53764; tc->connection.proto = TRANSPORT_PROTO_TCP; tc->connection.is_ip4 = 1; - clib_memcpy (tc2, &tc->connection, sizeof (*tc2)); + clib_memcpy_fast (tc2, &tc->connection, sizeof (*tc2)); /* * Confirm that connection lookup works |