net/mlx5: fix port stop by verify flows are still present
authorNélio Laranjeiro <nelio.laranjeiro@6wind.com>
Tue, 30 Jan 2018 13:36:52 +0000 (14:36 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 5 Feb 2018 12:42:53 +0000 (13:42 +0100)
priv_flow_stop() may be called several times, in such situation flows are
already removed from the NIC and thus all associated objects are no present
in the flow object (ibv_flow, indirection tables, ....).

Fixes: 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
drivers/net/mlx5/mlx5_flow.c

index 957cb75..8984218 100644 (file)
@@ -2173,6 +2173,7 @@ priv_flow_stop(struct priv *priv, struct mlx5_flows *list)
 
        TAILQ_FOREACH_REVERSE(flow, list, mlx5_flows, next) {
                unsigned int i;
+               struct mlx5_ind_table_ibv *ind_tbl = NULL;
 
                if (flow->drop) {
                        if (!flow->frxq[HASH_RXQ_ETH].ibv_flow)
@@ -2180,17 +2181,26 @@ priv_flow_stop(struct priv *priv, struct mlx5_flows *list)
                        claim_zero(mlx5_glue->destroy_flow
                                   (flow->frxq[HASH_RXQ_ETH].ibv_flow));
                        flow->frxq[HASH_RXQ_ETH].ibv_flow = NULL;
+                       DEBUG("Flow %p removed", (void *)flow);
                        /* Next flow. */
                        continue;
                }
+               /* Verify the flow has not already been cleaned. */
+               for (i = 0; i != hash_rxq_init_n; ++i) {
+                       if (!flow->frxq[i].ibv_flow)
+                               continue;
+                       /*
+                        * Indirection table may be necessary to remove the
+                        * flags in the Rx queues.
+                        * This helps to speed-up the process by avoiding
+                        * another loop.
+                        */
+                       ind_tbl = flow->frxq[i].hrxq->ind_table;
+                       break;
+               }
+               if (i == hash_rxq_init_n)
+                       return;
                if (flow->mark) {
-                       struct mlx5_ind_table_ibv *ind_tbl = NULL;
-
-                       for (i = 0; i != hash_rxq_init_n; ++i) {
-                               if (!flow->frxq[i].hrxq)
-                                       continue;
-                               ind_tbl = flow->frxq[i].hrxq->ind_table;
-                       }
                        assert(ind_tbl);
                        for (i = 0; i != ind_tbl->queues_n; ++i)
                                (*priv->rxqs)[ind_tbl->queues[i]]->mark = 0;