get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43231,
    "url": "http://patchwork.dpdk.org/api/patches/43231/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20180720124421.71277-1-ferruh.yigit@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20180720124421.71277-1-ferruh.yigit@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180720124421.71277-1-ferruh.yigit@intel.com",
    "date": "2018-07-20T12:44:21",
    "name": "[v2] drivers/net: fix segfault in secondary process",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d4f3bf87a9acd8e3b701505e22198be0b8b0c10d",
    "submitter": {
        "id": 324,
        "url": "http://patchwork.dpdk.org/api/people/324/?format=api",
        "name": "Ferruh Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20180720124421.71277-1-ferruh.yigit@intel.com/mbox/",
    "series": [
        {
            "id": 689,
            "url": "http://patchwork.dpdk.org/api/series/689/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=689",
            "date": "2018-07-20T12:44:21",
            "name": "[v2] drivers/net: fix segfault in secondary process",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/689/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/43231/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/43231/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 56F132BF5;\n\tFri, 20 Jul 2018 13:44:58 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 516C61E34;\n\tFri, 20 Jul 2018 13:44:56 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Jul 2018 04:44:55 -0700",
            "from silpixa00399752.ir.intel.com (HELO\n\tsilpixa00399752.ger.corp.intel.com) ([10.237.222.212])\n\tby FMSMGA003.fm.intel.com with ESMTP; 20 Jul 2018 04:44:36 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,378,1526367600\"; d=\"scan'208\";a=\"66171144\"",
        "From": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "To": "\"John W. Linville\" <linville@tuxdriver.com>,\n\tDeclan Doherty <declan.doherty@intel.com>,\n\tChas Williams <chas3@att.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,\n\tShreyansh Jain <shreyansh.jain@nxp.com>,\n\tGaetan Rivet <gaetan.rivet@6wind.com>,\n\tTetsuya Mukawa <mtetsuyah@gmail.com>,\n\tSantosh Shukla <santosh.shukla@caviumnetworks.com>,\n\tJerin Jacob <jerin.jacob@caviumnetworks.com>,\n\tKeith Wiles <keith.wiles@intel.com>,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>,\n\tTiwei Bie <tiwei.bie@intel.com>, Zhihong Wang <zhihong.wang@intel.com>,\n\tThomas Monjalon <thomas@monjalon.net>,\n\tAndrew Rybchenko <arybchenko@solarflare.com>",
        "Cc": "dev@dpdk.org,\n\tFerruh Yigit <ferruh.yigit@intel.com>,\n\tstable@dpdk.org",
        "Date": "Fri, 20 Jul 2018 13:44:21 +0100",
        "Message-Id": "<20180720124421.71277-1-ferruh.yigit@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180719164556.93162-1-ferruh.yigit@intel.com>",
        "References": "<20180719164556.93162-1-ferruh.yigit@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2] drivers/net: fix segfault in secondary process",
        "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": "Calling rte_eth_dev_info_get() on secondary process cause a crash\nbecause eth_dev->device is not set properly.\n\nAdding a helper function rte_eth_vdev_secondary_probe() that initializes\neth_dev fields properly.\n\nFixes: ee27edbe0c10 (\"drivers/net: share vdev data to secondary process\")\nCc: stable@dpdk.org\n\nReported-by: Vipin Varghese <vipin.varghese@intel.com>\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\nv2:\n* Added rte_eth_vdev_secondary_probe\n* Updated dpaa\n* More update on octeontx\n---\n drivers/net/af_packet/rte_eth_af_packet.c |  5 +----\n drivers/net/bonding/rte_eth_bond_pmd.c    |  6 ++----\n drivers/net/dpaa/dpaa_ethdev.c            |  2 ++\n drivers/net/failsafe/failsafe.c           |  6 ++----\n drivers/net/kni/rte_eth_kni.c             |  6 ++----\n drivers/net/null/rte_eth_null.c           |  7 ++-----\n drivers/net/octeontx/octeontx_ethdev.c    |  9 +++++----\n drivers/net/pcap/rte_eth_pcap.c           |  6 ++----\n drivers/net/tap/rte_eth_tap.c             |  8 ++------\n drivers/net/vhost/rte_eth_vhost.c         |  5 +----\n lib/librte_ethdev/rte_ethdev_vdev.h       | 17 +++++++++++++++++\n 11 files changed, 38 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c\nindex ce1e31aa4..548aee09e 100644\n--- a/drivers/net/af_packet/rte_eth_af_packet.c\n+++ b/drivers/net/af_packet/rte_eth_af_packet.c\n@@ -929,14 +929,11 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(dev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tPMD_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex fc4d4fd97..d155c7ac2 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -3177,14 +3177,12 @@ bond_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(dev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name,\n+\t\t\t&default_dev_ops);\n \t\tif (!eth_dev) {\n \t\t\tRTE_BOND_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &default_dev_ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c\nindex 5c0aafb3c..7a950ac04 100644\n--- a/drivers/net/dpaa/dpaa_ethdev.c\n+++ b/drivers/net/dpaa/dpaa_ethdev.c\n@@ -1389,6 +1389,8 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv,\n \t\teth_dev = rte_eth_dev_attach_secondary(dpaa_dev->name);\n \t\tif (!eth_dev)\n \t\t\treturn -ENOMEM;\n+\t\teth_dev->device = &dpaa_dev->device;\n+\t\teth_dev->dev_ops = &dpaa_devops;\n \t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\ndiff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c\nindex 7f89486d4..0278deb33 100644\n--- a/drivers/net/failsafe/failsafe.c\n+++ b/drivers/net/failsafe/failsafe.c\n@@ -321,14 +321,12 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(vdev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(vdev, name,\n+\t\t\t&failsafe_ops);\n \t\tif (!eth_dev) {\n \t\t\tERROR(\"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &failsafe_ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c\nindex b038fbf1a..3e653d729 100644\n--- a/drivers/net/kni/rte_eth_kni.c\n+++ b/drivers/net/kni/rte_eth_kni.c\n@@ -413,14 +413,12 @@ eth_kni_probe(struct rte_vdev_device *vdev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(params) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(vdev, name,\n+\t\t\t&eth_kni_ops);\n \t\tif (!eth_dev) {\n \t\t\tPMD_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &eth_kni_ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c\nindex d85d25f7e..46ee494f6 100644\n--- a/drivers/net/null/rte_eth_null.c\n+++ b/drivers/net/null/rte_eth_null.c\n@@ -616,15 +616,12 @@ rte_pmd_null_probe(struct rte_vdev_device *dev)\n \tPMD_LOG(INFO, \"Initializing pmd_null for %s\", name);\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n-\t    strlen(params) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\t\tstrlen(params) == 0) {\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tPMD_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c\nindex 21e5e4fca..ad96b152d 100644\n--- a/drivers/net/octeontx/octeontx_ethdev.c\n+++ b/drivers/net/octeontx/octeontx_ethdev.c\n@@ -19,6 +19,7 @@\n #include <rte_mbuf_pool_ops.h>\n #include <rte_prefetch.h>\n #include <rte_bus_vdev.h>\n+#include <rte_ethdev_vdev.h>\n \n #include \"octeontx_ethdev.h\"\n #include \"octeontx_rxtx.h\"\n@@ -1015,6 +1016,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,\n \t\tif (eth_dev == NULL)\n \t\t\treturn -ENODEV;\n \n+\t\teth_dev->dev_ops = &octeontx_dev_ops;\n+\t\teth_dev->device = &dev->device;\n \t\teth_dev->tx_pkt_burst = octeontx_xmit_pkts;\n \t\teth_dev->rx_pkt_burst = octeontx_recv_pkts;\n \t\trte_eth_dev_probing_finish(eth_dev);\n@@ -1176,14 +1179,12 @@ octeontx_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(dev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(dev_name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, dev_name,\n+\t\t\t&octeontx_dev_ops);\n \t\tif (!eth_dev) {\n \t\t\tRTE_LOG(ERR, PMD, \"Failed to probe %s\\n\", dev_name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &octeontx_dev_ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c\nindex 6779f97c1..d714c4be7 100644\n--- a/drivers/net/pcap/rte_eth_pcap.c\n+++ b/drivers/net/pcap/rte_eth_pcap.c\n@@ -1010,14 +1010,12 @@ pmd_pcap_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(dev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tPMD_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n+\t\treturn 0;\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c\nindex 22ba872ed..e17d8955d 100644\n--- a/drivers/net/tap/rte_eth_tap.c\n+++ b/drivers/net/tap/rte_eth_tap.c\n@@ -1925,12 +1925,11 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(params) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tTAP_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\teth_dev->dev_ops = &ops;\n \t\treturn 0;\n \t}\n \n@@ -1993,14 +1992,11 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(params) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tTAP_LOG(ERR, \"Failed to probe %s\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c\nindex 47b33456c..c4d8decd0 100644\n--- a/drivers/net/vhost/rte_eth_vhost.c\n+++ b/drivers/net/vhost/rte_eth_vhost.c\n@@ -1347,14 +1347,11 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n \t    strlen(rte_vdev_device_args(dev)) == 0) {\n-\t\teth_dev = rte_eth_dev_attach_secondary(name);\n+\t\teth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);\n \t\tif (!eth_dev) {\n \t\t\tVHOST_LOG(ERR, \"Failed to probe %s\\n\", name);\n \t\t\treturn -1;\n \t\t}\n-\t\t/* TODO: request info from primary to set up Rx and Tx */\n-\t\teth_dev->dev_ops = &ops;\n-\t\trte_eth_dev_probing_finish(eth_dev);\n \t\treturn 0;\n \t}\n \ndiff --git a/lib/librte_ethdev/rte_ethdev_vdev.h b/lib/librte_ethdev/rte_ethdev_vdev.h\nindex 259feda3f..6092f6e71 100644\n--- a/lib/librte_ethdev/rte_ethdev_vdev.h\n+++ b/lib/librte_ethdev/rte_ethdev_vdev.h\n@@ -81,4 +81,21 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)\n \treturn eth_dev;\n }\n \n+static inline struct rte_eth_dev *\n+rte_eth_vdev_secondary_probe(struct rte_vdev_device *vdev,\n+\t\tconst char *name, const struct eth_dev_ops *ops)\n+{\n+\tstruct rte_eth_dev *eth_dev;\n+\n+\teth_dev = rte_eth_dev_attach_secondary(name);\n+\tif (!eth_dev)\n+\t\treturn NULL;\n+\n+\t/* TODO: request info from primary to set up Rx and Tx */\n+\teth_dev->dev_ops = ops;\n+\teth_dev->device = &vdev->device;\n+\trte_eth_dev_probing_finish(eth_dev);\n+\treturn eth_dev;\n+}\n+\n #endif /* _RTE_ETHDEV_VDEV_H_ */\n",
    "prefixes": [
        "v2"
    ]
}