get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 36014,
    "url": "https://patches.dpdk.org/api/patches/36014/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180312172615.6621-24-jasvinder.singh@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": "<20180312172615.6621-24-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180312172615.6621-24-jasvinder.singh@intel.com",
    "date": "2018-03-12T17:25:54",
    "name": "[dpdk-dev,v2,23/44] ip_pipeline: add tap object",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "aa35f250fa999c54a46c73e7f0b0ac012027b3ec",
    "submitter": {
        "id": 285,
        "url": "https://patches.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180312172615.6621-24-jasvinder.singh@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/36014/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/36014/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6303B1AFF2;\n\tMon, 12 Mar 2018 18:52:55 +0100 (CET)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id AFA847D30\n\tfor <dev@dpdk.org>; Mon, 12 Mar 2018 18:52:32 +0100 (CET)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Mar 2018 10:26:51 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby orsmga004.jf.intel.com with ESMTP; 12 Mar 2018 10:26:50 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.47,462,1515484800\"; d=\"scan'208\";a=\"182012973\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com,\n\tKevin Laatz <kevin.laatz@intel.com>",
        "Date": "Mon, 12 Mar 2018 17:25:54 +0000",
        "Message-Id": "<20180312172615.6621-24-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180312172615.6621-1-jasvinder.singh@intel.com>",
        "References": "<20180309182426.135278-2-jasvinder.singh@intel.com>\n\t<20180312172615.6621-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 23/44] ip_pipeline: add tap object",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add tap object implementation to the application\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\n---\n examples/ip_pipeline/Makefile    |  1 +\n examples/ip_pipeline/cli.c       | 32 +++++++++++++\n examples/ip_pipeline/main.c      |  8 ++++\n examples/ip_pipeline/meson.build |  1 +\n examples/ip_pipeline/tap.c       | 97 ++++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/tap.h       | 29 ++++++++++++\n 6 files changed, 168 insertions(+)\n create mode 100644 examples/ip_pipeline/tap.c\n create mode 100644 examples/ip_pipeline/tap.h",
    "diff": "diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile\nindex 35e4302..0f6bb78 100644\n--- a/examples/ip_pipeline/Makefile\n+++ b/examples/ip_pipeline/Makefile\n@@ -12,6 +12,7 @@ SRCS-y += main.c\n SRCS-y += mempool.c\n SRCS-y += parser.c\n SRCS-y += swq.c\n+SRCS-y += tap.c\n SRCS-y += tmgr.c\n #SRCS-y += thread.c\n \ndiff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c\nindex c6111e7..b6c5269 100644\n--- a/examples/ip_pipeline/cli.c\n+++ b/examples/ip_pipeline/cli.c\n@@ -14,6 +14,7 @@\n #include \"mempool.h\"\n #include \"parser.h\"\n #include \"swq.h\"\n+#include \"tap.h\"\n #include \"tmgr.h\"\n \n #ifndef CMD_MAX_TOKENS\n@@ -603,6 +604,32 @@ cmd_tmgr_subport_pipe(char **tokens,\n \t}\n }\n \n+/**\n+ * tap <tap_name>\n+ */\n+static void\n+cmd_tap(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tchar *name;\n+\tstruct tap *tap;\n+\n+\tif (n_tokens != 2) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tname = tokens[1];\n+\n+\ttap = tap_create(name);\n+\tif (tap == NULL) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n void\n cli_process(char *in, char *out, size_t out_size)\n {\n@@ -671,6 +698,11 @@ cli_process(char *in, char *out, size_t out_size)\n \t\treturn;\n \t}\n \n+\tif (strcmp(tokens[0], \"tap\") == 0) {\n+\t\tcmd_tap(tokens, n_tokens, out, out_size);\n+\t\treturn;\n+\t}\n+\n \tsnprintf(out, out_size, MSG_CMD_UNKNOWN, tokens[0]);\n }\n \ndiff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c\nindex 490991f..33c3354 100644\n--- a/examples/ip_pipeline/main.c\n+++ b/examples/ip_pipeline/main.c\n@@ -15,6 +15,7 @@\n #include \"link.h\"\n #include \"mempool.h\"\n #include \"swq.h\"\n+#include \"tap.h\"\n #include \"tmgr.h\"\n \n static const char usage[] =\n@@ -191,6 +192,13 @@ main(int argc, char **argv)\n \t\treturn status;\n \t}\n \n+\t/* TAP */\n+\tstatus = tap_init();\n+\tif (status) {\n+\t\tprintf(\"Error: TAP initialization failed (%d)\\n\", status);\n+\t\treturn status;\n+\t}\n+\n \t/* Script */\n \tif (app.script_name)\n \t\tcli_script_process(app.script_name,\ndiff --git a/examples/ip_pipeline/meson.build b/examples/ip_pipeline/meson.build\nindex cb2154c..e875811 100644\n--- a/examples/ip_pipeline/meson.build\n+++ b/examples/ip_pipeline/meson.build\n@@ -15,5 +15,6 @@ sources = files(\n \t'mempool.c',\n \t'parser.c',\n \t'swq.c',\n+\t'tap.c',\n \t'tmgr.c'\n )\ndiff --git a/examples/ip_pipeline/tap.c b/examples/ip_pipeline/tap.c\nnew file mode 100644\nindex 0000000..5b34032\n--- /dev/null\n+++ b/examples/ip_pipeline/tap.c\n@@ -0,0 +1,97 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2018 Intel Corporation\n+ */\n+\n+#include <netinet/in.h>\n+#ifdef RTE_EXEC_ENV_LINUXAPP\n+#include <linux/if.h>\n+#include <linux/if_tun.h>\n+#endif\n+#include <sys/ioctl.h>\n+\n+#include <fcntl.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <unistd.h>\n+\n+#include \"tap.h\"\n+\n+#define TAP_DEV                                            \"/dev/net/tun\"\n+\n+static struct tap_list tap_list;\n+\n+int\n+tap_init(void)\n+{\n+\tTAILQ_INIT(&tap_list);\n+\n+\treturn 0;\n+}\n+\n+struct tap *\n+tap_find(const char *name)\n+{\n+\tstruct tap *tap;\n+\n+\tif (name == NULL)\n+\t\treturn NULL;\n+\n+\tTAILQ_FOREACH(tap, &tap_list, node)\n+\t\tif (strcmp(tap->name, name) == 0)\n+\t\t\treturn tap;\n+\n+\treturn NULL;\n+}\n+\n+#ifndef RTE_EXEC_ENV_LINUXAPP\n+\n+struct tap *\n+tap_create(const char *name __rte_unused)\n+{\n+\treturn NULL;\n+}\n+\n+#else\n+\n+struct tap *\n+tap_create(const char *name)\n+{\n+\tstruct tap *tap;\n+\tstruct ifreq ifr;\n+\tint fd, status;\n+\n+\t/* Check input params */\n+\tif ((name == NULL) ||\n+\t\ttap_find(name))\n+\t\treturn NULL;\n+\n+\t/* Resource create */\n+\tfd = open(TAP_DEV, O_RDWR | O_NONBLOCK);\n+\tif (fd < 0)\n+\t\treturn NULL;\n+\n+\tmemset(&ifr, 0, sizeof(ifr));\n+\tifr.ifr_flags = IFF_TAP | IFF_NO_PI; /* No packet information */\n+\tsnprintf(ifr.ifr_name, IFNAMSIZ, \"%s\", name);\n+\n+\tstatus = ioctl(fd, TUNSETIFF, (void *) &ifr);\n+\tif (status < 0)\n+\t\treturn NULL;\n+\n+\t/* Node allocation */\n+\ttap = calloc(1, sizeof(struct tap));\n+\tif (tap == NULL)\n+\t\treturn NULL;\n+\n+\t/* Node fill in */\n+\tstrncpy(tap->name, name, sizeof(tap->name));\n+\ttap->fd = fd;\n+\n+\t/* Node add to list */\n+\tTAILQ_INSERT_TAIL(&tap_list, tap, node);\n+\n+\treturn tap;\n+}\n+\n+#endif\ndiff --git a/examples/ip_pipeline/tap.h b/examples/ip_pipeline/tap.h\nnew file mode 100644\nindex 0000000..0dce72f\n--- /dev/null\n+++ b/examples/ip_pipeline/tap.h\n@@ -0,0 +1,29 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2018 Intel Corporation\n+ */\n+\n+#ifndef _INCLUDE_TAP_H_\n+#define _INCLUDE_TAP_H_\n+\n+#include <sys/queue.h>\n+\n+#include \"common.h\"\n+\n+struct tap {\n+\tTAILQ_ENTRY(tap) node;\n+\tchar name[NAME_SIZE];\n+\tint fd;\n+};\n+\n+TAILQ_HEAD(tap_list, tap);\n+\n+int\n+tap_init(void);\n+\n+struct tap *\n+tap_find(const char *name);\n+\n+struct tap *\n+tap_create(const char *name);\n+\n+#endif /* _INCLUDE_TAP_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "23/44"
    ]
}