get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97057,
    "url": "http://patchwork.dpdk.org/api/patches/97057/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/473f5de149a87eef20a916e0b164d03e4f5d9f53.1629287046.git.sovaradh@linux.microsoft.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<473f5de149a87eef20a916e0b164d03e4f5d9f53.1629287046.git.sovaradh@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/473f5de149a87eef20a916e0b164d03e4f5d9f53.1629287046.git.sovaradh@linux.microsoft.com",
    "date": "2021-08-18T15:01:13",
    "name": "[v2,1/2] examples/flow_classify: hooks for filters on tcp flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "c36080ff59c0dc5d975339fcbf26970c4c3dabc2",
    "submitter": {
        "id": 2330,
        "url": "http://patchwork.dpdk.org/api/people/2330/?format=api",
        "name": "Sowmini Varadhan",
        "email": "sovaradh@linux.microsoft.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/473f5de149a87eef20a916e0b164d03e4f5d9f53.1629287046.git.sovaradh@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 18333,
            "url": "http://patchwork.dpdk.org/api/series/18333/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18333",
            "date": "2021-08-18T15:01:12",
            "name": "TCP flow classification using 4-tuple and flags",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/18333/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/97057/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/97057/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 4DC9DA0C52;\n\tWed, 18 Aug 2021 17:01:27 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B21DF4117D;\n\tWed, 18 Aug 2021 17:01:21 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id C7E8540151\n for <dev@dpdk.org>; Wed, 18 Aug 2021 17:01:18 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1065)\n id 17F7D20C32B5; Wed, 18 Aug 2021 08:01:18 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 17F7D20C32B5",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1629298878;\n bh=ddMCFpIJ+dUtcFDJSCMEZkxl6kgBF4EnsLEdiH142/8=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To:\n References:From;\n b=SexaSGacN4GxA4JQZLnCdUjj08NJTM8d5BVhWYk47oD21zzi42ehmA35s+mDaXF15\n U/R2ul/qISwsQegyLguzZq3lk7iWh5dFbZBO0hNfYUpiWTaikaMeSvEBP5pwsvDOto\n 8hmQ73+Lxq9gw01M3fncPg9tRF3uXtxzCQO3tz1c=",
        "From": "Sowmini Varadhan <sovaradh@linux.microsoft.com>",
        "To": "sowmini05@gmail.com, bernard.iremonger@intel.com, dev@dpdk.org,\n sovaradh@linux.microsoft.com",
        "Cc": "thomas@monjalon.net",
        "Date": "Wed, 18 Aug 2021 08:01:13 -0700",
        "Message-Id": "\n <473f5de149a87eef20a916e0b164d03e4f5d9f53.1629287046.git.sovaradh@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": [
            "<cover.1629287046.git.sovaradh@linux.microsoft.com>",
            "<cover.1629287046.git.sovaradh@linux.microsoft.com>"
        ],
        "References": [
            "<cover.1629287046.git.sovaradh@linux.microsoft.com>",
            "<cover.1629287046.git.sovaradh@linux.microsoft.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v2 1/2] examples/flow_classify: hooks for filters\n on tcp flags",
        "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": "v2 fixes:  typo fixes, get_tcp_flags returns -EINVAL\n\nThe rte_eth_ntuple_filter allows tcp_flags which can check for things\nlike\n    #define RTE_TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */\n    #define RTE_TCP_ECE_FLAG 0x40 /**< ECN-Echo */\n    #define RTE_TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */\n    #define RTE_TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */\n    #define RTE_TCP_PSH_FLAG 0x08 /**< Push Function */\n    #define RTE_TCP_RST_FLAG 0x04 /**< Reset the connection */\n    #define RTE_TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */\n    #define RTE_TCP_FIN_FLAG 0x01 /**< No more data from sender */\nbut there are no existing examples that demonstrate how to use this\nfeature.\n\nThis patch extends the existing classification support to allow\nan optional flags in the input file. The flags string can be any\nconcatenation of characters from {C, E, U, A, P, R, S, F} and\n\"*\" indicates \"don't care\". These flags are set in the ntuple_filter and\nare used to construct the tcp_spec and tcp_mask sent to the driver\n\nThe rte_acl_field_def is updated to use the (u8) tcp flag as lookup key.\nNote that, as per\n  https://doc.dpdk.org/guides/prog_guide/packet_classif_access_ctrl.html\nthis field MUST be allocated for 4 bytes, thus it has sizeof(uint32_t).\n\nHowever, also note the XXX in this commit: additional updates are\nneeded to the rte_flow_classify_table_entry_add() so that it does\nnot ignore any key fields other than the 5-tuple.\n\nSigned-off-by: Sowmini Varadhan <sovaradh@linux.microsoft.com>\n---\n examples/flow_classify/flow_classify.c     | 87 ++++++++++++++++++++--\n examples/flow_classify/ipv4_rules_file.txt | 22 +++---\n 2 files changed, 91 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c\nindex db71f5aa04..ff4c8bc2f5 100644\n--- a/examples/flow_classify/flow_classify.c\n+++ b/examples/flow_classify/flow_classify.c\n@@ -51,6 +51,7 @@ enum {\n \tCB_FLD_DST_PORT_MASK,\n \tCB_FLD_PROTO,\n \tCB_FLD_PRIORITY,\n+\tCB_FLD_TCP_FLAGS,\n \tCB_FLD_NUM,\n };\n \n@@ -86,6 +87,7 @@ enum {\n \tDST_FIELD_IPV4,\n \tSRCP_FIELD_IPV4,\n \tDSTP_FIELD_IPV4,\n+\tTCP_FLAGS_FIELD,\n \tNUM_FIELDS_IPV4\n };\n \n@@ -93,7 +95,8 @@ enum {\n \tPROTO_INPUT_IPV4,\n \tSRC_INPUT_IPV4,\n \tDST_INPUT_IPV4,\n-\tSRCP_DESTP_INPUT_IPV4\n+\tSRCP_DESTP_INPUT_IPV4,\n+\tTCP_FLAGS_INDEX,\n };\n \n static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = {\n@@ -150,6 +153,17 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = {\n \t\t\tsizeof(struct rte_ipv4_hdr) +\n \t\t\toffsetof(struct rte_tcp_hdr, dst_port),\n \t},\n+\t/* next field must be 4 bytes, even though flags is only 1 byte */\n+\t{\n+\t\t/* rte_flags */\n+\t\t.type = RTE_ACL_FIELD_TYPE_BITMASK,\n+\t\t.size = sizeof(uint32_t),\n+\t\t.field_index = TCP_FLAGS_FIELD,\n+\t\t.input_index = TCP_FLAGS_INDEX,\n+\t\t.offset = sizeof(struct rte_ether_hdr) +\n+\t\t\tsizeof(struct rte_ipv4_hdr) +\n+\t\t\toffsetof(struct rte_tcp_hdr, tcp_flags),\n+\t},\n };\n /* >8 End of creation of ACL table. */\n \n@@ -285,12 +299,14 @@ lcore_main(struct flow_classifier *cls_app)\n \tint ret;\n \tint i = 0;\n \n-\tret = rte_flow_classify_table_entry_delete(cls_app->cls,\n-\t\t\trules[7]);\n-\tif (ret)\n-\t\tprintf(\"table_entry_delete failed [7] %d\\n\\n\", ret);\n-\telse\n-\t\tprintf(\"table_entry_delete succeeded [7]\\n\\n\");\n+\tif (rules[7]) {\n+\t\tret = rte_flow_classify_table_entry_delete(cls_app->cls,\n+\t\t\t\trules[7]);\n+\t\tif (ret)\n+\t\t\tprintf(\"table_entry_delete failed [7] %d\\n\\n\", ret);\n+\t\telse\n+\t\t\tprintf(\"table_entry_delete succeeded [7]\\n\\n\");\n+\t}\n \n \t/*\n \t * Check that the port is on the same NUMA node as the polling thread\n@@ -410,6 +426,53 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len)\n \treturn 0;\n }\n \n+static int\n+get_tcp_flags(char *in, struct rte_eth_ntuple_filter *ntuple_filter)\n+{\n+\tint len = strlen(in);\n+\tint i;\n+\tuint8_t flags = 0;\n+\n+\tif (strcmp(in, \"*\") == 0) {\n+\t\tntuple_filter->tcp_flags = 0;\n+\t\treturn 0;\n+\t}\n+\n+\tfor (i = 0; i < len; i++) {\n+\t\tswitch (in[i]) {\n+\t\tcase 'S':\n+\t\t\tflags |= RTE_TCP_SYN_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'F':\n+\t\t\tflags |= RTE_TCP_FIN_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'R':\n+\t\t\tflags |= RTE_TCP_RST_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'P':\n+\t\t\tflags |= RTE_TCP_PSH_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'A':\n+\t\t\tflags |= RTE_TCP_ACK_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'U':\n+\t\t\tflags |= RTE_TCP_URG_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'E':\n+\t\t\tflags |= RTE_TCP_ECE_FLAG;\n+\t\t\tbreak;\n+\t\tcase 'C':\n+\t\t\tflags |= RTE_TCP_CWR_FLAG;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tfprintf(stderr, \"unknown flag %c\\n\", in[i]);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\tntuple_filter->tcp_flags = flags;\n+\treturn 0;\n+}\n+\n static int\n parse_ipv4_5tuple_rule(char *str, struct rte_eth_ntuple_filter *ntuple_filter)\n {\n@@ -481,6 +544,8 @@ parse_ipv4_5tuple_rule(char *str, struct rte_eth_ntuple_filter *ntuple_filter)\n \tntuple_filter->priority = (uint16_t)temp;\n \tif (ntuple_filter->priority > FLOW_CLASSIFY_MAX_PRIORITY)\n \t\tret = -EINVAL;\n+\tif (get_tcp_flags(in[CB_FLD_TCP_FLAGS], ntuple_filter))\n+\t\treturn -EINVAL;\n \n \treturn ret;\n }\n@@ -597,10 +662,13 @@ add_classify_rule(struct rte_eth_ntuple_filter *ntuple_filter,\n \t\tmemset(&tcp_spec, 0, sizeof(tcp_spec));\n \t\ttcp_spec.hdr.src_port = ntuple_filter->src_port;\n \t\ttcp_spec.hdr.dst_port = ntuple_filter->dst_port;\n+\t\ttcp_spec.hdr.tcp_flags = ntuple_filter->tcp_flags;\n \n \t\tmemset(&tcp_mask, 0, sizeof(tcp_mask));\n \t\ttcp_mask.hdr.src_port = ntuple_filter->src_port_mask;\n \t\ttcp_mask.hdr.dst_port = ntuple_filter->dst_port_mask;\n+\t\tif (tcp_spec.hdr.tcp_flags != 0)\n+\t\t\ttcp_mask.hdr.tcp_flags = 0xff;\n \n \t\ttcp_item.type = RTE_FLOW_ITEM_TYPE_TCP;\n \t\ttcp_item.spec = &tcp_spec;\n@@ -655,6 +723,11 @@ add_classify_rule(struct rte_eth_ntuple_filter *ntuple_filter,\n \t\treturn ret;\n \t}\n \n+\t/* XXX but this only adds table_type of\n+\t * RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE\n+\t * i.e., it only ever does allocate_acl_ipv4_5tuple_rule()\n+\t * so the tcp_flags is ignored!\n+\t */\n \trule = rte_flow_classify_table_entry_add(\n \t\t\tcls_app->cls, &attr, pattern_ipv4_5tuple,\n \t\t\tactions, &key_found, &error);\ndiff --git a/examples/flow_classify/ipv4_rules_file.txt b/examples/flow_classify/ipv4_rules_file.txt\nindex dfa0631fcc..415573732a 100644\n--- a/examples/flow_classify/ipv4_rules_file.txt\n+++ b/examples/flow_classify/ipv4_rules_file.txt\n@@ -1,14 +1,14 @@\n #file format:\n-#src_ip/masklen dst_ip/masklen src_port : mask dst_port : mask proto/mask priority\n+#src_ip/masklen dst_ip/masklen src_port : mask dst_port : mask proto/mask priority tcp_flags\n #\n-2.2.2.3/24 2.2.2.7/24 32 : 0xffff 33 : 0xffff 17/0xff 0\n-9.9.9.3/24 9.9.9.7/24 32 : 0xffff 33 : 0xffff 17/0xff 1\n-9.9.9.3/24 9.9.9.7/24 32 : 0xffff 33 : 0xffff 6/0xff 2\n-9.9.8.3/24 9.9.8.7/24 32 : 0xffff 33 : 0xffff 6/0xff 3\n-6.7.8.9/24 2.3.4.5/24 32 : 0x0000 33 : 0x0000 132/0xff 4\n-6.7.8.9/32 192.168.0.36/32 10 : 0xffff 11 : 0xffff 6/0xfe 5\n-6.7.8.9/24 192.168.0.36/24 10 : 0xffff 11 : 0xffff 6/0xfe 6\n-6.7.8.9/16 192.168.0.36/16 10 : 0xffff 11 : 0xffff 6/0xfe 7\n-6.7.8.9/8 192.168.0.36/8 10 : 0xffff 11 : 0xffff 6/0xfe 8\n+2.2.2.3/24 2.2.2.7/24 32 : 0xffff 33 : 0xffff 17/0xff 0 *\n+9.9.9.3/24 9.9.9.7/24 32 : 0xffff 33 : 0xffff 17/0xff 1 *\n+9.9.9.3/24 9.9.9.7/24 32 : 0xffff 33 : 0xffff 6/0xff 2 *\n+9.9.8.3/24 9.9.8.7/24 32 : 0xffff 33 : 0xffff 6/0xff 3 *\n+6.7.8.9/24 2.3.4.5/24 32 : 0x0000 33 : 0x0000 132/0xff 4 *\n+6.7.8.9/32 192.168.0.36/32 10 : 0xffff 11 : 0xffff 6/0xfe 5 *\n+6.7.8.9/24 192.168.0.36/24 10 : 0xffff 11 : 0xffff 6/0xfe 6 *\n+6.7.8.9/16 192.168.0.36/16 10 : 0xffff 11 : 0xffff 6/0xfe 7 *\n+6.7.8.9/8 192.168.0.36/8 10 : 0xffff 11 : 0xffff 6/0xfe 8 *\n #error rules\n-#9.8.7.6/8 192.168.0.36/8 10 : 0xffff 11 : 0xffff 6/0xfe 9\n\\ No newline at end of file\n+#9.8.7.6/8 192.168.0.36/8 10 : 0xffff 11 : 0xffff 6/0xfe 9 *\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}