src/dpdk/drivers/net/mvpp2/mrvl_flow.c
static int
mrvl_parse_mac(const struct rte_flow_item_eth *spec,
	       const struct rte_flow_item_eth *mask,
	       int parse_dst, struct rte_flow *flow)
{
	struct pp2_cls_rule_key_field *key_field;
	const uint8_t *k, *m;

	if (parse_dst) {
		k = spec->dst.addr_bytes;
		m = mask->dst.addr_bytes;

		flow->table_key.proto_field[flow->rule.num_fields].field.eth =
			MV_NET_ETH_F_DA;
	} else {
		k = spec->src.addr_bytes;
		m = mask->src.addr_bytes;

		flow->table_key.proto_field[flow->rule.num_fields].field.eth =
			MV_NET_ETH_F_SA;
	}

	key_field = &flow->rule.fields[flow->rule.num_fields];
	mrvl_alloc_key_mask(key_field);
	key_field->size = 6;

	snprintf((char *)key_field->key, MRVL_CLS_STR_SIZE_MAX,
		 "%02x:%02x:%02x:%02x:%02x:%02x",
		 k[0], k[1], k[2], k[3], k[4], k[5]);

	snprintf((char *)key_field->mask, MRVL_CLS_STR_SIZE_MAX,
		 "%02x:%02x:%02x:%02x:%02x:%02x",
		 m[0], m[1], m[2], m[3], m[4], m[5]);

	flow->table_key.proto_field[flow->rule.num_fields].proto =
		MV_NET_PROTO_ETH;
	flow->table_key.key_size += key_field->size;

	flow->rule.num_fields += 1;

	return 0;
}
/**
 * Parse the eth flow item.
 *
 * This will create classifier rule that matches either destination or source
 * mac.
 *
 * @param spec Pointer to the specific flow item.
 * @param mask Pointer to the specific flow item's mask.
 * @param parse_dst Parse either destination or source mac address.
 * @param flow Pointer to the flow.
 * @return 0 in case of success, negative error value otherwise.
 */
Parse the eth flow item.
This will create classifier rule that matches either destination or source
mac.

@param spec Pointer to the specific flow item.
@param mask Pointer to the specific flow item's mask.
@param parse_dst Parse either destination or source mac address.
@param flow Pointer to the flow.
@return 0 in case of success, negative error value otherwise.
Parse the eth flow item . This will create classifier rule that matches either destination or source mac . @param spec Pointer to the specific flow item . @param mask Pointer to the specific flow item ' s mask . @param parse_dst Parse either destination or source mac address . @param flow Pointer to the flow . @return 0 in case of success negative error value otherwise .
static int
mrvl_parse_mac(const struct rte_flow_item_eth *spec,
	       const struct rte_flow_item_eth *mask,
	       int parse_dst, struct rte_flow *flow)
{
	struct pp2_cls_rule_key_field *key_field;
	const uint8_t *k, *m;
	if (parse_dst) {
		k = spec->dst.addr_bytes;
		m = mask->dst.addr_bytes;
		flow->table_key.proto_field[flow->rule.num_fields].field.eth =
			MV_NET_ETH_F_DA;
	} else {
		k = spec->src.addr_bytes;
		m = mask->src.addr_bytes;
		flow->table_key.proto_field[flow->rule.num_fields].field.eth =
			MV_NET_ETH_F_SA;
	}
	key_field = &flow->rule.fields[flow->rule.num_fields];
	mrvl_alloc_key_mask(key_field);
	key_field->size = 6;
	snprintf((char *)key_field->key, MRVL_CLS_STR_SIZE_MAX,
		 "%02x:%02x:%02x:%02x:%02x:%02x",
		 k[0], k[1], k[2], k[3], k[4], k[5]);
	snprintf((char *)key_field->mask, MRVL_CLS_STR_SIZE_MAX,
		 "%02x:%02x:%02x:%02x:%02x:%02x",
		 m[0], m[1], m[2], m[3], m[4], m[5]);
	flow->table_key.proto_field[flow->rule.num_fields].proto =
		MV_NET_PROTO_ETH;
	flow->table_key.key_size += key_field->size;
	flow->rule.num_fields += 1;
	return 0;
}
static int mrvl_parse_mac ( const struct rte_flow_item_eth * spec , const struct rte_flow_item_eth * mask , int parse_dst , struct rte_flow * flow ) { struct pp2_cls_rule_key_field * key_field ; const uint8_t * k , * m ; if ( parse_dst ) { k = spec -> dst . addr_bytes ; m = mask -> dst . addr_bytes ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . field . eth = MV_NET_ETH_F_DA ; } else { k = spec -> src . addr_bytes ; m = mask -> src . addr_bytes ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . field . eth = MV_NET_ETH_F_SA ; } key_field = & flow -> rule . fields [ flow -> rule . num_fields ] ; mrvl_alloc_key_mask ( key_field ) ; key_field -> size = 6 ; snprintf ( ( char * ) key_field -> key , MRVL_CLS_STR_SIZE_MAX , " " , k [ 0 ] , k [ 1 ] , k [ 2 ] , k [ 3 ] , k [ 4 ] , k [ 5 ] ) ; snprintf ( ( char * ) key_field -> mask , MRVL_CLS_STR_SIZE_MAX , " " , m [ 0 ] , m [ 1 ] , m [ 2 ] , m [ 3 ] , m [ 4 ] , m [ 5 ] ) ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . proto = MV_NET_PROTO_ETH ; flow -> table_key . key_size += key_field -> size ; flow -> rule . num_fields += 1 ; return 0 ; }
Parse the eth flow item.
Parse the eth flow item .