aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_netlink.h
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2006-08-18 17:30:09 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-09-02 16:33:49 -0400
commit84314fd4740ad73550c76dee4a9578979d84af48 (patch)
treef8902dbe4134f9bab4f6886bb6c0b2a30797ceaa /include/scsi/scsi_netlink.h
parentdeb81d80ba27da8dfabc29ccb5977db8f4942a0a (diff)
[SCSI] SCSI and FC Transport: add netlink support for posting of transport events
This patch formally adds support for the posting of FC events via netlink. It is a followup to the original RFC at: http://marc.theaimsgroup.com/?l=linux-scsi&m=114530667923464&w=2 and the initial posting at: http://marc.theaimsgroup.com/?l=linux-scsi&m=115507374832500&w=2 The patch has been updated to optimize the send path, per the discussions in the initial posting. Per discussions at the Storage Summit and at OLS, we are to use netlink for async events from transports. Also per discussions, to avoid a netlink protocol per transport, I've create a single NETLINK_SCSITRANSPORT protocol, which can then be used by all transports. This patch: - Creates new files scsi_netlink.c and scsi_netlink.h, which contains the single and shared definitions for the SCSI Transport. It is tied into the base SCSI subsystem intialization. Contains a single interface routine, scsi_send_transport_event(), for a transport to send an event (via multicast to a protocol specific group). - Creates a new scsi_netlink_fc.h file, which contains the FC netlink event messages - Adds 3 new routines to the fc transport: fc_get_event_number() - to get a FC event # fc_host_post_event() - to send a simple FC event (32 bits of data) fc_host_post_vendor_event() - to send a Vendor unique event, with arbitrary amounts of data. Note: the separation of event number allows for a LLD to send a standard event, followed by vendor-specific data for the event. Note: This patch assumes 2 prior fc transport patches have been installed: http://marc.theaimsgroup.com/?l=linux-scsi&m=115555807316329&w=2 http://marc.theaimsgroup.com/?l=linux-scsi&m=115581614930261&w=2 Sorry - next time I'll do something like making these individual patches of the same posting when I know they'll be posted closely together. Signed-off-by: James Smart <James.Smart@emulex.com> Tidy up configuration not to make SCSI always select NET Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi/scsi_netlink.h')
-rw-r--r--include/scsi/scsi_netlink.h86
1 files changed, 86 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