cq.c (301a36fa700f9add6e14f5a95c7573e01578343a) cq.c (49b53a93a64ab0aaec10851b004297a3ac885433)
1/*
2 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 652 unchanged lines hidden (view full) ---

661 } else {
662 PDBG("%s cq %p cqid 0x%x skip hw cqe cidx %u\n",
663 __func__, cq, cq->cqid, cq->cidx);
664 t4_hwcq_consume(cq);
665 }
666 return ret;
667}
668
1/*
2 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 652 unchanged lines hidden (view full) ---

661 } else {
662 PDBG("%s cq %p cqid 0x%x skip hw cqe cidx %u\n",
663 __func__, cq, cq->cqid, cq->cidx);
664 t4_hwcq_consume(cq);
665 }
666 return ret;
667}
668
669static void invalidate_mr(struct c4iw_dev *rhp, u32 rkey)
670{
671 struct c4iw_mr *mhp;
672 unsigned long flags;
673
674 spin_lock_irqsave(&rhp->lock, flags);
675 mhp = get_mhp(rhp, rkey >> 8);
676 if (mhp)
677 mhp->attr.state = 0;
678 spin_unlock_irqrestore(&rhp->lock, flags);
679}
680
669/*
670 * Get one cq entry from c4iw and map it to openib.
671 *
672 * Returns:
673 * 0 cqe returned
674 * -ENODATA EMPTY;
675 * -EAGAIN caller must try again
676 * any other -errno fatal error

--- 39 unchanged lines hidden (view full) ---

716 wc->byte_len = CQE_LEN(&cqe);
717 else
718 wc->byte_len = 0;
719 wc->opcode = IB_WC_RECV;
720 if (CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_INV ||
721 CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_SE_INV) {
722 wc->ex.invalidate_rkey = CQE_WRID_STAG(&cqe);
723 wc->wc_flags |= IB_WC_WITH_INVALIDATE;
681/*
682 * Get one cq entry from c4iw and map it to openib.
683 *
684 * Returns:
685 * 0 cqe returned
686 * -ENODATA EMPTY;
687 * -EAGAIN caller must try again
688 * any other -errno fatal error

--- 39 unchanged lines hidden (view full) ---

728 wc->byte_len = CQE_LEN(&cqe);
729 else
730 wc->byte_len = 0;
731 wc->opcode = IB_WC_RECV;
732 if (CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_INV ||
733 CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_SE_INV) {
734 wc->ex.invalidate_rkey = CQE_WRID_STAG(&cqe);
735 wc->wc_flags |= IB_WC_WITH_INVALIDATE;
736 invalidate_mr(qhp->rhp, wc->ex.invalidate_rkey);
724 }
725 } else {
726 switch (CQE_OPCODE(&cqe)) {
727 case FW_RI_RDMA_WRITE:
728 wc->opcode = IB_WC_RDMA_WRITE;
729 break;
730 case FW_RI_READ_REQ:
731 wc->opcode = IB_WC_RDMA_READ;

--- 9 unchanged lines hidden (view full) ---

741 wc->opcode = IB_WC_SEND;
742 break;
743
744 case FW_RI_LOCAL_INV:
745 wc->opcode = IB_WC_LOCAL_INV;
746 break;
747 case FW_RI_FAST_REGISTER:
748 wc->opcode = IB_WC_REG_MR;
737 }
738 } else {
739 switch (CQE_OPCODE(&cqe)) {
740 case FW_RI_RDMA_WRITE:
741 wc->opcode = IB_WC_RDMA_WRITE;
742 break;
743 case FW_RI_READ_REQ:
744 wc->opcode = IB_WC_RDMA_READ;

--- 9 unchanged lines hidden (view full) ---

754 wc->opcode = IB_WC_SEND;
755 break;
756
757 case FW_RI_LOCAL_INV:
758 wc->opcode = IB_WC_LOCAL_INV;
759 break;
760 case FW_RI_FAST_REGISTER:
761 wc->opcode = IB_WC_REG_MR;
762
763 /* Invalidate the MR if the fastreg failed */
764 if (CQE_STATUS(&cqe) != T4_ERR_SUCCESS)
765 invalidate_mr(qhp->rhp, CQE_WRID_FR_STAG(&cqe));
749 break;
750 default:
751 printk(KERN_ERR MOD "Unexpected opcode %d "
752 "in the CQE received for QPID=0x%0x\n",
753 CQE_OPCODE(&cqe), CQE_QPID(&cqe));
754 ret = -EINVAL;
755 goto out;
756 }

--- 254 unchanged lines hidden (view full) ---

1011int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata)
1012{
1013 return -ENOSYS;
1014}
1015
1016int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
1017{
1018 struct c4iw_cq *chp;
766 break;
767 default:
768 printk(KERN_ERR MOD "Unexpected opcode %d "
769 "in the CQE received for QPID=0x%0x\n",
770 CQE_OPCODE(&cqe), CQE_QPID(&cqe));
771 ret = -EINVAL;
772 goto out;
773 }

--- 254 unchanged lines hidden (view full) ---

1028int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata)
1029{
1030 return -ENOSYS;
1031}
1032
1033int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
1034{
1035 struct c4iw_cq *chp;
1019 int ret = 0;
1036 int ret;
1020 unsigned long flag;
1021
1022 chp = to_c4iw_cq(ibcq);
1023 spin_lock_irqsave(&chp->lock, flag);
1037 unsigned long flag;
1038
1039 chp = to_c4iw_cq(ibcq);
1040 spin_lock_irqsave(&chp->lock, flag);
1024 t4_arm_cq(&chp->cq,
1025 (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED);
1026 if (flags & IB_CQ_REPORT_MISSED_EVENTS)
1027 ret = t4_cq_notempty(&chp->cq);
1041 ret = t4_arm_cq(&chp->cq,
1042 (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED);
1028 spin_unlock_irqrestore(&chp->lock, flag);
1043 spin_unlock_irqrestore(&chp->lock, flag);
1044 if (ret && !(flags & IB_CQ_REPORT_MISSED_EVENTS))
1045 ret = 0;
1029 return ret;
1030}
1046 return ret;
1047}