aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSelvin Xavier <selvin.xavier@emulex.com>2014-12-18 03:43:03 -0500
committerRoland Dreier <roland@purestorage.com>2015-02-18 11:31:03 -0500
commit043e9deed9ffd7da4349c8078917eb28a5f2d9c4 (patch)
tree9609633946de7e3b5da0d4e8546c9e5fb3ca1871
parent380676ea2bb0d74b6737cbf798922ebb0ef09608 (diff)
RDMA/ocrdma: Allow expansion of the SQ CQEs via buddy CQ expansion of the QP
If the SQ and RQ of the QP in error state uses separate CQs, traverse the list of QPs using each CQs and invoke the buddy CQ handler for both SQ and RQ. Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com> Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com> Signed-off-by: Mitesh Ahuja <mitesh.ahuja@emulex.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.c66
1 files changed, 44 insertions, 22 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 47999bb2b5f5..f28362616413 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -834,20 +834,20 @@ static int ocrdma_mq_cq_handler(struct ocrdma_dev *dev, u16 cq_id)
834 return 0; 834 return 0;
835} 835}
836 836
837static void ocrdma_qp_buddy_cq_handler(struct ocrdma_dev *dev, 837static struct ocrdma_cq *_ocrdma_qp_buddy_cq_handler(struct ocrdma_dev *dev,
838 struct ocrdma_cq *cq) 838 struct ocrdma_cq *cq, bool sq)
839{ 839{
840 unsigned long flags;
841 struct ocrdma_qp *qp; 840 struct ocrdma_qp *qp;
842 bool buddy_cq_found = false; 841 struct list_head *cur;
843 /* Go through list of QPs in error state which are using this CQ 842 struct ocrdma_cq *bcq = NULL;
844 * and invoke its callback handler to trigger CQE processing for 843 struct list_head *head = sq?(&cq->sq_head):(&cq->rq_head);
845 * error/flushed CQE. It is rare to find more than few entries in 844
846 * this list as most consumers stops after getting error CQE. 845 list_for_each(cur, head) {
847 * List is traversed only once when a matching buddy cq found for a QP. 846 if (sq)
848 */ 847 qp = list_entry(cur, struct ocrdma_qp, sq_entry);
849 spin_lock_irqsave(&dev->flush_q_lock, flags); 848 else
850 list_for_each_entry(qp, &cq->sq_head, sq_entry) { 849 qp = list_entry(cur, struct ocrdma_qp, rq_entry);
850
851 if (qp->srq) 851 if (qp->srq)
852 continue; 852 continue;
853 /* if wq and rq share the same cq, than comp_handler 853 /* if wq and rq share the same cq, than comp_handler
@@ -859,19 +859,41 @@ static void ocrdma_qp_buddy_cq_handler(struct ocrdma_dev *dev,
859 * if completion came on rq, sq's cq is buddy cq. 859 * if completion came on rq, sq's cq is buddy cq.
860 */ 860 */
861 if (qp->sq_cq == cq) 861 if (qp->sq_cq == cq)
862 cq = qp->rq_cq; 862 bcq = qp->rq_cq;
863 else 863 else
864 cq = qp->sq_cq; 864 bcq = qp->sq_cq;
865 buddy_cq_found = true; 865 return bcq;
866 break;
867 } 866 }
867 return NULL;
868}
869
870static void ocrdma_qp_buddy_cq_handler(struct ocrdma_dev *dev,
871 struct ocrdma_cq *cq)
872{
873 unsigned long flags;
874 struct ocrdma_cq *bcq = NULL;
875
876 /* Go through list of QPs in error state which are using this CQ
877 * and invoke its callback handler to trigger CQE processing for
878 * error/flushed CQE. It is rare to find more than few entries in
879 * this list as most consumers stops after getting error CQE.
880 * List is traversed only once when a matching buddy cq found for a QP.
881 */
882 spin_lock_irqsave(&dev->flush_q_lock, flags);
883 /* Check if buddy CQ is present.
884 * true - Check for SQ CQ
885 * false - Check for RQ CQ
886 */
887 bcq = _ocrdma_qp_buddy_cq_handler(dev, cq, true);
888 if (bcq == NULL)
889 bcq = _ocrdma_qp_buddy_cq_handler(dev, cq, false);
868 spin_unlock_irqrestore(&dev->flush_q_lock, flags); 890 spin_unlock_irqrestore(&dev->flush_q_lock, flags);
869 if (buddy_cq_found == false) 891
870 return; 892 /* if there is valid buddy cq, look for its completion handler */
871 if (cq->ibcq.comp_handler) { 893 if (bcq && bcq->ibcq.comp_handler) {
872 spin_lock_irqsave(&cq->comp_handler_lock, flags); 894 spin_lock_irqsave(&bcq->comp_handler_lock, flags);
873 (*cq->ibcq.comp_handler) (&cq->ibcq, cq->ibcq.cq_context); 895 (*bcq->ibcq.comp_handler) (&bcq->ibcq, bcq->ibcq.cq_context);
874 spin_unlock_irqrestore(&cq->comp_handler_lock, flags); 896 spin_unlock_irqrestore(&bcq->comp_handler_lock, flags);
875 } 897 }
876} 898}
877 899