This source file includes following definitions.
- srp_chkready
1
2 #ifndef SCSI_TRANSPORT_SRP_H
3 #define SCSI_TRANSPORT_SRP_H
4
5 #include <linux/transport_class.h>
6 #include <linux/types.h>
7 #include <linux/mutex.h>
8
9 #define SRP_RPORT_ROLE_INITIATOR 0
10 #define SRP_RPORT_ROLE_TARGET 1
11
12 struct srp_rport_identifiers {
13 u8 port_id[16];
14 u8 roles;
15 };
16
17
18
19
20
21
22
23
24
25 enum srp_rport_state {
26 SRP_RPORT_RUNNING,
27 SRP_RPORT_BLOCKED,
28 SRP_RPORT_FAIL_FAST,
29 SRP_RPORT_LOST,
30 };
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 struct srp_rport {
54
55
56 struct device dev;
57
58 u8 port_id[16];
59 u8 roles;
60
61
62
63 void *lld_data;
64
65 struct mutex mutex;
66 enum srp_rport_state state;
67 int reconnect_delay;
68 int failed_reconnects;
69 struct delayed_work reconnect_work;
70 int fast_io_fail_tmo;
71 int dev_loss_tmo;
72 struct delayed_work fast_io_fail_work;
73 struct delayed_work dev_loss_work;
74 };
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93 struct srp_function_template {
94
95 bool has_rport_state;
96 bool reset_timer_if_blocked;
97 int *reconnect_delay;
98 int *fast_io_fail_tmo;
99 int *dev_loss_tmo;
100 int (*reconnect)(struct srp_rport *rport);
101 void (*terminate_rport_io)(struct srp_rport *rport);
102 void (*rport_delete)(struct srp_rport *rport);
103 };
104
105 extern struct scsi_transport_template *
106 srp_attach_transport(struct srp_function_template *);
107 extern void srp_release_transport(struct scsi_transport_template *);
108
109 extern void srp_rport_get(struct srp_rport *rport);
110 extern void srp_rport_put(struct srp_rport *rport);
111 extern struct srp_rport *srp_rport_add(struct Scsi_Host *,
112 struct srp_rport_identifiers *);
113 extern void srp_rport_del(struct srp_rport *);
114 extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo,
115 long dev_loss_tmo);
116 int srp_parse_tmo(int *tmo, const char *buf);
117 extern int srp_reconnect_rport(struct srp_rport *rport);
118 extern void srp_start_tl_fail_timers(struct srp_rport *rport);
119 extern void srp_remove_host(struct Scsi_Host *);
120 extern void srp_stop_rport_timers(struct srp_rport *rport);
121 enum blk_eh_timer_return srp_timed_out(struct scsi_cmnd *scmd);
122
123
124
125
126
127
128
129
130
131 static inline int srp_chkready(struct srp_rport *rport)
132 {
133 switch (rport->state) {
134 case SRP_RPORT_RUNNING:
135 case SRP_RPORT_BLOCKED:
136 default:
137 return 0;
138 case SRP_RPORT_FAIL_FAST:
139 return DID_TRANSPORT_FAILFAST << 16;
140 case SRP_RPORT_LOST:
141 return DID_NO_CONNECT << 16;
142 }
143 }
144
145 #endif