get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 95221,
    "url": "https://patches.dpdk.org/api/patches/95221/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210702204952.61445-1-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": "<20210702204952.61445-1-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210702204952.61445-1-cristian.dumitrescu@intel.com",
    "date": "2021-07-02T20:49:52",
    "name": "[1/5] examples/pipeline: improve table update CLI commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ca207bdddb5bb98f2d49fa91aa6af60fc0ea7d25",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210702204952.61445-1-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 17602,
            "url": "https://patches.dpdk.org/api/series/17602/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17602",
            "date": "2021-07-02T20:49:52",
            "name": "[1/5] examples/pipeline: improve table update CLI commands",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/17602/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/95221/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/95221/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 C86FEA0C3F;\n\tFri,  2 Jul 2021 22:49:59 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8B3C241363;\n\tFri,  2 Jul 2021 22:49:59 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id EA38941353\n for <dev@dpdk.org>; Fri,  2 Jul 2021 22:49:56 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 02 Jul 2021 13:49:54 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by fmsmga002.fm.intel.com with ESMTP; 02 Jul 2021 13:49:53 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10033\"; a=\"294428751\"",
            "E=Sophos;i=\"5.83,320,1616482800\"; d=\"scan'208\";a=\"294428751\"",
            "E=Sophos;i=\"5.83,320,1616482800\"; d=\"scan'208\";a=\"494257766\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Churchill Khangar <churchill.khangar@intel.com>",
        "Date": "Fri,  2 Jul 2021 21:49:52 +0100",
        "Message-Id": "<20210702204952.61445-1-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dpdk-dev] [PATCH 1/5] examples/pipeline: improve table update CLI\n commands",
        "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": "From: Churchill Khangar <churchill.khangar@intel.com>\n\nFor more felxibility, the single monolithic table update command is\nsplit into table entry add, table entry delete, table default entry\nadd, pipeline commit and pipeline abort.\n\nSigned-off-by: Churchill Khangar <churchill.khangar@intel.com>\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n examples/pipeline/cli.c                   | 589 ++++++++++++++++------\n examples/pipeline/examples/vxlan.cli      |   3 +-\n examples/pipeline/examples/vxlan_pcap.cli |   3 +-\n 3 files changed, 428 insertions(+), 167 deletions(-)",
    "diff": "diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c\nindex 215dd8e85..30754e319 100644\n--- a/examples/pipeline/cli.c\n+++ b/examples/pipeline/cli.c\n@@ -1038,25 +1038,76 @@ table_entry_free(struct rte_swx_table_entry *entry)\n \tfree(entry);\n }\n \n-static const char cmd_pipeline_table_update_help[] =\n-\"pipeline <pipeline_name> table <table_name> update <file_name_add> \"\n-\"<file_name_delete> <file_name_default>\";\n+#ifndef MAX_LINE_SIZE\n+#define MAX_LINE_SIZE 2048\n+#endif\n+\n+static int\n+pipeline_table_entries_add(struct rte_swx_ctl_pipeline *p,\n+\t\t\t   const char *table_name,\n+\t\t\t   FILE *file,\n+\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_table_entry_read(p,\n+\t\t\t\t\t\t\t      table_name,\n+\t\t\t\t\t\t\t      line,\n+\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_table_entry_add(p,\n+\t\t\t\t\t\t\t      table_name,\n+\t\t\t\t\t\t\t      entry);\n+\t\ttable_entry_free(entry);\n+\t\tif (status)\n+\t\t\tgoto error;\n+\t}\n+\n+error:\n+\tfree(line);\n+\t*file_line_number = line_id;\n+\treturn status;\n+}\n+\n+static const char cmd_pipeline_table_add_help[] =\n+\"pipeline <pipeline_name> table <table_name> add <file_name>\\n\";\n \n static void\n-cmd_pipeline_table_update(char **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size,\n-\tvoid *obj)\n+cmd_pipeline_table_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)\n {\n \tstruct pipeline *p;\n-\tchar *pipeline_name, *table_name, *line = NULL;\n-\tchar *file_name_add, *file_name_delete, *file_name_default;\n-\tFILE *file_add = NULL, *file_delete = NULL, *file_default = NULL;\n-\tuint32_t line_id;\n+\tchar *pipeline_name, *table_name, *file_name;\n+\tFILE *file = NULL;\n+\tuint32_t file_line_number = 0;\n \tint status;\n \n-\tif (n_tokens != 8) {\n+\tif (n_tokens != 6) {\n \t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n \t\treturn;\n \t}\n@@ -1068,192 +1119,313 @@ cmd_pipeline_table_update(char **tokens,\n \t\treturn;\n \t}\n \n-\tif (strcmp(tokens[2], \"table\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"table\");\n+\ttable_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_table_entries_add(p->ctl,\n+\t\t\t\t\t    table_name,\n+\t\t\t\t\t    file,\n+\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+static int\n+pipeline_table_entries_delete(struct rte_swx_ctl_pipeline *p,\n+\t\t\t      const char *table_name,\n+\t\t\t      FILE *file,\n+\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_table_entry_read(p,\n+\t\t\t\t\t\t\t      table_name,\n+\t\t\t\t\t\t\t      line,\n+\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_table_entry_delete(p,\n+\t\t\t\t\t\t\t\t table_name,\n+\t\t\t\t\t\t\t\t entry);\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+static const char cmd_pipeline_table_delete_help[] =\n+\"pipeline <pipeline_name> table <table_name> delete <file_name>\\n\";\n+\n+static void\n+cmd_pipeline_table_delete(char **tokens,\n+\t\t\t  uint32_t n_tokens,\n+\t\t\t  char *out,\n+\t\t\t  size_t out_size,\n+\t\t\t  void *obj)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name, *table_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 = pipeline_find(obj, pipeline_name);\n+\tif (!p || !p->ctl) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n \t\treturn;\n \t}\n \n \ttable_name = tokens[3];\n \n-\tif (strcmp(tokens[4], \"update\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"update\");\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-\tfile_name_add = tokens[5];\n-\tfile_name_delete = tokens[6];\n-\tfile_name_default = tokens[7];\n+\tstatus = pipeline_table_entries_delete(p->ctl,\n+\t\t\t\t\t       table_name,\n+\t\t\t\t\t       file,\n+\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+static int\n+pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *p,\n+\t\t\t\t const char *table_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/* File open. */\n-\tif (strcmp(file_name_add, \"none\")) {\n-\t\tfile_add = fopen(file_name_add, \"r\");\n-\t\tif (!file_add) {\n-\t\t\tsnprintf(out, out_size, \"Cannot open file %s.\\n\",\n-\t\t\t\tfile_name_add);\n+\t\tif (fgets(line, MAX_LINE_SIZE, file) == NULL)\n+\t\t\tbreak;\n+\n+\t\tentry = rte_swx_ctl_pipeline_table_entry_read(p,\n+\t\t\t\t\t\t\t      table_name,\n+\t\t\t\t\t\t\t      line,\n+\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-\t}\n \n-\tif (strcmp(file_name_delete, \"none\")) {\n-\t\tfile_delete = fopen(file_name_delete, \"r\");\n-\t\tif (!file_delete) {\n-\t\t\tsnprintf(out, out_size, \"Cannot open file %s.\\n\",\n-\t\t\t\tfile_name_delete);\n+\t\tstatus = rte_swx_ctl_pipeline_table_default_entry_add(p,\n+\t\t\t\t\t\t\t\t      table_name,\n+\t\t\t\t\t\t\t\t      entry);\n+\t\ttable_entry_free(entry);\n+\t\tif (status)\n \t\t\tgoto error;\n-\t\t}\n \t}\n \n-\tif (strcmp(file_name_default, \"none\")) {\n-\t\tfile_default = fopen(file_name_default, \"r\");\n-\t\tif (!file_default) {\n-\t\t\tsnprintf(out, out_size, \"Cannot open file %s.\\n\",\n-\t\t\t\tfile_name_default);\n-\t\t\tgoto error;\n-\t\t}\n+error:\n+\t*file_line_number = line_id;\n+\tfree(line);\n+\treturn status;\n+}\n+\n+static const char cmd_pipeline_table_default_help[] =\n+\"pipeline <pipeline_name> table <table_name> default <file_name>\\n\";\n+\n+static void\n+cmd_pipeline_table_default(char **tokens,\n+\t\t\t   uint32_t n_tokens,\n+\t\t\t   char *out,\n+\t\t\t   size_t out_size,\n+\t\t\t   void *obj)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name, *table_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-\tif (!file_add && !file_delete && !file_default) {\n-\t\tsnprintf(out, out_size, \"Nothing to be done.\");\n+\tpipeline_name = tokens[1];\n+\tp = pipeline_find(obj, pipeline_name);\n+\tif (!p || !p->ctl) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n \t\treturn;\n \t}\n \n-\t/* Buffer allocation. */\n-\tline = malloc(2048);\n-\tif (!line) {\n-\t\tsnprintf(out, out_size, MSG_OUT_OF_MEMORY);\n-\t\tgoto error;\n-\t}\n-\n-\t/* Add. */\n-\tif (file_add)\n-\t\tfor (line_id = 1; ; line_id++) {\n-\t\t\tstruct rte_swx_table_entry *entry;\n-\t\t\tint is_blank_or_comment;\n-\n-\t\t\tif (fgets(line, 2048, file_add) == NULL)\n-\t\t\t\tbreak;\n-\n-\t\t\tentry = rte_swx_ctl_pipeline_table_entry_read(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tline,\n-\t\t\t\t&is_blank_or_comment);\n-\t\t\tif (!entry) {\n-\t\t\t\tif (is_blank_or_comment)\n-\t\t\t\t\tcontinue;\n-\n-\t\t\t\tsnprintf(out, out_size, MSG_FILE_ERR,\n-\t\t\t\t\tfile_name_add, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n+\ttable_name = tokens[3];\n \n-\t\t\tstatus = rte_swx_ctl_pipeline_table_entry_add(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tentry);\n-\t\t\ttable_entry_free(entry);\n-\t\t\tif (status) {\n-\t\t\t\tsnprintf(out, out_size,\n-\t\t\t\t\t\"Invalid entry in file %s at line %u\",\n-\t\t\t\t\tfile_name_add, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n-\t\t}\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_table_default_entry_add(p->ctl,\n+\t\t\t\t\t\t  table_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-\t/* Delete. */\n-\tif (file_delete)\n-\t\tfor (line_id = 1; ; line_id++) {\n-\t\t\tstruct rte_swx_table_entry *entry;\n-\t\t\tint is_blank_or_comment;\n+\tfclose(file);\n+}\n \n-\t\t\tif (fgets(line, 2048, file_delete) == NULL)\n-\t\t\t\tbreak;\n+static const char cmd_pipeline_table_show_help[] =\n+\"pipeline <pipeline_name> table <table_name> show\\n\";\n \n-\t\t\tentry = rte_swx_ctl_pipeline_table_entry_read(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tline,\n-\t\t\t\t&is_blank_or_comment);\n-\t\t\tif (!entry) {\n-\t\t\t\tif (is_blank_or_comment)\n-\t\t\t\t\tcontinue;\n+static void\n+cmd_pipeline_table_show(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size,\n+\tvoid *obj)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name, *table_name;\n+\tint status;\n \n-\t\t\t\tsnprintf(out, out_size, MSG_FILE_ERR,\n-\t\t\t\t\tfile_name_delete, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n+\tif (n_tokens != 5) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n \n-\t\t\tstatus = rte_swx_ctl_pipeline_table_entry_delete(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tentry);\n-\t\t\ttable_entry_free(entry);\n-\t\t\tif (status)  {\n-\t\t\t\tsnprintf(out, out_size,\n-\t\t\t\t\t\"Invalid entry in file %s at line %u\",\n-\t\t\t\t\tfile_name_delete, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n-\t\t}\n+\tpipeline_name = tokens[1];\n+\tp = pipeline_find(obj, pipeline_name);\n+\tif (!p || !p->ctl) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n+\t\treturn;\n+\t}\n \n-\t/* Default. */\n-\tif (file_default)\n-\t\tfor (line_id = 1; ; line_id++) {\n-\t\t\tstruct rte_swx_table_entry *entry;\n-\t\t\tint is_blank_or_comment;\n+\ttable_name = tokens[3];\n+\tstatus = rte_swx_ctl_pipeline_table_fprintf(stdout, p->ctl, table_name);\n+\tif (status)\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"table_name\");\n+}\n \n-\t\t\tif (fgets(line, 2048, file_default) == NULL)\n-\t\t\t\tbreak;\n+static const char cmd_pipeline_commit_help[] =\n+\"pipeline <pipeline_name> commit\\n\";\n \n-\t\t\tentry = rte_swx_ctl_pipeline_table_entry_read(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tline,\n-\t\t\t\t&is_blank_or_comment);\n-\t\t\tif (!entry) {\n-\t\t\t\tif (is_blank_or_comment)\n-\t\t\t\t\tcontinue;\n+static void\n+cmd_pipeline_commit(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size,\n+\tvoid *obj)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name;\n+\tint status;\n \n-\t\t\t\tsnprintf(out, out_size, MSG_FILE_ERR,\n-\t\t\t\t\tfile_name_default, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n+\tif (n_tokens != 3) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n \n-\t\t\tstatus = rte_swx_ctl_pipeline_table_default_entry_add(p->ctl,\n-\t\t\t\ttable_name,\n-\t\t\t\tentry);\n-\t\t\ttable_entry_free(entry);\n-\t\t\tif (status) {\n-\t\t\t\tsnprintf(out, out_size,\n-\t\t\t\t\t\"Invalid entry in file %s at line %u\",\n-\t\t\t\t\tfile_name_default, line_id);\n-\t\t\t\tgoto error;\n-\t\t\t}\n-\t\t}\n+\tpipeline_name = tokens[1];\n+\tp = pipeline_find(obj, pipeline_name);\n+\tif (!p || !p->ctl) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n+\t\treturn;\n+\t}\n \n \tstatus = rte_swx_ctl_pipeline_commit(p->ctl, 1);\n-\tif (status) {\n-\t\tsnprintf(out, out_size, \"Commit failed.\");\n-\t\tgoto error;\n-\t}\n+\tif (status)\n+\t\tsnprintf(out, out_size, \"Commit failed. \"\n+\t\t\t\"Use \\\"commit\\\" to retry or \\\"abort\\\" to discard the pending work.\\n\");\n+}\n \n+static const char cmd_pipeline_abort_help[] =\n+\"pipeline <pipeline_name> abort\\n\";\n \n-\trte_swx_ctl_pipeline_table_fprintf(stdout, p->ctl, table_name);\n+static void\n+cmd_pipeline_abort(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size,\n+\tvoid *obj)\n+{\n+\tstruct pipeline *p;\n+\tchar *pipeline_name;\n \n-\tfree(line);\n-\tif (file_add)\n-\t\tfclose(file_add);\n-\tif (file_delete)\n-\t\tfclose(file_delete);\n-\tif (file_default)\n-\t\tfclose(file_default);\n-\treturn;\n+\tif (n_tokens != 3) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\tp = pipeline_find(obj, pipeline_name);\n+\tif (!p || !p->ctl) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipeline_name\");\n+\t\treturn;\n+\t}\n \n-error:\n \trte_swx_ctl_pipeline_abort(p->ctl);\n-\tfree(line);\n-\tif (file_add)\n-\t\tfclose(file_add);\n-\tif (file_delete)\n-\t\tfclose(file_delete);\n-\tif (file_default)\n-\t\tfclose(file_default);\n }\n \n static const char cmd_pipeline_regrd_help[] =\n@@ -1992,7 +2164,12 @@ cmd_help(char **tokens,\n \t\t\t\"\\tpipeline port in\\n\"\n \t\t\t\"\\tpipeline port out\\n\"\n \t\t\t\"\\tpipeline build\\n\"\n-\t\t\t\"\\tpipeline table update\\n\"\n+\t\t\t\"\\tpipeline table add\\n\"\n+\t\t\t\"\\tpipeline table delete\\n\"\n+\t\t\t\"\\tpipeline table default\\n\"\n+\t\t\t\"\\tpipeline table show\\n\"\n+\t\t\t\"\\tpipeline commit\\n\"\n+\t\t\t\"\\tpipeline abort\\n\"\n \t\t\t\"\\tpipeline regrd\\n\"\n \t\t\t\"\\tpipeline regwr\\n\"\n \t\t\t\"\\tpipeline meter profile add\\n\"\n@@ -2056,9 +2233,52 @@ cmd_help(char **tokens,\n \tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n \t\t(n_tokens == 3) &&\n \t\t(strcmp(tokens[1], \"table\") == 0) &&\n-\t\t(strcmp(tokens[2], \"update\") == 0)) {\n+\t\t(strcmp(tokens[2], \"add\") == 0)) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\tcmd_pipeline_table_add_help);\n+\t\treturn;\n+\t}\n+\n+\tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n+\t\t(n_tokens == 3) &&\n+\t\t(strcmp(tokens[1], \"table\") == 0) &&\n+\t\t(strcmp(tokens[2], \"delete\") == 0)) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\tcmd_pipeline_table_delete_help);\n+\t\treturn;\n+\t}\n+\n+\tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n+\t\t(n_tokens == 3) &&\n+\t\t(strcmp(tokens[1], \"table\") == 0) &&\n+\t\t(strcmp(tokens[2], \"default\") == 0)) {\n \t\tsnprintf(out, out_size, \"\\n%s\\n\",\n-\t\t\tcmd_pipeline_table_update_help);\n+\t\t\tcmd_pipeline_table_default_help);\n+\t\treturn;\n+\t}\n+\n+\tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n+\t\t(n_tokens == 3) &&\n+\t\t(strcmp(tokens[1], \"table\") == 0) &&\n+\t\t(strcmp(tokens[2], \"show\") == 0)) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\tcmd_pipeline_table_show_help);\n+\t\treturn;\n+\t}\n+\n+\tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n+\t\t(n_tokens == 2) &&\n+\t\t(strcmp(tokens[1], \"commit\") == 0)) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\tcmd_pipeline_commit_help);\n+\t\treturn;\n+\t}\n+\n+\tif ((strcmp(tokens[0], \"pipeline\") == 0) &&\n+\t\t(n_tokens == 2) &&\n+\t\t(strcmp(tokens[1], \"abort\") == 0)) {\n+\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\tcmd_pipeline_abort_help);\n \t\treturn;\n \t}\n \n@@ -2216,9 +2436,48 @@ cli_process(char *in, char *out, size_t out_size, void *obj)\n \t\t\treturn;\n \t\t}\n \n+\t\tif ((n_tokens >= 5) &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"add\") == 0)) {\n+\t\t\tcmd_pipeline_table_add(tokens, n_tokens, out,\n+\t\t\t\tout_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 5) &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"delete\") == 0)) {\n+\t\t\tcmd_pipeline_table_delete(tokens, n_tokens, out,\n+\t\t\t\tout_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 5) &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"default\") == 0)) {\n+\t\t\tcmd_pipeline_table_default(tokens, n_tokens, out,\n+\t\t\t\tout_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 5) &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"show\") == 0)) {\n+\t\t\tcmd_pipeline_table_show(tokens, n_tokens, out,\n+\t\t\t\tout_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 3) &&\n+\t\t\t(strcmp(tokens[2], \"commit\") == 0)) {\n+\t\t\tcmd_pipeline_commit(tokens, n_tokens, out,\n+\t\t\t\tout_size, obj);\n+\t\t\treturn;\n+\t\t}\n+\n \t\tif ((n_tokens >= 3) &&\n-\t\t\t(strcmp(tokens[2], \"table\") == 0)) {\n-\t\t\tcmd_pipeline_table_update(tokens, n_tokens, out,\n+\t\t\t(strcmp(tokens[2], \"abort\") == 0)) {\n+\t\t\tcmd_pipeline_abort(tokens, n_tokens, out,\n \t\t\t\tout_size, obj);\n \t\t\treturn;\n \t\t}\ndiff --git a/examples/pipeline/examples/vxlan.cli b/examples/pipeline/examples/vxlan.cli\nindex 7bf4a5757..a3bde6a9f 100644\n--- a/examples/pipeline/examples/vxlan.cli\n+++ b/examples/pipeline/examples/vxlan.cli\n@@ -22,6 +22,7 @@ pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32\n pipeline PIPELINE0 port out 4 sink none\n \n pipeline PIPELINE0 build ./examples/pipeline/examples/vxlan.spec\n-pipeline PIPELINE0 table vxlan_table update ./examples/pipeline/examples/vxlan_table.txt none none\n+pipeline PIPELINE0 table vxlan_table add ./examples/pipeline/examples/vxlan_table.txt\n+pipeline PIPELINE0 commit\n \n thread 1 pipeline PIPELINE0 enable\ndiff --git a/examples/pipeline/examples/vxlan_pcap.cli b/examples/pipeline/examples/vxlan_pcap.cli\nindex 1636ba080..3cc9a94af 100644\n--- a/examples/pipeline/examples/vxlan_pcap.cli\n+++ b/examples/pipeline/examples/vxlan_pcap.cli\n@@ -17,6 +17,7 @@ pipeline PIPELINE0 port out 3 sink none\n pipeline PIPELINE0 port out 4 sink none\n \n pipeline PIPELINE0 build ./examples/vxlan.spec\n-pipeline PIPELINE0 table vxlan_table update ./examples/vxlan_table.txt none none\n+pipeline PIPELINE0 table vxlan_table add ./examples/vxlan_table.txt\n+pipeline PIPELINE0 commit\n \n thread 1 pipeline PIPELINE0 enable\n",
    "prefixes": [
        "1/5"
    ]
}