aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-07-25 14:48:43 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-27 10:36:06 -0400
commit1d063c17298d7cd26cfe350f1e93e1727b4aa53f (patch)
treece7996d0b3fe0903287eac2649c79658b5c9c528
parent3128c6c73cdf3df92c3165bfb785ae50114d18bf (diff)
[SCSI] iscsi class: sysfs group is_visible callout for session attrs
The iscsi class currently does not support writable sysfs attrs for LLD sysfs settings. This patch converts the iscsi class and driver's session attrs to use the attribute container sysfs group and the sysfs group's is_visible callout to be able to support readable or writable sysfs attrs. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c32
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c19
-rw-r--r--drivers/scsi/be2iscsi/be_main.c15
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c34
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c11
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c11
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c20
-rw-r--r--drivers/scsi/iscsi_tcp.c34
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c5
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c148
-rw-r--r--include/scsi/iscsi_if.h38
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
12 files changed, 199 insertions, 172 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index c716722628cf..4f2411298b20 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -648,6 +648,25 @@ static mode_t iser_attr_is_visible(int param_type, int param)
648 case ISCSI_PARAM_PERSISTENT_PORT: 648 case ISCSI_PARAM_PERSISTENT_PORT:
649 case ISCSI_PARAM_PING_TMO: 649 case ISCSI_PARAM_PING_TMO:
650 case ISCSI_PARAM_RECV_TMO: 650 case ISCSI_PARAM_RECV_TMO:
651 case ISCSI_PARAM_INITIAL_R2T_EN:
652 case ISCSI_PARAM_MAX_R2T:
653 case ISCSI_PARAM_IMM_DATA_EN:
654 case ISCSI_PARAM_FIRST_BURST:
655 case ISCSI_PARAM_MAX_BURST:
656 case ISCSI_PARAM_PDU_INORDER_EN:
657 case ISCSI_PARAM_DATASEQ_INORDER_EN:
658 case ISCSI_PARAM_TARGET_NAME:
659 case ISCSI_PARAM_TPGT:
660 case ISCSI_PARAM_USERNAME:
661 case ISCSI_PARAM_PASSWORD:
662 case ISCSI_PARAM_USERNAME_IN:
663 case ISCSI_PARAM_PASSWORD_IN:
664 case ISCSI_PARAM_FAST_ABORT:
665 case ISCSI_PARAM_ABORT_TMO:
666 case ISCSI_PARAM_LU_RESET_TMO:
667 case ISCSI_PARAM_TGT_RESET_TMO:
668 case ISCSI_PARAM_IFACE_NAME:
669 case ISCSI_PARAM_INITIATOR_NAME:
651 return S_IRUGO; 670 return S_IRUGO;
652 default: 671 default:
653 return 0; 672 return 0;
@@ -678,19 +697,6 @@ static struct iscsi_transport iscsi_iser_transport = {
678 .owner = THIS_MODULE, 697 .owner = THIS_MODULE,
679 .name = "iser", 698 .name = "iser",
680 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T, 699 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T,
681 .param_mask = ISCSI_INITIAL_R2T_EN |
682 ISCSI_MAX_R2T |
683 ISCSI_IMM_DATA_EN |
684 ISCSI_FIRST_BURST |
685 ISCSI_MAX_BURST |
686 ISCSI_PDU_INORDER_EN |
687 ISCSI_DATASEQ_INORDER_EN |
688 ISCSI_TARGET_NAME | ISCSI_TPGT |
689 ISCSI_USERNAME | ISCSI_PASSWORD |
690 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
691 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
692 ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
693 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
694 .host_param_mask = ISCSI_HOST_HWADDRESS | 700 .host_param_mask = ISCSI_HOST_HWADDRESS |
695 ISCSI_HOST_NETDEV_NAME | 701 ISCSI_HOST_NETDEV_NAME |
696 ISCSI_HOST_INITIATOR_NAME, 702 ISCSI_HOST_INITIATOR_NAME,
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 87b7ae1ef488..ecd19bb3b207 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -750,6 +750,25 @@ mode_t be2iscsi_attr_is_visible(int param_type, int param)
750 case ISCSI_PARAM_PERSISTENT_PORT: 750 case ISCSI_PARAM_PERSISTENT_PORT:
751 case ISCSI_PARAM_PING_TMO: 751 case ISCSI_PARAM_PING_TMO:
752 case ISCSI_PARAM_RECV_TMO: 752 case ISCSI_PARAM_RECV_TMO:
753 case ISCSI_PARAM_INITIAL_R2T_EN:
754 case ISCSI_PARAM_MAX_R2T:
755 case ISCSI_PARAM_IMM_DATA_EN:
756 case ISCSI_PARAM_FIRST_BURST:
757 case ISCSI_PARAM_MAX_BURST:
758 case ISCSI_PARAM_PDU_INORDER_EN:
759 case ISCSI_PARAM_DATASEQ_INORDER_EN:
760 case ISCSI_PARAM_ERL:
761 case ISCSI_PARAM_TARGET_NAME:
762 case ISCSI_PARAM_TPGT:
763 case ISCSI_PARAM_USERNAME:
764 case ISCSI_PARAM_PASSWORD:
765 case ISCSI_PARAM_USERNAME_IN:
766 case ISCSI_PARAM_PASSWORD_IN:
767 case ISCSI_PARAM_FAST_ABORT:
768 case ISCSI_PARAM_ABORT_TMO:
769 case ISCSI_PARAM_LU_RESET_TMO:
770 case ISCSI_PARAM_IFACE_NAME:
771 case ISCSI_PARAM_INITIATOR_NAME:
753 return S_IRUGO; 772 return S_IRUGO;
754 default: 773 default:
755 return 0; 774 return 0;
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d2a3e4a4d024..93a3c708411a 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4364,21 +4364,6 @@ struct iscsi_transport beiscsi_iscsi_transport = {
4364 .name = DRV_NAME, 4364 .name = DRV_NAME,
4365 .caps = CAP_RECOVERY_L0 | CAP_HDRDGST | CAP_TEXT_NEGO | 4365 .caps = CAP_RECOVERY_L0 | CAP_HDRDGST | CAP_TEXT_NEGO |
4366 CAP_MULTI_R2T | CAP_DATADGST | CAP_DATA_PATH_OFFLOAD, 4366 CAP_MULTI_R2T | CAP_DATADGST | CAP_DATA_PATH_OFFLOAD,
4367 .param_mask =
4368 ISCSI_INITIAL_R2T_EN |
4369 ISCSI_MAX_R2T |
4370 ISCSI_IMM_DATA_EN |
4371 ISCSI_FIRST_BURST |
4372 ISCSI_MAX_BURST |
4373 ISCSI_PDU_INORDER_EN |
4374 ISCSI_DATASEQ_INORDER_EN |
4375 ISCSI_ERL |
4376 ISCSI_TARGET_NAME | ISCSI_TPGT |
4377 ISCSI_USERNAME | ISCSI_PASSWORD |
4378 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
4379 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
4380 ISCSI_LU_RESET_TMO |
4381 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
4382 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 4367 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
4383 ISCSI_HOST_INITIATOR_NAME, 4368 ISCSI_HOST_INITIATOR_NAME,
4384 .create_session = beiscsi_session_create, 4369 .create_session = beiscsi_session_create,
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 2d529c9fa1ad..2db3399d2734 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -2193,6 +2193,26 @@ static mode_t bnx2i_attr_is_visible(int param_type, int param)
2193 case ISCSI_PARAM_PERSISTENT_PORT: 2193 case ISCSI_PARAM_PERSISTENT_PORT:
2194 case ISCSI_PARAM_PING_TMO: 2194 case ISCSI_PARAM_PING_TMO:
2195 case ISCSI_PARAM_RECV_TMO: 2195 case ISCSI_PARAM_RECV_TMO:
2196 case ISCSI_PARAM_INITIAL_R2T_EN:
2197 case ISCSI_PARAM_MAX_R2T:
2198 case ISCSI_PARAM_IMM_DATA_EN:
2199 case ISCSI_PARAM_FIRST_BURST:
2200 case ISCSI_PARAM_MAX_BURST:
2201 case ISCSI_PARAM_PDU_INORDER_EN:
2202 case ISCSI_PARAM_DATASEQ_INORDER_EN:
2203 case ISCSI_PARAM_ERL:
2204 case ISCSI_PARAM_TARGET_NAME:
2205 case ISCSI_PARAM_TPGT:
2206 case ISCSI_PARAM_USERNAME:
2207 case ISCSI_PARAM_PASSWORD:
2208 case ISCSI_PARAM_USERNAME_IN:
2209 case ISCSI_PARAM_PASSWORD_IN:
2210 case ISCSI_PARAM_FAST_ABORT:
2211 case ISCSI_PARAM_ABORT_TMO:
2212 case ISCSI_PARAM_LU_RESET_TMO:
2213 case ISCSI_PARAM_TGT_RESET_TMO:
2214 case ISCSI_PARAM_IFACE_NAME:
2215 case ISCSI_PARAM_INITIATOR_NAME:
2196 return S_IRUGO; 2216 return S_IRUGO;
2197 default: 2217 default:
2198 return 0; 2218 return 0;
@@ -2231,20 +2251,6 @@ struct iscsi_transport bnx2i_iscsi_transport = {
2231 CAP_MULTI_R2T | CAP_DATADGST | 2251 CAP_MULTI_R2T | CAP_DATADGST |
2232 CAP_DATA_PATH_OFFLOAD | 2252 CAP_DATA_PATH_OFFLOAD |
2233 CAP_TEXT_NEGO, 2253 CAP_TEXT_NEGO,
2234 .param_mask = ISCSI_INITIAL_R2T_EN |
2235 ISCSI_MAX_R2T |
2236 ISCSI_IMM_DATA_EN |
2237 ISCSI_FIRST_BURST |
2238 ISCSI_MAX_BURST |
2239 ISCSI_PDU_INORDER_EN |
2240 ISCSI_DATASEQ_INORDER_EN |
2241 ISCSI_ERL |
2242 ISCSI_TARGET_NAME | ISCSI_TPGT |
2243 ISCSI_USERNAME | ISCSI_PASSWORD |
2244 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
2245 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
2246 ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
2247 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
2248 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 2254 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
2249 ISCSI_HOST_NETDEV_NAME, 2255 ISCSI_HOST_NETDEV_NAME,
2250 .create_session = bnx2i_session_create, 2256 .create_session = bnx2i_session_create,
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index c13b3f0a4f03..50d4e3f05038 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -106,17 +106,6 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
106 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST 106 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST
107 | CAP_DATADGST | CAP_DIGEST_OFFLOAD | 107 | CAP_DATADGST | CAP_DIGEST_OFFLOAD |
108 CAP_PADDING_OFFLOAD | CAP_TEXT_NEGO, 108 CAP_PADDING_OFFLOAD | CAP_TEXT_NEGO,
109 .param_mask =
110 ISCSI_INITIAL_R2T_EN | ISCSI_MAX_R2T |
111 ISCSI_IMM_DATA_EN | ISCSI_FIRST_BURST |
112 ISCSI_MAX_BURST | ISCSI_PDU_INORDER_EN |
113 ISCSI_DATASEQ_INORDER_EN | ISCSI_ERL |
114 ISCSI_TARGET_NAME | ISCSI_TPGT |
115 ISCSI_USERNAME | ISCSI_PASSWORD |
116 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
117 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
118 ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
119 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
120 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 109 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
121 ISCSI_HOST_INITIATOR_NAME | 110 ISCSI_HOST_INITIATOR_NAME |
122 ISCSI_HOST_NETDEV_NAME, 111 ISCSI_HOST_NETDEV_NAME,
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 89fca4b0787c..72f19ef7e016 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -107,17 +107,6 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {
107 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST | 107 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST |
108 CAP_DATADGST | CAP_DIGEST_OFFLOAD | 108 CAP_DATADGST | CAP_DIGEST_OFFLOAD |
109 CAP_PADDING_OFFLOAD | CAP_TEXT_NEGO, 109 CAP_PADDING_OFFLOAD | CAP_TEXT_NEGO,
110 .param_mask =
111 ISCSI_INITIAL_R2T_EN | ISCSI_MAX_R2T |
112 ISCSI_IMM_DATA_EN | ISCSI_FIRST_BURST |
113 ISCSI_MAX_BURST | ISCSI_PDU_INORDER_EN |
114 ISCSI_DATASEQ_INORDER_EN | ISCSI_ERL |
115 ISCSI_TARGET_NAME | ISCSI_TPGT |
116 ISCSI_USERNAME | ISCSI_PASSWORD |
117 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
118 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
119 ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
120 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
121 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 110 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
122 ISCSI_HOST_INITIATOR_NAME | 111 ISCSI_HOST_INITIATOR_NAME |
123 ISCSI_HOST_NETDEV_NAME, 112 ISCSI_HOST_NETDEV_NAME,
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index e5f4f968ed7b..f9c2ca0d8083 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2582,6 +2582,26 @@ mode_t cxgbi_attr_is_visible(int param_type, int param)
2582 case ISCSI_PARAM_PERSISTENT_PORT: 2582 case ISCSI_PARAM_PERSISTENT_PORT:
2583 case ISCSI_PARAM_PING_TMO: 2583 case ISCSI_PARAM_PING_TMO:
2584 case ISCSI_PARAM_RECV_TMO: 2584 case ISCSI_PARAM_RECV_TMO:
2585 case ISCSI_PARAM_INITIAL_R2T_EN:
2586 case ISCSI_PARAM_MAX_R2T:
2587 case ISCSI_PARAM_IMM_DATA_EN:
2588 case ISCSI_PARAM_FIRST_BURST:
2589 case ISCSI_PARAM_MAX_BURST:
2590 case ISCSI_PARAM_PDU_INORDER_EN:
2591 case ISCSI_PARAM_DATASEQ_INORDER_EN:
2592 case ISCSI_PARAM_ERL:
2593 case ISCSI_PARAM_TARGET_NAME:
2594 case ISCSI_PARAM_TPGT:
2595 case ISCSI_PARAM_USERNAME:
2596 case ISCSI_PARAM_PASSWORD:
2597 case ISCSI_PARAM_USERNAME_IN:
2598 case ISCSI_PARAM_PASSWORD_IN:
2599 case ISCSI_PARAM_FAST_ABORT:
2600 case ISCSI_PARAM_ABORT_TMO:
2601 case ISCSI_PARAM_LU_RESET_TMO:
2602 case ISCSI_PARAM_TGT_RESET_TMO:
2603 case ISCSI_PARAM_IFACE_NAME:
2604 case ISCSI_PARAM_INITIATOR_NAME:
2585 return S_IRUGO; 2605 return S_IRUGO;
2586 default: 2606 default:
2587 return 0; 2607 return 0;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 1dcb4d183bc9..6ab212211760 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -888,6 +888,26 @@ static mode_t iscsi_sw_tcp_attr_is_visible(int param_type, int param)
888 case ISCSI_PARAM_PERSISTENT_PORT: 888 case ISCSI_PARAM_PERSISTENT_PORT:
889 case ISCSI_PARAM_PING_TMO: 889 case ISCSI_PARAM_PING_TMO:
890 case ISCSI_PARAM_RECV_TMO: 890 case ISCSI_PARAM_RECV_TMO:
891 case ISCSI_PARAM_INITIAL_R2T_EN:
892 case ISCSI_PARAM_MAX_R2T:
893 case ISCSI_PARAM_IMM_DATA_EN:
894 case ISCSI_PARAM_FIRST_BURST:
895 case ISCSI_PARAM_MAX_BURST:
896 case ISCSI_PARAM_PDU_INORDER_EN:
897 case ISCSI_PARAM_DATASEQ_INORDER_EN:
898 case ISCSI_PARAM_ERL:
899 case ISCSI_PARAM_TARGET_NAME:
900 case ISCSI_PARAM_TPGT:
901 case ISCSI_PARAM_USERNAME:
902 case ISCSI_PARAM_PASSWORD:
903 case ISCSI_PARAM_USERNAME_IN:
904 case ISCSI_PARAM_PASSWORD_IN:
905 case ISCSI_PARAM_FAST_ABORT:
906 case ISCSI_PARAM_ABORT_TMO:
907 case ISCSI_PARAM_LU_RESET_TMO:
908 case ISCSI_PARAM_TGT_RESET_TMO:
909 case ISCSI_PARAM_IFACE_NAME:
910 case ISCSI_PARAM_INITIATOR_NAME:
891 return S_IRUGO; 911 return S_IRUGO;
892 default: 912 default:
893 return 0; 913 return 0;
@@ -935,20 +955,6 @@ static struct iscsi_transport iscsi_sw_tcp_transport = {
935 .name = "tcp", 955 .name = "tcp",
936 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST 956 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST
937 | CAP_DATADGST, 957 | CAP_DATADGST,
938 .param_mask = ISCSI_INITIAL_R2T_EN |
939 ISCSI_MAX_R2T |
940 ISCSI_IMM_DATA_EN |
941 ISCSI_FIRST_BURST |
942 ISCSI_MAX_BURST |
943 ISCSI_PDU_INORDER_EN |
944 ISCSI_DATASEQ_INORDER_EN |
945 ISCSI_ERL |
946 ISCSI_TARGET_NAME | ISCSI_TPGT |
947 ISCSI_USERNAME | ISCSI_PASSWORD |
948 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
949 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
950 ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
951 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
952 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 958 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
953 ISCSI_HOST_INITIATOR_NAME | 959 ISCSI_HOST_INITIATOR_NAME |
954 ISCSI_HOST_NETDEV_NAME, 960 ISCSI_HOST_NETDEV_NAME,
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f8a1506cb76a..3022c1534156 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -138,8 +138,6 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
138 .name = DRIVER_NAME, 138 .name = DRIVER_NAME,
139 .caps = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD | 139 .caps = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD |
140 CAP_DATA_PATH_OFFLOAD, 140 CAP_DATA_PATH_OFFLOAD,
141 .param_mask = ISCSI_TARGET_NAME | ISCSI_TPGT |
142 ISCSI_TARGET_ALIAS,
143 .host_param_mask = ISCSI_HOST_HWADDRESS | 141 .host_param_mask = ISCSI_HOST_HWADDRESS |
144 ISCSI_HOST_IPADDRESS | 142 ISCSI_HOST_IPADDRESS |
145 ISCSI_HOST_INITIATOR_NAME, 143 ISCSI_HOST_INITIATOR_NAME,
@@ -173,6 +171,9 @@ static mode_t ql4_attr_is_visible(int param_type, int param)
173 switch (param) { 171 switch (param) {
174 case ISCSI_PARAM_CONN_ADDRESS: 172 case ISCSI_PARAM_CONN_ADDRESS:
175 case ISCSI_PARAM_CONN_PORT: 173 case ISCSI_PARAM_CONN_PORT:
174 case ISCSI_PARAM_TARGET_NAME:
175 case ISCSI_PARAM_TPGT:
176 case ISCSI_PARAM_TARGET_ALIAS:
176 return S_IRUGO; 177 return S_IRUGO;
177 default: 178 default:
178 return 0; 179 return 0;
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index e9eca98e1102..75d7f6e93b67 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -32,8 +32,6 @@
32#include <scsi/iscsi_if.h> 32#include <scsi/iscsi_if.h>
33#include <scsi/scsi_cmnd.h> 33#include <scsi/scsi_cmnd.h>
34 34
35#define ISCSI_SESSION_ATTRS 23
36#define ISCSI_CONN_ATTRS 13
37#define ISCSI_HOST_ATTRS 4 35#define ISCSI_HOST_ATTRS 4
38 36
39#define ISCSI_TRANSPORT_VERSION "2.0-870" 37#define ISCSI_TRANSPORT_VERSION "2.0-870"
@@ -79,7 +77,6 @@ struct iscsi_internal {
79 struct device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1]; 77 struct device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1];
80 struct transport_container conn_cont; 78 struct transport_container conn_cont;
81 struct transport_container session_cont; 79 struct transport_container session_cont;
82 struct device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
83}; 80};
84 81
85static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ 82static atomic_t iscsi_session_nr; /* sysfs session id for next new session */
@@ -2114,7 +2111,6 @@ show_session_param_##param(struct device *dev, \
2114 iscsi_session_attr_show(param, perm) \ 2111 iscsi_session_attr_show(param, perm) \
2115static ISCSI_CLASS_ATTR(sess, field, S_IRUGO, show_session_param_##param, \ 2112static ISCSI_CLASS_ATTR(sess, field, S_IRUGO, show_session_param_##param, \
2116 NULL); 2113 NULL);
2117
2118iscsi_session_attr(targetname, ISCSI_PARAM_TARGET_NAME, 0); 2114iscsi_session_attr(targetname, ISCSI_PARAM_TARGET_NAME, 0);
2119iscsi_session_attr(initial_r2t, ISCSI_PARAM_INITIAL_R2T_EN, 0); 2115iscsi_session_attr(initial_r2t, ISCSI_PARAM_INITIAL_R2T_EN, 0);
2120iscsi_session_attr(max_outstanding_r2t, ISCSI_PARAM_MAX_R2T, 0); 2116iscsi_session_attr(max_outstanding_r2t, ISCSI_PARAM_MAX_R2T, 0);
@@ -2191,6 +2187,100 @@ static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUSR, \
2191 store_priv_session_##field) 2187 store_priv_session_##field)
2192iscsi_priv_session_rw_attr(recovery_tmo, "%d"); 2188iscsi_priv_session_rw_attr(recovery_tmo, "%d");
2193 2189
2190static struct attribute *iscsi_session_attrs[] = {
2191 &dev_attr_sess_initial_r2t.attr,
2192 &dev_attr_sess_max_outstanding_r2t.attr,
2193 &dev_attr_sess_immediate_data.attr,
2194 &dev_attr_sess_first_burst_len.attr,
2195 &dev_attr_sess_max_burst_len.attr,
2196 &dev_attr_sess_data_pdu_in_order.attr,
2197 &dev_attr_sess_data_seq_in_order.attr,
2198 &dev_attr_sess_erl.attr,
2199 &dev_attr_sess_targetname.attr,
2200 &dev_attr_sess_tpgt.attr,
2201 &dev_attr_sess_password.attr,
2202 &dev_attr_sess_password_in.attr,
2203 &dev_attr_sess_username.attr,
2204 &dev_attr_sess_username_in.attr,
2205 &dev_attr_sess_fast_abort.attr,
2206 &dev_attr_sess_abort_tmo.attr,
2207 &dev_attr_sess_lu_reset_tmo.attr,
2208 &dev_attr_sess_tgt_reset_tmo.attr,
2209 &dev_attr_sess_ifacename.attr,
2210 &dev_attr_sess_initiatorname.attr,
2211 &dev_attr_sess_targetalias.attr,
2212 &dev_attr_priv_sess_recovery_tmo.attr,
2213 &dev_attr_priv_sess_state.attr,
2214 NULL,
2215};
2216
2217static mode_t iscsi_session_attr_is_visible(struct kobject *kobj,
2218 struct attribute *attr, int i)
2219{
2220 struct device *cdev = container_of(kobj, struct device, kobj);
2221 struct iscsi_cls_session *session = transport_class_to_session(cdev);
2222 struct iscsi_transport *t = session->transport;
2223 int param;
2224
2225 if (attr == &dev_attr_sess_initial_r2t.attr)
2226 param = ISCSI_PARAM_INITIAL_R2T_EN;
2227 else if (attr == &dev_attr_sess_max_outstanding_r2t.attr)
2228 param = ISCSI_PARAM_MAX_R2T;
2229 else if (attr == &dev_attr_sess_immediate_data.attr)
2230 param = ISCSI_PARAM_IMM_DATA_EN;
2231 else if (attr == &dev_attr_sess_first_burst_len.attr)
2232 param = ISCSI_PARAM_FIRST_BURST;
2233 else if (attr == &dev_attr_sess_max_burst_len.attr)
2234 param = ISCSI_PARAM_MAX_BURST;
2235 else if (attr == &dev_attr_sess_data_pdu_in_order.attr)
2236 param = ISCSI_PARAM_PDU_INORDER_EN;
2237 else if (attr == &dev_attr_sess_data_seq_in_order.attr)
2238 param = ISCSI_PARAM_DATASEQ_INORDER_EN;
2239 else if (attr == &dev_attr_sess_erl.attr)
2240 param = ISCSI_PARAM_ERL;
2241 else if (attr == &dev_attr_sess_targetname.attr)
2242 param = ISCSI_PARAM_TARGET_NAME;
2243 else if (attr == &dev_attr_sess_tpgt.attr)
2244 param = ISCSI_PARAM_TPGT;
2245 else if (attr == &dev_attr_sess_password.attr)
2246 param = ISCSI_PARAM_USERNAME;
2247 else if (attr == &dev_attr_sess_password_in.attr)
2248 param = ISCSI_PARAM_USERNAME_IN;
2249 else if (attr == &dev_attr_sess_username.attr)
2250 param = ISCSI_PARAM_PASSWORD;
2251 else if (attr == &dev_attr_sess_username_in.attr)
2252 param = ISCSI_PARAM_PASSWORD_IN;
2253 else if (attr == &dev_attr_sess_fast_abort.attr)
2254 param = ISCSI_PARAM_FAST_ABORT;
2255 else if (attr == &dev_attr_sess_abort_tmo.attr)
2256 param = ISCSI_PARAM_ABORT_TMO;
2257 else if (attr == &dev_attr_sess_lu_reset_tmo.attr)
2258 param = ISCSI_PARAM_LU_RESET_TMO;
2259 else if (attr == &dev_attr_sess_tgt_reset_tmo.attr)
2260 param = ISCSI_PARAM_TGT_RESET_TMO;
2261 else if (attr == &dev_attr_sess_ifacename.attr)
2262 param = ISCSI_PARAM_IFACE_NAME;
2263 else if (attr == &dev_attr_sess_initiatorname.attr)
2264 param = ISCSI_PARAM_INITIATOR_NAME;
2265 else if (attr == &dev_attr_sess_targetalias.attr)
2266 param = ISCSI_PARAM_TARGET_ALIAS;
2267 else if (attr == &dev_attr_priv_sess_recovery_tmo.attr)
2268 return S_IRUGO | S_IWUSR;
2269 else if (attr == &dev_attr_priv_sess_state.attr)
2270 return S_IRUGO;
2271 else {
2272 WARN_ONCE(1, "Invalid session attr");
2273 return 0;
2274 }
2275
2276 return t->attr_is_visible(ISCSI_PARAM, param);
2277}
2278
2279static struct attribute_group iscsi_session_group = {
2280 .attrs = iscsi_session_attrs,
2281 .is_visible = iscsi_session_attr_is_visible,
2282};
2283
2194/* 2284/*
2195 * iSCSI host attrs 2285 * iSCSI host attrs
2196 */ 2286 */
@@ -2214,26 +2304,6 @@ iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS);
2214iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS); 2304iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS);
2215iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); 2305iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME);
2216 2306
2217#define SETUP_PRIV_SESSION_RD_ATTR(field) \
2218do { \
2219 priv->session_attrs[count] = &dev_attr_priv_sess_##field; \
2220 count++; \
2221} while (0)
2222
2223#define SETUP_PRIV_SESSION_RW_ATTR(field) \
2224do { \
2225 priv->session_attrs[count] = &dev_attr_priv_sess_##field; \
2226 count++; \
2227} while (0)
2228
2229#define SETUP_SESSION_RD_ATTR(field, param_flag) \
2230do { \
2231 if (tt->param_mask & param_flag) { \
2232 priv->session_attrs[count] = &dev_attr_sess_##field; \
2233 count++; \
2234 } \
2235} while (0)
2236
2237#define SETUP_HOST_RD_ATTR(field, param_flag) \ 2307#define SETUP_HOST_RD_ATTR(field, param_flag) \
2238do { \ 2308do { \
2239 if (tt->host_param_mask & param_flag) { \ 2309 if (tt->host_param_mask & param_flag) { \
@@ -2360,39 +2430,11 @@ iscsi_register_transport(struct iscsi_transport *tt)
2360 transport_container_register(&priv->conn_cont); 2430 transport_container_register(&priv->conn_cont);
2361 2431
2362 /* session parameters */ 2432 /* session parameters */
2363 priv->session_cont.ac.attrs = &priv->session_attrs[0];
2364 priv->session_cont.ac.class = &iscsi_session_class.class; 2433 priv->session_cont.ac.class = &iscsi_session_class.class;
2365 priv->session_cont.ac.match = iscsi_session_match; 2434 priv->session_cont.ac.match = iscsi_session_match;
2435 priv->session_cont.ac.grp = &iscsi_session_group;
2366 transport_container_register(&priv->session_cont); 2436 transport_container_register(&priv->session_cont);
2367 2437
2368 SETUP_SESSION_RD_ATTR(initial_r2t, ISCSI_INITIAL_R2T_EN);
2369 SETUP_SESSION_RD_ATTR(max_outstanding_r2t, ISCSI_MAX_R2T);
2370 SETUP_SESSION_RD_ATTR(immediate_data, ISCSI_IMM_DATA_EN);
2371 SETUP_SESSION_RD_ATTR(first_burst_len, ISCSI_FIRST_BURST);
2372 SETUP_SESSION_RD_ATTR(max_burst_len, ISCSI_MAX_BURST);
2373 SETUP_SESSION_RD_ATTR(data_pdu_in_order, ISCSI_PDU_INORDER_EN);
2374 SETUP_SESSION_RD_ATTR(data_seq_in_order, ISCSI_DATASEQ_INORDER_EN);
2375 SETUP_SESSION_RD_ATTR(erl, ISCSI_ERL);
2376 SETUP_SESSION_RD_ATTR(targetname, ISCSI_TARGET_NAME);
2377 SETUP_SESSION_RD_ATTR(tpgt, ISCSI_TPGT);
2378 SETUP_SESSION_RD_ATTR(password, ISCSI_USERNAME);
2379 SETUP_SESSION_RD_ATTR(password_in, ISCSI_USERNAME_IN);
2380 SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD);
2381 SETUP_SESSION_RD_ATTR(username_in, ISCSI_PASSWORD_IN);
2382 SETUP_SESSION_RD_ATTR(fast_abort, ISCSI_FAST_ABORT);
2383 SETUP_SESSION_RD_ATTR(abort_tmo, ISCSI_ABORT_TMO);
2384 SETUP_SESSION_RD_ATTR(lu_reset_tmo,ISCSI_LU_RESET_TMO);
2385 SETUP_SESSION_RD_ATTR(tgt_reset_tmo,ISCSI_TGT_RESET_TMO);
2386 SETUP_SESSION_RD_ATTR(ifacename, ISCSI_IFACE_NAME);
2387 SETUP_SESSION_RD_ATTR(initiatorname, ISCSI_INITIATOR_NAME);
2388 SETUP_SESSION_RD_ATTR(targetalias, ISCSI_TARGET_ALIAS);
2389 SETUP_PRIV_SESSION_RW_ATTR(recovery_tmo);
2390 SETUP_PRIV_SESSION_RD_ATTR(state);
2391
2392 BUG_ON(count > ISCSI_SESSION_ATTRS);
2393 priv->session_attrs[count] = NULL;
2394 count = 0;
2395
2396 spin_lock_irqsave(&iscsi_transport_lock, flags); 2438 spin_lock_irqsave(&iscsi_transport_lock, flags);
2397 list_add(&priv->list, &iscsi_transports); 2439 list_add(&priv->list, &iscsi_transports);
2398 spin_unlock_irqrestore(&iscsi_transport_lock, flags); 2440 spin_unlock_irqrestore(&iscsi_transport_lock, flags);
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index a563753d578b..a4353ff563f2 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -399,44 +399,6 @@ enum iscsi_param {
399 ISCSI_PARAM_MAX, 399 ISCSI_PARAM_MAX,
400}; 400};
401 401
402#define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH)
403#define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH)
404#define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN)
405#define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN)
406#define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN)
407#define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T)
408#define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN)
409#define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST)
410#define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST)
411#define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN)
412#define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN)
413#define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL)
414#define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN)
415#define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN)
416#define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN)
417#define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME)
418#define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT)
419#define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS)
420#define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT)
421#define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO)
422#define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT)
423#define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS)
424#define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME)
425#define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN)
426#define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD)
427#define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN)
428#define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT)
429#define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO)
430#define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO)
431#define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO)
432#define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO)
433#define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO)
434#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
435#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
436#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
437#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
438#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
439
440/* iSCSI HBA params */ 402/* iSCSI HBA params */
441enum iscsi_host_param { 403enum iscsi_host_param {
442 ISCSI_HOST_PARAM_HWADDRESS, 404 ISCSI_HOST_PARAM_HWADDRESS,
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 8918329feaac..53eb93849377 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -86,7 +86,6 @@ struct iscsi_transport {
86 char *name; 86 char *name;
87 unsigned int caps; 87 unsigned int caps;
88 /* LLD sets this to indicate what values it can export to sysfs */ 88 /* LLD sets this to indicate what values it can export to sysfs */
89 uint64_t param_mask;
90 uint64_t host_param_mask; 89 uint64_t host_param_mask;
91 uint64_t iface_param_mask; 90 uint64_t iface_param_mask;
92 91
@@ -219,6 +218,9 @@ struct iscsi_cls_session {
219#define iscsi_dev_to_session(_dev) \ 218#define iscsi_dev_to_session(_dev) \
220 container_of(_dev, struct iscsi_cls_session, dev) 219 container_of(_dev, struct iscsi_cls_session, dev)
221 220
221#define transport_class_to_session(_cdev) \
222 iscsi_dev_to_session(_cdev->parent)
223
222#define iscsi_session_to_shost(_session) \ 224#define iscsi_session_to_shost(_session) \
223 dev_to_shost(_session->dev.parent) 225 dev_to_shost(_session->dev.parent)
224 226