aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/fcoe_sysfs.h124
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/libfcoe.h27
-rw-r--r--include/scsi/sas.h1
4 files changed, 154 insertions, 0 deletions
diff --git a/include/scsi/fcoe_sysfs.h b/include/scsi/fcoe_sysfs.h
new file mode 100644
index 000000000000..604cb9bb3e76
--- /dev/null
+++ b/include/scsi/fcoe_sysfs.h
@@ -0,0 +1,124 @@
1/*
2 * Copyright (c) 2011-2012 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef FCOE_SYSFS
21#define FCOE_SYSFS
22
23#include <linux/if_ether.h>
24#include <linux/device.h>
25#include <scsi/fc/fc_fcoe.h>
26
27struct fcoe_ctlr_device;
28struct fcoe_fcf_device;
29
30struct fcoe_sysfs_function_template {
31 void (*get_fcoe_ctlr_link_fail)(struct fcoe_ctlr_device *);
32 void (*get_fcoe_ctlr_vlink_fail)(struct fcoe_ctlr_device *);
33 void (*get_fcoe_ctlr_miss_fka)(struct fcoe_ctlr_device *);
34 void (*get_fcoe_ctlr_symb_err)(struct fcoe_ctlr_device *);
35 void (*get_fcoe_ctlr_err_block)(struct fcoe_ctlr_device *);
36 void (*get_fcoe_ctlr_fcs_error)(struct fcoe_ctlr_device *);
37 void (*get_fcoe_ctlr_mode)(struct fcoe_ctlr_device *);
38 void (*get_fcoe_fcf_selected)(struct fcoe_fcf_device *);
39 void (*get_fcoe_fcf_vlan_id)(struct fcoe_fcf_device *);
40};
41
42#define dev_to_ctlr(d) \
43 container_of((d), struct fcoe_ctlr_device, dev)
44
45enum fip_conn_type {
46 FIP_CONN_TYPE_UNKNOWN,
47 FIP_CONN_TYPE_FABRIC,
48 FIP_CONN_TYPE_VN2VN,
49};
50
51struct fcoe_ctlr_device {
52 u32 id;
53
54 struct device dev;
55 struct fcoe_sysfs_function_template *f;
56
57 struct list_head fcfs;
58 char work_q_name[20];
59 struct workqueue_struct *work_q;
60 char devloss_work_q_name[20];
61 struct workqueue_struct *devloss_work_q;
62 struct mutex lock;
63
64 int fcf_dev_loss_tmo;
65 enum fip_conn_type mode;
66
67 /* expected in host order for displaying */
68 struct fcoe_fc_els_lesb lesb;
69};
70
71static inline void *fcoe_ctlr_device_priv(const struct fcoe_ctlr_device *ctlr)
72{
73 return (void *)(ctlr + 1);
74}
75
76/* fcf states */
77enum fcf_state {
78 FCOE_FCF_STATE_UNKNOWN,
79 FCOE_FCF_STATE_DISCONNECTED,
80 FCOE_FCF_STATE_CONNECTED,
81 FCOE_FCF_STATE_DELETED,
82};
83
84struct fcoe_fcf_device {
85 u32 id;
86 struct device dev;
87 struct list_head peers;
88 struct work_struct delete_work;
89 struct delayed_work dev_loss_work;
90 u32 dev_loss_tmo;
91 void *priv;
92 enum fcf_state state;
93
94 u64 fabric_name;
95 u64 switch_name;
96 u32 fc_map;
97 u16 vfid;
98 u8 mac[ETH_ALEN];
99 u8 priority;
100 u32 fka_period;
101 u8 selected;
102 u16 vlan_id;
103};
104
105#define dev_to_fcf(d) \
106 container_of((d), struct fcoe_fcf_device, dev)
107/* parentage should never be missing */
108#define fcoe_fcf_dev_to_ctlr_dev(x) \
109 dev_to_ctlr((x)->dev.parent)
110#define fcoe_fcf_device_priv(x) \
111 ((x)->priv)
112
113struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
114 struct fcoe_sysfs_function_template *f,
115 int priv_size);
116void fcoe_ctlr_device_delete(struct fcoe_ctlr_device *);
117struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *,
118 struct fcoe_fcf_device *);
119void fcoe_fcf_device_delete(struct fcoe_fcf_device *);
120
121int __init fcoe_sysfs_setup(void);
122void __exit fcoe_sysfs_teardown(void);
123
124#endif /* FCOE_SYSFS */
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 988ba06b3ad6..c1260d80ef30 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -661,6 +661,8 @@ struct iscsi_reject {
661 661
662#define ISCSI_DEF_TIME2WAIT 2 662#define ISCSI_DEF_TIME2WAIT 2
663 663
664#define ISCSI_NAME_LEN 224
665
664/************************* RFC 3720 End *****************************/ 666/************************* RFC 3720 End *****************************/
665 667
666#endif /* ISCSI_PROTO_H */ 668#endif /* ISCSI_PROTO_H */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index cfdb55f0937e..22b07cc99808 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -29,6 +29,7 @@
29#include <linux/random.h> 29#include <linux/random.h>
30#include <scsi/fc/fc_fcoe.h> 30#include <scsi/fc/fc_fcoe.h>
31#include <scsi/libfc.h> 31#include <scsi/libfc.h>
32#include <scsi/fcoe_sysfs.h>
32 33
33#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */ 34#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
34 35
@@ -159,8 +160,24 @@ struct fcoe_ctlr {
159}; 160};
160 161
161/** 162/**
163 * fcoe_ctlr_priv() - Return the private data from a fcoe_ctlr
164 * @cltr: The fcoe_ctlr whose private data will be returned
165 */
166static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr)
167{
168 return (void *)(ctlr + 1);
169}
170
171#define fcoe_ctlr_to_ctlr_dev(x) \
172 (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1)
173
174/**
162 * struct fcoe_fcf - Fibre-Channel Forwarder 175 * struct fcoe_fcf - Fibre-Channel Forwarder
163 * @list: list linkage 176 * @list: list linkage
177 * @event_work: Work for FC Transport actions queue
178 * @event: The event to be processed
179 * @fip: The controller that the FCF was discovered on
180 * @fcf_dev: The associated fcoe_fcf_device instance
164 * @time: system time (jiffies) when an advertisement was last received 181 * @time: system time (jiffies) when an advertisement was last received
165 * @switch_name: WWN of switch from advertisement 182 * @switch_name: WWN of switch from advertisement
166 * @fabric_name: WWN of fabric from advertisement 183 * @fabric_name: WWN of fabric from advertisement
@@ -182,6 +199,9 @@ struct fcoe_ctlr {
182 */ 199 */
183struct fcoe_fcf { 200struct fcoe_fcf {
184 struct list_head list; 201 struct list_head list;
202 struct work_struct event_work;
203 struct fcoe_ctlr *fip;
204 struct fcoe_fcf_device *fcf_dev;
185 unsigned long time; 205 unsigned long time;
186 206
187 u64 switch_name; 207 u64 switch_name;
@@ -198,6 +218,9 @@ struct fcoe_fcf {
198 u8 fd_flags:1; 218 u8 fd_flags:1;
199}; 219};
200 220
221#define fcoe_fcf_to_fcf_dev(x) \
222 ((x)->fcf_dev)
223
201/** 224/**
202 * struct fcoe_rport - VN2VN remote port 225 * struct fcoe_rport - VN2VN remote port
203 * @time: time of create or last beacon packet received from node 226 * @time: time of create or last beacon packet received from node
@@ -333,6 +356,10 @@ void fcoe_queue_timer(ulong lport);
333int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, 356int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen,
334 struct fcoe_percpu_s *fps); 357 struct fcoe_percpu_s *fps);
335 358
359/* FCoE Sysfs helpers */
360void fcoe_fcf_get_selected(struct fcoe_fcf_device *);
361void fcoe_ctlr_get_fip_mode(struct fcoe_ctlr_device *);
362
336/** 363/**
337 * struct netdev_list 364 * struct netdev_list
338 * A mapping from netdevice to fcoe_transport 365 * A mapping from netdevice to fcoe_transport
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index a577a833603d..be3eb0bf1ac0 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -103,6 +103,7 @@ enum sas_dev_type {
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
106 SAS_PROTOCOL_NONE = 0,
106 SAS_PROTOCOL_SATA = 0x01, 107 SAS_PROTOCOL_SATA = 0x01,
107 SAS_PROTOCOL_SMP = 0x02, 108 SAS_PROTOCOL_SMP = 0x02,
108 SAS_PROTOCOL_STP = 0x04, 109 SAS_PROTOCOL_STP = 0x04,