Commit 9bd626e7 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

IB/isert: pass scatterlist instead of cmd to fast_reg_mr routine

This routine may help for protection registration as well.
This patch does not change any functionality.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent dc87a90f
...@@ -2169,26 +2169,22 @@ isert_map_fr_pagelist(struct ib_device *ib_dev, ...@@ -2169,26 +2169,22 @@ isert_map_fr_pagelist(struct ib_device *ib_dev,
static int static int
isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc, isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc,
struct isert_cmd *isert_cmd, struct isert_conn *isert_conn, struct isert_conn *isert_conn, struct scatterlist *sg_start,
struct ib_sge *ib_sge, u32 offset, unsigned int data_len) struct ib_sge *ib_sge, u32 sg_nents, u32 offset,
unsigned int data_len)
{ {
struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd;
struct ib_device *ib_dev = isert_conn->conn_cm_id->device; struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
struct scatterlist *sg_start;
u32 sg_off, page_off;
struct ib_send_wr fr_wr, inv_wr; struct ib_send_wr fr_wr, inv_wr;
struct ib_send_wr *bad_wr, *wr = NULL; struct ib_send_wr *bad_wr, *wr = NULL;
int ret, pagelist_len;
u32 page_off;
u8 key; u8 key;
int ret, sg_nents, pagelist_len;
sg_off = offset / PAGE_SIZE; sg_nents = min_t(unsigned int, sg_nents, ISCSI_ISER_SG_TABLESIZE);
sg_start = &cmd->se_cmd.t_data_sg[sg_off];
sg_nents = min_t(unsigned int, cmd->se_cmd.t_data_nents - sg_off,
ISCSI_ISER_SG_TABLESIZE);
page_off = offset % PAGE_SIZE; page_off = offset % PAGE_SIZE;
pr_debug("Cmd: %p use fr_desc %p sg_nents %d sg_off %d offset %u\n", pr_debug("Use fr_desc %p sg_nents %d offset %u\n",
isert_cmd, fr_desc, sg_nents, sg_off, offset); fr_desc, sg_nents, offset);
pagelist_len = isert_map_fr_pagelist(ib_dev, sg_start, sg_nents, pagelist_len = isert_map_fr_pagelist(ib_dev, sg_start, sg_nents,
&fr_desc->data_frpl->page_list[0]); &fr_desc->data_frpl->page_list[0]);
...@@ -2257,9 +2253,9 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -2257,9 +2253,9 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) {
data_left = se_cmd->data_length; data_left = se_cmd->data_length;
} else { } else {
sg_off = cmd->write_data_done / PAGE_SIZE;
data_left = se_cmd->data_length - cmd->write_data_done;
offset = cmd->write_data_done; offset = cmd->write_data_done;
sg_off = offset / PAGE_SIZE;
data_left = se_cmd->data_length - cmd->write_data_done;
isert_cmd->tx_desc.isert_cmd = isert_cmd; isert_cmd->tx_desc.isert_cmd = isert_cmd;
} }
...@@ -2323,8 +2319,8 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -2323,8 +2319,8 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
spin_unlock_irqrestore(&isert_conn->conn_lock, flags); spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
wr->fr_desc = fr_desc; wr->fr_desc = fr_desc;
ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, ret = isert_fast_reg_mr(fr_desc, isert_conn, sg_start,
ib_sge, offset, data_len); ib_sge, sg_nents, offset, data_len);
if (ret) { if (ret) {
list_add_tail(&fr_desc->list, &isert_conn->conn_fr_pool); list_add_tail(&fr_desc->list, &isert_conn->conn_fr_pool);
goto unmap_sg; goto unmap_sg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment