get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 121849,
    "url": "https://patches.dpdk.org/api/patches/121849/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230111205608.87953-8-cristian.dumitrescu@intel.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": "<20230111205608.87953-8-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230111205608.87953-8-cristian.dumitrescu@intel.com",
    "date": "2023-01-11T20:56:04",
    "name": "[07/11] examples/pipeline: add IPsec CLI commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fb9e6317543528a28344e10eb1b781a409d9809c",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230111205608.87953-8-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 26482,
            "url": "https://patches.dpdk.org/api/series/26482/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26482",
            "date": "2023-01-11T20:55:57",
            "name": "pipeline: add IPsec support",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/26482/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/121849/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/121849/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 900CF423AF;\n\tWed, 11 Jan 2023 21:57:02 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 460FF42D58;\n\tWed, 11 Jan 2023 21:56:22 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id A476142D43\n for <dev@dpdk.org>; Wed, 11 Jan 2023 21:56:18 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Jan 2023 12:56:18 -0800",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.222.53])\n by orsmga003.jf.intel.com with ESMTP; 11 Jan 2023 12:56:17 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1673470578; x=1705006578;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=m8kqkXJ9ngkUmnF2mgSDGB4G10UZU0EJJwwCWsomtk0=;\n b=HcVV+z7xt2jhClUmKTaEzQxRBOTd5TSnar1h7Jg8ZnX630UQd7uBZW1t\n y8Rd8OrSbxM/cLYHhmP7Xfvk06rARbAw//MLhAwp1SUPEDJLfRuIteCUR\n eOrU6ibIM8OjtwZ3wz6qE9mTesbqNkpoa6In9tVlNHdLgeUnqUOp/0A5S\n 8FCNEBC9/KjfP8rCyYE/GxJMLZDbfROO4QozBCNWT6t+xwsBbvQccO/w+\n lXe4kOrse86rhSGDG4WTDob43PQaHDnkvyFZVx9KspmElI8h8A+QUKjmq\n M/nB+xKQFATY5ctZFKdVOocJp7d2gzSjgo6CXlwTpRyKx/oaiQmG4QQk/ A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10586\"; a=\"303229788\"",
            "E=Sophos;i=\"5.96,317,1665471600\"; d=\"scan'208\";a=\"303229788\"",
            "E=McAfee;i=\"6500,9779,10586\"; a=\"607518881\"",
            "E=Sophos;i=\"5.96,317,1665471600\"; d=\"scan'208\";a=\"607518881\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Kamalakannan R <kamalakannan.r@intel.com>",
        "Subject": "[PATCH 07/11] examples/pipeline: add IPsec CLI commands",
        "Date": "Wed, 11 Jan 2023 20:56:04 +0000",
        "Message-Id": "<20230111205608.87953-8-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230111205608.87953-1-cristian.dumitrescu@intel.com>",
        "References": "<20230111205608.87953-1-cristian.dumitrescu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "Add CLI commands for IPsec block configuration.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Kamalakannan R <kamalakannan.r@intel.com>\n---\n examples/pipeline/cli.c | 298 ++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 298 insertions(+)",
    "diff": "diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c\nindex 47c1adf772..efe2ff61db 100644\n--- a/examples/pipeline/cli.c\n+++ b/examples/pipeline/cli.c\n@@ -18,6 +18,7 @@\n #include <rte_swx_port_fd.h>\n #include <rte_swx_pipeline.h>\n #include <rte_swx_ctl.h>\n+#include <rte_swx_ipsec.h>\n \n #include \"cli.h\"\n \n@@ -2909,6 +2910,263 @@ cmd_pipeline_mirror_session(char **tokens,\n \t}\n }\n \n+static const char cmd_ipsec_create_help[] =\n+\"ipsec <ipsec_instance_name> create \"\n+\"in <ring_in_name> out <ring_out_name> \"\n+\"cryptodev <crypto_dev_name> cryptoq <crypto_dev_queue_pair_id> \"\n+\"bsz <ring_rd_bsz> <ring_wr_bsz> <crypto_wr_bsz> <crypto_rd_bsz> \"\n+\"samax <n_sa_max> \"\n+\"numa <numa_node>\\n\";\n+\n+static void\n+cmd_ipsec_create(char **tokens,\n+\t\t uint32_t n_tokens,\n+\t\t char *out,\n+\t\t size_t out_size,\n+\t\t void *obj __rte_unused)\n+{\n+\tstruct rte_swx_ipsec_params p;\n+\tstruct rte_swx_ipsec *ipsec;\n+\tchar *ipsec_instance_name;\n+\tuint32_t numa_node;\n+\tint status;\n+\n+\tif (n_tokens != 20) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tipsec_instance_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"create\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"create\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"in\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"in\");\n+\t\treturn;\n+\t}\n+\n+\tp.ring_in_name = tokens[4];\n+\n+\tif (strcmp(tokens[5], \"out\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"out\");\n+\t\treturn;\n+\t}\n+\n+\tp.ring_out_name = tokens[6];\n+\n+\tif (strcmp(tokens[7], \"cryptodev\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cryptodev\");\n+\t\treturn;\n+\t}\n+\n+\tp.crypto_dev_name = tokens[8];\n+\n+\tif (strcmp(tokens[9], \"cryptoq\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cryptoq\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.crypto_dev_queue_pair_id, tokens[10])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"crypto_dev_queue_pair_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[11], \"bsz\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"bsz\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.bsz.ring_rd, tokens[12])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"ring_rd_bsz\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.bsz.ring_wr, tokens[13])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"ring_wr_bsz\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.bsz.crypto_wr, tokens[14])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"crypto_wr_bsz\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.bsz.crypto_rd, tokens[15])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"crypto_rd_bsz\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[16], \"samax\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"samax\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&p.n_sa_max, tokens[17])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"n_sa_max\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[18], \"numa\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"numa\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&numa_node, tokens[19])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"numa_node\");\n+\t\treturn;\n+\t}\n+\n+\tstatus = rte_swx_ipsec_create(&ipsec,\n+\t\t\t\t      ipsec_instance_name,\n+\t\t\t\t      &p,\n+\t\t\t\t      (int)numa_node);\n+\tif (status)\n+\t\tsnprintf(out, out_size, \"IPsec instance creation failed (%d).\\n\", status);\n+}\n+\n+static const char cmd_ipsec_sa_add_help[] =\n+\"ipsec <ipsec_instance_name> sa add <file_name>\\n\";\n+\n+static void\n+cmd_ipsec_sa_add(char **tokens,\n+\t\t uint32_t n_tokens,\n+\t\t char *out,\n+\t\t size_t out_size,\n+\t\t void *obj __rte_unused)\n+{\n+\tstruct rte_swx_ipsec *ipsec;\n+\tchar *ipsec_instance_name, *file_name, *line = NULL;\n+\tFILE *file = NULL;\n+\tuint32_t line_id = 0;\n+\n+\tif (n_tokens != 5) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tipsec_instance_name = tokens[1];\n+\tipsec = rte_swx_ipsec_find(ipsec_instance_name);\n+\tif (!ipsec) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"ipsec_instance_name\");\n+\t\tgoto free;\n+\t}\n+\n+\tif (strcmp(tokens[2], \"sa\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"sa\");\n+\t\tgoto free;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"add\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"add\");\n+\t\tgoto free;\n+\t}\n+\n+\tfile_name = tokens[4];\n+\tfile = fopen(file_name, \"r\");\n+\tif (!file) {\n+\t\tsnprintf(out, out_size, \"Cannot open file %s.\\n\", file_name);\n+\t\tgoto free;\n+\t}\n+\n+\t/* Buffer allocation. */\n+\tline = malloc(MAX_LINE_SIZE);\n+\tif (!line) {\n+\t\tsnprintf(out, out_size, MSG_OUT_OF_MEMORY);\n+\t\tgoto free;\n+\t}\n+\n+\t/* File read. */\n+\tfor (line_id = 1; ; line_id++) {\n+\t\tstruct rte_swx_ipsec_sa_params *sa;\n+\t\tconst char *err_msg;\n+\t\tuint32_t sa_id = 0;\n+\t\tint is_blank_or_comment, status = 0;\n+\n+\t\tif (fgets(line, MAX_LINE_SIZE, file) == NULL)\n+\t\t\tbreak;\n+\n+\t\t/* Read SA from file. */\n+\t\tsa = rte_swx_ipsec_sa_read(ipsec, line, &is_blank_or_comment, &err_msg);\n+\t\tif (!sa) {\n+\t\t\tif (is_blank_or_comment)\n+\t\t\t\tcontinue;\n+\n+\t\t\tsnprintf(out, out_size, \"Invalid SA in file \\\"%s\\\" at line %u: \\\"%s\\\"\\n\",\n+\t\t\t\tfile_name, line_id, err_msg);\n+\t\t\tgoto free;\n+\t\t}\n+\n+\t\tsnprintf(out, out_size, \"%s\", line);\n+\t\tout_size -= strlen(out);\n+\t\tout += strlen(out);\n+\n+\t\t/* Add the SA to the IPsec instance. Free the SA. */\n+\t\tstatus = rte_swx_ipsec_sa_add(ipsec, sa, &sa_id);\n+\t\tif (status)\n+\t\t\tsnprintf(out, out_size, \"\\t: Error (%d)\\n\", status);\n+\t\telse\n+\t\t\tsnprintf(out, out_size, \"\\t: OK (SA ID = %u)\\n\", sa_id);\n+\t\tout_size -= strlen(out);\n+\t\tout += strlen(out);\n+\n+\t\tfree(sa);\n+\t\tif (status)\n+\t\t\tgoto free;\n+\t}\n+\n+free:\n+\tif (file)\n+\t\tfclose(file);\n+\tfree(line);\n+}\n+\n+static const char cmd_ipsec_sa_delete_help[] =\n+\"ipsec <ipsec_instance_name> sa delete <sa_id>\\n\";\n+\n+static void\n+cmd_ipsec_sa_delete(char **tokens,\n+\t\t    uint32_t n_tokens,\n+\t\t    char *out,\n+\t\t    size_t out_size,\n+\t\t    void *obj __rte_unused)\n+{\n+\tstruct rte_swx_ipsec *ipsec;\n+\tchar *ipsec_instance_name;\n+\tuint32_t sa_id;\n+\n+\tif (n_tokens != 5) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tipsec_instance_name = tokens[1];\n+\tipsec = rte_swx_ipsec_find(ipsec_instance_name);\n+\tif (!ipsec) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"ipsec_instance_name\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[2], \"sa\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"sa\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"delete\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"delete\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&sa_id, tokens[4])) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"sa_id\");\n+\t\treturn;\n+\t}\n+\n+\trte_swx_ipsec_sa_delete(ipsec, sa_id);\n+}\n+\n static const char cmd_thread_pipeline_enable_help[] =\n \"thread <thread_id> pipeline <pipeline_name> enable [ period <timer_period_ms> ]\\n\";\n \n@@ -3067,6 +3325,9 @@ cmd_help(char **tokens,\n \t\t\t\"\\tpipeline meter stats\\n\"\n \t\t\t\"\\tpipeline stats\\n\"\n \t\t\t\"\\tpipeline mirror session\\n\"\n+\t\t\t\"\\tipsec create\\n\"\n+\t\t\t\"\\tipsec sa add\\n\"\n+\t\t\t\"\\tipsec sa delete\\n\"\n \t\t\t\"\\tthread pipeline enable\\n\"\n \t\t\t\"\\tthread pipeline disable\\n\\n\");\n \t\treturn;\n@@ -3291,6 +3552,26 @@ cmd_help(char **tokens,\n \t\treturn;\n \t}\n \n+\tif (!strcmp(tokens[0], \"ipsec\") &&\n+\t\t(n_tokens == 2) && !strcmp(tokens[1], \"create\")) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\", cmd_ipsec_create_help);\n+\t\treturn;\n+\t}\n+\n+\tif (!strcmp(tokens[0], \"ipsec\") &&\n+\t\t(n_tokens == 3) && !strcmp(tokens[1], \"sa\")\n+\t\t&& !strcmp(tokens[2], \"add\")) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\", cmd_ipsec_sa_add_help);\n+\t\treturn;\n+\t}\n+\n+\tif (!strcmp(tokens[0], \"ipsec\") &&\n+\t\t(n_tokens == 3) && !strcmp(tokens[1], \"sa\")\n+\t\t&& !strcmp(tokens[2], \"delete\")) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\", cmd_ipsec_sa_delete_help);\n+\t\treturn;\n+\t}\n+\n \tif ((n_tokens == 3) &&\n \t\t(strcmp(tokens[0], \"thread\") == 0) &&\n \t\t(strcmp(tokens[1], \"pipeline\") == 0)) {\n@@ -3539,6 +3820,23 @@ cli_process(char *in, char *out, size_t out_size, void *obj)\n \t\t}\n \t}\n \n+\tif (!strcmp(tokens[0], \"ipsec\")) {\n+\t\tif (n_tokens >= 3 && !strcmp(tokens[2], \"create\")) {\n+\t\t\tcmd_ipsec_create(tokens, n_tokens, out, out_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (n_tokens >= 4 && !strcmp(tokens[2], \"sa\") && !strcmp(tokens[3], \"add\")) {\n+\t\t\tcmd_ipsec_sa_add(tokens, n_tokens, out, out_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (n_tokens >= 4 && !strcmp(tokens[2], \"sa\") && !strcmp(tokens[3], \"delete\")) {\n+\t\t\tcmd_ipsec_sa_delete(tokens, n_tokens, out, out_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\n \tif (strcmp(tokens[0], \"thread\") == 0) {\n \t\tif ((n_tokens >= 5) &&\n \t\t\t(strcmp(tokens[4], \"enable\") == 0)) {\n",
    "prefixes": [
        "07/11"
    ]
}