aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c12
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c24
7 files changed, 35 insertions, 33 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 55d7bd4e210a..9129ace02560 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -815,8 +815,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
815 int err; 815 int err;
816 int i; 816 int i;
817 817
818 priv->eq_table.uar_map = kcalloc(sizeof *priv->eq_table.uar_map, 818 priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev),
819 mlx4_num_eq_uar(dev), GFP_KERNEL); 819 sizeof *priv->eq_table.uar_map,
820 GFP_KERNEL);
820 if (!priv->eq_table.uar_map) { 821 if (!priv->eq_table.uar_map) {
821 err = -ENOMEM; 822 err = -ENOMEM;
822 goto err_out_free; 823 goto err_out_free;
@@ -1035,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1035 struct mlx4_priv *priv = mlx4_priv(dev); 1036 struct mlx4_priv *priv = mlx4_priv(dev);
1036 int vec = 0, err = 0, i; 1037 int vec = 0, err = 0, i;
1037 1038
1038 spin_lock(&priv->msix_ctl.pool_lock); 1039 mutex_lock(&priv->msix_ctl.pool_lock);
1039 for (i = 0; !vec && i < dev->caps.comp_pool; i++) { 1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) {
1040 if (~priv->msix_ctl.pool_bm & 1ULL << i) { 1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) {
1041 priv->msix_ctl.pool_bm |= 1ULL << i; 1042 priv->msix_ctl.pool_bm |= 1ULL << i;
@@ -1057,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1057 eq_set_ci(&priv->eq_table.eq[vec], 1); 1058 eq_set_ci(&priv->eq_table.eq[vec], 1);
1058 } 1059 }
1059 } 1060 }
1060 spin_unlock(&priv->msix_ctl.pool_lock); 1061 mutex_unlock(&priv->msix_ctl.pool_lock);
1061 1062
1062 if (vec) { 1063 if (vec) {
1063 *vector = vec; 1064 *vector = vec;
@@ -1078,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
1078 if (likely(i >= 0)) { 1079 if (likely(i >= 0)) {
1079 /*sanity check , making sure were not trying to free irq's 1080 /*sanity check , making sure were not trying to free irq's
1080 Belonging to a legacy EQ*/ 1081 Belonging to a legacy EQ*/
1081 spin_lock(&priv->msix_ctl.pool_lock); 1082 mutex_lock(&priv->msix_ctl.pool_lock);
1082 if (priv->msix_ctl.pool_bm & 1ULL << i) { 1083 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1083 free_irq(priv->eq_table.eq[vec].irq, 1084 free_irq(priv->eq_table.eq[vec].irq,
1084 &priv->eq_table.eq[vec]); 1085 &priv->eq_table.eq[vec]);
1085 priv->msix_ctl.pool_bm &= ~(1ULL << i); 1086 priv->msix_ctl.pool_bm &= ~(1ULL << i);
1086 } 1087 }
1087 spin_unlock(&priv->msix_ctl.pool_lock); 1088 mutex_unlock(&priv->msix_ctl.pool_lock);
1088 } 1089 }
1089 1090
1090} 1091}
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 8a21e10952ea..9ea7cabcaf3c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -685,7 +685,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
685 return err; 685 return err;
686} 686}
687 687
688static int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port) 688int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port)
689{ 689{
690 struct mlx4_cmd_mailbox *outbox = ptr; 690 struct mlx4_cmd_mailbox *outbox = ptr;
691 691
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b502fc..d498f049c74e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev,
531 for (port = 0; port < dev->caps.num_ports; port++) { 531 for (port = 0; port < dev->caps.num_ports; port++) {
532 /* Change the port type only if the new type is different 532 /* Change the port type only if the new type is different
533 * from the current, and not set to Auto */ 533 * from the current, and not set to Auto */
534 if (port_types[port] != dev->caps.port_type[port + 1]) { 534 if (port_types[port] != dev->caps.port_type[port + 1])
535 change = 1; 535 change = 1;
536 dev->caps.port_type[port + 1] = port_types[port];
537 }
538 } 536 }
539 if (change) { 537 if (change) {
540 mlx4_unregister_device(dev); 538 mlx4_unregister_device(dev);
541 for (port = 1; port <= dev->caps.num_ports; port++) { 539 for (port = 1; port <= dev->caps.num_ports; port++) {
542 mlx4_CLOSE_PORT(dev, port); 540 mlx4_CLOSE_PORT(dev, port);
541 dev->caps.port_type[port] = port_types[port - 1];
543 err = mlx4_SET_PORT(dev, port); 542 err = mlx4_SET_PORT(dev, port);
544 if (err) { 543 if (err) {
545 mlx4_err(dev, "Failed to set port %d, " 544 mlx4_err(dev, "Failed to set port %d, "
@@ -986,6 +985,9 @@ static int map_bf_area(struct mlx4_dev *dev)
986 resource_size_t bf_len; 985 resource_size_t bf_len;
987 int err = 0; 986 int err = 0;
988 987
988 if (!dev->caps.bf_reg_size)
989 return -ENXIO;
990
989 bf_start = pci_resource_start(dev->pdev, 2) + 991 bf_start = pci_resource_start(dev->pdev, 2) +
990 (dev->caps.num_uars << PAGE_SHIFT); 992 (dev->caps.num_uars << PAGE_SHIFT);
991 bf_len = pci_resource_len(dev->pdev, 2) - 993 bf_len = pci_resource_len(dev->pdev, 2) -
@@ -1825,7 +1827,7 @@ slave_start:
1825 goto err_master_mfunc; 1827 goto err_master_mfunc;
1826 1828
1827 priv->msix_ctl.pool_bm = 0; 1829 priv->msix_ctl.pool_bm = 0;
1828 spin_lock_init(&priv->msix_ctl.pool_lock); 1830 mutex_init(&priv->msix_ctl.pool_lock);
1829 1831
1830 mlx4_enable_msi_x(dev); 1832 mlx4_enable_msi_x(dev);
1831 if ((mlx4_is_mfunc(dev)) && 1833 if ((mlx4_is_mfunc(dev)) &&
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index c92269f8c057..28f8251561f4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -697,7 +697,7 @@ struct mlx4_sense {
697 697
698struct mlx4_msix_ctl { 698struct mlx4_msix_ctl {
699 u64 pool_bm; 699 u64 pool_bm;
700 spinlock_t pool_lock; 700 struct mutex pool_lock;
701}; 701};
702 702
703struct mlx4_steer { 703struct mlx4_steer {
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 8deeef98280c..25a80d71fb2a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -304,7 +304,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); 304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
305} 305}
306 306
307static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, 307int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
308 u32 *base_mridx) 308 u32 *base_mridx)
309{ 309{
310 struct mlx4_priv *priv = mlx4_priv(dev); 310 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -320,14 +320,14 @@ static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
320} 320}
321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range); 321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range);
322 322
323static void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt) 323void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt)
324{ 324{
325 struct mlx4_priv *priv = mlx4_priv(dev); 325 struct mlx4_priv *priv = mlx4_priv(dev);
326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt); 326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt);
327} 327}
328EXPORT_SYMBOL_GPL(mlx4_mr_release_range); 328EXPORT_SYMBOL_GPL(mlx4_mr_release_range);
329 329
330static int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd, 330int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd,
331 u64 iova, u64 size, u32 access, int npages, 331 u64 iova, u64 size, u32 access, int npages,
332 int page_shift, struct mlx4_mr *mr) 332 int page_shift, struct mlx4_mr *mr)
333{ 333{
@@ -457,7 +457,7 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
457} 457}
458EXPORT_SYMBOL_GPL(mlx4_mr_alloc); 458EXPORT_SYMBOL_GPL(mlx4_mr_alloc);
459 459
460static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) 460void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr)
461{ 461{
462 int err; 462 int err;
463 463
@@ -852,7 +852,7 @@ err_free:
852} 852}
853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); 853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
854 854
855static int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, 855int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx,
856 u32 pd, u32 access, int max_pages, 856 u32 pd, u32 access, int max_pages,
857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr) 857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr)
858{ 858{
@@ -954,7 +954,7 @@ int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
954} 954}
955EXPORT_SYMBOL_GPL(mlx4_fmr_free); 955EXPORT_SYMBOL_GPL(mlx4_fmr_free);
956 956
957static int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 957int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
958{ 958{
959 if (fmr->maps) 959 if (fmr->maps)
960 return -EBUSY; 960 return -EBUSY;
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 738f950a1ce5..fb2b36759cbf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -151,11 +151,6 @@ static int __mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
151 context->log_page_size = mtt->page_shift - MLX4_ICM_PAGE_SHIFT; 151 context->log_page_size = mtt->page_shift - MLX4_ICM_PAGE_SHIFT;
152 } 152 }
153 153
154 port = ((context->pri_path.sched_queue >> 6) & 1) + 1;
155 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
156 context->pri_path.sched_queue = (context->pri_path.sched_queue &
157 0xc3);
158
159 *(__be32 *) mailbox->buf = cpu_to_be32(optpar); 154 *(__be32 *) mailbox->buf = cpu_to_be32(optpar);
160 memcpy(mailbox->buf + 8, context, sizeof *context); 155 memcpy(mailbox->buf + 8, context, sizeof *context);
161 156
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index dcd819bfb2f0..8752e6e08169 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 {
@@ -374,6 +375,7 @@ static struct res_common *alloc_qp_tr(int id)
374 375
375 ret->com.res_id = id; 376 ret->com.res_id = id;
376 ret->com.state = RES_QP_RESERVED; 377 ret->com.state = RES_QP_RESERVED;
378 ret->local_qpn = id;
377 INIT_LIST_HEAD(&ret->mcg_list); 379 INIT_LIST_HEAD(&ret->mcg_list);
378 spin_lock_init(&ret->mcg_spl); 380 spin_lock_init(&ret->mcg_spl);
379 381
@@ -2253,8 +2255,7 @@ int mlx4_MODIFY_CQ_wrapper(struct mlx4_dev *dev, int slave,
2253 2255
2254 if (vhcr->op_modifier == 0) { 2256 if (vhcr->op_modifier == 0) {
2255 err = handle_resize(dev, slave, vhcr, inbox, outbox, cmd, cq); 2257 err = handle_resize(dev, slave, vhcr, inbox, outbox, cmd, cq);
2256 if (err) 2258 goto ex_put;
2257 goto ex_put;
2258 } 2259 }
2259 2260
2260 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); 2261 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd);
@@ -2479,7 +2480,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave,
2479} 2480}
2480 2481
2481static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2482static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2482 u8 *gid, enum mlx4_protocol prot) 2483 u8 *gid, enum mlx4_protocol prot,
2484 enum mlx4_steer_type steer)
2483{ 2485{
2484 struct res_gid *res; 2486 struct res_gid *res;
2485 int err; 2487 int err;
@@ -2495,6 +2497,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2495 } else { 2497 } else {
2496 memcpy(res->gid, gid, 16); 2498 memcpy(res->gid, gid, 16);
2497 res->prot = prot; 2499 res->prot = prot;
2500 res->steer = steer;
2498 list_add_tail(&res->list, &rqp->mcg_list); 2501 list_add_tail(&res->list, &rqp->mcg_list);
2499 err = 0; 2502 err = 0;
2500 } 2503 }
@@ -2504,14 +2507,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2504} 2507}
2505 2508
2506static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2509static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2507 u8 *gid, enum mlx4_protocol prot) 2510 u8 *gid, enum mlx4_protocol prot,
2511 enum mlx4_steer_type steer)
2508{ 2512{
2509 struct res_gid *res; 2513 struct res_gid *res;
2510 int err; 2514 int err;
2511 2515
2512 spin_lock_irq(&rqp->mcg_spl); 2516 spin_lock_irq(&rqp->mcg_spl);
2513 res = find_gid(dev, slave, rqp, gid); 2517 res = find_gid(dev, slave, rqp, gid);
2514 if (!res || res->prot != prot) 2518 if (!res || res->prot != prot || res->steer != steer)
2515 err = -EINVAL; 2519 err = -EINVAL;
2516 else { 2520 else {
2517 list_del(&res->list); 2521 list_del(&res->list);
@@ -2538,7 +2542,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2538 int attach = vhcr->op_modifier; 2542 int attach = vhcr->op_modifier;
2539 int block_loopback = vhcr->in_modifier >> 31; 2543 int block_loopback = vhcr->in_modifier >> 31;
2540 u8 steer_type_mask = 2; 2544 u8 steer_type_mask = 2;
2541 enum mlx4_steer_type type = gid[7] & steer_type_mask; 2545 enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1;
2542 2546
2543 qpn = vhcr->in_modifier & 0xffffff; 2547 qpn = vhcr->in_modifier & 0xffffff;
2544 err = get_res(dev, slave, qpn, RES_QP, &rqp); 2548 err = get_res(dev, slave, qpn, RES_QP, &rqp);
@@ -2547,7 +2551,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2547 2551
2548 qp.qpn = qpn; 2552 qp.qpn = qpn;
2549 if (attach) { 2553 if (attach) {
2550 err = add_mcg_res(dev, slave, rqp, gid, prot); 2554 err = add_mcg_res(dev, slave, rqp, gid, prot, type);
2551 if (err) 2555 if (err)
2552 goto ex_put; 2556 goto ex_put;
2553 2557
@@ -2556,7 +2560,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2556 if (err) 2560 if (err)
2557 goto ex_rem; 2561 goto ex_rem;
2558 } else { 2562 } else {
2559 err = rem_mcg_res(dev, slave, rqp, gid, prot); 2563 err = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2560 if (err) 2564 if (err)
2561 goto ex_put; 2565 goto ex_put;
2562 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); 2566 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type);
@@ -2567,7 +2571,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2567 2571
2568ex_rem: 2572ex_rem:
2569 /* ignore error return below, already in error */ 2573 /* ignore error return below, already in error */
2570 err1 = rem_mcg_res(dev, slave, rqp, gid, prot); 2574 err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2571ex_put: 2575ex_put:
2572 put_res(dev, slave, qpn, RES_QP); 2576 put_res(dev, slave, qpn, RES_QP);
2573 2577
@@ -2606,7 +2610,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp)
2606 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { 2610 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) {
2607 qp.qpn = rqp->local_qpn; 2611 qp.qpn = rqp->local_qpn;
2608 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, 2612 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot,
2609 MLX4_MC_STEER); 2613 rgid->steer);
2610 list_del(&rgid->list); 2614 list_del(&rgid->list);
2611 kfree(rgid); 2615 kfree(rgid);
2612 } 2616 }