diff options
Diffstat (limited to 'drivers/infiniband/ulp/srpt/ib_srpt.c')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0e537d8d0e47..fe09f2788b15 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -1078,6 +1078,7 @@ static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch, | |||
1078 | static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, | 1078 | static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, |
1079 | struct srpt_send_ioctx *ioctx) | 1079 | struct srpt_send_ioctx *ioctx) |
1080 | { | 1080 | { |
1081 | struct ib_device *dev = ch->sport->sdev->device; | ||
1081 | struct se_cmd *cmd; | 1082 | struct se_cmd *cmd; |
1082 | struct scatterlist *sg, *sg_orig; | 1083 | struct scatterlist *sg, *sg_orig; |
1083 | int sg_cnt; | 1084 | int sg_cnt; |
@@ -1124,7 +1125,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, | |||
1124 | 1125 | ||
1125 | db = ioctx->rbufs; | 1126 | db = ioctx->rbufs; |
1126 | tsize = cmd->data_length; | 1127 | tsize = cmd->data_length; |
1127 | dma_len = sg_dma_len(&sg[0]); | 1128 | dma_len = ib_sg_dma_len(dev, &sg[0]); |
1128 | riu = ioctx->rdma_ius; | 1129 | riu = ioctx->rdma_ius; |
1129 | 1130 | ||
1130 | /* | 1131 | /* |
@@ -1155,7 +1156,8 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, | |||
1155 | ++j; | 1156 | ++j; |
1156 | if (j < count) { | 1157 | if (j < count) { |
1157 | sg = sg_next(sg); | 1158 | sg = sg_next(sg); |
1158 | dma_len = sg_dma_len(sg); | 1159 | dma_len = ib_sg_dma_len( |
1160 | dev, sg); | ||
1159 | } | 1161 | } |
1160 | } | 1162 | } |
1161 | } else { | 1163 | } else { |
@@ -1192,8 +1194,8 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, | |||
1192 | tsize = cmd->data_length; | 1194 | tsize = cmd->data_length; |
1193 | riu = ioctx->rdma_ius; | 1195 | riu = ioctx->rdma_ius; |
1194 | sg = sg_orig; | 1196 | sg = sg_orig; |
1195 | dma_len = sg_dma_len(&sg[0]); | 1197 | dma_len = ib_sg_dma_len(dev, &sg[0]); |
1196 | dma_addr = sg_dma_address(&sg[0]); | 1198 | dma_addr = ib_sg_dma_address(dev, &sg[0]); |
1197 | 1199 | ||
1198 | /* this second loop is really mapped sg_addres to rdma_iu->ib_sge */ | 1200 | /* this second loop is really mapped sg_addres to rdma_iu->ib_sge */ |
1199 | for (i = 0, j = 0; | 1201 | for (i = 0, j = 0; |
@@ -1216,8 +1218,10 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, | |||
1216 | ++j; | 1218 | ++j; |
1217 | if (j < count) { | 1219 | if (j < count) { |
1218 | sg = sg_next(sg); | 1220 | sg = sg_next(sg); |
1219 | dma_len = sg_dma_len(sg); | 1221 | dma_len = ib_sg_dma_len( |
1220 | dma_addr = sg_dma_address(sg); | 1222 | dev, sg); |
1223 | dma_addr = ib_sg_dma_address( | ||
1224 | dev, sg); | ||
1221 | } | 1225 | } |
1222 | } | 1226 | } |
1223 | } else { | 1227 | } else { |
@@ -2580,7 +2584,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2580 | goto destroy_ib; | 2584 | goto destroy_ib; |
2581 | } | 2585 | } |
2582 | 2586 | ||
2583 | ch->sess = transport_init_session(); | 2587 | ch->sess = transport_init_session(TARGET_PROT_NORMAL); |
2584 | if (IS_ERR(ch->sess)) { | 2588 | if (IS_ERR(ch->sess)) { |
2585 | rej->reason = __constant_cpu_to_be32( | 2589 | rej->reason = __constant_cpu_to_be32( |
2586 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2590 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
@@ -3081,6 +3085,14 @@ static void srpt_queue_tm_rsp(struct se_cmd *cmd) | |||
3081 | srpt_queue_response(cmd); | 3085 | srpt_queue_response(cmd); |
3082 | } | 3086 | } |
3083 | 3087 | ||
3088 | static void srpt_aborted_task(struct se_cmd *cmd) | ||
3089 | { | ||
3090 | struct srpt_send_ioctx *ioctx = container_of(cmd, | ||
3091 | struct srpt_send_ioctx, cmd); | ||
3092 | |||
3093 | srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); | ||
3094 | } | ||
3095 | |||
3084 | static int srpt_queue_status(struct se_cmd *cmd) | 3096 | static int srpt_queue_status(struct se_cmd *cmd) |
3085 | { | 3097 | { |
3086 | struct srpt_send_ioctx *ioctx; | 3098 | struct srpt_send_ioctx *ioctx; |
@@ -3928,6 +3940,7 @@ static struct target_core_fabric_ops srpt_template = { | |||
3928 | .queue_data_in = srpt_queue_data_in, | 3940 | .queue_data_in = srpt_queue_data_in, |
3929 | .queue_status = srpt_queue_status, | 3941 | .queue_status = srpt_queue_status, |
3930 | .queue_tm_rsp = srpt_queue_tm_rsp, | 3942 | .queue_tm_rsp = srpt_queue_tm_rsp, |
3943 | .aborted_task = srpt_aborted_task, | ||
3931 | /* | 3944 | /* |
3932 | * Setup function pointers for generic logic in | 3945 | * Setup function pointers for generic logic in |
3933 | * target_core_fabric_configfs.c | 3946 | * target_core_fabric_configfs.c |