mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 01:10:28 +00:00
mlx4: add unicast steering entries to resource_tracker
Add unicast steering entries to resource tracker. Do qp_detach also for these entries when VF doesn't shut down gracefully. Otherwise there is leakage of these resources, since they are not tracked. Signed-off-by: Eugenia Emantayev <eugenia@mellanox.co.il> Reviewed-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2531188b47
commit
9f5b6c632e
@ -73,6 +73,7 @@ struct res_gid {
|
||||
struct list_head list;
|
||||
u8 gid[16];
|
||||
enum mlx4_protocol prot;
|
||||
enum mlx4_steer_type steer;
|
||||
};
|
||||
|
||||
enum res_qp_states {
|
||||
@ -2480,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave,
|
||||
}
|
||||
|
||||
static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
|
||||
u8 *gid, enum mlx4_protocol prot)
|
||||
u8 *gid, enum mlx4_protocol prot,
|
||||
enum mlx4_steer_type steer)
|
||||
{
|
||||
struct res_gid *res;
|
||||
int err;
|
||||
@ -2496,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
|
||||
} else {
|
||||
memcpy(res->gid, gid, 16);
|
||||
res->prot = prot;
|
||||
res->steer = steer;
|
||||
list_add_tail(&res->list, &rqp->mcg_list);
|
||||
err = 0;
|
||||
}
|
||||
@ -2505,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
|
||||
}
|
||||
|
||||
static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
|
||||
u8 *gid, enum mlx4_protocol prot)
|
||||
u8 *gid, enum mlx4_protocol prot,
|
||||
enum mlx4_steer_type steer)
|
||||
{
|
||||
struct res_gid *res;
|
||||
int err;
|
||||
|
||||
spin_lock_irq(&rqp->mcg_spl);
|
||||
res = find_gid(dev, slave, rqp, gid);
|
||||
if (!res || res->prot != prot)
|
||||
if (!res || res->prot != prot || res->steer != steer)
|
||||
err = -EINVAL;
|
||||
else {
|
||||
list_del(&res->list);
|
||||
@ -2548,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
|
||||
|
||||
qp.qpn = qpn;
|
||||
if (attach) {
|
||||
err = add_mcg_res(dev, slave, rqp, gid, prot);
|
||||
err = add_mcg_res(dev, slave, rqp, gid, prot, type);
|
||||
if (err)
|
||||
goto ex_put;
|
||||
|
||||
@ -2557,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
|
||||
if (err)
|
||||
goto ex_rem;
|
||||
} else {
|
||||
err = rem_mcg_res(dev, slave, rqp, gid, prot);
|
||||
err = rem_mcg_res(dev, slave, rqp, gid, prot, type);
|
||||
if (err)
|
||||
goto ex_put;
|
||||
err = mlx4_qp_detach_common(dev, &qp, gid, prot, type);
|
||||
@ -2568,7 +2572,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
|
||||
|
||||
ex_rem:
|
||||
/* ignore error return below, already in error */
|
||||
err1 = rem_mcg_res(dev, slave, rqp, gid, prot);
|
||||
err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type);
|
||||
ex_put:
|
||||
put_res(dev, slave, qpn, RES_QP);
|
||||
|
||||
@ -2607,7 +2611,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp)
|
||||
list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) {
|
||||
qp.qpn = rqp->local_qpn;
|
||||
err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot,
|
||||
MLX4_MC_STEER);
|
||||
rgid->steer);
|
||||
list_del(&rgid->list);
|
||||
kfree(rgid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user