diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/claw.c | 2141 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_dbug.c | 29 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_dbug.h | 39 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_fsms.c | 402 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_main.c | 514 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_main.h | 31 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_mpc.c | 1110 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_mpc.h | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 2 |
9 files changed, 1403 insertions, 2867 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index c644669a75c2..a08b1682c8e8 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -58,13 +58,13 @@ | |||
58 | * 1.10 Changes for Buffer allocation | 58 | * 1.10 Changes for Buffer allocation |
59 | * 1.15 Changed for 2.6 Kernel No longer compiles on 2.4 or lower | 59 | * 1.15 Changed for 2.6 Kernel No longer compiles on 2.4 or lower |
60 | * 1.25 Added Packing support | 60 | * 1.25 Added Packing support |
61 | * 1.5 | ||
61 | */ | 62 | */ |
62 | #include <asm/ccwdev.h> | 63 | #include <asm/ccwdev.h> |
63 | #include <asm/ccwgroup.h> | 64 | #include <asm/ccwgroup.h> |
64 | #include <asm/debug.h> | 65 | #include <asm/debug.h> |
65 | #include <asm/idals.h> | 66 | #include <asm/idals.h> |
66 | #include <asm/io.h> | 67 | #include <asm/io.h> |
67 | |||
68 | #include <linux/bitops.h> | 68 | #include <linux/bitops.h> |
69 | #include <linux/ctype.h> | 69 | #include <linux/ctype.h> |
70 | #include <linux/delay.h> | 70 | #include <linux/delay.h> |
@@ -90,36 +90,10 @@ | |||
90 | #include "cu3088.h" | 90 | #include "cu3088.h" |
91 | #include "claw.h" | 91 | #include "claw.h" |
92 | 92 | ||
93 | MODULE_AUTHOR("Andy Richter <richtera@us.ibm.com>"); | 93 | /* |
94 | MODULE_DESCRIPTION("Linux for zSeries CLAW Driver\n" \ | 94 | CLAW uses the s390dbf file system see claw_trace and claw_setup |
95 | "Copyright 2000,2005 IBM Corporation\n"); | ||
96 | MODULE_LICENSE("GPL"); | ||
97 | |||
98 | /* Debugging is based on DEBUGMSG, IOTRACE, or FUNCTRACE options: | ||
99 | DEBUGMSG - Enables output of various debug messages in the code | ||
100 | IOTRACE - Enables output of CCW and other IO related traces | ||
101 | FUNCTRACE - Enables output of function entry/exit trace | ||
102 | Define any combination of above options to enable tracing | ||
103 | |||
104 | CLAW also uses the s390dbf file system see claw_trace and claw_setup | ||
105 | */ | 95 | */ |
106 | 96 | ||
107 | /* following enables tracing */ | ||
108 | //#define DEBUGMSG | ||
109 | //#define IOTRACE | ||
110 | //#define FUNCTRACE | ||
111 | |||
112 | #ifdef DEBUGMSG | ||
113 | #define DEBUG | ||
114 | #endif | ||
115 | |||
116 | #ifdef IOTRACE | ||
117 | #define DEBUG | ||
118 | #endif | ||
119 | |||
120 | #ifdef FUNCTRACE | ||
121 | #define DEBUG | ||
122 | #endif | ||
123 | 97 | ||
124 | static char debug_buffer[255]; | 98 | static char debug_buffer[255]; |
125 | /** | 99 | /** |
@@ -146,7 +120,6 @@ claw_register_debug_facility(void) | |||
146 | claw_dbf_setup = debug_register("claw_setup", 2, 1, 8); | 120 | claw_dbf_setup = debug_register("claw_setup", 2, 1, 8); |
147 | claw_dbf_trace = debug_register("claw_trace", 2, 2, 8); | 121 | claw_dbf_trace = debug_register("claw_trace", 2, 2, 8); |
148 | if (claw_dbf_setup == NULL || claw_dbf_trace == NULL) { | 122 | if (claw_dbf_setup == NULL || claw_dbf_trace == NULL) { |
149 | printk(KERN_WARNING "Not enough memory for debug facility.\n"); | ||
150 | claw_unregister_debug_facility(); | 123 | claw_unregister_debug_facility(); |
151 | return -ENOMEM; | 124 | return -ENOMEM; |
152 | } | 125 | } |
@@ -232,9 +205,6 @@ static void probe_error( struct ccwgroup_device *cgdev); | |||
232 | static struct net_device_stats *claw_stats(struct net_device *dev); | 205 | static struct net_device_stats *claw_stats(struct net_device *dev); |
233 | static int pages_to_order_of_mag(int num_of_pages); | 206 | static int pages_to_order_of_mag(int num_of_pages); |
234 | static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr); | 207 | static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr); |
235 | #ifdef DEBUG | ||
236 | static void dumpit (char *buf, int len); | ||
237 | #endif | ||
238 | /* sysfs Functions */ | 208 | /* sysfs Functions */ |
239 | static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf); | 209 | static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf); |
240 | static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr, | 210 | static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr, |
@@ -263,12 +233,12 @@ static int claw_snd_disc(struct net_device *dev, struct clawctl * p_ctl); | |||
263 | static int claw_snd_sys_validate_rsp(struct net_device *dev, | 233 | static int claw_snd_sys_validate_rsp(struct net_device *dev, |
264 | struct clawctl * p_ctl, __u32 return_code); | 234 | struct clawctl * p_ctl, __u32 return_code); |
265 | static int claw_strt_conn_req(struct net_device *dev ); | 235 | static int claw_strt_conn_req(struct net_device *dev ); |
266 | static void claw_strt_read ( struct net_device *dev, int lock ); | 236 | static void claw_strt_read(struct net_device *dev, int lock); |
267 | static void claw_strt_out_IO( struct net_device *dev ); | 237 | static void claw_strt_out_IO(struct net_device *dev); |
268 | static void claw_free_wrt_buf( struct net_device *dev ); | 238 | static void claw_free_wrt_buf(struct net_device *dev); |
269 | 239 | ||
270 | /* Functions for unpack reads */ | 240 | /* Functions for unpack reads */ |
271 | static void unpack_read (struct net_device *dev ); | 241 | static void unpack_read(struct net_device *dev); |
272 | 242 | ||
273 | /* ccwgroup table */ | 243 | /* ccwgroup table */ |
274 | 244 | ||
@@ -284,7 +254,6 @@ static struct ccwgroup_driver claw_group_driver = { | |||
284 | }; | 254 | }; |
285 | 255 | ||
286 | /* | 256 | /* |
287 | * | ||
288 | * Key functions | 257 | * Key functions |
289 | */ | 258 | */ |
290 | 259 | ||
@@ -298,23 +267,14 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
298 | int rc; | 267 | int rc; |
299 | struct claw_privbk *privptr=NULL; | 268 | struct claw_privbk *privptr=NULL; |
300 | 269 | ||
301 | #ifdef FUNCTRACE | 270 | CLAW_DBF_TEXT(2, setup, "probe"); |
302 | printk(KERN_INFO "%s Enter\n",__func__); | ||
303 | #endif | ||
304 | CLAW_DBF_TEXT(2,setup,"probe"); | ||
305 | if (!get_device(&cgdev->dev)) | 271 | if (!get_device(&cgdev->dev)) |
306 | return -ENODEV; | 272 | return -ENODEV; |
307 | #ifdef DEBUGMSG | ||
308 | printk(KERN_INFO "claw: variable cgdev =\n"); | ||
309 | dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); | ||
310 | #endif | ||
311 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); | 273 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); |
312 | if (privptr == NULL) { | 274 | if (privptr == NULL) { |
313 | probe_error(cgdev); | 275 | probe_error(cgdev); |
314 | put_device(&cgdev->dev); | 276 | put_device(&cgdev->dev); |
315 | printk(KERN_WARNING "Out of memory %s %s Exit Line %d \n", | 277 | CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); |
316 | cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); | ||
317 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | ||
318 | return -ENOMEM; | 278 | return -ENOMEM; |
319 | } | 279 | } |
320 | privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); | 280 | privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); |
@@ -322,9 +282,7 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
322 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { | 282 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { |
323 | probe_error(cgdev); | 283 | probe_error(cgdev); |
324 | put_device(&cgdev->dev); | 284 | put_device(&cgdev->dev); |
325 | printk(KERN_WARNING "Out of memory %s %s Exit Line %d \n", | 285 | CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); |
326 | cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); | ||
327 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | ||
328 | return -ENOMEM; | 286 | return -ENOMEM; |
329 | } | 287 | } |
330 | memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); | 288 | memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); |
@@ -341,19 +299,14 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
341 | put_device(&cgdev->dev); | 299 | put_device(&cgdev->dev); |
342 | printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n", | 300 | printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n", |
343 | cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); | 301 | cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); |
344 | CLAW_DBF_TEXT_(2,setup,"probex%d",rc); | 302 | CLAW_DBF_TEXT_(2, setup, "probex%d", rc); |
345 | return rc; | 303 | return rc; |
346 | } | 304 | } |
347 | printk(KERN_INFO "claw: sysfs files added for %s\n",cgdev->cdev[0]->dev.bus_id); | ||
348 | privptr->p_env->p_priv = privptr; | 305 | privptr->p_env->p_priv = privptr; |
349 | cgdev->cdev[0]->handler = claw_irq_handler; | 306 | cgdev->cdev[0]->handler = claw_irq_handler; |
350 | cgdev->cdev[1]->handler = claw_irq_handler; | 307 | cgdev->cdev[1]->handler = claw_irq_handler; |
351 | cgdev->dev.driver_data = privptr; | 308 | cgdev->dev.driver_data = privptr; |
352 | #ifdef FUNCTRACE | 309 | CLAW_DBF_TEXT(2, setup, "prbext 0"); |
353 | printk(KERN_INFO "claw:%s exit on line %d, " | ||
354 | "rc = 0\n",__func__,__LINE__); | ||
355 | #endif | ||
356 | CLAW_DBF_TEXT(2,setup,"prbext 0"); | ||
357 | 310 | ||
358 | return 0; | 311 | return 0; |
359 | } /* end of claw_probe */ | 312 | } /* end of claw_probe */ |
@@ -370,37 +323,18 @@ claw_tx(struct sk_buff *skb, struct net_device *dev) | |||
370 | unsigned long saveflags; | 323 | unsigned long saveflags; |
371 | struct chbk *p_ch; | 324 | struct chbk *p_ch; |
372 | 325 | ||
373 | #ifdef FUNCTRACE | 326 | CLAW_DBF_TEXT(4, trace, "claw_tx"); |
374 | printk(KERN_INFO "%s:%s enter\n",dev->name,__func__); | ||
375 | #endif | ||
376 | CLAW_DBF_TEXT(4,trace,"claw_tx"); | ||
377 | p_ch=&privptr->channel[WRITE]; | 327 | p_ch=&privptr->channel[WRITE]; |
378 | if (skb == NULL) { | 328 | if (skb == NULL) { |
379 | printk(KERN_WARNING "%s: null pointer passed as sk_buffer\n", | ||
380 | dev->name); | ||
381 | privptr->stats.tx_dropped++; | 329 | privptr->stats.tx_dropped++; |
382 | #ifdef FUNCTRACE | 330 | privptr->stats.tx_errors++; |
383 | printk(KERN_INFO "%s: %s() exit on line %d, rc = EIO\n", | 331 | CLAW_DBF_TEXT_(2, trace, "clawtx%d", -EIO); |
384 | dev->name,__func__, __LINE__); | ||
385 | #endif | ||
386 | CLAW_DBF_TEXT_(2,trace,"clawtx%d",-EIO); | ||
387 | return -EIO; | 332 | return -EIO; |
388 | } | 333 | } |
389 | |||
390 | #ifdef IOTRACE | ||
391 | printk(KERN_INFO "%s: variable sk_buff=\n",dev->name); | ||
392 | dumpit((char *) skb, sizeof(struct sk_buff)); | ||
393 | printk(KERN_INFO "%s: variable dev=\n",dev->name); | ||
394 | dumpit((char *) dev, sizeof(struct net_device)); | ||
395 | #endif | ||
396 | spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); | 334 | spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); |
397 | rc=claw_hw_tx( skb, dev, 1 ); | 335 | rc=claw_hw_tx( skb, dev, 1 ); |
398 | spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); | 336 | spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); |
399 | #ifdef FUNCTRACE | 337 | CLAW_DBF_TEXT_(4, trace, "clawtx%d", rc); |
400 | printk(KERN_INFO "%s:%s exit on line %d, rc = %d\n", | ||
401 | dev->name, __func__, __LINE__, rc); | ||
402 | #endif | ||
403 | CLAW_DBF_TEXT_(4,trace,"clawtx%d",rc); | ||
404 | return rc; | 338 | return rc; |
405 | } /* end of claw_tx */ | 339 | } /* end of claw_tx */ |
406 | 340 | ||
@@ -419,7 +353,7 @@ claw_pack_skb(struct claw_privbk *privptr) | |||
419 | 353 | ||
420 | new_skb = NULL; /* assume no dice */ | 354 | new_skb = NULL; /* assume no dice */ |
421 | pkt_cnt = 0; | 355 | pkt_cnt = 0; |
422 | CLAW_DBF_TEXT(4,trace,"PackSKBe"); | 356 | CLAW_DBF_TEXT(4, trace, "PackSKBe"); |
423 | if (!skb_queue_empty(&p_ch->collect_queue)) { | 357 | if (!skb_queue_empty(&p_ch->collect_queue)) { |
424 | /* some data */ | 358 | /* some data */ |
425 | held_skb = skb_dequeue(&p_ch->collect_queue); | 359 | held_skb = skb_dequeue(&p_ch->collect_queue); |
@@ -457,13 +391,8 @@ claw_pack_skb(struct claw_privbk *privptr) | |||
457 | skb_queue_head(&p_ch->collect_queue,held_skb); | 391 | skb_queue_head(&p_ch->collect_queue,held_skb); |
458 | } | 392 | } |
459 | } | 393 | } |
460 | #ifdef IOTRACE | ||
461 | printk(KERN_INFO "%s: %s() Packed %d len %d\n", | ||
462 | p_env->ndev->name, | ||
463 | __func__,pkt_cnt,new_skb->len); | ||
464 | #endif | ||
465 | } | 394 | } |
466 | CLAW_DBF_TEXT(4,trace,"PackSKBx"); | 395 | CLAW_DBF_TEXT(4, trace, "PackSKBx"); |
467 | return new_skb; | 396 | return new_skb; |
468 | } | 397 | } |
469 | 398 | ||
@@ -477,29 +406,12 @@ claw_change_mtu(struct net_device *dev, int new_mtu) | |||
477 | { | 406 | { |
478 | struct claw_privbk *privptr=dev->priv; | 407 | struct claw_privbk *privptr=dev->priv; |
479 | int buff_size; | 408 | int buff_size; |
480 | #ifdef FUNCTRACE | 409 | CLAW_DBF_TEXT(4, trace, "setmtu"); |
481 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
482 | #endif | ||
483 | #ifdef DEBUGMSG | ||
484 | printk(KERN_INFO "variable dev =\n"); | ||
485 | dumpit((char *) dev, sizeof(struct net_device)); | ||
486 | printk(KERN_INFO "variable new_mtu = %d\n", new_mtu); | ||
487 | #endif | ||
488 | CLAW_DBF_TEXT(4,trace,"setmtu"); | ||
489 | buff_size = privptr->p_env->write_size; | 410 | buff_size = privptr->p_env->write_size; |
490 | if ((new_mtu < 60) || (new_mtu > buff_size)) { | 411 | if ((new_mtu < 60) || (new_mtu > buff_size)) { |
491 | #ifdef FUNCTRACE | ||
492 | printk(KERN_INFO "%s:%s Exit on line %d, rc=EINVAL\n", | ||
493 | dev->name, | ||
494 | __func__, __LINE__); | ||
495 | #endif | ||
496 | return -EINVAL; | 412 | return -EINVAL; |
497 | } | 413 | } |
498 | dev->mtu = new_mtu; | 414 | dev->mtu = new_mtu; |
499 | #ifdef FUNCTRACE | ||
500 | printk(KERN_INFO "%s:%s Exit on line %d\n",dev->name, | ||
501 | __func__, __LINE__); | ||
502 | #endif | ||
503 | return 0; | 415 | return 0; |
504 | } /* end of claw_change_mtu */ | 416 | } /* end of claw_change_mtu */ |
505 | 417 | ||
@@ -521,24 +433,13 @@ claw_open(struct net_device *dev) | |||
521 | struct timer_list timer; | 433 | struct timer_list timer; |
522 | struct ccwbk *p_buf; | 434 | struct ccwbk *p_buf; |
523 | 435 | ||
524 | #ifdef FUNCTRACE | 436 | CLAW_DBF_TEXT(4, trace, "open"); |
525 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
526 | #endif | ||
527 | CLAW_DBF_TEXT(4,trace,"open"); | ||
528 | if (!dev || (dev->name[0] == 0x00)) { | ||
529 | CLAW_DBF_TEXT(2,trace,"BadDev"); | ||
530 | printk(KERN_WARNING "claw: Bad device at open failing \n"); | ||
531 | return -ENODEV; | ||
532 | } | ||
533 | privptr = (struct claw_privbk *)dev->priv; | 437 | privptr = (struct claw_privbk *)dev->priv; |
534 | /* allocate and initialize CCW blocks */ | 438 | /* allocate and initialize CCW blocks */ |
535 | if (privptr->buffs_alloc == 0) { | 439 | if (privptr->buffs_alloc == 0) { |
536 | rc=init_ccw_bk(dev); | 440 | rc=init_ccw_bk(dev); |
537 | if (rc) { | 441 | if (rc) { |
538 | printk(KERN_INFO "%s:%s Exit on line %d, rc=ENOMEM\n", | 442 | CLAW_DBF_TEXT(2, trace, "openmem"); |
539 | dev->name, | ||
540 | __func__, __LINE__); | ||
541 | CLAW_DBF_TEXT(2,trace,"openmem"); | ||
542 | return -ENOMEM; | 443 | return -ENOMEM; |
543 | } | 444 | } |
544 | } | 445 | } |
@@ -557,7 +458,7 @@ claw_open(struct net_device *dev) | |||
557 | tasklet_init(&privptr->channel[READ].tasklet, claw_irq_tasklet, | 458 | tasklet_init(&privptr->channel[READ].tasklet, claw_irq_tasklet, |
558 | (unsigned long) &privptr->channel[READ]); | 459 | (unsigned long) &privptr->channel[READ]); |
559 | for ( i = 0; i < 2; i++) { | 460 | for ( i = 0; i < 2; i++) { |
560 | CLAW_DBF_TEXT_(2,trace,"opn_ch%d",i); | 461 | CLAW_DBF_TEXT_(2, trace, "opn_ch%d", i); |
561 | init_waitqueue_head(&privptr->channel[i].wait); | 462 | init_waitqueue_head(&privptr->channel[i].wait); |
562 | /* skb_queue_head_init(&p_ch->io_queue); */ | 463 | /* skb_queue_head_init(&p_ch->io_queue); */ |
563 | if (i == WRITE) | 464 | if (i == WRITE) |
@@ -595,15 +496,8 @@ claw_open(struct net_device *dev) | |||
595 | ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) || | 496 | ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) || |
596 | (((privptr->channel[READ].flag | | 497 | (((privptr->channel[READ].flag | |
597 | privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) { | 498 | privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) { |
598 | #ifdef DEBUGMSG | ||
599 | printk(KERN_INFO "%s: channel problems during open - read:" | ||
600 | " %02x - write: %02x\n", | ||
601 | dev->name, | ||
602 | privptr->channel[READ].last_dstat, | ||
603 | privptr->channel[WRITE].last_dstat); | ||
604 | #endif | ||
605 | printk(KERN_INFO "%s: remote side is not ready\n", dev->name); | 499 | printk(KERN_INFO "%s: remote side is not ready\n", dev->name); |
606 | CLAW_DBF_TEXT(2,trace,"notrdy"); | 500 | CLAW_DBF_TEXT(2, trace, "notrdy"); |
607 | 501 | ||
608 | for ( i = 0; i < 2; i++) { | 502 | for ( i = 0; i < 2; i++) { |
609 | spin_lock_irqsave( | 503 | spin_lock_irqsave( |
@@ -659,23 +553,14 @@ claw_open(struct net_device *dev) | |||
659 | privptr->p_buff_read=NULL; | 553 | privptr->p_buff_read=NULL; |
660 | privptr->p_buff_write=NULL; | 554 | privptr->p_buff_write=NULL; |
661 | claw_clear_busy(dev); | 555 | claw_clear_busy(dev); |
662 | #ifdef FUNCTRACE | 556 | CLAW_DBF_TEXT(2, trace, "open EIO"); |
663 | printk(KERN_INFO "%s:%s Exit on line %d, rc=EIO\n", | ||
664 | dev->name,__func__,__LINE__); | ||
665 | #endif | ||
666 | CLAW_DBF_TEXT(2,trace,"open EIO"); | ||
667 | return -EIO; | 557 | return -EIO; |
668 | } | 558 | } |
669 | 559 | ||
670 | /* Send SystemValidate command */ | 560 | /* Send SystemValidate command */ |
671 | 561 | ||
672 | claw_clear_busy(dev); | 562 | claw_clear_busy(dev); |
673 | 563 | CLAW_DBF_TEXT(4, trace, "openok"); | |
674 | #ifdef FUNCTRACE | ||
675 | printk(KERN_INFO "%s:%s Exit on line %d, rc=0\n", | ||
676 | dev->name,__func__,__LINE__); | ||
677 | #endif | ||
678 | CLAW_DBF_TEXT(4,trace,"openok"); | ||
679 | return 0; | 564 | return 0; |
680 | } /* end of claw_open */ | 565 | } /* end of claw_open */ |
681 | 566 | ||
@@ -694,22 +579,14 @@ claw_irq_handler(struct ccw_device *cdev, | |||
694 | struct claw_env *p_env; | 579 | struct claw_env *p_env; |
695 | struct chbk *p_ch_r=NULL; | 580 | struct chbk *p_ch_r=NULL; |
696 | 581 | ||
697 | 582 | CLAW_DBF_TEXT(4, trace, "clawirq"); | |
698 | #ifdef FUNCTRACE | ||
699 | printk(KERN_INFO "%s enter \n",__func__); | ||
700 | #endif | ||
701 | CLAW_DBF_TEXT(4,trace,"clawirq"); | ||
702 | /* Bypass all 'unsolicited interrupts' */ | 583 | /* Bypass all 'unsolicited interrupts' */ |
703 | if (!cdev->dev.driver_data) { | 584 | if (!cdev->dev.driver_data) { |
704 | printk(KERN_WARNING "claw: unsolicited interrupt for device:" | 585 | printk(KERN_WARNING "claw: unsolicited interrupt for device:" |
705 | "%s received c-%02x d-%02x\n", | 586 | "%s received c-%02x d-%02x\n", |
706 | cdev->dev.bus_id, irb->scsw.cmd.cstat, | 587 | cdev->dev.bus_id, irb->scsw.cmd.cstat, |
707 | irb->scsw.cmd.dstat); | 588 | irb->scsw.cmd.dstat); |
708 | #ifdef FUNCTRACE | 589 | CLAW_DBF_TEXT(2, trace, "badirq"); |
709 | printk(KERN_INFO "claw: %s() " | ||
710 | "exit on line %d\n",__func__,__LINE__); | ||
711 | #endif | ||
712 | CLAW_DBF_TEXT(2,trace,"badirq"); | ||
713 | return; | 590 | return; |
714 | } | 591 | } |
715 | privptr = (struct claw_privbk *)cdev->dev.driver_data; | 592 | privptr = (struct claw_privbk *)cdev->dev.driver_data; |
@@ -722,41 +599,25 @@ claw_irq_handler(struct ccw_device *cdev, | |||
722 | else { | 599 | else { |
723 | printk(KERN_WARNING "claw: Can't determine channel for " | 600 | printk(KERN_WARNING "claw: Can't determine channel for " |
724 | "interrupt, device %s\n", cdev->dev.bus_id); | 601 | "interrupt, device %s\n", cdev->dev.bus_id); |
725 | CLAW_DBF_TEXT(2,trace,"badchan"); | 602 | CLAW_DBF_TEXT(2, trace, "badchan"); |
726 | return; | 603 | return; |
727 | } | 604 | } |
728 | CLAW_DBF_TEXT_(4,trace,"IRQCH=%d",p_ch->flag); | 605 | CLAW_DBF_TEXT_(4, trace, "IRQCH=%d", p_ch->flag); |
729 | 606 | ||
730 | dev = (struct net_device *) (p_ch->ndev); | 607 | dev = (struct net_device *) (p_ch->ndev); |
731 | p_env=privptr->p_env; | 608 | p_env=privptr->p_env; |
732 | 609 | ||
733 | #ifdef IOTRACE | ||
734 | printk(KERN_INFO "%s: interrupt for device: %04x " | ||
735 | "received c-%02x d-%02x state-%02x\n", | ||
736 | dev->name, p_ch->devno, irb->scsw.cmd.cstat, | ||
737 | irb->scsw.cmd.dstat, p_ch->claw_state); | ||
738 | #endif | ||
739 | |||
740 | /* Copy interruption response block. */ | 610 | /* Copy interruption response block. */ |
741 | memcpy(p_ch->irb, irb, sizeof(struct irb)); | 611 | memcpy(p_ch->irb, irb, sizeof(struct irb)); |
742 | 612 | ||
743 | /* Check for good subchannel return code, otherwise error message */ | 613 | /* Check for good subchannel return code, otherwise info message */ |
744 | if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) { | 614 | if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) { |
745 | printk(KERN_INFO "%s: subchannel check for device: %04x -" | 615 | printk(KERN_INFO "%s: subchannel check for device: %04x -" |
746 | " Sch Stat %02x Dev Stat %02x CPA - %04x\n", | 616 | " Sch Stat %02x Dev Stat %02x CPA - %04x\n", |
747 | dev->name, p_ch->devno, | 617 | dev->name, p_ch->devno, |
748 | irb->scsw.cmd.cstat, irb->scsw.cmd.dstat, | 618 | irb->scsw.cmd.cstat, irb->scsw.cmd.dstat, |
749 | irb->scsw.cmd.cpa); | 619 | irb->scsw.cmd.cpa); |
750 | #ifdef IOTRACE | 620 | CLAW_DBF_TEXT(2, trace, "chanchk"); |
751 | dumpit((char *)irb,sizeof(struct irb)); | ||
752 | dumpit((char *)(unsigned long)irb->scsw.cmd.cpa, | ||
753 | sizeof(struct ccw1)); | ||
754 | #endif | ||
755 | #ifdef FUNCTRACE | ||
756 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
757 | dev->name,__func__,__LINE__); | ||
758 | #endif | ||
759 | CLAW_DBF_TEXT(2,trace,"chanchk"); | ||
760 | /* return; */ | 621 | /* return; */ |
761 | } | 622 | } |
762 | 623 | ||
@@ -768,233 +629,138 @@ claw_irq_handler(struct ccw_device *cdev, | |||
768 | p_ch->last_dstat = irb->scsw.cmd.dstat; | 629 | p_ch->last_dstat = irb->scsw.cmd.dstat; |
769 | 630 | ||
770 | switch (p_ch->claw_state) { | 631 | switch (p_ch->claw_state) { |
771 | case CLAW_STOP:/* HALT_IO by claw_release (halt sequence) */ | 632 | case CLAW_STOP:/* HALT_IO by claw_release (halt sequence) */ |
772 | #ifdef DEBUGMSG | 633 | if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || |
773 | printk(KERN_INFO "%s: CLAW_STOP enter\n", dev->name); | 634 | (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || |
774 | #endif | 635 | (p_ch->irb->scsw.cmd.stctl == |
775 | if (!((p_ch->irb->scsw.cmd.stctl & | 636 | (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) |
776 | SCSW_STCTL_SEC_STATUS) || | 637 | return; |
777 | (p_ch->irb->scsw.cmd.stctl == | 638 | wake_up(&p_ch->wait); /* wake up claw_release */ |
778 | SCSW_STCTL_STATUS_PEND) || | 639 | CLAW_DBF_TEXT(4, trace, "stop"); |
779 | (p_ch->irb->scsw.cmd.stctl == | 640 | return; |
780 | (SCSW_STCTL_ALERT_STATUS | | 641 | case CLAW_START_HALT_IO: /* HALT_IO issued by claw_open */ |
781 | SCSW_STCTL_STATUS_PEND)))) { | 642 | if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || |
782 | #ifdef FUNCTRACE | 643 | (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || |
783 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 644 | (p_ch->irb->scsw.cmd.stctl == |
784 | dev->name,__func__,__LINE__); | 645 | (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { |
785 | #endif | 646 | CLAW_DBF_TEXT(4, trace, "haltio"); |
786 | return; | 647 | return; |
787 | } | 648 | } |
788 | wake_up(&p_ch->wait); /* wake up claw_release */ | 649 | if (p_ch->flag == CLAW_READ) { |
789 | 650 | p_ch->claw_state = CLAW_START_READ; | |
790 | #ifdef DEBUGMSG | 651 | wake_up(&p_ch->wait); /* wake claw_open (READ)*/ |
791 | printk(KERN_INFO "%s: CLAW_STOP exit\n", dev->name); | 652 | } else if (p_ch->flag == CLAW_WRITE) { |
792 | #endif | 653 | p_ch->claw_state = CLAW_START_WRITE; |
793 | #ifdef FUNCTRACE | 654 | /* send SYSTEM_VALIDATE */ |
794 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 655 | claw_strt_read(dev, LOCK_NO); |
795 | dev->name,__func__,__LINE__); | 656 | claw_send_control(dev, |
796 | #endif | 657 | SYSTEM_VALIDATE_REQUEST, |
797 | CLAW_DBF_TEXT(4,trace,"stop"); | 658 | 0, 0, 0, |
798 | return; | 659 | p_env->host_name, |
799 | 660 | p_env->adapter_name); | |
800 | case CLAW_START_HALT_IO: /* HALT_IO issued by claw_open */ | 661 | } else { |
801 | #ifdef DEBUGMSG | 662 | printk(KERN_WARNING "claw: unsolicited " |
802 | printk(KERN_INFO "%s: process CLAW_STAT_HALT_IO\n", | 663 | "interrupt for device:" |
803 | dev->name); | 664 | "%s received c-%02x d-%02x\n", |
804 | #endif | 665 | cdev->dev.bus_id, |
805 | if (!((p_ch->irb->scsw.cmd.stctl & | 666 | irb->scsw.cmd.cstat, |
806 | SCSW_STCTL_SEC_STATUS) || | 667 | irb->scsw.cmd.dstat); |
807 | (p_ch->irb->scsw.cmd.stctl == | 668 | return; |
808 | SCSW_STCTL_STATUS_PEND) || | 669 | } |
809 | (p_ch->irb->scsw.cmd.stctl == | 670 | CLAW_DBF_TEXT(4, trace, "haltio"); |
810 | (SCSW_STCTL_ALERT_STATUS | | 671 | return; |
811 | SCSW_STCTL_STATUS_PEND)))) { | 672 | case CLAW_START_READ: |
812 | #ifdef FUNCTRACE | 673 | CLAW_DBF_TEXT(4, trace, "ReadIRQ"); |
813 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 674 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { |
814 | dev->name,__func__,__LINE__); | 675 | clear_bit(0, (void *)&p_ch->IO_active); |
815 | #endif | 676 | if ((p_ch->irb->ecw[0] & 0x41) == 0x41 || |
816 | CLAW_DBF_TEXT(4,trace,"haltio"); | 677 | (p_ch->irb->ecw[0] & 0x40) == 0x40 || |
817 | return; | 678 | (p_ch->irb->ecw[0]) == 0) { |
818 | } | 679 | privptr->stats.rx_errors++; |
819 | if (p_ch->flag == CLAW_READ) { | 680 | printk(KERN_INFO "%s: Restart is " |
820 | p_ch->claw_state = CLAW_START_READ; | 681 | "required after remote " |
821 | wake_up(&p_ch->wait); /* wake claw_open (READ)*/ | 682 | "side recovers \n", |
822 | } | 683 | dev->name); |
684 | } | ||
685 | CLAW_DBF_TEXT(4, trace, "notrdy"); | ||
686 | return; | ||
687 | } | ||
688 | if ((p_ch->irb->scsw.cmd.cstat & SCHN_STAT_PCI) && | ||
689 | (p_ch->irb->scsw.cmd.dstat == 0)) { | ||
690 | if (test_and_set_bit(CLAW_BH_ACTIVE, | ||
691 | (void *)&p_ch->flag_a) == 0) | ||
692 | tasklet_schedule(&p_ch->tasklet); | ||
823 | else | 693 | else |
824 | if (p_ch->flag == CLAW_WRITE) { | 694 | CLAW_DBF_TEXT(4, trace, "PCINoBH"); |
825 | p_ch->claw_state = CLAW_START_WRITE; | 695 | CLAW_DBF_TEXT(4, trace, "PCI_read"); |
826 | /* send SYSTEM_VALIDATE */ | 696 | return; |
827 | claw_strt_read(dev, LOCK_NO); | 697 | } |
828 | claw_send_control(dev, | 698 | if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || |
829 | SYSTEM_VALIDATE_REQUEST, | 699 | (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || |
830 | 0, 0, 0, | 700 | (p_ch->irb->scsw.cmd.stctl == |
831 | p_env->host_name, | 701 | (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { |
832 | p_env->adapter_name ); | 702 | CLAW_DBF_TEXT(4, trace, "SPend_rd"); |
833 | } else { | 703 | return; |
834 | printk(KERN_WARNING "claw: unsolicited " | 704 | } |
835 | "interrupt for device:" | 705 | clear_bit(0, (void *)&p_ch->IO_active); |
836 | "%s received c-%02x d-%02x\n", | 706 | claw_clearbit_busy(TB_RETRY, dev); |
837 | cdev->dev.bus_id, | 707 | if (test_and_set_bit(CLAW_BH_ACTIVE, |
838 | irb->scsw.cmd.cstat, | 708 | (void *)&p_ch->flag_a) == 0) |
839 | irb->scsw.cmd.dstat); | 709 | tasklet_schedule(&p_ch->tasklet); |
840 | return; | 710 | else |
841 | } | 711 | CLAW_DBF_TEXT(4, trace, "RdBHAct"); |
842 | #ifdef DEBUGMSG | 712 | CLAW_DBF_TEXT(4, trace, "RdIRQXit"); |
843 | printk(KERN_INFO "%s: process CLAW_STAT_HALT_IO exit\n", | 713 | return; |
844 | dev->name); | 714 | case CLAW_START_WRITE: |
845 | #endif | 715 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { |
846 | #ifdef FUNCTRACE | 716 | printk(KERN_INFO "%s: Unit Check Occured in " |
847 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 717 | "write channel\n", dev->name); |
848 | dev->name,__func__,__LINE__); | 718 | clear_bit(0, (void *)&p_ch->IO_active); |
849 | #endif | 719 | if (p_ch->irb->ecw[0] & 0x80) { |
850 | CLAW_DBF_TEXT(4,trace,"haltio"); | 720 | printk(KERN_INFO "%s: Resetting Event " |
851 | return; | 721 | "occurred:\n", dev->name); |
852 | case CLAW_START_READ: | 722 | init_timer(&p_ch->timer); |
853 | CLAW_DBF_TEXT(4,trace,"ReadIRQ"); | 723 | p_ch->timer.function = |
854 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { | 724 | (void *)claw_write_retry; |
855 | clear_bit(0, (void *)&p_ch->IO_active); | 725 | p_ch->timer.data = (unsigned long)p_ch; |
856 | if ((p_ch->irb->ecw[0] & 0x41) == 0x41 || | 726 | p_ch->timer.expires = jiffies + 10*HZ; |
857 | (p_ch->irb->ecw[0] & 0x40) == 0x40 || | 727 | add_timer(&p_ch->timer); |
858 | (p_ch->irb->ecw[0]) == 0) | 728 | printk(KERN_INFO "%s: write connection " |
859 | { | 729 | "restarting\n", dev->name); |
860 | privptr->stats.rx_errors++; | 730 | } |
861 | printk(KERN_INFO "%s: Restart is " | 731 | CLAW_DBF_TEXT(4, trace, "rstrtwrt"); |
862 | "required after remote " | 732 | return; |
863 | "side recovers \n", | 733 | } |
864 | dev->name); | 734 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) { |
865 | } | 735 | clear_bit(0, (void *)&p_ch->IO_active); |
866 | #ifdef FUNCTRACE | 736 | printk(KERN_INFO "%s: Unit Exception " |
867 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 737 | "Occured in write channel\n", |
868 | dev->name,__func__,__LINE__); | 738 | dev->name); |
869 | #endif | 739 | } |
870 | CLAW_DBF_TEXT(4,trace,"notrdy"); | 740 | if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || |
871 | return; | 741 | (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || |
872 | } | 742 | (p_ch->irb->scsw.cmd.stctl == |
873 | if ((p_ch->irb->scsw.cmd.cstat & SCHN_STAT_PCI) && | 743 | (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { |
874 | (p_ch->irb->scsw.cmd.dstat == 0)) { | 744 | CLAW_DBF_TEXT(4, trace, "writeUE"); |
875 | if (test_and_set_bit(CLAW_BH_ACTIVE, | 745 | return; |
876 | (void *)&p_ch->flag_a) == 0) { | 746 | } |
877 | tasklet_schedule(&p_ch->tasklet); | 747 | clear_bit(0, (void *)&p_ch->IO_active); |
878 | } | 748 | if (claw_test_and_setbit_busy(TB_TX, dev) == 0) { |
879 | else { | 749 | claw_write_next(p_ch); |
880 | CLAW_DBF_TEXT(4,trace,"PCINoBH"); | 750 | claw_clearbit_busy(TB_TX, dev); |
881 | } | 751 | claw_clear_busy(dev); |
882 | #ifdef FUNCTRACE | 752 | } |
883 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 753 | p_ch_r = (struct chbk *)&privptr->channel[READ]; |
884 | dev->name,__func__,__LINE__); | 754 | if (test_and_set_bit(CLAW_BH_ACTIVE, |
885 | #endif | 755 | (void *)&p_ch_r->flag_a) == 0) |
886 | CLAW_DBF_TEXT(4,trace,"PCI_read"); | 756 | tasklet_schedule(&p_ch_r->tasklet); |
887 | return; | 757 | CLAW_DBF_TEXT(4, trace, "StWtExit"); |
888 | } | 758 | return; |
889 | if (!((p_ch->irb->scsw.cmd.stctl & | 759 | default: |
890 | SCSW_STCTL_SEC_STATUS) || | 760 | printk(KERN_WARNING "%s: wrong selection code - irq " |
891 | (p_ch->irb->scsw.cmd.stctl == | 761 | "state=%d\n", dev->name, p_ch->claw_state); |
892 | SCSW_STCTL_STATUS_PEND) || | 762 | CLAW_DBF_TEXT(2, trace, "badIRQ"); |
893 | (p_ch->irb->scsw.cmd.stctl == | 763 | return; |
894 | (SCSW_STCTL_ALERT_STATUS | | ||
895 | SCSW_STCTL_STATUS_PEND)))) { | ||
896 | #ifdef FUNCTRACE | ||
897 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
898 | dev->name,__func__,__LINE__); | ||
899 | #endif | ||
900 | CLAW_DBF_TEXT(4,trace,"SPend_rd"); | ||
901 | return; | ||
902 | } | ||
903 | clear_bit(0, (void *)&p_ch->IO_active); | ||
904 | claw_clearbit_busy(TB_RETRY,dev); | ||
905 | if (test_and_set_bit(CLAW_BH_ACTIVE, | ||
906 | (void *)&p_ch->flag_a) == 0) { | ||
907 | tasklet_schedule(&p_ch->tasklet); | ||
908 | } | ||
909 | else { | ||
910 | CLAW_DBF_TEXT(4,trace,"RdBHAct"); | ||
911 | } | ||
912 | |||
913 | #ifdef DEBUGMSG | ||
914 | printk(KERN_INFO "%s: process CLAW_START_READ exit\n", | ||
915 | dev->name); | ||
916 | #endif | ||
917 | #ifdef FUNCTRACE | ||
918 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
919 | dev->name,__func__,__LINE__); | ||
920 | #endif | ||
921 | CLAW_DBF_TEXT(4,trace,"RdIRQXit"); | ||
922 | return; | ||
923 | case CLAW_START_WRITE: | ||
924 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { | ||
925 | printk(KERN_INFO "%s: Unit Check Occured in " | ||
926 | "write channel\n",dev->name); | ||
927 | clear_bit(0, (void *)&p_ch->IO_active); | ||
928 | if (p_ch->irb->ecw[0] & 0x80 ) { | ||
929 | printk(KERN_INFO "%s: Resetting Event " | ||
930 | "occurred:\n",dev->name); | ||
931 | init_timer(&p_ch->timer); | ||
932 | p_ch->timer.function = | ||
933 | (void *)claw_write_retry; | ||
934 | p_ch->timer.data = (unsigned long)p_ch; | ||
935 | p_ch->timer.expires = jiffies + 10*HZ; | ||
936 | add_timer(&p_ch->timer); | ||
937 | printk(KERN_INFO "%s: write connection " | ||
938 | "restarting\n",dev->name); | ||
939 | } | ||
940 | #ifdef FUNCTRACE | ||
941 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
942 | dev->name,__func__,__LINE__); | ||
943 | #endif | ||
944 | CLAW_DBF_TEXT(4,trace,"rstrtwrt"); | ||
945 | return; | ||
946 | } | ||
947 | if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) { | ||
948 | clear_bit(0, (void *)&p_ch->IO_active); | ||
949 | printk(KERN_INFO "%s: Unit Exception " | ||
950 | "Occured in write channel\n", | ||
951 | dev->name); | ||
952 | } | ||
953 | if (!((p_ch->irb->scsw.cmd.stctl & | ||
954 | SCSW_STCTL_SEC_STATUS) || | ||
955 | (p_ch->irb->scsw.cmd.stctl == | ||
956 | SCSW_STCTL_STATUS_PEND) || | ||
957 | (p_ch->irb->scsw.cmd.stctl == | ||
958 | (SCSW_STCTL_ALERT_STATUS | | ||
959 | SCSW_STCTL_STATUS_PEND)))) { | ||
960 | #ifdef FUNCTRACE | ||
961 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
962 | dev->name,__func__,__LINE__); | ||
963 | #endif | ||
964 | CLAW_DBF_TEXT(4,trace,"writeUE"); | ||
965 | return; | ||
966 | } | ||
967 | clear_bit(0, (void *)&p_ch->IO_active); | ||
968 | if (claw_test_and_setbit_busy(TB_TX,dev)==0) { | ||
969 | claw_write_next(p_ch); | ||
970 | claw_clearbit_busy(TB_TX,dev); | ||
971 | claw_clear_busy(dev); | ||
972 | } | ||
973 | p_ch_r=(struct chbk *)&privptr->channel[READ]; | ||
974 | if (test_and_set_bit(CLAW_BH_ACTIVE, | ||
975 | (void *)&p_ch_r->flag_a) == 0) { | ||
976 | tasklet_schedule(&p_ch_r->tasklet); | ||
977 | } | ||
978 | |||
979 | #ifdef DEBUGMSG | ||
980 | printk(KERN_INFO "%s: process CLAW_START_WRITE exit\n", | ||
981 | dev->name); | ||
982 | #endif | ||
983 | #ifdef FUNCTRACE | ||
984 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
985 | dev->name,__func__,__LINE__); | ||
986 | #endif | ||
987 | CLAW_DBF_TEXT(4,trace,"StWtExit"); | ||
988 | return; | ||
989 | default: | ||
990 | printk(KERN_WARNING "%s: wrong selection code - irq " | ||
991 | "state=%d\n",dev->name,p_ch->claw_state); | ||
992 | #ifdef FUNCTRACE | ||
993 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
994 | dev->name,__func__,__LINE__); | ||
995 | #endif | ||
996 | CLAW_DBF_TEXT(2,trace,"badIRQ"); | ||
997 | return; | ||
998 | } | 764 | } |
999 | 765 | ||
1000 | } /* end of claw_irq_handler */ | 766 | } /* end of claw_irq_handler */ |
@@ -1013,29 +779,11 @@ claw_irq_tasklet ( unsigned long data ) | |||
1013 | 779 | ||
1014 | p_ch = (struct chbk *) data; | 780 | p_ch = (struct chbk *) data; |
1015 | dev = (struct net_device *)p_ch->ndev; | 781 | dev = (struct net_device *)p_ch->ndev; |
1016 | #ifdef FUNCTRACE | 782 | CLAW_DBF_TEXT(4, trace, "IRQtask"); |
1017 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
1018 | #endif | ||
1019 | #ifdef DEBUGMSG | ||
1020 | printk(KERN_INFO "%s: variable p_ch =\n",dev->name); | ||
1021 | dumpit((char *) p_ch, sizeof(struct chbk)); | ||
1022 | #endif | ||
1023 | CLAW_DBF_TEXT(4,trace,"IRQtask"); | ||
1024 | |||
1025 | privptr = (struct claw_privbk *) dev->priv; | 783 | privptr = (struct claw_privbk *) dev->priv; |
1026 | |||
1027 | #ifdef DEBUGMSG | ||
1028 | printk(KERN_INFO "%s: bh routine - state-%02x\n" , | ||
1029 | dev->name, p_ch->claw_state); | ||
1030 | #endif | ||
1031 | |||
1032 | unpack_read(dev); | 784 | unpack_read(dev); |
1033 | clear_bit(CLAW_BH_ACTIVE, (void *)&p_ch->flag_a); | 785 | clear_bit(CLAW_BH_ACTIVE, (void *)&p_ch->flag_a); |
1034 | CLAW_DBF_TEXT(4,trace,"TskletXt"); | 786 | CLAW_DBF_TEXT(4, trace, "TskletXt"); |
1035 | #ifdef FUNCTRACE | ||
1036 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1037 | dev->name,__func__,__LINE__); | ||
1038 | #endif | ||
1039 | return; | 787 | return; |
1040 | } /* end of claw_irq_bh */ | 788 | } /* end of claw_irq_bh */ |
1041 | 789 | ||
@@ -1060,16 +808,7 @@ claw_release(struct net_device *dev) | |||
1060 | privptr = (struct claw_privbk *) dev->priv; | 808 | privptr = (struct claw_privbk *) dev->priv; |
1061 | if (!privptr) | 809 | if (!privptr) |
1062 | return 0; | 810 | return 0; |
1063 | #ifdef FUNCTRACE | 811 | CLAW_DBF_TEXT(4, trace, "release"); |
1064 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
1065 | #endif | ||
1066 | CLAW_DBF_TEXT(4,trace,"release"); | ||
1067 | #ifdef DEBUGMSG | ||
1068 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
1069 | dumpit((char *) dev, sizeof(struct net_device)); | ||
1070 | printk(KERN_INFO "Priv Buffalloc %d\n",privptr->buffs_alloc); | ||
1071 | printk(KERN_INFO "Priv p_buff_ccw = %p\n",&privptr->p_buff_ccw); | ||
1072 | #endif | ||
1073 | privptr->release_pend=1; | 812 | privptr->release_pend=1; |
1074 | claw_setbit_busy(TB_STOP,dev); | 813 | claw_setbit_busy(TB_STOP,dev); |
1075 | for ( i = 1; i >=0 ; i--) { | 814 | for ( i = 1; i >=0 ; i--) { |
@@ -1101,19 +840,15 @@ claw_release(struct net_device *dev) | |||
1101 | privptr->pk_skb = NULL; | 840 | privptr->pk_skb = NULL; |
1102 | } | 841 | } |
1103 | if(privptr->buffs_alloc != 1) { | 842 | if(privptr->buffs_alloc != 1) { |
1104 | #ifdef FUNCTRACE | 843 | CLAW_DBF_TEXT(4, trace, "none2fre"); |
1105 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1106 | dev->name,__func__,__LINE__); | ||
1107 | #endif | ||
1108 | CLAW_DBF_TEXT(4,trace,"none2fre"); | ||
1109 | return 0; | 844 | return 0; |
1110 | } | 845 | } |
1111 | CLAW_DBF_TEXT(4,trace,"freebufs"); | 846 | CLAW_DBF_TEXT(4, trace, "freebufs"); |
1112 | if (privptr->p_buff_ccw != NULL) { | 847 | if (privptr->p_buff_ccw != NULL) { |
1113 | free_pages((unsigned long)privptr->p_buff_ccw, | 848 | free_pages((unsigned long)privptr->p_buff_ccw, |
1114 | (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); | 849 | (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); |
1115 | } | 850 | } |
1116 | CLAW_DBF_TEXT(4,trace,"freeread"); | 851 | CLAW_DBF_TEXT(4, trace, "freeread"); |
1117 | if (privptr->p_env->read_size < PAGE_SIZE) { | 852 | if (privptr->p_env->read_size < PAGE_SIZE) { |
1118 | if (privptr->p_buff_read != NULL) { | 853 | if (privptr->p_buff_read != NULL) { |
1119 | free_pages((unsigned long)privptr->p_buff_read, | 854 | free_pages((unsigned long)privptr->p_buff_read, |
@@ -1129,7 +864,7 @@ claw_release(struct net_device *dev) | |||
1129 | p_buf=p_buf->next; | 864 | p_buf=p_buf->next; |
1130 | } | 865 | } |
1131 | } | 866 | } |
1132 | CLAW_DBF_TEXT(4,trace,"freewrit"); | 867 | CLAW_DBF_TEXT(4, trace, "freewrit"); |
1133 | if (privptr->p_env->write_size < PAGE_SIZE ) { | 868 | if (privptr->p_env->write_size < PAGE_SIZE ) { |
1134 | free_pages((unsigned long)privptr->p_buff_write, | 869 | free_pages((unsigned long)privptr->p_buff_write, |
1135 | (int)pages_to_order_of_mag(privptr->p_buff_write_num)); | 870 | (int)pages_to_order_of_mag(privptr->p_buff_write_num)); |
@@ -1143,7 +878,7 @@ claw_release(struct net_device *dev) | |||
1143 | p_buf=p_buf->next; | 878 | p_buf=p_buf->next; |
1144 | } | 879 | } |
1145 | } | 880 | } |
1146 | CLAW_DBF_TEXT(4,trace,"clearptr"); | 881 | CLAW_DBF_TEXT(4, trace, "clearptr"); |
1147 | privptr->buffs_alloc = 0; | 882 | privptr->buffs_alloc = 0; |
1148 | privptr->p_buff_ccw=NULL; | 883 | privptr->p_buff_ccw=NULL; |
1149 | privptr->p_buff_read=NULL; | 884 | privptr->p_buff_read=NULL; |
@@ -1180,18 +915,12 @@ claw_release(struct net_device *dev) | |||
1180 | dev->name, | 915 | dev->name, |
1181 | privptr->channel[READ].last_dstat, | 916 | privptr->channel[READ].last_dstat, |
1182 | privptr->channel[WRITE].last_dstat); | 917 | privptr->channel[WRITE].last_dstat); |
1183 | CLAW_DBF_TEXT(2,trace,"badclose"); | 918 | CLAW_DBF_TEXT(2, trace, "badclose"); |
1184 | } | 919 | } |
1185 | #ifdef FUNCTRACE | 920 | CLAW_DBF_TEXT(4, trace, "rlsexit"); |
1186 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1187 | dev->name,__func__,__LINE__); | ||
1188 | #endif | ||
1189 | CLAW_DBF_TEXT(4,trace,"rlsexit"); | ||
1190 | return 0; | 921 | return 0; |
1191 | } /* end of claw_release */ | 922 | } /* end of claw_release */ |
1192 | 923 | ||
1193 | |||
1194 | |||
1195 | /*-------------------------------------------------------------------* | 924 | /*-------------------------------------------------------------------* |
1196 | * claw_write_retry * | 925 | * claw_write_retry * |
1197 | * * | 926 | * * |
@@ -1203,32 +932,12 @@ claw_write_retry ( struct chbk *p_ch ) | |||
1203 | 932 | ||
1204 | struct net_device *dev=p_ch->ndev; | 933 | struct net_device *dev=p_ch->ndev; |
1205 | 934 | ||
1206 | 935 | CLAW_DBF_TEXT(4, trace, "w_retry"); | |
1207 | #ifdef FUNCTRACE | ||
1208 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
1209 | printk(KERN_INFO "claw: variable p_ch =\n"); | ||
1210 | dumpit((char *) p_ch, sizeof(struct chbk)); | ||
1211 | #endif | ||
1212 | CLAW_DBF_TEXT(4,trace,"w_retry"); | ||
1213 | if (p_ch->claw_state == CLAW_STOP) { | 936 | if (p_ch->claw_state == CLAW_STOP) { |
1214 | #ifdef FUNCTRACE | ||
1215 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1216 | dev->name,__func__,__LINE__); | ||
1217 | #endif | ||
1218 | return; | 937 | return; |
1219 | } | 938 | } |
1220 | #ifdef DEBUGMSG | ||
1221 | printk( KERN_INFO "%s:%s state-%02x\n" , | ||
1222 | dev->name, | ||
1223 | __func__, | ||
1224 | p_ch->claw_state); | ||
1225 | #endif | ||
1226 | claw_strt_out_IO( dev ); | 939 | claw_strt_out_IO( dev ); |
1227 | #ifdef FUNCTRACE | 940 | CLAW_DBF_TEXT(4, trace, "rtry_xit"); |
1228 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1229 | dev->name,__func__,__LINE__); | ||
1230 | #endif | ||
1231 | CLAW_DBF_TEXT(4,trace,"rtry_xit"); | ||
1232 | return; | 941 | return; |
1233 | } /* end of claw_write_retry */ | 942 | } /* end of claw_write_retry */ |
1234 | 943 | ||
@@ -1247,12 +956,7 @@ claw_write_next ( struct chbk * p_ch ) | |||
1247 | struct sk_buff *pk_skb; | 956 | struct sk_buff *pk_skb; |
1248 | int rc; | 957 | int rc; |
1249 | 958 | ||
1250 | #ifdef FUNCTRACE | 959 | CLAW_DBF_TEXT(4, trace, "claw_wrt"); |
1251 | printk(KERN_INFO "%s:%s Enter \n",p_ch->ndev->name,__func__); | ||
1252 | printk(KERN_INFO "%s: variable p_ch =\n",p_ch->ndev->name); | ||
1253 | dumpit((char *) p_ch, sizeof(struct chbk)); | ||
1254 | #endif | ||
1255 | CLAW_DBF_TEXT(4,trace,"claw_wrt"); | ||
1256 | if (p_ch->claw_state == CLAW_STOP) | 960 | if (p_ch->claw_state == CLAW_STOP) |
1257 | return; | 961 | return; |
1258 | dev = (struct net_device *) p_ch->ndev; | 962 | dev = (struct net_device *) p_ch->ndev; |
@@ -1272,11 +976,6 @@ claw_write_next ( struct chbk * p_ch ) | |||
1272 | if (privptr->p_write_active_first!=NULL) { | 976 | if (privptr->p_write_active_first!=NULL) { |
1273 | claw_strt_out_IO(dev); | 977 | claw_strt_out_IO(dev); |
1274 | } | 978 | } |
1275 | |||
1276 | #ifdef FUNCTRACE | ||
1277 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1278 | dev->name,__func__,__LINE__); | ||
1279 | #endif | ||
1280 | return; | 979 | return; |
1281 | } /* end of claw_write_next */ | 980 | } /* end of claw_write_next */ |
1282 | 981 | ||
@@ -1288,22 +987,12 @@ claw_write_next ( struct chbk * p_ch ) | |||
1288 | static void | 987 | static void |
1289 | claw_timer ( struct chbk * p_ch ) | 988 | claw_timer ( struct chbk * p_ch ) |
1290 | { | 989 | { |
1291 | #ifdef FUNCTRACE | 990 | CLAW_DBF_TEXT(4, trace, "timer"); |
1292 | printk(KERN_INFO "%s:%s Entry\n",p_ch->ndev->name,__func__); | ||
1293 | printk(KERN_INFO "%s: variable p_ch =\n",p_ch->ndev->name); | ||
1294 | dumpit((char *) p_ch, sizeof(struct chbk)); | ||
1295 | #endif | ||
1296 | CLAW_DBF_TEXT(4,trace,"timer"); | ||
1297 | p_ch->flag |= CLAW_TIMER; | 991 | p_ch->flag |= CLAW_TIMER; |
1298 | wake_up(&p_ch->wait); | 992 | wake_up(&p_ch->wait); |
1299 | #ifdef FUNCTRACE | ||
1300 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1301 | p_ch->ndev->name,__func__,__LINE__); | ||
1302 | #endif | ||
1303 | return; | 993 | return; |
1304 | } /* end of claw_timer */ | 994 | } /* end of claw_timer */ |
1305 | 995 | ||
1306 | |||
1307 | /* | 996 | /* |
1308 | * | 997 | * |
1309 | * functions | 998 | * functions |
@@ -1324,10 +1013,8 @@ pages_to_order_of_mag(int num_of_pages) | |||
1324 | { | 1013 | { |
1325 | int order_of_mag=1; /* assume 2 pages */ | 1014 | int order_of_mag=1; /* assume 2 pages */ |
1326 | int nump=2; | 1015 | int nump=2; |
1327 | #ifdef FUNCTRACE | 1016 | |
1328 | printk(KERN_INFO "%s Enter pages = %d \n",__func__,num_of_pages); | 1017 | CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages); |
1329 | #endif | ||
1330 | CLAW_DBF_TEXT_(5,trace,"pages%d",num_of_pages); | ||
1331 | if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ | 1018 | if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ |
1332 | /* 512 pages = 2Meg on 4k page systems */ | 1019 | /* 512 pages = 2Meg on 4k page systems */ |
1333 | if (num_of_pages >= 512) {return 9; } | 1020 | if (num_of_pages >= 512) {return 9; } |
@@ -1338,11 +1025,7 @@ pages_to_order_of_mag(int num_of_pages) | |||
1338 | order_of_mag +=1; | 1025 | order_of_mag +=1; |
1339 | } | 1026 | } |
1340 | if (order_of_mag > 9) { order_of_mag = 9; } /* I know it's paranoid */ | 1027 | if (order_of_mag > 9) { order_of_mag = 9; } /* I know it's paranoid */ |
1341 | #ifdef FUNCTRACE | 1028 | CLAW_DBF_TEXT_(5, trace, "mag%d", order_of_mag); |
1342 | printk(KERN_INFO "%s Exit on line %d, order = %d\n", | ||
1343 | __func__,__LINE__, order_of_mag); | ||
1344 | #endif | ||
1345 | CLAW_DBF_TEXT_(5,trace,"mag%d",order_of_mag); | ||
1346 | return order_of_mag; | 1029 | return order_of_mag; |
1347 | } | 1030 | } |
1348 | 1031 | ||
@@ -1358,21 +1041,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
1358 | struct claw_privbk *privptr; | 1041 | struct claw_privbk *privptr; |
1359 | struct ccw1 temp_ccw; | 1042 | struct ccw1 temp_ccw; |
1360 | struct endccw * p_end; | 1043 | struct endccw * p_end; |
1361 | #ifdef IOTRACE | 1044 | CLAW_DBF_TEXT(4, trace, "addreads"); |
1362 | struct ccwbk* p_buf; | ||
1363 | #endif | ||
1364 | #ifdef FUNCTRACE | ||
1365 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
1366 | #endif | ||
1367 | #ifdef DEBUGMSG | ||
1368 | printk(KERN_INFO "dev\n"); | ||
1369 | dumpit((char *) dev, sizeof(struct net_device)); | ||
1370 | printk(KERN_INFO "p_first\n"); | ||
1371 | dumpit((char *) p_first, sizeof(struct ccwbk)); | ||
1372 | printk(KERN_INFO "p_last\n"); | ||
1373 | dumpit((char *) p_last, sizeof(struct ccwbk)); | ||
1374 | #endif | ||
1375 | CLAW_DBF_TEXT(4,trace,"addreads"); | ||
1376 | privptr = dev->priv; | 1045 | privptr = dev->priv; |
1377 | p_end = privptr->p_end_ccw; | 1046 | p_end = privptr->p_end_ccw; |
1378 | 1047 | ||
@@ -1380,11 +1049,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
1380 | * to apend the running channel programs | 1049 | * to apend the running channel programs |
1381 | */ | 1050 | */ |
1382 | if ( p_first==NULL) { | 1051 | if ( p_first==NULL) { |
1383 | #ifdef FUNCTRACE | 1052 | CLAW_DBF_TEXT(4, trace, "addexit"); |
1384 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1385 | dev->name,__func__,__LINE__); | ||
1386 | #endif | ||
1387 | CLAW_DBF_TEXT(4,trace,"addexit"); | ||
1388 | return 0; | 1053 | return 0; |
1389 | } | 1054 | } |
1390 | 1055 | ||
@@ -1411,21 +1076,11 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
1411 | } | 1076 | } |
1412 | 1077 | ||
1413 | if ( privptr-> p_read_active_first ==NULL ) { | 1078 | if ( privptr-> p_read_active_first ==NULL ) { |
1414 | #ifdef DEBUGMSG | ||
1415 | printk(KERN_INFO "%s:%s p_read_active_first == NULL \n", | ||
1416 | dev->name,__func__); | ||
1417 | printk(KERN_INFO "%s:%s Read active first/last changed \n", | ||
1418 | dev->name,__func__); | ||
1419 | #endif | ||
1420 | privptr-> p_read_active_first= p_first; /* set new first */ | 1079 | privptr-> p_read_active_first= p_first; /* set new first */ |
1421 | privptr-> p_read_active_last = p_last; /* set new last */ | 1080 | privptr-> p_read_active_last = p_last; /* set new last */ |
1422 | } | 1081 | } |
1423 | else { | 1082 | else { |
1424 | 1083 | ||
1425 | #ifdef DEBUGMSG | ||
1426 | printk(KERN_INFO "%s:%s Read in progress \n", | ||
1427 | dev->name,__func__); | ||
1428 | #endif | ||
1429 | /* set up TIC ccw */ | 1084 | /* set up TIC ccw */ |
1430 | temp_ccw.cda= (__u32)__pa(&p_first->read); | 1085 | temp_ccw.cda= (__u32)__pa(&p_first->read); |
1431 | temp_ccw.count=0; | 1086 | temp_ccw.count=0; |
@@ -1462,27 +1117,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
1462 | privptr->p_read_active_last->next = p_first; | 1117 | privptr->p_read_active_last->next = p_first; |
1463 | privptr->p_read_active_last=p_last; | 1118 | privptr->p_read_active_last=p_last; |
1464 | } /* end of if ( privptr-> p_read_active_first ==NULL) */ | 1119 | } /* end of if ( privptr-> p_read_active_first ==NULL) */ |
1465 | #ifdef IOTRACE | 1120 | CLAW_DBF_TEXT(4, trace, "addexit"); |
1466 | printk(KERN_INFO "%s:%s dump p_last CCW BK \n",dev->name,__func__); | ||
1467 | dumpit((char *)p_last, sizeof(struct ccwbk)); | ||
1468 | printk(KERN_INFO "%s:%s dump p_end CCW BK \n",dev->name,__func__); | ||
1469 | dumpit((char *)p_end, sizeof(struct endccw)); | ||
1470 | |||
1471 | printk(KERN_INFO "%s:%s dump p_first CCW BK \n",dev->name,__func__); | ||
1472 | dumpit((char *)p_first, sizeof(struct ccwbk)); | ||
1473 | printk(KERN_INFO "%s:%s Dump Active CCW chain \n", | ||
1474 | dev->name,__func__); | ||
1475 | p_buf=privptr->p_read_active_first; | ||
1476 | while (p_buf!=NULL) { | ||
1477 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
1478 | p_buf=p_buf->next; | ||
1479 | } | ||
1480 | #endif | ||
1481 | #ifdef FUNCTRACE | ||
1482 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1483 | dev->name,__func__,__LINE__); | ||
1484 | #endif | ||
1485 | CLAW_DBF_TEXT(4,trace,"addexit"); | ||
1486 | return 0; | 1121 | return 0; |
1487 | } /* end of add_claw_reads */ | 1122 | } /* end of add_claw_reads */ |
1488 | 1123 | ||
@@ -1494,44 +1129,29 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
1494 | static void | 1129 | static void |
1495 | ccw_check_return_code(struct ccw_device *cdev, int return_code) | 1130 | ccw_check_return_code(struct ccw_device *cdev, int return_code) |
1496 | { | 1131 | { |
1497 | #ifdef FUNCTRACE | 1132 | CLAW_DBF_TEXT(4, trace, "ccwret"); |
1498 | printk(KERN_INFO "%s: %s() > enter \n", | ||
1499 | cdev->dev.bus_id,__func__); | ||
1500 | #endif | ||
1501 | CLAW_DBF_TEXT(4,trace,"ccwret"); | ||
1502 | #ifdef DEBUGMSG | ||
1503 | printk(KERN_INFO "variable cdev =\n"); | ||
1504 | dumpit((char *) cdev, sizeof(struct ccw_device)); | ||
1505 | printk(KERN_INFO "variable return_code = %d\n",return_code); | ||
1506 | #endif | ||
1507 | if (return_code != 0) { | 1133 | if (return_code != 0) { |
1508 | switch (return_code) { | 1134 | switch (return_code) { |
1509 | case -EBUSY: | 1135 | case -EBUSY: /* BUSY is a transient state no action needed */ |
1510 | printk(KERN_INFO "%s: Busy !\n", | 1136 | break; |
1511 | cdev->dev.bus_id); | 1137 | case -ENODEV: |
1512 | break; | 1138 | printk(KERN_EMERG "%s: Missing device called " |
1513 | case -ENODEV: | 1139 | "for IO ENODEV\n", cdev->dev.bus_id); |
1514 | printk(KERN_EMERG "%s: Missing device called " | 1140 | break; |
1515 | "for IO ENODEV\n", cdev->dev.bus_id); | 1141 | case -EIO: |
1516 | break; | 1142 | printk(KERN_EMERG "%s: Status pending... EIO \n", |
1517 | case -EIO: | 1143 | cdev->dev.bus_id); |
1518 | printk(KERN_EMERG "%s: Status pending... EIO \n", | 1144 | break; |
1519 | cdev->dev.bus_id); | 1145 | case -EINVAL: |
1520 | break; | 1146 | printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", |
1521 | case -EINVAL: | 1147 | cdev->dev.bus_id); |
1522 | printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", | 1148 | break; |
1523 | cdev->dev.bus_id); | 1149 | default: |
1524 | break; | 1150 | printk(KERN_EMERG "%s: Unknown error in " |
1525 | default: | ||
1526 | printk(KERN_EMERG "%s: Unknown error in " | ||
1527 | "Do_IO %d\n",cdev->dev.bus_id, return_code); | 1151 | "Do_IO %d\n",cdev->dev.bus_id, return_code); |
1528 | } | 1152 | } |
1529 | } | 1153 | } |
1530 | #ifdef FUNCTRACE | 1154 | CLAW_DBF_TEXT(4, trace, "ccwret"); |
1531 | printk(KERN_INFO "%s: %s() > exit on line %d\n", | ||
1532 | cdev->dev.bus_id,__func__,__LINE__); | ||
1533 | #endif | ||
1534 | CLAW_DBF_TEXT(4,trace,"ccwret"); | ||
1535 | } /* end of ccw_check_return_code */ | 1155 | } /* end of ccw_check_return_code */ |
1536 | 1156 | ||
1537 | /*-------------------------------------------------------------------* | 1157 | /*-------------------------------------------------------------------* |
@@ -1541,173 +1161,46 @@ ccw_check_return_code(struct ccw_device *cdev, int return_code) | |||
1541 | static void | 1161 | static void |
1542 | ccw_check_unit_check(struct chbk * p_ch, unsigned char sense ) | 1162 | ccw_check_unit_check(struct chbk * p_ch, unsigned char sense ) |
1543 | { | 1163 | { |
1544 | struct net_device *dev = p_ch->ndev; | 1164 | struct net_device *ndev = p_ch->ndev; |
1545 | |||
1546 | #ifdef FUNCTRACE | ||
1547 | printk(KERN_INFO "%s: %s() > enter\n",dev->name,__func__); | ||
1548 | #endif | ||
1549 | #ifdef DEBUGMSG | ||
1550 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
1551 | dumpit((char *)dev, sizeof(struct net_device)); | ||
1552 | printk(KERN_INFO "%s: variable sense =\n",dev->name); | ||
1553 | dumpit((char *)&sense, 2); | ||
1554 | #endif | ||
1555 | CLAW_DBF_TEXT(4,trace,"unitchek"); | ||
1556 | 1165 | ||
1166 | CLAW_DBF_TEXT(4, trace, "unitchek"); | ||
1557 | printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n", | 1167 | printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n", |
1558 | dev->name, sense); | 1168 | ndev->name, sense); |
1559 | 1169 | ||
1560 | if (sense & 0x40) { | 1170 | if (sense & 0x40) { |
1561 | if (sense & 0x01) { | 1171 | if (sense & 0x01) { |
1562 | printk(KERN_WARNING "%s: Interface disconnect or " | 1172 | printk(KERN_WARNING "%s: Interface disconnect or " |
1563 | "Selective reset " | 1173 | "Selective reset " |
1564 | "occurred (remote side)\n", dev->name); | 1174 | "occurred (remote side)\n", ndev->name); |
1565 | } | 1175 | } |
1566 | else { | 1176 | else { |
1567 | printk(KERN_WARNING "%s: System reset occured" | 1177 | printk(KERN_WARNING "%s: System reset occured" |
1568 | " (remote side)\n", dev->name); | 1178 | " (remote side)\n", ndev->name); |
1569 | } | 1179 | } |
1570 | } | 1180 | } |
1571 | else if (sense & 0x20) { | 1181 | else if (sense & 0x20) { |
1572 | if (sense & 0x04) { | 1182 | if (sense & 0x04) { |
1573 | printk(KERN_WARNING "%s: Data-streaming " | 1183 | printk(KERN_WARNING "%s: Data-streaming " |
1574 | "timeout)\n", dev->name); | 1184 | "timeout)\n", ndev->name); |
1575 | } | 1185 | } |
1576 | else { | 1186 | else { |
1577 | printk(KERN_WARNING "%s: Data-transfer parity" | 1187 | printk(KERN_WARNING "%s: Data-transfer parity" |
1578 | " error\n", dev->name); | 1188 | " error\n", ndev->name); |
1579 | } | 1189 | } |
1580 | } | 1190 | } |
1581 | else if (sense & 0x10) { | 1191 | else if (sense & 0x10) { |
1582 | if (sense & 0x20) { | 1192 | if (sense & 0x20) { |
1583 | printk(KERN_WARNING "%s: Hardware malfunction " | 1193 | printk(KERN_WARNING "%s: Hardware malfunction " |
1584 | "(remote side)\n", dev->name); | 1194 | "(remote side)\n", ndev->name); |
1585 | } | 1195 | } |
1586 | else { | 1196 | else { |
1587 | printk(KERN_WARNING "%s: read-data parity error " | 1197 | printk(KERN_WARNING "%s: read-data parity error " |
1588 | "(remote side)\n", dev->name); | 1198 | "(remote side)\n", ndev->name); |
1589 | } | 1199 | } |
1590 | } | 1200 | } |
1591 | 1201 | ||
1592 | #ifdef FUNCTRACE | ||
1593 | printk(KERN_INFO "%s: %s() exit on line %d\n", | ||
1594 | dev->name,__func__,__LINE__); | ||
1595 | #endif | ||
1596 | } /* end of ccw_check_unit_check */ | 1202 | } /* end of ccw_check_unit_check */ |
1597 | 1203 | ||
1598 | |||
1599 | |||
1600 | /*-------------------------------------------------------------------* | ||
1601 | * Dump buffer format * | ||
1602 | * * | ||
1603 | *--------------------------------------------------------------------*/ | ||
1604 | #ifdef DEBUG | ||
1605 | static void | ||
1606 | dumpit(char* buf, int len) | ||
1607 | { | ||
1608 | |||
1609 | __u32 ct, sw, rm, dup; | ||
1610 | char *ptr, *rptr; | ||
1611 | char tbuf[82], tdup[82]; | ||
1612 | #if (CONFIG_64BIT) | ||
1613 | char addr[22]; | ||
1614 | #else | ||
1615 | char addr[12]; | ||
1616 | #endif | ||
1617 | char boff[12]; | ||
1618 | char bhex[82], duphex[82]; | ||
1619 | char basc[40]; | ||
1620 | |||
1621 | sw = 0; | ||
1622 | rptr =ptr=buf; | ||
1623 | rm = 16; | ||
1624 | duphex[0] = 0x00; | ||
1625 | dup = 0; | ||
1626 | for ( ct=0; ct < len; ct++, ptr++, rptr++ ) { | ||
1627 | if (sw == 0) { | ||
1628 | #if (CONFIG_64BIT) | ||
1629 | sprintf(addr, "%16.16lX",(unsigned long)rptr); | ||
1630 | #else | ||
1631 | sprintf(addr, "%8.8X",(__u32)rptr); | ||
1632 | #endif | ||
1633 | sprintf(boff, "%4.4X", (__u32)ct); | ||
1634 | bhex[0] = '\0'; | ||
1635 | basc[0] = '\0'; | ||
1636 | } | ||
1637 | if ((sw == 4) || (sw == 12)) { | ||
1638 | strcat(bhex, " "); | ||
1639 | } | ||
1640 | if (sw == 8) { | ||
1641 | strcat(bhex, " "); | ||
1642 | } | ||
1643 | #if (CONFIG_64BIT) | ||
1644 | sprintf(tbuf,"%2.2lX", (unsigned long)*ptr); | ||
1645 | #else | ||
1646 | sprintf(tbuf,"%2.2X", (__u32)*ptr); | ||
1647 | #endif | ||
1648 | tbuf[2] = '\0'; | ||
1649 | strcat(bhex, tbuf); | ||
1650 | if ((0!=isprint(*ptr)) && (*ptr >= 0x20)) { | ||
1651 | basc[sw] = *ptr; | ||
1652 | } | ||
1653 | else { | ||
1654 | basc[sw] = '.'; | ||
1655 | } | ||
1656 | basc[sw+1] = '\0'; | ||
1657 | sw++; | ||
1658 | rm--; | ||
1659 | if (sw==16) { | ||
1660 | if ((strcmp(duphex, bhex)) !=0) { | ||
1661 | if (dup !=0) { | ||
1662 | sprintf(tdup,"Duplicate as above to" | ||
1663 | " %s", addr); | ||
1664 | printk( KERN_INFO " " | ||
1665 | " --- %s ---\n",tdup); | ||
1666 | } | ||
1667 | printk( KERN_INFO " %s (+%s) : %s [%s]\n", | ||
1668 | addr, boff, bhex, basc); | ||
1669 | dup = 0; | ||
1670 | strcpy(duphex, bhex); | ||
1671 | } | ||
1672 | else { | ||
1673 | dup++; | ||
1674 | } | ||
1675 | sw = 0; | ||
1676 | rm = 16; | ||
1677 | } | ||
1678 | } /* endfor */ | ||
1679 | |||
1680 | if (sw != 0) { | ||
1681 | for ( ; rm > 0; rm--, sw++ ) { | ||
1682 | if ((sw==4) || (sw==12)) strcat(bhex, " "); | ||
1683 | if (sw==8) strcat(bhex, " "); | ||
1684 | strcat(bhex, " "); | ||
1685 | strcat(basc, " "); | ||
1686 | } | ||
1687 | if (dup !=0) { | ||
1688 | sprintf(tdup,"Duplicate as above to %s", addr); | ||
1689 | printk( KERN_INFO " --- %s ---\n", | ||
1690 | tdup); | ||
1691 | } | ||
1692 | printk( KERN_INFO " %s (+%s) : %s [%s]\n", | ||
1693 | addr, boff, bhex, basc); | ||
1694 | } | ||
1695 | else { | ||
1696 | if (dup >=1) { | ||
1697 | sprintf(tdup,"Duplicate as above to %s", addr); | ||
1698 | printk( KERN_INFO " --- %s ---\n", | ||
1699 | tdup); | ||
1700 | } | ||
1701 | if (dup !=0) { | ||
1702 | printk( KERN_INFO " %s (+%s) : %s [%s]\n", | ||
1703 | addr, boff, bhex, basc); | ||
1704 | } | ||
1705 | } | ||
1706 | return; | ||
1707 | |||
1708 | } /* end of dumpit */ | ||
1709 | #endif | ||
1710 | |||
1711 | /*-------------------------------------------------------------------* | 1204 | /*-------------------------------------------------------------------* |
1712 | * find_link * | 1205 | * find_link * |
1713 | *--------------------------------------------------------------------*/ | 1206 | *--------------------------------------------------------------------*/ |
@@ -1718,16 +1211,7 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) | |||
1718 | struct claw_env *p_env; | 1211 | struct claw_env *p_env; |
1719 | int rc=0; | 1212 | int rc=0; |
1720 | 1213 | ||
1721 | #ifdef FUNCTRACE | 1214 | CLAW_DBF_TEXT(2, setup, "findlink"); |
1722 | printk(KERN_INFO "%s:%s > enter \n",dev->name,__func__); | ||
1723 | #endif | ||
1724 | CLAW_DBF_TEXT(2,setup,"findlink"); | ||
1725 | #ifdef DEBUGMSG | ||
1726 | printk(KERN_INFO "%s: variable dev = \n",dev->name); | ||
1727 | dumpit((char *) dev, sizeof(struct net_device)); | ||
1728 | printk(KERN_INFO "%s: variable host_name = %s\n",dev->name, host_name); | ||
1729 | printk(KERN_INFO "%s: variable ws_name = %s\n",dev->name, ws_name); | ||
1730 | #endif | ||
1731 | privptr=dev->priv; | 1215 | privptr=dev->priv; |
1732 | p_env=privptr->p_env; | 1216 | p_env=privptr->p_env; |
1733 | switch (p_env->packing) | 1217 | switch (p_env->packing) |
@@ -1750,10 +1234,6 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) | |||
1750 | break; | 1234 | break; |
1751 | } | 1235 | } |
1752 | 1236 | ||
1753 | #ifdef FUNCTRACE | ||
1754 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
1755 | dev->name,__func__,__LINE__); | ||
1756 | #endif | ||
1757 | return 0; | 1237 | return 0; |
1758 | } /* end of find_link */ | 1238 | } /* end of find_link */ |
1759 | 1239 | ||
@@ -1782,27 +1262,11 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1782 | int lock; | 1262 | int lock; |
1783 | struct clawph *pk_head; | 1263 | struct clawph *pk_head; |
1784 | struct chbk *ch; | 1264 | struct chbk *ch; |
1785 | #ifdef IOTRACE | 1265 | |
1786 | struct ccwbk *p_buf; | 1266 | CLAW_DBF_TEXT(4, trace, "hw_tx"); |
1787 | #endif | ||
1788 | #ifdef FUNCTRACE | ||
1789 | printk(KERN_INFO "%s: %s() > enter\n",dev->name,__func__); | ||
1790 | #endif | ||
1791 | CLAW_DBF_TEXT(4,trace,"hw_tx"); | ||
1792 | #ifdef DEBUGMSG | ||
1793 | printk(KERN_INFO "%s: variable dev skb =\n",dev->name); | ||
1794 | dumpit((char *) skb, sizeof(struct sk_buff)); | ||
1795 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
1796 | dumpit((char *) dev, sizeof(struct net_device)); | ||
1797 | printk(KERN_INFO "%s: variable linkid = %ld\n",dev->name,linkid); | ||
1798 | #endif | ||
1799 | privptr = (struct claw_privbk *) (dev->priv); | 1267 | privptr = (struct claw_privbk *) (dev->priv); |
1800 | p_ch=(struct chbk *)&privptr->channel[WRITE]; | 1268 | p_ch=(struct chbk *)&privptr->channel[WRITE]; |
1801 | p_env =privptr->p_env; | 1269 | p_env =privptr->p_env; |
1802 | #ifdef IOTRACE | ||
1803 | printk(KERN_INFO "%s: %s() dump sk_buff \n",dev->name,__func__); | ||
1804 | dumpit((char *)skb ,sizeof(struct sk_buff)); | ||
1805 | #endif | ||
1806 | claw_free_wrt_buf(dev); /* Clean up free chain if posible */ | 1270 | claw_free_wrt_buf(dev); /* Clean up free chain if posible */ |
1807 | /* scan the write queue to free any completed write packets */ | 1271 | /* scan the write queue to free any completed write packets */ |
1808 | p_first_ccw=NULL; | 1272 | p_first_ccw=NULL; |
@@ -1834,11 +1298,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1834 | claw_strt_out_IO(dev ); | 1298 | claw_strt_out_IO(dev ); |
1835 | claw_free_wrt_buf( dev ); | 1299 | claw_free_wrt_buf( dev ); |
1836 | if (privptr->write_free_count==0) { | 1300 | if (privptr->write_free_count==0) { |
1837 | #ifdef IOTRACE | ||
1838 | printk(KERN_INFO "%s: " | ||
1839 | "(claw_check_busy) no free write " | ||
1840 | "buffers\n", dev->name); | ||
1841 | #endif | ||
1842 | ch = &privptr->channel[WRITE]; | 1301 | ch = &privptr->channel[WRITE]; |
1843 | atomic_inc(&skb->users); | 1302 | atomic_inc(&skb->users); |
1844 | skb_queue_tail(&ch->collect_queue, skb); | 1303 | skb_queue_tail(&ch->collect_queue, skb); |
@@ -1851,10 +1310,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1851 | } | 1310 | } |
1852 | /* tx lock */ | 1311 | /* tx lock */ |
1853 | if (claw_test_and_setbit_busy(TB_TX,dev)) { /* set to busy */ | 1312 | if (claw_test_and_setbit_busy(TB_TX,dev)) { /* set to busy */ |
1854 | #ifdef DEBUGMSG | ||
1855 | printk(KERN_INFO "%s: busy (claw_test_and_setbit_" | ||
1856 | "busy)\n", dev->name); | ||
1857 | #endif | ||
1858 | ch = &privptr->channel[WRITE]; | 1313 | ch = &privptr->channel[WRITE]; |
1859 | atomic_inc(&skb->users); | 1314 | atomic_inc(&skb->users); |
1860 | skb_queue_tail(&ch->collect_queue, skb); | 1315 | skb_queue_tail(&ch->collect_queue, skb); |
@@ -1871,28 +1326,16 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1871 | privptr->p_write_free_chain == NULL ) { | 1326 | privptr->p_write_free_chain == NULL ) { |
1872 | 1327 | ||
1873 | claw_setbit_busy(TB_NOBUFFER,dev); | 1328 | claw_setbit_busy(TB_NOBUFFER,dev); |
1874 | |||
1875 | #ifdef DEBUGMSG | ||
1876 | printk(KERN_INFO "%s: busy (claw_setbit_busy" | ||
1877 | "(TB_NOBUFFER))\n", dev->name); | ||
1878 | printk(KERN_INFO " free_count: %d, numBuffers : %d\n", | ||
1879 | (int)privptr->write_free_count,(int) numBuffers ); | ||
1880 | #endif | ||
1881 | ch = &privptr->channel[WRITE]; | 1329 | ch = &privptr->channel[WRITE]; |
1882 | atomic_inc(&skb->users); | 1330 | atomic_inc(&skb->users); |
1883 | skb_queue_tail(&ch->collect_queue, skb); | 1331 | skb_queue_tail(&ch->collect_queue, skb); |
1884 | CLAW_DBF_TEXT(2,trace,"clawbusy"); | 1332 | CLAW_DBF_TEXT(2, trace, "clawbusy"); |
1885 | goto Done2; | 1333 | goto Done2; |
1886 | } | 1334 | } |
1887 | pDataAddress=skb->data; | 1335 | pDataAddress=skb->data; |
1888 | len_of_data=skb->len; | 1336 | len_of_data=skb->len; |
1889 | 1337 | ||
1890 | while (len_of_data > 0) { | 1338 | while (len_of_data > 0) { |
1891 | #ifdef DEBUGMSG | ||
1892 | printk(KERN_INFO "%s: %s() length-of-data is %ld \n", | ||
1893 | dev->name ,__func__,len_of_data); | ||
1894 | dumpit((char *)pDataAddress ,64); | ||
1895 | #endif | ||
1896 | p_this_ccw=privptr->p_write_free_chain; /* get a block */ | 1339 | p_this_ccw=privptr->p_write_free_chain; /* get a block */ |
1897 | if (p_this_ccw == NULL) { /* lost the race */ | 1340 | if (p_this_ccw == NULL) { /* lost the race */ |
1898 | ch = &privptr->channel[WRITE]; | 1341 | ch = &privptr->channel[WRITE]; |
@@ -1924,12 +1367,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1924 | (__u32)__pa(&p_this_ccw->write); | 1367 | (__u32)__pa(&p_this_ccw->write); |
1925 | } | 1368 | } |
1926 | p_last_ccw=p_this_ccw; /* save new last block */ | 1369 | p_last_ccw=p_this_ccw; /* save new last block */ |
1927 | #ifdef IOTRACE | ||
1928 | printk(KERN_INFO "%s: %s() > CCW and Buffer %ld bytes long \n", | ||
1929 | dev->name,__func__,bytesInThisBuffer); | ||
1930 | dumpit((char *)p_this_ccw, sizeof(struct ccwbk)); | ||
1931 | dumpit((char *)p_this_ccw->p_buffer, 64); | ||
1932 | #endif | ||
1933 | } | 1370 | } |
1934 | 1371 | ||
1935 | /* FirstCCW and LastCCW now contain a new set of write channel | 1372 | /* FirstCCW and LastCCW now contain a new set of write channel |
@@ -1962,13 +1399,11 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1962 | pEnd->write1_nop2.count=1; | 1399 | pEnd->write1_nop2.count=1; |
1963 | } /* end if if (pEnd->write1) */ | 1400 | } /* end if if (pEnd->write1) */ |
1964 | 1401 | ||
1965 | |||
1966 | if (privptr->p_write_active_first==NULL ) { | 1402 | if (privptr->p_write_active_first==NULL ) { |
1967 | privptr->p_write_active_first=p_first_ccw; | 1403 | privptr->p_write_active_first=p_first_ccw; |
1968 | privptr->p_write_active_last=p_last_ccw; | 1404 | privptr->p_write_active_last=p_last_ccw; |
1969 | } | 1405 | } |
1970 | else { | 1406 | else { |
1971 | |||
1972 | /* set up Tic CCWs */ | 1407 | /* set up Tic CCWs */ |
1973 | 1408 | ||
1974 | tempCCW.cda=(__u32)__pa(&p_first_ccw->write); | 1409 | tempCCW.cda=(__u32)__pa(&p_first_ccw->write); |
@@ -2007,19 +1442,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
2007 | } | 1442 | } |
2008 | 1443 | ||
2009 | } /* endif (p_first_ccw!=NULL) */ | 1444 | } /* endif (p_first_ccw!=NULL) */ |
2010 | |||
2011 | |||
2012 | #ifdef IOTRACE | ||
2013 | printk(KERN_INFO "%s: %s() > Dump Active CCW chain \n", | ||
2014 | dev->name,__func__); | ||
2015 | p_buf=privptr->p_write_active_first; | ||
2016 | while (p_buf!=NULL) { | ||
2017 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
2018 | p_buf=p_buf->next; | ||
2019 | } | ||
2020 | p_buf=(struct ccwbk*)privptr->p_end_ccw; | ||
2021 | dumpit((char *)p_buf, sizeof(struct endccw)); | ||
2022 | #endif | ||
2023 | dev_kfree_skb_any(skb); | 1445 | dev_kfree_skb_any(skb); |
2024 | if (linkid==0) { | 1446 | if (linkid==0) { |
2025 | lock=LOCK_NO; | 1447 | lock=LOCK_NO; |
@@ -2029,21 +1451,12 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
2029 | } | 1451 | } |
2030 | claw_strt_out_IO(dev ); | 1452 | claw_strt_out_IO(dev ); |
2031 | /* if write free count is zero , set NOBUFFER */ | 1453 | /* if write free count is zero , set NOBUFFER */ |
2032 | #ifdef DEBUGMSG | ||
2033 | printk(KERN_INFO "%s: %s() > free_count is %d\n", | ||
2034 | dev->name,__func__, | ||
2035 | (int) privptr->write_free_count ); | ||
2036 | #endif | ||
2037 | if (privptr->write_free_count==0) { | 1454 | if (privptr->write_free_count==0) { |
2038 | claw_setbit_busy(TB_NOBUFFER,dev); | 1455 | claw_setbit_busy(TB_NOBUFFER,dev); |
2039 | } | 1456 | } |
2040 | Done2: | 1457 | Done2: |
2041 | claw_clearbit_busy(TB_TX,dev); | 1458 | claw_clearbit_busy(TB_TX,dev); |
2042 | Done: | 1459 | Done: |
2043 | #ifdef FUNCTRACE | ||
2044 | printk(KERN_INFO "%s: %s() > exit on line %d, rc = %d \n", | ||
2045 | dev->name,__func__,__LINE__, rc); | ||
2046 | #endif | ||
2047 | return(rc); | 1460 | return(rc); |
2048 | } /* end of claw_hw_tx */ | 1461 | } /* end of claw_hw_tx */ |
2049 | 1462 | ||
@@ -2075,14 +1488,7 @@ init_ccw_bk(struct net_device *dev) | |||
2075 | struct clawh *pClawH=NULL; | 1488 | struct clawh *pClawH=NULL; |
2076 | addr_t real_TIC_address; | 1489 | addr_t real_TIC_address; |
2077 | int i,j; | 1490 | int i,j; |
2078 | #ifdef FUNCTRACE | 1491 | CLAW_DBF_TEXT(4, trace, "init_ccw"); |
2079 | printk(KERN_INFO "%s: %s() enter \n",dev->name,__func__); | ||
2080 | #endif | ||
2081 | CLAW_DBF_TEXT(4,trace,"init_ccw"); | ||
2082 | #ifdef DEBUGMSG | ||
2083 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
2084 | dumpit((char *) dev, sizeof(struct net_device)); | ||
2085 | #endif | ||
2086 | 1492 | ||
2087 | /* initialize statistics field */ | 1493 | /* initialize statistics field */ |
2088 | privptr->active_link_ID=0; | 1494 | privptr->active_link_ID=0; |
@@ -2107,20 +1513,6 @@ init_ccw_bk(struct net_device *dev) | |||
2107 | */ | 1513 | */ |
2108 | ccw_blocks_required = | 1514 | ccw_blocks_required = |
2109 | privptr->p_env->read_buffers+privptr->p_env->write_buffers+1; | 1515 | privptr->p_env->read_buffers+privptr->p_env->write_buffers+1; |
2110 | #ifdef DEBUGMSG | ||
2111 | printk(KERN_INFO "%s: %s() " | ||
2112 | "ccw_blocks_required=%d\n", | ||
2113 | dev->name,__func__, | ||
2114 | ccw_blocks_required); | ||
2115 | printk(KERN_INFO "%s: %s() " | ||
2116 | "PAGE_SIZE=0x%x\n", | ||
2117 | dev->name,__func__, | ||
2118 | (unsigned int)PAGE_SIZE); | ||
2119 | printk(KERN_INFO "%s: %s() > " | ||
2120 | "PAGE_MASK=0x%x\n", | ||
2121 | dev->name,__func__, | ||
2122 | (unsigned int)PAGE_MASK); | ||
2123 | #endif | ||
2124 | /* | 1516 | /* |
2125 | * compute number of CCW blocks that will fit in a page | 1517 | * compute number of CCW blocks that will fit in a page |
2126 | */ | 1518 | */ |
@@ -2128,14 +1520,6 @@ init_ccw_bk(struct net_device *dev) | |||
2128 | ccw_pages_required= | 1520 | ccw_pages_required= |
2129 | DIV_ROUND_UP(ccw_blocks_required, ccw_blocks_perpage); | 1521 | DIV_ROUND_UP(ccw_blocks_required, ccw_blocks_perpage); |
2130 | 1522 | ||
2131 | #ifdef DEBUGMSG | ||
2132 | printk(KERN_INFO "%s: %s() > ccw_blocks_perpage=%d\n", | ||
2133 | dev->name,__func__, | ||
2134 | ccw_blocks_perpage); | ||
2135 | printk(KERN_INFO "%s: %s() > ccw_pages_required=%d\n", | ||
2136 | dev->name,__func__, | ||
2137 | ccw_pages_required); | ||
2138 | #endif | ||
2139 | /* | 1523 | /* |
2140 | * read and write sizes are set by 2 constants in claw.h | 1524 | * read and write sizes are set by 2 constants in claw.h |
2141 | * 4k and 32k. Unpacked values other than 4k are not going to | 1525 | * 4k and 32k. Unpacked values other than 4k are not going to |
@@ -2166,36 +1550,6 @@ init_ccw_bk(struct net_device *dev) | |||
2166 | claw_write_pages = privptr->p_env->write_buffers * | 1550 | claw_write_pages = privptr->p_env->write_buffers * |
2167 | privptr->p_buff_pages_perwrite; | 1551 | privptr->p_buff_pages_perwrite; |
2168 | } | 1552 | } |
2169 | #ifdef DEBUGMSG | ||
2170 | if (privptr->p_env->read_size < PAGE_SIZE) { | ||
2171 | printk(KERN_INFO "%s: %s() reads_perpage=%d\n", | ||
2172 | dev->name,__func__, | ||
2173 | claw_reads_perpage); | ||
2174 | } | ||
2175 | else { | ||
2176 | printk(KERN_INFO "%s: %s() pages_perread=%d\n", | ||
2177 | dev->name,__func__, | ||
2178 | privptr->p_buff_pages_perread); | ||
2179 | } | ||
2180 | printk(KERN_INFO "%s: %s() read_pages=%d\n", | ||
2181 | dev->name,__func__, | ||
2182 | claw_read_pages); | ||
2183 | if (privptr->p_env->write_size < PAGE_SIZE) { | ||
2184 | printk(KERN_INFO "%s: %s() writes_perpage=%d\n", | ||
2185 | dev->name,__func__, | ||
2186 | claw_writes_perpage); | ||
2187 | } | ||
2188 | else { | ||
2189 | printk(KERN_INFO "%s: %s() pages_perwrite=%d\n", | ||
2190 | dev->name,__func__, | ||
2191 | privptr->p_buff_pages_perwrite); | ||
2192 | } | ||
2193 | printk(KERN_INFO "%s: %s() write_pages=%d\n", | ||
2194 | dev->name,__func__, | ||
2195 | claw_write_pages); | ||
2196 | #endif | ||
2197 | |||
2198 | |||
2199 | /* | 1553 | /* |
2200 | * allocate ccw_pages_required | 1554 | * allocate ccw_pages_required |
2201 | */ | 1555 | */ |
@@ -2204,17 +1558,6 @@ init_ccw_bk(struct net_device *dev) | |||
2204 | (void *)__get_free_pages(__GFP_DMA, | 1558 | (void *)__get_free_pages(__GFP_DMA, |
2205 | (int)pages_to_order_of_mag(ccw_pages_required )); | 1559 | (int)pages_to_order_of_mag(ccw_pages_required )); |
2206 | if (privptr->p_buff_ccw==NULL) { | 1560 | if (privptr->p_buff_ccw==NULL) { |
2207 | printk(KERN_INFO "%s: %s() " | ||
2208 | "__get_free_pages for CCWs failed : " | ||
2209 | "pages is %d\n", | ||
2210 | dev->name,__func__, | ||
2211 | ccw_pages_required ); | ||
2212 | #ifdef FUNCTRACE | ||
2213 | printk(KERN_INFO "%s: %s() > " | ||
2214 | "exit on line %d, rc = ENOMEM\n", | ||
2215 | dev->name,__func__, | ||
2216 | __LINE__); | ||
2217 | #endif | ||
2218 | return -ENOMEM; | 1561 | return -ENOMEM; |
2219 | } | 1562 | } |
2220 | privptr->p_buff_ccw_num=ccw_pages_required; | 1563 | privptr->p_buff_ccw_num=ccw_pages_required; |
@@ -2229,11 +1572,6 @@ init_ccw_bk(struct net_device *dev) | |||
2229 | privptr->p_end_ccw = (struct endccw *)&privptr->end_ccw; | 1572 | privptr->p_end_ccw = (struct endccw *)&privptr->end_ccw; |
2230 | real_address = (__u32)__pa(privptr->p_end_ccw); | 1573 | real_address = (__u32)__pa(privptr->p_end_ccw); |
2231 | /* Initialize ending CCW block */ | 1574 | /* Initialize ending CCW block */ |
2232 | #ifdef DEBUGMSG | ||
2233 | printk(KERN_INFO "%s: %s() begin initialize ending CCW blocks\n", | ||
2234 | dev->name,__func__); | ||
2235 | #endif | ||
2236 | |||
2237 | p_endccw=privptr->p_end_ccw; | 1575 | p_endccw=privptr->p_end_ccw; |
2238 | p_endccw->real=real_address; | 1576 | p_endccw->real=real_address; |
2239 | p_endccw->write1=0x00; | 1577 | p_endccw->write1=0x00; |
@@ -2287,21 +1625,10 @@ init_ccw_bk(struct net_device *dev) | |||
2287 | p_endccw->read2_nop2.count = 1; | 1625 | p_endccw->read2_nop2.count = 1; |
2288 | p_endccw->read2_nop2.cda = 0; | 1626 | p_endccw->read2_nop2.cda = 0; |
2289 | 1627 | ||
2290 | #ifdef IOTRACE | ||
2291 | printk(KERN_INFO "%s: %s() dump claw ending CCW BK \n", | ||
2292 | dev->name,__func__); | ||
2293 | dumpit((char *)p_endccw, sizeof(struct endccw)); | ||
2294 | #endif | ||
2295 | |||
2296 | /* | 1628 | /* |
2297 | * Build a chain of CCWs | 1629 | * Build a chain of CCWs |
2298 | * | 1630 | * |
2299 | */ | 1631 | */ |
2300 | |||
2301 | #ifdef DEBUGMSG | ||
2302 | printk(KERN_INFO "%s: %s() Begin build a chain of CCW buffer \n", | ||
2303 | dev->name,__func__); | ||
2304 | #endif | ||
2305 | p_buff=privptr->p_buff_ccw; | 1632 | p_buff=privptr->p_buff_ccw; |
2306 | 1633 | ||
2307 | p_free_chain=NULL; | 1634 | p_free_chain=NULL; |
@@ -2316,26 +1643,10 @@ init_ccw_bk(struct net_device *dev) | |||
2316 | } | 1643 | } |
2317 | p_buff+=PAGE_SIZE; | 1644 | p_buff+=PAGE_SIZE; |
2318 | } | 1645 | } |
2319 | #ifdef DEBUGMSG | ||
2320 | printk(KERN_INFO "%s: %s() " | ||
2321 | "End build a chain of CCW buffer \n", | ||
2322 | dev->name,__func__); | ||
2323 | p_buf=p_free_chain; | ||
2324 | while (p_buf!=NULL) { | ||
2325 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
2326 | p_buf=p_buf->next; | ||
2327 | } | ||
2328 | #endif | ||
2329 | |||
2330 | /* | 1646 | /* |
2331 | * Initialize ClawSignalBlock | 1647 | * Initialize ClawSignalBlock |
2332 | * | 1648 | * |
2333 | */ | 1649 | */ |
2334 | #ifdef DEBUGMSG | ||
2335 | printk(KERN_INFO "%s: %s() " | ||
2336 | "Begin initialize ClawSignalBlock \n", | ||
2337 | dev->name,__func__); | ||
2338 | #endif | ||
2339 | if (privptr->p_claw_signal_blk==NULL) { | 1650 | if (privptr->p_claw_signal_blk==NULL) { |
2340 | privptr->p_claw_signal_blk=p_free_chain; | 1651 | privptr->p_claw_signal_blk=p_free_chain; |
2341 | p_free_chain=p_free_chain->next; | 1652 | p_free_chain=p_free_chain->next; |
@@ -2344,12 +1655,6 @@ init_ccw_bk(struct net_device *dev) | |||
2344 | pClawH->opcode=0xff; | 1655 | pClawH->opcode=0xff; |
2345 | pClawH->flag=CLAW_BUSY; | 1656 | pClawH->flag=CLAW_BUSY; |
2346 | } | 1657 | } |
2347 | #ifdef DEBUGMSG | ||
2348 | printk(KERN_INFO "%s: %s() > End initialize " | ||
2349 | "ClawSignalBlock\n", | ||
2350 | dev->name,__func__); | ||
2351 | dumpit((char *)privptr->p_claw_signal_blk, sizeof(struct ccwbk)); | ||
2352 | #endif | ||
2353 | 1658 | ||
2354 | /* | 1659 | /* |
2355 | * allocate write_pages_required and add to free chain | 1660 | * allocate write_pages_required and add to free chain |
@@ -2360,17 +1665,7 @@ init_ccw_bk(struct net_device *dev) | |||
2360 | (void *)__get_free_pages(__GFP_DMA, | 1665 | (void *)__get_free_pages(__GFP_DMA, |
2361 | (int)pages_to_order_of_mag(claw_write_pages )); | 1666 | (int)pages_to_order_of_mag(claw_write_pages )); |
2362 | if (privptr->p_buff_write==NULL) { | 1667 | if (privptr->p_buff_write==NULL) { |
2363 | printk(KERN_INFO "%s: %s() __get_free_pages for write" | ||
2364 | " bufs failed : get is for %d pages\n", | ||
2365 | dev->name,__func__,claw_write_pages ); | ||
2366 | free_pages((unsigned long)privptr->p_buff_ccw, | ||
2367 | (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); | ||
2368 | privptr->p_buff_ccw=NULL; | 1668 | privptr->p_buff_ccw=NULL; |
2369 | #ifdef FUNCTRACE | ||
2370 | printk(KERN_INFO "%s: %s() > exit on line %d," | ||
2371 | "rc = ENOMEM\n", | ||
2372 | dev->name,__func__,__LINE__); | ||
2373 | #endif | ||
2374 | return -ENOMEM; | 1669 | return -ENOMEM; |
2375 | } | 1670 | } |
2376 | /* | 1671 | /* |
@@ -2380,10 +1675,6 @@ init_ccw_bk(struct net_device *dev) | |||
2380 | 1675 | ||
2381 | memset(privptr->p_buff_write, 0x00, | 1676 | memset(privptr->p_buff_write, 0x00, |
2382 | ccw_pages_required * PAGE_SIZE); | 1677 | ccw_pages_required * PAGE_SIZE); |
2383 | #ifdef DEBUGMSG | ||
2384 | printk(KERN_INFO "%s: %s() Begin build claw write free " | ||
2385 | "chain \n",dev->name,__func__); | ||
2386 | #endif | ||
2387 | privptr->p_write_free_chain=NULL; | 1678 | privptr->p_write_free_chain=NULL; |
2388 | 1679 | ||
2389 | p_buff=privptr->p_buff_write; | 1680 | p_buff=privptr->p_buff_write; |
@@ -2419,18 +1710,7 @@ init_ccw_bk(struct net_device *dev) | |||
2419 | p_buff=(void *)__get_free_pages(__GFP_DMA, | 1710 | p_buff=(void *)__get_free_pages(__GFP_DMA, |
2420 | (int)pages_to_order_of_mag( | 1711 | (int)pages_to_order_of_mag( |
2421 | privptr->p_buff_pages_perwrite) ); | 1712 | privptr->p_buff_pages_perwrite) ); |
2422 | #ifdef IOTRACE | ||
2423 | printk(KERN_INFO "%s:%s __get_free_pages " | ||
2424 | "for writes buf: get for %d pages\n", | ||
2425 | dev->name,__func__, | ||
2426 | privptr->p_buff_pages_perwrite); | ||
2427 | #endif | ||
2428 | if (p_buff==NULL) { | 1713 | if (p_buff==NULL) { |
2429 | printk(KERN_INFO "%s:%s __get_free_pages " | ||
2430 | "for writes buf failed : get is for %d pages\n", | ||
2431 | dev->name, | ||
2432 | __func__, | ||
2433 | privptr->p_buff_pages_perwrite ); | ||
2434 | free_pages((unsigned long)privptr->p_buff_ccw, | 1714 | free_pages((unsigned long)privptr->p_buff_ccw, |
2435 | (int)pages_to_order_of_mag( | 1715 | (int)pages_to_order_of_mag( |
2436 | privptr->p_buff_ccw_num)); | 1716 | privptr->p_buff_ccw_num)); |
@@ -2443,12 +1723,6 @@ init_ccw_bk(struct net_device *dev) | |||
2443 | privptr->p_buff_pages_perwrite)); | 1723 | privptr->p_buff_pages_perwrite)); |
2444 | p_buf=p_buf->next; | 1724 | p_buf=p_buf->next; |
2445 | } | 1725 | } |
2446 | #ifdef FUNCTRACE | ||
2447 | printk(KERN_INFO "%s: %s exit on line %d, rc = ENOMEM\n", | ||
2448 | dev->name, | ||
2449 | __func__, | ||
2450 | __LINE__); | ||
2451 | #endif | ||
2452 | return -ENOMEM; | 1726 | return -ENOMEM; |
2453 | } /* Error on get_pages */ | 1727 | } /* Error on get_pages */ |
2454 | memset(p_buff, 0x00, privptr->p_env->write_size ); | 1728 | memset(p_buff, 0x00, privptr->p_env->write_size ); |
@@ -2477,15 +1751,6 @@ init_ccw_bk(struct net_device *dev) | |||
2477 | privptr->write_free_count=privptr->p_env->write_buffers; | 1751 | privptr->write_free_count=privptr->p_env->write_buffers; |
2478 | 1752 | ||
2479 | 1753 | ||
2480 | #ifdef DEBUGMSG | ||
2481 | printk(KERN_INFO "%s:%s End build claw write free chain \n", | ||
2482 | dev->name,__func__); | ||
2483 | p_buf=privptr->p_write_free_chain; | ||
2484 | while (p_buf!=NULL) { | ||
2485 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
2486 | p_buf=p_buf->next; | ||
2487 | } | ||
2488 | #endif | ||
2489 | /* | 1754 | /* |
2490 | * allocate read_pages_required and chain to free chain | 1755 | * allocate read_pages_required and chain to free chain |
2491 | */ | 1756 | */ |
@@ -2495,10 +1760,6 @@ init_ccw_bk(struct net_device *dev) | |||
2495 | (void *)__get_free_pages(__GFP_DMA, | 1760 | (void *)__get_free_pages(__GFP_DMA, |
2496 | (int)pages_to_order_of_mag(claw_read_pages) ); | 1761 | (int)pages_to_order_of_mag(claw_read_pages) ); |
2497 | if (privptr->p_buff_read==NULL) { | 1762 | if (privptr->p_buff_read==NULL) { |
2498 | printk(KERN_INFO "%s: %s() " | ||
2499 | "__get_free_pages for read buf failed : " | ||
2500 | "get is for %d pages\n", | ||
2501 | dev->name,__func__,claw_read_pages ); | ||
2502 | free_pages((unsigned long)privptr->p_buff_ccw, | 1763 | free_pages((unsigned long)privptr->p_buff_ccw, |
2503 | (int)pages_to_order_of_mag( | 1764 | (int)pages_to_order_of_mag( |
2504 | privptr->p_buff_ccw_num)); | 1765 | privptr->p_buff_ccw_num)); |
@@ -2508,10 +1769,6 @@ init_ccw_bk(struct net_device *dev) | |||
2508 | privptr->p_buff_write_num)); | 1769 | privptr->p_buff_write_num)); |
2509 | privptr->p_buff_ccw=NULL; | 1770 | privptr->p_buff_ccw=NULL; |
2510 | privptr->p_buff_write=NULL; | 1771 | privptr->p_buff_write=NULL; |
2511 | #ifdef FUNCTRACE | ||
2512 | printk(KERN_INFO "%s: %s() > exit on line %d, rc =" | ||
2513 | " ENOMEM\n",dev->name,__func__,__LINE__); | ||
2514 | #endif | ||
2515 | return -ENOMEM; | 1772 | return -ENOMEM; |
2516 | } | 1773 | } |
2517 | memset(privptr->p_buff_read, 0x00, claw_read_pages * PAGE_SIZE); | 1774 | memset(privptr->p_buff_read, 0x00, claw_read_pages * PAGE_SIZE); |
@@ -2520,10 +1777,6 @@ init_ccw_bk(struct net_device *dev) | |||
2520 | * Build CLAW read free chain | 1777 | * Build CLAW read free chain |
2521 | * | 1778 | * |
2522 | */ | 1779 | */ |
2523 | #ifdef DEBUGMSG | ||
2524 | printk(KERN_INFO "%s: %s() Begin build claw read free chain \n", | ||
2525 | dev->name,__func__); | ||
2526 | #endif | ||
2527 | p_buff=privptr->p_buff_read; | 1780 | p_buff=privptr->p_buff_read; |
2528 | for (i=0 ; i< privptr->p_env->read_buffers ; i++) { | 1781 | for (i=0 ; i< privptr->p_env->read_buffers ; i++) { |
2529 | p_buf = p_free_chain; | 1782 | p_buf = p_free_chain; |
@@ -2600,19 +1853,10 @@ init_ccw_bk(struct net_device *dev) | |||
2600 | } /* for read_buffers */ | 1853 | } /* for read_buffers */ |
2601 | } /* read_size < PAGE_SIZE */ | 1854 | } /* read_size < PAGE_SIZE */ |
2602 | else { /* read Size >= PAGE_SIZE */ | 1855 | else { /* read Size >= PAGE_SIZE */ |
2603 | |||
2604 | #ifdef DEBUGMSG | ||
2605 | printk(KERN_INFO "%s: %s() Begin build claw read free chain \n", | ||
2606 | dev->name,__func__); | ||
2607 | #endif | ||
2608 | for (i=0 ; i< privptr->p_env->read_buffers ; i++) { | 1856 | for (i=0 ; i< privptr->p_env->read_buffers ; i++) { |
2609 | p_buff = (void *)__get_free_pages(__GFP_DMA, | 1857 | p_buff = (void *)__get_free_pages(__GFP_DMA, |
2610 | (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) ); | 1858 | (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) ); |
2611 | if (p_buff==NULL) { | 1859 | if (p_buff==NULL) { |
2612 | printk(KERN_INFO "%s: %s() __get_free_pages for read " | ||
2613 | "buf failed : get is for %d pages\n", | ||
2614 | dev->name,__func__, | ||
2615 | privptr->p_buff_pages_perread ); | ||
2616 | free_pages((unsigned long)privptr->p_buff_ccw, | 1860 | free_pages((unsigned long)privptr->p_buff_ccw, |
2617 | (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); | 1861 | (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); |
2618 | /* free the write pages */ | 1862 | /* free the write pages */ |
@@ -2633,11 +1877,6 @@ init_ccw_bk(struct net_device *dev) | |||
2633 | } | 1877 | } |
2634 | privptr->p_buff_ccw=NULL; | 1878 | privptr->p_buff_ccw=NULL; |
2635 | privptr->p_buff_write=NULL; | 1879 | privptr->p_buff_write=NULL; |
2636 | #ifdef FUNCTRACE | ||
2637 | printk(KERN_INFO "%s: %s() exit on line %d, rc = ENOMEM\n", | ||
2638 | dev->name,__func__, | ||
2639 | __LINE__); | ||
2640 | #endif | ||
2641 | return -ENOMEM; | 1880 | return -ENOMEM; |
2642 | } | 1881 | } |
2643 | memset(p_buff, 0x00, privptr->p_env->read_size); | 1882 | memset(p_buff, 0x00, privptr->p_env->read_size); |
@@ -2706,22 +1945,9 @@ init_ccw_bk(struct net_device *dev) | |||
2706 | } /* For read_buffers */ | 1945 | } /* For read_buffers */ |
2707 | } /* read_size >= PAGE_SIZE */ | 1946 | } /* read_size >= PAGE_SIZE */ |
2708 | } /* pBuffread = NULL */ | 1947 | } /* pBuffread = NULL */ |
2709 | #ifdef DEBUGMSG | ||
2710 | printk(KERN_INFO "%s: %s() > End build claw read free chain \n", | ||
2711 | dev->name,__func__); | ||
2712 | p_buf=p_first_CCWB; | ||
2713 | while (p_buf!=NULL) { | ||
2714 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
2715 | p_buf=p_buf->next; | ||
2716 | } | ||
2717 | |||
2718 | #endif | ||
2719 | add_claw_reads( dev ,p_first_CCWB , p_last_CCWB); | 1948 | add_claw_reads( dev ,p_first_CCWB , p_last_CCWB); |
2720 | privptr->buffs_alloc = 1; | 1949 | privptr->buffs_alloc = 1; |
2721 | #ifdef FUNCTRACE | 1950 | |
2722 | printk(KERN_INFO "%s: %s() exit on line %d\n", | ||
2723 | dev->name,__func__,__LINE__); | ||
2724 | #endif | ||
2725 | return 0; | 1951 | return 0; |
2726 | } /* end of init_ccw_bk */ | 1952 | } /* end of init_ccw_bk */ |
2727 | 1953 | ||
@@ -2735,14 +1961,8 @@ static void | |||
2735 | probe_error( struct ccwgroup_device *cgdev) | 1961 | probe_error( struct ccwgroup_device *cgdev) |
2736 | { | 1962 | { |
2737 | struct claw_privbk *privptr; | 1963 | struct claw_privbk *privptr; |
2738 | #ifdef FUNCTRACE | 1964 | |
2739 | printk(KERN_INFO "%s enter \n",__func__); | 1965 | CLAW_DBF_TEXT(4, trace, "proberr"); |
2740 | #endif | ||
2741 | CLAW_DBF_TEXT(4,trace,"proberr"); | ||
2742 | #ifdef DEBUGMSG | ||
2743 | printk(KERN_INFO "%s variable cgdev =\n",__func__); | ||
2744 | dumpit((char *) cgdev, sizeof(struct ccwgroup_device)); | ||
2745 | #endif | ||
2746 | privptr=(struct claw_privbk *)cgdev->dev.driver_data; | 1966 | privptr=(struct claw_privbk *)cgdev->dev.driver_data; |
2747 | if (privptr!=NULL) { | 1967 | if (privptr!=NULL) { |
2748 | kfree(privptr->p_env); | 1968 | kfree(privptr->p_env); |
@@ -2752,16 +1972,9 @@ probe_error( struct ccwgroup_device *cgdev) | |||
2752 | kfree(privptr); | 1972 | kfree(privptr); |
2753 | privptr=NULL; | 1973 | privptr=NULL; |
2754 | } | 1974 | } |
2755 | #ifdef FUNCTRACE | ||
2756 | printk(KERN_INFO "%s > exit on line %d\n", | ||
2757 | __func__,__LINE__); | ||
2758 | #endif | ||
2759 | |||
2760 | return; | 1975 | return; |
2761 | } /* probe_error */ | 1976 | } /* probe_error */ |
2762 | 1977 | ||
2763 | |||
2764 | |||
2765 | /*-------------------------------------------------------------------* | 1978 | /*-------------------------------------------------------------------* |
2766 | * claw_process_control * | 1979 | * claw_process_control * |
2767 | * * | 1980 | * * |
@@ -2783,32 +1996,19 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw) | |||
2783 | struct conncmd *p_connect=NULL; | 1996 | struct conncmd *p_connect=NULL; |
2784 | int rc; | 1997 | int rc; |
2785 | struct chbk *p_ch = NULL; | 1998 | struct chbk *p_ch = NULL; |
2786 | #ifdef FUNCTRACE | 1999 | struct device *tdev; |
2787 | printk(KERN_INFO "%s: %s() > enter \n", | 2000 | CLAW_DBF_TEXT(2, setup, "clw_cntl"); |
2788 | dev->name,__func__); | ||
2789 | #endif | ||
2790 | CLAW_DBF_TEXT(2,setup,"clw_cntl"); | ||
2791 | #ifdef DEBUGMSG | ||
2792 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
2793 | dumpit((char *) dev, sizeof(struct net_device)); | ||
2794 | printk(KERN_INFO "%s: variable p_ccw =\n",dev->name); | ||
2795 | dumpit((char *) p_ccw, sizeof(struct ccwbk *)); | ||
2796 | #endif | ||
2797 | udelay(1000); /* Wait a ms for the control packets to | 2001 | udelay(1000); /* Wait a ms for the control packets to |
2798 | *catch up to each other */ | 2002 | *catch up to each other */ |
2799 | privptr=dev->priv; | 2003 | privptr=dev->priv; |
2800 | p_env=privptr->p_env; | 2004 | p_env=privptr->p_env; |
2005 | tdev = &privptr->channel[READ].cdev->dev; | ||
2801 | memcpy( &temp_host_name, p_env->host_name, 8); | 2006 | memcpy( &temp_host_name, p_env->host_name, 8); |
2802 | memcpy( &temp_ws_name, p_env->adapter_name , 8); | 2007 | memcpy( &temp_ws_name, p_env->adapter_name , 8); |
2803 | printk(KERN_INFO "%s: CLAW device %.8s: " | 2008 | printk(KERN_INFO "%s: CLAW device %.8s: " |
2804 | "Received Control Packet\n", | 2009 | "Received Control Packet\n", |
2805 | dev->name, temp_ws_name); | 2010 | dev->name, temp_ws_name); |
2806 | if (privptr->release_pend==1) { | 2011 | if (privptr->release_pend==1) { |
2807 | #ifdef FUNCTRACE | ||
2808 | printk(KERN_INFO "%s: %s() > " | ||
2809 | "exit on line %d, rc=0\n", | ||
2810 | dev->name,__func__,__LINE__); | ||
2811 | #endif | ||
2812 | return 0; | 2012 | return 0; |
2813 | } | 2013 | } |
2814 | p_buf=p_ccw->p_buffer; | 2014 | p_buf=p_ccw->p_buffer; |
@@ -2818,261 +2018,246 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw) | |||
2818 | } else { | 2018 | } else { |
2819 | memcpy(p_ctlbk, p_buf, sizeof(struct clawctl)); | 2019 | memcpy(p_ctlbk, p_buf, sizeof(struct clawctl)); |
2820 | } | 2020 | } |
2821 | #ifdef IOTRACE | ||
2822 | printk(KERN_INFO "%s: dump claw control data inbound\n",dev->name); | ||
2823 | dumpit((char *)p_ctlbk, sizeof(struct clawctl)); | ||
2824 | #endif | ||
2825 | switch (p_ctlbk->command) | 2021 | switch (p_ctlbk->command) |
2826 | { | 2022 | { |
2827 | case SYSTEM_VALIDATE_REQUEST: | 2023 | case SYSTEM_VALIDATE_REQUEST: |
2828 | if (p_ctlbk->version!=CLAW_VERSION_ID) { | 2024 | if (p_ctlbk->version != CLAW_VERSION_ID) { |
2829 | claw_snd_sys_validate_rsp(dev, p_ctlbk, | 2025 | claw_snd_sys_validate_rsp(dev, p_ctlbk, |
2830 | CLAW_RC_WRONG_VERSION ); | 2026 | CLAW_RC_WRONG_VERSION); |
2831 | printk("%s: %d is wrong version id. " | 2027 | printk("%s: %d is wrong version id. " |
2832 | "Expected %d\n", | 2028 | "Expected %d\n", |
2833 | dev->name, p_ctlbk->version, | 2029 | dev->name, p_ctlbk->version, |
2834 | CLAW_VERSION_ID); | 2030 | CLAW_VERSION_ID); |
2835 | } | 2031 | } |
2836 | p_sysval=(struct sysval *)&(p_ctlbk->data); | 2032 | p_sysval = (struct sysval *)&(p_ctlbk->data); |
2837 | printk( "%s: Recv Sys Validate Request: " | 2033 | printk("%s: Recv Sys Validate Request: " |
2838 | "Vers=%d,link_id=%d,Corr=%d,WS name=%." | 2034 | "Vers=%d,link_id=%d,Corr=%d,WS name=%." |
2839 | "8s,Host name=%.8s\n", | 2035 | "8s,Host name=%.8s\n", |
2840 | dev->name, p_ctlbk->version, | 2036 | dev->name, p_ctlbk->version, |
2841 | p_ctlbk->linkid, | 2037 | p_ctlbk->linkid, |
2842 | p_ctlbk->correlator, | 2038 | p_ctlbk->correlator, |
2843 | p_sysval->WS_name, | 2039 | p_sysval->WS_name, |
2844 | p_sysval->host_name); | 2040 | p_sysval->host_name); |
2845 | if (0!=memcmp(temp_host_name,p_sysval->host_name,8)) { | 2041 | if (memcmp(temp_host_name, p_sysval->host_name, 8)) { |
2846 | claw_snd_sys_validate_rsp(dev, p_ctlbk, | 2042 | claw_snd_sys_validate_rsp(dev, p_ctlbk, |
2847 | CLAW_RC_NAME_MISMATCH ); | 2043 | CLAW_RC_NAME_MISMATCH); |
2848 | CLAW_DBF_TEXT(2,setup,"HSTBAD"); | 2044 | CLAW_DBF_TEXT(2, setup, "HSTBAD"); |
2849 | CLAW_DBF_TEXT_(2,setup,"%s",p_sysval->host_name); | 2045 | CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name); |
2850 | CLAW_DBF_TEXT_(2,setup,"%s",temp_host_name); | 2046 | CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name); |
2851 | printk(KERN_INFO "%s: Host name mismatch\n", | 2047 | printk(KERN_INFO "%s: Host name mismatch\n", |
2852 | dev->name); | 2048 | dev->name); |
2853 | printk(KERN_INFO "%s: Received :%s: " | 2049 | printk(KERN_INFO "%s: Received :%s: " |
2854 | "expected :%s: \n", | 2050 | "expected :%s: \n", |
2855 | dev->name, | 2051 | dev->name, |
2856 | p_sysval->host_name, | 2052 | p_sysval->host_name, |
2857 | temp_host_name); | 2053 | temp_host_name); |
2858 | } | 2054 | } |
2859 | if (0!=memcmp(temp_ws_name,p_sysval->WS_name,8)) { | 2055 | if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) { |
2860 | claw_snd_sys_validate_rsp(dev, p_ctlbk, | 2056 | claw_snd_sys_validate_rsp(dev, p_ctlbk, |
2861 | CLAW_RC_NAME_MISMATCH ); | 2057 | CLAW_RC_NAME_MISMATCH); |
2862 | CLAW_DBF_TEXT(2,setup,"WSNBAD"); | 2058 | CLAW_DBF_TEXT(2, setup, "WSNBAD"); |
2863 | CLAW_DBF_TEXT_(2,setup,"%s",p_sysval->WS_name); | 2059 | CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name); |
2864 | CLAW_DBF_TEXT_(2,setup,"%s",temp_ws_name); | 2060 | CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name); |
2865 | printk(KERN_INFO "%s: WS name mismatch\n", | 2061 | printk(KERN_INFO "%s: WS name mismatch\n", |
2866 | dev->name); | 2062 | dev->name); |
2867 | printk(KERN_INFO "%s: Received :%s: " | 2063 | printk(KERN_INFO "%s: Received :%s: " |
2868 | "expected :%s: \n", | 2064 | "expected :%s: \n", |
2869 | dev->name, | 2065 | dev->name, |
2870 | p_sysval->WS_name, | 2066 | p_sysval->WS_name, |
2871 | temp_ws_name); | 2067 | temp_ws_name); |
2872 | } | 2068 | } |
2873 | if (( p_sysval->write_frame_size < p_env->write_size) && | 2069 | if ((p_sysval->write_frame_size < p_env->write_size) && |
2874 | ( p_env->packing == 0)) { | 2070 | (p_env->packing == 0)) { |
2875 | claw_snd_sys_validate_rsp(dev, p_ctlbk, | 2071 | claw_snd_sys_validate_rsp(dev, p_ctlbk, |
2876 | CLAW_RC_HOST_RCV_TOO_SMALL ); | 2072 | CLAW_RC_HOST_RCV_TOO_SMALL); |
2877 | printk(KERN_INFO "%s: host write size is too " | 2073 | printk(KERN_INFO "%s: host write size is too " |
2878 | "small\n", dev->name); | 2074 | "small\n", dev->name); |
2879 | CLAW_DBF_TEXT(2,setup,"wrtszbad"); | 2075 | CLAW_DBF_TEXT(2, setup, "wrtszbad"); |
2880 | } | 2076 | } |
2881 | if (( p_sysval->read_frame_size < p_env->read_size) && | 2077 | if ((p_sysval->read_frame_size < p_env->read_size) && |
2882 | ( p_env->packing == 0)) { | 2078 | (p_env->packing == 0)) { |
2883 | claw_snd_sys_validate_rsp(dev, p_ctlbk, | 2079 | claw_snd_sys_validate_rsp(dev, p_ctlbk, |
2884 | CLAW_RC_HOST_RCV_TOO_SMALL ); | 2080 | CLAW_RC_HOST_RCV_TOO_SMALL); |
2885 | printk(KERN_INFO "%s: host read size is too " | 2081 | printk(KERN_INFO "%s: host read size is too " |
2886 | "small\n", dev->name); | 2082 | "small\n", dev->name); |
2887 | CLAW_DBF_TEXT(2,setup,"rdsizbad"); | 2083 | CLAW_DBF_TEXT(2, setup, "rdsizbad"); |
2888 | } | 2084 | } |
2889 | claw_snd_sys_validate_rsp(dev, p_ctlbk, 0 ); | 2085 | claw_snd_sys_validate_rsp(dev, p_ctlbk, 0); |
2890 | printk("%s: CLAW device %.8s: System validate" | 2086 | printk(KERN_INFO "%s: CLAW device %.8s: System validate " |
2891 | " completed.\n",dev->name, temp_ws_name); | 2087 | "completed.\n", dev->name, temp_ws_name); |
2892 | printk("%s: sys Validate Rsize:%d Wsize:%d\n",dev->name, | 2088 | printk("%s: sys Validate Rsize:%d Wsize:%d\n", dev->name, |
2893 | p_sysval->read_frame_size,p_sysval->write_frame_size); | 2089 | p_sysval->read_frame_size, p_sysval->write_frame_size); |
2894 | privptr->system_validate_comp=1; | 2090 | privptr->system_validate_comp = 1; |
2895 | if(strncmp(p_env->api_type,WS_APPL_NAME_PACKED,6) == 0) { | 2091 | if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0) |
2896 | p_env->packing = PACKING_ASK; | 2092 | p_env->packing = PACKING_ASK; |
2897 | } | 2093 | claw_strt_conn_req(dev); |
2898 | claw_strt_conn_req(dev); | 2094 | break; |
2899 | break; | 2095 | case SYSTEM_VALIDATE_RESPONSE: |
2900 | 2096 | p_sysval = (struct sysval *)&(p_ctlbk->data); | |
2901 | case SYSTEM_VALIDATE_RESPONSE: | 2097 | printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d," |
2902 | p_sysval=(struct sysval *)&(p_ctlbk->data); | 2098 | "WS name=%.8s,Host name=%.8s\n", |
2903 | printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d," | 2099 | dev->name, |
2904 | "WS name=%.8s,Host name=%.8s\n", | 2100 | p_ctlbk->version, |
2905 | dev->name, | 2101 | p_ctlbk->correlator, |
2906 | p_ctlbk->version, | 2102 | p_ctlbk->rc, |
2907 | p_ctlbk->correlator, | 2103 | p_sysval->WS_name, |
2908 | p_ctlbk->rc, | 2104 | p_sysval->host_name); |
2909 | p_sysval->WS_name, | 2105 | switch (p_ctlbk->rc) { |
2910 | p_sysval->host_name); | 2106 | case 0: |
2911 | switch (p_ctlbk->rc) | 2107 | printk(KERN_INFO "%s: CLAW device " |
2912 | { | 2108 | "%.8s: System validate " |
2913 | case 0: | 2109 | "completed.\n", |
2914 | printk(KERN_INFO "%s: CLAW device " | 2110 | dev->name, temp_ws_name); |
2915 | "%.8s: System validate " | 2111 | if (privptr->system_validate_comp == 0) |
2916 | "completed.\n", | 2112 | claw_strt_conn_req(dev); |
2917 | dev->name, temp_ws_name); | 2113 | privptr->system_validate_comp = 1; |
2918 | if (privptr->system_validate_comp == 0) | 2114 | break; |
2919 | claw_strt_conn_req(dev); | 2115 | case CLAW_RC_NAME_MISMATCH: |
2920 | privptr->system_validate_comp=1; | 2116 | printk(KERN_INFO "%s: Sys Validate " |
2921 | break; | 2117 | "Resp : Host, WS name is " |
2922 | case CLAW_RC_NAME_MISMATCH: | 2118 | "mismatch\n", |
2923 | printk(KERN_INFO "%s: Sys Validate " | 2119 | dev->name); |
2924 | "Resp : Host, WS name is " | 2120 | break; |
2925 | "mismatch\n", | 2121 | case CLAW_RC_WRONG_VERSION: |
2926 | dev->name); | 2122 | printk(KERN_INFO "%s: Sys Validate " |
2927 | break; | 2123 | "Resp : Wrong version\n", |
2928 | case CLAW_RC_WRONG_VERSION: | 2124 | dev->name); |
2929 | printk(KERN_INFO "%s: Sys Validate " | 2125 | break; |
2930 | "Resp : Wrong version\n", | 2126 | case CLAW_RC_HOST_RCV_TOO_SMALL: |
2931 | dev->name); | 2127 | printk(KERN_INFO "%s: Sys Validate " |
2932 | break; | 2128 | "Resp : bad frame size\n", |
2933 | case CLAW_RC_HOST_RCV_TOO_SMALL: | 2129 | dev->name); |
2934 | printk(KERN_INFO "%s: Sys Validate " | 2130 | break; |
2935 | "Resp : bad frame size\n", | 2131 | default: |
2936 | dev->name); | 2132 | printk(KERN_INFO "%s: Sys Validate " |
2937 | break; | 2133 | "error code=%d \n", |
2938 | default: | 2134 | dev->name, p_ctlbk->rc); |
2939 | printk(KERN_INFO "%s: Sys Validate " | 2135 | break; |
2940 | "error code=%d \n", | 2136 | } |
2941 | dev->name, p_ctlbk->rc ); | 2137 | break; |
2942 | break; | ||
2943 | } | ||
2944 | break; | ||
2945 | 2138 | ||
2946 | case CONNECTION_REQUEST: | 2139 | case CONNECTION_REQUEST: |
2947 | p_connect=(struct conncmd *)&(p_ctlbk->data); | 2140 | p_connect = (struct conncmd *)&(p_ctlbk->data); |
2948 | printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d," | 2141 | printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d," |
2949 | "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n", | 2142 | "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n", |
2950 | dev->name, | 2143 | dev->name, |
2951 | p_ctlbk->version, | 2144 | p_ctlbk->version, |
2952 | p_ctlbk->linkid, | 2145 | p_ctlbk->linkid, |
2953 | p_ctlbk->correlator, | 2146 | p_ctlbk->correlator, |
2954 | p_connect->host_name, | 2147 | p_connect->host_name, |
2955 | p_connect->WS_name); | 2148 | p_connect->WS_name); |
2956 | if (privptr->active_link_ID!=0 ) { | 2149 | if (privptr->active_link_ID != 0) { |
2957 | claw_snd_disc(dev, p_ctlbk); | 2150 | claw_snd_disc(dev, p_ctlbk); |
2958 | printk(KERN_INFO "%s: Conn Req error : " | 2151 | printk(KERN_INFO "%s: Conn Req error : " |
2959 | "already logical link is active \n", | 2152 | "already logical link is active \n", |
2960 | dev->name); | 2153 | dev->name); |
2961 | } | 2154 | } |
2962 | if (p_ctlbk->linkid!=1 ) { | 2155 | if (p_ctlbk->linkid != 1) { |
2963 | claw_snd_disc(dev, p_ctlbk); | 2156 | claw_snd_disc(dev, p_ctlbk); |
2964 | printk(KERN_INFO "%s: Conn Req error : " | 2157 | printk(KERN_INFO "%s: Conn Req error : " |
2965 | "req logical link id is not 1\n", | 2158 | "req logical link id is not 1\n", |
2159 | dev->name); | ||
2160 | } | ||
2161 | rc = find_link(dev, p_connect->host_name, p_connect->WS_name); | ||
2162 | if (rc != 0) { | ||
2163 | claw_snd_disc(dev, p_ctlbk); | ||
2164 | printk(KERN_INFO "%s: Conn Resp error: " | ||
2165 | "req appl name does not match\n", | ||
2166 | dev->name); | ||
2167 | } | ||
2168 | claw_send_control(dev, | ||
2169 | CONNECTION_CONFIRM, p_ctlbk->linkid, | ||
2170 | p_ctlbk->correlator, | ||
2171 | 0, p_connect->host_name, | ||
2172 | p_connect->WS_name); | ||
2173 | if (p_env->packing == PACKING_ASK) { | ||
2174 | p_env->packing = PACK_SEND; | ||
2175 | claw_snd_conn_req(dev, 0); | ||
2176 | } | ||
2177 | printk(KERN_INFO "%s: CLAW device %.8s: Connection " | ||
2178 | "completed link_id=%d.\n", | ||
2179 | dev->name, temp_ws_name, | ||
2180 | p_ctlbk->linkid); | ||
2181 | privptr->active_link_ID = p_ctlbk->linkid; | ||
2182 | p_ch = &privptr->channel[WRITE]; | ||
2183 | wake_up(&p_ch->wait); /* wake up claw_open ( WRITE) */ | ||
2184 | break; | ||
2185 | case CONNECTION_RESPONSE: | ||
2186 | p_connect = (struct conncmd *)&(p_ctlbk->data); | ||
2187 | printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d," | ||
2188 | "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n", | ||
2189 | dev->name, | ||
2190 | p_ctlbk->version, | ||
2191 | p_ctlbk->linkid, | ||
2192 | p_ctlbk->correlator, | ||
2193 | p_ctlbk->rc, | ||
2194 | p_connect->host_name, | ||
2195 | p_connect->WS_name); | ||
2196 | |||
2197 | if (p_ctlbk->rc != 0) { | ||
2198 | printk(KERN_INFO "%s: Conn Resp error: rc=%d \n", | ||
2199 | dev->name, p_ctlbk->rc); | ||
2200 | return 1; | ||
2201 | } | ||
2202 | rc = find_link(dev, | ||
2203 | p_connect->host_name, p_connect->WS_name); | ||
2204 | if (rc != 0) { | ||
2205 | claw_snd_disc(dev, p_ctlbk); | ||
2206 | printk(KERN_INFO "%s: Conn Resp error: " | ||
2207 | "req appl name does not match\n", | ||
2208 | dev->name); | ||
2209 | } | ||
2210 | /* should be until CONNECTION_CONFIRM */ | ||
2211 | privptr->active_link_ID = -(p_ctlbk->linkid); | ||
2212 | break; | ||
2213 | case CONNECTION_CONFIRM: | ||
2214 | p_connect = (struct conncmd *)&(p_ctlbk->data); | ||
2215 | printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d," | ||
2216 | "Corr=%d,Host appl=%.8s,WS appl=%.8s\n", | ||
2217 | dev->name, | ||
2218 | p_ctlbk->version, | ||
2219 | p_ctlbk->linkid, | ||
2220 | p_ctlbk->correlator, | ||
2221 | p_connect->host_name, | ||
2222 | p_connect->WS_name); | ||
2223 | if (p_ctlbk->linkid == -(privptr->active_link_ID)) { | ||
2224 | privptr->active_link_ID = p_ctlbk->linkid; | ||
2225 | if (p_env->packing > PACKING_ASK) { | ||
2226 | printk(KERN_INFO "%s: Confirmed Now packing\n", | ||
2966 | dev->name); | 2227 | dev->name); |
2967 | } | ||
2968 | rc=find_link(dev, | ||
2969 | p_connect->host_name, p_connect->WS_name); | ||
2970 | if (rc!=0) { | ||
2971 | claw_snd_disc(dev, p_ctlbk); | ||
2972 | printk(KERN_INFO "%s: Conn Req error : " | ||
2973 | "req appl name does not match\n", | ||
2974 | dev->name); | ||
2975 | } | ||
2976 | claw_send_control(dev, | ||
2977 | CONNECTION_CONFIRM, p_ctlbk->linkid, | ||
2978 | p_ctlbk->correlator, | ||
2979 | 0, p_connect->host_name, | ||
2980 | p_connect->WS_name); | ||
2981 | if (p_env->packing == PACKING_ASK) { | ||
2982 | printk("%s: Now Pack ask\n",dev->name); | ||
2983 | p_env->packing = PACK_SEND; | ||
2984 | claw_snd_conn_req(dev,0); | ||
2985 | } | ||
2986 | printk(KERN_INFO "%s: CLAW device %.8s: Connection " | ||
2987 | "completed link_id=%d.\n", | ||
2988 | dev->name, temp_ws_name, | ||
2989 | p_ctlbk->linkid); | ||
2990 | privptr->active_link_ID=p_ctlbk->linkid; | ||
2991 | p_ch=&privptr->channel[WRITE]; | ||
2992 | wake_up(&p_ch->wait); /* wake up claw_open ( WRITE) */ | ||
2993 | break; | ||
2994 | case CONNECTION_RESPONSE: | ||
2995 | p_connect=(struct conncmd *)&(p_ctlbk->data); | ||
2996 | printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d," | ||
2997 | "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n", | ||
2998 | dev->name, | ||
2999 | p_ctlbk->version, | ||
3000 | p_ctlbk->linkid, | ||
3001 | p_ctlbk->correlator, | ||
3002 | p_ctlbk->rc, | ||
3003 | p_connect->host_name, | ||
3004 | p_connect->WS_name); | ||
3005 | |||
3006 | if (p_ctlbk->rc !=0 ) { | ||
3007 | printk(KERN_INFO "%s: Conn Resp error: rc=%d \n", | ||
3008 | dev->name, p_ctlbk->rc); | ||
3009 | return 1; | ||
3010 | } | ||
3011 | rc=find_link(dev, | ||
3012 | p_connect->host_name, p_connect->WS_name); | ||
3013 | if (rc!=0) { | ||
3014 | claw_snd_disc(dev, p_ctlbk); | ||
3015 | printk(KERN_INFO "%s: Conn Resp error: " | ||
3016 | "req appl name does not match\n", | ||
3017 | dev->name); | ||
3018 | } | ||
3019 | /* should be until CONNECTION_CONFIRM */ | ||
3020 | privptr->active_link_ID = - (p_ctlbk->linkid); | ||
3021 | break; | ||
3022 | case CONNECTION_CONFIRM: | ||
3023 | p_connect=(struct conncmd *)&(p_ctlbk->data); | ||
3024 | printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d," | ||
3025 | "Corr=%d,Host appl=%.8s,WS appl=%.8s\n", | ||
3026 | dev->name, | ||
3027 | p_ctlbk->version, | ||
3028 | p_ctlbk->linkid, | ||
3029 | p_ctlbk->correlator, | ||
3030 | p_connect->host_name, | ||
3031 | p_connect->WS_name); | ||
3032 | if (p_ctlbk->linkid== -(privptr->active_link_ID)) { | ||
3033 | privptr->active_link_ID=p_ctlbk->linkid; | ||
3034 | if (p_env->packing > PACKING_ASK) { | ||
3035 | printk(KERN_INFO "%s: Confirmed Now packing\n",dev->name); | ||
3036 | p_env->packing = DO_PACKED; | ||
3037 | } | ||
3038 | p_ch=&privptr->channel[WRITE]; | ||
3039 | wake_up(&p_ch->wait); | ||
3040 | } | ||
3041 | else { | ||
3042 | printk(KERN_INFO "%s: Conn confirm: " | ||
3043 | "unexpected linkid=%d \n", | ||
3044 | dev->name, p_ctlbk->linkid); | ||
3045 | claw_snd_disc(dev, p_ctlbk); | ||
3046 | } | ||
3047 | break; | ||
3048 | case DISCONNECT: | ||
3049 | printk(KERN_INFO "%s: Disconnect: " | ||
3050 | "Vers=%d,link_id=%d,Corr=%d\n", | ||
3051 | dev->name, p_ctlbk->version, | ||
3052 | p_ctlbk->linkid, p_ctlbk->correlator); | ||
3053 | if ((p_ctlbk->linkid == 2) && | ||
3054 | (p_env->packing == PACK_SEND)) { | ||
3055 | privptr->active_link_ID = 1; | ||
3056 | p_env->packing = DO_PACKED; | 2228 | p_env->packing = DO_PACKED; |
3057 | } | 2229 | } |
3058 | else | 2230 | p_ch = &privptr->channel[WRITE]; |
3059 | privptr->active_link_ID=0; | 2231 | wake_up(&p_ch->wait); |
3060 | break; | 2232 | } else { |
3061 | case CLAW_ERROR: | 2233 | printk(KERN_INFO "%s: Conn confirm: " |
3062 | printk(KERN_INFO "%s: CLAW ERROR detected\n", | 2234 | "unexpected linkid=%d \n", |
3063 | dev->name); | 2235 | dev->name, p_ctlbk->linkid); |
3064 | break; | 2236 | claw_snd_disc(dev, p_ctlbk); |
3065 | default: | 2237 | } |
3066 | printk(KERN_INFO "%s: Unexpected command code=%d \n", | 2238 | break; |
3067 | dev->name, p_ctlbk->command); | 2239 | case DISCONNECT: |
3068 | break; | 2240 | printk(KERN_INFO "%s: Disconnect: " |
2241 | "Vers=%d,link_id=%d,Corr=%d\n", | ||
2242 | dev->name, p_ctlbk->version, | ||
2243 | p_ctlbk->linkid, p_ctlbk->correlator); | ||
2244 | if ((p_ctlbk->linkid == 2) && | ||
2245 | (p_env->packing == PACK_SEND)) { | ||
2246 | privptr->active_link_ID = 1; | ||
2247 | p_env->packing = DO_PACKED; | ||
2248 | } else | ||
2249 | privptr->active_link_ID = 0; | ||
2250 | break; | ||
2251 | case CLAW_ERROR: | ||
2252 | printk(KERN_INFO "%s: CLAW ERROR detected\n", | ||
2253 | dev->name); | ||
2254 | break; | ||
2255 | default: | ||
2256 | printk(KERN_INFO "%s: Unexpected command code=%d \n", | ||
2257 | dev->name, p_ctlbk->command); | ||
2258 | break; | ||
3069 | } | 2259 | } |
3070 | 2260 | ||
3071 | #ifdef FUNCTRACE | ||
3072 | printk(KERN_INFO "%s: %s() exit on line %d, rc = 0\n", | ||
3073 | dev->name,__func__,__LINE__); | ||
3074 | #endif | ||
3075 | |||
3076 | return 0; | 2261 | return 0; |
3077 | } /* end of claw_process_control */ | 2262 | } /* end of claw_process_control */ |
3078 | 2263 | ||
@@ -3092,18 +2277,7 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, | |||
3092 | struct conncmd *p_connect; | 2277 | struct conncmd *p_connect; |
3093 | struct sk_buff *skb; | 2278 | struct sk_buff *skb; |
3094 | 2279 | ||
3095 | #ifdef FUNCTRACE | 2280 | CLAW_DBF_TEXT(2, setup, "sndcntl"); |
3096 | printk(KERN_INFO "%s:%s > enter \n",dev->name,__func__); | ||
3097 | #endif | ||
3098 | CLAW_DBF_TEXT(2,setup,"sndcntl"); | ||
3099 | #ifdef DEBUGMSG | ||
3100 | printk(KERN_INFO "%s: Sending Control Packet \n",dev->name); | ||
3101 | printk(KERN_INFO "%s: variable type = 0x%X, link = " | ||
3102 | "%d, correlator = %d, rc = %d\n", | ||
3103 | dev->name,type, link, correlator, rc); | ||
3104 | printk(KERN_INFO "%s: variable local_name = %s, " | ||
3105 | "remote_name = %s\n",dev->name, local_name, remote_name); | ||
3106 | #endif | ||
3107 | privptr=dev->priv; | 2281 | privptr=dev->priv; |
3108 | p_ctl=(struct clawctl *)&privptr->ctl_bk; | 2282 | p_ctl=(struct clawctl *)&privptr->ctl_bk; |
3109 | 2283 | ||
@@ -3125,7 +2299,7 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, | |||
3125 | p_sysval->read_frame_size=DEF_PACK_BUFSIZE; | 2299 | p_sysval->read_frame_size=DEF_PACK_BUFSIZE; |
3126 | p_sysval->write_frame_size=DEF_PACK_BUFSIZE; | 2300 | p_sysval->write_frame_size=DEF_PACK_BUFSIZE; |
3127 | } else { | 2301 | } else { |
3128 | /* how big is the piggest group of packets */ | 2302 | /* how big is the biggest group of packets */ |
3129 | p_sysval->read_frame_size=privptr->p_env->read_size; | 2303 | p_sysval->read_frame_size=privptr->p_env->read_size; |
3130 | p_sysval->write_frame_size=privptr->p_env->write_size; | 2304 | p_sysval->write_frame_size=privptr->p_env->write_size; |
3131 | } | 2305 | } |
@@ -3155,29 +2329,14 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, | |||
3155 | 2329 | ||
3156 | skb = dev_alloc_skb(sizeof(struct clawctl)); | 2330 | skb = dev_alloc_skb(sizeof(struct clawctl)); |
3157 | if (!skb) { | 2331 | if (!skb) { |
3158 | printk( "%s:%s low on mem, returning...\n", | ||
3159 | dev->name,__func__); | ||
3160 | #ifdef DEBUG | ||
3161 | printk(KERN_INFO "%s:%s Exit, rc = ENOMEM\n", | ||
3162 | dev->name,__func__); | ||
3163 | #endif | ||
3164 | return -ENOMEM; | 2332 | return -ENOMEM; |
3165 | } | 2333 | } |
3166 | memcpy(skb_put(skb, sizeof(struct clawctl)), | 2334 | memcpy(skb_put(skb, sizeof(struct clawctl)), |
3167 | p_ctl, sizeof(struct clawctl)); | 2335 | p_ctl, sizeof(struct clawctl)); |
3168 | #ifdef IOTRACE | ||
3169 | printk(KERN_INFO "%s: outbnd claw cntl data \n",dev->name); | ||
3170 | dumpit((char *)p_ctl,sizeof(struct clawctl)); | ||
3171 | #endif | ||
3172 | if (privptr->p_env->packing >= PACK_SEND) | 2336 | if (privptr->p_env->packing >= PACK_SEND) |
3173 | claw_hw_tx(skb, dev, 1); | 2337 | claw_hw_tx(skb, dev, 1); |
3174 | else | 2338 | else |
3175 | claw_hw_tx(skb, dev, 0); | 2339 | claw_hw_tx(skb, dev, 0); |
3176 | #ifdef FUNCTRACE | ||
3177 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3178 | dev->name,__func__,__LINE__); | ||
3179 | #endif | ||
3180 | |||
3181 | return 0; | 2340 | return 0; |
3182 | } /* end of claw_send_control */ | 2341 | } /* end of claw_send_control */ |
3183 | 2342 | ||
@@ -3192,22 +2351,11 @@ claw_snd_conn_req(struct net_device *dev, __u8 link) | |||
3192 | struct claw_privbk *privptr=dev->priv; | 2351 | struct claw_privbk *privptr=dev->priv; |
3193 | struct clawctl *p_ctl; | 2352 | struct clawctl *p_ctl; |
3194 | 2353 | ||
3195 | #ifdef FUNCTRACE | 2354 | CLAW_DBF_TEXT(2, setup, "snd_conn"); |
3196 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
3197 | #endif | ||
3198 | CLAW_DBF_TEXT(2,setup,"snd_conn"); | ||
3199 | #ifdef DEBUGMSG | ||
3200 | printk(KERN_INFO "%s: variable link = %X, dev =\n",dev->name, link); | ||
3201 | dumpit((char *) dev, sizeof(struct net_device)); | ||
3202 | #endif | ||
3203 | rc = 1; | 2355 | rc = 1; |
3204 | p_ctl=(struct clawctl *)&privptr->ctl_bk; | 2356 | p_ctl=(struct clawctl *)&privptr->ctl_bk; |
3205 | p_ctl->linkid = link; | 2357 | p_ctl->linkid = link; |
3206 | if ( privptr->system_validate_comp==0x00 ) { | 2358 | if ( privptr->system_validate_comp==0x00 ) { |
3207 | #ifdef FUNCTRACE | ||
3208 | printk(KERN_INFO "%s:%s Exit on line %d, rc = 1\n", | ||
3209 | dev->name,__func__,__LINE__); | ||
3210 | #endif | ||
3211 | return rc; | 2359 | return rc; |
3212 | } | 2360 | } |
3213 | if (privptr->p_env->packing == PACKING_ASK ) | 2361 | if (privptr->p_env->packing == PACKING_ASK ) |
@@ -3220,10 +2368,6 @@ claw_snd_conn_req(struct net_device *dev, __u8 link) | |||
3220 | if (privptr->p_env->packing == 0) | 2368 | if (privptr->p_env->packing == 0) |
3221 | rc=claw_send_control(dev, CONNECTION_REQUEST,0,0,0, | 2369 | rc=claw_send_control(dev, CONNECTION_REQUEST,0,0,0, |
3222 | HOST_APPL_NAME, privptr->p_env->api_type); | 2370 | HOST_APPL_NAME, privptr->p_env->api_type); |
3223 | #ifdef FUNCTRACE | ||
3224 | printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", | ||
3225 | dev->name,__func__,__LINE__, rc); | ||
3226 | #endif | ||
3227 | return rc; | 2371 | return rc; |
3228 | 2372 | ||
3229 | } /* end of claw_snd_conn_req */ | 2373 | } /* end of claw_snd_conn_req */ |
@@ -3240,25 +2384,12 @@ claw_snd_disc(struct net_device *dev, struct clawctl * p_ctl) | |||
3240 | int rc; | 2384 | int rc; |
3241 | struct conncmd * p_connect; | 2385 | struct conncmd * p_connect; |
3242 | 2386 | ||
3243 | #ifdef FUNCTRACE | 2387 | CLAW_DBF_TEXT(2, setup, "snd_dsc"); |
3244 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
3245 | #endif | ||
3246 | CLAW_DBF_TEXT(2,setup,"snd_dsc"); | ||
3247 | #ifdef DEBUGMSG | ||
3248 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
3249 | dumpit((char *) dev, sizeof(struct net_device)); | ||
3250 | printk(KERN_INFO "%s: variable p_ctl",dev->name); | ||
3251 | dumpit((char *) p_ctl, sizeof(struct clawctl)); | ||
3252 | #endif | ||
3253 | p_connect=(struct conncmd *)&p_ctl->data; | 2388 | p_connect=(struct conncmd *)&p_ctl->data; |
3254 | 2389 | ||
3255 | rc=claw_send_control(dev, DISCONNECT, p_ctl->linkid, | 2390 | rc=claw_send_control(dev, DISCONNECT, p_ctl->linkid, |
3256 | p_ctl->correlator, 0, | 2391 | p_ctl->correlator, 0, |
3257 | p_connect->host_name, p_connect->WS_name); | 2392 | p_connect->host_name, p_connect->WS_name); |
3258 | #ifdef FUNCTRACE | ||
3259 | printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", | ||
3260 | dev->name,__func__, __LINE__, rc); | ||
3261 | #endif | ||
3262 | return rc; | 2393 | return rc; |
3263 | } /* end of claw_snd_disc */ | 2394 | } /* end of claw_snd_disc */ |
3264 | 2395 | ||
@@ -3276,18 +2407,7 @@ claw_snd_sys_validate_rsp(struct net_device *dev, | |||
3276 | struct claw_privbk *privptr; | 2407 | struct claw_privbk *privptr; |
3277 | int rc; | 2408 | int rc; |
3278 | 2409 | ||
3279 | #ifdef FUNCTRACE | 2410 | CLAW_DBF_TEXT(2, setup, "chkresp"); |
3280 | printk(KERN_INFO "%s:%s Enter\n", | ||
3281 | dev->name,__func__); | ||
3282 | #endif | ||
3283 | CLAW_DBF_TEXT(2,setup,"chkresp"); | ||
3284 | #ifdef DEBUGMSG | ||
3285 | printk(KERN_INFO "%s: variable return_code = %d, dev =\n", | ||
3286 | dev->name, return_code); | ||
3287 | dumpit((char *) dev, sizeof(struct net_device)); | ||
3288 | printk(KERN_INFO "%s: variable p_ctl =\n",dev->name); | ||
3289 | dumpit((char *) p_ctl, sizeof(struct clawctl)); | ||
3290 | #endif | ||
3291 | privptr = dev->priv; | 2411 | privptr = dev->priv; |
3292 | p_env=privptr->p_env; | 2412 | p_env=privptr->p_env; |
3293 | rc=claw_send_control(dev, SYSTEM_VALIDATE_RESPONSE, | 2413 | rc=claw_send_control(dev, SYSTEM_VALIDATE_RESPONSE, |
@@ -3296,10 +2416,6 @@ claw_snd_sys_validate_rsp(struct net_device *dev, | |||
3296 | return_code, | 2416 | return_code, |
3297 | p_env->host_name, | 2417 | p_env->host_name, |
3298 | p_env->adapter_name ); | 2418 | p_env->adapter_name ); |
3299 | #ifdef FUNCTRACE | ||
3300 | printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", | ||
3301 | dev->name,__func__,__LINE__, rc); | ||
3302 | #endif | ||
3303 | return rc; | 2419 | return rc; |
3304 | } /* end of claw_snd_sys_validate_rsp */ | 2420 | } /* end of claw_snd_sys_validate_rsp */ |
3305 | 2421 | ||
@@ -3313,19 +2429,8 @@ claw_strt_conn_req(struct net_device *dev ) | |||
3313 | { | 2429 | { |
3314 | int rc; | 2430 | int rc; |
3315 | 2431 | ||
3316 | #ifdef FUNCTRACE | 2432 | CLAW_DBF_TEXT(2, setup, "conn_req"); |
3317 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
3318 | #endif | ||
3319 | CLAW_DBF_TEXT(2,setup,"conn_req"); | ||
3320 | #ifdef DEBUGMSG | ||
3321 | printk(KERN_INFO "%s: variable dev =\n",dev->name); | ||
3322 | dumpit((char *) dev, sizeof(struct net_device)); | ||
3323 | #endif | ||
3324 | rc=claw_snd_conn_req(dev, 1); | 2433 | rc=claw_snd_conn_req(dev, 1); |
3325 | #ifdef FUNCTRACE | ||
3326 | printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", | ||
3327 | dev->name,__func__,__LINE__, rc); | ||
3328 | #endif | ||
3329 | return rc; | 2434 | return rc; |
3330 | } /* end of claw_strt_conn_req */ | 2435 | } /* end of claw_strt_conn_req */ |
3331 | 2436 | ||
@@ -3339,15 +2444,9 @@ static struct | |||
3339 | net_device_stats *claw_stats(struct net_device *dev) | 2444 | net_device_stats *claw_stats(struct net_device *dev) |
3340 | { | 2445 | { |
3341 | struct claw_privbk *privptr; | 2446 | struct claw_privbk *privptr; |
3342 | #ifdef FUNCTRACE | 2447 | |
3343 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | 2448 | CLAW_DBF_TEXT(4, trace, "stats"); |
3344 | #endif | ||
3345 | CLAW_DBF_TEXT(4,trace,"stats"); | ||
3346 | privptr = dev->priv; | 2449 | privptr = dev->priv; |
3347 | #ifdef FUNCTRACE | ||
3348 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3349 | dev->name,__func__,__LINE__); | ||
3350 | #endif | ||
3351 | return &privptr->stats; | 2450 | return &privptr->stats; |
3352 | } /* end of claw_stats */ | 2451 | } /* end of claw_stats */ |
3353 | 2452 | ||
@@ -3368,36 +2467,28 @@ unpack_read(struct net_device *dev ) | |||
3368 | struct clawph *p_packh; | 2467 | struct clawph *p_packh; |
3369 | void *p_packd; | 2468 | void *p_packd; |
3370 | struct clawctl *p_ctlrec=NULL; | 2469 | struct clawctl *p_ctlrec=NULL; |
2470 | struct device *p_dev; | ||
3371 | 2471 | ||
3372 | __u32 len_of_data; | 2472 | __u32 len_of_data; |
3373 | __u32 pack_off; | 2473 | __u32 pack_off; |
3374 | __u8 link_num; | 2474 | __u8 link_num; |
3375 | __u8 mtc_this_frm=0; | 2475 | __u8 mtc_this_frm=0; |
3376 | __u32 bytes_to_mov; | 2476 | __u32 bytes_to_mov; |
3377 | struct chbk *p_ch = NULL; | ||
3378 | int i=0; | 2477 | int i=0; |
3379 | int p=0; | 2478 | int p=0; |
3380 | 2479 | ||
3381 | #ifdef FUNCTRACE | 2480 | CLAW_DBF_TEXT(4, trace, "unpkread"); |
3382 | printk(KERN_INFO "%s:%s enter \n",dev->name,__func__); | ||
3383 | #endif | ||
3384 | CLAW_DBF_TEXT(4,trace,"unpkread"); | ||
3385 | p_first_ccw=NULL; | 2481 | p_first_ccw=NULL; |
3386 | p_last_ccw=NULL; | 2482 | p_last_ccw=NULL; |
3387 | p_packh=NULL; | 2483 | p_packh=NULL; |
3388 | p_packd=NULL; | 2484 | p_packd=NULL; |
3389 | privptr=dev->priv; | 2485 | privptr=dev->priv; |
2486 | |||
2487 | p_dev = &privptr->channel[READ].cdev->dev; | ||
3390 | p_env = privptr->p_env; | 2488 | p_env = privptr->p_env; |
3391 | p_this_ccw=privptr->p_read_active_first; | 2489 | p_this_ccw=privptr->p_read_active_first; |
3392 | i=0; | 2490 | i=0; |
3393 | while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { | 2491 | while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { |
3394 | #ifdef IOTRACE | ||
3395 | printk(KERN_INFO "%s p_this_ccw \n",dev->name); | ||
3396 | dumpit((char*)p_this_ccw, sizeof(struct ccwbk)); | ||
3397 | printk(KERN_INFO "%s Inbound p_this_ccw->p_buffer(64)" | ||
3398 | " pk=%d \n",dev->name,p_env->packing); | ||
3399 | dumpit((char *)p_this_ccw->p_buffer, 64 ); | ||
3400 | #endif | ||
3401 | pack_off = 0; | 2492 | pack_off = 0; |
3402 | p = 0; | 2493 | p = 0; |
3403 | p_this_ccw->header.flag=CLAW_PENDING; | 2494 | p_this_ccw->header.flag=CLAW_PENDING; |
@@ -3419,10 +2510,6 @@ unpack_read(struct net_device *dev ) | |||
3419 | else | 2510 | else |
3420 | link_num=p_this_ccw->header.opcode / 8; | 2511 | link_num=p_this_ccw->header.opcode / 8; |
3421 | if ((p_this_ccw->header.opcode & MORE_to_COME_FLAG)!=0) { | 2512 | if ((p_this_ccw->header.opcode & MORE_to_COME_FLAG)!=0) { |
3422 | #ifdef DEBUGMSG | ||
3423 | printk(KERN_INFO "%s: %s > More_to_come is ON\n", | ||
3424 | dev->name,__func__); | ||
3425 | #endif | ||
3426 | mtc_this_frm=1; | 2513 | mtc_this_frm=1; |
3427 | if (p_this_ccw->header.length!= | 2514 | if (p_this_ccw->header.length!= |
3428 | privptr->p_env->read_size ) { | 2515 | privptr->p_env->read_size ) { |
@@ -3445,22 +2532,12 @@ unpack_read(struct net_device *dev ) | |||
3445 | privptr->mtc_skipping=0; /* Ok, the end */ | 2532 | privptr->mtc_skipping=0; /* Ok, the end */ |
3446 | privptr->mtc_logical_link=-1; | 2533 | privptr->mtc_logical_link=-1; |
3447 | } | 2534 | } |
3448 | #ifdef DEBUGMSG | ||
3449 | printk(KERN_INFO "%s:%s goto next " | ||
3450 | "frame from MoretoComeSkip \n", | ||
3451 | dev->name,__func__); | ||
3452 | #endif | ||
3453 | goto NextFrame; | 2535 | goto NextFrame; |
3454 | } | 2536 | } |
3455 | 2537 | ||
3456 | if (link_num==0) { | 2538 | if (link_num==0) { |
3457 | claw_process_control(dev, p_this_ccw); | 2539 | claw_process_control(dev, p_this_ccw); |
3458 | #ifdef DEBUGMSG | 2540 | CLAW_DBF_TEXT(4, trace, "UnpkCntl"); |
3459 | printk(KERN_INFO "%s:%s goto next " | ||
3460 | "frame from claw_process_control \n", | ||
3461 | dev->name,__func__); | ||
3462 | #endif | ||
3463 | CLAW_DBF_TEXT(4,trace,"UnpkCntl"); | ||
3464 | goto NextFrame; | 2541 | goto NextFrame; |
3465 | } | 2542 | } |
3466 | unpack_next: | 2543 | unpack_next: |
@@ -3479,10 +2556,6 @@ unpack_next: | |||
3479 | bytes_to_mov=p_this_ccw->header.length; | 2556 | bytes_to_mov=p_this_ccw->header.length; |
3480 | } | 2557 | } |
3481 | if (privptr->mtc_logical_link<0) { | 2558 | if (privptr->mtc_logical_link<0) { |
3482 | #ifdef DEBUGMSG | ||
3483 | printk(KERN_INFO "%s: %s mtc_logical_link < 0 \n", | ||
3484 | dev->name,__func__); | ||
3485 | #endif | ||
3486 | 2559 | ||
3487 | /* | 2560 | /* |
3488 | * if More-To-Come is set in this frame then we don't know | 2561 | * if More-To-Come is set in this frame then we don't know |
@@ -3496,15 +2569,6 @@ unpack_next: | |||
3496 | 2569 | ||
3497 | if (bytes_to_mov > (MAX_ENVELOPE_SIZE- privptr->mtc_offset) ) { | 2570 | if (bytes_to_mov > (MAX_ENVELOPE_SIZE- privptr->mtc_offset) ) { |
3498 | /* error */ | 2571 | /* error */ |
3499 | #ifdef DEBUGMSG | ||
3500 | printk(KERN_INFO "%s: %s > goto next " | ||
3501 | "frame from MoretoComeSkip \n", | ||
3502 | dev->name, | ||
3503 | __func__); | ||
3504 | printk(KERN_INFO " bytes_to_mov %d > (MAX_ENVELOPE_" | ||
3505 | "SIZE-privptr->mtc_offset %d)\n", | ||
3506 | bytes_to_mov,(MAX_ENVELOPE_SIZE- privptr->mtc_offset)); | ||
3507 | #endif | ||
3508 | privptr->stats.rx_frame_errors++; | 2572 | privptr->stats.rx_frame_errors++; |
3509 | goto NextFrame; | 2573 | goto NextFrame; |
3510 | } | 2574 | } |
@@ -3516,16 +2580,6 @@ unpack_next: | |||
3516 | memcpy( privptr->p_mtc_envelope+ privptr->mtc_offset, | 2580 | memcpy( privptr->p_mtc_envelope+ privptr->mtc_offset, |
3517 | p_this_ccw->p_buffer, bytes_to_mov); | 2581 | p_this_ccw->p_buffer, bytes_to_mov); |
3518 | } | 2582 | } |
3519 | #ifdef DEBUGMSG | ||
3520 | printk(KERN_INFO "%s: %s() received data \n", | ||
3521 | dev->name,__func__); | ||
3522 | if (p_env->packing == DO_PACKED) | ||
3523 | dumpit((char *)p_packd+sizeof(struct clawph),32); | ||
3524 | else | ||
3525 | dumpit((char *)p_this_ccw->p_buffer, 32); | ||
3526 | printk(KERN_INFO "%s: %s() bytelength %d \n", | ||
3527 | dev->name,__func__,bytes_to_mov); | ||
3528 | #endif | ||
3529 | if (mtc_this_frm==0) { | 2583 | if (mtc_this_frm==0) { |
3530 | len_of_data=privptr->mtc_offset+bytes_to_mov; | 2584 | len_of_data=privptr->mtc_offset+bytes_to_mov; |
3531 | skb=dev_alloc_skb(len_of_data); | 2585 | skb=dev_alloc_skb(len_of_data); |
@@ -3540,11 +2594,6 @@ unpack_next: | |||
3540 | privptr->stats.rx_packets++; | 2594 | privptr->stats.rx_packets++; |
3541 | privptr->stats.rx_bytes+=len_of_data; | 2595 | privptr->stats.rx_bytes+=len_of_data; |
3542 | netif_rx(skb); | 2596 | netif_rx(skb); |
3543 | #ifdef DEBUGMSG | ||
3544 | printk(KERN_INFO "%s: %s() netif_" | ||
3545 | "rx(skb) completed \n", | ||
3546 | dev->name,__func__); | ||
3547 | #endif | ||
3548 | } | 2597 | } |
3549 | else { | 2598 | else { |
3550 | privptr->stats.rx_dropped++; | 2599 | privptr->stats.rx_dropped++; |
@@ -3581,28 +2630,14 @@ NextFrame: | |||
3581 | * chain to next block on active read queue | 2630 | * chain to next block on active read queue |
3582 | */ | 2631 | */ |
3583 | p_this_ccw = privptr->p_read_active_first; | 2632 | p_this_ccw = privptr->p_read_active_first; |
3584 | CLAW_DBF_TEXT_(4,trace,"rxpkt %d",p); | 2633 | CLAW_DBF_TEXT_(4, trace, "rxpkt %d", p); |
3585 | } /* end of while */ | 2634 | } /* end of while */ |
3586 | 2635 | ||
3587 | /* check validity */ | 2636 | /* check validity */ |
3588 | 2637 | ||
3589 | #ifdef IOTRACE | 2638 | CLAW_DBF_TEXT_(4, trace, "rxfrm %d", i); |
3590 | printk(KERN_INFO "%s:%s processed frame is %d \n", | ||
3591 | dev->name,__func__,i); | ||
3592 | printk(KERN_INFO "%s:%s F:%lx L:%lx\n", | ||
3593 | dev->name, | ||
3594 | __func__, | ||
3595 | (unsigned long)p_first_ccw, | ||
3596 | (unsigned long)p_last_ccw); | ||
3597 | #endif | ||
3598 | CLAW_DBF_TEXT_(4,trace,"rxfrm %d",i); | ||
3599 | add_claw_reads(dev, p_first_ccw, p_last_ccw); | 2639 | add_claw_reads(dev, p_first_ccw, p_last_ccw); |
3600 | p_ch=&privptr->channel[READ]; | ||
3601 | claw_strt_read(dev, LOCK_YES); | 2640 | claw_strt_read(dev, LOCK_YES); |
3602 | #ifdef FUNCTRACE | ||
3603 | printk(KERN_INFO "%s: %s exit on line %d\n", | ||
3604 | dev->name, __func__, __LINE__); | ||
3605 | #endif | ||
3606 | return; | 2641 | return; |
3607 | } /* end of unpack_read */ | 2642 | } /* end of unpack_read */ |
3608 | 2643 | ||
@@ -3622,12 +2657,7 @@ claw_strt_read (struct net_device *dev, int lock ) | |||
3622 | struct clawh *p_clawh; | 2657 | struct clawh *p_clawh; |
3623 | p_ch=&privptr->channel[READ]; | 2658 | p_ch=&privptr->channel[READ]; |
3624 | 2659 | ||
3625 | #ifdef FUNCTRACE | 2660 | CLAW_DBF_TEXT(4, trace, "StRdNter"); |
3626 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); | ||
3627 | printk(KERN_INFO "%s: variable lock = %d, dev =\n",dev->name, lock); | ||
3628 | dumpit((char *) dev, sizeof(struct net_device)); | ||
3629 | #endif | ||
3630 | CLAW_DBF_TEXT(4,trace,"StRdNter"); | ||
3631 | p_clawh=(struct clawh *)privptr->p_claw_signal_blk; | 2661 | p_clawh=(struct clawh *)privptr->p_claw_signal_blk; |
3632 | p_clawh->flag=CLAW_IDLE; /* 0x00 */ | 2662 | p_clawh->flag=CLAW_IDLE; /* 0x00 */ |
3633 | 2663 | ||
@@ -3637,21 +2667,11 @@ claw_strt_read (struct net_device *dev, int lock ) | |||
3637 | privptr->p_read_active_first->header.flag!=CLAW_PENDING )) { | 2667 | privptr->p_read_active_first->header.flag!=CLAW_PENDING )) { |
3638 | p_clawh->flag=CLAW_BUSY; /* 0xff */ | 2668 | p_clawh->flag=CLAW_BUSY; /* 0xff */ |
3639 | } | 2669 | } |
3640 | #ifdef DEBUGMSG | ||
3641 | printk(KERN_INFO "%s:%s state-%02x\n" , | ||
3642 | dev->name,__func__, p_ch->claw_state); | ||
3643 | #endif | ||
3644 | if (lock==LOCK_YES) { | 2670 | if (lock==LOCK_YES) { |
3645 | spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); | 2671 | spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); |
3646 | } | 2672 | } |
3647 | if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { | 2673 | if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { |
3648 | #ifdef DEBUGMSG | 2674 | CLAW_DBF_TEXT(4, trace, "HotRead"); |
3649 | printk(KERN_INFO "%s: HOT READ started in %s\n" , | ||
3650 | dev->name,__func__); | ||
3651 | p_clawh=(struct clawh *)privptr->p_claw_signal_blk; | ||
3652 | dumpit((char *)&p_clawh->flag , 1); | ||
3653 | #endif | ||
3654 | CLAW_DBF_TEXT(4,trace,"HotRead"); | ||
3655 | p_ccwbk=privptr->p_read_active_first; | 2675 | p_ccwbk=privptr->p_read_active_first; |
3656 | parm = (unsigned long) p_ch; | 2676 | parm = (unsigned long) p_ch; |
3657 | rc = ccw_device_start (p_ch->cdev, &p_ccwbk->read, parm, | 2677 | rc = ccw_device_start (p_ch->cdev, &p_ccwbk->read, parm, |
@@ -3661,21 +2681,13 @@ claw_strt_read (struct net_device *dev, int lock ) | |||
3661 | } | 2681 | } |
3662 | } | 2682 | } |
3663 | else { | 2683 | else { |
3664 | #ifdef DEBUGMSG | 2684 | CLAW_DBF_TEXT(2, trace, "ReadAct"); |
3665 | printk(KERN_INFO "%s: No READ started by %s() In progress\n" , | ||
3666 | dev->name,__func__); | ||
3667 | #endif | ||
3668 | CLAW_DBF_TEXT(2,trace,"ReadAct"); | ||
3669 | } | 2685 | } |
3670 | 2686 | ||
3671 | if (lock==LOCK_YES) { | 2687 | if (lock==LOCK_YES) { |
3672 | spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); | 2688 | spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); |
3673 | } | 2689 | } |
3674 | #ifdef FUNCTRACE | 2690 | CLAW_DBF_TEXT(4, trace, "StRdExit"); |
3675 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3676 | dev->name,__func__,__LINE__); | ||
3677 | #endif | ||
3678 | CLAW_DBF_TEXT(4,trace,"StRdExit"); | ||
3679 | return; | 2691 | return; |
3680 | } /* end of claw_strt_read */ | 2692 | } /* end of claw_strt_read */ |
3681 | 2693 | ||
@@ -3693,38 +2705,23 @@ claw_strt_out_IO( struct net_device *dev ) | |||
3693 | struct chbk *p_ch; | 2705 | struct chbk *p_ch; |
3694 | struct ccwbk *p_first_ccw; | 2706 | struct ccwbk *p_first_ccw; |
3695 | 2707 | ||
3696 | #ifdef FUNCTRACE | ||
3697 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
3698 | #endif | ||
3699 | if (!dev) { | 2708 | if (!dev) { |
3700 | return; | 2709 | return; |
3701 | } | 2710 | } |
3702 | privptr=(struct claw_privbk *)dev->priv; | 2711 | privptr=(struct claw_privbk *)dev->priv; |
3703 | p_ch=&privptr->channel[WRITE]; | 2712 | p_ch=&privptr->channel[WRITE]; |
3704 | 2713 | ||
3705 | #ifdef DEBUGMSG | 2714 | CLAW_DBF_TEXT(4, trace, "strt_io"); |
3706 | printk(KERN_INFO "%s:%s state-%02x\n" , | ||
3707 | dev->name,__func__,p_ch->claw_state); | ||
3708 | #endif | ||
3709 | CLAW_DBF_TEXT(4,trace,"strt_io"); | ||
3710 | p_first_ccw=privptr->p_write_active_first; | 2715 | p_first_ccw=privptr->p_write_active_first; |
3711 | 2716 | ||
3712 | if (p_ch->claw_state == CLAW_STOP) | 2717 | if (p_ch->claw_state == CLAW_STOP) |
3713 | return; | 2718 | return; |
3714 | if (p_first_ccw == NULL) { | 2719 | if (p_first_ccw == NULL) { |
3715 | #ifdef FUNCTRACE | ||
3716 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3717 | dev->name,__func__,__LINE__); | ||
3718 | #endif | ||
3719 | return; | 2720 | return; |
3720 | } | 2721 | } |
3721 | if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { | 2722 | if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { |
3722 | parm = (unsigned long) p_ch; | 2723 | parm = (unsigned long) p_ch; |
3723 | #ifdef DEBUGMSG | 2724 | CLAW_DBF_TEXT(2, trace, "StWrtIO"); |
3724 | printk(KERN_INFO "%s:%s do_io \n" ,dev->name,__func__); | ||
3725 | dumpit((char *)p_first_ccw, sizeof(struct ccwbk)); | ||
3726 | #endif | ||
3727 | CLAW_DBF_TEXT(2,trace,"StWrtIO"); | ||
3728 | rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm, | 2725 | rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm, |
3729 | 0xff, 0); | 2726 | 0xff, 0); |
3730 | if (rc != 0) { | 2727 | if (rc != 0) { |
@@ -3732,11 +2729,6 @@ claw_strt_out_IO( struct net_device *dev ) | |||
3732 | } | 2729 | } |
3733 | } | 2730 | } |
3734 | dev->trans_start = jiffies; | 2731 | dev->trans_start = jiffies; |
3735 | #ifdef FUNCTRACE | ||
3736 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3737 | dev->name,__func__,__LINE__); | ||
3738 | #endif | ||
3739 | |||
3740 | return; | 2732 | return; |
3741 | } /* end of claw_strt_out_IO */ | 2733 | } /* end of claw_strt_out_IO */ |
3742 | 2734 | ||
@@ -3754,32 +2746,11 @@ claw_free_wrt_buf( struct net_device *dev ) | |||
3754 | struct ccwbk*p_last_ccw; | 2746 | struct ccwbk*p_last_ccw; |
3755 | struct ccwbk*p_this_ccw; | 2747 | struct ccwbk*p_this_ccw; |
3756 | struct ccwbk*p_next_ccw; | 2748 | struct ccwbk*p_next_ccw; |
3757 | #ifdef IOTRACE | 2749 | |
3758 | struct ccwbk*p_buf; | 2750 | CLAW_DBF_TEXT(4, trace, "freewrtb"); |
3759 | #endif | ||
3760 | #ifdef FUNCTRACE | ||
3761 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
3762 | printk(KERN_INFO "%s: free count = %d variable dev =\n", | ||
3763 | dev->name,privptr->write_free_count); | ||
3764 | #endif | ||
3765 | CLAW_DBF_TEXT(4,trace,"freewrtb"); | ||
3766 | /* scan the write queue to free any completed write packets */ | 2751 | /* scan the write queue to free any completed write packets */ |
3767 | p_first_ccw=NULL; | 2752 | p_first_ccw=NULL; |
3768 | p_last_ccw=NULL; | 2753 | p_last_ccw=NULL; |
3769 | #ifdef IOTRACE | ||
3770 | printk(KERN_INFO "%s: Dump current CCW chain \n",dev->name ); | ||
3771 | p_buf=privptr->p_write_active_first; | ||
3772 | while (p_buf!=NULL) { | ||
3773 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
3774 | p_buf=p_buf->next; | ||
3775 | } | ||
3776 | if (p_buf==NULL) { | ||
3777 | printk(KERN_INFO "%s: privptr->p_write_" | ||
3778 | "active_first==NULL\n",dev->name ); | ||
3779 | } | ||
3780 | p_buf=(struct ccwbk*)privptr->p_end_ccw; | ||
3781 | dumpit((char *)p_buf, sizeof(struct endccw)); | ||
3782 | #endif | ||
3783 | p_this_ccw=privptr->p_write_active_first; | 2754 | p_this_ccw=privptr->p_write_active_first; |
3784 | while ( (p_this_ccw!=NULL) && (p_this_ccw->header.flag!=CLAW_PENDING)) | 2755 | while ( (p_this_ccw!=NULL) && (p_this_ccw->header.flag!=CLAW_PENDING)) |
3785 | { | 2756 | { |
@@ -3809,31 +2780,8 @@ claw_free_wrt_buf( struct net_device *dev ) | |||
3809 | /* whole chain removed? */ | 2780 | /* whole chain removed? */ |
3810 | if (privptr->p_write_active_first==NULL) { | 2781 | if (privptr->p_write_active_first==NULL) { |
3811 | privptr->p_write_active_last=NULL; | 2782 | privptr->p_write_active_last=NULL; |
3812 | #ifdef DEBUGMSG | ||
3813 | printk(KERN_INFO "%s:%s p_write_" | ||
3814 | "active_first==NULL\n",dev->name,__func__); | ||
3815 | #endif | ||
3816 | } | ||
3817 | #ifdef IOTRACE | ||
3818 | printk(KERN_INFO "%s: Dump arranged CCW chain \n",dev->name ); | ||
3819 | p_buf=privptr->p_write_active_first; | ||
3820 | while (p_buf!=NULL) { | ||
3821 | dumpit((char *)p_buf, sizeof(struct ccwbk)); | ||
3822 | p_buf=p_buf->next; | ||
3823 | } | 2783 | } |
3824 | if (p_buf==NULL) { | 2784 | CLAW_DBF_TEXT_(4, trace, "FWC=%d", privptr->write_free_count); |
3825 | printk(KERN_INFO "%s: privptr->p_write_active_" | ||
3826 | "first==NULL\n",dev->name ); | ||
3827 | } | ||
3828 | p_buf=(struct ccwbk*)privptr->p_end_ccw; | ||
3829 | dumpit((char *)p_buf, sizeof(struct endccw)); | ||
3830 | #endif | ||
3831 | |||
3832 | CLAW_DBF_TEXT_(4,trace,"FWC=%d",privptr->write_free_count); | ||
3833 | #ifdef FUNCTRACE | ||
3834 | printk(KERN_INFO "%s:%s Exit on line %d free_count =%d\n", | ||
3835 | dev->name,__func__, __LINE__,privptr->write_free_count); | ||
3836 | #endif | ||
3837 | return; | 2785 | return; |
3838 | } | 2786 | } |
3839 | 2787 | ||
@@ -3845,14 +2793,11 @@ static void | |||
3845 | claw_free_netdevice(struct net_device * dev, int free_dev) | 2793 | claw_free_netdevice(struct net_device * dev, int free_dev) |
3846 | { | 2794 | { |
3847 | struct claw_privbk *privptr; | 2795 | struct claw_privbk *privptr; |
3848 | #ifdef FUNCTRACE | ||
3849 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | ||
3850 | #endif | ||
3851 | CLAW_DBF_TEXT(2,setup,"free_dev"); | ||
3852 | 2796 | ||
2797 | CLAW_DBF_TEXT(2, setup, "free_dev"); | ||
3853 | if (!dev) | 2798 | if (!dev) |
3854 | return; | 2799 | return; |
3855 | CLAW_DBF_TEXT_(2,setup,"%s",dev->name); | 2800 | CLAW_DBF_TEXT_(2, setup, "%s", dev->name); |
3856 | privptr = dev->priv; | 2801 | privptr = dev->priv; |
3857 | if (dev->flags & IFF_RUNNING) | 2802 | if (dev->flags & IFF_RUNNING) |
3858 | claw_release(dev); | 2803 | claw_release(dev); |
@@ -3865,10 +2810,7 @@ claw_free_netdevice(struct net_device * dev, int free_dev) | |||
3865 | free_netdev(dev); | 2810 | free_netdev(dev); |
3866 | } | 2811 | } |
3867 | #endif | 2812 | #endif |
3868 | CLAW_DBF_TEXT(2,setup,"feee_ok"); | 2813 | CLAW_DBF_TEXT(2, setup, "free_ok"); |
3869 | #ifdef FUNCTRACE | ||
3870 | printk(KERN_INFO "%s:%s Exit\n",dev->name,__func__); | ||
3871 | #endif | ||
3872 | } | 2814 | } |
3873 | 2815 | ||
3874 | /** | 2816 | /** |
@@ -3879,17 +2821,8 @@ claw_free_netdevice(struct net_device * dev, int free_dev) | |||
3879 | static void | 2821 | static void |
3880 | claw_init_netdevice(struct net_device * dev) | 2822 | claw_init_netdevice(struct net_device * dev) |
3881 | { | 2823 | { |
3882 | #ifdef FUNCTRACE | 2824 | CLAW_DBF_TEXT(2, setup, "init_dev"); |
3883 | printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); | 2825 | CLAW_DBF_TEXT_(2, setup, "%s", dev->name); |
3884 | #endif | ||
3885 | CLAW_DBF_TEXT(2,setup,"init_dev"); | ||
3886 | CLAW_DBF_TEXT_(2,setup,"%s",dev->name); | ||
3887 | if (!dev) { | ||
3888 | printk(KERN_WARNING "claw:%s BAD Device exit line %d\n", | ||
3889 | __func__,__LINE__); | ||
3890 | CLAW_DBF_TEXT(2,setup,"baddev"); | ||
3891 | return; | ||
3892 | } | ||
3893 | dev->mtu = CLAW_DEFAULT_MTU_SIZE; | 2826 | dev->mtu = CLAW_DEFAULT_MTU_SIZE; |
3894 | dev->hard_start_xmit = claw_tx; | 2827 | dev->hard_start_xmit = claw_tx; |
3895 | dev->open = claw_open; | 2828 | dev->open = claw_open; |
@@ -3901,10 +2834,7 @@ claw_init_netdevice(struct net_device * dev) | |||
3901 | dev->type = ARPHRD_SLIP; | 2834 | dev->type = ARPHRD_SLIP; |
3902 | dev->tx_queue_len = 1300; | 2835 | dev->tx_queue_len = 1300; |
3903 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | 2836 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
3904 | #ifdef FUNCTRACE | 2837 | CLAW_DBF_TEXT(2, setup, "initok"); |
3905 | printk(KERN_INFO "%s:%s Exit\n",dev->name,__func__); | ||
3906 | #endif | ||
3907 | CLAW_DBF_TEXT(2,setup,"initok"); | ||
3908 | return; | 2838 | return; |
3909 | } | 2839 | } |
3910 | 2840 | ||
@@ -3921,10 +2851,7 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) | |||
3921 | struct chbk *p_ch; | 2851 | struct chbk *p_ch; |
3922 | struct ccw_dev_id dev_id; | 2852 | struct ccw_dev_id dev_id; |
3923 | 2853 | ||
3924 | #ifdef FUNCTRACE | 2854 | CLAW_DBF_TEXT_(2, setup, "%s", cdev->dev.bus_id); |
3925 | printk(KERN_INFO "%s:%s Enter\n",cdev->dev.bus_id,__func__); | ||
3926 | #endif | ||
3927 | CLAW_DBF_TEXT_(2,setup,"%s",cdev->dev.bus_id); | ||
3928 | privptr->channel[i].flag = i+1; /* Read is 1 Write is 2 */ | 2855 | privptr->channel[i].flag = i+1; /* Read is 1 Write is 2 */ |
3929 | p_ch = &privptr->channel[i]; | 2856 | p_ch = &privptr->channel[i]; |
3930 | p_ch->cdev = cdev; | 2857 | p_ch->cdev = cdev; |
@@ -3932,18 +2859,8 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) | |||
3932 | ccw_device_get_id(cdev, &dev_id); | 2859 | ccw_device_get_id(cdev, &dev_id); |
3933 | p_ch->devno = dev_id.devno; | 2860 | p_ch->devno = dev_id.devno; |
3934 | if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { | 2861 | if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { |
3935 | printk(KERN_WARNING "%s Out of memory in %s for irb\n", | ||
3936 | p_ch->id,__func__); | ||
3937 | #ifdef FUNCTRACE | ||
3938 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3939 | p_ch->id,__func__,__LINE__); | ||
3940 | #endif | ||
3941 | return -ENOMEM; | 2862 | return -ENOMEM; |
3942 | } | 2863 | } |
3943 | #ifdef FUNCTRACE | ||
3944 | printk(KERN_INFO "%s:%s Exit on line %d\n", | ||
3945 | cdev->dev.bus_id,__func__,__LINE__); | ||
3946 | #endif | ||
3947 | return 0; | 2864 | return 0; |
3948 | } | 2865 | } |
3949 | 2866 | ||
@@ -3965,9 +2882,8 @@ claw_new_device(struct ccwgroup_device *cgdev) | |||
3965 | int ret; | 2882 | int ret; |
3966 | struct ccw_dev_id dev_id; | 2883 | struct ccw_dev_id dev_id; |
3967 | 2884 | ||
3968 | pr_debug("%s() called\n", __func__); | ||
3969 | printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id); | 2885 | printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id); |
3970 | CLAW_DBF_TEXT(2,setup,"new_dev"); | 2886 | CLAW_DBF_TEXT(2, setup, "new_dev"); |
3971 | privptr = cgdev->dev.driver_data; | 2887 | privptr = cgdev->dev.driver_data; |
3972 | cgdev->cdev[READ]->dev.driver_data = privptr; | 2888 | cgdev->cdev[READ]->dev.driver_data = privptr; |
3973 | cgdev->cdev[WRITE]->dev.driver_data = privptr; | 2889 | cgdev->cdev[WRITE]->dev.driver_data = privptr; |
@@ -3982,22 +2898,21 @@ claw_new_device(struct ccwgroup_device *cgdev) | |||
3982 | if (ret == 0) | 2898 | if (ret == 0) |
3983 | ret = add_channel(cgdev->cdev[1],1,privptr); | 2899 | ret = add_channel(cgdev->cdev[1],1,privptr); |
3984 | if (ret != 0) { | 2900 | if (ret != 0) { |
3985 | printk(KERN_WARNING | 2901 | printk(KERN_WARNING |
3986 | "add channel failed " | 2902 | "add channel failed with ret = %d\n", ret); |
3987 | "with ret = %d\n", ret); | 2903 | goto out; |
3988 | goto out; | ||
3989 | } | 2904 | } |
3990 | ret = ccw_device_set_online(cgdev->cdev[READ]); | 2905 | ret = ccw_device_set_online(cgdev->cdev[READ]); |
3991 | if (ret != 0) { | 2906 | if (ret != 0) { |
3992 | printk(KERN_WARNING | 2907 | printk(KERN_WARNING |
3993 | "claw: ccw_device_set_online %s READ failed " | 2908 | "claw: ccw_device_set_online %s READ failed " |
3994 | "with ret = %d\n",cgdev->cdev[READ]->dev.bus_id,ret); | 2909 | "with ret = %d\n",cgdev->cdev[READ]->dev.bus_id,ret); |
3995 | goto out; | 2910 | goto out; |
3996 | } | 2911 | } |
3997 | ret = ccw_device_set_online(cgdev->cdev[WRITE]); | 2912 | ret = ccw_device_set_online(cgdev->cdev[WRITE]); |
3998 | if (ret != 0) { | 2913 | if (ret != 0) { |
3999 | printk(KERN_WARNING | 2914 | printk(KERN_WARNING |
4000 | "claw: ccw_device_set_online %s WRITE failed " | 2915 | "claw: ccw_device_set_online %s WRITE failed " |
4001 | "with ret = %d\n",cgdev->cdev[WRITE]->dev.bus_id, ret); | 2916 | "with ret = %d\n",cgdev->cdev[WRITE]->dev.bus_id, ret); |
4002 | goto out; | 2917 | goto out; |
4003 | } | 2918 | } |
@@ -4014,18 +2929,16 @@ claw_new_device(struct ccwgroup_device *cgdev) | |||
4014 | SET_NETDEV_DEV(dev, &cgdev->dev); | 2929 | SET_NETDEV_DEV(dev, &cgdev->dev); |
4015 | if (register_netdev(dev) != 0) { | 2930 | if (register_netdev(dev) != 0) { |
4016 | claw_free_netdevice(dev, 1); | 2931 | claw_free_netdevice(dev, 1); |
4017 | CLAW_DBF_TEXT(2,trace,"regfail"); | 2932 | CLAW_DBF_TEXT(2, trace, "regfail"); |
4018 | goto out; | 2933 | goto out; |
4019 | } | 2934 | } |
4020 | dev->flags &=~IFF_RUNNING; | 2935 | dev->flags &=~IFF_RUNNING; |
4021 | if (privptr->buffs_alloc == 0) { | 2936 | if (privptr->buffs_alloc == 0) { |
4022 | ret=init_ccw_bk(dev); | 2937 | ret=init_ccw_bk(dev); |
4023 | if (ret !=0) { | 2938 | if (ret !=0) { |
4024 | printk(KERN_WARNING | ||
4025 | "claw: init_ccw_bk failed with ret=%d\n", ret); | ||
4026 | unregister_netdev(dev); | 2939 | unregister_netdev(dev); |
4027 | claw_free_netdevice(dev,1); | 2940 | claw_free_netdevice(dev,1); |
4028 | CLAW_DBF_TEXT(2,trace,"ccwmem"); | 2941 | CLAW_DBF_TEXT(2, trace, "ccwmem"); |
4029 | goto out; | 2942 | goto out; |
4030 | } | 2943 | } |
4031 | } | 2944 | } |
@@ -4047,7 +2960,6 @@ claw_new_device(struct ccwgroup_device *cgdev) | |||
4047 | out: | 2960 | out: |
4048 | ccw_device_set_offline(cgdev->cdev[1]); | 2961 | ccw_device_set_offline(cgdev->cdev[1]); |
4049 | ccw_device_set_offline(cgdev->cdev[0]); | 2962 | ccw_device_set_offline(cgdev->cdev[0]); |
4050 | |||
4051 | return -ENODEV; | 2963 | return -ENODEV; |
4052 | } | 2964 | } |
4053 | 2965 | ||
@@ -4056,8 +2968,7 @@ claw_purge_skb_queue(struct sk_buff_head *q) | |||
4056 | { | 2968 | { |
4057 | struct sk_buff *skb; | 2969 | struct sk_buff *skb; |
4058 | 2970 | ||
4059 | CLAW_DBF_TEXT(4,trace,"purgque"); | 2971 | CLAW_DBF_TEXT(4, trace, "purgque"); |
4060 | |||
4061 | while ((skb = skb_dequeue(q))) { | 2972 | while ((skb = skb_dequeue(q))) { |
4062 | atomic_dec(&skb->users); | 2973 | atomic_dec(&skb->users); |
4063 | dev_kfree_skb_any(skb); | 2974 | dev_kfree_skb_any(skb); |
@@ -4078,8 +2989,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev) | |||
4078 | struct net_device *ndev; | 2989 | struct net_device *ndev; |
4079 | int ret; | 2990 | int ret; |
4080 | 2991 | ||
4081 | pr_debug("%s() called\n", __func__); | 2992 | CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); |
4082 | CLAW_DBF_TEXT_(2,setup,"%s",cgdev->dev.bus_id); | ||
4083 | priv = cgdev->dev.driver_data; | 2993 | priv = cgdev->dev.driver_data; |
4084 | if (!priv) | 2994 | if (!priv) |
4085 | return -ENODEV; | 2995 | return -ENODEV; |
@@ -4108,13 +3018,10 @@ claw_remove_device(struct ccwgroup_device *cgdev) | |||
4108 | { | 3018 | { |
4109 | struct claw_privbk *priv; | 3019 | struct claw_privbk *priv; |
4110 | 3020 | ||
4111 | pr_debug("%s() called\n", __func__); | 3021 | BUG_ON(!cgdev); |
4112 | CLAW_DBF_TEXT_(2,setup,"%s",cgdev->dev.bus_id); | 3022 | CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); |
4113 | priv = cgdev->dev.driver_data; | 3023 | priv = cgdev->dev.driver_data; |
4114 | if (!priv) { | 3024 | BUG_ON(!priv); |
4115 | printk(KERN_WARNING "claw: %s() no Priv exiting\n",__func__); | ||
4116 | return; | ||
4117 | } | ||
4118 | printk(KERN_INFO "claw: %s() called %s will be removed.\n", | 3025 | printk(KERN_INFO "claw: %s() called %s will be removed.\n", |
4119 | __func__,cgdev->cdev[0]->dev.bus_id); | 3026 | __func__,cgdev->cdev[0]->dev.bus_id); |
4120 | if (cgdev->state == CCWGROUP_ONLINE) | 3027 | if (cgdev->state == CCWGROUP_ONLINE) |
@@ -4133,6 +3040,8 @@ claw_remove_device(struct ccwgroup_device *cgdev) | |||
4133 | cgdev->cdev[READ]->dev.driver_data = NULL; | 3040 | cgdev->cdev[READ]->dev.driver_data = NULL; |
4134 | cgdev->cdev[WRITE]->dev.driver_data = NULL; | 3041 | cgdev->cdev[WRITE]->dev.driver_data = NULL; |
4135 | put_device(&cgdev->dev); | 3042 | put_device(&cgdev->dev); |
3043 | |||
3044 | return; | ||
4136 | } | 3045 | } |
4137 | 3046 | ||
4138 | 3047 | ||
@@ -4168,8 +3077,8 @@ claw_hname_write(struct device *dev, struct device_attribute *attr, const char * | |||
4168 | strncpy(p_env->host_name,buf, count); | 3077 | strncpy(p_env->host_name,buf, count); |
4169 | p_env->host_name[count-1] = 0x20; /* clear extra 0x0a */ | 3078 | p_env->host_name[count-1] = 0x20; /* clear extra 0x0a */ |
4170 | p_env->host_name[MAX_NAME_LEN] = 0x00; | 3079 | p_env->host_name[MAX_NAME_LEN] = 0x00; |
4171 | CLAW_DBF_TEXT(2,setup,"HstnSet"); | 3080 | CLAW_DBF_TEXT(2, setup, "HstnSet"); |
4172 | CLAW_DBF_TEXT_(2,setup,"%s",p_env->host_name); | 3081 | CLAW_DBF_TEXT_(2, setup, "%s", p_env->host_name); |
4173 | 3082 | ||
4174 | return count; | 3083 | return count; |
4175 | } | 3084 | } |
@@ -4186,7 +3095,7 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
4186 | if (!priv) | 3095 | if (!priv) |
4187 | return -ENODEV; | 3096 | return -ENODEV; |
4188 | p_env = priv->p_env; | 3097 | p_env = priv->p_env; |
4189 | return sprintf(buf, "%s\n",p_env->adapter_name); | 3098 | return sprintf(buf, "%s\n", p_env->adapter_name); |
4190 | } | 3099 | } |
4191 | 3100 | ||
4192 | static ssize_t | 3101 | static ssize_t |
@@ -4205,8 +3114,8 @@ claw_adname_write(struct device *dev, struct device_attribute *attr, const char | |||
4205 | strncpy(p_env->adapter_name,buf, count); | 3114 | strncpy(p_env->adapter_name,buf, count); |
4206 | p_env->adapter_name[count-1] = 0x20; /* clear extra 0x0a */ | 3115 | p_env->adapter_name[count-1] = 0x20; /* clear extra 0x0a */ |
4207 | p_env->adapter_name[MAX_NAME_LEN] = 0x00; | 3116 | p_env->adapter_name[MAX_NAME_LEN] = 0x00; |
4208 | CLAW_DBF_TEXT(2,setup,"AdnSet"); | 3117 | CLAW_DBF_TEXT(2, setup, "AdnSet"); |
4209 | CLAW_DBF_TEXT_(2,setup,"%s",p_env->adapter_name); | 3118 | CLAW_DBF_TEXT_(2, setup, "%s", p_env->adapter_name); |
4210 | 3119 | ||
4211 | return count; | 3120 | return count; |
4212 | } | 3121 | } |
@@ -4247,15 +3156,15 @@ claw_apname_write(struct device *dev, struct device_attribute *attr, const char | |||
4247 | p_env->read_size=DEF_PACK_BUFSIZE; | 3156 | p_env->read_size=DEF_PACK_BUFSIZE; |
4248 | p_env->write_size=DEF_PACK_BUFSIZE; | 3157 | p_env->write_size=DEF_PACK_BUFSIZE; |
4249 | p_env->packing=PACKING_ASK; | 3158 | p_env->packing=PACKING_ASK; |
4250 | CLAW_DBF_TEXT(2,setup,"PACKING"); | 3159 | CLAW_DBF_TEXT(2, setup, "PACKING"); |
4251 | } | 3160 | } |
4252 | else { | 3161 | else { |
4253 | p_env->packing=0; | 3162 | p_env->packing=0; |
4254 | p_env->read_size=CLAW_FRAME_SIZE; | 3163 | p_env->read_size=CLAW_FRAME_SIZE; |
4255 | p_env->write_size=CLAW_FRAME_SIZE; | 3164 | p_env->write_size=CLAW_FRAME_SIZE; |
4256 | CLAW_DBF_TEXT(2,setup,"ApiSet"); | 3165 | CLAW_DBF_TEXT(2, setup, "ApiSet"); |
4257 | } | 3166 | } |
4258 | CLAW_DBF_TEXT_(2,setup,"%s",p_env->api_type); | 3167 | CLAW_DBF_TEXT_(2, setup, "%s", p_env->api_type); |
4259 | return count; | 3168 | return count; |
4260 | } | 3169 | } |
4261 | 3170 | ||
@@ -4295,8 +3204,8 @@ claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char * | |||
4295 | if ((nnn > max ) || (nnn < 2)) | 3204 | if ((nnn > max ) || (nnn < 2)) |
4296 | return -EINVAL; | 3205 | return -EINVAL; |
4297 | p_env->write_buffers = nnn; | 3206 | p_env->write_buffers = nnn; |
4298 | CLAW_DBF_TEXT(2,setup,"Wbufset"); | 3207 | CLAW_DBF_TEXT(2, setup, "Wbufset"); |
4299 | CLAW_DBF_TEXT_(2,setup,"WB=%d",p_env->write_buffers); | 3208 | CLAW_DBF_TEXT_(2, setup, "WB=%d", p_env->write_buffers); |
4300 | return count; | 3209 | return count; |
4301 | } | 3210 | } |
4302 | 3211 | ||
@@ -4336,8 +3245,8 @@ claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char * | |||
4336 | if ((nnn > max ) || (nnn < 2)) | 3245 | if ((nnn > max ) || (nnn < 2)) |
4337 | return -EINVAL; | 3246 | return -EINVAL; |
4338 | p_env->read_buffers = nnn; | 3247 | p_env->read_buffers = nnn; |
4339 | CLAW_DBF_TEXT(2,setup,"Rbufset"); | 3248 | CLAW_DBF_TEXT(2, setup, "Rbufset"); |
4340 | CLAW_DBF_TEXT_(2,setup,"RB=%d",p_env->read_buffers); | 3249 | CLAW_DBF_TEXT_(2, setup, "RB=%d", p_env->read_buffers); |
4341 | return count; | 3250 | return count; |
4342 | } | 3251 | } |
4343 | 3252 | ||
@@ -4359,16 +3268,14 @@ static struct attribute_group claw_attr_group = { | |||
4359 | static int | 3268 | static int |
4360 | claw_add_files(struct device *dev) | 3269 | claw_add_files(struct device *dev) |
4361 | { | 3270 | { |
4362 | pr_debug("%s() called\n", __func__); | 3271 | CLAW_DBF_TEXT(2, setup, "add_file"); |
4363 | CLAW_DBF_TEXT(2,setup,"add_file"); | ||
4364 | return sysfs_create_group(&dev->kobj, &claw_attr_group); | 3272 | return sysfs_create_group(&dev->kobj, &claw_attr_group); |
4365 | } | 3273 | } |
4366 | 3274 | ||
4367 | static void | 3275 | static void |
4368 | claw_remove_files(struct device *dev) | 3276 | claw_remove_files(struct device *dev) |
4369 | { | 3277 | { |
4370 | pr_debug("%s() called\n", __func__); | 3278 | CLAW_DBF_TEXT(2, setup, "rem_file"); |
4371 | CLAW_DBF_TEXT(2,setup,"rem_file"); | ||
4372 | sysfs_remove_group(&dev->kobj, &claw_attr_group); | 3279 | sysfs_remove_group(&dev->kobj, &claw_attr_group); |
4373 | } | 3280 | } |
4374 | 3281 | ||
@@ -4397,35 +3304,27 @@ claw_init(void) | |||
4397 | int ret = 0; | 3304 | int ret = 0; |
4398 | printk(KERN_INFO "claw: starting driver\n"); | 3305 | printk(KERN_INFO "claw: starting driver\n"); |
4399 | 3306 | ||
4400 | #ifdef FUNCTRACE | ||
4401 | printk(KERN_INFO "claw: %s() enter \n",__func__); | ||
4402 | #endif | ||
4403 | ret = claw_register_debug_facility(); | 3307 | ret = claw_register_debug_facility(); |
4404 | if (ret) { | 3308 | if (ret) { |
4405 | printk(KERN_WARNING "claw: %s() debug_register failed %d\n", | 3309 | printk(KERN_WARNING "claw: %s() debug_register failed %d\n", |
4406 | __func__,ret); | 3310 | __func__,ret); |
4407 | return ret; | 3311 | return ret; |
4408 | } | 3312 | } |
4409 | CLAW_DBF_TEXT(2,setup,"init_mod"); | 3313 | CLAW_DBF_TEXT(2, setup, "init_mod"); |
4410 | ret = register_cu3088_discipline(&claw_group_driver); | 3314 | ret = register_cu3088_discipline(&claw_group_driver); |
4411 | if (ret) { | 3315 | if (ret) { |
3316 | CLAW_DBF_TEXT(2, setup, "init_bad"); | ||
4412 | claw_unregister_debug_facility(); | 3317 | claw_unregister_debug_facility(); |
4413 | printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n", | 3318 | printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n", |
4414 | __func__,ret); | 3319 | __func__,ret); |
4415 | } | 3320 | } |
4416 | #ifdef FUNCTRACE | ||
4417 | printk(KERN_INFO "claw: %s() exit \n",__func__); | ||
4418 | #endif | ||
4419 | return ret; | 3321 | return ret; |
4420 | } | 3322 | } |
4421 | 3323 | ||
4422 | module_init(claw_init); | 3324 | module_init(claw_init); |
4423 | module_exit(claw_cleanup); | 3325 | module_exit(claw_cleanup); |
4424 | 3326 | ||
4425 | 3327 | MODULE_AUTHOR("Andy Richter <richtera@us.ibm.com>"); | |
4426 | 3328 | MODULE_DESCRIPTION("Linux for System z CLAW Driver\n" \ | |
4427 | /*--------------------------------------------------------------------* | 3329 | "Copyright 2000,2008 IBM Corporation\n"); |
4428 | * End of File * | 3330 | MODULE_LICENSE("GPL"); |
4429 | *---------------------------------------------------------------------*/ | ||
4430 | |||
4431 | |||
diff --git a/drivers/s390/net/ctcm_dbug.c b/drivers/s390/net/ctcm_dbug.c index 8eb25d00b2e7..1ca58f153470 100644 --- a/drivers/s390/net/ctcm_dbug.c +++ b/drivers/s390/net/ctcm_dbug.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/stddef.h> | 9 | #include <linux/stddef.h> |
10 | #include <linux/string.h> | ||
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
@@ -22,15 +23,13 @@ | |||
22 | * Debug Facility Stuff | 23 | * Debug Facility Stuff |
23 | */ | 24 | */ |
24 | 25 | ||
25 | DEFINE_PER_CPU(char[256], ctcm_dbf_txt_buf); | ||
26 | |||
27 | struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = { | 26 | struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = { |
28 | [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, 5, NULL}, | 27 | [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, CTC_DBF_INFO, NULL}, |
29 | [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, 3, NULL}, | 28 | [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, CTC_DBF_ERROR, NULL}, |
30 | [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, 3, NULL}, | 29 | [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, CTC_DBF_ERROR, NULL}, |
31 | [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 64, 5, NULL}, | 30 | [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 80, CTC_DBF_INFO, NULL}, |
32 | [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 64, 3, NULL}, | 31 | [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 80, CTC_DBF_ERROR, NULL}, |
33 | [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 64, 3, NULL}, | 32 | [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 80, CTC_DBF_ERROR, NULL}, |
34 | }; | 33 | }; |
35 | 34 | ||
36 | void ctcm_unregister_dbf_views(void) | 35 | void ctcm_unregister_dbf_views(void) |
@@ -65,3 +64,17 @@ int ctcm_register_dbf_views(void) | |||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
67 | 66 | ||
67 | void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *fmt, ...) | ||
68 | { | ||
69 | char dbf_txt_buf[64]; | ||
70 | va_list args; | ||
71 | |||
72 | if (level > (ctcm_dbf[dbf_nix].id)->level) | ||
73 | return; | ||
74 | va_start(args, fmt); | ||
75 | vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args); | ||
76 | va_end(args); | ||
77 | |||
78 | debug_text_event(ctcm_dbf[dbf_nix].id, level, dbf_txt_buf); | ||
79 | } | ||
80 | |||
diff --git a/drivers/s390/net/ctcm_dbug.h b/drivers/s390/net/ctcm_dbug.h index fdff34fe59a2..26966d0b9abd 100644 --- a/drivers/s390/net/ctcm_dbug.h +++ b/drivers/s390/net/ctcm_dbug.h | |||
@@ -20,16 +20,17 @@ | |||
20 | #else | 20 | #else |
21 | #define do_debug 0 | 21 | #define do_debug 0 |
22 | #endif | 22 | #endif |
23 | #ifdef DEBUGDATA | ||
24 | #define do_debug_data 1 | ||
25 | #else | ||
26 | #define do_debug_data 0 | ||
27 | #endif | ||
28 | #ifdef DEBUGCCW | 23 | #ifdef DEBUGCCW |
29 | #define do_debug_ccw 1 | 24 | #define do_debug_ccw 1 |
25 | #define DEBUGDATA 1 | ||
30 | #else | 26 | #else |
31 | #define do_debug_ccw 0 | 27 | #define do_debug_ccw 0 |
32 | #endif | 28 | #endif |
29 | #ifdef DEBUGDATA | ||
30 | #define do_debug_data 1 | ||
31 | #else | ||
32 | #define do_debug_data 0 | ||
33 | #endif | ||
33 | 34 | ||
34 | /* define dbf debug levels similar to kernel msg levels */ | 35 | /* define dbf debug levels similar to kernel msg levels */ |
35 | #define CTC_DBF_ALWAYS 0 /* always print this */ | 36 | #define CTC_DBF_ALWAYS 0 /* always print this */ |
@@ -42,8 +43,6 @@ | |||
42 | #define CTC_DBF_INFO 5 /* informational */ | 43 | #define CTC_DBF_INFO 5 /* informational */ |
43 | #define CTC_DBF_DEBUG 6 /* debug-level messages */ | 44 | #define CTC_DBF_DEBUG 6 /* debug-level messages */ |
44 | 45 | ||
45 | DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf); | ||
46 | |||
47 | enum ctcm_dbf_names { | 46 | enum ctcm_dbf_names { |
48 | CTCM_DBF_SETUP, | 47 | CTCM_DBF_SETUP, |
49 | CTCM_DBF_ERROR, | 48 | CTCM_DBF_ERROR, |
@@ -67,6 +66,7 @@ extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS]; | |||
67 | 66 | ||
68 | int ctcm_register_dbf_views(void); | 67 | int ctcm_register_dbf_views(void); |
69 | void ctcm_unregister_dbf_views(void); | 68 | void ctcm_unregister_dbf_views(void); |
69 | void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...); | ||
70 | 70 | ||
71 | static inline const char *strtail(const char *s, int n) | 71 | static inline const char *strtail(const char *s, int n) |
72 | { | 72 | { |
@@ -74,12 +74,6 @@ static inline const char *strtail(const char *s, int n) | |||
74 | return (l > n) ? s + (l - n) : s; | 74 | return (l > n) ? s + (l - n) : s; |
75 | } | 75 | } |
76 | 76 | ||
77 | /* sort out levels early to avoid unnecessary sprintfs */ | ||
78 | static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | ||
79 | { | ||
80 | return (dbf_grp->level >= level); | ||
81 | } | ||
82 | |||
83 | #define CTCM_FUNTAIL strtail((char *)__func__, 16) | 77 | #define CTCM_FUNTAIL strtail((char *)__func__, 16) |
84 | 78 | ||
85 | #define CTCM_DBF_TEXT(name, level, text) \ | 79 | #define CTCM_DBF_TEXT(name, level, text) \ |
@@ -94,16 +88,7 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
94 | } while (0) | 88 | } while (0) |
95 | 89 | ||
96 | #define CTCM_DBF_TEXT_(name, level, text...) \ | 90 | #define CTCM_DBF_TEXT_(name, level, text...) \ |
97 | do { \ | 91 | ctcm_dbf_longtext(CTCM_DBF_##name, level, text) |
98 | if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \ | ||
99 | char *ctcm_dbf_txt_buf = \ | ||
100 | get_cpu_var(ctcm_dbf_txt_buf); \ | ||
101 | sprintf(ctcm_dbf_txt_buf, text); \ | ||
102 | debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \ | ||
103 | level, ctcm_dbf_txt_buf); \ | ||
104 | put_cpu_var(ctcm_dbf_txt_buf); \ | ||
105 | } \ | ||
106 | } while (0) | ||
107 | 92 | ||
108 | /* | 93 | /* |
109 | * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. | 94 | * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. |
@@ -112,13 +97,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
112 | */ | 97 | */ |
113 | #define CTCM_DBF_DEV_NAME(cat, dev, text) \ | 98 | #define CTCM_DBF_DEV_NAME(cat, dev, text) \ |
114 | do { \ | 99 | do { \ |
115 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \ | 100 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \ |
116 | CTCM_FUNTAIL, dev->name, text); \ | 101 | CTCM_FUNTAIL, dev->name, text); \ |
117 | } while (0) | 102 | } while (0) |
118 | 103 | ||
119 | #define MPC_DBF_DEV_NAME(cat, dev, text) \ | 104 | #define MPC_DBF_DEV_NAME(cat, dev, text) \ |
120 | do { \ | 105 | do { \ |
121 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \ | 106 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \ |
122 | CTCM_FUNTAIL, dev->name, text); \ | 107 | CTCM_FUNTAIL, dev->name, text); \ |
123 | } while (0) | 108 | } while (0) |
124 | 109 | ||
@@ -137,13 +122,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
137 | */ | 122 | */ |
138 | #define CTCM_DBF_DEV(cat, dev, text) \ | 123 | #define CTCM_DBF_DEV(cat, dev, text) \ |
139 | do { \ | 124 | do { \ |
140 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \ | 125 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \ |
141 | CTCM_FUNTAIL, dev, text); \ | 126 | CTCM_FUNTAIL, dev, text); \ |
142 | } while (0) | 127 | } while (0) |
143 | 128 | ||
144 | #define MPC_DBF_DEV(cat, dev, text) \ | 129 | #define MPC_DBF_DEV(cat, dev, text) \ |
145 | do { \ | 130 | do { \ |
146 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \ | 131 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \ |
147 | CTCM_FUNTAIL, dev, text); \ | 132 | CTCM_FUNTAIL, dev, text); \ |
148 | } while (0) | 133 | } while (0) |
149 | 134 | ||
diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index 7e6bd387f4d8..0b4e6253abe4 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c | |||
@@ -190,7 +190,8 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg); | |||
190 | void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) | 190 | void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) |
191 | { | 191 | { |
192 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 192 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
193 | "ccw error %s (%s): %04x\n", ch->id, msg, rc); | 193 | "%s(%s): %s: %04x\n", |
194 | CTCM_FUNTAIL, ch->id, msg, rc); | ||
194 | switch (rc) { | 195 | switch (rc) { |
195 | case -EBUSY: | 196 | case -EBUSY: |
196 | ctcm_pr_warn("%s (%s): Busy !\n", ch->id, msg); | 197 | ctcm_pr_warn("%s (%s): Busy !\n", ch->id, msg); |
@@ -212,7 +213,7 @@ void ctcm_purge_skb_queue(struct sk_buff_head *q) | |||
212 | { | 213 | { |
213 | struct sk_buff *skb; | 214 | struct sk_buff *skb; |
214 | 215 | ||
215 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | 216 | CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __func__); |
216 | 217 | ||
217 | while ((skb = skb_dequeue(q))) { | 218 | while ((skb = skb_dequeue(q))) { |
218 | atomic_dec(&skb->users); | 219 | atomic_dec(&skb->users); |
@@ -251,6 +252,8 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) | |||
251 | unsigned long duration; | 252 | unsigned long duration; |
252 | struct timespec done_stamp = current_kernel_time(); /* xtime */ | 253 | struct timespec done_stamp = current_kernel_time(); /* xtime */ |
253 | 254 | ||
255 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); | ||
256 | |||
254 | duration = | 257 | duration = |
255 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + | 258 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + |
256 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; | 259 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; |
@@ -258,8 +261,9 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) | |||
258 | ch->prof.tx_time = duration; | 261 | ch->prof.tx_time = duration; |
259 | 262 | ||
260 | if (ch->irb->scsw.cmd.count != 0) | 263 | if (ch->irb->scsw.cmd.count != 0) |
261 | ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", | 264 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
262 | dev->name, ch->irb->scsw.cmd.count); | 265 | "%s(%s): TX not complete, remaining %d bytes", |
266 | CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); | ||
263 | fsm_deltimer(&ch->timer); | 267 | fsm_deltimer(&ch->timer); |
264 | while ((skb = skb_dequeue(&ch->io_queue))) { | 268 | while ((skb = skb_dequeue(&ch->io_queue))) { |
265 | priv->stats.tx_packets++; | 269 | priv->stats.tx_packets++; |
@@ -334,7 +338,8 @@ void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg) | |||
334 | struct net_device *dev = ch->netdev; | 338 | struct net_device *dev = ch->netdev; |
335 | struct ctcm_priv *priv = dev->priv; | 339 | struct ctcm_priv *priv = dev->priv; |
336 | 340 | ||
337 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | 341 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); |
342 | |||
338 | fsm_deltimer(&ch->timer); | 343 | fsm_deltimer(&ch->timer); |
339 | fsm_newstate(fi, CTC_STATE_TXIDLE); | 344 | fsm_newstate(fi, CTC_STATE_TXIDLE); |
340 | fsm_event(priv->fsm, DEV_EVENT_TXUP, ch->netdev); | 345 | fsm_event(priv->fsm, DEV_EVENT_TXUP, ch->netdev); |
@@ -361,15 +366,17 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
361 | 366 | ||
362 | fsm_deltimer(&ch->timer); | 367 | fsm_deltimer(&ch->timer); |
363 | if (len < 8) { | 368 | if (len < 8) { |
364 | ctcm_pr_debug("%s: got packet with length %d < 8\n", | 369 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
365 | dev->name, len); | 370 | "%s(%s): got packet with length %d < 8\n", |
371 | CTCM_FUNTAIL, dev->name, len); | ||
366 | priv->stats.rx_dropped++; | 372 | priv->stats.rx_dropped++; |
367 | priv->stats.rx_length_errors++; | 373 | priv->stats.rx_length_errors++; |
368 | goto again; | 374 | goto again; |
369 | } | 375 | } |
370 | if (len > ch->max_bufsize) { | 376 | if (len > ch->max_bufsize) { |
371 | ctcm_pr_debug("%s: got packet with length %d > %d\n", | 377 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
372 | dev->name, len, ch->max_bufsize); | 378 | "%s(%s): got packet with length %d > %d\n", |
379 | CTCM_FUNTAIL, dev->name, len, ch->max_bufsize); | ||
373 | priv->stats.rx_dropped++; | 380 | priv->stats.rx_dropped++; |
374 | priv->stats.rx_length_errors++; | 381 | priv->stats.rx_length_errors++; |
375 | goto again; | 382 | goto again; |
@@ -388,8 +395,9 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
388 | break; | 395 | break; |
389 | } | 396 | } |
390 | if ((len < block_len) || (len > check_len)) { | 397 | if ((len < block_len) || (len > check_len)) { |
391 | ctcm_pr_debug("%s: got block length %d != rx length %d\n", | 398 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
392 | dev->name, block_len, len); | 399 | "%s(%s): got block length %d != rx length %d\n", |
400 | CTCM_FUNTAIL, dev->name, block_len, len); | ||
393 | if (do_debug) | 401 | if (do_debug) |
394 | ctcmpc_dump_skb(skb, 0); | 402 | ctcmpc_dump_skb(skb, 0); |
395 | 403 | ||
@@ -425,17 +433,23 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
425 | */ | 433 | */ |
426 | static void chx_firstio(fsm_instance *fi, int event, void *arg) | 434 | static void chx_firstio(fsm_instance *fi, int event, void *arg) |
427 | { | 435 | { |
428 | struct channel *ch = arg; | ||
429 | int rc; | 436 | int rc; |
437 | struct channel *ch = arg; | ||
438 | int fsmstate = fsm_getstate(fi); | ||
430 | 439 | ||
431 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | 440 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
441 | "%s(%s) : %02x", | ||
442 | CTCM_FUNTAIL, ch->id, fsmstate); | ||
432 | 443 | ||
433 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) | 444 | ch->sense_rc = 0; /* reset unit check report control */ |
434 | ctcm_pr_debug("%s: remote side issued READ?, init.\n", ch->id); | 445 | if (fsmstate == CTC_STATE_TXIDLE) |
446 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, | ||
447 | "%s(%s): remote side issued READ?, init.\n", | ||
448 | CTCM_FUNTAIL, ch->id); | ||
435 | fsm_deltimer(&ch->timer); | 449 | fsm_deltimer(&ch->timer); |
436 | if (ctcm_checkalloc_buffer(ch)) | 450 | if (ctcm_checkalloc_buffer(ch)) |
437 | return; | 451 | return; |
438 | if ((fsm_getstate(fi) == CTC_STATE_SETUPWAIT) && | 452 | if ((fsmstate == CTC_STATE_SETUPWAIT) && |
439 | (ch->protocol == CTCM_PROTO_OS390)) { | 453 | (ch->protocol == CTCM_PROTO_OS390)) { |
440 | /* OS/390 resp. z/OS */ | 454 | /* OS/390 resp. z/OS */ |
441 | if (CHANNEL_DIRECTION(ch->flags) == READ) { | 455 | if (CHANNEL_DIRECTION(ch->flags) == READ) { |
@@ -451,7 +465,6 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) | |||
451 | } | 465 | } |
452 | return; | 466 | return; |
453 | } | 467 | } |
454 | |||
455 | /* | 468 | /* |
456 | * Don't setup a timer for receiving the initial RX frame | 469 | * Don't setup a timer for receiving the initial RX frame |
457 | * if in compatibility mode, since VM TCP delays the initial | 470 | * if in compatibility mode, since VM TCP delays the initial |
@@ -505,11 +518,10 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
505 | __u16 buflen; | 518 | __u16 buflen; |
506 | int rc; | 519 | int rc; |
507 | 520 | ||
508 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | ||
509 | fsm_deltimer(&ch->timer); | 521 | fsm_deltimer(&ch->timer); |
510 | buflen = *((__u16 *)ch->trans_skb->data); | 522 | buflen = *((__u16 *)ch->trans_skb->data); |
511 | if (do_debug) | 523 | CTCM_PR_DEBUG("%s: %s: Initial RX count = %d\n", |
512 | ctcm_pr_debug("%s: Initial RX count %d\n", dev->name, buflen); | 524 | __func__, dev->name, buflen); |
513 | 525 | ||
514 | if (buflen >= CTCM_INITIAL_BLOCKLEN) { | 526 | if (buflen >= CTCM_INITIAL_BLOCKLEN) { |
515 | if (ctcm_checkalloc_buffer(ch)) | 527 | if (ctcm_checkalloc_buffer(ch)) |
@@ -524,9 +536,9 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
524 | } else | 536 | } else |
525 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); | 537 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); |
526 | } else { | 538 | } else { |
527 | if (do_debug) | 539 | CTCM_PR_DEBUG("%s: %s: Initial RX count %d not %d\n", |
528 | ctcm_pr_debug("%s: Initial RX count %d not %d\n", | 540 | __func__, dev->name, |
529 | dev->name, buflen, CTCM_INITIAL_BLOCKLEN); | 541 | buflen, CTCM_INITIAL_BLOCKLEN); |
530 | chx_firstio(fi, event, arg); | 542 | chx_firstio(fi, event, arg); |
531 | } | 543 | } |
532 | } | 544 | } |
@@ -548,14 +560,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) | |||
548 | fsm_deltimer(&ch->timer); | 560 | fsm_deltimer(&ch->timer); |
549 | if (IS_MPC(ch)) { | 561 | if (IS_MPC(ch)) { |
550 | timeout = 1500; | 562 | timeout = 1500; |
551 | if (do_debug) | 563 | CTCM_PR_DEBUG("enter %s: cp=%i ch=0x%p id=%s\n", |
552 | ctcm_pr_debug("ctcm enter: %s(): cp=%i ch=0x%p id=%s\n", | 564 | __func__, smp_processor_id(), ch, ch->id); |
553 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
554 | } | 565 | } |
555 | fsm_addtimer(&ch->timer, timeout, CTC_EVENT_TIMER, ch); | 566 | fsm_addtimer(&ch->timer, timeout, CTC_EVENT_TIMER, ch); |
556 | fsm_newstate(fi, CTC_STATE_SETUPWAIT); | 567 | fsm_newstate(fi, CTC_STATE_SETUPWAIT); |
557 | if (do_debug_ccw && IS_MPC(ch)) | 568 | CTCM_CCW_DUMP((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); |
558 | ctcmpc_dumpit((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); | ||
559 | 569 | ||
560 | if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */ | 570 | if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */ |
561 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 571 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
@@ -583,24 +593,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) | |||
583 | */ | 593 | */ |
584 | static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) | 594 | static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) |
585 | { | 595 | { |
586 | struct channel *ch = arg; | 596 | struct channel *ch = arg; |
587 | int rc; | ||
588 | struct net_device *dev; | ||
589 | unsigned long saveflags; | 597 | unsigned long saveflags; |
598 | int rc; | ||
590 | 599 | ||
591 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | 600 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s): %s", |
592 | if (ch == NULL) { | 601 | CTCM_FUNTAIL, ch->id, |
593 | ctcm_pr_warn("chx_start ch=NULL\n"); | ||
594 | return; | ||
595 | } | ||
596 | if (ch->netdev == NULL) { | ||
597 | ctcm_pr_warn("chx_start dev=NULL, id=%s\n", ch->id); | ||
598 | return; | ||
599 | } | ||
600 | dev = ch->netdev; | ||
601 | |||
602 | if (do_debug) | ||
603 | ctcm_pr_debug("%s: %s channel start\n", dev->name, | ||
604 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 602 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
605 | 603 | ||
606 | if (ch->trans_skb != NULL) { | 604 | if (ch->trans_skb != NULL) { |
@@ -618,11 +616,12 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) | |||
618 | ch->ccw[1].count = 0; | 616 | ch->ccw[1].count = 0; |
619 | } | 617 | } |
620 | if (ctcm_checkalloc_buffer(ch)) { | 618 | if (ctcm_checkalloc_buffer(ch)) { |
621 | ctcm_pr_notice("%s: %s trans_skb allocation delayed " | 619 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
622 | "until first transfer\n", dev->name, | 620 | "%s(%s): %s trans_skb alloc delayed " |
621 | "until first transfer", | ||
622 | CTCM_FUNTAIL, ch->id, | ||
623 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 623 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
624 | } | 624 | } |
625 | |||
626 | ch->ccw[0].cmd_code = CCW_CMD_PREPARE; | 625 | ch->ccw[0].cmd_code = CCW_CMD_PREPARE; |
627 | ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 626 | ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
628 | ch->ccw[0].count = 0; | 627 | ch->ccw[0].count = 0; |
@@ -661,7 +660,6 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) | |||
661 | int rc; | 660 | int rc; |
662 | int oldstate; | 661 | int oldstate; |
663 | 662 | ||
664 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | ||
665 | fsm_deltimer(&ch->timer); | 663 | fsm_deltimer(&ch->timer); |
666 | if (IS_MPC(ch)) | 664 | if (IS_MPC(ch)) |
667 | fsm_deltimer(&ch->sweep_timer); | 665 | fsm_deltimer(&ch->sweep_timer); |
@@ -684,7 +682,7 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) | |||
684 | fsm_deltimer(&ch->timer); | 682 | fsm_deltimer(&ch->timer); |
685 | if (event != CTC_EVENT_STOP) { | 683 | if (event != CTC_EVENT_STOP) { |
686 | fsm_newstate(fi, oldstate); | 684 | fsm_newstate(fi, oldstate); |
687 | ctcm_ccw_check_rc(ch, rc, (char *)__FUNCTION__); | 685 | ctcm_ccw_check_rc(ch, rc, (char *)__func__); |
688 | } | 686 | } |
689 | } | 687 | } |
690 | } | 688 | } |
@@ -703,7 +701,9 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, | |||
703 | struct net_device *dev = ch->netdev; | 701 | struct net_device *dev = ch->netdev; |
704 | struct ctcm_priv *priv = dev->priv; | 702 | struct ctcm_priv *priv = dev->priv; |
705 | 703 | ||
706 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | 704 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
705 | "%s(%s): %s[%d]\n", | ||
706 | CTCM_FUNTAIL, dev->name, ch->id, state); | ||
707 | 707 | ||
708 | fsm_deltimer(&ch->timer); | 708 | fsm_deltimer(&ch->timer); |
709 | if (IS_MPC(ch)) | 709 | if (IS_MPC(ch)) |
@@ -743,7 +743,6 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, | |||
743 | */ | 743 | */ |
744 | static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) | 744 | static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) |
745 | { | 745 | { |
746 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
747 | ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg); | 746 | ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg); |
748 | } | 747 | } |
749 | 748 | ||
@@ -771,7 +770,6 @@ static void ctcm_chx_stop(fsm_instance *fi, int event, void *arg) | |||
771 | */ | 770 | */ |
772 | static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) | 771 | static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) |
773 | { | 772 | { |
774 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
775 | ctcm_chx_cleanup(fi, CTC_STATE_NOTOP, arg); | 773 | ctcm_chx_cleanup(fi, CTC_STATE_NOTOP, arg); |
776 | } | 774 | } |
777 | 775 | ||
@@ -809,8 +807,8 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg) | |||
809 | } | 807 | } |
810 | 808 | ||
811 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, | 809 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, |
812 | "%s : %s error during %s channel setup state=%s\n", | 810 | "%s(%s) : %s error during %s channel setup state=%s\n", |
813 | dev->name, ctc_ch_event_names[event], | 811 | CTCM_FUNTAIL, dev->name, ctc_ch_event_names[event], |
814 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", | 812 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", |
815 | fsm_getstate_str(fi)); | 813 | fsm_getstate_str(fi)); |
816 | 814 | ||
@@ -838,10 +836,12 @@ static void ctcm_chx_restart(fsm_instance *fi, int event, void *arg) | |||
838 | int oldstate; | 836 | int oldstate; |
839 | int rc; | 837 | int rc; |
840 | 838 | ||
841 | CTCM_DBF_TEXT(TRACE, CTC_DBF_NOTICE, __FUNCTION__); | 839 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
840 | "%s: %s[%d] of %s\n", | ||
841 | CTCM_FUNTAIL, ch->id, event, dev->name); | ||
842 | |||
842 | fsm_deltimer(&ch->timer); | 843 | fsm_deltimer(&ch->timer); |
843 | ctcm_pr_debug("%s: %s channel restart\n", dev->name, | 844 | |
844 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | ||
845 | fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); | 845 | fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); |
846 | oldstate = fsm_getstate(fi); | 846 | oldstate = fsm_getstate(fi); |
847 | fsm_newstate(fi, CTC_STATE_STARTWAIT); | 847 | fsm_newstate(fi, CTC_STATE_STARTWAIT); |
@@ -876,13 +876,10 @@ static void ctcm_chx_rxiniterr(fsm_instance *fi, int event, void *arg) | |||
876 | struct net_device *dev = ch->netdev; | 876 | struct net_device *dev = ch->netdev; |
877 | struct ctcm_priv *priv = dev->priv; | 877 | struct ctcm_priv *priv = dev->priv; |
878 | 878 | ||
879 | CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); | ||
880 | if (event == CTC_EVENT_TIMER) { | 879 | if (event == CTC_EVENT_TIMER) { |
881 | if (!IS_MPCDEV(dev)) | 880 | if (!IS_MPCDEV(dev)) |
882 | /* TODO : check if MPC deletes timer somewhere */ | 881 | /* TODO : check if MPC deletes timer somewhere */ |
883 | fsm_deltimer(&ch->timer); | 882 | fsm_deltimer(&ch->timer); |
884 | ctcm_pr_debug("%s: Timeout during RX init handshake\n", | ||
885 | dev->name); | ||
886 | if (ch->retry++ < 3) | 883 | if (ch->retry++ < 3) |
887 | ctcm_chx_restart(fi, event, arg); | 884 | ctcm_chx_restart(fi, event, arg); |
888 | else { | 885 | else { |
@@ -907,9 +904,10 @@ static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg) | |||
907 | struct net_device *dev = ch->netdev; | 904 | struct net_device *dev = ch->netdev; |
908 | struct ctcm_priv *priv = dev->priv; | 905 | struct ctcm_priv *priv = dev->priv; |
909 | 906 | ||
910 | CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); | 907 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
908 | "%s(%s): RX %s busy, init. fail", | ||
909 | CTCM_FUNTAIL, dev->name, ch->id); | ||
911 | fsm_newstate(fi, CTC_STATE_RXERR); | 910 | fsm_newstate(fi, CTC_STATE_RXERR); |
912 | ctcm_pr_warn("%s: RX busy. Initialization failed\n", dev->name); | ||
913 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); | 911 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); |
914 | } | 912 | } |
915 | 913 | ||
@@ -927,11 +925,10 @@ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg) | |||
927 | struct net_device *dev = ch->netdev; | 925 | struct net_device *dev = ch->netdev; |
928 | struct ctcm_priv *priv = dev->priv; | 926 | struct ctcm_priv *priv = dev->priv; |
929 | 927 | ||
930 | CTCM_DBF_DEV_NAME(TRACE, dev, "Got remote disconnect, re-initializing"); | 928 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
929 | "%s: %s: remote disconnect - re-init ...", | ||
930 | CTCM_FUNTAIL, dev->name); | ||
931 | fsm_deltimer(&ch->timer); | 931 | fsm_deltimer(&ch->timer); |
932 | if (do_debug) | ||
933 | ctcm_pr_debug("%s: Got remote disconnect, " | ||
934 | "re-initializing ...\n", dev->name); | ||
935 | /* | 932 | /* |
936 | * Notify device statemachine | 933 | * Notify device statemachine |
937 | */ | 934 | */ |
@@ -961,8 +958,6 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) | |||
961 | 958 | ||
962 | if (event == CTC_EVENT_TIMER) { | 959 | if (event == CTC_EVENT_TIMER) { |
963 | fsm_deltimer(&ch->timer); | 960 | fsm_deltimer(&ch->timer); |
964 | CTCM_DBF_DEV_NAME(ERROR, dev, | ||
965 | "Timeout during TX init handshake"); | ||
966 | if (ch->retry++ < 3) | 961 | if (ch->retry++ < 3) |
967 | ctcm_chx_restart(fi, event, arg); | 962 | ctcm_chx_restart(fi, event, arg); |
968 | else { | 963 | else { |
@@ -971,9 +966,8 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) | |||
971 | } | 966 | } |
972 | } else { | 967 | } else { |
973 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 968 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
974 | "%s : %s error during channel setup state=%s", | 969 | "%s(%s): %s in %s", CTCM_FUNTAIL, ch->id, |
975 | dev->name, ctc_ch_event_names[event], | 970 | ctc_ch_event_names[event], fsm_getstate_str(fi)); |
976 | fsm_getstate_str(fi)); | ||
977 | 971 | ||
978 | ctcm_pr_warn("%s: Error during TX init handshake\n", dev->name); | 972 | ctcm_pr_warn("%s: Error during TX init handshake\n", dev->name); |
979 | } | 973 | } |
@@ -993,15 +987,15 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
993 | struct ctcm_priv *priv = dev->priv; | 987 | struct ctcm_priv *priv = dev->priv; |
994 | struct sk_buff *skb; | 988 | struct sk_buff *skb; |
995 | 989 | ||
996 | if (do_debug) | 990 | CTCM_PR_DEBUG("Enter: %s: cp=%i ch=0x%p id=%s\n", |
997 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 991 | __func__, smp_processor_id(), ch, ch->id); |
998 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
999 | 992 | ||
1000 | fsm_deltimer(&ch->timer); | 993 | fsm_deltimer(&ch->timer); |
1001 | if (ch->retry++ > 3) { | 994 | if (ch->retry++ > 3) { |
1002 | struct mpc_group *gptr = priv->mpcg; | 995 | struct mpc_group *gptr = priv->mpcg; |
1003 | ctcm_pr_debug("%s: TX retry failed, restarting channel\n", | 996 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, |
1004 | dev->name); | 997 | "%s: %s: retries exceeded", |
998 | CTCM_FUNTAIL, ch->id); | ||
1005 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 999 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1006 | /* call restart if not MPC or if MPC and mpcg fsm is ready. | 1000 | /* call restart if not MPC or if MPC and mpcg fsm is ready. |
1007 | use gptr as mpc indicator */ | 1001 | use gptr as mpc indicator */ |
@@ -1010,7 +1004,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
1010 | goto done; | 1004 | goto done; |
1011 | } | 1005 | } |
1012 | 1006 | ||
1013 | ctcm_pr_debug("%s: TX retry %d\n", dev->name, ch->retry); | 1007 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
1008 | "%s : %s: retry %d", | ||
1009 | CTCM_FUNTAIL, ch->id, ch->retry); | ||
1014 | skb = skb_peek(&ch->io_queue); | 1010 | skb = skb_peek(&ch->io_queue); |
1015 | if (skb) { | 1011 | if (skb) { |
1016 | int rc = 0; | 1012 | int rc = 0; |
@@ -1018,8 +1014,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
1018 | clear_normalized_cda(&ch->ccw[4]); | 1014 | clear_normalized_cda(&ch->ccw[4]); |
1019 | ch->ccw[4].count = skb->len; | 1015 | ch->ccw[4].count = skb->len; |
1020 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { | 1016 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { |
1021 | ctcm_pr_debug("%s: IDAL alloc failed, chan restart\n", | 1017 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, |
1022 | dev->name); | 1018 | "%s: %s: IDAL alloc failed", |
1019 | CTCM_FUNTAIL, ch->id); | ||
1023 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 1020 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1024 | ctcm_chx_restart(fi, event, arg); | 1021 | ctcm_chx_restart(fi, event, arg); |
1025 | goto done; | 1022 | goto done; |
@@ -1061,22 +1058,21 @@ static void ctcm_chx_iofatal(fsm_instance *fi, int event, void *arg) | |||
1061 | struct channel *ch = arg; | 1058 | struct channel *ch = arg; |
1062 | struct net_device *dev = ch->netdev; | 1059 | struct net_device *dev = ch->netdev; |
1063 | struct ctcm_priv *priv = dev->priv; | 1060 | struct ctcm_priv *priv = dev->priv; |
1061 | int rd = CHANNEL_DIRECTION(ch->flags); | ||
1064 | 1062 | ||
1065 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
1066 | fsm_deltimer(&ch->timer); | 1063 | fsm_deltimer(&ch->timer); |
1067 | ctcm_pr_warn("%s %s : unrecoverable channel error\n", | 1064 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
1068 | CTC_DRIVER_NAME, dev->name); | 1065 | "%s: %s: %s unrecoverable channel error", |
1066 | CTCM_FUNTAIL, ch->id, rd == READ ? "RX" : "TX"); | ||
1067 | |||
1069 | if (IS_MPC(ch)) { | 1068 | if (IS_MPC(ch)) { |
1070 | priv->stats.tx_dropped++; | 1069 | priv->stats.tx_dropped++; |
1071 | priv->stats.tx_errors++; | 1070 | priv->stats.tx_errors++; |
1072 | } | 1071 | } |
1073 | 1072 | if (rd == READ) { | |
1074 | if (CHANNEL_DIRECTION(ch->flags) == READ) { | ||
1075 | ctcm_pr_debug("%s: RX I/O error\n", dev->name); | ||
1076 | fsm_newstate(fi, CTC_STATE_RXERR); | 1073 | fsm_newstate(fi, CTC_STATE_RXERR); |
1077 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); | 1074 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); |
1078 | } else { | 1075 | } else { |
1079 | ctcm_pr_debug("%s: TX I/O error\n", dev->name); | ||
1080 | fsm_newstate(fi, CTC_STATE_TXERR); | 1076 | fsm_newstate(fi, CTC_STATE_TXERR); |
1081 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 1077 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1082 | } | 1078 | } |
@@ -1216,27 +1212,27 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1216 | struct sk_buff *skb; | 1212 | struct sk_buff *skb; |
1217 | int first = 1; | 1213 | int first = 1; |
1218 | int i; | 1214 | int i; |
1219 | struct timespec done_stamp; | ||
1220 | __u32 data_space; | 1215 | __u32 data_space; |
1221 | unsigned long duration; | 1216 | unsigned long duration; |
1222 | struct sk_buff *peekskb; | 1217 | struct sk_buff *peekskb; |
1223 | int rc; | 1218 | int rc; |
1224 | struct th_header *header; | 1219 | struct th_header *header; |
1225 | struct pdu *p_header; | 1220 | struct pdu *p_header; |
1221 | struct timespec done_stamp = current_kernel_time(); /* xtime */ | ||
1226 | 1222 | ||
1227 | if (do_debug) | 1223 | CTCM_PR_DEBUG("Enter %s: %s cp:%i\n", |
1228 | ctcm_pr_debug("%s cp:%i enter: %s()\n", | 1224 | __func__, dev->name, smp_processor_id()); |
1229 | dev->name, smp_processor_id(), __FUNCTION__); | ||
1230 | 1225 | ||
1231 | done_stamp = current_kernel_time(); /* xtime */ | 1226 | duration = |
1232 | duration = (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 | 1227 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + |
1233 | + (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; | 1228 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; |
1234 | if (duration > ch->prof.tx_time) | 1229 | if (duration > ch->prof.tx_time) |
1235 | ch->prof.tx_time = duration; | 1230 | ch->prof.tx_time = duration; |
1236 | 1231 | ||
1237 | if (ch->irb->scsw.cmd.count != 0) | 1232 | if (ch->irb->scsw.cmd.count != 0) |
1238 | ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", | 1233 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
1239 | dev->name, ch->irb->scsw.cmd.count); | 1234 | "%s(%s): TX not complete, remaining %d bytes", |
1235 | CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); | ||
1240 | fsm_deltimer(&ch->timer); | 1236 | fsm_deltimer(&ch->timer); |
1241 | while ((skb = skb_dequeue(&ch->io_queue))) { | 1237 | while ((skb = skb_dequeue(&ch->io_queue))) { |
1242 | priv->stats.tx_packets++; | 1238 | priv->stats.tx_packets++; |
@@ -1250,7 +1246,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1250 | } | 1246 | } |
1251 | spin_lock(&ch->collect_lock); | 1247 | spin_lock(&ch->collect_lock); |
1252 | clear_normalized_cda(&ch->ccw[4]); | 1248 | clear_normalized_cda(&ch->ccw[4]); |
1253 | |||
1254 | if ((ch->collect_len <= 0) || (grp->in_sweep != 0)) { | 1249 | if ((ch->collect_len <= 0) || (grp->in_sweep != 0)) { |
1255 | spin_unlock(&ch->collect_lock); | 1250 | spin_unlock(&ch->collect_lock); |
1256 | fsm_newstate(fi, CTC_STATE_TXIDLE); | 1251 | fsm_newstate(fi, CTC_STATE_TXIDLE); |
@@ -1269,17 +1264,13 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1269 | if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) | 1264 | if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) |
1270 | ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); | 1265 | ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); |
1271 | i = 0; | 1266 | i = 0; |
1272 | 1267 | p_header = NULL; | |
1273 | if (do_debug_data) | ||
1274 | ctcm_pr_debug("ctcmpc: %s() building " | ||
1275 | "trans_skb from collect_q \n", __FUNCTION__); | ||
1276 | |||
1277 | data_space = grp->group_max_buflen - TH_HEADER_LENGTH; | 1268 | data_space = grp->group_max_buflen - TH_HEADER_LENGTH; |
1278 | 1269 | ||
1279 | if (do_debug_data) | 1270 | CTCM_PR_DBGDATA("%s: building trans_skb from collect_q" |
1280 | ctcm_pr_debug("ctcmpc: %s() building trans_skb from collect_q" | 1271 | " data_space:%04x\n", |
1281 | " data_space:%04x\n", __FUNCTION__, data_space); | 1272 | __func__, data_space); |
1282 | p_header = NULL; | 1273 | |
1283 | while ((skb = skb_dequeue(&ch->collect_queue))) { | 1274 | while ((skb = skb_dequeue(&ch->collect_queue))) { |
1284 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); | 1275 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); |
1285 | p_header = (struct pdu *) | 1276 | p_header = (struct pdu *) |
@@ -1290,15 +1281,12 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1290 | else | 1281 | else |
1291 | p_header->pdu_flag |= 0x20; | 1282 | p_header->pdu_flag |= 0x20; |
1292 | 1283 | ||
1293 | if (do_debug_data) { | 1284 | CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", |
1294 | ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", | 1285 | __func__, ch->trans_skb->len); |
1295 | __FUNCTION__, ch->trans_skb->len); | 1286 | CTCM_PR_DBGDATA("%s: pdu header and data for up" |
1296 | ctcm_pr_debug("ctcmpc: %s() pdu header and data" | 1287 | " to 32 bytes sent to vtam\n", __func__); |
1297 | " for up to 32 bytes sent to vtam\n", | 1288 | CTCM_D3_DUMP((char *)p_header, min_t(int, skb->len, 32)); |
1298 | __FUNCTION__); | 1289 | |
1299 | ctcmpc_dumpit((char *)p_header, | ||
1300 | min_t(int, skb->len, 32)); | ||
1301 | } | ||
1302 | ch->collect_len -= skb->len; | 1290 | ch->collect_len -= skb->len; |
1303 | data_space -= skb->len; | 1291 | data_space -= skb->len; |
1304 | priv->stats.tx_packets++; | 1292 | priv->stats.tx_packets++; |
@@ -1314,46 +1302,38 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1314 | if (p_header) | 1302 | if (p_header) |
1315 | p_header->pdu_flag |= PDU_LAST; /*Say it's the last one*/ | 1303 | p_header->pdu_flag |= PDU_LAST; /*Say it's the last one*/ |
1316 | header = kzalloc(TH_HEADER_LENGTH, gfp_type()); | 1304 | header = kzalloc(TH_HEADER_LENGTH, gfp_type()); |
1317 | |||
1318 | if (!header) { | 1305 | if (!header) { |
1319 | printk(KERN_WARNING "ctcmpc: OUT OF MEMORY IN %s()" | ||
1320 | ": Data Lost \n", __FUNCTION__); | ||
1321 | spin_unlock(&ch->collect_lock); | 1306 | spin_unlock(&ch->collect_lock); |
1322 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1307 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1323 | goto done; | 1308 | goto done; |
1324 | } | 1309 | } |
1325 | |||
1326 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ | 1310 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ |
1327 | ch->th_seq_num++; | 1311 | ch->th_seq_num++; |
1328 | header->th_seq_num = ch->th_seq_num; | 1312 | header->th_seq_num = ch->th_seq_num; |
1329 | 1313 | ||
1330 | if (do_debug_data) | 1314 | CTCM_PR_DBGDATA("%s: ToVTAM_th_seq= %08x\n" , |
1331 | ctcm_pr_debug("%s: ToVTAM_th_seq= %08x\n" , | 1315 | __func__, ch->th_seq_num); |
1332 | __FUNCTION__, ch->th_seq_num); | ||
1333 | 1316 | ||
1334 | memcpy(skb_push(ch->trans_skb, TH_HEADER_LENGTH), header, | 1317 | memcpy(skb_push(ch->trans_skb, TH_HEADER_LENGTH), header, |
1335 | TH_HEADER_LENGTH); /* put the TH on the packet */ | 1318 | TH_HEADER_LENGTH); /* put the TH on the packet */ |
1336 | 1319 | ||
1337 | kfree(header); | 1320 | kfree(header); |
1338 | 1321 | ||
1339 | if (do_debug_data) { | 1322 | CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", |
1340 | ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", | 1323 | __func__, ch->trans_skb->len); |
1341 | __FUNCTION__, ch->trans_skb->len); | 1324 | CTCM_PR_DBGDATA("%s: up-to-50 bytes of trans_skb " |
1342 | 1325 | "data to vtam from collect_q\n", __func__); | |
1343 | ctcm_pr_debug("ctcmpc: %s() up-to-50 bytes of trans_skb " | 1326 | CTCM_D3_DUMP((char *)ch->trans_skb->data, |
1344 | "data to vtam from collect_q\n", __FUNCTION__); | ||
1345 | ctcmpc_dumpit((char *)ch->trans_skb->data, | ||
1346 | min_t(int, ch->trans_skb->len, 50)); | 1327 | min_t(int, ch->trans_skb->len, 50)); |
1347 | } | ||
1348 | 1328 | ||
1349 | spin_unlock(&ch->collect_lock); | 1329 | spin_unlock(&ch->collect_lock); |
1350 | clear_normalized_cda(&ch->ccw[1]); | 1330 | clear_normalized_cda(&ch->ccw[1]); |
1351 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { | 1331 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { |
1352 | dev_kfree_skb_any(ch->trans_skb); | 1332 | dev_kfree_skb_any(ch->trans_skb); |
1353 | ch->trans_skb = NULL; | 1333 | ch->trans_skb = NULL; |
1354 | printk(KERN_WARNING | 1334 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
1355 | "ctcmpc: %s()CCW failure - data lost\n", | 1335 | "%s: %s: IDAL alloc failed", |
1356 | __FUNCTION__); | 1336 | CTCM_FUNTAIL, ch->id); |
1357 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1337 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1358 | return; | 1338 | return; |
1359 | } | 1339 | } |
@@ -1373,7 +1353,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1373 | } | 1353 | } |
1374 | done: | 1354 | done: |
1375 | ctcm_clear_busy(dev); | 1355 | ctcm_clear_busy(dev); |
1376 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1377 | return; | 1356 | return; |
1378 | } | 1357 | } |
1379 | 1358 | ||
@@ -1393,26 +1372,25 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) | |||
1393 | struct mpc_group *grp = priv->mpcg; | 1372 | struct mpc_group *grp = priv->mpcg; |
1394 | struct sk_buff *skb = ch->trans_skb; | 1373 | struct sk_buff *skb = ch->trans_skb; |
1395 | struct sk_buff *new_skb; | 1374 | struct sk_buff *new_skb; |
1396 | unsigned long saveflags = 0; /* avoids compiler warning */ | 1375 | unsigned long saveflags = 0; /* avoids compiler warning */ |
1397 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; | 1376 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; |
1398 | 1377 | ||
1399 | if (do_debug_data) { | 1378 | CTCM_PR_DEBUG("%s: %s: cp:%i %s maxbuf : %04x, len: %04x\n", |
1400 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx %s cp:%i %s\n", | 1379 | CTCM_FUNTAIL, dev->name, smp_processor_id(), |
1401 | dev->name, smp_processor_id(), ch->id); | 1380 | ch->id, ch->max_bufsize, len); |
1402 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx: maxbuf: %04x " | ||
1403 | "len: %04x\n", ch->max_bufsize, len); | ||
1404 | } | ||
1405 | fsm_deltimer(&ch->timer); | 1381 | fsm_deltimer(&ch->timer); |
1406 | 1382 | ||
1407 | if (skb == NULL) { | 1383 | if (skb == NULL) { |
1408 | ctcm_pr_debug("ctcmpc exit: %s() TRANS_SKB = NULL \n", | 1384 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1409 | __FUNCTION__); | 1385 | "%s(%s): TRANS_SKB = NULL", |
1410 | goto again; | 1386 | CTCM_FUNTAIL, dev->name); |
1387 | goto again; | ||
1411 | } | 1388 | } |
1412 | 1389 | ||
1413 | if (len < TH_HEADER_LENGTH) { | 1390 | if (len < TH_HEADER_LENGTH) { |
1414 | ctcm_pr_info("%s: got packet with invalid length %d\n", | 1391 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1415 | dev->name, len); | 1392 | "%s(%s): packet length %d to short", |
1393 | CTCM_FUNTAIL, dev->name, len); | ||
1416 | priv->stats.rx_dropped++; | 1394 | priv->stats.rx_dropped++; |
1417 | priv->stats.rx_length_errors++; | 1395 | priv->stats.rx_length_errors++; |
1418 | } else { | 1396 | } else { |
@@ -1422,11 +1400,9 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) | |||
1422 | new_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC); | 1400 | new_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC); |
1423 | 1401 | ||
1424 | if (new_skb == NULL) { | 1402 | if (new_skb == NULL) { |
1425 | printk(KERN_INFO "ctcmpc:%s() NEW_SKB = NULL\n", | 1403 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1426 | __FUNCTION__); | 1404 | "%s(%d): skb allocation failed", |
1427 | printk(KERN_WARNING "ctcmpc: %s() MEMORY ALLOC FAILED" | 1405 | CTCM_FUNTAIL, dev->name); |
1428 | " - DATA LOST - MPC FAILED\n", | ||
1429 | __FUNCTION__); | ||
1430 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1406 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1431 | goto again; | 1407 | goto again; |
1432 | } | 1408 | } |
@@ -1479,9 +1455,8 @@ again: | |||
1479 | break; | 1455 | break; |
1480 | } | 1456 | } |
1481 | 1457 | ||
1482 | if (do_debug) | 1458 | CTCM_PR_DEBUG("Exit %s: %s, ch=0x%p, id=%s\n", |
1483 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1459 | __func__, dev->name, ch, ch->id); |
1484 | dev->name, __FUNCTION__, ch, ch->id); | ||
1485 | 1460 | ||
1486 | } | 1461 | } |
1487 | 1462 | ||
@@ -1497,15 +1472,16 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) | |||
1497 | struct channel *ch = arg; | 1472 | struct channel *ch = arg; |
1498 | struct net_device *dev = ch->netdev; | 1473 | struct net_device *dev = ch->netdev; |
1499 | struct ctcm_priv *priv = dev->priv; | 1474 | struct ctcm_priv *priv = dev->priv; |
1475 | struct mpc_group *gptr = priv->mpcg; | ||
1476 | |||
1477 | CTCM_PR_DEBUG("Enter %s: id=%s, ch=0x%p\n", | ||
1478 | __func__, ch->id, ch); | ||
1479 | |||
1480 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, | ||
1481 | "%s: %s: chstate:%i, grpstate:%i, prot:%i\n", | ||
1482 | CTCM_FUNTAIL, ch->id, fsm_getstate(fi), | ||
1483 | fsm_getstate(gptr->fsm), ch->protocol); | ||
1500 | 1484 | ||
1501 | if (do_debug) { | ||
1502 | struct mpc_group *gptr = priv->mpcg; | ||
1503 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | ||
1504 | __FUNCTION__, ch, ch->id); | ||
1505 | ctcm_pr_debug("%s() %s chstate:%i grpstate:%i chprotocol:%i\n", | ||
1506 | __FUNCTION__, ch->id, fsm_getstate(fi), | ||
1507 | fsm_getstate(gptr->fsm), ch->protocol); | ||
1508 | } | ||
1509 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) | 1485 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) |
1510 | MPC_DBF_DEV_NAME(TRACE, dev, "remote side issued READ? "); | 1486 | MPC_DBF_DEV_NAME(TRACE, dev, "remote side issued READ? "); |
1511 | 1487 | ||
@@ -1531,9 +1507,8 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) | |||
1531 | ? CTC_STATE_RXINIT : CTC_STATE_TXINIT); | 1507 | ? CTC_STATE_RXINIT : CTC_STATE_TXINIT); |
1532 | 1508 | ||
1533 | done: | 1509 | done: |
1534 | if (do_debug) | 1510 | CTCM_PR_DEBUG("Exit %s: id=%s, ch=0x%p\n", |
1535 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | 1511 | __func__, ch->id, ch); |
1536 | __FUNCTION__, ch, ch->id); | ||
1537 | return; | 1512 | return; |
1538 | } | 1513 | } |
1539 | 1514 | ||
@@ -1556,12 +1531,9 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1556 | unsigned long saveflags = 0; /* avoids compiler warning */ | 1531 | unsigned long saveflags = 0; /* avoids compiler warning */ |
1557 | 1532 | ||
1558 | fsm_deltimer(&ch->timer); | 1533 | fsm_deltimer(&ch->timer); |
1559 | ctcm_pr_debug("%s cp:%i enter: %s()\n", | 1534 | CTCM_PR_DEBUG("%s: %s: %s: cp:%i, chstate:%i grpstate:%i\n", |
1560 | dev->name, smp_processor_id(), __FUNCTION__); | 1535 | __func__, ch->id, dev->name, smp_processor_id(), |
1561 | if (do_debug) | 1536 | fsm_getstate(fi), fsm_getstate(grp->fsm)); |
1562 | ctcm_pr_debug("%s() %s chstate:%i grpstate:%i\n", | ||
1563 | __FUNCTION__, ch->id, | ||
1564 | fsm_getstate(fi), fsm_getstate(grp->fsm)); | ||
1565 | 1537 | ||
1566 | fsm_newstate(fi, CTC_STATE_RXIDLE); | 1538 | fsm_newstate(fi, CTC_STATE_RXIDLE); |
1567 | /* XID processing complete */ | 1539 | /* XID processing complete */ |
@@ -1575,9 +1547,7 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1575 | skb_reset_tail_pointer(ch->trans_skb); | 1547 | skb_reset_tail_pointer(ch->trans_skb); |
1576 | ch->trans_skb->len = 0; | 1548 | ch->trans_skb->len = 0; |
1577 | ch->ccw[1].count = ch->max_bufsize; | 1549 | ch->ccw[1].count = ch->max_bufsize; |
1578 | if (do_debug_ccw) | 1550 | CTCM_CCW_DUMP((char *)&ch->ccw[0], sizeof(struct ccw1) * 3); |
1579 | ctcmpc_dumpit((char *)&ch->ccw[0], | ||
1580 | sizeof(struct ccw1) * 3); | ||
1581 | if (event == CTC_EVENT_START) | 1551 | if (event == CTC_EVENT_START) |
1582 | /* see remark about conditional locking */ | 1552 | /* see remark about conditional locking */ |
1583 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 1553 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
@@ -1598,9 +1568,6 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1598 | 1568 | ||
1599 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); | 1569 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); |
1600 | done: | 1570 | done: |
1601 | if (do_debug) | ||
1602 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", | ||
1603 | dev->name, __FUNCTION__); | ||
1604 | return; | 1571 | return; |
1605 | } | 1572 | } |
1606 | 1573 | ||
@@ -1616,13 +1583,9 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) | |||
1616 | struct ctcm_priv *priv = dev->priv; | 1583 | struct ctcm_priv *priv = dev->priv; |
1617 | struct mpc_group *grp = priv->mpcg; | 1584 | struct mpc_group *grp = priv->mpcg; |
1618 | 1585 | ||
1619 | if (do_debug) { | 1586 | CTCM_PR_DEBUG("%s(%s): %s(ch=0x%p), cp=%i, ChStat:%s, GrpStat:%s\n", |
1620 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s" | 1587 | __func__, dev->name, ch->id, ch, smp_processor_id(), |
1621 | "GrpState:%s ChState:%s\n", | 1588 | fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); |
1622 | __FUNCTION__, smp_processor_id(), ch, ch->id, | ||
1623 | fsm_getstate_str(grp->fsm), | ||
1624 | fsm_getstate_str(ch->fsm)); | ||
1625 | } | ||
1626 | 1589 | ||
1627 | switch (fsm_getstate(grp->fsm)) { | 1590 | switch (fsm_getstate(grp->fsm)) { |
1628 | case MPCG_STATE_XID2INITW: | 1591 | case MPCG_STATE_XID2INITW: |
@@ -1664,11 +1627,7 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) | |||
1664 | break; | 1627 | break; |
1665 | } | 1628 | } |
1666 | 1629 | ||
1667 | if (do_debug) | ||
1668 | ctcm_pr_debug("ctcmpc exit : %s(): cp=%i ch=0x%p id=%s\n", | ||
1669 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
1670 | return; | 1630 | return; |
1671 | |||
1672 | } | 1631 | } |
1673 | 1632 | ||
1674 | /* | 1633 | /* |
@@ -1683,11 +1642,9 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) | |||
1683 | struct ctcm_priv *priv = dev->priv; | 1642 | struct ctcm_priv *priv = dev->priv; |
1684 | struct mpc_group *grp = priv->mpcg; | 1643 | struct mpc_group *grp = priv->mpcg; |
1685 | 1644 | ||
1686 | ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", | 1645 | CTCM_PR_DEBUG("%s(%s): %s\n ChState:%s GrpState:%s\n", |
1687 | dev->name, | 1646 | __func__, dev->name, ch->id, |
1688 | __FUNCTION__, ch->id, | 1647 | fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); |
1689 | fsm_getstate_str(grp->fsm), | ||
1690 | fsm_getstate_str(ch->fsm)); | ||
1691 | 1648 | ||
1692 | fsm_deltimer(&ch->timer); | 1649 | fsm_deltimer(&ch->timer); |
1693 | 1650 | ||
@@ -1750,16 +1707,12 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) | |||
1750 | if (ch->in_mpcgroup) | 1707 | if (ch->in_mpcgroup) |
1751 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); | 1708 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); |
1752 | else | 1709 | else |
1753 | printk(KERN_WARNING "ctcmpc: %s() Not all channels have" | 1710 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1754 | " been added to group\n", __FUNCTION__); | 1711 | "%s(%s): channel %s not added to group", |
1712 | CTCM_FUNTAIL, dev->name, ch->id); | ||
1755 | 1713 | ||
1756 | done: | 1714 | done: |
1757 | if (do_debug) | ||
1758 | ctcm_pr_debug("ctcmpc exit : %s()%s ch=0x%p id=%s\n", | ||
1759 | __FUNCTION__, dev->name, ch, ch->id); | ||
1760 | |||
1761 | return; | 1715 | return; |
1762 | |||
1763 | } | 1716 | } |
1764 | 1717 | ||
1765 | /* | 1718 | /* |
@@ -1774,13 +1727,7 @@ static void ctcmpc_chx_resend(fsm_instance *fsm, int event, void *arg) | |||
1774 | struct ctcm_priv *priv = dev->priv; | 1727 | struct ctcm_priv *priv = dev->priv; |
1775 | struct mpc_group *grp = priv->mpcg; | 1728 | struct mpc_group *grp = priv->mpcg; |
1776 | 1729 | ||
1777 | ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", | ||
1778 | dev->name, __FUNCTION__, ch->id, | ||
1779 | fsm_getstate_str(grp->fsm), | ||
1780 | fsm_getstate_str(ch->fsm)); | ||
1781 | |||
1782 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); | 1730 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); |
1783 | |||
1784 | return; | 1731 | return; |
1785 | } | 1732 | } |
1786 | 1733 | ||
@@ -1802,19 +1749,16 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1802 | int rc = 0; | 1749 | int rc = 0; |
1803 | unsigned long saveflags = 0; | 1750 | unsigned long saveflags = 0; |
1804 | 1751 | ||
1805 | if (do_debug) | 1752 | CTCM_PR_DEBUG("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", |
1806 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 1753 | __func__, smp_processor_id(), ach, ach->id); |
1807 | __FUNCTION__, smp_processor_id(), ach, ach->id); | ||
1808 | 1754 | ||
1809 | if (grp->in_sweep == 0) | 1755 | if (grp->in_sweep == 0) |
1810 | goto done; | 1756 | goto done; |
1811 | 1757 | ||
1812 | if (do_debug_data) { | 1758 | CTCM_PR_DBGDATA("%s: 1: ToVTAM_th_seq= %08x\n" , |
1813 | ctcm_pr_debug("ctcmpc: %s() 1: ToVTAM_th_seq= %08x\n" , | 1759 | __func__, wch->th_seq_num); |
1814 | __FUNCTION__, wch->th_seq_num); | 1760 | CTCM_PR_DBGDATA("%s: 1: FromVTAM_th_seq= %08x\n" , |
1815 | ctcm_pr_debug("ctcmpc: %s() 1: FromVTAM_th_seq= %08x\n" , | 1761 | __func__, rch->th_seq_num); |
1816 | __FUNCTION__, rch->th_seq_num); | ||
1817 | } | ||
1818 | 1762 | ||
1819 | if (fsm_getstate(wch->fsm) != CTC_STATE_TXIDLE) { | 1763 | if (fsm_getstate(wch->fsm) != CTC_STATE_TXIDLE) { |
1820 | /* give the previous IO time to complete */ | 1764 | /* give the previous IO time to complete */ |
@@ -1853,11 +1797,9 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1853 | 1797 | ||
1854 | header->sw.th_last_seq = wch->th_seq_num; | 1798 | header->sw.th_last_seq = wch->th_seq_num; |
1855 | 1799 | ||
1856 | if (do_debug_ccw) | 1800 | CTCM_CCW_DUMP((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); |
1857 | ctcmpc_dumpit((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); | 1801 | CTCM_PR_DBGDATA("%s: sweep packet\n", __func__); |
1858 | 1802 | CTCM_D3_DUMP((char *)header, TH_SWEEP_LENGTH); | |
1859 | ctcm_pr_debug("ctcmpc: %s() sweep packet\n", __FUNCTION__); | ||
1860 | ctcmpc_dumpit((char *)header, TH_SWEEP_LENGTH); | ||
1861 | 1803 | ||
1862 | fsm_addtimer(&wch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, wch); | 1804 | fsm_addtimer(&wch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, wch); |
1863 | fsm_newstate(wch->fsm, CTC_STATE_TX); | 1805 | fsm_newstate(wch->fsm, CTC_STATE_TX); |
@@ -1876,19 +1818,13 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1876 | ctcm_clear_busy_do(dev); | 1818 | ctcm_clear_busy_do(dev); |
1877 | } | 1819 | } |
1878 | 1820 | ||
1879 | if (do_debug_data) { | 1821 | CTCM_PR_DBGDATA("%s: To-/From-VTAM_th_seq = %08x/%08x\n" , |
1880 | ctcm_pr_debug("ctcmpc: %s()2: ToVTAM_th_seq= %08x\n" , | 1822 | __func__, wch->th_seq_num, rch->th_seq_num); |
1881 | __FUNCTION__, wch->th_seq_num); | ||
1882 | ctcm_pr_debug("ctcmpc: %s()2: FromVTAM_th_seq= %08x\n" , | ||
1883 | __FUNCTION__, rch->th_seq_num); | ||
1884 | } | ||
1885 | 1823 | ||
1886 | if (rc != 0) | 1824 | if (rc != 0) |
1887 | ctcm_ccw_check_rc(wch, rc, "send sweep"); | 1825 | ctcm_ccw_check_rc(wch, rc, "send sweep"); |
1888 | 1826 | ||
1889 | done: | 1827 | done: |
1890 | if (do_debug) | ||
1891 | ctcm_pr_debug("ctcmpc exit: %s() %s\n", __FUNCTION__, ach->id); | ||
1892 | return; | 1828 | return; |
1893 | } | 1829 | } |
1894 | 1830 | ||
@@ -2149,9 +2085,8 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg) | |||
2149 | struct channel *ch = priv->channel[direction]; | 2085 | struct channel *ch = priv->channel[direction]; |
2150 | fsm_event(ch->fsm, CTC_EVENT_STOP, ch); | 2086 | fsm_event(ch->fsm, CTC_EVENT_STOP, ch); |
2151 | ch->th_seq_num = 0x00; | 2087 | ch->th_seq_num = 0x00; |
2152 | if (do_debug) | 2088 | CTCM_PR_DEBUG("%s: CH_th_seq= %08x\n", |
2153 | ctcm_pr_debug("ctcm: %s() CH_th_seq= %08x\n", | 2089 | __func__, ch->th_seq_num); |
2154 | __FUNCTION__, ch->th_seq_num); | ||
2155 | } | 2090 | } |
2156 | if (IS_MPC(priv)) | 2091 | if (IS_MPC(priv)) |
2157 | fsm_newstate(priv->mpcg->fsm, MPCG_STATE_RESET); | 2092 | fsm_newstate(priv->mpcg->fsm, MPCG_STATE_RESET); |
@@ -2199,8 +2134,11 @@ static void dev_action_chup(fsm_instance *fi, int event, void *arg) | |||
2199 | { | 2134 | { |
2200 | struct net_device *dev = arg; | 2135 | struct net_device *dev = arg; |
2201 | struct ctcm_priv *priv = dev->priv; | 2136 | struct ctcm_priv *priv = dev->priv; |
2137 | int dev_stat = fsm_getstate(fi); | ||
2202 | 2138 | ||
2203 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 2139 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
2140 | "%s(%s): priv = %p [%d,%d]\n ", CTCM_FUNTAIL, | ||
2141 | dev->name, dev->priv, dev_stat, event); | ||
2204 | 2142 | ||
2205 | switch (fsm_getstate(fi)) { | 2143 | switch (fsm_getstate(fi)) { |
2206 | case DEV_STATE_STARTWAIT_RXTX: | 2144 | case DEV_STATE_STARTWAIT_RXTX: |
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 6b13c1c1beb8..126a3ebb8ab2 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
@@ -84,20 +84,19 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
84 | skb_pull(pskb, LL_HEADER_LENGTH); | 84 | skb_pull(pskb, LL_HEADER_LENGTH); |
85 | if ((ch->protocol == CTCM_PROTO_S390) && | 85 | if ((ch->protocol == CTCM_PROTO_S390) && |
86 | (header->type != ETH_P_IP)) { | 86 | (header->type != ETH_P_IP)) { |
87 | |||
88 | if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { | 87 | if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { |
88 | ch->logflags |= LOG_FLAG_ILLEGALPKT; | ||
89 | /* | 89 | /* |
90 | * Check packet type only if we stick strictly | 90 | * Check packet type only if we stick strictly |
91 | * to S/390's protocol of OS390. This only | 91 | * to S/390's protocol of OS390. This only |
92 | * supports IP. Otherwise allow any packet | 92 | * supports IP. Otherwise allow any packet |
93 | * type. | 93 | * type. |
94 | */ | 94 | */ |
95 | ctcm_pr_warn("%s Illegal packet type 0x%04x " | 95 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
96 | "received, dropping\n", | 96 | "%s(%s): Illegal packet type 0x%04x" |
97 | dev->name, header->type); | 97 | " - dropping", |
98 | ch->logflags |= LOG_FLAG_ILLEGALPKT; | 98 | CTCM_FUNTAIL, dev->name, header->type); |
99 | } | 99 | } |
100 | |||
101 | priv->stats.rx_dropped++; | 100 | priv->stats.rx_dropped++; |
102 | priv->stats.rx_frame_errors++; | 101 | priv->stats.rx_frame_errors++; |
103 | return; | 102 | return; |
@@ -105,11 +104,11 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
105 | pskb->protocol = ntohs(header->type); | 104 | pskb->protocol = ntohs(header->type); |
106 | if (header->length <= LL_HEADER_LENGTH) { | 105 | if (header->length <= LL_HEADER_LENGTH) { |
107 | if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { | 106 | if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { |
108 | ctcm_pr_warn( | 107 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
109 | "%s Illegal packet size %d " | 108 | "%s(%s): Illegal packet size %d(%d,%d)" |
110 | "received (MTU=%d blocklen=%d), " | 109 | "- dropping", |
111 | "dropping\n", dev->name, header->length, | 110 | CTCM_FUNTAIL, dev->name, |
112 | dev->mtu, len); | 111 | header->length, dev->mtu, len); |
113 | ch->logflags |= LOG_FLAG_ILLEGALSIZE; | 112 | ch->logflags |= LOG_FLAG_ILLEGALSIZE; |
114 | } | 113 | } |
115 | 114 | ||
@@ -122,10 +121,10 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
122 | if ((header->length > skb_tailroom(pskb)) || | 121 | if ((header->length > skb_tailroom(pskb)) || |
123 | (header->length > len)) { | 122 | (header->length > len)) { |
124 | if (!(ch->logflags & LOG_FLAG_OVERRUN)) { | 123 | if (!(ch->logflags & LOG_FLAG_OVERRUN)) { |
125 | ctcm_pr_warn( | 124 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
126 | "%s Illegal packet size %d (beyond the" | 125 | "%s(%s): Packet size %d (overrun)" |
127 | " end of received data), dropping\n", | 126 | " - dropping", CTCM_FUNTAIL, |
128 | dev->name, header->length); | 127 | dev->name, header->length); |
129 | ch->logflags |= LOG_FLAG_OVERRUN; | 128 | ch->logflags |= LOG_FLAG_OVERRUN; |
130 | } | 129 | } |
131 | 130 | ||
@@ -139,9 +138,9 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
139 | skb = dev_alloc_skb(pskb->len); | 138 | skb = dev_alloc_skb(pskb->len); |
140 | if (!skb) { | 139 | if (!skb) { |
141 | if (!(ch->logflags & LOG_FLAG_NOMEM)) { | 140 | if (!(ch->logflags & LOG_FLAG_NOMEM)) { |
142 | ctcm_pr_warn( | 141 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
143 | "%s Out of memory in ctcm_unpack_skb\n", | 142 | "%s(%s): MEMORY allocation error", |
144 | dev->name); | 143 | CTCM_FUNTAIL, dev->name); |
145 | ch->logflags |= LOG_FLAG_NOMEM; | 144 | ch->logflags |= LOG_FLAG_NOMEM; |
146 | } | 145 | } |
147 | priv->stats.rx_dropped++; | 146 | priv->stats.rx_dropped++; |
@@ -184,7 +183,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
184 | */ | 183 | */ |
185 | static void channel_free(struct channel *ch) | 184 | static void channel_free(struct channel *ch) |
186 | { | 185 | { |
187 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | 186 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s)", CTCM_FUNTAIL, ch->id); |
188 | ch->flags &= ~CHANNEL_FLAGS_INUSE; | 187 | ch->flags &= ~CHANNEL_FLAGS_INUSE; |
189 | fsm_newstate(ch->fsm, CTC_STATE_IDLE); | 188 | fsm_newstate(ch->fsm, CTC_STATE_IDLE); |
190 | } | 189 | } |
@@ -251,19 +250,12 @@ static struct channel *channel_get(enum channel_types type, | |||
251 | { | 250 | { |
252 | struct channel *ch = channels; | 251 | struct channel *ch = channels; |
253 | 252 | ||
254 | if (do_debug) { | ||
255 | char buf[64]; | ||
256 | sprintf(buf, "%s(%d, %s, %d)\n", | ||
257 | CTCM_FUNTAIL, type, id, direction); | ||
258 | CTCM_DBF_TEXT(TRACE, CTC_DBF_INFO, buf); | ||
259 | } | ||
260 | while (ch && (strncmp(ch->id, id, CTCM_ID_SIZE) || (ch->type != type))) | 253 | while (ch && (strncmp(ch->id, id, CTCM_ID_SIZE) || (ch->type != type))) |
261 | ch = ch->next; | 254 | ch = ch->next; |
262 | if (!ch) { | 255 | if (!ch) { |
263 | char buf[64]; | 256 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
264 | sprintf(buf, "%s(%d, %s, %d) not found in channel list\n", | 257 | "%s(%d, %s, %d) not found in channel list\n", |
265 | CTCM_FUNTAIL, type, id, direction); | 258 | CTCM_FUNTAIL, type, id, direction); |
266 | CTCM_DBF_TEXT(ERROR, CTC_DBF_ERROR, buf); | ||
267 | } else { | 259 | } else { |
268 | if (ch->flags & CHANNEL_FLAGS_INUSE) | 260 | if (ch->flags & CHANNEL_FLAGS_INUSE) |
269 | ch = NULL; | 261 | ch = NULL; |
@@ -283,8 +275,9 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
283 | if (!IS_ERR(irb)) | 275 | if (!IS_ERR(irb)) |
284 | return 0; | 276 | return 0; |
285 | 277 | ||
286 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, "irb error %ld on device %s\n", | 278 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, |
287 | PTR_ERR(irb), cdev->dev.bus_id); | 279 | "irb error %ld on device %s\n", |
280 | PTR_ERR(irb), cdev->dev.bus_id); | ||
288 | 281 | ||
289 | switch (PTR_ERR(irb)) { | 282 | switch (PTR_ERR(irb)) { |
290 | case -EIO: | 283 | case -EIO: |
@@ -307,58 +300,85 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
307 | * ch The channel, the sense code belongs to. | 300 | * ch The channel, the sense code belongs to. |
308 | * sense The sense code to inspect. | 301 | * sense The sense code to inspect. |
309 | */ | 302 | */ |
310 | static inline void ccw_unit_check(struct channel *ch, unsigned char sense) | 303 | static inline void ccw_unit_check(struct channel *ch, __u8 sense) |
311 | { | 304 | { |
312 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | 305 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
306 | "%s(%s): %02x", | ||
307 | CTCM_FUNTAIL, ch->id, sense); | ||
308 | |||
313 | if (sense & SNS0_INTERVENTION_REQ) { | 309 | if (sense & SNS0_INTERVENTION_REQ) { |
314 | if (sense & 0x01) { | 310 | if (sense & 0x01) { |
315 | ctcm_pr_debug("%s: Interface disc. or Sel. reset " | 311 | if (ch->sense_rc != 0x01) { |
316 | "(remote)\n", ch->id); | 312 | ctcm_pr_debug("%s: Interface disc. or Sel. " |
313 | "reset (remote)\n", ch->id); | ||
314 | ch->sense_rc = 0x01; | ||
315 | } | ||
317 | fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); | 316 | fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); |
318 | } else { | 317 | } else { |
319 | ctcm_pr_debug("%s: System reset (remote)\n", ch->id); | 318 | if (ch->sense_rc != SNS0_INTERVENTION_REQ) { |
319 | ctcm_pr_debug("%s: System reset (remote)\n", | ||
320 | ch->id); | ||
321 | ch->sense_rc = SNS0_INTERVENTION_REQ; | ||
322 | } | ||
320 | fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); | 323 | fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); |
321 | } | 324 | } |
322 | } else if (sense & SNS0_EQUIPMENT_CHECK) { | 325 | } else if (sense & SNS0_EQUIPMENT_CHECK) { |
323 | if (sense & SNS0_BUS_OUT_CHECK) { | 326 | if (sense & SNS0_BUS_OUT_CHECK) { |
324 | ctcm_pr_warn("%s: Hardware malfunction (remote)\n", | 327 | if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { |
325 | ch->id); | 328 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
329 | "%s(%s): remote HW error %02x", | ||
330 | CTCM_FUNTAIL, ch->id, sense); | ||
331 | ch->sense_rc = SNS0_BUS_OUT_CHECK; | ||
332 | } | ||
326 | fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); | 333 | fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); |
327 | } else { | 334 | } else { |
328 | ctcm_pr_warn("%s: Read-data parity error (remote)\n", | 335 | if (ch->sense_rc != SNS0_EQUIPMENT_CHECK) { |
329 | ch->id); | 336 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
337 | "%s(%s): remote read parity error %02x", | ||
338 | CTCM_FUNTAIL, ch->id, sense); | ||
339 | ch->sense_rc = SNS0_EQUIPMENT_CHECK; | ||
340 | } | ||
330 | fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); | 341 | fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); |
331 | } | 342 | } |
332 | } else if (sense & SNS0_BUS_OUT_CHECK) { | 343 | } else if (sense & SNS0_BUS_OUT_CHECK) { |
333 | if (sense & 0x04) { | 344 | if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { |
334 | ctcm_pr_warn("%s: Data-streaming timeout)\n", ch->id); | 345 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
346 | "%s(%s): BUS OUT error %02x", | ||
347 | CTCM_FUNTAIL, ch->id, sense); | ||
348 | ch->sense_rc = SNS0_BUS_OUT_CHECK; | ||
349 | } | ||
350 | if (sense & 0x04) /* data-streaming timeout */ | ||
335 | fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); | 351 | fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); |
336 | } else { | 352 | else /* Data-transfer parity error */ |
337 | ctcm_pr_warn("%s: Data-transfer parity error\n", | ||
338 | ch->id); | ||
339 | fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); | 353 | fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); |
340 | } | ||
341 | } else if (sense & SNS0_CMD_REJECT) { | 354 | } else if (sense & SNS0_CMD_REJECT) { |
342 | ctcm_pr_warn("%s: Command reject\n", ch->id); | 355 | if (ch->sense_rc != SNS0_CMD_REJECT) { |
356 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, | ||
357 | "%s(%s): Command rejected", | ||
358 | CTCM_FUNTAIL, ch->id); | ||
359 | ch->sense_rc = SNS0_CMD_REJECT; | ||
360 | } | ||
343 | } else if (sense == 0) { | 361 | } else if (sense == 0) { |
344 | ctcm_pr_debug("%s: Unit check ZERO\n", ch->id); | 362 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
363 | "%s(%s): Unit check ZERO", | ||
364 | CTCM_FUNTAIL, ch->id); | ||
345 | fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); | 365 | fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); |
346 | } else { | 366 | } else { |
347 | ctcm_pr_warn("%s: Unit Check with sense code: %02x\n", | 367 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
348 | ch->id, sense); | 368 | "%s(%s): Unit check code %02x unknown", |
369 | CTCM_FUNTAIL, ch->id, sense); | ||
349 | fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); | 370 | fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); |
350 | } | 371 | } |
351 | } | 372 | } |
352 | 373 | ||
353 | int ctcm_ch_alloc_buffer(struct channel *ch) | 374 | int ctcm_ch_alloc_buffer(struct channel *ch) |
354 | { | 375 | { |
355 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | ||
356 | |||
357 | clear_normalized_cda(&ch->ccw[1]); | 376 | clear_normalized_cda(&ch->ccw[1]); |
358 | ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC | GFP_DMA); | 377 | ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC | GFP_DMA); |
359 | if (ch->trans_skb == NULL) { | 378 | if (ch->trans_skb == NULL) { |
360 | ctcm_pr_warn("%s: Couldn't alloc %s trans_skb\n", | 379 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
361 | ch->id, | 380 | "%s(%s): %s trans_skb allocation error", |
381 | CTCM_FUNTAIL, ch->id, | ||
362 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 382 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
363 | return -ENOMEM; | 383 | return -ENOMEM; |
364 | } | 384 | } |
@@ -367,9 +387,9 @@ int ctcm_ch_alloc_buffer(struct channel *ch) | |||
367 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { | 387 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { |
368 | dev_kfree_skb(ch->trans_skb); | 388 | dev_kfree_skb(ch->trans_skb); |
369 | ch->trans_skb = NULL; | 389 | ch->trans_skb = NULL; |
370 | ctcm_pr_warn("%s: set_normalized_cda for %s " | 390 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
371 | "trans_skb failed, dropping packets\n", | 391 | "%s(%s): %s set norm_cda failed", |
372 | ch->id, | 392 | CTCM_FUNTAIL, ch->id, |
373 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 393 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
374 | return -ENOMEM; | 394 | return -ENOMEM; |
375 | } | 395 | } |
@@ -516,7 +536,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
516 | atomic_dec(&skb->users); | 536 | atomic_dec(&skb->users); |
517 | skb_pull(skb, LL_HEADER_LENGTH + 2); | 537 | skb_pull(skb, LL_HEADER_LENGTH + 2); |
518 | ctcm_clear_busy(ch->netdev); | 538 | ctcm_clear_busy(ch->netdev); |
519 | return -EBUSY; | 539 | return -ENOMEM; |
520 | } | 540 | } |
521 | 541 | ||
522 | skb_reset_tail_pointer(ch->trans_skb); | 542 | skb_reset_tail_pointer(ch->trans_skb); |
@@ -570,15 +590,12 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
570 | struct th_sweep *header; | 590 | struct th_sweep *header; |
571 | struct sk_buff *sweep_skb; | 591 | struct sk_buff *sweep_skb; |
572 | struct channel *ch; | 592 | struct channel *ch; |
573 | int rc = 0; | 593 | /* int rc = 0; */ |
574 | 594 | ||
575 | priv = dev->priv; | 595 | priv = dev->priv; |
576 | grp = priv->mpcg; | 596 | grp = priv->mpcg; |
577 | ch = priv->channel[WRITE]; | 597 | ch = priv->channel[WRITE]; |
578 | 598 | ||
579 | if (do_debug) | ||
580 | MPC_DBF_DEV_NAME(TRACE, dev, ch->id); | ||
581 | |||
582 | /* sweep processing is not complete until response and request */ | 599 | /* sweep processing is not complete until response and request */ |
583 | /* has completed for all read channels in group */ | 600 | /* has completed for all read channels in group */ |
584 | if (grp->in_sweep == 0) { | 601 | if (grp->in_sweep == 0) { |
@@ -590,17 +607,16 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
590 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); | 607 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); |
591 | 608 | ||
592 | if (sweep_skb == NULL) { | 609 | if (sweep_skb == NULL) { |
593 | printk(KERN_INFO "Couldn't alloc sweep_skb\n"); | 610 | /* rc = -ENOMEM; */ |
594 | rc = -ENOMEM; | 611 | goto nomem; |
595 | goto done; | ||
596 | } | 612 | } |
597 | 613 | ||
598 | header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); | 614 | header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); |
599 | 615 | ||
600 | if (!header) { | 616 | if (!header) { |
601 | dev_kfree_skb_any(sweep_skb); | 617 | dev_kfree_skb_any(sweep_skb); |
602 | rc = -ENOMEM; | 618 | /* rc = -ENOMEM; */ |
603 | goto done; | 619 | goto nomem; |
604 | } | 620 | } |
605 | 621 | ||
606 | header->th.th_seg = 0x00 ; | 622 | header->th.th_seg = 0x00 ; |
@@ -621,12 +637,10 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
621 | 637 | ||
622 | return; | 638 | return; |
623 | 639 | ||
624 | done: | 640 | nomem: |
625 | if (rc != 0) { | 641 | grp->in_sweep = 0; |
626 | grp->in_sweep = 0; | 642 | ctcm_clear_busy(dev); |
627 | ctcm_clear_busy(dev); | 643 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
628 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
629 | } | ||
630 | 644 | ||
631 | return; | 645 | return; |
632 | } | 646 | } |
@@ -648,11 +662,9 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
648 | unsigned long saveflags = 0; /* avoids compiler warning */ | 662 | unsigned long saveflags = 0; /* avoids compiler warning */ |
649 | __u16 block_len; | 663 | __u16 block_len; |
650 | 664 | ||
651 | if (do_debug) | 665 | CTCM_PR_DEBUG("Enter %s: %s, cp=%i ch=0x%p id=%s state=%s\n", |
652 | ctcm_pr_debug( | 666 | __func__, dev->name, smp_processor_id(), ch, |
653 | "ctcm enter: %s(): %s cp=%i ch=0x%p id=%s state=%s\n", | 667 | ch->id, fsm_getstate_str(ch->fsm)); |
654 | __FUNCTION__, dev->name, smp_processor_id(), ch, | ||
655 | ch->id, fsm_getstate_str(ch->fsm)); | ||
656 | 668 | ||
657 | if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { | 669 | if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { |
658 | spin_lock_irqsave(&ch->collect_lock, saveflags); | 670 | spin_lock_irqsave(&ch->collect_lock, saveflags); |
@@ -660,14 +672,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
660 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); | 672 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); |
661 | 673 | ||
662 | if (!p_header) { | 674 | if (!p_header) { |
663 | printk(KERN_WARNING "ctcm: OUT OF MEMORY IN %s():" | ||
664 | " Data Lost \n", __FUNCTION__); | ||
665 | |||
666 | atomic_dec(&skb->users); | ||
667 | dev_kfree_skb_any(skb); | ||
668 | spin_unlock_irqrestore(&ch->collect_lock, saveflags); | 675 | spin_unlock_irqrestore(&ch->collect_lock, saveflags); |
669 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 676 | goto nomem_exit; |
670 | goto done; | ||
671 | } | 677 | } |
672 | 678 | ||
673 | p_header->pdu_offset = skb->len; | 679 | p_header->pdu_offset = skb->len; |
@@ -682,13 +688,10 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
682 | memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, | 688 | memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, |
683 | PDU_HEADER_LENGTH); | 689 | PDU_HEADER_LENGTH); |
684 | 690 | ||
685 | if (do_debug_data) { | 691 | CTCM_PR_DEBUG("%s(%s): Put on collect_q - skb len: %04x \n" |
686 | ctcm_pr_debug("ctcm: %s() Putting on collect_q" | 692 | "pdu header and data for up to 32 bytes:\n", |
687 | " - skb len: %04x \n", __FUNCTION__, skb->len); | 693 | __func__, dev->name, skb->len); |
688 | ctcm_pr_debug("ctcm: %s() pdu header and data" | 694 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
689 | " for up to 32 bytes\n", __FUNCTION__); | ||
690 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
691 | } | ||
692 | 695 | ||
693 | skb_queue_tail(&ch->collect_queue, skb); | 696 | skb_queue_tail(&ch->collect_queue, skb); |
694 | ch->collect_len += skb->len; | 697 | ch->collect_len += skb->len; |
@@ -713,12 +716,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
713 | if (hi) { | 716 | if (hi) { |
714 | nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 717 | nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
715 | if (!nskb) { | 718 | if (!nskb) { |
716 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" | 719 | goto nomem_exit; |
717 | "- Data Lost \n", __FUNCTION__); | ||
718 | atomic_dec(&skb->users); | ||
719 | dev_kfree_skb_any(skb); | ||
720 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
721 | goto done; | ||
722 | } else { | 720 | } else { |
723 | memcpy(skb_put(nskb, skb->len), skb->data, skb->len); | 721 | memcpy(skb_put(nskb, skb->len), skb->data, skb->len); |
724 | atomic_inc(&nskb->users); | 722 | atomic_inc(&nskb->users); |
@@ -730,15 +728,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
730 | 728 | ||
731 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); | 729 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); |
732 | 730 | ||
733 | if (!p_header) { | 731 | if (!p_header) |
734 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" | 732 | goto nomem_exit; |
735 | ": Data Lost \n", __FUNCTION__); | ||
736 | |||
737 | atomic_dec(&skb->users); | ||
738 | dev_kfree_skb_any(skb); | ||
739 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
740 | goto done; | ||
741 | } | ||
742 | 733 | ||
743 | p_header->pdu_offset = skb->len; | 734 | p_header->pdu_offset = skb->len; |
744 | p_header->pdu_proto = 0x01; | 735 | p_header->pdu_proto = 0x01; |
@@ -768,15 +759,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
768 | ch->prof.txlen += skb->len - PDU_HEADER_LENGTH; | 759 | ch->prof.txlen += skb->len - PDU_HEADER_LENGTH; |
769 | 760 | ||
770 | header = kmalloc(TH_HEADER_LENGTH, gfp_type()); | 761 | header = kmalloc(TH_HEADER_LENGTH, gfp_type()); |
771 | 762 | if (!header) | |
772 | if (!header) { | 763 | goto nomem_exit; |
773 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY: Data Lost \n", | ||
774 | __FUNCTION__); | ||
775 | atomic_dec(&skb->users); | ||
776 | dev_kfree_skb_any(skb); | ||
777 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
778 | goto done; | ||
779 | } | ||
780 | 764 | ||
781 | header->th_seg = 0x00; | 765 | header->th_seg = 0x00; |
782 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ | 766 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ |
@@ -785,41 +769,31 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
785 | ch->th_seq_num++; | 769 | ch->th_seq_num++; |
786 | header->th_seq_num = ch->th_seq_num; | 770 | header->th_seq_num = ch->th_seq_num; |
787 | 771 | ||
788 | if (do_debug_data) | 772 | CTCM_PR_DBGDATA("%s(%s) ToVTAM_th_seq= %08x\n" , |
789 | ctcm_pr_debug("ctcm: %s() ToVTAM_th_seq= %08x\n" , | 773 | __func__, dev->name, ch->th_seq_num); |
790 | __FUNCTION__, ch->th_seq_num); | ||
791 | 774 | ||
792 | /* put the TH on the packet */ | 775 | /* put the TH on the packet */ |
793 | memcpy(skb_push(skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); | 776 | memcpy(skb_push(skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); |
794 | 777 | ||
795 | kfree(header); | 778 | kfree(header); |
796 | 779 | ||
797 | if (do_debug_data) { | 780 | CTCM_PR_DBGDATA("%s(%s): skb len: %04x\n - pdu header and data for " |
798 | ctcm_pr_debug("ctcm: %s(): skb len: %04x \n", | 781 | "up to 32 bytes sent to vtam:\n", |
799 | __FUNCTION__, skb->len); | 782 | __func__, dev->name, skb->len); |
800 | ctcm_pr_debug("ctcm: %s(): pdu header and data for up to 32 " | 783 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
801 | "bytes sent to vtam\n", __FUNCTION__); | ||
802 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
803 | } | ||
804 | 784 | ||
805 | ch->ccw[4].count = skb->len; | 785 | ch->ccw[4].count = skb->len; |
806 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { | 786 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { |
807 | /* | 787 | /* |
808 | * idal allocation failed, try via copying to | 788 | * idal allocation failed, try via copying to trans_skb. |
809 | * trans_skb. trans_skb usually has a pre-allocated | 789 | * trans_skb usually has a pre-allocated idal. |
810 | * idal. | ||
811 | */ | 790 | */ |
812 | if (ctcm_checkalloc_buffer(ch)) { | 791 | if (ctcm_checkalloc_buffer(ch)) { |
813 | /* | 792 | /* |
814 | * Remove our header. It gets added | 793 | * Remove our header. |
815 | * again on retransmit. | 794 | * It gets added again on retransmit. |
816 | */ | 795 | */ |
817 | atomic_dec(&skb->users); | 796 | goto nomem_exit; |
818 | dev_kfree_skb_any(skb); | ||
819 | printk(KERN_WARNING "ctcm: %s()OUT OF MEMORY:" | ||
820 | " Data Lost \n", __FUNCTION__); | ||
821 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
822 | goto done; | ||
823 | } | 797 | } |
824 | 798 | ||
825 | skb_reset_tail_pointer(ch->trans_skb); | 799 | skb_reset_tail_pointer(ch->trans_skb); |
@@ -829,14 +803,11 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
829 | atomic_dec(&skb->users); | 803 | atomic_dec(&skb->users); |
830 | dev_kfree_skb_irq(skb); | 804 | dev_kfree_skb_irq(skb); |
831 | ccw_idx = 0; | 805 | ccw_idx = 0; |
832 | if (do_debug_data) { | 806 | CTCM_PR_DBGDATA("%s(%s): trans_skb len: %04x\n" |
833 | ctcm_pr_debug("ctcm: %s() TRANS skb len: %d \n", | 807 | "up to 32 bytes sent to vtam:\n", |
834 | __FUNCTION__, ch->trans_skb->len); | 808 | __func__, dev->name, ch->trans_skb->len); |
835 | ctcm_pr_debug("ctcm: %s up to 32 bytes of data" | 809 | CTCM_D3_DUMP((char *)ch->trans_skb->data, |
836 | " sent to vtam\n", __FUNCTION__); | 810 | min_t(int, 32, ch->trans_skb->len)); |
837 | ctcmpc_dump32((char *)ch->trans_skb->data, | ||
838 | ch->trans_skb->len); | ||
839 | } | ||
840 | } else { | 811 | } else { |
841 | skb_queue_tail(&ch->io_queue, skb); | 812 | skb_queue_tail(&ch->io_queue, skb); |
842 | ccw_idx = 3; | 813 | ccw_idx = 3; |
@@ -865,13 +836,21 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
865 | priv->stats.tx_packets++; | 836 | priv->stats.tx_packets++; |
866 | priv->stats.tx_bytes += skb->len - TH_HEADER_LENGTH; | 837 | priv->stats.tx_bytes += skb->len - TH_HEADER_LENGTH; |
867 | } | 838 | } |
868 | if (ch->th_seq_num > 0xf0000000) /* Chose 4Billion at random. */ | 839 | if (ch->th_seq_num > 0xf0000000) /* Chose at random. */ |
869 | ctcmpc_send_sweep_req(ch); | 840 | ctcmpc_send_sweep_req(ch); |
870 | 841 | ||
842 | goto done; | ||
843 | nomem_exit: | ||
844 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_CRIT, | ||
845 | "%s(%s): MEMORY allocation ERROR\n", | ||
846 | CTCM_FUNTAIL, ch->id); | ||
847 | rc = -ENOMEM; | ||
848 | atomic_dec(&skb->users); | ||
849 | dev_kfree_skb_any(skb); | ||
850 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
871 | done: | 851 | done: |
872 | if (do_debug) | 852 | CTCM_PR_DEBUG("Exit %s(%s)\n", __func__, dev->name); |
873 | ctcm_pr_debug("ctcm exit: %s %s()\n", dev->name, __FUNCTION__); | 853 | return rc; |
874 | return 0; | ||
875 | } | 854 | } |
876 | 855 | ||
877 | /** | 856 | /** |
@@ -888,20 +867,19 @@ done: | |||
888 | /* first merge version - leaving both functions separated */ | 867 | /* first merge version - leaving both functions separated */ |
889 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | 868 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) |
890 | { | 869 | { |
891 | int rc = 0; | 870 | struct ctcm_priv *priv = dev->priv; |
892 | struct ctcm_priv *priv; | ||
893 | |||
894 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | ||
895 | priv = dev->priv; | ||
896 | 871 | ||
897 | if (skb == NULL) { | 872 | if (skb == NULL) { |
898 | ctcm_pr_warn("%s: NULL sk_buff passed\n", dev->name); | 873 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
874 | "%s(%s): NULL sk_buff passed", | ||
875 | CTCM_FUNTAIL, dev->name); | ||
899 | priv->stats.tx_dropped++; | 876 | priv->stats.tx_dropped++; |
900 | return 0; | 877 | return 0; |
901 | } | 878 | } |
902 | if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) { | 879 | if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) { |
903 | ctcm_pr_warn("%s: Got sk_buff with head room < %ld bytes\n", | 880 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
904 | dev->name, LL_HEADER_LENGTH + 2); | 881 | "%s(%s): Got sk_buff with head room < %ld bytes", |
882 | CTCM_FUNTAIL, dev->name, LL_HEADER_LENGTH + 2); | ||
905 | dev_kfree_skb(skb); | 883 | dev_kfree_skb(skb); |
906 | priv->stats.tx_dropped++; | 884 | priv->stats.tx_dropped++; |
907 | return 0; | 885 | return 0; |
@@ -925,51 +903,43 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | |||
925 | 903 | ||
926 | dev->trans_start = jiffies; | 904 | dev->trans_start = jiffies; |
927 | if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) | 905 | if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) |
928 | rc = 1; | 906 | return 1; |
929 | return rc; | 907 | return 0; |
930 | } | 908 | } |
931 | 909 | ||
932 | /* unmerged MPC variant of ctcm_tx */ | 910 | /* unmerged MPC variant of ctcm_tx */ |
933 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | 911 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) |
934 | { | 912 | { |
935 | int len = 0; | 913 | int len = 0; |
936 | struct ctcm_priv *priv = NULL; | 914 | struct ctcm_priv *priv = dev->priv; |
937 | struct mpc_group *grp = NULL; | 915 | struct mpc_group *grp = priv->mpcg; |
938 | struct sk_buff *newskb = NULL; | 916 | struct sk_buff *newskb = NULL; |
939 | 917 | ||
940 | if (do_debug) | ||
941 | ctcm_pr_debug("ctcmpc enter: %s(): skb:%0lx\n", | ||
942 | __FUNCTION__, (unsigned long)skb); | ||
943 | |||
944 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | ||
945 | "ctcmpc enter: %s(): skb:%0lx\n", | ||
946 | __FUNCTION__, (unsigned long)skb); | ||
947 | |||
948 | priv = dev->priv; | ||
949 | grp = priv->mpcg; | ||
950 | /* | 918 | /* |
951 | * Some sanity checks ... | 919 | * Some sanity checks ... |
952 | */ | 920 | */ |
953 | if (skb == NULL) { | 921 | if (skb == NULL) { |
954 | ctcm_pr_warn("ctcmpc: %s: NULL sk_buff passed\n", dev->name); | 922 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
923 | "%s(%s): NULL sk_buff passed", | ||
924 | CTCM_FUNTAIL, dev->name); | ||
955 | priv->stats.tx_dropped++; | 925 | priv->stats.tx_dropped++; |
956 | goto done; | 926 | goto done; |
957 | } | 927 | } |
958 | if (skb_headroom(skb) < (TH_HEADER_LENGTH + PDU_HEADER_LENGTH)) { | 928 | if (skb_headroom(skb) < (TH_HEADER_LENGTH + PDU_HEADER_LENGTH)) { |
959 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_WARN, | 929 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
960 | "%s: Got sk_buff with head room < %ld bytes\n", | 930 | "%s(%s): Got sk_buff with head room < %ld bytes", |
961 | dev->name, TH_HEADER_LENGTH + PDU_HEADER_LENGTH); | 931 | CTCM_FUNTAIL, dev->name, |
932 | TH_HEADER_LENGTH + PDU_HEADER_LENGTH); | ||
962 | 933 | ||
963 | if (do_debug_data) | 934 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
964 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
965 | 935 | ||
966 | len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH; | 936 | len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH; |
967 | newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA); | 937 | newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA); |
968 | 938 | ||
969 | if (!newskb) { | 939 | if (!newskb) { |
970 | printk(KERN_WARNING "ctcmpc: %s() OUT OF MEMORY-" | 940 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
971 | "Data Lost\n", | 941 | "%s: %s: __dev_alloc_skb failed", |
972 | __FUNCTION__); | 942 | __func__, dev->name); |
973 | 943 | ||
974 | dev_kfree_skb_any(skb); | 944 | dev_kfree_skb_any(skb); |
975 | priv->stats.tx_dropped++; | 945 | priv->stats.tx_dropped++; |
@@ -993,9 +963,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
993 | if ((fsm_getstate(priv->fsm) != DEV_STATE_RUNNING) || | 963 | if ((fsm_getstate(priv->fsm) != DEV_STATE_RUNNING) || |
994 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { | 964 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { |
995 | dev_kfree_skb_any(skb); | 965 | dev_kfree_skb_any(skb); |
996 | printk(KERN_INFO "ctcmpc: %s() DATA RCVD - MPC GROUP " | 966 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
997 | "NOT ACTIVE - DROPPED\n", | 967 | "%s(%s): inactive MPCGROUP - dropped", |
998 | __FUNCTION__); | 968 | CTCM_FUNTAIL, dev->name); |
999 | priv->stats.tx_dropped++; | 969 | priv->stats.tx_dropped++; |
1000 | priv->stats.tx_errors++; | 970 | priv->stats.tx_errors++; |
1001 | priv->stats.tx_carrier_errors++; | 971 | priv->stats.tx_carrier_errors++; |
@@ -1003,8 +973,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
1003 | } | 973 | } |
1004 | 974 | ||
1005 | if (ctcm_test_and_set_busy(dev)) { | 975 | if (ctcm_test_and_set_busy(dev)) { |
1006 | printk(KERN_WARNING "%s:DEVICE ERR - UNRECOVERABLE DATA LOSS\n", | 976 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1007 | __FUNCTION__); | 977 | "%s(%s): device busy - dropped", |
978 | CTCM_FUNTAIL, dev->name); | ||
1008 | dev_kfree_skb_any(skb); | 979 | dev_kfree_skb_any(skb); |
1009 | priv->stats.tx_dropped++; | 980 | priv->stats.tx_dropped++; |
1010 | priv->stats.tx_errors++; | 981 | priv->stats.tx_errors++; |
@@ -1015,12 +986,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
1015 | 986 | ||
1016 | dev->trans_start = jiffies; | 987 | dev->trans_start = jiffies; |
1017 | if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { | 988 | if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { |
1018 | printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" | 989 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1019 | ": Data Lost \n", | 990 | "%s(%s): device error - dropped", |
1020 | __FUNCTION__); | 991 | CTCM_FUNTAIL, dev->name); |
1021 | printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" | ||
1022 | " - UNRECOVERABLE DATA LOSS\n", | ||
1023 | __FUNCTION__); | ||
1024 | dev_kfree_skb_any(skb); | 992 | dev_kfree_skb_any(skb); |
1025 | priv->stats.tx_dropped++; | 993 | priv->stats.tx_dropped++; |
1026 | priv->stats.tx_errors++; | 994 | priv->stats.tx_errors++; |
@@ -1054,8 +1022,6 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) | |||
1054 | struct ctcm_priv *priv; | 1022 | struct ctcm_priv *priv; |
1055 | int max_bufsize; | 1023 | int max_bufsize; |
1056 | 1024 | ||
1057 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1058 | |||
1059 | if (new_mtu < 576 || new_mtu > 65527) | 1025 | if (new_mtu < 576 || new_mtu > 65527) |
1060 | return -EINVAL; | 1026 | return -EINVAL; |
1061 | 1027 | ||
@@ -1087,30 +1053,13 @@ static struct net_device_stats *ctcm_stats(struct net_device *dev) | |||
1087 | return &((struct ctcm_priv *)dev->priv)->stats; | 1053 | return &((struct ctcm_priv *)dev->priv)->stats; |
1088 | } | 1054 | } |
1089 | 1055 | ||
1090 | |||
1091 | static void ctcm_netdev_unregister(struct net_device *dev) | ||
1092 | { | ||
1093 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1094 | if (!dev) | ||
1095 | return; | ||
1096 | unregister_netdev(dev); | ||
1097 | } | ||
1098 | |||
1099 | static int ctcm_netdev_register(struct net_device *dev) | ||
1100 | { | ||
1101 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1102 | return register_netdev(dev); | ||
1103 | } | ||
1104 | |||
1105 | static void ctcm_free_netdevice(struct net_device *dev) | 1056 | static void ctcm_free_netdevice(struct net_device *dev) |
1106 | { | 1057 | { |
1107 | struct ctcm_priv *priv; | 1058 | struct ctcm_priv *priv; |
1108 | struct mpc_group *grp; | 1059 | struct mpc_group *grp; |
1109 | 1060 | ||
1110 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | 1061 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1111 | 1062 | "%s(%s)", CTCM_FUNTAIL, dev->name); | |
1112 | if (!dev) | ||
1113 | return; | ||
1114 | priv = dev->priv; | 1063 | priv = dev->priv; |
1115 | if (priv) { | 1064 | if (priv) { |
1116 | grp = priv->mpcg; | 1065 | grp = priv->mpcg; |
@@ -1171,7 +1120,9 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) | |||
1171 | dev = alloc_netdev(0, CTC_DEVICE_GENE, ctcm_dev_setup); | 1120 | dev = alloc_netdev(0, CTC_DEVICE_GENE, ctcm_dev_setup); |
1172 | 1121 | ||
1173 | if (!dev) { | 1122 | if (!dev) { |
1174 | ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); | 1123 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, |
1124 | "%s: MEMORY allocation ERROR", | ||
1125 | CTCM_FUNTAIL); | ||
1175 | return NULL; | 1126 | return NULL; |
1176 | } | 1127 | } |
1177 | dev->priv = priv; | 1128 | dev->priv = priv; |
@@ -1209,6 +1160,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) | |||
1209 | } | 1160 | } |
1210 | 1161 | ||
1211 | CTCMY_DBF_DEV(SETUP, dev, "finished"); | 1162 | CTCMY_DBF_DEV(SETUP, dev, "finished"); |
1163 | |||
1212 | return dev; | 1164 | return dev; |
1213 | } | 1165 | } |
1214 | 1166 | ||
@@ -1226,18 +1178,24 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1226 | struct net_device *dev; | 1178 | struct net_device *dev; |
1227 | struct ctcm_priv *priv; | 1179 | struct ctcm_priv *priv; |
1228 | struct ccwgroup_device *cgdev; | 1180 | struct ccwgroup_device *cgdev; |
1181 | int cstat; | ||
1182 | int dstat; | ||
1183 | |||
1184 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, | ||
1185 | "Enter %s(%s)", CTCM_FUNTAIL, &cdev->dev.bus_id); | ||
1229 | 1186 | ||
1230 | CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __FUNCTION__); | ||
1231 | if (ctcm_check_irb_error(cdev, irb)) | 1187 | if (ctcm_check_irb_error(cdev, irb)) |
1232 | return; | 1188 | return; |
1233 | 1189 | ||
1234 | cgdev = dev_get_drvdata(&cdev->dev); | 1190 | cgdev = dev_get_drvdata(&cdev->dev); |
1235 | 1191 | ||
1192 | cstat = irb->scsw.cmd.cstat; | ||
1193 | dstat = irb->scsw.cmd.dstat; | ||
1194 | |||
1236 | /* Check for unsolicited interrupts. */ | 1195 | /* Check for unsolicited interrupts. */ |
1237 | if (cgdev == NULL) { | 1196 | if (cgdev == NULL) { |
1238 | ctcm_pr_warn("ctcm: Got unsolicited irq: %s c-%02x d-%02x\n", | 1197 | ctcm_pr_warn("ctcm: Got unsolicited irq: c-%02x d-%02x\n", |
1239 | cdev->dev.bus_id, irb->scsw.cmd.cstat, | 1198 | cstat, dstat); |
1240 | irb->scsw.cmd.dstat); | ||
1241 | return; | 1199 | return; |
1242 | } | 1200 | } |
1243 | 1201 | ||
@@ -1254,26 +1212,22 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1254 | return; | 1212 | return; |
1255 | } | 1213 | } |
1256 | 1214 | ||
1257 | dev = (struct net_device *)(ch->netdev); | 1215 | dev = ch->netdev; |
1258 | if (dev == NULL) { | 1216 | if (dev == NULL) { |
1259 | ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", | 1217 | ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", |
1260 | __FUNCTION__, cdev->dev.bus_id, ch); | 1218 | __func__, cdev->dev.bus_id, ch); |
1261 | return; | 1219 | return; |
1262 | } | 1220 | } |
1263 | 1221 | ||
1264 | if (do_debug) | 1222 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
1265 | ctcm_pr_debug("%s: interrupt for device: %s " | 1223 | "%s(%s): int. for %s: cstat=%02x dstat=%02x", |
1266 | "received c-%02x d-%02x\n", | 1224 | CTCM_FUNTAIL, dev->name, ch->id, cstat, dstat); |
1267 | dev->name, | ||
1268 | ch->id, | ||
1269 | irb->scsw.cmd.cstat, | ||
1270 | irb->scsw.cmd.dstat); | ||
1271 | 1225 | ||
1272 | /* Copy interruption response block. */ | 1226 | /* Copy interruption response block. */ |
1273 | memcpy(ch->irb, irb, sizeof(struct irb)); | 1227 | memcpy(ch->irb, irb, sizeof(struct irb)); |
1274 | 1228 | ||
1275 | /* Check for good subchannel return code, otherwise error message */ | ||
1276 | if (irb->scsw.cmd.cstat) { | 1229 | if (irb->scsw.cmd.cstat) { |
1230 | /* Check for good subchannel return code, otherwise error message */ | ||
1277 | fsm_event(ch->fsm, CTC_EVENT_SC_UNKNOWN, ch); | 1231 | fsm_event(ch->fsm, CTC_EVENT_SC_UNKNOWN, ch); |
1278 | ctcm_pr_warn("%s: subchannel check for dev: %s - %02x %02x\n", | 1232 | ctcm_pr_warn("%s: subchannel check for dev: %s - %02x %02x\n", |
1279 | dev->name, ch->id, irb->scsw.cmd.cstat, | 1233 | dev->name, ch->id, irb->scsw.cmd.cstat, |
@@ -1283,6 +1237,11 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1283 | 1237 | ||
1284 | /* Check the reason-code of a unit check */ | 1238 | /* Check the reason-code of a unit check */ |
1285 | if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { | 1239 | if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { |
1240 | if ((irb->ecw[0] & ch->sense_rc) == 0) | ||
1241 | /* print it only once */ | ||
1242 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, | ||
1243 | "%s(%s): sense=%02x, ds=%02x", | ||
1244 | CTCM_FUNTAIL, ch->id, irb->ecw[0], dstat); | ||
1286 | ccw_unit_check(ch, irb->ecw[0]); | 1245 | ccw_unit_check(ch, irb->ecw[0]); |
1287 | return; | 1246 | return; |
1288 | } | 1247 | } |
@@ -1320,14 +1279,18 @@ static int ctcm_probe_device(struct ccwgroup_device *cgdev) | |||
1320 | struct ctcm_priv *priv; | 1279 | struct ctcm_priv *priv; |
1321 | int rc; | 1280 | int rc; |
1322 | 1281 | ||
1323 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s %p", __FUNCTION__, cgdev); | 1282 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1283 | "%s %p", | ||
1284 | __func__, cgdev); | ||
1324 | 1285 | ||
1325 | if (!get_device(&cgdev->dev)) | 1286 | if (!get_device(&cgdev->dev)) |
1326 | return -ENODEV; | 1287 | return -ENODEV; |
1327 | 1288 | ||
1328 | priv = kzalloc(sizeof(struct ctcm_priv), GFP_KERNEL); | 1289 | priv = kzalloc(sizeof(struct ctcm_priv), GFP_KERNEL); |
1329 | if (!priv) { | 1290 | if (!priv) { |
1330 | ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); | 1291 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
1292 | "%s: memory allocation failure", | ||
1293 | CTCM_FUNTAIL); | ||
1331 | put_device(&cgdev->dev); | 1294 | put_device(&cgdev->dev); |
1332 | return -ENOMEM; | 1295 | return -ENOMEM; |
1333 | } | 1296 | } |
@@ -1364,10 +1327,13 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1364 | int ccw_num; | 1327 | int ccw_num; |
1365 | int rc = 0; | 1328 | int rc = 0; |
1366 | 1329 | ||
1367 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | 1330 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1331 | "%s(%s), type %d, proto %d", | ||
1332 | __func__, cdev->dev.bus_id, type, priv->protocol); | ||
1333 | |||
1368 | ch = kzalloc(sizeof(struct channel), GFP_KERNEL); | 1334 | ch = kzalloc(sizeof(struct channel), GFP_KERNEL); |
1369 | if (ch == NULL) | 1335 | if (ch == NULL) |
1370 | goto nomem_return; | 1336 | return -ENOMEM; |
1371 | 1337 | ||
1372 | ch->protocol = priv->protocol; | 1338 | ch->protocol = priv->protocol; |
1373 | if (IS_MPC(priv)) { | 1339 | if (IS_MPC(priv)) { |
@@ -1478,7 +1444,7 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1478 | if (*c && (!strncmp((*c)->id, ch->id, CTCM_ID_SIZE))) { | 1444 | if (*c && (!strncmp((*c)->id, ch->id, CTCM_ID_SIZE))) { |
1479 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1445 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1480 | "%s (%s) already in list, using old entry", | 1446 | "%s (%s) already in list, using old entry", |
1481 | __FUNCTION__, (*c)->id); | 1447 | __func__, (*c)->id); |
1482 | 1448 | ||
1483 | goto free_return; | 1449 | goto free_return; |
1484 | } | 1450 | } |
@@ -1498,11 +1464,10 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1498 | return 0; | 1464 | return 0; |
1499 | 1465 | ||
1500 | nomem_return: | 1466 | nomem_return: |
1501 | ctcm_pr_warn("ctcm: Out of memory in %s\n", __FUNCTION__); | ||
1502 | rc = -ENOMEM; | 1467 | rc = -ENOMEM; |
1503 | 1468 | ||
1504 | free_return: /* note that all channel pointers are 0 or valid */ | 1469 | free_return: /* note that all channel pointers are 0 or valid */ |
1505 | kfree(ch->ccw); /* TODO: check that again */ | 1470 | kfree(ch->ccw); |
1506 | kfree(ch->discontact_th); | 1471 | kfree(ch->discontact_th); |
1507 | kfree_fsm(ch->fsm); | 1472 | kfree_fsm(ch->fsm); |
1508 | kfree(ch->irb); | 1473 | kfree(ch->irb); |
@@ -1540,48 +1505,48 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1540 | enum channel_types type; | 1505 | enum channel_types type; |
1541 | struct ctcm_priv *priv; | 1506 | struct ctcm_priv *priv; |
1542 | struct net_device *dev; | 1507 | struct net_device *dev; |
1508 | struct ccw_device *cdev0; | ||
1509 | struct ccw_device *cdev1; | ||
1543 | int ret; | 1510 | int ret; |
1544 | 1511 | ||
1545 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1546 | |||
1547 | priv = dev_get_drvdata(&cgdev->dev); | 1512 | priv = dev_get_drvdata(&cgdev->dev); |
1548 | if (!priv) | 1513 | if (!priv) |
1549 | return -ENODEV; | 1514 | return -ENODEV; |
1550 | 1515 | ||
1551 | type = get_channel_type(&cgdev->cdev[0]->id); | 1516 | cdev0 = cgdev->cdev[0]; |
1517 | cdev1 = cgdev->cdev[1]; | ||
1518 | |||
1519 | type = get_channel_type(&cdev0->id); | ||
1552 | 1520 | ||
1553 | snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); | 1521 | snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cdev0->dev.bus_id); |
1554 | snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); | 1522 | snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cdev1->dev.bus_id); |
1555 | 1523 | ||
1556 | ret = add_channel(cgdev->cdev[0], type, priv); | 1524 | ret = add_channel(cdev0, type, priv); |
1557 | if (ret) | 1525 | if (ret) |
1558 | return ret; | 1526 | return ret; |
1559 | ret = add_channel(cgdev->cdev[1], type, priv); | 1527 | ret = add_channel(cdev1, type, priv); |
1560 | if (ret) | 1528 | if (ret) |
1561 | return ret; | 1529 | return ret; |
1562 | 1530 | ||
1563 | ret = ccw_device_set_online(cgdev->cdev[0]); | 1531 | ret = ccw_device_set_online(cdev0); |
1564 | if (ret != 0) { | 1532 | if (ret != 0) { |
1565 | CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, | 1533 | /* may be ok to fail now - can be done later */ |
1566 | "ccw_device_set_online (cdev[0]) failed "); | 1534 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
1567 | ctcm_pr_warn("ccw_device_set_online (cdev[0]) failed " | 1535 | "%s(%s) set_online rc=%d", |
1568 | "with ret = %d\n", ret); | 1536 | CTCM_FUNTAIL, read_id, ret); |
1569 | } | 1537 | } |
1570 | 1538 | ||
1571 | ret = ccw_device_set_online(cgdev->cdev[1]); | 1539 | ret = ccw_device_set_online(cdev1); |
1572 | if (ret != 0) { | 1540 | if (ret != 0) { |
1573 | CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, | 1541 | /* may be ok to fail now - can be done later */ |
1574 | "ccw_device_set_online (cdev[1]) failed "); | 1542 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
1575 | ctcm_pr_warn("ccw_device_set_online (cdev[1]) failed " | 1543 | "%s(%s) set_online rc=%d", |
1576 | "with ret = %d\n", ret); | 1544 | CTCM_FUNTAIL, write_id, ret); |
1577 | } | 1545 | } |
1578 | 1546 | ||
1579 | dev = ctcm_init_netdevice(priv); | 1547 | dev = ctcm_init_netdevice(priv); |
1580 | 1548 | if (dev == NULL) | |
1581 | if (dev == NULL) { | 1549 | goto out; |
1582 | ctcm_pr_warn("ctcm_init_netdevice failed\n"); | ||
1583 | goto out; | ||
1584 | } | ||
1585 | 1550 | ||
1586 | for (direction = READ; direction <= WRITE; direction++) { | 1551 | for (direction = READ; direction <= WRITE; direction++) { |
1587 | priv->channel[direction] = | 1552 | priv->channel[direction] = |
@@ -1590,8 +1555,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1590 | if (priv->channel[direction] == NULL) { | 1555 | if (priv->channel[direction] == NULL) { |
1591 | if (direction == WRITE) | 1556 | if (direction == WRITE) |
1592 | channel_free(priv->channel[READ]); | 1557 | channel_free(priv->channel[READ]); |
1593 | ctcm_free_netdevice(dev); | 1558 | goto out_dev; |
1594 | goto out; | ||
1595 | } | 1559 | } |
1596 | priv->channel[direction]->netdev = dev; | 1560 | priv->channel[direction]->netdev = dev; |
1597 | priv->channel[direction]->protocol = priv->protocol; | 1561 | priv->channel[direction]->protocol = priv->protocol; |
@@ -1600,26 +1564,24 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1600 | /* sysfs magic */ | 1564 | /* sysfs magic */ |
1601 | SET_NETDEV_DEV(dev, &cgdev->dev); | 1565 | SET_NETDEV_DEV(dev, &cgdev->dev); |
1602 | 1566 | ||
1603 | if (ctcm_netdev_register(dev) != 0) { | 1567 | if (register_netdev(dev)) |
1604 | ctcm_free_netdevice(dev); | 1568 | goto out_dev; |
1605 | goto out; | ||
1606 | } | ||
1607 | 1569 | ||
1608 | if (ctcm_add_attributes(&cgdev->dev)) { | 1570 | if (ctcm_add_attributes(&cgdev->dev)) { |
1609 | ctcm_netdev_unregister(dev); | 1571 | unregister_netdev(dev); |
1610 | /* dev->priv = NULL; why that ???? */ | 1572 | goto out_dev; |
1611 | ctcm_free_netdevice(dev); | ||
1612 | goto out; | ||
1613 | } | 1573 | } |
1614 | 1574 | ||
1615 | strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name)); | 1575 | strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name)); |
1616 | 1576 | ||
1617 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1577 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1618 | "setup(%s) ok : r/w = %s / %s, proto : %d", | 1578 | "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name, |
1619 | dev->name, priv->channel[READ]->id, | 1579 | priv->channel[READ]->id, |
1620 | priv->channel[WRITE]->id, priv->protocol); | 1580 | priv->channel[WRITE]->id, priv->protocol); |
1621 | 1581 | ||
1622 | return 0; | 1582 | return 0; |
1583 | out_dev: | ||
1584 | ctcm_free_netdevice(dev); | ||
1623 | out: | 1585 | out: |
1624 | ccw_device_set_offline(cgdev->cdev[1]); | 1586 | ccw_device_set_offline(cgdev->cdev[1]); |
1625 | ccw_device_set_offline(cgdev->cdev[0]); | 1587 | ccw_device_set_offline(cgdev->cdev[0]); |
@@ -1658,8 +1620,7 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1658 | channel_free(priv->channel[WRITE]); | 1620 | channel_free(priv->channel[WRITE]); |
1659 | 1621 | ||
1660 | if (dev) { | 1622 | if (dev) { |
1661 | ctcm_netdev_unregister(dev); | 1623 | unregister_netdev(dev); |
1662 | /* dev->priv = NULL; why that ??? */ | ||
1663 | ctcm_free_netdevice(dev); | 1624 | ctcm_free_netdevice(dev); |
1664 | } | 1625 | } |
1665 | 1626 | ||
@@ -1682,13 +1643,16 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1682 | 1643 | ||
1683 | static void ctcm_remove_device(struct ccwgroup_device *cgdev) | 1644 | static void ctcm_remove_device(struct ccwgroup_device *cgdev) |
1684 | { | 1645 | { |
1685 | struct ctcm_priv *priv; | 1646 | struct ctcm_priv *priv = dev_get_drvdata(&cgdev->dev); |
1686 | 1647 | ||
1687 | CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, __FUNCTION__); | 1648 | BUG_ON(priv == NULL); |
1649 | |||
1650 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | ||
1651 | "removing device %s, r/w = %s/%s, proto : %d", | ||
1652 | priv->channel[READ]->netdev->name, | ||
1653 | priv->channel[READ]->id, priv->channel[WRITE]->id, | ||
1654 | priv->protocol); | ||
1688 | 1655 | ||
1689 | priv = dev_get_drvdata(&cgdev->dev); | ||
1690 | if (!priv) | ||
1691 | return; | ||
1692 | if (cgdev->state == CCWGROUP_ONLINE) | 1656 | if (cgdev->state == CCWGROUP_ONLINE) |
1693 | ctcm_shutdown_device(cgdev); | 1657 | ctcm_shutdown_device(cgdev); |
1694 | ctcm_remove_files(&cgdev->dev); | 1658 | ctcm_remove_files(&cgdev->dev); |
@@ -1748,8 +1712,6 @@ static int __init ctcm_init(void) | |||
1748 | 1712 | ||
1749 | ret = ctcm_register_dbf_views(); | 1713 | ret = ctcm_register_dbf_views(); |
1750 | if (ret) { | 1714 | if (ret) { |
1751 | ctcm_pr_crit("ctcm_init failed with ctcm_register_dbf_views " | ||
1752 | "rc = %d\n", ret); | ||
1753 | return ret; | 1715 | return ret; |
1754 | } | 1716 | } |
1755 | ret = register_cu3088_discipline(&ctcm_group_driver); | 1717 | ret = register_cu3088_discipline(&ctcm_group_driver); |
diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h index 95b0c0b6ebc6..a72e0feeb27f 100644 --- a/drivers/s390/net/ctcm_main.h +++ b/drivers/s390/net/ctcm_main.h | |||
@@ -22,9 +22,9 @@ | |||
22 | 22 | ||
23 | #define CTC_DRIVER_NAME "ctcm" | 23 | #define CTC_DRIVER_NAME "ctcm" |
24 | #define CTC_DEVICE_NAME "ctc" | 24 | #define CTC_DEVICE_NAME "ctc" |
25 | #define CTC_DEVICE_GENE "ctc%d" | ||
26 | #define MPC_DEVICE_NAME "mpc" | 25 | #define MPC_DEVICE_NAME "mpc" |
27 | #define MPC_DEVICE_GENE "mpc%d" | 26 | #define CTC_DEVICE_GENE CTC_DEVICE_NAME "%d" |
27 | #define MPC_DEVICE_GENE MPC_DEVICE_NAME "%d" | ||
28 | 28 | ||
29 | #define CHANNEL_FLAGS_READ 0 | 29 | #define CHANNEL_FLAGS_READ 0 |
30 | #define CHANNEL_FLAGS_WRITE 1 | 30 | #define CHANNEL_FLAGS_WRITE 1 |
@@ -48,6 +48,30 @@ | |||
48 | #define ctcm_pr_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) | 48 | #define ctcm_pr_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) |
49 | #define ctcm_pr_crit(fmt, arg...) printk(KERN_CRIT fmt, ##arg) | 49 | #define ctcm_pr_crit(fmt, arg...) printk(KERN_CRIT fmt, ##arg) |
50 | 50 | ||
51 | #define CTCM_PR_DEBUG(fmt, arg...) \ | ||
52 | do { \ | ||
53 | if (do_debug) \ | ||
54 | printk(KERN_DEBUG fmt, ##arg); \ | ||
55 | } while (0) | ||
56 | |||
57 | #define CTCM_PR_DBGDATA(fmt, arg...) \ | ||
58 | do { \ | ||
59 | if (do_debug_data) \ | ||
60 | printk(KERN_DEBUG fmt, ##arg); \ | ||
61 | } while (0) | ||
62 | |||
63 | #define CTCM_D3_DUMP(buf, len) \ | ||
64 | do { \ | ||
65 | if (do_debug_data) \ | ||
66 | ctcmpc_dumpit(buf, len); \ | ||
67 | } while (0) | ||
68 | |||
69 | #define CTCM_CCW_DUMP(buf, len) \ | ||
70 | do { \ | ||
71 | if (do_debug_ccw) \ | ||
72 | ctcmpc_dumpit(buf, len); \ | ||
73 | } while (0) | ||
74 | |||
51 | /* | 75 | /* |
52 | * CCW commands, used in this driver. | 76 | * CCW commands, used in this driver. |
53 | */ | 77 | */ |
@@ -161,8 +185,9 @@ struct channel { | |||
161 | fsm_instance *fsm; /* finite state machine of this channel */ | 185 | fsm_instance *fsm; /* finite state machine of this channel */ |
162 | struct net_device *netdev; /* corresponding net_device */ | 186 | struct net_device *netdev; /* corresponding net_device */ |
163 | struct ctcm_profile prof; | 187 | struct ctcm_profile prof; |
164 | unsigned char *trans_skb_data; | 188 | __u8 *trans_skb_data; |
165 | __u16 logflags; | 189 | __u16 logflags; |
190 | __u8 sense_rc; /* last unit check sense code report control */ | ||
166 | }; | 191 | }; |
167 | 192 | ||
168 | struct ctcm_priv { | 193 | struct ctcm_priv { |
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 | ||
diff --git a/drivers/s390/net/ctcm_mpc.h b/drivers/s390/net/ctcm_mpc.h index f99686069a91..5336120cddf1 100644 --- a/drivers/s390/net/ctcm_mpc.h +++ b/drivers/s390/net/ctcm_mpc.h | |||
@@ -231,7 +231,7 @@ static inline void ctcmpc_dump32(char *buf, int len) | |||
231 | int ctcmpc_open(struct net_device *); | 231 | int ctcmpc_open(struct net_device *); |
232 | void ctcm_ccw_check_rc(struct channel *, int, char *); | 232 | void ctcm_ccw_check_rc(struct channel *, int, char *); |
233 | void mpc_group_ready(unsigned long adev); | 233 | void mpc_group_ready(unsigned long adev); |
234 | int mpc_channel_action(struct channel *ch, int direction, int action); | 234 | void mpc_channel_action(struct channel *ch, int direction, int action); |
235 | void mpc_action_send_discontact(unsigned long thischan); | 235 | void mpc_action_send_discontact(unsigned long thischan); |
236 | void mpc_action_discontact(fsm_instance *fi, int event, void *arg); | 236 | void mpc_action_discontact(fsm_instance *fi, int event, void *arg); |
237 | void ctcmpc_bh(unsigned long thischan); | 237 | void ctcmpc_bh(unsigned long thischan); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index b29afef5c7fb..38de31b55708 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -2651,7 +2651,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2651 | tag = (u16 *)(new_skb->data + 12); | 2651 | tag = (u16 *)(new_skb->data + 12); |
2652 | *tag = __constant_htons(ETH_P_8021Q); | 2652 | *tag = __constant_htons(ETH_P_8021Q); |
2653 | *(tag + 1) = htons(vlan_tx_tag_get(new_skb)); | 2653 | *(tag + 1) = htons(vlan_tx_tag_get(new_skb)); |
2654 | VLAN_TX_SKB_CB(new_skb)->magic = 0; | 2654 | new_skb->vlan_tci = 0; |
2655 | } | 2655 | } |
2656 | } | 2656 | } |
2657 | 2657 | ||