summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg
AgeCommit message (Expand)AuthorFilesLines
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-1/+1
2019-02-22Add no-append flag to vlib_frame_tDamjan Marion1-0/+1
2019-02-20pg: fix payload hex-string bugKingwel Xie1-6/+8
2019-02-20pg: fix tracing when device-input feature arc is usedDamjan Marion1-6/+4
2019-02-20pg: fix crash when multiple streams are enqueuing to the same nextDamjan Marion1-1/+1
2019-02-20pg: remove no-recycle optionDamjan Marion2-6/+0
2019-02-09buffers: fix typoDamjan Marion3-3/+3
2019-02-06buffers: make buffer data size configurable from startup configDamjan Marion3-5/+5
2019-01-25pg: bugfix for pg paylod hdr-sizeKingwel Xie1-3/+3
2019-01-23pg: cli improvementKingwel Xie4-32/+97
2019-01-18Add vlib_buffer_copy_indices inline functionDamjan Marion1-4/+3
2019-01-06pktgen: support mixed multi/single chunk pcap replayDave Barach3-71/+165
2019-01-01buffers: remove unused codeDamjan Marion4-15/+7
2018-11-20ethernet-input optimizationsDamjan Marion1-1/+19
2018-11-17pcap-based dispatch tracerDave Barach2-2/+2
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach3-21/+25
2018-11-13vlib rename vlib_frame_args(...) to vlib_frame_scalar_args(..)Damjan Marion1-2/+2
2018-10-27pg: incrementing len should be truncated byKingwel Xie1-12/+15
2018-10-23c11 safe string handling supportDave Barach2-3/+3
2018-10-19vppinfra: add atomic macros for __sync builtinsSirshak Das1-2/+3
2018-07-19Cleanup of handoff codeDamjan Marion1-3/+0
2018-05-17Packet generator: preserve pcap file timestampsDave Barach3-0/+8
2018-04-27A bit of buffer metadata reshuffling to accommodate flow_idDamjan Marion1-1/+1
2018-03-07packet-generator: use default free listDamjan Marion2-63/+8
2018-02-07Refactor vlib_buffer flagsDamjan Marion1-1/+1
2018-01-23VPPAPIGEN: vppapigen replacement in Python PLY.Ole Troan1-1/+1
2017-11-21dpdk: add l2_hdr_offset and l3_hdr_offset in vlib_buffer_tDamjan Marion2-3/+3
2017-11-10Break up vpe.apiNeale Ranns2-0/+269
2017-10-04[aarch64] Fixes CLI crashes on dpaa2 platform.Christophe Fontaine2-2/+2
2017-07-10vlib: store buffer memory information in the buffer_mainDamjan Marion2-4/+4
2017-04-06Use thread local storage for thread indexDamjan Marion1-2/+2
2017-03-17Fix IP feature ordering.Neale Ranns1-4/+0
2017-03-07DHCP Multiple Servers (VPP-602, VPP-605)Neale Ranns1-0/+6
2017-03-01dpdk: be a pluginDamjan Marion2-8/+8
2017-02-22VPP-635: CLI Memory leak with invalid parameterBilly McFall1-10/+29
2017-02-03pg: add trace information for pg tx nodeDamjan Marion3-9/+46
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion9-0/+3742
s="p">{ u32 sw_if_index; u32 next_worker_index; u32 buffer_index; } worker_handoff_trace_t; #define foreach_worker_handoff_error \ _(CONGESTION_DROP, "congestion drop") typedef enum { #define _(sym,str) WORKER_HANDOFF_ERROR_##sym, foreach_worker_handoff_error #undef _ WORKER_HANDOFF_N_ERROR, } worker_handoff_error_t; static char *worker_handoff_error_strings[] = { #define _(sym,string) string, foreach_worker_handoff_error #undef _ }; /* packet trace format function */ static u8 * format_worker_handoff_trace (u8 * s, va_list * args) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); worker_handoff_trace_t *t = va_arg (*args, worker_handoff_trace_t *); s = format (s, "worker-handoff: sw_if_index %d, next_worker %d, buffer 0x%x", t->sw_if_index, t->next_worker_index, t->buffer_index); return s; } VLIB_NODE_FN (worker_handoff_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { handoff_main_t *hm = &handoff_main; vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b; u32 n_enq, n_left_from, *from; u16 thread_indices[VLIB_FRAME_SIZE], *ti; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; vlib_get_buffers (vm, from, bufs, n_left_from); b = bufs; ti = thread_indices; while (n_left_from > 0) { u32 sw_if_index0; u32 hash; u64 hash_key; per_inteface_handoff_data_t *ihd0; u32 index0; sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_RX]; ASSERT (hm->if_data); ihd0 = vec_elt_at_index (hm->if_data, sw_if_index0); /* * Force unknown traffic onto worker 0, * and into ethernet-input. $$$$ add more hashes. */ /* Compute ingress LB hash */ hash_key = hm->hash_fn ((ethernet_header_t *) vlib_buffer_get_current (b[0])); hash = (u32) clib_xxhash (hash_key); /* if input node did not specify next index, then packet should go to ethernet-input */ if (PREDICT_TRUE (is_pow2 (vec_len (ihd0->workers)))) index0 = hash & (vec_len (ihd0->workers) - 1); else index0 = hash % vec_len (ihd0->workers); ti[0] = hm->first_worker_index + ihd0->workers[index0]; if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && (b[0]->flags & VLIB_BUFFER_IS_TRACED))) { worker_handoff_trace_t *t = vlib_add_trace (vm, node, b[0], sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_worker_index = ti[0]; t->buffer_index = vlib_get_buffer_index (vm, b[0]); } /* next */ n_left_from -= 1; ti += 1; b += 1; } n_enq = vlib_buffer_enqueue_to_thread (vm, hm->frame_queue_index, from, thread_indices, frame->n_vectors, 1); if (n_enq < frame->n_vectors) vlib_node_increment_counter (vm, node->node_index, WORKER_HANDOFF_ERROR_CONGESTION_DROP, frame->n_vectors - n_enq); return frame->n_vectors; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (worker_handoff_node) = { .name = "worker-handoff", .vector_size = sizeof (u32), .format_trace = format_worker_handoff_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = ARRAY_LEN(worker_handoff_error_strings), .error_strings = worker_handoff_error_strings, .n_next_nodes = 1, .next_nodes = { [0] = "error-drop", }, }; /* *INDENT-ON* */ #ifndef CLIB_MARCH_VARIANT int interface_handoff_enable_disable (vlib_main_t * vm, u32 sw_if_index, uword * bitmap, int enable_disable) { handoff_main_t *hm = &handoff_main; vnet_sw_interface_t *sw; vnet_main_t *vnm = vnet_get_main (); per_inteface_handoff_data_t *d; int i, rv = 0; if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index)) return VNET_API_ERROR_INVALID_SW_IF_INDEX; sw = vnet_get_sw_interface (vnm, sw_if_index); if (sw->type != VNET_SW_INTERFACE_TYPE_HARDWARE) return VNET_API_ERROR_INVALID_SW_IF_INDEX; if (clib_bitmap_last_set (bitmap) >= hm->num_workers) return VNET_API_ERROR_INVALID_WORKER; if (hm->frame_queue_index == ~0) { vlib_node_t *n = vlib_get_node_by_name (vm, (u8 *) "ethernet-input"); hm->frame_queue_index = vlib_frame_queue_main_init (n->index, 0); } vec_validate (hm->if_data, sw_if_index); d = vec_elt_at_index (hm->if_data, sw_if_index); vec_free (d->workers); vec_free (d->workers_bitmap); if (enable_disable) { d->workers_bitmap = bitmap; /* *INDENT-OFF* */ clib_bitmap_foreach (i, bitmap, ({ vec_add1(d->workers, i); })); /* *INDENT-ON* */ } vnet_feature_enable_disable ("device-input", "worker-handoff", sw_if_index, enable_disable, 0, 0); return rv; } static clib_error_t * set_interface_handoff_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { handoff_main_t *hm = &handoff_main; u32 sw_if_index = ~0; int enable_disable = 1; uword *bitmap = 0; u32 sym = ~0; int rv = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "disable")) enable_disable = 0; else if (unformat (input, "workers %U", unformat_bitmap_list, &bitmap)) ; else if (unformat (input, "%U", unformat_vnet_sw_interface, vnet_get_main (), &sw_if_index)) ; else if (unformat (input, "symmetrical")) sym = 1; else if (unformat (input, "asymmetrical")) sym = 0; else break; } if (sw_if_index == ~0) return clib_error_return (0, "Please specify an interface..."); if (bitmap == 0) return clib_error_return (0, "Please specify list of workers..."); rv = interface_handoff_enable_disable (vm, sw_if_index, bitmap, enable_disable); switch (rv) { case 0: break; case VNET_API_ERROR_INVALID_SW_IF_INDEX: return clib_error_return (0, "Invalid interface"); break; case VNET_API_ERROR_INVALID_WORKER: return clib_error_return (0, "Invalid worker(s)"); break; case VNET_API_ERROR_UNIMPLEMENTED: return clib_error_return (0, "Device driver doesn't support redirection"); break; default: return clib_error_return (0, "unknown return value %d", rv); } if (sym == 1) hm->hash_fn = eth_get_sym_key; else if (sym == 0) hm->hash_fn = eth_get_key; return 0; } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_interface_handoff_command, static) = { .path = "set interface handoff", .short_help = "set interface handoff <interface-name> workers <workers-list> [symmetrical|asymmetrical]", .function = set_interface_handoff_command_fn, }; /* *INDENT-ON* */ clib_error_t * handoff_init (vlib_main_t * vm) { handoff_main_t *hm = &handoff_main; vlib_thread_main_t *tm = vlib_get_thread_main (); clib_error_t *error; uword *p; if ((error = vlib_call_init_function (vm, threads_init))) return error; vlib_thread_registration_t *tr; /* Only the standard vnet worker threads are supported */ p = hash_get_mem (tm->thread_registrations_by_name, "workers"); if (p) { tr = (vlib_thread_registration_t *) p[0]; if (tr) { hm->num_workers = tr->count; hm->first_worker_index = tr->first_index; } } hm->hash_fn = eth_get_key; hm->frame_queue_index = ~0; return 0; } VLIB_INIT_FUNCTION (handoff_init); #endif /* CLIB_MARCH_VARIANT */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */