aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gtpu/gtpu_test.c
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2020-02-17 02:19:15 +0800
committerDamjan Marion <dmarion@me.com>2020-02-17 12:32:59 +0000
commit00fdf53c7076d1bd0045439e73f0144d613eb09c (patch)
tree1d2214e4d401d4b74dd9295ad9040447f29bcc41 /src/plugins/gtpu/gtpu_test.c
parent4dc5a43f4871c3f0a88ad0bb9041332bf3b03f1b (diff)
gtpu: offload RX flow
ip4 gtpu cli/api (using flow infra) to create flows and enable them on different hardware (currently tested with ice) to offload a gtpu tunnel onto hw: set flow-offload gtpu hw TwentyFiveGigabitEthernet3/0/0 rx gtpu_tunnel0 to remove offload: set flow-offload gtpu hw TwentyFiveGigabitEthernet3/0/0 rx gtpu_tunnel0 del TODO:ipv6 handling Type: feature Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: I8e356feeb0b16cfeadc1bbbe92f773aa2916e715
Diffstat (limited to 'src/plugins/gtpu/gtpu_test.c')
-rw-r--r--src/plugins/gtpu/gtpu_test.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/plugins/gtpu/gtpu_test.c b/src/plugins/gtpu/gtpu_test.c
index 55c5363becc..c780bd77d85 100644
--- a/src/plugins/gtpu/gtpu_test.c
+++ b/src/plugins/gtpu/gtpu_test.c
@@ -107,6 +107,12 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
return 1;
}
+static uword
+api_unformat_hw_if_index (unformat_input_t * input, va_list * args)
+{
+ return 0;
+}
+
static int
api_sw_interface_set_gtpu_bypass (vat_main_t * vam)
{
@@ -174,6 +180,58 @@ static uword unformat_gtpu_decap_next
}
static int
+api_gtpu_offload_rx (vat_main_t * vam)
+{
+ unformat_input_t *line_input = vam->input;
+ vl_api_gtpu_offload_rx_t *mp;
+ u32 rx_sw_if_index = ~0;
+ u32 hw_if_index = ~0;
+ int is_add = 1;
+ int ret;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "hw %U", api_unformat_hw_if_index, vam, &hw_if_index))
+ ;
+ else
+ if (unformat (line_input, "rx %U", api_unformat_sw_if_index, vam, &rx_sw_if_index))
+ ;
+ else
+ if (unformat (line_input, "del"))
+ {
+ is_add = 0;
+ continue;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, line_input);
+ return -99;
+ }
+ }
+
+ if (rx_sw_if_index == ~0)
+ {
+ errmsg ("missing rx interface");
+ return -99;
+ }
+
+ if (hw_if_index == ~0)
+ {
+ errmsg ("missing hw interface");
+ return -99;
+ }
+
+ M (GTPU_OFFLOAD_RX, mp);
+ mp->hw_if_index = ntohl (hw_if_index);
+ mp->sw_if_index = ntohl (rx_sw_if_index);
+ mp->enable = is_add;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
api_gtpu_add_del_tunnel (vat_main_t * vam)
{
unformat_input_t *line_input = vam->input;