aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEugenia Emantayev <eugenia@mellanox.co.il>2012-02-15 01:23:16 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-15 14:50:16 -0500
commit9f5b6c632eb3b495d5ae701c43e67da930b1f637 (patch)
tree7898b3b5db0f0f8fe08eca1c2ea01372777593ee /drivers
parent2531188b476c83fe29b1d3498a76e329f4b6f16b (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 629cc3018746..bfdb7af19e49 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -73,6 +73,7 @@ struct res_gid {
73 struct list_head list; 73 struct list_head list;
74 u8 gid[16]; 74 u8 gid[16];
75 enum mlx4_protocol prot; 75 enum mlx4_protocol prot;
76 enum mlx4_steer_type steer;
76}; 77};
77 78
78enum res_qp_states { 79enum res_qp_states {
@@ -2480,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave,
2480} 2481}
2481 2482
2482static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2483static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2483 u8 *gid, enum mlx4_protocol prot) 2484 u8 *gid, enum mlx4_protocol prot,
2485 enum mlx4_steer_type steer)
2484{ 2486{
2485 struct res_gid *res; 2487 struct res_gid *res;
2486 int err; 2488 int err;
@@ -2496,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2496 } else { 2498 } else {
2497 memcpy(res->gid, gid, 16); 2499 memcpy(res->gid, gid, 16);
2498 res->prot = prot; 2500 res->prot = prot;
2501 res->steer = steer;
2499 list_add_tail(&res->list, &rqp->mcg_list); 2502 list_add_tail(&res->list, &rqp->mcg_list);
2500 err = 0; 2503 err = 0;
2501 } 2504 }
@@ -2505,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2505} 2508}
2506 2509
2507static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2510static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2508 u8 *gid, enum mlx4_protocol prot) 2511 u8 *gid, enum mlx4_protocol prot,
2512 enum mlx4_steer_type steer)
2509{ 2513{
2510 struct res_gid *res; 2514 struct res_gid *res;
2511 int err; 2515 int err;
2512 2516
2513 spin_lock_irq(&rqp->mcg_spl); 2517 spin_lock_irq(&rqp->mcg_spl);
2514 res = find_gid(dev, slave, rqp, gid); 2518 res = find_gid(dev, slave, rqp, gid);
2515 if (!res || res->prot != prot) 2519 if (!res || res->prot != prot || res->steer != steer)
2516 err = -EINVAL; 2520 err = -EINVAL;
2517 else { 2521 else {
2518 list_del(&res->list); 2522 list_del(&res->list);
@@ -2548,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2548 2552
2549 qp.qpn = qpn; 2553 qp.qpn = qpn;
2550 if (attach) { 2554 if (attach) {
2551 err = add_mcg_res(dev, slave, rqp, gid, prot); 2555 err = add_mcg_res(dev, slave, rqp, gid, prot, type);
2552 if (err) 2556 if (err)
2553 goto ex_put; 2557 goto ex_put;
2554 2558
@@ -2557,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2557 if (err) 2561 if (err)
2558 goto ex_rem; 2562 goto ex_rem;
2559 } else { 2563 } else {
2560 err = rem_mcg_res(dev, slave, rqp, gid, prot); 2564 err = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2561 if (err) 2565 if (err)
2562 goto ex_put; 2566 goto ex_put;
2563 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); 2567 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,
2568 2572
2569ex_rem: 2573ex_rem:
2570 /* ignore error return below, already in error */ 2574 /* ignore error return below, already in error */
2571 err1 = rem_mcg_res(dev, slave, rqp, gid, prot); 2575 err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2572ex_put: 2576ex_put:
2573 put_res(dev, slave, qpn, RES_QP); 2577 put_res(dev, slave, qpn, RES_QP);
2574 2578
@@ -2607,7 +2611,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp)
2607 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { 2611 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) {
2608 qp.qpn = rqp->local_qpn; 2612 qp.qpn = rqp->local_qpn;
2609 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, 2613 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot,
2610 MLX4_MC_STEER); 2614 rgid->steer);
2611 list_del(&rgid->list); 2615 list_del(&rgid->list);
2612 kfree(rgid); 2616 kfree(rgid);
2613 } 2617 }