All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/11] qla4xxx: added IPv6 support.
@ 2010-01-30  6:28 Ravi Anand
  2010-02-01 18:15 ` Mike Christie
  0 siblings, 1 reply; 8+ messages in thread
From: Ravi Anand @ 2010-01-30  6:28 UTC (permalink / raw)
  To: James Bottomley; +Cc: Linux-SCSI Mailing List, Mike Christie, Vikas Chaudhary

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h  |   50 +++++++-
 drivers/scsi/qla4xxx/ql4_fw.h   |   43 ++++++-
 drivers/scsi/qla4xxx/ql4_init.c |  212 +++++++++++++++++++++++++------
 drivers/scsi/qla4xxx/ql4_mbx.c  |  266 +++++++++++++++++++++++++--------------
 4 files changed, 426 insertions(+), 145 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 38e261d..9c37989 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -114,6 +114,7 @@
  */
 #define MAC_ADDR_LEN                   6       /* in bytes */
 #define IP_ADDR_LEN                    4       /* in bytes */
+#define IPv6_ADDR_LEN                  16      /* IPv6 address size */
 #define DRIVER_NAME                    "qla4xxx"

 #define MAX_LINKED_CMDS_PER_LUN                3
@@ -221,7 +222,7 @@ struct ddb_entry {

        uint16_t os_target_id;  /* Target ID */
        uint16_t fw_ddb_index;  /* DDB firmware index */
-       uint8_t reserved[2];
+       uint8_t options;
        uint32_t fw_ddb_device_state; /* F/W Device State  -- see ql4_fw.h */

        uint32_t CmdSn;
@@ -246,10 +247,18 @@ struct ddb_entry {

        uint16_t port;
        uint32_t tpgt;
-       uint8_t ip_addr[ISCSI_IPADDR_SIZE];
+       uint8_t ip_addr[IP_ADDR_LEN];
        uint8_t iscsi_name[ISCSI_NAME_SIZE];    /* 72 x48 */
        uint8_t iscsi_alias[0x20];
        uint8_t isid[6];
+       uint16_t iscsi_max_burst_len;
+       uint16_t iscsi_max_outsnd_r2t;
+       uint16_t iscsi_first_burst_len;
+       uint16_t iscsi_max_rcv_data_seg_len;
+       uint16_t iscsi_max_snd_data_seg_len;
+
+       struct in6_addr remote_ipv6_addr;
+       struct in6_addr link_local_ipv6_addr;
 };

 /*
@@ -275,6 +284,16 @@ struct ddb_entry {
 #include "ql4_fw.h"
 #include "ql4_nvram.h"

+/* shortcut to print ISID */
+#define ISID(addr) \
+       ((unsigned char *)&addr)[5], \
+       ((unsigned char *)&addr)[4], \
+       ((unsigned char *)&addr)[3], \
+       ((unsigned char *)&addr)[2], \
+       ((unsigned char *)&addr)[1], \
+       ((unsigned char *)&addr)[0]
+#define ISID_FMT "0x%02x%02x%02x%02x%02x%02x"
+
 /*
  * Linux Host Adapter structure
  */
@@ -442,8 +461,35 @@ struct scsi_qla_host {

        /* Saved srb for status continuation entry processing */
        struct srb *status_srb;
+
+       /* IPv6 support info from InitFW */
+       uint8_t acb_version;
+       uint8_t ipv4_addr_state;
+       uint16_t ipv4_options;
+
+       uint32_t resvd2;
+       uint32_t ipv6_options;
+       uint32_t ipv6_addl_options;
+       uint8_t ipv6_link_local_state;
+       uint8_t ipv6_addr0_state;
+       uint8_t ipv6_addr1_state;
+       uint8_t ipv6_default_router_state;
+       struct in6_addr ipv6_link_local_addr;
+       struct in6_addr ipv6_addr0;
+       struct in6_addr ipv6_addr1;
+       struct in6_addr ipv6_default_router_addr;
 };

+static inline int is_ipv4_enabled(struct scsi_qla_host *ha)
+{
+       return ((ha->ipv4_options & IPOPT_IPv4_PROTOCOL_ENABLE) != 0);
+}
+
+static inline int is_ipv6_enabled(struct scsi_qla_host *ha)
+{
+       return ((ha->ipv6_options & IPV6_OPT_IPV6_PROTOCOL_ENABLE) != 0);
+}
+
 static inline int is_qla4010(struct scsi_qla_host *ha)
 {
        return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4010;
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 9cd7a60..835c95c 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -258,13 +258,15 @@ union external_hw_config_reg {
 /* Mailbox 1 */
 #define FW_STATE_READY                         0x0000
 #define FW_STATE_CONFIG_WAIT                   0x0001
-#define FW_STATE_WAIT_LOGIN                    0x0002
+#define FW_STATE_WAIT_AUTOCONNECT              0x0002
 #define FW_STATE_ERROR                         0x0004
-#define FW_STATE_DHCP_IN_PROGRESS              0x0008
+#define FW_STATE_CONFIGURING_IP                        0x0008

 /* Mailbox 3 */
 #define FW_ADDSTATE_OPTICAL_MEDIA              0x0001
-#define FW_ADDSTATE_DHCP_ENABLED               0x0002
+#define FW_ADDSTATE_DHCPv4_ENABLED             0x0002
+#define FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED      0x0004
+#define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED       0x0008
 #define FW_ADDSTATE_LINK_UP                    0x0010
 #define FW_ADDSTATE_ISNS_SVC_ENABLED           0x0020
 #define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS   0x006B
@@ -320,6 +322,8 @@ union external_hw_config_reg {
 /* Host Adapter Initialization Control Block (from host) */
 struct addr_ctrl_blk {
        uint8_t version;        /* 00 */
+#define  IFCB_VER_MIN                  0x01
+#define  IFCB_VER_MAX                  0x02
        uint8_t control;        /* 01 */

        uint16_t fw_options;    /* 02-03 */
@@ -351,11 +355,15 @@ struct addr_ctrl_blk {
        uint16_t iscsi_opts;    /* 30-31 */
        uint16_t ipv4_tcp_opts; /* 32-33 */
        uint16_t ipv4_ip_opts;  /* 34-35 */
+#define  IPOPT_IPv4_PROTOCOL_ENABLE    0x8000

        uint16_t iscsi_max_pdu_size;    /* 36-37 */
        uint8_t ipv4_tos;       /* 38 */
        uint8_t ipv4_ttl;       /* 39 */
        uint8_t acb_version;    /* 3A */
+#define ACB_NOT_SUPPORTED              0x00
+#define ACB_SUPPORTED                  0x02 /* Capable of ACB Version 2 Features */
+
        uint8_t res2;   /* 3B */
        uint16_t def_timeout;   /* 3C-3D */
        uint16_t iscsi_fburst_len;      /* 3E-3F */
@@ -397,16 +405,34 @@ struct addr_ctrl_blk {
        uint32_t cookie;        /* 200-203 */
        uint16_t ipv6_port;     /* 204-205 */
        uint16_t ipv6_opts;     /* 206-207 */
+#define IPV6_OPT_IPV6_PROTOCOL_ENABLE  0x8000
+
        uint16_t ipv6_addtl_opts;       /* 208-209 */
+#define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE     0x0002 /* Pri ACB Only */
+#define IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR         0x0001
+
        uint16_t ipv6_tcp_opts; /* 20A-20B */
        uint8_t ipv6_tcp_wsf;   /* 20C */
        uint16_t ipv6_flow_lbl; /* 20D-20F */
-       uint8_t ipv6_gw_addr[16];       /* 210-21F */
+       uint8_t ipv6_dflt_rtr_addr[16]; /* 210-21F */
        uint16_t ipv6_vlan_tag; /* 220-221 */
        uint8_t ipv6_lnk_lcl_addr_state;/* 222 */
        uint8_t ipv6_addr0_state;       /* 223 */
        uint8_t ipv6_addr1_state;       /* 224 */
-       uint8_t ipv6_gw_state;  /* 225 */
+#define IP_ADDRSTATE_UNCONFIGURED      0
+#define IP_ADDRSTATE_INVALID           1
+#define IP_ADDRSTATE_ACQUIRING         2
+#define IP_ADDRSTATE_TENTATIVE         3
+#define IP_ADDRSTATE_DEPRICATED                4
+#define IP_ADDRSTATE_PREFERRED         5
+#define IP_ADDRSTATE_DISABLING         6
+
+       uint8_t ipv6_dflt_rtr_state;    /* 225 */
+#define IPV6_RTRSTATE_UNKNOWN                   0
+#define IPV6_RTRSTATE_MANUAL                    1
+#define IPV6_RTRSTATE_ADVERTISED                3
+#define IPV6_RTRSTATE_STALE                     4
+
        uint8_t ipv6_traffic_class;     /* 226 */
        uint8_t ipv6_hop_limit; /* 227 */
        uint8_t ipv6_if_id[8];  /* 228-22F */
@@ -424,7 +450,7 @@ struct addr_ctrl_blk {

 struct init_fw_ctrl_blk {
        struct addr_ctrl_blk pri;
-       struct addr_ctrl_blk sec;
+/*     struct addr_ctrl_blk sec;*/
 };

 /*************************************************************************/
@@ -433,6 +459,9 @@ struct dev_db_entry {
        uint16_t options;       /* 00-01 */
 #define DDB_OPT_DISC_SESSION  0x10
 #define DDB_OPT_TARGET       0x02 /* device is a target */
+#define DDB_OPT_IPV6_DEVICE    0x100
+#define DDB_OPT_IPV6_NULL_LINK_LOCAL           0x800 /* post connection */
+#define DDB_OPT_IPV6_FW_DEFINED_LINK_LOCAL     0x800 /* pre connection */

        uint16_t exec_throttle; /* 02-03 */
        uint16_t exec_count;    /* 04-05 */
@@ -468,7 +497,7 @@ struct dev_db_entry {
                                         * pointer to a string so we
                                         * don't have to reserve soooo
                                         * much RAM */
-       uint8_t ipv6_addr[0x10];/* 1A0-1AF */
+       uint8_t link_local_ipv6_addr[0x10]; /* 1A0-1AF */
        uint8_t res5[0x10];     /* 1B0-1BF */
        uint16_t ddb_link;      /* 1C0-1C1 */
        uint16_t chap_tbl_idx;  /* 1C2-1C3 */
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index af8c323..cad9d45 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -189,6 +189,71 @@ static int qla4xxx_init_local_data(struct scsi_qla_host *ha)
        return qla4xxx_get_firmware_status(ha);
 }

+static uint8_t
+qla4xxx_wait_for_ip_config(struct scsi_qla_host *ha)
+{
+       uint8_t ipv4_wait = 0;
+       uint8_t ipv6_wait = 0;
+       int8_t ip_address[IPv6_ADDR_LEN] = {0} ;
+
+       /* If both IPv4 & IPv6 are enabled, possibly only one
+        * IP address may be acquired, so check to see if we
+        * need to wait for another */
+       if (is_ipv4_enabled(ha) && is_ipv6_enabled(ha)) {
+               if (((ha->addl_fw_state & FW_ADDSTATE_DHCPv4_ENABLED) != 0) &&
+                       ((ha->addl_fw_state & FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED) == 0)) {
+                       ipv4_wait = 1;
+               }
+               if (((ha->ipv6_addl_options & IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE) != 0) &&
+                   ((ha->ipv6_link_local_state == IP_ADDRSTATE_ACQUIRING) ||
+                    (ha->ipv6_addr0_state == IP_ADDRSTATE_ACQUIRING) ||
+                    (ha->ipv6_addr1_state == IP_ADDRSTATE_ACQUIRING))) {
+
+                       ipv6_wait = 1;
+
+                       if ((ha->ipv6_link_local_state == IP_ADDRSTATE_PREFERRED) ||
+                           (ha->ipv6_addr0_state == IP_ADDRSTATE_PREFERRED) ||
+                           (ha->ipv6_addr1_state == IP_ADDRSTATE_PREFERRED)) {
+                               DEBUG2(printk("scsi%ld: %s: "
+                                               "Preferred IP configured.  Don't wait! \n",
+                                               ha->host_no, __func__));
+                               ipv6_wait = 0;
+                       }
+                       if (memcmp(&ha->ipv6_default_router_addr, ip_address,
+                               IPv6_ADDR_LEN) == 0) {
+                               DEBUG2(printk("scsi%ld: %s: "
+                                             "No Router configured.  Don't wait! \n",
+                                             ha->host_no, __func__));
+                               ipv6_wait = 0;
+                       }
+                       if ((ha->ipv6_default_router_state == IPV6_RTRSTATE_MANUAL) &&
+                           (ha->ipv6_link_local_state == IP_ADDRSTATE_TENTATIVE) &&
+                           (memcmp(&ha->ipv6_link_local_addr,
+                                  &ha->ipv6_default_router_addr, 4) == 0)) {
+                               DEBUG2(printk("scsi%ld: %s: LinkLocal Router & "
+                                       "IP configured.  Don't wait! \n",
+                                       ha->host_no, __func__));
+                               ipv6_wait = 0;
+                       }
+               }
+               if (ipv4_wait || ipv6_wait) {
+                       DEBUG2(printk("scsi%ld: %s: Wait for additional IP(s) \"",
+                                       ha->host_no, __func__));
+                       if (ipv4_wait)
+                               DEBUG2(printk("IPv4 "));
+                       if (ha->ipv6_link_local_state == IP_ADDRSTATE_ACQUIRING)
+                               DEBUG2(printk("IPv6LinkLocal "));
+                       if (ha->ipv6_addr0_state == IP_ADDRSTATE_ACQUIRING)
+                               DEBUG2(printk("IPv6Addr0 "));
+                       if (ha->ipv6_addr1_state == IP_ADDRSTATE_ACQUIRING)
+                               DEBUG2(printk("IPv6Addr1 "));
+                       DEBUG2(printk("\"\n"));
+               }
+       }
+
+       return (ipv4_wait|ipv6_wait);
+}
+
 static int qla4xxx_fw_ready(struct scsi_qla_host *ha)
 {
        uint32_t timeout_count;
@@ -226,38 +291,75 @@ static int qla4xxx_fw_ready(struct scsi_qla_host *ha)
                        continue;
                }

+               if (ha->firmware_state & FW_STATE_WAIT_AUTOCONNECT) {
+                       DEBUG2(printk("scsi%ld: %s: fwstate:"
+                                     "AUTOCONNECT in progress\n",
+                                     ha->host_no, __func__));
+               }
+
+               if (ha->firmware_state & FW_STATE_CONFIGURING_IP) {
+                       DEBUG2(printk("scsi%ld: %s: fwstate: CONFIGURING IP\n",
+                                      ha->host_no, __func__));
+                       /*
+                        * Check for link state after 15 secs and if link is still DOWN then,
+                        * cable is unplugged. Ignore "DHCP in Progress/CONFIGURING IP" bit
+                        * to check if firmware is in ready state or not after 15 secs.
+                        * This is applicable for both 2.x & 3.x firmware
+                        */
+                       if (timeout_count <= (ADAPTER_INIT_TOV - 15)) {
+                               if (ha->addl_fw_state & FW_ADDSTATE_LINK_UP) {
+                                       DEBUG2(printk("scsi%ld: %s: LINK UP "
+                                                     "(Cable plugged)\n",
+                                                     ha->host_no, __func__));
+                               }
+                               else if (ha->firmware_state &
+                                       (FW_STATE_CONFIGURING_IP | FW_STATE_READY)) {
+                                       DEBUG2(printk("scsi%ld: %s: LINK DOWN "
+                                                     "(Cable unplugged)\n",
+                                                     ha->host_no, __func__));
+                                       ha->firmware_state = FW_STATE_READY;
+                               }
+                       }
+               }
+
                if (ha->firmware_state == FW_STATE_READY) {
-                       DEBUG2(dev_info(&ha->pdev->dev, "Firmware Ready..\n"));
-                       /* The firmware is ready to process SCSI commands. */
-                       DEBUG2(dev_info(&ha->pdev->dev,
-                                         "scsi%ld: %s: MEDIA TYPE - %s\n",
-                                         ha->host_no,
-                                         __func__, (ha->addl_fw_state &
-                                                    FW_ADDSTATE_OPTICAL_MEDIA)
-                                         != 0 ? "OPTICAL" : "COPPER"));
-                       DEBUG2(dev_info(&ha->pdev->dev,
-                                         "scsi%ld: %s: DHCP STATE Enabled "
-                                         "%s\n",
-                                         ha->host_no, __func__,
-                                         (ha->addl_fw_state &
-                                          FW_ADDSTATE_DHCP_ENABLED) != 0 ?
-                                         "YES" : "NO"));
-                       DEBUG2(dev_info(&ha->pdev->dev,
-                                         "scsi%ld: %s: LINK %s\n",
-                                         ha->host_no, __func__,
-                                         (ha->addl_fw_state &
-                                          FW_ADDSTATE_LINK_UP) != 0 ?
-                                         "UP" : "DOWN"));
-                       DEBUG2(dev_info(&ha->pdev->dev,
-                                         "scsi%ld: %s: iSNS Service "
-                                         "Started %s\n",
-                                         ha->host_no, __func__,
-                                         (ha->addl_fw_state &
-                                          FW_ADDSTATE_ISNS_SVC_ENABLED) != 0 ?
-                                         "YES" : "NO"));
-
-                       ready = 1;
-                       break;
+                       /* If DHCP IP Addr is available, retrieve it now. */
+                       if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags))
+                               qla4xxx_get_dhcp_ip_address(ha);
+
+                       if (!qla4xxx_wait_for_ip_config(ha) || timeout_count == 1) {
+                               DEBUG2(dev_info(&ha->pdev->dev, "Firmware Ready..\n"));
+                               /* The firmware is ready to process SCSI commands. */
+                               DEBUG2(dev_info(&ha->pdev->dev,
+                                                 "scsi%ld: %s: MEDIA TYPE - %s\n",
+                                                 ha->host_no,
+                                                 __func__, (ha->addl_fw_state &
+                                                            FW_ADDSTATE_OPTICAL_MEDIA)
+                                                 != 0 ? "OPTICAL" : "COPPER"));
+                               DEBUG2(dev_info(&ha->pdev->dev,
+                                                 "scsi%ld: %s: DHCPv4 STATE Enabled "
+                                                 "%s\n",
+                                                 ha->host_no, __func__,
+                                                 (ha->addl_fw_state &
+                                                  FW_ADDSTATE_DHCPv4_ENABLED) != 0 ?
+                                                 "YES" : "NO"));
+                               DEBUG2(dev_info(&ha->pdev->dev,
+                                                 "scsi%ld: %s: LINK %s\n",
+                                                 ha->host_no, __func__,
+                                                 (ha->addl_fw_state &
+                                                  FW_ADDSTATE_LINK_UP) != 0 ?
+                                                 "UP" : "DOWN"));
+                               DEBUG2(dev_info(&ha->pdev->dev,
+                                                 "scsi%ld: %s: iSNS Service "
+                                                 "Started %s\n",
+                                                 ha->host_no, __func__,
+                                                 (ha->addl_fw_state &
+                                                  FW_ADDSTATE_ISNS_SVC_ENABLED) != 0 ?
+                                                 "YES" : "NO"));
+
+                               ready = 1;
+                               break;
+                       }
                }
                DEBUG2(printk("scsi%ld: %s: waiting on fw, state=%x:%x - "
                              "seconds expired= %d\n", ha->host_no, __func__,
@@ -272,15 +374,19 @@ static int qla4xxx_fw_ready(struct scsi_qla_host *ha)
                msleep(1000);
        }                       /* end of for */

-       if (timeout_count == 0)
+       if (timeout_count <= 0)
                DEBUG2(printk("scsi%ld: %s: FW Initialization timed out!\n",
                              ha->host_no, __func__));

-       if (ha->firmware_state & FW_STATE_DHCP_IN_PROGRESS)  {
-               DEBUG2(printk("scsi%ld: %s: FW is reporting its waiting to"
-                             " grab an IP address from DHCP server\n",
-                             ha->host_no, __func__));
+       if (ha->firmware_state & FW_STATE_CONFIGURING_IP) {
+               DEBUG2(printk("scsi%ld: %s: FW initialized, but is reporting "
+                             "it's waiting to configure an IP address\n",
+                              ha->host_no, __func__));
                ready = 1;
+       } else if (ha->firmware_state & FW_STATE_WAIT_AUTOCONNECT) {
+               DEBUG2(printk("scsi%ld: %s: FW initialized, but "
+                             "auto-discovery still in process\n",
+                              ha->host_no, __func__));
        }

        return ready;
@@ -442,11 +548,35 @@ static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha,
        memcpy(&ddb_entry->ip_addr[0], &fw_ddb_entry->ip_addr[0],
               min(sizeof(ddb_entry->ip_addr), sizeof(fw_ddb_entry->ip_addr)));

-       DEBUG2(printk("scsi%ld: %s: ddb[%d] - State= %x status= %d.\n",
-                     ha->host_no, __func__, fw_ddb_index,
-                     ddb_entry->fw_ddb_device_state, status));
+       ddb_entry->iscsi_max_burst_len = fw_ddb_entry->iscsi_max_burst_len;
+       ddb_entry->iscsi_max_outsnd_r2t = fw_ddb_entry->iscsi_max_outsnd_r2t;
+       ddb_entry->iscsi_first_burst_len = fw_ddb_entry->iscsi_first_burst_len;
+       ddb_entry->iscsi_max_rcv_data_seg_len =
+                               fw_ddb_entry->iscsi_max_rcv_data_seg_len;
+       ddb_entry->iscsi_max_snd_data_seg_len =
+                               fw_ddb_entry->iscsi_max_snd_data_seg_len;
+
+       if (ddb_entry->options & DDB_OPT_IPV6_DEVICE) {
+               memcpy(&ddb_entry->remote_ipv6_addr,
+                       fw_ddb_entry->ip_addr,
+                       min(sizeof(ddb_entry->remote_ipv6_addr),
+                       sizeof(fw_ddb_entry->ip_addr)));
+               memcpy(&ddb_entry->link_local_ipv6_addr,
+                       fw_ddb_entry->link_local_ipv6_addr,
+                       min(sizeof(ddb_entry->link_local_ipv6_addr),
+                       sizeof(fw_ddb_entry->link_local_ipv6_addr)));
+       }

- exit_update_ddb:
+       DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
+                                       "State %04x ConnErr %08x "
+                                       NIPQUAD_FMT ":%04d \"%s\"\n",
+                                       __func__, fw_ddb_index,
+                                       ddb_entry->os_target_id,
+                                       ddb_state, conn_err,
+                                       NIPQUAD(fw_ddb_entry->ip_addr),
+                                       le16_to_cpu(fw_ddb_entry->port),
+                                       fw_ddb_entry->iscsi_name));
+exit_update_ddb:
        if (fw_ddb_entry)
                dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
                                  fw_ddb_entry, fw_ddb_entry_dma);
@@ -1168,7 +1298,7 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha,
         * the ddb_list and wait for DHCP lease acquired aen to come in
         * followed by 0x8014 aen" to trigger the tgt discovery process.
         */
-       if (ha->firmware_state & FW_STATE_DHCP_IN_PROGRESS)
+       if (ha->firmware_state & FW_STATE_CONFIGURING_IP)
                goto exit_init_online;

        /* Skip device discovery if ip and subnet is zero */
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 37c8fcb..8cb2dae 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -172,108 +172,198 @@ mbox_exit:
        return status;
 }

+uint8_t
+qla4xxx_set_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, uint32_t *mbox_sts,
+                       dma_addr_t init_fw_cb_dma)
+{
+       memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
+       memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
+       mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
+       mbox_cmd[1] = 0;
+       mbox_cmd[2] = LSDW(init_fw_cb_dma);
+       mbox_cmd[3] = MSDW(init_fw_cb_dma);
+       mbox_cmd[4] = sizeof(struct addr_ctrl_blk);
+       mbox_cmd[5] = (IFCB_VER_MAX << 8) | IFCB_VER_MIN;
+
+       if (qla4xxx_mailbox_command(ha, 6, 6, mbox_cmd, mbox_sts)
+               != QLA_SUCCESS) {
+               DEBUG2(printk("scsi%ld: %s: "
+                             "MBOX_CMD_INITIALIZE_FIRMWARE failed w/ status %04X\n",
+                             ha->host_no, __func__, mbox_sts[0]));
+               return (QLA_ERROR);
+       }
+       return (QLA_SUCCESS);
+}
+
+uint8_t
+qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, uint32_t *mbox_sts,
+                dma_addr_t init_fw_cb_dma)
+{
+       memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
+       memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
+       mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
+       mbox_cmd[2] = LSDW(init_fw_cb_dma);
+       mbox_cmd[3] = MSDW(init_fw_cb_dma);
+       mbox_cmd[4] = sizeof(struct addr_ctrl_blk);
+
+       if (qla4xxx_mailbox_command(ha, 5, 5, mbox_cmd, mbox_sts)
+               != QLA_SUCCESS) {
+
+               DEBUG2(printk("scsi%ld: %s: "
+                             "MBOX_CMD_GET_INIT_FW_CTRL_BLOCK failed w/ status %04X\n",
+                             ha->host_no, __func__, mbox_sts[0]));
+               return (QLA_ERROR);
+       }
+       return (QLA_SUCCESS);
+}
+
+void
+qla4xxx_update_local_ip(struct scsi_qla_host *ha,
+                        struct addr_ctrl_blk  *init_fw_cb)
+{
+       /* Save IPv4 Address Info */
+       memcpy(ha->ip_address, init_fw_cb->ipv4_addr,
+               min(sizeof(ha->ip_address), sizeof(init_fw_cb->ipv4_addr)));
+       memcpy(ha->subnet_mask, init_fw_cb->ipv4_subnet,
+               min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->ipv4_subnet)));
+       memcpy(ha->gateway, init_fw_cb->ipv4_gw_addr,
+               min(sizeof(ha->gateway), sizeof(init_fw_cb->ipv4_gw_addr)));
+
+       if (is_ipv6_enabled(ha)) {
+                /* Save IPv6 Address */
+               ha->ipv6_link_local_state = init_fw_cb->ipv6_lnk_lcl_addr_state;
+               ha->ipv6_addr0_state = init_fw_cb->ipv6_addr0_state;
+               ha->ipv6_addr1_state = init_fw_cb->ipv6_addr1_state;
+               ha->ipv6_default_router_state = init_fw_cb->ipv6_dflt_rtr_state;
+               ha->ipv6_link_local_addr.in6_u.u6_addr8[0] = 0xFE;
+               ha->ipv6_link_local_addr.in6_u.u6_addr8[1] = 0x80;
+
+               memcpy(&ha->ipv6_link_local_addr.in6_u.u6_addr8[8], init_fw_cb->ipv6_if_id,
+                       min(sizeof(ha->ipv6_link_local_addr)/2, sizeof(init_fw_cb->ipv6_if_id)));
+               memcpy(&ha->ipv6_addr0, init_fw_cb->ipv6_addr0,
+                       min(sizeof(ha->ipv6_addr0), sizeof(init_fw_cb->ipv6_addr0)));
+               memcpy(&ha->ipv6_addr1, init_fw_cb->ipv6_addr1,
+                       min(sizeof(ha->ipv6_addr1), sizeof(init_fw_cb->ipv6_addr1)));
+               memcpy(&ha->ipv6_default_router_addr, init_fw_cb->ipv6_dflt_rtr_addr,
+                       min(sizeof(ha->ipv6_default_router_addr), sizeof(init_fw_cb->ipv6_dflt_rtr_addr)));
+       }
+}
+
+uint8_t
+qla4xxx_update_local_ifcb(struct scsi_qla_host *ha,
+                         uint32_t *mbox_cmd,
+                         uint32_t *mbox_sts,
+                         struct addr_ctrl_blk  *init_fw_cb,
+                         dma_addr_t init_fw_cb_dma)
+{
+       if (qla4xxx_get_ifcb(ha, mbox_cmd, mbox_sts, init_fw_cb_dma)
+           != QLA_SUCCESS) {
+               DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n",
+                               ha->host_no, __func__));
+               return (QLA_ERROR);
+       }
+
+       DEBUG2(qla4xxx_dump_buffer(init_fw_cb, sizeof(struct addr_ctrl_blk)));
+
+       /* Save some info in adapter structure. */
+       ha->acb_version = init_fw_cb->acb_version;
+       ha->firmware_options = le16_to_cpu(init_fw_cb->fw_options);
+       ha->tcp_options = le16_to_cpu(init_fw_cb->ipv4_tcp_opts);
+       ha->ipv4_options = le16_to_cpu(init_fw_cb->ipv4_ip_opts);
+       ha->ipv4_addr_state = le16_to_cpu(init_fw_cb->ipv4_addr_state);
+       ha->heartbeat_interval = init_fw_cb->hb_interval;
+       memcpy(ha->name_string, init_fw_cb->iscsi_name,
+               min(sizeof(ha->name_string),
+               sizeof(init_fw_cb->iscsi_name)));
+       /*memcpy(ha->alias, init_fw_cb->Alias,
+              min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/
+
+       /* Save Command Line Paramater info */
+       ha->port_down_retry_count = le16_to_cpu(init_fw_cb->conn_ka_timeout);
+       ha->discovery_wait = ql4xdiscoverywait;
+
+       if (ha->acb_version == ACB_SUPPORTED) {
+               ha->ipv6_options = init_fw_cb->ipv6_opts;
+               ha->ipv6_addl_options = init_fw_cb->ipv6_addtl_opts;
+       }
+       qla4xxx_update_local_ip(ha, init_fw_cb);
+
+       return (QLA_SUCCESS);
+}
+
 /**
  * qla4xxx_initialize_fw_cb - initializes firmware control block.
  * @ha: Pointer to host adapter structure.
  **/
 int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
 {
-       struct init_fw_ctrl_blk *init_fw_cb;
+       struct addr_ctrl_blk *init_fw_cb;
        dma_addr_t init_fw_cb_dma;
        uint32_t mbox_cmd[MBOX_REG_COUNT];
        uint32_t mbox_sts[MBOX_REG_COUNT];
        int status = QLA_ERROR;

        init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
-                                       sizeof(struct init_fw_ctrl_blk),
+                                       sizeof(struct addr_ctrl_blk),
                                        &init_fw_cb_dma, GFP_KERNEL);
        if (init_fw_cb == NULL) {
                DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n",
                              ha->host_no, __func__));
                return 10;
        }
-       memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk));
+       memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk));

        /* Get Initialize Firmware Control Block. */
        memset(&mbox_cmd, 0, sizeof(mbox_cmd));
        memset(&mbox_sts, 0, sizeof(mbox_sts));

-       mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-       mbox_cmd[2] = LSDW(init_fw_cb_dma);
-       mbox_cmd[3] = MSDW(init_fw_cb_dma);
-       mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk);
-
-       if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) !=
-           QLA_SUCCESS) {
+       if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma)
+               != QLA_SUCCESS) {
                dma_free_coherent(&ha->pdev->dev,
-                                 sizeof(struct init_fw_ctrl_blk),
+                                 sizeof(struct addr_ctrl_blk),
                                  init_fw_cb, init_fw_cb_dma);
-               return status;
+               goto exit_init_fw_cb;
        }

        /* Initialize request and response queues. */
        qla4xxx_init_rings(ha);

        /* Fill in the request and response queue information. */
-       init_fw_cb->pri.rqq_consumer_idx = cpu_to_le16(ha->request_out);
-       init_fw_cb->pri.compq_producer_idx = cpu_to_le16(ha->response_in);
-       init_fw_cb->pri.rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH);
-       init_fw_cb->pri.compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH);
-       init_fw_cb->pri.rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma));
-       init_fw_cb->pri.rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma));
-       init_fw_cb->pri.compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma));
-       init_fw_cb->pri.compq_addr_hi = cpu_to_le32(MSDW(ha->response_dma));
-       init_fw_cb->pri.shdwreg_addr_lo =
-               cpu_to_le32(LSDW(ha->shadow_regs_dma));
-       init_fw_cb->pri.shdwreg_addr_hi =
-               cpu_to_le32(MSDW(ha->shadow_regs_dma));
+       init_fw_cb->rqq_consumer_idx = cpu_to_le16(ha->request_out);
+       init_fw_cb->compq_producer_idx = cpu_to_le16(ha->response_in);
+       init_fw_cb->rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH);
+       init_fw_cb->compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH);
+       init_fw_cb->rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma));
+       init_fw_cb->rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma));
+       init_fw_cb->compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma));
+       init_fw_cb->compq_addr_hi = cpu_to_le32(MSDW(ha->response_dma));
+       init_fw_cb->shdwreg_addr_lo = cpu_to_le32(LSDW(ha->shadow_regs_dma));
+       init_fw_cb->shdwreg_addr_hi = cpu_to_le32(MSDW(ha->shadow_regs_dma));

        /* Set up required options. */
-       init_fw_cb->pri.fw_options |=
+       init_fw_cb->fw_options |=
                __constant_cpu_to_le16(FWOPT_SESSION_MODE |
                                       FWOPT_INITIATOR_MODE);
-       init_fw_cb->pri.fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);
-
-       /* Save some info in adapter structure. */
-       ha->firmware_options = le16_to_cpu(init_fw_cb->pri.fw_options);
-       ha->tcp_options = le16_to_cpu(init_fw_cb->pri.ipv4_tcp_opts);
-       ha->heartbeat_interval = init_fw_cb->pri.hb_interval;
-       memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr,
-              min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr)));
-       memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet,
-              min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet)));
-       memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr,
-              min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr)));
-       memcpy(ha->name_string, init_fw_cb->pri.iscsi_name,
-              min(sizeof(ha->name_string),
-                  sizeof(init_fw_cb->pri.iscsi_name)));
-       /*memcpy(ha->alias, init_fw_cb->Alias,
-              min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/
+       init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);

-       /* Save Command Line Paramater info */
-       ha->port_down_retry_count = le16_to_cpu(init_fw_cb->pri.conn_ka_timeout);
-       ha->discovery_wait = ql4xdiscoverywait;
-
-       /* Send Initialize Firmware Control Block. */
-       memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-       memset(&mbox_sts, 0, sizeof(mbox_sts));
-
-       mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
-       mbox_cmd[1] = 0;
-       mbox_cmd[2] = LSDW(init_fw_cb_dma);
-       mbox_cmd[3] = MSDW(init_fw_cb_dma);
-       mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk);
+       if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma)
+               != QLA_SUCCESS) {
+               DEBUG2(printk("scsi%ld: %s: Failed to set init_fw_ctrl_blk\n",
+                             ha->host_no, __func__));
+               goto exit_init_fw_cb;
+       }

-       if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) ==
-           QLA_SUCCESS)
-               status = QLA_SUCCESS;
-        else {
-               DEBUG2(printk("scsi%ld: %s: MBOX_CMD_INITIALIZE_FIRMWARE "
-                             "failed w/ status %04X\n", ha->host_no, __func__,
-                             mbox_sts[0]));
+       if (qla4xxx_update_local_ifcb(ha, &mbox_cmd[0], &mbox_sts[0],
+               init_fw_cb, init_fw_cb_dma) != QLA_SUCCESS) {
+               DEBUG2(printk("scsi%ld: %s: Failed to update local ifcb\n",
+                               ha->host_no, __func__));
+               goto exit_init_fw_cb;
        }
-       dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk),
-                         init_fw_cb, init_fw_cb_dma);
+       status = QLA_SUCCESS;
+
+exit_init_fw_cb:
+       dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk),
+                               init_fw_cb, init_fw_cb_dma);

        return status;
 }
@@ -284,13 +374,13 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
  **/
 int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)
 {
-       struct init_fw_ctrl_blk *init_fw_cb;
+       struct addr_ctrl_blk *init_fw_cb;
        dma_addr_t init_fw_cb_dma;
        uint32_t mbox_cmd[MBOX_REG_COUNT];
        uint32_t mbox_sts[MBOX_REG_COUNT];

        init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
-                                       sizeof(struct init_fw_ctrl_blk),
+                                       sizeof(struct addr_ctrl_blk),
                                        &init_fw_cb_dma, GFP_KERNEL);
        if (init_fw_cb == NULL) {
                printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no,
@@ -299,35 +389,21 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)
        }

        /* Get Initialize Firmware Control Block. */
-       memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-       memset(&mbox_sts, 0, sizeof(mbox_sts));
-
-       memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk));
-       mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-       mbox_cmd[2] = LSDW(init_fw_cb_dma);
-       mbox_cmd[3] = MSDW(init_fw_cb_dma);
-       mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk);
-
-       if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) !=
-           QLA_SUCCESS) {
+       memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk));
+       if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma)
+               != QLA_SUCCESS) {
                DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n",
                              ha->host_no, __func__));
                dma_free_coherent(&ha->pdev->dev,
-                                 sizeof(struct init_fw_ctrl_blk),
+                                 sizeof(struct addr_ctrl_blk),
                                  init_fw_cb, init_fw_cb_dma);
                return QLA_ERROR;
        }

        /* Save IP Address. */
-       memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr,
-              min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr)));
-       memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet,
-              min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet)));
-       memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr,
-              min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr)));
-
-       dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk),
-                         init_fw_cb, init_fw_cb_dma);
+       qla4xxx_update_local_ip(ha, init_fw_cb);
+       dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk),
+                               init_fw_cb, init_fw_cb_dma);

        return QLA_SUCCESS;
 }
@@ -441,14 +517,14 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
                goto exit_get_fwddb;
        }
        if (fw_ddb_entry) {
-               dev_info(&ha->pdev->dev, "DDB[%d] MB0 %04x Tot %d Next %d "
-                          "State %04x ConnErr %08x %d.%d.%d.%d:%04d \"%s\"\n",
-                          fw_ddb_index, mbox_sts[0], mbox_sts[2], mbox_sts[3],
-                          mbox_sts[4], mbox_sts[5], fw_ddb_entry->ip_addr[0],
-                          fw_ddb_entry->ip_addr[1], fw_ddb_entry->ip_addr[2],
-                          fw_ddb_entry->ip_addr[3],
-                          le16_to_cpu(fw_ddb_entry->port),
-                          fw_ddb_entry->iscsi_name);
+               dev_info(&ha->pdev->dev, "%s: DDB[%d] MB0 %04x Tot %d "
+                               "Next %d State %04x ConnErr %08x " NIPQUAD_FMT
+                               ":%04d \"%s\"\n", __func__, fw_ddb_index,
+                               mbox_sts[0], mbox_sts[2], mbox_sts[3],
+                               mbox_sts[4], mbox_sts[5],
+                               NIPQUAD(fw_ddb_entry->ip_addr),
+                               le16_to_cpu(fw_ddb_entry->port),
+                               fw_ddb_entry->iscsi_name);
        }
        if (num_valid_ddb_entries)
                *num_valid_ddb_entries = mbox_sts[2];
--
1.6.0.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
  2010-01-30  6:28 [PATCH 02/11] qla4xxx: added IPv6 support Ravi Anand
@ 2010-02-01 18:15 ` Mike Christie
  2010-02-11 11:09   ` Ravi Anand
       [not found]   ` <7312FDA8-2587-4DA7-9762-978EA46A8B9C@qlogic.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Christie @ 2010-02-01 18:15 UTC (permalink / raw)
  To: Ravi Anand; +Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary

On 01/30/2010 12:28 AM, Ravi Anand wrote:
> +       uint16_t iscsi_max_burst_len;
> +       uint16_t iscsi_max_outsnd_r2t;
> +       uint16_t iscsi_first_burst_len;
> +       uint16_t iscsi_max_rcv_data_seg_len;
> +       uint16_t iscsi_max_snd_data_seg_len;


Probably do not need those settings above. Did not really see them used.



> +
> +       struct in6_addr remote_ipv6_addr;
> +       struct in6_addr link_local_ipv6_addr;
>   };
>
>   /*
> @@ -275,6 +284,16 @@ struct ddb_entry {
>   #include "ql4_fw.h"
>   #include "ql4_nvram.h"
>
> +/* shortcut to print ISID */
> +#define ISID(addr) \
> +       ((unsigned char *)&addr)[5], \
> +       ((unsigned char *)&addr)[4], \
> +       ((unsigned char *)&addr)[3], \
> +       ((unsigned char *)&addr)[2], \
> +       ((unsigned char *)&addr)[1], \
> +       ((unsigned char *)&addr)[0]
> +#define ISID_FMT "0x%02x%02x%02x%02x%02x%02x"


Also not used. And if you add it, it should go in iscsi_proto.h.


> +       DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
> +                                       "State %04x ConnErr %08x "
> +                                       NIPQUAD_FMT ":%04d \"%s\"\n",


Do you go down this path for ipv6 (looked like it did and did in other 
places)? NIPQUAD_FMT will not work, and we are trying to not use it 
NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is 
also a %pI6 for ipv6.

Also you need to update qla4xxx_conn_get_param and 
qla4xxx_host_get_param ip handling.


> +       if (qla4xxx_mailbox_command(ha, 6, 6, mbox_cmd, mbox_sts)
> +               != QLA_SUCCESS) {


I think we normally put the != on the end of the other line.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
  2010-02-01 18:15 ` Mike Christie
@ 2010-02-11 11:09   ` Ravi Anand
       [not found]   ` <7312FDA8-2587-4DA7-9762-978EA46A8B9C@qlogic.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Ravi Anand @ 2010-02-11 11:09 UTC (permalink / raw)
  To: Mike Christie; +Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary

On Mon, 01 Feb 2010, Mike Christie wrote:
> On 01/30/2010 12:28 AM, Ravi Anand wrote:
> > +       uint16_t iscsi_max_burst_len;
> > +       uint16_t iscsi_max_outsnd_r2t;
> > +       uint16_t iscsi_first_burst_len;
> > +       uint16_t iscsi_max_rcv_data_seg_len;
> > +       uint16_t iscsi_max_snd_data_seg_len;
> 
> 
> Probably do not need those settings above. Did not really see them used.

Sorry for the late reply as I was sick. 

Currently we are caching it in the DDB struct from the F/W database
and the goal is to export it to user space.
> 
> 
> 
> > +
> > +       struct in6_addr remote_ipv6_addr;
> > +       struct in6_addr link_local_ipv6_addr;
> >   };
> >
> >   /*
> > @@ -275,6 +284,16 @@ struct ddb_entry {
> >   #include "ql4_fw.h"
> >   #include "ql4_nvram.h"
> >
> > +/* shortcut to print ISID */
> > +#define ISID(addr) \
> > +       ((unsigned char *)&addr)[5], \
> > +       ((unsigned char *)&addr)[4], \
> > +       ((unsigned char *)&addr)[3], \
> > +       ((unsigned char *)&addr)[2], \
> > +       ((unsigned char *)&addr)[1], \
> > +       ((unsigned char *)&addr)[0]
> > +#define ISID_FMT "0x%02x%02x%02x%02x%02x%02x"
> 
> 
> Also not used. And if you add it, it should go in iscsi_proto.h.

We will remvoe it. 
> 
> 
> > +       DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
> > +                                       "State %04x ConnErr %08x "
> > +                                       NIPQUAD_FMT ":%04d \"%s\"\n",
> 
> 
> Do you go down this path for ipv6 (looked like it did and did in other 
> places)?

IPV4 and IPV6.

> NIPQUAD_FMT will not work, and we are trying to not use it 
> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is 
> also a %pI6 for ipv6.

OK. We will modify it to use %pI4 or %pI4.
> 
> Also you need to update qla4xxx_conn_get_param and 
> qla4xxx_host_get_param ip handling.

Will do. Missed it.
> 
> 
> > +       if (qla4xxx_mailbox_command(ha, 6, 6, mbox_cmd, mbox_sts)
> > +               != QLA_SUCCESS) {
> 
> 
> I think we normally put the != on the end of the other line.

OK.

Thanks
Ravi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
       [not found]   ` <7312FDA8-2587-4DA7-9762-978EA46A8B9C@qlogic.com>
@ 2010-04-07  3:43     ` Mike Christie
  2010-04-07  5:46       ` Karen Xie
  2010-04-07 17:41       ` Mike Christie
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Christie @ 2010-04-07  3:43 UTC (permalink / raw)
  To: ravi.anand
  Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary,
	open-iscsi, Karen Xie, Jayamohan Kalickal

On 04/06/2010 05:21 AM, ravi.anand wrote:
>
> On Feb 1, 2010, at 10:15 AM, Mike Christie wrote:
>
>> On 01/30/2010 12:28 AM, Ravi Anand wrote:
>>>
>>
>>> + DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
>>> + "State %04x ConnErr %08x "
>>> + NIPQUAD_FMT ":%04d \"%s\"\n",
>>
>>
>> Do you go down this path for ipv6 (looked like it did and did in other
>> places)? NIPQUAD_FMT will not work, and we are trying to not use it
>> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is
>> also a %pI6 for ipv6.
>>
>> Also you need to update qla4xxx_conn_get_param and
>> qla4xxx_host_get_param ip handling.
>>>
>>
>
> While trying to address the IPV6 part for conn_get_param() and
> host_get_param(), we ran into
> the dilemma how to populate IPV4 and IPV6 address at the same time.
> Currently on our adapter IPV4 and IPV6 can be enabled at the same time
> and can be active.
>
> So we wanted to find out if for following param mask :
>
> ISCSI_HOST_PARAM_IPADDRESS
>
> should we just fill the buffer for IPV4 and IPV6 address or should
> we need define new param mask sepeartely for IPV6 ?
>
> Basically we will like to follow up with another patch to address this part
> on to of the patches which we have just pushed.
>

Right now iscsi_tcp supports ipv4 and ipv6 for that param. I think 
people have been saying it might be easier to break it up into a ipv4 
and ipv6 param.

Karen, it seems like you are only supporting ipv4 right now. Any thoughts?

Jay, it seems be2iscsi handling is incorrect. Is your driver supporting 
ipv6 right now?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 02/11] qla4xxx: added IPv6 support.
  2010-04-07  3:43     ` Mike Christie
@ 2010-04-07  5:46       ` Karen Xie
  2010-04-07 17:41       ` Mike Christie
  1 sibling, 0 replies; 8+ messages in thread
From: Karen Xie @ 2010-04-07  5:46 UTC (permalink / raw)
  To: Mike Christie, ravi.anand
  Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary,
	open-iscsi, Jayamohan Kalickal, Rakesh Ranjan

Hi, Mike,

Yeah, the cxgb3i does have the limitation of offloading ipv4 only. Would
it be possible to have separate param for ipv4 and ipv6?

Thanks,
Karen

-----Original Message-----
From: Mike Christie [mailto:michaelc@cs.wisc.edu] 
Sent: Tuesday, April 06, 2010 8:44 PM
To: ravi.anand
Cc: James Bottomley; Linux-SCSI Mailing List; Vikas Chaudhary;
open-iscsi; Karen Xie; Jayamohan Kalickal
Subject: Re: [PATCH 02/11] qla4xxx: added IPv6 support.

On 04/06/2010 05:21 AM, ravi.anand wrote:
>
> On Feb 1, 2010, at 10:15 AM, Mike Christie wrote:
>
>> On 01/30/2010 12:28 AM, Ravi Anand wrote:
>>>
>>
>>> + DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
>>> + "State %04x ConnErr %08x "
>>> + NIPQUAD_FMT ":%04d \"%s\"\n",
>>
>>
>> Do you go down this path for ipv6 (looked like it did and did in
other
>> places)? NIPQUAD_FMT will not work, and we are trying to not use it
>> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is
>> also a %pI6 for ipv6.
>>
>> Also you need to update qla4xxx_conn_get_param and
>> qla4xxx_host_get_param ip handling.
>>>
>>
>
> While trying to address the IPV6 part for conn_get_param() and
> host_get_param(), we ran into
> the dilemma how to populate IPV4 and IPV6 address at the same time.
> Currently on our adapter IPV4 and IPV6 can be enabled at the same time
> and can be active.
>
> So we wanted to find out if for following param mask :
>
> ISCSI_HOST_PARAM_IPADDRESS
>
> should we just fill the buffer for IPV4 and IPV6 address or should
> we need define new param mask sepeartely for IPV6 ?
>
> Basically we will like to follow up with another patch to address this
part
> on to of the patches which we have just pushed.
>

Right now iscsi_tcp supports ipv4 and ipv6 for that param. I think 
people have been saying it might be easier to break it up into a ipv4 
and ipv6 param.

Karen, it seems like you are only supporting ipv4 right now. Any
thoughts?

Jay, it seems be2iscsi handling is incorrect. Is your driver supporting 
ipv6 right now?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
  2010-04-07  3:43     ` Mike Christie
  2010-04-07  5:46       ` Karen Xie
@ 2010-04-07 17:41       ` Mike Christie
  1 sibling, 0 replies; 8+ messages in thread
From: Mike Christie @ 2010-04-07 17:41 UTC (permalink / raw)
  To: ravi.anand
  Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary,
	open-iscsi, Karen Xie, Jayamohan Kalickal

On 04/06/2010 10:43 PM, Mike Christie wrote:
> On 04/06/2010 05:21 AM, ravi.anand wrote:
>>
>> On Feb 1, 2010, at 10:15 AM, Mike Christie wrote:
>>
>>> On 01/30/2010 12:28 AM, Ravi Anand wrote:
>>>>
>>>
>>>> + DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
>>>> + "State %04x ConnErr %08x "
>>>> + NIPQUAD_FMT ":%04d \"%s\"\n",
>>>
>>>
>>> Do you go down this path for ipv6 (looked like it did and did in other
>>> places)? NIPQUAD_FMT will not work, and we are trying to not use it
>>> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is
>>> also a %pI6 for ipv6.
>>>
>>> Also you need to update qla4xxx_conn_get_param and
>>> qla4xxx_host_get_param ip handling.
>>>>
>>>
>>
>> While trying to address the IPV6 part for conn_get_param() and
>> host_get_param(), we ran into
>> the dilemma how to populate IPV4 and IPV6 address at the same time.
>> Currently on our adapter IPV4 and IPV6 can be enabled at the same time
>> and can be active.
>>
>> So we wanted to find out if for following param mask :
>>
>> ISCSI_HOST_PARAM_IPADDRESS
>>
>> should we just fill the buffer for IPV4 and IPV6 address or should
>> we need define new param mask sepeartely for IPV6 ?
>>
>> Basically we will like to follow up with another patch to address this
>> part
>> on to of the patches which we have just pushed.
>>
>
> Right now iscsi_tcp supports ipv4 and ipv6 for that param. I think
> people have been saying it might be easier to break it up into a ipv4
> and ipv6 param.
>
> Karen, it seems like you are only supporting ipv4 right now. Any thoughts?
>
> Jay, it seems be2iscsi handling is incorrect. Is your driver supporting
> ipv6 right now?


After looking at the code, I think I misunderstood what you needed. You 
want to have multiple ip addresses at the same time, right?

be2iscsi needs the ability to support multiple ipv4 and/or ipv6 
addresses at the same time. I would think other cards are going to need 
this feature one day too, so maybe we could make this a little more generic.

Would having a ISCSI_HOST_PARAM_IPADDRESSES param where you can get N 
addresses work for all cases? For the netlink side we could just define 
the netlink msg to have a counter and some separator. And for bsg we 
could do something similar.

To display this in sysfs I think it gets more complicated, I think we 
need to add a sysfs file for each address. And then actually I think we 
want a sysfs dir for each address, because do want to config other 
params for each address like a port or subnet mask or dns info, etc 
(each item would be a sysfs file in some dir)? Or what about vlans too? 
Some cards support multiple vlans, so would you want

/sys/class/iscsi_host/host1
And then the tree under the host would be

tree host1

# this one would be a vlan
|-net_interface0
	|-ip
	|-subnet
	|-vlan_idA
|-net_interface1
	|-ip
	|-subnet
	|-vlan_idB
# no vlans but each interface has different ips
|-net_interface2
	|-ip
	|-subnet_mask
|-net_interface3
	|-ip
	|-subnet_mask

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
  2010-04-07 17:26 Jayamohan Kalickal
@ 2010-04-07 18:00 ` Mike Christie
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Christie @ 2010-04-07 18:00 UTC (permalink / raw)
  To: Jayamohan Kalickal
  Cc: ravi.anand, James Bottomley, Linux-SCSI Mailing List,
	Vikas Chaudhary, open-iscsi, Karen Xie

On 04/07/2010 12:26 PM, Jayamohan Kalickal wrote:
> Mike,
>
>     Yes, IPV6 works for be2iscsi. One of our guys had set it up and we were able to do login etc.
>
> You mentioned that be2iscsi handling is incorrect, can you let me know the details
>

Do

cat /sys/class/iscsi_host/hostX/ipaddress

You will not get anything, because you set the iscsi_transport template 
bit to export this setting, but you did not handle it in the get host 
param callout.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 02/11] qla4xxx: added IPv6 support.
@ 2010-04-07 17:26 Jayamohan Kalickal
  2010-04-07 18:00 ` Mike Christie
  0 siblings, 1 reply; 8+ messages in thread
From: Jayamohan Kalickal @ 2010-04-07 17:26 UTC (permalink / raw)
  To: Mike Christie, ravi.anand
  Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary,
	open-iscsi, Karen Xie

Mike,

   Yes, IPV6 works for be2iscsi. One of our guys had set it up and we were able to do login etc.

You mentioned that be2iscsi handling is incorrect, can you let me know the details

-Jay

  _____  
From: Mike Christie [mailto:michaelc@cs.wisc.edu]
To: ravi.anand [mailto:ravi.anand@qlogic.com]
Cc: James Bottomley [mailto:james.bottomley@suse.de], Linux-SCSI Mailing List [mailto:linux-scsi@vger.kernel.org], Vikas Chaudhary [mailto:vikas.chaudhary@qlogic.com], open-iscsi [mailto:open-iscsi@googlegroups.com], Karen Xie [mailto:kxie@chelsio.com], Jayamohan Kalickal [mailto:jayamohank@serverengines.com]
Sent: Tue, 06 Apr 2010 20:43:30 -0700
Subject: Re: [PATCH 02/11] qla4xxx: added IPv6 support.

On 04/06/2010 05:21 AM, ravi.anand wrote:
>
> On Feb 1, 2010, at 10:15 AM, Mike Christie wrote:
>
>> On 01/30/2010 12:28 AM, Ravi Anand wrote:
>>>
>>
>>> + DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
>>> + "State %04x ConnErr %08x "
>>> + NIPQUAD_FMT ":%04d \"%s\"\n",
>>
>>
>> Do you go down this path for ipv6 (looked like it did and did in other
>> places)? NIPQUAD_FMT will not work, and we are trying to not use it
>> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is
>> also a %pI6 for ipv6.
>>
>> Also you need to update qla4xxx_conn_get_param and
>> qla4xxx_host_get_param ip handling.
>>>
>>
>
> While trying to address the IPV6 part for conn_get_param() and
> host_get_param(), we ran into
> the dilemma how to populate IPV4 and IPV6 address at the same time.
> Currently on our adapter IPV4 and IPV6 can be enabled at the same time
> and can be active.
>
> So we wanted to find out if for following param mask :
>
> ISCSI_HOST_PARAM_IPADDRESS
>
> should we just fill the buffer for IPV4 and IPV6 address or should
> we need define new param mask sepeartely for IPV6 ?
>
> Basically we will like to follow up with another patch to address this part
> on to of the patches which we have just pushed.
>

Right now iscsi_tcp supports ipv4 and ipv6 for that param. I think 
people have been saying it might be easier to break it up into a ipv4 
and ipv6 param.

Karen, it seems like you are only supporting ipv4 right now. Any thoughts?

Jay, it seems be2iscsi handling is incorrect. Is your driver supporting 
ipv6 right now?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of
ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized
review, printing, retention, copying, disclosure or distribution is strictly prohibited.  If you are not the
intended recipient of this message, please immediately advise the sender by reply email message and
delete all copies of this message and any attachment(s). Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-07 17:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-30  6:28 [PATCH 02/11] qla4xxx: added IPv6 support Ravi Anand
2010-02-01 18:15 ` Mike Christie
2010-02-11 11:09   ` Ravi Anand
     [not found]   ` <7312FDA8-2587-4DA7-9762-978EA46A8B9C@qlogic.com>
2010-04-07  3:43     ` Mike Christie
2010-04-07  5:46       ` Karen Xie
2010-04-07 17:41       ` Mike Christie
2010-04-07 17:26 Jayamohan Kalickal
2010-04-07 18:00 ` Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.