aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c11
-rw-r--r--drivers/target/iscsi/iscsi_target_core.h5
-rw-r--r--drivers/target/iscsi/iscsi_target_nodeattrib.c5
-rw-r--r--drivers/target/iscsi/iscsi_target_nodeattrib.h3
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.c18
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.h1
6 files changed, 36 insertions, 7 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index fde3624dce7e..e3318edb233d 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1046,6 +1046,11 @@ TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR);
1046 */ 1046 */
1047DEF_TPG_ATTRIB(demo_mode_discovery); 1047DEF_TPG_ATTRIB(demo_mode_discovery);
1048TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR); 1048TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR);
1049/*
1050 * Define iscsi_tpg_attrib_s_default_erl
1051 */
1052DEF_TPG_ATTRIB(default_erl);
1053TPG_ATTR(default_erl, S_IRUGO | S_IWUSR);
1049 1054
1050static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { 1055static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
1051 &iscsi_tpg_attrib_authentication.attr, 1056 &iscsi_tpg_attrib_authentication.attr,
@@ -1057,6 +1062,7 @@ static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
1057 &iscsi_tpg_attrib_demo_mode_write_protect.attr, 1062 &iscsi_tpg_attrib_demo_mode_write_protect.attr,
1058 &iscsi_tpg_attrib_prod_mode_write_protect.attr, 1063 &iscsi_tpg_attrib_prod_mode_write_protect.attr,
1059 &iscsi_tpg_attrib_demo_mode_discovery.attr, 1064 &iscsi_tpg_attrib_demo_mode_discovery.attr,
1065 &iscsi_tpg_attrib_default_erl.attr,
1060 NULL, 1066 NULL,
1061}; 1067};
1062 1068
@@ -1919,9 +1925,12 @@ static void lio_set_default_node_attributes(struct se_node_acl *se_acl)
1919{ 1925{
1920 struct iscsi_node_acl *acl = container_of(se_acl, struct iscsi_node_acl, 1926 struct iscsi_node_acl *acl = container_of(se_acl, struct iscsi_node_acl,
1921 se_node_acl); 1927 se_node_acl);
1928 struct se_portal_group *se_tpg = se_acl->se_tpg;
1929 struct iscsi_portal_group *tpg = container_of(se_tpg,
1930 struct iscsi_portal_group, tpg_se_tpg);
1922 1931
1923 acl->node_attrib.nacl = acl; 1932 acl->node_attrib.nacl = acl;
1924 iscsit_set_default_node_attribues(acl); 1933 iscsit_set_default_node_attribues(acl, tpg);
1925} 1934}
1926 1935
1927static int lio_check_stop_free(struct se_cmd *se_cmd) 1936static int lio_check_stop_free(struct se_cmd *se_cmd)
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index 8dcb3c1aa801..48f7b3bf4e8c 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -37,9 +37,6 @@
37#define NA_RANDOM_DATAIN_PDU_OFFSETS 0 37#define NA_RANDOM_DATAIN_PDU_OFFSETS 0
38#define NA_RANDOM_DATAIN_SEQ_OFFSETS 0 38#define NA_RANDOM_DATAIN_SEQ_OFFSETS 0
39#define NA_RANDOM_R2T_OFFSETS 0 39#define NA_RANDOM_R2T_OFFSETS 0
40#define NA_DEFAULT_ERL 0
41#define NA_DEFAULT_ERL_MAX 2
42#define NA_DEFAULT_ERL_MIN 0
43 40
44/* struct iscsi_tpg_attrib sanity values */ 41/* struct iscsi_tpg_attrib sanity values */
45#define TA_AUTHENTICATION 1 42#define TA_AUTHENTICATION 1
@@ -59,6 +56,7 @@
59/* Disabled by default in production mode w/ explict ACLs */ 56/* Disabled by default in production mode w/ explict ACLs */
60#define TA_PROD_MODE_WRITE_PROTECT 0 57#define TA_PROD_MODE_WRITE_PROTECT 0
61#define TA_DEMO_MODE_DISCOVERY 1 58#define TA_DEMO_MODE_DISCOVERY 1
59#define TA_DEFAULT_ERL 0
62#define TA_CACHE_CORE_NPS 0 60#define TA_CACHE_CORE_NPS 0
63 61
64 62
@@ -766,6 +764,7 @@ struct iscsi_tpg_attrib {
766 u32 demo_mode_write_protect; 764 u32 demo_mode_write_protect;
767 u32 prod_mode_write_protect; 765 u32 prod_mode_write_protect;
768 u32 demo_mode_discovery; 766 u32 demo_mode_discovery;
767 u32 default_erl;
769 struct iscsi_portal_group *tpg; 768 struct iscsi_portal_group *tpg;
770}; 769};
771 770
diff --git a/drivers/target/iscsi/iscsi_target_nodeattrib.c b/drivers/target/iscsi/iscsi_target_nodeattrib.c
index 93bdc475eb00..16454a922e2b 100644
--- a/drivers/target/iscsi/iscsi_target_nodeattrib.c
+++ b/drivers/target/iscsi/iscsi_target_nodeattrib.c
@@ -33,7 +33,8 @@ static inline char *iscsit_na_get_initiatorname(
33} 33}
34 34
35void iscsit_set_default_node_attribues( 35void iscsit_set_default_node_attribues(
36 struct iscsi_node_acl *acl) 36 struct iscsi_node_acl *acl,
37 struct iscsi_portal_group *tpg)
37{ 38{
38 struct iscsi_node_attrib *a = &acl->node_attrib; 39 struct iscsi_node_attrib *a = &acl->node_attrib;
39 40
@@ -44,7 +45,7 @@ void iscsit_set_default_node_attribues(
44 a->random_datain_pdu_offsets = NA_RANDOM_DATAIN_PDU_OFFSETS; 45 a->random_datain_pdu_offsets = NA_RANDOM_DATAIN_PDU_OFFSETS;
45 a->random_datain_seq_offsets = NA_RANDOM_DATAIN_SEQ_OFFSETS; 46 a->random_datain_seq_offsets = NA_RANDOM_DATAIN_SEQ_OFFSETS;
46 a->random_r2t_offsets = NA_RANDOM_R2T_OFFSETS; 47 a->random_r2t_offsets = NA_RANDOM_R2T_OFFSETS;
47 a->default_erl = NA_DEFAULT_ERL; 48 a->default_erl = tpg->tpg_attrib.default_erl;
48} 49}
49 50
50int iscsit_na_dataout_timeout( 51int iscsit_na_dataout_timeout(
diff --git a/drivers/target/iscsi/iscsi_target_nodeattrib.h b/drivers/target/iscsi/iscsi_target_nodeattrib.h
index c970b326ef23..0c69a46a62ec 100644
--- a/drivers/target/iscsi/iscsi_target_nodeattrib.h
+++ b/drivers/target/iscsi/iscsi_target_nodeattrib.h
@@ -1,7 +1,8 @@
1#ifndef ISCSI_TARGET_NODEATTRIB_H 1#ifndef ISCSI_TARGET_NODEATTRIB_H
2#define ISCSI_TARGET_NODEATTRIB_H 2#define ISCSI_TARGET_NODEATTRIB_H
3 3
4extern void iscsit_set_default_node_attribues(struct iscsi_node_acl *); 4extern void iscsit_set_default_node_attribues(struct iscsi_node_acl *,
5 struct iscsi_portal_group *);
5extern int iscsit_na_dataout_timeout(struct iscsi_node_acl *, u32); 6extern int iscsit_na_dataout_timeout(struct iscsi_node_acl *, u32);
6extern int iscsit_na_dataout_timeout_retries(struct iscsi_node_acl *, u32); 7extern int iscsit_na_dataout_timeout_retries(struct iscsi_node_acl *, u32);
7extern int iscsit_na_nopin_timeout(struct iscsi_node_acl *, u32); 8extern int iscsit_na_nopin_timeout(struct iscsi_node_acl *, u32);
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index 98ccf0bff546..39761837608d 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -224,6 +224,7 @@ static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group *tpg)
224 a->demo_mode_write_protect = TA_DEMO_MODE_WRITE_PROTECT; 224 a->demo_mode_write_protect = TA_DEMO_MODE_WRITE_PROTECT;
225 a->prod_mode_write_protect = TA_PROD_MODE_WRITE_PROTECT; 225 a->prod_mode_write_protect = TA_PROD_MODE_WRITE_PROTECT;
226 a->demo_mode_discovery = TA_DEMO_MODE_DISCOVERY; 226 a->demo_mode_discovery = TA_DEMO_MODE_DISCOVERY;
227 a->default_erl = TA_DEFAULT_ERL;
227} 228}
228 229
229int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg) 230int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg)
@@ -840,3 +841,20 @@ int iscsit_ta_demo_mode_discovery(
840 841
841 return 0; 842 return 0;
842} 843}
844
845int iscsit_ta_default_erl(
846 struct iscsi_portal_group *tpg,
847 u32 default_erl)
848{
849 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
850
851 if ((default_erl != 0) && (default_erl != 1) && (default_erl != 2)) {
852 pr_err("Illegal value for default_erl: %u\n", default_erl);
853 return -EINVAL;
854 }
855
856 a->default_erl = default_erl;
857 pr_debug("iSCSI_TPG[%hu] - DefaultERL: %u\n", tpg->tpgt, a->default_erl);
858
859 return 0;
860}
diff --git a/drivers/target/iscsi/iscsi_target_tpg.h b/drivers/target/iscsi/iscsi_target_tpg.h
index 3e8ce8644082..213c0fc7fdc9 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.h
+++ b/drivers/target/iscsi/iscsi_target_tpg.h
@@ -38,5 +38,6 @@ extern int iscsit_ta_cache_dynamic_acls(struct iscsi_portal_group *, u32);
38extern int iscsit_ta_demo_mode_write_protect(struct iscsi_portal_group *, u32); 38extern int iscsit_ta_demo_mode_write_protect(struct iscsi_portal_group *, u32);
39extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32); 39extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32);
40extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32); 40extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32);
41extern int iscsit_ta_default_erl(struct iscsi_portal_group *, u32);
41 42
42#endif /* ISCSI_TARGET_TPG_H */ 43#endif /* ISCSI_TARGET_TPG_H */