ethdev: add L2TPv3 over IP header to flow API
authorRory Sexton <rory.sexton@intel.com>
Mon, 13 Jan 2020 11:50:40 +0000 (11:50 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:26 +0000 (19:46 +0100)
This patch adds the new flow item RTE_FLOW_ITEM_TYPE_L2TPV3OIP to
flow API to match a L2TPv3 over IP header. This patch supports only
L2TPv3 over IP header format which is different to L2TPv2/L2TPv3
over UDP. The difference in header formats between L2TPv3 over IP
and L2TP over UDP require a separate implementation for each.

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Signed-off-by: Dariusz Jagus <dariuszx.jagus@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
app/test-pmd/cmdline_flow.c
doc/guides/prog_guide/rte_flow.rst
doc/guides/rel_notes/release_20_02.rst
doc/guides/testpmd_app_ug/testpmd_funcs.rst
lib/librte_ethdev/rte_flow.c
lib/librte_ethdev/rte_flow.h

index 1240de4..33ba1d7 100644 (file)
@@ -213,6 +213,8 @@ enum index {
        ITEM_TAG,
        ITEM_TAG_DATA,
        ITEM_TAG_INDEX,
+       ITEM_L2TPV3OIP,
+       ITEM_L2TPV3OIP_SESSION_ID,
 
        /* Validate/create actions. */
        ACTIONS,
@@ -750,6 +752,7 @@ static const enum index next_item[] = {
        ITEM_PPPOE_PROTO_ID,
        ITEM_HIGIG2,
        ITEM_TAG,
+       ITEM_L2TPV3OIP,
        END_SET,
        ZERO,
 };
@@ -1034,6 +1037,12 @@ static const enum index item_tag[] = {
        ZERO,
 };
 
+static const enum index item_l2tpv3oip[] = {
+       ITEM_L2TPV3OIP_SESSION_ID,
+       ITEM_NEXT,
+       ZERO,
+};
+
 static const enum index next_action[] = {
        ACTION_END,
        ACTION_VOID,
@@ -2611,6 +2620,22 @@ static const struct token token_list[] = {
                             NEXT_ENTRY(ITEM_PARAM_IS)),
                .args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
        },
+       [ITEM_L2TPV3OIP] = {
+               .name = "l2tpv3oip",
+               .help = "match L2TPv3 over IP header",
+               .priv = PRIV_ITEM(L2TPV3OIP,
+                                 sizeof(struct rte_flow_item_l2tpv3oip)),
+               .next = NEXT(item_l2tpv3oip),
+               .call = parse_vc,
+       },
+       [ITEM_L2TPV3OIP_SESSION_ID] = {
+               .name = "session_id",
+               .help = "session identifier",
+               .next = NEXT(item_l2tpv3oip, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv3oip,
+                                            session_id)),
+       },
+
        /* Validate/create actions. */
        [ACTIONS] = {
                .name = "actions",
@@ -6291,6 +6316,10 @@ flow_item_default_mask(const struct rte_flow_item *item)
                break;
        case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
                mask = &rte_flow_item_pppoe_proto_id_mask;
+               break;
+       case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
+               mask = &rte_flow_item_l2tpv3oip_mask;
+               break;
        default:
                break;
        }
@@ -6380,6 +6409,10 @@ cmd_set_raw_parsed(const struct buffer *in)
                case RTE_FLOW_ITEM_TYPE_GENEVE:
                        size = sizeof(struct rte_flow_item_geneve);
                        break;
+               case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
+                       size = sizeof(struct rte_flow_item_l2tpv3oip);
+                       proto = 0x73;
+                       break;
                default:
                        printf("Error - Not supported item\n");
                        *total_size = 0;
index 2f21309..371819e 100644 (file)
@@ -1336,6 +1336,13 @@ Broadcom switches.
 
 - Default ``mask`` matches classification and vlan.
 
+Item: ``L2TPV3OIP``
+^^^^^^^^^^^^^^^^^^^
+
+Matches a L2TPv3 over IP header.
+
+- ``session_id``: L2TPv3 over IP session identifier.
+- Default ``mask`` matches session_id only.
 
 Actions
 ~~~~~~~
index 4c27f45..3d483c6 100644 (file)
@@ -61,6 +61,10 @@ New Features
   A new API has been added to wait for a memory location to be updated with a
   16-bit, 32-bit, 64-bit value.
 
+* **Updated rte_flow api to support L2TPv3 over IP flows.**
+
+  Added support for new flow item to handle L2TPv3 over IP rte_flow patterns.
+
 * **Updated Hisilicon hns3 driver.**
 
   Updated Hisilicon hns3 driver with new features and improvements, including:
@@ -73,6 +77,11 @@ New Features
 
   * Added support for RSS using L3/L4 source/destination only.
 
+* **Updated testpmd to support L2TPv3 over IP flows.**
+
+  Added support for L2TPv3 over IP rte_flow patterns to the testpmd
+  application.
+
 * **Added algorithms to cryptodev API.**
 
   * Chacha20-Poly1305 AEAD algorithm can now be supported in cryptodev.
index 3baaacb..4e56e07 100644 (file)
@@ -3969,6 +3969,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``proto_id {unsigned}``: PPP protocol identifier.
 
+- ``l2tpv3oip``: match L2TPv3 over IP header.
+
+  - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
index b86aee3..26b4f75 100644 (file)
@@ -93,6 +93,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
        MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
        MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
        MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
+       MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
 };
 
 /** Generate flow_action[] entry. */
index 16d849e..706dcfb 100644 (file)
@@ -510,6 +510,16 @@ enum rte_flow_item_type {
         * See struct rte_flow_item_tag.
         */
        RTE_FLOW_ITEM_TYPE_TAG,
+
+       /**
+        * Matches a L2TPv3 over IP header.
+        *
+        * Configure flow for L2TPv3 over IP packets.
+        *
+        * See struct rte_flow_item_l2tpv3oip.
+        */
+       RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
+
 };
 
 /**
@@ -1373,6 +1383,23 @@ static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
+ *
+ * Matches a L2TPv3 over IP header.
+ */
+struct rte_flow_item_l2tpv3oip {
+       rte_be32_t session_id; /**< Session ID. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
+       .session_id = RTE_BE32(UINT32_MAX),
+};
+#endif
+
+
 /**
  * @warning
  * @b EXPERIMENTAL: this structure may change without prior notice