diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-09 19:53:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-09 19:53:47 -0500 |
commit | 92fff53b7191cae566be9ca6752069426c7f8241 (patch) | |
tree | 019396be4719ad3969d0395cfa0a90860be75f4a /drivers/infiniband/ulp | |
parent | a50243b1ddcdd766d0d17fbfeeb1a22e62fdc461 (diff) | |
parent | 26af1a368e40618d67956b1f883fbcfec292c5d8 (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly update of the usual drivers: arcmsr, qla2xxx, lpfc,
hisi_sas, target/iscsi and target/core.
Additionally Christoph refactored gdth as part of the dma changes. The
major mid-layer change this time is the removal of bidi commands and
with them the whole of the osd/exofs driver and filesystem. This is a
major simplification for block and mq in particular"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (240 commits)
scsi: cxgb4i: validate tcp sequence number only if chip version <= T5
scsi: cxgb4i: get pf number from lldi->pf
scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
scsi: mpt3sas: Add missing breaks in switch statements
scsi: aacraid: Fix missing break in switch statement
scsi: kill command serial number
scsi: csiostor: drop serial_number usage
scsi: mvumi: use request tag instead of serial_number
scsi: dpt_i2o: remove serial number usage
scsi: st: osst: Remove negative constant left-shifts
scsi: ufs-bsg: Allow reading descriptors
scsi: ufs: Allow reading descriptor via raw upiu
scsi: ufs-bsg: Change the calling convention for write descriptor
scsi: ufs: Remove unused device quirks
Revert "scsi: ufs: disable vccq if it's not needed by UFS device"
scsi: megaraid_sas: Remove a bunch of set but not used variables
scsi: clean obsolete return values of eh_timed_out
scsi: sd: Optimal I/O size should be a multiple of physical block size
scsi: MAINTAINERS: SCSI initiator and target tweaks
scsi: fcoe: make use of fip_mode enum complete
...
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 80 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.h | 4 |
3 files changed, 36 insertions, 50 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index e3dd13798d79..989f1ac4245c 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -1186,7 +1186,7 @@ sequence_cmd: | |||
1186 | rc = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); | 1186 | rc = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); |
1187 | 1187 | ||
1188 | if (!rc && dump_payload == false && unsol_data) | 1188 | if (!rc && dump_payload == false && unsol_data) |
1189 | iscsit_set_unsoliticed_dataout(cmd); | 1189 | iscsit_set_unsolicited_dataout(cmd); |
1190 | else if (dump_payload && imm_data) | 1190 | else if (dump_payload && imm_data) |
1191 | target_put_sess_cmd(&cmd->se_cmd); | 1191 | target_put_sess_cmd(&cmd->se_cmd); |
1192 | 1192 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index e9c336cff8f5..1a039f16d315 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -1217,22 +1217,15 @@ static int srpt_ch_qp_err(struct srpt_rdma_ch *ch) | |||
1217 | static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) | 1217 | static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) |
1218 | { | 1218 | { |
1219 | struct srpt_send_ioctx *ioctx; | 1219 | struct srpt_send_ioctx *ioctx; |
1220 | unsigned long flags; | 1220 | int tag, cpu; |
1221 | 1221 | ||
1222 | BUG_ON(!ch); | 1222 | BUG_ON(!ch); |
1223 | 1223 | ||
1224 | ioctx = NULL; | 1224 | tag = sbitmap_queue_get(&ch->sess->sess_tag_pool, &cpu); |
1225 | spin_lock_irqsave(&ch->spinlock, flags); | 1225 | if (tag < 0) |
1226 | if (!list_empty(&ch->free_list)) { | 1226 | return NULL; |
1227 | ioctx = list_first_entry(&ch->free_list, | ||
1228 | struct srpt_send_ioctx, free_list); | ||
1229 | list_del(&ioctx->free_list); | ||
1230 | } | ||
1231 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
1232 | |||
1233 | if (!ioctx) | ||
1234 | return ioctx; | ||
1235 | 1227 | ||
1228 | ioctx = ch->ioctx_ring[tag]; | ||
1236 | BUG_ON(ioctx->ch != ch); | 1229 | BUG_ON(ioctx->ch != ch); |
1237 | ioctx->state = SRPT_STATE_NEW; | 1230 | ioctx->state = SRPT_STATE_NEW; |
1238 | WARN_ON_ONCE(ioctx->recv_ioctx); | 1231 | WARN_ON_ONCE(ioctx->recv_ioctx); |
@@ -1245,6 +1238,8 @@ static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) | |||
1245 | */ | 1238 | */ |
1246 | memset(&ioctx->cmd, 0, sizeof(ioctx->cmd)); | 1239 | memset(&ioctx->cmd, 0, sizeof(ioctx->cmd)); |
1247 | memset(&ioctx->sense_data, 0, sizeof(ioctx->sense_data)); | 1240 | memset(&ioctx->sense_data, 0, sizeof(ioctx->sense_data)); |
1241 | ioctx->cmd.map_tag = tag; | ||
1242 | ioctx->cmd.map_cpu = cpu; | ||
1248 | 1243 | ||
1249 | return ioctx; | 1244 | return ioctx; |
1250 | } | 1245 | } |
@@ -1505,7 +1500,7 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, | |||
1505 | pr_err("0x%llx: parsing SRP descriptor table failed.\n", | 1500 | pr_err("0x%llx: parsing SRP descriptor table failed.\n", |
1506 | srp_cmd->tag); | 1501 | srp_cmd->tag); |
1507 | } | 1502 | } |
1508 | goto release_ioctx; | 1503 | goto busy; |
1509 | } | 1504 | } |
1510 | 1505 | ||
1511 | rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, | 1506 | rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, |
@@ -1516,13 +1511,12 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, | |||
1516 | if (rc != 0) { | 1511 | if (rc != 0) { |
1517 | pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, | 1512 | pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, |
1518 | srp_cmd->tag); | 1513 | srp_cmd->tag); |
1519 | goto release_ioctx; | 1514 | goto busy; |
1520 | } | 1515 | } |
1521 | return; | 1516 | return; |
1522 | 1517 | ||
1523 | release_ioctx: | 1518 | busy: |
1524 | send_ioctx->state = SRPT_STATE_DONE; | 1519 | target_send_busy(cmd); |
1525 | srpt_release_cmd(cmd); | ||
1526 | } | 1520 | } |
1527 | 1521 | ||
1528 | static int srp_tmr_to_tcm(int fn) | 1522 | static int srp_tmr_to_tcm(int fn) |
@@ -1582,11 +1576,9 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, | |||
1582 | TARGET_SCF_ACK_KREF); | 1576 | TARGET_SCF_ACK_KREF); |
1583 | if (rc != 0) { | 1577 | if (rc != 0) { |
1584 | send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; | 1578 | send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; |
1585 | goto fail; | 1579 | cmd->se_tfo->queue_tm_rsp(cmd); |
1586 | } | 1580 | } |
1587 | return; | 1581 | return; |
1588 | fail: | ||
1589 | transport_send_check_condition_and_sense(cmd, 0, 0); // XXX: | ||
1590 | } | 1582 | } |
1591 | 1583 | ||
1592 | /** | 1584 | /** |
@@ -2151,7 +2143,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, | |||
2151 | struct srpt_rdma_ch *ch = NULL; | 2143 | struct srpt_rdma_ch *ch = NULL; |
2152 | char i_port_id[36]; | 2144 | char i_port_id[36]; |
2153 | u32 it_iu_len; | 2145 | u32 it_iu_len; |
2154 | int i, ret; | 2146 | int i, tag_num, tag_size, ret; |
2155 | 2147 | ||
2156 | WARN_ON_ONCE(irqs_disabled()); | 2148 | WARN_ON_ONCE(irqs_disabled()); |
2157 | 2149 | ||
@@ -2251,11 +2243,8 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, | |||
2251 | goto free_rsp_cache; | 2243 | goto free_rsp_cache; |
2252 | } | 2244 | } |
2253 | 2245 | ||
2254 | INIT_LIST_HEAD(&ch->free_list); | 2246 | for (i = 0; i < ch->rq_size; i++) |
2255 | for (i = 0; i < ch->rq_size; i++) { | ||
2256 | ch->ioctx_ring[i]->ch = ch; | 2247 | ch->ioctx_ring[i]->ch = ch; |
2257 | list_add_tail(&ch->ioctx_ring[i]->free_list, &ch->free_list); | ||
2258 | } | ||
2259 | if (!sdev->use_srq) { | 2248 | if (!sdev->use_srq) { |
2260 | u16 imm_data_offset = req->req_flags & SRP_IMMED_REQUESTED ? | 2249 | u16 imm_data_offset = req->req_flags & SRP_IMMED_REQUESTED ? |
2261 | be16_to_cpu(req->imm_data_offset) : 0; | 2250 | be16_to_cpu(req->imm_data_offset) : 0; |
@@ -2309,18 +2298,20 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, | |||
2309 | 2298 | ||
2310 | pr_debug("registering session %s\n", ch->sess_name); | 2299 | pr_debug("registering session %s\n", ch->sess_name); |
2311 | 2300 | ||
2301 | tag_num = ch->rq_size; | ||
2302 | tag_size = 1; /* ib_srpt does not use se_sess->sess_cmd_map */ | ||
2312 | if (sport->port_guid_tpg.se_tpg_wwn) | 2303 | if (sport->port_guid_tpg.se_tpg_wwn) |
2313 | ch->sess = target_setup_session(&sport->port_guid_tpg, 0, 0, | 2304 | ch->sess = target_setup_session(&sport->port_guid_tpg, tag_num, |
2314 | TARGET_PROT_NORMAL, | 2305 | tag_size, TARGET_PROT_NORMAL, |
2315 | ch->sess_name, ch, NULL); | 2306 | ch->sess_name, ch, NULL); |
2316 | if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) | 2307 | if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) |
2317 | ch->sess = target_setup_session(&sport->port_gid_tpg, 0, 0, | 2308 | ch->sess = target_setup_session(&sport->port_gid_tpg, tag_num, |
2318 | TARGET_PROT_NORMAL, i_port_id, ch, | 2309 | tag_size, TARGET_PROT_NORMAL, i_port_id, |
2319 | NULL); | 2310 | ch, NULL); |
2320 | /* Retry without leading "0x" */ | 2311 | /* Retry without leading "0x" */ |
2321 | if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) | 2312 | if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) |
2322 | ch->sess = target_setup_session(&sport->port_gid_tpg, 0, 0, | 2313 | ch->sess = target_setup_session(&sport->port_gid_tpg, tag_num, |
2323 | TARGET_PROT_NORMAL, | 2314 | tag_size, TARGET_PROT_NORMAL, |
2324 | i_port_id + 2, ch, NULL); | 2315 | i_port_id + 2, ch, NULL); |
2325 | if (IS_ERR_OR_NULL(ch->sess)) { | 2316 | if (IS_ERR_OR_NULL(ch->sess)) { |
2326 | WARN_ON_ONCE(ch->sess == NULL); | 2317 | WARN_ON_ONCE(ch->sess == NULL); |
@@ -2703,14 +2694,6 @@ static int srpt_rdma_cm_handler(struct rdma_cm_id *cm_id, | |||
2703 | return ret; | 2694 | return ret; |
2704 | } | 2695 | } |
2705 | 2696 | ||
2706 | static int srpt_write_pending_status(struct se_cmd *se_cmd) | ||
2707 | { | ||
2708 | struct srpt_send_ioctx *ioctx; | ||
2709 | |||
2710 | ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); | ||
2711 | return ioctx->state == SRPT_STATE_NEED_DATA; | ||
2712 | } | ||
2713 | |||
2714 | /* | 2697 | /* |
2715 | * srpt_write_pending - Start data transfer from initiator to target (write). | 2698 | * srpt_write_pending - Start data transfer from initiator to target (write). |
2716 | */ | 2699 | */ |
@@ -2887,8 +2870,19 @@ static void srpt_queue_tm_rsp(struct se_cmd *cmd) | |||
2887 | srpt_queue_response(cmd); | 2870 | srpt_queue_response(cmd); |
2888 | } | 2871 | } |
2889 | 2872 | ||
2873 | /* | ||
2874 | * This function is called for aborted commands if no response is sent to the | ||
2875 | * initiator. Make sure that the credits freed by aborting a command are | ||
2876 | * returned to the initiator the next time a response is sent by incrementing | ||
2877 | * ch->req_lim_delta. | ||
2878 | */ | ||
2890 | static void srpt_aborted_task(struct se_cmd *cmd) | 2879 | static void srpt_aborted_task(struct se_cmd *cmd) |
2891 | { | 2880 | { |
2881 | struct srpt_send_ioctx *ioctx = container_of(cmd, | ||
2882 | struct srpt_send_ioctx, cmd); | ||
2883 | struct srpt_rdma_ch *ch = ioctx->ch; | ||
2884 | |||
2885 | atomic_inc(&ch->req_lim_delta); | ||
2892 | } | 2886 | } |
2893 | 2887 | ||
2894 | static int srpt_queue_status(struct se_cmd *cmd) | 2888 | static int srpt_queue_status(struct se_cmd *cmd) |
@@ -3290,7 +3284,6 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) | |||
3290 | struct srpt_send_ioctx, cmd); | 3284 | struct srpt_send_ioctx, cmd); |
3291 | struct srpt_rdma_ch *ch = ioctx->ch; | 3285 | struct srpt_rdma_ch *ch = ioctx->ch; |
3292 | struct srpt_recv_ioctx *recv_ioctx = ioctx->recv_ioctx; | 3286 | struct srpt_recv_ioctx *recv_ioctx = ioctx->recv_ioctx; |
3293 | unsigned long flags; | ||
3294 | 3287 | ||
3295 | WARN_ON_ONCE(ioctx->state != SRPT_STATE_DONE && | 3288 | WARN_ON_ONCE(ioctx->state != SRPT_STATE_DONE && |
3296 | !(ioctx->cmd.transport_state & CMD_T_ABORTED)); | 3289 | !(ioctx->cmd.transport_state & CMD_T_ABORTED)); |
@@ -3306,9 +3299,7 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) | |||
3306 | ioctx->n_rw_ctx = 0; | 3299 | ioctx->n_rw_ctx = 0; |
3307 | } | 3300 | } |
3308 | 3301 | ||
3309 | spin_lock_irqsave(&ch->spinlock, flags); | 3302 | target_free_tag(se_cmd->se_sess, se_cmd); |
3310 | list_add(&ioctx->free_list, &ch->free_list); | ||
3311 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
3312 | } | 3303 | } |
3313 | 3304 | ||
3314 | /** | 3305 | /** |
@@ -3806,7 +3797,6 @@ static const struct target_core_fabric_ops srpt_template = { | |||
3806 | .sess_get_index = srpt_sess_get_index, | 3797 | .sess_get_index = srpt_sess_get_index, |
3807 | .sess_get_initiator_sid = NULL, | 3798 | .sess_get_initiator_sid = NULL, |
3808 | .write_pending = srpt_write_pending, | 3799 | .write_pending = srpt_write_pending, |
3809 | .write_pending_status = srpt_write_pending_status, | ||
3810 | .set_default_node_attributes = srpt_set_default_node_attrs, | 3800 | .set_default_node_attributes = srpt_set_default_node_attrs, |
3811 | .get_cmd_state = srpt_get_tcm_cmd_state, | 3801 | .get_cmd_state = srpt_get_tcm_cmd_state, |
3812 | .queue_data_in = srpt_queue_data_in, | 3802 | .queue_data_in = srpt_queue_data_in, |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index 39b3e50baf3d..ee9f20e9177a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h | |||
@@ -207,7 +207,6 @@ struct srpt_rw_ctx { | |||
207 | * @rw_ctxs: RDMA read/write contexts. | 207 | * @rw_ctxs: RDMA read/write contexts. |
208 | * @imm_sg: Scatterlist for immediate data. | 208 | * @imm_sg: Scatterlist for immediate data. |
209 | * @rdma_cqe: RDMA completion queue element. | 209 | * @rdma_cqe: RDMA completion queue element. |
210 | * @free_list: Node in srpt_rdma_ch.free_list. | ||
211 | * @state: I/O context state. | 210 | * @state: I/O context state. |
212 | * @cmd: Target core command data structure. | 211 | * @cmd: Target core command data structure. |
213 | * @sense_data: SCSI sense data. | 212 | * @sense_data: SCSI sense data. |
@@ -227,7 +226,6 @@ struct srpt_send_ioctx { | |||
227 | struct scatterlist imm_sg; | 226 | struct scatterlist imm_sg; |
228 | 227 | ||
229 | struct ib_cqe rdma_cqe; | 228 | struct ib_cqe rdma_cqe; |
230 | struct list_head free_list; | ||
231 | enum srpt_command_state state; | 229 | enum srpt_command_state state; |
232 | struct se_cmd cmd; | 230 | struct se_cmd cmd; |
233 | u8 n_rdma; | 231 | u8 n_rdma; |
@@ -277,7 +275,6 @@ enum rdma_ch_state { | |||
277 | * @req_lim_delta: Number of credits not yet sent back to the initiator. | 275 | * @req_lim_delta: Number of credits not yet sent back to the initiator. |
278 | * @imm_data_offset: Offset from start of SRP_CMD for immediate data. | 276 | * @imm_data_offset: Offset from start of SRP_CMD for immediate data. |
279 | * @spinlock: Protects free_list and state. | 277 | * @spinlock: Protects free_list and state. |
280 | * @free_list: Head of list with free send I/O contexts. | ||
281 | * @state: channel state. See also enum rdma_ch_state. | 278 | * @state: channel state. See also enum rdma_ch_state. |
282 | * @using_rdma_cm: Whether the RDMA/CM or IB/CM is used for this channel. | 279 | * @using_rdma_cm: Whether the RDMA/CM or IB/CM is used for this channel. |
283 | * @processing_wait_list: Whether or not cmd_wait_list is being processed. | 280 | * @processing_wait_list: Whether or not cmd_wait_list is being processed. |
@@ -318,7 +315,6 @@ struct srpt_rdma_ch { | |||
318 | atomic_t req_lim_delta; | 315 | atomic_t req_lim_delta; |
319 | u16 imm_data_offset; | 316 | u16 imm_data_offset; |
320 | spinlock_t spinlock; | 317 | spinlock_t spinlock; |
321 | struct list_head free_list; | ||
322 | enum rdma_ch_state state; | 318 | enum rdma_ch_state state; |
323 | struct kmem_cache *rsp_buf_cache; | 319 | struct kmem_cache *rsp_buf_cache; |
324 | struct srpt_send_ioctx **ioctx_ring; | 320 | struct srpt_send_ioctx **ioctx_ring; |