Skip to content

Commit 2a49a78

Browse files
Vikas ChaudharyJames Bottomley
authored andcommitted
[SCSI] qla4xxx: added IPv6 support.
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>
1 parent 3487d9e commit 2a49a78

File tree

4 files changed

+445
-142
lines changed

4 files changed

+445
-142
lines changed

drivers/scsi/qla4xxx/ql4_def.h

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
*/
115115
#define MAC_ADDR_LEN 6 /* in bytes */
116116
#define IP_ADDR_LEN 4 /* in bytes */
117+
#define IPv6_ADDR_LEN 16 /* IPv6 address size */
117118
#define DRIVER_NAME "qla4xxx"
118119

119120
#define MAX_LINKED_CMDS_PER_LUN 3
@@ -220,7 +221,7 @@ struct ddb_entry {
220221

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

226227
uint32_t CmdSn;
@@ -245,10 +246,18 @@ struct ddb_entry {
245246

246247
uint16_t port;
247248
uint32_t tpgt;
248-
uint8_t ip_addr[ISCSI_IPADDR_SIZE];
249+
uint8_t ip_addr[IP_ADDR_LEN];
249250
uint8_t iscsi_name[ISCSI_NAME_SIZE]; /* 72 x48 */
250251
uint8_t iscsi_alias[0x20];
251252
uint8_t isid[6];
253+
uint16_t iscsi_max_burst_len;
254+
uint16_t iscsi_max_outsnd_r2t;
255+
uint16_t iscsi_first_burst_len;
256+
uint16_t iscsi_max_rcv_data_seg_len;
257+
uint16_t iscsi_max_snd_data_seg_len;
258+
259+
struct in6_addr remote_ipv6_addr;
260+
struct in6_addr link_local_ipv6_addr;
252261
};
253262

254263
/*
@@ -441,8 +450,35 @@ struct scsi_qla_host {
441450

442451
/* Saved srb for status continuation entry processing */
443452
struct srb *status_srb;
453+
454+
/* IPv6 support info from InitFW */
455+
uint8_t acb_version;
456+
uint8_t ipv4_addr_state;
457+
uint16_t ipv4_options;
458+
459+
uint32_t resvd2;
460+
uint32_t ipv6_options;
461+
uint32_t ipv6_addl_options;
462+
uint8_t ipv6_link_local_state;
463+
uint8_t ipv6_addr0_state;
464+
uint8_t ipv6_addr1_state;
465+
uint8_t ipv6_default_router_state;
466+
struct in6_addr ipv6_link_local_addr;
467+
struct in6_addr ipv6_addr0;
468+
struct in6_addr ipv6_addr1;
469+
struct in6_addr ipv6_default_router_addr;
444470
};
445471

472+
static inline int is_ipv4_enabled(struct scsi_qla_host *ha)
473+
{
474+
return ((ha->ipv4_options & IPOPT_IPv4_PROTOCOL_ENABLE) != 0);
475+
}
476+
477+
static inline int is_ipv6_enabled(struct scsi_qla_host *ha)
478+
{
479+
return ((ha->ipv6_options & IPV6_OPT_IPV6_PROTOCOL_ENABLE) != 0);
480+
}
481+
446482
static inline int is_qla4010(struct scsi_qla_host *ha)
447483
{
448484
return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4010;

drivers/scsi/qla4xxx/ql4_fw.h

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,15 @@ union external_hw_config_reg {
258258
/* Mailbox 1 */
259259
#define FW_STATE_READY 0x0000
260260
#define FW_STATE_CONFIG_WAIT 0x0001
261-
#define FW_STATE_WAIT_LOGIN 0x0002
261+
#define FW_STATE_WAIT_AUTOCONNECT 0x0002
262262
#define FW_STATE_ERROR 0x0004
263-
#define FW_STATE_DHCP_IN_PROGRESS 0x0008
263+
#define FW_STATE_CONFIGURING_IP 0x0008
264264

265265
/* Mailbox 3 */
266266
#define FW_ADDSTATE_OPTICAL_MEDIA 0x0001
267-
#define FW_ADDSTATE_DHCP_ENABLED 0x0002
267+
#define FW_ADDSTATE_DHCPv4_ENABLED 0x0002
268+
#define FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED 0x0004
269+
#define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED 0x0008
268270
#define FW_ADDSTATE_LINK_UP 0x0010
269271
#define FW_ADDSTATE_ISNS_SVC_ENABLED 0x0020
270272
#define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS 0x006B
@@ -320,6 +322,8 @@ union external_hw_config_reg {
320322
/* Host Adapter Initialization Control Block (from host) */
321323
struct addr_ctrl_blk {
322324
uint8_t version; /* 00 */
325+
#define IFCB_VER_MIN 0x01
326+
#define IFCB_VER_MAX 0x02
323327
uint8_t control; /* 01 */
324328

325329
uint16_t fw_options; /* 02-03 */
@@ -351,11 +355,16 @@ struct addr_ctrl_blk {
351355
uint16_t iscsi_opts; /* 30-31 */
352356
uint16_t ipv4_tcp_opts; /* 32-33 */
353357
uint16_t ipv4_ip_opts; /* 34-35 */
358+
#define IPOPT_IPv4_PROTOCOL_ENABLE 0x8000
354359

355360
uint16_t iscsi_max_pdu_size; /* 36-37 */
356361
uint8_t ipv4_tos; /* 38 */
357362
uint8_t ipv4_ttl; /* 39 */
358363
uint8_t acb_version; /* 3A */
364+
#define ACB_NOT_SUPPORTED 0x00
365+
#define ACB_SUPPORTED 0x02 /* Capable of ACB Version 2
366+
Features */
367+
359368
uint8_t res2; /* 3B */
360369
uint16_t def_timeout; /* 3C-3D */
361370
uint16_t iscsi_fburst_len; /* 3E-3F */
@@ -397,16 +406,35 @@ struct addr_ctrl_blk {
397406
uint32_t cookie; /* 200-203 */
398407
uint16_t ipv6_port; /* 204-205 */
399408
uint16_t ipv6_opts; /* 206-207 */
409+
#define IPV6_OPT_IPV6_PROTOCOL_ENABLE 0x8000
410+
400411
uint16_t ipv6_addtl_opts; /* 208-209 */
412+
#define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE 0x0002 /* Pri ACB
413+
Only */
414+
#define IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR 0x0001
415+
401416
uint16_t ipv6_tcp_opts; /* 20A-20B */
402417
uint8_t ipv6_tcp_wsf; /* 20C */
403418
uint16_t ipv6_flow_lbl; /* 20D-20F */
404-
uint8_t ipv6_gw_addr[16]; /* 210-21F */
419+
uint8_t ipv6_dflt_rtr_addr[16]; /* 210-21F */
405420
uint16_t ipv6_vlan_tag; /* 220-221 */
406421
uint8_t ipv6_lnk_lcl_addr_state;/* 222 */
407422
uint8_t ipv6_addr0_state; /* 223 */
408423
uint8_t ipv6_addr1_state; /* 224 */
409-
uint8_t ipv6_gw_state; /* 225 */
424+
#define IP_ADDRSTATE_UNCONFIGURED 0
425+
#define IP_ADDRSTATE_INVALID 1
426+
#define IP_ADDRSTATE_ACQUIRING 2
427+
#define IP_ADDRSTATE_TENTATIVE 3
428+
#define IP_ADDRSTATE_DEPRICATED 4
429+
#define IP_ADDRSTATE_PREFERRED 5
430+
#define IP_ADDRSTATE_DISABLING 6
431+
432+
uint8_t ipv6_dflt_rtr_state; /* 225 */
433+
#define IPV6_RTRSTATE_UNKNOWN 0
434+
#define IPV6_RTRSTATE_MANUAL 1
435+
#define IPV6_RTRSTATE_ADVERTISED 3
436+
#define IPV6_RTRSTATE_STALE 4
437+
410438
uint8_t ipv6_traffic_class; /* 226 */
411439
uint8_t ipv6_hop_limit; /* 227 */
412440
uint8_t ipv6_if_id[8]; /* 228-22F */
@@ -424,7 +452,7 @@ struct addr_ctrl_blk {
424452

425453
struct init_fw_ctrl_blk {
426454
struct addr_ctrl_blk pri;
427-
struct addr_ctrl_blk sec;
455+
/* struct addr_ctrl_blk sec;*/
428456
};
429457

430458
/*************************************************************************/
@@ -433,6 +461,9 @@ struct dev_db_entry {
433461
uint16_t options; /* 00-01 */
434462
#define DDB_OPT_DISC_SESSION 0x10
435463
#define DDB_OPT_TARGET 0x02 /* device is a target */
464+
#define DDB_OPT_IPV6_DEVICE 0x100
465+
#define DDB_OPT_IPV6_NULL_LINK_LOCAL 0x800 /* post connection */
466+
#define DDB_OPT_IPV6_FW_DEFINED_LINK_LOCAL 0x800 /* pre connection */
436467

437468
uint16_t exec_throttle; /* 02-03 */
438469
uint16_t exec_count; /* 04-05 */
@@ -468,7 +499,7 @@ struct dev_db_entry {
468499
* pointer to a string so we
469500
* don't have to reserve soooo
470501
* much RAM */
471-
uint8_t ipv6_addr[0x10];/* 1A0-1AF */
502+
uint8_t link_local_ipv6_addr[0x10]; /* 1A0-1AF */
472503
uint8_t res5[0x10]; /* 1B0-1BF */
473504
uint16_t ddb_link; /* 1C0-1C1 */
474505
uint16_t chap_tbl_idx; /* 1C2-1C3 */

0 commit comments

Comments
 (0)