summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-11-14 16:55:53 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-11-20 22:05:06 +0000
commit650223c0ae8fe781aea5f26c92a6cf9bc2ca59e5 (patch)
tree1a4d5b85ed7adeab9e5f34410362a6323d096a65 /src/vnet/pg
parent7e0b17df0990ebca9cbae71b31cae7fd2c439acf (diff)
ethernet-input optimizations
Change-Id: I4ec7750ef58363bd8966a16a2baeec6db18b7e9e Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/pg')
-rw-r--r--src/vnet/pg/input.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index 8b46688929f..ee6aad4995e 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -40,6 +40,7 @@
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
#include <vnet/vnet.h>
+#include <vnet/ethernet/ethernet.h>
#include <vnet/feature/feature.h>
#include <vnet/devices/devices.h>
@@ -1496,7 +1497,24 @@ pg_generate_packets (vlib_node_runtime_t * node,
{
u32 *head, *start, *end;
- vlib_get_next_frame (vm, node, next_index, to_next, n_left);
+ if (PREDICT_TRUE (next_index == VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT))
+ {
+ vlib_next_frame_t *nf;
+ vlib_frame_t *f;
+ ethernet_input_frame_t *ef;
+ pg_interface_t *pi;
+ vlib_get_new_next_frame (vm, node, next_index, to_next, n_left);
+ nf = vlib_node_runtime_get_next_frame (vm, node, next_index);
+ f = vlib_get_frame (vm, nf->frame_index);
+ f->flags = ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX;
+
+ ef = vlib_frame_scalar_args (f);
+ pi = pool_elt_at_index (pg->interfaces, s->pg_if_index);
+ ef->sw_if_index = pi->sw_if_index;
+ ef->hw_if_index = pi->hw_if_index;
+ }
+ else
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left);
n_this_frame = n_packets_to_generate;
if (n_this_frame > n_left)