Skip to contentSkip to conversation

qla4xxx: added IPv6 support.

PATCH In review Ravi Anand 4 participants 8 messages Jan 30, 2010 – Apr 7, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ravi Anand

author
#0 lore raw

PATCH 2/11 qla4xxx: added IPv6 support.

From: Vikas Chaudhary <[email protected]>

---
 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(-)
drivers/scsi/qla4xxx/ql4_def.h +48 -2
index 38e261d..9c37989 100644
@@ -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;
drivers/scsi/qla4xxx/ql4_fw.h +36 -7

102 lines not on this page · raw message

drivers/scsi/qla4xxx/ql4_init.c +171 -41

248 lines not on this page · raw message

drivers/scsi/qla4xxx/ql4_mbx.c +171 -95

341 lines not on this page · raw message

--
1.6.0.2

#1 lore raw

drivers/scsi/qla4xxx/ql4_def.h struct ddb_entry { · line 258

Quoted 5 lines · Ravi Anand
drivers/scsi/qla4xxx/ql4_def.h +5 -0
+       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.

Quoted 9 lines
drivers/scsi/qla4xxx/ql4_def.h +3 -0
+
+       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"

drivers/scsi/qla4xxx/ql4_def.h struct ddb_entry { · line 295

Quoted 10 lines
drivers/scsi/qla4xxx/ql4_def.h +9 -0
 
+/* 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.

drivers/scsi/qla4xxx/ql4_init.c static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha, · line 572

Quoted 3 lines
drivers/scsi/qla4xxx/ql4_init.c +3 -0
+       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.

Review struct ddb_entry {

Quoted 2 lines
(quoted diff) +2 -0
+       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.

author
#2 lore raw
Quoted 9 lines · Mike Christie

drivers/scsi/qla4xxx/ql4_def.h struct ddb_entry { · line 258

Quoted 5 lines · Ravi Anand
drivers/scsi/qla4xxx/ql4_def.h +5 -0
+       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.

Quoted 13 lines
Quoted 13 lines
drivers/scsi/qla4xxx/ql4_def.h +3 -0
+
+       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"
 
Quoted 12 lines

drivers/scsi/qla4xxx/ql4_def.h struct ddb_entry { · line 295

Quoted 9 lines
drivers/scsi/qla4xxx/ql4_def.h +9 -0
+/* 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.

Quoted 9 lines

drivers/scsi/qla4xxx/ql4_init.c static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha, · line 572

Quoted 5 lines
drivers/scsi/qla4xxx/ql4_init.c +3 -0
+       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.

Quoted 3 lines

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.

Quoted 3 lines

Also you need to update qla4xxx_conn_get_param and qla4xxx_host_get_param ip handling.

Will do. Missed it.

Quoted 7 lines

Review struct ddb_entry {

Quoted 4 lines
(quoted diff) +2 -0
+       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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 29 lines · ravi.anand
Quoted 8 lines · Mike Christie
Quoted 5 lines · Ravi Anand

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

Quoted 9 lines

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.

Quoted 1 line

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 :

Quoted 8 lines

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?

#5 lore raw

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:[email protected]]
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.

Quoted 6 lines · ravi.anand
Quoted 3 lines · Mike Christie
Quoted 1 line · Ravi Anand
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

+ 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

Quoted 15 lines
Quoted 8 lines

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.

Quoted 1 line

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.

Quoted 8 lines

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

Quoted 2 lines

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?

#6 lore raw
In reply to Mike Christie

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:[email protected]]
To: ravi.anand [mailto:[email protected]]
Cc: James Bottomley [mailto:[email protected]], Linux-SCSI Mailing List [mailto:[email protected]], Vikas Chaudhary [mailto:[email protected]], open-iscsi [mailto:[email protected]], Karen Xie [mailto:[email protected]], Jayamohan Kalickal [mailto:[email protected]]
Sent: Tue, 06 Apr 2010 20:43:30 -0700
Subject: Re: [PATCH 02/11] qla4xxx: added IPv6 support.

Quoted 29 lines · ravi.anand
Quoted 8 lines · Mike Christie
Quoted 5 lines · Ravi Anand

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

Quoted 9 lines

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.

Quoted 1 line

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 :

Quoted 8 lines

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 [email protected]
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.

#7 lore raw
Quoted 6 lines · Jayamohan Kalickal

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.

#8 lore raw
In reply to Mike Christie
Quoted 40 lines · Mike Christie
Quoted 29 lines · ravi.anand
Quoted 8 lines · Mike Christie
Quoted 5 lines · Ravi Anand

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

Quoted 9 lines

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.

Quoted 1 line

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 :

Quoted 9 lines

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.

Quoted 8 lines

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