[PATCH v4] examples/l3fwd: merge l3fwd-acl into l3fwd

Morrissey, Sean sean.morrissey at intel.com
Fri Apr 8 21:01:00 CEST 2022


Hi Konstantin,

Comment on some of your feedback below. I will make the rest of the 
changes and send a new version.

On 08/04/2022 18:26, Ananyev, Konstantin wrote:
> Hi Sean,
>
> Few nits, that I didn't spot previously, pls see below.
>   
>> +
>> +/* Setup ACL context. 8< */
> Looks like some typo within comments.

I believe these characters are needed in the comments to state the start 
and end of the automated code snippets for the docs.

>> +static struct rte_acl_ctx*
>> +app_acl_init(struct rte_acl_rule *route_base,
>> +		struct rte_acl_rule *acl_base, unsigned int route_num,
>> +		unsigned int acl_num, int ipv6, int socketid)
>> +{
>> +	char name[PATH_MAX];
>> +	struct rte_acl_param acl_param;
>> +	struct rte_acl_config acl_build_param;
>> +	struct rte_acl_ctx *context;
>> +	int dim = ipv6 ? RTE_DIM(ipv6_defs) : RTE_DIM(ipv4_defs);
>> +
>> +	/* Create ACL contexts */
>> +	snprintf(name, sizeof(name), "%s%d",
>> +			ipv6 ? L3FWD_ACL_IPV6_NAME : L3FWD_ACL_IPV4_NAME,
>> +			socketid);
>> +
>> +	acl_param.name = name;
>> +	acl_param.socket_id = socketid;
>> +	acl_param.rule_size = RTE_ACL_RULE_SZ(dim);
>> +	acl_param.max_rule_num = MAX_ACL_RULE_NUM;
>> +
>> +	context = rte_acl_create(&acl_param);
>> +	if (context == NULL)
>> +		rte_exit(EXIT_FAILURE, "Failed to create ACL context\n");
>> +
>> +	if (parm_config.alg != RTE_ACL_CLASSIFY_DEFAULT &&
>> +			rte_acl_set_ctx_classify(context, parm_config.alg) != 0)
>> +		rte_exit(EXIT_FAILURE,
>> +			"Failed to setup classify method for  ACL context\n");
>> +
>> +	if (rte_acl_add_rules(context, route_base, route_num) < 0)
>> +		rte_exit(EXIT_FAILURE, "add rules failed\n");
>> +
>> +	if (rte_acl_add_rules(context, acl_base, acl_num) < 0)
>> +		rte_exit(EXIT_FAILURE, "add rules failed\n");
>> +
>> +	/* Perform builds */
>> +	memset(&acl_build_param, 0, sizeof(acl_build_param));
>> +
>> +	acl_build_param.num_categories = DEFAULT_MAX_CATEGORIES;
>> +	acl_build_param.num_fields = dim;
>> +	memcpy(&acl_build_param.defs, ipv6 ? ipv6_defs : ipv4_defs,
>> +		ipv6 ? sizeof(ipv6_defs) : sizeof(ipv4_defs));
>> +
>> +	if (rte_acl_build(context, &acl_build_param) != 0)
>> +		rte_exit(EXIT_FAILURE, "Failed to build ACL trie\n");
>> +
>> +	rte_acl_dump(context);
>> +
>> +	return context;
>> +}
>> +/* >8 End of ACL context setup. */
> Typo in comments.

Same as above.



More information about the dev mailing list