net/mlx5: use a better name for the flow parser

struct mlx5_flow_parse was commonly used with the name "flow" confusing
sometimes the development.  The variable name is replaced by parser to
reflect its use.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
This commit is contained in:
Nélio Laranjeiro 2017-10-09 16:45:01 +02:00 committed by Ferruh Yigit
parent 2b8d515d3b
commit 8c80f6ae6c

View File

@ -426,8 +426,8 @@ mlx5_flow_item_validate(const struct rte_flow_item *item,
* Associated actions (list terminated by the END action). * Associated actions (list terminated by the END action).
* @param[out] error * @param[out] error
* Perform verbose error reporting if not NULL. * Perform verbose error reporting if not NULL.
* @param[in, out] flow * @param[in, out] parser
* Flow structure to update. * Internal parser structure.
* *
* @return * @return
* 0 on success, a negative errno value otherwise and rte_errno is set. * 0 on success, a negative errno value otherwise and rte_errno is set.
@ -438,14 +438,14 @@ priv_flow_convert(struct priv *priv,
const struct rte_flow_item items[], const struct rte_flow_item items[],
const struct rte_flow_action actions[], const struct rte_flow_action actions[],
struct rte_flow_error *error, struct rte_flow_error *error,
struct mlx5_flow_parse *flow) struct mlx5_flow_parse *parser)
{ {
const struct mlx5_flow_items *cur_item = mlx5_flow_items; const struct mlx5_flow_items *cur_item = mlx5_flow_items;
(void)priv; (void)priv;
*flow = (struct mlx5_flow_parse){ *parser = (struct mlx5_flow_parse){
.ibv_attr = flow->ibv_attr, .ibv_attr = parser->ibv_attr,
.create = flow->create, .create = parser->create,
.offset = sizeof(struct ibv_flow_attr), .offset = sizeof(struct ibv_flow_attr),
.mark_id = MLX5_FLOW_MARK_DEFAULT, .mark_id = MLX5_FLOW_MARK_DEFAULT,
}; };
@ -481,7 +481,7 @@ priv_flow_convert(struct priv *priv,
if (actions->type == RTE_FLOW_ACTION_TYPE_VOID) { if (actions->type == RTE_FLOW_ACTION_TYPE_VOID) {
continue; continue;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) { } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) {
flow->drop = 1; parser->drop = 1;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE) { } else if (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
const struct rte_flow_action_queue *queue = const struct rte_flow_action_queue *queue =
(const struct rte_flow_action_queue *) (const struct rte_flow_action_queue *)
@ -491,13 +491,13 @@ priv_flow_convert(struct priv *priv,
if (!queue || (queue->index > (priv->rxqs_n - 1))) if (!queue || (queue->index > (priv->rxqs_n - 1)))
goto exit_action_not_supported; goto exit_action_not_supported;
for (n = 0; n < flow->queues_n; ++n) { for (n = 0; n < parser->queues_n; ++n) {
if (flow->queues[n] == queue->index) { if (parser->queues[n] == queue->index) {
found = 1; found = 1;
break; break;
} }
} }
if (flow->queues_n > 1 && !found) { if (parser->queues_n > 1 && !found) {
rte_flow_error_set(error, ENOTSUP, rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, RTE_FLOW_ERROR_TYPE_ACTION,
actions, actions,
@ -505,9 +505,9 @@ priv_flow_convert(struct priv *priv,
return -rte_errno; return -rte_errno;
} }
if (!found) { if (!found) {
flow->queue = 1; parser->queue = 1;
flow->queues_n = 1; parser->queues_n = 1;
flow->queues[0] = queue->index; parser->queues[0] = queue->index;
} }
} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) { } else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
const struct rte_flow_action_rss *rss = const struct rte_flow_action_rss *rss =
@ -522,12 +522,12 @@ priv_flow_convert(struct priv *priv,
"no valid queues"); "no valid queues");
return -rte_errno; return -rte_errno;
} }
if (flow->queues_n == 1) { if (parser->queues_n == 1) {
uint16_t found = 0; uint16_t found = 0;
assert(flow->queues_n); assert(parser->queues_n);
for (n = 0; n < rss->num; ++n) { for (n = 0; n < rss->num; ++n) {
if (flow->queues[0] == if (parser->queues[0] ==
rss->queue[n]) { rss->queue[n]) {
found = 1; found = 1;
break; break;
@ -552,10 +552,10 @@ priv_flow_convert(struct priv *priv,
return -rte_errno; return -rte_errno;
} }
} }
flow->queue = 1; parser->queue = 1;
for (n = 0; n < rss->num; ++n) for (n = 0; n < rss->num; ++n)
flow->queues[n] = rss->queue[n]; parser->queues[n] = rss->queue[n];
flow->queues_n = rss->num; parser->queues_n = rss->num;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_MARK) { } else if (actions->type == RTE_FLOW_ACTION_TYPE_MARK) {
const struct rte_flow_action_mark *mark = const struct rte_flow_action_mark *mark =
(const struct rte_flow_action_mark *) (const struct rte_flow_action_mark *)
@ -575,19 +575,19 @@ priv_flow_convert(struct priv *priv,
" and 16777199"); " and 16777199");
return -rte_errno; return -rte_errno;
} }
flow->mark = 1; parser->mark = 1;
flow->mark_id = mark->id; parser->mark_id = mark->id;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) { } else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) {
flow->mark = 1; parser->mark = 1;
} else { } else {
goto exit_action_not_supported; goto exit_action_not_supported;
} }
} }
if (flow->mark && !flow->ibv_attr && !flow->drop) if (parser->mark && !parser->ibv_attr && !parser->drop)
flow->offset += sizeof(struct ibv_flow_spec_action_tag); parser->offset += sizeof(struct ibv_flow_spec_action_tag);
if (!flow->ibv_attr && flow->drop) if (!parser->ibv_attr && parser->drop)
flow->offset += sizeof(struct ibv_flow_spec_action_drop); parser->offset += sizeof(struct ibv_flow_spec_action_drop);
if (!flow->queue && !flow->drop) { if (!parser->queue && !parser->drop) {
rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "no valid action"); NULL, "no valid action");
return -rte_errno; return -rte_errno;
@ -616,16 +616,16 @@ priv_flow_convert(struct priv *priv,
cur_item->mask_sz); cur_item->mask_sz);
if (err) if (err)
goto exit_item_not_supported; goto exit_item_not_supported;
if (flow->ibv_attr && cur_item->convert) { if (parser->ibv_attr && cur_item->convert) {
err = cur_item->convert(items, err = cur_item->convert(items,
(cur_item->default_mask ? (cur_item->default_mask ?
cur_item->default_mask : cur_item->default_mask :
cur_item->mask), cur_item->mask),
flow); parser);
if (err) if (err)
goto exit_item_not_supported; goto exit_item_not_supported;
} else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) { } else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
if (flow->inner) { if (parser->inner) {
rte_flow_error_set(error, ENOTSUP, rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ITEM, RTE_FLOW_ERROR_TYPE_ITEM,
items, items,
@ -633,9 +633,9 @@ priv_flow_convert(struct priv *priv,
" VXLAN encapsulations"); " VXLAN encapsulations");
return -rte_errno; return -rte_errno;
} }
flow->inner = 1; parser->inner = 1;
} }
flow->offset += cur_item->dst_sz; parser->offset += cur_item->dst_sz;
} }
return 0; return 0;
exit_item_not_supported: exit_item_not_supported:
@ -665,17 +665,16 @@ mlx5_flow_create_eth(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_eth *spec = item->spec; const struct rte_flow_item_eth *spec = item->spec;
const struct rte_flow_item_eth *mask = item->mask; const struct rte_flow_item_eth *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_eth *eth; struct ibv_flow_spec_eth *eth;
const unsigned int eth_size = sizeof(struct ibv_flow_spec_eth); const unsigned int eth_size = sizeof(struct ibv_flow_spec_eth);
unsigned int i; unsigned int i;
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 2; parser->hash_fields = 0;
flow->hash_fields = 0; eth = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
eth = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
*eth = (struct ibv_flow_spec_eth) { *eth = (struct ibv_flow_spec_eth) {
.type = flow->inner | IBV_FLOW_SPEC_ETH, .type = parser->inner | IBV_FLOW_SPEC_ETH,
.size = eth_size, .size = eth_size,
}; };
if (!spec) if (!spec)
@ -714,11 +713,11 @@ mlx5_flow_create_vlan(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_vlan *spec = item->spec; const struct rte_flow_item_vlan *spec = item->spec;
const struct rte_flow_item_vlan *mask = item->mask; const struct rte_flow_item_vlan *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_eth *eth; struct ibv_flow_spec_eth *eth;
const unsigned int eth_size = sizeof(struct ibv_flow_spec_eth); const unsigned int eth_size = sizeof(struct ibv_flow_spec_eth);
eth = (void *)((uintptr_t)flow->ibv_attr + flow->offset - eth_size); eth = (void *)((uintptr_t)parser->ibv_attr + parser->offset - eth_size);
if (!spec) if (!spec)
return 0; return 0;
if (!mask) if (!mask)
@ -746,17 +745,15 @@ mlx5_flow_create_ipv4(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *spec = item->spec;
const struct rte_flow_item_ipv4 *mask = item->mask; const struct rte_flow_item_ipv4 *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_ipv4_ext *ipv4; struct ibv_flow_spec_ipv4_ext *ipv4;
unsigned int ipv4_size = sizeof(struct ibv_flow_spec_ipv4_ext); unsigned int ipv4_size = sizeof(struct ibv_flow_spec_ipv4_ext);
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 1; parser->hash_fields = (IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4);
flow->hash_fields = (IBV_RX_HASH_SRC_IPV4 | ipv4 = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
IBV_RX_HASH_DST_IPV4);
ipv4 = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
*ipv4 = (struct ibv_flow_spec_ipv4_ext) { *ipv4 = (struct ibv_flow_spec_ipv4_ext) {
.type = flow->inner | IBV_FLOW_SPEC_IPV4_EXT, .type = parser->inner | IBV_FLOW_SPEC_IPV4_EXT,
.size = ipv4_size, .size = ipv4_size,
}; };
if (!spec) if (!spec)
@ -800,18 +797,16 @@ mlx5_flow_create_ipv6(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_ipv6 *spec = item->spec; const struct rte_flow_item_ipv6 *spec = item->spec;
const struct rte_flow_item_ipv6 *mask = item->mask; const struct rte_flow_item_ipv6 *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_ipv6 *ipv6; struct ibv_flow_spec_ipv6 *ipv6;
unsigned int ipv6_size = sizeof(struct ibv_flow_spec_ipv6); unsigned int ipv6_size = sizeof(struct ibv_flow_spec_ipv6);
unsigned int i; unsigned int i;
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 1; parser->hash_fields = (IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6);
flow->hash_fields = (IBV_RX_HASH_SRC_IPV6 | ipv6 = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
IBV_RX_HASH_DST_IPV6);
ipv6 = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
*ipv6 = (struct ibv_flow_spec_ipv6) { *ipv6 = (struct ibv_flow_spec_ipv6) {
.type = flow->inner | IBV_FLOW_SPEC_IPV6, .type = parser->inner | IBV_FLOW_SPEC_IPV6,
.size = ipv6_size, .size = ipv6_size,
}; };
if (!spec) if (!spec)
@ -857,17 +852,16 @@ mlx5_flow_create_udp(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_udp *spec = item->spec; const struct rte_flow_item_udp *spec = item->spec;
const struct rte_flow_item_udp *mask = item->mask; const struct rte_flow_item_udp *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_tcp_udp *udp; struct ibv_flow_spec_tcp_udp *udp;
unsigned int udp_size = sizeof(struct ibv_flow_spec_tcp_udp); unsigned int udp_size = sizeof(struct ibv_flow_spec_tcp_udp);
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 0; parser->hash_fields |= (IBV_RX_HASH_SRC_PORT_UDP |
flow->hash_fields |= (IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP);
IBV_RX_HASH_DST_PORT_UDP); udp = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
udp = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
*udp = (struct ibv_flow_spec_tcp_udp) { *udp = (struct ibv_flow_spec_tcp_udp) {
.type = flow->inner | IBV_FLOW_SPEC_UDP, .type = parser->inner | IBV_FLOW_SPEC_UDP,
.size = udp_size, .size = udp_size,
}; };
if (!spec) if (!spec)
@ -901,17 +895,16 @@ mlx5_flow_create_tcp(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *spec = item->spec;
const struct rte_flow_item_tcp *mask = item->mask; const struct rte_flow_item_tcp *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_tcp_udp *tcp; struct ibv_flow_spec_tcp_udp *tcp;
unsigned int tcp_size = sizeof(struct ibv_flow_spec_tcp_udp); unsigned int tcp_size = sizeof(struct ibv_flow_spec_tcp_udp);
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 0; parser->hash_fields |= (IBV_RX_HASH_SRC_PORT_TCP |
flow->hash_fields |= (IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP);
IBV_RX_HASH_DST_PORT_TCP); tcp = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
tcp = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
*tcp = (struct ibv_flow_spec_tcp_udp) { *tcp = (struct ibv_flow_spec_tcp_udp) {
.type = flow->inner | IBV_FLOW_SPEC_TCP, .type = parser->inner | IBV_FLOW_SPEC_TCP,
.size = tcp_size, .size = tcp_size,
}; };
if (!spec) if (!spec)
@ -945,7 +938,7 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item,
{ {
const struct rte_flow_item_vxlan *spec = item->spec; const struct rte_flow_item_vxlan *spec = item->spec;
const struct rte_flow_item_vxlan *mask = item->mask; const struct rte_flow_item_vxlan *mask = item->mask;
struct mlx5_flow_parse *flow = (struct mlx5_flow_parse *)data; struct mlx5_flow_parse *parser = (struct mlx5_flow_parse *)data;
struct ibv_flow_spec_tunnel *vxlan; struct ibv_flow_spec_tunnel *vxlan;
unsigned int size = sizeof(struct ibv_flow_spec_tunnel); unsigned int size = sizeof(struct ibv_flow_spec_tunnel);
union vni { union vni {
@ -953,15 +946,14 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item,
uint8_t vni[4]; uint8_t vni[4];
} id; } id;
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->ibv_attr->priority = 0;
id.vni[0] = 0; id.vni[0] = 0;
vxlan = (void *)((uintptr_t)flow->ibv_attr + flow->offset); vxlan = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
*vxlan = (struct ibv_flow_spec_tunnel) { *vxlan = (struct ibv_flow_spec_tunnel) {
.type = flow->inner | IBV_FLOW_SPEC_VXLAN_TUNNEL, .type = parser->inner | IBV_FLOW_SPEC_VXLAN_TUNNEL,
.size = size, .size = size,
}; };
flow->inner = IBV_FLOW_SPEC_INNER; parser->inner = IBV_FLOW_SPEC_INNER;
if (!spec) if (!spec)
return 0; return 0;
if (!mask) if (!mask)
@ -978,26 +970,26 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item,
/** /**
* Convert mark/flag action to Verbs specification. * Convert mark/flag action to Verbs specification.
* *
* @param flow * @param parser
* Pointer to MLX5 flow structure. * Internal parser structure.
* @param mark_id * @param mark_id
* Mark identifier. * Mark identifier.
*/ */
static int static int
mlx5_flow_create_flag_mark(struct mlx5_flow_parse *flow, uint32_t mark_id) mlx5_flow_create_flag_mark(struct mlx5_flow_parse *parser, uint32_t mark_id)
{ {
struct ibv_flow_spec_action_tag *tag; struct ibv_flow_spec_action_tag *tag;
unsigned int size = sizeof(struct ibv_flow_spec_action_tag); unsigned int size = sizeof(struct ibv_flow_spec_action_tag);
assert(flow->mark); assert(parser->mark);
tag = (void *)((uintptr_t)flow->ibv_attr + flow->offset); tag = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
*tag = (struct ibv_flow_spec_action_tag){ *tag = (struct ibv_flow_spec_action_tag){
.type = IBV_FLOW_SPEC_ACTION_TAG, .type = IBV_FLOW_SPEC_ACTION_TAG,
.size = size, .size = size,
.tag_id = mlx5_flow_mark_set(mark_id), .tag_id = mlx5_flow_mark_set(mark_id),
}; };
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->offset += size; parser->offset += size;
return 0; return 0;
} }
@ -1006,8 +998,8 @@ mlx5_flow_create_flag_mark(struct mlx5_flow_parse *flow, uint32_t mark_id)
* *
* @param priv * @param priv
* Pointer to private structure. * Pointer to private structure.
* @param flow * @param parser
* MLX5 flow attributes (filled by mlx5_flow_validate()). * Internal parser structure.
* @param[out] error * @param[out] error
* Perform verbose error reporting if not NULL. * Perform verbose error reporting if not NULL.
* *
@ -1016,7 +1008,7 @@ mlx5_flow_create_flag_mark(struct mlx5_flow_parse *flow, uint32_t mark_id)
*/ */
static struct rte_flow * static struct rte_flow *
priv_flow_create_action_queue_drop(struct priv *priv, priv_flow_create_action_queue_drop(struct priv *priv,
struct mlx5_flow_parse *flow, struct mlx5_flow_parse *parser,
struct rte_flow_error *error) struct rte_flow_error *error)
{ {
struct rte_flow *rte_flow; struct rte_flow *rte_flow;
@ -1032,14 +1024,14 @@ priv_flow_create_action_queue_drop(struct priv *priv,
return NULL; return NULL;
} }
rte_flow->drop = 1; rte_flow->drop = 1;
drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset); drop = (void *)((uintptr_t)parser->ibv_attr + parser->offset);
*drop = (struct ibv_flow_spec_action_drop){ *drop = (struct ibv_flow_spec_action_drop){
.type = IBV_FLOW_SPEC_ACTION_DROP, .type = IBV_FLOW_SPEC_ACTION_DROP,
.size = size, .size = size,
}; };
++flow->ibv_attr->num_of_specs; ++parser->ibv_attr->num_of_specs;
flow->offset += sizeof(struct ibv_flow_spec_action_drop); parser->offset += sizeof(struct ibv_flow_spec_action_drop);
rte_flow->ibv_attr = flow->ibv_attr; rte_flow->ibv_attr = parser->ibv_attr;
if (!priv->dev->data->dev_started) if (!priv->dev->data->dev_started)
return rte_flow; return rte_flow;
rte_flow->drxq.hrxq.qp = priv->flow_drop_queue->qp; rte_flow->drxq.hrxq.qp = priv->flow_drop_queue->qp;
@ -1062,8 +1054,8 @@ error:
* *
* @param priv * @param priv
* Pointer to private structure. * Pointer to private structure.
* @param flow * @param parser
* MLX5 flow attributes (filled by mlx5_flow_validate()). * MLX5 flow parser attributes (filled by mlx5_flow_validate()).
* @param[out] error * @param[out] error
* Perform verbose error reporting if not NULL. * Perform verbose error reporting if not NULL.
* *
@ -1072,7 +1064,7 @@ error:
*/ */
static struct rte_flow * static struct rte_flow *
priv_flow_create_action_queue(struct priv *priv, priv_flow_create_action_queue(struct priv *priv,
struct mlx5_flow_parse *flow, struct mlx5_flow_parse *parser,
struct rte_flow_error *error) struct rte_flow_error *error)
{ {
struct rte_flow *rte_flow; struct rte_flow *rte_flow;
@ -1080,33 +1072,33 @@ priv_flow_create_action_queue(struct priv *priv,
assert(priv->pd); assert(priv->pd);
assert(priv->ctx); assert(priv->ctx);
assert(!flow->drop); assert(!parser->drop);
rte_flow = rte_calloc(__func__, 1, rte_flow = rte_calloc(__func__, 1,
sizeof(*rte_flow) + sizeof(*rte_flow) +
flow->queues_n * sizeof(uint16_t), parser->queues_n * sizeof(uint16_t),
0); 0);
if (!rte_flow) { if (!rte_flow) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "cannot allocate flow memory"); NULL, "cannot allocate flow memory");
return NULL; return NULL;
} }
rte_flow->mark = flow->mark; rte_flow->mark = parser->mark;
rte_flow->ibv_attr = flow->ibv_attr; rte_flow->ibv_attr = parser->ibv_attr;
rte_flow->queues = (uint16_t (*)[])(rte_flow + 1); rte_flow->queues = (uint16_t (*)[])(rte_flow + 1);
memcpy(rte_flow->queues, flow->queues, memcpy(rte_flow->queues, parser->queues,
flow->queues_n * sizeof(uint16_t)); parser->queues_n * sizeof(uint16_t));
rte_flow->queues_n = flow->queues_n; rte_flow->queues_n = parser->queues_n;
rte_flow->frxq.hash_fields = flow->hash_fields; rte_flow->frxq.hash_fields = parser->hash_fields;
rte_flow->frxq.hrxq = mlx5_priv_hrxq_get(priv, rss_hash_default_key, rte_flow->frxq.hrxq = mlx5_priv_hrxq_get(priv, rss_hash_default_key,
rss_hash_default_key_len, rss_hash_default_key_len,
flow->hash_fields, parser->hash_fields,
(*rte_flow->queues), (*rte_flow->queues),
rte_flow->queues_n); rte_flow->queues_n);
if (!rte_flow->frxq.hrxq) { if (!rte_flow->frxq.hrxq) {
rte_flow->frxq.hrxq = rte_flow->frxq.hrxq =
mlx5_priv_hrxq_new(priv, rss_hash_default_key, mlx5_priv_hrxq_new(priv, rss_hash_default_key,
rss_hash_default_key_len, rss_hash_default_key_len,
flow->hash_fields, parser->hash_fields,
(*rte_flow->queues), (*rte_flow->queues),
rte_flow->queues_n); rte_flow->queues_n);
if (!rte_flow->frxq.hrxq) { if (!rte_flow->frxq.hrxq) {
@ -1116,11 +1108,11 @@ priv_flow_create_action_queue(struct priv *priv,
goto error; goto error;
} }
} }
for (i = 0; i != flow->queues_n; ++i) { for (i = 0; i != parser->queues_n; ++i) {
struct mlx5_rxq_data *q = struct mlx5_rxq_data *q =
(*priv->rxqs)[flow->queues[i]]; (*priv->rxqs)[parser->queues[i]];
q->mark |= flow->mark; q->mark |= parser->mark;
} }
if (!priv->dev->data->dev_started) if (!priv->dev->data->dev_started)
return rte_flow; return rte_flow;