diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-06-28 13:00:22 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-29 11:06:59 -0400 |
commit | 01cb225dad8da2e717356fab03240e2f4a8d01bf (patch) | |
tree | 8accf53a998b27b61362aec3fe61e7b72c69bbde | |
parent | 332959cb521af6bb0281c7aae797f1f91dcb4c42 (diff) |
[SCSI] iscsi: add target discvery event to transport class
Patch from david.somayajulu@qlogic.com:
Add target discovery event. We may have a setup where the iscsi traffic
is on a different netowrk than the other network traffic. In this case
we will want to do discovery though the iscsi card. This patch adds
a event to the transport class that can be used by hw iscsi cards that
support this.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 18 | ||||
-rw-r--r-- | include/scsi/iscsi_if.h | 37 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 2 |
3 files changed, 57 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 5569fdcfd621..99e76d458290 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -978,6 +978,21 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, | |||
978 | } | 978 | } |
979 | 979 | ||
980 | static int | 980 | static int |
981 | iscsi_tgt_dscvr(struct iscsi_transport *transport, | ||
982 | struct iscsi_uevent *ev) | ||
983 | { | ||
984 | struct sockaddr *dst_addr; | ||
985 | |||
986 | if (!transport->tgt_dscvr) | ||
987 | return -EINVAL; | ||
988 | |||
989 | dst_addr = (struct sockaddr *)((char*)ev + sizeof(*ev)); | ||
990 | return transport->tgt_dscvr(ev->u.tgt_dscvr.type, | ||
991 | ev->u.tgt_dscvr.host_no, | ||
992 | ev->u.tgt_dscvr.enable, dst_addr); | ||
993 | } | ||
994 | |||
995 | static int | ||
981 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | 996 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
982 | { | 997 | { |
983 | int err = 0; | 998 | int err = 0; |
@@ -1065,6 +1080,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1065 | case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: | 1080 | case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: |
1066 | err = iscsi_if_transport_ep(transport, ev, nlh->nlmsg_type); | 1081 | err = iscsi_if_transport_ep(transport, ev, nlh->nlmsg_type); |
1067 | break; | 1082 | break; |
1083 | case ISCSI_UEVENT_TGT_DSCVR: | ||
1084 | err = iscsi_tgt_dscvr(transport, ev); | ||
1085 | break; | ||
1068 | default: | 1086 | default: |
1069 | err = -EINVAL; | 1087 | err = -EINVAL; |
1070 | break; | 1088 | break; |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 253797c60095..8813f0f4c624 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -47,12 +47,20 @@ enum iscsi_uevent_e { | |||
47 | ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13, | 47 | ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13, |
48 | ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14, | 48 | ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14, |
49 | 49 | ||
50 | ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, | ||
51 | |||
50 | /* up events */ | 52 | /* up events */ |
51 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 53 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
52 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, | 54 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, |
53 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, | 55 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, |
54 | }; | 56 | }; |
55 | 57 | ||
58 | enum iscsi_tgt_dscvr { | ||
59 | ISCSI_TGT_DSCVR_SEND_TARGETS = 1, | ||
60 | ISCSI_TGT_DSCVR_ISNS = 2, | ||
61 | ISCSI_TGT_DSCVR_SLP = 3, | ||
62 | }; | ||
63 | |||
56 | struct iscsi_uevent { | 64 | struct iscsi_uevent { |
57 | uint32_t type; /* k/u events type */ | 65 | uint32_t type; /* k/u events type */ |
58 | uint32_t iferror; /* carries interface or resource errors */ | 66 | uint32_t iferror; /* carries interface or resource errors */ |
@@ -116,6 +124,17 @@ struct iscsi_uevent { | |||
116 | struct msg_transport_disconnect { | 124 | struct msg_transport_disconnect { |
117 | uint64_t ep_handle; | 125 | uint64_t ep_handle; |
118 | } ep_disconnect; | 126 | } ep_disconnect; |
127 | struct msg_tgt_dscvr { | ||
128 | enum iscsi_tgt_dscvr type; | ||
129 | uint32_t host_no; | ||
130 | /* | ||
131 | * enable = 1 to establish a new connection | ||
132 | * with the server. enable = 0 to disconnect | ||
133 | * from the server. Used primarily to switch | ||
134 | * from one iSNS server to another. | ||
135 | */ | ||
136 | uint32_t enable; | ||
137 | } tgt_dscvr; | ||
119 | } u; | 138 | } u; |
120 | union { | 139 | union { |
121 | /* messages k -> u */ | 140 | /* messages k -> u */ |
@@ -141,6 +160,24 @@ struct iscsi_uevent { | |||
141 | struct msg_transport_connect_ret { | 160 | struct msg_transport_connect_ret { |
142 | uint64_t handle; | 161 | uint64_t handle; |
143 | } ep_connect_ret; | 162 | } ep_connect_ret; |
163 | struct msg_tgt_dscvr_ret { | ||
164 | /* | ||
165 | * session/connection pair used to reference | ||
166 | * the connection to server | ||
167 | */ | ||
168 | uint32_t sid; | ||
169 | uint32_t cid; | ||
170 | union { | ||
171 | struct isns { | ||
172 | /* port # for conn to iSNS server */ | ||
173 | uint16_t isns_port; | ||
174 | /* listening port to receive SCNs */ | ||
175 | uint16_t scn_port; | ||
176 | /* listening port to receive ESIs */ | ||
177 | uint16_t esi_port; | ||
178 | } isns_attrib; | ||
179 | } u; | ||
180 | } tgt_dscvr_ret; | ||
144 | } r; | 181 | } r; |
145 | } __attribute__ ((aligned (sizeof(uint64_t)))); | 182 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
146 | 183 | ||
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index b684426a5900..b95151aec602 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -127,6 +127,8 @@ struct iscsi_transport { | |||
127 | uint64_t *ep_handle); | 127 | uint64_t *ep_handle); |
128 | int (*ep_poll) (uint64_t ep_handle, int timeout_ms); | 128 | int (*ep_poll) (uint64_t ep_handle, int timeout_ms); |
129 | void (*ep_disconnect) (uint64_t ep_handle); | 129 | void (*ep_disconnect) (uint64_t ep_handle); |
130 | int (*tgt_dscvr) (enum iscsi_tgt_dscvr type, uint32_t host_no, | ||
131 | uint32_t enable, struct sockaddr *dst_addr); | ||
130 | }; | 132 | }; |
131 | 133 | ||
132 | /* | 134 | /* |