History

IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct

polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing. This can be used for polling mode ULPs.

Sagi Grimberg committed 8 years ago

Commit 246d8b11 parent aaebd371 file · +13 −10Browse files

Unified · Split

drivers/infiniband/core/cq.c+13−10
@@ -25,9 +25,10 @@ · 24 unmodified lines
2525 #define IB_POLL_FLAGS \
2626 (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
2727
28−static int __ib_process_cq(struct ib_cq *cq, int budget)
28+static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
2929 {
3030 int i, n, completed = 0;
31+ struct ib_wc *wcs = poll_wc ? : cq->wc;
3132
3233 /*
3334 * budget might be (-1) if the caller does not
@@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) · 1 unmodified line
3536 * minimum here.
3637 */
3738 while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
38− budget - completed), cq->wc)) > 0) {
39+ budget - completed), wcs)) > 0) {
3940 for (i = 0; i < n; i++) {
40− struct ib_wc *wc = &cq->wc[i];
41+ struct ib_wc *wc = &wcs[i];
4142
4243 if (wc->wr_cqe)
4344 wc->wr_cqe->done(cq, wc);
@@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) · 16 unmodified lines
6061 * @cq: CQ to process
6162 * @budget: number of CQEs to poll for
6263 *
63− * This function is used to process all outstanding CQ entries on a
64− * %IB_POLL_DIRECT CQ. It does not offload CQ processing to a different
65− * context and does not ask for completion interrupts from the HCA.
64+ * This function is used to process all outstanding CQ entries.
65+ * It does not offload CQ processing to a different context and does
66+ * not ask for completion interrupts from the HCA.
67+ * Using direct processing on CQ with non IB_POLL_DIRECT type may trigger
68+ * concurrent processing.
6669 *
6770 * Note: do not pass -1 as %budget unless it is guaranteed that the number
6871 * of completions that will be processed is small.
6972 */
7073 int ib_process_cq_direct(struct ib_cq *cq, int budget)
7174 {
72− WARN_ON_ONCE(cq->poll_ctx != IB_POLL_DIRECT);
75+ struct ib_wc wcs[IB_POLL_BATCH];
7376
74− return __ib_process_cq(cq, budget);
77+ return __ib_process_cq(cq, budget, wcs);
7578 }
7679 EXPORT_SYMBOL(ib_process_cq_direct);
7780
@@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget) · 7 unmodified lines
8588 struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
8689 int completed;
8790
88− completed = __ib_process_cq(cq, budget);
91+ completed = __ib_process_cq(cq, budget, NULL);
8992 if (completed < budget) {
9093 irq_poll_complete(&cq->iop);
9194 if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
@@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct *work) · 13 unmodified lines
105108 struct ib_cq *cq = container_of(work, struct ib_cq, work);
106109 int completed;
107110
108− completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE);
111+ completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
109112 if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
110113 ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
111114 queue_work(ib_comp_wq, &cq->work);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t