Skip to content

Commit 01cb225

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[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>
1 parent 332959c commit 01cb225

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,21 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,
977977
return rc;
978978
}
979979

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+
980995
static int
981996
iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
982997
{
@@ -1065,6 +1080,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
10651080
case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT:
10661081
err = iscsi_if_transport_ep(transport, ev, nlh->nlmsg_type);
10671082
break;
1083+
case ISCSI_UEVENT_TGT_DSCVR:
1084+
err = iscsi_tgt_dscvr(transport, ev);
1085+
break;
10681086
default:
10691087
err = -EINVAL;
10701088
break;

include/scsi/iscsi_if.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,20 @@ enum iscsi_uevent_e {
4747
ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
4848
ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
4949

50+
ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51+
5052
/* up events */
5153
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
5254
ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
5355
ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
5456
};
5557

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+
5664
struct iscsi_uevent {
5765
uint32_t type; /* k/u events type */
5866
uint32_t iferror; /* carries interface or resource errors */
@@ -116,6 +124,17 @@ struct iscsi_uevent {
116124
struct msg_transport_disconnect {
117125
uint64_t ep_handle;
118126
} 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;
119138
} u;
120139
union {
121140
/* messages k -> u */
@@ -141,6 +160,24 @@ struct iscsi_uevent {
141160
struct msg_transport_connect_ret {
142161
uint64_t handle;
143162
} 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;
144181
} r;
145182
} __attribute__ ((aligned (sizeof(uint64_t))));
146183

include/scsi/scsi_transport_iscsi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ struct iscsi_transport {
127127
uint64_t *ep_handle);
128128
int (*ep_poll) (uint64_t ep_handle, int timeout_ms);
129129
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);
130132
};
131133

132134
/*

0 commit comments

Comments
 (0)