diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 22:09:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 22:09:51 -0400 |
commit | c010b2f76c3032e48097a6eef291d8593d5d79a6 (patch) | |
tree | 16077c83703527732991a55dea1abe330c0ccdc6 /drivers/s390/net/claw.c | |
parent | 6069fb2ef5d4f47432359c97f350e0cfcc4d208e (diff) | |
parent | 521c4d96e0840ecce25b956e00f416ed499ef2ba (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (82 commits)
ipw2200: Call netif_*_queue() interfaces properly.
netxen: Needs to include linux/vmalloc.h
[netdrvr] atl1d: fix !CONFIG_PM build
r6040: rework init_one error handling
r6040: bump release number to 0.18
r6040: handle RX fifo full and no descriptor interrupts
r6040: change the default waiting time
r6040: use definitions for magic values in descriptor status
r6040: completely rework the RX path
r6040: call napi_disable when puting down the interface and set lp->dev accordingly.
mv643xx_eth: fix NETPOLL build
r6040: rework the RX buffers allocation routine
r6040: fix scheduling while atomic in r6040_tx_timeout
r6040: fix null pointer access and tx timeouts
r6040: prefix all functions with r6040
rndis_host: support WM6 devices as modems
at91_ether: use netstats in net_device structure
sfc: Create one RX queue and interrupt per CPU package by default
sfc: Use a separate workqueue for resets
sfc: I2C adapter initialisation fixes
...
Diffstat (limited to 'drivers/s390/net/claw.c')
-rw-r--r-- | drivers/s390/net/claw.c | 2141 |
1 files changed, 520 insertions, 1621 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 | |||