Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/54274/?format=api
https://patches.dpdk.org/api/patches/54274/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190603222835.27909-1-stephen@networkplumber.org/", "project": { "id": 1, "url": "https://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": "<20190603222835.27909-1-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20190603222835.27909-1-stephen@networkplumber.org", "date": "2019-06-03T22:28:35", "name": "[v2] examples/client_server_mp: check port ownership", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "96443c32a19d6fbfab272e8d0e698112b396b240", "submitter": { "id": 27, "url": "https://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190603222835.27909-1-stephen@networkplumber.org/mbox/", "series": [ { "id": 4877, "url": "https://patches.dpdk.org/api/series/4877/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=4877", "date": "2019-06-03T22:28:35", "name": "[v2] examples/client_server_mp: check port ownership", "version": 2, "mbox": "https://patches.dpdk.org/series/4877/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/54274/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/54274/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 9D55C1B9AE;\n\tTue, 4 Jun 2019 00:28:40 +0200 (CEST)", "from mail-pf1-f194.google.com (mail-pf1-f194.google.com\n\t[209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 1ED661B9AA\n\tfor <dev@dpdk.org>; Tue, 4 Jun 2019 00:28:39 +0200 (CEST)", "by mail-pf1-f194.google.com with SMTP id q17so11413965pfq.8\n\tfor <dev@dpdk.org>; Mon, 03 Jun 2019 15:28:39 -0700 (PDT)", "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\tv4sm18769347pfe.180.2019.06.03.15.28.37\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 03 Jun 2019 15:28:37 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=/CI00bKuGjRiu2szEZF/sipEIOLbbKUiOeeYSU7iBLs=;\n\tb=C14rSeudR2wFhdNfBEFkQK7y9hlXNm2TO/WG72QHBUixid4CdmLfDkIILyr567xBZG\n\tHqInPK7yqMHrbo+ojia81M0wfN2l8IXtPWN37UD8BeljJamm8pm4kc/PFVOm3Dgz26mp\n\tYk1qgw/qPEVHn/isMLAzOsG/0TKexYYEpv+Kb+j30pu0ujK7jVt6Vgo4IqWkazli4ypM\n\tiWb67tvE/YlBwguKvYoeY5tljW6PRV2f2pfvecBKSe93RsUhzb+xtTKPuzvF5p7q/X4z\n\ttVw7lLRhqBU6GrkWRWLOWdpMiSW0eAInd+1E/1PKjlJtWjeUhLrJ+t4hX1gNsgiDMMQw\n\tRKxA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=/CI00bKuGjRiu2szEZF/sipEIOLbbKUiOeeYSU7iBLs=;\n\tb=Pvc+qerZma5eJ0lyqvg17ONrFA/1hQ3s0ZJShczzuqYZBF52sFb/Jo2lzM52Y2KUZq\n\t2cuKT+QHXXt8R8iRsHr0oEo/+fgxlq+MqX8AsHiU1amQiJ1RCbz1EtfGfCGqjXEwjmi1\n\tY4FJrO6I6cRfpgw/EjjwVT9S6jYqcQhLrvxU3amNRS/YUbO1+dRNm5KaMZaHFlfEQA4D\n\tHFIaJgLyzJO5ca0s9hVS846jan6JxY1gFhcRnp2Y2q1tyKLkFRMYAw2RY5asbkIb5OGJ\n\tLG/SJUjhXLAazTueiRalpH3j8BRo5R1FSgcpPxIzwOZssMbzB7csAILUfkSNHwEqgbez\n\tpgtA==", "X-Gm-Message-State": "APjAAAWIxMe9DBWnXCfjTV2VKHNsBgnOPYKoIOJ8UfAW51+7ujLL05Uk\n\tKExGpBWE0+JpBmWrEzhz+pW+DQ==", "X-Google-Smtp-Source": "APXvYqyxarzpb8E72p3nl9+1I5PgxcziwmUG/+lfreKevxgUMfK3hnN/tZgn6yUYKYmLiaEHhyp2NQ==", "X-Received": "by 2002:a17:90a:bd8b:: with SMTP id\n\tz11mr32075957pjr.39.1559600918279; \n\tMon, 03 Jun 2019 15:28:38 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "anatoly.burakov@intel.com", "Cc": "dev@dpdk.org,\n\tStephen Hemminger <sthemmin@microsoft.com>", "Date": "Mon, 3 Jun 2019 15:28:35 -0700", "Message-Id": "<20190603222835.27909-1-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190529224321.20760-1-stephen@networkplumber.org>", "References": "<20190529224321.20760-1-stephen@networkplumber.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v2] examples/client_server_mp: check port\n\townership", "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": "From: Stephen Hemminger <sthemmin@microsoft.com>\n\nThe mp_server would accept a port mask that included hidden (owned)\nports and which later caused either lost packets or failed initialization.\n\nThis fixes explicitly checks for ownership when parsing the port mask.\n\nFixes: 5b7ba31148a8 (\"ethdev: add port ownership\")\nSigned-off-by: Stephen Hemminger <sthemmin@microsoft.com>\n---\nv2 - fix checkpatch complains about return and else\n\n .../client_server_mp/mp_server/args.c | 35 +++++++++++++------\n 1 file changed, 24 insertions(+), 11 deletions(-)", "diff": "diff --git a/examples/multi_process/client_server_mp/mp_server/args.c b/examples/multi_process/client_server_mp/mp_server/args.c\nindex b0d8d7665c85..72cb85008c39 100644\n--- a/examples/multi_process/client_server_mp/mp_server/args.c\n+++ b/examples/multi_process/client_server_mp/mp_server/args.c\n@@ -10,6 +10,7 @@\n #include <errno.h>\n \n #include <rte_memory.h>\n+#include <rte_ethdev.h>\n #include <rte_string_fns.h>\n \n #include \"common.h\"\n@@ -45,27 +46,39 @@ parse_portmask(uint8_t max_ports, const char *portmask)\n {\n \tchar *end = NULL;\n \tunsigned long pm;\n-\tuint16_t count = 0;\n+\tuint16_t count;\n \n \tif (portmask == NULL || *portmask == '\\0')\n \t\treturn -1;\n \n \t/* convert parameter to a number and verify */\n \tpm = strtoul(portmask, &end, 16);\n-\tif (end == NULL || *end != '\\0' || pm == 0)\n+\tif (end == NULL || *end != '\\0' || pm > UINT16_MAX || pm == 0)\n \t\treturn -1;\n \n \t/* loop through bits of the mask and mark ports */\n-\twhile (pm != 0){\n-\t\tif (pm & 0x01){ /* bit is set in mask, use port */\n-\t\t\tif (count >= max_ports)\n-\t\t\t\tprintf(\"WARNING: requested port %u not present\"\n-\t\t\t\t\" - ignoring\\n\", (unsigned)count);\n-\t\t\telse\n-\t\t\t ports->id[ports->num_ports++] = count;\n+\tfor (count = 0; pm != 0; pm >>= 1, ++count) {\n+\t\tstruct rte_eth_dev_owner owner;\n+\n+\t\tif ((pm & 0x1) == 0)\n+\t\t\tcontinue;\n+\n+\t\tif (count >= max_ports) {\n+\t\t\tprintf(\"WARNING: requested port %u not present - ignoring\\n\",\n+\t\t\t\tcount);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (rte_eth_dev_owner_get(count, &owner) < 0) {\n+\t\t\tprintf(\"ERROR: can not find port %u owner\\n\", count);\n+\t\t\treturn -1;\n \t\t}\n-\t\tpm = (pm >> 1);\n-\t\tcount++;\n+\t\tif (owner.id != RTE_ETH_DEV_NO_OWNER) {\n+\t\t\tprintf(\"ERROR: requested port %u is owned by device %s\\n\",\n+\t\t\t\t\tcount, owner.name);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tports->id[ports->num_ports++] = count;\n \t}\n \n \treturn 0;\n", "prefixes": [ "v2" ] }{ "id": 54274, "url": "