aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-06 12:02:50 +0100
committerNeale Ranns <nranns@cisco.com>2017-03-06 16:21:23 +0000
commit35af9e50cdbfc73dab963557f4ffbd56b21e2abc (patch)
treed9a4a567eb13f1a74472ee50487477ad682b0f8f
parent0e2e0dfe8b6783641e779b01a4b8e9ebf0e6fc77 (diff)
features: take device-input buffer advance value directly
Change-Id: Ifac7d9134d03d79164ce6f06ae9413279bbaadb3 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/dpdk/device/node.c6
-rw-r--r--src/vnet/devices/af_packet/node.c3
-rw-r--r--src/vnet/devices/netmap/node.c2
-rw-r--r--src/vnet/devices/virtio/vhost-user.c2
-rw-r--r--src/vnet/feature/feature.h62
-rw-r--r--src/vnet/unix/tapcli.c3
-rw-r--r--src/vnet/unix/tuntap.c2
7 files changed, 42 insertions, 38 deletions
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index 04c416550c6..ccbfd2f290a 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -439,9 +439,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
/* Do we have any driver RX features configured on the interface? */
vnet_feature_start_device_input_x4 (xd->vlib_sw_if_index,
&next0, &next1, &next2, &next3,
- b0, b1, b2, b3,
- l3_offset0, l3_offset1,
- l3_offset2, l3_offset3);
+ b0, b1, b2, b3);
vlib_validate_buffer_enqueue_x4 (vm, node, next_index,
to_next, n_left_to_next,
@@ -502,7 +500,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
/* Do we have any driver RX features configured on the interface? */
vnet_feature_start_device_input_x1 (xd->vlib_sw_if_index, &next0,
- b0, l3_offset0);
+ b0);
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next,
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 69fc11c927e..ab7fd80005f 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -216,8 +216,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* redirect if feature path enabled */
- vnet_feature_start_device_input_x1 (apif->sw_if_index, &next0, b0,
- 0);
+ vnet_feature_start_device_input_x1 (apif->sw_if_index, &next0, b0);
/* enque and take next packet */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
diff --git a/src/vnet/devices/netmap/node.c b/src/vnet/devices/netmap/node.c
index 835209a3449..68ea7832614 100644
--- a/src/vnet/devices/netmap/node.c
+++ b/src/vnet/devices/netmap/node.c
@@ -218,7 +218,7 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* redirect if feature path enabled */
vnet_feature_start_device_input_x1 (nif->sw_if_index, &next0,
- first_b0, 0);
+ first_b0);
/* enque and take next packet */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
diff --git a/src/vnet/devices/virtio/vhost-user.c b/src/vnet/devices/virtio/vhost-user.c
index f490f0c1b41..c16e98227db 100644
--- a/src/vnet/devices/virtio/vhost-user.c
+++ b/src/vnet/devices/virtio/vhost-user.c
@@ -1747,7 +1747,7 @@ vhost_user_if_input (vlib_main_t * vm,
/* redirect if feature path enabled */
vnet_feature_start_device_input_x1 (vui->sw_if_index, &next0,
- b_head, 0);
+ b_head);
u32 bi = to_next[-1]; //Cannot use to_next[-1] in the macro
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h
index b27aaf17804..77b1499de40 100644
--- a/src/vnet/feature/feature.h
+++ b/src/vnet/feature/feature.h
@@ -18,6 +18,7 @@
#include <vnet/vnet.h>
#include <vnet/api_errno.h>
+#include <vnet/devices/devices.h>
/** feature registration object */
typedef struct _vnet_feature_arc_registration
@@ -227,7 +228,7 @@ vnet_feature_next (u32 sw_if_index, u32 * next0, vlib_buffer_t * b0)
static_always_inline void
vnet_feature_start_device_input_x1 (u32 sw_if_index, u32 * next0,
- vlib_buffer_t * b0, u16 buffer_advanced0)
+ vlib_buffer_t * b0)
{
vnet_feature_main_t *fm = &feature_main;
vnet_feature_config_main_t *cm;
@@ -242,9 +243,12 @@ vnet_feature_start_device_input_x1 (u32 sw_if_index, u32 * next0,
* Save next0 so that the last feature in the chain
* can skip ethernet-input if indicated...
*/
+ u16 adv;
+
vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
- vnet_buffer (b0)->device_input_feat.buffer_advance = buffer_advanced0;
- vlib_buffer_advance (b0, -buffer_advanced0);
+ adv = device_input_next_node_advance[*next0];
+ vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b0, -adv);
b0->feature_arc_index = feature_arc_index;
b0->current_config_index =
@@ -258,10 +262,7 @@ static_always_inline void
vnet_feature_start_device_input_x2 (u32 sw_if_index,
u32 * next0,
u32 * next1,
- vlib_buffer_t * b0,
- vlib_buffer_t * b1,
- u16 buffer_advanced0,
- u16 buffer_advanced1)
+ vlib_buffer_t * b0, vlib_buffer_t * b1)
{
vnet_feature_main_t *fm = &feature_main;
vnet_feature_config_main_t *cm;
@@ -276,12 +277,17 @@ vnet_feature_start_device_input_x2 (u32 sw_if_index,
* Save next0 so that the last feature in the chain
* can skip ethernet-input if indicated...
*/
+ u16 adv;
+
vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
+ adv = device_input_next_node_advance[*next0];
+ vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b0, -adv);
+
vnet_buffer (b1)->device_input_feat.saved_next_index = *next1;
- vnet_buffer (b0)->device_input_feat.buffer_advance = buffer_advanced0;
- vnet_buffer (b1)->device_input_feat.buffer_advance = buffer_advanced1;
- vlib_buffer_advance (b0, -buffer_advanced0);
- vlib_buffer_advance (b1, -buffer_advanced1);
+ adv = device_input_next_node_advance[*next1];
+ vnet_buffer (b1)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b1, -adv);
b0->feature_arc_index = feature_arc_index;
b1->feature_arc_index = feature_arc_index;
@@ -303,12 +309,7 @@ vnet_feature_start_device_input_x4 (u32 sw_if_index,
u32 * next3,
vlib_buffer_t * b0,
vlib_buffer_t * b1,
- vlib_buffer_t * b2,
- vlib_buffer_t * b3,
- u16 buffer_advanced0,
- u16 buffer_advanced1,
- u16 buffer_advanced2,
- u16 buffer_advanced3)
+ vlib_buffer_t * b2, vlib_buffer_t * b3)
{
vnet_feature_main_t *fm = &feature_main;
vnet_feature_config_main_t *cm;
@@ -323,20 +324,27 @@ vnet_feature_start_device_input_x4 (u32 sw_if_index,
* Save next0 so that the last feature in the chain
* can skip ethernet-input if indicated...
*/
+ u16 adv;
+
vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
+ adv = device_input_next_node_advance[*next0];
+ vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b0, -adv);
+
vnet_buffer (b1)->device_input_feat.saved_next_index = *next1;
- vnet_buffer (b2)->device_input_feat.saved_next_index = *next2;
- vnet_buffer (b3)->device_input_feat.saved_next_index = *next3;
+ adv = device_input_next_node_advance[*next1];
+ vnet_buffer (b1)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b1, -adv);
- vnet_buffer (b0)->device_input_feat.buffer_advance = buffer_advanced0;
- vnet_buffer (b1)->device_input_feat.buffer_advance = buffer_advanced1;
- vnet_buffer (b2)->device_input_feat.buffer_advance = buffer_advanced2;
- vnet_buffer (b3)->device_input_feat.buffer_advance = buffer_advanced3;
+ vnet_buffer (b2)->device_input_feat.saved_next_index = *next2;
+ adv = device_input_next_node_advance[*next2];
+ vnet_buffer (b2)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b2, -adv);
- vlib_buffer_advance (b0, -buffer_advanced0);
- vlib_buffer_advance (b1, -buffer_advanced1);
- vlib_buffer_advance (b2, -buffer_advanced2);
- vlib_buffer_advance (b3, -buffer_advanced3);
+ vnet_buffer (b3)->device_input_feat.saved_next_index = *next3;
+ adv = device_input_next_node_advance[*next3];
+ vnet_buffer (b3)->device_input_feat.buffer_advance = adv;
+ vlib_buffer_advance (b3, -adv);
b0->feature_arc_index = feature_arc_index;
b1->feature_arc_index = feature_arc_index;
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 25c930c6bfe..496f38851e9 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -355,8 +355,7 @@ static uword tapcli_rx_iface(vlib_main_t * vm,
to_next++;
n_left_to_next--;
- vnet_feature_start_device_input_x1 (ti->sw_if_index, &next_index,
- b_first, 0);
+ vnet_feature_start_device_input_x1 (ti->sw_if_index, &next_index, b_first);
vlib_validate_buffer_enqueue_x1 (vm, node, next,
to_next, n_left_to_next,
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 4a5dd676a68..2cfcc92ff8a 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -351,7 +351,7 @@ tuntap_rx (vlib_main_t * vm,
next_index = VNET_DEVICE_INPUT_NEXT_DROP;
}
- vnet_feature_start_device_input_x1 (tm->sw_if_index, &next_index, b, 0);
+ vnet_feature_start_device_input_x1 (tm->sw_if_index, &next_index, b);
vlib_set_next_frame_buffer (vm, node, next_index, bi);