get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 20686,
    "url": "http://patches.dpdk.org/api/patches/20686/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1487851096-32479-1-git-send-email-amis@radware.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": "<1487851096-32479-1-git-send-email-amis@radware.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1487851096-32479-1-git-send-email-amis@radware.com",
    "date": "2017-02-23T11:58:16",
    "name": "[dpdk-dev] net/virtio-user: fix multi-process issue",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "faaef3b2d78f898b922ad969c1368091960bc05d",
    "submitter": {
        "id": 678,
        "url": "http://patches.dpdk.org/api/people/678/?format=api",
        "name": "Ami Sabo",
        "email": "amis@radware.com"
    },
    "delegate": {
        "id": 355,
        "url": "http://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1487851096-32479-1-git-send-email-amis@radware.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/20686/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/20686/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id F1F1F5911;\n\tThu, 23 Feb 2017 12:58:21 +0100 (CET)",
            "from mailout1.radware.com (mailout1.radwarecloud.com\n\t[192.115.180.130]) by dpdk.org (Postfix) with ESMTP id 3C47F2BFF\n\tfor <dev@dpdk.org>; Thu, 23 Feb 2017 12:58:19 +0100 (CET)",
            "from localhost.localdomain (176.200.121.205) by\n\tILCAS1.corp.radware.com (176.200.120.121) with Microsoft SMTP Server\n\tid 14.3.319.2; Thu, 23 Feb 2017 13:58:18 +0200"
        ],
        "From": "Ami Sabo <amis@radware.com>",
        "To": "<yuanhan.liu@linux.intel.com>",
        "CC": "<dev@dpdk.org>, Ami Sabo <amis@radware.com>",
        "Date": "Thu, 23 Feb 2017 13:58:16 +0200",
        "Message-ID": "<1487851096-32479-1-git-send-email-amis@radware.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-TM-AS-Product-Ver": "SMEX-11.0.0.4179-8.100.1062-22902.006",
        "X-TM-AS-Result": "No--10.553000-0.000000-31",
        "X-TM-AS-User-Approved-Sender": "Yes",
        "X-TM-AS-User-Blocked-Sender": "No",
        "Subject": "[dpdk-dev] [PATCH] net/virtio-user: fix multi-process issue",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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": "Secondary process doesn't properly attach to the rte_eth_device\ninitialized by the primary process.\n\nAccessing device from secondary process (e.g. via rte_eth_rx_burst),\ncauses process to crash. because rte_eth_dev_data is not properly set.\n\nThe issue was flood by\n'commit 7f95f78a8aea (\"ethdev: clear data when allocating device\")'\nwhich now clears rte_eth_dev_data entry.\n\nSo, most of the rte_eth_dev_data fields are not initialized.\nFor pci devices these fields are initialized  by rte_eth_dev_pci_probe\n->eth_dev_attach_secondary().\nHowever, for virtio-user virtio_user_pmd_probe() is called instead of\nrte_eth_dev_pci_probe().\nTo fix it:  Allow non-pci drivers call to dev_attach_secondary() and\ncall it (for secondary process) from virtio_user_pmd_probe.\n\nSigned-off-by: Ami Sabo <amis@radware.com>\n---\n drivers/net/virtio/virtio_user_ethdev.c | 29 +++++++++++++++++------------\n lib/librte_ether/rte_ethdev.c           |  6 +++---\n lib/librte_ether/rte_ethdev.h           | 11 +++++++++++\n lib/librte_ether/rte_ether_version.map  |  1 +\n 4 files changed, 32 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex e544acc..d388b92 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -418,18 +418,23 @@ virtio_user_pmd_probe(const char *name, const char *params)\n \t\tgoto end;\n \t}\n \n-\teth_dev = virtio_user_eth_dev_alloc(name);\n-\tif (!eth_dev) {\n-\t\tPMD_INIT_LOG(ERR, \"virtio_user fails to alloc device\");\n-\t\tgoto end;\n-\t}\n-\n-\thw = eth_dev->data->dev_private;\n-\tif (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,\n-\t\t\t\t queue_size, mac_addr) < 0) {\n-\t\tPMD_INIT_LOG(ERR, \"virtio_user_dev_init fails\");\n-\t\tvirtio_user_eth_dev_free(eth_dev);\n-\t\tgoto end;\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\teth_dev = virtio_user_eth_dev_alloc(name);\n+\t\tif (!eth_dev) {\n+\t\t\tPMD_INIT_LOG(ERR, \"virtio_user fails to alloc device\");\n+\t\t\tgoto end;\n+\t\t}\n+\t\thw = eth_dev->data->dev_private;\n+\t\tif (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,\n+\t\t\tqueue_size, mac_addr) < 0) {\n+\t\t\tPMD_INIT_LOG(ERR, \"virtio_user_dev_init fails\");\n+\t\t\tvirtio_user_eth_dev_free(eth_dev);\n+\t\t\tgoto end;\n+\t\t}\n+\t} else {\n+\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\tif (!eth_dev)\n+\t\t\tgoto end;\n \t}\n \n \t/* previously called by rte_eal_pci_probe() for physical dev */\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 61f44e2..ea4f76c 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -239,8 +239,8 @@ rte_eth_dev_allocate(const char *name)\n  * makes sure that the same device would have the same port id both\n  * in the primary and secondary process.\n  */\n-static struct rte_eth_dev *\n-eth_dev_attach_secondary(const char *name)\n+struct rte_eth_dev *\n+rte_eth_dev_attach_secondary(const char *name)\n {\n \tuint8_t i;\n \tstruct rte_eth_dev *eth_dev;\n@@ -302,7 +302,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,\n \t\tif (eth_dev->data->dev_private == NULL)\n \t\t\trte_panic(\"Cannot allocate memzone for private port data\\n\");\n \t} else {\n-\t\teth_dev = eth_dev_attach_secondary(ethdev_name);\n+\t\teth_dev = rte_eth_dev_attach_secondary(ethdev_name);\n \t\tif (eth_dev == NULL) {\n \t\t\t/*\n \t\t\t * if we failed to attach a device, it means the\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex c17bbda..3281205 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1762,6 +1762,17 @@ struct rte_eth_dev *rte_eth_dev_allocate(const char *name);\n \n /**\n  * @internal\n+ * Attach to the ethdev already initialized by the primary\n+ * process.\n+ *\n+ * @param\tname\tEthernet device's name.\n+  @return\n+ *   - Slot in the rte_dev_devices array for attached device;\n+ */\n+struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);\n+\n+/**\n+ * @internal\n  * Release the specified ethdev port.\n  *\n  * @param eth_dev\ndiff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map\nindex c6c9d0d..f8bf2ee 100644\n--- a/lib/librte_ether/rte_ether_version.map\n+++ b/lib/librte_ether/rte_ether_version.map\n@@ -152,5 +152,6 @@ DPDK_17.02 {\n \trte_flow_flush;\n \trte_flow_query;\n \trte_flow_validate;\n+\trte_eth_dev_attach_secondary;\n \n } DPDK_16.11;\n",
    "prefixes": [
        "dpdk-dev"
    ]
}