aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r--drivers/net/mlx4/cq.c1
-rw-r--r--drivers/net/mlx4/eq.c77
-rw-r--r--drivers/net/mlx4/icm.c1
-rw-r--r--drivers/net/mlx4/main.c37
-rw-r--r--drivers/net/mlx4/mcg.c1
-rw-r--r--drivers/net/mlx4/mlx4.h7
-rw-r--r--drivers/net/mlx4/mr.c1
-rw-r--r--drivers/net/mlx4/pd.c1
-rw-r--r--drivers/net/mlx4/profile.c2
-rw-r--r--drivers/net/mlx4/qp.c2
-rw-r--r--drivers/net/mlx4/reset.c1
-rw-r--r--drivers/net/mlx4/srq.c2
12 files changed, 42 insertions, 91 deletions
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c
index ac57b6a42c6e..ccfe276943f0 100644
--- a/drivers/net/mlx4/cq.c
+++ b/drivers/net/mlx4/cq.c
@@ -34,7 +34,6 @@
34 * SOFTWARE. 34 * SOFTWARE.
35 */ 35 */
36 36
37#include <linux/init.h>
38#include <linux/hardirq.h> 37#include <linux/hardirq.h>
39 38
40#include <linux/mlx4/cmd.h> 39#include <linux/mlx4/cmd.h>
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index b9ceddde46c0..bffb7995cb70 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35#include <linux/interrupt.h> 34#include <linux/interrupt.h>
36#include <linux/mm.h> 35#include <linux/mm.h>
37#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
@@ -42,6 +41,10 @@
42#include "fw.h" 41#include "fw.h"
43 42
44enum { 43enum {
44 MLX4_IRQNAME_SIZE = 64
45};
46
47enum {
45 MLX4_NUM_ASYNC_EQE = 0x100, 48 MLX4_NUM_ASYNC_EQE = 0x100,
46 MLX4_NUM_SPARE_EQE = 0x80, 49 MLX4_NUM_SPARE_EQE = 0x80,
47 MLX4_EQ_ENTRY_SIZE = 0x20 50 MLX4_EQ_ENTRY_SIZE = 0x20
@@ -526,48 +529,6 @@ static void mlx4_unmap_clr_int(struct mlx4_dev *dev)
526 iounmap(priv->clr_base); 529 iounmap(priv->clr_base);
527} 530}
528 531
529int mlx4_map_eq_icm(struct mlx4_dev *dev, u64 icm_virt)
530{
531 struct mlx4_priv *priv = mlx4_priv(dev);
532 int ret;
533
534 /*
535 * We assume that mapping one page is enough for the whole EQ
536 * context table. This is fine with all current HCAs, because
537 * we only use 32 EQs and each EQ uses 64 bytes of context
538 * memory, or 1 KB total.
539 */
540 priv->eq_table.icm_virt = icm_virt;
541 priv->eq_table.icm_page = alloc_page(GFP_HIGHUSER);
542 if (!priv->eq_table.icm_page)
543 return -ENOMEM;
544 priv->eq_table.icm_dma = pci_map_page(dev->pdev, priv->eq_table.icm_page, 0,
545 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
546 if (pci_dma_mapping_error(dev->pdev, priv->eq_table.icm_dma)) {
547 __free_page(priv->eq_table.icm_page);
548 return -ENOMEM;
549 }
550
551 ret = mlx4_MAP_ICM_page(dev, priv->eq_table.icm_dma, icm_virt);
552 if (ret) {
553 pci_unmap_page(dev->pdev, priv->eq_table.icm_dma, PAGE_SIZE,
554 PCI_DMA_BIDIRECTIONAL);
555 __free_page(priv->eq_table.icm_page);
556 }
557
558 return ret;
559}
560
561void mlx4_unmap_eq_icm(struct mlx4_dev *dev)
562{
563 struct mlx4_priv *priv = mlx4_priv(dev);
564
565 mlx4_UNMAP_ICM(dev, priv->eq_table.icm_virt, 1);
566 pci_unmap_page(dev->pdev, priv->eq_table.icm_dma, PAGE_SIZE,
567 PCI_DMA_BIDIRECTIONAL);
568 __free_page(priv->eq_table.icm_page);
569}
570
571int mlx4_alloc_eq_table(struct mlx4_dev *dev) 532int mlx4_alloc_eq_table(struct mlx4_dev *dev)
572{ 533{
573 struct mlx4_priv *priv = mlx4_priv(dev); 534 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -615,7 +576,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
615 priv->eq_table.clr_int = priv->clr_base + 576 priv->eq_table.clr_int = priv->clr_base +
616 (priv->eq_table.inta_pin < 32 ? 4 : 0); 577 (priv->eq_table.inta_pin < 32 ? 4 : 0);
617 578
618 priv->eq_table.irq_names = kmalloc(16 * dev->caps.num_comp_vectors, GFP_KERNEL); 579 priv->eq_table.irq_names =
580 kmalloc(MLX4_IRQNAME_SIZE * (dev->caps.num_comp_vectors + 1),
581 GFP_KERNEL);
619 if (!priv->eq_table.irq_names) { 582 if (!priv->eq_table.irq_names) {
620 err = -ENOMEM; 583 err = -ENOMEM;
621 goto err_out_bitmap; 584 goto err_out_bitmap;
@@ -638,17 +601,25 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
638 goto err_out_comp; 601 goto err_out_comp;
639 602
640 if (dev->flags & MLX4_FLAG_MSI_X) { 603 if (dev->flags & MLX4_FLAG_MSI_X) {
641 static const char async_eq_name[] = "mlx4-async";
642 const char *eq_name; 604 const char *eq_name;
643 605
644 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i) { 606 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i) {
645 if (i < dev->caps.num_comp_vectors) { 607 if (i < dev->caps.num_comp_vectors) {
646 snprintf(priv->eq_table.irq_names + i * 16, 16, 608 snprintf(priv->eq_table.irq_names +
647 "mlx4-comp-%d", i); 609 i * MLX4_IRQNAME_SIZE,
648 eq_name = priv->eq_table.irq_names + i * 16; 610 MLX4_IRQNAME_SIZE,
649 } else 611 "mlx4-comp-%d@pci:%s", i,
650 eq_name = async_eq_name; 612 pci_name(dev->pdev));
613 } else {
614 snprintf(priv->eq_table.irq_names +
615 i * MLX4_IRQNAME_SIZE,
616 MLX4_IRQNAME_SIZE,
617 "mlx4-async@pci:%s",
618 pci_name(dev->pdev));
619 }
651 620
621 eq_name = priv->eq_table.irq_names +
622 i * MLX4_IRQNAME_SIZE;
652 err = request_irq(priv->eq_table.eq[i].irq, 623 err = request_irq(priv->eq_table.eq[i].irq,
653 mlx4_msi_x_interrupt, 0, eq_name, 624 mlx4_msi_x_interrupt, 0, eq_name,
654 priv->eq_table.eq + i); 625 priv->eq_table.eq + i);
@@ -658,8 +629,12 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
658 priv->eq_table.eq[i].have_irq = 1; 629 priv->eq_table.eq[i].have_irq = 1;
659 } 630 }
660 } else { 631 } else {
632 snprintf(priv->eq_table.irq_names,
633 MLX4_IRQNAME_SIZE,
634 DRV_NAME "@pci:%s",
635 pci_name(dev->pdev));
661 err = request_irq(dev->pdev->irq, mlx4_interrupt, 636 err = request_irq(dev->pdev->irq, mlx4_interrupt,
662 IRQF_SHARED, DRV_NAME, dev); 637 IRQF_SHARED, priv->eq_table.irq_names, dev);
663 if (err) 638 if (err)
664 goto err_out_async; 639 goto err_out_async;
665 640
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index baf4bf66062c..04b382fcb8c8 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
36#include <linux/mm.h> 35#include <linux/mm.h>
37#include <linux/scatterlist.h> 36#include <linux/scatterlist.h>
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index dac621b1e9fc..3dd481e77f92 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -525,7 +525,10 @@ static int mlx4_init_icm(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap,
525 goto err_unmap_aux; 525 goto err_unmap_aux;
526 } 526 }
527 527
528 err = mlx4_map_eq_icm(dev, init_hca->eqc_base); 528 err = mlx4_init_icm_table(dev, &priv->eq_table.table,
529 init_hca->eqc_base, dev_cap->eqc_entry_sz,
530 dev->caps.num_eqs, dev->caps.num_eqs,
531 0, 0);
529 if (err) { 532 if (err) {
530 mlx4_err(dev, "Failed to map EQ context memory, aborting.\n"); 533 mlx4_err(dev, "Failed to map EQ context memory, aborting.\n");
531 goto err_unmap_cmpt; 534 goto err_unmap_cmpt;
@@ -668,7 +671,7 @@ err_unmap_mtt:
668 mlx4_cleanup_icm_table(dev, &priv->mr_table.mtt_table); 671 mlx4_cleanup_icm_table(dev, &priv->mr_table.mtt_table);
669 672
670err_unmap_eq: 673err_unmap_eq:
671 mlx4_unmap_eq_icm(dev); 674 mlx4_cleanup_icm_table(dev, &priv->eq_table.table);
672 675
673err_unmap_cmpt: 676err_unmap_cmpt:
674 mlx4_cleanup_icm_table(dev, &priv->eq_table.cmpt_table); 677 mlx4_cleanup_icm_table(dev, &priv->eq_table.cmpt_table);
@@ -698,11 +701,11 @@ static void mlx4_free_icms(struct mlx4_dev *dev)
698 mlx4_cleanup_icm_table(dev, &priv->qp_table.qp_table); 701 mlx4_cleanup_icm_table(dev, &priv->qp_table.qp_table);
699 mlx4_cleanup_icm_table(dev, &priv->mr_table.dmpt_table); 702 mlx4_cleanup_icm_table(dev, &priv->mr_table.dmpt_table);
700 mlx4_cleanup_icm_table(dev, &priv->mr_table.mtt_table); 703 mlx4_cleanup_icm_table(dev, &priv->mr_table.mtt_table);
704 mlx4_cleanup_icm_table(dev, &priv->eq_table.table);
701 mlx4_cleanup_icm_table(dev, &priv->eq_table.cmpt_table); 705 mlx4_cleanup_icm_table(dev, &priv->eq_table.cmpt_table);
702 mlx4_cleanup_icm_table(dev, &priv->cq_table.cmpt_table); 706 mlx4_cleanup_icm_table(dev, &priv->cq_table.cmpt_table);
703 mlx4_cleanup_icm_table(dev, &priv->srq_table.cmpt_table); 707 mlx4_cleanup_icm_table(dev, &priv->srq_table.cmpt_table);
704 mlx4_cleanup_icm_table(dev, &priv->qp_table.cmpt_table); 708 mlx4_cleanup_icm_table(dev, &priv->qp_table.cmpt_table);
705 mlx4_unmap_eq_icm(dev);
706 709
707 mlx4_UNMAP_ICM_AUX(dev); 710 mlx4_UNMAP_ICM_AUX(dev);
708 mlx4_free_icm(dev, priv->fw.aux_icm, 0); 711 mlx4_free_icm(dev, priv->fw.aux_icm, 0);
@@ -786,7 +789,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
786 return 0; 789 return 0;
787 790
788err_close: 791err_close:
789 mlx4_close_hca(dev); 792 mlx4_CLOSE_HCA(dev, 0);
790 793
791err_free_icm: 794err_free_icm:
792 mlx4_free_icms(dev); 795 mlx4_free_icms(dev);
@@ -1070,18 +1073,12 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1070 goto err_disable_pdev; 1073 goto err_disable_pdev;
1071 } 1074 }
1072 1075
1073 err = pci_request_region(pdev, 0, DRV_NAME); 1076 err = pci_request_regions(pdev, DRV_NAME);
1074 if (err) { 1077 if (err) {
1075 dev_err(&pdev->dev, "Cannot request control region, aborting.\n"); 1078 dev_err(&pdev->dev, "Couldn't get PCI resources, aborting\n");
1076 goto err_disable_pdev; 1079 goto err_disable_pdev;
1077 } 1080 }
1078 1081
1079 err = pci_request_region(pdev, 2, DRV_NAME);
1080 if (err) {
1081 dev_err(&pdev->dev, "Cannot request UAR region, aborting.\n");
1082 goto err_release_bar0;
1083 }
1084
1085 pci_set_master(pdev); 1082 pci_set_master(pdev);
1086 1083
1087 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); 1084 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
@@ -1090,7 +1087,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1090 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 1087 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1091 if (err) { 1088 if (err) {
1092 dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting.\n"); 1089 dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting.\n");
1093 goto err_release_bar2; 1090 goto err_release_regions;
1094 } 1091 }
1095 } 1092 }
1096 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 1093 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
@@ -1101,7 +1098,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1101 if (err) { 1098 if (err) {
1102 dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, " 1099 dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, "
1103 "aborting.\n"); 1100 "aborting.\n");
1104 goto err_release_bar2; 1101 goto err_release_regions;
1105 } 1102 }
1106 } 1103 }
1107 1104
@@ -1110,7 +1107,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1110 dev_err(&pdev->dev, "Device struct alloc failed, " 1107 dev_err(&pdev->dev, "Device struct alloc failed, "
1111 "aborting.\n"); 1108 "aborting.\n");
1112 err = -ENOMEM; 1109 err = -ENOMEM;
1113 goto err_release_bar2; 1110 goto err_release_regions;
1114 } 1111 }
1115 1112
1116 dev = &priv->dev; 1113 dev = &priv->dev;
@@ -1205,11 +1202,8 @@ err_cmd:
1205err_free_dev: 1202err_free_dev:
1206 kfree(priv); 1203 kfree(priv);
1207 1204
1208err_release_bar2: 1205err_release_regions:
1209 pci_release_region(pdev, 2); 1206 pci_release_regions(pdev);
1210
1211err_release_bar0:
1212 pci_release_region(pdev, 0);
1213 1207
1214err_disable_pdev: 1208err_disable_pdev:
1215 pci_disable_device(pdev); 1209 pci_disable_device(pdev);
@@ -1265,8 +1259,7 @@ static void mlx4_remove_one(struct pci_dev *pdev)
1265 pci_disable_msix(pdev); 1259 pci_disable_msix(pdev);
1266 1260
1267 kfree(priv); 1261 kfree(priv);
1268 pci_release_region(pdev, 2); 1262 pci_release_regions(pdev);
1269 pci_release_region(pdev, 0);
1270 pci_disable_device(pdev); 1263 pci_disable_device(pdev);
1271 pci_set_drvdata(pdev, NULL); 1264 pci_set_drvdata(pdev, NULL);
1272 } 1265 }
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index 6053c357a470..5ccbce9866fe 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35#include <linux/string.h> 34#include <linux/string.h>
36#include <linux/slab.h> 35#include <linux/slab.h>
37 36
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 5bd79c2b184f..bc72d6e4919b 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -205,9 +205,7 @@ struct mlx4_eq_table {
205 void __iomem **uar_map; 205 void __iomem **uar_map;
206 u32 clr_mask; 206 u32 clr_mask;
207 struct mlx4_eq *eq; 207 struct mlx4_eq *eq;
208 u64 icm_virt; 208 struct mlx4_icm_table table;
209 struct page *icm_page;
210 dma_addr_t icm_dma;
211 struct mlx4_icm_table cmpt_table; 209 struct mlx4_icm_table cmpt_table;
212 int have_irq; 210 int have_irq;
213 u8 inta_pin; 211 u8 inta_pin;
@@ -373,9 +371,6 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
373 struct mlx4_dev_cap *dev_cap, 371 struct mlx4_dev_cap *dev_cap,
374 struct mlx4_init_hca_param *init_hca); 372 struct mlx4_init_hca_param *init_hca);
375 373
376int mlx4_map_eq_icm(struct mlx4_dev *dev, u64 icm_virt);
377void mlx4_unmap_eq_icm(struct mlx4_dev *dev);
378
379int mlx4_cmd_init(struct mlx4_dev *dev); 374int mlx4_cmd_init(struct mlx4_dev *dev);
380void mlx4_cmd_cleanup(struct mlx4_dev *dev); 375void mlx4_cmd_cleanup(struct mlx4_dev *dev);
381void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param); 376void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param);
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index f96948be0a44..ca7ab8e7b4cc 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -32,7 +32,6 @@
32 * SOFTWARE. 32 * SOFTWARE.
33 */ 33 */
34 34
35#include <linux/init.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
37 36
38#include <linux/mlx4/cmd.h> 37#include <linux/mlx4/cmd.h>
diff --git a/drivers/net/mlx4/pd.c b/drivers/net/mlx4/pd.c
index 26d1a7a9e375..c4988d6bd5b2 100644
--- a/drivers/net/mlx4/pd.c
+++ b/drivers/net/mlx4/pd.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
36 35
37#include <asm/page.h> 36#include <asm/page.h>
diff --git a/drivers/net/mlx4/profile.c b/drivers/net/mlx4/profile.c
index bd22df95adf9..ca25b9dc8378 100644
--- a/drivers/net/mlx4/profile.c
+++ b/drivers/net/mlx4/profile.c
@@ -32,8 +32,6 @@
32 * SOFTWARE. 32 * SOFTWARE.
33 */ 33 */
34 34
35#include <linux/init.h>
36
37#include "mlx4.h" 35#include "mlx4.h"
38#include "fw.h" 36#include "fw.h"
39 37
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c
index 1c565ef8d179..42ab9fc01d3e 100644
--- a/drivers/net/mlx4/qp.c
+++ b/drivers/net/mlx4/qp.c
@@ -33,8 +33,6 @@
33 * SOFTWARE. 33 * SOFTWARE.
34 */ 34 */
35 35
36#include <linux/init.h>
37
38#include <linux/mlx4/cmd.h> 36#include <linux/mlx4/cmd.h>
39#include <linux/mlx4/qp.h> 37#include <linux/mlx4/qp.h>
40 38
diff --git a/drivers/net/mlx4/reset.c b/drivers/net/mlx4/reset.c
index 3951b884c0fb..e5741dab3825 100644
--- a/drivers/net/mlx4/reset.c
+++ b/drivers/net/mlx4/reset.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
36#include <linux/pci.h> 35#include <linux/pci.h>
37#include <linux/delay.h> 36#include <linux/delay.h>
diff --git a/drivers/net/mlx4/srq.c b/drivers/net/mlx4/srq.c
index fe9f218691f5..1377d0dc8f1f 100644
--- a/drivers/net/mlx4/srq.c
+++ b/drivers/net/mlx4/srq.c
@@ -31,8 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/init.h>
35
36#include <linux/mlx4/cmd.h> 34#include <linux/mlx4/cmd.h>
37 35
38#include "mlx4.h" 36#include "mlx4.h"