forked from Minki/linux
[SCSI] scsi_transport_iscsi: added support for host event
Added support to post kernel host event to application using netlink interface. Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
46801ba698
commit
a11e254595
@ -1476,6 +1476,37 @@ void iscsi_conn_login_event(struct iscsi_cls_conn *conn,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(iscsi_conn_login_event);
|
EXPORT_SYMBOL_GPL(iscsi_conn_login_event);
|
||||||
|
|
||||||
|
void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport,
|
||||||
|
enum iscsi_host_event_code code, uint32_t data_size,
|
||||||
|
uint8_t *data)
|
||||||
|
{
|
||||||
|
struct nlmsghdr *nlh;
|
||||||
|
struct sk_buff *skb;
|
||||||
|
struct iscsi_uevent *ev;
|
||||||
|
int len = NLMSG_SPACE(sizeof(*ev) + data_size);
|
||||||
|
|
||||||
|
skb = alloc_skb(len, GFP_KERNEL);
|
||||||
|
if (!skb) {
|
||||||
|
printk(KERN_ERR "gracefully ignored host event (%d):%d OOM\n",
|
||||||
|
host_no, code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0);
|
||||||
|
ev = NLMSG_DATA(nlh);
|
||||||
|
ev->transport_handle = iscsi_handle(transport);
|
||||||
|
ev->type = ISCSI_KEVENT_HOST_EVENT;
|
||||||
|
ev->r.host_event.host_no = host_no;
|
||||||
|
ev->r.host_event.code = code;
|
||||||
|
ev->r.host_event.data_size = data_size;
|
||||||
|
|
||||||
|
if (data_size)
|
||||||
|
memcpy((char *)ev + sizeof(*ev), data, data_size);
|
||||||
|
|
||||||
|
iscsi_multicast_skb(skb, ISCSI_NL_GRP_ISCSID, GFP_KERNEL);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(iscsi_post_host_event);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi,
|
iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi,
|
||||||
void *payload, int size)
|
void *payload, int size)
|
||||||
|
@ -72,6 +72,7 @@ enum iscsi_uevent_e {
|
|||||||
ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
|
ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
|
||||||
ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
|
ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
|
||||||
ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
|
ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
|
||||||
|
ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum iscsi_tgt_dscvr {
|
enum iscsi_tgt_dscvr {
|
||||||
@ -80,6 +81,13 @@ enum iscsi_tgt_dscvr {
|
|||||||
ISCSI_TGT_DSCVR_SLP = 3,
|
ISCSI_TGT_DSCVR_SLP = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum iscsi_host_event_code {
|
||||||
|
ISCSI_EVENT_LINKUP = 1,
|
||||||
|
ISCSI_EVENT_LINKDOWN,
|
||||||
|
/* must always be last */
|
||||||
|
ISCSI_EVENT_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
struct iscsi_uevent {
|
struct iscsi_uevent {
|
||||||
uint32_t type; /* k/u events type */
|
uint32_t type; /* k/u events type */
|
||||||
uint32_t iferror; /* carries interface or resource errors */
|
uint32_t iferror; /* carries interface or resource errors */
|
||||||
@ -222,6 +230,11 @@ struct iscsi_uevent {
|
|||||||
struct msg_notify_if_down {
|
struct msg_notify_if_down {
|
||||||
uint32_t host_no;
|
uint32_t host_no;
|
||||||
} notify_if_down;
|
} notify_if_down;
|
||||||
|
struct msg_host_event {
|
||||||
|
uint32_t host_no;
|
||||||
|
uint32_t data_size;
|
||||||
|
enum iscsi_host_event_code code;
|
||||||
|
} host_event;
|
||||||
} r;
|
} r;
|
||||||
} __attribute__ ((aligned (sizeof(uint64_t))));
|
} __attribute__ ((aligned (sizeof(uint64_t))));
|
||||||
|
|
||||||
|
@ -166,6 +166,12 @@ extern int iscsi_offload_mesg(struct Scsi_Host *shost,
|
|||||||
struct iscsi_transport *transport, uint32_t type,
|
struct iscsi_transport *transport, uint32_t type,
|
||||||
char *data, uint16_t data_size);
|
char *data, uint16_t data_size);
|
||||||
|
|
||||||
|
extern void iscsi_post_host_event(uint32_t host_no,
|
||||||
|
struct iscsi_transport *transport,
|
||||||
|
enum iscsi_host_event_code code,
|
||||||
|
uint32_t data_size,
|
||||||
|
uint8_t *data);
|
||||||
|
|
||||||
struct iscsi_cls_conn {
|
struct iscsi_cls_conn {
|
||||||
struct list_head conn_list; /* item in connlist */
|
struct list_head conn_list; /* item in connlist */
|
||||||
void *dd_data; /* LLD private data */
|
void *dd_data; /* LLD private data */
|
||||||
|
Loading…
Reference in New Issue
Block a user