src/dpdk/drivers/net/mvpp2/mrvl_flow.c
static int
mrvl_parse_vlan(const struct rte_flow_item *item,
		struct rte_flow *flow,
		struct rte_flow_error *error)
{
	const struct rte_flow_item_vlan *spec = NULL, *mask = NULL;
	uint16_t m;
	int ret, i;

	ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask,
			      &rte_flow_item_vlan_mask,
			      sizeof(struct rte_flow_item_vlan), error);
	if (ret)
		return ret;

	m = rte_be_to_cpu_16(mask->tci);
	if (m & MRVL_VLAN_ID_MASK) {
		MRVL_LOG(WARNING, "vlan id mask is ignored");
		ret = mrvl_parse_vlan_id(spec, mask, flow);
		if (ret)
			goto out;
	}

	if (m & MRVL_VLAN_PRI_MASK) {
		MRVL_LOG(WARNING, "vlan pri mask is ignored");
		ret = mrvl_parse_vlan_pri(spec, mask, flow);
		if (ret)
			goto out;
	}

	if (mask->inner_type) {
		struct rte_flow_item_eth spec_eth = {
			.type = spec->inner_type,
		};
		struct rte_flow_item_eth mask_eth = {
			.type = mask->inner_type,
		};

		/* TPID is not supported so if ETH_TYPE was selected,
		 * error is return. else, classify eth-type with the tpid value
		 */
		for (i = 0; i < flow->rule.num_fields; i++)
			if (flow->table_key.proto_field[i].proto ==
			    MV_NET_PROTO_ETH &&
			    flow->table_key.proto_field[i].field.eth ==
			    MV_NET_ETH_F_TYPE) {
				rte_flow_error_set(error, ENOTSUP,
						   RTE_FLOW_ERROR_TYPE_ITEM,
						   item,
						   "VLAN TPID matching is not supported");
				return -rte_errno;
			}

		MRVL_LOG(WARNING, "inner eth type mask is ignored");
		ret = mrvl_parse_type(&spec_eth, &mask_eth, flow);
		if (ret)
			goto out;
	}

	return 0;
out:
	rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
			   "Reached maximum number of fields in cls tbl key\n");
	return -rte_errno;
}
/**
 * Parse vlan flow item.
 *
 * @param item Pointer to the flow item.
 * @param flow Pointer to the flow.
 * @param error Pointer to the flow error.
 * @returns 0 on success, negative value otherwise.
 */
Parse vlan flow item.
@param item Pointer to the flow item.
@param flow Pointer to the flow.
@param error Pointer to the flow error.
@returns 0 on success, negative value otherwise.
Parse vlan flow item . @param item Pointer to the flow item . @param flow Pointer to the flow . @param error Pointer to the flow error . @returns 0 on success negative value otherwise .
static int
mrvl_parse_vlan(const struct rte_flow_item *item,
		struct rte_flow *flow,
		struct rte_flow_error *error)
{
	const struct rte_flow_item_vlan *spec = NULL, *mask = NULL;
	uint16_t m;
	int ret, i;
	ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask,
			      &rte_flow_item_vlan_mask,
			      sizeof(struct rte_flow_item_vlan), error);
	if (ret)
		return ret;
	m = rte_be_to_cpu_16(mask->tci);
	if (m & MRVL_VLAN_ID_MASK) {
		MRVL_LOG(WARNING, "vlan id mask is ignored");
		ret = mrvl_parse_vlan_id(spec, mask, flow);
		if (ret)
			goto out;
	}
	if (m & MRVL_VLAN_PRI_MASK) {
		MRVL_LOG(WARNING, "vlan pri mask is ignored");
		ret = mrvl_parse_vlan_pri(spec, mask, flow);
		if (ret)
			goto out;
	}
	if (mask->inner_type) {
		struct rte_flow_item_eth spec_eth = {
			.type = spec->inner_type,
		};
		struct rte_flow_item_eth mask_eth = {
			.type = mask->inner_type,
		};
		for (i = 0; i < flow->rule.num_fields; i++)
			if (flow->table_key.proto_field[i].proto ==
			    MV_NET_PROTO_ETH &&
			    flow->table_key.proto_field[i].field.eth ==
			    MV_NET_ETH_F_TYPE) {
				rte_flow_error_set(error, ENOTSUP,
						   RTE_FLOW_ERROR_TYPE_ITEM,
						   item,
						   "VLAN TPID matching is not supported");
				return -rte_errno;
			}
		MRVL_LOG(WARNING, "inner eth type mask is ignored");
		ret = mrvl_parse_type(&spec_eth, &mask_eth, flow);
		if (ret)
			goto out;
	}
	return 0;
out:
	rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
			   "Reached maximum number of fields in cls tbl key\n");
	return -rte_errno;
}
static int mrvl_parse_vlan ( const struct rte_flow_item * item , struct rte_flow * flow , struct rte_flow_error * error ) { const struct rte_flow_item_vlan * spec = NULL , * mask = NULL ; uint16_t m ; int ret , i ; ret = mrvl_parse_init ( item , ( const void * * ) & spec , ( const void * * ) & mask , & rte_flow_item_vlan_mask , sizeof ( struct rte_flow_item_vlan ) , error ) ; if ( ret ) return ret ; m = rte_be_to_cpu_16 ( mask -> tci ) ; if ( m & MRVL_VLAN_ID_MASK ) { MRVL_LOG ( WARNING , " " ) ; ret = mrvl_parse_vlan_id ( spec , mask , flow ) ; if ( ret ) goto out ; } if ( m & MRVL_VLAN_PRI_MASK ) { MRVL_LOG ( WARNING , " " ) ; ret = mrvl_parse_vlan_pri ( spec , mask , flow ) ; if ( ret ) goto out ; } if ( mask -> inner_type ) { struct rte_flow_item_eth spec_eth = { . type = spec -> inner_type , } ; struct rte_flow_item_eth mask_eth = { . type = mask -> inner_type , } ; for ( i = 0 ; i < flow -> rule . num_fields ; i ++ ) if ( flow -> table_key . proto_field [ i ] . proto == MV_NET_PROTO_ETH && flow -> table_key . proto_field [ i ] . field . eth == MV_NET_ETH_F_TYPE ) { rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ITEM , item , " " ) ; return - rte_errno ; } MRVL_LOG ( WARNING , " " ) ; ret = mrvl_parse_type ( & spec_eth , & mask_eth , flow ) ; if ( ret ) goto out ; } return 0 ; out : rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_UNSPECIFIED , NULL , " \n " ) ; return - rte_errno ; }
Parse vlan flow item.
Parse vlan flow item .
/* TPID is not supported so if ETH_TYPE was selected,
		 * error is return. else, classify eth-type with the tpid value
		 */