Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/12884/?format=api
http://patches.dpdk.org/api/patches/12884/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1463598911-18176-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it/", "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": "<1463598911-18176-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>", "list_archive_url": "https://inbox.dpdk.org/dev/1463598911-18176-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it", "date": "2016-05-18T19:15:11", "name": "[dpdk-dev,v3] librte_ether: use RTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "80ed186d7bcba74157ef3474c6b439f5f346fd44", "submitter": { "id": 375, "url": "http://patches.dpdk.org/api/people/375/?format=api", "name": "Mauricio Vasquez B", "email": "mauricio.vasquezbernal@studenti.polito.it" }, "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/1463598911-18176-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/12884/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/12884/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 31DD45A64;\n\tWed, 18 May 2016 21:15:19 +0200 (CEST)", "from compass.polito.it (compass.polito.it [130.192.55.110])\n\tby dpdk.org (Postfix) with ESMTP id 8F0045A49\n\tfor <dev@dpdk.org>; Wed, 18 May 2016 21:15:17 +0200 (CEST)", "from localhost (localhost [127.0.0.1])\n\tby compass.polito.it (Postfix) with ESMTP id 6AF3C100130;\n\tWed, 18 May 2016 21:15:17 +0200 (CEST)", "from compass.polito.it ([127.0.0.1])\n\tby localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026)\n\twith ESMTP id bUqipfhnI0s4; Wed, 18 May 2016 21:15:15 +0200 (CEST)", "from mvb-X455LJ.lan (unknown [93.56.119.81])\n\t(using TLSv1.2 with cipher AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: s203403@studenti.polito.it)\n\tby compass.polito.it (Postfix) with ESMTPSA id B1B7E100129;\n\tWed, 18 May 2016 21:15:15 +0200 (CEST)" ], "Authentication-Results": "compass.polito.it (amavisd-new);\n\tdkim=pass (1024-bit key) reason=\"pass (just generated, assumed good)\"\n\theader.d=studenti.polito.it", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=\n\tstudenti.polito.it; h=references:in-reply-to:x-mailer:message-id\n\t:date:date:subject:subject:cc:to:from:from:received:received; s=\n\ty2k10; t=1463598915; bh=GfWJ74uDC29HrAy3hiNhU68fuE4gMrL7q/pTMZfH\n\tVMs=; b=H4C30HaibsPo/mJ4wtXlTcegylFuIF0n6GxocY8ichYzndJB834Zrhz2\n\tf0wOkEbxuqv4kmp+3l/6qrkIqhQzggmCEkbCTvWz64Zv0cKKe9Eg2ofaBp3oK47K\n\tUfq9a6sdyY5WXpT1sevkcBPGrXW5ZwtPx27bjlz2tdh8YjMx4HM=", "X-Virus-Scanned": "amavisd-new at studenti.polito.it", "X-Spam-Flag": "NO", "X-Spam-Score": "-5.877", "X-Spam-Level": "", "X-Spam-Status": "No, score=-5.877 tagged_above=-100 required=3.5\n\ttests=[ALL_TRUSTED=-5, AWL=0.623, BAYES_00=-1.5] autolearn=ham", "From": "Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>", "To": "thomas.monjalon@6wind.com", "Cc": "dev@dpdk.org", "Date": "Wed, 18 May 2016 21:15:11 +0200", "Message-Id": "<1463598911-18176-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1463515316-4949-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>", "References": "<1463515316-4949-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>", "Subject": "[dpdk-dev] [PATCH v3] librte_ether: use\n\tRTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <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": "The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some places\nto check if a port id is valid or not. This commit makes use of it in\nsome new parts of the code.\n\nSigned-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>\n---\nv3:\n - use it also in rte_eth_add_rx_callback and rte_eth_add_tx_callback \nv2:\n - add missed case\n - change also cases in examples/ethtool/lib/rte_ethtool.c\n examples/ethtool/lib/rte_ethtool.c | 15 ++++++-----\n lib/librte_ether/rte_ethdev.c | 51 +++++++++++++-------------------------\n 2 files changed, 24 insertions(+), 42 deletions(-)", "diff": "diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c\nindex 42e05f1..9b18e46 100644\n--- a/examples/ethtool/lib/rte_ethtool.c\n+++ b/examples/ethtool/lib/rte_ethtool.c\n@@ -51,8 +51,7 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)\n \tif (drvinfo == NULL)\n \t\treturn -EINVAL;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tmemset(&dev_info, 0, sizeof(dev_info));\n \trte_eth_dev_info_get(port_id, &dev_info);\n@@ -120,8 +119,8 @@ rte_ethtool_get_link(uint8_t port_id)\n {\n \tstruct rte_eth_link link;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\n \trte_eth_link_get(port_id, &link);\n \treturn link.link_status;\n }\n@@ -267,8 +266,8 @@ rte_ethtool_net_open(uint8_t port_id)\n int\n rte_ethtool_net_stop(uint8_t port_id)\n {\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\n \trte_eth_dev_stop(port_id);\n \n \treturn 0;\n@@ -277,8 +276,8 @@ rte_ethtool_net_stop(uint8_t port_id)\n int\n rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr)\n {\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\n \tif (addr == NULL)\n \t\treturn -EINVAL;\n \trte_eth_macaddr_get(port_id, addr);\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex a31018e..80adbd3 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -369,8 +369,8 @@ rte_eth_dev_is_valid_port(uint8_t port_id)\n int\n rte_eth_dev_socket_id(uint8_t port_id)\n {\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -1;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);\n+\n \treturn rte_eth_devices[port_id].data->numa_node;\n }\n \n@@ -383,8 +383,8 @@ rte_eth_dev_count(void)\n static enum rte_eth_dev_type\n rte_eth_dev_get_device_type(uint8_t port_id)\n {\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn RTE_ETH_DEV_UNKNOWN;\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);\n+\n \treturn rte_eth_devices[port_id].dev_type;\n }\n \n@@ -479,10 +479,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)\n {\n \tuint32_t dev_flags;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n-\t\treturn -EINVAL;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n \n \tswitch (rte_eth_devices[port_id].data->kdrv) {\n \tcase RTE_KDRV_IGB_UIO:\n@@ -1994,10 +1991,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,\n \tstruct rte_eth_dev *dev;\n \tint ret;\n \n-\tif (port_id >= nb_ports) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \t/* Check mask bits */\n \tret = rte_eth_check_reta_mask(reta_conf, reta_size);\n@@ -2641,10 +2635,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)\n \tuint16_t qid;\n \tint rc;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%u\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tdev = &rte_eth_devices[port_id];\n \tintr_handle = &dev->pci_dev->intr_handle;\n@@ -2699,10 +2690,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,\n \tstruct rte_intr_handle *intr_handle;\n \tint rc;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%u\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tdev = &rte_eth_devices[port_id];\n \tif (queue_id >= dev->data->nb_rx_queues) {\n@@ -2734,10 +2722,7 @@ rte_eth_dev_rx_intr_enable(uint8_t port_id,\n {\n \tstruct rte_eth_dev *dev;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tdev = &rte_eth_devices[port_id];\n \n@@ -2751,10 +2736,7 @@ rte_eth_dev_rx_intr_disable(uint8_t port_id,\n {\n \tstruct rte_eth_dev *dev;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tdev = &rte_eth_devices[port_id];\n \n@@ -3001,7 +2983,9 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,\n \treturn -ENOTSUP;\n #endif\n \t/* Check input parameters. */\n-\tif (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL ||\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n+\n+\tif (user_cb == NULL ||\n \t\t queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) {\n \t\treturn -EINVAL;\n \t}\n@@ -3040,7 +3024,9 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,\n \treturn -ENOTSUP;\n #endif\n \t/* Check input parameters. */\n-\tif (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL ||\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n+\n+\tif (user_cb == NULL ||\n \t\t queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) {\n \t\treturn -EINVAL;\n \t}\n@@ -3284,10 +3270,7 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,\n {\n \tstruct rte_eth_dev *dev;\n \n-\tif (!rte_eth_dev_is_valid_port(port_id)) {\n-\t\tRTE_PMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n-\t\treturn -ENODEV;\n-\t}\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n \tdev = &rte_eth_devices[port_id];\n \tmemset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));\n", "prefixes": [ "dpdk-dev", "v3" ] }{ "id": 12884, "url": "