]> err.no Git - linux-2.6/commitdiff
[SCSI] iscsi class, iscsi_tcp, iser, qla4xxx: add netdevname sysfs attr
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 30 May 2007 17:57:25 +0000 (12:57 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sat, 2 Jun 2007 19:38:04 +0000 (15:38 -0400)
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>
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/scsi_transport_iscsi.c
include/scsi/iscsi_if.h
include/scsi/libiscsi.h

index bed583c426e6fedd4fdf510b30e09861a07ebc8d..1bf173decade5d28bb81dd4a55cf0302b98ce4d4 100644 (file)
@@ -583,6 +583,7 @@ static struct iscsi_transport iscsi_iser_transport = {
                                  ISCSI_USERNAME | ISCSI_PASSWORD |
                                  ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN,
        .host_param_mask        = ISCSI_HOST_HWADDRESS |
+                                 ISCSI_HOST_NETDEV_NAME |
                                  ISCSI_HOST_INITIATOR_NAME,
        .host_template          = &iscsi_iser_sht,
        .conndata_size          = sizeof(struct iscsi_conn),
index da66fb524b5b844c734d6dc09baad32b84ec1bbb..d5a6527b3b3d80734e9311f42881c1b6ced18423 100644 (file)
@@ -2303,7 +2303,8 @@ static struct iscsi_transport iscsi_tcp_transport = {
                                  ISCSI_USERNAME | ISCSI_PASSWORD |
                                  ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN,
        .host_param_mask        = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
-                                 ISCSI_HOST_INITIATOR_NAME,
+                                 ISCSI_HOST_INITIATOR_NAME |
+                                 ISCSI_HOST_NETDEV_NAME,
        .host_template          = &iscsi_sht,
        .conndata_size          = sizeof(struct iscsi_conn),
        .max_conn               = 1,
index 1632866f52cc4fc5749aad7e60b24946ff3d06b7..865dd5739f0e36ab4a386b368b7559eff7d59ae1 100644 (file)
@@ -1483,6 +1483,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
        kfree(session->username);
        kfree(session->username_in);
        kfree(session->targetname);
+       kfree(session->netdev);
        kfree(session->hwaddress);
        kfree(session->initiatorname);
 
@@ -2040,6 +2041,12 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
        int len;
 
        switch (param) {
+       case ISCSI_HOST_PARAM_NETDEV_NAME:
+               if (!session->netdev)
+                       len = sprintf(buf, "%s\n", "default");
+               else
+                       len = sprintf(buf, "%s\n", session->netdev);
+               break;
        case ISCSI_HOST_PARAM_HWADDRESS:
                if (!session->hwaddress)
                        len = sprintf(buf, "%s\n", "default");
@@ -2067,6 +2074,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param,
        struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
 
        switch (param) {
+       case ISCSI_HOST_PARAM_NETDEV_NAME:
+               if (!session->netdev)
+                       session->netdev = kstrdup(buf, GFP_KERNEL);
+               break;
        case ISCSI_HOST_PARAM_HWADDRESS:
                if (!session->hwaddress)
                        session->hwaddress = kstrdup(buf, GFP_KERNEL);
index b87b460832ea57ca13a540c3a42af029645417e8..e69160a7bc600e6ce3ce4604225db09be90f1d16 100644 (file)
@@ -102,7 +102,8 @@ static struct scsi_host_template qla4xxx_driver_template = {
 static struct iscsi_transport qla4xxx_iscsi_transport = {
        .owner                  = THIS_MODULE,
        .name                   = DRIVER_NAME,
-       .caps                   = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD,
+       .caps                   = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD |
+                                 CAP_DATA_PATH_OFFLOAD,
        .param_mask             = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS |
                                  ISCSI_TARGET_NAME | ISCSI_TPGT,
        .host_param_mask        = ISCSI_HOST_HWADDRESS |
index 9b54eea20560364e9f73c6190089447f79b9d5f3..34c1860a259d8ac5ea458db279e263c13ed0deed 100644 (file)
@@ -32,7 +32,7 @@
 
 #define ISCSI_SESSION_ATTRS 15
 #define ISCSI_CONN_ATTRS 11
-#define ISCSI_HOST_ATTRS 3
+#define ISCSI_HOST_ATTRS 4
 #define ISCSI_TRANSPORT_VERSION "2.0-724"
 
 struct iscsi_internal {
@@ -1261,8 +1261,9 @@ show_host_param_##param(struct class_device *cdev, char *buf)             \
 static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \
                        NULL);
 
-iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS);
+iscsi_host_attr(netdev, ISCSI_HOST_PARAM_NETDEV_NAME);
 iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS);
+iscsi_host_attr(ipaddress, ISCSI_HOST_PARAM_IPADDRESS);
 iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME);
 
 #define SETUP_PRIV_SESSION_RD_ATTR(field)                              \
@@ -1399,6 +1400,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
        priv->t.host_size = sizeof(struct iscsi_host);
        transport_container_register(&priv->t.host_attrs);
 
+       SETUP_HOST_RD_ATTR(netdev, ISCSI_HOST_NETDEV_NAME);
        SETUP_HOST_RD_ATTR(ipaddress, ISCSI_HOST_IPADDRESS);
        SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS);
        SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME);
index 642998069e0070949bc7cb4be01ca393f4c5b986..50e907f4204849177f8e883ced1ec53b3030504f 100644 (file)
@@ -271,12 +271,14 @@ enum iscsi_param {
 enum iscsi_host_param {
        ISCSI_HOST_PARAM_HWADDRESS,
        ISCSI_HOST_PARAM_INITIATOR_NAME,
+       ISCSI_HOST_PARAM_NETDEV_NAME,
        ISCSI_HOST_PARAM_IPADDRESS,
        ISCSI_HOST_PARAM_MAX,
 };
 
 #define ISCSI_HOST_HWADDRESS           (1 << ISCSI_HOST_PARAM_HWADDRESS)
 #define ISCSI_HOST_INITIATOR_NAME      (1 << ISCSI_HOST_PARAM_INITIATOR_NAME)
+#define ISCSI_HOST_NETDEV_NAME         (1 << ISCSI_HOST_PARAM_NETDEV_NAME)
 #define ISCSI_HOST_IPADDRESS           (1 << ISCSI_HOST_PARAM_IPADDRESS)
 
 #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
@@ -303,6 +305,7 @@ enum iscsi_host_param {
 #define CAP_MARKERS            0x100
 #define CAP_FW_DB              0x200
 #define CAP_SENDTARGETS_OFFLOAD        0x400
+#define CAP_DATA_PATH_OFFLOAD  0x800
 
 /*
  * These flags describes reason of stop_conn() call
index eea33f7b1544bb6f8b448fbc86bdc86dafd94636..3f631b08a1ab3a63fd4cc2a9d4291cb87ac4613f 100644 (file)
@@ -228,8 +228,9 @@ struct iscsi_session {
        char                    *password_in;
        char                    *targetname;
        char                    *initiatorname;
-       /* hw address being used for iscsi connection */
+       /* hw address or netdev iscsi connection is bound to */
        char                    *hwaddress;
+       char                    *netdev;
        /* control data */
        struct iscsi_transport  *tt;
        struct Scsi_Host        *host;