get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 91677,
    "url": "http://patches.dpdk.org/api/patches/91677/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1618595649-157464-2-git-send-email-bingz@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1618595649-157464-2-git-send-email-bingz@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1618595649-157464-2-git-send-email-bingz@nvidia.com",
    "date": "2021-04-16T17:54:07",
    "name": "[v3,1/3] ethdev: introduce conntrack flow action and item",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "86299ca5c2066f0211686ec4c88f92bb0ef6f636",
    "submitter": {
        "id": 1976,
        "url": "http://patches.dpdk.org/api/people/1976/?format=api",
        "name": "Bing Zhao",
        "email": "bingz@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1618595649-157464-2-git-send-email-bingz@nvidia.com/mbox/",
    "series": [
        {
            "id": 16453,
            "url": "http://patches.dpdk.org/api/series/16453/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16453",
            "date": "2021-04-16T17:54:06",
            "name": "ethdev: introduce conntrack flow action and item",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/16453/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/91677/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/91677/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 0A08FA0548;\n\tFri, 16 Apr 2021 19:54:24 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E3BB0160718;\n\tFri, 16 Apr 2021 19:54:20 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id E864E161C2C\n for <dev@dpdk.org>; Fri, 16 Apr 2021 19:54:19 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n bingz@nvidia.com) with SMTP; 16 Apr 2021 20:54:15 +0300",
            "from nvidia.com (mtbc-r640-01.mtbc.labs.mlnx [10.75.70.6])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 13GHsAVO025093;\n Fri, 16 Apr 2021 20:54:13 +0300"
        ],
        "From": "Bing Zhao <bingz@nvidia.com>",
        "To": "orika@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com,\n andrew.rybchenko@oktetlabs.ru",
        "Cc": "dev@dpdk.org, ajit.khaparde@broadcom.com, xiaoyun.li@intel.com",
        "Date": "Sat, 17 Apr 2021 01:54:07 +0800",
        "Message-Id": "<1618595649-157464-2-git-send-email-bingz@nvidia.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1618595649-157464-1-git-send-email-bingz@nvidia.com>",
        "References": "<1618062393-205611-1-git-send-email-bingz@nvidia.com>\n <1618595649-157464-1-git-send-email-bingz@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/3] ethdev: introduce conntrack flow action\n and item",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "This commit introduces the conntrack action and item.\n\nUsually the HW offloading is stateless. For some stateful offloading\nlike a TCP connection, HW module will help provide the ability of a\nfull offloading w/o SW participation after the connection was\nestablished.\n\nThe basic usage is that in the first flow rule the application should\nadd the conntrack action and jump to the next flow table. In the\nfollowing flow rule(s) of the next table, the application should use\nthe conntrack item to match on the result.\n\nA TCP connection has two directions traffic. To set a conntrack\naction context correctly, the information of packets from both\ndirections are required.\n\nThe conntrack action should be created on one ethdev port and supply\nthe peer ethdev port as a parameter to the action. After context\ncreated, it could only be used between these two ethdev ports\n(dual-port mode) or a single port. The application should modify the\naction via the API \"rte_action_handle_update\" only when before using\nit to create a flow rule with conntrack conntrack for the opposite\ndirection. This will help the driver to recognize the direction of\nthe flow to be created, especially in the single-port mode, in which\ncase the traffic from both directions will go through the same\nethdev port if the application works as an \"forwarding engine\" but\nnot an end point. There is no need to call the update interface if\nthe subsequent flow rules have nothing to be changed.\n\nQuery will be supported via \"rte_action_handle_query\" interface,\nabout the current packets information and connection status. The\nfields query capabilities depends on the HW.\n\nFor the packets received during the conntrack setup, it is suggested\nto re-inject the packets in order to make sure the conntrack module\nworks correctly without missing any packet. Only the valid packets\nshould pass the conntrack, packets with invalid TCP information,\nlike out of window, or with invalid header, like malformed, should\nnot pass.\n\nNaming and definition:\nhttps://elixir.bootlin.com/linux/latest/source/include/uapi/linux/netfilter/nf_conntrack_tcp.h\nhttps://elixir.bootlin.com/linux/latest/source/net/netfilter/nf_conntrack_proto_tcp.c\n\nOther reference:\nhttps://www.usenix.org/legacy/events/sec01/invitedtalks/rooij.pdf\n\nSigned-off-by: Bing Zhao <bingz@nvidia.com>\n---\n lib/librte_ethdev/rte_flow.c |   2 +\n lib/librte_ethdev/rte_flow.h | 207 +++++++++++++++++++++++++++++++++++\n 2 files changed, 209 insertions(+)",
    "diff": "diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c\nindex 0d2610b7c4..c7c7108933 100644\n--- a/lib/librte_ethdev/rte_flow.c\n+++ b/lib/librte_ethdev/rte_flow.c\n@@ -98,6 +98,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {\n \tMK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),\n \tMK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),\n \tMK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)),\n+\tMK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)),\n };\n \n /** Generate flow_action[] entry. */\n@@ -186,6 +187,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {\n \t * indirect action handle.\n \t */\n \tMK_FLOW_ACTION(INDIRECT, 0),\n+\tMK_FLOW_ACTION(CONNTRACK, sizeof(struct rte_flow_action_conntrack)),\n };\n \n int\ndiff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h\nindex 324d00abdc..c9d7bdfa57 100644\n--- a/lib/librte_ethdev/rte_flow.h\n+++ b/lib/librte_ethdev/rte_flow.h\n@@ -551,6 +551,15 @@ enum rte_flow_item_type {\n \t * See struct rte_flow_item_geneve_opt\n \t */\n \tRTE_FLOW_ITEM_TYPE_GENEVE_OPT,\n+\n+\t/**\n+\t * [META]\n+\t *\n+\t * Matches conntrack state.\n+\t *\n+\t * @see struct rte_flow_item_conntrack.\n+\t */\n+\tRTE_FLOW_ITEM_TYPE_CONNTRACK,\n };\n \n /**\n@@ -1685,6 +1694,51 @@ rte_flow_item_geneve_opt_mask = {\n };\n #endif\n \n+/**\n+ * The packet is valid after conntrack checking.\n+ */\n+#define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)\n+/**\n+ * The state of the connection is changed.\n+ */\n+#define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)\n+/**\n+ * Error is detected on this packet for this connection and\n+ * an invalid state is set.\n+ */\n+#define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)\n+/**\n+ * The HW connection tracking module is disabled.\n+ * It can be due to application command or an invalid state.\n+ */\n+#define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)\n+/**\n+ * The packet contains some bad field(s) and cannot continue\n+ * with the conntrack module checking.\n+ */\n+#define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this structure may change without prior notice\n+ *\n+ * RTE_FLOW_ITEM_TYPE_CONNTRACK\n+ *\n+ * Matches the state of a packet after it passed the connection tracking\n+ * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*\n+ * or a reasonable combination of these bits.\n+ */\n+struct rte_flow_item_conntrack {\n+\tuint32_t flags;\n+};\n+\n+/** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */\n+#ifndef __cplusplus\n+static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {\n+\t.flags = 0xffffffff,\n+};\n+#endif\n+\n /**\n  * Matching pattern item definition.\n  *\n@@ -2277,6 +2331,15 @@ enum rte_flow_action_type {\n \t * same port or across different ports.\n \t */\n \tRTE_FLOW_ACTION_TYPE_INDIRECT,\n+\n+\t/**\n+\t * [META]\n+\t *\n+\t * Enable tracking a TCP connection state.\n+\t *\n+\t * @see struct rte_flow_action_conntrack.\n+\t */\n+\tRTE_FLOW_ACTION_TYPE_CONNTRACK,\n };\n \n /**\n@@ -2875,6 +2938,150 @@ struct rte_flow_action_set_dscp {\n  */\n struct rte_flow_action_handle;\n \n+/**\n+ * The state of a TCP connection.\n+ */\n+enum rte_flow_conntrack_state {\n+\t/**< SYN-ACK packet was seen. */\n+\tRTE_FLOW_CONNTRACK_STATE_SYN_RECV,\n+\t/**< 3-way handshake was done. */\n+\tRTE_FLOW_CONNTRACK_STATE_ESTABLISHED,\n+\t/**< First FIN packet was received to close the connection. */\n+\tRTE_FLOW_CONNTRACK_STATE_FIN_WAIT,\n+\t/**< First FIN was ACKed. */\n+\tRTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,\n+\t/**< Second FIN was received, waiting for the last ACK. */\n+\tRTE_FLOW_CONNTRACK_STATE_LAST_ACK,\n+\t/**< Second FIN was ACKed, connection was closed. */\n+\tRTE_FLOW_CONNTRACK_STATE_TIME_WAIT,\n+};\n+\n+/**\n+ * The last passed TCP packet flags of a connection.\n+ */\n+enum rte_flow_conntrack_tcp_last_index {\n+\tRTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */\n+\tRTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */\n+\tRTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */\n+\tRTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */\n+\tRTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */\n+\tRTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this structure may change without prior notice\n+ *\n+ * Configuration parameters for each direction of a TCP connection.\n+ */\n+struct rte_flow_tcp_dir_param {\n+\t/** TCP window scaling factor, 0xF to disable. */\n+\tuint32_t scale:4;\n+\t/** The FIN was sent by this direction. */\n+\tuint32_t close_initiated:1;\n+\t/** An ACK packet has been received by this side. */\n+\tuint32_t last_ack_seen:1;\n+\t/**\n+\t * If set, it indicates that there is unacknowledged data for the\n+\t * packets sent from this direction.\n+\t */\n+\tuint32_t data_unacked:1;\n+\t/**\n+\t * Maximal value of sequence + payload length in sent\n+\t * packets (next ACK from the opposite direction).\n+\t */\n+\tuint32_t sent_end;\n+\t/**\n+\t * Maximal value of (ACK + window size) in received packet + length\n+\t * over sent packet (maximal sequence could be sent).\n+\t */\n+\tuint32_t reply_end;\n+\t/** Maximal value of actual window size in sent packets. */\n+\tuint32_t max_win;\n+\t/** Maximal value of ACK in sent packets. */\n+\tuint32_t max_ack;\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this structure may change without prior notice\n+ *\n+ * RTE_FLOW_ACTION_TYPE_CONNTRACK\n+ *\n+ * Configuration and initial state for the connection tracking module.\n+ * This structure could be used for both setting and query.\n+ */\n+struct rte_flow_action_conntrack {\n+\t/** The peer port number, can be the same port. */\n+\tuint16_t peer_port;\n+\t/**\n+\t * Direction of this connection when creating a flow, the value\n+\t * only affects the subsequent flows creation.\n+\t */\n+\tuint32_t is_original_dir:1;\n+\t/**\n+\t * Enable / disable the conntrack HW module. When disabled, the\n+\t * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.\n+\t * In this state the HW will act as passthrough.\n+\t * It only affects this conntrack object in the HW without any effect\n+\t * to the other objects.\n+\t */\n+\tuint32_t enable:1;\n+\t/** At least one ack was seen after the connection was established. */\n+\tuint32_t live_connection:1;\n+\t/** Enable selective ACK on this connection. */\n+\tuint32_t selective_ack:1;\n+\t/** A challenge ack has passed. */\n+\tuint32_t challenge_ack_passed:1;\n+\t/**\n+\t * 1: The last packet is seen from the original direction.\n+\t * 0: The last packet is seen from the reply direction.\n+\t */\n+\tuint32_t last_direction:1;\n+\t/** No TCP check will be done except the state change. */\n+\tuint32_t liberal_mode:1;\n+\t/**<The current state of this connection. */\n+\tenum rte_flow_conntrack_state state;\n+\t/** Scaling factor for maximal allowed ACK window. */\n+\tuint8_t max_ack_window;\n+\t/** Maximal allowed number of retransmission times. */\n+\tuint8_t retransmission_limit;\n+\t/** TCP parameters of the original direction. */\n+\tstruct rte_flow_tcp_dir_param original_dir;\n+\t/** TCP parameters of the reply direction. */\n+\tstruct rte_flow_tcp_dir_param reply_dir;\n+\t/** The window value of the last packet passed this conntrack. */\n+\tuint16_t last_window;\n+\tenum rte_flow_conntrack_tcp_last_index last_index;\n+\t/** The sequence of the last packet passed this conntrack. */\n+\tuint32_t last_seq;\n+\t/** The acknowledgement of the last packet passed this conntrack. */\n+\tuint32_t last_ack;\n+\t/**\n+\t * The total value ACK + payload length of the last packet\n+\t * passed this conntrack.\n+\t */\n+\tuint32_t last_end;\n+};\n+\n+/**\n+ * RTE_FLOW_ACTION_TYPE_CONNTRACK\n+ *\n+ * Wrapper structure for the context update interface.\n+ * Ports cannot support updating, and the only valid solution is to\n+ * destroy the old context and create a new one instead.\n+ */\n+struct rte_flow_modify_conntrack {\n+\t/** New connection tracking parameters to be updated. */\n+\tstruct rte_flow_action_conntrack new_ct;\n+\t/** The direction field will be updated. */\n+\tuint32_t direction:1;\n+\t/** All the other fields except direction will be updated. */\n+\tuint32_t state:1;\n+\t/** Reserved bits for the future usage. */\n+\tuint32_t reserved:30;\n+};\n+\n /**\n  * Field IDs for MODIFY_FIELD action.\n  */\n",
    "prefixes": [
        "v3",
        "1/3"
    ]
}