aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_netlink.h86
-rw-r--r--include/scsi/scsi_netlink_fc.h71
-rw-r--r--include/scsi/scsi_transport_fc.h34
3 files changed, 191 insertions, 0 deletions
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
new file mode 100644
index 000000000000..7a3a20e640c0
--- /dev/null
+++ b/include/scsi/scsi_netlink.h
@@ -0,0 +1,86 @@
1/*
2 * SCSI Transport Netlink Interface
3 * Used for the posting of outbound SCSI transport events
4 *
5 * Copyright (C) 2006 James Smart, Emulex Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef SCSI_NETLINK_H
23#define SCSI_NETLINK_H
24
25/*
26 * This file intended to be included by both kernel and user space
27 */
28
29/* Single Netlink Message type to send all SCSI Transport messages */
30#define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
31
32/* SCSI Transport Broadcast Groups */
33 /* leaving groups 0 and 1 unassigned */
34#define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
35#define SCSI_NL_GRP_CNT 3
36
37
38/* SCSI_TRANSPORT_MSG event message header */
39struct scsi_nl_hdr {
40 uint8_t version;
41 uint8_t transport;
42 uint16_t magic;
43 uint16_t msgtype;
44 uint16_t msglen;
45} __attribute__((aligned(sizeof(uint64_t))));
46
47/* scsi_nl_hdr->version value */
48#define SCSI_NL_VERSION 1
49
50/* scsi_nl_hdr->magic value */
51#define SCSI_NL_MAGIC 0xA1B2
52
53/* scsi_nl_hdr->transport value */
54#define SCSI_NL_TRANSPORT 0
55#define SCSI_NL_TRANSPORT_FC 1
56#define SCSI_NL_MAX_TRANSPORTS 2
57
58/* scsi_nl_hdr->msgtype values are defined in each transport */
59
60
61/*
62 * Vendor ID:
63 * If transports post vendor-unique events, they must pass a well-known
64 * 32-bit vendor identifier. This identifier consists of 8 bits indicating
65 * the "type" of identifier contained, and 24 bits of id data.
66 *
67 * Identifiers for each type:
68 * PCI : ID data is the 16 bit PCI Registered Vendor ID
69 */
70#define SCSI_NL_VID_ID_MASK 0x00FFFFFF
71#define SCSI_NL_VID_TYPE_MASK 0xFF000000
72#define SCSI_NL_VID_TYPE_PCI 0x01000000
73
74
75#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
76 { \
77 (hdr)->version = SCSI_NL_VERSION; \
78 (hdr)->transport = t; \
79 (hdr)->magic = SCSI_NL_MAGIC; \
80 (hdr)->msgtype = mtype; \
81 (hdr)->msglen = mlen; \
82 }
83
84
85#endif /* SCSI_NETLINK_H */
86
diff --git a/include/scsi/scsi_netlink_fc.h b/include/scsi/scsi_netlink_fc.h
new file mode 100644
index 000000000000..b213d2909fed
--- /dev/null
+++ b/include/scsi/scsi_netlink_fc.h
@@ -0,0 +1,71 @@
1/*
2 * FC Transport Netlink Interface
3 *
4 * Copyright (C) 2006 James Smart, Emulex Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21#ifndef SCSI_NETLINK_FC_H
22#define SCSI_NETLINK_FC_H
23
24#include <scsi/scsi_netlink.h>
25
26/*
27 * This file intended to be included by both kernel and user space
28 */
29
30/*
31 * FC Transport Message Types
32 */
33 /* kernel -> user */
34#define FC_NL_ASYNC_EVENT 0x0100
35 /* user -> kernel */
36/* none */
37
38
39/*
40 * Message Structures :
41 */
42
43/* macro to round up message lengths to 8byte boundary */
44#define FC_NL_MSGALIGN(len) (((len) + 7) & ~7)
45
46
47/*
48 * FC Transport Broadcast Event Message :
49 * FC_NL_ASYNC_EVENT
50 *
51 * Note: if Vendor Unique message, &event_data will be start of
52 * vendor unique payload, and the length of the payload is
53 * per event_datalen
54 *
55 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
56 * formatting requirements specified in scsi_netlink.h
57 */
58struct fc_nl_event {
59 struct scsi_nl_hdr snlh; /* must be 1st element ! */
60 uint64_t seconds;
61 uint32_t vendor_id;
62 uint16_t host_no;
63 uint16_t event_datalen;
64 uint32_t event_num;
65 uint32_t event_code;
66 uint32_t event_data;
67} __attribute__((aligned(sizeof(uint64_t))));
68
69
70#endif /* SCSI_NETLINK_FC_H */
71
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index c74be5dabfeb..f91c5358af3a 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -29,6 +29,7 @@
29 29
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <scsi/scsi.h> 31#include <scsi/scsi.h>
32#include <scsi/scsi_netlink.h>
32 33
33struct scsi_transport_template; 34struct scsi_transport_template;
34 35
@@ -284,6 +285,30 @@ struct fc_host_statistics {
284 285
285 286
286/* 287/*
288 * FC Event Codes - Polled and Async, following FC HBAAPI v2.0 guidelines
289 */
290
291/*
292 * fc_host_event_code: If you alter this, you also need to alter
293 * scsi_transport_fc.c (for the ascii descriptions).
294 */
295enum fc_host_event_code {
296 FCH_EVT_LIP = 0x1,
297 FCH_EVT_LINKUP = 0x2,
298 FCH_EVT_LINKDOWN = 0x3,
299 FCH_EVT_LIPRESET = 0x4,
300 FCH_EVT_RSCN = 0x5,
301 FCH_EVT_ADAPTER_CHANGE = 0x103,
302 FCH_EVT_PORT_UNKNOWN = 0x200,
303 FCH_EVT_PORT_OFFLINE = 0x201,
304 FCH_EVT_PORT_ONLINE = 0x202,
305 FCH_EVT_PORT_FABRIC = 0x204,
306 FCH_EVT_LINK_UNKNOWN = 0x500,
307 FCH_EVT_VENDOR_UNIQUE = 0xffff,
308};
309
310
311/*
287 * FC Local Port (Host) Attributes 312 * FC Local Port (Host) Attributes
288 * 313 *
289 * Attributes are based on HBAAPI V2.0 definitions. 314 * Attributes are based on HBAAPI V2.0 definitions.
@@ -526,5 +551,14 @@ struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,
526void fc_remote_port_delete(struct fc_rport *rport); 551void fc_remote_port_delete(struct fc_rport *rport);
527void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); 552void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles);
528int scsi_is_fc_rport(const struct device *); 553int scsi_is_fc_rport(const struct device *);
554u32 fc_get_event_number(void);
555void fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
556 enum fc_host_event_code event_code, u32 event_data);
557void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
558 u32 data_len, char * data_buf, u32 vendor_id);
559 /* Note: when specifying vendor_id to fc_host_post_vendor_event()
560 * be sure to read the Vendor Type and ID formatting requirements
561 * specified in scsi_netlink.h
562 */
529 563
530#endif /* SCSI_TRANSPORT_FC_H */ 564#endif /* SCSI_TRANSPORT_FC_H */