get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 45466,
    "url": "http://patches.dpdk.org/api/patches/45466/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180927003256.6901-2-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-2-dg@adax.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180927003256.6901-2-dg@adax.com",
    "date": "2018-09-27T00:32:51",
    "name": "[v3,1/6] kni: add API to set link status on kernel interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "63c2d140b0f070972d31f0eeaf9b2f3ce2f8b82b",
    "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-2-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/45466/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/45466/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 B2DC81B272;\n\tThu, 27 Sep 2018 02:34:14 +0200 (CEST)",
            "from mail-qk1-f176.google.com (mail-qk1-f176.google.com\n\t[209.85.222.176]) by dpdk.org (Postfix) with ESMTP id 5D1FE1B213\n\tfor <dev@dpdk.org>; Thu, 27 Sep 2018 02:34:04 +0200 (CEST)",
            "by mail-qk1-f176.google.com with SMTP id q12-v6so522666qkl.13\n\tfor <dev@dpdk.org>; Wed, 26 Sep 2018 17:34:04 -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.00\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 26 Sep 2018 17:34:02 -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=PlH/VAfIrUGq17Kvr2neDS51vqfEwcHSM70/Jy2B3NE=;\n\tb=jH4xuT7IpWHZwgFkuw8NrXmt35YOBwN+qeJQRmr33xHlEXsGXdzxC5ngywB9DOHlB/\n\tuib0BCQCamSlXWMroSjdpRWillX6P40LtFL2lcth8s/SB4bukAtgZH6+rmJStOOTIWnI\n\taxB6ZVDbDS3iprkOalQTbW/Pk8s9cMgaIuB0znlAsB6a3gdMhQMerOprsMkpolryWLOB\n\t4gFDoZ+FP4aMIf+eMk+vUB/ocQZkjbaFe/xDujmXOYHBinBIo3xmVjKgTMUNeFJIAZzT\n\tbUlQJCMAmpxE5+NiK4TCncEGPq2NRwSotb133aTd9bHL4bkhcT1vsaGaRVWMNlI/ol20\n\tRTFw==",
        "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=PlH/VAfIrUGq17Kvr2neDS51vqfEwcHSM70/Jy2B3NE=;\n\tb=m8RyVtNY8lJGaWngsM98WyT1JZKuCHzrCJTfQWhhYK9dccYJJktkfGx1nX3Ygsw+WK\n\tzY3avaFOAngn9bOCpPu6NMPjFYz5Ul82HyVpplpuXcT1G8nfd2w77oeW/6liCBq0C6St\n\ti427BKU72exWHcSGrlL0pyCpwDtrpp5YRInwExdZZuLhvYjXPk9/Ttd8V1yrziopzkw7\n\tr+eTjGKM2Ks17LaKfpZKfJn2mz47iW4724TiybpbdF7FxoKBE7fRoIWoAoTfWhrQtiF5\n\tYaHzkWGCL+aV5+OpPP82kaHBLkwSNJjfo+50CdpXyuWmj8s5Dmu8ETzajFh32O+AWCwT\n\th4GQ==",
        "X-Gm-Message-State": "ABuFfoiZZg46FJDtpvkbcwPi6ytFnAYy9GHjauGupGKzNE9y2h7w2bv0\n\twC8HZDXTFKKmIaKxFS0AuU+H2AsA",
        "X-Google-Smtp-Source": "ACcGV60F5ANhfU20GVWeRpk05nnP23KTpJ2P8dr1eHYjdMod+oGkM3f4IfRqW0/yuzOJqb7oVZb9FA==",
        "X-Received": "by 2002:a37:30d4:: with SMTP id\n\tw203-v6mr2829130qkw.106.1538008443306; \n\tWed, 26 Sep 2018 17:34:03 -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:51 -0300",
        "Message-Id": "<20180927003256.6901-2-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 1/6] kni: add API to set link status on kernel\n\tinterface",
        "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": "Add a new API function to KNI, rte_kni_update_link() to allow DPDK\napplications to update the link status for KNI network interfaces in\nthe linux kernel.\n\nSigned-off-by: Dan Gora <dg@adax.com>\n---\n lib/librte_kni/rte_kni.c           | 57 ++++++++++++++++++++++++++++++\n lib/librte_kni/rte_kni.h           | 18 ++++++++++\n lib/librte_kni/rte_kni_version.map |  6 ++++\n 3 files changed, 81 insertions(+)",
    "diff": "diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c\nindex 65f6a2b03..0c3e17dbb 100644\n--- a/lib/librte_kni/rte_kni.c\n+++ b/lib/librte_kni/rte_kni.c\n@@ -790,6 +790,63 @@ rte_kni_unregister_handlers(struct rte_kni *kni)\n \n \treturn 0;\n }\n+\n+int __rte_experimental\n+rte_kni_update_link(struct rte_kni *kni, struct rte_eth_link *link)\n+{\n+\tchar path[64];\n+\tchar carrier[2];\n+\tconst char *new_carrier;\n+\tint fd, ret;\n+\n+\tif (kni == NULL || link == NULL)\n+\t\treturn -1;\n+\n+\tsnprintf(path, sizeof(path), \"/sys/devices/virtual/net/%s/carrier\",\n+\t\tkni->name);\n+\n+\tfd = open(path, O_RDWR);\n+\tif (fd == -1) {\n+\t\tRTE_LOG(ERR, KNI, \"Failed to open file: %s.\\n\", path);\n+\t\treturn -1;\n+\t}\n+\n+\tret = read(fd, carrier, 2);\n+\tif (ret < 1) {\n+\t\t/* Cannot read carrier until interface is marked\n+\t\t * 'up', so don't log an error.\n+\t\t */\n+\t\tclose(fd);\n+\t\treturn -1;\n+\t}\n+\n+\tnew_carrier = (link->link_status == ETH_LINK_UP) ? \"1\" : \"0\";\n+\tret = write(fd, new_carrier, 1);\n+\tif (ret < 1) {\n+\t\tRTE_LOG(ERR, KNI, \"Failed to write file: %s.\\n\", path);\n+\t\tclose(fd);\n+\t\treturn -1;\n+\t}\n+\n+\tif (strncmp(carrier, new_carrier, 1)) {\n+\t\tif (link->link_status == ETH_LINK_UP) {\n+\t\t\tRTE_LOG(INFO, KNI, \"%s NIC Link is Up %d Mbps %s %s.\\n\",\n+\t\t\t\tkni->name,\n+\t\t\t\tlink->link_speed,\n+\t\t\t\tlink->link_autoneg ? \"(AutoNeg)\" : \"(Fixed)\",\n+\t\t\t\tlink->link_duplex ?\n+\t\t\t\t\t\"Full Duplex\" : \"Half Duplex\");\n+\t\t} else {\n+\t\t\tRTE_LOG(INFO, KNI, \"%s NIC Link is Down.\\n\",\n+\t\t\t\tkni->name);\n+\t\t}\n+\t}\n+\n+\tclose(fd);\n+\n+\treturn 0;\n+}\n+\n void\n rte_kni_close(void)\n {\ndiff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h\nindex 99055e2c2..4118ae97a 100644\n--- a/lib/librte_kni/rte_kni.h\n+++ b/lib/librte_kni/rte_kni.h\n@@ -21,6 +21,7 @@\n #include <rte_memory.h>\n #include <rte_mempool.h>\n #include <rte_ether.h>\n+#include <rte_ethdev.h>\n \n #include <exec-env/rte_kni_common.h>\n \n@@ -228,6 +229,23 @@ int rte_kni_register_handlers(struct rte_kni *kni, struct rte_kni_ops *ops);\n  */\n int rte_kni_unregister_handlers(struct rte_kni *kni);\n \n+/**\n+ * Update link status info for KNI port.\n+ *\n+ * Update the linkup/linkdown status of a KNI interface in the kernel.\n+ *\n+ * @param kni\n+ *  pointer to struct rte_kni.\n+ * @param link\n+ *  pointer to struct rte_eth_link containing new interface status.\n+ *\n+ * @return\n+ *  On success: 0\n+ *  On failure: -1\n+ */\n+int __rte_experimental\n+rte_kni_update_link(struct rte_kni *kni, struct rte_eth_link *link);\n+\n /**\n  *  Close KNI device.\n  */\ndiff --git a/lib/librte_kni/rte_kni_version.map b/lib/librte_kni/rte_kni_version.map\nindex acd515eb0..c877dc6aa 100644\n--- a/lib/librte_kni/rte_kni_version.map\n+++ b/lib/librte_kni/rte_kni_version.map\n@@ -15,3 +15,9 @@ DPDK_2.0 {\n \n \tlocal: *;\n };\n+\n+EXPERIMENTAL {\n+\tglobal:\n+\n+\trte_kni_update_link;\n+};\n",
    "prefixes": [
        "v3",
        "1/6"
    ]
}