src/dpdk/drivers/net/enic/enic_flow.c
static int
enic_copy_item_raw_v2(struct copy_item_args *arg)
{
	const struct rte_flow_item *item = arg->item;
	struct filter_v2 *enic_filter = arg->filter;
	uint8_t *inner_ofst = arg->inner_ofst;
	const struct rte_flow_item_raw *spec = item->spec;
	const struct rte_flow_item_raw *mask = item->mask;
	struct filter_generic_1 *gp = &enic_filter->u.generic_1;

	ENICPMD_FUNC_TRACE();

	/* Cannot be used for inner packet */
	if (*inner_ofst)
		return EINVAL;
	/* Need both spec and mask */
	if (!spec || !mask)
		return EINVAL;
	/* Only supports relative with offset 0 */
	if (!spec->relative || spec->offset != 0 || spec->search || spec->limit)
		return EINVAL;
	/* Need non-null pattern that fits within the NIC's filter pattern */
	if (spec->length == 0 ||
	    spec->length + sizeof(struct rte_udp_hdr) > FILTER_GENERIC_1_KEY_LEN ||
	    !spec->pattern || !mask->pattern)
		return EINVAL;
	/*
	 * Mask fields, including length, are often set to zero. Assume that
	 * means "same as spec" to avoid breaking existing apps. If length
	 * is not zero, then it should be >= spec length.
	 *
	 * No more pattern follows this, so append to the L4 layer instead of
	 * L5 to work with both recent and older VICs.
	 */
	if (mask->length != 0 && mask->length < spec->length)
		return EINVAL;
	memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr),
	       mask->pattern, spec->length);
	memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr),
	       spec->pattern, spec->length);

	return 0;
}
/*
 * Copy raw item into version 2 NIC filter. Currently, raw pattern match is
 * very limited. It is intended for matching UDP tunnel header (e.g. vxlan
 * or geneve).
 */
Copy raw item into version 2 NIC filter. Currently, raw pattern match is
very limited. It is intended for matching UDP tunnel header .
Copy raw item into version 2 NIC filter . Currently raw pattern match is very limited . It is intended for matching UDP tunnel header .
static int
enic_copy_item_raw_v2(struct copy_item_args *arg)
{
	const struct rte_flow_item *item = arg->item;
	struct filter_v2 *enic_filter = arg->filter;
	uint8_t *inner_ofst = arg->inner_ofst;
	const struct rte_flow_item_raw *spec = item->spec;
	const struct rte_flow_item_raw *mask = item->mask;
	struct filter_generic_1 *gp = &enic_filter->u.generic_1;
	ENICPMD_FUNC_TRACE();
	if (*inner_ofst)
		return EINVAL;
	if (!spec || !mask)
		return EINVAL;
	if (!spec->relative || spec->offset != 0 || spec->search || spec->limit)
		return EINVAL;
	if (spec->length == 0 ||
	    spec->length + sizeof(struct rte_udp_hdr) > FILTER_GENERIC_1_KEY_LEN ||
	    !spec->pattern || !mask->pattern)
		return EINVAL;
	if (mask->length != 0 && mask->length < spec->length)
		return EINVAL;
	memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr),
	       mask->pattern, spec->length);
	memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr),
	       spec->pattern, spec->length);
	return 0;
}
static int enic_copy_item_raw_v2 ( struct copy_item_args * arg ) { const struct rte_flow_item * item = arg -> item ; struct filter_v2 * enic_filter = arg -> filter ; uint8_t * inner_ofst = arg -> inner_ofst ; const struct rte_flow_item_raw * spec = item -> spec ; const struct rte_flow_item_raw * mask = item -> mask ; struct filter_generic_1 * gp = & enic_filter -> u . generic_1 ; ENICPMD_FUNC_TRACE ( ) ; if ( * inner_ofst ) return EINVAL ; if ( ! spec || ! mask ) return EINVAL ; if ( ! spec -> relative || spec -> offset != 0 || spec -> search || spec -> limit ) return EINVAL ; if ( spec -> length == 0 || spec -> length + sizeof ( struct rte_udp_hdr ) > FILTER_GENERIC_1_KEY_LEN || ! spec -> pattern || ! mask -> pattern ) return EINVAL ; if ( mask -> length != 0 && mask -> length < spec -> length ) return EINVAL ; memcpy ( gp -> layer [ FILTER_GENERIC_1_L4 ] . mask + sizeof ( struct rte_udp_hdr ) , mask -> pattern , spec -> length ) ; memcpy ( gp -> layer [ FILTER_GENERIC_1_L4 ] . val + sizeof ( struct rte_udp_hdr ) , spec -> pattern , spec -> length ) ; return 0 ; }
Copy raw item into version 2 NIC filter.
Copy raw item into version 2 NIC filter .
/* Cannot be used for inner packet */ /* Need both spec and mask */ /* Only supports relative with offset 0 */ /* Need non-null pattern that fits within the NIC's filter pattern */ /*
	 * Mask fields, including length, are often set to zero. Assume that
	 * means "same as spec" to avoid breaking existing apps. If length
	 * is not zero, then it should be >= spec length.
	 *
	 * No more pattern follows this, so append to the L4 layer instead of
	 * L5 to work with both recent and older VICs.
	 */