From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: increase array for fetching supported FEC caps
Date: Thu, 24 Dec 2020 15:53:29 +0800 [thread overview]
Message-ID: <6956d15d-d64d-2480-fd27-12bceccfb249@huawei.com> (raw)
In-Reply-To: <1608504422-29220-2-git-send-email-rahul.lakkireddy@chelsio.com>
在 2020/12/21 6:47, Rahul Lakkireddy 写道:
> From: Karra Satwik <kaara.satwik@chelsio.com>
>
> Request the driver for number of entries in the FEC caps
> array and then dynamically allocate the array.
>
> Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> ---
> app/test-pmd/cmdline.c | 29 ++++++++++++++++++++---------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 2ccbaa039..d7a90d55e 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -16263,29 +16263,40 @@ cmd_show_fec_capability_parsed(void *parsed_result,
> __rte_unused struct cmdline *cl,
> __rte_unused void *data)
> {
> -#define FEC_CAP_NUM 2
> struct cmd_show_fec_capability_result *res = parsed_result;
> - struct rte_eth_fec_capa speed_fec_capa[FEC_CAP_NUM];
> - unsigned int num = FEC_CAP_NUM;
> - unsigned int ret_num;
> - int ret;
> + struct rte_eth_fec_capa *speed_fec_capa;
> + int num, ret;
>
> if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
> printf("Invalid port id %u\n", res->cmd_pid);
> return;
> }
>
> - ret = rte_eth_fec_get_capability(res->cmd_pid, speed_fec_capa, num);
Hi, the type of num is "unsigned int" in rte_eth_fec_get_capability,
please keep in accordance with it.
> + ret = rte_eth_fec_get_capability(res->cmd_pid, NULL, 0);
> if (ret == -ENOTSUP) {
> printf("Function not implemented\n");
> return;
> } else if (ret < 0) {
> - printf("Get FEC capability failed\n");
> + printf("Get FEC capability failed: %d\n", ret);
> + return;
> + }
> +
> + num = ret;
> + speed_fec_capa = calloc(num, sizeof(*speed_fec_capa));
> + if (!speed_fec_capa) {
> + printf("Failed to alloc FEC capability buffer\n");
> return;
> }
>
> - ret_num = (unsigned int)ret;
> - show_fec_capability(ret_num, speed_fec_capa);
> + ret = rte_eth_fec_get_capability(res->cmd_pid, speed_fec_capa, num);
> + if (ret < 0) {
> + printf("Error getting FEC capability: %d\n", ret);
> + goto out;
> + }
> +
> + show_fec_capability(num, speed_fec_capa);
> +out:
> + free(speed_fec_capa);
> }
>
> cmdline_parse_token_string_t cmd_show_fec_capability_show =
>
next prev parent reply other threads:[~2020-12-24 7:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-20 22:47 [dpdk-dev] [PATCH] app/testpmd: fix start index for showing FEC array Rahul Lakkireddy
2020-12-20 22:47 ` [dpdk-dev] [PATCH] app/testpmd: increase array for fetching supported FEC caps Rahul Lakkireddy
2020-12-23 6:02 ` Li, Xiaoyun
2020-12-23 12:25 ` [dpdk-dev] [PATCH v2] " Rahul Lakkireddy
2020-12-24 11:18 ` [dpdk-dev] [PATCH v3] " Rahul Lakkireddy
2020-12-25 1:06 ` Min Hu (Connor)
2021-01-15 15:27 ` Ferruh Yigit
2020-12-24 7:53 ` Min Hu (Connor) [this message]
2020-12-21 9:07 ` [dpdk-dev] [PATCH] app/testpmd: fix start index for showing FEC array Min Hu (Connor)
2020-12-23 12:31 ` Rahul Lakkireddy
2020-12-25 13:49 ` Rahul Lakkireddy
2020-12-23 6:07 ` [dpdk-dev] [dpdk-stable] " Li, Xiaoyun
2021-01-15 13:53 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6956d15d-d64d-2480-fd27-12bceccfb249@huawei.com \
--to=humin29@huawei.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).