diff options
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/application_interface.h | 4 | ||||
-rw-r--r-- | src/vnet/session/mma_template.c | 6 | ||||
-rw-r--r-- | src/vnet/session/session.h | 2 | ||||
-rwxr-xr-x | src/vnet/session/session_api.c | 38 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 8 | ||||
-rw-r--r-- | src/vnet/session/session_rules_table.c | 18 | ||||
-rw-r--r-- | src/vnet/session/transport.c | 9 |
7 files changed, 45 insertions, 40 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 2da69fcab92..dc4c46906c4 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -397,10 +397,10 @@ app_send_dgram_raw (svm_fifo_t * f, app_session_transport_t * at, actual_write = clib_min (len, max_enqueue); hdr.data_length = actual_write; hdr.data_offset = 0; - clib_memcpy (&hdr.rmt_ip, &at->rmt_ip, sizeof (ip46_address_t)); + clib_memcpy_fast (&hdr.rmt_ip, &at->rmt_ip, sizeof (ip46_address_t)); hdr.is_ip4 = at->is_ip4; hdr.rmt_port = at->rmt_port; - clib_memcpy (&hdr.lcl_ip, &at->lcl_ip, sizeof (ip46_address_t)); + clib_memcpy_fast (&hdr.lcl_ip, &at->lcl_ip, sizeof (ip46_address_t)); hdr.lcl_port = at->lcl_port; rv = svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr); ASSERT (rv == sizeof (hdr)); diff --git a/src/vnet/session/mma_template.c b/src/vnet/session/mma_template.c index 15fd7c7aeed..9dd7c76cb06 100644 --- a/src/vnet/session/mma_template.c +++ b/src/vnet/session/mma_template.c @@ -238,7 +238,7 @@ RT (mma_rules_table_del_rule) (RTT (mma_rules_table) * srt, if (i != 0) { vec_add2 (next_indices, new_elts, i); - clib_memcpy (new_elts, rp->next_indices, i * sizeof (u32)); + clib_memcpy_fast (new_elts, rp->next_indices, i * sizeof (u32)); } if (vec_len (child->next_indices)) vec_append (next_indices, child->next_indices); @@ -246,8 +246,8 @@ RT (mma_rules_table_del_rule) (RTT (mma_rules_table) * srt, if (left_to_add) { vec_add2 (next_indices, new_elts, left_to_add); - clib_memcpy (new_elts, &rp->next_indices[i + 1], - left_to_add * sizeof (u32)); + clib_memcpy_fast (new_elts, &rp->next_indices[i + 1], + left_to_add * sizeof (u32)); } RT (mma_rule_free) (srt, child); vec_free (rp->next_indices); diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index 35c8fb4069f..ea21464ee54 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -563,7 +563,7 @@ session_clone_safe (u32 session_index, u32 thread_index) session_pool_add_peeker (thread_index); new_s = session_alloc (current_thread_index); old_s = session_manager_main.wrk[thread_index].sessions + session_index; - clib_memcpy (new_s, old_s, sizeof (*new_s)); + clib_memcpy_fast (new_s, old_s, sizeof (*new_s)); session_pool_remove_peeker (thread_index); new_s->thread_index = current_thread_index; new_s->session_index = session_get_index (new_s); diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index eb33db03f33..8315c19a7ac 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -241,7 +241,7 @@ send_session_accept_callback (stream_session_t * s) tc = tp_vft->get_connection (s->connection_index, s->thread_index); mp->port = tc->rmt_port; mp->is_ip4 = tc->is_ip4; - clib_memcpy (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip)); + clib_memcpy_fast (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip)); } else { @@ -364,7 +364,7 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context, vpp_queue = session_manager_get_vpp_event_queue (s->thread_index); mp->handle = session_handle (s); mp->vpp_event_queue_address = pointer_to_uword (vpp_queue); - clib_memcpy (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); + clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); mp->is_ip4 = tc->is_ip4; mp->lcl_port = tc->lcl_port; mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo); @@ -459,7 +459,7 @@ mq_send_session_accepted_cb (stream_session_t * s) tc = tp_vft->get_connection (s->connection_index, s->thread_index); mp->port = tc->rmt_port; mp->is_ip4 = tc->is_ip4; - clib_memcpy (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip)); + clib_memcpy_fast (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip)); } else { @@ -616,7 +616,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context, vpp_mq = session_manager_get_vpp_event_queue (s->thread_index); mp->handle = session_handle (s); mp->vpp_event_queue_address = pointer_to_uword (vpp_mq); - clib_memcpy (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); + clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); mp->is_ip4 = tc->is_ip4; mp->lcl_port = tc->lcl_port; mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo); @@ -692,7 +692,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context, tc = listen_session_get_transport (ls); mp->lcl_port = tc->lcl_port; mp->lcl_is_ip4 = tc->is_ip4; - clib_memcpy (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); + clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); } else { @@ -779,7 +779,8 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp) if (mp->namespace_id_len) { vec_validate (a->namespace_id, mp->namespace_id_len - 1); - clib_memcpy (a->namespace_id, mp->namespace_id, mp->namespace_id_len); + clib_memcpy_fast (a->namespace_id, mp->namespace_id, + mp->namespace_id_len); } if ((error = vnet_application_attach (a))) @@ -906,7 +907,7 @@ done: tc = listen_session_get_transport (s); rmp->lcl_is_ip4 = tc->is_ip4; rmp->lcl_port = tc->lcl_port; - clib_memcpy (rmp->lcl_ip, &tc->lcl_ip, sizeof(tc->lcl_ip)); + clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof(tc->lcl_ip)); if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL) { rmp->rx_fifo = pointer_to_uword (s->server_rx_fifo); @@ -1208,7 +1209,7 @@ done: { s = listen_session_get_from_handle (a->handle); tc = listen_session_get_transport (s); - clib_memcpy (rmp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); + clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip)); if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL) { rmp->rx_fifo = pointer_to_uword (s->server_rx_fifo); @@ -1295,7 +1296,8 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp) if (mp->hostname_len) { vec_validate (a->sep_ext.hostname, mp->hostname_len - 1); - clib_memcpy (a->sep_ext.hostname, mp->hostname, mp->hostname_len); + clib_memcpy_fast (a->sep_ext.hostname, mp->hostname, + mp->hostname_len); } a->api_context = mp->context; a->app_index = app->app_index; @@ -1429,7 +1431,7 @@ vl_api_app_namespace_add_del_t_handler (vl_api_app_namespace_add_del_t * mp) } vec_validate (ns_id, mp->namespace_id_len - 1); - clib_memcpy (ns_id, mp->namespace_id, mp->namespace_id_len); + clib_memcpy_fast (ns_id, mp->namespace_id, mp->namespace_id_len); vnet_app_namespace_add_del_args_t args = { .ns_id = ns_id, .secret = clib_net_to_host_u64 (mp->secret), @@ -1522,8 +1524,8 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, rmp->context = context; rmp->is_ip4 = 1; - clib_memcpy (rmp->lcl_ip, &match->lcl_ip, sizeof (match->lcl_ip)); - clib_memcpy (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip)); + clib_memcpy_fast (rmp->lcl_ip, &match->lcl_ip, sizeof (match->lcl_ip)); + clib_memcpy_fast (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip)); rmp->lcl_plen = ip4_mask_to_preflen (&mask->lcl_ip); rmp->rmt_plen = ip4_mask_to_preflen (&mask->rmt_ip); rmp->lcl_port = match->lcl_port; @@ -1535,7 +1537,7 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, rmp->appns_index = clib_host_to_net_u32 (appns_index); if (tag) { - clib_memcpy (rmp->tag, tag, vec_len (tag)); + clib_memcpy_fast (rmp->tag, tag, vec_len (tag)); rmp->tag[vec_len (tag)] = 0; } @@ -1559,8 +1561,8 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, rmp->context = context; rmp->is_ip4 = 0; - clib_memcpy (rmp->lcl_ip, &match->lcl_ip, sizeof (match->lcl_ip)); - clib_memcpy (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip)); + clib_memcpy_fast (rmp->lcl_ip, &match->lcl_ip, sizeof (match->lcl_ip)); + clib_memcpy_fast (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip)); rmp->lcl_plen = ip6_mask_to_preflen (&mask->lcl_ip); rmp->rmt_plen = ip6_mask_to_preflen (&mask->rmt_ip); rmp->lcl_port = match->lcl_port; @@ -1572,7 +1574,7 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, rmp->appns_index = clib_host_to_net_u32 (appns_index); if (tag) { - clib_memcpy (rmp->tag, tag, vec_len (tag)); + clib_memcpy_fast (rmp->tag, tag, vec_len (tag)); rmp->tag[vec_len (tag)] = 0; } @@ -1671,7 +1673,7 @@ vl_api_application_tls_cert_add_t_handler (vl_api_application_tls_cert_add_t * goto done; } vec_validate (a->cert, cert_len); - clib_memcpy (a->cert, mp->cert, cert_len); + clib_memcpy_fast (a->cert, mp->cert, cert_len); if ((error = vnet_app_add_tls_cert (a))) { rv = clib_error_get_code (error); @@ -1711,7 +1713,7 @@ vl_api_application_tls_key_add_t_handler (vl_api_application_tls_key_add_t * goto done; } vec_validate (a->key, key_len); - clib_memcpy (a->key, mp->key, key_len); + clib_memcpy_fast (a->key, mp->key, key_len); if ((error = vnet_app_add_tls_key (a))) { rv = clib_error_get_code (error); diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 22d8d3c45b0..cf2d5766fb0 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -800,7 +800,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, { vec_add2 (fifo_events, e, 1); svm_msg_q_sub_w_lock (mq, msg); - clib_memcpy (e, svm_msg_q_msg_data (mq, msg), sizeof (*e)); + clib_memcpy_fast (e, svm_msg_q_msg_data (mq, msg), sizeof (*e)); svm_msg_q_free_msg (mq, msg); } svm_msg_q_unlock (mq); @@ -961,7 +961,7 @@ dump_thread_0_event_queue (void) { msg = (svm_msg_q_msg_t *) (&mq->q->data[0] + mq->q->elsize * index); ring = svm_msg_q_ring (mq, msg->ring_index); - clib_memcpy (e, svm_msg_q_msg_data (mq, msg), ring->elsize); + clib_memcpy_fast (e, svm_msg_q_msg_data (mq, msg), ring->elsize); switch (e->event_type) { @@ -1053,7 +1053,7 @@ session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e) { msg = (svm_msg_q_msg_t *) (&mq->q->data[0] + mq->q->elsize * index); ring = svm_msg_q_ring (mq, msg->ring_index); - clib_memcpy (e, svm_msg_q_msg_data (mq, msg), ring->elsize); + clib_memcpy_fast (e, svm_msg_q_msg_data (mq, msg), ring->elsize); found = session_node_cmp_event (e, f); if (found) return 1; @@ -1069,7 +1069,7 @@ session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e) found = session_node_cmp_event (evt, f); if (found) { - clib_memcpy (e, evt, sizeof (*evt)); + clib_memcpy_fast (e, evt, sizeof (*evt)); break; } } diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c index 33f7de07944..6304606ca43 100644 --- a/src/vnet/session/session_rules_table.c +++ b/src/vnet/session/session_rules_table.c @@ -270,8 +270,10 @@ session_rules_table_init_rule_40 (mma_rule_40_t * rule, fib_pref_normalize (lcl); fib_pref_normalize (rmt); match = (session_mask_or_match_6_t *) & rule->match; - clib_memcpy (&match->lcl_ip, &lcl->fp_addr.ip6, sizeof (match->lcl_ip)); - clib_memcpy (&match->rmt_ip, &rmt->fp_addr.ip6, sizeof (match->rmt_ip)); + clib_memcpy_fast (&match->lcl_ip, &lcl->fp_addr.ip6, + sizeof (match->lcl_ip)); + clib_memcpy_fast (&match->rmt_ip, &rmt->fp_addr.ip6, + sizeof (match->rmt_ip)); match->lcl_port = lcl_port; match->rmt_port = rmt_port; mask = (session_mask_or_match_6_t *) & rule->mask; @@ -355,8 +357,8 @@ session_rules_table_lookup_rule6 (session_rules_table_t * srt, .lcl_port = lcl_port, .rmt_port = rmt_port, }; - clib_memcpy (&key.lcl_ip, lcl_ip, sizeof (*lcl_ip)); - clib_memcpy (&key.rmt_ip, rmt_ip, sizeof (*rmt_ip)); + clib_memcpy_fast (&key.lcl_ip, lcl_ip, sizeof (*lcl_ip)); + clib_memcpy_fast (&key.rmt_ip, rmt_ip, sizeof (*rmt_ip)); return mma_rules_table_lookup_rule_40 (srt6, (mma_mask_or_match_40_t *) & key, srt6->root_index); @@ -372,8 +374,8 @@ session_rules_table_lookup6 (session_rules_table_t * srt, .lcl_port = lcl_port, .rmt_port = rmt_port, }; - clib_memcpy (&key.lcl_ip, lcl_ip, sizeof (*lcl_ip)); - clib_memcpy (&key.rmt_ip, rmt_ip, sizeof (*rmt_ip)); + clib_memcpy_fast (&key.lcl_ip, lcl_ip, sizeof (*lcl_ip)); + clib_memcpy_fast (&key.rmt_ip, rmt_ip, sizeof (*rmt_ip)); return mma_rules_table_lookup_40 (srt6, (mma_mask_or_match_40_t *) & key, srt6->root_index); } @@ -577,8 +579,8 @@ session_rules_table_show_rule (vlib_main_t * vm, session_rules_table_t * srt, .lcl_port = lcl_port, .rmt_port = rmt_port, }; - clib_memcpy (&key.lcl_ip, &lcl_ip->ip6, sizeof (lcl_ip->ip6)); - clib_memcpy (&key.rmt_ip, &rmt_ip->ip6, sizeof (rmt_ip->ip6)); + clib_memcpy_fast (&key.lcl_ip, &lcl_ip->ip6, sizeof (lcl_ip->ip6)); + clib_memcpy_fast (&key.rmt_ip, &rmt_ip->ip6, sizeof (rmt_ip->ip6)); ri = mma_rules_table_lookup_rule_40 (srt6, (mma_mask_or_match_40_t *) & key, srt6->root_index); diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index 06c541a9e2b..91b80d7c11e 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -319,7 +319,7 @@ transport_endpoint_mark_used (u8 proto, ip46_address_t * ip, u16 port) transport_endpoint_t *tep; clib_spinlock_lock_if_init (&local_endpoints_lock); tep = transport_endpoint_new (); - clib_memcpy (&tep->ip, ip, sizeof (*ip)); + clib_memcpy_fast (&tep->ip, ip, sizeof (*ip)); tep->port = port; transport_endpoint_table_add (&local_endpoints_table, proto, tep, tep - local_endpoints); @@ -388,7 +388,7 @@ transport_get_interface_ip (u32 sw_if_index, u8 is_ip4, ip46_address_t * addr) return clib_error_return (0, "no routable ip6 addresses on %U", format_vnet_sw_if_index_name, vnet_get_main (), sw_if_index); - clib_memcpy (&addr->ip6, ip6, sizeof (*ip6)); + clib_memcpy_fast (&addr->ip6, ip6, sizeof (*ip6)); } return 0; } @@ -404,7 +404,7 @@ transport_find_local_ip_for_remote (u32 sw_if_index, if (sw_if_index == ENDPOINT_INVALID_INDEX) { /* Find a FIB path to the destination */ - clib_memcpy (&prefix.fp_addr, &rmt->ip, sizeof (rmt->ip)); + clib_memcpy_fast (&prefix.fp_addr, &rmt->ip, sizeof (rmt->ip)); prefix.fp_proto = rmt->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6; prefix.fp_len = rmt->is_ip4 ? 32 : 128; @@ -449,7 +449,8 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg, else { /* Assume session layer vetted this address */ - clib_memcpy (lcl_addr, &rmt_cfg->peer.ip, sizeof (rmt_cfg->peer.ip)); + clib_memcpy_fast (lcl_addr, &rmt_cfg->peer.ip, + sizeof (rmt_cfg->peer.ip)); } /* |