get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 114638,
    "url": "http://patches.dpdk.org/api/patches/114638/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220804165839.1074817-16-cristian.dumitrescu@intel.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": "<20220804165839.1074817-16-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220804165839.1074817-16-cristian.dumitrescu@intel.com",
    "date": "2022-08-04T16:58:33",
    "name": "[15/21] net/softnic: add pipeline learner table CLI commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8fabeb849e13de7f2ff1cf137a945b6985e0d12f",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220804165839.1074817-16-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 24205,
            "url": "http://patches.dpdk.org/api/series/24205/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24205",
            "date": "2022-08-04T16:58:18",
            "name": "net/softnic: replace the legacy pipeline with SWX pipeline",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/24205/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/114638/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/114638/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 0FB6CA00C4;\n\tThu,  4 Aug 2022 19:01:03 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D9A2342C69;\n\tThu,  4 Aug 2022 18:59:12 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 3A31A42C2C\n for <dev@dpdk.org>; Thu,  4 Aug 2022 18:59:10 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 Aug 2022 09:59:09 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.157])\n by orsmga001.jf.intel.com with ESMTP; 04 Aug 2022 09:59:08 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1659632350; x=1691168350;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=Gvmi6htJVOns0cufiUy+/ldeBvcUuUQIG8VyNMqRSPE=;\n b=bBqb0+Y0n0Iw4JfPN7sWmkFhMctgK52eMpHSXxhMAX2WKWJAMBKDaLNF\n /fUwwl30ITMKJCmV1vanKaWx9g7TgQrwhWEai0sfblh8cZXAF6S0iKliZ\n L7z80EowI46tukYktb2fywFbtfWfjE09BaZZkKTBxZ+ia1AtgwJ2kUCP1\n WjiNs0+mvm0y4maglFexAn0Hd/YgA7f0ezMYVMENI2lJ/URJbZkGwT0mp\n o5BW1imrC9u4zT4Iz3/59tLXIX3LF7GwkQpm8uVhNDc++3pYdVRbP4pes\n QwMtR4aB8NjPT+LL1i8LcDxPEvIm1oKEd6Ee8n0ijp8pQQCNACIH0lY5Q g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10429\"; a=\"290000179\"",
            "E=Sophos;i=\"5.93,216,1654585200\"; d=\"scan'208\";a=\"290000179\"",
            "E=Sophos;i=\"5.93,216,1654585200\"; d=\"scan'208\";a=\"636163243\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jasvinder.singh@intel.com,\n\tyogesh.jangra@intel.com",
        "Subject": "[PATCH 15/21] net/softnic: add pipeline learner table CLI commands",
        "Date": "Thu,  4 Aug 2022 16:58:33 +0000",
        "Message-Id": "<20220804165839.1074817-16-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220804165839.1074817-1-cristian.dumitrescu@intel.com>",
        "References": "<20220804165839.1074817-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 command for managing the learner table default entry.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Yogesh Jangra <yogesh.jangra@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic_cli.c | 106 ++++++++++++++++++++++\n 1 file changed, 106 insertions(+)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex dd094bfb65..5710ea6a73 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -1247,6 +1247,104 @@ cmd_softnic_pipeline_selector_show(struct pmd_internals *softnic,\n \t\tfclose(file);\n }\n \n+static int\n+pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *p,\n+\t\t\t\t   const char *learner_name,\n+\t\t\t\t   FILE *file,\n+\t\t\t\t   uint32_t *file_line_number)\n+{\n+\tchar *line = NULL;\n+\tuint32_t line_id = 0;\n+\tint status = 0;\n+\n+\t/* Buffer allocation. */\n+\tline = malloc(MAX_LINE_SIZE);\n+\tif (!line)\n+\t\treturn -ENOMEM;\n+\n+\t/* File read. */\n+\tfor (line_id = 1; ; line_id++) {\n+\t\tstruct rte_swx_table_entry *entry;\n+\t\tint is_blank_or_comment;\n+\n+\t\tif (fgets(line, MAX_LINE_SIZE, file) == NULL)\n+\t\t\tbreak;\n+\n+\t\tentry = rte_swx_ctl_pipeline_learner_default_entry_read(p,\n+\t\t\t\t\t\t\t\t\tlearner_name,\n+\t\t\t\t\t\t\t\t\tline,\n+\t\t\t\t\t\t\t\t\t&is_blank_or_comment);\n+\t\tif (!entry) {\n+\t\t\tif (is_blank_or_comment)\n+\t\t\t\tcontinue;\n+\n+\t\t\tstatus = -EINVAL;\n+\t\t\tgoto error;\n+\t\t}\n+\n+\t\tstatus = rte_swx_ctl_pipeline_learner_default_entry_add(p,\n+\t\t\t\t\t\t\t\t\tlearner_name,\n+\t\t\t\t\t\t\t\t\tentry);\n+\t\ttable_entry_free(entry);\n+\t\tif (status)\n+\t\t\tgoto error;\n+\t}\n+\n+error:\n+\t*file_line_number = line_id;\n+\tfree(line);\n+\treturn status;\n+}\n+\n+/**\n+ * pipeline <pipeline_name> learner <learner_name> default <file_name>\n+ */\n+static void\n+cmd_softnic_pipeline_learner_default(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name, *learner_name, *file_name;\n+\tFILE *file = NULL;\n+\tuint32_t file_line_number = 0;\n+\tint status;\n+\n+\tif (n_tokens != 6) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (!p) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n+\t\treturn;\n+\t}\n+\n+\tlearner_name = tokens[3];\n+\n+\tfile_name = tokens[5];\n+\tfile = fopen(file_name, \"r\");\n+\tif (!file) {\n+\t\tsnprintf(out, out_size, \"Cannot open file %s.\\n\", file_name);\n+\t\treturn;\n+\t}\n+\n+\tstatus = pipeline_learner_default_entry_add(p->ctl,\n+\t\t\t\t\t\t    learner_name,\n+\t\t\t\t\t\t    file,\n+\t\t\t\t\t\t    &file_line_number);\n+\tif (status)\n+\t\tsnprintf(out, out_size, \"Invalid entry in file %s at line %u\\n\",\n+\t\t\t file_name,\n+\t\t\t file_line_number);\n+\n+\tfclose(file);\n+}\n+\n /**\n  * thread <thread_id> pipeline <pipeline_name> enable [ period <timer_period_ms> ]\n  */\n@@ -1465,6 +1563,14 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\t\t\tout, out_size);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif ((n_tokens >= 5) &&\n+\t\t\t!strcmp(tokens[2], \"learner\") &&\n+\t\t\t!strcmp(tokens[4], \"default\")) {\n+\t\t\tcmd_softnic_pipeline_learner_default(softnic, tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif (strcmp(tokens[0], \"thread\") == 0) {\n",
    "prefixes": [
        "15/21"
    ]
}