]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/open-fcoe-rc1-update
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / open-fcoe-rc1-update
1 Subject: Update open-FCoE with latest patches from Intel
2 From: John Fastabend <john.r.fastabend@intel.com>
3 Date: Fri Dec 5 16:35:38 2008 +0100:
4 References: bnc#438954
5
6 This updates the open-FCoE stack to version 1.0.5.
7
8 Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
9 Acked-by: Hannes Reinecke <hare@suse.de>
10
11 diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
12 index de29ccd..77f8857 100644
13 --- a/drivers/scsi/fcoe/libfcoe.c
14 +++ b/drivers/scsi/fcoe/libfcoe.c
15 @@ -59,7 +59,7 @@ static int debug_fcoe;
16 MODULE_AUTHOR("Open-FCoE.org");
17 MODULE_DESCRIPTION("FCoE");
18 MODULE_LICENSE("GPL");
19 -MODULE_VERSION("1.0.4");
20 +MODULE_VERSION("1.0.5");
21
22 /* fcoe host list */
23 LIST_HEAD(fcoe_hostlist);
24 @@ -453,10 +453,9 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
25 /* adjust skb netowrk/transport offsets to match mac/fcoe/fc */
26 skb_push(skb, elen + hlen);
27 skb_reset_mac_header(skb);
28 - skb_set_network_header(skb, elen);
29 - skb_set_transport_header(skb, elen + hlen);
30 + skb_reset_network_header(skb);
31 skb->mac_len = elen;
32 - skb->protocol = htons(ETH_P_FCOE);
33 + skb->protocol = htons(ETH_P_802_3);
34 skb->dev = fc->real_dev;
35
36 /* fill up mac and fcoe headers */
37 @@ -473,7 +472,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
38 else
39 memcpy(eh->h_source, fc->data_src_addr, ETH_ALEN);
40
41 - hp = (struct fcoe_hdr *)skb_network_header(skb);
42 + hp = (struct fcoe_hdr *)(eh + 1);
43 memset(hp, 0, sizeof(*hp));
44 if (FC_FCOE_VER)
45 FC_FCOE_ENCAPS_VER(hp, FC_FCOE_VER);
46 diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
47 index aee2f9c..0cd8d0c 100644
48 --- a/drivers/scsi/libfc/fc_disc.c
49 +++ b/drivers/scsi/libfc/fc_disc.c
50 @@ -45,9 +45,6 @@ static int fc_disc_debug;
51 FC_DBG(fmt); \
52 } while (0)
53
54 -static struct mutex disc_list_lock;
55 -static struct list_head disc_list;
56 -
57 struct fc_disc {
58 unsigned char retry_count;
59 unsigned char delay;
60 @@ -66,7 +63,6 @@ struct fc_disc {
61 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
62 struct delayed_work disc_work;
63
64 - struct list_head list;
65 };
66
67 static void fc_disc_gpn_ft_req(struct fc_disc *);
68 @@ -87,26 +83,23 @@ static void fc_disc_restart(struct fc_disc *);
69 struct fc_rport *fc_disc_lookup_rport(const struct fc_lport *lport,
70 u32 port_id)
71 {
72 - struct fc_disc *disc;
73 + struct fc_disc *disc = lport->disc;
74 struct fc_rport *rport, *found = NULL;
75 struct fc_rport_libfc_priv *rdata;
76 int disc_found = 0;
77
78 - mutex_lock(&disc_list_lock);
79 - list_for_each_entry(disc, &disc_list, list) {
80 - if (disc->lport == lport) {
81 - list_for_each_entry(rdata, &disc->rports, peers) {
82 - rport = PRIV_TO_RPORT(rdata);
83 - if (rport->port_id == port_id) {
84 - disc_found = 1;
85 - found = rport;
86 - get_device(&found->dev);
87 - break;
88 - }
89 - }
90 + if (!disc)
91 + return NULL;
92 +
93 + list_for_each_entry(rdata, &disc->rports, peers) {
94 + rport = PRIV_TO_RPORT(rdata);
95 + if (rport->port_id == port_id) {
96 + disc_found = 1;
97 + found = rport;
98 + get_device(&found->dev);
99 + break;
100 }
101 }
102 - mutex_unlock(&disc_list_lock);
103
104 if (!disc_found) {
105 FC_DEBUG_DISC("The rport (%6x) for lport (%6x) "
106 @@ -127,19 +120,15 @@ static inline struct fc_disc *fc_disc_alloc(struct fc_lport *lport)
107 struct fc_disc *disc;
108
109 disc = kzalloc(sizeof(struct fc_disc), GFP_KERNEL);
110 - INIT_LIST_HEAD(&disc->list);
111 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout);
112 mutex_init(&disc->disc_mutex);
113 INIT_LIST_HEAD(&disc->rports);
114
115 disc->lport = lport;
116 + lport->disc = disc;
117 disc->delay = FC_DISC_DELAY;
118 disc->event = DISC_EV_NONE;
119
120 - mutex_lock(&disc_list_lock);
121 - list_add_tail(&disc->list, &disc_list);
122 - mutex_unlock(&disc_list_lock);
123 -
124 return disc;
125 }
126
127 @@ -182,23 +171,19 @@ static void fc_disc_rport_event(struct fc_lport *lport,
128 enum fc_lport_event event)
129 {
130 struct fc_rport_libfc_priv *rdata = rport->dd_data;
131 - struct fc_disc *disc;
132 + struct fc_disc *disc = lport->disc;
133 int found = 0;
134
135 FC_DEBUG_DISC("Received a %d event for port (%6x)\n", event,
136 rport->port_id);
137
138 if (event == RPORT_EV_CREATED) {
139 - mutex_lock(&disc_list_lock);
140 - list_for_each_entry(disc, &disc_list, list) {
141 - if (disc->lport == lport) {
142 - found = 1;
143 - mutex_lock(&disc->disc_mutex);
144 - list_add_tail(&rdata->peers, &disc->rports);
145 - mutex_unlock(&disc->disc_mutex);
146 - }
147 + if (disc) {
148 + found = 1;
149 + mutex_lock(&disc->disc_mutex);
150 + list_add_tail(&rdata->peers, &disc->rports);
151 + mutex_unlock(&disc->disc_mutex);
152 }
153 - mutex_unlock(&disc_list_lock);
154 }
155
156 if (!found)
157 @@ -323,19 +308,9 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp,
158 struct fc_lport *lport)
159 {
160 u8 op;
161 - struct fc_disc *disc;
162 - int found = 0;
163 -
164 - mutex_lock(&disc_list_lock);
165 - list_for_each_entry(disc, &disc_list, list) {
166 - if (disc->lport == lport) {
167 - found = 1;
168 - break;
169 - }
170 - }
171 - mutex_unlock(&disc_list_lock);
172 + struct fc_disc *disc = lport->disc;
173
174 - if (!found) {
175 + if (!disc) {
176 FC_DBG("Received a request for an lport not managed "
177 "by the discovery engine\n");
178 return;
179 @@ -394,19 +369,9 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *,
180 {
181 struct fc_rport *rport;
182 struct fc_rport_identifiers ids;
183 - struct fc_disc *disc;
184 - int found = 0;
185 -
186 - mutex_lock(&disc_list_lock);
187 - list_for_each_entry(disc, &disc_list, list) {
188 - if (disc->lport == lport) {
189 - found = 1;
190 - break;
191 - }
192 - }
193 - mutex_unlock(&disc_list_lock);
194 + struct fc_disc *disc = lport->disc;
195
196 - if (!found) {
197 + if (!disc) {
198 FC_DEBUG_DISC("No existing discovery job, "
199 "creating one for lport (%6x)\n",
200 fc_host_port_id(lport->host));
201 @@ -510,7 +475,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
202 rport = fc_rport_rogue_create(&dp);
203 }
204 if (!rport)
205 - error = ENOMEM;
206 + error = -ENOMEM;
207 }
208 if (rport) {
209 rp = rport->dd_data;
210 @@ -577,18 +542,16 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
211 if (disc->retry_count < FC_DISC_RETRY_LIMIT) {
212 /* go ahead and retry */
213 if (!fp)
214 - delay = msecs_to_jiffies(500);
215 + delay = msecs_to_jiffies(FC_DISC_RETRY_DELAY);
216 else {
217 - delay = jiffies +
218 - msecs_to_jiffies(lport->e_d_tov);
219 + delay = msecs_to_jiffies(lport->e_d_tov);
220
221 /* timeout faster first time */
222 if (!disc->retry_count)
223 delay /= 4;
224 }
225 disc->retry_count++;
226 - schedule_delayed_work(&disc->disc_work,
227 - delay);
228 + schedule_delayed_work(&disc->disc_work, delay);
229 } else {
230 /* exceeded retries */
231 disc->event = DISC_EV_FAILED;
232 @@ -868,16 +831,12 @@ out:
233 */
234 void fc_disc_stop(struct fc_lport *lport)
235 {
236 - struct fc_disc *disc, *next;
237 + struct fc_disc *disc = lport->disc;
238
239 - mutex_lock(&disc_list_lock);
240 - list_for_each_entry_safe(disc, next, &disc_list, list) {
241 - if (disc->lport == lport) {
242 - cancel_delayed_work_sync(&disc->disc_work);
243 - fc_disc_stop_rports(disc);
244 - }
245 + if (disc) {
246 + cancel_delayed_work_sync(&disc->disc_work);
247 + fc_disc_stop_rports(disc);
248 }
249 - mutex_unlock(&disc_list_lock);
250 }
251
252 /**
253 @@ -889,18 +848,8 @@ void fc_disc_stop(struct fc_lport *lport)
254 */
255 void fc_disc_stop_final(struct fc_lport *lport)
256 {
257 - struct fc_disc *disc, *next;
258 fc_disc_stop(lport);
259 lport->tt.rport_flush_queue();
260 -
261 - mutex_lock(&disc_list_lock);
262 - list_for_each_entry_safe(disc, next, &disc_list, list) {
263 - if (disc->lport == lport) {
264 - list_del(&disc->list);
265 - kfree(disc);
266 - }
267 - }
268 - mutex_unlock(&disc_list_lock);
269 }
270
271 /**
272 @@ -909,8 +858,6 @@ void fc_disc_stop_final(struct fc_lport *lport)
273 */
274 int fc_disc_init(struct fc_lport *lport)
275 {
276 - INIT_LIST_HEAD(&disc_list);
277 - mutex_init(&disc_list_lock);
278
279 if (!lport->tt.disc_start)
280 lport->tt.disc_start = fc_disc_start;
281 diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
282 index 04ced7f..2426501 100644
283 --- a/drivers/scsi/libfc/fc_fcp.c
284 +++ b/drivers/scsi/libfc/fc_fcp.c
285 @@ -42,6 +42,7 @@
286 MODULE_AUTHOR("Open-FCoE.org");
287 MODULE_DESCRIPTION("libfc");
288 MODULE_LICENSE("GPL");
289 +MODULE_VERSION("1.0.5");
290
291 static int fc_fcp_debug;
292
293 diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
294 index 083d57b..de16203 100644
295 --- a/drivers/scsi/libfc/fc_lport.c
296 +++ b/drivers/scsi/libfc/fc_lport.c
297 @@ -577,6 +577,8 @@ int fc_fabric_logoff(struct fc_lport *lport)
298 {
299 lport->tt.disc_stop_final(lport);
300 mutex_lock(&lport->lp_mutex);
301 + kfree(lport->disc);
302 + lport->disc = NULL;
303 fc_lport_enter_logo(lport);
304 mutex_unlock(&lport->lp_mutex);
305 return 0;
306 diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
307 index dac03e2..587be50 100644
308 --- a/include/scsi/libfc.h
309 +++ b/include/scsi/libfc.h
310 @@ -570,6 +570,8 @@ struct libfc_function_template {
311 void (*disc_stop_final) (struct fc_lport *);
312 };
313
314 +struct fc_disc;
315 +
316 struct fc_lport {
317 struct list_head list;
318
319 @@ -578,6 +580,7 @@ struct fc_lport {
320 struct fc_exch_mgr *emp;
321 struct fc_rport *dns_rp;
322 struct fc_rport *ptp_rp;
323 + struct fc_disc *disc;
324 void *scsi_priv;
325
326 /* Operational Information */