get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 49759,
    "url": "https://patches.dpdk.org/api/patches/49759/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190111203520.19944-6-stephen@networkplumber.org/",
    "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": "<20190111203520.19944-6-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190111203520.19944-6-stephen@networkplumber.org",
    "date": "2019-01-11T20:35:18",
    "name": "[v2,5/7] net/tap: let kernel choose tun device name",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1b6c3d4eaa9fb61b8e8a9cae62b9a324f2647a81",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190111203520.19944-6-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 3139,
            "url": "https://patches.dpdk.org/api/series/3139/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=3139",
            "date": "2019-01-11T20:35:13",
            "name": "net/tap: fixes and cleanups",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/3139/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/49759/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/49759/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 940AC1BBE6;\n\tFri, 11 Jan 2019 21:35:38 +0100 (CET)",
            "from mail-pl1-f195.google.com (mail-pl1-f195.google.com\n\t[209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 54F931BB9A\n\tfor <dev@dpdk.org>; Fri, 11 Jan 2019 21:35:34 +0100 (CET)",
            "by mail-pl1-f195.google.com with SMTP id p8so7257225plo.2\n\tfor <dev@dpdk.org>; Fri, 11 Jan 2019 12:35:34 -0800 (PST)",
            "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\tf32sm96610438pgf.80.2019.01.11.12.35.31\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 11 Jan 2019 12:35:32 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=h9HkD8ZLwGy2kyuiB1QX6Db1tBcyNluhse7XiIZQrB8=;\n\tb=UXVX779ktNQWA2gTcDSifG4szJELaytHP92xCjbCbukykRJyUtaLfQZDN9+ZcuNFhE\n\tY3orpd7XeDKeCRkuBc7va5UnIRSHP9pUB4KgS9JoKK0BI6PxNbcuTnvmq8+zt9k+H+K0\n\t6dYrbt8su9/ofQ6EDnWxnxD66/+ORHkzg8509yP8jAkZYybCu2F9/FT6dXMkN1kiQ4DQ\n\tPOfpZ94r7uRwltAzhNRrJJJhpys6KLnauQ/Xo72xBEwJpYy6DSsx9XJrYMpayWK3946B\n\tl3SLUWEHKxy5c1S/cV6THqNRY/5M/HExq1Ajj5MFsOqEHL0gbV9d94YH6gsna9tPlUPe\n\tA4zQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=h9HkD8ZLwGy2kyuiB1QX6Db1tBcyNluhse7XiIZQrB8=;\n\tb=PW1LsIH7wxPTSWtCesB3zVqjZNiRVXUz14SmW6dmY9pFPpG+B1SilJwsbuD8gcCABt\n\toDQNp1mCPsQFk4LWGw0jiIIZxMr0lciMEagVNivyUrbjXubtxya34ADTgehV/DDI7rxj\n\tsiUAybLy0X/ToZlrQbYYH6n1WWEireawazr0essphbNjDv8c/S5adZ/1FnI3d9XgUkxw\n\tGB7cvinPfolXhMBeF0Uxxg4a2CG6x3gxSTeb6GXiElV0YW4G9J5CwBQasuNowkLd7a6U\n\t2u2hmIufnFKNIbXfJYuJfCbyVOuVxTs92kH+Hk1j5JiXjGCuyMOJC6hVCAP6Ek4hhBU0\n\tRkIQ==",
        "X-Gm-Message-State": "AJcUukd71V18xYjBK2xj6emSCGEPS+qYOlt1I3/CZIk4E7L67bC5SQdF\n\t5N+aRm6Yye2pPS5DMrojuIEm8A==",
        "X-Google-Smtp-Source": "ALg8bN6scL/ZqX6TphCwTSiAgyFFF8HWk9DP1V3w+ZuRQV2KVNjzqt7VsyRzfZECHOXKgnnTzANsIg==",
        "X-Received": "by 2002:a17:902:4523:: with SMTP id\n\tm32mr15996795pld.53.1547238933474; \n\tFri, 11 Jan 2019 12:35:33 -0800 (PST)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "keith.wiles@intel.com",
        "Cc": "dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,\n\thfli@netitest.com",
        "Date": "Fri, 11 Jan 2019 12:35:18 -0800",
        "Message-Id": "<20190111203520.19944-6-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190111203520.19944-1-stephen@networkplumber.org>",
        "References": "<20190111180659.5972-1-stephen@networkplumber.org>\n\t<20190111203520.19944-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 5/7] net/tap: let kernel choose tun device name",
        "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": "Assigning tun and tap index in DPDK tap device driver is racy\nand fails if used with primary/secondary. Instead use the kernel\nfeature of device wildcarding where if a name with %d is used\nthe kernel will fill in the next available device.\n\nReported-by: hfli@netitest.com\nFixes: 02f96a0a82d1 (\"net/tap: add TUN/TAP device PMD\")\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\nAcked-by Keith Wiles <keith.wiles@intel.com>\n---\n drivers/net/tap/rte_eth_tap.c | 33 +++++++++++++++++----------------\n 1 file changed, 17 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c\nindex d699b4fb095d..ed8483cb96bc 100644\n--- a/drivers/net/tap/rte_eth_tap.c\n+++ b/drivers/net/tap/rte_eth_tap.c\n@@ -79,9 +79,6 @@ static const char *valid_arguments[] = {\n \tNULL\n };\n \n-static unsigned int tap_unit;\n-static unsigned int tun_unit;\n-\n static char tuntap_name[8];\n \n static volatile uint32_t tap_trigger;\t/* Rx trigger */\n@@ -151,8 +148,6 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive)\n \t\tIFF_TAP : IFF_TUN | IFF_POINTOPOINT;\n \tstrlcpy(ifr.ifr_name, pmd->name, IFNAMSIZ);\n \n-\tTAP_LOG(DEBUG, \"ifr_name '%s'\", ifr.ifr_name);\n-\n \tfd = open(TUN_TAP_DEV_PATH, O_RDWR);\n \tif (fd < 0) {\n \t\tTAP_LOG(ERR, \"Unable to create %s interface\", tuntap_name);\n@@ -186,6 +181,13 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive)\n \t\tgoto error;\n \t}\n \n+\t/*\n+\t * Name passed to kernel might be wildcard like dtun%d\n+\t * and need to find the resulting device.\n+\t */\n+\tTAP_LOG(DEBUG, \"Device name is '%s'\", ifr.ifr_name);\n+\tstrlcpy(pmd->name, ifr.ifr_name, RTE_ETH_NAME_MAX_LEN);\n+\n \tif (is_keepalive) {\n \t\t/*\n \t\t * Detach the TUN/TAP keep-alive queue\n@@ -1756,6 +1758,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,\n \t\tTAP_LOG(ERR, \"Unable to create %s interface\", tuntap_name);\n \t\tgoto error_exit;\n \t}\n+\tTAP_LOG(DEBUG, \"allocated %s\", pmd->name);\n \n \tifr.ifr_mtu = dev->data->mtu;\n \tif (tap_ioctl(pmd, SIOCSIFMTU, &ifr, 1, LOCAL_AND_REMOTE) < 0)\n@@ -1918,8 +1921,8 @@ set_interface_name(const char *key __rte_unused,\n \t\t}\n \t\tstrlcpy(name, value, RTE_ETH_NAME_MAX_LEN);\n \t} else {\n-\t\tsnprintf(name, RTE_ETH_NAME_MAX_LEN, \"%s%d\",\n-\t\t\t DEFAULT_TAP_NAME, tap_unit - 1);\n+\t\t/* use tap%d which causes kernel to choose next available */\n+\t\tstrlcpy(name, DEFAULT_TAP_NAME \"%d\", RTE_ETH_NAME_MAX_LEN);\n \t}\n \treturn 0;\n }\n@@ -2032,8 +2035,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)\n \t\treturn 0;\n \t}\n \n-\tsnprintf(tun_name, sizeof(tun_name), \"%s%u\",\n-\t\t DEFAULT_TUN_NAME, tun_unit++);\n+\t/* use tun%d which causes kernel to choose next available */\n+\tstrlcpy(tun_name, DEFAULT_TUN_NAME \"%d\", RTE_ETH_NAME_MAX_LEN);\n \n \tif (params && (params[0] != '\\0')) {\n \t\tTAP_LOG(DEBUG, \"parameters (%s)\", params);\n@@ -2053,17 +2056,15 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)\n \t}\n \tpmd_link.link_speed = ETH_SPEED_NUM_10G;\n \n-\tTAP_LOG(DEBUG, \"Initializing pmd_tun for %s as %s\",\n-\t\tname, tun_name);\n+\tTAP_LOG(DEBUG, \"Initializing pmd_tun for %s\", name);\n \n \tret = eth_dev_tap_create(dev, tun_name, remote_iface, 0,\n-\t\tETH_TUNTAP_TYPE_TUN);\n+\t\t\t\t ETH_TUNTAP_TYPE_TUN);\n \n leave:\n \tif (ret == -1) {\n \t\tTAP_LOG(ERR, \"Failed to create pmd for %s as %s\",\n \t\t\tname, tun_name);\n-\t\ttun_unit--; /* Restore the unit number */\n \t}\n \trte_kvargs_free(kvlist);\n \n@@ -2219,8 +2220,9 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)\n \t}\n \n \tspeed = ETH_SPEED_NUM_10G;\n-\tsnprintf(tap_name, sizeof(tap_name), \"%s%u\",\n-\t\t DEFAULT_TAP_NAME, tap_unit++);\n+\n+\t/* use tap%d which causes kernel to choose next available */\n+\tstrlcpy(tap_name, DEFAULT_TAP_NAME \"%d\", RTE_ETH_NAME_MAX_LEN);\n \tmemset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN);\n \n \tif (params && (params[0] != '\\0')) {\n@@ -2283,7 +2285,6 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)\n \t\t\t\trte_mp_action_unregister(TAP_MP_KEY);\n \t\t\ttap_devices_count--;\n \t\t}\n-\t\ttap_unit--;\t\t/* Restore the unit number */\n \t}\n \trte_kvargs_free(kvlist);\n \n",
    "prefixes": [
        "v2",
        "5/7"
    ]
}