[dpdk-dev] [PATCH v6 2/2] app/testpmd: add configuration for input set

Lu, Wenzhuo wenzhuo.lu at intel.com
Thu Jan 4 07:51:59 CET 2018


Hi Beilei

> -----Original Message-----
> From: Xing, Beilei
> Sent: Friday, December 8, 2017 3:52 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>; Lu, Wenzhuo
> <wenzhuo.lu at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
> Cc: dev at dpdk.org; Chilikin, Andrey <andrey.chilikin at intel.com>
> Subject: [PATCH v6 2/2] app/testpmd: add configuration for input set
> 
> This patch adds command to configure input set for RSS/flow director/flow
> director flexible payload.
> 
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  app/test-pmd/cmdline.c | 237
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 237 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> f71d963..79fdd0b 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c


> 
> @@ -14652,6 +14661,232 @@ cmdline_parse_inst_t cmd_ddp_get_list = {
>  	},
>  };
> 
> +/* Configure input set */
> +struct cmd_cfg_input_set_result {
> +	cmdline_fixed_string_t port;
> +	cmdline_fixed_string_t cfg;
> +	portid_t port_id;
> +	cmdline_fixed_string_t pctype;
> +	uint8_t pctype_id;
> +	cmdline_fixed_string_t inset_type;
> +	cmdline_fixed_string_t opt;
> +	cmdline_fixed_string_t field;
> +	uint8_t field_idx;
> +};
> +
> +static void
> +cmd_cfg_input_set_parsed(
> +	void *parsed_result,
> +	__attribute__((unused)) struct cmdline *cl,
> +	__attribute__((unused)) void *data)
> +{
> +	struct cmd_cfg_input_set_result *res = parsed_result; #ifdef
> +RTE_LIBRTE_I40E_PMD
> +	enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
> +	struct rte_pmd_i40e_inset inset;
> +	int ret;
> +#endif
> +
> +	if (res->port_id > nb_ports) {
> +		printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
> +		return;
> +	}
> +
> +	if (!all_ports_stopped()) {
> +		printf("Please stop all ports first\n");
> +		return;
> +	}
> +
> +#ifdef RTE_LIBRTE_I40E_PMD
I don't think it's good to comment all the code below.  Because if you run this CLI on a NIC which is not i40e, the CLI will fail silently. Please reference the existing code about how to use this macro.

> +	if (!strcmp(res->inset_type, "hash_inset"))
> +		inset_type = INSET_HASH;
> +	else if (!strcmp(res->inset_type, "fdir_inset"))
> +		inset_type = INSET_FDIR;
> +	else if (!strcmp(res->inset_type, "fdir_flx_inset"))
> +		inset_type = INSET_FDIR_FLX;
> +	ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id,
> +				     &inset, inset_type);
> +	if (ret) {
> +		printf("Failed to get input set.\n");
> +		return;
> +	}
> +
> +	if (!strcmp(res->opt, "get")) {
> +		ret = rte_pmd_i40e_inset_field_get(inset.inset,
> +						   res->field_idx);
> +		if (ret)
> +			printf("Field index %d is enabled.\n", res->field_idx);
> +		else
> +			printf("Field index %d is disabled.\n", res->field_idx);
> +		return;
> +	} else if (!strcmp(res->opt, "set"))
> +		ret = rte_pmd_i40e_inset_field_set(&inset.inset,
> +						   res->field_idx);
> +	else if (!strcmp(res->opt, "clear"))
> +		ret = rte_pmd_i40e_inset_field_clear(&inset.inset,
> +						     res->field_idx);
> +	if (ret) {
> +		printf("Failed to configure input set field.\n");
> +		return;
> +	}
> +
> +	ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
> +				     &inset, inset_type);
> +	if (ret) {
> +		printf("Failed to set input set.\n");
> +		return;
> +	}
> +
> +#endif


Another thing, please update the testpmd_funcs.rst for the new CLIs.

> --
> 2.5.5



More information about the dev mailing list