All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>, <dev@dpdk.org>
Cc: <kaara.satwik@chelsio.com>, <xiaoyun.li@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: increase array for fetching supported FEC caps
Date: Fri, 25 Dec 2020 09:06:23 +0800	[thread overview]
Message-ID: <0f3e6ee5-9ab0-86e1-f30f-7281d5f056cc@huawei.com> (raw)
In-Reply-To: <1608808729-3768-1-git-send-email-rahul.lakkireddy@chelsio.com>

Acked-by: Min Hu (Connor) <humin29@huawei.com>

在 2020/12/24 19:18, 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>
> Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
> v3:
> - Use unsigned int num, instead of int num
> 
> v2:
> - Replace if (!speed_fec_capa) with if (speed_fec_capa == NULL)
> 
>   app/test-pmd/cmdline.c | 28 ++++++++++++++++++++--------
>   1 file changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 2ccbaa039..1dfad5df4 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -16263,11 +16263,9 @@ 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;
> +	struct rte_eth_fec_capa *speed_fec_capa;
> +	unsigned int num;
>   	int ret;
>   
>   	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
> @@ -16275,17 +16273,31 @@ cmd_show_fec_capability_parsed(void *parsed_result,
>   		return;
>   	}
>   
> -	ret = rte_eth_fec_get_capability(res->cmd_pid, speed_fec_capa, num);
> +	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 = (unsigned int)ret;
> +	speed_fec_capa = calloc(num, sizeof(*speed_fec_capa));
> +	if (speed_fec_capa == NULL) {
> +		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 =
> 

  reply	other threads:[~2020-12-25  1:06 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) [this message]
2021-01-15 15:27         ` Ferruh Yigit
2020-12-24  7:53   ` [dpdk-dev] [PATCH] " Min Hu (Connor)
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=0f3e6ee5-9ab0-86e1-f30f-7281d5f056cc@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=kaara.satwik@chelsio.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=xiaoyun.li@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.