aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-21 16:06:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-21 16:06:38 -0400
commitc3351dfabf5c78fb5ddc79d0f7b65ebd9e441337 (patch)
tree032d5b9c844577c7ca2d4937d6a33e189c64c9f9 /drivers/scsi
parent848a552893ff1fe071c57231edcd179cf84ec4f8 (diff)
parent62d3ab49b8a5438d11a11605ea1a6d2fe0118f32 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Here are the target updates for v3.18-rc2 code. These where originally destined for -rc1, but due to the combination of travel last week for KVM Forum and my mistake of taking the three week merge window literally, the pull request slipped.. Apologies for that. Things where reasonably quiet this round. The highlights include: - New userspace backend driver (target_core_user.ko) by Shaohua Li and Andy Grover - A number of cleanups in target, iscsi-taret and qla_target code from Joern Engel - Fix an OOPs related to queue full handling with CHECK_CONDITION status from Quinn Tran - Fix to disable TX completion interrupt coalescing in iser-target, that was causing problems on some hardware - Fix for PR APTPL metadata handling with demo-mode ACLs I'm most excited about the new backend driver that uses UIO + shared memory ring to dispatch I/O and control commands into user-space. This was probably the most requested feature by users over the last couple of years, and opens up a new area of development + porting of existing user-space storage applications to LIO. Thanks to Shaohua + Andy for making this happen. Also another honorable mention, a new Xen PV SCSI driver was merged via the xen/tip.git tree recently, which puts us now at 10 target drivers in upstream! Thanks to David Vrabel + Juergen Gross for their work to get this code merged" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (40 commits) target/file: fix inclusive vfs_fsync_range() end iser-target: Disable TX completion interrupt coalescing target: Add force_pr_aptpl device attribute target: Fix APTPL metadata handling for dynamic MappedLUNs qla_target: don't delete changed nacls target/user: Recalculate pad size inside is_ring_space_avail() tcm_loop: Fixup tag handling iser-target: Fix smatch warning target/user: Fix up smatch warnings in tcmu_netlink_event target: Add a user-passthrough backstore target: Add documentation on the target userspace pass-through driver uio: Export definition of struct uio_device target: Remove unneeded check in sbc_parse_cdb target: Fix queue full status NULL pointer for SCF_TRANSPORT_TASK_SENSE qla_target: rearrange struct qla_tgt_prm qla_target: improve qlt_unmap_sg() qla_target: make some global functions static qla_target: remove unused parameter target: simplify core_tmr_abort_task target: encapsulate smp_mb__after_atomic() ...
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c35
-rw-r--r--drivers/scsi/qla2xxx/qla_target.h12
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c11
3 files changed, 27 insertions, 31 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 829752cfd73f..a902fa1db7af 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -112,6 +112,7 @@ static void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha,
112 struct qla_tgt_cmd *cmd); 112 struct qla_tgt_cmd *cmd);
113static void qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, 113static void qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
114 struct atio_from_isp *atio, uint16_t status, int qfull); 114 struct atio_from_isp *atio, uint16_t status, int qfull);
115static void qlt_disable_vha(struct scsi_qla_host *vha);
115/* 116/*
116 * Global Variables 117 * Global Variables
117 */ 118 */
@@ -210,7 +211,7 @@ static inline void qlt_decr_num_pend_cmds(struct scsi_qla_host *vha)
210 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); 211 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags);
211} 212}
212 213
213void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, 214static void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha,
214 struct atio_from_isp *atio) 215 struct atio_from_isp *atio)
215{ 216{
216 ql_dbg(ql_dbg_tgt, vha, 0xe072, 217 ql_dbg(ql_dbg_tgt, vha, 0xe072,
@@ -433,7 +434,7 @@ static int qlt_reset(struct scsi_qla_host *vha, void *iocb, int mcmd)
433#if 0 /* FIXME: Re-enable Global event handling.. */ 434#if 0 /* FIXME: Re-enable Global event handling.. */
434 /* Global event */ 435 /* Global event */
435 atomic_inc(&ha->tgt.qla_tgt->tgt_global_resets_count); 436 atomic_inc(&ha->tgt.qla_tgt->tgt_global_resets_count);
436 qlt_clear_tgt_db(ha->tgt.qla_tgt, 1); 437 qlt_clear_tgt_db(ha->tgt.qla_tgt);
437 if (!list_empty(&ha->tgt.qla_tgt->sess_list)) { 438 if (!list_empty(&ha->tgt.qla_tgt->sess_list)) {
438 sess = list_entry(ha->tgt.qla_tgt->sess_list.next, 439 sess = list_entry(ha->tgt.qla_tgt->sess_list.next,
439 typeof(*sess), sess_list_entry); 440 typeof(*sess), sess_list_entry);
@@ -515,7 +516,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess,
515} 516}
516 517
517/* ha->hardware_lock supposed to be held on entry */ 518/* ha->hardware_lock supposed to be held on entry */
518static void qlt_clear_tgt_db(struct qla_tgt *tgt, bool local_only) 519static void qlt_clear_tgt_db(struct qla_tgt *tgt)
519{ 520{
520 struct qla_tgt_sess *sess; 521 struct qla_tgt_sess *sess;
521 522
@@ -867,7 +868,7 @@ int qlt_stop_phase1(struct qla_tgt *tgt)
867 mutex_lock(&vha->vha_tgt.tgt_mutex); 868 mutex_lock(&vha->vha_tgt.tgt_mutex);
868 spin_lock_irqsave(&ha->hardware_lock, flags); 869 spin_lock_irqsave(&ha->hardware_lock, flags);
869 tgt->tgt_stop = 1; 870 tgt->tgt_stop = 1;
870 qlt_clear_tgt_db(tgt, true); 871 qlt_clear_tgt_db(tgt);
871 spin_unlock_irqrestore(&ha->hardware_lock, flags); 872 spin_unlock_irqrestore(&ha->hardware_lock, flags);
872 mutex_unlock(&vha->vha_tgt.tgt_mutex); 873 mutex_unlock(&vha->vha_tgt.tgt_mutex);
873 mutex_unlock(&qla_tgt_mutex); 874 mutex_unlock(&qla_tgt_mutex);
@@ -1462,12 +1463,13 @@ out_err:
1462 return -1; 1463 return -1;
1463} 1464}
1464 1465
1465static inline void qlt_unmap_sg(struct scsi_qla_host *vha, 1466static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
1466 struct qla_tgt_cmd *cmd)
1467{ 1467{
1468 struct qla_hw_data *ha = vha->hw; 1468 struct qla_hw_data *ha = vha->hw;
1469 1469
1470 BUG_ON(!cmd->sg_mapped); 1470 if (!cmd->sg_mapped)
1471 return;
1472
1471 pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction); 1473 pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction);
1472 cmd->sg_mapped = 0; 1474 cmd->sg_mapped = 0;
1473 1475
@@ -2428,8 +2430,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
2428 return 0; 2430 return 0;
2429 2431
2430out_unmap_unlock: 2432out_unmap_unlock:
2431 if (cmd->sg_mapped) 2433 qlt_unmap_sg(vha, cmd);
2432 qlt_unmap_sg(vha, cmd);
2433 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2434 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2434 2435
2435 return res; 2436 return res;
@@ -2506,8 +2507,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
2506 return res; 2507 return res;
2507 2508
2508out_unlock_free_unmap: 2509out_unlock_free_unmap:
2509 if (cmd->sg_mapped) 2510 qlt_unmap_sg(vha, cmd);
2510 qlt_unmap_sg(vha, cmd);
2511 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2511 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2512 2512
2513 return res; 2513 return res;
@@ -2741,8 +2741,7 @@ done:
2741 if (!ha_locked && !in_interrupt()) 2741 if (!ha_locked && !in_interrupt())
2742 msleep(250); /* just in case */ 2742 msleep(250); /* just in case */
2743 2743
2744 if (cmd->sg_mapped) 2744 qlt_unmap_sg(vha, cmd);
2745 qlt_unmap_sg(vha, cmd);
2746 vha->hw->tgt.tgt_ops->free_cmd(cmd); 2745 vha->hw->tgt.tgt_ops->free_cmd(cmd);
2747 } 2746 }
2748 return; 2747 return;
@@ -3087,8 +3086,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle,
3087 tfo = se_cmd->se_tfo; 3086 tfo = se_cmd->se_tfo;
3088 cmd->cmd_sent_to_fw = 0; 3087 cmd->cmd_sent_to_fw = 0;
3089 3088
3090 if (cmd->sg_mapped) 3089 qlt_unmap_sg(vha, cmd);
3091 qlt_unmap_sg(vha, cmd);
3092 3090
3093 if (unlikely(status != CTIO_SUCCESS)) { 3091 if (unlikely(status != CTIO_SUCCESS)) {
3094 switch (status & 0xFFFF) { 3092 switch (status & 0xFFFF) {
@@ -5343,7 +5341,7 @@ void qlt_lport_deregister(struct scsi_qla_host *vha)
5343EXPORT_SYMBOL(qlt_lport_deregister); 5341EXPORT_SYMBOL(qlt_lport_deregister);
5344 5342
5345/* Must be called under HW lock */ 5343/* Must be called under HW lock */
5346void qlt_set_mode(struct scsi_qla_host *vha) 5344static void qlt_set_mode(struct scsi_qla_host *vha)
5347{ 5345{
5348 struct qla_hw_data *ha = vha->hw; 5346 struct qla_hw_data *ha = vha->hw;
5349 5347
@@ -5364,7 +5362,7 @@ void qlt_set_mode(struct scsi_qla_host *vha)
5364} 5362}
5365 5363
5366/* Must be called under HW lock */ 5364/* Must be called under HW lock */
5367void qlt_clear_mode(struct scsi_qla_host *vha) 5365static void qlt_clear_mode(struct scsi_qla_host *vha)
5368{ 5366{
5369 struct qla_hw_data *ha = vha->hw; 5367 struct qla_hw_data *ha = vha->hw;
5370 5368
@@ -5428,8 +5426,7 @@ EXPORT_SYMBOL(qlt_enable_vha);
5428 * 5426 *
5429 * Disable Target Mode and reset the adapter 5427 * Disable Target Mode and reset the adapter
5430 */ 5428 */
5431void 5429static void qlt_disable_vha(struct scsi_qla_host *vha)
5432qlt_disable_vha(struct scsi_qla_host *vha)
5433{ 5430{
5434 struct qla_hw_data *ha = vha->hw; 5431 struct qla_hw_data *ha = vha->hw;
5435 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; 5432 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 8ff330f7d6f5..332086776dfe 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -1001,11 +1001,11 @@ struct qla_tgt_prm {
1001 struct qla_tgt *tgt; 1001 struct qla_tgt *tgt;
1002 void *pkt; 1002 void *pkt;
1003 struct scatterlist *sg; /* cmd data buffer SG vector */ 1003 struct scatterlist *sg; /* cmd data buffer SG vector */
1004 unsigned char *sense_buffer;
1004 int seg_cnt; 1005 int seg_cnt;
1005 int req_cnt; 1006 int req_cnt;
1006 uint16_t rq_result; 1007 uint16_t rq_result;
1007 uint16_t scsi_status; 1008 uint16_t scsi_status;
1008 unsigned char *sense_buffer;
1009 int sense_buffer_len; 1009 int sense_buffer_len;
1010 int residual; 1010 int residual;
1011 int add_status_pkt; 1011 int add_status_pkt;
@@ -1033,10 +1033,6 @@ struct qla_tgt_srr_ctio {
1033 1033
1034 1034
1035extern struct qla_tgt_data qla_target; 1035extern struct qla_tgt_data qla_target;
1036/*
1037 * Internal function prototypes
1038 */
1039void qlt_disable_vha(struct scsi_qla_host *);
1040 1036
1041/* 1037/*
1042 * Function prototypes for qla_target.c logic used by qla2xxx LLD code. 1038 * Function prototypes for qla_target.c logic used by qla2xxx LLD code.
@@ -1049,8 +1045,6 @@ extern void qlt_lport_deregister(struct scsi_qla_host *);
1049extern void qlt_unreg_sess(struct qla_tgt_sess *); 1045extern void qlt_unreg_sess(struct qla_tgt_sess *);
1050extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *); 1046extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *);
1051extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *); 1047extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *);
1052extern void qlt_set_mode(struct scsi_qla_host *ha);
1053extern void qlt_clear_mode(struct scsi_qla_host *ha);
1054extern int __init qlt_init(void); 1048extern int __init qlt_init(void);
1055extern void qlt_exit(void); 1049extern void qlt_exit(void);
1056extern void qlt_update_vp_map(struct scsi_qla_host *, int); 1050extern void qlt_update_vp_map(struct scsi_qla_host *, int);
@@ -1083,13 +1077,9 @@ static inline void qla_reverse_ini_mode(struct scsi_qla_host *ha)
1083/* 1077/*
1084 * Exported symbols from qla_target.c LLD logic used by qla2xxx code.. 1078 * Exported symbols from qla_target.c LLD logic used by qla2xxx code..
1085 */ 1079 */
1086extern void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *,
1087 struct atio_from_isp *);
1088extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); 1080extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *);
1089extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); 1081extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *);
1090extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); 1082extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t);
1091extern int qlt_rdy_to_xfer_dif(struct qla_tgt_cmd *);
1092extern int qlt_xmit_response_dif(struct qla_tgt_cmd *, int, uint8_t);
1093extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); 1083extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
1094extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); 1084extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
1095extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); 1085extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 031b2961c6b7..73f9feecda72 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -786,7 +786,16 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess)
786 pr_debug("fc_rport domain: port_id 0x%06x\n", nacl->nport_id); 786 pr_debug("fc_rport domain: port_id 0x%06x\n", nacl->nport_id);
787 787
788 node = btree_remove32(&lport->lport_fcport_map, nacl->nport_id); 788 node = btree_remove32(&lport->lport_fcport_map, nacl->nport_id);
789 WARN_ON(node && (node != se_nacl)); 789 if (WARN_ON(node && (node != se_nacl))) {
790 /*
791 * The nacl no longer matches what we think it should be.
792 * Most likely a new dynamic acl has been added while
793 * someone dropped the hardware lock. It clearly is a
794 * bug elsewhere, but this bit can't make things worse.
795 */
796 btree_insert32(&lport->lport_fcport_map, nacl->nport_id,
797 node, GFP_ATOMIC);
798 }
790 799
791 pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n", 800 pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n",
792 se_nacl, nacl->nport_wwnn, nacl->nport_id); 801 se_nacl, nacl->nport_wwnn, nacl->nport_id);