get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 138753,
    "url": "http://patches.dpdk.org/api/patches/138753/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240322222543.23548-3-damodharam.ammepalli@broadcom.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": "<20240322222543.23548-3-damodharam.ammepalli@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240322222543.23548-3-damodharam.ammepalli@broadcom.com",
    "date": "2024-03-22T22:25:43",
    "name": "[RFC,2/2] testpmd: Add speed lanes to testpmd config and show command",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "177f943ce5aeed8e772e360dcfa338929c6a91d0",
    "submitter": {
        "id": 2741,
        "url": "http://patches.dpdk.org/api/people/2741/?format=api",
        "name": "Damodharam Ammepalli",
        "email": "damodharam.ammepalli@broadcom.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/20240322222543.23548-3-damodharam.ammepalli@broadcom.com/mbox/",
    "series": [
        {
            "id": 31606,
            "url": "http://patches.dpdk.org/api/series/31606/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31606",
            "date": "2024-03-22T22:25:41",
            "name": "Add support for link speed lanes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/31606/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/138753/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/138753/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 790BB43D26;\n\tFri, 22 Mar 2024 23:27:00 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1528842F1B;\n\tFri, 22 Mar 2024 23:26:51 +0100 (CET)",
            "from mail-qv1-f51.google.com (mail-qv1-f51.google.com\n [209.85.219.51]) by mails.dpdk.org (Postfix) with ESMTP id AF97A42F03\n for <dev@dpdk.org>; Fri, 22 Mar 2024 23:26:49 +0100 (CET)",
            "by mail-qv1-f51.google.com with SMTP id\n 6a1803df08f44-696499bd61eso25800696d6.0\n for <dev@dpdk.org>; Fri, 22 Mar 2024 15:26:49 -0700 (PDT)",
            "from dhcp-10-193-55-224.dhcp.broadcom.net ([192.19.224.250])\n by smtp.gmail.com with ESMTPSA id\n mx17-20020a0562142e1100b0069679a663e6sm57003qvb.21.2024.03.22.15.26.46\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 22 Mar 2024 15:26:47 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=broadcom.com; s=google; t=1711146408; x=1711751208; darn=dpdk.org;\n h=mime-version:references:in-reply-to:message-id:date:subject:cc:to\n :from:from:to:cc:subject:date:message-id:reply-to;\n bh=/ebsP1NAs8JOBSmY1qKb0o6BSCoUT1T61xbcHESCjlU=;\n b=LGVX+iPRgYJ/JTzJR2hBgNoOJj45tCFxvV/FEsPHJ/oRpPxBYrOlEi8nXihOXSdPpY\n 8QUc1u7XG3UsAehpn3Vq+cejcQSBf6y6LAZtypzP0Kl3MZjjn6qgOyqn2fZnJyXi+p8o\n aE5t2cu6wHA1TWkiUlo5/dTyHMEHH00zKF/g4=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1711146408; x=1711751208;\n h=mime-version:references:in-reply-to:message-id:date:subject:cc:to\n :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=/ebsP1NAs8JOBSmY1qKb0o6BSCoUT1T61xbcHESCjlU=;\n b=QM5P7dpY8kTyTiBpNYsfc3hZD+zO7auVJG3z5Qew46zBmQJhqKcNn+ORRKL3mP613V\n hCV/Ex9B9s9MnZEo5Mz3NBqtpj2z6GBig6B+HSNQ2EwCZSimuUPo1+XWSS0H5pC4D3Xl\n pxFl2y5fFvNl0OXcyi/ZfBhjVBb+UHTgvpDVUqYHFwCXZOxgrAfqfbWFgy9JFvUo9ZY9\n 7w31TSm+lkCHqEN+LseJRbusGsuSAvfE+DJG5IZphlujJE5Mz2ga4poV82WkSZLCc9mo\n yA/MCEqdnVTVtlfvsY9zOohAcuEogvP2JH+8tvxQ5SoLKsK+fg+c63243rg953Jwb9J1\n j3rQ==",
        "X-Gm-Message-State": "AOJu0YxNymUBVp6W4acZ/DiiuSa+CWiOqVnW/5mOZEyAbhjWyWO7O9id\n 67MCKkM1jaVk2GuVz7eVeo6lMsxtktoPKmFL4spL7H8evpen7ArvSVmTbrjNC4wx2VsAumO9gUm\n eHanf0+Br4pIfnXC8syNYX0OroktzFrIZf53xEOJDmLWMN1okwd2M4JjXcmAdu79w8BVjsCuwRV\n bRigsvz4oR1xMqeKOXts/wOu2b1OT4Czo9Ug57/w==",
        "X-Google-Smtp-Source": "\n AGHT+IGLZ8tuse2M85B60vzgEnMqpxjSu0iHOm03ddNrc+0jLRzsttO4BmPoQhQlAbNJ1+QW8c0iXA==",
        "X-Received": "by 2002:a05:6214:c8f:b0:690:b887:901a with SMTP id\n r15-20020a0562140c8f00b00690b887901amr883238qvr.48.1711146408104;\n Fri, 22 Mar 2024 15:26:48 -0700 (PDT)",
        "From": "Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,\n Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "Subject": "[RFC 2/2] testpmd: Add speed lanes to testpmd config and show command",
        "Date": "Fri, 22 Mar 2024 15:25:43 -0700",
        "Message-Id": "<20240322222543.23548-3-damodharam.ammepalli@broadcom.com>",
        "X-Mailer": "git-send-email 2.39.3",
        "In-Reply-To": "<20240322222543.23548-1-damodharam.ammepalli@broadcom.com>",
        "References": "<20240322222543.23548-1-damodharam.ammepalli@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Type": "multipart/signed; protocol=\"application/pkcs7-signature\";\n micalg=sha-256; boundary=\"000000000000d5cf000614475177\"",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "Add speed lanes configuration and display commands support\nto testpmd. Also provide display the lanes info show device info.\n\ntestpmd>\ntestpmd> port stop 0\ntestpmd> port config 0 speed_lanes 4\ntestpmd> port config 0 speed 200000 duplex full\ntestpmd> port start 0\ntestpmd> show port summary 0\nNumber of available ports: 2\nPort MAC Address       Name         Driver         Status   Link     Lanes\n0    14:23:F2:C3:BA:D2 0000:b1:00.0 net_bnxt       up       200 Gbps 4\ntestpmd>\n\ntestpmd> show port info 0\n\n********************* Infos for port 0  *********************\nMAC address: 14:23:F2:C3:BA:D2\nDevice name: 0000:b1:00.0\nDriver name: net_bnxt\nFirmware-version: 228.9.115.0\nConnect to socket: 2\nmemory allocation on the socket: 2\nLink status: up\nLink speed: 200 Gbps\nLanes: 4\nLink duplex: full-duplex\nAutoneg status: Off\n\nSigned-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>\nReviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n app/test-pmd/cmdline.c | 142 +++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/config.c  |  13 ++--\n 2 files changed, 151 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex b7759e38a8..785e5dd4de 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -1361,6 +1361,27 @@ struct cmd_config_speed_all {\n \tcmdline_fixed_string_t value2;\n };\n \n+static int\n+cmd_validate_lanes(portid_t pid, uint32_t *lanes)\n+{\n+\tstruct rte_eth_speed_lanes_capa spd_lanes = {0};\n+\tint ret;\n+\n+\tret = rte_eth_speed_lanes_get(pid, &spd_lanes);\n+\t/* if not supported default lanes to 0 */\n+\tif (ret == -ENOTSUP) {\n+\t\t*lanes = 0;\n+\t\treturn 0;\n+\t}\n+\n+\tif (*lanes > spd_lanes.max_lanes_cap) {\n+\t\tfprintf(stderr, \"Invalid lanes %d configuration\\n\", *lanes);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)\n {\n@@ -1676,6 +1697,125 @@ static cmdline_parse_inst_t cmd_config_loopback_specific = {\n \t},\n };\n \n+/* *** configure speed_lanes for all ports *** */\n+struct cmd_config_speed_lanes_all {\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t keyword;\n+\tcmdline_fixed_string_t all;\n+\tcmdline_fixed_string_t item;\n+\tuint32_t lanes;\n+};\n+\n+static void\n+cmd_config_speed_lanes_all_parsed(void *parsed_result,\n+\t\t\t\t  __rte_unused struct cmdline *cl,\n+\t\t\t\t  __rte_unused void *data)\n+{\n+\tstruct cmd_config_speed_lanes_all *res = parsed_result;\n+\tportid_t pid;\n+\n+\tif (!all_ports_stopped()) {\n+\t\tfprintf(stderr, \"Please stop all ports first\\n\");\n+\t\treturn;\n+\t}\n+\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\tif (cmd_validate_lanes(pid, &res->lanes))\n+\t\t\treturn;\n+\t\trte_eth_speed_lanes_set(pid, res->lanes);\n+\t}\n+\n+\tcmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);\n+}\n+\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_all_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_all, port, \"port\");\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_all_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_all, keyword,\n+\t\t\t\t \"config\");\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_all_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_all, all, \"all\");\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_all_item =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_all, item,\n+\t\t\t\t \"speed_lanes\");\n+static cmdline_parse_token_num_t cmd_config_speed_lanes_all_lanes =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_config_speed_lanes_all, lanes, RTE_UINT32);\n+\n+static cmdline_parse_inst_t cmd_config_speed_lanes_all = {\n+\t.f = cmd_config_speed_lanes_all_parsed,\n+\t.data = NULL,\n+\t.help_str = \"port config all speed_lanes <value>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_config_speed_lanes_all_port,\n+\t\t(void *)&cmd_config_speed_lanes_all_keyword,\n+\t\t(void *)&cmd_config_speed_lanes_all_all,\n+\t\t(void *)&cmd_config_speed_lanes_all_item,\n+\t\t(void *)&cmd_config_speed_lanes_all_lanes,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** configure speed_lanes for specific port *** */\n+struct cmd_config_speed_lanes_specific {\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t keyword;\n+\tuint16_t port_id;\n+\tcmdline_fixed_string_t item;\n+\tuint32_t lanes;\n+};\n+\n+static void\n+cmd_config_speed_lanes_specific_parsed(void *parsed_result,\n+\t\t\t\t       __rte_unused struct cmdline *cl,\n+\t\t\t\t       __rte_unused void *data)\n+{\n+\tstruct cmd_config_speed_lanes_specific *res = parsed_result;\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tif (!port_is_stopped(res->port_id)) {\n+\t\tfprintf(stderr, \"Please stop port %u first\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tif (cmd_validate_lanes(res->port_id, &res->lanes))\n+\t\treturn;\n+\trte_eth_speed_lanes_set(res->port_id, res->lanes);\n+\n+\tcmd_reconfig_device_queue(res->port_id, 1, 1);\n+}\n+\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_specific_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_specific, port,\n+\t\t\t\t \"port\");\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_specific_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_specific, keyword,\n+\t\t\t\t \"config\");\n+static cmdline_parse_token_num_t cmd_config_speed_lanes_specific_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_config_speed_lanes_specific, port_id,\n+\t\t\t      RTE_UINT16);\n+static cmdline_parse_token_string_t cmd_config_speed_lanes_specific_item =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_config_speed_lanes_specific, item,\n+\t\t\t\t \"speed_lanes\");\n+static cmdline_parse_token_num_t cmd_config_speed_lanes_specific_lanes =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_config_speed_lanes_specific, lanes,\n+\t\t\t      RTE_UINT32);\n+\n+static cmdline_parse_inst_t cmd_config_speed_lanes_specific = {\n+\t.f = cmd_config_speed_lanes_specific_parsed,\n+\t.data = NULL,\n+\t.help_str = \"port config <port_id> speed_lanes <value>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_config_speed_lanes_specific_port,\n+\t\t(void *)&cmd_config_speed_lanes_specific_keyword,\n+\t\t(void *)&cmd_config_speed_lanes_specific_id,\n+\t\t(void *)&cmd_config_speed_lanes_specific_item,\n+\t\t(void *)&cmd_config_speed_lanes_specific_lanes,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** configure txq/rxq, txd/rxd *** */\n struct cmd_config_rx_tx {\n \tcmdline_fixed_string_t port;\n@@ -13381,6 +13521,8 @@ static cmdline_parse_ctx_t builtin_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_show_port_cman_config,\n \t(cmdline_parse_inst_t *)&cmd_set_port_cman_config,\n \t(cmdline_parse_inst_t *)&cmd_config_tx_affinity_map,\n+\t(cmdline_parse_inst_t *)&cmd_config_speed_lanes_all,\n+\t(cmdline_parse_inst_t *)&cmd_config_speed_lanes_specific,\n \tNULL,\n };\n \ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex ba1007ace6..9f846c5e84 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -779,6 +779,7 @@ port_infos_display(portid_t port_id)\n \tstruct rte_ether_addr mac_addr;\n \tstruct rte_eth_link link;\n \tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_speed_lanes_capa spd_lanes = {0};\n \tint vlan_offload;\n \tstruct rte_mempool * mp;\n \tstatic const char *info_border = \"*********************\";\n@@ -828,6 +829,8 @@ port_infos_display(portid_t port_id)\n \n \tprintf(\"\\nLink status: %s\\n\", (link.link_status) ? (\"up\") : (\"down\"));\n \tprintf(\"Link speed: %s\\n\", rte_eth_link_speed_to_str(link.link_speed));\n+\trte_eth_speed_lanes_get(port_id, &spd_lanes);\n+\tprintf(\"Lanes: %d\\n\", spd_lanes.active_lanes);\n \tprintf(\"Link duplex: %s\\n\", (link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX) ?\n \t       (\"full-duplex\") : (\"half-duplex\"));\n \tprintf(\"Autoneg status: %s\\n\", (link.link_autoneg == RTE_ETH_LINK_AUTONEG) ?\n@@ -962,8 +965,8 @@ port_summary_header_display(void)\n \n \tport_number = rte_eth_dev_count_avail();\n \tprintf(\"Number of available ports: %i\\n\", port_number);\n-\tprintf(\"%-4s %-17s %-12s %-14s %-8s %s\\n\", \"Port\", \"MAC Address\", \"Name\",\n-\t\t\t\"Driver\", \"Status\", \"Link\");\n+\tprintf(\"%-4s %-17s %-12s %-14s %-8s %-8s %s\\n\", \"Port\", \"MAC Address\", \"Name\",\n+\t\t\t\"Driver\", \"Status\", \"Link\", \"Lanes\");\n }\n \n void\n@@ -972,6 +975,7 @@ port_summary_display(portid_t port_id)\n \tstruct rte_ether_addr mac_addr;\n \tstruct rte_eth_link link;\n \tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_speed_lanes_capa spd_lanes = {0};\n \tchar name[RTE_ETH_NAME_MAX_LEN];\n \tint ret;\n \n@@ -993,10 +997,11 @@ port_summary_display(portid_t port_id)\n \tif (ret != 0)\n \t\treturn;\n \n-\tprintf(\"%-4d \" RTE_ETHER_ADDR_PRT_FMT \" %-12s %-14s %-8s %s\\n\",\n+\trte_eth_speed_lanes_get(port_id, &spd_lanes);\n+\tprintf(\"%-4d \" RTE_ETHER_ADDR_PRT_FMT \" %-12s %-14s %-8s %-8s %d\\n\",\n \t\tport_id, RTE_ETHER_ADDR_BYTES(&mac_addr), name,\n \t\tdev_info.driver_name, (link.link_status) ? (\"up\") : (\"down\"),\n-\t\trte_eth_link_speed_to_str(link.link_speed));\n+\t\trte_eth_link_speed_to_str(link.link_speed), spd_lanes.active_lanes);\n }\n \n void\n",
    "prefixes": [
        "RFC",
        "2/2"
    ]
}