get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 45469,
    "url": "http://patches.dpdk.org/api/patches/45469/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180927003256.6901-5-dg@adax.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": "<20180927003256.6901-5-dg@adax.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180927003256.6901-5-dg@adax.com",
    "date": "2018-09-27T00:32:54",
    "name": "[v3,4/6] examples/kni: monitor and update link status continually",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5df81bad706092716336661f12a317c2048a8d91",
    "submitter": {
        "id": 1040,
        "url": "http://patches.dpdk.org/api/people/1040/?format=api",
        "name": "Dan Gora",
        "email": "dg@adax.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180927003256.6901-5-dg@adax.com/mbox/",
    "series": [
        {
            "id": 1530,
            "url": "http://patches.dpdk.org/api/series/1530/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1530",
            "date": "2018-09-27T00:32:50",
            "name": "kni: add API to set link status on kernel interface",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/1530/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/45469/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/45469/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 C46981B39B;\n\tThu, 27 Sep 2018 02:34:20 +0200 (CEST)",
            "from mail-qt1-f181.google.com (mail-qt1-f181.google.com\n\t[209.85.160.181]) by dpdk.org (Postfix) with ESMTP id 3AB521B1C1\n\tfor <dev@dpdk.org>; Thu, 27 Sep 2018 02:34:13 +0200 (CEST)",
            "by mail-qt1-f181.google.com with SMTP id z14-v6so993249qtn.2\n\tfor <dev@dpdk.org>; Wed, 26 Sep 2018 17:34:13 -0700 (PDT)",
            "from snappy.local.lan (189-46-124-178.dsl.telesp.net.br.\n\t[189.46.124.178]) by smtp.gmail.com with ESMTPSA id\n\tx26-v6sm463053qth.15.2018.09.26.17.34.09\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 26 Sep 2018 17:34:11 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=pLLLNP8XDuEHY0ULln1BKY4tSmTgFpDovLSjwzzDUAk=;\n\tb=LlaCbo7rYsD/8kM1wwqYExhzMzd9F67Z9Tbtv058GLS5VL41FyvyC7DDskLxWWvRgV\n\tegEjixqAUymsfrVyclqBZHPr5qtCdJGhQ6u8V0AN8U6xukWdwebjYhGBgt6zOU6ZbgjK\n\t3eJGn6YY1UYfr3LoqbD0eaMnlFCcnvuEZhyLT/9CZqMs5sG77RulNwaWqE03SiqjSK2T\n\tJvnBBLmvvFhJlJOOM0cOXVtb9zRnaM12zvTt4jjdrcQKIlJeJOvPf3S9qyTSf9vuC8cC\n\tECu/CKwaTRRdzwK4NUOLJBtQFosq/mLUShL8ImA+iRCvwgK2g1K2PhNiTDGQ6t8iluAR\n\tBkOQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=pLLLNP8XDuEHY0ULln1BKY4tSmTgFpDovLSjwzzDUAk=;\n\tb=FhvUZ+OmhjZLifR1M1rauTtOgisXGl6LEZ1x+RGQAqEO/VOZ8P/Ob4JRas9snqS3yT\n\tp1/ob5OvC5yq9yyuqtFqG9zdEllonbYi0VnXlhJhb6nuQU7dadz8jK0hER1uXPm6SUk1\n\tNL+LjzYPQQ87oRdt/Dh2uNXza226HEUoF6+0E135/8NIWLDEcByn4dZ3Flsp/oM/M6SP\n\t8kWMjWSEYmCL0rs4eTO5IKrSfj4BpptFaelQkIzBNTNCkSAsTtKVXjaQn5PxgzIkvEAh\n\tLPXjR3GJBMVt1InqFRi9g5WVd3Tp6KyXegR6sqLm3P56fGybOAxy7Xh4bWXZKvvKANIG\n\tmedw==",
        "X-Gm-Message-State": "ABuFfoi24UipoBYfIzrgI33vlHQNLSMv7zylVDfZh0gUJxORSg+NuPoo\n\tGxifwcUeT1QZS11C8Sr0gr68pIde",
        "X-Google-Smtp-Source": "ACcGV6341WjEpt1F6u3a9Jtnp9Vf5dV4QaRC/qb5mc578RLX5pRRFAvK5gwPFC9yYW5jnsBNn5vqDg==",
        "X-Received": "by 2002:ac8:29ef:: with SMTP id\n\t44-v6mr6338172qtt.174.1538008452235; \n\tWed, 26 Sep 2018 17:34:12 -0700 (PDT)",
        "From": "Dan Gora <dg@adax.com>",
        "To": "dev@dpdk.org",
        "Cc": "Igor Ryzhov <iryzhov@nfware.com>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tFerruh Yigit <ferruh.yigit@intel.com>, Dan Gora <dg@adax.com>",
        "Date": "Wed, 26 Sep 2018 21:32:54 -0300",
        "Message-Id": "<20180927003256.6901-5-dg@adax.com>",
        "X-Mailer": "git-send-email 2.19.0",
        "In-Reply-To": "<20180927003256.6901-1-dg@adax.com>",
        "References": "<20180911232906.18352-1-dg@adax.com>\n\t<20180927003256.6901-1-dg@adax.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 4/6] examples/kni: monitor and update link\n\tstatus continually",
        "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://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Update KNI example to continuously monitor the Ethernet link status\nof the physical link and update the link status of the corresponding\ninterfaces with rte_kni_update_link().\n\nSigned-off-by: Dan Gora <dg@adax.com>\n---\n examples/kni/Makefile |  2 ++\n examples/kni/main.c   | 73 +++++++++++++++++--------------------------\n 2 files changed, 31 insertions(+), 44 deletions(-)",
    "diff": "diff --git a/examples/kni/Makefile b/examples/kni/Makefile\nindex 7e19d2e2a..dd90d7d73 100644\n--- a/examples/kni/Makefile\n+++ b/examples/kni/Makefile\n@@ -20,6 +20,7 @@ static: build/$(APP)-static\n \n PC_FILE := $(shell pkg-config --path libdpdk)\n CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)\n LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)\n \n@@ -54,6 +55,7 @@ please change the definition of the RTE_TARGET environment variable)\n endif\n \n CFLAGS += -O3\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n CFLAGS += $(WERROR_FLAGS)\n \n include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/examples/kni/main.c b/examples/kni/main.c\nindex 80c401c51..be721b9cc 100644\n--- a/examples/kni/main.c\n+++ b/examples/kni/main.c\n@@ -107,6 +107,8 @@ static uint32_t ports_mask = 0;\n /* Ports set in promiscuous mode off by default. */\n static int promiscuous_on = 0;\n \n+static int kni_running;\n+\n /* Structure type for recording kni interface specific stats */\n struct kni_interface_stats {\n \t/* number of pkts received from NIC, and sent to KNI */\n@@ -619,59 +621,31 @@ init_port(uint16_t port)\n \t\trte_eth_promiscuous_enable(port);\n }\n \n-/* Check the link status of all ports in up to 9s, and print them finally */\n-static void\n-check_all_ports_link_status(uint32_t port_mask)\n+/*\n+ * Monitor the link status of all ports and update the\n+ * corresponding KNI interface(s)\n+ */\n+static void *\n+check_all_ports_link_status(void *arg)\n {\n-#define CHECK_INTERVAL 100 /* 100ms */\n-#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */\n \tuint16_t portid;\n-\tuint8_t count, all_ports_up, print_flag = 0;\n \tstruct rte_eth_link link;\n+\tunsigned int i;\n+\tstruct kni_port_params **p = kni_port_params_array;\n+\t(void) arg;\n \n-\tprintf(\"\\nChecking link status\\n\");\n-\tfflush(stdout);\n-\tfor (count = 0; count <= MAX_CHECK_TIME; count++) {\n-\t\tall_ports_up = 1;\n+\twhile (kni_running) {\n+\t\trte_delay_ms(100);\n \t\tRTE_ETH_FOREACH_DEV(portid) {\n-\t\t\tif ((port_mask & (1 << portid)) == 0)\n+\t\t\tif ((ports_mask & (1 << portid)) == 0)\n \t\t\t\tcontinue;\n \t\t\tmemset(&link, 0, sizeof(link));\n \t\t\trte_eth_link_get_nowait(portid, &link);\n-\t\t\t/* print link status if flag set */\n-\t\t\tif (print_flag == 1) {\n-\t\t\t\tif (link.link_status)\n-\t\t\t\t\tprintf(\n-\t\t\t\t\t\"Port%d Link Up - speed %uMbps - %s\\n\",\n-\t\t\t\t\t\tportid, link.link_speed,\n-\t\t\t\t(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?\n-\t\t\t\t\t(\"full-duplex\") : (\"half-duplex\\n\"));\n-\t\t\t\telse\n-\t\t\t\t\tprintf(\"Port %d Link Down\\n\", portid);\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\t/* clear all_ports_up flag if any link down */\n-\t\t\tif (link.link_status == ETH_LINK_DOWN) {\n-\t\t\t\tall_ports_up = 0;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n-\t\t/* after finally printing all link status, get out */\n-\t\tif (print_flag == 1)\n-\t\t\tbreak;\n-\n-\t\tif (all_ports_up == 0) {\n-\t\t\tprintf(\".\");\n-\t\t\tfflush(stdout);\n-\t\t\trte_delay_ms(CHECK_INTERVAL);\n-\t\t}\n-\n-\t\t/* set the print_flag if all ports up or timeout */\n-\t\tif (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1)) {\n-\t\t\tprint_flag = 1;\n-\t\t\tprintf(\"done\\n\");\n+\t\t\tfor (i = 0; i < p[portid]->nb_kni; i++)\n+\t\t\t\trte_kni_update_link(p[portid]->kni[i], &link);\n \t\t}\n \t}\n+\treturn NULL;\n }\n \n /* Callback for request of changing MTU */\n@@ -893,6 +867,8 @@ main(int argc, char** argv)\n \tint ret;\n \tuint16_t nb_sys_ports, port;\n \tunsigned i;\n+\tvoid *retval;\n+\tpthread_t kni_link_tid;\n \n \t/* Associate signal_hanlder function with USR signals */\n \tsignal(SIGUSR1, signal_handler);\n@@ -947,7 +923,14 @@ main(int argc, char** argv)\n \n \t\tkni_alloc(port);\n \t}\n-\tcheck_all_ports_link_status(ports_mask);\n+\n+\tkni_running = 1;\n+\tret = rte_ctrl_thread_create(&kni_link_tid,\n+\t\t\t\t     \"KNI link status check\", NULL,\n+\t\t\t\t     check_all_ports_link_status, NULL);\n+\tif (ret < 0)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"Could not create link status thread!\\n\");\n \n \t/* Launch per-lcore function on every lcore */\n \trte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);\n@@ -955,6 +938,8 @@ main(int argc, char** argv)\n \t\tif (rte_eal_wait_lcore(i) < 0)\n \t\t\treturn -1;\n \t}\n+\tkni_running = 0;\n+\tpthread_join(kni_link_tid, &retval);\n \n \t/* Release resources */\n \tRTE_ETH_FOREACH_DEV(port) {\n",
    "prefixes": [
        "v3",
        "4/6"
    ]
}