get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 33663,
    "url": "http://patches.dpdk.org/api/patches/33663/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1515756682-69016-2-git-send-email-wei.dai@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": "<1515756682-69016-2-git-send-email-wei.dai@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1515756682-69016-2-git-send-email-wei.dai@intel.com",
    "date": "2018-01-12T11:31:21",
    "name": "[dpdk-dev,v6,1/2] app/testpmd: fix invalid rxq number setting",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e78cdc3216a879906536ea7f8e2652ebda808716",
    "submitter": {
        "id": 490,
        "url": "http://patches.dpdk.org/api/people/490/?format=api",
        "name": "Wei Dai",
        "email": "wei.dai@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/1515756682-69016-2-git-send-email-wei.dai@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/33663/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/33663/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 D7896A84F;\n\tFri, 12 Jan 2018 12:47:48 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 0FC8DA49F;\n\tFri, 12 Jan 2018 12:47:44 +0100 (CET)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Jan 2018 03:47:44 -0800",
            "from dpdk6.bj.intel.com ([172.16.182.87])\n\tby orsmga006.jf.intel.com with ESMTP; 12 Jan 2018 03:47:41 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,348,1511856000\"; d=\"scan'208\";a=\"10704009\"",
        "From": "Wei Dai <wei.dai@intel.com>",
        "To": "ferruh.yigit@intel.com, yuan.peng@intel.com, konstantin.ananyev@intel.com,\n\twenzhuo.lu@intel.com, jingjing.wu@intel.com",
        "Cc": "dev@dpdk.org,\n\tWei Dai <wei.dai@intel.com>,\n\tstable@dpdk.org",
        "Date": "Fri, 12 Jan 2018 19:31:21 +0800",
        "Message-Id": "<1515756682-69016-2-git-send-email-wei.dai@intel.com>",
        "X-Mailer": "git-send-email 2.7.5",
        "In-Reply-To": "<1515756682-69016-1-git-send-email-wei.dai@intel.com>",
        "References": "<1515744603-60457-1-git-send-email-wei.dai@intel.com>\n\t<1515756682-69016-1-git-send-email-wei.dai@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 1/2] app/testpmd: fix invalid rxq number\n\tsetting",
        "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://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": "<https://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": "If an invalid number of RX queues is configured from testpmd run-time\ncommand like \"port config all rxq number\" or from --rxq in the command\nto start testpmd, the global variable nb_rxq is updated by this invalid\nvalue without this patch. It may cause testpmd crash. This patch refuses\ninvalid rxq setting and keeps its last correct value.\n\nFixes: ce8d561418d4 (\"app/testpmd: add port configuration settings\")\nCc: stable@dpdk.org\n\nSigned-off-by: Wei Dai <wei.dai@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\nTested-by: Yuan Peng <yuan.peng@intel.com>\n---\n app/test-pmd/cmdline.c    |  2 ++\n app/test-pmd/parameters.c |  7 ++++---\n app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/testpmd.h    |  3 +++\n 4 files changed, 55 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 5b2e2ef..f0623b1 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,\n \t\t\tprintf(\"Warning: Either rx or tx queues should be non zero\\n\");\n \t\t\treturn;\n \t\t}\n+\t\tif (check_nb_rxq(res->value) != 0)\n+\t\t\treturn;\n \t\tnb_rxq = res->value;\n \t}\n \telse if (!strcmp(res->name, \"txq\")) {\ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 304b98d..c46e734 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)\n \tint n, opt;\n \tchar **argvopt;\n \tint opt_idx;\n+\tportid_t pid;\n \tenum { TX, RX };\n \n \tstatic struct option lgopts[] = {\n@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\trss_hf = ETH_RSS_UDP;\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"rxq\")) {\n \t\t\t\tn = atoi(optarg);\n-\t\t\t\tif (n >= 0 && n <= (int) MAX_QUEUE_ID)\n+\t\t\t\tif (n >= 0 && check_nb_rxq((queueid_t)n) == 0)\n \t\t\t\t\tnb_rxq = (queueid_t) n;\n \t\t\t\telse\n \t\t\t\t\trte_exit(EXIT_FAILURE, \"rxq %d invalid - must be\"\n-\t\t\t\t\t\t  \" >= 0 && <= %d\\n\", n,\n-\t\t\t\t\t\t  (int) MAX_QUEUE_ID);\n+\t\t\t\t\t\t  \" >= 0 && <= %u\\n\", n,\n+\t\t\t\t\t\t  get_allowed_max_nb_rxq(&pid));\n \t\t\t}\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"txq\")) {\n \t\t\t\tn = atoi(optarg);\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 9414d0e..4e8667d 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -540,6 +540,52 @@ check_socket_id(const unsigned int socket_id)\n \treturn 0;\n }\n \n+/*\n+ * Get the allowed maximum number of RX queues.\n+ * *pid return the port id which has minimal value of\n+ * max_rx_queues in all ports.\n+ */\n+queueid_t\n+get_allowed_max_nb_rxq(portid_t *pid)\n+{\n+\tqueueid_t allowed_max_rxq = MAX_QUEUE_ID;\n+\tportid_t pi;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tRTE_ETH_FOREACH_DEV(pi) {\n+\t\trte_eth_dev_info_get(pi, &dev_info);\n+\t\tif (dev_info.max_rx_queues < allowed_max_rxq) {\n+\t\t\tallowed_max_rxq = dev_info.max_rx_queues;\n+\t\t\t*pid = pi;\n+\t\t}\n+\t}\n+\treturn allowed_max_rxq;\n+}\n+\n+/*\n+ * Check input rxq is valid or not.\n+ * If input rxq is not greater than any of maximum number\n+ * of RX queues of all ports, it is valid.\n+ * if valid, return 0, else return -1\n+ */\n+int\n+check_nb_rxq(queueid_t rxq)\n+{\n+\tqueueid_t allowed_max_rxq;\n+\tportid_t pid = 0;\n+\n+\tallowed_max_rxq = get_allowed_max_nb_rxq(&pid);\n+\tif (rxq > allowed_max_rxq) {\n+\t\tprintf(\"Fail: input rxq (%u) can't be greater \"\n+\t\t       \"than max_rx_queues (%u) of port %u\\n\",\n+\t\t       rxq,\n+\t\t       allowed_max_rxq,\n+\t\t       pid);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n static void\n init_config(void)\n {\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 2a266fd..e815509 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -700,6 +700,9 @@ enum print_warning {\n int port_id_is_invalid(portid_t port_id, enum print_warning warning);\n int new_socket_id(unsigned int socket_id);\n \n+queueid_t get_allowed_max_nb_rxq(portid_t *pid);\n+int check_nb_rxq(queueid_t rxq);\n+\n /*\n  * Work-around of a compilation error with ICC on invocations of the\n  * rte_be_to_cpu_16() function.\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "1/2"
    ]
}