[V2 17/18] net/hinic3: add FDIR flow control module

Stephen Hemminger stephen at networkplumber.org
Thu Jun 26 21:58:07 CEST 2025


On Wed, 25 Jun 2025 10:28:13 +0800
Feifei Wang <wff_light at vip.163.com> wrote:

> diff --git a/drivers/net/hinic3/hinic3_fdir.c b/drivers/net/hinic3/hinic3_fdir.c
> new file mode 100644
> index 0000000000..32fc5472bd
> --- /dev/null
> +++ b/drivers/net/hinic3/hinic3_fdir.c
> @@ -0,0 +1,1394 @@

Suggestion: Don't call this fdir since that implies the old Intel Flow Director
stuff which was deprecated and (mostly) removed from DPDK.
Your code is for the current rte_flow API.

> +static int
> +hinic3_flow_fdir_vxlan(struct rte_flow_error *error,
> +		       struct hinic3_filter_t *filter,
> +		       const struct rte_flow_item *flow_item)
> +{
> +	const struct rte_flow_item_vxlan *spec_vxlan, *mask_vxlan;
> +	uint32_t vxlan_vni_id = 0;
> +
> +	spec_vxlan = (const struct rte_flow_item_vxlan *)flow_item->spec;
> +	mask_vxlan = (const struct rte_flow_item_vxlan *)flow_item->mask;
> +
> +	filter->fdir_filter.tunnel_type = HINIC3_FDIR_TUNNEL_MODE_VXLAN;
> +
> +	if (!spec_vxlan && !mask_vxlan) {
> +		return 0;
> +	} else if (filter->fdir_filter.outer_ip_type == HINIC3_FDIR_IP_TYPE_IPV6) {
> +		rte_flow_error_set(error, EINVAL, HINIC3_FLOW_ERROR_TYPE_ITEM,
> +				   flow_item,
> +				   "Invalid fdir filter vxlan mask or spec, "
> +				   "ipv6 vxlan, don't support vni");
> +		return -rte_errno;
> +	}
> +
> +	if (!spec_vxlan || !mask_vxlan) {
> +		rte_flow_error_set(error, EINVAL, HINIC3_FLOW_ERROR_TYPE_ITEM,
> +				   flow_item,
> +				   "Invalid fdir filter vxlan mask or spec");
> +		return -rte_errno;
> +	}
> +
> +	rte_memcpy(((uint8_t *)&vxlan_vni_id + 1), spec_vxlan->vni, 3);

No need for rte_memcpy here, not fast path. use memcpy instead.
Don't hard code value of 3; instead use sizeof(spec_vxlan->vni)


More information about the dev mailing list