]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_core: Fix resource tracker memory leak after Reset Flow
authorHadar Hen Zion <hadarh@mellanox.com>
Tue, 11 Mar 2014 15:44:51 +0000 (17:44 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:19 +0000 (14:45 -0700)
In case of non-responsive device mlx4_ACCESS_MEM fails and the
driver can't read qp_detach mailbox, which includes all the
rule information.

Since the driver doesn't get the rules attributes form the
qp_detach mailbox the master fails to detach his rules form
the resource tracker during driver unload sequence when the
device in in internal_error state.

Calling rem_slave_qp will remove those rules and the qps they are
attached to unconditionally.

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

index eaefc8a16bdc77b4f309b84fcf63d1a6a8f1344b..b25e12a1d4176009b6d577602603c361d0549e7e 100644 (file)
@@ -293,6 +293,7 @@ static const char *resource_str(enum mlx4_resource rt)
 }
 
 static void rem_slave_vlans(struct mlx4_dev *dev, int slave);
+static void rem_slave_qps(struct mlx4_dev *dev, int slave);
 static inline int mlx4_grant_resource(struct mlx4_dev *dev, int slave,
                                      enum mlx4_resource res_type, int count,
                                      int port)
@@ -632,6 +633,15 @@ void mlx4_free_resource_tracker(struct mlx4_dev *dev,
                        mlx4_reset_roce_gids(dev, i);
                        mutex_lock(&priv->mfunc.master.res_tracker.slave_list[i].mutex);
                        rem_slave_vlans(dev, i);
+                       /* Free master's qps in case of 'Reset Flow'.
+                        * When the device is non-responsive the master is
+                        * unable to read steering rules mailboxes and
+                        * therefore can't delete those rules and the qp they are
+                        * attached to from the resource tracker.
+                        * Calling rem_slave_qp removes those resources
+                        * unconditionally.
+                        */
+                       rem_slave_qps(dev, i);
                        mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[i].mutex);
                }