Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/53881/?format=api
http://patches.dpdk.org/api/patches/53881/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190529224321.20760-1-stephen@networkplumber.org/", "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": "<20190529224321.20760-1-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20190529224321.20760-1-stephen@networkplumber.org", "date": "2019-05-29T22:43:21", "name": "examples/client_server_mp: check port ownership", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "bdd9964162731f24a40fc15e151568fe4b8e6b2e", "submitter": { "id": 27, "url": "http://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190529224321.20760-1-stephen@networkplumber.org/mbox/", "series": [ { "id": 4819, "url": "http://patches.dpdk.org/api/series/4819/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4819", "date": "2019-05-29T22:43:21", "name": "examples/client_server_mp: check port ownership", "version": 1, "mbox": "http://patches.dpdk.org/series/4819/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/53881/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/53881/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 A39F61B944;\n\tThu, 30 May 2019 00:43:27 +0200 (CEST)", "from mail-pl1-f195.google.com (mail-pl1-f195.google.com\n\t[209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 8AEB1378B\n\tfor <dev@dpdk.org>; Thu, 30 May 2019 00:43:26 +0200 (CEST)", "by mail-pl1-f195.google.com with SMTP id d21so1679417plr.3\n\tfor <dev@dpdk.org>; Wed, 29 May 2019 15:43:26 -0700 (PDT)", "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\tb18sm743933pfp.32.2019.05.29.15.43.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 29 May 2019 15:43:23 -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:mime-version\n\t:content-transfer-encoding;\n\tbh=OJNv1vkxzK/R+YjawMrVeHohyEdDuIe+1TM5Rh68V3w=;\n\tb=1eGacqFHURQ3OtbtGmVep7pZC4m3oTYT+lAjkMCJR784lAe7Bnb31+CPeDPFlrjc4T\n\tLPcp0hQ1pnncI2Q2F56MejROERMODau1ARiusogv4km8vGqObnoshlyuqAZR+iqPoW4Y\n\tO3IfG1ZlCPgyGjFCF6mw4VO/oFuQmSFI9OOQKSH8qKnWuX9qjdCqbnaMUWM2M9mA903U\n\tobwjSubd16a3+UkjuFgaIBA+jtjOxTF7DI95rePNAURdN5Wpdu9wsq8d8CPgvSD5POZE\n\tVf7dspmDCXqAdm8/g2ThaXNJGdRYeafACPf4fgHnIkwX4503cXgmT8gclSwofVDabFdU\n\t9+/g==", "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:mime-version\n\t:content-transfer-encoding;\n\tbh=OJNv1vkxzK/R+YjawMrVeHohyEdDuIe+1TM5Rh68V3w=;\n\tb=PpNZMHydiGdUjcoO/grJwchZfT42mU+oI7GkzmO2OmXZ7s/4N+nG/CcLdZWrNgUqS5\n\t+TeNVOMxFtCJ0NF/W8J6L84vwIrRIpu8BKLQMCOIArUxTfGoYTXQbqnGzvgyVAayT/Hr\n\tiJGuYyim6ZzuZB70LV30Bd87vNrhAbzSPgk9HQJEyJWkgLzZ3M7DOVARTtPUwPR24Obf\n\tIAujNdboFjLHPJ8OiV2bobdimcDAlDCXppAr8YhJtaOalZrfHTkca7eY0OkzgXJScLgC\n\tC1aIipnd7VqeftkUPHckCroVSfgRoDE/ypbWdnNv48FXJggzviQFDtf51P76nalPQVzY\n\tPKLw==", "X-Gm-Message-State": "APjAAAUnQD4yeZewfJQ+9o9TZ/nhW+skJPb42+MhUCpaz3cqD5j2e3r6\n\tAPWKZJSCMU6wsAXNCDYAvKScHg==", "X-Google-Smtp-Source": "APXvYqzKQ025uBRB7r5CeXGcOvy8xoz7STlW3MzYTeC6/Q+Ii7KM/NkfePm/SsD91960bIxsJc6SEg==", "X-Received": "by 2002:a17:902:b083:: with SMTP id\n\tp3mr380020plr.151.1559169805646; \n\tWed, 29 May 2019 15:43:25 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "anatoly.burakov@intel.com", "Cc": "dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,\n\tStephen Hemminger <sthemmin@microsoft.com>", "Date": "Wed, 29 May 2019 15:43:21 -0700", "Message-Id": "<20190529224321.20760-1-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH] examples/client_server_mp: check port ownership", "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": "The 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 explictly checks for ownership when parsing the port mask.\n\nFixes: 5b7ba31148a8 (\"ethdev: add port ownership\")\nSigned-off-by: Stephen Hemminger <sthemmin@microsoft.com>\n---\n .../client_server_mp/mp_server/args.c | 32 ++++++++++++-------\n 1 file changed, 21 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..933f69a54296 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,36 @@ 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} else if (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} else if (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} else {\n+\t\t\tports->id[ports->num_ports++] = count;\n \t\t}\n-\t\tpm = (pm >> 1);\n-\t\tcount++;\n \t}\n \n \treturn 0;\n", "prefixes": [] }{ "id": 53881, "url": "