aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@dev.mellanox.co.il>2007-05-03 06:48:47 -0400
committerRoland Dreier <rolandd@cisco.com>2007-05-07 00:18:11 -0400
commitf4fd0b224d60044d2da5ca02f8f2b5150c1d8731 (patch)
tree9bc6c08bde26e6b7d5c51ebd48fc26357d6ae9c5 /drivers/infiniband
parent154257f3626ea6dd96781fac0896c3f27fe2b0a1 (diff)
IB: Add CQ comp_vector support
Add a num_comp_vectors member to struct ib_device and extend ib_create_cq() to pass in a comp_vector parameter -- this parallels the userspace libibverbs API. Update all hardware drivers to set num_comp_vectors to 1 and have all ULPs pass 0 for the comp_vector value. Pass the value of num_comp_vectors to userspace rather than hard-coding a value of 1. We want multiple CQ event vector support (via MSI-X or similar for adapters that can generate multiple interrupts), but it's not clear how many vectors we want, or how we want to deal with policy issues such as how to decide which vector to use or how to set up interrupt affinity. This patch is useful for experimenting, since no core changes will be necessary when updating a driver to support multiple vectors, and we know that we want to make at least these changes anyway. Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/mad.c2
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c1
-rw-r--r--drivers/infiniband/core/uverbs_main.c2
-rw-r--r--drivers/infiniband/core/verbs.c4
-rw-r--r--drivers/infiniband/hw/amso1100/c2_provider.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_iverbs.h2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_cq.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c2
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c2
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c2
17 files changed, 22 insertions, 15 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 6edfecf1be72..85ccf13b8041 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2771,7 +2771,7 @@ static int ib_mad_port_open(struct ib_device *device,
2771 cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2; 2771 cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2;
2772 port_priv->cq = ib_create_cq(port_priv->device, 2772 port_priv->cq = ib_create_cq(port_priv->device,
2773 ib_mad_thread_completion_handler, 2773 ib_mad_thread_completion_handler,
2774 NULL, port_priv, cq_size); 2774 NULL, port_priv, cq_size, 0);
2775 if (IS_ERR(port_priv->cq)) { 2775 if (IS_ERR(port_priv->cq)) {
2776 printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n"); 2776 printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n");
2777 ret = PTR_ERR(port_priv->cq); 2777 ret = PTR_ERR(port_priv->cq);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4fd75afa6a3a..bab66769be14 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -802,6 +802,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
802 INIT_LIST_HEAD(&obj->async_list); 802 INIT_LIST_HEAD(&obj->async_list);
803 803
804 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe, 804 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe,
805 cmd.comp_vector,
805 file->ucontext, &udata); 806 file->ucontext, &udata);
806 if (IS_ERR(cq)) { 807 if (IS_ERR(cq)) {
807 ret = PTR_ERR(cq); 808 ret = PTR_ERR(cq);
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index f8bc822a3cc3..d44e54799651 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -752,7 +752,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
752 spin_unlock(&map_lock); 752 spin_unlock(&map_lock);
753 753
754 uverbs_dev->ib_dev = device; 754 uverbs_dev->ib_dev = device;
755 uverbs_dev->num_comp_vectors = 1; 755 uverbs_dev->num_comp_vectors = device->num_comp_vectors;
756 756
757 uverbs_dev->dev = cdev_alloc(); 757 uverbs_dev->dev = cdev_alloc();
758 if (!uverbs_dev->dev) 758 if (!uverbs_dev->dev)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index ccdf93d30b01..86ed8af9c7e6 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -609,11 +609,11 @@ EXPORT_SYMBOL(ib_destroy_qp);
609struct ib_cq *ib_create_cq(struct ib_device *device, 609struct ib_cq *ib_create_cq(struct ib_device *device,
610 ib_comp_handler comp_handler, 610 ib_comp_handler comp_handler,
611 void (*event_handler)(struct ib_event *, void *), 611 void (*event_handler)(struct ib_event *, void *),
612 void *cq_context, int cqe) 612 void *cq_context, int cqe, int comp_vector)
613{ 613{
614 struct ib_cq *cq; 614 struct ib_cq *cq;
615 615
616 cq = device->create_cq(device, cqe, NULL, NULL); 616 cq = device->create_cq(device, cqe, comp_vector, NULL, NULL);
617 617
618 if (!IS_ERR(cq)) { 618 if (!IS_ERR(cq)) {
619 cq->device = device; 619 cq->device = device;
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index 607c09bf764c..109166223c09 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -290,7 +290,7 @@ static int c2_destroy_qp(struct ib_qp *ib_qp)
290 return 0; 290 return 0;
291} 291}
292 292
293static struct ib_cq *c2_create_cq(struct ib_device *ibdev, int entries, 293static struct ib_cq *c2_create_cq(struct ib_device *ibdev, int entries, int vector,
294 struct ib_ucontext *context, 294 struct ib_ucontext *context,
295 struct ib_udata *udata) 295 struct ib_udata *udata)
296{ 296{
@@ -795,6 +795,7 @@ int c2_register_device(struct c2_dev *dev)
795 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid)); 795 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
796 memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6); 796 memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6);
797 dev->ibdev.phys_port_cnt = 1; 797 dev->ibdev.phys_port_cnt = 1;
798 dev->ibdev.num_comp_vectors = 1;
798 dev->ibdev.dma_device = &dev->pcidev->dev; 799 dev->ibdev.dma_device = &dev->pcidev->dev;
799 dev->ibdev.query_device = c2_query_device; 800 dev->ibdev.query_device = c2_query_device;
800 dev->ibdev.query_port = c2_query_port; 801 dev->ibdev.query_port = c2_query_port;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 93038c007133..78a495f5332e 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -139,7 +139,7 @@ static int iwch_destroy_cq(struct ib_cq *ib_cq)
139 return 0; 139 return 0;
140} 140}
141 141
142static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, 142static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int vector,
143 struct ib_ucontext *ib_context, 143 struct ib_ucontext *ib_context,
144 struct ib_udata *udata) 144 struct ib_udata *udata)
145{ 145{
@@ -1110,6 +1110,7 @@ int iwch_register_device(struct iwch_dev *dev)
1110 dev->ibdev.node_type = RDMA_NODE_RNIC; 1110 dev->ibdev.node_type = RDMA_NODE_RNIC;
1111 memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC)); 1111 memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC));
1112 dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports; 1112 dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports;
1113 dev->ibdev.num_comp_vectors = 1;
1113 dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev); 1114 dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
1114 dev->ibdev.query_device = iwch_query_device; 1115 dev->ibdev.query_device = iwch_query_device;
1115 dev->ibdev.query_port = iwch_query_port; 1116 dev->ibdev.query_port = iwch_query_port;
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index e2cdc1a16fe9..67f0670fe3b1 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -113,7 +113,7 @@ struct ehca_qp* ehca_cq_get_qp(struct ehca_cq *cq, int real_qp_num)
113 return ret; 113 return ret;
114} 114}
115 115
116struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, 116struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
117 struct ib_ucontext *context, 117 struct ib_ucontext *context,
118 struct ib_udata *udata) 118 struct ib_udata *udata)
119{ 119{
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index 95fd59fb4528..aff96ac4fd12 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -123,7 +123,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
123void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq); 123void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
124 124
125 125
126struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, 126struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
127 struct ib_ucontext *context, 127 struct ib_ucontext *context,
128 struct ib_udata *udata); 128 struct ib_udata *udata);
129 129
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 3b23d677cb86..77bb36bba0d8 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -313,6 +313,7 @@ int ehca_init_device(struct ehca_shca *shca)
313 313
314 shca->ib_device.node_type = RDMA_NODE_IB_CA; 314 shca->ib_device.node_type = RDMA_NODE_IB_CA;
315 shca->ib_device.phys_port_cnt = shca->num_ports; 315 shca->ib_device.phys_port_cnt = shca->num_ports;
316 shca->ib_device.num_comp_vectors = 1;
316 shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; 317 shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev;
317 shca->ib_device.query_device = ehca_query_device; 318 shca->ib_device.query_device = ehca_query_device;
318 shca->ib_device.query_port = ehca_query_port; 319 shca->ib_device.query_port = ehca_query_port;
@@ -375,7 +376,7 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
375 return -EPERM; 376 return -EPERM;
376 } 377 }
377 378
378 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void*)(-1), 10); 379 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void*)(-1), 10, 0);
379 if (IS_ERR(ibcq)) { 380 if (IS_ERR(ibcq)) {
380 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ."); 381 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ.");
381 return PTR_ERR(ibcq); 382 return PTR_ERR(ibcq);
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c
index 4715f89528cd..00d3eb9bc696 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -204,7 +204,7 @@ static void send_complete(unsigned long data)
204 * 204 *
205 * Called by ib_create_cq() in the generic verbs code. 205 * Called by ib_create_cq() in the generic verbs code.
206 */ 206 */
207struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, 207struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
208 struct ib_ucontext *context, 208 struct ib_ucontext *context,
209 struct ib_udata *udata) 209 struct ib_udata *udata)
210{ 210{
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index b676ea81fc41..12933e77c7e9 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1561,6 +1561,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
1561 (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); 1561 (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
1562 dev->node_type = RDMA_NODE_IB_CA; 1562 dev->node_type = RDMA_NODE_IB_CA;
1563 dev->phys_port_cnt = 1; 1563 dev->phys_port_cnt = 1;
1564 dev->num_comp_vectors = 1;
1564 dev->dma_device = &dd->pcidev->dev; 1565 dev->dma_device = &dd->pcidev->dev;
1565 dev->query_device = ipath_query_device; 1566 dev->query_device = ipath_query_device;
1566 dev->modify_device = ipath_modify_device; 1567 dev->modify_device = ipath_modify_device;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index ac66c00a2976..2d734fb6eff7 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -735,7 +735,7 @@ int ipath_destroy_srq(struct ib_srq *ibsrq);
735 735
736int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry); 736int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
737 737
738struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, 738struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
739 struct ib_ucontext *context, 739 struct ib_ucontext *context,
740 struct ib_udata *udata); 740 struct ib_udata *udata);
741 741
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 47e6fd46d9c2..1c05486c3c68 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -663,6 +663,7 @@ static int mthca_destroy_qp(struct ib_qp *qp)
663} 663}
664 664
665static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries, 665static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
666 int comp_vector,
666 struct ib_ucontext *context, 667 struct ib_ucontext *context,
667 struct ib_udata *udata) 668 struct ib_udata *udata)
668{ 669{
@@ -1292,6 +1293,7 @@ int mthca_register_device(struct mthca_dev *dev)
1292 (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); 1293 (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
1293 dev->ib_dev.node_type = RDMA_NODE_IB_CA; 1294 dev->ib_dev.node_type = RDMA_NODE_IB_CA;
1294 dev->ib_dev.phys_port_cnt = dev->limits.num_ports; 1295 dev->ib_dev.phys_port_cnt = dev->limits.num_ports;
1296 dev->ib_dev.num_comp_vectors = 1;
1295 dev->ib_dev.dma_device = &dev->pdev->dev; 1297 dev->ib_dev.dma_device = &dev->pdev->dev;
1296 dev->ib_dev.query_device = mthca_query_device; 1298 dev->ib_dev.query_device = mthca_query_device;
1297 dev->ib_dev.query_port = mthca_query_port; 1299 dev->ib_dev.query_port = mthca_query_port;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 1e27930077e6..b8089a041581 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -793,7 +793,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
793 } 793 }
794 794
795 p->cq = ib_create_cq(priv->ca, ipoib_cm_tx_completion, NULL, p, 795 p->cq = ib_create_cq(priv->ca, ipoib_cm_tx_completion, NULL, p,
796 ipoib_sendq_size + 1); 796 ipoib_sendq_size + 1, 0);
797 if (IS_ERR(p->cq)) { 797 if (IS_ERR(p->cq)) {
798 ret = PTR_ERR(p->cq); 798 ret = PTR_ERR(p->cq);
799 ipoib_warn(priv, "failed to allocate tx cq: %d\n", ret); 799 ipoib_warn(priv, "failed to allocate tx cq: %d\n", ret);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 7f3ec205e35f..5c3c6a43a52b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -187,7 +187,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
187 if (!ret) 187 if (!ret)
188 size += ipoib_recvq_size; 188 size += ipoib_recvq_size;
189 189
190 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size); 190 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size, 0);
191 if (IS_ERR(priv->cq)) { 191 if (IS_ERR(priv->cq)) {
192 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name); 192 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name);
193 goto out_free_mr; 193 goto out_free_mr;
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 1fc967464a28..89d6008bb673 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -76,7 +76,7 @@ static int iser_create_device_ib_res(struct iser_device *device)
76 iser_cq_callback, 76 iser_cq_callback,
77 iser_cq_event_callback, 77 iser_cq_event_callback,
78 (void *)device, 78 (void *)device,
79 ISER_MAX_CQ_LEN); 79 ISER_MAX_CQ_LEN, 0);
80 if (IS_ERR(device->cq)) 80 if (IS_ERR(device->cq))
81 goto cq_err; 81 goto cq_err;
82 82
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 3468ae1ad1af..39bf057fbc43 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -197,7 +197,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
197 return -ENOMEM; 197 return -ENOMEM;
198 198
199 target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion, 199 target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion,
200 NULL, target, SRP_CQ_SIZE); 200 NULL, target, SRP_CQ_SIZE, 0);
201 if (IS_ERR(target->cq)) { 201 if (IS_ERR(target->cq)) {
202 ret = PTR_ERR(target->cq); 202 ret = PTR_ERR(target->cq);
203 goto out; 203 goto out;