aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c99
-rw-r--r--drivers/infiniband/core/iwcm.c3
-rw-r--r--drivers/infiniband/core/sa_query.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h1
-rw-r--r--drivers/infiniband/hw/ehca/ehca_hca.c4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c2
-rw-r--r--drivers/infiniband/hw/ehca/ipz_pt_fn.c1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c26
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c1
12 files changed, 133 insertions, 14 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index ae11d5cc74d0..e980ff3335db 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -168,6 +168,12 @@ struct cma_work {
168 struct rdma_cm_event event; 168 struct rdma_cm_event event;
169}; 169};
170 170
171struct cma_ndev_work {
172 struct work_struct work;
173 struct rdma_id_private *id;
174 struct rdma_cm_event event;
175};
176
171union cma_ip_addr { 177union cma_ip_addr {
172 struct in6_addr ip6; 178 struct in6_addr ip6;
173 struct { 179 struct {
@@ -914,7 +920,10 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
914 struct rdma_cm_event event; 920 struct rdma_cm_event event;
915 int ret = 0; 921 int ret = 0;
916 922
917 if (cma_disable_callback(id_priv, CMA_CONNECT)) 923 if ((ib_event->event != IB_CM_TIMEWAIT_EXIT &&
924 cma_disable_callback(id_priv, CMA_CONNECT)) ||
925 (ib_event->event == IB_CM_TIMEWAIT_EXIT &&
926 cma_disable_callback(id_priv, CMA_DISCONNECT)))
918 return 0; 927 return 0;
919 928
920 memset(&event, 0, sizeof event); 929 memset(&event, 0, sizeof event);
@@ -950,6 +959,8 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
950 event.event = RDMA_CM_EVENT_DISCONNECTED; 959 event.event = RDMA_CM_EVENT_DISCONNECTED;
951 break; 960 break;
952 case IB_CM_TIMEWAIT_EXIT: 961 case IB_CM_TIMEWAIT_EXIT:
962 event.event = RDMA_CM_EVENT_TIMEWAIT_EXIT;
963 break;
953 case IB_CM_MRA_RECEIVED: 964 case IB_CM_MRA_RECEIVED:
954 /* ignore event */ 965 /* ignore event */
955 goto out; 966 goto out;
@@ -1598,6 +1609,30 @@ out:
1598 kfree(work); 1609 kfree(work);
1599} 1610}
1600 1611
1612static void cma_ndev_work_handler(struct work_struct *_work)
1613{
1614 struct cma_ndev_work *work = container_of(_work, struct cma_ndev_work, work);
1615 struct rdma_id_private *id_priv = work->id;
1616 int destroy = 0;
1617
1618 mutex_lock(&id_priv->handler_mutex);
1619 if (id_priv->state == CMA_DESTROYING ||
1620 id_priv->state == CMA_DEVICE_REMOVAL)
1621 goto out;
1622
1623 if (id_priv->id.event_handler(&id_priv->id, &work->event)) {
1624 cma_exch(id_priv, CMA_DESTROYING);
1625 destroy = 1;
1626 }
1627
1628out:
1629 mutex_unlock(&id_priv->handler_mutex);
1630 cma_deref_id(id_priv);
1631 if (destroy)
1632 rdma_destroy_id(&id_priv->id);
1633 kfree(work);
1634}
1635
1601static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms) 1636static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
1602{ 1637{
1603 struct rdma_route *route = &id_priv->id.route; 1638 struct rdma_route *route = &id_priv->id.route;
@@ -2723,6 +2758,65 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
2723} 2758}
2724EXPORT_SYMBOL(rdma_leave_multicast); 2759EXPORT_SYMBOL(rdma_leave_multicast);
2725 2760
2761static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private *id_priv)
2762{
2763 struct rdma_dev_addr *dev_addr;
2764 struct cma_ndev_work *work;
2765
2766 dev_addr = &id_priv->id.route.addr.dev_addr;
2767
2768 if ((dev_addr->src_dev == ndev) &&
2769 memcmp(dev_addr->src_dev_addr, ndev->dev_addr, ndev->addr_len)) {
2770 printk(KERN_INFO "RDMA CM addr change for ndev %s used by id %p\n",
2771 ndev->name, &id_priv->id);
2772 work = kzalloc(sizeof *work, GFP_KERNEL);
2773 if (!work)
2774 return -ENOMEM;
2775
2776 INIT_WORK(&work->work, cma_ndev_work_handler);
2777 work->id = id_priv;
2778 work->event.event = RDMA_CM_EVENT_ADDR_CHANGE;
2779 atomic_inc(&id_priv->refcount);
2780 queue_work(cma_wq, &work->work);
2781 }
2782
2783 return 0;
2784}
2785
2786static int cma_netdev_callback(struct notifier_block *self, unsigned long event,
2787 void *ctx)
2788{
2789 struct net_device *ndev = (struct net_device *)ctx;
2790 struct cma_device *cma_dev;
2791 struct rdma_id_private *id_priv;
2792 int ret = NOTIFY_DONE;
2793
2794 if (dev_net(ndev) != &init_net)
2795 return NOTIFY_DONE;
2796
2797 if (event != NETDEV_BONDING_FAILOVER)
2798 return NOTIFY_DONE;
2799
2800 if (!(ndev->flags & IFF_MASTER) || !(ndev->priv_flags & IFF_BONDING))
2801 return NOTIFY_DONE;
2802
2803 mutex_lock(&lock);
2804 list_for_each_entry(cma_dev, &dev_list, list)
2805 list_for_each_entry(id_priv, &cma_dev->id_list, list) {
2806 ret = cma_netdev_change(ndev, id_priv);
2807 if (ret)
2808 goto out;
2809 }
2810
2811out:
2812 mutex_unlock(&lock);
2813 return ret;
2814}
2815
2816static struct notifier_block cma_nb = {
2817 .notifier_call = cma_netdev_callback
2818};
2819
2726static void cma_add_one(struct ib_device *device) 2820static void cma_add_one(struct ib_device *device)
2727{ 2821{
2728 struct cma_device *cma_dev; 2822 struct cma_device *cma_dev;
@@ -2831,6 +2925,7 @@ static int cma_init(void)
2831 2925
2832 ib_sa_register_client(&sa_client); 2926 ib_sa_register_client(&sa_client);
2833 rdma_addr_register_client(&addr_client); 2927 rdma_addr_register_client(&addr_client);
2928 register_netdevice_notifier(&cma_nb);
2834 2929
2835 ret = ib_register_client(&cma_client); 2930 ret = ib_register_client(&cma_client);
2836 if (ret) 2931 if (ret)
@@ -2838,6 +2933,7 @@ static int cma_init(void)
2838 return 0; 2933 return 0;
2839 2934
2840err: 2935err:
2936 unregister_netdevice_notifier(&cma_nb);
2841 rdma_addr_unregister_client(&addr_client); 2937 rdma_addr_unregister_client(&addr_client);
2842 ib_sa_unregister_client(&sa_client); 2938 ib_sa_unregister_client(&sa_client);
2843 destroy_workqueue(cma_wq); 2939 destroy_workqueue(cma_wq);
@@ -2847,6 +2943,7 @@ err:
2847static void cma_cleanup(void) 2943static void cma_cleanup(void)
2848{ 2944{
2849 ib_unregister_client(&cma_client); 2945 ib_unregister_client(&cma_client);
2946 unregister_netdevice_notifier(&cma_nb);
2850 rdma_addr_unregister_client(&addr_client); 2947 rdma_addr_unregister_client(&addr_client);
2851 ib_sa_unregister_client(&sa_client); 2948 ib_sa_unregister_client(&sa_client);
2852 destroy_workqueue(cma_wq); 2949 destroy_workqueue(cma_wq);
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 81c9195b512a..8f9509e1ebf7 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -942,8 +942,7 @@ static int iwcm_init_qp_init_attr(struct iwcm_id_private *cm_id_priv,
942 case IW_CM_STATE_CONN_RECV: 942 case IW_CM_STATE_CONN_RECV:
943 case IW_CM_STATE_ESTABLISHED: 943 case IW_CM_STATE_ESTABLISHED:
944 *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS; 944 *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS;
945 qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | 945 qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE|
946 IB_ACCESS_REMOTE_WRITE|
947 IB_ACCESS_REMOTE_READ; 946 IB_ACCESS_REMOTE_READ;
948 ret = 0; 947 ret = 0;
949 break; 948 break;
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 1341de793e51..7863a50d56f2 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1064,7 +1064,8 @@ static void ib_sa_remove_one(struct ib_device *device)
1064 1064
1065 for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { 1065 for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
1066 ib_unregister_mad_agent(sa_dev->port[i].agent); 1066 ib_unregister_mad_agent(sa_dev->port[i].agent);
1067 kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah); 1067 if (sa_dev->port[i].sm_ah)
1068 kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
1068 } 1069 }
1069 1070
1070 kfree(sa_dev); 1071 kfree(sa_dev);
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 1e9e99a13933..0b0618edd645 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -194,6 +194,7 @@ struct ehca_qp {
194 u32 packet_count; 194 u32 packet_count;
195 atomic_t nr_events; /* events seen */ 195 atomic_t nr_events; /* events seen */
196 wait_queue_head_t wait_completion; 196 wait_queue_head_t wait_completion;
197 int mig_armed;
197}; 198};
198 199
199#define IS_SRQ(qp) (qp->ext_type == EQPT_SRQ) 200#define IS_SRQ(qp) (qp->ext_type == EQPT_SRQ)
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
index bc3b37d2070f..46288220cfbb 100644
--- a/drivers/infiniband/hw/ehca/ehca_hca.c
+++ b/drivers/infiniband/hw/ehca/ehca_hca.c
@@ -114,7 +114,9 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
114 } 114 }
115 115
116 props->max_pkeys = 16; 116 props->max_pkeys = 16;
117 props->local_ca_ack_delay = min_t(u8, rblock->local_ca_ack_delay, 255); 117 /* Some FW versions say 0 here; insert sensible value in that case */
118 props->local_ca_ack_delay = rblock->local_ca_ack_delay ?
119 min_t(u8, rblock->local_ca_ack_delay, 255) : 12;
118 props->max_raw_ipv6_qp = limit_uint(rblock->max_raw_ipv6_qp); 120 props->max_raw_ipv6_qp = limit_uint(rblock->max_raw_ipv6_qp);
119 props->max_raw_ethy_qp = limit_uint(rblock->max_raw_ethy_qp); 121 props->max_raw_ethy_qp = limit_uint(rblock->max_raw_ethy_qp);
120 props->max_mcast_grp = limit_uint(rblock->max_mcast_grp); 122 props->max_mcast_grp = limit_uint(rblock->max_mcast_grp);
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 0792d930c481..99642a6e17c4 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -178,6 +178,10 @@ static void dispatch_qp_event(struct ehca_shca *shca, struct ehca_qp *qp,
178{ 178{
179 struct ib_event event; 179 struct ib_event event;
180 180
181 /* PATH_MIG without the QP ever having been armed is false alarm */
182 if (event_type == IB_EVENT_PATH_MIG && !qp->mig_armed)
183 return;
184
181 event.device = &shca->ib_device; 185 event.device = &shca->ib_device;
182 event.event = event_type; 186 event.event = event_type;
183 187
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 3f59587338ea..ea13efddf175 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -1460,6 +1460,8 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1460 goto modify_qp_exit2; 1460 goto modify_qp_exit2;
1461 } 1461 }
1462 mqpcb->path_migration_state = attr->path_mig_state + 1; 1462 mqpcb->path_migration_state = attr->path_mig_state + 1;
1463 if (attr->path_mig_state == IB_MIG_REARM)
1464 my_qp->mig_armed = 1;
1463 update_mask |= 1465 update_mask |=
1464 EHCA_BMASK_SET(MQPCB_MASK_PATH_MIGRATION_STATE, 1); 1466 EHCA_BMASK_SET(MQPCB_MASK_PATH_MIGRATION_STATE, 1);
1465 } 1467 }
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.c b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
index 661f8db62706..c3a328465431 100644
--- a/drivers/infiniband/hw/ehca/ipz_pt_fn.c
+++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.c
@@ -163,6 +163,7 @@ static int alloc_small_queue_page(struct ipz_queue *queue, struct ehca_pd *pd)
163 163
164out: 164out:
165 ehca_err(pd->ib_pd.device, "failed to allocate small queue page"); 165 ehca_err(pd->ib_pd.device, "failed to allocate small queue page");
166 mutex_unlock(&pd->lock);
166 return 0; 167 return 0;
167} 168}
168 169
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index ee4d073c889f..252590116df5 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -202,6 +202,7 @@ struct mthca_pd_table {
202 202
203struct mthca_buddy { 203struct mthca_buddy {
204 unsigned long **bits; 204 unsigned long **bits;
205 int *num_free;
205 int max_order; 206 int max_order;
206 spinlock_t lock; 207 spinlock_t lock;
207}; 208};
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 8489b1e81c0f..882e6b735915 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -89,23 +89,26 @@ static u32 mthca_buddy_alloc(struct mthca_buddy *buddy, int order)
89 89
90 spin_lock(&buddy->lock); 90 spin_lock(&buddy->lock);
91 91
92 for (o = order; o <= buddy->max_order; ++o) { 92 for (o = order; o <= buddy->max_order; ++o)
93 m = 1 << (buddy->max_order - o); 93 if (buddy->num_free[o]) {
94 seg = find_first_bit(buddy->bits[o], m); 94 m = 1 << (buddy->max_order - o);
95 if (seg < m) 95 seg = find_first_bit(buddy->bits[o], m);
96 goto found; 96 if (seg < m)
97 } 97 goto found;
98 }
98 99
99 spin_unlock(&buddy->lock); 100 spin_unlock(&buddy->lock);
100 return -1; 101 return -1;
101 102
102 found: 103 found:
103 clear_bit(seg, buddy->bits[o]); 104 clear_bit(seg, buddy->bits[o]);
105 --buddy->num_free[o];
104 106
105 while (o > order) { 107 while (o > order) {
106 --o; 108 --o;
107 seg <<= 1; 109 seg <<= 1;
108 set_bit(seg ^ 1, buddy->bits[o]); 110 set_bit(seg ^ 1, buddy->bits[o]);
111 ++buddy->num_free[o];
109 } 112 }
110 113
111 spin_unlock(&buddy->lock); 114 spin_unlock(&buddy->lock);
@@ -123,11 +126,13 @@ static void mthca_buddy_free(struct mthca_buddy *buddy, u32 seg, int order)
123 126
124 while (test_bit(seg ^ 1, buddy->bits[order])) { 127 while (test_bit(seg ^ 1, buddy->bits[order])) {
125 clear_bit(seg ^ 1, buddy->bits[order]); 128 clear_bit(seg ^ 1, buddy->bits[order]);
129 --buddy->num_free[order];
126 seg >>= 1; 130 seg >>= 1;
127 ++order; 131 ++order;
128 } 132 }
129 133
130 set_bit(seg, buddy->bits[order]); 134 set_bit(seg, buddy->bits[order]);
135 ++buddy->num_free[order];
131 136
132 spin_unlock(&buddy->lock); 137 spin_unlock(&buddy->lock);
133} 138}
@@ -141,7 +146,9 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
141 146
142 buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *), 147 buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
143 GFP_KERNEL); 148 GFP_KERNEL);
144 if (!buddy->bits) 149 buddy->num_free = kzalloc((buddy->max_order + 1) * sizeof (int *),
150 GFP_KERNEL);
151 if (!buddy->bits || !buddy->num_free)
145 goto err_out; 152 goto err_out;
146 153
147 for (i = 0; i <= buddy->max_order; ++i) { 154 for (i = 0; i <= buddy->max_order; ++i) {
@@ -154,6 +161,7 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
154 } 161 }
155 162
156 set_bit(0, buddy->bits[buddy->max_order]); 163 set_bit(0, buddy->bits[buddy->max_order]);
164 buddy->num_free[buddy->max_order] = 1;
157 165
158 return 0; 166 return 0;
159 167
@@ -161,9 +169,10 @@ err_out_free:
161 for (i = 0; i <= buddy->max_order; ++i) 169 for (i = 0; i <= buddy->max_order; ++i)
162 kfree(buddy->bits[i]); 170 kfree(buddy->bits[i]);
163 171
172err_out:
164 kfree(buddy->bits); 173 kfree(buddy->bits);
174 kfree(buddy->num_free);
165 175
166err_out:
167 return -ENOMEM; 176 return -ENOMEM;
168} 177}
169 178
@@ -175,6 +184,7 @@ static void mthca_buddy_cleanup(struct mthca_buddy *buddy)
175 kfree(buddy->bits[i]); 184 kfree(buddy->bits[i]);
176 185
177 kfree(buddy->bits); 186 kfree(buddy->bits);
187 kfree(buddy->num_free);
178} 188}
179 189
180static u32 mthca_alloc_mtt_range(struct mthca_dev *dev, int order, 190static u32 mthca_alloc_mtt_range(struct mthca_dev *dev, int order,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 8be9ea0436e6..f51201b17bfd 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -548,7 +548,7 @@ static int path_rec_start(struct net_device *dev,
548 path_rec_completion, 548 path_rec_completion,
549 path, &path->query); 549 path, &path->query);
550 if (path->query_id < 0) { 550 if (path->query_id < 0) {
551 ipoib_warn(priv, "ib_sa_path_rec_get failed\n"); 551 ipoib_warn(priv, "ib_sa_path_rec_get failed: %d\n", path->query_id);
552 path->query = NULL; 552 path->query = NULL;
553 return path->query_id; 553 return path->query_id;
554 } 554 }
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 3a917c1f796f..63462ecca147 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -483,6 +483,7 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
483 break; 483 break;
484 case RDMA_CM_EVENT_DISCONNECTED: 484 case RDMA_CM_EVENT_DISCONNECTED:
485 case RDMA_CM_EVENT_DEVICE_REMOVAL: 485 case RDMA_CM_EVENT_DEVICE_REMOVAL:
486 case RDMA_CM_EVENT_ADDR_CHANGE:
486 iser_disconnected_handler(cma_id); 487 iser_disconnected_handler(cma_id);
487 break; 488 break;
488 default: 489 default: