get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68750,
    "url": "http://patches.dpdk.org/api/patches/68750/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1587121194-9098-1-git-send-email-oulijun@huawei.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": "<1587121194-9098-1-git-send-email-oulijun@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1587121194-9098-1-git-send-email-oulijun@huawei.com",
    "date": "2020-04-17T10:59:54",
    "name": "app/testpmd: configure rxd and txd number correctly",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f35a04746ef2b4aa12417aa79c019b7ada2d9795",
    "submitter": {
        "id": 1675,
        "url": "http://patches.dpdk.org/api/people/1675/?format=api",
        "name": "Lijun Ou",
        "email": "oulijun@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1587121194-9098-1-git-send-email-oulijun@huawei.com/mbox/",
    "series": [
        {
            "id": 9459,
            "url": "http://patches.dpdk.org/api/series/9459/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9459",
            "date": "2020-04-17T10:59:54",
            "name": "app/testpmd: configure rxd and txd number correctly",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/9459/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/68750/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/68750/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5743FA058A;\n\tFri, 17 Apr 2020 13:01:02 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E8A311E49E;\n\tFri, 17 Apr 2020 13:01:01 +0200 (CEST)",
            "from huawei.com (szxga05-in.huawei.com [45.249.212.191])\n by dpdk.org (Postfix) with ESMTP id 7FFE41E49D\n for <dev@dpdk.org>; Fri, 17 Apr 2020 13:00:57 +0200 (CEST)",
            "from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59])\n by Forcepoint Email with ESMTP id D47729C85B0848893CA2\n for <dev@dpdk.org>; Fri, 17 Apr 2020 19:00:54 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id\n 14.3.487.0; Fri, 17 Apr 2020 19:00:45 +0800"
        ],
        "From": "Lijun Ou <oulijun@huawei.com>",
        "To": "<xiaolong.ye@intel.com>, <qi.z.zhang@intel.com>",
        "CC": "<dev@dpdk.org>, <linuxarm@huawei.com>",
        "Date": "Fri, 17 Apr 2020 18:59:54 +0800",
        "Message-ID": "<1587121194-9098-1-git-send-email-oulijun@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH] app/testpmd: configure rxd and txd number\n\tcorrectly",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "When users configure rxds and txds by used port config cmd based\non testpmd application, it will not be able to configure rxd and\ntxd according to the max capability range supported by the actual\nNIC hardware. Due testpmd defects, it can only configure a fixed\nrange to 0 to 2048.\nThe final result is that an incorrect printing prompt appears and\ncannot be applied using rxd && txd according to the actual\ncapabilities supported by the device.\nIn order to solve the above problems, we modify the testpmd. First\nby calling the rte_eth_dev_info_get api to obtain the max and min\nrx/tx capability supported by the hns3, and then use this range\nto compare with the actual value by users configured and make\nreasonable limitation.\n\nSigned-off-by: Lijun Ou <oulijun@huawei.com>\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\n---\n app/test-pmd/cmdline.c |  11 +--\n app/test-pmd/testpmd.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++++-\n app/test-pmd/testpmd.h |   2 +\n 3 files changed, 190 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 982322c..eb76f1d 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -1922,18 +1922,13 @@ cmd_config_rx_tx_parsed(void *parsed_result,\n \t\tnb_txq = res->value;\n \t}\n \telse if (!strcmp(res->name, \"rxd\")) {\n-\t\tif (res->value <= 0 || res->value > RTE_TEST_RX_DESC_MAX) {\n-\t\t\tprintf(\"rxd %d invalid - must be > 0 && <= %d\\n\",\n-\t\t\t\t\tres->value, RTE_TEST_RX_DESC_MAX);\n+\t\tif (check_nb_rxd(res->value) != 0)\n \t\t\treturn;\n-\t\t}\n \t\tnb_rxd = res->value;\n \t} else if (!strcmp(res->name, \"txd\")) {\n-\t\tif (res->value <= 0 || res->value > RTE_TEST_TX_DESC_MAX) {\n-\t\t\tprintf(\"txd %d invalid - must be > 0 && <= %d\\n\",\n-\t\t\t\t\tres->value, RTE_TEST_TX_DESC_MAX);\n+\t\tif (check_nb_txd(res->value) != 0)\n \t\t\treturn;\n-\t\t}\n+\n \t\tnb_txd = res->value;\n \t} else {\n \t\tprintf(\"Unknown parameter\\n\");\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 035836a..042b75a 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -1156,6 +1156,177 @@ check_nb_txq(queueid_t txq)\n }\n \n /*\n+ * Get the allowed maximum number of RXDs of every rx queue.\n+ * *pid return the port id which has minimal value of\n+ * max_rxd in all queues of all ports.\n+ */\n+static uint16_t\n+get_allowed_max_nb_rxd(portid_t *pid)\n+{\n+\tuint16_t allowed_max_rxd = UINT16_MAX;\n+\tportid_t pi;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tRTE_ETH_FOREACH_DEV(pi) {\n+\t\tif (eth_dev_info_get_print_err(pi, &dev_info) != 0)\n+\t\t\tcontinue;\n+\n+\t\tif (dev_info.rx_desc_lim.nb_max < allowed_max_rxd) {\n+\t\t\tallowed_max_rxd = dev_info.rx_desc_lim.nb_max;\n+\t\t\t*pid = pi;\n+\t\t}\n+\t}\n+\treturn allowed_max_rxd;\n+}\n+\n+/*\n+ * Get the allowed minimal number of RXDs of every rx queue.\n+ * *pid return the port id which has minimal value of\n+ * min_rxd in all queues of all ports.\n+ */\n+static uint16_t\n+get_allowed_min_nb_rxd(portid_t *pid)\n+{\n+\tuint16_t allowed_min_rxd = 0;\n+\tportid_t pi;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tRTE_ETH_FOREACH_DEV(pi) {\n+\t\tif (eth_dev_info_get_print_err(pi, &dev_info) != 0)\n+\t\t\tcontinue;\n+\n+\t\tif (dev_info.rx_desc_lim.nb_min > allowed_min_rxd) {\n+\t\t\tallowed_min_rxd = dev_info.rx_desc_lim.nb_min;\n+\t\t\t*pid = pi;\n+\t\t}\n+\t}\n+\n+\treturn allowed_min_rxd;\n+}\n+\n+/*\n+ * Check input rxd is valid or not.\n+ * If input rxd is not greater than any of maximum number\n+ * of RXDs of every Rx queues and is not less than any of\n+ * minimal number of RXDs of every Rx queues, it is valid.\n+ * if valid, return 0, else return -1\n+ */\n+int\n+check_nb_rxd(queueid_t rxd)\n+{\n+\tuint16_t allowed_max_rxd;\n+\tuint16_t allowed_min_rxd;\n+\tportid_t pid = 0;\n+\n+\tallowed_max_rxd = get_allowed_max_nb_rxd(&pid);\n+\tif (rxd > allowed_max_rxd) {\n+\t\tprintf(\"Fail: input rxd (%u) can't be greater \"\n+\t\t       \"than max_rxds (%u) of port %u\\n\",\n+\t\t       rxd,\n+\t\t       allowed_max_rxd,\n+\t\t       pid);\n+\t\treturn -1;\n+\t}\n+\n+\tallowed_min_rxd = get_allowed_min_nb_rxd(&pid);\n+\tif (rxd < allowed_min_rxd) {\n+\t\tprintf(\"Fail: input rxd (%u) can't be less \"\n+\t\t       \"than min_rxds (%u) of port %u\\n\",\n+\t\t       rxd,\n+\t\t       allowed_min_rxd,\n+\t\t       pid);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Get the allowed maximum number of TXDs of every rx queues.\n+ * *pid return the port id which has minimal value of\n+ * max_txd in every tx queue.\n+ */\n+static uint16_t\n+get_allowed_max_nb_txd(portid_t *pid)\n+{\n+\tuint16_t allowed_max_txd = UINT16_MAX;\n+\tportid_t pi;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tRTE_ETH_FOREACH_DEV(pi) {\n+\t\tif (eth_dev_info_get_print_err(pi, &dev_info) != 0)\n+\t\t\tcontinue;\n+\n+\t\tif (dev_info.tx_desc_lim.nb_max < allowed_max_txd) {\n+\t\t\tallowed_max_txd = dev_info.tx_desc_lim.nb_max;\n+\t\t\t*pid = pi;\n+\t\t}\n+\t}\n+\treturn allowed_max_txd;\n+}\n+\n+/*\n+ * Get the allowed maximum number of TXDs of every tx queues.\n+ * *pid return the port id which has minimal value of\n+ * min_txd in every tx queue.\n+ */\n+static uint16_t\n+get_allowed_min_nb_txd(portid_t *pid)\n+{\n+\tuint16_t allowed_min_txd = 0;\n+\tportid_t pi;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tRTE_ETH_FOREACH_DEV(pi) {\n+\t\tif (eth_dev_info_get_print_err(pi, &dev_info) != 0)\n+\t\t\tcontinue;\n+\n+\t\tif (dev_info.tx_desc_lim.nb_min > allowed_min_txd) {\n+\t\t\tallowed_min_txd = dev_info.tx_desc_lim.nb_min;\n+\t\t\t*pid = pi;\n+\t\t}\n+\t}\n+\n+\treturn allowed_min_txd;\n+}\n+\n+/*\n+ * Check input txd is valid or not.\n+ * If input txd is not greater than any of maximum number\n+ * of TXDs of every Rx queues, it is valid.\n+ * if valid, return 0, else return -1\n+ */\n+int\n+check_nb_txd(queueid_t txd)\n+{\n+\tuint16_t allowed_max_txd;\n+\tuint16_t allowed_min_txd;\n+\tportid_t pid = 0;\n+\n+\tallowed_max_txd = get_allowed_max_nb_txd(&pid);\n+\tif (txd > allowed_max_txd) {\n+\t\tprintf(\"Fail: input txd (%u) can't be greater \"\n+\t\t       \"than max_txds (%u) of port %u\\n\",\n+\t\t       txd,\n+\t\t       allowed_max_txd,\n+\t\t       pid);\n+\t\treturn -1;\n+\t}\n+\n+\tallowed_min_txd = get_allowed_min_nb_txd(&pid);\n+\tif (txd < allowed_min_txd) {\n+\t\tprintf(\"Fail: input txd (%u) can't be less \"\n+\t\t       \"than min_txds (%u) of port %u\\n\",\n+\t\t       txd,\n+\t\t       allowed_min_txd,\n+\t\t       pid);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+\n+/*\n  * Get the allowed maximum number of hairpin queues.\n  * *pid return the port id which has minimal value of\n  * max_hairpin_queues in all ports.\n@@ -1212,6 +1383,8 @@ init_config(void)\n \tlcoreid_t  lc_id;\n \tuint8_t port_per_socket[RTE_MAX_NUMA_NODES];\n \tstruct rte_gro_param gro_param;\n+\tuint16_t allowed_max_rxd;\n+\tuint16_t allowed_max_txd;\n \tuint32_t gso_types;\n \tuint16_t data_size;\n \tbool warning = 0;\n@@ -1239,6 +1412,9 @@ init_config(void)\n \t\tfwd_lcores[lc_id]->cpuid_idx = lc_id;\n \t}\n \n+\tallowed_max_rxd = RTE_TEST_RX_DESC_MAX;\n+\tallowed_max_txd = RTE_TEST_RX_DESC_MAX;\n+\n \tRTE_ETH_FOREACH_DEV(pid) {\n \t\tport = &ports[pid];\n \t\t/* Apply default TxRx configuration for all ports */\n@@ -1299,6 +1475,13 @@ init_config(void)\n \t\t\t\twarning = 1;\n \t\t\t}\n \t\t}\n+\n+\t\t/* Get the maximum number of txd and rxd per queue. */\n+\t\tif (port->dev_info.tx_desc_lim.nb_max > allowed_max_rxd)\n+\t\t\tallowed_max_txd = port->dev_info.tx_desc_lim.nb_max;\n+\n+\t\tif (port->dev_info.rx_desc_lim.nb_max > allowed_max_txd)\n+\t\t\tallowed_max_rxd = port->dev_info.rx_desc_lim.nb_max;\n \t}\n \n \tif (warning)\n@@ -1317,9 +1500,9 @@ init_config(void)\n \tif (param_total_num_mbufs)\n \t\tnb_mbuf_per_pool = param_total_num_mbufs;\n \telse {\n-\t\tnb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX +\n+\t\tnb_mbuf_per_pool = allowed_max_rxd +\n \t\t\t(nb_lcores * mb_mempool_cache) +\n-\t\t\tRTE_TEST_TX_DESC_MAX + MAX_PKT_BURST;\n+\t\t\tallowed_max_txd + MAX_PKT_BURST;\n \t\tnb_mbuf_per_pool *= RTE_MAX_ETHPORTS;\n \t}\n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 7a7c73f..7ff4c5d 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -878,6 +878,8 @@ queueid_t get_allowed_max_nb_rxq(portid_t *pid);\n int check_nb_rxq(queueid_t rxq);\n queueid_t get_allowed_max_nb_txq(portid_t *pid);\n int check_nb_txq(queueid_t txq);\n+int check_nb_rxd(queueid_t rxd);\n+int check_nb_txd(queueid_t txd);\n queueid_t get_allowed_max_nb_hairpinq(portid_t *pid);\n int check_nb_hairpinq(queueid_t hairpinq);\n \n",
    "prefixes": []
}