@@ -763,7 +763,8 @@ out:
static int rds_iw_build_send_reg(struct rds_iw_send_work *send,
struct scatterlist *sg,
- int sg_nents)
+ int sg_nents,
+ int access_flags)
{
int n;
@@ -776,7 +777,7 @@ static int rds_iw_build_send_reg(struct rds_iw_send_work *send,
send->s_reg_wr.wr.num_sge = 0;
send->s_reg_wr.mr = send->s_mr;
send->s_reg_wr.key = send->s_mr->rkey;
- send->s_reg_wr.access = IB_ACCESS_REMOTE_WRITE;
+ send->s_reg_wr.access = access_flags;
ib_update_fast_reg_key(send->s_mr, send->s_remap_count++);
@@ -786,6 +787,7 @@ static int rds_iw_build_send_reg(struct rds_iw_send_work *send,
int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
{
struct rds_iw_connection *ic = conn->c_transport_data;
+ struct ib_device *device = ic->i_cm_id->device;
struct rds_iw_send_work *send = NULL;
struct rds_iw_send_work *first;
struct rds_iw_send_work *prev;
@@ -803,11 +805,11 @@ int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
int num_sge;
int sg_nents;
- rds_iwdev = ib_get_client_data(ic->i_cm_id->device, &rds_iw_client);
+ rds_iwdev = ib_get_client_data(device, &rds_iw_client);
/* map the message the first time we see it */
if (!op->op_mapped) {
- op->op_count = ib_dma_map_sg(ic->i_cm_id->device,
+ op->op_count = ib_dma_map_sg(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);
@@ -896,12 +898,12 @@ int rds_iw_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 = ib_sg_dma_len(ic->i_cm_id->device, scat);
+ len = ib_sg_dma_len(device, scat);
if (send->s_rdma_wr.wr.opcode == IB_WR_RDMA_READ_WITH_INV)
sg_nents++;
else {
- send->s_sge[j].addr = ib_sg_dma_address(ic->i_cm_id->device, scat);
+ send->s_sge[j].addr = ib_sg_dma_address(device, scat);
send->s_sge[j].length = len;
send->s_sge[j].lkey = rds_iw_local_dma_lkey(ic);
}
@@ -947,7 +949,8 @@ int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
*/
if (!op->op_write) {
ret = rds_iw_build_send_reg(&ic->i_sends[fr_pos],
- &op->op_sg[0], sg_nents);
+ &op->op_sg[0], sg_nents,
+ device->rdma_read_access_flags);
if (ret) {
printk(KERN_WARNING "RDS/IW: failed to reg send mem\n");
goto out;
Instead of hard-coding remote access (which is not secured issue in IB). Signed-off-by: Sagi Grimberg <sagig@mellanox.com> --- net/rds/iw_send.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)