app/testpmd: parse flow command line for ESP
authorBernard Iremonger <bernard.iremonger@intel.com>
Thu, 16 Jan 2020 12:44:48 +0000 (12:44 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:59:18 +0000 (19:59 +0100)
add ITEM_ESP
add ITEM_ESP_SPI
update release notes for testpmd changes
add sample ESP rules in testpmd guide

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
app/test-pmd/cmdline_flow.c
doc/guides/rel_notes/release_20_02.rst
doc/guides/testpmd_app_ug/testpmd_funcs.rst

index 33ba1d7..f7e0a62 100644 (file)
@@ -215,6 +215,8 @@ enum index {
        ITEM_TAG_INDEX,
        ITEM_L2TPV3OIP,
        ITEM_L2TPV3OIP_SESSION_ID,
+       ITEM_ESP,
+       ITEM_ESP_SPI,
 
        /* Validate/create actions. */
        ACTIONS,
@@ -753,6 +755,7 @@ static const enum index next_item[] = {
        ITEM_HIGIG2,
        ITEM_TAG,
        ITEM_L2TPV3OIP,
+       ITEM_ESP,
        END_SET,
        ZERO,
 };
@@ -1024,6 +1027,12 @@ static const enum index item_higig2[] = {
        ZERO,
 };
 
+static const enum index item_esp[] = {
+       ITEM_ESP_SPI,
+       ITEM_NEXT,
+       ZERO,
+};
+
 static const enum index next_set_raw[] = {
        SET_RAW_INDEX,
        ITEM_ETH,
@@ -2635,7 +2644,20 @@ static const struct token token_list[] = {
                .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv3oip,
                                             session_id)),
        },
-
+       [ITEM_ESP] = {
+               .name = "esp",
+               .help = "match ESP header",
+               .priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+               .next = NEXT(item_esp),
+               .call = parse_vc,
+       },
+       [ITEM_ESP_SPI] = {
+               .name = "spi",
+               .help = "security policy index",
+               .next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+                               hdr.spi)),
+       },
        /* Validate/create actions. */
        [ACTIONS] = {
                .name = "actions",
@@ -6305,9 +6327,6 @@ flow_item_default_mask(const struct rte_flow_item *item)
        case RTE_FLOW_ITEM_TYPE_GTP:
                mask = &rte_flow_item_gtp_mask;
                break;
-       case RTE_FLOW_ITEM_TYPE_ESP:
-               mask = &rte_flow_item_esp_mask;
-               break;
        case RTE_FLOW_ITEM_TYPE_GTP_PSC:
                mask = &rte_flow_item_gtp_psc_mask;
                break;
@@ -6320,6 +6339,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
        case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
                mask = &rte_flow_item_l2tpv3oip_mask;
                break;
+       case RTE_FLOW_ITEM_TYPE_ESP:
+               mask = &rte_flow_item_esp_mask;
+               break;
        default:
                break;
        }
@@ -6413,6 +6435,10 @@ cmd_set_raw_parsed(const struct buffer *in)
                        size = sizeof(struct rte_flow_item_l2tpv3oip);
                        proto = 0x73;
                        break;
+               case RTE_FLOW_ITEM_TYPE_ESP:
+                       size = sizeof(struct rte_flow_item_esp);
+                       proto = 0x32;
+                       break;
                default:
                        printf("Error - Not supported item\n");
                        *total_size = 0;
index f26f278..17b8cdc 100644 (file)
@@ -83,9 +83,9 @@ New Features
 
   * Added support for RSS using L3/L4 source/destination only.
 
-* **Updated testpmd to support L2TPv3 over IP flows.**
+* **Updated testpmd application.**
 
-  Added support for L2TPv3 over IP rte_flow patterns to the testpmd
+  Added support for ESP and L2TPv3 over IP rte_flow patterns to the testpmd
   application.
 
 * **Added algorithms to cryptodev API.**
index 4e56e07..7f4564c 100644 (file)
@@ -4778,6 +4778,20 @@ Decapsulating VxLAN::
  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
         end actions raw_decap / queue index 0 / end
 
+Sample ESP rules
+~~~~~~~~~~~~~~~~
+
+ESP rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
+        actions queue index 3 / end
+
 BPF Functions
 --------------