diff options
-rw-r--r-- | vlib/vlib/buffer.c | 9 | ||||
-rw-r--r-- | vlib/vlib/buffer_funcs.h | 71 | ||||
-rw-r--r-- | vlib/vlib/dpdk_buffer.c | 34 | ||||
-rw-r--r-- | vlib/vlib/threads_cli.c | 8 | ||||
-rw-r--r-- | vnet/vnet/buffer.h | 3 | ||||
-rw-r--r-- | vnet/vnet/devices/af_packet/node.c | 16 | ||||
-rw-r--r-- | vnet/vnet/devices/netmap/node.c | 16 | ||||
-rw-r--r-- | vnet/vnet/devices/ssvm/node.c | 4 | ||||
-rw-r--r-- | vnet/vnet/devices/ssvm/ssvm_eth.h | 1 | ||||
-rw-r--r-- | vnet/vnet/devices/virtio/vhost-user.h | 4 | ||||
-rw-r--r-- | vnet/vnet/ip/ip.h | 35 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_forward.c | 30 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_neighbor.c | 12 | ||||
-rw-r--r-- | vnet/vnet/ipsec/esp.h | 3 | ||||
-rw-r--r-- | vnet/vnet/ipsec/ipsec.h | 17 | ||||
-rw-r--r-- | vnet/vnet/l2/l2_output.c | 6 | ||||
-rw-r--r-- | vnet/vnet/pg/input.c | 52 | ||||
-rw-r--r-- | vnet/vnet/unix/tapcli.c | 7 | ||||
-rw-r--r-- | vnet/vnet/unix/tuntap.c | 40 | ||||
-rw-r--r-- | vpp-api-test/vat/api_format.c | 1 | ||||
-rw-r--r-- | vpp/vpp-api/api.c | 4 |
21 files changed, 23 insertions, 350 deletions
diff --git a/vlib/vlib/buffer.c b/vlib/vlib/buffer.c index e1be2005424..4b899a898cc 100644 --- a/vlib/vlib/buffer.c +++ b/vlib/vlib/buffer.c @@ -1277,15 +1277,6 @@ vlib_buffer_chain_append_data_with_alloc (vlib_main_t * vm, return copied; } -/* - * Fills in the required rte_mbuf fields for chained buffers given a VLIB chain. - */ -void -vlib_buffer_chain_validate (vlib_main_t * vm, vlib_buffer_t * b_first) -{ - return; -} - static void vlib_serialize_tx (serialize_main_header_t * m, serialize_stream_t * s) { diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h index 29635a3fd96..60e0e28d625 100644 --- a/vlib/vlib/buffer_funcs.h +++ b/vlib/vlib/buffer_funcs.h @@ -42,18 +42,6 @@ #include <vppinfra/hash.h> -#if DPDK == 1 -#undef always_inline // dpdk and clib use conflicting always_inline macros. -#include <rte_config.h> -#include <rte_mbuf.h> - -#if CLIB_DEBUG > 0 -#define always_inline static inline -#else -#define always_inline static inline __attribute__ ((__always_inline__)) -#endif -#endif - /** \file vlib buffer access methods. */ @@ -244,14 +232,6 @@ vlib_buffer_set_known_state (vlib_main_t * vm, u8 *vlib_validate_buffer (vlib_main_t * vm, u32 buffer_index, uword follow_chain); -/* Validate an array of buffers. As above. */ -u8 *vlib_validate_buffers (vlib_main_t * vm, - u32 * buffers, - uword next_buffer_stride, - uword n_buffers, - vlib_buffer_known_state_t known_state, - uword follow_chain); - #endif /* DPDK == 0 */ clib_error_t *vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, @@ -429,6 +409,7 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b) vlib_buffer_t *s, *d, *fd; uword n_alloc, n_buffers = 1; u32 *new_buffers = 0; + u32 flag_mask = VLIB_BUFFER_NEXT_PRESENT | VLIB_BUFFER_TOTAL_LENGTH_VALID; int i; s = b; @@ -449,20 +430,10 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b) vlib_buffer_get_current (s), s->current_length); d->current_data = s->current_data; d->current_length = s->current_length; - d->flags = s->flags; + d->flags = s->flags & flag_mask; d->total_length_not_including_first_buffer = s->total_length_not_including_first_buffer; clib_memcpy (d->opaque, s->opaque, sizeof (s->opaque)); -#if DPDK > 0 - struct rte_mbuf *ms, *md; - ms = rte_mbuf_from_vlib_buffer (s); - md = rte_mbuf_from_vlib_buffer (d); - rte_pktmbuf_reset (md); - md->nb_segs = ms->nb_segs; - md->data_len = ms->data_len; - md->pkt_len = ms->pkt_len; - md->data_off = ms->data_off; -#endif /* next segments */ for (i = 1; i < n_buffers; i++) @@ -476,19 +447,7 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b) d->current_length = s->current_length; clib_memcpy (vlib_buffer_get_current (d), vlib_buffer_get_current (s), s->current_length); - d->flags = s->flags; -#if DPDK > 0 - /* previous */ - md->next = rte_mbuf_from_vlib_buffer (d); - /* current */ - md = rte_mbuf_from_vlib_buffer (d); - ms = rte_mbuf_from_vlib_buffer (s); - rte_pktmbuf_reset (md); - md->data_len = ms->data_len; - md->pkt_len = ms->pkt_len; - md->data_off = ms->data_off; - md->next = 0; -#endif + d->flags = s->flags & flag_mask; } return fd; @@ -507,11 +466,6 @@ vlib_buffer_chain_init (vlib_buffer_t * first) first->current_length = 0; first->flags &= ~VLIB_BUFFER_NEXT_PRESENT; first->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; -#if DPDK == 1 - struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer (first); - rte_pktmbuf_reset (mb); - mb->data_off = VLIB_BUFFER_PRE_DATA_SIZE + first->current_data; -#endif } /* The provided next_bi buffer index is appended to the end of the packet. */ @@ -525,19 +479,6 @@ vlib_buffer_chain_buffer (vlib_main_t * vm, last->flags |= VLIB_BUFFER_NEXT_PRESENT; next_buffer->current_length = 0; next_buffer->flags &= ~VLIB_BUFFER_NEXT_PRESENT; -#if DPDK == 1 - struct rte_mbuf *mb; - mb = rte_mbuf_from_vlib_buffer (first); - mb->nb_segs++; - - mb = rte_mbuf_from_vlib_buffer (last); - mb->next = rte_mbuf_from_vlib_buffer (next_buffer); - - mb = rte_mbuf_from_vlib_buffer (next_buffer); - mb->data_len = 0; - mb->data_off = VLIB_BUFFER_PRE_DATA_SIZE + next_buffer->current_data; - mb->next = 0; -#endif return next_buffer; } @@ -552,12 +493,6 @@ vlib_buffer_chain_increase_length (vlib_buffer_t * first, last->current_length += len; if (first != last) first->total_length_not_including_first_buffer += len; -#if DPDK == 1 - struct rte_mbuf *mb_first = rte_mbuf_from_vlib_buffer (first); - struct rte_mbuf *mb_last = rte_mbuf_from_vlib_buffer (last); - mb_first->pkt_len += len; - mb_last->data_len += len; -#endif } /* Copy data to the end of the packet and increases its length. diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c index 2f63543ec43..feb2bc6f739 100644 --- a/vlib/vlib/dpdk_buffer.c +++ b/vlib/vlib/dpdk_buffer.c @@ -526,9 +526,6 @@ fill_free_list (vlib_main_t * vm, ASSERT (rte_mbuf_refcnt_read (mb) == 0); rte_mbuf_refcnt_set (mb, 1); - mb->next = NULL; - mb->data_off = RTE_PKTMBUF_HEADROOM; - mb->nb_segs = 1; b = vlib_buffer_from_rte_mbuf (mb); bi = vlib_get_buffer_index (vm, b); @@ -866,12 +863,6 @@ vlib_packet_template_get_packet (vlib_main_t * vm, t->packet_data, vec_len (t->packet_data)); b->current_length = vec_len (t->packet_data); - /* Fix up mbuf header length fields */ - struct rte_mbuf *mb; - mb = rte_mbuf_from_vlib_buffer (b); - mb->data_len = b->current_length; - mb->pkt_len = b->current_length; - return b->data; } @@ -968,31 +959,6 @@ vlib_buffer_chain_append_data_with_alloc (vlib_main_t * vm, return copied; } -/* - * Fills in the required rte_mbuf fields for chained buffers given a VLIB chain. - */ -void -vlib_buffer_chain_validate (vlib_main_t * vm, vlib_buffer_t * b_first) -{ - vlib_buffer_t *b = b_first, *prev = b_first; - struct rte_mbuf *mb_prev, *mb, *mb_first; - - mb_first = rte_mbuf_from_vlib_buffer (b_first); - - mb_first->pkt_len = mb_first->data_len = b_first->current_length; - while (b->flags & VLIB_BUFFER_NEXT_PRESENT) - { - b = vlib_get_buffer (vm, b->next_buffer); - mb = rte_mbuf_from_vlib_buffer (b); - mb_prev = rte_mbuf_from_vlib_buffer (prev); - mb_first->nb_segs++; - mb_first->pkt_len += b->current_length; - mb_prev->next = mb; - mb->data_len = b->current_length; - prev = b; - } -} - clib_error_t * vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, unsigned socket_id) diff --git a/vlib/vlib/threads_cli.c b/vlib/vlib/threads_cli.c index 6651a4dd671..ee632279db5 100644 --- a/vlib/vlib/threads_cli.c +++ b/vlib/vlib/threads_cli.c @@ -20,6 +20,14 @@ #include <vlib/threads.h> #include <vlib/unix/unix.h> +#if DPDK==1 +#include <rte_config.h> +#include <rte_common.h> +#include <rte_eal.h> +#include <rte_launch.h> +#include <rte_lcore.h> +#endif + static u8 * format_sched_policy_and_priority (u8 * s, va_list * args) { diff --git a/vnet/vnet/buffer.h b/vnet/vnet/buffer.h index d3ad86442cd..2ae4f1ccb70 100644 --- a/vnet/vnet/buffer.h +++ b/vnet/vnet/buffer.h @@ -67,6 +67,9 @@ #define LOG2_BUFFER_HANDOFF_NEXT_VALID LOG2_VLIB_BUFFER_FLAG_USER(6) #define BUFFER_HANDOFF_NEXT_VALID (1 << LOG2_BUFFER_HANDOFF_NEXT_VALID) +#define LOG2_VNET_BUFFER_RTE_MBUF_IS_VALID LOG2_VLIB_BUFFER_FLAG_USER(7) +#define VNET_BUFFER_RTE_MBUF_IS_VALID (1 << LOG2_VNET_BUFFER_RTE_MBUF_IS_VALID) + #define foreach_buffer_opaque_union_subtype \ _(ethernet) \ _(ip) \ diff --git a/vnet/vnet/devices/af_packet/node.c b/vnet/vnet/devices/af_packet/node.c index 083c5581c2d..72004320c67 100644 --- a/vnet/vnet/devices/af_packet/node.c +++ b/vnet/vnet/devices/af_packet/node.c @@ -104,17 +104,6 @@ buffer_add_to_chain (vlib_main_t * vm, u32 bi, u32 first_bi, u32 prev_bi) /* update current buffer */ b->next_buffer = 0; - -#if DPDK > 0 - struct rte_mbuf *mbuf = rte_mbuf_from_vlib_buffer (b); - struct rte_mbuf *first_mbuf = rte_mbuf_from_vlib_buffer (first_b); - struct rte_mbuf *prev_mbuf = rte_mbuf_from_vlib_buffer (prev_b); - first_mbuf->nb_segs++; - prev_mbuf->next = mbuf; - mbuf->data_len = b->current_length; - mbuf->data_off = RTE_PKTMBUF_HEADROOM + b->current_data; - mbuf->next = 0; -#endif } always_inline uword @@ -194,11 +183,6 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, if (offset == 0) { -#if DPDK > 0 - struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer (b0); - rte_pktmbuf_data_len (mb) = b0->current_length; - rte_pktmbuf_pkt_len (mb) = b0->current_length; -#endif b0->total_length_not_including_first_buffer = 0; b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; vnet_buffer (b0)->sw_if_index[VLIB_RX] = apif->sw_if_index; diff --git a/vnet/vnet/devices/netmap/node.c b/vnet/vnet/devices/netmap/node.c index b96bada5f37..19895e4754a 100644 --- a/vnet/vnet/devices/netmap/node.c +++ b/vnet/vnet/devices/netmap/node.c @@ -83,17 +83,6 @@ buffer_add_to_chain (vlib_main_t * vm, u32 bi, u32 first_bi, u32 prev_bi) /* update current buffer */ b->next_buffer = 0; - -#if DPDK > 0 - struct rte_mbuf *mbuf = rte_mbuf_from_vlib_buffer (b); - struct rte_mbuf *first_mbuf = rte_mbuf_from_vlib_buffer (first_b); - struct rte_mbuf *prev_mbuf = rte_mbuf_from_vlib_buffer (prev_b); - first_mbuf->nb_segs++; - prev_mbuf->next = mbuf; - mbuf->data_len = b->current_length; - mbuf->data_off = RTE_PKTMBUF_HEADROOM + b->current_data; - mbuf->next = 0; -#endif } always_inline uword @@ -195,11 +184,6 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, if (offset == 0) { -#if DPDK > 0 - struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer (b0); - rte_pktmbuf_data_len (mb) = b0->current_length; - rte_pktmbuf_pkt_len (mb) = b0->current_length; -#endif b0->total_length_not_including_first_buffer = 0; b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; vnet_buffer (b0)->sw_if_index[VLIB_RX] = diff --git a/vnet/vnet/devices/ssvm/node.c b/vnet/vnet/devices/ssvm/node.c index 5ecccd376c0..3a695b1d8c0 100644 --- a/vnet/vnet/devices/ssvm/node.c +++ b/vnet/vnet/devices/ssvm/node.c @@ -77,11 +77,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em, int rx_queue_index; u32 n_to_alloc = VLIB_FRAME_SIZE * 2; u32 n_allocated, n_present_in_cache; -#if DPDK > 0 u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; -#else - u32 next_index = 0; -#endif vlib_buffer_free_list_t *fl; u32 n_left_to_next, *to_next; u32 next0; diff --git a/vnet/vnet/devices/ssvm/ssvm_eth.h b/vnet/vnet/devices/ssvm/ssvm_eth.h index f4156e3ae70..ac611f4edb6 100644 --- a/vnet/vnet/devices/ssvm/ssvm_eth.h +++ b/vnet/vnet/devices/ssvm/ssvm_eth.h @@ -25,6 +25,7 @@ #include <vppinfra/elog.h> #include <vlib/vlib.h> #include <vnet/ethernet/ethernet.h> +#include <vnet/devices/devices.h> #include <vnet/ip/ip.h> #include <vnet/pg/pg.h> #include <vlibmemory/unix_shared_memory_queue.h> diff --git a/vnet/vnet/devices/virtio/vhost-user.h b/vnet/vnet/devices/virtio/vhost-user.h index 0495991d02c..4ce0830963f 100644 --- a/vnet/vnet/devices/virtio/vhost-user.h +++ b/vnet/vnet/devices/virtio/vhost-user.h @@ -32,10 +32,6 @@ #define VHOST_VRING_F_LOG 0 #define VHOST_USER_F_PROTOCOL_FEATURES 30 -#if DPDK == 0 -#define RTE_VERSION_NUM(a,b,c,d) 1 -#define RTE_VERSION 0 -#endif #define VHOST_USER_PROTOCOL_FEATURES ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD)) diff --git a/vnet/vnet/ip/ip.h b/vnet/vnet/ip/ip.h index c9a82930a67..f50662b2acf 100644 --- a/vnet/vnet/ip/ip.h +++ b/vnet/vnet/ip/ip.h @@ -63,11 +63,6 @@ #include <vnet/ip/ip6_packet.h> #include <vnet/ip/ip6_error.h> #include <vnet/ip/icmp6.h> - -#if DPDK > 0 -#include <vnet/devices/dpdk/dpdk.h> -#endif - #include <vnet/classify/vnet_classify.h> /* Per protocol info. */ @@ -155,35 +150,6 @@ ip_incremental_checksum_buffer (vlib_main_t * vm, vlib_buffer_t * first_buffer, u32 first_buffer_offset, u32 n_bytes_to_checksum, ip_csum_t sum) -#if DPDK > 0 -{ - u32 n_bytes_left = n_bytes_to_checksum; - struct rte_mbuf * mb = rte_mbuf_from_vlib_buffer(first_buffer); - u8 nb_segs = mb->nb_segs; - ASSERT(mb->data_len >= first_buffer_offset); - void * h; - u32 n; - - n = clib_min (n_bytes_left, mb->data_len); - h = vlib_buffer_get_current (first_buffer) + first_buffer_offset; - while (n_bytes_left) - { - sum = ip_incremental_checksum (sum, h, n); - n_bytes_left -= n; - nb_segs--; - mb = mb->next; - if ((nb_segs == 0) || (mb == 0)) - break; - - n = clib_min (n_bytes_left, mb->data_len); - h = rte_ctrlmbuf_data(mb); - } - - ASSERT(n_bytes_left == 0); - ASSERT(nb_segs == 0); - return sum; -} -#else { vlib_buffer_t * b = first_buffer; u32 n_bytes_left = n_bytes_to_checksum; @@ -210,7 +176,6 @@ ip_incremental_checksum_buffer (vlib_main_t * vm, vlib_buffer_t * first_buffer, return sum; } -#endif /* DPDK */ void ip_del_all_interface_addresses (vlib_main_t *vm, u32 sw_if_index); diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c index 14dd9dfbdf0..f3cd640a841 100644 --- a/vnet/vnet/ip/ip6_forward.c +++ b/vnet/vnet/ip/ip6_forward.c @@ -1177,35 +1177,6 @@ u16 ip6_tcp_udp_icmp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0, ip6 } n_bytes_left = n_this_buffer = payload_length_host_byte_order; -#if DPDK > 0 - if (p0 && n_this_buffer + headers_size > p0->current_length) - { - struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer(p0); - u8 nb_segs = mb->nb_segs; - - n_this_buffer = (p0->current_length > headers_size ? - p0->current_length - headers_size : 0); - while (n_bytes_left) - { - sum0 = ip_incremental_checksum (sum0, data_this_buffer, n_this_buffer); - n_bytes_left -= n_this_buffer; - - mb = mb->next; - nb_segs--; - if ((nb_segs == 0) || (mb == 0)) - break; - - data_this_buffer = rte_ctrlmbuf_data(mb); - n_this_buffer = mb->data_len; - } - if (n_bytes_left || nb_segs) - { - *bogus_lengthp = 1; - return 0xfefe; - } - } - else sum0 = ip_incremental_checksum (sum0, data_this_buffer, n_this_buffer); -#else if (p0 && n_this_buffer + headers_size > p0->current_length) n_this_buffer = p0->current_length > headers_size ? p0->current_length - headers_size : 0; while (1) @@ -1224,7 +1195,6 @@ u16 ip6_tcp_udp_icmp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0, ip6 data_this_buffer = vlib_buffer_get_current (p0); n_this_buffer = p0->current_length; } -#endif /* DPDK */ sum16 = ~ ip_csum_fold (sum0); diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index af852a2be86..cc176306969 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -23,10 +23,6 @@ #include <vnet/fib/fib_table.h> #include <vnet/fib/ip6_fib.h> -#if DPDK==1 -#include <vnet/devices/dpdk/dpdk.h> -#endif - /** * @file * @brief IPv6 Neighbor Adjacency and Neighbor Discovery. @@ -317,7 +313,6 @@ typedef struct { ip6_address_t addr; } ip6_neighbor_set_unset_rpc_args_t; -#if DPDK > 0 static void ip6_neighbor_set_unset_rpc_callback ( ip6_neighbor_set_unset_rpc_args_t * a); @@ -340,7 +335,6 @@ static void set_unset_ip6_neighbor_rpc vl_api_rpc_call_main_thread (ip6_neighbor_set_unset_rpc_callback, (u8 *) &args, sizeof (args)); } -#endif static void ip6_nbr_probe (ip_adjacency_t *adj) @@ -538,14 +532,12 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm, u32 next_index; pending_resolution_t * pr, * mc; -#if DPDK > 0 if (os_get_cpu_number()) { set_unset_ip6_neighbor_rpc (vm, sw_if_index, a, link_layer_address, 1 /* set new neighbor */, is_static); return 0; } -#endif k.sw_if_index = sw_if_index; k.ip6_address = a[0]; @@ -687,14 +679,12 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm, uword * p; int rv = 0; -#if DPDK > 0 if (os_get_cpu_number()) { set_unset_ip6_neighbor_rpc (vm, sw_if_index, a, link_layer_address, 0 /* unset */, 0); return 0; } -#endif k.sw_if_index = sw_if_index; k.ip6_address = a[0]; @@ -722,7 +712,6 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm, return rv; } -#if DPDK > 0 static void ip6_neighbor_set_unset_rpc_callback ( ip6_neighbor_set_unset_rpc_args_t * a) { @@ -734,7 +723,6 @@ static void ip6_neighbor_set_unset_rpc_callback vnet_unset_ip6_ethernet_neighbor (vm, a->sw_if_index, &a->addr, a->link_layer_address, 6); } -#endif static int ip6_neighbor_sort (void *a1, void *a2) diff --git a/vnet/vnet/ipsec/esp.h b/vnet/vnet/ipsec/esp.h index 505d34ad859..b9feacbb322 100644 --- a/vnet/vnet/ipsec/esp.h +++ b/vnet/vnet/ipsec/esp.h @@ -12,9 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#if DPDK==1 -#include <vnet/devices/dpdk/dpdk.h> -#endif #include <openssl/hmac.h> #include <openssl/rand.h> diff --git a/vnet/vnet/ipsec/ipsec.h b/vnet/vnet/ipsec/ipsec.h index dbbb928fc30..d33df383669 100644 --- a/vnet/vnet/ipsec/ipsec.h +++ b/vnet/vnet/ipsec/ipsec.h @@ -12,10 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#if DPDK==1 -#include <vnet/devices/dpdk/dpdk.h> -#endif - #define IPSEC_FLAG_IPSEC_GRE_TUNNEL (1 << 0) #define foreach_ipsec_policy_action \ @@ -280,12 +276,6 @@ int ipsec_set_interface_key (vnet_main_t * vnm, u32 hw_if_index, always_inline void ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im) { -#if DPDK==1 - dpdk_main_t *dm = &dpdk_main; - u32 free_list_index = dm->vlib_buffer_free_list_index; -#else - u32 free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX; -#endif u32 cpu_index = os_get_cpu_number (); uword l = vec_len (im->empty_buffers[cpu_index]); uword n_alloc = 0; @@ -297,11 +287,8 @@ ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im) vec_alloc (im->empty_buffers[cpu_index], 2 * VLIB_FRAME_SIZE); } - n_alloc = vlib_buffer_alloc_from_free_list (vm, - im->empty_buffers[cpu_index] - + l, - 2 * VLIB_FRAME_SIZE - l, - free_list_index); + n_alloc = vlib_buffer_alloc (vm, im->empty_buffers[cpu_index] + l, + 2 * VLIB_FRAME_SIZE - l); _vec_len (im->empty_buffers[cpu_index]) = l + n_alloc; } diff --git a/vnet/vnet/l2/l2_output.c b/vnet/vnet/l2/l2_output.c index f8ebe146000..22ce663b899 100644 --- a/vnet/vnet/l2/l2_output.c +++ b/vnet/vnet/l2/l2_output.c @@ -614,7 +614,6 @@ typedef struct u32 sw_if_index; } output_node_mapping_rpc_args_t; -#if DPDK > 0 static void output_node_rpc_callback (output_node_mapping_rpc_args_t * a); static void @@ -629,7 +628,6 @@ output_node_mapping_send_rpc (u32 node_index, u32 sw_if_index) vl_api_rpc_call_main_thread (output_node_rpc_callback, (u8 *) & args, sizeof (args)); } -#endif /** Create a mapping in the next node mapping table for the given sw_if_index. */ @@ -645,7 +643,6 @@ l2output_create_output_node_mapping (vlib_main_t * vlib_main, vnet_main_t * vnet hw0 = vnet_get_sup_hw_interface (vnet_main, sw_if_index); -#if DPDK > 0 uword cpu_number; cpu_number = os_get_cpu_number (); @@ -663,7 +660,6 @@ l2output_create_output_node_mapping (vlib_main_t * vlib_main, vnet_main_t * vnet output_node_mapping_send_rpc (node_index, sw_if_index); return L2OUTPUT_NEXT_DROP; } -#endif /* dynamically create graph node arc */ next = vlib_node_add_next (vlib_main, node_index, hw0->output_node_index); @@ -679,7 +675,6 @@ l2output_create_output_node_mapping (vlib_main_t * vlib_main, vnet_main_t * vnet return next; } -#if DPDK > 0 void output_node_rpc_callback (output_node_mapping_rpc_args_t * a) { @@ -691,7 +686,6 @@ output_node_rpc_callback (output_node_mapping_rpc_args_t * a) (vm, vnm, a->node_index, mp->next_nodes.output_node_index_vec, a->sw_if_index); } -#endif /* Get a pointer to the config for the given interface */ l2_output_config_t * diff --git a/vnet/vnet/pg/input.c b/vnet/vnet/pg/input.c index 54687d51190..77b56f528fc 100644 --- a/vnet/vnet/pg/input.c +++ b/vnet/vnet/pg/input.c @@ -43,39 +43,6 @@ #include <vnet/feature/feature.h> #include <vnet/devices/devices.h> -#if DPDK==1 -#include <vnet/devices/dpdk/dpdk.h> -#endif - -static inline void -pg_set_mbuf_metadata (pg_main_t * pg, u32 * buffers, u32 n_alloc) -{ -#if DPDK == 1 - vlib_main_t *vm = vlib_get_main (); - vlib_buffer_t *b; - struct rte_mbuf *mb; - i16 delta; - u16 new_data_len; - u16 new_pkt_len; - - int i; - - for (i = 0; i < n_alloc; i++) - { - b = vlib_get_buffer (vm, buffers[i]); - mb = rte_mbuf_from_vlib_buffer (b); - - delta = vlib_buffer_length_in_chain (vm, b) - (i16) mb->pkt_len; - new_data_len = (u16) ((i16) mb->data_len + delta); - new_pkt_len = (u16) ((i16) mb->pkt_len + delta); - - mb->data_len = new_data_len; - mb->pkt_len = new_pkt_len; - mb->data_off = (u16) ((RTE_PKTMBUF_HEADROOM) + b->current_data); - } -#endif -} - static int validate_buffer_data2 (vlib_buffer_t * b, pg_stream_t * s, u32 data_offset, u32 n_bytes) @@ -930,7 +897,6 @@ pg_generate_set_lengths (pg_main_t * pg, si->sw_if_index, n_buffers, length_sum); } - pg_set_mbuf_metadata (pg, buffers, n_buffers); } static void @@ -1398,24 +1364,6 @@ pg_stream_fill (pg_main_t * pg, pg_stream_t * s, u32 n_buffers) last_start = start; /* Verify that pkts in the fifo are properly allocated */ -#if DPDK == 1 - if (CLIB_DEBUG > 0) - { - u32 *bi0; - vlib_main_t *vm = vlib_get_main (); - /* *INDENT-OFF* */ - clib_fifo_foreach (bi0, bi->buffer_fifo, - ({ - vlib_buffer_t * b; - struct rte_mbuf *mb; - - b = vlib_get_buffer(vm, bi0[0]); - mb = rte_mbuf_from_vlib_buffer(b); - ASSERT(rte_mbuf_refcnt_read(mb) == 1); - })); - /* *INDENT-ON* */ - } -#endif } return n_in_fifo + n_added; diff --git a/vnet/vnet/unix/tapcli.c b/vnet/vnet/unix/tapcli.c index d23e6fea64f..db634f710fe 100644 --- a/vnet/vnet/unix/tapcli.c +++ b/vnet/vnet/unix/tapcli.c @@ -39,10 +39,6 @@ #include <vnet/ethernet/ethernet.h> -#if DPDK == 1 -#include <vnet/devices/dpdk/dpdk.h> -#endif - #include <vnet/feature/feature.h> #include <vnet/devices/devices.h> #include <vnet/unix/tapcli.h> @@ -343,9 +339,6 @@ static uword tapcli_rx_iface(vlib_main_t * vm, (n_bytes_in_packet > buffer_size) ? n_bytes_in_packet - buffer_size : 0; b_first->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; - /* Ensure mbufs are updated */ - vlib_buffer_chain_validate(vm, b_first); - VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b_first); vnet_buffer (b_first)->sw_if_index[VLIB_RX] = ti->sw_if_index; diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c index dbb6f309045..4a5dd676a68 100644 --- a/vnet/vnet/unix/tuntap.c +++ b/vnet/vnet/unix/tuntap.c @@ -50,10 +50,6 @@ #include <vnet/devices/devices.h> #include <vnet/feature/feature.h> -#if DPDK == 1 -#include <vnet/devices/dpdk/dpdk.h> -#endif - static vnet_device_class_t tuntap_dev_class; static vnet_hw_interface_class_t tuntap_interface_class; @@ -233,13 +229,6 @@ tuntap_rx (vlib_main_t * vm, vlib_buffer_t * b; u32 bi; const uword buffer_size = VLIB_BUFFER_DATA_SIZE; -#if DPDK == 0 - u32 free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX; -#else - dpdk_main_t * dm = &dpdk_main; - u32 free_list_index = dm->vlib_buffer_free_list_index; - struct rte_mbuf *first_mb = NULL, *prev_mb = NULL; -#endif /** Make sure we have some RX buffers. */ { @@ -251,9 +240,7 @@ tuntap_rx (vlib_main_t * vm, if (! tm->rx_buffers) vec_alloc (tm->rx_buffers, VLIB_FRAME_SIZE); - n_alloc = vlib_buffer_alloc_from_free_list - (vm, tm->rx_buffers + n_left, VLIB_FRAME_SIZE - n_left, - free_list_index); + n_alloc = vlib_buffer_alloc (vm, tm->rx_buffers + n_left, VLIB_FRAME_SIZE - n_left); _vec_len (tm->rx_buffers) = n_left + n_alloc; } } @@ -289,46 +276,21 @@ tuntap_rx (vlib_main_t * vm, while (1) { -#if DPDK == 1 - struct rte_mbuf * mb; -#endif b = vlib_get_buffer (vm, tm->rx_buffers[i_rx]); -#if DPDK == 1 - mb = rte_mbuf_from_vlib_buffer(b); - - if (first_mb == NULL) - first_mb = mb; - - if (prev_mb != NULL) - { - prev_mb->next = mb; - first_mb->nb_segs++; - } -#endif b->flags = 0; b->current_data = 0; b->current_length = n_bytes_left < buffer_size ? n_bytes_left : buffer_size; n_bytes_left -= buffer_size; -#if DPDK == 1 - rte_pktmbuf_data_len (mb) = b->current_length; - mb->data_off = RTE_PKTMBUF_HEADROOM + b->current_data; -#endif if (n_bytes_left <= 0) { -#if DPDK == 1 - rte_pktmbuf_pkt_len (first_mb) = n_bytes_in_packet; -#endif break; } i_rx--; b->flags |= VLIB_BUFFER_NEXT_PRESENT; b->next_buffer = tm->rx_buffers[i_rx]; -#if DPDK == 1 - prev_mb = mb; -#endif } /** Interface counters for tuntap interface. */ diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 549bd0377fb..67280df87ee 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -54,6 +54,7 @@ #include "vat/json_format.h" +#include <inttypes.h> #include <sys/stat.h> #define vl_typedefs /* define message structures */ diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index 676b0c45728..73e3c0ddaa5 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -95,6 +95,10 @@ #undef __included_bihash_template_h__ #include <vnet/l2/l2_fib.h> +#if DPDK > 0 +#include <vnet/devices/dpdk/dpdk.h> +#endif + #if IPSEC > 0 #include <vnet/ipsec/ipsec.h> #include <vnet/ipsec/ikev2.h> |