63 #define KMSG_COMPONENT "claw"
67 #include <asm/debug.h>
70 #include <linux/bitops.h>
71 #include <linux/ctype.h>
73 #include <linux/errno.h>
74 #include <linux/if_arp.h>
78 #include <linux/kernel.h>
79 #include <linux/module.h>
80 #include <linux/netdevice.h>
83 #include <linux/sched.h>
84 #include <linux/signal.h>
86 #include <linux/slab.h>
87 #include <linux/string.h>
88 #include <linux/tcp.h>
90 #include <linux/types.h>
110 claw_unregister_debug_facility(
void)
119 claw_register_debug_facility(
void)
123 if (claw_dbf_setup ==
NULL || claw_dbf_trace ==
NULL) {
124 claw_unregister_debug_facility();
144 netif_wake_queue(dev);
156 netif_stop_queue(dev);
161 claw_clearbit_busy(
int nr,
struct net_device *dev)
164 netif_wake_queue(dev);
168 claw_test_and_setbit_busy(
int nr,
struct net_device *dev)
170 netif_stop_queue(dev);
184 static int claw_change_mtu(
struct net_device *dev,
int new_mtu);
188 static void claw_irq_tasklet (
unsigned long data );
189 static int claw_release(
struct net_device *dev);
190 static void claw_write_retry (
struct chbk * p_ch );
191 static void claw_write_next (
struct chbk * p_ch );
192 static void claw_timer (
struct chbk * p_ch );
195 static int add_claw_reads(
struct net_device *dev,
198 static void ccw_check_unit_check (
struct chbk * p_ch,
unsigned char sense );
201 static int init_ccw_bk(
struct net_device *dev);
204 static int pages_to_order_of_mag(
int num_of_pages);
234 static int claw_process_control(
struct net_device *dev,
struct ccwbk * p_ccw);
236 __u8 correlator,
__u8 rc ,
char *local_name,
char *remote_name);
239 static int claw_snd_sys_validate_rsp(
struct net_device *dev,
241 static int claw_strt_conn_req(
struct net_device *dev );
242 static void claw_strt_read(
struct net_device *dev,
int lock);
243 static void claw_strt_out_IO(
struct net_device *dev);
244 static void claw_free_wrt_buf(
struct net_device *dev);
247 static void unpack_read(
struct net_device *dev);
255 static struct device *claw_root_dev;
265 .remove = claw_remove_device,
266 .set_online = claw_new_device,
267 .set_offline = claw_shutdown_device,
268 .prepare = claw_pm_prepare,
293 return err ? err :
count;
297 static struct attribute *claw_drv_attrs[] = {
298 &driver_attr_group.attr,
302 .attrs = claw_drv_attrs,
305 &claw_drv_attr_group,
322 unsigned long saveflags;
328 rc=claw_hw_tx( skb, dev, 1 );
346 struct sk_buff *new_skb,*held_skb;
365 if (new_skb ==
NULL) {
373 new_skb->cb[1] =
'P';
374 while ((pk_ind) && (held_skb !=
NULL)) {
378 privptr->
stats.tx_packets++;
379 so_far += held_skb->
len;
402 claw_change_mtu(
struct net_device *dev,
int new_mtu)
407 buff_size = privptr->
p_env->write_size;
408 if ((new_mtu < 60) || (new_mtu > buff_size)) {
426 unsigned long saveflags=0;
450 privptr->
p_env->packing=0;
457 for ( i = 0; i < 2; i++) {
468 timer.function = (
void *)claw_timer;
473 privptr->
channel[i].cdev), saveflags);
481 spin_unlock_irqrestore(
487 ccw_check_return_code(privptr->
channel[i].cdev, rc);
497 "%s: remote side is not ready\n", dev->
name);
500 for ( i = 0; i < 2; i++) {
509 spin_unlock_irqrestore(
513 ccw_check_return_code(
521 (
int)pages_to_order_of_mag(
526 while (p_buf!=
NULL) {
528 (
int)pages_to_order_of_mag(
535 (
int)pages_to_order_of_mag(
540 while (p_buf!=
NULL) {
542 (
int)pages_to_order_of_mag(
553 claw_clear_busy(dev);
560 claw_clear_busy(dev);
584 dev_warn(&cdev->
dev,
"An uninitialized CLAW device received an"
585 " IRQ, c-%02x d-%02x\n",
597 dev_warn(&cdev->
dev,
"The device is not a CLAW device\n");
604 p_env=privptr->
p_env;
607 memcpy(p_ch->
irb, irb,
sizeof(
struct irb));
612 "%s: subchannel check for device: %04x -"
613 " Sch Stat %02x Dev Stat %02x CPA - %04x\n",
623 ccw_check_unit_check(p_ch, irb->
ecw[0]);
632 (p_ch->
irb->scsw.cmd.stctl ==
641 (p_ch->
irb->scsw.cmd.stctl ==
653 claw_send_control(dev,
660 " an unexpected IRQ, "
672 if ((p_ch->
irb->ecw[0] & 0x41) == 0x41 ||
673 (p_ch->
irb->ecw[0] & 0x40) == 0x40 ||
674 (p_ch->
irb->ecw[0]) == 0) {
675 privptr->
stats.rx_errors++;
677 "%s: Restart is required after remote "
685 (p_ch->
irb->scsw.cmd.dstat == 0)) {
687 (
void *)&p_ch->
flag_a) == 0)
688 tasklet_schedule(&p_ch->
tasklet);
696 (p_ch->
irb->scsw.cmd.stctl ==
704 (
void *)&p_ch->
flag_a) == 0)
705 tasklet_schedule(&p_ch->
tasklet);
713 "%s: Unit Check Occurred in "
714 "write channel\n", dev->
name);
716 if (p_ch->
irb->ecw[0] & 0x80) {
718 "%s: Resetting Event "
719 "occurred:\n", dev->
name);
721 p_ch->
timer.function =
722 (
void *)claw_write_retry;
727 "%s: write connection "
728 "restarting\n", dev->
name);
736 "%s: Unit Exception "
737 "occurred in write channel\n",
742 (p_ch->
irb->scsw.cmd.stctl ==
748 if (claw_test_and_setbit_busy(
TB_TX, dev) == 0) {
749 claw_write_next(p_ch);
750 claw_clearbit_busy(
TB_TX, dev);
751 claw_clear_busy(dev);
755 (
void *)&p_ch_r->
flag_a) == 0)
756 tasklet_schedule(&p_ch_r->
tasklet);
761 "The CLAW device for %s received an unexpected IRQ\n",
775 claw_irq_tasklet (
unsigned long data )
780 p_ch = (
struct chbk *) data;
798 unsigned long saveflags;
802 struct ccwbk* p_this_ccw;
813 for ( i = 1; i >=0 ; i--) {
821 claw_purge_skb_queue(
828 spin_unlock_irqrestore(
834 ccw_check_return_code(privptr->
channel[i].cdev, rc);
859 while (p_buf!=
NULL) {
861 (
int)pages_to_order_of_mag(
873 while (p_buf!=
NULL) {
875 (
int)pages_to_order_of_mag(
889 while (p_this_ccw!=
NULL) {
890 p_this_ccw->
header.length=0xffff;
891 p_this_ccw->
header.opcode=0xff;
892 p_this_ccw->
header.flag=0x00;
893 p_this_ccw=p_this_ccw->
next;
913 "Deactivating %s completed with incorrect"
914 " subchannel status "
915 "(read %02x, write %02x)\n",
931 claw_write_retry (
struct chbk *p_ch )
940 claw_strt_out_IO( dev );
952 claw_write_next (
struct chbk * p_ch )
964 claw_free_wrt_buf( dev );
967 pk_skb = claw_pack_skb(privptr);
968 while (pk_skb !=
NULL) {
969 claw_hw_tx(pk_skb, dev, 1);
971 pk_skb = claw_pack_skb(privptr);
977 claw_strt_out_IO(dev);
988 claw_timer (
struct chbk * p_ch )
1012 pages_to_order_of_mag(
int num_of_pages)
1018 if (num_of_pages == 1) {
return 0; }
1020 if (num_of_pages >= 512) {
return 9; }
1022 for (nump=2 ;nump <= 512;nump*=2) {
1023 if (num_of_pages <= nump)
1027 if (order_of_mag > 9) { order_of_mag = 9; }
1029 return order_of_mag;
1039 struct ccwbk* p_last)
1042 struct ccw1 temp_ccw;
1051 if ( p_first==
NULL) {
1078 if ( privptr-> p_read_active_first ==
NULL ) {
1100 sizeof(
struct ccw1));
1110 sizeof(
struct ccw1));
1133 if (return_code != 0) {
1134 switch (return_code) {
1138 dev_err(&cdev->
dev,
"The remote channel adapter is not"
1143 "The status of the remote channel adapter"
1147 dev_err(&cdev->
dev,
"The common device layer"
1148 " returned error code %d\n",
1160 ccw_check_unit_check(
struct chbk * p_ch,
unsigned char sense )
1166 dev_warn(dev,
"The communication peer of %s disconnected\n",
1171 dev_warn(dev,
"The remote channel adapter for"
1172 " %s has been reset\n",
1175 }
else if (sense & 0x20) {
1177 dev_warn(dev,
"A data streaming timeout occurred"
1180 }
else if (sense & 0x10) {
1181 dev_warn(dev,
"The remote channel adapter for %s"
1185 dev_warn(dev,
"A data transfer parity error occurred"
1189 }
else if (sense & 0x10) {
1190 dev_warn(dev,
"A read data parity error occurred"
1209 p_env=privptr->
p_env;
1244 struct ccwbk *p_this_ccw;
1245 struct ccwbk *p_first_ccw;
1246 struct ccwbk *p_last_ccw;
1248 signed long len_of_data;
1249 unsigned long bytesInThisBuffer;
1250 unsigned char *pDataAddress;
1252 struct ccw1 tempCCW;
1259 p_env =privptr->
p_env;
1260 claw_free_wrt_buf(dev);
1265 (skb->cb[1] !=
'P')) {
1269 if (pk_head->
len%4) {
1270 pk_head->
len+= 4-(pk_head->
len%4);
1278 pk_head->
flag = 0x00;
1283 if (claw_check_busy(dev)) {
1285 claw_clear_busy(dev);
1288 claw_strt_out_IO(dev );
1289 claw_free_wrt_buf( dev );
1297 claw_clear_busy(dev);
1302 if (claw_test_and_setbit_busy(
TB_TX,dev)) {
1306 claw_strt_out_IO(dev );
1325 pDataAddress=skb->
data;
1326 len_of_data=skb->
len;
1328 while (len_of_data > 0) {
1330 if (p_this_ccw ==
NULL) {
1339 if (len_of_data >= privptr->
p_env->write_size)
1340 bytesInThisBuffer = privptr->
p_env->write_size;
1342 bytesInThisBuffer = len_of_data;
1344 len_of_data-=bytesInThisBuffer;
1345 pDataAddress+=(
unsigned long)bytesInThisBuffer;
1347 p_this_ccw->
write.cmd_code = (linkid * 8) +1;
1348 if (len_of_data>0) {
1351 p_this_ccw->
write.count=bytesInThisBuffer;
1353 if (p_first_ccw==
NULL) {
1354 p_first_ccw=p_this_ccw;
1356 if (p_last_ccw!=
NULL) {
1357 p_last_ccw->
next=p_this_ccw;
1362 p_last_ccw=p_this_ccw;
1369 if (p_first_ccw!=
NULL) {
1417 sizeof(
struct ccw1));
1427 sizeof(
struct ccw1));
1439 claw_strt_out_IO(dev );
1445 claw_clearbit_busy(
TB_TX,dev);
1460 __u32 ccw_blocks_required;
1461 __u32 ccw_blocks_perpage;
1462 __u32 ccw_pages_required;
1463 __u32 claw_reads_perpage=1;
1464 __u32 claw_read_pages;
1465 __u32 claw_writes_perpage=1;
1466 __u32 claw_write_pages;
1468 struct ccwbk*p_free_chain;
1470 struct ccwbk*p_last_CCWB;
1471 struct ccwbk*p_first_CCWB;
1501 ccw_blocks_required =
1502 privptr->
p_env->read_buffers+privptr->
p_env->write_buffers+1;
1519 claw_reads_perpage);
1524 claw_read_pages = privptr->
p_env->read_buffers *
1528 claw_writes_perpage =
1531 claw_writes_perpage);
1537 claw_write_pages = privptr->
p_env->write_buffers *
1546 (
int)pages_to_order_of_mag(ccw_pages_required ));
1563 p_endccw->
real=real_address;
1565 p_endccw->
read1=0x00;
1622 for (i=0 ; i < ccw_pages_required; i++ ) {
1625 for (j=0 ; j < ccw_blocks_perpage ; j++) {
1626 p_buf->
next = p_free_chain;
1627 p_free_chain = p_buf;
1639 p_free_chain=p_free_chain->
next;
1653 (
int)pages_to_order_of_mag(claw_write_pages ));
1669 for (i=0 ; i< privptr->
p_env->write_buffers ; i++) {
1670 p_buf = p_free_chain;
1671 p_free_chain = p_buf->
next;
1674 p_buf-> p_buffer = (
struct clawbuf *)p_buff;
1679 p_buf-> w_read_FF.count = 1;
1680 p_buf-> w_read_FF.cda =
1683 p_buf-> w_TIC_1.flags = 0;
1684 p_buf-> w_TIC_1.count = 0;
1686 if (((
unsigned long)p_buff +
1687 privptr->
p_env->write_size) >=
1688 ((
unsigned long)(p_buff+2*
1690 p_buff = p_buff+privptr->
p_env->write_size;
1697 for (i = 0; i< privptr->
p_env->write_buffers ; i++) {
1699 (
int)pages_to_order_of_mag(
1703 (
int)pages_to_order_of_mag(
1707 while (p_buf!=
NULL) {
1710 (
int)pages_to_order_of_mag(
1716 memset(p_buff, 0x00, privptr->
p_env->write_size );
1717 p_buf = p_free_chain;
1718 p_free_chain = p_buf->
next;
1727 p_buf-> w_read_FF.count = 1;
1728 p_buf-> w_read_FF.cda =
1731 p_buf-> w_TIC_1.flags = 0;
1732 p_buf-> w_TIC_1.count = 0;
1749 (
int)pages_to_order_of_mag(claw_read_pages) );
1752 (
int)pages_to_order_of_mag(
1756 (
int)pages_to_order_of_mag(
1769 for (i=0 ; i< privptr->
p_env->read_buffers ; i++) {
1770 p_buf = p_free_chain;
1771 p_free_chain = p_buf->
next;
1773 if (p_last_CCWB==
NULL) {
1779 p_buf->
next=p_first_CCWB;
1791 p_buf->
read.count = privptr->
p_env->read_size;
1795 p_buf-> read_h.cda =
1798 p_buf-> read_h.count =
sizeof(
struct clawh);
1802 p_buf-> signal.cda =
1805 p_buf-> signal.count = 1;
1809 p_buf-> r_TIC_1.cda = (
__u32)real_TIC_address;
1810 p_buf-> r_TIC_1.flags = 0;
1811 p_buf-> r_TIC_1.count = 0;
1815 p_buf-> r_read_FF.cda =
1817 p_buf-> r_read_FF.flags =
1819 p_buf-> r_read_FF.count = 1;
1826 p_buf->
header.length=0xffff;
1827 p_buf->
header.opcode=0xff;
1830 if (((
unsigned long)p_buff+privptr->
p_env->read_size) >=
1831 ((
unsigned long)(p_buff+2*(privptr->
p_env->read_size)
1834 p_buff= p_buff+privptr->
p_env->read_size;
1838 (
void *)((
unsigned long)
1839 (p_buff+2*(privptr->
p_env->read_size)-1)
1845 for (i=0 ; i< privptr->
p_env->read_buffers ; i++) {
1847 (
int)pages_to_order_of_mag(
1851 (
int)pages_to_order_of_mag(privptr->
1855 while (p_buf!=
NULL) {
1858 (
int)pages_to_order_of_mag(
1864 while (p_buf!=
NULL) {
1867 (
int)pages_to_order_of_mag(
1876 p_buf = p_free_chain;
1878 p_free_chain = p_buf->
next;
1880 if (p_last_CCWB==
NULL) {
1886 p_buf->
next=p_first_CCWB;
1889 &p_first_CCWB ->
read );
1899 p_buf->
read.count = privptr->
p_env->read_size;
1903 p_buf-> read_h.cda =
1906 p_buf-> read_h.count =
sizeof(
struct clawh);
1910 p_buf-> signal.cda =
1913 p_buf-> signal.count = 1;
1917 p_buf-> r_TIC_1.cda = (
__u32)real_TIC_address;
1918 p_buf-> r_TIC_1.flags = 0;
1919 p_buf-> r_TIC_1.count = 0;
1923 p_buf-> r_read_FF.cda =
1925 p_buf-> r_read_FF.flags =
1927 p_buf-> r_read_FF.count = 1;
1931 sizeof(
struct ccw1));
1934 p_buf->
header.length=0xffff;
1935 p_buf->
header.opcode=0xff;
1941 add_claw_reads( dev ,p_first_CCWB , p_last_CCWB);
1960 if (privptr !=
NULL) {
1981 char temp_host_name[8];
1982 char temp_ws_name[8];
1994 p_env=privptr->
p_env;
1998 dev_info(tdev,
"%s: CLAW device %.8s: "
1999 "Received Control Packet\n",
2000 dev->
name, temp_ws_name);
2015 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2017 dev_warn(tdev,
"The communication peer of %s"
2018 " uses an incorrect API version %d\n",
2021 p_sysval = (
struct sysval *)&(p_ctlbk->
data);
2022 dev_info(tdev,
"%s: Recv Sys Validate Request: "
2023 "Vers=%d,link_id=%d,Corr=%d,WS name=%.8s,"
2031 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2037 "Host name %s for %s does not match the"
2038 " remote adapter name %s\n",
2044 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2049 dev_warn(tdev,
"Adapter name %s for %s does not match"
2050 " the remote host name %s\n",
2057 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2060 "The local write buffer is smaller than the"
2061 " remote read buffer\n");
2066 claw_snd_sys_validate_rsp(dev, p_ctlbk,
2069 "The local read buffer is smaller than the"
2070 " remote write buffer\n");
2073 claw_snd_sys_validate_rsp(dev, p_ctlbk, 0);
2075 "CLAW device %.8s: System validate"
2076 " completed.\n", temp_ws_name);
2078 "%s: sys Validate Rsize:%d Wsize:%d\n",
2084 claw_strt_conn_req(dev);
2087 p_sysval = (
struct sysval *)&(p_ctlbk->
data);
2089 "Settings for %s validated (version=%d, "
2090 "remote device=%d, rc=%d, adapter name=%.8s, "
2091 "host name=%.8s)\n",
2098 switch (p_ctlbk->
rc) {
2101 "%.8s: System validate completed.\n",
2102 dev->
name, temp_ws_name);
2104 claw_strt_conn_req(dev);
2108 dev_warn(tdev,
"Validating %s failed because of"
2109 " a host or adapter name mismatch\n",
2113 dev_warn(tdev,
"Validating %s failed because of a"
2114 " version conflict\n",
2118 dev_warn(tdev,
"Validating %s failed because of a"
2119 " frame size conflict\n",
2123 dev_warn(tdev,
"The communication peer of %s rejected"
2124 " the connection\n",
2132 dev_info(tdev,
"%s: Recv Conn Req: Vers=%d,link_id=%d,"
2133 "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n",
2141 claw_snd_disc(dev, p_ctlbk);
2142 dev_info(tdev,
"%s rejected a connection request"
2143 " because it is already active\n",
2146 if (p_ctlbk->
linkid != 1) {
2147 claw_snd_disc(dev, p_ctlbk);
2148 dev_info(tdev,
"%s rejected a request to open multiple"
2154 claw_snd_disc(dev, p_ctlbk);
2155 dev_info(tdev,
"%s rejected a connection request"
2156 " because of a type mismatch\n",
2159 claw_send_control(dev,
2166 claw_snd_conn_req(dev, 0);
2168 dev_info(tdev,
"%s: CLAW device %.8s: Connection "
2169 "completed link_id=%d.\n",
2170 dev->
name, temp_ws_name,
2178 dev_info(tdev,
"%s: Recv Conn Resp: Vers=%d,link_id=%d,"
2179 "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n",
2188 if (p_ctlbk->
rc != 0) {
2189 dev_warn(tdev,
"The communication peer of %s rejected"
2190 " a connection request\n",
2197 claw_snd_disc(dev, p_ctlbk);
2198 dev_warn(tdev,
"The communication peer of %s"
2199 " rejected a connection "
2200 "request because of a type mismatch\n",
2209 "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
2210 "Corr=%d,Host appl=%.8s,WS appl=%.8s\n",
2221 "%s: Confirmed Now packing\n", dev->
name);
2227 dev_warn(tdev,
"Activating %s failed because of"
2228 " an incorrect link ID=%d\n",
2230 claw_snd_disc(dev, p_ctlbk);
2235 "Vers=%d,link_id=%d,Corr=%d\n",
2238 if ((p_ctlbk->
linkid == 2) &&
2246 dev_warn(tdev,
"The communication peer of %s failed\n",
2250 dev_warn(tdev,
"The communication peer of %s sent"
2251 " an unknown command code\n",
2267 __u8 correlator,
__u8 rc,
char *local_name,
char *remote_name)
2293 if (privptr->
p_env->packing > 0) {
2299 privptr->
p_env->read_size;
2301 privptr->
p_env->write_size;
2311 if (privptr->
p_env->packing > 0) {
2327 skb = dev_alloc_skb(
sizeof(
struct clawctl));
2332 p_ctl,
sizeof(
struct clawctl));
2334 claw_hw_tx(skb, dev, 1);
2336 claw_hw_tx(skb, dev, 0);
2365 if (privptr->
p_env->packing == 0)
2400 claw_snd_sys_validate_rsp(
struct net_device *dev,
2409 p_env=privptr->
p_env;
2430 rc=claw_snd_conn_req(dev, 1);
2447 return &privptr->
stats;
2461 struct ccwbk *p_this_ccw;
2462 struct ccwbk *p_first_ccw;
2463 struct ccwbk *p_last_ccw;
2472 __u8 mtc_this_frm=0;
2485 p_env = privptr->
p_env;
2495 (p_packh->
len == 32) &&
2498 p_ctlrec = (
struct clawctl *)p_packh;
2507 link_num=p_this_ccw->
header.opcode / 8;
2510 if (p_this_ccw->
header.length!=
2511 privptr->
p_env->read_size ) {
2513 "The communication peer of %s"
2515 " frame of length %02x\n",
2529 if (mtc_this_frm==0) {
2537 claw_process_control(dev, p_this_ccw);
2545 p_packd = p_this_ccw->
p_buffer+pack_off;
2546 p_packh = (
struct clawph *) p_packd;
2547 if ((p_packh->
len == 0) ||
2548 (p_packh->
flag != 0))
2550 bytes_to_mov = p_packh->
len;
2551 pack_off += bytes_to_mov+
sizeof(
struct clawph);
2554 bytes_to_mov=p_this_ccw->
header.length;
2570 privptr->
stats.rx_frame_errors++;
2575 p_packd+
sizeof(
struct clawph), bytes_to_mov);
2579 p_this_ccw->
p_buffer, bytes_to_mov);
2581 if (mtc_this_frm==0) {
2582 len_of_data=privptr->
mtc_offset+bytes_to_mov;
2583 skb=dev_alloc_skb(len_of_data);
2589 skb_reset_mac_header(skb);
2592 privptr->
stats.rx_packets++;
2593 privptr->
stats.rx_bytes+=len_of_data;
2597 dev_info(p_dev,
"Allocating a buffer for"
2598 " incoming data failed\n");
2599 privptr->
stats.rx_dropped++;
2615 p_this_ccw->
header.length=0xffff;
2616 p_this_ccw->
header.opcode=0xff;
2620 if (p_first_ccw==
NULL) {
2621 p_first_ccw = p_this_ccw;
2624 p_last_ccw->
next = p_this_ccw;
2626 p_last_ccw = p_this_ccw;
2637 add_claw_reads(dev, p_first_ccw, p_last_ccw);
2647 claw_strt_read (
struct net_device *dev,
int lock )
2651 unsigned long saveflags = 0;
2653 struct ccwbk*p_ccwbk;
2655 struct clawh *p_clawh;
2674 parm = (
unsigned long) p_ch;
2678 ccw_check_return_code(p_ch->
cdev, rc);
2704 struct ccwbk *p_first_ccw;
2717 if (p_first_ccw ==
NULL) {
2721 parm = (
unsigned long) p_ch;
2726 ccw_check_return_code(p_ch->
cdev, rc);
2743 struct ccwbk*p_this_ccw;
2744 struct ccwbk*p_next_ccw;
2751 p_next_ccw = p_this_ccw->
next;
2752 if (((p_next_ccw!=
NULL) &&
2763 privptr->
stats.tx_bytes+= p_this_ccw->
write.count;
2765 privptr->
stats.tx_packets++;
2787 claw_free_netdevice(
struct net_device * dev,
int free_dev)
2816 .ndo_open = claw_open,
2817 .ndo_stop = claw_release,
2818 .ndo_get_stats = claw_stats,
2819 .ndo_start_xmit = claw_tx,
2820 .ndo_change_mtu = claw_change_mtu,
2891 p_env = privptr->
p_env;
2896 ret = add_channel(cgdev->
cdev[0],0,privptr);
2898 ret = add_channel(cgdev->
cdev[1],1,privptr);
2900 dev_warn(&cgdev->
dev,
"Creating a CLAW group device"
2901 " failed with error code %d\n", ret);
2907 "Setting the read subchannel online"
2908 " failed with error code %d\n", ret);
2914 "Setting the write subchannel online "
2915 "failed with error code %d\n", ret);
2921 "Activating the CLAW device failed\n");
2931 claw_free_netdevice(dev, 1);
2937 ret=init_ccw_bk(dev);
2940 claw_free_netdevice(dev,1);
2949 dev_info(&cgdev->
dev,
"%s:readsize=%d writesize=%d "
2950 "readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n",
2955 dev_info(&cgdev->
dev,
"%s:host_name:%.8s, adapter_name "
2956 ":%.8s api_type: %.8s\n",
3002 ret = claw_release(ndev);
3006 claw_free_netdevice(ndev, 1);
3026 if (cgdev->
state == CCWGROUP_ONLINE)
3027 claw_shutdown_device(cgdev);
3058 p_env = priv->
p_env;
3064 const char *buf,
size_t count)
3072 p_env = priv->
p_env;
3085 static DEVICE_ATTR(host_name, 0644, claw_hname_show, claw_hname_write);
3096 p_env = priv->
p_env;
3102 const char *buf,
size_t count)
3110 p_env = priv->
p_env;
3134 p_env = priv->
p_env;
3141 const char *buf,
size_t count)
3149 p_env = priv->
p_env;
3183 p_env = priv->
p_env;
3189 const char *buf,
size_t count)
3198 p_env = priv->
p_env;
3206 if ((nnn > max ) || (nnn < 2))
3214 static DEVICE_ATTR(write_buffer, 0644, claw_wbuff_show, claw_wbuff_write);
3225 p_env = priv->
p_env;
3231 const char *buf,
size_t count)
3240 p_env = priv->
p_env;
3248 if ((nnn > max ) || (nnn < 2))
3257 static struct attribute *claw_attr[] = {
3258 &dev_attr_read_buffer.attr,
3259 &dev_attr_write_buffer.attr,
3260 &dev_attr_adapter_name.attr,
3261 &dev_attr_api_type.attr,
3262 &dev_attr_host_name.attr,
3274 .groups = claw_attr_groups,
3290 if (privptr ==
NULL) {
3307 privptr->
p_env->packing = 0;
3308 privptr->
p_env->write_buffers = 5;
3309 privptr->
p_env->read_buffers = 5;
3312 privptr->
p_env->p_priv = privptr;
3313 cgdev->
cdev[0]->handler = claw_irq_handler;
3314 cgdev->
cdev[1]->handler = claw_irq_handler;
3315 cgdev->
dev.type = &claw_devtype;
3325 static void __exit claw_cleanup(
void)
3330 claw_unregister_debug_facility();
3340 static int __init claw_init(
void)
3345 ret = claw_register_debug_facility();
3347 pr_err(
"Registering with the S/390 debug feature"
3348 " failed with error code %d\n", ret);
3353 ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0;
3359 claw_group_driver.
driver.groups = claw_drv_attr_groups;
3371 claw_unregister_debug_facility();
3373 pr_err(
"Initializing the claw device driver failed\n");
3382 "Copyright IBM Corp. 2000, 2008\n");