Deleted Added
full compact
qp.c (296478) qp.c (297124)
1/*
2 * Copyright (c) 2009-2013 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:

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

25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2009-2013 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:

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

25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/dev/cxgbe/iw_cxgbe/qp.c 296478 2016-03-08 00:23:56Z np $");
33__FBSDID("$FreeBSD: head/sys/dev/cxgbe/iw_cxgbe/qp.c 297124 2016-03-21 00:29:45Z np $");
34
35#include "opt_inet.h"
36
37#ifdef TCP_OFFLOAD
38#include <sys/types.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/socketvar.h>

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

610 break;
611 }
612 wqe = (union t4_wr *)((u8 *)qhp->wq.sq.queue +
613 qhp->wq.sq.wq_pidx * T4_EQ_ENTRY_SIZE);
614
615 fw_flags = 0;
616 if (wr->send_flags & IB_SEND_SOLICITED)
617 fw_flags |= FW_RI_SOLICITED_EVENT_FLAG;
34
35#include "opt_inet.h"
36
37#ifdef TCP_OFFLOAD
38#include <sys/types.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/socketvar.h>

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

610 break;
611 }
612 wqe = (union t4_wr *)((u8 *)qhp->wq.sq.queue +
613 qhp->wq.sq.wq_pidx * T4_EQ_ENTRY_SIZE);
614
615 fw_flags = 0;
616 if (wr->send_flags & IB_SEND_SOLICITED)
617 fw_flags |= FW_RI_SOLICITED_EVENT_FLAG;
618 if (wr->send_flags & IB_SEND_SIGNALED)
618 if (wr->send_flags & IB_SEND_SIGNALED || qhp->sq_sig_all)
619 fw_flags |= FW_RI_COMPLETION_FLAG;
620 swsqe = &qhp->wq.sq.sw_sq[qhp->wq.sq.pidx];
621 switch (wr->opcode) {
622 case IB_WR_SEND_WITH_INV:
623 case IB_WR_SEND:
624 if (wr->send_flags & IB_SEND_FENCE)
625 fw_flags |= FW_RI_READ_FENCE_FLAG;
626 fw_opcode = FW_RI_SEND_WR;

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

668 err = -EINVAL;
669 }
670 if (err) {
671 *bad_wr = wr;
672 break;
673 }
674 swsqe->idx = qhp->wq.sq.pidx;
675 swsqe->complete = 0;
619 fw_flags |= FW_RI_COMPLETION_FLAG;
620 swsqe = &qhp->wq.sq.sw_sq[qhp->wq.sq.pidx];
621 switch (wr->opcode) {
622 case IB_WR_SEND_WITH_INV:
623 case IB_WR_SEND:
624 if (wr->send_flags & IB_SEND_FENCE)
625 fw_flags |= FW_RI_READ_FENCE_FLAG;
626 fw_opcode = FW_RI_SEND_WR;

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

668 err = -EINVAL;
669 }
670 if (err) {
671 *bad_wr = wr;
672 break;
673 }
674 swsqe->idx = qhp->wq.sq.pidx;
675 swsqe->complete = 0;
676 swsqe->signaled = (wr->send_flags & IB_SEND_SIGNALED);
676 swsqe->signaled = (wr->send_flags & IB_SEND_SIGNALED) ||
677 qhp->sq_sig_all;
677 swsqe->wr_id = wr->wr_id;
678
679 init_wr_hdr(wqe, qhp->wq.sq.pidx, fw_opcode, fw_flags, len16);
680
681 CTR5(KTR_IW_CXGBE,
682 "%s cookie 0x%llx pidx 0x%x opcode 0x%x read_len %u",
683 __func__, (unsigned long long)wr->wr_id, qhp->wq.sq.pidx,
684 swsqe->opcode, swsqe->read_len);

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

947 /* locking hierarchy: cq lock first, then qp lock. */
948 spin_lock_irqsave(&rchp->lock, flag);
949 spin_lock(&qhp->lock);
950 c4iw_flush_hw_cq(&rchp->cq);
951 c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
952 flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
953 spin_unlock(&qhp->lock);
954 spin_unlock_irqrestore(&rchp->lock, flag);
678 swsqe->wr_id = wr->wr_id;
679
680 init_wr_hdr(wqe, qhp->wq.sq.pidx, fw_opcode, fw_flags, len16);
681
682 CTR5(KTR_IW_CXGBE,
683 "%s cookie 0x%llx pidx 0x%x opcode 0x%x read_len %u",
684 __func__, (unsigned long long)wr->wr_id, qhp->wq.sq.pidx,
685 swsqe->opcode, swsqe->read_len);

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

948 /* locking hierarchy: cq lock first, then qp lock. */
949 spin_lock_irqsave(&rchp->lock, flag);
950 spin_lock(&qhp->lock);
951 c4iw_flush_hw_cq(&rchp->cq);
952 c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
953 flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
954 spin_unlock(&qhp->lock);
955 spin_unlock_irqrestore(&rchp->lock, flag);
955 if (flushed) {
956 if (flushed && rchp->ibcq.comp_handler) {
956 spin_lock_irqsave(&rchp->comp_handler_lock, flag);
957 (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
958 spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
959 }
960
961 /* locking hierarchy: cq lock first, then qp lock. */
962 spin_lock_irqsave(&schp->lock, flag);
963 spin_lock(&qhp->lock);
964 c4iw_flush_hw_cq(&schp->cq);
965 c4iw_count_scqes(&schp->cq, &qhp->wq, &count);
966 flushed = c4iw_flush_sq(&qhp->wq, &schp->cq, count);
967 spin_unlock(&qhp->lock);
968 spin_unlock_irqrestore(&schp->lock, flag);
957 spin_lock_irqsave(&rchp->comp_handler_lock, flag);
958 (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
959 spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
960 }
961
962 /* locking hierarchy: cq lock first, then qp lock. */
963 spin_lock_irqsave(&schp->lock, flag);
964 spin_lock(&qhp->lock);
965 c4iw_flush_hw_cq(&schp->cq);
966 c4iw_count_scqes(&schp->cq, &qhp->wq, &count);
967 flushed = c4iw_flush_sq(&qhp->wq, &schp->cq, count);
968 spin_unlock(&qhp->lock);
969 spin_unlock_irqrestore(&schp->lock, flag);
969 if (flushed) {
970 if (flushed && schp->ibcq.comp_handler) {
970 spin_lock_irqsave(&schp->comp_handler_lock, flag);
971 (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);
972 spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
973 }
974}
975
976static void flush_qp(struct c4iw_qp *qhp)
977{

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

1525 qhp->attr.rq_max_sges = attrs->cap.max_recv_sge;
1526 qhp->attr.state = C4IW_QP_STATE_IDLE;
1527 qhp->attr.next_state = C4IW_QP_STATE_IDLE;
1528 qhp->attr.enable_rdma_read = 1;
1529 qhp->attr.enable_rdma_write = 1;
1530 qhp->attr.enable_bind = 1;
1531 qhp->attr.max_ord = 1;
1532 qhp->attr.max_ird = 1;
971 spin_lock_irqsave(&schp->comp_handler_lock, flag);
972 (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);
973 spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
974 }
975}
976
977static void flush_qp(struct c4iw_qp *qhp)
978{

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

1526 qhp->attr.rq_max_sges = attrs->cap.max_recv_sge;
1527 qhp->attr.state = C4IW_QP_STATE_IDLE;
1528 qhp->attr.next_state = C4IW_QP_STATE_IDLE;
1529 qhp->attr.enable_rdma_read = 1;
1530 qhp->attr.enable_rdma_write = 1;
1531 qhp->attr.enable_bind = 1;
1532 qhp->attr.max_ord = 1;
1533 qhp->attr.max_ird = 1;
1534 qhp->sq_sig_all = attrs->sq_sig_type == IB_SIGNAL_ALL_WR;
1533 spin_lock_init(&qhp->lock);
1534 mutex_init(&qhp->mutex);
1535 init_waitqueue_head(&qhp->wait);
1536 atomic_set(&qhp->refcnt, 1);
1537
1538 spin_lock_irq(&rhp->lock);
1539 if (rhp->db_state != NORMAL)
1540 t4_disable_wq_db(&qhp->wq);

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

1697int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
1698 int attr_mask, struct ib_qp_init_attr *init_attr)
1699{
1700 struct c4iw_qp *qhp = to_c4iw_qp(ibqp);
1701
1702 memset(attr, 0, sizeof *attr);
1703 memset(init_attr, 0, sizeof *init_attr);
1704 attr->qp_state = to_ib_qp_state(qhp->attr.state);
1535 spin_lock_init(&qhp->lock);
1536 mutex_init(&qhp->mutex);
1537 init_waitqueue_head(&qhp->wait);
1538 atomic_set(&qhp->refcnt, 1);
1539
1540 spin_lock_irq(&rhp->lock);
1541 if (rhp->db_state != NORMAL)
1542 t4_disable_wq_db(&qhp->wq);

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

1699int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
1700 int attr_mask, struct ib_qp_init_attr *init_attr)
1701{
1702 struct c4iw_qp *qhp = to_c4iw_qp(ibqp);
1703
1704 memset(attr, 0, sizeof *attr);
1705 memset(init_attr, 0, sizeof *init_attr);
1706 attr->qp_state = to_ib_qp_state(qhp->attr.state);
1707 init_attr->cap.max_send_wr = qhp->attr.sq_num_entries;
1708 init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries;
1709 init_attr->cap.max_send_sge = qhp->attr.sq_max_sges;
1710 init_attr->cap.max_recv_sge = qhp->attr.sq_max_sges;
1711 init_attr->cap.max_inline_data = T4_MAX_SEND_INLINE;
1712 init_attr->sq_sig_type = qhp->sq_sig_all ? IB_SIGNAL_ALL_WR : 0;
1705 return 0;
1706}
1707#endif
1713 return 0;
1714}
1715#endif