[dpdk-dev,1/2] net/mlx5: fix flow queues array allocation
Checks
Commit Message
Flow queues array offset is not properly computed causing all sorts of
issues. Address it by making the rte_flow structure less complex.
Fixes: 360663e1df46 ("net/mlx5: prepare support for RSS action rule")
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_flow.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
Comments
On 4/11/2017 4:21 PM, Nelio Laranjeiro wrote:
> Flow queues array offset is not properly computed causing all sorts of
> issues. Address it by making the rte_flow structure less complex.
>
> Fixes: 360663e1df46 ("net/mlx5: prepare support for RSS action rule")
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Series applied to dpdk-next-net/master, thanks.
On 4/12/2017 4:02 PM, Ferruh Yigit wrote:
> On 4/11/2017 4:21 PM, Nelio Laranjeiro wrote:
>> Flow queues array offset is not properly computed causing all sorts of
>> issues. Address it by making the rte_flow structure less complex.
>>
>> Fixes: 360663e1df46 ("net/mlx5: prepare support for RSS action rule")
>>
>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
>> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>
> Series applied to dpdk-next-net/master, thanks.
Removed from tree, and patchwork status updated to "New", please check
comment about rte_panic() usage in patch 2/2.
Thanks,
ferruh
On 4/12/2017 5:51 PM, Ferruh Yigit wrote:
> On 4/12/2017 4:02 PM, Ferruh Yigit wrote:
>> On 4/11/2017 4:21 PM, Nelio Laranjeiro wrote:
>>> Flow queues array offset is not properly computed causing all sorts of
>>> issues. Address it by making the rte_flow structure less complex.
>>>
>>> Fixes: 360663e1df46 ("net/mlx5: prepare support for RSS action rule")
>>>
>>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
>>> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>>
>> Series applied to dpdk-next-net/master, thanks.
>
> Removed from tree, and patchwork status updated to "New", please check
> comment about rte_panic() usage in patch 2/2.
Series applied _back_ to dpdk-next-net/master, thanks.
@@ -98,11 +98,11 @@ struct rte_flow {
struct ibv_exp_flow *ibv_flow; /**< Verbs flow. */
struct ibv_exp_wq *wq; /**< Verbs work queue. */
struct ibv_cq *cq; /**< Verbs completion queue. */
- struct rxq *(*rxqs)[]; /**< Pointer to the queues array. */
uint16_t rxqs_n; /**< Number of queues in this flow, 0 if drop queue. */
uint32_t mark:1; /**< Set if the flow is marked. */
uint32_t drop:1; /**< Drop queue. */
uint64_t hash_fields; /**< Fields that participate in the hash. */
+ struct rxq *rxqs[]; /**< Pointer to the queues array. */
};
/** Static initializer for items. */
@@ -1038,24 +1038,20 @@ priv_flow_create_action_queue(struct priv *priv,
assert(priv->pd);
assert(priv->ctx);
assert(!action->drop);
- rte_flow = rte_calloc(__func__, 1,
- sizeof(*rte_flow) + sizeof(struct rxq *) *
- action->queues_n, 0);
+ rte_flow = rte_calloc(__func__, 1, sizeof(*rte_flow) +
+ sizeof(*rte_flow->rxqs) * action->queues_n, 0);
if (!rte_flow) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "cannot allocate flow memory");
return NULL;
}
- rte_flow->rxqs = (struct rxq *(*)[])((uintptr_t)rte_flow +
- sizeof(struct rxq *) *
- action->queues_n);
for (i = 0; i < action->queues_n; ++i) {
struct rxq_ctrl *rxq;
rxq = container_of((*priv->rxqs)[action->queues[i]],
struct rxq_ctrl, rxq);
wqs[i] = rxq->wq;
- (*rte_flow->rxqs)[i] = &rxq->rxq;
+ rte_flow->rxqs[i] = &rxq->rxq;
++rte_flow->rxqs_n;
rxq->rxq.mark |= action->mark;
}
@@ -1265,7 +1261,7 @@ priv_flow_destroy(struct priv *priv,
* present in any other marked flow (RSS or not).
*/
for (queue_n = 0; queue_n < flow->rxqs_n; ++queue_n) {
- rxq = (*flow->rxqs)[queue_n];
+ rxq = flow->rxqs[queue_n];
for (tmp = LIST_FIRST(&priv->flows);
tmp;
tmp = LIST_NEXT(tmp, next)) {
@@ -1278,7 +1274,7 @@ priv_flow_destroy(struct priv *priv,
++tqueue_n) {
struct rxq *trxq;
- trxq = (*tmp->rxqs)[tqueue_n];
+ trxq = tmp->rxqs[tqueue_n];
if (rxq == trxq)
++mark_n;
}
@@ -1489,7 +1485,7 @@ priv_flow_stop(struct priv *priv)
unsigned int n;
for (n = 0; n < flow->rxqs_n; ++n)
- (*flow->rxqs)[n]->mark = 0;
+ flow->rxqs[n]->mark = 0;
}
DEBUG("Flow %p removed", (void *)flow);
}
@@ -1534,7 +1530,7 @@ priv_flow_start(struct priv *priv)
unsigned int n;
for (n = 0; n < flow->rxqs_n; ++n)
- (*flow->rxqs)[n]->mark = 1;
+ flow->rxqs[n]->mark = 1;
}
}
return 0;