src/dpdk/drivers/net/igc/igc_flow.c
static int
igc_parse_pattern_ether(const struct rte_flow_item *item,
		struct igc_all_filter *filter,
		struct rte_flow_error *error)
{
	const struct rte_flow_item_eth *spec = item->spec;
	const struct rte_flow_item_eth *mask = item->mask;
	struct igc_ethertype_filter *ether;

	if (mask == NULL) {
		/* only n-tuple and SYN filter match the pattern */
		IGC_SET_FILTER_MASK(filter, IGC_FILTER_MASK_NTUPLE |
				IGC_FILTER_MASK_TCP_SYN);
		return 0;
	}

	/* only ether-type filter match the pattern*/
	IGC_SET_FILTER_MASK(filter, IGC_FILTER_MASK_ETHER);

	/* destination and source MAC address are not supported */
	if (!rte_is_zero_ether_addr(&mask->src) ||
		!rte_is_zero_ether_addr(&mask->dst))
		return rte_flow_error_set(error, EINVAL,
				RTE_FLOW_ERROR_TYPE_ITEM_MASK, item,
				"Only support ether-type");

	/* ether-type mask bits must be all 1 */
	if (IGC_NOT_ALL_BITS_SET(mask->type))
		return rte_flow_error_set(error, EINVAL,
				RTE_FLOW_ERROR_TYPE_ITEM_MASK, item,
				"Ethernet type mask bits must be all 1");

	ether = &filter->ethertype;

	/* get ether-type */
	ether->ether_type = rte_be_to_cpu_16(spec->type);

	/* ether-type should not be IPv4 and IPv6 */
	if (ether->ether_type == RTE_ETHER_TYPE_IPV4 ||
		ether->ether_type == RTE_ETHER_TYPE_IPV6 ||
		ether->ether_type == 0)
		return rte_flow_error_set(error, EINVAL,
			RTE_FLOW_ERROR_TYPE_ITEM, NULL,
			"IPv4/IPv6/0 not supported by ethertype filter");
	return 0;
}
/* Parse pattern type of ethernet header */
Parse pattern type of ethernet header
Parse pattern type of ethernet header
static int
igc_parse_pattern_ether(const struct rte_flow_item *item,
		struct igc_all_filter *filter,
		struct rte_flow_error *error)
{
	const struct rte_flow_item_eth *spec = item->spec;
	const struct rte_flow_item_eth *mask = item->mask;
	struct igc_ethertype_filter *ether;
	if (mask == NULL) {
		IGC_SET_FILTER_MASK(filter, IGC_FILTER_MASK_NTUPLE |
				IGC_FILTER_MASK_TCP_SYN);
		return 0;
	}
	IGC_SET_FILTER_MASK(filter, IGC_FILTER_MASK_ETHER);
	if (!rte_is_zero_ether_addr(&mask->src) ||
		!rte_is_zero_ether_addr(&mask->dst))
		return rte_flow_error_set(error, EINVAL,
				RTE_FLOW_ERROR_TYPE_ITEM_MASK, item,
				"Only support ether-type");
	if (IGC_NOT_ALL_BITS_SET(mask->type))
		return rte_flow_error_set(error, EINVAL,
				RTE_FLOW_ERROR_TYPE_ITEM_MASK, item,
				"Ethernet type mask bits must be all 1");
	ether = &filter->ethertype;
	ether->ether_type = rte_be_to_cpu_16(spec->type);
	if (ether->ether_type == RTE_ETHER_TYPE_IPV4 ||
		ether->ether_type == RTE_ETHER_TYPE_IPV6 ||
		ether->ether_type == 0)
		return rte_flow_error_set(error, EINVAL,
			RTE_FLOW_ERROR_TYPE_ITEM, NULL,
			"IPv4/IPv6/0 not supported by ethertype filter");
	return 0;
}
static int igc_parse_pattern_ether ( const struct rte_flow_item * item , struct igc_all_filter * filter , struct rte_flow_error * error ) { const struct rte_flow_item_eth * spec = item -> spec ; const struct rte_flow_item_eth * mask = item -> mask ; struct igc_ethertype_filter * ether ; if ( mask == NULL ) { IGC_SET_FILTER_MASK ( filter , IGC_FILTER_MASK_NTUPLE | IGC_FILTER_MASK_TCP_SYN ) ; return 0 ; } IGC_SET_FILTER_MASK ( filter , IGC_FILTER_MASK_ETHER ) ; if ( ! rte_is_zero_ether_addr ( & mask -> src ) || ! rte_is_zero_ether_addr ( & mask -> dst ) ) return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM_MASK , item , " " ) ; if ( IGC_NOT_ALL_BITS_SET ( mask -> type ) ) return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM_MASK , item , " " ) ; ether = & filter -> ethertype ; ether -> ether_type = rte_be_to_cpu_16 ( spec -> type ) ; if ( ether -> ether_type == RTE_ETHER_TYPE_IPV4 || ether -> ether_type == RTE_ETHER_TYPE_IPV6 || ether -> ether_type == 0 ) return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM , NULL , " " ) ; return 0 ; }
Parse pattern type of ethernet header
Parse pattern type of ethernet header
/* only n-tuple and SYN filter match the pattern */ /* only ether-type filter match the pattern*/ /* destination and source MAC address are not supported */ /* ether-type mask bits must be all 1 */ /* get ether-type */ /* ether-type should not be IPv4 and IPv6 */