Skip to content

Commit

Permalink
[SCSI] qla4xxx: added IPv6 support.
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Vikas Chaudhary authored and James Bottomley committed May 2, 2010
1 parent 3487d9e commit 2a49a78
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 142 deletions.
40 changes: 38 additions & 2 deletions drivers/scsi/qla4xxx/ql4_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -220,7 +221,7 @@ struct ddb_entry {

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

uint32_t CmdSn;
Expand All @@ -245,10 +246,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;
};

/*
Expand Down Expand Up @@ -441,8 +450,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;
Expand Down
45 changes: 38 additions & 7 deletions drivers/scsi/qla4xxx/ql4_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -351,11 +355,16 @@ 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 */
Expand Down Expand Up @@ -397,16 +406,35 @@ 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 */
Expand All @@ -424,7 +452,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;*/
};

/*************************************************************************/
Expand All @@ -433,6 +461,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 */
Expand Down Expand Up @@ -468,7 +499,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 */
Expand Down
Loading

0 comments on commit 2a49a78

Please sign in to comment.