aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-21 16:54:16 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:21 -0400
commit88dfd340b9dece8fcaa1a2d4c782338926c017f7 (patch)
tree89800910ef8636f00d2c66ce4e83a161087857e6
parent06520edea0fc7007985fa4cd51560149feb3f442 (diff)
[SCSI] iscsi class: Add session initiatorname and ifacename sysfs attrs.
This adds two new attrs used for creating initiator ports and binding sessions to hardware. The session level initiatorname: Since bnx2i does a scsi_host per host device, we need to add the iface initiator port settings on the session, so we can create multiple initiator ports (each with different inames) per device/scsi_host. The current iname reflects that qla4xxx can have one iname per hba, and we are allocating a host per session for software. The iname on the host will remain so we can export and set the hba level qla4xxx setting. The ifacename attr: To bind a session to a some peice of hardware in userspace we maintain some mappings, but during boot or iscsid restart (iscsid contains the user space part of the driver) we need to be able to figure out which of those host mappings abstractions maps to certain sessions. This patch adds a ifacename attr, which userspace can set to id the host side of the endpoint across pivot_roots and iscsid restarts. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c3
-rw-r--r--drivers/scsi/iscsi_tcp.c3
-rw-r--r--drivers/scsi/libiscsi.c20
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c6
-rw-r--r--include/scsi/iscsi_if.h79
-rw-r--r--include/scsi/libiscsi.h2
6 files changed, 74 insertions, 39 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 42e95b833092..08edbaf89223 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -629,7 +629,8 @@ static struct iscsi_transport iscsi_iser_transport = {
629 ISCSI_USERNAME | ISCSI_PASSWORD | 629 ISCSI_USERNAME | ISCSI_PASSWORD |
630 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | 630 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
631 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | 631 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
632 ISCSI_PING_TMO | ISCSI_RECV_TMO, 632 ISCSI_PING_TMO | ISCSI_RECV_TMO |
633 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
633 .host_param_mask = ISCSI_HOST_HWADDRESS | 634 .host_param_mask = ISCSI_HOST_HWADDRESS |
634 ISCSI_HOST_NETDEV_NAME | 635 ISCSI_HOST_NETDEV_NAME |
635 ISCSI_HOST_INITIATOR_NAME, 636 ISCSI_HOST_INITIATOR_NAME,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 92d031959002..7552dd8a88f3 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1957,7 +1957,8 @@ static struct iscsi_transport iscsi_tcp_transport = {
1957 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | 1957 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
1958 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | 1958 ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
1959 ISCSI_LU_RESET_TMO | 1959 ISCSI_LU_RESET_TMO |
1960 ISCSI_PING_TMO | ISCSI_RECV_TMO, 1960 ISCSI_PING_TMO | ISCSI_RECV_TMO |
1961 ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
1961 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 1962 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
1962 ISCSI_HOST_INITIATOR_NAME | 1963 ISCSI_HOST_INITIATOR_NAME |
1963 ISCSI_HOST_NETDEV_NAME, 1964 ISCSI_HOST_NETDEV_NAME,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index e88b726ab2e0..c1af2aa8e4e0 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1990,6 +1990,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
1990 kfree(session->username); 1990 kfree(session->username);
1991 kfree(session->username_in); 1991 kfree(session->username_in);
1992 kfree(session->targetname); 1992 kfree(session->targetname);
1993 kfree(session->initiatorname);
1994 kfree(session->ifacename);
1993 1995
1994 iscsi_destroy_session(cls_session); 1996 iscsi_destroy_session(cls_session);
1995 module_put(owner); 1997 module_put(owner);
@@ -2453,6 +2455,14 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
2453 if (!conn->persistent_address) 2455 if (!conn->persistent_address)
2454 return -ENOMEM; 2456 return -ENOMEM;
2455 break; 2457 break;
2458 case ISCSI_PARAM_IFACE_NAME:
2459 if (!session->ifacename)
2460 session->ifacename = kstrdup(buf, GFP_KERNEL);
2461 break;
2462 case ISCSI_PARAM_INITIATOR_NAME:
2463 if (!session->initiatorname)
2464 session->initiatorname = kstrdup(buf, GFP_KERNEL);
2465 break;
2456 default: 2466 default:
2457 return -ENOSYS; 2467 return -ENOSYS;
2458 } 2468 }
@@ -2519,6 +2529,15 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session,
2519 case ISCSI_PARAM_PASSWORD_IN: 2529 case ISCSI_PARAM_PASSWORD_IN:
2520 len = sprintf(buf, "%s\n", session->password_in); 2530 len = sprintf(buf, "%s\n", session->password_in);
2521 break; 2531 break;
2532 case ISCSI_PARAM_IFACE_NAME:
2533 len = sprintf(buf, "%s\n", session->ifacename);
2534 break;
2535 case ISCSI_PARAM_INITIATOR_NAME:
2536 if (!session->initiatorname)
2537 len = sprintf(buf, "%s\n", "unknown");
2538 else
2539 len = sprintf(buf, "%s\n", session->initiatorname);
2540 break;
2522 default: 2541 default:
2523 return -ENOSYS; 2542 return -ENOSYS;
2524 } 2543 }
@@ -2606,6 +2625,7 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
2606 else 2625 else
2607 len = sprintf(buf, "%s\n", 2626 len = sprintf(buf, "%s\n",
2608 ihost->local_address); 2627 ihost->local_address);
2628 break;
2609 default: 2629 default:
2610 return -ENOSYS; 2630 return -ENOSYS;
2611 } 2631 }
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index c3c07ccccca7..9fd5c6d87ed1 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -30,7 +30,7 @@
30#include <scsi/scsi_transport_iscsi.h> 30#include <scsi/scsi_transport_iscsi.h>
31#include <scsi/iscsi_if.h> 31#include <scsi/iscsi_if.h>
32 32
33#define ISCSI_SESSION_ATTRS 19 33#define ISCSI_SESSION_ATTRS 21
34#define ISCSI_CONN_ATTRS 13 34#define ISCSI_CONN_ATTRS 13
35#define ISCSI_HOST_ATTRS 4 35#define ISCSI_HOST_ATTRS 4
36 36
@@ -1634,6 +1634,8 @@ iscsi_session_attr(password_in, ISCSI_PARAM_PASSWORD_IN, 1);
1634iscsi_session_attr(fast_abort, ISCSI_PARAM_FAST_ABORT, 0); 1634iscsi_session_attr(fast_abort, ISCSI_PARAM_FAST_ABORT, 0);
1635iscsi_session_attr(abort_tmo, ISCSI_PARAM_ABORT_TMO, 0); 1635iscsi_session_attr(abort_tmo, ISCSI_PARAM_ABORT_TMO, 0);
1636iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0); 1636iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0);
1637iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
1638iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0)
1637 1639
1638static ssize_t 1640static ssize_t
1639show_priv_session_state(struct device *dev, struct device_attribute *attr, 1641show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -1875,6 +1877,8 @@ iscsi_register_transport(struct iscsi_transport *tt)
1875 SETUP_SESSION_RD_ATTR(fast_abort, ISCSI_FAST_ABORT); 1877 SETUP_SESSION_RD_ATTR(fast_abort, ISCSI_FAST_ABORT);
1876 SETUP_SESSION_RD_ATTR(abort_tmo, ISCSI_ABORT_TMO); 1878 SETUP_SESSION_RD_ATTR(abort_tmo, ISCSI_ABORT_TMO);
1877 SETUP_SESSION_RD_ATTR(lu_reset_tmo,ISCSI_LU_RESET_TMO); 1879 SETUP_SESSION_RD_ATTR(lu_reset_tmo,ISCSI_LU_RESET_TMO);
1880 SETUP_SESSION_RD_ATTR(ifacename, ISCSI_IFACE_NAME);
1881 SETUP_SESSION_RD_ATTR(initiatorname, ISCSI_INITIATOR_NAME);
1878 SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo); 1882 SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo);
1879 SETUP_PRIV_SESSION_RD_ATTR(state); 1883 SETUP_PRIV_SESSION_RD_ATTR(state);
1880 1884
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index a0f13a280e71..16be12f1cbe8 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -257,42 +257,49 @@ enum iscsi_param {
257 257
258 ISCSI_PARAM_PING_TMO, 258 ISCSI_PARAM_PING_TMO,
259 ISCSI_PARAM_RECV_TMO, 259 ISCSI_PARAM_RECV_TMO,
260
261 ISCSI_PARAM_IFACE_NAME,
262 ISCSI_PARAM_ISID,
263 ISCSI_PARAM_INITIATOR_NAME,
260 /* must always be last */ 264 /* must always be last */
261 ISCSI_PARAM_MAX, 265 ISCSI_PARAM_MAX,
262}; 266};
263 267
264#define ISCSI_MAX_RECV_DLENGTH (1 << ISCSI_PARAM_MAX_RECV_DLENGTH) 268#define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH)
265#define ISCSI_MAX_XMIT_DLENGTH (1 << ISCSI_PARAM_MAX_XMIT_DLENGTH) 269#define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH)
266#define ISCSI_HDRDGST_EN (1 << ISCSI_PARAM_HDRDGST_EN) 270#define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN)
267#define ISCSI_DATADGST_EN (1 << ISCSI_PARAM_DATADGST_EN) 271#define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN)
268#define ISCSI_INITIAL_R2T_EN (1 << ISCSI_PARAM_INITIAL_R2T_EN) 272#define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN)
269#define ISCSI_MAX_R2T (1 << ISCSI_PARAM_MAX_R2T) 273#define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T)
270#define ISCSI_IMM_DATA_EN (1 << ISCSI_PARAM_IMM_DATA_EN) 274#define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN)
271#define ISCSI_FIRST_BURST (1 << ISCSI_PARAM_FIRST_BURST) 275#define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST)
272#define ISCSI_MAX_BURST (1 << ISCSI_PARAM_MAX_BURST) 276#define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST)
273#define ISCSI_PDU_INORDER_EN (1 << ISCSI_PARAM_PDU_INORDER_EN) 277#define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN)
274#define ISCSI_DATASEQ_INORDER_EN (1 << ISCSI_PARAM_DATASEQ_INORDER_EN) 278#define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN)
275#define ISCSI_ERL (1 << ISCSI_PARAM_ERL) 279#define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL)
276#define ISCSI_IFMARKER_EN (1 << ISCSI_PARAM_IFMARKER_EN) 280#define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN)
277#define ISCSI_OFMARKER_EN (1 << ISCSI_PARAM_OFMARKER_EN) 281#define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN)
278#define ISCSI_EXP_STATSN (1 << ISCSI_PARAM_EXP_STATSN) 282#define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN)
279#define ISCSI_TARGET_NAME (1 << ISCSI_PARAM_TARGET_NAME) 283#define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME)
280#define ISCSI_TPGT (1 << ISCSI_PARAM_TPGT) 284#define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT)
281#define ISCSI_PERSISTENT_ADDRESS (1 << ISCSI_PARAM_PERSISTENT_ADDRESS) 285#define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS)
282#define ISCSI_PERSISTENT_PORT (1 << ISCSI_PARAM_PERSISTENT_PORT) 286#define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT)
283#define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO) 287#define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO)
284#define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT) 288#define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT)
285#define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS) 289#define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS)
286#define ISCSI_USERNAME (1 << ISCSI_PARAM_USERNAME) 290#define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME)
287#define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN) 291#define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN)
288#define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD) 292#define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD)
289#define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN) 293#define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN)
290#define ISCSI_FAST_ABORT (1 << ISCSI_PARAM_FAST_ABORT) 294#define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT)
291#define ISCSI_ABORT_TMO (1 << ISCSI_PARAM_ABORT_TMO) 295#define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO)
292#define ISCSI_LU_RESET_TMO (1 << ISCSI_PARAM_LU_RESET_TMO) 296#define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO)
293#define ISCSI_HOST_RESET_TMO (1 << ISCSI_PARAM_HOST_RESET_TMO) 297#define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO)
294#define ISCSI_PING_TMO (1 << ISCSI_PARAM_PING_TMO) 298#define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO)
295#define ISCSI_RECV_TMO (1 << ISCSI_PARAM_RECV_TMO) 299#define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO)
300#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
301#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
302#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
296 303
297/* iSCSI HBA params */ 304/* iSCSI HBA params */
298enum iscsi_host_param { 305enum iscsi_host_param {
@@ -303,10 +310,10 @@ enum iscsi_host_param {
303 ISCSI_HOST_PARAM_MAX, 310 ISCSI_HOST_PARAM_MAX,
304}; 311};
305 312
306#define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS) 313#define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS)
307#define ISCSI_HOST_INITIATOR_NAME (1 << ISCSI_HOST_PARAM_INITIATOR_NAME) 314#define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME)
308#define ISCSI_HOST_NETDEV_NAME (1 << ISCSI_HOST_PARAM_NETDEV_NAME) 315#define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME)
309#define ISCSI_HOST_IPADDRESS (1 << ISCSI_HOST_PARAM_IPADDRESS) 316#define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS)
310 317
311#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 318#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
312#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 319#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 13c92d7ba969..21cfb1d5483f 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -270,6 +270,8 @@ struct iscsi_session {
270 char *password; 270 char *password;
271 char *password_in; 271 char *password_in;
272 char *targetname; 272 char *targetname;
273 char *ifacename;
274 char *initiatorname;
273 /* control data */ 275 /* control data */
274 struct iscsi_transport *tt; 276 struct iscsi_transport *tt;
275 struct Scsi_Host *host; 277 struct Scsi_Host *host;