aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2007-05-30 13:57:25 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-02 15:38:04 -0400
commitd8196ed2181b4595eaf464a5bcbddb6c28649a39 (patch)
treec4a9fd65f2c43bfecfa50f5714036f52200749c6
parent2223696192c687f2853e42b7c1e0d3ef002081fd (diff)
[SCSI] iscsi class, iscsi_tcp, iser, qla4xxx: add netdevname sysfs attr
iSCSI must support software iscsi (iscsi_tcp, iser), hardware iscsi (qla4xxx), and partial offload (broadcom). To be able to allow each stack or driver or port (virtual or physical) to be able to log into the same target portal we use the initiator tuple [[HWADDRESS | NETDEVNAME], INITIATOR_NAME] and the target tuple [TARGETNAME, CONN_ADDRESS, CONN_PORT] to id a session. This patch adds the netdev name, which is used by software iscsi when it binds a session to a netdevice using the SO_BINDTODEVICE sock opt. It cannot use HWADDRESS because if someone did vlans then the same netdevice will have the same mac and the initiator,target id will not be unique. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Cc: Roland Dreier <rdreier@cisco.com> Cc: David C Somayajulu <david.somayajulu@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c1
-rw-r--r--drivers/scsi/iscsi_tcp.c3
-rw-r--r--drivers/scsi/libiscsi.c11
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c3
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c6
-rw-r--r--include/scsi/iscsi_if.h3
-rw-r--r--include/scsi/libiscsi.h3
7 files changed, 25 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index bed583c426e6..1bf173decade 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -583,6 +583,7 @@ static struct iscsi_transport iscsi_iser_transport = {
583 ISCSI_USERNAME | ISCSI_PASSWORD | 583 ISCSI_USERNAME | ISCSI_PASSWORD |
584 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, 584 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN,
585 .host_param_mask = ISCSI_HOST_HWADDRESS | 585 .host_param_mask = ISCSI_HOST_HWADDRESS |
586 ISCSI_HOST_NETDEV_NAME |
586 ISCSI_HOST_INITIATOR_NAME, 587 ISCSI_HOST_INITIATOR_NAME,
587 .host_template = &iscsi_iser_sht, 588 .host_template = &iscsi_iser_sht,
588 .conndata_size = sizeof(struct iscsi_conn), 589 .conndata_size = sizeof(struct iscsi_conn),
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index da66fb524b5b..d5a6527b3b3d 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -2303,7 +2303,8 @@ static struct iscsi_transport iscsi_tcp_transport = {
2303 ISCSI_USERNAME | ISCSI_PASSWORD | 2303 ISCSI_USERNAME | ISCSI_PASSWORD |
2304 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, 2304 ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN,
2305 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | 2305 .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
2306 ISCSI_HOST_INITIATOR_NAME, 2306 ISCSI_HOST_INITIATOR_NAME |
2307 ISCSI_HOST_NETDEV_NAME,
2307 .host_template = &iscsi_sht, 2308 .host_template = &iscsi_sht,
2308 .conndata_size = sizeof(struct iscsi_conn), 2309 .conndata_size = sizeof(struct iscsi_conn),
2309 .max_conn = 1, 2310 .max_conn = 1,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 1632866f52cc..865dd5739f0e 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1483,6 +1483,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
1483 kfree(session->username); 1483 kfree(session->username);
1484 kfree(session->username_in); 1484 kfree(session->username_in);
1485 kfree(session->targetname); 1485 kfree(session->targetname);
1486 kfree(session->netdev);
1486 kfree(session->hwaddress); 1487 kfree(session->hwaddress);
1487 kfree(session->initiatorname); 1488 kfree(session->initiatorname);
1488 1489
@@ -2040,6 +2041,12 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
2040 int len; 2041 int len;
2041 2042
2042 switch (param) { 2043 switch (param) {
2044 case ISCSI_HOST_PARAM_NETDEV_NAME:
2045 if (!session->netdev)
2046 len = sprintf(buf, "%s\n", "default");
2047 else
2048 len = sprintf(buf, "%s\n", session->netdev);
2049 break;
2043 case ISCSI_HOST_PARAM_HWADDRESS: 2050 case ISCSI_HOST_PARAM_HWADDRESS:
2044 if (!session->hwaddress) 2051 if (!session->hwaddress)
2045 len = sprintf(buf, "%s\n", "default"); 2052 len = sprintf(buf, "%s\n", "default");
@@ -2067,6 +2074,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param,
2067 struct iscsi_session *session = iscsi_hostdata(shost->hostdata); 2074 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
2068 2075
2069 switch (param) { 2076 switch (param) {
2077 case ISCSI_HOST_PARAM_NETDEV_NAME:
2078 if (!session->netdev)
2079 session->netdev = kstrdup(buf, GFP_KERNEL);
2080 break;
2070 case ISCSI_HOST_PARAM_HWADDRESS: 2081 case ISCSI_HOST_PARAM_HWADDRESS:
2071 if (!session->hwaddress) 2082 if (!session->hwaddress)
2072 session->hwaddress = kstrdup(buf, GFP_KERNEL); 2083 session->hwaddress = kstrdup(buf, GFP_KERNEL);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index b87b460832ea..e69160a7bc60 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -102,7 +102,8 @@ static struct scsi_host_template qla4xxx_driver_template = {
102static struct iscsi_transport qla4xxx_iscsi_transport = { 102static struct iscsi_transport qla4xxx_iscsi_transport = {
103 .owner = THIS_MODULE, 103 .owner = THIS_MODULE,
104 .name = DRIVER_NAME, 104 .name = DRIVER_NAME,
105 .caps = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD, 105 .caps = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD |
106 CAP_DATA_PATH_OFFLOAD,
106 .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | 107 .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS |
107 ISCSI_TARGET_NAME | ISCSI_TPGT, 108 ISCSI_TARGET_NAME | ISCSI_TPGT,
108 .host_param_mask = ISCSI_HOST_HWADDRESS | 109 .host_param_mask = ISCSI_HOST_HWADDRESS |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 9b54eea20560..34c1860a259d 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -32,7 +32,7 @@
32 32
33#define ISCSI_SESSION_ATTRS 15 33#define ISCSI_SESSION_ATTRS 15
34#define ISCSI_CONN_ATTRS 11 34#define ISCSI_CONN_ATTRS 11
35#define ISCSI_HOST_ATTRS 3 35#define ISCSI_HOST_ATTRS 4
36#define ISCSI_TRANSPORT_VERSION "2.0-724" 36#define ISCSI_TRANSPORT_VERSION "2.0-724"
37 37
38struct iscsi_internal { 38struct iscsi_internal {
@@ -1261,8 +1261,9 @@ show_host_param_##param(struct class_device *cdev, char *buf) \
1261static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \ 1261static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \
1262 NULL); 1262 NULL);
1263 1263
1264iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS); 1264iscsi_host_attr(netdev, ISCSI_HOST_PARAM_NETDEV_NAME);
1265iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); 1265iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS);
1266iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS);
1266iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); 1267iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME);
1267 1268
1268#define SETUP_PRIV_SESSION_RD_ATTR(field) \ 1269#define SETUP_PRIV_SESSION_RD_ATTR(field) \
@@ -1399,6 +1400,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
1399 priv->t.host_size = sizeof(struct iscsi_host); 1400 priv->t.host_size = sizeof(struct iscsi_host);
1400 transport_container_register(&priv->t.host_attrs); 1401 transport_container_register(&priv->t.host_attrs);
1401 1402
1403 SETUP_HOST_RD_ATTR(netdev, ISCSI_HOST_NETDEV_NAME);
1402 SETUP_HOST_RD_ATTR(ipaddress, ISCSI_HOST_IPADDRESS); 1404 SETUP_HOST_RD_ATTR(ipaddress, ISCSI_HOST_IPADDRESS);
1403 SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); 1405 SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS);
1404 SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME); 1406 SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME);
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 642998069e00..50e907f42048 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -271,12 +271,14 @@ enum iscsi_param {
271enum iscsi_host_param { 271enum iscsi_host_param {
272 ISCSI_HOST_PARAM_HWADDRESS, 272 ISCSI_HOST_PARAM_HWADDRESS,
273 ISCSI_HOST_PARAM_INITIATOR_NAME, 273 ISCSI_HOST_PARAM_INITIATOR_NAME,
274 ISCSI_HOST_PARAM_NETDEV_NAME,
274 ISCSI_HOST_PARAM_IPADDRESS, 275 ISCSI_HOST_PARAM_IPADDRESS,
275 ISCSI_HOST_PARAM_MAX, 276 ISCSI_HOST_PARAM_MAX,
276}; 277};
277 278
278#define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS) 279#define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS)
279#define ISCSI_HOST_INITIATOR_NAME (1 << ISCSI_HOST_PARAM_INITIATOR_NAME) 280#define ISCSI_HOST_INITIATOR_NAME (1 << ISCSI_HOST_PARAM_INITIATOR_NAME)
281#define ISCSI_HOST_NETDEV_NAME (1 << ISCSI_HOST_PARAM_NETDEV_NAME)
280#define ISCSI_HOST_IPADDRESS (1 << ISCSI_HOST_PARAM_IPADDRESS) 282#define ISCSI_HOST_IPADDRESS (1 << ISCSI_HOST_PARAM_IPADDRESS)
281 283
282#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 284#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
@@ -303,6 +305,7 @@ enum iscsi_host_param {
303#define CAP_MARKERS 0x100 305#define CAP_MARKERS 0x100
304#define CAP_FW_DB 0x200 306#define CAP_FW_DB 0x200
305#define CAP_SENDTARGETS_OFFLOAD 0x400 307#define CAP_SENDTARGETS_OFFLOAD 0x400
308#define CAP_DATA_PATH_OFFLOAD 0x800
306 309
307/* 310/*
308 * These flags describes reason of stop_conn() call 311 * These flags describes reason of stop_conn() call
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index eea33f7b1544..3f631b08a1ab 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -228,8 +228,9 @@ struct iscsi_session {
228 char *password_in; 228 char *password_in;
229 char *targetname; 229 char *targetname;
230 char *initiatorname; 230 char *initiatorname;
231 /* hw address being used for iscsi connection */ 231 /* hw address or netdev iscsi connection is bound to */
232 char *hwaddress; 232 char *hwaddress;
233 char *netdev;
233 /* control data */ 234 /* control data */
234 struct iscsi_transport *tt; 235 struct iscsi_transport *tt;
235 struct Scsi_Host *host; 236 struct Scsi_Host *host;