aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/claw.c431
1 files changed, 233 insertions, 198 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 3cb387f45b61..6669adf355be 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -60,6 +60,9 @@
60 * 1.25 Added Packing support 60 * 1.25 Added Packing support
61 * 1.5 61 * 1.5
62 */ 62 */
63
64#define KMSG_COMPONENT "claw"
65
63#include <asm/ccwdev.h> 66#include <asm/ccwdev.h>
64#include <asm/ccwgroup.h> 67#include <asm/ccwgroup.h>
65#include <asm/debug.h> 68#include <asm/debug.h>
@@ -94,7 +97,7 @@
94 CLAW uses the s390dbf file system see claw_trace and claw_setup 97 CLAW uses the s390dbf file system see claw_trace and claw_setup
95*/ 98*/
96 99
97 100static char version[] __initdata = "CLAW driver";
98static char debug_buffer[255]; 101static char debug_buffer[255];
99/** 102/**
100 * Debug Facility Stuff 103 * Debug Facility Stuff
@@ -206,20 +209,30 @@ static struct net_device_stats *claw_stats(struct net_device *dev);
206static int pages_to_order_of_mag(int num_of_pages); 209static int pages_to_order_of_mag(int num_of_pages);
207static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr); 210static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr);
208/* sysfs Functions */ 211/* sysfs Functions */
209static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf); 212static ssize_t claw_hname_show(struct device *dev,
210static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr, 213 struct device_attribute *attr, char *buf);
214static ssize_t claw_hname_write(struct device *dev,
215 struct device_attribute *attr,
211 const char *buf, size_t count); 216 const char *buf, size_t count);
212static ssize_t claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf); 217static ssize_t claw_adname_show(struct device *dev,
213static ssize_t claw_adname_write(struct device *dev, struct device_attribute *attr, 218 struct device_attribute *attr, char *buf);
219static ssize_t claw_adname_write(struct device *dev,
220 struct device_attribute *attr,
214 const char *buf, size_t count); 221 const char *buf, size_t count);
215static ssize_t claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf); 222static ssize_t claw_apname_show(struct device *dev,
216static ssize_t claw_apname_write(struct device *dev, struct device_attribute *attr, 223 struct device_attribute *attr, char *buf);
224static ssize_t claw_apname_write(struct device *dev,
225 struct device_attribute *attr,
217 const char *buf, size_t count); 226 const char *buf, size_t count);
218static ssize_t claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf); 227static ssize_t claw_wbuff_show(struct device *dev,
219static ssize_t claw_wbuff_write(struct device *dev, struct device_attribute *attr, 228 struct device_attribute *attr, char *buf);
229static ssize_t claw_wbuff_write(struct device *dev,
230 struct device_attribute *attr,
220 const char *buf, size_t count); 231 const char *buf, size_t count);
221static ssize_t claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf); 232static ssize_t claw_rbuff_show(struct device *dev,
222static ssize_t claw_rbuff_write(struct device *dev, struct device_attribute *attr, 233 struct device_attribute *attr, char *buf);
234static ssize_t claw_rbuff_write(struct device *dev,
235 struct device_attribute *attr,
223 const char *buf, size_t count); 236 const char *buf, size_t count);
224static int claw_add_files(struct device *dev); 237static int claw_add_files(struct device *dev);
225static void claw_remove_files(struct device *dev); 238static void claw_remove_files(struct device *dev);
@@ -298,8 +311,8 @@ claw_probe(struct ccwgroup_device *cgdev)
298 if (rc) { 311 if (rc) {
299 probe_error(cgdev); 312 probe_error(cgdev);
300 put_device(&cgdev->dev); 313 put_device(&cgdev->dev);
301 printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n", 314 dev_err(&cgdev->dev, "Creating the /proc files for a new"
302 dev_name(&cgdev->cdev[0]->dev), __func__, __LINE__); 315 " CLAW device failed\n");
303 CLAW_DBF_TEXT_(2, setup, "probex%d", rc); 316 CLAW_DBF_TEXT_(2, setup, "probex%d", rc);
304 return rc; 317 return rc;
305 } 318 }
@@ -496,7 +509,8 @@ claw_open(struct net_device *dev)
496 ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) || 509 ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) ||
497 (((privptr->channel[READ].flag | 510 (((privptr->channel[READ].flag |
498 privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) { 511 privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) {
499 printk(KERN_INFO "%s: remote side is not ready\n", dev->name); 512 dev_info(&privptr->channel[READ].cdev->dev,
513 "%s: remote side is not ready\n", dev->name);
500 CLAW_DBF_TEXT(2, trace, "notrdy"); 514 CLAW_DBF_TEXT(2, trace, "notrdy");
501 515
502 for ( i = 0; i < 2; i++) { 516 for ( i = 0; i < 2; i++) {
@@ -582,10 +596,9 @@ claw_irq_handler(struct ccw_device *cdev,
582 CLAW_DBF_TEXT(4, trace, "clawirq"); 596 CLAW_DBF_TEXT(4, trace, "clawirq");
583 /* Bypass all 'unsolicited interrupts' */ 597 /* Bypass all 'unsolicited interrupts' */
584 if (!cdev->dev.driver_data) { 598 if (!cdev->dev.driver_data) {
585 printk(KERN_WARNING "claw: unsolicited interrupt for device:" 599 dev_warn(&cdev->dev, "An uninitialized CLAW device received an"
586 "%s received c-%02x d-%02x\n", 600 " IRQ, c-%02x d-%02x\n",
587 dev_name(&cdev->dev), irb->scsw.cmd.cstat, 601 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
588 irb->scsw.cmd.dstat);
589 CLAW_DBF_TEXT(2, trace, "badirq"); 602 CLAW_DBF_TEXT(2, trace, "badirq");
590 return; 603 return;
591 } 604 }
@@ -597,8 +610,7 @@ claw_irq_handler(struct ccw_device *cdev,
597 else if (privptr->channel[WRITE].cdev == cdev) 610 else if (privptr->channel[WRITE].cdev == cdev)
598 p_ch = &privptr->channel[WRITE]; 611 p_ch = &privptr->channel[WRITE];
599 else { 612 else {
600 printk(KERN_WARNING "claw: Can't determine channel for " 613 dev_warn(&cdev->dev, "The device is not a CLAW device\n");
601 "interrupt, device %s\n", dev_name(&cdev->dev));
602 CLAW_DBF_TEXT(2, trace, "badchan"); 614 CLAW_DBF_TEXT(2, trace, "badchan");
603 return; 615 return;
604 } 616 }
@@ -612,7 +624,8 @@ claw_irq_handler(struct ccw_device *cdev,
612 624
613 /* Check for good subchannel return code, otherwise info message */ 625 /* Check for good subchannel return code, otherwise info message */
614 if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) { 626 if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) {
615 printk(KERN_INFO "%s: subchannel check for device: %04x -" 627 dev_info(&cdev->dev,
628 "%s: subchannel check for device: %04x -"
616 " Sch Stat %02x Dev Stat %02x CPA - %04x\n", 629 " Sch Stat %02x Dev Stat %02x CPA - %04x\n",
617 dev->name, p_ch->devno, 630 dev->name, p_ch->devno,
618 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat, 631 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat,
@@ -651,7 +664,7 @@ claw_irq_handler(struct ccw_device *cdev,
651 wake_up(&p_ch->wait); /* wake claw_open (READ)*/ 664 wake_up(&p_ch->wait); /* wake claw_open (READ)*/
652 } else if (p_ch->flag == CLAW_WRITE) { 665 } else if (p_ch->flag == CLAW_WRITE) {
653 p_ch->claw_state = CLAW_START_WRITE; 666 p_ch->claw_state = CLAW_START_WRITE;
654 /* send SYSTEM_VALIDATE */ 667 /* send SYSTEM_VALIDATE */
655 claw_strt_read(dev, LOCK_NO); 668 claw_strt_read(dev, LOCK_NO);
656 claw_send_control(dev, 669 claw_send_control(dev,
657 SYSTEM_VALIDATE_REQUEST, 670 SYSTEM_VALIDATE_REQUEST,
@@ -659,10 +672,9 @@ claw_irq_handler(struct ccw_device *cdev,
659 p_env->host_name, 672 p_env->host_name,
660 p_env->adapter_name); 673 p_env->adapter_name);
661 } else { 674 } else {
662 printk(KERN_WARNING "claw: unsolicited " 675 dev_warn(&cdev->dev, "The CLAW device received"
663 "interrupt for device:" 676 " an unexpected IRQ, "
664 "%s received c-%02x d-%02x\n", 677 "c-%02x d-%02x\n",
665 dev_name(&cdev->dev),
666 irb->scsw.cmd.cstat, 678 irb->scsw.cmd.cstat,
667 irb->scsw.cmd.dstat); 679 irb->scsw.cmd.dstat);
668 return; 680 return;
@@ -677,8 +689,8 @@ claw_irq_handler(struct ccw_device *cdev,
677 (p_ch->irb->ecw[0] & 0x40) == 0x40 || 689 (p_ch->irb->ecw[0] & 0x40) == 0x40 ||
678 (p_ch->irb->ecw[0]) == 0) { 690 (p_ch->irb->ecw[0]) == 0) {
679 privptr->stats.rx_errors++; 691 privptr->stats.rx_errors++;
680 printk(KERN_INFO "%s: Restart is " 692 dev_info(&cdev->dev,
681 "required after remote " 693 "%s: Restart is required after remote "
682 "side recovers \n", 694 "side recovers \n",
683 dev->name); 695 dev->name);
684 } 696 }
@@ -713,11 +725,13 @@ claw_irq_handler(struct ccw_device *cdev,
713 return; 725 return;
714 case CLAW_START_WRITE: 726 case CLAW_START_WRITE:
715 if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { 727 if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
716 printk(KERN_INFO "%s: Unit Check Occured in " 728 dev_info(&cdev->dev,
729 "%s: Unit Check Occured in "
717 "write channel\n", dev->name); 730 "write channel\n", dev->name);
718 clear_bit(0, (void *)&p_ch->IO_active); 731 clear_bit(0, (void *)&p_ch->IO_active);
719 if (p_ch->irb->ecw[0] & 0x80) { 732 if (p_ch->irb->ecw[0] & 0x80) {
720 printk(KERN_INFO "%s: Resetting Event " 733 dev_info(&cdev->dev,
734 "%s: Resetting Event "
721 "occurred:\n", dev->name); 735 "occurred:\n", dev->name);
722 init_timer(&p_ch->timer); 736 init_timer(&p_ch->timer);
723 p_ch->timer.function = 737 p_ch->timer.function =
@@ -725,7 +739,8 @@ claw_irq_handler(struct ccw_device *cdev,
725 p_ch->timer.data = (unsigned long)p_ch; 739 p_ch->timer.data = (unsigned long)p_ch;
726 p_ch->timer.expires = jiffies + 10*HZ; 740 p_ch->timer.expires = jiffies + 10*HZ;
727 add_timer(&p_ch->timer); 741 add_timer(&p_ch->timer);
728 printk(KERN_INFO "%s: write connection " 742 dev_info(&cdev->dev,
743 "%s: write connection "
729 "restarting\n", dev->name); 744 "restarting\n", dev->name);
730 } 745 }
731 CLAW_DBF_TEXT(4, trace, "rstrtwrt"); 746 CLAW_DBF_TEXT(4, trace, "rstrtwrt");
@@ -733,9 +748,10 @@ claw_irq_handler(struct ccw_device *cdev,
733 } 748 }
734 if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) { 749 if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) {
735 clear_bit(0, (void *)&p_ch->IO_active); 750 clear_bit(0, (void *)&p_ch->IO_active);
736 printk(KERN_INFO "%s: Unit Exception " 751 dev_info(&cdev->dev,
737 "Occured in write channel\n", 752 "%s: Unit Exception "
738 dev->name); 753 "occurred in write channel\n",
754 dev->name);
739 } 755 }
740 if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || 756 if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) ||
741 (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || 757 (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) ||
@@ -757,8 +773,9 @@ claw_irq_handler(struct ccw_device *cdev,
757 CLAW_DBF_TEXT(4, trace, "StWtExit"); 773 CLAW_DBF_TEXT(4, trace, "StWtExit");
758 return; 774 return;
759 default: 775 default:
760 printk(KERN_WARNING "%s: wrong selection code - irq " 776 dev_warn(&cdev->dev,
761 "state=%d\n", dev->name, p_ch->claw_state); 777 "The CLAW device for %s received an unexpected IRQ\n",
778 dev->name);
762 CLAW_DBF_TEXT(2, trace, "badIRQ"); 779 CLAW_DBF_TEXT(2, trace, "badIRQ");
763 return; 780 return;
764 } 781 }
@@ -910,8 +927,10 @@ claw_release(struct net_device *dev)
910 if (((privptr->channel[READ].last_dstat | 927 if (((privptr->channel[READ].last_dstat |
911 privptr->channel[WRITE].last_dstat) & 928 privptr->channel[WRITE].last_dstat) &
912 ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) { 929 ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) {
913 printk(KERN_WARNING "%s: channel problems during close - " 930 dev_warn(&privptr->channel[READ].cdev->dev,
914 "read: %02x - write: %02x\n", 931 "Deactivating %s completed with incorrect"
932 " subchannel status "
933 "(read %02x, write %02x)\n",
915 dev->name, 934 dev->name,
916 privptr->channel[READ].last_dstat, 935 privptr->channel[READ].last_dstat,
917 privptr->channel[WRITE].last_dstat); 936 privptr->channel[WRITE].last_dstat);
@@ -1076,8 +1095,8 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first,
1076 } 1095 }
1077 1096
1078 if ( privptr-> p_read_active_first ==NULL ) { 1097 if ( privptr-> p_read_active_first ==NULL ) {
1079 privptr-> p_read_active_first= p_first; /* set new first */ 1098 privptr->p_read_active_first = p_first; /* set new first */
1080 privptr-> p_read_active_last = p_last; /* set new last */ 1099 privptr->p_read_active_last = p_last; /* set new last */
1081 } 1100 }
1082 else { 1101 else {
1083 1102
@@ -1113,7 +1132,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first,
1113 privptr->p_read_active_last->r_TIC_2.cda= 1132 privptr->p_read_active_last->r_TIC_2.cda=
1114 (__u32)__pa(&p_first->read); 1133 (__u32)__pa(&p_first->read);
1115 } 1134 }
1116 /* chain in new set of blocks */ 1135 /* chain in new set of blocks */
1117 privptr->p_read_active_last->next = p_first; 1136 privptr->p_read_active_last->next = p_first;
1118 privptr->p_read_active_last=p_last; 1137 privptr->p_read_active_last=p_last;
1119 } /* end of if ( privptr-> p_read_active_first ==NULL) */ 1138 } /* end of if ( privptr-> p_read_active_first ==NULL) */
@@ -1135,21 +1154,18 @@ ccw_check_return_code(struct ccw_device *cdev, int return_code)
1135 case -EBUSY: /* BUSY is a transient state no action needed */ 1154 case -EBUSY: /* BUSY is a transient state no action needed */
1136 break; 1155 break;
1137 case -ENODEV: 1156 case -ENODEV:
1138 printk(KERN_EMERG "%s: Missing device called " 1157 dev_err(&cdev->dev, "The remote channel adapter is not"
1139 "for IO ENODEV\n", dev_name(&cdev->dev)); 1158 " available\n");
1140 break;
1141 case -EIO:
1142 printk(KERN_EMERG "%s: Status pending... EIO \n",
1143 dev_name(&cdev->dev));
1144 break; 1159 break;
1145 case -EINVAL: 1160 case -EINVAL:
1146 printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", 1161 dev_err(&cdev->dev,
1147 dev_name(&cdev->dev)); 1162 "The status of the remote channel adapter"
1163 " is not valid\n");
1148 break; 1164 break;
1149 default: 1165 default:
1150 printk(KERN_EMERG "%s: Unknown error in " 1166 dev_err(&cdev->dev, "The common device layer"
1151 "Do_IO %d\n", dev_name(&cdev->dev), 1167 " returned error code %d\n",
1152 return_code); 1168 return_code);
1153 } 1169 }
1154 } 1170 }
1155 CLAW_DBF_TEXT(4, trace, "ccwret"); 1171 CLAW_DBF_TEXT(4, trace, "ccwret");
@@ -1163,40 +1179,41 @@ static void
1163ccw_check_unit_check(struct chbk * p_ch, unsigned char sense ) 1179ccw_check_unit_check(struct chbk * p_ch, unsigned char sense )
1164{ 1180{
1165 struct net_device *ndev = p_ch->ndev; 1181 struct net_device *ndev = p_ch->ndev;
1182 struct device *dev = &p_ch->cdev->dev;
1166 1183
1167 CLAW_DBF_TEXT(4, trace, "unitchek"); 1184 CLAW_DBF_TEXT(4, trace, "unitchek");
1168 printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n", 1185 dev_warn(dev, "The communication peer of %s disconnected\n",
1169 ndev->name, sense); 1186 ndev->name);
1170 1187
1171 if (sense & 0x40) { 1188 if (sense & 0x40) {
1172 if (sense & 0x01) { 1189 if (sense & 0x01) {
1173 printk(KERN_WARNING "%s: Interface disconnect or " 1190 dev_warn(dev, "The remote channel adapter for"
1174 "Selective reset " 1191 " %s has been reset\n",
1175 "occurred (remote side)\n", ndev->name); 1192 ndev->name);
1176 }
1177 else {
1178 printk(KERN_WARNING "%s: System reset occured"
1179 " (remote side)\n", ndev->name);
1180 } 1193 }
1181 } 1194 }
1182 else if (sense & 0x20) { 1195 else if (sense & 0x20) {
1183 if (sense & 0x04) { 1196 if (sense & 0x04) {
1184 printk(KERN_WARNING "%s: Data-streaming " 1197 dev_warn(dev, "A data streaming timeout occurred"
1185 "timeout)\n", ndev->name); 1198 " for %s\n",
1199 ndev->name);
1186 } 1200 }
1187 else { 1201 else {
1188 printk(KERN_WARNING "%s: Data-transfer parity" 1202 dev_warn(dev, "A data transfer parity error occurred"
1189 " error\n", ndev->name); 1203 " for %s\n",
1204 ndev->name);
1190 } 1205 }
1191 } 1206 }
1192 else if (sense & 0x10) { 1207 else if (sense & 0x10) {
1193 if (sense & 0x20) { 1208 if (sense & 0x20) {
1194 printk(KERN_WARNING "%s: Hardware malfunction " 1209 dev_warn(dev, "The remote channel adapter for %s"
1195 "(remote side)\n", ndev->name); 1210 " is faulty\n",
1211 ndev->name);
1196 } 1212 }
1197 else { 1213 else {
1198 printk(KERN_WARNING "%s: read-data parity error " 1214 dev_warn(dev, "A read data parity error occurred"
1199 "(remote side)\n", ndev->name); 1215 " for %s\n",
1216 ndev->name);
1200 } 1217 }
1201 } 1218 }
1202 1219
@@ -1375,7 +1392,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
1375 */ 1392 */
1376 1393
1377 if (p_first_ccw!=NULL) { 1394 if (p_first_ccw!=NULL) {
1378 /* setup ending ccw sequence for this segment */ 1395 /* setup ending ccw sequence for this segment */
1379 pEnd=privptr->p_end_ccw; 1396 pEnd=privptr->p_end_ccw;
1380 if (pEnd->write1) { 1397 if (pEnd->write1) {
1381 pEnd->write1=0x00; /* second end ccw is now active */ 1398 pEnd->write1=0x00; /* second end ccw is now active */
@@ -1697,10 +1714,11 @@ init_ccw_bk(struct net_device *dev)
1697 p_buf-> w_TIC_1.flags = 0; 1714 p_buf-> w_TIC_1.flags = 0;
1698 p_buf-> w_TIC_1.count = 0; 1715 p_buf-> w_TIC_1.count = 0;
1699 1716
1700 if (((unsigned long)p_buff+privptr->p_env->write_size) >= 1717 if (((unsigned long)p_buff +
1718 privptr->p_env->write_size) >=
1701 ((unsigned long)(p_buff+2* 1719 ((unsigned long)(p_buff+2*
1702 (privptr->p_env->write_size) -1) & PAGE_MASK)) { 1720 (privptr->p_env->write_size) - 1) & PAGE_MASK)) {
1703 p_buff= p_buff+privptr->p_env->write_size; 1721 p_buff = p_buff+privptr->p_env->write_size;
1704 } 1722 }
1705 } 1723 }
1706 } 1724 }
@@ -1840,15 +1858,16 @@ init_ccw_bk(struct net_device *dev)
1840 p_buf->header.opcode=0xff; 1858 p_buf->header.opcode=0xff;
1841 p_buf->header.flag=CLAW_PENDING; 1859 p_buf->header.flag=CLAW_PENDING;
1842 1860
1843 if (((unsigned long)p_buff+privptr->p_env->read_size) >= 1861 if (((unsigned long)p_buff+privptr->p_env->read_size) >=
1844 ((unsigned long)(p_buff+2*(privptr->p_env->read_size) -1) 1862 ((unsigned long)(p_buff+2*(privptr->p_env->read_size)
1845 & PAGE_MASK) ) { 1863 -1)
1864 & PAGE_MASK)) {
1846 p_buff= p_buff+privptr->p_env->read_size; 1865 p_buff= p_buff+privptr->p_env->read_size;
1847 } 1866 }
1848 else { 1867 else {
1849 p_buff= 1868 p_buff=
1850 (void *)((unsigned long) 1869 (void *)((unsigned long)
1851 (p_buff+2*(privptr->p_env->read_size) -1) 1870 (p_buff+2*(privptr->p_env->read_size)-1)
1852 & PAGE_MASK) ; 1871 & PAGE_MASK) ;
1853 } 1872 }
1854 } /* for read_buffers */ 1873 } /* for read_buffers */
@@ -1856,24 +1875,28 @@ init_ccw_bk(struct net_device *dev)
1856 else { /* read Size >= PAGE_SIZE */ 1875 else { /* read Size >= PAGE_SIZE */
1857 for (i=0 ; i< privptr->p_env->read_buffers ; i++) { 1876 for (i=0 ; i< privptr->p_env->read_buffers ; i++) {
1858 p_buff = (void *)__get_free_pages(__GFP_DMA, 1877 p_buff = (void *)__get_free_pages(__GFP_DMA,
1859 (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) ); 1878 (int)pages_to_order_of_mag(
1879 privptr->p_buff_pages_perread));
1860 if (p_buff==NULL) { 1880 if (p_buff==NULL) {
1861 free_pages((unsigned long)privptr->p_buff_ccw, 1881 free_pages((unsigned long)privptr->p_buff_ccw,
1862 (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); 1882 (int)pages_to_order_of_mag(privptr->
1883 p_buff_ccw_num));
1863 /* free the write pages */ 1884 /* free the write pages */
1864 p_buf=privptr->p_buff_write; 1885 p_buf=privptr->p_buff_write;
1865 while (p_buf!=NULL) { 1886 while (p_buf!=NULL) {
1866 free_pages((unsigned long)p_buf->p_buffer, 1887 free_pages(
1867 (int)pages_to_order_of_mag( 1888 (unsigned long)p_buf->p_buffer,
1868 privptr->p_buff_pages_perwrite )); 1889 (int)pages_to_order_of_mag(
1890 privptr->p_buff_pages_perwrite));
1869 p_buf=p_buf->next; 1891 p_buf=p_buf->next;
1870 } 1892 }
1871 /* free any read pages already alloc */ 1893 /* free any read pages already alloc */
1872 p_buf=privptr->p_buff_read; 1894 p_buf=privptr->p_buff_read;
1873 while (p_buf!=NULL) { 1895 while (p_buf!=NULL) {
1874 free_pages((unsigned long)p_buf->p_buffer, 1896 free_pages(
1875 (int)pages_to_order_of_mag( 1897 (unsigned long)p_buf->p_buffer,
1876 privptr->p_buff_pages_perread )); 1898 (int)pages_to_order_of_mag(
1899 privptr->p_buff_pages_perread));
1877 p_buf=p_buf->next; 1900 p_buf=p_buf->next;
1878 } 1901 }
1879 privptr->p_buff_ccw=NULL; 1902 privptr->p_buff_ccw=NULL;
@@ -2003,7 +2026,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2003 tdev = &privptr->channel[READ].cdev->dev; 2026 tdev = &privptr->channel[READ].cdev->dev;
2004 memcpy( &temp_host_name, p_env->host_name, 8); 2027 memcpy( &temp_host_name, p_env->host_name, 8);
2005 memcpy( &temp_ws_name, p_env->adapter_name , 8); 2028 memcpy( &temp_ws_name, p_env->adapter_name , 8);
2006 printk(KERN_INFO "%s: CLAW device %.8s: " 2029 dev_info(tdev, "%s: CLAW device %.8s: "
2007 "Received Control Packet\n", 2030 "Received Control Packet\n",
2008 dev->name, temp_ws_name); 2031 dev->name, temp_ws_name);
2009 if (privptr->release_pend==1) { 2032 if (privptr->release_pend==1) {
@@ -2022,32 +2045,30 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2022 if (p_ctlbk->version != CLAW_VERSION_ID) { 2045 if (p_ctlbk->version != CLAW_VERSION_ID) {
2023 claw_snd_sys_validate_rsp(dev, p_ctlbk, 2046 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2024 CLAW_RC_WRONG_VERSION); 2047 CLAW_RC_WRONG_VERSION);
2025 printk("%s: %d is wrong version id. " 2048 dev_warn(tdev, "The communication peer of %s"
2026 "Expected %d\n", 2049 " uses an incorrect API version %d\n",
2027 dev->name, p_ctlbk->version, 2050 dev->name, p_ctlbk->version);
2028 CLAW_VERSION_ID);
2029 } 2051 }
2030 p_sysval = (struct sysval *)&(p_ctlbk->data); 2052 p_sysval = (struct sysval *)&(p_ctlbk->data);
2031 printk("%s: Recv Sys Validate Request: " 2053 dev_info(tdev, "%s: Recv Sys Validate Request: "
2032 "Vers=%d,link_id=%d,Corr=%d,WS name=%." 2054 "Vers=%d,link_id=%d,Corr=%d,WS name=%.8s,"
2033 "8s,Host name=%.8s\n", 2055 "Host name=%.8s\n",
2034 dev->name, p_ctlbk->version, 2056 dev->name, p_ctlbk->version,
2035 p_ctlbk->linkid, 2057 p_ctlbk->linkid,
2036 p_ctlbk->correlator, 2058 p_ctlbk->correlator,
2037 p_sysval->WS_name, 2059 p_sysval->WS_name,
2038 p_sysval->host_name); 2060 p_sysval->host_name);
2039 if (memcmp(temp_host_name, p_sysval->host_name, 8)) { 2061 if (memcmp(temp_host_name, p_sysval->host_name, 8)) {
2040 claw_snd_sys_validate_rsp(dev, p_ctlbk, 2062 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2041 CLAW_RC_NAME_MISMATCH); 2063 CLAW_RC_NAME_MISMATCH);
2042 CLAW_DBF_TEXT(2, setup, "HSTBAD"); 2064 CLAW_DBF_TEXT(2, setup, "HSTBAD");
2043 CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name); 2065 CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name);
2044 CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name); 2066 CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name);
2045 printk(KERN_INFO "%s: Host name mismatch\n", 2067 dev_warn(tdev,
2046 dev->name); 2068 "Host name %s for %s does not match the"
2047 printk(KERN_INFO "%s: Received :%s: " 2069 " remote adapter name %s\n",
2048 "expected :%s: \n",
2049 dev->name,
2050 p_sysval->host_name, 2070 p_sysval->host_name,
2071 dev->name,
2051 temp_host_name); 2072 temp_host_name);
2052 } 2073 }
2053 if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) { 2074 if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) {
@@ -2056,35 +2077,38 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2056 CLAW_DBF_TEXT(2, setup, "WSNBAD"); 2077 CLAW_DBF_TEXT(2, setup, "WSNBAD");
2057 CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name); 2078 CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name);
2058 CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name); 2079 CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name);
2059 printk(KERN_INFO "%s: WS name mismatch\n", 2080 dev_warn(tdev, "Adapter name %s for %s does not match"
2060 dev->name); 2081 " the remote host name %s\n",
2061 printk(KERN_INFO "%s: Received :%s: " 2082 p_sysval->WS_name,
2062 "expected :%s: \n", 2083 dev->name,
2063 dev->name, 2084 temp_ws_name);
2064 p_sysval->WS_name,
2065 temp_ws_name);
2066 } 2085 }
2067 if ((p_sysval->write_frame_size < p_env->write_size) && 2086 if ((p_sysval->write_frame_size < p_env->write_size) &&
2068 (p_env->packing == 0)) { 2087 (p_env->packing == 0)) {
2069 claw_snd_sys_validate_rsp(dev, p_ctlbk, 2088 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2070 CLAW_RC_HOST_RCV_TOO_SMALL); 2089 CLAW_RC_HOST_RCV_TOO_SMALL);
2071 printk(KERN_INFO "%s: host write size is too " 2090 dev_warn(tdev,
2072 "small\n", dev->name); 2091 "The local write buffer is smaller than the"
2092 " remote read buffer\n");
2073 CLAW_DBF_TEXT(2, setup, "wrtszbad"); 2093 CLAW_DBF_TEXT(2, setup, "wrtszbad");
2074 } 2094 }
2075 if ((p_sysval->read_frame_size < p_env->read_size) && 2095 if ((p_sysval->read_frame_size < p_env->read_size) &&
2076 (p_env->packing == 0)) { 2096 (p_env->packing == 0)) {
2077 claw_snd_sys_validate_rsp(dev, p_ctlbk, 2097 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2078 CLAW_RC_HOST_RCV_TOO_SMALL); 2098 CLAW_RC_HOST_RCV_TOO_SMALL);
2079 printk(KERN_INFO "%s: host read size is too " 2099 dev_warn(tdev,
2080 "small\n", dev->name); 2100 "The local read buffer is smaller than the"
2101 " remote write buffer\n");
2081 CLAW_DBF_TEXT(2, setup, "rdsizbad"); 2102 CLAW_DBF_TEXT(2, setup, "rdsizbad");
2082 } 2103 }
2083 claw_snd_sys_validate_rsp(dev, p_ctlbk, 0); 2104 claw_snd_sys_validate_rsp(dev, p_ctlbk, 0);
2084 printk(KERN_INFO "%s: CLAW device %.8s: System validate " 2105 dev_info(tdev,
2085 "completed.\n", dev->name, temp_ws_name); 2106 "CLAW device %.8s: System validate"
2086 printk("%s: sys Validate Rsize:%d Wsize:%d\n", dev->name, 2107 " completed.\n", temp_ws_name);
2087 p_sysval->read_frame_size, p_sysval->write_frame_size); 2108 dev_info(tdev,
2109 "%s: sys Validate Rsize:%d Wsize:%d\n",
2110 dev->name, p_sysval->read_frame_size,
2111 p_sysval->write_frame_size);
2088 privptr->system_validate_comp = 1; 2112 privptr->system_validate_comp = 1;
2089 if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0) 2113 if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0)
2090 p_env->packing = PACKING_ASK; 2114 p_env->packing = PACKING_ASK;
@@ -2092,8 +2116,10 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2092 break; 2116 break;
2093 case SYSTEM_VALIDATE_RESPONSE: 2117 case SYSTEM_VALIDATE_RESPONSE:
2094 p_sysval = (struct sysval *)&(p_ctlbk->data); 2118 p_sysval = (struct sysval *)&(p_ctlbk->data);
2095 printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d," 2119 dev_info(tdev,
2096 "WS name=%.8s,Host name=%.8s\n", 2120 "Settings for %s validated (version=%d, "
2121 "remote device=%d, rc=%d, adapter name=%.8s, "
2122 "host name=%.8s)\n",
2097 dev->name, 2123 dev->name,
2098 p_ctlbk->version, 2124 p_ctlbk->version,
2099 p_ctlbk->correlator, 2125 p_ctlbk->correlator,
@@ -2102,41 +2128,39 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2102 p_sysval->host_name); 2128 p_sysval->host_name);
2103 switch (p_ctlbk->rc) { 2129 switch (p_ctlbk->rc) {
2104 case 0: 2130 case 0:
2105 printk(KERN_INFO "%s: CLAW device " 2131 dev_info(tdev, "%s: CLAW device "
2106 "%.8s: System validate " 2132 "%.8s: System validate completed.\n",
2107 "completed.\n", 2133 dev->name, temp_ws_name);
2108 dev->name, temp_ws_name);
2109 if (privptr->system_validate_comp == 0) 2134 if (privptr->system_validate_comp == 0)
2110 claw_strt_conn_req(dev); 2135 claw_strt_conn_req(dev);
2111 privptr->system_validate_comp = 1; 2136 privptr->system_validate_comp = 1;
2112 break; 2137 break;
2113 case CLAW_RC_NAME_MISMATCH: 2138 case CLAW_RC_NAME_MISMATCH:
2114 printk(KERN_INFO "%s: Sys Validate " 2139 dev_warn(tdev, "Validating %s failed because of"
2115 "Resp : Host, WS name is " 2140 " a host or adapter name mismatch\n",
2116 "mismatch\n", 2141 dev->name);
2117 dev->name);
2118 break; 2142 break;
2119 case CLAW_RC_WRONG_VERSION: 2143 case CLAW_RC_WRONG_VERSION:
2120 printk(KERN_INFO "%s: Sys Validate " 2144 dev_warn(tdev, "Validating %s failed because of a"
2121 "Resp : Wrong version\n", 2145 " version conflict\n",
2122 dev->name); 2146 dev->name);
2123 break; 2147 break;
2124 case CLAW_RC_HOST_RCV_TOO_SMALL: 2148 case CLAW_RC_HOST_RCV_TOO_SMALL:
2125 printk(KERN_INFO "%s: Sys Validate " 2149 dev_warn(tdev, "Validating %s failed because of a"
2126 "Resp : bad frame size\n", 2150 " frame size conflict\n",
2127 dev->name); 2151 dev->name);
2128 break; 2152 break;
2129 default: 2153 default:
2130 printk(KERN_INFO "%s: Sys Validate " 2154 dev_warn(tdev, "The communication peer of %s rejected"
2131 "error code=%d \n", 2155 " the connection\n",
2132 dev->name, p_ctlbk->rc); 2156 dev->name);
2133 break; 2157 break;
2134 } 2158 }
2135 break; 2159 break;
2136 2160
2137 case CONNECTION_REQUEST: 2161 case CONNECTION_REQUEST:
2138 p_connect = (struct conncmd *)&(p_ctlbk->data); 2162 p_connect = (struct conncmd *)&(p_ctlbk->data);
2139 printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d," 2163 dev_info(tdev, "%s: Recv Conn Req: Vers=%d,link_id=%d,"
2140 "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n", 2164 "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n",
2141 dev->name, 2165 dev->name,
2142 p_ctlbk->version, 2166 p_ctlbk->version,
@@ -2146,21 +2170,21 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2146 p_connect->WS_name); 2170 p_connect->WS_name);
2147 if (privptr->active_link_ID != 0) { 2171 if (privptr->active_link_ID != 0) {
2148 claw_snd_disc(dev, p_ctlbk); 2172 claw_snd_disc(dev, p_ctlbk);
2149 printk(KERN_INFO "%s: Conn Req error : " 2173 dev_info(tdev, "%s rejected a connection request"
2150 "already logical link is active \n", 2174 " because it is already active\n",
2151 dev->name); 2175 dev->name);
2152 } 2176 }
2153 if (p_ctlbk->linkid != 1) { 2177 if (p_ctlbk->linkid != 1) {
2154 claw_snd_disc(dev, p_ctlbk); 2178 claw_snd_disc(dev, p_ctlbk);
2155 printk(KERN_INFO "%s: Conn Req error : " 2179 dev_info(tdev, "%s rejected a request to open multiple"
2156 "req logical link id is not 1\n", 2180 " connections\n",
2157 dev->name); 2181 dev->name);
2158 } 2182 }
2159 rc = find_link(dev, p_connect->host_name, p_connect->WS_name); 2183 rc = find_link(dev, p_connect->host_name, p_connect->WS_name);
2160 if (rc != 0) { 2184 if (rc != 0) {
2161 claw_snd_disc(dev, p_ctlbk); 2185 claw_snd_disc(dev, p_ctlbk);
2162 printk(KERN_INFO "%s: Conn Resp error: " 2186 dev_info(tdev, "%s rejected a connection request"
2163 "req appl name does not match\n", 2187 " because of a type mismatch\n",
2164 dev->name); 2188 dev->name);
2165 } 2189 }
2166 claw_send_control(dev, 2190 claw_send_control(dev,
@@ -2172,7 +2196,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2172 p_env->packing = PACK_SEND; 2196 p_env->packing = PACK_SEND;
2173 claw_snd_conn_req(dev, 0); 2197 claw_snd_conn_req(dev, 0);
2174 } 2198 }
2175 printk(KERN_INFO "%s: CLAW device %.8s: Connection " 2199 dev_info(tdev, "%s: CLAW device %.8s: Connection "
2176 "completed link_id=%d.\n", 2200 "completed link_id=%d.\n",
2177 dev->name, temp_ws_name, 2201 dev->name, temp_ws_name,
2178 p_ctlbk->linkid); 2202 p_ctlbk->linkid);
@@ -2182,7 +2206,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2182 break; 2206 break;
2183 case CONNECTION_RESPONSE: 2207 case CONNECTION_RESPONSE:
2184 p_connect = (struct conncmd *)&(p_ctlbk->data); 2208 p_connect = (struct conncmd *)&(p_ctlbk->data);
2185 printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d," 2209 dev_info(tdev, "%s: Recv Conn Resp: Vers=%d,link_id=%d,"
2186 "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n", 2210 "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n",
2187 dev->name, 2211 dev->name,
2188 p_ctlbk->version, 2212 p_ctlbk->version,
@@ -2193,16 +2217,18 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2193 p_connect->WS_name); 2217 p_connect->WS_name);
2194 2218
2195 if (p_ctlbk->rc != 0) { 2219 if (p_ctlbk->rc != 0) {
2196 printk(KERN_INFO "%s: Conn Resp error: rc=%d \n", 2220 dev_warn(tdev, "The communication peer of %s rejected"
2197 dev->name, p_ctlbk->rc); 2221 " a connection request\n",
2222 dev->name);
2198 return 1; 2223 return 1;
2199 } 2224 }
2200 rc = find_link(dev, 2225 rc = find_link(dev,
2201 p_connect->host_name, p_connect->WS_name); 2226 p_connect->host_name, p_connect->WS_name);
2202 if (rc != 0) { 2227 if (rc != 0) {
2203 claw_snd_disc(dev, p_ctlbk); 2228 claw_snd_disc(dev, p_ctlbk);
2204 printk(KERN_INFO "%s: Conn Resp error: " 2229 dev_warn(tdev, "The communication peer of %s"
2205 "req appl name does not match\n", 2230 " rejected a connection "
2231 "request because of a type mismatch\n",
2206 dev->name); 2232 dev->name);
2207 } 2233 }
2208 /* should be until CONNECTION_CONFIRM */ 2234 /* should be until CONNECTION_CONFIRM */
@@ -2210,7 +2236,8 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2210 break; 2236 break;
2211 case CONNECTION_CONFIRM: 2237 case CONNECTION_CONFIRM:
2212 p_connect = (struct conncmd *)&(p_ctlbk->data); 2238 p_connect = (struct conncmd *)&(p_ctlbk->data);
2213 printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d," 2239 dev_info(tdev,
2240 "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
2214 "Corr=%d,Host appl=%.8s,WS appl=%.8s\n", 2241 "Corr=%d,Host appl=%.8s,WS appl=%.8s\n",
2215 dev->name, 2242 dev->name,
2216 p_ctlbk->version, 2243 p_ctlbk->version,
@@ -2221,21 +2248,21 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2221 if (p_ctlbk->linkid == -(privptr->active_link_ID)) { 2248 if (p_ctlbk->linkid == -(privptr->active_link_ID)) {
2222 privptr->active_link_ID = p_ctlbk->linkid; 2249 privptr->active_link_ID = p_ctlbk->linkid;
2223 if (p_env->packing > PACKING_ASK) { 2250 if (p_env->packing > PACKING_ASK) {
2224 printk(KERN_INFO "%s: Confirmed Now packing\n", 2251 dev_info(tdev,
2225 dev->name); 2252 "%s: Confirmed Now packing\n", dev->name);
2226 p_env->packing = DO_PACKED; 2253 p_env->packing = DO_PACKED;
2227 } 2254 }
2228 p_ch = &privptr->channel[WRITE]; 2255 p_ch = &privptr->channel[WRITE];
2229 wake_up(&p_ch->wait); 2256 wake_up(&p_ch->wait);
2230 } else { 2257 } else {
2231 printk(KERN_INFO "%s: Conn confirm: " 2258 dev_warn(tdev, "Activating %s failed because of"
2232 "unexpected linkid=%d \n", 2259 " an incorrect link ID=%d\n",
2233 dev->name, p_ctlbk->linkid); 2260 dev->name, p_ctlbk->linkid);
2234 claw_snd_disc(dev, p_ctlbk); 2261 claw_snd_disc(dev, p_ctlbk);
2235 } 2262 }
2236 break; 2263 break;
2237 case DISCONNECT: 2264 case DISCONNECT:
2238 printk(KERN_INFO "%s: Disconnect: " 2265 dev_info(tdev, "%s: Disconnect: "
2239 "Vers=%d,link_id=%d,Corr=%d\n", 2266 "Vers=%d,link_id=%d,Corr=%d\n",
2240 dev->name, p_ctlbk->version, 2267 dev->name, p_ctlbk->version,
2241 p_ctlbk->linkid, p_ctlbk->correlator); 2268 p_ctlbk->linkid, p_ctlbk->correlator);
@@ -2247,12 +2274,13 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
2247 privptr->active_link_ID = 0; 2274 privptr->active_link_ID = 0;
2248 break; 2275 break;
2249 case CLAW_ERROR: 2276 case CLAW_ERROR:
2250 printk(KERN_INFO "%s: CLAW ERROR detected\n", 2277 dev_warn(tdev, "The communication peer of %s failed\n",
2251 dev->name); 2278 dev->name);
2252 break; 2279 break;
2253 default: 2280 default:
2254 printk(KERN_INFO "%s: Unexpected command code=%d \n", 2281 dev_warn(tdev, "The communication peer of %s sent"
2255 dev->name, p_ctlbk->command); 2282 " an unknown command code\n",
2283 dev->name);
2256 break; 2284 break;
2257 } 2285 }
2258 2286
@@ -2294,12 +2322,14 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link,
2294 memcpy(&p_sysval->host_name, local_name, 8); 2322 memcpy(&p_sysval->host_name, local_name, 8);
2295 memcpy(&p_sysval->WS_name, remote_name, 8); 2323 memcpy(&p_sysval->WS_name, remote_name, 8);
2296 if (privptr->p_env->packing > 0) { 2324 if (privptr->p_env->packing > 0) {
2297 p_sysval->read_frame_size=DEF_PACK_BUFSIZE; 2325 p_sysval->read_frame_size = DEF_PACK_BUFSIZE;
2298 p_sysval->write_frame_size=DEF_PACK_BUFSIZE; 2326 p_sysval->write_frame_size = DEF_PACK_BUFSIZE;
2299 } else { 2327 } else {
2300 /* how big is the biggest group of packets */ 2328 /* how big is the biggest group of packets */
2301 p_sysval->read_frame_size=privptr->p_env->read_size; 2329 p_sysval->read_frame_size =
2302 p_sysval->write_frame_size=privptr->p_env->write_size; 2330 privptr->p_env->read_size;
2331 p_sysval->write_frame_size =
2332 privptr->p_env->write_size;
2303 } 2333 }
2304 memset(&p_sysval->reserved, 0x00, 4); 2334 memset(&p_sysval->reserved, 0x00, 4);
2305 break; 2335 break;
@@ -2511,8 +2541,10 @@ unpack_read(struct net_device *dev )
2511 mtc_this_frm=1; 2541 mtc_this_frm=1;
2512 if (p_this_ccw->header.length!= 2542 if (p_this_ccw->header.length!=
2513 privptr->p_env->read_size ) { 2543 privptr->p_env->read_size ) {
2514 printk(KERN_INFO " %s: Invalid frame detected " 2544 dev_warn(p_dev,
2515 "length is %02x\n" , 2545 "The communication peer of %s"
2546 " sent a faulty"
2547 " frame of length %02x\n",
2516 dev->name, p_this_ccw->header.length); 2548 dev->name, p_this_ccw->header.length);
2517 } 2549 }
2518 } 2550 }
@@ -2544,7 +2576,7 @@ unpack_next:
2544 goto NextFrame; 2576 goto NextFrame;
2545 p_packd = p_this_ccw->p_buffer+pack_off; 2577 p_packd = p_this_ccw->p_buffer+pack_off;
2546 p_packh = (struct clawph *) p_packd; 2578 p_packh = (struct clawph *) p_packd;
2547 if ((p_packh->len == 0) || /* all done with this frame? */ 2579 if ((p_packh->len == 0) || /* done with this frame? */
2548 (p_packh->flag != 0)) 2580 (p_packh->flag != 0))
2549 goto NextFrame; 2581 goto NextFrame;
2550 bytes_to_mov = p_packh->len; 2582 bytes_to_mov = p_packh->len;
@@ -2594,9 +2626,9 @@ unpack_next:
2594 netif_rx(skb); 2626 netif_rx(skb);
2595 } 2627 }
2596 else { 2628 else {
2629 dev_info(p_dev, "Allocating a buffer for"
2630 " incoming data failed\n");
2597 privptr->stats.rx_dropped++; 2631 privptr->stats.rx_dropped++;
2598 printk(KERN_WARNING "%s: %s() low on memory\n",
2599 dev->name,__func__);
2600 } 2632 }
2601 privptr->mtc_offset=0; 2633 privptr->mtc_offset=0;
2602 privptr->mtc_logical_link=-1; 2634 privptr->mtc_logical_link=-1;
@@ -2720,8 +2752,8 @@ claw_strt_out_IO( struct net_device *dev )
2720 if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { 2752 if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) {
2721 parm = (unsigned long) p_ch; 2753 parm = (unsigned long) p_ch;
2722 CLAW_DBF_TEXT(2, trace, "StWrtIO"); 2754 CLAW_DBF_TEXT(2, trace, "StWrtIO");
2723 rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm, 2755 rc = ccw_device_start(p_ch->cdev, &p_first_ccw->write, parm,
2724 0xff, 0); 2756 0xff, 0);
2725 if (rc != 0) { 2757 if (rc != 0) {
2726 ccw_check_return_code(p_ch->cdev, rc); 2758 ccw_check_return_code(p_ch->cdev, rc);
2727 } 2759 }
@@ -2884,8 +2916,8 @@ claw_new_device(struct ccwgroup_device *cgdev)
2884 int ret; 2916 int ret;
2885 struct ccw_dev_id dev_id; 2917 struct ccw_dev_id dev_id;
2886 2918
2887 printk(KERN_INFO "claw: add for %s\n", 2919 dev_info(&cgdev->dev, "add for %s\n",
2888 dev_name(&cgdev->cdev[READ]->dev)); 2920 dev_name(&cgdev->cdev[READ]->dev));
2889 CLAW_DBF_TEXT(2, setup, "new_dev"); 2921 CLAW_DBF_TEXT(2, setup, "new_dev");
2890 privptr = cgdev->dev.driver_data; 2922 privptr = cgdev->dev.driver_data;
2891 cgdev->cdev[READ]->dev.driver_data = privptr; 2923 cgdev->cdev[READ]->dev.driver_data = privptr;
@@ -2901,29 +2933,28 @@ claw_new_device(struct ccwgroup_device *cgdev)
2901 if (ret == 0) 2933 if (ret == 0)
2902 ret = add_channel(cgdev->cdev[1],1,privptr); 2934 ret = add_channel(cgdev->cdev[1],1,privptr);
2903 if (ret != 0) { 2935 if (ret != 0) {
2904 printk(KERN_WARNING 2936 dev_warn(&cgdev->dev, "Creating a CLAW group device"
2905 "add channel failed with ret = %d\n", ret); 2937 " failed with error code %d\n", ret);
2906 goto out; 2938 goto out;
2907 } 2939 }
2908 ret = ccw_device_set_online(cgdev->cdev[READ]); 2940 ret = ccw_device_set_online(cgdev->cdev[READ]);
2909 if (ret != 0) { 2941 if (ret != 0) {
2910 printk(KERN_WARNING 2942 dev_warn(&cgdev->dev,
2911 "claw: ccw_device_set_online %s READ failed " 2943 "Setting the read subchannel online"
2912 "with ret = %d\n", dev_name(&cgdev->cdev[READ]->dev), 2944 " failed with error code %d\n", ret);
2913 ret);
2914 goto out; 2945 goto out;
2915 } 2946 }
2916 ret = ccw_device_set_online(cgdev->cdev[WRITE]); 2947 ret = ccw_device_set_online(cgdev->cdev[WRITE]);
2917 if (ret != 0) { 2948 if (ret != 0) {
2918 printk(KERN_WARNING 2949 dev_warn(&cgdev->dev,
2919 "claw: ccw_device_set_online %s WRITE failed " 2950 "Setting the write subchannel online "
2920 "with ret = %d\n", dev_name(&cgdev->cdev[WRITE]->dev), 2951 "failed with error code %d\n", ret);
2921 ret);
2922 goto out; 2952 goto out;
2923 } 2953 }
2924 dev = alloc_netdev(0,"claw%d",claw_init_netdevice); 2954 dev = alloc_netdev(0,"claw%d",claw_init_netdevice);
2925 if (!dev) { 2955 if (!dev) {
2926 printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__); 2956 dev_warn(&cgdev->dev,
2957 "Activating the CLAW device failed\n");
2927 goto out; 2958 goto out;
2928 } 2959 }
2929 dev->ml_priv = privptr; 2960 dev->ml_priv = privptr;
@@ -2951,13 +2982,13 @@ claw_new_device(struct ccwgroup_device *cgdev)
2951 privptr->channel[WRITE].ndev = dev; 2982 privptr->channel[WRITE].ndev = dev;
2952 privptr->p_env->ndev = dev; 2983 privptr->p_env->ndev = dev;
2953 2984
2954 printk(KERN_INFO "%s:readsize=%d writesize=%d " 2985 dev_info(&cgdev->dev, "%s:readsize=%d writesize=%d "
2955 "readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n", 2986 "readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n",
2956 dev->name, p_env->read_size, 2987 dev->name, p_env->read_size,
2957 p_env->write_size, p_env->read_buffers, 2988 p_env->write_size, p_env->read_buffers,
2958 p_env->write_buffers, p_env->devno[READ], 2989 p_env->write_buffers, p_env->devno[READ],
2959 p_env->devno[WRITE]); 2990 p_env->devno[WRITE]);
2960 printk(KERN_INFO "%s:host_name:%.8s, adapter_name " 2991 dev_info(&cgdev->dev, "%s:host_name:%.8s, adapter_name "
2961 ":%.8s api_type: %.8s\n", 2992 ":%.8s api_type: %.8s\n",
2962 dev->name, p_env->host_name, 2993 dev->name, p_env->host_name,
2963 p_env->adapter_name , p_env->api_type); 2994 p_env->adapter_name , p_env->api_type);
@@ -3001,8 +3032,8 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
3001 ndev = priv->channel[READ].ndev; 3032 ndev = priv->channel[READ].ndev;
3002 if (ndev) { 3033 if (ndev) {
3003 /* Close the device */ 3034 /* Close the device */
3004 printk(KERN_INFO 3035 dev_info(&cgdev->dev, "%s: shutting down \n",
3005 "%s: shuting down \n",ndev->name); 3036 ndev->name);
3006 if (ndev->flags & IFF_RUNNING) 3037 if (ndev->flags & IFF_RUNNING)
3007 ret = claw_release(ndev); 3038 ret = claw_release(ndev);
3008 ndev->flags &=~IFF_RUNNING; 3039 ndev->flags &=~IFF_RUNNING;
@@ -3027,8 +3058,7 @@ claw_remove_device(struct ccwgroup_device *cgdev)
3027 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); 3058 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
3028 priv = cgdev->dev.driver_data; 3059 priv = cgdev->dev.driver_data;
3029 BUG_ON(!priv); 3060 BUG_ON(!priv);
3030 printk(KERN_INFO "claw: %s() called %s will be removed.\n", 3061 dev_info(&cgdev->dev, " will be removed.\n");
3031 __func__, dev_name(&cgdev->cdev[0]->dev));
3032 if (cgdev->state == CCWGROUP_ONLINE) 3062 if (cgdev->state == CCWGROUP_ONLINE)
3033 claw_shutdown_device(cgdev); 3063 claw_shutdown_device(cgdev);
3034 claw_remove_files(&cgdev->dev); 3064 claw_remove_files(&cgdev->dev);
@@ -3067,7 +3097,8 @@ claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf)
3067} 3097}
3068 3098
3069static ssize_t 3099static ssize_t
3070claw_hname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 3100claw_hname_write(struct device *dev, struct device_attribute *attr,
3101 const char *buf, size_t count)
3071{ 3102{
3072 struct claw_privbk *priv; 3103 struct claw_privbk *priv;
3073 struct claw_env * p_env; 3104 struct claw_env * p_env;
@@ -3104,7 +3135,8 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf)
3104} 3135}
3105 3136
3106static ssize_t 3137static ssize_t
3107claw_adname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 3138claw_adname_write(struct device *dev, struct device_attribute *attr,
3139 const char *buf, size_t count)
3108{ 3140{
3109 struct claw_privbk *priv; 3141 struct claw_privbk *priv;
3110 struct claw_env * p_env; 3142 struct claw_env * p_env;
@@ -3142,7 +3174,8 @@ claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf)
3142} 3174}
3143 3175
3144static ssize_t 3176static ssize_t
3145claw_apname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 3177claw_apname_write(struct device *dev, struct device_attribute *attr,
3178 const char *buf, size_t count)
3146{ 3179{
3147 struct claw_privbk *priv; 3180 struct claw_privbk *priv;
3148 struct claw_env * p_env; 3181 struct claw_env * p_env;
@@ -3189,7 +3222,8 @@ claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
3189} 3222}
3190 3223
3191static ssize_t 3224static ssize_t
3192claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 3225claw_wbuff_write(struct device *dev, struct device_attribute *attr,
3226 const char *buf, size_t count)
3193{ 3227{
3194 struct claw_privbk *priv; 3228 struct claw_privbk *priv;
3195 struct claw_env * p_env; 3229 struct claw_env * p_env;
@@ -3230,7 +3264,8 @@ claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
3230} 3264}
3231 3265
3232static ssize_t 3266static ssize_t
3233claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 3267claw_rbuff_write(struct device *dev, struct device_attribute *attr,
3268 const char *buf, size_t count)
3234{ 3269{
3235 struct claw_privbk *priv; 3270 struct claw_privbk *priv;
3236 struct claw_env *p_env; 3271 struct claw_env *p_env;
@@ -3293,7 +3328,7 @@ claw_cleanup(void)
3293{ 3328{
3294 unregister_cu3088_discipline(&claw_group_driver); 3329 unregister_cu3088_discipline(&claw_group_driver);
3295 claw_unregister_debug_facility(); 3330 claw_unregister_debug_facility();
3296 printk(KERN_INFO "claw: Driver unloaded\n"); 3331 pr_info("Driver unloaded\n");
3297 3332
3298} 3333}
3299 3334
@@ -3307,12 +3342,12 @@ static int __init
3307claw_init(void) 3342claw_init(void)
3308{ 3343{
3309 int ret = 0; 3344 int ret = 0;
3310 printk(KERN_INFO "claw: starting driver\n");
3311 3345
3346 pr_info("Loading %s\n", version);
3312 ret = claw_register_debug_facility(); 3347 ret = claw_register_debug_facility();
3313 if (ret) { 3348 if (ret) {
3314 printk(KERN_WARNING "claw: %s() debug_register failed %d\n", 3349 pr_err("Registering with the S/390 debug feature"
3315 __func__,ret); 3350 " failed with error code %d\n", ret);
3316 return ret; 3351 return ret;
3317 } 3352 }
3318 CLAW_DBF_TEXT(2, setup, "init_mod"); 3353 CLAW_DBF_TEXT(2, setup, "init_mod");
@@ -3320,8 +3355,8 @@ claw_init(void)
3320 if (ret) { 3355 if (ret) {
3321 CLAW_DBF_TEXT(2, setup, "init_bad"); 3356 CLAW_DBF_TEXT(2, setup, "init_bad");
3322 claw_unregister_debug_facility(); 3357 claw_unregister_debug_facility();
3323 printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n", 3358 pr_err("Registering with the cu3088 device driver failed "
3324 __func__,ret); 3359 "with error code %d\n", ret);
3325 } 3360 }
3326 return ret; 3361 return ret;
3327} 3362}