diff options
author | Peter Tiedemann <ptiedem@de.ibm.com> | 2008-07-18 09:24:57 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-22 17:53:46 -0400 |
commit | aa3f2cb63086e474a2ac3836d01fc6d9db393846 (patch) | |
tree | dfeb9dea4c7bd3a5fce6f223f4e261e6a0fe1ac2 /drivers/s390/net/ctcm_mpc.c | |
parent | b805da74dee3a8de8a29654078c5198f2fb0e15b (diff) |
s390/net/ctcm: message cleanup
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/s390/net/ctcm_mpc.c')
-rw-r--r-- | drivers/s390/net/ctcm_mpc.c | 1110 |
1 files changed, 412 insertions, 698 deletions
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 044addee64a2..49ae1cd25caa 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c | |||
@@ -149,7 +149,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
149 | for (ct = 0; ct < len; ct++, ptr++, rptr++) { | 149 | for (ct = 0; ct < len; ct++, ptr++, rptr++) { |
150 | if (sw == 0) { | 150 | if (sw == 0) { |
151 | #if (UTS_MACHINE == s390x) | 151 | #if (UTS_MACHINE == s390x) |
152 | sprintf(addr, "%16.16lx", (unsigned long)rptr); | 152 | sprintf(addr, "%16.16lx", (__u64)rptr); |
153 | #else | 153 | #else |
154 | sprintf(addr, "%8.8X", (__u32)rptr); | 154 | sprintf(addr, "%8.8X", (__u32)rptr); |
155 | #endif | 155 | #endif |
@@ -164,7 +164,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
164 | strcat(bhex, " "); | 164 | strcat(bhex, " "); |
165 | 165 | ||
166 | #if (UTS_MACHINE == s390x) | 166 | #if (UTS_MACHINE == s390x) |
167 | sprintf(tbuf, "%2.2lX", (unsigned long)*ptr); | 167 | sprintf(tbuf, "%2.2lX", (__u64)*ptr); |
168 | #else | 168 | #else |
169 | sprintf(tbuf, "%2.2X", (__u32)*ptr); | 169 | sprintf(tbuf, "%2.2X", (__u32)*ptr); |
170 | #endif | 170 | #endif |
@@ -179,24 +179,24 @@ void ctcmpc_dumpit(char *buf, int len) | |||
179 | basc[sw+1] = '\0'; | 179 | basc[sw+1] = '\0'; |
180 | sw++; | 180 | sw++; |
181 | rm--; | 181 | rm--; |
182 | if (sw == 16) { | 182 | if (sw != 16) |
183 | if ((strcmp(duphex, bhex)) != 0) { | 183 | continue; |
184 | if (dup != 0) { | 184 | if ((strcmp(duphex, bhex)) != 0) { |
185 | sprintf(tdup, "Duplicate as above " | 185 | if (dup != 0) { |
186 | "to %s", addr); | 186 | sprintf(tdup, |
187 | printk(KERN_INFO " " | 187 | "Duplicate as above to %s", addr); |
188 | " --- %s ---\n", tdup); | 188 | ctcm_pr_debug(" --- %s ---\n", |
189 | } | 189 | tdup); |
190 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 190 | } |
191 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", | ||
191 | addr, boff, bhex, basc); | 192 | addr, boff, bhex, basc); |
192 | dup = 0; | 193 | dup = 0; |
193 | strcpy(duphex, bhex); | 194 | strcpy(duphex, bhex); |
194 | } else | 195 | } else |
195 | dup++; | 196 | dup++; |
196 | 197 | ||
197 | sw = 0; | 198 | sw = 0; |
198 | rm = 16; | 199 | rm = 16; |
199 | } | ||
200 | } /* endfor */ | 200 | } /* endfor */ |
201 | 201 | ||
202 | if (sw != 0) { | 202 | if (sw != 0) { |
@@ -210,19 +210,17 @@ void ctcmpc_dumpit(char *buf, int len) | |||
210 | } | 210 | } |
211 | if (dup != 0) { | 211 | if (dup != 0) { |
212 | sprintf(tdup, "Duplicate as above to %s", addr); | 212 | sprintf(tdup, "Duplicate as above to %s", addr); |
213 | printk(KERN_INFO " " | 213 | ctcm_pr_debug(" --- %s ---\n", tdup); |
214 | " --- %s ---\n", tdup); | ||
215 | } | 214 | } |
216 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 215 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", |
217 | addr, boff, bhex, basc); | 216 | addr, boff, bhex, basc); |
218 | } else { | 217 | } else { |
219 | if (dup >= 1) { | 218 | if (dup >= 1) { |
220 | sprintf(tdup, "Duplicate as above to %s", addr); | 219 | sprintf(tdup, "Duplicate as above to %s", addr); |
221 | printk(KERN_INFO " " | 220 | ctcm_pr_debug(" --- %s ---\n", tdup); |
222 | " --- %s ---\n", tdup); | ||
223 | } | 221 | } |
224 | if (dup != 0) { | 222 | if (dup != 0) { |
225 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 223 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", |
226 | addr, boff, bhex, basc); | 224 | addr, boff, bhex, basc); |
227 | } | 225 | } |
228 | } | 226 | } |
@@ -241,7 +239,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
241 | */ | 239 | */ |
242 | void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | 240 | void ctcmpc_dump_skb(struct sk_buff *skb, int offset) |
243 | { | 241 | { |
244 | unsigned char *p = skb->data; | 242 | __u8 *p = skb->data; |
245 | struct th_header *header; | 243 | struct th_header *header; |
246 | struct pdu *pheader; | 244 | struct pdu *pheader; |
247 | int bl = skb->len; | 245 | int bl = skb->len; |
@@ -253,8 +251,8 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | |||
253 | p += offset; | 251 | p += offset; |
254 | header = (struct th_header *)p; | 252 | header = (struct th_header *)p; |
255 | 253 | ||
256 | printk(KERN_INFO "dump:\n"); | 254 | ctcm_pr_debug("dump:\n"); |
257 | printk(KERN_INFO "skb len=%d \n", skb->len); | 255 | ctcm_pr_debug("skb len=%d \n", skb->len); |
258 | if (skb->len > 2) { | 256 | if (skb->len > 2) { |
259 | switch (header->th_ch_flag) { | 257 | switch (header->th_ch_flag) { |
260 | case TH_HAS_PDU: | 258 | case TH_HAS_PDU: |
@@ -273,32 +271,64 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | |||
273 | } | 271 | } |
274 | 272 | ||
275 | pheader = (struct pdu *)p; | 273 | pheader = (struct pdu *)p; |
276 | printk(KERN_INFO "pdu->offset: %d hex: %04x\n", | 274 | ctcm_pr_debug("pdu->offset: %d hex: %04x\n", |
277 | pheader->pdu_offset, pheader->pdu_offset); | 275 | pheader->pdu_offset, pheader->pdu_offset); |
278 | printk(KERN_INFO "pdu->flag : %02x\n", pheader->pdu_flag); | 276 | ctcm_pr_debug("pdu->flag : %02x\n", pheader->pdu_flag); |
279 | printk(KERN_INFO "pdu->proto : %02x\n", pheader->pdu_proto); | 277 | ctcm_pr_debug("pdu->proto : %02x\n", pheader->pdu_proto); |
280 | printk(KERN_INFO "pdu->seq : %02x\n", pheader->pdu_seq); | 278 | ctcm_pr_debug("pdu->seq : %02x\n", pheader->pdu_seq); |
281 | goto dumpdata; | 279 | goto dumpdata; |
282 | 280 | ||
283 | dumpth: | 281 | dumpth: |
284 | printk(KERN_INFO "th->seg : %02x\n", header->th_seg); | 282 | ctcm_pr_debug("th->seg : %02x\n", header->th_seg); |
285 | printk(KERN_INFO "th->ch : %02x\n", header->th_ch_flag); | 283 | ctcm_pr_debug("th->ch : %02x\n", header->th_ch_flag); |
286 | printk(KERN_INFO "th->blk_flag: %02x\n", header->th_blk_flag); | 284 | ctcm_pr_debug("th->blk_flag: %02x\n", header->th_blk_flag); |
287 | printk(KERN_INFO "th->type : %s\n", | 285 | ctcm_pr_debug("th->type : %s\n", |
288 | (header->th_is_xid) ? "DATA" : "XID"); | 286 | (header->th_is_xid) ? "DATA" : "XID"); |
289 | printk(KERN_INFO "th->seqnum : %04x\n", header->th_seq_num); | 287 | ctcm_pr_debug("th->seqnum : %04x\n", header->th_seq_num); |
290 | 288 | ||
291 | } | 289 | } |
292 | dumpdata: | 290 | dumpdata: |
293 | if (bl > 32) | 291 | if (bl > 32) |
294 | bl = 32; | 292 | bl = 32; |
295 | printk(KERN_INFO "data: "); | 293 | ctcm_pr_debug("data: "); |
296 | for (i = 0; i < bl; i++) | 294 | for (i = 0; i < bl; i++) |
297 | printk(KERN_INFO "%02x%s", *p++, (i % 16) ? " " : "\n<7>"); | 295 | ctcm_pr_debug("%02x%s", *p++, (i % 16) ? " " : "\n"); |
298 | printk(KERN_INFO "\n"); | 296 | ctcm_pr_debug("\n"); |
299 | } | 297 | } |
300 | #endif | 298 | #endif |
301 | 299 | ||
300 | static struct net_device *ctcmpc_get_dev(int port_num) | ||
301 | { | ||
302 | char device[20]; | ||
303 | struct net_device *dev; | ||
304 | struct ctcm_priv *priv; | ||
305 | |||
306 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
307 | |||
308 | dev = __dev_get_by_name(&init_net, device); | ||
309 | |||
310 | if (dev == NULL) { | ||
311 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
312 | "%s: Device not found by name: %s", | ||
313 | CTCM_FUNTAIL, device); | ||
314 | return NULL; | ||
315 | } | ||
316 | priv = dev->priv; | ||
317 | if (priv == NULL) { | ||
318 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
319 | "%s(%s): dev->priv is NULL", | ||
320 | CTCM_FUNTAIL, device); | ||
321 | return NULL; | ||
322 | } | ||
323 | if (priv->mpcg == NULL) { | ||
324 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
325 | "%s(%s): priv->mpcg is NULL", | ||
326 | CTCM_FUNTAIL, device); | ||
327 | return NULL; | ||
328 | } | ||
329 | return dev; | ||
330 | } | ||
331 | |||
302 | /* | 332 | /* |
303 | * ctc_mpc_alloc_channel | 333 | * ctc_mpc_alloc_channel |
304 | * (exported interface) | 334 | * (exported interface) |
@@ -308,34 +338,23 @@ dumpdata: | |||
308 | */ | 338 | */ |
309 | int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | 339 | int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) |
310 | { | 340 | { |
311 | char device[20]; | ||
312 | struct net_device *dev; | 341 | struct net_device *dev; |
313 | struct mpc_group *grp; | 342 | struct mpc_group *grp; |
314 | struct ctcm_priv *priv; | 343 | struct ctcm_priv *priv; |
315 | 344 | ||
316 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 345 | dev = ctcmpc_get_dev(port_num); |
317 | 346 | if (dev == NULL) | |
318 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
319 | dev = __dev_get_by_name(&init_net, device); | ||
320 | |||
321 | if (dev == NULL) { | ||
322 | printk(KERN_INFO "ctc_mpc_alloc_channel %s dev=NULL\n", device); | ||
323 | return 1; | 347 | return 1; |
324 | } | ||
325 | |||
326 | priv = dev->priv; | 348 | priv = dev->priv; |
327 | grp = priv->mpcg; | 349 | grp = priv->mpcg; |
328 | if (!grp) | ||
329 | return 1; | ||
330 | 350 | ||
331 | grp->allochanfunc = callback; | 351 | grp->allochanfunc = callback; |
332 | grp->port_num = port_num; | 352 | grp->port_num = port_num; |
333 | grp->port_persist = 1; | 353 | grp->port_persist = 1; |
334 | 354 | ||
335 | ctcm_pr_debug("ctcmpc: %s called for device %s state=%s\n", | 355 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
336 | __FUNCTION__, | 356 | "%s(%s): state=%s", |
337 | dev->name, | 357 | CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); |
338 | fsm_getstate_str(grp->fsm)); | ||
339 | 358 | ||
340 | switch (fsm_getstate(grp->fsm)) { | 359 | switch (fsm_getstate(grp->fsm)) { |
341 | case MPCG_STATE_INOP: | 360 | case MPCG_STATE_INOP: |
@@ -377,12 +396,8 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | |||
377 | grp->allocchan_callback_retries = 0; | 396 | grp->allocchan_callback_retries = 0; |
378 | } | 397 | } |
379 | break; | 398 | break; |
380 | default: | ||
381 | return 0; | ||
382 | |||
383 | } | 399 | } |
384 | 400 | ||
385 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
386 | return 0; | 401 | return 0; |
387 | } | 402 | } |
388 | EXPORT_SYMBOL(ctc_mpc_alloc_channel); | 403 | EXPORT_SYMBOL(ctc_mpc_alloc_channel); |
@@ -394,31 +409,22 @@ EXPORT_SYMBOL(ctc_mpc_alloc_channel); | |||
394 | void ctc_mpc_establish_connectivity(int port_num, | 409 | void ctc_mpc_establish_connectivity(int port_num, |
395 | void (*callback)(int, int, int)) | 410 | void (*callback)(int, int, int)) |
396 | { | 411 | { |
397 | char device[20]; | ||
398 | struct net_device *dev; | 412 | struct net_device *dev; |
399 | struct mpc_group *grp; | 413 | struct mpc_group *grp; |
400 | struct ctcm_priv *priv; | 414 | struct ctcm_priv *priv; |
401 | struct channel *rch, *wch; | 415 | struct channel *rch, *wch; |
402 | 416 | ||
403 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 417 | dev = ctcmpc_get_dev(port_num); |
404 | 418 | if (dev == NULL) | |
405 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
406 | dev = __dev_get_by_name(&init_net, device); | ||
407 | |||
408 | if (dev == NULL) { | ||
409 | printk(KERN_INFO "ctc_mpc_establish_connectivity " | ||
410 | "%s dev=NULL\n", device); | ||
411 | return; | 419 | return; |
412 | } | ||
413 | priv = dev->priv; | 420 | priv = dev->priv; |
421 | grp = priv->mpcg; | ||
414 | rch = priv->channel[READ]; | 422 | rch = priv->channel[READ]; |
415 | wch = priv->channel[WRITE]; | 423 | wch = priv->channel[WRITE]; |
416 | 424 | ||
417 | grp = priv->mpcg; | 425 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
418 | 426 | "%s(%s): state=%s", | |
419 | ctcm_pr_debug("ctcmpc: %s() called for device %s state=%s\n", | 427 | CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); |
420 | __FUNCTION__, dev->name, | ||
421 | fsm_getstate_str(grp->fsm)); | ||
422 | 428 | ||
423 | grp->estconnfunc = callback; | 429 | grp->estconnfunc = callback; |
424 | grp->port_num = port_num; | 430 | grp->port_num = port_num; |
@@ -446,8 +452,10 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
446 | case MPCG_STATE_RESET: | 452 | case MPCG_STATE_RESET: |
447 | /* MPC Group is not ready to start XID - min num of */ | 453 | /* MPC Group is not ready to start XID - min num of */ |
448 | /* 1 read and 1 write channel have not been acquired*/ | 454 | /* 1 read and 1 write channel have not been acquired*/ |
449 | printk(KERN_WARNING "ctcmpc: %s() REJECTED ACTIVE XID Req" | 455 | |
450 | "uest - Channel Pair is not Active\n", __FUNCTION__); | 456 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
457 | "%s(%s): REJECTED - inactive channels", | ||
458 | CTCM_FUNTAIL, dev->name); | ||
451 | if (grp->estconnfunc) { | 459 | if (grp->estconnfunc) { |
452 | grp->estconnfunc(grp->port_num, -1, 0); | 460 | grp->estconnfunc(grp->port_num, -1, 0); |
453 | grp->estconnfunc = NULL; | 461 | grp->estconnfunc = NULL; |
@@ -457,11 +465,12 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
457 | /* alloc channel was called but no XID exchange */ | 465 | /* alloc channel was called but no XID exchange */ |
458 | /* has occurred. initiate xside XID exchange */ | 466 | /* has occurred. initiate xside XID exchange */ |
459 | /* make sure yside XID0 processing has not started */ | 467 | /* make sure yside XID0 processing has not started */ |
468 | |||
460 | if ((fsm_getstate(rch->fsm) > CH_XID0_PENDING) || | 469 | if ((fsm_getstate(rch->fsm) > CH_XID0_PENDING) || |
461 | (fsm_getstate(wch->fsm) > CH_XID0_PENDING)) { | 470 | (fsm_getstate(wch->fsm) > CH_XID0_PENDING)) { |
462 | printk(KERN_WARNING "mpc: %s() ABORT ACTIVE XID" | 471 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
463 | " Request- PASSIVE XID in process\n" | 472 | "%s(%s): ABORT - PASSIVE XID", |
464 | , __FUNCTION__); | 473 | CTCM_FUNTAIL, dev->name); |
465 | break; | 474 | break; |
466 | } | 475 | } |
467 | grp->send_qllc_disc = 1; | 476 | grp->send_qllc_disc = 1; |
@@ -476,9 +485,9 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
476 | (fsm_getstate(rch->fsm) == CH_XID0_PENDING)) | 485 | (fsm_getstate(rch->fsm) == CH_XID0_PENDING)) |
477 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, rch); | 486 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, rch); |
478 | else { | 487 | else { |
479 | printk(KERN_WARNING "mpc: %s() Unable to start" | 488 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
480 | " ACTIVE XID0 on read channel\n", | 489 | "%s(%s): RX-%s not ready for ACTIVE XID0", |
481 | __FUNCTION__); | 490 | CTCM_FUNTAIL, dev->name, rch->id); |
482 | if (grp->estconnfunc) { | 491 | if (grp->estconnfunc) { |
483 | grp->estconnfunc(grp->port_num, -1, 0); | 492 | grp->estconnfunc(grp->port_num, -1, 0); |
484 | grp->estconnfunc = NULL; | 493 | grp->estconnfunc = NULL; |
@@ -490,9 +499,9 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
490 | (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) | 499 | (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) |
491 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, wch); | 500 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, wch); |
492 | else { | 501 | else { |
493 | printk(KERN_WARNING "mpc: %s() Unable to start" | 502 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
494 | " ACTIVE XID0 on write channel\n", | 503 | "%s(%s): WX-%s not ready for ACTIVE XID0", |
495 | __FUNCTION__); | 504 | CTCM_FUNTAIL, dev->name, wch->id); |
496 | if (grp->estconnfunc) { | 505 | if (grp->estconnfunc) { |
497 | grp->estconnfunc(grp->port_num, -1, 0); | 506 | grp->estconnfunc(grp->port_num, -1, 0); |
498 | grp->estconnfunc = NULL; | 507 | grp->estconnfunc = NULL; |
@@ -508,7 +517,7 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
508 | } | 517 | } |
509 | 518 | ||
510 | done: | 519 | done: |
511 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | 520 | CTCM_PR_DEBUG("Exit %s()\n", __func__); |
512 | return; | 521 | return; |
513 | } | 522 | } |
514 | EXPORT_SYMBOL(ctc_mpc_establish_connectivity); | 523 | EXPORT_SYMBOL(ctc_mpc_establish_connectivity); |
@@ -520,40 +529,22 @@ EXPORT_SYMBOL(ctc_mpc_establish_connectivity); | |||
520 | void ctc_mpc_dealloc_ch(int port_num) | 529 | void ctc_mpc_dealloc_ch(int port_num) |
521 | { | 530 | { |
522 | struct net_device *dev; | 531 | struct net_device *dev; |
523 | char device[20]; | ||
524 | struct ctcm_priv *priv; | 532 | struct ctcm_priv *priv; |
525 | struct mpc_group *grp; | 533 | struct mpc_group *grp; |
526 | 534 | ||
527 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 535 | dev = ctcmpc_get_dev(port_num); |
528 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | 536 | if (dev == NULL) |
529 | dev = __dev_get_by_name(&init_net, device); | 537 | return; |
530 | 538 | priv = dev->priv; | |
531 | if (dev == NULL) { | 539 | grp = priv->mpcg; |
532 | printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); | ||
533 | goto done; | ||
534 | } | ||
535 | 540 | ||
536 | ctcm_pr_debug("ctcmpc:%s %s() called for device %s refcount=%d\n", | 541 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_DEBUG, |
537 | dev->name, __FUNCTION__, | 542 | "%s: %s: refcount = %d\n", |
538 | dev->name, atomic_read(&dev->refcnt)); | 543 | CTCM_FUNTAIL, dev->name, atomic_read(&dev->refcnt)); |
539 | 544 | ||
540 | priv = dev->priv; | ||
541 | if (priv == NULL) { | ||
542 | printk(KERN_INFO "%s() %s priv=NULL\n", | ||
543 | __FUNCTION__, device); | ||
544 | goto done; | ||
545 | } | ||
546 | fsm_deltimer(&priv->restart_timer); | 545 | fsm_deltimer(&priv->restart_timer); |
547 | |||
548 | grp = priv->mpcg; | ||
549 | if (grp == NULL) { | ||
550 | printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); | ||
551 | goto done; | ||
552 | } | ||
553 | grp->channels_terminating = 0; | 546 | grp->channels_terminating = 0; |
554 | |||
555 | fsm_deltimer(&grp->timer); | 547 | fsm_deltimer(&grp->timer); |
556 | |||
557 | grp->allochanfunc = NULL; | 548 | grp->allochanfunc = NULL; |
558 | grp->estconnfunc = NULL; | 549 | grp->estconnfunc = NULL; |
559 | grp->port_persist = 0; | 550 | grp->port_persist = 0; |
@@ -561,8 +552,6 @@ void ctc_mpc_dealloc_ch(int port_num) | |||
561 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 552 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
562 | 553 | ||
563 | ctcm_close(dev); | 554 | ctcm_close(dev); |
564 | done: | ||
565 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
566 | return; | 555 | return; |
567 | } | 556 | } |
568 | EXPORT_SYMBOL(ctc_mpc_dealloc_ch); | 557 | EXPORT_SYMBOL(ctc_mpc_dealloc_ch); |
@@ -573,32 +562,22 @@ EXPORT_SYMBOL(ctc_mpc_dealloc_ch); | |||
573 | */ | 562 | */ |
574 | void ctc_mpc_flow_control(int port_num, int flowc) | 563 | void ctc_mpc_flow_control(int port_num, int flowc) |
575 | { | 564 | { |
576 | char device[20]; | ||
577 | struct ctcm_priv *priv; | 565 | struct ctcm_priv *priv; |
578 | struct mpc_group *grp; | 566 | struct mpc_group *grp; |
579 | struct net_device *dev; | 567 | struct net_device *dev; |
580 | struct channel *rch; | 568 | struct channel *rch; |
581 | int mpcg_state; | 569 | int mpcg_state; |
582 | 570 | ||
583 | ctcm_pr_debug("ctcmpc enter: %s() %i\n", __FUNCTION__, flowc); | 571 | dev = ctcmpc_get_dev(port_num); |
584 | 572 | if (dev == NULL) | |
585 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
586 | dev = __dev_get_by_name(&init_net, device); | ||
587 | |||
588 | if (dev == NULL) { | ||
589 | printk(KERN_INFO "ctc_mpc_flow_control %s dev=NULL\n", device); | ||
590 | return; | 573 | return; |
591 | } | 574 | priv = dev->priv; |
575 | grp = priv->mpcg; | ||
592 | 576 | ||
593 | ctcm_pr_debug("ctcmpc: %s %s called \n", dev->name, __FUNCTION__); | 577 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
578 | "%s: %s: flowc = %d", | ||
579 | CTCM_FUNTAIL, dev->name, flowc); | ||
594 | 580 | ||
595 | priv = dev->priv; | ||
596 | if (priv == NULL) { | ||
597 | printk(KERN_INFO "ctcmpc:%s() %s priv=NULL\n", | ||
598 | __FUNCTION__, device); | ||
599 | return; | ||
600 | } | ||
601 | grp = priv->mpcg; | ||
602 | rch = priv->channel[READ]; | 581 | rch = priv->channel[READ]; |
603 | 582 | ||
604 | mpcg_state = fsm_getstate(grp->fsm); | 583 | mpcg_state = fsm_getstate(grp->fsm); |
@@ -629,7 +608,6 @@ void ctc_mpc_flow_control(int port_num, int flowc) | |||
629 | break; | 608 | break; |
630 | } | 609 | } |
631 | 610 | ||
632 | ctcm_pr_debug("ctcmpc exit: %s() %i\n", __FUNCTION__, flowc); | ||
633 | } | 611 | } |
634 | EXPORT_SYMBOL(ctc_mpc_flow_control); | 612 | EXPORT_SYMBOL(ctc_mpc_flow_control); |
635 | 613 | ||
@@ -646,12 +624,8 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) | |||
646 | struct mpc_group *grp = priv->mpcg; | 624 | struct mpc_group *grp = priv->mpcg; |
647 | struct channel *ch = priv->channel[WRITE]; | 625 | struct channel *ch = priv->channel[WRITE]; |
648 | 626 | ||
649 | if (do_debug) | 627 | CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
650 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | 628 | CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); |
651 | __FUNCTION__, ch, ch->id); | ||
652 | |||
653 | if (do_debug_data) | ||
654 | ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); | ||
655 | 629 | ||
656 | grp->sweep_rsp_pend_num--; | 630 | grp->sweep_rsp_pend_num--; |
657 | 631 | ||
@@ -684,14 +658,13 @@ static void ctcmpc_send_sweep_resp(struct channel *rch) | |||
684 | struct sk_buff *sweep_skb; | 658 | struct sk_buff *sweep_skb; |
685 | struct channel *ch = priv->channel[WRITE]; | 659 | struct channel *ch = priv->channel[WRITE]; |
686 | 660 | ||
687 | if (do_debug) | 661 | CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, rch, rch->id); |
688 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
689 | __FUNCTION__, rch, rch->id); | ||
690 | 662 | ||
691 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, | 663 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); |
692 | GFP_ATOMIC|GFP_DMA); | ||
693 | if (sweep_skb == NULL) { | 664 | if (sweep_skb == NULL) { |
694 | printk(KERN_INFO "Couldn't alloc sweep_skb\n"); | 665 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
666 | "%s(%s): sweep_skb allocation ERROR\n", | ||
667 | CTCM_FUNTAIL, rch->id); | ||
695 | rc = -ENOMEM; | 668 | rc = -ENOMEM; |
696 | goto done; | 669 | goto done; |
697 | } | 670 | } |
@@ -746,7 +719,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) | |||
746 | 719 | ||
747 | if (do_debug) | 720 | if (do_debug) |
748 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | 721 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
749 | " %s(): ch=0x%p id=%s\n", __FUNCTION__, ch, ch->id); | 722 | " %s(): ch=0x%p id=%s\n", __func__, ch, ch->id); |
750 | 723 | ||
751 | if (grp->in_sweep == 0) { | 724 | if (grp->in_sweep == 0) { |
752 | grp->in_sweep = 1; | 725 | grp->in_sweep = 1; |
@@ -755,8 +728,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) | |||
755 | grp->sweep_rsp_pend_num = grp->active_channels[READ]; | 728 | grp->sweep_rsp_pend_num = grp->active_channels[READ]; |
756 | } | 729 | } |
757 | 730 | ||
758 | if (do_debug_data) | 731 | CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); |
759 | ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); | ||
760 | 732 | ||
761 | grp->sweep_req_pend_num--; | 733 | grp->sweep_req_pend_num--; |
762 | ctcmpc_send_sweep_resp(ch); | 734 | ctcmpc_send_sweep_resp(ch); |
@@ -875,25 +847,13 @@ static int mpcg_fsm_len = ARRAY_SIZE(mpcg_fsm); | |||
875 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | 847 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) |
876 | { | 848 | { |
877 | struct net_device *dev = arg; | 849 | struct net_device *dev = arg; |
878 | struct ctcm_priv *priv = NULL; | 850 | struct ctcm_priv *priv = dev->priv; |
879 | struct mpc_group *grp = NULL; | 851 | struct mpc_group *grp = priv->mpcg; |
880 | |||
881 | if (dev == NULL) { | ||
882 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
883 | return; | ||
884 | } | ||
885 | |||
886 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
887 | |||
888 | priv = dev->priv; | ||
889 | if (priv == NULL) { | ||
890 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
891 | return; | ||
892 | } | ||
893 | 852 | ||
894 | grp = priv->mpcg; | ||
895 | if (grp == NULL) { | 853 | if (grp == NULL) { |
896 | printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); | 854 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
855 | "%s(%s): No MPC group", | ||
856 | CTCM_FUNTAIL, dev->name); | ||
897 | return; | 857 | return; |
898 | } | 858 | } |
899 | 859 | ||
@@ -907,7 +867,12 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | |||
907 | grp->estconnfunc = NULL; | 867 | grp->estconnfunc = NULL; |
908 | } else if (grp->allochanfunc) | 868 | } else if (grp->allochanfunc) |
909 | grp->send_qllc_disc = 1; | 869 | grp->send_qllc_disc = 1; |
910 | goto done; | 870 | |
871 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
872 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
873 | "%s(%s): fails", | ||
874 | CTCM_FUNTAIL, dev->name); | ||
875 | return; | ||
911 | } | 876 | } |
912 | 877 | ||
913 | grp->port_persist = 1; | 878 | grp->port_persist = 1; |
@@ -916,14 +881,7 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | |||
916 | 881 | ||
917 | tasklet_hi_schedule(&grp->mpc_tasklet2); | 882 | tasklet_hi_schedule(&grp->mpc_tasklet2); |
918 | 883 | ||
919 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
920 | return; | 884 | return; |
921 | |||
922 | done: | ||
923 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
924 | |||
925 | |||
926 | ctcm_pr_info("ctcmpc: %s()failure occurred\n", __FUNCTION__); | ||
927 | } | 885 | } |
928 | 886 | ||
929 | /* | 887 | /* |
@@ -933,42 +891,28 @@ done: | |||
933 | void mpc_group_ready(unsigned long adev) | 891 | void mpc_group_ready(unsigned long adev) |
934 | { | 892 | { |
935 | struct net_device *dev = (struct net_device *)adev; | 893 | struct net_device *dev = (struct net_device *)adev; |
936 | struct ctcm_priv *priv = NULL; | 894 | struct ctcm_priv *priv = dev->priv; |
937 | struct mpc_group *grp = NULL; | 895 | struct mpc_group *grp = priv->mpcg; |
938 | struct channel *ch = NULL; | 896 | struct channel *ch = NULL; |
939 | 897 | ||
940 | |||
941 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | ||
942 | |||
943 | if (dev == NULL) { | ||
944 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
945 | return; | ||
946 | } | ||
947 | |||
948 | priv = dev->priv; | ||
949 | if (priv == NULL) { | ||
950 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
951 | return; | ||
952 | } | ||
953 | |||
954 | grp = priv->mpcg; | ||
955 | if (grp == NULL) { | 898 | if (grp == NULL) { |
956 | printk(KERN_INFO "ctcmpc:%s() grp=NULL\n", __FUNCTION__); | 899 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
900 | "%s(%s): No MPC group", | ||
901 | CTCM_FUNTAIL, dev->name); | ||
957 | return; | 902 | return; |
958 | } | 903 | } |
959 | 904 | ||
960 | printk(KERN_NOTICE "ctcmpc: %s GROUP TRANSITIONED TO READY" | 905 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, |
961 | " maxbuf:%d\n", | 906 | "%s: %s: GROUP TRANSITIONED TO READY, maxbuf = %d\n", |
962 | dev->name, grp->group_max_buflen); | 907 | CTCM_FUNTAIL, dev->name, grp->group_max_buflen); |
963 | 908 | ||
964 | fsm_newstate(grp->fsm, MPCG_STATE_READY); | 909 | fsm_newstate(grp->fsm, MPCG_STATE_READY); |
965 | 910 | ||
966 | /* Put up a read on the channel */ | 911 | /* Put up a read on the channel */ |
967 | ch = priv->channel[READ]; | 912 | ch = priv->channel[READ]; |
968 | ch->pdu_seq = 0; | 913 | ch->pdu_seq = 0; |
969 | if (do_debug_data) | 914 | CTCM_PR_DBGDATA("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , |
970 | ctcm_pr_debug("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , | 915 | __func__, ch->pdu_seq); |
971 | __FUNCTION__, ch->pdu_seq); | ||
972 | 916 | ||
973 | ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); | 917 | ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); |
974 | /* Put the write channel in idle state */ | 918 | /* Put the write channel in idle state */ |
@@ -980,22 +924,18 @@ void mpc_group_ready(unsigned long adev) | |||
980 | spin_unlock(&ch->collect_lock); | 924 | spin_unlock(&ch->collect_lock); |
981 | } | 925 | } |
982 | ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); | 926 | ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); |
983 | |||
984 | ctcm_clear_busy(dev); | 927 | ctcm_clear_busy(dev); |
985 | 928 | ||
986 | if (grp->estconnfunc) { | 929 | if (grp->estconnfunc) { |
987 | grp->estconnfunc(grp->port_num, 0, | 930 | grp->estconnfunc(grp->port_num, 0, |
988 | grp->group_max_buflen); | 931 | grp->group_max_buflen); |
989 | grp->estconnfunc = NULL; | 932 | grp->estconnfunc = NULL; |
990 | } else | 933 | } else if (grp->allochanfunc) |
991 | if (grp->allochanfunc) | 934 | grp->allochanfunc(grp->port_num, grp->group_max_buflen); |
992 | grp->allochanfunc(grp->port_num, | ||
993 | grp->group_max_buflen); | ||
994 | 935 | ||
995 | grp->send_qllc_disc = 1; | 936 | grp->send_qllc_disc = 1; |
996 | grp->changed_side = 0; | 937 | grp->changed_side = 0; |
997 | 938 | ||
998 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
999 | return; | 939 | return; |
1000 | 940 | ||
1001 | } | 941 | } |
@@ -1004,51 +944,26 @@ void mpc_group_ready(unsigned long adev) | |||
1004 | * Increment the MPC Group Active Channel Counts | 944 | * Increment the MPC Group Active Channel Counts |
1005 | * helper of dev_action (called from channel fsm) | 945 | * helper of dev_action (called from channel fsm) |
1006 | */ | 946 | */ |
1007 | int mpc_channel_action(struct channel *ch, int direction, int action) | 947 | void mpc_channel_action(struct channel *ch, int direction, int action) |
1008 | { | 948 | { |
1009 | struct net_device *dev = ch->netdev; | 949 | struct net_device *dev = ch->netdev; |
1010 | struct ctcm_priv *priv; | 950 | struct ctcm_priv *priv = dev->priv; |
1011 | struct mpc_group *grp = NULL; | 951 | struct mpc_group *grp = priv->mpcg; |
1012 | int rc = 0; | ||
1013 | |||
1014 | if (do_debug) | ||
1015 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | ||
1016 | __FUNCTION__, ch, ch->id); | ||
1017 | |||
1018 | if (dev == NULL) { | ||
1019 | printk(KERN_INFO "ctcmpc_channel_action %i dev=NULL\n", | ||
1020 | action); | ||
1021 | rc = 1; | ||
1022 | goto done; | ||
1023 | } | ||
1024 | |||
1025 | priv = dev->priv; | ||
1026 | if (priv == NULL) { | ||
1027 | printk(KERN_INFO | ||
1028 | "ctcmpc_channel_action%i priv=NULL, dev=%s\n", | ||
1029 | action, dev->name); | ||
1030 | rc = 2; | ||
1031 | goto done; | ||
1032 | } | ||
1033 | |||
1034 | grp = priv->mpcg; | ||
1035 | 952 | ||
1036 | if (grp == NULL) { | 953 | if (grp == NULL) { |
1037 | printk(KERN_INFO "ctcmpc: %s()%i mpcgroup=NULL, dev=%s\n", | 954 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1038 | __FUNCTION__, action, dev->name); | 955 | "%s(%s): No MPC group", |
1039 | rc = 3; | 956 | CTCM_FUNTAIL, dev->name); |
1040 | goto done; | 957 | return; |
1041 | } | 958 | } |
1042 | 959 | ||
1043 | ctcm_pr_info( | 960 | CTCM_PR_DEBUG("enter %s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
1044 | "ctcmpc: %s() %i(): Grp:%s total_channel_paths=%i " | 961 | |
1045 | "active_channels read=%i, write=%i\n", | 962 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1046 | __FUNCTION__, | 963 | "%s: %i / Grp:%s total_channels=%i, active_channels: " |
1047 | action, | 964 | "read=%i, write=%i\n", __func__, action, |
1048 | fsm_getstate_str(grp->fsm), | 965 | fsm_getstate_str(grp->fsm), grp->num_channel_paths, |
1049 | grp->num_channel_paths, | 966 | grp->active_channels[READ], grp->active_channels[WRITE]); |
1050 | grp->active_channels[READ], | ||
1051 | grp->active_channels[WRITE]); | ||
1052 | 967 | ||
1053 | if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { | 968 | if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { |
1054 | grp->num_channel_paths++; | 969 | grp->num_channel_paths++; |
@@ -1062,10 +977,11 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1062 | ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, | 977 | ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, |
1063 | GFP_ATOMIC | GFP_DMA); | 978 | GFP_ATOMIC | GFP_DMA); |
1064 | if (ch->xid_skb == NULL) { | 979 | if (ch->xid_skb == NULL) { |
1065 | printk(KERN_INFO "ctcmpc: %s()" | 980 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1066 | "Couldn't alloc ch xid_skb\n", __FUNCTION__); | 981 | "%s(%s): Couldn't alloc ch xid_skb\n", |
982 | CTCM_FUNTAIL, dev->name); | ||
1067 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 983 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1068 | return 1; | 984 | return; |
1069 | } | 985 | } |
1070 | ch->xid_skb_data = ch->xid_skb->data; | 986 | ch->xid_skb_data = ch->xid_skb->data; |
1071 | ch->xid_th = (struct th_header *)ch->xid_skb->data; | 987 | ch->xid_th = (struct th_header *)ch->xid_skb->data; |
@@ -1097,8 +1013,9 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1097 | (grp->active_channels[WRITE] > 0) && | 1013 | (grp->active_channels[WRITE] > 0) && |
1098 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { | 1014 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { |
1099 | fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW); | 1015 | fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW); |
1100 | printk(KERN_NOTICE "ctcmpc: %s MPC GROUP " | 1016 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, |
1101 | "CHANNELS ACTIVE\n", dev->name); | 1017 | "%s: %s: MPC GROUP CHANNELS ACTIVE\n", |
1018 | __func__, dev->name); | ||
1102 | } | 1019 | } |
1103 | } else if ((action == MPC_CHANNEL_REMOVE) && | 1020 | } else if ((action == MPC_CHANNEL_REMOVE) && |
1104 | (ch->in_mpcgroup == 1)) { | 1021 | (ch->in_mpcgroup == 1)) { |
@@ -1119,25 +1036,14 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1119 | (grp->active_channels[READ] > 0))) | 1036 | (grp->active_channels[READ] > 0))) |
1120 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1037 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1121 | } | 1038 | } |
1122 | |||
1123 | done: | 1039 | done: |
1040 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | ||
1041 | "exit %s: %i / Grp:%s total_channels=%i, active_channels: " | ||
1042 | "read=%i, write=%i\n", __func__, action, | ||
1043 | fsm_getstate_str(grp->fsm), grp->num_channel_paths, | ||
1044 | grp->active_channels[READ], grp->active_channels[WRITE]); | ||
1124 | 1045 | ||
1125 | if (do_debug) { | 1046 | CTCM_PR_DEBUG("exit %s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
1126 | ctcm_pr_debug( | ||
1127 | "ctcmpc: %s() %i Grp:%s ttl_chan_paths=%i " | ||
1128 | "active_chans read=%i, write=%i\n", | ||
1129 | __FUNCTION__, | ||
1130 | action, | ||
1131 | fsm_getstate_str(grp->fsm), | ||
1132 | grp->num_channel_paths, | ||
1133 | grp->active_channels[READ], | ||
1134 | grp->active_channels[WRITE]); | ||
1135 | |||
1136 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
1137 | __FUNCTION__, ch, ch->id); | ||
1138 | } | ||
1139 | return rc; | ||
1140 | |||
1141 | } | 1047 | } |
1142 | 1048 | ||
1143 | /** | 1049 | /** |
@@ -1163,9 +1069,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1163 | int skblen; | 1069 | int skblen; |
1164 | int sendrc = 0; | 1070 | int sendrc = 0; |
1165 | 1071 | ||
1166 | if (do_debug) | 1072 | CTCM_PR_DEBUG("ctcmpc enter: %s() %s cp:%i ch:%s\n", |
1167 | ctcm_pr_debug("ctcmpc enter: %s() %s cp:%i ch:%s\n", | 1073 | __func__, dev->name, smp_processor_id(), ch->id); |
1168 | __FUNCTION__, dev->name, smp_processor_id(), ch->id); | ||
1169 | 1074 | ||
1170 | header = (struct th_header *)pskb->data; | 1075 | header = (struct th_header *)pskb->data; |
1171 | if ((header->th_seg == 0) && | 1076 | if ((header->th_seg == 0) && |
@@ -1174,21 +1079,16 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1174 | (header->th_seq_num == 0)) | 1079 | (header->th_seq_num == 0)) |
1175 | /* nothing for us */ goto done; | 1080 | /* nothing for us */ goto done; |
1176 | 1081 | ||
1177 | if (do_debug_data) { | 1082 | CTCM_PR_DBGDATA("%s: th_header\n", __func__); |
1178 | ctcm_pr_debug("ctcmpc: %s() th_header\n", __FUNCTION__); | 1083 | CTCM_D3_DUMP((char *)header, TH_HEADER_LENGTH); |
1179 | ctcmpc_dumpit((char *)header, TH_HEADER_LENGTH); | 1084 | CTCM_PR_DBGDATA("%s: pskb len: %04x \n", __func__, pskb->len); |
1180 | ctcm_pr_debug("ctcmpc: %s() pskb len: %04x \n", | ||
1181 | __FUNCTION__, pskb->len); | ||
1182 | } | ||
1183 | 1085 | ||
1184 | pskb->dev = dev; | 1086 | pskb->dev = dev; |
1185 | pskb->ip_summed = CHECKSUM_UNNECESSARY; | 1087 | pskb->ip_summed = CHECKSUM_UNNECESSARY; |
1186 | skb_pull(pskb, TH_HEADER_LENGTH); | 1088 | skb_pull(pskb, TH_HEADER_LENGTH); |
1187 | 1089 | ||
1188 | if (likely(header->th_ch_flag == TH_HAS_PDU)) { | 1090 | if (likely(header->th_ch_flag == TH_HAS_PDU)) { |
1189 | if (do_debug_data) | 1091 | CTCM_PR_DBGDATA("%s: came into th_has_pdu\n", __func__); |
1190 | ctcm_pr_debug("ctcmpc: %s() came into th_has_pdu\n", | ||
1191 | __FUNCTION__); | ||
1192 | if ((fsm_getstate(grp->fsm) == MPCG_STATE_FLOWC) || | 1092 | if ((fsm_getstate(grp->fsm) == MPCG_STATE_FLOWC) || |
1193 | ((fsm_getstate(grp->fsm) == MPCG_STATE_READY) && | 1093 | ((fsm_getstate(grp->fsm) == MPCG_STATE_READY) && |
1194 | (header->th_seq_num != ch->th_seq_num + 1) && | 1094 | (header->th_seq_num != ch->th_seq_num + 1) && |
@@ -1202,33 +1102,29 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1202 | grp->out_of_sequence += 1; | 1102 | grp->out_of_sequence += 1; |
1203 | __skb_push(pskb, TH_HEADER_LENGTH); | 1103 | __skb_push(pskb, TH_HEADER_LENGTH); |
1204 | skb_queue_tail(&ch->io_queue, pskb); | 1104 | skb_queue_tail(&ch->io_queue, pskb); |
1205 | if (do_debug_data) | 1105 | CTCM_PR_DBGDATA("%s: th_seq_num expect:%08x " |
1206 | ctcm_pr_debug("ctcmpc: %s() th_seq_num " | 1106 | "got:%08x\n", __func__, |
1207 | "expect:%08x got:%08x\n", __FUNCTION__, | 1107 | ch->th_seq_num + 1, header->th_seq_num); |
1208 | ch->th_seq_num + 1, header->th_seq_num); | ||
1209 | 1108 | ||
1210 | return; | 1109 | return; |
1211 | } | 1110 | } |
1212 | grp->out_of_sequence = 0; | 1111 | grp->out_of_sequence = 0; |
1213 | ch->th_seq_num = header->th_seq_num; | 1112 | ch->th_seq_num = header->th_seq_num; |
1214 | 1113 | ||
1215 | if (do_debug_data) | 1114 | CTCM_PR_DBGDATA("ctcmpc: %s() FromVTAM_th_seq=%08x\n", |
1216 | ctcm_pr_debug("ctcmpc: %s() FromVTAM_th_seq=%08x\n", | 1115 | __func__, ch->th_seq_num); |
1217 | __FUNCTION__, ch->th_seq_num); | ||
1218 | 1116 | ||
1219 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) | 1117 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) |
1220 | goto done; | 1118 | goto done; |
1221 | pdu_last_seen = 0; | 1119 | pdu_last_seen = 0; |
1222 | while ((pskb->len > 0) && !pdu_last_seen) { | 1120 | while ((pskb->len > 0) && !pdu_last_seen) { |
1223 | curr_pdu = (struct pdu *)pskb->data; | 1121 | curr_pdu = (struct pdu *)pskb->data; |
1224 | if (do_debug_data) { | 1122 | |
1225 | ctcm_pr_debug("ctcm: %s() pdu_header\n", | 1123 | CTCM_PR_DBGDATA("%s: pdu_header\n", __func__); |
1226 | __FUNCTION__); | 1124 | CTCM_D3_DUMP((char *)pskb->data, PDU_HEADER_LENGTH); |
1227 | ctcmpc_dumpit((char *)pskb->data, | 1125 | CTCM_PR_DBGDATA("%s: pskb len: %04x \n", |
1228 | PDU_HEADER_LENGTH); | 1126 | __func__, pskb->len); |
1229 | ctcm_pr_debug("ctcm: %s() pskb len: %04x \n", | 1127 | |
1230 | __FUNCTION__, pskb->len); | ||
1231 | } | ||
1232 | skb_pull(pskb, PDU_HEADER_LENGTH); | 1128 | skb_pull(pskb, PDU_HEADER_LENGTH); |
1233 | 1129 | ||
1234 | if (curr_pdu->pdu_flag & PDU_LAST) | 1130 | if (curr_pdu->pdu_flag & PDU_LAST) |
@@ -1239,46 +1135,39 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1239 | pskb->protocol = htons(ETH_P_SNA_DIX); | 1135 | pskb->protocol = htons(ETH_P_SNA_DIX); |
1240 | 1136 | ||
1241 | if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { | 1137 | if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { |
1242 | printk(KERN_INFO | 1138 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1243 | "%s Illegal packet size %d " | 1139 | "%s(%s): Dropping packet with " |
1244 | "received " | 1140 | "illegal siize %d", |
1245 | "dropping\n", dev->name, | 1141 | CTCM_FUNTAIL, dev->name, pskb->len); |
1246 | pskb->len); | 1142 | |
1247 | priv->stats.rx_dropped++; | 1143 | priv->stats.rx_dropped++; |
1248 | priv->stats.rx_length_errors++; | 1144 | priv->stats.rx_length_errors++; |
1249 | goto done; | 1145 | goto done; |
1250 | } | 1146 | } |
1251 | skb_reset_mac_header(pskb); | 1147 | skb_reset_mac_header(pskb); |
1252 | new_len = curr_pdu->pdu_offset; | 1148 | new_len = curr_pdu->pdu_offset; |
1253 | if (do_debug_data) | 1149 | CTCM_PR_DBGDATA("%s: new_len: %04x \n", |
1254 | ctcm_pr_debug("ctcmpc: %s() new_len: %04x \n", | 1150 | __func__, new_len); |
1255 | __FUNCTION__, new_len); | ||
1256 | if ((new_len == 0) || (new_len > pskb->len)) { | 1151 | if ((new_len == 0) || (new_len > pskb->len)) { |
1257 | /* should never happen */ | 1152 | /* should never happen */ |
1258 | /* pskb len must be hosed...bail out */ | 1153 | /* pskb len must be hosed...bail out */ |
1259 | printk(KERN_INFO | 1154 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1260 | "ctcmpc: %s(): invalid pdu" | 1155 | "%s(%s): non valid pdu_offset: %04x", |
1261 | " offset of %04x - data may be" | 1156 | /* "data may be lost", */ |
1262 | "lost\n", __FUNCTION__, new_len); | 1157 | CTCM_FUNTAIL, dev->name, new_len); |
1263 | goto done; | 1158 | goto done; |
1264 | } | 1159 | } |
1265 | skb = __dev_alloc_skb(new_len+4, GFP_ATOMIC); | 1160 | skb = __dev_alloc_skb(new_len+4, GFP_ATOMIC); |
1266 | 1161 | ||
1267 | if (!skb) { | 1162 | if (!skb) { |
1268 | printk(KERN_INFO | 1163 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1269 | "ctcm: %s Out of memory in " | 1164 | "%s(%s): MEMORY allocation error", |
1270 | "%s()- request-len:%04x \n", | 1165 | CTCM_FUNTAIL, dev->name); |
1271 | dev->name, | ||
1272 | __FUNCTION__, | ||
1273 | new_len+4); | ||
1274 | priv->stats.rx_dropped++; | 1166 | priv->stats.rx_dropped++; |
1275 | fsm_event(grp->fsm, | 1167 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1276 | MPCG_EVENT_INOP, dev); | ||
1277 | goto done; | 1168 | goto done; |
1278 | } | 1169 | } |
1279 | 1170 | memcpy(skb_put(skb, new_len), pskb->data, new_len); | |
1280 | memcpy(skb_put(skb, new_len), | ||
1281 | pskb->data, new_len); | ||
1282 | 1171 | ||
1283 | skb_reset_mac_header(skb); | 1172 | skb_reset_mac_header(skb); |
1284 | skb->dev = pskb->dev; | 1173 | skb->dev = pskb->dev; |
@@ -1287,17 +1176,14 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1287 | *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; | 1176 | *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; |
1288 | ch->pdu_seq++; | 1177 | ch->pdu_seq++; |
1289 | 1178 | ||
1290 | if (do_debug_data) | ||
1291 | ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", | ||
1292 | __FUNCTION__, ch->pdu_seq); | ||
1293 | |||
1294 | ctcm_pr_debug("ctcm: %s() skb:%0lx " | ||
1295 | "skb len: %d \n", __FUNCTION__, | ||
1296 | (unsigned long)skb, skb->len); | ||
1297 | if (do_debug_data) { | 1179 | if (do_debug_data) { |
1298 | ctcm_pr_debug("ctcmpc: %s() up to 32 bytes" | 1180 | ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", |
1299 | " of pdu_data sent\n", | 1181 | __func__, ch->pdu_seq); |
1300 | __FUNCTION__); | 1182 | ctcm_pr_debug("%s: skb:%0lx " |
1183 | "skb len: %d \n", __func__, | ||
1184 | (unsigned long)skb, skb->len); | ||
1185 | ctcm_pr_debug("%s: up to 32 bytes " | ||
1186 | "of pdu_data sent\n", __func__); | ||
1301 | ctcmpc_dump32((char *)skb->data, skb->len); | 1187 | ctcmpc_dump32((char *)skb->data, skb->len); |
1302 | } | 1188 | } |
1303 | 1189 | ||
@@ -1316,8 +1202,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1316 | mpcginfo->ch = ch; | 1202 | mpcginfo->ch = ch; |
1317 | mpcginfo->th = header; | 1203 | mpcginfo->th = header; |
1318 | mpcginfo->skb = pskb; | 1204 | mpcginfo->skb = pskb; |
1319 | ctcm_pr_debug("ctcmpc: %s() Not PDU - may be control pkt\n", | 1205 | CTCM_PR_DEBUG("%s: Not PDU - may be control pkt\n", |
1320 | __FUNCTION__); | 1206 | __func__); |
1321 | /* it's a sweep? */ | 1207 | /* it's a sweep? */ |
1322 | sweep = (struct th_sweep *)pskb->data; | 1208 | sweep = (struct th_sweep *)pskb->data; |
1323 | mpcginfo->sweep = sweep; | 1209 | mpcginfo->sweep = sweep; |
@@ -1333,8 +1219,9 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1333 | } else if (header->th_blk_flag == TH_DISCONTACT) | 1219 | } else if (header->th_blk_flag == TH_DISCONTACT) |
1334 | fsm_event(grp->fsm, MPCG_EVENT_DISCONC, mpcginfo); | 1220 | fsm_event(grp->fsm, MPCG_EVENT_DISCONC, mpcginfo); |
1335 | else if (header->th_seq_num != 0) { | 1221 | else if (header->th_seq_num != 0) { |
1336 | printk(KERN_INFO "%s unexpected packet" | 1222 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1337 | " expected control pkt\n", dev->name); | 1223 | "%s(%s): control pkt expected\n", |
1224 | CTCM_FUNTAIL, dev->name); | ||
1338 | priv->stats.rx_dropped++; | 1225 | priv->stats.rx_dropped++; |
1339 | /* mpcginfo only used for non-data transfers */ | 1226 | /* mpcginfo only used for non-data transfers */ |
1340 | kfree(mpcginfo); | 1227 | kfree(mpcginfo); |
@@ -1347,13 +1234,12 @@ done: | |||
1347 | dev_kfree_skb_any(pskb); | 1234 | dev_kfree_skb_any(pskb); |
1348 | if (sendrc == NET_RX_DROP) { | 1235 | if (sendrc == NET_RX_DROP) { |
1349 | printk(KERN_WARNING "%s %s() NETWORK BACKLOG EXCEEDED" | 1236 | printk(KERN_WARNING "%s %s() NETWORK BACKLOG EXCEEDED" |
1350 | " - PACKET DROPPED\n", dev->name, __FUNCTION__); | 1237 | " - PACKET DROPPED\n", dev->name, __func__); |
1351 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1238 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1352 | } | 1239 | } |
1353 | 1240 | ||
1354 | if (do_debug) | 1241 | CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", |
1355 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1242 | __func__, dev->name, ch, ch->id); |
1356 | dev->name, __FUNCTION__, ch, ch->id); | ||
1357 | } | 1243 | } |
1358 | 1244 | ||
1359 | /** | 1245 | /** |
@@ -1366,15 +1252,14 @@ done: | |||
1366 | */ | 1252 | */ |
1367 | void ctcmpc_bh(unsigned long thischan) | 1253 | void ctcmpc_bh(unsigned long thischan) |
1368 | { | 1254 | { |
1369 | struct channel *ch = (struct channel *)thischan; | 1255 | struct channel *ch = (struct channel *)thischan; |
1370 | struct sk_buff *skb; | 1256 | struct sk_buff *skb; |
1371 | struct net_device *dev = ch->netdev; | 1257 | struct net_device *dev = ch->netdev; |
1372 | struct ctcm_priv *priv = dev->priv; | 1258 | struct ctcm_priv *priv = dev->priv; |
1373 | struct mpc_group *grp = priv->mpcg; | 1259 | struct mpc_group *grp = priv->mpcg; |
1374 | 1260 | ||
1375 | if (do_debug) | 1261 | CTCM_PR_DEBUG("%s cp:%i enter: %s() %s\n", |
1376 | ctcm_pr_debug("%s cp:%i enter: %s() %s\n", | 1262 | dev->name, smp_processor_id(), __func__, ch->id); |
1377 | dev->name, smp_processor_id(), __FUNCTION__, ch->id); | ||
1378 | /* caller has requested driver to throttle back */ | 1263 | /* caller has requested driver to throttle back */ |
1379 | while ((fsm_getstate(grp->fsm) != MPCG_STATE_FLOWC) && | 1264 | while ((fsm_getstate(grp->fsm) != MPCG_STATE_FLOWC) && |
1380 | (skb = skb_dequeue(&ch->io_queue))) { | 1265 | (skb = skb_dequeue(&ch->io_queue))) { |
@@ -1390,9 +1275,8 @@ void ctcmpc_bh(unsigned long thischan) | |||
1390 | if (skb == skb_peek(&ch->io_queue)) | 1275 | if (skb == skb_peek(&ch->io_queue)) |
1391 | break; | 1276 | break; |
1392 | } | 1277 | } |
1393 | if (do_debug) | 1278 | CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", |
1394 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1279 | __func__, dev->name, ch, ch->id); |
1395 | dev->name, __FUNCTION__, ch, ch->id); | ||
1396 | return; | 1280 | return; |
1397 | } | 1281 | } |
1398 | 1282 | ||
@@ -1403,16 +1287,16 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1403 | { | 1287 | { |
1404 | struct mpc_group *grp; | 1288 | struct mpc_group *grp; |
1405 | 1289 | ||
1406 | CTCM_DBF_TEXT(MPC_SETUP, 3, __FUNCTION__); | 1290 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
1291 | "Enter %s(%p)", CTCM_FUNTAIL, priv); | ||
1407 | 1292 | ||
1408 | grp = kzalloc(sizeof(struct mpc_group), GFP_KERNEL); | 1293 | grp = kzalloc(sizeof(struct mpc_group), GFP_KERNEL); |
1409 | if (grp == NULL) | 1294 | if (grp == NULL) |
1410 | return NULL; | 1295 | return NULL; |
1411 | 1296 | ||
1412 | grp->fsm = | 1297 | grp->fsm = init_fsm("mpcg", mpcg_state_names, mpcg_event_names, |
1413 | init_fsm("mpcg", mpcg_state_names, mpcg_event_names, | 1298 | MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, |
1414 | MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, | 1299 | mpcg_fsm_len, GFP_KERNEL); |
1415 | mpcg_fsm_len, GFP_KERNEL); | ||
1416 | if (grp->fsm == NULL) { | 1300 | if (grp->fsm == NULL) { |
1417 | kfree(grp); | 1301 | kfree(grp); |
1418 | return NULL; | 1302 | return NULL; |
@@ -1424,7 +1308,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1424 | grp->xid_skb = | 1308 | grp->xid_skb = |
1425 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); | 1309 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); |
1426 | if (grp->xid_skb == NULL) { | 1310 | if (grp->xid_skb == NULL) { |
1427 | printk(KERN_INFO "Couldn't alloc MPCgroup xid_skb\n"); | ||
1428 | kfree_fsm(grp->fsm); | 1311 | kfree_fsm(grp->fsm); |
1429 | kfree(grp); | 1312 | kfree(grp); |
1430 | return NULL; | 1313 | return NULL; |
@@ -1435,7 +1318,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1435 | memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), | 1318 | memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), |
1436 | &thnorm, TH_HEADER_LENGTH); | 1319 | &thnorm, TH_HEADER_LENGTH); |
1437 | 1320 | ||
1438 | grp->xid = (struct xid2 *) skb_tail_pointer(grp->xid_skb); | 1321 | grp->xid = (struct xid2 *)skb_tail_pointer(grp->xid_skb); |
1439 | memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); | 1322 | memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); |
1440 | grp->xid->xid2_adj_id = jiffies | 0xfff00000; | 1323 | grp->xid->xid2_adj_id = jiffies | 0xfff00000; |
1441 | grp->xid->xid2_sender_id = jiffies; | 1324 | grp->xid->xid2_sender_id = jiffies; |
@@ -1446,7 +1329,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1446 | grp->rcvd_xid_skb = | 1329 | grp->rcvd_xid_skb = |
1447 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); | 1330 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); |
1448 | if (grp->rcvd_xid_skb == NULL) { | 1331 | if (grp->rcvd_xid_skb == NULL) { |
1449 | printk(KERN_INFO "Couldn't alloc MPCgroup rcvd_xid_skb\n"); | ||
1450 | kfree_fsm(grp->fsm); | 1332 | kfree_fsm(grp->fsm); |
1451 | dev_kfree_skb(grp->xid_skb); | 1333 | dev_kfree_skb(grp->xid_skb); |
1452 | kfree(grp); | 1334 | kfree(grp); |
@@ -1492,32 +1374,27 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
1492 | int rc = 0; | 1374 | int rc = 0; |
1493 | struct channel *wch, *rch; | 1375 | struct channel *wch, *rch; |
1494 | 1376 | ||
1495 | if (dev == NULL) { | 1377 | BUG_ON(dev == NULL); |
1496 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | 1378 | CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); |
1497 | return; | ||
1498 | } | ||
1499 | |||
1500 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
1501 | 1379 | ||
1502 | priv = dev->priv; | 1380 | priv = dev->priv; |
1503 | grp = priv->mpcg; | 1381 | grp = priv->mpcg; |
1504 | grp->flow_off_called = 0; | 1382 | grp->flow_off_called = 0; |
1505 | |||
1506 | fsm_deltimer(&grp->timer); | 1383 | fsm_deltimer(&grp->timer); |
1507 | |||
1508 | if (grp->channels_terminating) | 1384 | if (grp->channels_terminating) |
1509 | goto done; | 1385 | return; |
1510 | 1386 | ||
1511 | grp->channels_terminating = 1; | 1387 | grp->channels_terminating = 1; |
1512 | |||
1513 | grp->saved_state = fsm_getstate(grp->fsm); | 1388 | grp->saved_state = fsm_getstate(grp->fsm); |
1514 | fsm_newstate(grp->fsm, MPCG_STATE_INOP); | 1389 | fsm_newstate(grp->fsm, MPCG_STATE_INOP); |
1515 | if (grp->saved_state > MPCG_STATE_XID7INITF) | 1390 | if (grp->saved_state > MPCG_STATE_XID7INITF) |
1516 | printk(KERN_NOTICE "%s:MPC GROUP INOPERATIVE\n", dev->name); | 1391 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1392 | "%s(%s): MPC GROUP INOPERATIVE", | ||
1393 | CTCM_FUNTAIL, dev->name); | ||
1517 | if ((grp->saved_state != MPCG_STATE_RESET) || | 1394 | if ((grp->saved_state != MPCG_STATE_RESET) || |
1518 | /* dealloc_channel has been called */ | 1395 | /* dealloc_channel has been called */ |
1519 | ((grp->saved_state == MPCG_STATE_RESET) && | 1396 | ((grp->saved_state == MPCG_STATE_RESET) && |
1520 | (grp->port_persist == 0))) | 1397 | (grp->port_persist == 0))) |
1521 | fsm_deltimer(&priv->restart_timer); | 1398 | fsm_deltimer(&priv->restart_timer); |
1522 | 1399 | ||
1523 | wch = priv->channel[WRITE]; | 1400 | wch = priv->channel[WRITE]; |
@@ -1567,29 +1444,24 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
1567 | /* This can result in INOP of VTAM PU due to halting of */ | 1444 | /* This can result in INOP of VTAM PU due to halting of */ |
1568 | /* outstanding IO which causes a sense to be returned */ | 1445 | /* outstanding IO which causes a sense to be returned */ |
1569 | /* Only about 3 senses are allowed and then IOS/VTAM will*/ | 1446 | /* Only about 3 senses are allowed and then IOS/VTAM will*/ |
1570 | /* ebcome unreachable without manual intervention */ | 1447 | /* become unreachable without manual intervention */ |
1571 | if ((grp->port_persist == 1) || (grp->alloc_called)) { | 1448 | if ((grp->port_persist == 1) || (grp->alloc_called)) { |
1572 | grp->alloc_called = 0; | 1449 | grp->alloc_called = 0; |
1573 | fsm_deltimer(&priv->restart_timer); | 1450 | fsm_deltimer(&priv->restart_timer); |
1574 | fsm_addtimer(&priv->restart_timer, | 1451 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_RESTART, dev); |
1575 | 500, | ||
1576 | DEV_EVENT_RESTART, | ||
1577 | dev); | ||
1578 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); | 1452 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); |
1579 | if (grp->saved_state > MPCG_STATE_XID7INITF) | 1453 | if (grp->saved_state > MPCG_STATE_XID7INITF) |
1580 | printk(KERN_NOTICE "%s:MPC GROUP RECOVERY SCHEDULED\n", | 1454 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, |
1581 | dev->name); | 1455 | "%s(%s): MPC GROUP RECOVERY SCHEDULED", |
1456 | CTCM_FUNTAIL, dev->name); | ||
1582 | } else { | 1457 | } else { |
1583 | fsm_deltimer(&priv->restart_timer); | 1458 | fsm_deltimer(&priv->restart_timer); |
1584 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_STOP, dev); | 1459 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_STOP, dev); |
1585 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); | 1460 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); |
1586 | printk(KERN_NOTICE "%s:MPC GROUP RECOVERY NOT ATTEMPTED\n", | 1461 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, |
1587 | dev->name); | 1462 | "%s(%s): NO MPC GROUP RECOVERY ATTEMPTED", |
1463 | CTCM_FUNTAIL, dev->name); | ||
1588 | } | 1464 | } |
1589 | |||
1590 | done: | ||
1591 | ctcm_pr_debug("ctcmpc exit:%s %s()\n", dev->name, __FUNCTION__); | ||
1592 | return; | ||
1593 | } | 1465 | } |
1594 | 1466 | ||
1595 | /** | 1467 | /** |
@@ -1609,12 +1481,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) | |||
1609 | struct channel *wch; | 1481 | struct channel *wch; |
1610 | struct channel *rch; | 1482 | struct channel *rch; |
1611 | 1483 | ||
1612 | CTCM_DBF_TEXT(MPC_TRACE, 6, __FUNCTION__); | 1484 | BUG_ON(dev == NULL); |
1613 | |||
1614 | if (dev == NULL) { | ||
1615 | CTCM_DBF_TEXT_(MPC_ERROR, 4, "%s: dev=NULL\n", __FUNCTION__); | ||
1616 | return; | ||
1617 | } | ||
1618 | 1485 | ||
1619 | priv = dev->priv; | 1486 | priv = dev->priv; |
1620 | grp = priv->mpcg; | 1487 | grp = priv->mpcg; |
@@ -1633,8 +1500,9 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) | |||
1633 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1500 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1634 | } | 1501 | } |
1635 | 1502 | ||
1636 | CTCM_DBF_TEXT_(MPC_TRACE, 6, "%s: dev=%s exit", | 1503 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
1637 | __FUNCTION__, dev->name); | 1504 | "%s: dev=%s exit", |
1505 | CTCM_FUNTAIL, dev->name); | ||
1638 | return; | 1506 | return; |
1639 | } | 1507 | } |
1640 | 1508 | ||
@@ -1646,25 +1514,25 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) | |||
1646 | { | 1514 | { |
1647 | struct mpcg_info *mpcginfo = arg; | 1515 | struct mpcg_info *mpcginfo = arg; |
1648 | struct channel *ch = mpcginfo->ch; | 1516 | struct channel *ch = mpcginfo->ch; |
1649 | struct net_device *dev = ch->netdev; | 1517 | struct net_device *dev; |
1650 | struct ctcm_priv *priv = dev->priv; | 1518 | struct ctcm_priv *priv; |
1651 | struct mpc_group *grp = priv->mpcg; | 1519 | struct mpc_group *grp; |
1652 | 1520 | ||
1653 | if (ch == NULL) { | 1521 | if (ch) { |
1654 | printk(KERN_INFO "%s() ch=NULL\n", __FUNCTION__); | 1522 | dev = ch->netdev; |
1655 | return; | 1523 | if (dev) { |
1656 | } | 1524 | priv = dev->priv; |
1657 | if (ch->netdev == NULL) { | 1525 | if (priv) { |
1658 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | 1526 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1659 | return; | 1527 | "%s: %s: %s\n", |
1528 | CTCM_FUNTAIL, dev->name, ch->id); | ||
1529 | grp = priv->mpcg; | ||
1530 | grp->send_qllc_disc = 1; | ||
1531 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
1532 | } | ||
1533 | } | ||
1660 | } | 1534 | } |
1661 | 1535 | ||
1662 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
1663 | |||
1664 | grp->send_qllc_disc = 1; | ||
1665 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
1666 | |||
1667 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1668 | return; | 1536 | return; |
1669 | } | 1537 | } |
1670 | 1538 | ||
@@ -1675,26 +1543,9 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) | |||
1675 | */ | 1543 | */ |
1676 | void mpc_action_send_discontact(unsigned long thischan) | 1544 | void mpc_action_send_discontact(unsigned long thischan) |
1677 | { | 1545 | { |
1678 | struct channel *ch; | 1546 | int rc; |
1679 | struct net_device *dev; | 1547 | struct channel *ch = (struct channel *)thischan; |
1680 | struct ctcm_priv *priv; | 1548 | unsigned long saveflags = 0; |
1681 | struct mpc_group *grp; | ||
1682 | int rc = 0; | ||
1683 | unsigned long saveflags; | ||
1684 | |||
1685 | ch = (struct channel *)thischan; | ||
1686 | dev = ch->netdev; | ||
1687 | priv = dev->priv; | ||
1688 | grp = priv->mpcg; | ||
1689 | |||
1690 | ctcm_pr_info("ctcmpc: %s cp:%i enter: %s() GrpState:%s ChState:%s\n", | ||
1691 | dev->name, | ||
1692 | smp_processor_id(), | ||
1693 | __FUNCTION__, | ||
1694 | fsm_getstate_str(grp->fsm), | ||
1695 | fsm_getstate_str(ch->fsm)); | ||
1696 | saveflags = 0; /* avoids compiler warning with | ||
1697 | spin_unlock_irqrestore */ | ||
1698 | 1549 | ||
1699 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 1550 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
1700 | rc = ccw_device_start(ch->cdev, &ch->ccw[15], | 1551 | rc = ccw_device_start(ch->cdev, &ch->ccw[15], |
@@ -1702,16 +1553,9 @@ void mpc_action_send_discontact(unsigned long thischan) | |||
1702 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); | 1553 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); |
1703 | 1554 | ||
1704 | if (rc != 0) { | 1555 | if (rc != 0) { |
1705 | ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", | 1556 | ctcm_ccw_check_rc(ch, rc, (char *)__func__); |
1706 | __FUNCTION__, | ||
1707 | ch->id); | ||
1708 | ctcm_ccw_check_rc(ch, rc, "send discontact"); | ||
1709 | /* Not checking return code value here */ | ||
1710 | /* Making best effort to notify partner*/ | ||
1711 | /* that MPC Group is going down */ | ||
1712 | } | 1557 | } |
1713 | 1558 | ||
1714 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1715 | return; | 1559 | return; |
1716 | } | 1560 | } |
1717 | 1561 | ||
@@ -1723,49 +1567,50 @@ void mpc_action_send_discontact(unsigned long thischan) | |||
1723 | */ | 1567 | */ |
1724 | static int mpc_validate_xid(struct mpcg_info *mpcginfo) | 1568 | static int mpc_validate_xid(struct mpcg_info *mpcginfo) |
1725 | { | 1569 | { |
1726 | struct channel *ch = mpcginfo->ch; | 1570 | struct channel *ch = mpcginfo->ch; |
1727 | struct net_device *dev = ch->netdev; | 1571 | struct net_device *dev = ch->netdev; |
1728 | struct ctcm_priv *priv = dev->priv; | 1572 | struct ctcm_priv *priv = dev->priv; |
1729 | struct mpc_group *grp = priv->mpcg; | 1573 | struct mpc_group *grp = priv->mpcg; |
1730 | struct xid2 *xid = mpcginfo->xid; | 1574 | struct xid2 *xid = mpcginfo->xid; |
1731 | int failed = 0; | 1575 | int rc = 0; |
1732 | int rc = 0; | 1576 | __u64 our_id = 0; |
1733 | __u64 our_id, their_id = 0; | 1577 | __u64 their_id = 0; |
1734 | int len; | 1578 | int len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; |
1735 | |||
1736 | len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; | ||
1737 | 1579 | ||
1738 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 1580 | CTCM_PR_DEBUG("Enter %s: xid=%p\n", __func__, xid); |
1739 | 1581 | ||
1740 | if (mpcginfo->xid == NULL) { | 1582 | if (xid == NULL) { |
1741 | printk(KERN_INFO "%s() xid=NULL\n", __FUNCTION__); | ||
1742 | rc = 1; | 1583 | rc = 1; |
1743 | goto done; | 1584 | /* XID REJECTED: xid == NULL */ |
1585 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
1586 | "%s(%s): xid = NULL", | ||
1587 | CTCM_FUNTAIL, ch->id); | ||
1588 | goto done; | ||
1744 | } | 1589 | } |
1745 | 1590 | ||
1746 | ctcm_pr_debug("ctcmpc : %s xid received()\n", __FUNCTION__); | 1591 | CTCM_D3_DUMP((char *)xid, XID2_LENGTH); |
1747 | ctcmpc_dumpit((char *)mpcginfo->xid, XID2_LENGTH); | ||
1748 | 1592 | ||
1749 | /*the received direction should be the opposite of ours */ | 1593 | /*the received direction should be the opposite of ours */ |
1750 | if (((CHANNEL_DIRECTION(ch->flags) == READ) ? XID2_WRITE_SIDE : | 1594 | if (((CHANNEL_DIRECTION(ch->flags) == READ) ? XID2_WRITE_SIDE : |
1751 | XID2_READ_SIDE) != xid->xid2_dlc_type) { | 1595 | XID2_READ_SIDE) != xid->xid2_dlc_type) { |
1752 | failed = 1; | 1596 | rc = 2; |
1753 | printk(KERN_INFO "ctcmpc:%s() XID REJECTED - READ-WRITE CH " | 1597 | /* XID REJECTED: r/w channel pairing mismatch */ |
1754 | "Pairing Invalid \n", __FUNCTION__); | 1598 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1599 | "%s(%s): r/w channel pairing mismatch", | ||
1600 | CTCM_FUNTAIL, ch->id); | ||
1601 | goto done; | ||
1755 | } | 1602 | } |
1756 | 1603 | ||
1757 | if (xid->xid2_dlc_type == XID2_READ_SIDE) { | 1604 | if (xid->xid2_dlc_type == XID2_READ_SIDE) { |
1758 | ctcm_pr_debug("ctcmpc: %s(): grpmaxbuf:%d xid2buflen:%d\n", | 1605 | CTCM_PR_DEBUG("%s: grpmaxbuf:%d xid2buflen:%d\n", __func__, |
1759 | __FUNCTION__, grp->group_max_buflen, | 1606 | grp->group_max_buflen, xid->xid2_buf_len); |
1760 | xid->xid2_buf_len); | ||
1761 | 1607 | ||
1762 | if (grp->group_max_buflen == 0 || | 1608 | if (grp->group_max_buflen == 0 || grp->group_max_buflen > |
1763 | grp->group_max_buflen > xid->xid2_buf_len - len) | 1609 | xid->xid2_buf_len - len) |
1764 | grp->group_max_buflen = xid->xid2_buf_len - len; | 1610 | grp->group_max_buflen = xid->xid2_buf_len - len; |
1765 | } | 1611 | } |
1766 | 1612 | ||
1767 | 1613 | if (grp->saved_xid2 == NULL) { | |
1768 | if (grp->saved_xid2 == NULL) { | ||
1769 | grp->saved_xid2 = | 1614 | grp->saved_xid2 = |
1770 | (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); | 1615 | (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); |
1771 | 1616 | ||
@@ -1786,49 +1631,54 @@ static int mpc_validate_xid(struct mpcg_info *mpcginfo) | |||
1786 | /* lower id assume the xside role */ | 1631 | /* lower id assume the xside role */ |
1787 | if (our_id < their_id) { | 1632 | if (our_id < their_id) { |
1788 | grp->roll = XSIDE; | 1633 | grp->roll = XSIDE; |
1789 | ctcm_pr_debug("ctcmpc :%s() WE HAVE LOW ID-" | 1634 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1790 | "TAKE XSIDE\n", __FUNCTION__); | 1635 | "%s(%s): WE HAVE LOW ID - TAKE XSIDE", |
1636 | CTCM_FUNTAIL, ch->id); | ||
1791 | } else { | 1637 | } else { |
1792 | grp->roll = YSIDE; | 1638 | grp->roll = YSIDE; |
1793 | ctcm_pr_debug("ctcmpc :%s() WE HAVE HIGH ID-" | 1639 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1794 | "TAKE YSIDE\n", __FUNCTION__); | 1640 | "%s(%s): WE HAVE HIGH ID - TAKE YSIDE", |
1641 | CTCM_FUNTAIL, ch->id); | ||
1795 | } | 1642 | } |
1796 | 1643 | ||
1797 | } else { | 1644 | } else { |
1798 | if (xid->xid2_flag4 != grp->saved_xid2->xid2_flag4) { | 1645 | if (xid->xid2_flag4 != grp->saved_xid2->xid2_flag4) { |
1799 | failed = 1; | 1646 | rc = 3; |
1800 | printk(KERN_INFO "%s XID REJECTED - XID Flag Byte4\n", | 1647 | /* XID REJECTED: xid flag byte4 mismatch */ |
1801 | __FUNCTION__); | 1648 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1649 | "%s(%s): xid flag byte4 mismatch", | ||
1650 | CTCM_FUNTAIL, ch->id); | ||
1802 | } | 1651 | } |
1803 | if (xid->xid2_flag2 == 0x40) { | 1652 | if (xid->xid2_flag2 == 0x40) { |
1804 | failed = 1; | 1653 | rc = 4; |
1805 | printk(KERN_INFO "%s XID REJECTED - XID NOGOOD\n", | 1654 | /* XID REJECTED - xid NOGOOD */ |
1806 | __FUNCTION__); | 1655 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1656 | "%s(%s): xid NOGOOD", | ||
1657 | CTCM_FUNTAIL, ch->id); | ||
1807 | } | 1658 | } |
1808 | if (xid->xid2_adj_id != grp->saved_xid2->xid2_adj_id) { | 1659 | if (xid->xid2_adj_id != grp->saved_xid2->xid2_adj_id) { |
1809 | failed = 1; | 1660 | rc = 5; |
1810 | printk(KERN_INFO "%s XID REJECTED - " | 1661 | /* XID REJECTED - Adjacent Station ID Mismatch */ |
1811 | "Adjacent Station ID Mismatch\n", | 1662 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1812 | __FUNCTION__); | 1663 | "%s(%s): Adjacent Station ID Mismatch", |
1664 | CTCM_FUNTAIL, ch->id); | ||
1813 | } | 1665 | } |
1814 | if (xid->xid2_sender_id != grp->saved_xid2->xid2_sender_id) { | 1666 | if (xid->xid2_sender_id != grp->saved_xid2->xid2_sender_id) { |
1815 | failed = 1; | 1667 | rc = 6; |
1816 | printk(KERN_INFO "%s XID REJECTED - " | 1668 | /* XID REJECTED - Sender Address Mismatch */ |
1817 | "Sender Address Mismatch\n", __FUNCTION__); | 1669 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1818 | 1670 | "%s(%s): Sender Address Mismatch", | |
1671 | CTCM_FUNTAIL, ch->id); | ||
1819 | } | 1672 | } |
1820 | } | 1673 | } |
1821 | 1674 | ||
1822 | if (failed) { | 1675 | done: |
1676 | if (rc) { | ||
1823 | ctcm_pr_info("ctcmpc : %s() failed\n", __FUNCTION__); | 1677 | ctcm_pr_info("ctcmpc : %s() failed\n", __FUNCTION__); |
1824 | priv->xid->xid2_flag2 = 0x40; | 1678 | priv->xid->xid2_flag2 = 0x40; |
1825 | grp->saved_xid2->xid2_flag2 = 0x40; | 1679 | grp->saved_xid2->xid2_flag2 = 0x40; |
1826 | rc = 1; | ||
1827 | } | 1680 | } |
1828 | 1681 | ||
1829 | done: | ||
1830 | |||
1831 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
1832 | return rc; | 1682 | return rc; |
1833 | } | 1683 | } |
1834 | 1684 | ||
@@ -1839,46 +1689,20 @@ done: | |||
1839 | static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | 1689 | static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) |
1840 | { | 1690 | { |
1841 | struct channel *ch = arg; | 1691 | struct channel *ch = arg; |
1842 | struct ctcm_priv *priv; | ||
1843 | struct mpc_group *grp = NULL; | ||
1844 | struct net_device *dev = NULL; | ||
1845 | int rc = 0; | 1692 | int rc = 0; |
1846 | int gotlock = 0; | 1693 | int gotlock = 0; |
1847 | unsigned long saveflags = 0; /* avoids compiler warning with | 1694 | unsigned long saveflags = 0; /* avoids compiler warning with |
1848 | spin_unlock_irqrestore */ | 1695 | spin_unlock_irqrestore */ |
1849 | |||
1850 | if (ch == NULL) { | ||
1851 | printk(KERN_INFO "%s ch=NULL\n", __FUNCTION__); | ||
1852 | goto done; | ||
1853 | } | ||
1854 | |||
1855 | if (do_debug) | ||
1856 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
1857 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
1858 | |||
1859 | dev = ch->netdev; | ||
1860 | if (dev == NULL) { | ||
1861 | printk(KERN_INFO "%s dev=NULL\n", __FUNCTION__); | ||
1862 | goto done; | ||
1863 | } | ||
1864 | |||
1865 | priv = dev->priv; | ||
1866 | if (priv == NULL) { | ||
1867 | printk(KERN_INFO "%s priv=NULL\n", __FUNCTION__); | ||
1868 | goto done; | ||
1869 | } | ||
1870 | 1696 | ||
1871 | grp = priv->mpcg; | 1697 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
1872 | if (grp == NULL) { | 1698 | __func__, smp_processor_id(), ch, ch->id); |
1873 | printk(KERN_INFO "%s grp=NULL\n", __FUNCTION__); | ||
1874 | goto done; | ||
1875 | } | ||
1876 | 1699 | ||
1877 | if (ctcm_checkalloc_buffer(ch)) | 1700 | if (ctcm_checkalloc_buffer(ch)) |
1878 | goto done; | 1701 | goto done; |
1879 | 1702 | ||
1880 | /* skb data-buffer referencing: */ | 1703 | /* |
1881 | 1704 | * skb data-buffer referencing: | |
1705 | */ | ||
1882 | ch->trans_skb->data = ch->trans_skb_data; | 1706 | ch->trans_skb->data = ch->trans_skb_data; |
1883 | skb_reset_tail_pointer(ch->trans_skb); | 1707 | skb_reset_tail_pointer(ch->trans_skb); |
1884 | ch->trans_skb->len = 0; | 1708 | ch->trans_skb->len = 0; |
@@ -1911,22 +1735,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1911 | ch->ccw[8].count = 0; | 1735 | ch->ccw[8].count = 0; |
1912 | ch->ccw[8].cda = 0x00; | 1736 | ch->ccw[8].cda = 0x00; |
1913 | 1737 | ||
1738 | if (!(ch->xid_th && ch->xid && ch->xid_id)) | ||
1739 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, | ||
1740 | "%s(%s): xid_th=%p, xid=%p, xid_id=%p", | ||
1741 | CTCM_FUNTAIL, ch->id, ch->xid_th, ch->xid, ch->xid_id); | ||
1742 | |||
1914 | if (side == XSIDE) { | 1743 | if (side == XSIDE) { |
1915 | /* mpc_action_xside_xid */ | 1744 | /* mpc_action_xside_xid */ |
1916 | if (ch->xid_th == NULL) { | 1745 | if (ch->xid_th == NULL) |
1917 | printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); | 1746 | goto done; |
1918 | goto done; | ||
1919 | } | ||
1920 | ch->ccw[9].cmd_code = CCW_CMD_WRITE; | 1747 | ch->ccw[9].cmd_code = CCW_CMD_WRITE; |
1921 | ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1748 | ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1922 | ch->ccw[9].count = TH_HEADER_LENGTH; | 1749 | ch->ccw[9].count = TH_HEADER_LENGTH; |
1923 | ch->ccw[9].cda = virt_to_phys(ch->xid_th); | 1750 | ch->ccw[9].cda = virt_to_phys(ch->xid_th); |
1924 | 1751 | ||
1925 | if (ch->xid == NULL) { | 1752 | if (ch->xid == NULL) |
1926 | printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); | 1753 | goto done; |
1927 | goto done; | ||
1928 | } | ||
1929 | |||
1930 | ch->ccw[10].cmd_code = CCW_CMD_WRITE; | 1754 | ch->ccw[10].cmd_code = CCW_CMD_WRITE; |
1931 | ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1755 | ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1932 | ch->ccw[10].count = XID2_LENGTH; | 1756 | ch->ccw[10].count = XID2_LENGTH; |
@@ -1956,28 +1780,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1956 | ch->ccw[10].count = XID2_LENGTH; | 1780 | ch->ccw[10].count = XID2_LENGTH; |
1957 | ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); | 1781 | ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); |
1958 | 1782 | ||
1959 | if (ch->xid_th == NULL) { | 1783 | if (ch->xid_th == NULL) |
1960 | printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); | 1784 | goto done; |
1961 | goto done; | ||
1962 | } | ||
1963 | ch->ccw[11].cmd_code = CCW_CMD_WRITE; | 1785 | ch->ccw[11].cmd_code = CCW_CMD_WRITE; |
1964 | ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1786 | ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1965 | ch->ccw[11].count = TH_HEADER_LENGTH; | 1787 | ch->ccw[11].count = TH_HEADER_LENGTH; |
1966 | ch->ccw[11].cda = virt_to_phys(ch->xid_th); | 1788 | ch->ccw[11].cda = virt_to_phys(ch->xid_th); |
1967 | 1789 | ||
1968 | if (ch->xid == NULL) { | 1790 | if (ch->xid == NULL) |
1969 | printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); | 1791 | goto done; |
1970 | goto done; | ||
1971 | } | ||
1972 | ch->ccw[12].cmd_code = CCW_CMD_WRITE; | 1792 | ch->ccw[12].cmd_code = CCW_CMD_WRITE; |
1973 | ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1793 | ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1974 | ch->ccw[12].count = XID2_LENGTH; | 1794 | ch->ccw[12].count = XID2_LENGTH; |
1975 | ch->ccw[12].cda = virt_to_phys(ch->xid); | 1795 | ch->ccw[12].cda = virt_to_phys(ch->xid); |
1976 | 1796 | ||
1977 | if (ch->xid_id == NULL) { | 1797 | if (ch->xid_id == NULL) |
1978 | printk(KERN_INFO "%s ch->xid_id=NULL\n", __FUNCTION__); | 1798 | goto done; |
1979 | goto done; | ||
1980 | } | ||
1981 | ch->ccw[13].cmd_code = CCW_CMD_WRITE; | 1799 | ch->ccw[13].cmd_code = CCW_CMD_WRITE; |
1982 | ch->ccw[13].cda = virt_to_phys(ch->xid_id); | 1800 | ch->ccw[13].cda = virt_to_phys(ch->xid_id); |
1983 | 1801 | ||
@@ -1990,12 +1808,11 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1990 | ch->ccw[14].count = 0; | 1808 | ch->ccw[14].count = 0; |
1991 | ch->ccw[14].cda = 0; | 1809 | ch->ccw[14].cda = 0; |
1992 | 1810 | ||
1993 | if (do_debug_ccw) | 1811 | CTCM_CCW_DUMP((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); |
1994 | ctcmpc_dumpit((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); | 1812 | CTCM_D3_DUMP((char *)ch->xid_th, TH_HEADER_LENGTH); |
1813 | CTCM_D3_DUMP((char *)ch->xid, XID2_LENGTH); | ||
1814 | CTCM_D3_DUMP((char *)ch->xid_id, 4); | ||
1995 | 1815 | ||
1996 | ctcmpc_dumpit((char *)ch->xid_th, TH_HEADER_LENGTH); | ||
1997 | ctcmpc_dumpit((char *)ch->xid, XID2_LENGTH); | ||
1998 | ctcmpc_dumpit((char *)ch->xid_id, 4); | ||
1999 | if (!in_irq()) { | 1816 | if (!in_irq()) { |
2000 | /* Such conditional locking is a known problem for | 1817 | /* Such conditional locking is a known problem for |
2001 | * sparse because its static undeterministic. | 1818 | * sparse because its static undeterministic. |
@@ -2012,16 +1829,13 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
2012 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); | 1829 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); |
2013 | 1830 | ||
2014 | if (rc != 0) { | 1831 | if (rc != 0) { |
2015 | ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", | ||
2016 | __FUNCTION__, ch->id); | ||
2017 | ctcm_ccw_check_rc(ch, rc, | 1832 | ctcm_ccw_check_rc(ch, rc, |
2018 | (side == XSIDE) ? "x-side XID" : "y-side XID"); | 1833 | (side == XSIDE) ? "x-side XID" : "y-side XID"); |
2019 | } | 1834 | } |
2020 | 1835 | ||
2021 | done: | 1836 | done: |
2022 | if (do_debug) | 1837 | CTCM_PR_DEBUG("Exit %s: ch=0x%p id=%s\n", |
2023 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | 1838 | __func__, ch, ch->id); |
2024 | __FUNCTION__, ch, ch->id); | ||
2025 | return; | 1839 | return; |
2026 | 1840 | ||
2027 | } | 1841 | } |
@@ -2050,41 +1864,19 @@ static void mpc_action_yside_xid(fsm_instance *fsm, int event, void *arg) | |||
2050 | */ | 1864 | */ |
2051 | static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | 1865 | static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) |
2052 | { | 1866 | { |
2053 | struct channel *ch = arg; | 1867 | struct channel *ch = arg; |
2054 | struct ctcm_priv *priv; | 1868 | struct net_device *dev = ch->netdev; |
2055 | struct mpc_group *grp = NULL; | 1869 | struct ctcm_priv *priv = dev->priv; |
2056 | struct net_device *dev = NULL; | 1870 | struct mpc_group *grp = priv->mpcg; |
2057 | |||
2058 | if (do_debug) | ||
2059 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
2060 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2061 | |||
2062 | if (ch == NULL) { | ||
2063 | printk(KERN_WARNING "%s ch=NULL\n", __FUNCTION__); | ||
2064 | goto done; | ||
2065 | } | ||
2066 | |||
2067 | dev = ch->netdev; | ||
2068 | if (dev == NULL) { | ||
2069 | printk(KERN_WARNING "%s dev=NULL\n", __FUNCTION__); | ||
2070 | goto done; | ||
2071 | } | ||
2072 | |||
2073 | priv = dev->priv; | ||
2074 | if (priv == NULL) { | ||
2075 | printk(KERN_WARNING "%s priv=NULL\n", __FUNCTION__); | ||
2076 | goto done; | ||
2077 | } | ||
2078 | 1871 | ||
2079 | grp = priv->mpcg; | 1872 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
2080 | if (grp == NULL) { | 1873 | __func__, smp_processor_id(), ch, ch->id); |
2081 | printk(KERN_WARNING "%s grp=NULL\n", __FUNCTION__); | ||
2082 | goto done; | ||
2083 | } | ||
2084 | 1874 | ||
2085 | if (ch->xid == NULL) { | 1875 | if (ch->xid == NULL) { |
2086 | printk(KERN_WARNING "%s ch-xid=NULL\n", __FUNCTION__); | 1876 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2087 | goto done; | 1877 | "%s(%s): ch->xid == NULL", |
1878 | CTCM_FUNTAIL, dev->name); | ||
1879 | return; | ||
2088 | } | 1880 | } |
2089 | 1881 | ||
2090 | fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); | 1882 | fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); |
@@ -2104,12 +1896,7 @@ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | |||
2104 | 1896 | ||
2105 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); | 1897 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); |
2106 | 1898 | ||
2107 | done: | ||
2108 | if (do_debug) | ||
2109 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
2110 | __FUNCTION__, ch, ch->id); | ||
2111 | return; | 1899 | return; |
2112 | |||
2113 | } | 1900 | } |
2114 | 1901 | ||
2115 | /* | 1902 | /* |
@@ -2119,32 +1906,16 @@ done: | |||
2119 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | 1906 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) |
2120 | { | 1907 | { |
2121 | struct net_device *dev = arg; | 1908 | struct net_device *dev = arg; |
2122 | struct ctcm_priv *priv = NULL; | 1909 | struct ctcm_priv *priv = dev->priv; |
2123 | struct mpc_group *grp = NULL; | 1910 | struct mpc_group *grp = NULL; |
2124 | int direction; | 1911 | int direction; |
2125 | int rc = 0; | ||
2126 | int send = 0; | 1912 | int send = 0; |
2127 | 1913 | ||
2128 | ctcm_pr_debug("ctcmpc enter: %s() \n", __FUNCTION__); | 1914 | if (priv) |
2129 | 1915 | grp = priv->mpcg; | |
2130 | if (dev == NULL) { | ||
2131 | printk(KERN_INFO "%s dev=NULL \n", __FUNCTION__); | ||
2132 | rc = 1; | ||
2133 | goto done; | ||
2134 | } | ||
2135 | |||
2136 | priv = dev->priv; | ||
2137 | if (priv == NULL) { | ||
2138 | printk(KERN_INFO "%s priv=NULL \n", __FUNCTION__); | ||
2139 | rc = 1; | ||
2140 | goto done; | ||
2141 | } | ||
2142 | |||
2143 | grp = priv->mpcg; | ||
2144 | if (grp == NULL) { | 1916 | if (grp == NULL) { |
2145 | printk(KERN_INFO "%s grp=NULL \n", __FUNCTION__); | 1917 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
2146 | rc = 1; | 1918 | return; |
2147 | goto done; | ||
2148 | } | 1919 | } |
2149 | 1920 | ||
2150 | for (direction = READ; direction <= WRITE; direction++) { | 1921 | for (direction = READ; direction <= WRITE; direction++) { |
@@ -2199,11 +1970,6 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | |||
2199 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); | 1970 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); |
2200 | } | 1971 | } |
2201 | 1972 | ||
2202 | done: | ||
2203 | |||
2204 | if (rc != 0) | ||
2205 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
2206 | |||
2207 | return; | 1973 | return; |
2208 | } | 1974 | } |
2209 | 1975 | ||
@@ -2214,24 +1980,15 @@ done: | |||
2214 | static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) | 1980 | static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) |
2215 | { | 1981 | { |
2216 | 1982 | ||
2217 | struct mpcg_info *mpcginfo = arg; | 1983 | struct mpcg_info *mpcginfo = arg; |
2218 | struct channel *ch = mpcginfo->ch; | 1984 | struct channel *ch = mpcginfo->ch; |
2219 | struct net_device *dev = ch->netdev; | 1985 | struct net_device *dev = ch->netdev; |
2220 | struct ctcm_priv *priv; | 1986 | struct ctcm_priv *priv = dev->priv; |
2221 | struct mpc_group *grp; | 1987 | struct mpc_group *grp = priv->mpcg; |
2222 | |||
2223 | if (do_debug) | ||
2224 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
2225 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2226 | |||
2227 | priv = dev->priv; | ||
2228 | grp = priv->mpcg; | ||
2229 | 1988 | ||
2230 | ctcm_pr_debug("ctcmpc in:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", | 1989 | CTCM_PR_DEBUG("%s: ch-id:%s xid2:%i xid7:%i xidt_p2:%i \n", |
2231 | __FUNCTION__, ch->id, | 1990 | __func__, ch->id, grp->outstanding_xid2, |
2232 | grp->outstanding_xid2, | 1991 | grp->outstanding_xid7, grp->outstanding_xid7_p2); |
2233 | grp->outstanding_xid7, | ||
2234 | grp->outstanding_xid7_p2); | ||
2235 | 1992 | ||
2236 | if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) | 1993 | if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) |
2237 | fsm_newstate(ch->fsm, CH_XID7_PENDING); | 1994 | fsm_newstate(ch->fsm, CH_XID7_PENDING); |
@@ -2268,17 +2025,12 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) | |||
2268 | } | 2025 | } |
2269 | kfree(mpcginfo); | 2026 | kfree(mpcginfo); |
2270 | 2027 | ||
2271 | if (do_debug) { | 2028 | CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", |
2272 | ctcm_pr_debug("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", | 2029 | __func__, ch->id, grp->outstanding_xid2, |
2273 | __FUNCTION__, ch->id, | 2030 | grp->outstanding_xid7, grp->outstanding_xid7_p2); |
2274 | grp->outstanding_xid2, | 2031 | CTCM_PR_DEBUG("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", |
2275 | grp->outstanding_xid7, | 2032 | __func__, ch->id, |
2276 | grp->outstanding_xid7_p2); | 2033 | fsm_getstate_str(grp->fsm), fsm_getstate_str(ch->fsm)); |
2277 | ctcm_pr_debug("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", | ||
2278 | __FUNCTION__, ch->id, | ||
2279 | fsm_getstate_str(grp->fsm), | ||
2280 | fsm_getstate_str(ch->fsm)); | ||
2281 | } | ||
2282 | return; | 2034 | return; |
2283 | 2035 | ||
2284 | } | 2036 | } |
@@ -2296,15 +2048,10 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2296 | struct ctcm_priv *priv = dev->priv; | 2048 | struct ctcm_priv *priv = dev->priv; |
2297 | struct mpc_group *grp = priv->mpcg; | 2049 | struct mpc_group *grp = priv->mpcg; |
2298 | 2050 | ||
2299 | if (do_debug) { | 2051 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
2300 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 2052 | __func__, smp_processor_id(), ch, ch->id); |
2301 | __FUNCTION__, smp_processor_id(), ch, ch->id); | 2053 | CTCM_PR_DEBUG("%s: outstanding_xid7: %i, outstanding_xid7_p2: %i\n", |
2302 | 2054 | __func__, grp->outstanding_xid7, grp->outstanding_xid7_p2); | |
2303 | ctcm_pr_debug("ctcmpc: outstanding_xid7: %i, " | ||
2304 | " outstanding_xid7_p2: %i\n", | ||
2305 | grp->outstanding_xid7, | ||
2306 | grp->outstanding_xid7_p2); | ||
2307 | } | ||
2308 | 2055 | ||
2309 | grp->outstanding_xid7--; | 2056 | grp->outstanding_xid7--; |
2310 | ch->xid_skb->data = ch->xid_skb_data; | 2057 | ch->xid_skb->data = ch->xid_skb_data; |
@@ -2337,14 +2084,8 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2337 | mpc_validate_xid(mpcginfo); | 2084 | mpc_validate_xid(mpcginfo); |
2338 | break; | 2085 | break; |
2339 | } | 2086 | } |
2340 | |||
2341 | kfree(mpcginfo); | 2087 | kfree(mpcginfo); |
2342 | |||
2343 | if (do_debug) | ||
2344 | ctcm_pr_debug("ctcmpc exit: %s(): cp=%i ch=0x%p id=%s\n", | ||
2345 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2346 | return; | 2088 | return; |
2347 | |||
2348 | } | 2089 | } |
2349 | 2090 | ||
2350 | /* | 2091 | /* |
@@ -2353,36 +2094,14 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2353 | */ | 2094 | */ |
2354 | static int mpc_send_qllc_discontact(struct net_device *dev) | 2095 | static int mpc_send_qllc_discontact(struct net_device *dev) |
2355 | { | 2096 | { |
2356 | int rc = 0; | ||
2357 | __u32 new_len = 0; | 2097 | __u32 new_len = 0; |
2358 | struct sk_buff *skb; | 2098 | struct sk_buff *skb; |
2359 | struct qllc *qllcptr; | 2099 | struct qllc *qllcptr; |
2360 | struct ctcm_priv *priv; | 2100 | struct ctcm_priv *priv = dev->priv; |
2361 | struct mpc_group *grp; | 2101 | struct mpc_group *grp = priv->mpcg; |
2362 | |||
2363 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | ||
2364 | |||
2365 | if (dev == NULL) { | ||
2366 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
2367 | rc = 1; | ||
2368 | goto done; | ||
2369 | } | ||
2370 | |||
2371 | priv = dev->priv; | ||
2372 | if (priv == NULL) { | ||
2373 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
2374 | rc = 1; | ||
2375 | goto done; | ||
2376 | } | ||
2377 | 2102 | ||
2378 | grp = priv->mpcg; | 2103 | CTCM_PR_DEBUG("%s: GROUP STATE: %s\n", |
2379 | if (grp == NULL) { | 2104 | __func__, mpcg_state_names[grp->saved_state]); |
2380 | printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); | ||
2381 | rc = 1; | ||
2382 | goto done; | ||
2383 | } | ||
2384 | ctcm_pr_info("ctcmpc: %s() GROUP STATE: %s\n", __FUNCTION__, | ||
2385 | mpcg_state_names[grp->saved_state]); | ||
2386 | 2105 | ||
2387 | switch (grp->saved_state) { | 2106 | switch (grp->saved_state) { |
2388 | /* | 2107 | /* |
@@ -2408,11 +2127,10 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2408 | new_len = sizeof(struct qllc); | 2127 | new_len = sizeof(struct qllc); |
2409 | qllcptr = kzalloc(new_len, gfp_type() | GFP_DMA); | 2128 | qllcptr = kzalloc(new_len, gfp_type() | GFP_DMA); |
2410 | if (qllcptr == NULL) { | 2129 | if (qllcptr == NULL) { |
2411 | printk(KERN_INFO | 2130 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2412 | "ctcmpc: Out of memory in %s()\n", | 2131 | "%s(%s): qllcptr allocation error", |
2413 | dev->name); | 2132 | CTCM_FUNTAIL, dev->name); |
2414 | rc = 1; | 2133 | return -ENOMEM; |
2415 | goto done; | ||
2416 | } | 2134 | } |
2417 | 2135 | ||
2418 | qllcptr->qllc_address = 0xcc; | 2136 | qllcptr->qllc_address = 0xcc; |
@@ -2421,31 +2139,29 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2421 | skb = __dev_alloc_skb(new_len, GFP_ATOMIC); | 2139 | skb = __dev_alloc_skb(new_len, GFP_ATOMIC); |
2422 | 2140 | ||
2423 | if (skb == NULL) { | 2141 | if (skb == NULL) { |
2424 | printk(KERN_INFO "%s Out of memory in mpc_send_qllc\n", | 2142 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2425 | dev->name); | 2143 | "%s(%s): skb allocation error", |
2144 | CTCM_FUNTAIL, dev->name); | ||
2426 | priv->stats.rx_dropped++; | 2145 | priv->stats.rx_dropped++; |
2427 | rc = 1; | ||
2428 | kfree(qllcptr); | 2146 | kfree(qllcptr); |
2429 | goto done; | 2147 | return -ENOMEM; |
2430 | } | 2148 | } |
2431 | 2149 | ||
2432 | memcpy(skb_put(skb, new_len), qllcptr, new_len); | 2150 | memcpy(skb_put(skb, new_len), qllcptr, new_len); |
2433 | kfree(qllcptr); | 2151 | kfree(qllcptr); |
2434 | 2152 | ||
2435 | if (skb_headroom(skb) < 4) { | 2153 | if (skb_headroom(skb) < 4) { |
2436 | printk(KERN_INFO "ctcmpc: %s() Unable to" | 2154 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2437 | " build discontact for %s\n", | 2155 | "%s(%s): skb_headroom error", |
2438 | __FUNCTION__, dev->name); | 2156 | CTCM_FUNTAIL, dev->name); |
2439 | rc = 1; | ||
2440 | dev_kfree_skb_any(skb); | 2157 | dev_kfree_skb_any(skb); |
2441 | goto done; | 2158 | return -ENOMEM; |
2442 | } | 2159 | } |
2443 | 2160 | ||
2444 | *((__u32 *)skb_push(skb, 4)) = priv->channel[READ]->pdu_seq; | 2161 | *((__u32 *)skb_push(skb, 4)) = priv->channel[READ]->pdu_seq; |
2445 | priv->channel[READ]->pdu_seq++; | 2162 | priv->channel[READ]->pdu_seq++; |
2446 | if (do_debug_data) | 2163 | CTCM_PR_DBGDATA("ctcmpc: %s ToDCM_pdu_seq= %08x\n", |
2447 | ctcm_pr_debug("ctcmpc: %s ToDCM_pdu_seq= %08x\n", | 2164 | __func__, priv->channel[READ]->pdu_seq); |
2448 | __FUNCTION__, priv->channel[READ]->pdu_seq); | ||
2449 | 2165 | ||
2450 | /* receipt of CC03 resets anticipated sequence number on | 2166 | /* receipt of CC03 resets anticipated sequence number on |
2451 | receiving side */ | 2167 | receiving side */ |
@@ -2455,7 +2171,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2455 | skb->protocol = htons(ETH_P_SNAP); | 2171 | skb->protocol = htons(ETH_P_SNAP); |
2456 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2172 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
2457 | 2173 | ||
2458 | ctcmpc_dumpit((char *)skb->data, (sizeof(struct qllc) + 4)); | 2174 | CTCM_D3_DUMP(skb->data, (sizeof(struct qllc) + 4)); |
2459 | 2175 | ||
2460 | netif_rx(skb); | 2176 | netif_rx(skb); |
2461 | break; | 2177 | break; |
@@ -2464,9 +2180,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2464 | 2180 | ||
2465 | } | 2181 | } |
2466 | 2182 | ||
2467 | done: | 2183 | return 0; |
2468 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
2469 | return rc; | ||
2470 | } | 2184 | } |
2471 | /* --- This is the END my friend --- */ | 2185 | /* --- This is the END my friend --- */ |
2472 | 2186 | ||