aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_device.h21
-rw-r--r--include/scsi/scsi_netlink.h62
-rw-r--r--include/scsi/scsi_transport_fc.h23
3 files changed, 101 insertions, 5 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 80b2e93c2936..b49e725be039 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -42,9 +42,11 @@ enum scsi_device_state {
42 * originate in the mid-layer) */ 42 * originate in the mid-layer) */
43 SDEV_OFFLINE, /* Device offlined (by error handling or 43 SDEV_OFFLINE, /* Device offlined (by error handling or
44 * user request */ 44 * user request */
45 SDEV_BLOCK, /* Device blocked by scsi lld. No scsi 45 SDEV_BLOCK, /* Device blocked by scsi lld. No
46 * commands from user or midlayer should be issued 46 * scsi commands from user or midlayer
47 * to the scsi lld. */ 47 * should be issued to the scsi
48 * lld. */
49 SDEV_CREATED_BLOCK, /* same as above but for created devices */
48}; 50};
49 51
50enum scsi_device_event { 52enum scsi_device_event {
@@ -384,10 +386,23 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
384#define scmd_id(scmd) sdev_id((scmd)->device) 386#define scmd_id(scmd) sdev_id((scmd)->device)
385#define scmd_channel(scmd) sdev_channel((scmd)->device) 387#define scmd_channel(scmd) sdev_channel((scmd)->device)
386 388
389/*
390 * checks for positions of the SCSI state machine
391 */
387static inline int scsi_device_online(struct scsi_device *sdev) 392static inline int scsi_device_online(struct scsi_device *sdev)
388{ 393{
389 return sdev->sdev_state != SDEV_OFFLINE; 394 return sdev->sdev_state != SDEV_OFFLINE;
390} 395}
396static inline int scsi_device_blocked(struct scsi_device *sdev)
397{
398 return sdev->sdev_state == SDEV_BLOCK ||
399 sdev->sdev_state == SDEV_CREATED_BLOCK;
400}
401static inline int scsi_device_created(struct scsi_device *sdev)
402{
403 return sdev->sdev_state == SDEV_CREATED ||
404 sdev->sdev_state == SDEV_CREATED_BLOCK;
405}
391 406
392/* accessor functions for the SCSI parameters */ 407/* accessor functions for the SCSI parameters */
393static inline int scsi_device_sync(struct scsi_device *sdev) 408static inline int scsi_device_sync(struct scsi_device *sdev)
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 8c1470cc8209..536752c40d41 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -22,6 +22,9 @@
22#ifndef SCSI_NETLINK_H 22#ifndef SCSI_NETLINK_H
23#define SCSI_NETLINK_H 23#define SCSI_NETLINK_H
24 24
25#include <linux/netlink.h>
26
27
25/* 28/*
26 * This file intended to be included by both kernel and user space 29 * This file intended to be included by both kernel and user space
27 */ 30 */
@@ -55,7 +58,41 @@ struct scsi_nl_hdr {
55#define SCSI_NL_TRANSPORT_FC 1 58#define SCSI_NL_TRANSPORT_FC 1
56#define SCSI_NL_MAX_TRANSPORTS 2 59#define SCSI_NL_MAX_TRANSPORTS 2
57 60
58/* scsi_nl_hdr->msgtype values are defined in each transport */ 61/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
62
63/*
64 * GENERIC SCSI scsi_nl_hdr->msgtype Values
65 */
66 /* kernel -> user */
67#define SCSI_NL_SHOST_VENDOR 0x0001
68 /* user -> kernel */
69/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
70
71
72/*
73 * Message Structures :
74 */
75
76/* macro to round up message lengths to 8byte boundary */
77#define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
78
79
80/*
81 * SCSI HOST Vendor Unique messages :
82 * SCSI_NL_SHOST_VENDOR
83 *
84 * Note: The Vendor Unique message payload will begin directly after
85 * this structure, with the length of the payload per vmsg_datalen.
86 *
87 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
88 * formatting requirements specified below
89 */
90struct scsi_nl_host_vendor_msg {
91 struct scsi_nl_hdr snlh; /* must be 1st element ! */
92 uint64_t vendor_id;
93 uint16_t host_no;
94 uint16_t vmsg_datalen;
95} __attribute__((aligned(sizeof(uint64_t))));
59 96
60 97
61/* 98/*
@@ -83,5 +120,28 @@ struct scsi_nl_hdr {
83 } 120 }
84 121
85 122
123#ifdef __KERNEL__
124
125#include <scsi/scsi_host.h>
126
127/* Exported Kernel Interfaces */
128int scsi_nl_add_transport(u8 tport,
129 int (*msg_handler)(struct sk_buff *),
130 void (*event_handler)(struct notifier_block *, unsigned long, void *));
131void scsi_nl_remove_transport(u8 tport);
132
133int scsi_nl_add_driver(u64 vendor_id, struct scsi_host_template *hostt,
134 int (*nlmsg_handler)(struct Scsi_Host *shost, void *payload,
135 u32 len, u32 pid),
136 void (*nlevt_handler)(struct notifier_block *nb,
137 unsigned long event, void *notify_ptr));
138void scsi_nl_remove_driver(u64 vendor_id);
139
140void scsi_nl_send_transport_msg(u32 pid, struct scsi_nl_hdr *hdr);
141int scsi_nl_send_vendor_msg(u32 pid, unsigned short host_no, u64 vendor_id,
142 char *data_buf, u32 data_len);
143
144#endif /* __KERNEL__ */
145
86#endif /* SCSI_NETLINK_H */ 146#endif /* SCSI_NETLINK_H */
87 147
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 878373c32ef7..21018a4df452 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -167,6 +167,26 @@ enum fc_tgtid_binding_type {
167struct device_attribute dev_attr_vport_##_name = \ 167struct device_attribute dev_attr_vport_##_name = \
168 __ATTR(_name,_mode,_show,_store) 168 __ATTR(_name,_mode,_show,_store)
169 169
170/*
171 * fc_vport_identifiers: This set of data contains all elements
172 * to uniquely identify and instantiate a FC virtual port.
173 *
174 * Notes:
175 * symbolic_name: The driver is to append the symbolic_name string data
176 * to the symbolic_node_name data that it generates by default.
177 * the resulting combination should then be registered with the switch.
178 * It is expected that things like Xen may stuff a VM title into
179 * this field.
180 */
181#define FC_VPORT_SYMBOLIC_NAMELEN 64
182struct fc_vport_identifiers {
183 u64 node_name;
184 u64 port_name;
185 u32 roles;
186 bool disable;
187 enum fc_port_type vport_type; /* only FC_PORTTYPE_NPIV allowed */
188 char symbolic_name[FC_VPORT_SYMBOLIC_NAMELEN];
189};
170 190
171/* 191/*
172 * FC Virtual Port Attributes 192 * FC Virtual Port Attributes
@@ -197,7 +217,6 @@ struct device_attribute dev_attr_vport_##_name = \
197 * managed by the transport w/o driver interaction. 217 * managed by the transport w/o driver interaction.
198 */ 218 */
199 219
200#define FC_VPORT_SYMBOLIC_NAMELEN 64
201struct fc_vport { 220struct fc_vport {
202 /* Fixed Attributes */ 221 /* Fixed Attributes */
203 222
@@ -732,6 +751,8 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
732 * be sure to read the Vendor Type and ID formatting requirements 751 * be sure to read the Vendor Type and ID formatting requirements
733 * specified in scsi_netlink.h 752 * specified in scsi_netlink.h
734 */ 753 */
754struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
755 struct fc_vport_identifiers *);
735int fc_vport_terminate(struct fc_vport *vport); 756int fc_vport_terminate(struct fc_vport *vport);
736 757
737#endif /* SCSI_TRANSPORT_FC_H */ 758#endif /* SCSI_TRANSPORT_FC_H */