diff options
38 files changed, 247 insertions, 188 deletions
diff --git a/drivers/infiniband/hw/mlx5/ah.c b/drivers/infiniband/hw/mlx5/ah.c index 39ab0caefdf9..66080580e24d 100644 --- a/drivers/infiniband/hw/mlx5/ah.c +++ b/drivers/infiniband/hw/mlx5/ah.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index c463e7bba5f4..2ee6b1051975 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -572,11 +572,15 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
572 | 572 | ||
573 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 573 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
574 | { | 574 | { |
575 | struct mlx5_core_dev *mdev = to_mdev(ibcq->device)->mdev; | ||
576 | void __iomem *uar_page = mdev->priv.uuari.uars[0].map; | ||
577 | |||
575 | mlx5_cq_arm(&to_mcq(ibcq)->mcq, | 578 | mlx5_cq_arm(&to_mcq(ibcq)->mcq, |
576 | (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? | 579 | (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? |
577 | MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, | 580 | MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, |
578 | to_mdev(ibcq->device)->mdev->priv.uuari.uars[0].map, | 581 | uar_page, |
579 | MLX5_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->mdev->priv.cq_uar_lock)); | 582 | MLX5_GET_DOORBELL_LOCK(&mdev->priv.cq_uar_lock), |
583 | to_mcq(ibcq)->mcq.cons_index); | ||
580 | 584 | ||
581 | return 0; | 585 | return 0; |
582 | } | 586 | } |
@@ -697,8 +701,6 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, | |||
697 | 701 | ||
698 | cq->mcq.set_ci_db = cq->db.db; | 702 | cq->mcq.set_ci_db = cq->db.db; |
699 | cq->mcq.arm_db = cq->db.db + 1; | 703 | cq->mcq.arm_db = cq->db.db + 1; |
700 | *cq->mcq.set_ci_db = 0; | ||
701 | *cq->mcq.arm_db = 0; | ||
702 | cq->mcq.cqe_sz = cqe_size; | 704 | cq->mcq.cqe_sz = cqe_size; |
703 | 705 | ||
704 | err = alloc_cq_buf(dev, &cq->buf, entries, cqe_size); | 706 | err = alloc_cq_buf(dev, &cq->buf, entries, cqe_size); |
@@ -782,7 +784,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries, | |||
782 | cq->cqe_size = cqe_size; | 784 | cq->cqe_size = cqe_size; |
783 | cqb->ctx.cqe_sz_flags = cqe_sz_to_mlx_sz(cqe_size) << 5; | 785 | cqb->ctx.cqe_sz_flags = cqe_sz_to_mlx_sz(cqe_size) << 5; |
784 | cqb->ctx.log_sz_usr_page = cpu_to_be32((ilog2(entries) << 24) | index); | 786 | cqb->ctx.log_sz_usr_page = cpu_to_be32((ilog2(entries) << 24) | index); |
785 | err = mlx5_vector2eqn(dev, vector, &eqn, &irqn); | 787 | err = mlx5_vector2eqn(dev->mdev, vector, &eqn, &irqn); |
786 | if (err) | 788 | if (err) |
787 | goto err_cqb; | 789 | goto err_cqb; |
788 | 790 | ||
diff --git a/drivers/infiniband/hw/mlx5/doorbell.c b/drivers/infiniband/hw/mlx5/doorbell.c index ece028fc47d6..a0e4e6ddb71a 100644 --- a/drivers/infiniband/hw/mlx5/doorbell.c +++ b/drivers/infiniband/hw/mlx5/doorbell.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c index 657af9a1167c..9cf9a37bb5ff 100644 --- a/drivers/infiniband/hw/mlx5/mad.c +++ b/drivers/infiniband/hw/mlx5/mad.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index cc4ac1e583b2..57c9809e8b87 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -62,95 +62,6 @@ static char mlx5_version[] = | |||
62 | DRIVER_NAME ": Mellanox Connect-IB Infiniband driver v" | 62 | DRIVER_NAME ": Mellanox Connect-IB Infiniband driver v" |
63 | DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; | 63 | DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; |
64 | 64 | ||
65 | int mlx5_vector2eqn(struct mlx5_ib_dev *dev, int vector, int *eqn, int *irqn) | ||
66 | { | ||
67 | struct mlx5_eq_table *table = &dev->mdev->priv.eq_table; | ||
68 | struct mlx5_eq *eq, *n; | ||
69 | int err = -ENOENT; | ||
70 | |||
71 | spin_lock(&table->lock); | ||
72 | list_for_each_entry_safe(eq, n, &dev->eqs_list, list) { | ||
73 | if (eq->index == vector) { | ||
74 | *eqn = eq->eqn; | ||
75 | *irqn = eq->irqn; | ||
76 | err = 0; | ||
77 | break; | ||
78 | } | ||
79 | } | ||
80 | spin_unlock(&table->lock); | ||
81 | |||
82 | return err; | ||
83 | } | ||
84 | |||
85 | static int alloc_comp_eqs(struct mlx5_ib_dev *dev) | ||
86 | { | ||
87 | struct mlx5_eq_table *table = &dev->mdev->priv.eq_table; | ||
88 | char name[MLX5_MAX_EQ_NAME]; | ||
89 | struct mlx5_eq *eq, *n; | ||
90 | int ncomp_vec; | ||
91 | int nent; | ||
92 | int err; | ||
93 | int i; | ||
94 | |||
95 | INIT_LIST_HEAD(&dev->eqs_list); | ||
96 | ncomp_vec = table->num_comp_vectors; | ||
97 | nent = MLX5_COMP_EQ_SIZE; | ||
98 | for (i = 0; i < ncomp_vec; i++) { | ||
99 | eq = kzalloc(sizeof(*eq), GFP_KERNEL); | ||
100 | if (!eq) { | ||
101 | err = -ENOMEM; | ||
102 | goto clean; | ||
103 | } | ||
104 | |||
105 | snprintf(name, MLX5_MAX_EQ_NAME, "mlx5_comp%d", i); | ||
106 | err = mlx5_create_map_eq(dev->mdev, eq, | ||
107 | i + MLX5_EQ_VEC_COMP_BASE, nent, 0, | ||
108 | name, &dev->mdev->priv.uuari.uars[0]); | ||
109 | if (err) { | ||
110 | kfree(eq); | ||
111 | goto clean; | ||
112 | } | ||
113 | mlx5_ib_dbg(dev, "allocated completion EQN %d\n", eq->eqn); | ||
114 | eq->index = i; | ||
115 | spin_lock(&table->lock); | ||
116 | list_add_tail(&eq->list, &dev->eqs_list); | ||
117 | spin_unlock(&table->lock); | ||
118 | } | ||
119 | |||
120 | dev->num_comp_vectors = ncomp_vec; | ||
121 | return 0; | ||
122 | |||
123 | clean: | ||
124 | spin_lock(&table->lock); | ||
125 | list_for_each_entry_safe(eq, n, &dev->eqs_list, list) { | ||
126 | list_del(&eq->list); | ||
127 | spin_unlock(&table->lock); | ||
128 | if (mlx5_destroy_unmap_eq(dev->mdev, eq)) | ||
129 | mlx5_ib_warn(dev, "failed to destroy EQ 0x%x\n", eq->eqn); | ||
130 | kfree(eq); | ||
131 | spin_lock(&table->lock); | ||
132 | } | ||
133 | spin_unlock(&table->lock); | ||
134 | return err; | ||
135 | } | ||
136 | |||
137 | static void free_comp_eqs(struct mlx5_ib_dev *dev) | ||
138 | { | ||
139 | struct mlx5_eq_table *table = &dev->mdev->priv.eq_table; | ||
140 | struct mlx5_eq *eq, *n; | ||
141 | |||
142 | spin_lock(&table->lock); | ||
143 | list_for_each_entry_safe(eq, n, &dev->eqs_list, list) { | ||
144 | list_del(&eq->list); | ||
145 | spin_unlock(&table->lock); | ||
146 | if (mlx5_destroy_unmap_eq(dev->mdev, eq)) | ||
147 | mlx5_ib_warn(dev, "failed to destroy EQ 0x%x\n", eq->eqn); | ||
148 | kfree(eq); | ||
149 | spin_lock(&table->lock); | ||
150 | } | ||
151 | spin_unlock(&table->lock); | ||
152 | } | ||
153 | |||
154 | static int mlx5_ib_query_device(struct ib_device *ibdev, | 65 | static int mlx5_ib_query_device(struct ib_device *ibdev, |
155 | struct ib_device_attr *props) | 66 | struct ib_device_attr *props) |
156 | { | 67 | { |
@@ -1291,10 +1202,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
1291 | 1202 | ||
1292 | get_ext_port_caps(dev); | 1203 | get_ext_port_caps(dev); |
1293 | 1204 | ||
1294 | err = alloc_comp_eqs(dev); | ||
1295 | if (err) | ||
1296 | goto err_dealloc; | ||
1297 | |||
1298 | MLX5_INIT_DOORBELL_LOCK(&dev->uar_lock); | 1205 | MLX5_INIT_DOORBELL_LOCK(&dev->uar_lock); |
1299 | 1206 | ||
1300 | strlcpy(dev->ib_dev.name, "mlx5_%d", IB_DEVICE_NAME_MAX); | 1207 | strlcpy(dev->ib_dev.name, "mlx5_%d", IB_DEVICE_NAME_MAX); |
@@ -1303,7 +1210,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
1303 | dev->ib_dev.local_dma_lkey = mdev->caps.gen.reserved_lkey; | 1210 | dev->ib_dev.local_dma_lkey = mdev->caps.gen.reserved_lkey; |
1304 | dev->num_ports = mdev->caps.gen.num_ports; | 1211 | dev->num_ports = mdev->caps.gen.num_ports; |
1305 | dev->ib_dev.phys_port_cnt = dev->num_ports; | 1212 | dev->ib_dev.phys_port_cnt = dev->num_ports; |
1306 | dev->ib_dev.num_comp_vectors = dev->num_comp_vectors; | 1213 | dev->ib_dev.num_comp_vectors = |
1214 | dev->mdev->priv.eq_table.num_comp_vectors; | ||
1307 | dev->ib_dev.dma_device = &mdev->pdev->dev; | 1215 | dev->ib_dev.dma_device = &mdev->pdev->dev; |
1308 | 1216 | ||
1309 | dev->ib_dev.uverbs_abi_ver = MLX5_IB_UVERBS_ABI_VERSION; | 1217 | dev->ib_dev.uverbs_abi_ver = MLX5_IB_UVERBS_ABI_VERSION; |
@@ -1390,13 +1298,13 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
1390 | 1298 | ||
1391 | err = init_node_data(dev); | 1299 | err = init_node_data(dev); |
1392 | if (err) | 1300 | if (err) |
1393 | goto err_eqs; | 1301 | goto err_dealloc; |
1394 | 1302 | ||
1395 | mutex_init(&dev->cap_mask_mutex); | 1303 | mutex_init(&dev->cap_mask_mutex); |
1396 | 1304 | ||
1397 | err = create_dev_resources(&dev->devr); | 1305 | err = create_dev_resources(&dev->devr); |
1398 | if (err) | 1306 | if (err) |
1399 | goto err_eqs; | 1307 | goto err_dealloc; |
1400 | 1308 | ||
1401 | err = mlx5_ib_odp_init_one(dev); | 1309 | err = mlx5_ib_odp_init_one(dev); |
1402 | if (err) | 1310 | if (err) |
@@ -1433,9 +1341,6 @@ err_odp: | |||
1433 | err_rsrc: | 1341 | err_rsrc: |
1434 | destroy_dev_resources(&dev->devr); | 1342 | destroy_dev_resources(&dev->devr); |
1435 | 1343 | ||
1436 | err_eqs: | ||
1437 | free_comp_eqs(dev); | ||
1438 | |||
1439 | err_dealloc: | 1344 | err_dealloc: |
1440 | ib_dealloc_device((struct ib_device *)dev); | 1345 | ib_dealloc_device((struct ib_device *)dev); |
1441 | 1346 | ||
@@ -1450,7 +1355,6 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context) | |||
1450 | destroy_umrc_res(dev); | 1355 | destroy_umrc_res(dev); |
1451 | mlx5_ib_odp_remove_one(dev); | 1356 | mlx5_ib_odp_remove_one(dev); |
1452 | destroy_dev_resources(&dev->devr); | 1357 | destroy_dev_resources(&dev->devr); |
1453 | free_comp_eqs(dev); | ||
1454 | ib_dealloc_device(&dev->ib_dev); | 1358 | ib_dealloc_device(&dev->ib_dev); |
1455 | } | 1359 | } |
1456 | 1360 | ||
@@ -1458,6 +1362,7 @@ static struct mlx5_interface mlx5_ib_interface = { | |||
1458 | .add = mlx5_ib_add, | 1362 | .add = mlx5_ib_add, |
1459 | .remove = mlx5_ib_remove, | 1363 | .remove = mlx5_ib_remove, |
1460 | .event = mlx5_ib_event, | 1364 | .event = mlx5_ib_event, |
1365 | .protocol = MLX5_INTERFACE_PROTOCOL_IB, | ||
1461 | }; | 1366 | }; |
1462 | 1367 | ||
1463 | static int __init mlx5_ib_init(void) | 1368 | static int __init mlx5_ib_init(void) |
diff --git a/drivers/infiniband/hw/mlx5/mem.c b/drivers/infiniband/hw/mlx5/mem.c index 611a9fdf2f38..40df2cca0609 100644 --- a/drivers/infiniband/hw/mlx5/mem.c +++ b/drivers/infiniband/hw/mlx5/mem.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 83f22fe297c8..dff1cfcdf476 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -421,9 +421,7 @@ struct mlx5_ib_dev { | |||
421 | struct ib_device ib_dev; | 421 | struct ib_device ib_dev; |
422 | struct mlx5_core_dev *mdev; | 422 | struct mlx5_core_dev *mdev; |
423 | MLX5_DECLARE_DOORBELL_LOCK(uar_lock); | 423 | MLX5_DECLARE_DOORBELL_LOCK(uar_lock); |
424 | struct list_head eqs_list; | ||
425 | int num_ports; | 424 | int num_ports; |
426 | int num_comp_vectors; | ||
427 | /* serialize update of capability mask | 425 | /* serialize update of capability mask |
428 | */ | 426 | */ |
429 | struct mutex cap_mask_mutex; | 427 | struct mutex cap_mask_mutex; |
@@ -594,7 +592,6 @@ struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev, | |||
594 | struct ib_ucontext *context, | 592 | struct ib_ucontext *context, |
595 | struct ib_udata *udata); | 593 | struct ib_udata *udata); |
596 | int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd); | 594 | int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd); |
597 | int mlx5_vector2eqn(struct mlx5_ib_dev *dev, int vector, int *eqn, int *irqn); | ||
598 | int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset); | 595 | int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset); |
599 | int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port); | 596 | int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port); |
600 | int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, | 597 | int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, |
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index cd9822eeacae..71c593583864 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index a2c541c4809a..5099db08afd2 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014 Mellanox Technologies. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index be0cd358b080..4d7024b899cb 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -796,9 +796,6 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, | |||
796 | goto err_free; | 796 | goto err_free; |
797 | } | 797 | } |
798 | 798 | ||
799 | qp->db.db[0] = 0; | ||
800 | qp->db.db[1] = 0; | ||
801 | |||
802 | qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wrid), GFP_KERNEL); | 799 | qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wrid), GFP_KERNEL); |
803 | qp->sq.wr_data = kmalloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wr_data), GFP_KERNEL); | 800 | qp->sq.wr_data = kmalloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wr_data), GFP_KERNEL); |
804 | qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(*qp->rq.wrid), GFP_KERNEL); | 801 | qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(*qp->rq.wrid), GFP_KERNEL); |
@@ -1162,10 +1159,11 @@ static void destroy_qp_common(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp) | |||
1162 | in = kzalloc(sizeof(*in), GFP_KERNEL); | 1159 | in = kzalloc(sizeof(*in), GFP_KERNEL); |
1163 | if (!in) | 1160 | if (!in) |
1164 | return; | 1161 | return; |
1162 | |||
1165 | if (qp->state != IB_QPS_RESET) { | 1163 | if (qp->state != IB_QPS_RESET) { |
1166 | mlx5_ib_qp_disable_pagefaults(qp); | 1164 | mlx5_ib_qp_disable_pagefaults(qp); |
1167 | if (mlx5_core_qp_modify(dev->mdev, to_mlx5_state(qp->state), | 1165 | if (mlx5_core_qp_modify(dev->mdev, to_mlx5_state(qp->state), |
1168 | MLX5_QP_STATE_RST, in, sizeof(*in), &qp->mqp)) | 1166 | MLX5_QP_STATE_RST, in, 0, &qp->mqp)) |
1169 | mlx5_ib_warn(dev, "mlx5_ib: modify QP %06x to RESET failed\n", | 1167 | mlx5_ib_warn(dev, "mlx5_ib: modify QP %06x to RESET failed\n", |
1170 | qp->mqp.qpn); | 1168 | qp->mqp.qpn); |
1171 | } | 1169 | } |
diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c index 41fec66217dd..02d77a29764d 100644 --- a/drivers/infiniband/hw/mlx5/srq.c +++ b/drivers/infiniband/hw/mlx5/srq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -165,8 +165,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq, | |||
165 | return err; | 165 | return err; |
166 | } | 166 | } |
167 | 167 | ||
168 | *srq->db.db = 0; | ||
169 | |||
170 | if (mlx5_buf_alloc(dev->mdev, buf_size, PAGE_SIZE * 2, &srq->buf)) { | 168 | if (mlx5_buf_alloc(dev->mdev, buf_size, PAGE_SIZE * 2, &srq->buf)) { |
171 | mlx5_ib_dbg(dev, "buf alloc failed\n"); | 169 | mlx5_ib_dbg(dev, "buf alloc failed\n"); |
172 | err = -ENOMEM; | 170 | err = -ENOMEM; |
diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h index d0ba264ac1ed..76fb7b927d37 100644 --- a/drivers/infiniband/hw/mlx5/user.h +++ b/drivers/infiniband/hw/mlx5/user.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c index 201ca6d76ce5..ac0f7bf4be95 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -171,6 +171,9 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir, | |||
171 | db->db = pgdir->db_page + offset / sizeof(*pgdir->db_page); | 171 | db->db = pgdir->db_page + offset / sizeof(*pgdir->db_page); |
172 | db->dma = pgdir->db_dma + offset; | 172 | db->dma = pgdir->db_dma + offset; |
173 | 173 | ||
174 | db->db[0] = 0; | ||
175 | db->db[1] = 0; | ||
176 | |||
174 | return 0; | 177 | return 0; |
175 | } | 178 | } |
176 | 179 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index a2853057c779..e3273faf4568 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -125,7 +125,10 @@ static u8 alloc_token(struct mlx5_cmd *cmd) | |||
125 | u8 token; | 125 | u8 token; |
126 | 126 | ||
127 | spin_lock(&cmd->token_lock); | 127 | spin_lock(&cmd->token_lock); |
128 | token = cmd->token++ % 255 + 1; | 128 | cmd->token++; |
129 | if (cmd->token == 0) | ||
130 | cmd->token++; | ||
131 | token = cmd->token; | ||
129 | spin_unlock(&cmd->token_lock); | 132 | spin_unlock(&cmd->token_lock); |
130 | 133 | ||
131 | return token; | 134 | return token; |
@@ -515,10 +518,11 @@ static void cmd_work_handler(struct work_struct *work) | |||
515 | ent->ts1 = ktime_get_ns(); | 518 | ent->ts1 = ktime_get_ns(); |
516 | 519 | ||
517 | /* ring doorbell after the descriptor is valid */ | 520 | /* ring doorbell after the descriptor is valid */ |
521 | mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); | ||
518 | wmb(); | 522 | wmb(); |
519 | iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); | 523 | iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); |
520 | mlx5_core_dbg(dev, "write 0x%x to command doorbell\n", 1 << ent->idx); | ||
521 | mmiowb(); | 524 | mmiowb(); |
525 | /* if not in polling don't use ent after this point */ | ||
522 | if (cmd->mode == CMD_MODE_POLLING) { | 526 | if (cmd->mode == CMD_MODE_POLLING) { |
523 | poll_timeout(ent); | 527 | poll_timeout(ent); |
524 | /* make sure we read the descriptor after ownership is SW */ | 528 | /* make sure we read the descriptor after ownership is SW */ |
@@ -1236,7 +1240,8 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, | |||
1236 | goto out_out; | 1240 | goto out_out; |
1237 | } | 1241 | } |
1238 | 1242 | ||
1239 | err = mlx5_copy_from_msg(out, outb, out_size); | 1243 | if (!callback) |
1244 | err = mlx5_copy_from_msg(out, outb, out_size); | ||
1240 | 1245 | ||
1241 | out_out: | 1246 | out_out: |
1242 | if (!callback) | 1247 | if (!callback) |
@@ -1319,6 +1324,45 @@ ex_err: | |||
1319 | return err; | 1324 | return err; |
1320 | } | 1325 | } |
1321 | 1326 | ||
1327 | static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) | ||
1328 | { | ||
1329 | struct device *ddev = &dev->pdev->dev; | ||
1330 | |||
1331 | cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, | ||
1332 | &cmd->alloc_dma, GFP_KERNEL); | ||
1333 | if (!cmd->cmd_alloc_buf) | ||
1334 | return -ENOMEM; | ||
1335 | |||
1336 | /* make sure it is aligned to 4K */ | ||
1337 | if (!((uintptr_t)cmd->cmd_alloc_buf & (MLX5_ADAPTER_PAGE_SIZE - 1))) { | ||
1338 | cmd->cmd_buf = cmd->cmd_alloc_buf; | ||
1339 | cmd->dma = cmd->alloc_dma; | ||
1340 | cmd->alloc_size = MLX5_ADAPTER_PAGE_SIZE; | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1344 | dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf, | ||
1345 | cmd->alloc_dma); | ||
1346 | cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, | ||
1347 | 2 * MLX5_ADAPTER_PAGE_SIZE - 1, | ||
1348 | &cmd->alloc_dma, GFP_KERNEL); | ||
1349 | if (!cmd->cmd_alloc_buf) | ||
1350 | return -ENOMEM; | ||
1351 | |||
1352 | cmd->cmd_buf = PTR_ALIGN(cmd->cmd_alloc_buf, MLX5_ADAPTER_PAGE_SIZE); | ||
1353 | cmd->dma = ALIGN(cmd->alloc_dma, MLX5_ADAPTER_PAGE_SIZE); | ||
1354 | cmd->alloc_size = 2 * MLX5_ADAPTER_PAGE_SIZE - 1; | ||
1355 | return 0; | ||
1356 | } | ||
1357 | |||
1358 | static void free_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) | ||
1359 | { | ||
1360 | struct device *ddev = &dev->pdev->dev; | ||
1361 | |||
1362 | dma_free_coherent(ddev, cmd->alloc_size, cmd->cmd_alloc_buf, | ||
1363 | cmd->alloc_dma); | ||
1364 | } | ||
1365 | |||
1322 | int mlx5_cmd_init(struct mlx5_core_dev *dev) | 1366 | int mlx5_cmd_init(struct mlx5_core_dev *dev) |
1323 | { | 1367 | { |
1324 | int size = sizeof(struct mlx5_cmd_prot_block); | 1368 | int size = sizeof(struct mlx5_cmd_prot_block); |
@@ -1341,17 +1385,9 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) | |||
1341 | if (!cmd->pool) | 1385 | if (!cmd->pool) |
1342 | return -ENOMEM; | 1386 | return -ENOMEM; |
1343 | 1387 | ||
1344 | cmd->cmd_buf = (void *)__get_free_pages(GFP_ATOMIC, 0); | 1388 | err = alloc_cmd_page(dev, cmd); |
1345 | if (!cmd->cmd_buf) { | 1389 | if (err) |
1346 | err = -ENOMEM; | ||
1347 | goto err_free_pool; | 1390 | goto err_free_pool; |
1348 | } | ||
1349 | cmd->dma = dma_map_single(&dev->pdev->dev, cmd->cmd_buf, PAGE_SIZE, | ||
1350 | DMA_BIDIRECTIONAL); | ||
1351 | if (dma_mapping_error(&dev->pdev->dev, cmd->dma)) { | ||
1352 | err = -ENOMEM; | ||
1353 | goto err_free; | ||
1354 | } | ||
1355 | 1391 | ||
1356 | cmd_l = ioread32be(&dev->iseg->cmdq_addr_l_sz) & 0xff; | 1392 | cmd_l = ioread32be(&dev->iseg->cmdq_addr_l_sz) & 0xff; |
1357 | cmd->log_sz = cmd_l >> 4 & 0xf; | 1393 | cmd->log_sz = cmd_l >> 4 & 0xf; |
@@ -1360,13 +1396,13 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) | |||
1360 | dev_err(&dev->pdev->dev, "firmware reports too many outstanding commands %d\n", | 1396 | dev_err(&dev->pdev->dev, "firmware reports too many outstanding commands %d\n", |
1361 | 1 << cmd->log_sz); | 1397 | 1 << cmd->log_sz); |
1362 | err = -EINVAL; | 1398 | err = -EINVAL; |
1363 | goto err_map; | 1399 | goto err_free_page; |
1364 | } | 1400 | } |
1365 | 1401 | ||
1366 | if (cmd->log_sz + cmd->log_stride > MLX5_ADAPTER_PAGE_SHIFT) { | 1402 | if (cmd->log_sz + cmd->log_stride > MLX5_ADAPTER_PAGE_SHIFT) { |
1367 | dev_err(&dev->pdev->dev, "command queue size overflow\n"); | 1403 | dev_err(&dev->pdev->dev, "command queue size overflow\n"); |
1368 | err = -EINVAL; | 1404 | err = -EINVAL; |
1369 | goto err_map; | 1405 | goto err_free_page; |
1370 | } | 1406 | } |
1371 | 1407 | ||
1372 | cmd->checksum_disabled = 1; | 1408 | cmd->checksum_disabled = 1; |
@@ -1378,7 +1414,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) | |||
1378 | dev_err(&dev->pdev->dev, "driver does not support command interface version. driver %d, firmware %d\n", | 1414 | dev_err(&dev->pdev->dev, "driver does not support command interface version. driver %d, firmware %d\n", |
1379 | CMD_IF_REV, cmd->cmdif_rev); | 1415 | CMD_IF_REV, cmd->cmdif_rev); |
1380 | err = -ENOTSUPP; | 1416 | err = -ENOTSUPP; |
1381 | goto err_map; | 1417 | goto err_free_page; |
1382 | } | 1418 | } |
1383 | 1419 | ||
1384 | spin_lock_init(&cmd->alloc_lock); | 1420 | spin_lock_init(&cmd->alloc_lock); |
@@ -1394,7 +1430,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) | |||
1394 | if (cmd_l & 0xfff) { | 1430 | if (cmd_l & 0xfff) { |
1395 | dev_err(&dev->pdev->dev, "invalid command queue address\n"); | 1431 | dev_err(&dev->pdev->dev, "invalid command queue address\n"); |
1396 | err = -ENOMEM; | 1432 | err = -ENOMEM; |
1397 | goto err_map; | 1433 | goto err_free_page; |
1398 | } | 1434 | } |
1399 | 1435 | ||
1400 | iowrite32be(cmd_h, &dev->iseg->cmdq_addr_h); | 1436 | iowrite32be(cmd_h, &dev->iseg->cmdq_addr_h); |
@@ -1410,7 +1446,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) | |||
1410 | err = create_msg_cache(dev); | 1446 | err = create_msg_cache(dev); |
1411 | if (err) { | 1447 | if (err) { |
1412 | dev_err(&dev->pdev->dev, "failed to create command cache\n"); | 1448 | dev_err(&dev->pdev->dev, "failed to create command cache\n"); |
1413 | goto err_map; | 1449 | goto err_free_page; |
1414 | } | 1450 | } |
1415 | 1451 | ||
1416 | set_wqname(dev); | 1452 | set_wqname(dev); |
@@ -1435,11 +1471,8 @@ err_wq: | |||
1435 | err_cache: | 1471 | err_cache: |
1436 | destroy_msg_cache(dev); | 1472 | destroy_msg_cache(dev); |
1437 | 1473 | ||
1438 | err_map: | 1474 | err_free_page: |
1439 | dma_unmap_single(&dev->pdev->dev, cmd->dma, PAGE_SIZE, | 1475 | free_cmd_page(dev, cmd); |
1440 | DMA_BIDIRECTIONAL); | ||
1441 | err_free: | ||
1442 | free_pages((unsigned long)cmd->cmd_buf, 0); | ||
1443 | 1476 | ||
1444 | err_free_pool: | 1477 | err_free_pool: |
1445 | pci_pool_destroy(cmd->pool); | 1478 | pci_pool_destroy(cmd->pool); |
@@ -1455,9 +1488,7 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) | |||
1455 | clean_debug_files(dev); | 1488 | clean_debug_files(dev); |
1456 | destroy_workqueue(cmd->wq); | 1489 | destroy_workqueue(cmd->wq); |
1457 | destroy_msg_cache(dev); | 1490 | destroy_msg_cache(dev); |
1458 | dma_unmap_single(&dev->pdev->dev, cmd->dma, PAGE_SIZE, | 1491 | free_cmd_page(dev, cmd); |
1459 | DMA_BIDIRECTIONAL); | ||
1460 | free_pages((unsigned long)cmd->cmd_buf, 0); | ||
1461 | pci_pool_destroy(cmd->pool); | 1492 | pci_pool_destroy(cmd->pool); |
1462 | } | 1493 | } |
1463 | EXPORT_SYMBOL(mlx5_cmd_cleanup); | 1494 | EXPORT_SYMBOL(mlx5_cmd_cleanup); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c index 43c5f4809526..eb0cf81f5f45 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c index 4878025e231c..5210d92e6bc7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index da82991239a8..dbf190d9b9ad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c index 06f9036acd83..4b4cda3bcc5f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 3e6670c4a7cd..292d76f2a904 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mad.c b/drivers/net/ethernet/mellanox/mlx5/core/mad.c index fd80ecfa7195..ee1b0b965f34 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mad.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mad.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 350c6297fe5d..28425e5ea91f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -48,11 +48,11 @@ | |||
48 | #include "mlx5_core.h" | 48 | #include "mlx5_core.h" |
49 | 49 | ||
50 | #define DRIVER_NAME "mlx5_core" | 50 | #define DRIVER_NAME "mlx5_core" |
51 | #define DRIVER_VERSION "2.2-1" | 51 | #define DRIVER_VERSION "3.0" |
52 | #define DRIVER_RELDATE "Feb 2014" | 52 | #define DRIVER_RELDATE "January 2015" |
53 | 53 | ||
54 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 54 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
55 | MODULE_DESCRIPTION("Mellanox ConnectX-IB HCA core library"); | 55 | MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); |
56 | MODULE_LICENSE("Dual BSD/GPL"); | 56 | MODULE_LICENSE("Dual BSD/GPL"); |
57 | MODULE_VERSION(DRIVER_VERSION); | 57 | MODULE_VERSION(DRIVER_VERSION); |
58 | 58 | ||
@@ -288,8 +288,6 @@ static void copy_rw_fields(void *to, struct mlx5_caps *from) | |||
288 | MLX5_SET(cmd_hca_cap, to, log_max_ra_req_qp, from->gen.log_max_ra_req_qp); | 288 | MLX5_SET(cmd_hca_cap, to, log_max_ra_req_qp, from->gen.log_max_ra_req_qp); |
289 | MLX5_SET(cmd_hca_cap, to, log_max_ra_res_qp, from->gen.log_max_ra_res_qp); | 289 | MLX5_SET(cmd_hca_cap, to, log_max_ra_res_qp, from->gen.log_max_ra_res_qp); |
290 | MLX5_SET(cmd_hca_cap, to, pkey_table_size, from->gen.pkey_table_size); | 290 | MLX5_SET(cmd_hca_cap, to, pkey_table_size, from->gen.pkey_table_size); |
291 | MLX5_SET(cmd_hca_cap, to, log_max_ra_req_dc, from->gen.log_max_ra_req_dc); | ||
292 | MLX5_SET(cmd_hca_cap, to, log_max_ra_res_dc, from->gen.log_max_ra_res_dc); | ||
293 | MLX5_SET(cmd_hca_cap, to, pkey_table_size, to_fw_pkey_sz(from->gen.pkey_table_size)); | 291 | MLX5_SET(cmd_hca_cap, to, pkey_table_size, to_fw_pkey_sz(from->gen.pkey_table_size)); |
294 | MLX5_SET(cmd_hca_cap, to, log_uar_page_sz, PAGE_SHIFT - 12); | 292 | MLX5_SET(cmd_hca_cap, to, log_uar_page_sz, PAGE_SHIFT - 12); |
295 | v64 = from->gen.flags & MLX5_CAP_BITS_RW_MASK; | 293 | v64 = from->gen.flags & MLX5_CAP_BITS_RW_MASK; |
@@ -509,6 +507,87 @@ static int mlx5_core_disable_hca(struct mlx5_core_dev *dev) | |||
509 | return 0; | 507 | return 0; |
510 | } | 508 | } |
511 | 509 | ||
510 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn) | ||
511 | { | ||
512 | struct mlx5_eq_table *table = &dev->priv.eq_table; | ||
513 | struct mlx5_eq *eq, *n; | ||
514 | int err = -ENOENT; | ||
515 | |||
516 | spin_lock(&table->lock); | ||
517 | list_for_each_entry_safe(eq, n, &table->comp_eqs_list, list) { | ||
518 | if (eq->index == vector) { | ||
519 | *eqn = eq->eqn; | ||
520 | *irqn = eq->irqn; | ||
521 | err = 0; | ||
522 | break; | ||
523 | } | ||
524 | } | ||
525 | spin_unlock(&table->lock); | ||
526 | |||
527 | return err; | ||
528 | } | ||
529 | EXPORT_SYMBOL(mlx5_vector2eqn); | ||
530 | |||
531 | static void free_comp_eqs(struct mlx5_core_dev *dev) | ||
532 | { | ||
533 | struct mlx5_eq_table *table = &dev->priv.eq_table; | ||
534 | struct mlx5_eq *eq, *n; | ||
535 | |||
536 | spin_lock(&table->lock); | ||
537 | list_for_each_entry_safe(eq, n, &table->comp_eqs_list, list) { | ||
538 | list_del(&eq->list); | ||
539 | spin_unlock(&table->lock); | ||
540 | if (mlx5_destroy_unmap_eq(dev, eq)) | ||
541 | mlx5_core_warn(dev, "failed to destroy EQ 0x%x\n", | ||
542 | eq->eqn); | ||
543 | kfree(eq); | ||
544 | spin_lock(&table->lock); | ||
545 | } | ||
546 | spin_unlock(&table->lock); | ||
547 | } | ||
548 | |||
549 | static int alloc_comp_eqs(struct mlx5_core_dev *dev) | ||
550 | { | ||
551 | struct mlx5_eq_table *table = &dev->priv.eq_table; | ||
552 | char name[MLX5_MAX_EQ_NAME]; | ||
553 | struct mlx5_eq *eq; | ||
554 | int ncomp_vec; | ||
555 | int nent; | ||
556 | int err; | ||
557 | int i; | ||
558 | |||
559 | INIT_LIST_HEAD(&table->comp_eqs_list); | ||
560 | ncomp_vec = table->num_comp_vectors; | ||
561 | nent = MLX5_COMP_EQ_SIZE; | ||
562 | for (i = 0; i < ncomp_vec; i++) { | ||
563 | eq = kzalloc(sizeof(*eq), GFP_KERNEL); | ||
564 | if (!eq) { | ||
565 | err = -ENOMEM; | ||
566 | goto clean; | ||
567 | } | ||
568 | |||
569 | snprintf(name, MLX5_MAX_EQ_NAME, "mlx5_comp%d", i); | ||
570 | err = mlx5_create_map_eq(dev, eq, | ||
571 | i + MLX5_EQ_VEC_COMP_BASE, nent, 0, | ||
572 | name, &dev->priv.uuari.uars[0]); | ||
573 | if (err) { | ||
574 | kfree(eq); | ||
575 | goto clean; | ||
576 | } | ||
577 | mlx5_core_dbg(dev, "allocated completion EQN %d\n", eq->eqn); | ||
578 | eq->index = i; | ||
579 | spin_lock(&table->lock); | ||
580 | list_add_tail(&eq->list, &table->comp_eqs_list); | ||
581 | spin_unlock(&table->lock); | ||
582 | } | ||
583 | |||
584 | return 0; | ||
585 | |||
586 | clean: | ||
587 | free_comp_eqs(dev); | ||
588 | return err; | ||
589 | } | ||
590 | |||
512 | static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | 591 | static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) |
513 | { | 592 | { |
514 | struct mlx5_priv *priv = &dev->priv; | 593 | struct mlx5_priv *priv = &dev->priv; |
@@ -645,6 +724,12 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | |||
645 | goto err_free_uar; | 724 | goto err_free_uar; |
646 | } | 725 | } |
647 | 726 | ||
727 | err = alloc_comp_eqs(dev); | ||
728 | if (err) { | ||
729 | dev_err(&pdev->dev, "Failed to alloc completion EQs\n"); | ||
730 | goto err_stop_eqs; | ||
731 | } | ||
732 | |||
648 | MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); | 733 | MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); |
649 | 734 | ||
650 | mlx5_init_cq_table(dev); | 735 | mlx5_init_cq_table(dev); |
@@ -654,6 +739,9 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | |||
654 | 739 | ||
655 | return 0; | 740 | return 0; |
656 | 741 | ||
742 | err_stop_eqs: | ||
743 | mlx5_stop_eqs(dev); | ||
744 | |||
657 | err_free_uar: | 745 | err_free_uar: |
658 | mlx5_free_uuars(dev, &priv->uuari); | 746 | mlx5_free_uuars(dev, &priv->uuari); |
659 | 747 | ||
@@ -705,6 +793,7 @@ static void mlx5_dev_cleanup(struct mlx5_core_dev *dev) | |||
705 | mlx5_cleanup_srq_table(dev); | 793 | mlx5_cleanup_srq_table(dev); |
706 | mlx5_cleanup_qp_table(dev); | 794 | mlx5_cleanup_qp_table(dev); |
707 | mlx5_cleanup_cq_table(dev); | 795 | mlx5_cleanup_cq_table(dev); |
796 | free_comp_eqs(dev); | ||
708 | mlx5_stop_eqs(dev); | 797 | mlx5_stop_eqs(dev); |
709 | mlx5_free_uuars(dev, &priv->uuari); | 798 | mlx5_free_uuars(dev, &priv->uuari); |
710 | mlx5_eq_cleanup(dev); | 799 | mlx5_eq_cleanup(dev); |
@@ -819,6 +908,28 @@ void mlx5_unregister_interface(struct mlx5_interface *intf) | |||
819 | } | 908 | } |
820 | EXPORT_SYMBOL(mlx5_unregister_interface); | 909 | EXPORT_SYMBOL(mlx5_unregister_interface); |
821 | 910 | ||
911 | void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol) | ||
912 | { | ||
913 | struct mlx5_priv *priv = &mdev->priv; | ||
914 | struct mlx5_device_context *dev_ctx; | ||
915 | unsigned long flags; | ||
916 | void *result = NULL; | ||
917 | |||
918 | spin_lock_irqsave(&priv->ctx_lock, flags); | ||
919 | |||
920 | list_for_each_entry(dev_ctx, &mdev->priv.ctx_list, list) | ||
921 | if ((dev_ctx->intf->protocol == protocol) && | ||
922 | dev_ctx->intf->get_dev) { | ||
923 | result = dev_ctx->intf->get_dev(dev_ctx->context); | ||
924 | break; | ||
925 | } | ||
926 | |||
927 | spin_unlock_irqrestore(&priv->ctx_lock, flags); | ||
928 | |||
929 | return result; | ||
930 | } | ||
931 | EXPORT_SYMBOL(mlx5_get_protocol_dev); | ||
932 | |||
822 | static void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, | 933 | static void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, |
823 | unsigned long param) | 934 | unsigned long param) |
824 | { | 935 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mcg.c b/drivers/net/ethernet/mellanox/mlx5/core/mcg.c index 44837640bd7c..d79fd85d1dd5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mcg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index f0c9f9a7a361..a051b906afdf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index 184c3615f479..1adb300dd850 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(mlx5_core_destroy_mkey); | |||
141 | int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, | 141 | int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, |
142 | struct mlx5_query_mkey_mbox_out *out, int outlen) | 142 | struct mlx5_query_mkey_mbox_out *out, int outlen) |
143 | { | 143 | { |
144 | struct mlx5_destroy_mkey_mbox_in in; | 144 | struct mlx5_query_mkey_mbox_in in; |
145 | int err; | 145 | int err; |
146 | 146 | ||
147 | memset(&in, 0, sizeof(in)); | 147 | memset(&in, 0, sizeof(in)); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index 4fdaae9b54d9..df2238372ea7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -243,8 +243,9 @@ static int alloc_system_page(struct mlx5_core_dev *dev, u16 func_id) | |||
243 | struct page *page; | 243 | struct page *page; |
244 | u64 addr; | 244 | u64 addr; |
245 | int err; | 245 | int err; |
246 | int nid = dev_to_node(&dev->pdev->dev); | ||
246 | 247 | ||
247 | page = alloc_page(GFP_HIGHUSER); | 248 | page = alloc_pages_node(nid, GFP_HIGHUSER, 0); |
248 | if (!page) { | 249 | if (!page) { |
249 | mlx5_core_warn(dev, "failed to allocate page\n"); | 250 | mlx5_core_warn(dev, "failed to allocate page\n"); |
250 | return -ENOMEM; | 251 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pd.c b/drivers/net/ethernet/mellanox/mlx5/core/pd.c index 790da5c4ca4f..f2d3aee909e8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c index 72c2d002c3b8..49e90f2612d8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index 575d853dbe05..dc7dbf7e9d98 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/srq.c b/drivers/net/ethernet/mellanox/mlx5/core/srq.c index 38bce93f8314..f9d25dcd03c1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/srq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/srq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 06801d6f595e..5a89bb1d678a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h index 2826a4b6071e..68cd08f02c2f 100644 --- a/include/linux/mlx5/cmd.h +++ b/include/linux/mlx5/cmd.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h index f6b17ac601bd..2695ced222df 100644 --- a/include/linux/mlx5/cq.h +++ b/include/linux/mlx5/cq.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -137,14 +137,15 @@ enum { | |||
137 | 137 | ||
138 | static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, | 138 | static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, |
139 | void __iomem *uar_page, | 139 | void __iomem *uar_page, |
140 | spinlock_t *doorbell_lock) | 140 | spinlock_t *doorbell_lock, |
141 | u32 cons_index) | ||
141 | { | 142 | { |
142 | __be32 doorbell[2]; | 143 | __be32 doorbell[2]; |
143 | u32 sn; | 144 | u32 sn; |
144 | u32 ci; | 145 | u32 ci; |
145 | 146 | ||
146 | sn = cq->arm_sn & 3; | 147 | sn = cq->arm_sn & 3; |
147 | ci = cq->cons_index & 0xffffff; | 148 | ci = cons_index & 0xffffff; |
148 | 149 | ||
149 | *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci); | 150 | *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci); |
150 | 151 | ||
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 4e5bd813bb9a..abf65c790421 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h index 163a818411e7..afc78a3f4462 100644 --- a/include/linux/mlx5/doorbell.h +++ b/include/linux/mlx5/doorbell.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 166d9315fe4b..9a90e7523dc2 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -232,6 +232,9 @@ struct mlx5_cmd_stats { | |||
232 | }; | 232 | }; |
233 | 233 | ||
234 | struct mlx5_cmd { | 234 | struct mlx5_cmd { |
235 | void *cmd_alloc_buf; | ||
236 | dma_addr_t alloc_dma; | ||
237 | int alloc_size; | ||
235 | void *cmd_buf; | 238 | void *cmd_buf; |
236 | dma_addr_t dma; | 239 | dma_addr_t dma; |
237 | u16 cmdif_rev; | 240 | u16 cmdif_rev; |
@@ -407,7 +410,7 @@ struct mlx5_core_srq { | |||
407 | struct mlx5_eq_table { | 410 | struct mlx5_eq_table { |
408 | void __iomem *update_ci; | 411 | void __iomem *update_ci; |
409 | void __iomem *update_arm_ci; | 412 | void __iomem *update_arm_ci; |
410 | struct list_head *comp_eq_head; | 413 | struct list_head comp_eqs_list; |
411 | struct mlx5_eq pages_eq; | 414 | struct mlx5_eq pages_eq; |
412 | struct mlx5_eq async_eq; | 415 | struct mlx5_eq async_eq; |
413 | struct mlx5_eq cmd_eq; | 416 | struct mlx5_eq cmd_eq; |
@@ -722,6 +725,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, | |||
722 | int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 725 | int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); |
723 | int mlx5_start_eqs(struct mlx5_core_dev *dev); | 726 | int mlx5_start_eqs(struct mlx5_core_dev *dev); |
724 | int mlx5_stop_eqs(struct mlx5_core_dev *dev); | 727 | int mlx5_stop_eqs(struct mlx5_core_dev *dev); |
728 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn); | ||
725 | int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); | 729 | int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); |
726 | int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); | 730 | int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); |
727 | 731 | ||
@@ -777,14 +781,22 @@ enum { | |||
777 | MAX_MR_CACHE_ENTRIES = 16, | 781 | MAX_MR_CACHE_ENTRIES = 16, |
778 | }; | 782 | }; |
779 | 783 | ||
784 | enum { | ||
785 | MLX5_INTERFACE_PROTOCOL_IB = 0, | ||
786 | MLX5_INTERFACE_PROTOCOL_ETH = 1, | ||
787 | }; | ||
788 | |||
780 | struct mlx5_interface { | 789 | struct mlx5_interface { |
781 | void * (*add)(struct mlx5_core_dev *dev); | 790 | void * (*add)(struct mlx5_core_dev *dev); |
782 | void (*remove)(struct mlx5_core_dev *dev, void *context); | 791 | void (*remove)(struct mlx5_core_dev *dev, void *context); |
783 | void (*event)(struct mlx5_core_dev *dev, void *context, | 792 | void (*event)(struct mlx5_core_dev *dev, void *context, |
784 | enum mlx5_dev_event event, unsigned long param); | 793 | enum mlx5_dev_event event, unsigned long param); |
794 | void * (*get_dev)(void *context); | ||
795 | int protocol; | ||
785 | struct list_head list; | 796 | struct list_head list; |
786 | }; | 797 | }; |
787 | 798 | ||
799 | void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol); | ||
788 | int mlx5_register_interface(struct mlx5_interface *intf); | 800 | int mlx5_register_interface(struct mlx5_interface *intf); |
789 | void mlx5_unregister_interface(struct mlx5_interface *intf); | 801 | void mlx5_unregister_interface(struct mlx5_interface *intf); |
790 | 802 | ||
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 5f48b8f592c5..cb3ad17edd1f 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index 61f7a342d1bf..310b5f7fd6ae 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h index e1a363a33663..f43ed054a3e0 100644 --- a/include/linux/mlx5/srq.h +++ b/include/linux/mlx5/srq.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |