aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
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 /drivers/scsi
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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/iscsi_tcp.c3
-rw-r--r--drivers/scsi/libiscsi.c20
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c6
3 files changed, 27 insertions, 2 deletions
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