summaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 22:00:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 22:00:42 -0400
commit05c78081d2d8eaf04bf60946fcc53380febf3376 (patch)
tree0ba735378eb44380c916c075e4fe17d74f3889c5 /include/target
parent8e78b7dc93c580c050435b0f88991c26e02166bc (diff)
parentac64a2ce509104a746321a4f9646b6750cf281eb (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 outstanding target-pending updates for v4.3-rc1. Mostly bug-fixes and minor changes this round. The fallout from the big v4.2-rc1 RCU conversion have (thus far) been minimal. The highlights this round include: - Move sense handling routines into scsi_common code (Sagi) - Return ABORTED_COMMAND sense key for PI errors (Sagi) - Add tpg_enabled_sendtargets attribute for disabled iscsi-target discovery (David) - Shrink target struct se_cmd by rearranging fields (Roland) - Drop iSCSI use of mutex around max_cmd_sn increment (Roland) - Replace iSCSI __kernel_sockaddr_storage with sockaddr_storage (Andy + Chris) - Honor fabric max_data_sg_nents I/O transfer limit (Arun + Himanshu + nab) - Fix EXTENDED_COPY >= v4.1 regression OOPsen (Alex + nab)" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (37 commits) target: use stringify.h instead of own definition target/user: Fix UFLAG_UNKNOWN_OP handling target: Remove no-op conditional target/user: Remove unused variable target: Fix max_cmd_sn increment w/o cmdsn mutex regressions target: Attach EXTENDED_COPY local I/O descriptors to xcopy_pt_sess target/qla2xxx: Honor max_data_sg_nents I/O transfer limit target/iscsi: Replace __kernel_sockaddr_storage with sockaddr_storage target/iscsi: Replace conn->login_ip with login_sockaddr target/iscsi: Keep local_ip as the actual sockaddr target/iscsi: Fix np_ip bracket issue by removing np_ip target: Drop iSCSI use of mutex around max_cmd_sn increment qla2xxx: Update tcm_qla2xxx module description to 24xx+ iscsi-target: Add tpg_enabled_sendtargets for disabled discovery drivers: target: Drop unlikely before IS_ERR(_OR_NULL) target: check DPO/FUA usage for COMPARE AND WRITE target: Shrink struct se_cmd by rearranging fields target: Remove cmd->se_ordered_id (unused except debug log lines) target: add support for START_STOP_UNIT SCSI opcode target: improve unsupported opcode message ...
Diffstat (limited to 'include/target')
-rw-r--r--include/target/iscsi/iscsi_target_core.h15
-rw-r--r--include/target/iscsi/iscsi_target_stat.h2
-rw-r--r--include/target/iscsi/iscsi_transport.h2
-rw-r--r--include/target/target_core_backend.h2
-rw-r--r--include/target/target_core_base.h27
-rw-r--r--include/target/target_core_fabric.h14
6 files changed, 34 insertions, 28 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index 0aedbb2c10e0..373d3342002b 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -62,6 +62,8 @@
62/* T10 protection information disabled by default */ 62/* T10 protection information disabled by default */
63#define TA_DEFAULT_T10_PI 0 63#define TA_DEFAULT_T10_PI 0
64#define TA_DEFAULT_FABRIC_PROT_TYPE 0 64#define TA_DEFAULT_FABRIC_PROT_TYPE 0
65/* TPG status needs to be enabled to return sendtargets discovery endpoint info */
66#define TA_DEFAULT_TPG_ENABLED_SENDTARGETS 1
65 67
66#define ISCSI_IOV_DATA_BUFFER 5 68#define ISCSI_IOV_DATA_BUFFER 5
67 69
@@ -517,7 +519,6 @@ struct iscsi_conn {
517 u16 cid; 519 u16 cid;
518 /* Remote TCP Port */ 520 /* Remote TCP Port */
519 u16 login_port; 521 u16 login_port;
520 u16 local_port;
521 int net_size; 522 int net_size;
522 int login_family; 523 int login_family;
523 u32 auth_id; 524 u32 auth_id;
@@ -527,9 +528,8 @@ struct iscsi_conn {
527 u32 exp_statsn; 528 u32 exp_statsn;
528 /* Per connection status sequence number */ 529 /* Per connection status sequence number */
529 u32 stat_sn; 530 u32 stat_sn;
530#define IPV6_ADDRESS_SPACE 48 531 struct sockaddr_storage login_sockaddr;
531 unsigned char login_ip[IPV6_ADDRESS_SPACE]; 532 struct sockaddr_storage local_sockaddr;
532 unsigned char local_ip[IPV6_ADDRESS_SPACE];
533 int conn_usage_count; 533 int conn_usage_count;
534 int conn_waiting_on_uc; 534 int conn_waiting_on_uc;
535 atomic_t check_immediate_queue; 535 atomic_t check_immediate_queue;
@@ -636,7 +636,7 @@ struct iscsi_session {
636 /* session wide counter: expected command sequence number */ 636 /* session wide counter: expected command sequence number */
637 u32 exp_cmd_sn; 637 u32 exp_cmd_sn;
638 /* session wide counter: maximum allowed command sequence number */ 638 /* session wide counter: maximum allowed command sequence number */
639 u32 max_cmd_sn; 639 atomic_t max_cmd_sn;
640 struct list_head sess_ooo_cmdsn_list; 640 struct list_head sess_ooo_cmdsn_list;
641 641
642 /* LIO specific session ID */ 642 /* LIO specific session ID */
@@ -764,6 +764,7 @@ struct iscsi_tpg_attrib {
764 u32 default_erl; 764 u32 default_erl;
765 u8 t10_pi; 765 u8 t10_pi;
766 u32 fabric_prot_type; 766 u32 fabric_prot_type;
767 u32 tpg_enabled_sendtargets;
767 struct iscsi_portal_group *tpg; 768 struct iscsi_portal_group *tpg;
768}; 769};
769 770
@@ -776,12 +777,10 @@ struct iscsi_np {
776 enum iscsi_timer_flags_table np_login_timer_flags; 777 enum iscsi_timer_flags_table np_login_timer_flags;
777 u32 np_exports; 778 u32 np_exports;
778 enum np_flags_table np_flags; 779 enum np_flags_table np_flags;
779 unsigned char np_ip[IPV6_ADDRESS_SPACE];
780 u16 np_port;
781 spinlock_t np_thread_lock; 780 spinlock_t np_thread_lock;
782 struct completion np_restart_comp; 781 struct completion np_restart_comp;
783 struct socket *np_socket; 782 struct socket *np_socket;
784 struct __kernel_sockaddr_storage np_sockaddr; 783 struct sockaddr_storage np_sockaddr;
785 struct task_struct *np_thread; 784 struct task_struct *np_thread;
786 struct timer_list np_login_timer; 785 struct timer_list np_login_timer;
787 void *np_context; 786 void *np_context;
diff --git a/include/target/iscsi/iscsi_target_stat.h b/include/target/iscsi/iscsi_target_stat.h
index 3ff76b4faad3..e615bb485d0b 100644
--- a/include/target/iscsi/iscsi_target_stat.h
+++ b/include/target/iscsi/iscsi_target_stat.h
@@ -50,7 +50,7 @@ struct iscsi_login_stats {
50 u64 last_fail_time; /* time stamp (jiffies) */ 50 u64 last_fail_time; /* time stamp (jiffies) */
51 u32 last_fail_type; 51 u32 last_fail_type;
52 int last_intr_fail_ip_family; 52 int last_intr_fail_ip_family;
53 unsigned char last_intr_fail_ip_addr[IPV6_ADDRESS_SPACE]; 53 struct sockaddr_storage last_intr_fail_sockaddr;
54 char last_intr_fail_name[224]; 54 char last_intr_fail_name[224];
55} ____cacheline_aligned; 55} ____cacheline_aligned;
56 56
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index e6bb166f12c2..90e37faa2ede 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -9,7 +9,7 @@ struct iscsit_transport {
9 int priv_size; 9 int priv_size;
10 struct module *owner; 10 struct module *owner;
11 struct list_head t_node; 11 struct list_head t_node;
12 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); 12 int (*iscsit_setup_np)(struct iscsi_np *, struct sockaddr_storage *);
13 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); 13 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *);
14 void (*iscsit_free_np)(struct iscsi_np *); 14 void (*iscsit_free_np)(struct iscsi_np *);
15 void (*iscsit_wait_conn)(struct iscsi_conn *); 15 void (*iscsit_wait_conn)(struct iscsi_conn *);
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 1e5c8f949bae..56cf8e485ef2 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -93,4 +93,6 @@ bool target_lun_is_rdonly(struct se_cmd *);
93sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, 93sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd,
94 sense_reason_t (*exec_cmd)(struct se_cmd *cmd)); 94 sense_reason_t (*exec_cmd)(struct se_cmd *cmd));
95 95
96bool target_sense_desc_format(struct se_device *dev);
97
96#endif /* TARGET_CORE_BACKEND_H */ 98#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 17ae2d6a4891..ac9bf1c0e42d 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -6,6 +6,7 @@
6#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
7#include <linux/blkdev.h> 7#include <linux/blkdev.h>
8#include <linux/percpu_ida.h> 8#include <linux/percpu_ida.h>
9#include <linux/t10-pi.h>
9#include <net/sock.h> 10#include <net/sock.h>
10#include <net/tcp.h> 11#include <net/tcp.h>
11 12
@@ -426,12 +427,6 @@ enum target_core_dif_check {
426 TARGET_DIF_CHECK_REFTAG = 0x1 << 2, 427 TARGET_DIF_CHECK_REFTAG = 0x1 << 2,
427}; 428};
428 429
429struct se_dif_v1_tuple {
430 __be16 guard_tag;
431 __be16 app_tag;
432 __be32 ref_tag;
433};
434
435/* for sam_task_attr */ 430/* for sam_task_attr */
436#define TCM_SIMPLE_TAG 0x20 431#define TCM_SIMPLE_TAG 0x20
437#define TCM_HEAD_TAG 0x21 432#define TCM_HEAD_TAG 0x21
@@ -444,6 +439,9 @@ struct se_cmd {
444 u8 scsi_asc; 439 u8 scsi_asc;
445 u8 scsi_ascq; 440 u8 scsi_ascq;
446 u16 scsi_sense_length; 441 u16 scsi_sense_length;
442 unsigned cmd_wait_set:1;
443 unsigned unknown_data_length:1;
444 bool state_active:1;
447 u64 tag; /* SAM command identifier aka task tag */ 445 u64 tag; /* SAM command identifier aka task tag */
448 /* Delay for ALUA Active/NonOptimized state access in milliseconds */ 446 /* Delay for ALUA Active/NonOptimized state access in milliseconds */
449 int alua_nonop_delay; 447 int alua_nonop_delay;
@@ -455,11 +453,8 @@ struct se_cmd {
455 unsigned int map_tag; 453 unsigned int map_tag;
456 /* Transport protocol dependent state, see transport_state_table */ 454 /* Transport protocol dependent state, see transport_state_table */
457 enum transport_state_table t_state; 455 enum transport_state_table t_state;
458 unsigned cmd_wait_set:1;
459 unsigned unknown_data_length:1;
460 /* See se_cmd_flags_table */ 456 /* See se_cmd_flags_table */
461 u32 se_cmd_flags; 457 u32 se_cmd_flags;
462 u32 se_ordered_id;
463 /* Total size in bytes associated with command */ 458 /* Total size in bytes associated with command */
464 u32 data_length; 459 u32 data_length;
465 u32 residual_count; 460 u32 residual_count;
@@ -477,7 +472,6 @@ struct se_cmd {
477 struct se_tmr_req *se_tmr_req; 472 struct se_tmr_req *se_tmr_req;
478 struct list_head se_cmd_list; 473 struct list_head se_cmd_list;
479 struct completion cmd_wait_comp; 474 struct completion cmd_wait_comp;
480 struct kref cmd_kref;
481 const struct target_core_fabric_ops *se_tfo; 475 const struct target_core_fabric_ops *se_tfo;
482 sense_reason_t (*execute_cmd)(struct se_cmd *); 476 sense_reason_t (*execute_cmd)(struct se_cmd *);
483 sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool); 477 sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
@@ -497,6 +491,7 @@ struct se_cmd {
497#define CMD_T_REQUEST_STOP (1 << 8) 491#define CMD_T_REQUEST_STOP (1 << 8)
498#define CMD_T_BUSY (1 << 9) 492#define CMD_T_BUSY (1 << 9)
499 spinlock_t t_state_lock; 493 spinlock_t t_state_lock;
494 struct kref cmd_kref;
500 struct completion t_transport_stop_comp; 495 struct completion t_transport_stop_comp;
501 496
502 struct work_struct work; 497 struct work_struct work;
@@ -509,8 +504,10 @@ struct se_cmd {
509 struct scatterlist *t_bidi_data_sg; 504 struct scatterlist *t_bidi_data_sg;
510 unsigned int t_bidi_data_nents; 505 unsigned int t_bidi_data_nents;
511 506
507 /* Used for lun->lun_ref counting */
508 int lun_ref_active;
509
512 struct list_head state_list; 510 struct list_head state_list;
513 bool state_active;
514 511
515 /* old task stop completion, consider merging with some of the above */ 512 /* old task stop completion, consider merging with some of the above */
516 struct completion task_stop_comp; 513 struct completion task_stop_comp;
@@ -518,20 +515,17 @@ struct se_cmd {
518 /* backend private data */ 515 /* backend private data */
519 void *priv; 516 void *priv;
520 517
521 /* Used for lun->lun_ref counting */
522 int lun_ref_active;
523
524 /* DIF related members */ 518 /* DIF related members */
525 enum target_prot_op prot_op; 519 enum target_prot_op prot_op;
526 enum target_prot_type prot_type; 520 enum target_prot_type prot_type;
527 u8 prot_checks; 521 u8 prot_checks;
522 bool prot_pto;
528 u32 prot_length; 523 u32 prot_length;
529 u32 reftag_seed; 524 u32 reftag_seed;
530 struct scatterlist *t_prot_sg; 525 struct scatterlist *t_prot_sg;
531 unsigned int t_prot_nents; 526 unsigned int t_prot_nents;
532 sense_reason_t pi_err; 527 sense_reason_t pi_err;
533 sector_t bad_sector; 528 sector_t bad_sector;
534 bool prot_pto;
535}; 529};
536 530
537struct se_ua { 531struct se_ua {
@@ -598,7 +592,6 @@ struct se_ml_stat_grps {
598}; 592};
599 593
600struct se_lun_acl { 594struct se_lun_acl {
601 char initiatorname[TRANSPORT_IQN_LEN];
602 u64 mapped_lun; 595 u64 mapped_lun;
603 struct se_node_acl *se_lun_nacl; 596 struct se_node_acl *se_lun_nacl;
604 struct se_lun *se_lun; 597 struct se_lun *se_lun;
@@ -685,7 +678,6 @@ struct se_lun {
685#define SE_LUN_LINK_MAGIC 0xffff7771 678#define SE_LUN_LINK_MAGIC 0xffff7771
686 u32 lun_link_magic; 679 u32 lun_link_magic;
687 u32 lun_access; 680 u32 lun_access;
688 u32 lun_flags;
689 u32 lun_index; 681 u32 lun_index;
690 682
691 /* RELATIVE TARGET PORT IDENTIFER */ 683 /* RELATIVE TARGET PORT IDENTIFER */
@@ -751,7 +743,6 @@ struct se_device {
751 atomic_long_t write_bytes; 743 atomic_long_t write_bytes;
752 /* Active commands on this virtual SE device */ 744 /* Active commands on this virtual SE device */
753 atomic_t simple_cmds; 745 atomic_t simple_cmds;
754 atomic_t dev_ordered_id;
755 atomic_t dev_ordered_sync; 746 atomic_t dev_ordered_sync;
756 atomic_t dev_qf_count; 747 atomic_t dev_qf_count;
757 u32 export_count; 748 u32 export_count;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 18afef91b447..7fb2557a760e 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -5,6 +5,19 @@ struct target_core_fabric_ops {
5 struct module *module; 5 struct module *module;
6 const char *name; 6 const char *name;
7 size_t node_acl_size; 7 size_t node_acl_size;
8 /*
9 * Limits number of scatterlist entries per SCF_SCSI_DATA_CDB payload.
10 * Setting this value tells target-core to enforce this limit, and
11 * report as INQUIRY EVPD=b0 MAXIMUM TRANSFER LENGTH.
12 *
13 * target-core will currently reset se_cmd->data_length to this
14 * maximum size, and set UNDERFLOW residual count if length exceeds
15 * this limit.
16 *
17 * XXX: Not all initiator hosts honor this block-limit EVPD
18 * XXX: Currently assumes single PAGE_SIZE per scatterlist entry
19 */
20 u32 max_data_sg_nents;
8 char *(*get_fabric_name)(void); 21 char *(*get_fabric_name)(void);
9 char *(*tpg_get_wwn)(struct se_portal_group *); 22 char *(*tpg_get_wwn)(struct se_portal_group *);
10 u16 (*tpg_get_tag)(struct se_portal_group *); 23 u16 (*tpg_get_tag)(struct se_portal_group *);
@@ -152,6 +165,7 @@ int transport_generic_handle_tmr(struct se_cmd *);
152void transport_generic_request_failure(struct se_cmd *, sense_reason_t); 165void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
153void __target_execute_cmd(struct se_cmd *); 166void __target_execute_cmd(struct se_cmd *);
154int transport_lookup_tmr_lun(struct se_cmd *, u64); 167int transport_lookup_tmr_lun(struct se_cmd *, u64);
168void core_allocate_nexus_loss_ua(struct se_node_acl *acl);
155 169
156struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 170struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
157 unsigned char *); 171 unsigned char *);