aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/cm.c26
-rw-r--r--drivers/infiniband/core/cma.c10
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c17
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c1
-rw-r--r--drivers/net/mlx4/mr.c21
9 files changed, 51 insertions, 30 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 638b727d42e0..b10ade92efed 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3587,8 +3587,6 @@ static void cm_release_port_obj(struct kobject *obj)
3587{ 3587{
3588 struct cm_port *cm_port; 3588 struct cm_port *cm_port;
3589 3589
3590 printk(KERN_ERR "free cm port\n");
3591
3592 cm_port = container_of(obj, struct cm_port, port_obj); 3590 cm_port = container_of(obj, struct cm_port, port_obj);
3593 kfree(cm_port); 3591 kfree(cm_port);
3594} 3592}
@@ -3601,8 +3599,6 @@ static void cm_release_dev_obj(struct kobject *obj)
3601{ 3599{
3602 struct cm_device *cm_dev; 3600 struct cm_device *cm_dev;
3603 3601
3604 printk(KERN_ERR "free cm dev\n");
3605
3606 cm_dev = container_of(obj, struct cm_device, dev_obj); 3602 cm_dev = container_of(obj, struct cm_device, dev_obj);
3607 kfree(cm_dev); 3603 kfree(cm_dev);
3608} 3604}
@@ -3616,18 +3612,12 @@ struct class cm_class = {
3616}; 3612};
3617EXPORT_SYMBOL(cm_class); 3613EXPORT_SYMBOL(cm_class);
3618 3614
3619static void cm_remove_fs_obj(struct kobject *obj)
3620{
3621 kobject_put(obj->parent);
3622 kobject_put(obj);
3623}
3624
3625static int cm_create_port_fs(struct cm_port *port) 3615static int cm_create_port_fs(struct cm_port *port)
3626{ 3616{
3627 int i, ret; 3617 int i, ret;
3628 3618
3629 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, 3619 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type,
3630 kobject_get(&port->cm_dev->dev_obj), 3620 &port->cm_dev->dev_obj,
3631 "%d", port->port_num); 3621 "%d", port->port_num);
3632 if (ret) { 3622 if (ret) {
3633 kfree(port); 3623 kfree(port);
@@ -3637,7 +3627,7 @@ static int cm_create_port_fs(struct cm_port *port)
3637 for (i = 0; i < CM_COUNTER_GROUPS; i++) { 3627 for (i = 0; i < CM_COUNTER_GROUPS; i++) {
3638 ret = kobject_init_and_add(&port->counter_group[i].obj, 3628 ret = kobject_init_and_add(&port->counter_group[i].obj,
3639 &cm_counter_obj_type, 3629 &cm_counter_obj_type,
3640 kobject_get(&port->port_obj), 3630 &port->port_obj,
3641 "%s", counter_group_names[i]); 3631 "%s", counter_group_names[i]);
3642 if (ret) 3632 if (ret)
3643 goto error; 3633 goto error;
@@ -3647,8 +3637,8 @@ static int cm_create_port_fs(struct cm_port *port)
3647 3637
3648error: 3638error:
3649 while (i--) 3639 while (i--)
3650 cm_remove_fs_obj(&port->counter_group[i].obj); 3640 kobject_put(&port->counter_group[i].obj);
3651 cm_remove_fs_obj(&port->port_obj); 3641 kobject_put(&port->port_obj);
3652 return ret; 3642 return ret;
3653 3643
3654} 3644}
@@ -3658,9 +3648,9 @@ static void cm_remove_port_fs(struct cm_port *port)
3658 int i; 3648 int i;
3659 3649
3660 for (i = 0; i < CM_COUNTER_GROUPS; i++) 3650 for (i = 0; i < CM_COUNTER_GROUPS; i++)
3661 cm_remove_fs_obj(&port->counter_group[i].obj); 3651 kobject_put(&port->counter_group[i].obj);
3662 3652
3663 cm_remove_fs_obj(&port->port_obj); 3653 kobject_put(&port->port_obj);
3664} 3654}
3665 3655
3666static void cm_add_one(struct ib_device *device) 3656static void cm_add_one(struct ib_device *device)
@@ -3744,7 +3734,7 @@ error1:
3744 ib_unregister_mad_agent(port->mad_agent); 3734 ib_unregister_mad_agent(port->mad_agent);
3745 cm_remove_port_fs(port); 3735 cm_remove_port_fs(port);
3746 } 3736 }
3747 cm_remove_fs_obj(&cm_dev->dev_obj); 3737 kobject_put(&cm_dev->dev_obj);
3748} 3738}
3749 3739
3750static void cm_remove_one(struct ib_device *device) 3740static void cm_remove_one(struct ib_device *device)
@@ -3771,7 +3761,7 @@ static void cm_remove_one(struct ib_device *device)
3771 ib_unregister_mad_agent(port->mad_agent); 3761 ib_unregister_mad_agent(port->mad_agent);
3772 cm_remove_port_fs(port); 3762 cm_remove_port_fs(port);
3773 } 3763 }
3774 cm_remove_fs_obj(&cm_dev->dev_obj); 3764 kobject_put(&cm_dev->dev_obj);
3775} 3765}
3776 3766
3777static int __init ib_cm_init(void) 3767static int __init ib_cm_init(void)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 1eff1b2c0e08..34507daaf9b6 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1107,7 +1107,6 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1107 event.param.ud.private_data_len = 1107 event.param.ud.private_data_len =
1108 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset; 1108 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset;
1109 } else { 1109 } else {
1110 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
1111 conn_id = cma_new_conn_id(&listen_id->id, ib_event); 1110 conn_id = cma_new_conn_id(&listen_id->id, ib_event);
1112 cma_set_req_event_data(&event, &ib_event->param.req_rcvd, 1111 cma_set_req_event_data(&event, &ib_event->param.req_rcvd,
1113 ib_event->private_data, offset); 1112 ib_event->private_data, offset);
@@ -1130,6 +1129,15 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1130 1129
1131 ret = conn_id->id.event_handler(&conn_id->id, &event); 1130 ret = conn_id->id.event_handler(&conn_id->id, &event);
1132 if (!ret) { 1131 if (!ret) {
1132 /*
1133 * Acquire mutex to prevent user executing rdma_destroy_id()
1134 * while we're accessing the cm_id.
1135 */
1136 mutex_lock(&lock);
1137 if (cma_comp(conn_id, CMA_CONNECT) &&
1138 !cma_is_ud_ps(conn_id->id.ps))
1139 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
1140 mutex_unlock(&lock);
1133 cma_enable_remove(conn_id); 1141 cma_enable_remove(conn_id);
1134 goto out; 1142 goto out;
1135 } 1143 }
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa3dffe..320f2b6ddee6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <linux/timer.h> 36#include <linux/timer.h>
37#include <linux/notifier.h> 37#include <linux/notifier.h>
38#include <linux/inetdevice.h>
38 39
39#include <net/neighbour.h> 40#include <net/neighbour.h>
40#include <net/netevent.h> 41#include <net/netevent.h>
@@ -1784,6 +1785,17 @@ err:
1784 return err; 1785 return err;
1785} 1786}
1786 1787
1788static int is_loopback_dst(struct iw_cm_id *cm_id)
1789{
1790 struct net_device *dev;
1791
1792 dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr);
1793 if (!dev)
1794 return 0;
1795 dev_put(dev);
1796 return 1;
1797}
1798
1787int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) 1799int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1788{ 1800{
1789 int err = 0; 1801 int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1791 struct iwch_ep *ep; 1803 struct iwch_ep *ep;
1792 struct rtable *rt; 1804 struct rtable *rt;
1793 1805
1806 if (is_loopback_dst(cm_id)) {
1807 err = -ENOSYS;
1808 goto out;
1809 }
1810
1794 ep = alloc_ep(sizeof(*ep), GFP_KERNEL); 1811 ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
1795 if (!ep) { 1812 if (!ep) {
1796 printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__); 1813 printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__);
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 7dc91a3e712d..fe2c2e94a5f8 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -199,7 +199,7 @@ struct ib_fmr *mlx4_ib_fmr_alloc(struct ib_pd *pd, int acc,
199 if (err) 199 if (err)
200 goto err_free; 200 goto err_free;
201 201
202 err = mlx4_mr_enable(to_mdev(pd->device)->dev, &fmr->mfmr.mr); 202 err = mlx4_fmr_enable(to_mdev(pd->device)->dev, &fmr->mfmr);
203 if (err) 203 if (err)
204 goto err_mr; 204 goto err_mr;
205 205
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 6bd9f1393349..1e1e336d3ef9 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -473,7 +473,7 @@ static void handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
473 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 473 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
474 return; 474 return;
475 475
476 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); 476 be16_add_cpu(&cqe->db_cnt, -dbd);
477 cqe->wqe = new_wqe; 477 cqe->wqe = new_wqe;
478 cqe->syndrome = SYNDROME_WR_FLUSH_ERR; 478 cqe->syndrome = SYNDROME_WR_FLUSH_ERR;
479 479
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 1f4d27d7c16d..252db0822f6c 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -542,6 +542,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev)
542 for (i = 0; i < npages; ++i) { 542 for (i = 0; i < npages; ++i) {
543 db_tab->page[i].refcount = 0; 543 db_tab->page[i].refcount = 0;
544 db_tab->page[i].uvirt = 0; 544 db_tab->page[i].uvirt = 0;
545 sg_init_table(&db_tab->page[i].mem, 1);
545 } 546 }
546 547
547 return db_tab; 548 return db_tab;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index f9b7caa54143..054fab8e27a0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -209,7 +209,6 @@ struct ipoib_cm_tx {
209 unsigned tx_tail; 209 unsigned tx_tail;
210 unsigned long flags; 210 unsigned long flags;
211 u32 mtu; 211 u32 mtu;
212 struct ib_wc ibwc[IPOIB_NUM_WC];
213}; 212};
214 213
215struct ipoib_cm_rx_buf { 214struct ipoib_cm_rx_buf {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 9d3e778dc56d..08c4396cf418 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -780,6 +780,7 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, int pkey_event)
780 if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { 780 if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) {
781 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); 781 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
782 ipoib_ib_dev_down(dev, 0); 782 ipoib_ib_dev_down(dev, 0);
783 ipoib_ib_dev_stop(dev, 0);
783 ipoib_pkey_dev_delay_open(dev); 784 ipoib_pkey_dev_delay_open(dev);
784 return; 785 return;
785 } 786 }
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index 679dfdb6807f..79b317b88c86 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -578,13 +578,6 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
578 goto err_free; 578 goto err_free;
579 } 579 }
580 580
581 fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
582 key_to_hw_index(fmr->mr.key), NULL);
583 if (!fmr->mpt) {
584 err = -ENOMEM;
585 goto err_free;
586 }
587
588 return 0; 581 return 0;
589 582
590err_free: 583err_free:
@@ -595,7 +588,19 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
595 588
596int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 589int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
597{ 590{
598 return mlx4_mr_enable(dev, &fmr->mr); 591 struct mlx4_priv *priv = mlx4_priv(dev);
592 int err;
593
594 err = mlx4_mr_enable(dev, &fmr->mr);
595 if (err)
596 return err;
597
598 fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
599 key_to_hw_index(fmr->mr.key), NULL);
600 if (!fmr->mpt)
601 return -ENOMEM;
602
603 return 0;
599} 604}
600EXPORT_SYMBOL_GPL(mlx4_fmr_enable); 605EXPORT_SYMBOL_GPL(mlx4_fmr_enable);
601 606