Show a patch.

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

{
    "id": 240,
    "url": "https://patches.dpdk.org/api/patches/240/",
    "web_url": "https://patches.dpdk.org/patch/240/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1409062300-17004-3-git-send-email-david.marchand@6wind.com>",
    "date": "2014-08-26T14:11:39",
    "name": "[dpdk-dev,RFC,2/3] eal: don't call rte_eal_iopl_init unconditionnally",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "07755f31676909a484185221e1c498dc1c8b8b6d",
    "submitter": {
        "id": 3,
        "url": "https://patches.dpdk.org/api/people/3/",
        "name": "David Marchand",
        "email": "david.marchand@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/240/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/240/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/240/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=KQY/1GeOkVTWOJ9DV0qeB5o2vqo0k8y/iqleXgyIKNA=;\n\tb=Rr9+LP6Li5e7Kxl4h7x1ziQo0xUZhrKmFtpny++YbuDGCyflr+QZ0EQs6hk8wSxstu\n\tPGKcxS64FG7cEsyluuG08O9CjB7SHe1vafI+dJF8ZPu0ke+ZOv2UUw/SF2Y2rXcvKD0d\n\tK0XNG+LzAOYOGNrLuHrvaYuoMzwI9NPCU2P8Om1afHXN1KmWMfbNB6cJPs98BnBPQEX5\n\tSbHTvAXE5MKsMEIDmD+4bp84vNYg81egaRlxweEXc3wZpchRQ9MuZSzbZmck7AkZqNUJ\n\thS57xMTGG+hqFzQ/Ihsw5eKrWbQ+jRSTisTxTupltiFhZ+GE8CLXT7HuuROhJSXa69vz\n\tknRg==",
        "In-Reply-To": "<1409062300-17004-1-git-send-email-david.marchand@6wind.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1409062300-17004-1-git-send-email-david.marchand@6wind.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "X-Gm-Message-State": "ALoCoQnVteZPiOy/AO8ROOu9X+hWAU14wP1HFc1wl54Dt3TbgresBqvqAv0bPy4+U8V6IC7RHo6V",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 26 Aug 2014 16:11:39 +0200",
        "Received": [
            "from mail-wi0-f177.google.com (mail-wi0-f177.google.com\n\t[209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 4937AB3C2\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 16:07:52 +0200 (CEST)",
            "by mail-wi0-f177.google.com with SMTP id ho1so4226514wib.10\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 07:11:52 -0700 (PDT)",
            "from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by mx.google.com with ESMTPSA id\n\tju1sm8693095wjc.1.2014.08.26.07.11.50 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Aug 2014 07:11:51 -0700 (PDT)"
        ],
        "From": "David Marchand <david.marchand@6wind.com>",
        "Precedence": "list",
        "Message-Id": "<1409062300-17004-3-git-send-email-david.marchand@6wind.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH RFC 2/3] eal: don't call rte_eal_iopl_init\n\tunconditionnally",
        "X-List-Received-Date": "Tue, 26 Aug 2014 14:07:52 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<david.marchand@6wind.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Received": "by 10.194.176.68 with SMTP id cg4mr1965679wjc.132.1409062312344; \n\tTue, 26 Aug 2014 07:11:52 -0700 (PDT)",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "There is no need for ioport access for applications that won't use virtio pmds.\nMake rte_eal_iopl_init() non-static so that it is called from pmds that need it.\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c         |    5 +----\n lib/librte_eal/common/include/rte_eal.h |   14 +++++++++++---\n lib/librte_eal/linuxapp/eal/eal.c       |   11 ++++-------\n lib/librte_pmd_virtio/virtio_ethdev.c   |   15 ++++++++-------\n 4 files changed, 24 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 0697b05..dad9e0c 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -803,7 +803,7 @@ int rte_eal_has_hugepages(void)\n }\n \n /* Abstraction for port I/0 privilege */\n-static int\n+int\n rte_eal_iopl_init(void)\n {\n \tint fd = -1;\n@@ -864,9 +864,6 @@ rte_eal_init(int argc, char **argv)\n \n \trte_config_init();\n \n-\tif (rte_eal_iopl_init() == 0)\n-\t\trte_config.flags |= EAL_FLG_HIGH_IOPL;\n-\n \tif (rte_eal_cpu_init() < 0)\n \t\trte_panic(\"Cannot detect lcores\\n\");\n \ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 273da9a..8d39cba 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -88,9 +88,6 @@ struct rte_config {\n \tstruct rte_mem_config *mem_config;\n } __attribute__((__packed__));\n \n-/* Flag definitions for rte_config flags */\n-#define EAL_FLG_HIGH_IOPL 1 /**< indicates high IO privilege in a linux env */\n-\n /**\n  * Get the global configuration structure.\n  *\n@@ -119,6 +116,17 @@ enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id);\n enum rte_proc_type_t rte_eal_process_type(void);\n \n /**\n+ * Request iopl privilege for all RPL.\n+ *\n+ * This function should be called by pmds which need access to ioports.\n+\n+ * @return\n+ *   - On success, returns 0.\n+ *   - On failure, returns -1.\n+ */\n+int rte_eal_iopl_init(void);\n+\n+/**\n  * Initialize the Environment Abstraction Layer (EAL).\n  *\n  * This function is to be executed on the MASTER lcore only, as soon\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 2940e69..884aa9b 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -107,8 +107,6 @@\n \n #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)\n \n-#define HIGHEST_RPL 3\n-\n #define BITS_PER_HEX 4\n \n /* Allow the application to print its usage message too if set */\n@@ -1060,10 +1058,12 @@ rte_eal_mcfg_complete(void)\n /*\n  * Request iopl privilege for all RPL, returns 0 on success\n  */\n-static int\n+int\n rte_eal_iopl_init(void)\n {\n-\treturn iopl(HIGHEST_RPL);\n+\tif (iopl(3) != 0)\n+\t\treturn -1;\n+\treturn 0;\n }\n \n /* Launch threads, called at application init(). */\n@@ -1125,9 +1125,6 @@ rte_eal_init(int argc, char **argv)\n \n \trte_config_init();\n \n-\tif (rte_eal_iopl_init() == 0)\n-\t\trte_config.flags |= EAL_FLG_HIGH_IOPL;\n-\n \tif (rte_eal_pci_init() < 0)\n \t\trte_panic(\"Cannot init PCI\\n\");\n \ndiff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c\nindex 3344ffb..587b746 100644\n--- a/lib/librte_pmd_virtio/virtio_ethdev.c\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\n@@ -736,12 +736,6 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t\treturn -1;\n \t}\n \n-\tif (!(rte_eal_get_configuration()->flags & EAL_FLG_HIGH_IOPL)) {\n-\t\tPMD_INIT_LOG(ERR,\n-\t\t\t\"IOPL call failed in EAL init - cannot use virtio PMD driver\\n\");\n-\t\treturn -1;\n-\t}\n-\n \teth_dev->dev_ops = &virtio_eth_dev_ops;\n \teth_dev->tx_pkt_burst = &virtio_xmit_pkts;\n \n@@ -896,8 +890,15 @@ static struct eth_driver rte_virtio_pmd = {\n  * Returns 0 on success.\n  */\n static int\n-rte_virtio_pmd_init(const char *name __rte_unused, const char *param __rte_unused)\n+rte_virtio_pmd_init(const char *name __rte_unused,\n+\t\t    const char *param __rte_unused)\n {\n+\tif (rte_eal_iopl_init() != 0) {\n+\t\tPMD_INIT_LOG(ERR, \"IOPL call failed - \"\n+\t\t\t\t  \"cannot use virtio PMD driver\\n\");\n+\t\treturn -1;\n+\t}\n+\n \trte_eth_driver_register(&rte_virtio_pmd);\n \treturn 0;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "2/3"
    ]
}