rw.c (5a6781a558cc3909851c04a0d44e3a87a35aad94) rw.c (c0a6cbb9cbccffc249743afa16e64f16c46c80b2)
1/*
2 * Copyright (c) 2016 HGST, a Western Digital Company.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

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

683 */
684 factor = 1;
685
686 /*
687 * If the devices needs MRs to perform RDMA READ or WRITE operations,
688 * we'll need two additional MRs for the registrations and the
689 * invalidation.
690 */
1/*
2 * Copyright (c) 2016 HGST, a Western Digital Company.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

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

683 */
684 factor = 1;
685
686 /*
687 * If the devices needs MRs to perform RDMA READ or WRITE operations,
688 * we'll need two additional MRs for the registrations and the
689 * invalidation.
690 */
691 if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN)
691 if (attr->create_flags & IB_QP_CREATE_INTEGRITY_EN)
692 factor += 6; /* (inv + reg) * (data + prot + sig) */
693 else if (rdma_rw_can_use_mr(dev, attr->port_num))
694 factor += 2; /* inv + reg */
695
696 attr->cap.max_send_wr += factor * attr->cap.max_rdma_ctxs;
697
698 /*
699 * But maybe we were just too high in the sky and the device doesn't

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

704}
705
706int rdma_rw_init_mrs(struct ib_qp *qp, struct ib_qp_init_attr *attr)
707{
708 struct ib_device *dev = qp->pd->device;
709 u32 nr_mrs = 0, nr_sig_mrs = 0;
710 int ret = 0;
711
692 factor += 6; /* (inv + reg) * (data + prot + sig) */
693 else if (rdma_rw_can_use_mr(dev, attr->port_num))
694 factor += 2; /* inv + reg */
695
696 attr->cap.max_send_wr += factor * attr->cap.max_rdma_ctxs;
697
698 /*
699 * But maybe we were just too high in the sky and the device doesn't

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

704}
705
706int rdma_rw_init_mrs(struct ib_qp *qp, struct ib_qp_init_attr *attr)
707{
708 struct ib_device *dev = qp->pd->device;
709 u32 nr_mrs = 0, nr_sig_mrs = 0;
710 int ret = 0;
711
712 if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN) {
712 if (attr->create_flags & IB_QP_CREATE_INTEGRITY_EN) {
713 nr_sig_mrs = attr->cap.max_rdma_ctxs;
714 nr_mrs = attr->cap.max_rdma_ctxs * 2;
715 } else if (rdma_rw_can_use_mr(dev, attr->port_num)) {
716 nr_mrs = attr->cap.max_rdma_ctxs;
717 }
718
719 if (nr_mrs) {
720 ret = ib_mr_pool_init(qp, &qp->rdma_mrs, nr_mrs,

--- 31 unchanged lines hidden ---
713 nr_sig_mrs = attr->cap.max_rdma_ctxs;
714 nr_mrs = attr->cap.max_rdma_ctxs * 2;
715 } else if (rdma_rw_can_use_mr(dev, attr->port_num)) {
716 nr_mrs = attr->cap.max_rdma_ctxs;
717 }
718
719 if (nr_mrs) {
720 ret = ib_mr_pool_init(qp, &qp->rdma_mrs, nr_mrs,

--- 31 unchanged lines hidden ---