diff options
author | Florin Coras <fcoras@cisco.com> | 2018-01-05 03:20:25 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-09 18:33:08 +0000 |
commit | e86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch) | |
tree | 480219864cadd743fdb95c21379aeaf88a985e23 /src/vnet/udp | |
parent | 4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff) |
api: refactor vlibmemory
- separate client/server code for both memory and socket apis
- separate memory api code from generic vlib api code
- move unix_shared_memory_fifo to svm and rename to svm_fifo_t
- overall declutter
Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/udp')
-rw-r--r-- | src/vnet/udp/builtin_server.c | 5 | ||||
-rw-r--r-- | src/vnet/udp/udp_api.c | 36 |
2 files changed, 19 insertions, 22 deletions
diff --git a/src/vnet/udp/builtin_server.c b/src/vnet/udp/builtin_server.c index 05a47031dc2..73914cbc143 100644 --- a/src/vnet/udp/builtin_server.c +++ b/src/vnet/udp/builtin_server.c @@ -62,7 +62,7 @@ builtin_server_rx_callback (stream_session_t * s) int actual_transfer; u8 *my_copy_buffer; session_fifo_event_t evt; - unix_shared_memory_queue_t *q; + svm_queue_t *q; my_copy_buffer = copy_buffers[s->thread_index]; rx_fifo = s->server_rx_fifo; @@ -90,8 +90,7 @@ builtin_server_rx_callback (stream_session_t * s) evt.fifo = tx_fifo; evt.event_type = FIFO_EVENT_APP_TX; q = session_manager_get_vpp_event_queue (s->thread_index); - unix_shared_memory_queue_add (q, (u8 *) & evt, - 0 /* do wait for mutex */ ); + svm_queue_add (q, (u8 *) & evt, 0 /* do wait for mutex */ ); } return 0; diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c index e65235a5396..dddc6f9470d 100644 --- a/src/vnet/udp/udp_api.c +++ b/src/vnet/udp/udp_api.c @@ -43,8 +43,7 @@ _(UDP_ENCAP_DUMP, udp_encap_dump) static void -send_udp_encap_details (const udp_encap_t * ue, - unix_shared_memory_queue_t * q, u32 context) +send_udp_encap_details (const udp_encap_t * ue, svm_queue_t * q, u32 context) { vl_api_udp_encap_details_t *mp; fib_table_t *fib_table; @@ -82,7 +81,7 @@ static void vl_api_udp_encap_dump_t_handler (vl_api_udp_encap_dump_t * mp, vlib_main_t * vm) { - unix_shared_memory_queue_t *q; + svm_queue_t *q; udp_encap_t *ue; q = vl_api_client_index_to_input_queue (mp->client_index); @@ -94,12 +93,12 @@ vl_api_udp_encap_dump_t_handler (vl_api_udp_encap_dump_t * mp, ({ send_udp_encap_details(ue, q, mp->context); })); - /* *INDENT-OFF* */ + /* *INDENT-ON* */ } static void vl_api_udp_encap_add_del_t_handler (vl_api_udp_encap_add_del_t * mp, - vlib_main_t * vm) + vlib_main_t * vm) { vl_api_udp_encap_add_del_reply_t *rmp; ip46_address_t src_ip, dst_ip; @@ -107,11 +106,11 @@ vl_api_udp_encap_add_del_t_handler (vl_api_udp_encap_add_del_t * mp, fib_protocol_t fproto; int rv = 0; - ue_id = ntohl(mp->id); - table_id = ntohl(mp->table_id); + ue_id = ntohl (mp->id); + table_id = ntohl (mp->table_id); fproto = (mp->is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4); - fib_index = fib_table_find(fproto, table_id); + fib_index = fib_table_find (fproto, table_id); if (~0 == fib_index) { @@ -121,29 +120,28 @@ vl_api_udp_encap_add_del_t_handler (vl_api_udp_encap_add_del_t * mp, if (FIB_PROTOCOL_IP4 == fproto) { - clib_memcpy(&src_ip.ip4, mp->src_ip, 4); - clib_memcpy(&dst_ip.ip4, mp->dst_ip, 4); + clib_memcpy (&src_ip.ip4, mp->src_ip, 4); + clib_memcpy (&dst_ip.ip4, mp->dst_ip, 4); } else { - clib_memcpy(&src_ip.ip6, mp->src_ip, 16); - clib_memcpy(&dst_ip.ip6, mp->dst_ip, 16); + clib_memcpy (&src_ip.ip6, mp->src_ip, 16); + clib_memcpy (&dst_ip.ip6, mp->dst_ip, 16); } if (mp->is_add) { - udp_encap_add_and_lock(ue_id, fproto, fib_index, - &src_ip, &dst_ip, - ntohs(mp->src_port), - ntohs(mp->dst_port), - UDP_ENCAP_FIXUP_NONE); + udp_encap_add_and_lock (ue_id, fproto, fib_index, + &src_ip, &dst_ip, + ntohs (mp->src_port), + ntohs (mp->dst_port), UDP_ENCAP_FIXUP_NONE); } else { - udp_encap_unlock(ue_id); + udp_encap_unlock (ue_id); } - done: +done: REPLY_MACRO (VL_API_UDP_ENCAP_ADD_DEL_REPLY); } |