]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: add generic TTL rewrite actions
authorXiaoyu Min <jackmin@mellanox.com>
Tue, 16 Oct 2018 08:14:23 +0000 (08:14 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 18 Oct 2018 08:24:39 +0000 (10:24 +0200)
rewrite TTL by decrease or just set it directly
it's not necessary to check if the final result
is zero or not

This is slightly different from the one defined
by openflow and more generic

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
doc/guides/prog_guide/rte_flow.rst
lib/librte_ethdev/rte_flow.c
lib/librte_ethdev/rte_flow.h

index a5ec441c9bc528cf5f0d8cea9321fea29ffc9919..e766329071fd568d963f5c6c9444099dc08dbcf3 100644 (file)
@@ -2203,6 +2203,42 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
    | no properties |
    +---------------+
 
+Action: ``DEC_TTL``
+^^^^^^^^^^^^^^^^^^^
+
+Decrease TTL value.
+
+If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
+in pattern, Some PMDs will reject rule because behaviour will be undefined.
+
+.. _table_rte_flow_action_dec_ttl:
+
+.. table:: DEC_TTL
+
+   +---------------+
+   | Field         |
+   +===============+
+   | no properties |
+   +---------------+
+
+Action: ``SET_TTL``
+^^^^^^^^^^^^^^^^^^^
+
+Assigns a new TTL value.
+
+If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
+in pattern, Some PMDs will reject rule because behaviour will be undefined.
+
+.. _table_rte_flow_action_set_ttl:
+
+.. table:: SET_TTL
+
+   +---------------+--------------------+
+   | Field         | Value              |
+   +===============+====================+
+   | ``ttl_value`` | new TTL value      |
+   +---------------+--------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
index bc9e719dc50077d1e217fc2c7975ee40654dd941..5040c7667b18926530f26e1bd32fc1f6385e1de0 100644 (file)
@@ -136,6 +136,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
        MK_FLOW_ACTION(SET_TP_DST,
                       sizeof(struct rte_flow_action_set_tp)),
        MK_FLOW_ACTION(MAC_SWAP, 0),
+       MK_FLOW_ACTION(DEC_TTL, 0),
+       MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)),
 };
 
 static int
index 68bbf57d0585cb411c5f420ec1a713d61c74a775..79bcb292d9f5a4f436ac8811597cc868bff963b5 100644 (file)
@@ -1579,6 +1579,20 @@ enum rte_flow_action_type {
         * No associated configuration structure.
         */
        RTE_FLOW_ACTION_TYPE_MAC_SWAP,
+
+       /**
+        * Decrease TTL value directly
+        *
+        * No associated configuration structure.
+        */
+       RTE_FLOW_ACTION_TYPE_DEC_TTL,
+
+       /**
+        * Set TTL value
+        *
+        * See struct rte_flow_action_set_ttl
+        */
+       RTE_FLOW_ACTION_TYPE_SET_TTL,
 };
 
 /**
@@ -1987,6 +2001,15 @@ struct rte_flow_action_set_tp {
        rte_be16_t port;
 };
 
+/**
+ * RTE_FLOW_ACTION_TYPE_SET_TTL
+ *
+ * Set the TTL value directly for IPv4 or IPv6
+ */
+struct rte_flow_action_set_ttl {
+       uint8_t ttl_value;
+};
+
 /*
  * Definition of a single action.
  *