diff options
author | Jim Gibson <gibson+fdio@cisco.com> | 2017-06-01 15:30:03 -0400 |
---|---|---|
committer | Jim Gibson <gibson+fdio@cisco.com> | 2017-06-02 16:51:22 -0400 |
commit | 716eb01c0b25f7b5bd74e91ec3a1c8d51d402c00 (patch) | |
tree | 919b6c07dd9a4a9bf6c430e382efed18e9162916 /cicn-plugin/cicn/node.c | |
parent | 2c8098d53b946eec9526dbb5cb4086efb6fa3366 (diff) |
Update cicn-plugin for vpp v17.04 (from v17.01)Vpp-plugin-v17.04
1. Changes for cicn-plugin to build under v17.04:
- update build files to v17.04, including
- no longer need/want plugin to include dpdk headers (though
still link in dpdk plugin)
- vpp include changes
- relocation of vpe.api.h
- relocation of pneum.h
- for modprobe, replace igb_uio with uio_pci_generic
- vnet/ip/udp.h => vnet/udp/udp.h
- update cicn vpp plugin registration per vpp changes
- use new VLIB_PLUGIN_REGISTER() macro
- delete no-loger-supported vlib_plugin_register() function,
moving contents of latter to cicn_init
- remove sm->ethernet_main, which was not used and is no longer part of
plugin boilerplate.
- cicn_api_test_plugin.so (plugin for vpp_api_test)
- update per 17.04 updated requirements:
vat_api_hookup => cicn_vat_api_hookup
- buffering/cloning changes needed for building
- CICN_FEATURE_VPP_VLIB_CLONING hard-coded enabled and removed,
- CICN_FEATURE_DPDK_RTEMBUF_CLONING removed
- Small indentation updates from vpp checkstyle.sh
2. Updates for new vlib_buffer_attach_clone() API now exported by vpp
- remove code to manage rte_mbuf: cicn plugin now longer depends
on dpdk being present.
- remove use of indirect header for cloned cs entry: new scheme
supports having hdr buffer point directly to shared buffer rather
that requiring hdr buffer to poitn to indirect header that
points to cs buffer
- cicn_rte_mbuf_inlines.h replaced by much smaller cicn_infra_inlines.h
- report new characteristic of whether cloning replication is enabled
- "cicn show internal" (dbg cli), "cicn_api_node_params_get"
(vpp_api_test)
- update output accordingly
- cicn_show: other tweaks to output
3. In node.c, in code for dropping possibly multiple buffers
- delete ifdef'd-out code block for dropping using the drop node
[this codepath possibly had buffer problems.]
- retain code that instead drops by freeing buffers directly.
[this codepath has been robust with respect to buffer management]
Change-Id: I6e3d18153f52d8b94773332a39cc452873589baf
Signed-off-by: Jim Gibson <gibson+fdio@cisco.com>
Diffstat (limited to 'cicn-plugin/cicn/node.c')
-rw-r--r-- | cicn-plugin/cicn/node.c | 93 |
1 files changed, 12 insertions, 81 deletions
diff --git a/cicn-plugin/cicn/node.c b/cicn-plugin/cicn/node.c index 922ebf4b..02199829 100644 --- a/cicn-plugin/cicn/node.c +++ b/cicn-plugin/cicn/node.c @@ -16,14 +16,13 @@ * node.c - icn plug-in nodes for vpp */ -#include "cicn_rte_mbuf.h" // needed first because vlib.h defs conflict #include <vlib/vlib.h> #include <vnet/vnet.h> #include <cicn/cicn.h> #include <cicn/cicn_hashtb.h> #include <cicn/cicn_pcs.h> -#include <cicn/cicn_rte_mbuf_inlines.h> +#include <cicn/cicn_infra_inlines.h> #include <cicn/cicn_hello_inlines.h> int cicn_buftrc = 0; // make permanent or delete? Set to 1 to enable trace @@ -121,7 +120,6 @@ prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0) /* Advance the vlib buffer to the beginning of the ICN payload */ vlib_buffer_advance (b0, sizeof (ip4_header_t) + sizeof (udp_header_t)); - cicn_infra_vlib_buffer_cs_prep_finalize (vm, b0); ret = AOK; return (ret); @@ -135,10 +133,10 @@ prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0) static int cicn_clone_cs_buffer (vlib_buffer_t * hdr_b0, const cicn_pcs_entry_t * pcs, vlib_main_t * vm, vlib_buffer_free_list_t * fl, - unsigned socket_id, cicn_face_db_entry_t * outface) + cicn_face_db_entry_t * outface) { int ret = EINVAL; - vlib_buffer_t *cs_b0, *clone_b0; + vlib_buffer_t *cs_b0; BUFTRC ("CS-H-SW", GBI (vm, hdr_b0)); if (PREDICT_FALSE (pcs->u.cs.cs_pkt_buf == 0)) @@ -149,33 +147,14 @@ cicn_clone_cs_buffer (vlib_buffer_t * hdr_b0, const cicn_pcs_entry_t * pcs, cs_b0 = vlib_get_buffer (vm, pcs->u.cs.cs_pkt_buf); - /* Clone the buf held in the CS */ - clone_b0 = cicn_infra_vlib_buffer_clone (cs_b0, vm, fl, socket_id, outface); - BUFTRC ("CS-H-CL", GBI (vm, clone_b0)); - if (PREDICT_FALSE (clone_b0 == 0)) - { - /* If we can't get a buf, we can't continue */ - goto done; - } - /* At this point, the base CS buffer is pointing at the ICN payload * part of the packet, and we'll be using the other buffer * to hold the egress/tx rewrite info. */ hdr_b0->current_data = 0; hdr_b0->current_length = sizeof (ip4_header_t) + sizeof (udp_header_t); - hdr_b0->flags |= VLIB_BUFFER_NEXT_PRESENT; - if (outface->swif_is_dpdk_driver) - { - ASSERT ((hdr_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) != 0); - } - hdr_b0->total_length_not_including_first_buffer = - vlib_buffer_length_in_chain (vm, cs_b0); - - /* Connect the header particle to the body */ - hdr_b0->next_buffer = vlib_get_buffer_index (vm, clone_b0); - cicn_infra_vlib_buffer_clone_attach_finalize (hdr_b0, clone_b0, outface); + vlib_buffer_attach_clone (vm, hdr_b0, cs_b0); /* Looks like success */ ret = AOK; @@ -213,7 +192,6 @@ icnfwd_node_fn (vlib_main_t * vm, cicn_prefix_hashinf_t pfxhash; f64 tnow; vlib_buffer_free_list_t *fl; - unsigned socket_id = cicn_infra_rte_socket_id (); cicn_main_t *sm = &cicn_main; fl = vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); @@ -281,7 +259,7 @@ icnfwd_node_fn (vlib_main_t * vm, uint16_t faceid; int clone_count; vlib_buffer_t *hdr_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; - vlib_buffer_t *clone_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; + vlib_buffer_t *cs_b0; cicn_face_db_entry_t *face_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; u64 seq_num; int trace_p = 0; @@ -495,6 +473,7 @@ icnfwd_node_fn (vlib_main_t * vm, * the ICN payload packet buf. We also capture the tx faceid. */ ret = AOK; + cs_b0 = b0; for (clone_count = 0, i = 0; i < CICN_PARAM_PIT_ENTRY_PHOPS_MAX; i++) { @@ -516,25 +495,11 @@ icnfwd_node_fn (vlib_main_t * vm, face_vec[clone_count] = outface; hdr_vec[clone_count] = - cicn_infra_vlib_buffer_alloc (vm, fl, socket_id, - outface); - if (!cicn_cs_enabled (&rt->pitcs) && clone_count == 0) - { - clone_vec[clone_count] = b0; - } - else - { - clone_vec[clone_count] = - cicn_infra_vlib_buffer_clone (b0, vm, fl, - socket_id, outface); - } + cicn_infra_vlib_buffer_alloc (vm); BUFTRC ("CLN-HDR", GBI (vm, hdr_vec[clone_count])); - BUFTRC ("CLN-CLN", GBI (vm, clone_vec[clone_count])); - if (PREDICT_FALSE ((hdr_vec[clone_count] == NULL) || - (clone_vec[clone_count] == NULL))) + if (PREDICT_FALSE (hdr_vec[clone_count] == NULL)) { - /* Need to check this index in the arrays in * the error-handling code below. */ @@ -554,17 +519,10 @@ icnfwd_node_fn (vlib_main_t * vm, for (i = 0; i < clone_count; i++) { BUFTRC ("ERR-FRE", - vlib_get_buffer_index (vm, - clone_vec[clone_count])); + vlib_get_buffer_index (vm, hdr_vec[i])); if (hdr_vec[i]) { - cicn_infra_vlib_buffer_free (hdr_vec[i], vm, - face_vec[i]); - } - if (clone_vec[i]) - { - cicn_infra_vlib_buffer_free (hdr_vec[i], vm, - face_vec[i]); + cicn_infra_vlib_buffer_free (hdr_vec[i], vm); } } @@ -675,10 +633,8 @@ icnfwd_node_fn (vlib_main_t * vm, */ for (i = 0; i < clone_count; i++) { - vlib_buffer_t *cs_b0; b0 = hdr_vec[i]; - cs_b0 = clone_vec[i]; outface = face_vec[i]; if (PREDICT_FALSE (trace_p != 0)) @@ -691,16 +647,7 @@ icnfwd_node_fn (vlib_main_t * vm, b0->current_data = 0; b0->current_length = (sizeof (ip4_header_t) + sizeof (udp_header_t)); - b0->flags |= VLIB_BUFFER_NEXT_PRESENT; - - b0->total_length_not_including_first_buffer = - vlib_buffer_length_in_chain (vm, cs_b0); - - /* Connect the header particle to the body */ - b0->next_buffer = vlib_get_buffer_index (vm, cs_b0); - - cicn_infra_vlib_buffer_clone_attach_finalize (b0, cs_b0, - outface); + vlib_buffer_attach_clone (vm, b0, cs_b0); /* Refresh the ip and udp headers * before the final part of the rewrite @@ -991,7 +938,7 @@ icnfwd_node_fn (vlib_main_t * vm, * Clone the CS packet, and prepare the incoming request * packet to hold the rewrite info as a particle. */ - if (cicn_clone_cs_buffer (b0, pitp, vm, fl, socket_id, + if (cicn_clone_cs_buffer (b0, pitp, vm, fl, inface /*outface */ ) != AOK) { no_bufs_count++; @@ -1526,23 +1473,7 @@ cicn_trim_cs_lru (vlib_main_t * vm, vlib_node_runtime_t * node, BUFTRC ("CS-TRIM-ALL", bufcount); if (bufcount > 0) { -#if 1 //$$$XXX TODO: does this work better than drop-node approach? seems so(?) vlib_buffer_free (vm, buf_list, bufcount); -#else - /* This ought to work, not limited to a single frame size. It has - * the nice property that we get to set a stat/error code for - * the bufs we're freeing. Note that we specify the 'next index' - * in terms of our own node's array of 'nexts'. - * - * Seems to work but can replace with - * vlib_buffer_free (vm, buf_list, bufcount); - * if willing to give up the counter. - */ - vlib_error_drop_buffers (vm, node, buf_list, 1 /*stride */ , - bufcount, - ICNFWD_NEXT_ERROR_DROP /*next index */ , - icnfwd_node.index, ICNFWD_ERROR_CS_LRU); -#endif } } |