Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/57114/?format=api
http://patches.dpdk.org/api/patches/57114/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/cb51a5c695e59ae2cfc1f97c292192b59ab34b9a.1564064436.git.anatoly.burakov@intel.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": "<cb51a5c695e59ae2cfc1f97c292192b59ab34b9a.1564064436.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/cb51a5c695e59ae2cfc1f97c292192b59ab34b9a.1564064436.git.anatoly.burakov@intel.com", "date": "2019-07-25T14:21:10", "name": "[v4,3/3] usertools/devbind: print all errors to stderr", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "e2d704562c8252edeea9c06fb89ba21a17fbe3f0", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "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/cb51a5c695e59ae2cfc1f97c292192b59ab34b9a.1564064436.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 5752, "url": "http://patches.dpdk.org/api/series/5752/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5752", "date": "2019-07-25T14:21:07", "name": "Small usability improvements for devbind", "version": 4, "mbox": "http://patches.dpdk.org/series/5752/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/57114/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/57114/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 715D61C370;\n\tThu, 25 Jul 2019 16:21:23 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id B5F5A1C35D\n\tfor <dev@dpdk.org>; Thu, 25 Jul 2019 16:21:16 +0200 (CEST)", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2019 07:21:16 -0700", "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga005.jf.intel.com with ESMTP; 25 Jul 2019 07:21:15 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,307,1559545200\"; d=\"scan'208\";a=\"345454121\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net, john.mcnamara@intel.com, stephen@networkplumber.org", "Date": "Thu, 25 Jul 2019 15:21:10 +0100", "Message-Id": "<cb51a5c695e59ae2cfc1f97c292192b59ab34b9a.1564064436.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<cover.1564064436.git.anatoly.burakov@intel.com>", "<cover.1564064436.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1564064436.git.anatoly.burakov@intel.com>", "<cover.1564062922.git.anatoly.burakov@intel.com>\n\t<cover.1564064436.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v4 3/3] usertools/devbind: print all errors to\n\tstderr", "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": "Bring consistency to error messages and output them to stderr.\nAls, whenever the script tells the user to \"check usage\", don't\ntell the user to do it and just display usage instead.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n usertools/dpdk-devbind.py | 58 ++++++++++++++++++---------------------\n 1 file changed, 27 insertions(+), 31 deletions(-)", "diff": "diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py\nindex d3b16240f..7b5cbc12c 100755\n--- a/usertools/dpdk-devbind.py\n+++ b/usertools/dpdk-devbind.py\n@@ -3,6 +3,7 @@\n # Copyright(c) 2010-2014 Intel Corporation\n #\n \n+from __future__ import print_function\n import sys\n import os\n import getopt\n@@ -185,7 +186,7 @@ def check_modules():\n \n # check if we have at least one loaded module\n if True not in [mod[\"Found\"] for mod in mods] and b_flag is not None:\n- print(\"Warning: no supported DPDK kernel modules are loaded\")\n+ print(\"Warning: no supported DPDK kernel modules are loaded\", file=sys.stderr)\n \n # change DPDK driver list to only contain drivers that are loaded\n dpdk_drivers = [mod[\"Name\"] for mod in mods if mod[\"Found\"]]\n@@ -352,14 +353,14 @@ def unbind_one(dev_id, force):\n '''Unbind the device identified by \"dev_id\" from its current driver'''\n dev = devices[dev_id]\n if not has_driver(dev_id):\n- print(\"%s %s %s is not currently managed by any driver\\n\" %\n- (dev[\"Slot\"], dev[\"Device_str\"], dev[\"Interface\"]))\n+ print(\"Notice: %s %s %s is not currently managed by any driver\" %\n+ (dev[\"Slot\"], dev[\"Device_str\"], dev[\"Interface\"]), file=sys.stderr)\n return\n \n # prevent us disconnecting ourselves\n if dev[\"Ssh_if\"] and not force:\n- print(\"Routing table indicates that interface %s is active. \"\n- \"Skipping unbind\" % (dev_id))\n+ print(\"Warning: routing table indicates that interface %s is active. \"\n+ \"Skipping unbind\" % dev_id, file=sys.stderr)\n return\n \n # write to /sys to unbind\n@@ -367,9 +368,8 @@ def unbind_one(dev_id, force):\n try:\n f = open(filename, \"a\")\n except:\n- print(\"Error: unbind failed for %s - Cannot open %s\"\n- % (dev_id, filename))\n- sys.exit(1)\n+ sys.exit(\"Error: unbind failed for %s - Cannot open %s\" %\n+ (dev_id, filename))\n f.write(dev_id)\n f.close()\n \n@@ -382,15 +382,15 @@ def bind_one(dev_id, driver, force):\n \n # prevent disconnection of our ssh session\n if dev[\"Ssh_if\"] and not force:\n- print(\"Routing table indicates that interface %s is active. \"\n- \"Not modifying\" % (dev_id))\n+ print(\"Warning: routing table indicates that interface %s is active. \"\n+ \"Not modifying\" % dev_id, file=sys.stderr)\n return\n \n # unbind any existing drivers we don't want\n if has_driver(dev_id):\n if dev[\"Driver_str\"] == driver:\n- print(\"%s already bound to driver %s, skipping\\n\"\n- % (dev_id, driver))\n+ print(\"Notice: %s already bound to driver %s, skipping\" %\n+ (dev_id, driver), file=sys.stderr)\n return\n else:\n saved_driver = dev[\"Driver_str\"]\n@@ -410,14 +410,14 @@ def bind_one(dev_id, driver, force):\n f = open(filename, \"w\")\n except:\n print(\"Error: bind failed for %s - Cannot open %s\"\n- % (dev_id, filename))\n+ % (dev_id, filename), file=sys.stderr)\n return\n try:\n f.write(\"%s\" % driver)\n f.close()\n except:\n print(\"Error: bind failed for %s - Cannot write driver %s to \"\n- \"PCI ID \" % (dev_id, driver))\n+ \"PCI ID \" % (dev_id, driver), file=sys.stderr)\n return\n # For kernels < 3.15 use new_id to add PCI id's to the driver\n else:\n@@ -426,7 +426,7 @@ def bind_one(dev_id, driver, force):\n f = open(filename, \"w\")\n except:\n print(\"Error: bind failed for %s - Cannot open %s\"\n- % (dev_id, filename))\n+ % (dev_id, filename), file=sys.stderr)\n return\n try:\n # Convert Device and Vendor Id to int to write to new_id\n@@ -435,7 +435,7 @@ def bind_one(dev_id, driver, force):\n f.close()\n except:\n print(\"Error: bind failed for %s - Cannot write new PCI ID to \"\n- \"driver %s\" % (dev_id, driver))\n+ \"driver %s\" % (dev_id, driver), file=sys.stderr)\n return\n \n # do the bind by writing to /sys\n@@ -444,7 +444,7 @@ def bind_one(dev_id, driver, force):\n f = open(filename, \"a\")\n except:\n print(\"Error: bind failed for %s - Cannot open %s\"\n- % (dev_id, filename))\n+ % (dev_id, filename), file=sys.stderr)\n if saved_driver is not None: # restore any previous driver\n bind_one(dev_id, saved_driver, force)\n return\n@@ -459,7 +459,7 @@ def bind_one(dev_id, driver, force):\n if \"Driver_str\" in tmp and tmp[\"Driver_str\"] == driver:\n return\n print(\"Error: bind failed for %s - Cannot bind to driver %s\"\n- % (dev_id, driver))\n+ % (dev_id, driver), file=sys.stderr)\n if saved_driver is not None: # restore any previous driver\n bind_one(dev_id, saved_driver, force)\n return\n@@ -472,16 +472,14 @@ def bind_one(dev_id, driver, force):\n try:\n f = open(filename, \"w\")\n except:\n- print(\"Error: unbind failed for %s - Cannot open %s\"\n+ sys.exit(\"Error: unbind failed for %s - Cannot open %s\"\n % (dev_id, filename))\n- sys.exit(1)\n try:\n f.write(\"\\00\")\n f.close()\n except:\n- print(\"Error: unbind failed for %s - Cannot open %s\"\n+ sys.exit(\"Error: unbind failed for %s - Cannot open %s\"\n % (dev_id, filename))\n- sys.exit(1)\n \n \n def unbind_all(dev_list, force=False):\n@@ -676,8 +674,7 @@ def parse_args():\n force_flag = True\n if opt == \"-b\" or opt == \"-u\" or opt == \"--bind\" or opt == \"--unbind\":\n if b_flag is not None:\n- print(\"Error - Only one bind or unbind may be specified\\n\")\n- sys.exit(1)\n+ sys.exit(\"Error: binding and unbinding are mutually exclusive\")\n if opt == \"-u\" or opt == \"--unbind\":\n b_flag = \"none\"\n else:\n@@ -692,14 +689,14 @@ def do_arg_actions():\n global args\n \n if b_flag is None and not status_flag:\n- print(\"Error: No action specified for devices.\"\n- \"Please give a -b or -u option\")\n- print(\"Run '%s --usage' for further information\" % sys.argv[0])\n+ print(\"Error: No action specified for devices. \"\n+ \"Please give a -b or -u option\", file=sys.stderr)\n+ usage()\n sys.exit(1)\n \n if b_flag is not None and len(args) == 0:\n- print(\"Error: No devices specified.\")\n- print(\"Run '%s --usage' for further information\" % sys.argv[0])\n+ print(\"Error: No devices specified.\", file=sys.stderr)\n+ usage()\n sys.exit(1)\n \n if b_flag == \"none\" or b_flag == \"None\":\n@@ -727,8 +724,7 @@ def main():\n ret = subprocess.call(['which', 'lspci'],\n stdout=devnull, stderr=devnull)\n if ret != 0:\n- print(\"'lspci' not found - please install 'pciutils'\")\n- sys.exit(1)\n+ sys.exit(\"'lspci' not found - please install 'pciutils'\")\n parse_args()\n check_modules()\n clear_data()\n", "prefixes": [ "v4", "3/3" ] }{ "id": 57114, "url": "