aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca/ehca_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_irq.c')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index ee06d8bd739..a925ea52443 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -175,41 +175,55 @@ error_data1:
175 175
176} 176}
177 177
178static void qp_event_callback(struct ehca_shca *shca, u64 eqe, 178static void dispatch_qp_event(struct ehca_shca *shca, struct ehca_qp *qp,
179 enum ib_event_type event_type, int fatal) 179 enum ib_event_type event_type)
180{ 180{
181 struct ib_event event; 181 struct ib_event event;
182 struct ehca_qp *qp;
183 u32 token = EHCA_BMASK_GET(EQE_QP_TOKEN, eqe);
184
185 read_lock(&ehca_qp_idr_lock);
186 qp = idr_find(&ehca_qp_idr, token);
187 read_unlock(&ehca_qp_idr_lock);
188
189
190 if (!qp)
191 return;
192
193 if (fatal)
194 ehca_error_data(shca, qp, qp->ipz_qp_handle.handle);
195 182
196 event.device = &shca->ib_device; 183 event.device = &shca->ib_device;
184 event.event = event_type;
197 185
198 if (qp->ext_type == EQPT_SRQ) { 186 if (qp->ext_type == EQPT_SRQ) {
199 if (!qp->ib_srq.event_handler) 187 if (!qp->ib_srq.event_handler)
200 return; 188 return;
201 189
202 event.event = fatal ? IB_EVENT_SRQ_ERR : event_type;
203 event.element.srq = &qp->ib_srq; 190 event.element.srq = &qp->ib_srq;
204 qp->ib_srq.event_handler(&event, qp->ib_srq.srq_context); 191 qp->ib_srq.event_handler(&event, qp->ib_srq.srq_context);
205 } else { 192 } else {
206 if (!qp->ib_qp.event_handler) 193 if (!qp->ib_qp.event_handler)
207 return; 194 return;
208 195
209 event.event = event_type;
210 event.element.qp = &qp->ib_qp; 196 event.element.qp = &qp->ib_qp;
211 qp->ib_qp.event_handler(&event, qp->ib_qp.qp_context); 197 qp->ib_qp.event_handler(&event, qp->ib_qp.qp_context);
212 } 198 }
199}
200
201static void qp_event_callback(struct ehca_shca *shca, u64 eqe,
202 enum ib_event_type event_type, int fatal)
203{
204 struct ehca_qp *qp;
205 u32 token = EHCA_BMASK_GET(EQE_QP_TOKEN, eqe);
206
207 read_lock(&ehca_qp_idr_lock);
208 qp = idr_find(&ehca_qp_idr, token);
209 read_unlock(&ehca_qp_idr_lock);
210
211 if (!qp)
212 return;
213
214 if (fatal)
215 ehca_error_data(shca, qp, qp->ipz_qp_handle.handle);
216
217 dispatch_qp_event(shca, qp, fatal && qp->ext_type == EQPT_SRQ ?
218 IB_EVENT_SRQ_ERR : event_type);
219
220 /*
221 * eHCA only processes one WQE at a time for SRQ base QPs,
222 * so the last WQE has been processed as soon as the QP enters
223 * error state.
224 */
225 if (fatal && qp->ext_type == EQPT_SRQBASE)
226 dispatch_qp_event(shca, qp, IB_EVENT_QP_LAST_WQE_REACHED);
213 227
214 return; 228 return;
215} 229}