src/dpdk/drivers/net/mvpp2/mrvl_flow.c
static int
mrvl_parse_ip6_addr(const struct rte_flow_item_ipv6 *spec,
	       const struct rte_flow_item_ipv6 *mask,
	       int parse_dst, struct rte_flow *flow)
{
	struct pp2_cls_rule_key_field *key_field;
	int size = sizeof(spec->hdr.dst_addr);
	struct in6_addr k, m;

	memset(&k, 0, sizeof(k));
	if (parse_dst) {
		memcpy(k.s6_addr, spec->hdr.dst_addr, size);
		memcpy(m.s6_addr, mask->hdr.dst_addr, size);

		flow->table_key.proto_field[flow->rule.num_fields].field.ipv6 =
			MV_NET_IP6_F_DA;
	} else {
		memcpy(k.s6_addr, spec->hdr.src_addr, size);
		memcpy(m.s6_addr, mask->hdr.src_addr, size);

		flow->table_key.proto_field[flow->rule.num_fields].field.ipv6 =
			MV_NET_IP6_F_SA;
	}

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

	inet_ntop(AF_INET6, &k, (char *)key_field->key, MRVL_CLS_STR_SIZE_MAX);
	inet_ntop(AF_INET6, &m, (char *)key_field->mask, MRVL_CLS_STR_SIZE_MAX);

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

	flow->rule.num_fields += 1;

	return 0;
}
/**
 * Parse either source or destination ip addresses of the ipv6 rte flow item.
 *
 * This will create classifier rule that matches either destination
 * or source ip field.
 *
 * @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 ipv6 address.
 * @param flow Pointer to the flow.
 * @return 0 in case of success, negative error value otherwise.
 */
Parse either source or destination ip addresses of the ipv6 rte flow item.
This will create classifier rule that matches either destination
or source ip field.

@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 ipv6 address.
@param flow Pointer to the flow.
@return 0 in case of success, negative error value otherwise.
Parse either source or destination ip addresses of the ipv6 rte flow item . This will create classifier rule that matches either destination or source ip field . @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 ipv6 address . @param flow Pointer to the flow . @return 0 in case of success negative error value otherwise .
static int
mrvl_parse_ip6_addr(const struct rte_flow_item_ipv6 *spec,
	       const struct rte_flow_item_ipv6 *mask,
	       int parse_dst, struct rte_flow *flow)
{
	struct pp2_cls_rule_key_field *key_field;
	int size = sizeof(spec->hdr.dst_addr);
	struct in6_addr k, m;
	memset(&k, 0, sizeof(k));
	if (parse_dst) {
		memcpy(k.s6_addr, spec->hdr.dst_addr, size);
		memcpy(m.s6_addr, mask->hdr.dst_addr, size);
		flow->table_key.proto_field[flow->rule.num_fields].field.ipv6 =
			MV_NET_IP6_F_DA;
	} else {
		memcpy(k.s6_addr, spec->hdr.src_addr, size);
		memcpy(m.s6_addr, mask->hdr.src_addr, size);
		flow->table_key.proto_field[flow->rule.num_fields].field.ipv6 =
			MV_NET_IP6_F_SA;
	}
	key_field = &flow->rule.fields[flow->rule.num_fields];
	mrvl_alloc_key_mask(key_field);
	key_field->size = 16;
	inet_ntop(AF_INET6, &k, (char *)key_field->key, MRVL_CLS_STR_SIZE_MAX);
	inet_ntop(AF_INET6, &m, (char *)key_field->mask, MRVL_CLS_STR_SIZE_MAX);
	flow->table_key.proto_field[flow->rule.num_fields].proto =
		MV_NET_PROTO_IP6;
	flow->table_key.key_size += key_field->size;
	flow->rule.num_fields += 1;
	return 0;
}
static int mrvl_parse_ip6_addr ( const struct rte_flow_item_ipv6 * spec , const struct rte_flow_item_ipv6 * mask , int parse_dst , struct rte_flow * flow ) { struct pp2_cls_rule_key_field * key_field ; int size = sizeof ( spec -> hdr . dst_addr ) ; struct in6_addr k , m ; memset ( & k , 0 , sizeof ( k ) ) ; if ( parse_dst ) { memcpy ( k . s6_addr , spec -> hdr . dst_addr , size ) ; memcpy ( m . s6_addr , mask -> hdr . dst_addr , size ) ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . field . ipv6 = MV_NET_IP6_F_DA ; } else { memcpy ( k . s6_addr , spec -> hdr . src_addr , size ) ; memcpy ( m . s6_addr , mask -> hdr . src_addr , size ) ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . field . ipv6 = MV_NET_IP6_F_SA ; } key_field = & flow -> rule . fields [ flow -> rule . num_fields ] ; mrvl_alloc_key_mask ( key_field ) ; key_field -> size = 16 ; inet_ntop ( AF_INET6 , & k , ( char * ) key_field -> key , MRVL_CLS_STR_SIZE_MAX ) ; inet_ntop ( AF_INET6 , & m , ( char * ) key_field -> mask , MRVL_CLS_STR_SIZE_MAX ) ; flow -> table_key . proto_field [ flow -> rule . num_fields ] . proto = MV_NET_PROTO_IP6 ; flow -> table_key . key_size += key_field -> size ; flow -> rule . num_fields += 1 ; return 0 ; }
Parse either source or destination ip addresses of the ipv6 rte flow item.
Parse either source or destination ip addresses of the ipv6 rte flow item .