af928bb2abb693f5a303ad7da399f7723ac19b8e
[vpp.git] / dpdk / dpdk-17.02_patches / 0005-net-mlx5-fix-startup-when-flow-cannot-be-applied.patch
1 From 0866d640e42d6c54b2b3f15ebde9930e756ba4d5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?N=C3=A9lio=20Laranjeiro?= <nelio.laranjeiro@6wind.com>
3 Date: Wed, 22 Feb 2017 10:57:52 +0100
4 Subject: [PATCH] net/mlx5: fix startup when flow cannot be applied
5
6 When flows cannot be re-applied due to configuration modifications, the
7 start function should rollback the configuration done.
8
9 Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")
10 Cc: stable@dpdk.org
11
12 Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
13 ---
14  drivers/net/mlx5/mlx5_trigger.c | 21 ++++++++++++++++-----
15  1 file changed, 16 insertions(+), 5 deletions(-)
16
17 diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
18 index 30addd2..0acbf28 100644
19 --- a/drivers/net/mlx5/mlx5_trigger.c
20 +++ b/drivers/net/mlx5/mlx5_trigger.c
21 @@ -82,17 +82,28 @@ mlx5_dev_start(struct rte_eth_dev *dev)
22                 ERROR("%p: an error occurred while configuring hash RX queues:"
23                       " %s",
24                       (void *)priv, strerror(err));
25 -               /* Rollback. */
26 -               priv_special_flow_disable_all(priv);
27 -               priv_mac_addrs_disable(priv);
28 -               priv_destroy_hash_rxqs(priv);
29 +               goto error;
30         }
31         if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_NONE)
32                 priv_fdir_enable(priv);
33 -       priv_dev_interrupt_handler_install(priv, dev);
34         err = priv_flow_start(priv);
35 +       if (err) {
36 +               priv->started = 0;
37 +               ERROR("%p: an error occurred while configuring flows:"
38 +                     " %s",
39 +                     (void *)priv, strerror(err));
40 +               goto error;
41 +       }
42 +       priv_dev_interrupt_handler_install(priv, dev);
43         priv_xstats_init(priv);
44         priv_unlock(priv);
45 +       return 0;
46 +error:
47 +       /* Rollback. */
48 +       priv_special_flow_disable_all(priv);
49 +       priv_mac_addrs_disable(priv);
50 +       priv_destroy_hash_rxqs(priv);
51 +       priv_flow_stop(priv);
52         return -err;
53  }
54  
55 -- 
56 2.7.4
57