net/mlx5: fix adding counter when dev not started
authorOri Kam <orika@mellanox.com>
Mon, 30 Oct 2017 07:32:24 +0000 (09:32 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 1 Nov 2017 21:17:06 +0000 (22:17 +0100)
When adding count action to a drop flow rule while the device was not
started, the counter was not saved in the flow.

Fixes: 9a761de8ea14 ("net/mlx5: flow counter support")

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
drivers/net/mlx5/mlx5_flow.c

index 1ea9d68..29c8e89 100644 (file)
@@ -1700,13 +1700,13 @@ priv_flow_create_action_queue_drop(struct priv *priv,
        ++parser->drop_q.ibv_attr->num_of_specs;
        parser->drop_q.offset += size;
        flow->drxq.ibv_attr = parser->drop_q.ibv_attr;
+       if (parser->count)
+               flow->cs = parser->cs;
        if (!priv->dev->data->dev_started)
                return 0;
        parser->drop_q.ibv_attr = NULL;
        flow->drxq.ibv_flow = ibv_create_flow(priv->flow_drop_queue->qp,
                                              flow->drxq.ibv_attr);
-       if (parser->count)
-               flow->cs = parser->cs;
        if (!flow->drxq.ibv_flow) {
                rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
                                   NULL, "flow rule creation failure");