get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/83680/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 83680,
    "url": "https://patches.dpdk.org/api/patches/83680/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201104125918.9751-3-orika@nvidia.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20201104125918.9751-3-orika@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201104125918.9751-3-orika@nvidia.com",
    "date": "2020-11-04T12:59:18",
    "name": "[v2,2/2] ethdev: introduce sft lib",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9ccd707609308948d7a139cfd3bf0f6a1bce0f06",
    "submitter": {
        "id": 1869,
        "url": "https://patches.dpdk.org/api/people/1869/?format=api",
        "name": "Ori Kam",
        "email": "orika@nvidia.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201104125918.9751-3-orika@nvidia.com/mbox/",
    "series": [
        {
            "id": 13661,
            "url": "https://patches.dpdk.org/api/series/13661/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13661",
            "date": "2020-11-04T12:59:17",
            "name": "introduce stateful flow table",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/13661/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/83680/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/83680/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D5A59A04B1;\n\tWed,  4 Nov 2020 14:00:25 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 403FBC92C;\n\tWed,  4 Nov 2020 13:59:53 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 3746CC92A\n for <dev@dpdk.org>; Wed,  4 Nov 2020 13:59:52 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n orika@nvidia.com) with SMTP; 4 Nov 2020 14:59:47 +0200",
            "from MTL-ORIKA.mtl.com ([172.27.14.169])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0A4CxeQp027881;\n Wed, 4 Nov 2020 14:59:46 +0200"
        ],
        "From": "Ori Kam <orika@nvidia.com>",
        "To": "andreyv@nvidia.com, mdr@ashroe.eu",
        "Cc": "alexr@nvidia.com, andrey.vesnovaty@gmail.com, arybchenko@solarflare.com,\n dev@dpdk.org, elibr@nvidia.com, ferruh.yigit@intel.com,\n orika@nvidia.com, ozsh@nvidia.com, roniba@nvidia.com,\n thomas@nvidia.net, viacheslavo@nvidia.com",
        "Date": "Wed,  4 Nov 2020 14:59:18 +0200",
        "Message-Id": "<20201104125918.9751-3-orika@nvidia.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20201104125918.9751-1-orika@nvidia.com>",
        "References": "<20200909203008.25563-1-andreyv@nvidia.com>\n <20201104125918.9751-1-orika@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 2/2] ethdev: introduce sft lib",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Defines RTE SFT (Stateful Flow Table) APIs for Stateful Flow Table library.\n\nCurrently, DPDK enables only stateless offloading, using the rte_flow.\nstateless means that each packet is handled without any knowledge of\nprivious or future packets.\n\nAs we look at the industry, there is much demand to save a context across\npackets that belong to a connection.\n\nExamples for such applications:\n- Next-generation firewalls\n- Intrusion detection/prevention systems (IDS/IPS): Suricata, snort\n- SW/Virtual Switching: OVS\nThe goals of the SFT library:\n- Accelerate flow recognition & its context retrieval for further\n  lookaside processing.\n- Enable context-aware flow handling offload.\n\nThe solution suggested is to create a lib that will enable saving states\nbetween different packets that belong to the same connection.\n\nThe solution will also enable better HW abstraction than the one we get\nfrom using the rte_flow. The reason for this is that saving states is\nnot atomic action like we have in rte_flow and also can't be done fully\nin HW (The first packets must be seen by the application).\nSaying the above this lib is based on interacting with the rte_flow but it\ndoesn't replace it or encapsulate it.\n\nKey design points.\n- The SFT should offload as much as possible to HW.\n- The SFT is designed to work alongside the rte_flow.\n- The SFT has its own ops that the PMD needs to implement.\n- The SFT works on 5 tuple + zone (a user-defined value)\n\nBasic usage flow:\n1. Application insert a flow that matches all eth traffic and have\n   sft action along with jump action. (in the future this jump can be\n   avoided and in doing so saving some jumps,\n   but for the most generic and complete solution we think\n   that allow the application full control of the packet process using\n   rte_flow is better.)\n2. Application insert a flow in the target group that matches the packet\n   state. Based on this state the application performs the needed\n   actions. This flow can also be merged with other matching criteria.\n   The application will also add a flow in the target group that will\n   upload to the application any packet with a miss state.\n3. First eth packet arrives and is routed to the SFT HW component.\n   since this is the first packet the SFT will have a miss and will\n   mark the packet with miss state and forward it to the target group.\n4. The application will pull the packet from the queue and will send it to\n   be processed by the sft lib.\n5. The SFT will extract HW packet state and if valid the zone or the\n   flow-id, and report it back to the application.\n6. Application will see that this is a new connection, so it will issue\n   SFT command to create a new connection with a selected state.\n   The SFT will create a HW flow, that matches the 5 tuple + zone and\n   sets the state of the packet. The state can be any u8 value, it is\n   the responsibility of the application to match on the value.\n7. On the next packet arriving to the HW it will jump to the SFT and\n   in the SFT HW there will be a match which will result in setting\n   the packet state and ID according to the application request.\n8. In case of later miss (at some other group) or application logic\n   that the packet should be routed back to the application.\n   The application will call the SFT lib with the new mbuf,\n   which will result in the flow-id returend to the application\n   along with the context attached to this connection.\n\nSigned-off-by: Andrey Vesnovaty <andreyv@nvidia.com>\nSigned-off-by: Ori Kam <orika@nvidia.com>\n---\n lib/librte_ethdev/meson.build            |   3 +\n lib/librte_ethdev/rte_ethdev_version.map |  19 +\n lib/librte_ethdev/rte_sft.c              |   9 +\n lib/librte_ethdev/rte_sft.h              | 878 +++++++++++++++++++++++\n lib/librte_ethdev/rte_sft_driver.h       | 201 ++++++\n 5 files changed, 1110 insertions(+)\n create mode 100644 lib/librte_ethdev/rte_sft.c\n create mode 100644 lib/librte_ethdev/rte_sft.h\n create mode 100644 lib/librte_ethdev/rte_sft_driver.h",
    "diff": "diff --git a/lib/librte_ethdev/meson.build b/lib/librte_ethdev/meson.build\nindex 8fc24e8c8a..064e3c9443 100644\n--- a/lib/librte_ethdev/meson.build\n+++ b/lib/librte_ethdev/meson.build\n@@ -9,6 +9,7 @@ sources = files('ethdev_private.c',\n \t'rte_ethdev.c',\n \t'rte_flow.c',\n \t'rte_mtr.c',\n+\t'rte_sft.c',\n \t'rte_tm.c')\n \n headers = files('rte_ethdev.h',\n@@ -24,6 +25,8 @@ headers = files('rte_ethdev.h',\n \t'rte_flow_driver.h',\n \t'rte_mtr.h',\n \t'rte_mtr_driver.h',\n+\t'rte_sft.h',\n+\t'rte_sft_driver.h',\n \t'rte_tm.h',\n \t'rte_tm_driver.h')\n \ndiff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map\nindex f8a0945812..e3c829b494 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -232,6 +232,25 @@ EXPERIMENTAL {\n \trte_eth_fec_get_capability;\n \trte_eth_fec_get;\n \trte_eth_fec_set;\n+\trte_sft_drain_mbuf;\n+\trte_sft_fini;\n+\trte_sft_flow_activate;\n+\trte_sft_flow_create;\n+\trte_sft_flow_destroy;\n+\trte_sft_flow_get_client_obj;\n+\trte_sft_flow_get_status;\n+\trte_sft_flow_query;\n+\trte_sft_flow_set_aging;\n+\trte_sft_flow_set_client_obj;\n+\trte_sft_flow_set_data;\n+\trte_sft_flow_set_offload;\n+\trte_sft_flow_set_state;\n+\trte_sft_flow_touch;\n+\trte_sft_init;\n+\trte_sft_process_mbuf;\n+\trte_sft_process_mbuf_with_zone;\n+\n+\n };\n \n INTERNAL {\ndiff --git a/lib/librte_ethdev/rte_sft.c b/lib/librte_ethdev/rte_sft.c\nnew file mode 100644\nindex 0000000000..f3d3945545\n--- /dev/null\n+++ b/lib/librte_ethdev/rte_sft.c\n@@ -0,0 +1,9 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+\n+\n+#include \"rte_sft.h\"\n+#include \"rte_sft_driver.h\"\n+\n+/* Placeholder for RTE SFT library APIs implementation */\ndiff --git a/lib/librte_ethdev/rte_sft.h b/lib/librte_ethdev/rte_sft.h\nnew file mode 100644\nindex 0000000000..edd8671cad\n--- /dev/null\n+++ b/lib/librte_ethdev/rte_sft.h\n@@ -0,0 +1,878 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+\n+#ifndef _RTE_SFT_H_\n+#define _RTE_SFT_H_\n+\n+/**\n+ * @file\n+ *\n+ * RTE SFT API\n+ *\n+ * Defines RTE SFT APIs for Statefull Flow Table library.\n+ *\n+ * The SFT lib is part of the ethdev class, the reason for this is that the main\n+ * idea is to leverage the HW offload that the ethdev allow using the rte_flow.\n+ *\n+ * SFT General description:\n+ * SFT library provides a framework for applications that need to maintain\n+ * context across different packets of the connection.\n+ * Examples for such applications:\n+ * - Next-generation firewalls\n+ * - Intrusion detection/prevention systems (IDS/IPS): Suricata, Snort\n+ * - SW/Virtual Switching: OVS\n+ * The goals of the SFT library:\n+ * - Accelerate flow recognition & its context retrieval for further look-aside\n+ *   processing.\n+ * - Enable context-aware flow handling offload.\n+ *\n+ * The SFT is designed to use HW offload to get the best performance.\n+ * This is done on two levels. The first one is marking the packet with flow id\n+ * to speed the lookup of the flow in the data structure.\n+ * The second is done be connecting the SFT results to the rte_flow for\n+ * continuing packet process.\n+ *\n+ * Definitions and Abbreviations:\n+ * - 5-tuple: defined by:\n+ *     -- Source IP address\n+ *     -- Source port\n+ *     -- Destination IP address\n+ *     -- Destination port\n+ *     -- IP protocol number\n+ * - 7-tuple: 5-tuple, zone and port (see struct rte_sft_7tuple)\n+ * - 5/7-tuple: 5/7-tuple of the packet from connection initiator\n+ * - revers 5/7-tuple: 5/7-tuple of the packet from connection initiate\n+ * - application: SFT library API consumer\n+ * - APP: see application\n+ * - CID: client ID\n+ * - CT: connection tracking\n+ * - FID: Flow identifier\n+ * - FIF: First In Flow\n+ * - Flow: defined by 7-tuple and its reverse i.e. flow is bidirectional\n+ * - SFT: Stateful Flow Table\n+ * - user: see application\n+ * - zone: additional user defined value used as differentiator for\n+ *         connections having same 5-tuple (for example different VXLAN\n+ *         connections with same inner 5-tuple).\n+ *\n+ * SFT components:\n+ *\n+ * +-----------------------------------+\n+ * | RTE flow                          |\n+ * |                                   |\n+ * | +-------------------------------+ |  +----------------+\n+ * | | group X                       | |  | RTE_SFT        |\n+ * | |                               | |  |                |\n+ * | | +---------------------------+ | |  |                |\n+ * | | | rule ...                  | | |  |                |\n+ * | | | .                         | | |  +-----------+----+\n+ * | | | .                         | | |              |\n+ * | | | .                         | | |          entry\n+ * | | +---------------------------+ | |            create\n+ * | | | rule                      | | |              |\n+ * | | |   patterns ...            +---------+        |\n+ * | | |   actions                 | | |     |        |\n+ * | | |     SFT (zone=Z)          | | |     |        |\n+ * | | |     JUMP (group=Y)        | | |  lookup      |\n+ * | | +---------------------------+ | |    zone=Z,   |\n+ * | | | rule ...                  | | |    5tuple    |\n+ * | | | .                         | | |     |        |\n+ * | | | .                         | | |  +--v-------------+\n+ * | | | .                         | | |  | SFT       |    |\n+ * | | |                           | | |  |           |    |\n+ * | | +---------------------------+ | |  |        +--v--+ |\n+ * | |                               | |  |        |     | |\n+ * | +-------------------------------+ |  |        | PMD | |\n+ * |                                   |  |        |     | |\n+ * |                                   |  |        +-----+ |\n+ * | +-------------------------------+ |  |                |\n+ * | | group Y                       | |  |                |\n+ * | |                               | |  | set state      |\n+ * | | +---------------------------+ | |  | set data       |\n+ * | | | rule                      | | |  +--------+-------+\n+ * | | |   patterns                | | |           |\n+ * | | |     SFT (state=UNDEFINED) | | |           |\n+ * | | |   actions RSS             | | |           |\n+ * | | +---------------------------+ | |           |\n+ * | | | rule                      | | |           |\n+ * | | |   patterns                | | |           |\n+ * | | |     SFT (state=INVALID)   | <-------------+\n+ * | | |   actions DROP            | | |  forward\n+ * | | +---------------------------+ | |    group=Y\n+ * | | | rule                      | | |\n+ * | | |   patterns                | | |\n+ * | | |     SFT (state=ACCEPTED)  | | |\n+ * | | |   actions PORT            | | |\n+ * | | +---------------------------+ | |\n+ * | |  ...                          | |\n+ * | |                               | |\n+ * | +-------------------------------+ |\n+ * |  ...                              |\n+ * |                                   |\n+ * +-----------------------------------+\n+ *\n+ * SFT as datastructure:\n+ * SFT can be treated as datastructure maintaining flow context across its\n+ * lifetime. SFT flow entry represents bidirectional network flow and defined by\n+ * 7-tuple & its reverse 7-tuple.\n+ * Each entry in SFT has:\n+ * - FID: 1:1 mapped & used as entry handle & encapsulating internal\n+ *   implementation of the entry.\n+ * - State: user-defined value attached to each entry, the only library\n+ *   reserved value for state unset (the actual value defined by SFT\n+ *   configuration). The application should define flow state encodings and\n+ *   set it for flow via rte_sft_flow_set_ctx() than what actions should be\n+ *   applied on packets can be defined via related RTE flow rule matching SFT\n+ *   state (see rules in SFT components diagram above).\n+ * - Timestamp: for the last seen in flow packet used for flow aging mechanism\n+ *   implementation.\n+ * - Client Objects: user-defined flow contexts attached as opaques to flow.\n+ * - Acceleration & offloading - utilize RTE flow capabilities, when supported\n+ *   (see action ``SFT``), for flow lookup acceleration and further\n+ *   context-aware flow handling offload.\n+ * - CT state: optionally for TCP connections CT state can be maintained\n+ *   (see enum rte_sft_flow_ct_state).\n+ * - Out of order TCP packets: optionally SFT can keep out of order TCP\n+ *   packets aside the flow context till the arrival of the missing in-order\n+ *   packet.\n+ *\n+ * RTE flow changes:\n+ * The SFT flow state (or context) for RTE flow is defined by fields of\n+ * struct rte_flow_item_sft.\n+ * To utilize SFT capabilities new item and action types introduced:\n+ * - item SFT: matching on SFT flow state (see RTE_FLOW_ITEM_TYPE_SFT).\n+ * - action SFT: retrieve SFT flow context and attache it to the processed\n+ *   packet (see RTE_FLOW_ACTION_TYPE_SFT).\n+ *\n+ * The contents of per port SFT serving RTE flow action ``SFT`` managed via\n+ * SFT PMD APIs (see struct rte_sft_ops).\n+ * The SFT flow state/context retrieval performed by user-defined zone ``SFT``\n+ * action argument and processed packet 5-tuple.\n+ * If in scope of action ``SFT`` there is no context/state for the flow in SFT\n+ * undefined sate attached to the packet meaning that the flow is not\n+ * recognized by SFT, most probably FIF packet.\n+ *\n+ * Once the SFT state set for a packet it can match on item SFT\n+ * (see RTE_FLOW_ITEM_TYPE_SFT) and forwarding design can be done for the\n+ * packet, for example:\n+ * - if state value == x than queue for further processing by the application\n+ * - if state value == y than forward it to eth port (full offload)\n+ * - if state value == 'undefined' than queue for further processing by\n+ *   the application (handle FIF packets)\n+ *\n+ * Processing packets with SFT library:\n+ *\n+ * FIF packet:\n+ * To recognize upcoming packets of the SFT flow every FIF packet should be\n+ * forwarded to the application utilizing the SFT library. Non-FIF packets can\n+ * be processed by the application or its processing can be fully offloaded.\n+ * Processing of the packets in SFT library starts with rte_sft_process_mbuf\n+ * or rte_sft_process_mbuf_with_zone. If mbuf recognized as FIF application\n+ * should make a design to destroy flow or complete flow creation process in\n+ * SFT using rte_sft_flow_activate.\n+ *\n+ * Recognized SFT flow:\n+ * Once struct rte_sft_flow_status with valid fid field possessed by application\n+ * it can:\n+ * - mange client objects on it (see client_obj field in\n+ *   struct rte_sft_flow_status) using rte_sft_flow_<OP>_client_obj APIs\n+ * - analyze user-defined flow state and CT state (see state & ct_sate fields\n+ *   in struct rte_sft_flow_status).\n+ * - set flow state to be attached to the upcoming packets by action ``SFT``\n+ *   via struct rte_sft_flow_status API.\n+ * - decide to destroy flow via rte_sft_flow_destroy API.\n+ *\n+ * Flow aging:\n+ *\n+ * SFT library manages the aging for each flow. On flow creation, it's\n+ * assigned an aging value, the maximal number of seconds passed since the\n+ * last flow packet arrived, once exceeded flow considered aged.\n+ * The application notified of aged flow asynchronously via event queues.\n+ * The device and port IDs tuple to identify the event queue to enqueue\n+ * flow aged events passed on flow creation as arguments\n+ * (see rte_sft_flow_activate). It's the application responsibility to\n+ * initialize event queues and assign them to each flow for EOF event\n+ * notifications.\n+ * Aged EOF event handling:\n+ * - Should be considered as application responsibility.\n+ * - The last stage should be the release of the flow resources via\n+ *    rte_sft_flow_destroy API.\n+ * - All client objects should be removed from flow before the\n+ *   rte_sft_flow_destroy API call.\n+ * See the description of ret_sft_flow_destroy for an example of aged flow\n+ * handling.\n+ *\n+ * SFT API thread safety:\n+ *\n+ * Since the SFT lib is designed to work as part of the Fast-Path, The SFT\n+ * is not thread safe, in order to enable better working with multiple threads\n+ * the SFT lib uses the queue approach, where each queue can only be accessesd\n+ * by one thread while one thread can access multiple queues.\n+ *\n+ * SFT Library initialization and cleanup:\n+ *\n+ * SFT library should be considered as a single instance, preconfigured and\n+ * initialized via rte_sft_init() API.\n+ * SFT library resource deallocation and cleanup should be done via\n+ * rte_sft_init() API as a stage of the application termination procedure.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_common.h>\n+#include <rte_config.h>\n+#include <rte_errno.h>\n+#include <rte_mbuf.h>\n+#include <rte_ethdev.h>\n+#include <rte_flow.h>\n+\n+/**\n+ * L3/L4 5-tuple - src/dest IP and port and IP protocol.\n+ *\n+ * Used for flow/connection identification.\n+ */\n+RTE_STD_C11\n+struct rte_sft_5tuple {\n+\tunion {\n+\t\tstruct {\n+\t\t\trte_be32_t src_addr; /**< IPv4 source address. */\n+\t\t\trte_be32_t dst_addr; /**< IPv4 destination address. */\n+\t\t} ipv4;\n+\t\tstruct {\n+\t\t\tuint8_t src_addr[16]; /**< IPv6 source address. */\n+\t\t\tuint8_t dst_addr[16]; /**< IPv6 destination address. */\n+\t\t} ipv6;\n+\t};\n+\trte_be16_t src_port; /**< Source port. */\n+\trte_be16_t dst_port; /**< Destination port. */\n+\tuint8_t proto; /**< IP protocol. */\n+\tuint8_t is_ipv6: 1; /**< True for valid IPv6 fields. Otherwise IPv4. */\n+};\n+\n+/**\n+ * Port flow identification.\n+ *\n+ * @p zone used for setups where 5-tuple is not enough to identify flow.\n+ * For example different VLANs/VXLANs may have similar 5-tuples.\n+ */\n+struct rte_sft_7tuple {\n+\tstruct rte_sft_5tuple flow_5tuple; /**< L3/L4 5-tuple. */\n+\tuint32_t zone; /**< Zone assigned to flow. */\n+\tuint16_t port_id; /** <Port identifier of Ethernet device. */\n+};\n+\n+/**\n+ * Structure describes SFT library configuration\n+ */\n+struct rte_sft_conf {\n+\tuint16_t nb_queues; /**< Preferred number of queues */\n+\tuint32_t udp_aging; /**< UDP proto default aging in sec */\n+\tuint32_t tcp_aging; /**< TCP proto default aging in sec */\n+\tuint32_t tcp_syn_aging; /**< TCP SYN default aging in sec. */\n+\tuint32_t default_aging; /**< All unlisted proto default aging in sec. */\n+\tuint32_t nb_max_entries; /**< Max entries in SFT. */\n+\tuint8_t app_data_len; /**< Number of uint32 of app data. */\n+\tuint32_t support_partial_match: 1;\n+\t/**< App can partial match on the data. */\n+\tuint32_t reorder_enable: 1;\n+\t/**< TCP packet reordering feature enabled bit. */\n+\tuint32_t tcp_ct_enable: 1;\n+\t/**< TCP connection tracking based on standard. */\n+\tuint32_t reserved: 30;\n+};\n+\n+/**\n+ *  Structure that holds the action configuration.\n+ */\n+struct rte_sft_actions_specs {\n+\tstruct rte_sft_5tuple *initiator_nat;\n+\t/**< The NAT configuration for the initiator flow. */\n+\tstruct rte_sft_5tuple *reverse_nat;\n+\t/**< The NAT configuration for the reverse flow. */\n+\tuint64_t aging; /**< the aging time out in sec. */\n+};\n+\n+#define RTE_SFT_ACTION_INITIATOR_NAT (1ul << 0)\n+/**< NAT action should be done on the initiator traffic. */\n+#define RTE_SFT_ACTION_REVERSE_NAT (1ul << 1)\n+/**< NAT action should be done on the reverse traffic. */\n+#define RTE_SFT_ACTION_COUNT (1ul << 2) /**< Enable count action. */\n+#define RTE_SFT_ACTION_AGE (1ul << 3) /**< Enable ageing action. */\n+\n+\n+/**\n+ * Structure that holds the count data.\n+ */\n+struct rte_sft_query_data {\n+\tuint64_t nb_bytes; /**< Number of bytes that passed in the flow. */\n+\tuint64_t nb_packets; /**< Number of packets that passed in the flow. */\n+\tuint32_t age; /**< Seconds passed since last seen packet. */\n+\tuint32_t aging;\n+\t/**< Flow considered aged once this age (seconds) reached. */\n+\tuint32_t nb_bytes_valid: 1; /**< Number of bytes is valid. */\n+\tuint32_t nb_packets_valid: 1; /* Number of packets is valid. */\n+\tuint32_t nb_age_valid: 1; /* Age is valid. */\n+\tuint32_t nb_aging_valid: 1; /* Aging is valid. */\n+\tuint32_t reserved: 28;\n+};\n+\n+/**\n+ * Structure describes the state of the flow in SFT.\n+ */\n+struct rte_sft_flow_status {\n+\tuint32_t fid; /**< SFT flow id. */\n+\tuint32_t zone; /**< Zone for lookup in SFT */\n+\tuint8_t state; /**< Application defined bidirectional flow state. */\n+\tuint8_t proto_state; /**< The state based on the protocol. */\n+\tuint16_t proto; /**< L4 protocol. */\n+\t/**< Connection tracking flow state, based on standard. */\n+\tuint32_t nb_in_order_mbufs;\n+\t/**< Number of in-order mbufs available for drain */\n+\tuint32_t activated: 1; /**< Flow was activated. */\n+\tuint32_t zone_valid: 1; /**< Zone field is valid. */\n+\tuint32_t proto_state_change: 1; /**< Protocol state was changed. */\n+\tuint32_t fragmented: 1; /**< Last flow mbuf was fragmented. */\n+\tuint32_t out_of_order: 1; /**< Last flow mbuf was out of order (TCP). */\n+\tuint32_t offloaded: 1;\n+\t/**< The connection is offload and no packet should be stored. */\n+\tuint32_t initiator: 1; /**< marks if the mbuf is from the initiator. */\n+\tuint32_t reserved: 25;\n+\tuint32_t data[];\n+\t/**< Application data. The length is defined by the configuration. */\n+};\n+\n+/**\n+ * Verbose error types.\n+ *\n+ * Most of them provide the type of the object referenced by struct\n+ * rte_flow_error.cause.\n+ */\n+enum rte_sft_error_type {\n+\tRTE_SFT_ERROR_TYPE_NONE, /**< No error. */\n+\tRTE_SFT_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */\n+\tRTE_SFT_ERROR_TYPE_FLOW_NOT_DEFINED, /**< The FID is not defined. */\n+};\n+\n+/**\n+ * Verbose error structure definition.\n+ *\n+ * This object is normally allocated by applications and set by SFT, the\n+ * message points to a constant string which does not need to be freed by\n+ * the application, however its pointer can be considered valid only as long\n+ * as its associated DPDK port remains configured. Closing the underlying\n+ * device or unloading the PMD invalidates it.\n+ *\n+ * Both cause and message may be NULL regardless of the error type.\n+ */\n+struct rte_sft_error {\n+\tenum rte_sft_error_type type; /**< Cause field and error types. */\n+\tconst void *cause; /**< Object responsible for the error. */\n+\tconst char *message; /**< Human-readable error message. */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Get SFT flow status, based on the fid.\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param[out] status\n+ *   Structure to dump actual SFT flow status.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_get_status(const uint16_t queue, const uint32_t fid,\n+\t\t\tstruct rte_sft_flow_status *status,\n+\t\t\tstruct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Set user defined data.\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param data\n+ *   User defined data. The len is defined at configuration time.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_set_data(uint16_t queue, uint32_t fid, const uint32_t *data,\n+\t\t      struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Set user defined state.\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param state\n+ *   User state.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_set_state(uint16_t queue, uint32_t fid, const uint8_t state,\n+\t\t       struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Set user defined state.\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param offload\n+ *   set if flow is offloaded.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_set_offload(uint16_t queue, uint32_t fid, bool offload,\n+\t\t\t struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Initialize SFT library instance.\n+ *\n+ * @param conf\n+ *   SFT library instance configuration.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_init(const struct rte_sft_conf *conf, struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Finalize SFT library instance.\n+ * Cleanup & release allocated resources.\n+ */\n+__rte_experimental\n+void\n+rte_sft_fini(void);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Process mbuf received on RX queue.\n+ *\n+ * This function checks the mbuf against the SFT database and return the\n+ * connection status that this mbuf belongs to.\n+ *\n+ * If status.activated = 1 and status.offloaded = 0 the input mbuf is\n+ * considered consumed and the application is not allowed to use it or free it,\n+ * instead the application should use the mbuf pointed by the mbuf_out.\n+ * Incase the mbuf is out of order or fragmented the mbuf_out will be NULL.\n+ *\n+ * If status.activated = 0 or status.offloaded = 1, the input mbuf is not\n+ * consumed and the mbuf_out will allways be NULL.\n+ *\n+ * This function doesn't create new entry in the SFT.\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param[in] mbuf_in\n+ *   mbuf to process; mbuf pointer considered 'consumed' and should not be used\n+ *   if status.activated and status.offload = 0.\n+ * @param[out] mbuf_out\n+ *   last processed not fragmented and in order mbuf.\n+ * @param[out] status\n+ *   Connection status based on the last in mbuf.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. Initialize in case of\n+ *   error only.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_process_mbuf(uint16_t queue, struct rte_mbuf *mbuf_in,\n+\t\t     struct rte_mbuf **mbuf_out,\n+\t\t     struct rte_sft_flow_status *status,\n+\t\t     struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Process mbuf received on RX queue while zone value provided by caller.\n+ *\n+ * The behaviour of this function is similar to rte_sft_process_mbuf except\n+ * the lookup in SFT procedure. The lookup in SFT always done by the *zone*\n+ * arg and 5-tuple 5-tuple, extracted form mbuf outer header contents.\n+ *\n+ * @see rte_sft_process_mbuf\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param[in] mbuf_in\n+ *   mbuf to process; mbuf pointer considered 'consumed' and should not be used\n+ *   after successful call to this function.\n+ * @param[out] mbuf_out\n+ *   last processed not fragmented and in order mbuf.\n+ * @param[out] status\n+ *   Connection status based on the last in mbuf.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. Initialize in case of\n+ *   error only.\n+ *\n+ * @return\n+ *   0 on success , a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_process_mbuf_with_zone(uint16_t queue, struct rte_mbuf *mbuf_in,\n+\t\t\t       uint32_t zone, struct rte_mbuf **mbuf_out,\n+\t\t\t       struct rte_sft_flow_status *status,\n+\t\t\t       struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Drain next in order mbuf.\n+ *\n+ * This function behaves similar to rte_sft_process_mbuf() but acts on packets\n+ * accumulated in SFT flow due to missing in order packet. Processing done on\n+ * single mbuf at a time and `in order`. Other than above the behavior is\n+ * same as of rte_sft_process_mbuf for flow defined & activated & mbuf isn't\n+ * fragmented & 'in order'. This function should be called when\n+ * rte_sft_process_mbuf or rte_sft_process_mbuf_with_zone sets\n+ * status->nb_in_order_mbufs output param !=0 and until\n+ * status->nb_in_order_mbufs == 0.\n+ * Flow should be locked by caller (see rte_sft_flow_lock).\n+ *\n+ * @param queue\n+ *   The sft queue number.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param[out] mbuf_out\n+ *   last processed not fragmented and in order mbuf.\n+ * @param nb_out\n+ *   Number of buffers to be drained.\n+ * @param initiator\n+ *   true packets that will be drained belongs to the initiator.\n+ * @param[out] status\n+ *   Connection status based on the last mbuf that was drained.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. Initialize in case of\n+ *   error only.\n+ *\n+ * @return\n+ *   The number of mbufs that were drained, negative value in case\n+ *   of error and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_drain_mbuf(uint16_t queue, uint32_t fid, struct rte_mbuf **mbuf_out,\n+\t\t   uint16_t nb_out, bool initiator,\n+\t\t   struct rte_sft_flow_status *status,\n+\t\t   struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Activate flow in SFT.\n+ *\n+ * This function creates an entry in the SFT for this connection.\n+ * The reasons for 2 phase flow creation procedure:\n+ * 1. Missing reverse flow - flow context is shared for both flow directions\n+ *    i.e. in order maintain bidirectional flow context in RTE SFT packets\n+ *    arriving from both directions should be identified as packets of the\n+ *    RTE SFT flow. Consequently, before the creation of the SFT flow caller\n+ *    should provide reverse flow direction 7-tuple.\n+ * 2. The caller of rte_sft_process_mbuf/rte_sft_process_mbuf_with_zone should\n+ *   be notified that arrived mbuf is first in flow & decide whether to\n+ *   create a new flow or disregard this packet.\n+ * This function completes the creation of the bidirectional SFT flow & creates\n+ * entry for 7-tuple on SFT PMD defined by the tuple port for both\n+ * initiator/initiate 7-tuples.\n+ * Flow aging, connection tracking state & out of order handling will be\n+ * initialized according to the content of the *mbuf_in* passes to\n+ * rte_sft_process_mbuf/_with_zone during phase 1 of flow creation.\n+ * Once this function returns upcoming calls rte_sft_process_mbuf/_with_zone\n+ * with 7-tuple or its reverse will return the handle to this flow.\n+ * Flow should be locked by the caller (see rte_sft_flow_lock).\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param[in] mbuf_in\n+ *   mbuf to process; mbuf pointer considered 'consumed' and should not be used\n+ *   after successful call to this function.\n+ * @param reverse_tuple\n+ *   Expected response flow 7-tuple.\n+ * @param state\n+ *   User defined state to set.\n+ * @param data\n+ *   User defined data, the len is configured during sft init.\n+ * @param proto_enable\n+ *   Enables maintenance of status->proto_state connection tracking value\n+ *   for the flow. otherwise status->proto_state will be initialized with zeros.\n+ * @param dev_id\n+ *   Event dev ID to enqueue end of flow event.\n+ * @param port_id\n+ *   Event port ID to enqueue end of flow event.\n+ * @param actions\n+ *   Flags that indicate which actions should be done on the packet before\n+ *   returning it to the rte_flow.\n+ * @param action_specs\n+ *   Hold the actions configuration.\n+ * @param[out] mbuf_out\n+ *   last processed not fragmented and in order mbuf.\n+ * @param[out] status\n+ *   Structure to dump SFT flow status once activated.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_activate(uint16_t queue, struct rte_mbuf *mbuf_in,\n+\t\t      const struct rte_sft_7tuple *reverse_tuple,\n+\t\t      uint8_t state, uint32_t *data, uint8_t proto_enable,\n+\t\t      uint8_t dev_id, uint8_t port_id, uint64_t actions,\n+\t\t      const struct rte_sft_actions_specs *action_specs,\n+\t\t      struct rte_mbuf **mbuf_out,\n+\t\t      struct rte_sft_flow_status *status,\n+\t\t      struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Artificially create SFT flow.\n+ *\n+ * Function to create SFT flow before reception of the first flow packet.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param tuple\n+ *   Expected initiator flow 7-tuple.\n+ * @param reverse_tuple\n+ *   Expected initiate flow 7-tuple.\n+ * @param state\n+ *   User defined state to set.\n+ * @param data\n+ *   User defined data, the len is configured during sft init.\n+ * @param proto_enable\n+ *   Enables maintenance of status->proto_state connection tracking value\n+ *   for the flow. otherwise status->proto_state will be initialized with zeros.\n+ * @param[out] status\n+ *   Connection status.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. PMDs initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   - on success: 0, locked SFT flow recognized by status->fid.\n+ *   - on error: a negative errno value otherwise and rte_errno is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_create(uint16_t queue, const struct rte_sft_7tuple *tuple,\n+\t\t    const struct rte_sft_7tuple *reverse_tuple,\n+\t\t    const struct rte_flow_item_sft *ctx,\n+\t\t    uint8_t ct_enable,\n+\t\t    struct rte_sft_flow_status *status,\n+\t\t    struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Removes flow from SFT.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID to destroy.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_destroy(uint16_t queue, uint32_t fid, struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Query counter and aging data.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param[out] data.\n+ *   SFT flow ID.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_query(uint16_t queue, uint32_t fid,\n+\t\t   struct rte_sft_query_data *data,\n+\t\t   struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Reset flow age to zero.\n+ *\n+ * Simulates last flow packet with timestamp set to just now.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_touch(uint16_t queue, uint32_t fid, struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Set flow aging to specific value.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param aging\n+ *   New flow aging value.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_set_aging(uint16_t queue, uint32_t fid, uint32_t aging,\n+\t\t       struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Set client object for given client ID.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param client_id\n+ *   Client ID to set object for.\n+ * @param client_obj\n+ *   Pointer to opaque client object structure.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_sft_error is set.\n+ */\n+__rte_experimental\n+int\n+rte_sft_flow_set_client_obj(uint16_t queue, uint32_t fid, uint8_t client_id,\n+\t\t\t    void *client_obj, struct rte_sft_error *error);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Get client object for given client ID.\n+ *\n+ * @param queue\n+ *   The SFT queue.\n+ * @param fid\n+ *   SFT flow ID.\n+ * @param client_id\n+ *   Client ID to get object for.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL. SFT initialize this\n+ *   structure in case of error only.\n+ *\n+ * @return\n+ *   A valid client object opaque pointer in case of success, NULL otherwise\n+ *   and rte_sft_error is set.\n+ */\n+__rte_experimental\n+void *\n+rte_sft_flow_get_client_obj(uint16_t queue, const uint32_t fid,\n+\t\t\t    uint8_t client_id, struct rte_sft_error *error);\n+\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_SFT_H_ */\ndiff --git a/lib/librte_ethdev/rte_sft_driver.h b/lib/librte_ethdev/rte_sft_driver.h\nnew file mode 100644\nindex 0000000000..4f1964dab6\n--- /dev/null\n+++ b/lib/librte_ethdev/rte_sft_driver.h\n@@ -0,0 +1,201 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+\n+#ifndef RTE_SFT_DRIVER_H_\n+#define RTE_SFT_DRIVER_H_\n+\n+/**\n+ * @file\n+ * RTE generic SFT API (driver side)\n+ *\n+ * This file provides implementation helpers for internal use by PMDs, they\n+ * are not intended to be exposed to applications and are not subject to ABI\n+ * versioning.\n+ */\n+\n+#include <stdint.h>\n+\n+#include \"rte_ethdev.h\"\n+#include \"rte_ethdev_driver.h\"\n+#include \"rte_sft.h\"\n+#include \"rte_flow.h\"\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+struct rte_sft_entry;\n+\n+#define RTE_SFT_STATE_FLAG_FID_VALID (1 << 0)\n+#define RTE_SFT_STATE_FLAG_ZONE_VALID (1 << 1)\n+#define RTE_SFT_STATE_FLAG_FLOW_MISS (1 << 2)\n+\n+#define RTE_SFT_MISS_TCP_FLAGS (1 << 0)\n+\n+RTE_STD_C11\n+struct rte_sft_decode_info {\n+\tunion {\n+\t\tuint32_t fid; /**< The fid value. */\n+\t\tuint32_t zone; /**< The zone value. */\n+\t};\n+\tuint32_t state;\n+\t/**< Flags that mark the packet state. see RTE_SFT_STATE_FLAG_*. */\n+};\n+\n+/**\n+ * @internal\n+ * Insert a flow to the SFT HW component.\n+ *\n+ * @param dev\n+ *   ethdev handle of port.\n+ * @param fid\n+ *   Flow ID.\n+ * @param queue\n+ *   The sft working queue.\n+ * @param pattern\n+ *   The matching pattern.\n+ * @param miss_conditions\n+ *   The conditions that forces a miss even if the 5 tuple was matched\n+ *   see RTE_SFT_MISS_*.\n+ * @param actions\n+ *   Set pf actions to apply in case the flow was hit. If no terminating action\n+ *   (queue, rss, drop, port) was given, the terminating action should be taken\n+ *   from the flow that resulted in the SFT.\n+ * @param miss_actions\n+ *   Set pf actions to apply in case the flow was hit. but the miss conditions\n+ *   were hit. (6 tuple match but tcp flags are on) If no terminating action\n+ *   (queue, rss, drop, port) was given, the terminating action should be taken\n+ *   from the flow that resulted in the SFT.\n+ * @param data\n+ *   The application data to attached to the flow.\n+ * @param data_len\n+ *   The length of the data in uint32_t increments.\n+ * @param state\n+ *   The application state to set.\n+ * @param error[out]\n+ *   Verbose of the error.\n+ *\n+ * @return\n+ *   Pointer to sft_entry in case of success, null otherwise and rte_sft_error\n+ *   is set.\n+ */\n+typedef struct rte_sft_entry *(*sft_entry_create_t)\n+\t\t(struct rte_eth_dev *dev, uint32_t fid, uint16_t queue,\n+\t\t const struct rte_flow_item *pattern, uint64_t miss_conditions,\n+\t\t const struct rte_flow_action *actions,\n+\t\t const struct rte_flow_action *miss_actions,\n+\t\t const uint32_t *data, uint16_t data_len, uint8_t state,\n+\t\t struct rte_sft_error *error);\n+\n+/**\n+ * @internal\n+ * Modify the state and the data of SFT flow in HW component.\n+ *\n+ * @param dev\n+ *   ethdev handle of port.\n+ * @param entry\n+ *   The entry to modify.\n+ * @param queue\n+ *   The sft working queue.\n+ * @param data\n+ *   The application data to attached to the flow.\n+ * @param data_len\n+ *   The length of the data in uint32_t increments.\n+ * @param state\n+ *   The application state to set.\n+ * @param error[out]\n+ *   Verbose of the error.\n+ *\n+ * @return\n+ *   Negative errno value on error, 0 on success.\n+ */\n+typedef int *(*sft_entry_modify_t)(struct rte_eth_dev *dev,\n+\t\t\t\t   struct rte_sft_entry *entry, uint16_t queue,\n+\t\t\t\t   const uint32_t *data, uint16_t data_len,\n+\t\t\t\t   uint8_t state, struct rte_sft_error *error);\n+\n+/**\n+ * @internal\n+ * Destroy SFT flow in HW component.\n+ *\n+ * @param dev\n+ *   ethdev handle of port.\n+ * @param entry\n+ *   The entry to modify.\n+ * @param queue\n+ *   The sft working queue.\n+ * @param error[out]\n+ *   Verbose of the error.\n+ *\n+ * @return\n+ *   Negative errno value on error, 0 on success.\n+ */\n+typedef int *(*sft_entry_destory_t)(struct rte_eth_dev *dev,\n+\t\t\t\t    struct rte_sft_entry *entry, uint16_t queue,\n+\t\t\t\t    struct rte_sft_error *error);\n+\n+/**\n+ * @internal\n+ * Decode sft state and FID from mbuf.\n+ *\n+ * @param dev\n+ *   ethdev handle of port.\n+ * @param entry\n+ *   The entry to modify.\n+ * @param queue\n+ *   The sft working queue.\n+ * @param mbuf\n+ *   The input mbuf.\n+ * @param info[out]\n+ *   The decoded sft data.\n+ * @param error[out]\n+ *   Verbose of the error.\n+ *\n+ * @return\n+ *   Negative errno value on error, 0 on success.\n+ */\n+typedef int *(*sft_entry_decode_t)(struct rte_eth_dev *dev,\n+\t\t\t\t   struct rte_sft_entry *entry, uint16_t queue,\n+\t\t\t\t   struct rte_mbuf *mbuf,\n+\t\t\t\t   struct rte_sft_decode_info *info,\n+\t\t\t\t   struct rte_sft_error *error);\n+\n+/**\n+ * Generic sft operations structure implemented and returned by PMDs.\n+ *\n+ * If successful, this operation must result in a pointer to a PMD-specific.\n+ *\n+ * See also rte_sft_ops_get().\n+ *\n+ * These callback functions are not supposed to be used by applications\n+ * directly, which must rely on the API defined in rte_sft.h.\n+ */\n+struct rte_sft_ops {\n+\tsft_entry_create_t sft_create_entry;\n+\tsft_entry_modify_t sft_entry_modify;\n+\tsft_entry_destory_t sft_entry_destory;\n+\tsft_entry_decode_t sft_entry_decode;\n+};\n+\n+/**\n+ * Get generic sft operations structure from a port.\n+ *\n+ * @param port_id\n+ *   Port identifier to query.\n+ * @param[out] error\n+ *   Pointer to flow error structure.\n+ *\n+ * @return\n+ *   The flow operations structure associated with port_id, NULL in case of\n+ *   error, in which case rte_errno is set and the error structure contains\n+ *   additional details.\n+ */\n+const struct rte_sft_ops *\n+rte_sft_ops_get(uint16_t port_id, struct rte_sft_error *error);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* RTE_SFT_DRIVER_H_ */\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}