diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_rx.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/eq.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mcg.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 21 |
7 files changed, 40 insertions, 28 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 405e6ac3faf6..eaf09d4f02d0 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -1616,12 +1616,12 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev) | |||
1616 | kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); | 1616 | kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); |
1617 | } | 1617 | } |
1618 | kfree(priv->mfunc.master.slave_state); | 1618 | kfree(priv->mfunc.master.slave_state); |
1619 | iounmap(priv->mfunc.comm); | ||
1620 | dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, | ||
1621 | priv->mfunc.vhcr, | ||
1622 | priv->mfunc.vhcr_dma); | ||
1623 | priv->mfunc.vhcr = NULL; | ||
1624 | } | 1619 | } |
1620 | |||
1621 | iounmap(priv->mfunc.comm); | ||
1622 | dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, | ||
1623 | priv->mfunc.vhcr, priv->mfunc.vhcr_dma); | ||
1624 | priv->mfunc.vhcr = NULL; | ||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | void mlx4_cmd_cleanup(struct mlx4_dev *dev) | 1627 | void mlx4_cmd_cleanup(struct mlx4_dev *dev) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 467ae5824875..149e60da0a32 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -892,7 +892,8 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
892 | 892 | ||
893 | for (i = 0; i < priv->rx_ring_num; i++) { | 893 | for (i = 0; i < priv->rx_ring_num; i++) { |
894 | if (priv->rx_ring[i].rx_info) | 894 | if (priv->rx_ring[i].rx_info) |
895 | mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i]); | 895 | mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i], |
896 | priv->prof->rx_ring_size, priv->stride); | ||
896 | if (priv->rx_cq[i].buf) | 897 | if (priv->rx_cq[i].buf) |
897 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); | 898 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
898 | } | 899 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 971d4b6b8dfe..d4ad8c226b51 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -168,8 +168,12 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, | |||
168 | return 0; | 168 | return 0; |
169 | 169 | ||
170 | err: | 170 | err: |
171 | while (i--) | 171 | while (i--) { |
172 | dma_addr_t dma = be64_to_cpu(rx_desc->data[i].addr); | ||
173 | pci_unmap_single(priv->mdev->pdev, dma, skb_frags[i].size, | ||
174 | PCI_DMA_FROMDEVICE); | ||
172 | put_page(skb_frags[i].page); | 175 | put_page(skb_frags[i].page); |
176 | } | ||
173 | return -ENOMEM; | 177 | return -ENOMEM; |
174 | } | 178 | } |
175 | 179 | ||
@@ -380,12 +384,12 @@ err_allocator: | |||
380 | } | 384 | } |
381 | 385 | ||
382 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, | 386 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, |
383 | struct mlx4_en_rx_ring *ring) | 387 | struct mlx4_en_rx_ring *ring, u32 size, u16 stride) |
384 | { | 388 | { |
385 | struct mlx4_en_dev *mdev = priv->mdev; | 389 | struct mlx4_en_dev *mdev = priv->mdev; |
386 | 390 | ||
387 | mlx4_en_unmap_buffer(&ring->wqres.buf); | 391 | mlx4_en_unmap_buffer(&ring->wqres.buf); |
388 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size + TXBB_SIZE); | 392 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); |
389 | vfree(ring->rx_info); | 393 | vfree(ring->rx_info); |
390 | ring->rx_info = NULL; | 394 | ring->rx_info = NULL; |
391 | } | 395 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 55d7bd4e210a..8fa41f3082cf 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; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index 0785d9b2a265..ca574d850b39 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -136,7 +136,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 port, | |||
136 | u32 prot; | 136 | u32 prot; |
137 | int err; | 137 | int err; |
138 | 138 | ||
139 | s_steer = &mlx4_priv(dev)->steer[0]; | 139 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
140 | new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL); | 140 | new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL); |
141 | if (!new_entry) | 141 | if (!new_entry) |
142 | return -ENOMEM; | 142 | return -ENOMEM; |
@@ -220,7 +220,7 @@ static int existing_steering_entry(struct mlx4_dev *dev, u8 port, | |||
220 | struct mlx4_promisc_qp *pqp; | 220 | struct mlx4_promisc_qp *pqp; |
221 | struct mlx4_promisc_qp *dqp; | 221 | struct mlx4_promisc_qp *dqp; |
222 | 222 | ||
223 | s_steer = &mlx4_priv(dev)->steer[0]; | 223 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
224 | 224 | ||
225 | pqp = get_promisc_qp(dev, 0, steer, qpn); | 225 | pqp = get_promisc_qp(dev, 0, steer, qpn); |
226 | if (!pqp) | 226 | if (!pqp) |
@@ -265,7 +265,7 @@ static bool check_duplicate_entry(struct mlx4_dev *dev, u8 port, | |||
265 | struct mlx4_steer_index *tmp_entry, *entry = NULL; | 265 | struct mlx4_steer_index *tmp_entry, *entry = NULL; |
266 | struct mlx4_promisc_qp *dqp, *tmp_dqp; | 266 | struct mlx4_promisc_qp *dqp, *tmp_dqp; |
267 | 267 | ||
268 | s_steer = &mlx4_priv(dev)->steer[0]; | 268 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
269 | 269 | ||
270 | /* if qp is not promisc, it cannot be duplicated */ | 270 | /* if qp is not promisc, it cannot be duplicated */ |
271 | if (!get_promisc_qp(dev, 0, steer, qpn)) | 271 | if (!get_promisc_qp(dev, 0, steer, qpn)) |
@@ -306,7 +306,7 @@ static bool can_remove_steering_entry(struct mlx4_dev *dev, u8 port, | |||
306 | bool ret = false; | 306 | bool ret = false; |
307 | int i; | 307 | int i; |
308 | 308 | ||
309 | s_steer = &mlx4_priv(dev)->steer[0]; | 309 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
310 | 310 | ||
311 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 311 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
312 | if (IS_ERR(mailbox)) | 312 | if (IS_ERR(mailbox)) |
@@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port, | |||
361 | int err; | 361 | int err; |
362 | struct mlx4_priv *priv = mlx4_priv(dev); | 362 | struct mlx4_priv *priv = mlx4_priv(dev); |
363 | 363 | ||
364 | s_steer = &mlx4_priv(dev)->steer[0]; | 364 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
365 | 365 | ||
366 | mutex_lock(&priv->mcg_table.mutex); | 366 | mutex_lock(&priv->mcg_table.mutex); |
367 | 367 | ||
@@ -466,7 +466,7 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 port, | |||
466 | int loc, i; | 466 | int loc, i; |
467 | int err; | 467 | int err; |
468 | 468 | ||
469 | s_steer = &mlx4_priv(dev)->steer[0]; | 469 | s_steer = &mlx4_priv(dev)->steer[port - 1]; |
470 | mutex_lock(&priv->mcg_table.mutex); | 470 | mutex_lock(&priv->mcg_table.mutex); |
471 | 471 | ||
472 | pqp = get_promisc_qp(dev, 0, steer, qpn); | 472 | pqp = get_promisc_qp(dev, 0, steer, qpn); |
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_promisc_remove); | |||
1004 | 1004 | ||
1005 | int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port) | 1005 | int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port) |
1006 | { | 1006 | { |
1007 | if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) | 1007 | if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER)) |
1008 | return 0; | 1008 | return 0; |
1009 | 1009 | ||
1010 | if (mlx4_is_mfunc(dev)) | 1010 | if (mlx4_is_mfunc(dev)) |
@@ -1016,7 +1016,7 @@ EXPORT_SYMBOL_GPL(mlx4_unicast_promisc_add); | |||
1016 | 1016 | ||
1017 | int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port) | 1017 | int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port) |
1018 | { | 1018 | { |
1019 | if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) | 1019 | if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER)) |
1020 | return 0; | 1020 | return 0; |
1021 | 1021 | ||
1022 | if (mlx4_is_mfunc(dev)) | 1022 | if (mlx4_is_mfunc(dev)) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 35f08840813c..d60335f3c473 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -528,7 +528,8 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, | |||
528 | struct mlx4_en_rx_ring *ring, | 528 | struct mlx4_en_rx_ring *ring, |
529 | u32 size, u16 stride); | 529 | u32 size, u16 stride); |
530 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, | 530 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, |
531 | struct mlx4_en_rx_ring *ring); | 531 | struct mlx4_en_rx_ring *ring, |
532 | u32 size, u16 stride); | ||
532 | int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); | 533 | int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); |
533 | void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, | 534 | void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, |
534 | struct mlx4_en_rx_ring *ring); | 535 | struct mlx4_en_rx_ring *ring); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index dcd819bfb2f0..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 | ||
78 | enum res_qp_states { | 79 | enum 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 | ||
@@ -2479,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave, | |||
2479 | } | 2481 | } |
2480 | 2482 | ||
2481 | static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, | 2483 | static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, |
2482 | u8 *gid, enum mlx4_protocol prot) | 2484 | u8 *gid, enum mlx4_protocol prot, |
2485 | enum mlx4_steer_type steer) | ||
2483 | { | 2486 | { |
2484 | struct res_gid *res; | 2487 | struct res_gid *res; |
2485 | int err; | 2488 | int err; |
@@ -2495,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, | |||
2495 | } else { | 2498 | } else { |
2496 | memcpy(res->gid, gid, 16); | 2499 | memcpy(res->gid, gid, 16); |
2497 | res->prot = prot; | 2500 | res->prot = prot; |
2501 | res->steer = steer; | ||
2498 | list_add_tail(&res->list, &rqp->mcg_list); | 2502 | list_add_tail(&res->list, &rqp->mcg_list); |
2499 | err = 0; | 2503 | err = 0; |
2500 | } | 2504 | } |
@@ -2504,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, | |||
2504 | } | 2508 | } |
2505 | 2509 | ||
2506 | static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, | 2510 | static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, |
2507 | u8 *gid, enum mlx4_protocol prot) | 2511 | u8 *gid, enum mlx4_protocol prot, |
2512 | enum mlx4_steer_type steer) | ||
2508 | { | 2513 | { |
2509 | struct res_gid *res; | 2514 | struct res_gid *res; |
2510 | int err; | 2515 | int err; |
2511 | 2516 | ||
2512 | spin_lock_irq(&rqp->mcg_spl); | 2517 | spin_lock_irq(&rqp->mcg_spl); |
2513 | res = find_gid(dev, slave, rqp, gid); | 2518 | res = find_gid(dev, slave, rqp, gid); |
2514 | if (!res || res->prot != prot) | 2519 | if (!res || res->prot != prot || res->steer != steer) |
2515 | err = -EINVAL; | 2520 | err = -EINVAL; |
2516 | else { | 2521 | else { |
2517 | list_del(&res->list); | 2522 | list_del(&res->list); |
@@ -2538,7 +2543,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
2538 | int attach = vhcr->op_modifier; | 2543 | int attach = vhcr->op_modifier; |
2539 | int block_loopback = vhcr->in_modifier >> 31; | 2544 | int block_loopback = vhcr->in_modifier >> 31; |
2540 | u8 steer_type_mask = 2; | 2545 | u8 steer_type_mask = 2; |
2541 | enum mlx4_steer_type type = gid[7] & steer_type_mask; | 2546 | enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1; |
2542 | 2547 | ||
2543 | qpn = vhcr->in_modifier & 0xffffff; | 2548 | qpn = vhcr->in_modifier & 0xffffff; |
2544 | err = get_res(dev, slave, qpn, RES_QP, &rqp); | 2549 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
@@ -2547,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
2547 | 2552 | ||
2548 | qp.qpn = qpn; | 2553 | qp.qpn = qpn; |
2549 | if (attach) { | 2554 | if (attach) { |
2550 | err = add_mcg_res(dev, slave, rqp, gid, prot); | 2555 | err = add_mcg_res(dev, slave, rqp, gid, prot, type); |
2551 | if (err) | 2556 | if (err) |
2552 | goto ex_put; | 2557 | goto ex_put; |
2553 | 2558 | ||
@@ -2556,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
2556 | if (err) | 2561 | if (err) |
2557 | goto ex_rem; | 2562 | goto ex_rem; |
2558 | } else { | 2563 | } else { |
2559 | err = rem_mcg_res(dev, slave, rqp, gid, prot); | 2564 | err = rem_mcg_res(dev, slave, rqp, gid, prot, type); |
2560 | if (err) | 2565 | if (err) |
2561 | goto ex_put; | 2566 | goto ex_put; |
2562 | err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); | 2567 | err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); |
@@ -2567,7 +2572,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
2567 | 2572 | ||
2568 | ex_rem: | 2573 | ex_rem: |
2569 | /* ignore error return below, already in error */ | 2574 | /* ignore error return below, already in error */ |
2570 | err1 = rem_mcg_res(dev, slave, rqp, gid, prot); | 2575 | err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type); |
2571 | ex_put: | 2576 | ex_put: |
2572 | put_res(dev, slave, qpn, RES_QP); | 2577 | put_res(dev, slave, qpn, RES_QP); |
2573 | 2578 | ||
@@ -2606,7 +2611,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) { | 2611 | list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { |
2607 | qp.qpn = rqp->local_qpn; | 2612 | qp.qpn = rqp->local_qpn; |
2608 | err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, | 2613 | err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, |
2609 | MLX4_MC_STEER); | 2614 | rgid->steer); |
2610 | list_del(&rgid->list); | 2615 | list_del(&rgid->list); |
2611 | kfree(rgid); | 2616 | kfree(rgid); |
2612 | } | 2617 | } |