net/rds: Handle ODP mr registration/unregistration
On-Demand-Paging MRs are registered using ib_reg_user_mr and unregistered with ib_dereg_mr. Signed-off-by: Hans Westgaard Ry <hans.westgaard.ry@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:

committed by
Leon Romanovsky

parent
c4c86abb3f
commit
2eafa1746f
@@ -39,6 +39,7 @@
|
||||
#include "rds_single_path.h"
|
||||
#include "rds.h"
|
||||
#include "ib.h"
|
||||
#include "ib_mr.h"
|
||||
|
||||
/*
|
||||
* Convert IB-specific error message to RDS error message and call core
|
||||
@@ -635,6 +636,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
|
||||
send->s_sge[0].addr = ic->i_send_hdrs_dma[pos];
|
||||
|
||||
send->s_sge[0].length = sizeof(struct rds_header);
|
||||
send->s_sge[0].lkey = ic->i_pd->local_dma_lkey;
|
||||
|
||||
memcpy(ic->i_send_hdrs[pos], &rm->m_inc.i_hdr,
|
||||
sizeof(struct rds_header));
|
||||
@@ -650,6 +652,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
|
||||
send->s_sge[1].addr = sg_dma_address(scat);
|
||||
send->s_sge[1].addr += rm->data.op_dmaoff;
|
||||
send->s_sge[1].length = len;
|
||||
send->s_sge[1].lkey = ic->i_pd->local_dma_lkey;
|
||||
|
||||
bytes_sent += len;
|
||||
rm->data.op_dmaoff += len;
|
||||
@@ -858,20 +861,29 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
|
||||
int ret;
|
||||
int num_sge;
|
||||
int nr_sig = 0;
|
||||
u64 odp_addr = op->op_odp_addr;
|
||||
u32 odp_lkey = 0;
|
||||
|
||||
/* map the op the first time we see it */
|
||||
if (!op->op_mapped) {
|
||||
op->op_count = ib_dma_map_sg(ic->i_cm_id->device,
|
||||
op->op_sg, op->op_nents, (op->op_write) ?
|
||||
DMA_TO_DEVICE : DMA_FROM_DEVICE);
|
||||
rdsdebug("ic %p mapping op %p: %d\n", ic, op, op->op_count);
|
||||
if (op->op_count == 0) {
|
||||
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
|
||||
ret = -ENOMEM; /* XXX ? */
|
||||
goto out;
|
||||
if (!op->op_odp_mr) {
|
||||
if (!op->op_mapped) {
|
||||
op->op_count =
|
||||
ib_dma_map_sg(ic->i_cm_id->device, op->op_sg,
|
||||
op->op_nents,
|
||||
(op->op_write) ? DMA_TO_DEVICE :
|
||||
DMA_FROM_DEVICE);
|
||||
rdsdebug("ic %p mapping op %p: %d\n", ic, op,
|
||||
op->op_count);
|
||||
if (op->op_count == 0) {
|
||||
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
|
||||
ret = -ENOMEM; /* XXX ? */
|
||||
goto out;
|
||||
}
|
||||
op->op_mapped = 1;
|
||||
}
|
||||
|
||||
op->op_mapped = 1;
|
||||
} else {
|
||||
op->op_count = op->op_nents;
|
||||
odp_lkey = rds_ib_get_lkey(op->op_odp_mr->r_trans_private);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -923,14 +935,20 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
|
||||
for (j = 0; j < send->s_rdma_wr.wr.num_sge &&
|
||||
scat != &op->op_sg[op->op_count]; j++) {
|
||||
len = sg_dma_len(scat);
|
||||
send->s_sge[j].addr = sg_dma_address(scat);
|
||||
if (!op->op_odp_mr) {
|
||||
send->s_sge[j].addr = sg_dma_address(scat);
|
||||
send->s_sge[j].lkey = ic->i_pd->local_dma_lkey;
|
||||
} else {
|
||||
send->s_sge[j].addr = odp_addr;
|
||||
send->s_sge[j].lkey = odp_lkey;
|
||||
}
|
||||
send->s_sge[j].length = len;
|
||||
send->s_sge[j].lkey = ic->i_pd->local_dma_lkey;
|
||||
|
||||
sent += len;
|
||||
rdsdebug("ic %p sent %d remote_addr %llu\n", ic, sent, remote_addr);
|
||||
|
||||
remote_addr += len;
|
||||
odp_addr += len;
|
||||
scat++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user