aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tokenring/smctr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tokenring/smctr.c')
-rw-r--r--drivers/net/tokenring/smctr.c500
1 files changed, 251 insertions, 249 deletions
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 0929fff5982c..63db5a6762ae 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -435,7 +435,7 @@ static int smctr_alloc_shared_memory(struct net_device *dev)
435 RX_DATA_BUFFER_SIZE * tp->num_rx_bdbs[NON_MAC_QUEUE]); 435 RX_DATA_BUFFER_SIZE * tp->num_rx_bdbs[NON_MAC_QUEUE]);
436 tp->rx_buff_end[NON_MAC_QUEUE] = (__u16 *)smctr_malloc(dev, 0); 436 tp->rx_buff_end[NON_MAC_QUEUE] = (__u16 *)smctr_malloc(dev, 0);
437 437
438 return (0); 438 return 0;
439} 439}
440 440
441/* Enter Bypass state. */ 441/* Enter Bypass state. */
@@ -448,7 +448,7 @@ static int smctr_bypass_state(struct net_device *dev)
448 448
449 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE, JS_BYPASS_STATE); 449 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE, JS_BYPASS_STATE);
450 450
451 return (err); 451 return err;
452} 452}
453 453
454static int smctr_checksum_firmware(struct net_device *dev) 454static int smctr_checksum_firmware(struct net_device *dev)
@@ -471,9 +471,9 @@ static int smctr_checksum_firmware(struct net_device *dev)
471 smctr_disable_adapter_ctrl_store(dev); 471 smctr_disable_adapter_ctrl_store(dev);
472 472
473 if(checksum) 473 if(checksum)
474 return (checksum); 474 return checksum;
475 475
476 return (0); 476 return 0;
477} 477}
478 478
479static int __init smctr_chk_mca(struct net_device *dev) 479static int __init smctr_chk_mca(struct net_device *dev)
@@ -485,7 +485,7 @@ static int __init smctr_chk_mca(struct net_device *dev)
485 485
486 current_slot = mca_find_unused_adapter(smctr_posid, 0); 486 current_slot = mca_find_unused_adapter(smctr_posid, 0);
487 if(current_slot == MCA_NOTFOUND) 487 if(current_slot == MCA_NOTFOUND)
488 return (-ENODEV); 488 return -ENODEV;
489 489
490 mca_set_adapter_name(current_slot, smctr_name); 490 mca_set_adapter_name(current_slot, smctr_name);
491 mca_mark_as_used(current_slot); 491 mca_mark_as_used(current_slot);
@@ -622,9 +622,9 @@ static int __init smctr_chk_mca(struct net_device *dev)
622 break; 622 break;
623 } 623 }
624 624
625 return (0); 625 return 0;
626#else 626#else
627 return (-1); 627 return -1;
628#endif /* CONFIG_MCA_LEGACY */ 628#endif /* CONFIG_MCA_LEGACY */
629} 629}
630 630
@@ -677,18 +677,18 @@ static int smctr_chg_rx_mask(struct net_device *dev)
677 if((err = smctr_issue_write_word_cmd(dev, RW_CONFIG_REGISTER_0, 677 if((err = smctr_issue_write_word_cmd(dev, RW_CONFIG_REGISTER_0,
678 &tp->config_word0))) 678 &tp->config_word0)))
679 { 679 {
680 return (err); 680 return err;
681 } 681 }
682 682
683 if((err = smctr_issue_write_word_cmd(dev, RW_CONFIG_REGISTER_1, 683 if((err = smctr_issue_write_word_cmd(dev, RW_CONFIG_REGISTER_1,
684 &tp->config_word1))) 684 &tp->config_word1)))
685 { 685 {
686 return (err); 686 return err;
687 } 687 }
688 688
689 smctr_disable_16bit(dev); 689 smctr_disable_16bit(dev);
690 690
691 return (0); 691 return 0;
692} 692}
693 693
694static int smctr_clear_int(struct net_device *dev) 694static int smctr_clear_int(struct net_device *dev)
@@ -697,7 +697,7 @@ static int smctr_clear_int(struct net_device *dev)
697 697
698 outb((tp->trc_mask | CSR_CLRTINT), dev->base_addr + CSR); 698 outb((tp->trc_mask | CSR_CLRTINT), dev->base_addr + CSR);
699 699
700 return (0); 700 return 0;
701} 701}
702 702
703static int smctr_clear_trc_reset(int ioaddr) 703static int smctr_clear_trc_reset(int ioaddr)
@@ -707,7 +707,7 @@ static int smctr_clear_trc_reset(int ioaddr)
707 r = inb(ioaddr + MSR); 707 r = inb(ioaddr + MSR);
708 outb(~MSR_RST & r, ioaddr + MSR); 708 outb(~MSR_RST & r, ioaddr + MSR);
709 709
710 return (0); 710 return 0;
711} 711}
712 712
713/* 713/*
@@ -725,7 +725,7 @@ static int smctr_close(struct net_device *dev)
725 725
726 /* Check to see if adapter is already in a closed state. */ 726 /* Check to see if adapter is already in a closed state. */
727 if(tp->status != OPEN) 727 if(tp->status != OPEN)
728 return (0); 728 return 0;
729 729
730 smctr_enable_16bit(dev); 730 smctr_enable_16bit(dev);
731 smctr_set_page(dev, (__u8 *)tp->ram_access); 731 smctr_set_page(dev, (__u8 *)tp->ram_access);
@@ -733,7 +733,7 @@ static int smctr_close(struct net_device *dev)
733 if((err = smctr_issue_remove_cmd(dev))) 733 if((err = smctr_issue_remove_cmd(dev)))
734 { 734 {
735 smctr_disable_16bit(dev); 735 smctr_disable_16bit(dev);
736 return (err); 736 return err;
737 } 737 }
738 738
739 for(;;) 739 for(;;)
@@ -746,7 +746,7 @@ static int smctr_close(struct net_device *dev)
746 } 746 }
747 747
748 748
749 return (0); 749 return 0;
750} 750}
751 751
752static int smctr_decode_firmware(struct net_device *dev, 752static int smctr_decode_firmware(struct net_device *dev,
@@ -807,12 +807,12 @@ static int smctr_decode_firmware(struct net_device *dev,
807 if(buff) 807 if(buff)
808 *(mem++) = SWAP_BYTES(buff); 808 *(mem++) = SWAP_BYTES(buff);
809 809
810 return (0); 810 return 0;
811} 811}
812 812
813static int smctr_disable_16bit(struct net_device *dev) 813static int smctr_disable_16bit(struct net_device *dev)
814{ 814{
815 return (0); 815 return 0;
816} 816}
817 817
818/* 818/*
@@ -832,7 +832,7 @@ static int smctr_disable_adapter_ctrl_store(struct net_device *dev)
832 tp->trc_mask |= CSR_WCSS; 832 tp->trc_mask |= CSR_WCSS;
833 outb(tp->trc_mask, ioaddr + CSR); 833 outb(tp->trc_mask, ioaddr + CSR);
834 834
835 return (0); 835 return 0;
836} 836}
837 837
838static int smctr_disable_bic_int(struct net_device *dev) 838static int smctr_disable_bic_int(struct net_device *dev)
@@ -844,7 +844,7 @@ static int smctr_disable_bic_int(struct net_device *dev)
844 | CSR_MSKTINT | CSR_WCSS; 844 | CSR_MSKTINT | CSR_WCSS;
845 outb(tp->trc_mask, ioaddr + CSR); 845 outb(tp->trc_mask, ioaddr + CSR);
846 846
847 return (0); 847 return 0;
848} 848}
849 849
850static int smctr_enable_16bit(struct net_device *dev) 850static int smctr_enable_16bit(struct net_device *dev)
@@ -858,7 +858,7 @@ static int smctr_enable_16bit(struct net_device *dev)
858 outb((r | LAAR_MEM16ENB), dev->base_addr + LAAR); 858 outb((r | LAAR_MEM16ENB), dev->base_addr + LAAR);
859 } 859 }
860 860
861 return (0); 861 return 0;
862} 862}
863 863
864/* 864/*
@@ -881,7 +881,7 @@ static int smctr_enable_adapter_ctrl_store(struct net_device *dev)
881 tp->trc_mask &= ~CSR_WCSS; 881 tp->trc_mask &= ~CSR_WCSS;
882 outb(tp->trc_mask, ioaddr + CSR); 882 outb(tp->trc_mask, ioaddr + CSR);
883 883
884 return (0); 884 return 0;
885} 885}
886 886
887static int smctr_enable_adapter_ram(struct net_device *dev) 887static int smctr_enable_adapter_ram(struct net_device *dev)
@@ -895,7 +895,7 @@ static int smctr_enable_adapter_ram(struct net_device *dev)
895 r = inb(ioaddr + MSR); 895 r = inb(ioaddr + MSR);
896 outb(MSR_MEMB | r, ioaddr + MSR); 896 outb(MSR_MEMB | r, ioaddr + MSR);
897 897
898 return (0); 898 return 0;
899} 899}
900 900
901static int smctr_enable_bic_int(struct net_device *dev) 901static int smctr_enable_bic_int(struct net_device *dev)
@@ -921,7 +921,7 @@ static int smctr_enable_bic_int(struct net_device *dev)
921 break; 921 break;
922 } 922 }
923 923
924 return (0); 924 return 0;
925} 925}
926 926
927static int __init smctr_chk_isa(struct net_device *dev) 927static int __init smctr_chk_isa(struct net_device *dev)
@@ -1145,7 +1145,7 @@ static int __init smctr_chk_isa(struct net_device *dev)
1145 */ 1145 */
1146 } 1146 }
1147 1147
1148 return (0); 1148 return 0;
1149 1149
1150out2: 1150out2:
1151 release_region(ioaddr, SMCTR_IO_EXTENT); 1151 release_region(ioaddr, SMCTR_IO_EXTENT);
@@ -1199,7 +1199,7 @@ static int __init smctr_get_boardid(struct net_device *dev, int mca)
1199 * return; 1199 * return;
1200 */ 1200 */
1201 if(IdByte & 0xF8) 1201 if(IdByte & 0xF8)
1202 return (-1); 1202 return -1;
1203 1203
1204 r1 = inb(ioaddr + BID_REG_1); 1204 r1 = inb(ioaddr + BID_REG_1);
1205 r1 &= BID_ICR_MASK; 1205 r1 &= BID_ICR_MASK;
@@ -1250,21 +1250,21 @@ static int __init smctr_get_boardid(struct net_device *dev, int mca)
1250 while(r1 & BID_RECALL_DONE_MASK) 1250 while(r1 & BID_RECALL_DONE_MASK)
1251 r1 = inb(ioaddr + BID_REG_1); 1251 r1 = inb(ioaddr + BID_REG_1);
1252 1252
1253 return (BoardIdMask); 1253 return BoardIdMask;
1254} 1254}
1255 1255
1256static int smctr_get_group_address(struct net_device *dev) 1256static int smctr_get_group_address(struct net_device *dev)
1257{ 1257{
1258 smctr_issue_read_word_cmd(dev, RW_INDIVIDUAL_GROUP_ADDR); 1258 smctr_issue_read_word_cmd(dev, RW_INDIVIDUAL_GROUP_ADDR);
1259 1259
1260 return(smctr_wait_cmd(dev)); 1260 return smctr_wait_cmd(dev);
1261} 1261}
1262 1262
1263static int smctr_get_functional_address(struct net_device *dev) 1263static int smctr_get_functional_address(struct net_device *dev)
1264{ 1264{
1265 smctr_issue_read_word_cmd(dev, RW_FUNCTIONAL_ADDR); 1265 smctr_issue_read_word_cmd(dev, RW_FUNCTIONAL_ADDR);
1266 1266
1267 return(smctr_wait_cmd(dev)); 1267 return smctr_wait_cmd(dev);
1268} 1268}
1269 1269
1270/* Calculate number of Non-MAC receive BDB's and data buffers. 1270/* Calculate number of Non-MAC receive BDB's and data buffers.
@@ -1346,14 +1346,14 @@ static unsigned int smctr_get_num_rx_bdbs(struct net_device *dev)
1346 */ 1346 */
1347 mem_used += 0x100; 1347 mem_used += 0x100;
1348 1348
1349 return((0xffff - mem_used) / (RX_DATA_BUFFER_SIZE + sizeof(BDBlock))); 1349 return (0xffff - mem_used) / (RX_DATA_BUFFER_SIZE + sizeof(BDBlock));
1350} 1350}
1351 1351
1352static int smctr_get_physical_drop_number(struct net_device *dev) 1352static int smctr_get_physical_drop_number(struct net_device *dev)
1353{ 1353{
1354 smctr_issue_read_word_cmd(dev, RW_PHYSICAL_DROP_NUMBER); 1354 smctr_issue_read_word_cmd(dev, RW_PHYSICAL_DROP_NUMBER);
1355 1355
1356 return(smctr_wait_cmd(dev)); 1356 return smctr_wait_cmd(dev);
1357} 1357}
1358 1358
1359static __u8 * smctr_get_rx_pointer(struct net_device *dev, short queue) 1359static __u8 * smctr_get_rx_pointer(struct net_device *dev, short queue)
@@ -1366,14 +1366,14 @@ static __u8 * smctr_get_rx_pointer(struct net_device *dev, short queue)
1366 1366
1367 tp->rx_fcb_curr[queue]->bdb_ptr = bdb; 1367 tp->rx_fcb_curr[queue]->bdb_ptr = bdb;
1368 1368
1369 return ((__u8 *)bdb->data_block_ptr); 1369 return (__u8 *)bdb->data_block_ptr;
1370} 1370}
1371 1371
1372static int smctr_get_station_id(struct net_device *dev) 1372static int smctr_get_station_id(struct net_device *dev)
1373{ 1373{
1374 smctr_issue_read_word_cmd(dev, RW_INDIVIDUAL_MAC_ADDRESS); 1374 smctr_issue_read_word_cmd(dev, RW_INDIVIDUAL_MAC_ADDRESS);
1375 1375
1376 return(smctr_wait_cmd(dev)); 1376 return smctr_wait_cmd(dev);
1377} 1377}
1378 1378
1379/* 1379/*
@@ -1384,7 +1384,7 @@ static struct net_device_stats *smctr_get_stats(struct net_device *dev)
1384{ 1384{
1385 struct net_local *tp = netdev_priv(dev); 1385 struct net_local *tp = netdev_priv(dev);
1386 1386
1387 return ((struct net_device_stats *)&tp->MacStat); 1387 return (struct net_device_stats *)&tp->MacStat;
1388} 1388}
1389 1389
1390static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue, 1390static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue,
@@ -1401,14 +1401,14 @@ static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue,
1401 1401
1402 /* check if there is enough FCB blocks */ 1402 /* check if there is enough FCB blocks */
1403 if(tp->num_tx_fcbs_used[queue] >= tp->num_tx_fcbs[queue]) 1403 if(tp->num_tx_fcbs_used[queue] >= tp->num_tx_fcbs[queue])
1404 return ((FCBlock *)(-1L)); 1404 return (FCBlock *)(-1L);
1405 1405
1406 /* round off the input pkt size to the nearest even number */ 1406 /* round off the input pkt size to the nearest even number */
1407 alloc_size = (bytes_count + 1) & 0xfffe; 1407 alloc_size = (bytes_count + 1) & 0xfffe;
1408 1408
1409 /* check if enough mem */ 1409 /* check if enough mem */
1410 if((tp->tx_buff_used[queue] + alloc_size) > tp->tx_buff_size[queue]) 1410 if((tp->tx_buff_used[queue] + alloc_size) > tp->tx_buff_size[queue])
1411 return ((FCBlock *)(-1L)); 1411 return (FCBlock *)(-1L);
1412 1412
1413 /* check if past the end ; 1413 /* check if past the end ;
1414 * if exactly enough mem to end of ring, alloc from front. 1414 * if exactly enough mem to end of ring, alloc from front.
@@ -1425,7 +1425,7 @@ static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue,
1425 if((tp->tx_buff_used[queue] + alloc_size) 1425 if((tp->tx_buff_used[queue] + alloc_size)
1426 > tp->tx_buff_size[queue]) 1426 > tp->tx_buff_size[queue])
1427 { 1427 {
1428 return ((FCBlock *)(-1L)); 1428 return (FCBlock *)(-1L);
1429 } 1429 }
1430 1430
1431 /* ring wrap */ 1431 /* ring wrap */
@@ -1448,14 +1448,14 @@ static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue,
1448 pFCB = tp->tx_fcb_curr[queue]; 1448 pFCB = tp->tx_fcb_curr[queue];
1449 tp->tx_fcb_curr[queue] = tp->tx_fcb_curr[queue]->next_ptr; 1449 tp->tx_fcb_curr[queue] = tp->tx_fcb_curr[queue]->next_ptr;
1450 1450
1451 return (pFCB); 1451 return pFCB;
1452} 1452}
1453 1453
1454static int smctr_get_upstream_neighbor_addr(struct net_device *dev) 1454static int smctr_get_upstream_neighbor_addr(struct net_device *dev)
1455{ 1455{
1456 smctr_issue_read_word_cmd(dev, RW_UPSTREAM_NEIGHBOR_ADDRESS); 1456 smctr_issue_read_word_cmd(dev, RW_UPSTREAM_NEIGHBOR_ADDRESS);
1457 1457
1458 return(smctr_wait_cmd(dev)); 1458 return smctr_wait_cmd(dev);
1459} 1459}
1460 1460
1461static int smctr_hardware_send_packet(struct net_device *dev, 1461static int smctr_hardware_send_packet(struct net_device *dev,
@@ -1469,21 +1469,22 @@ static int smctr_hardware_send_packet(struct net_device *dev,
1469 printk(KERN_DEBUG"%s: smctr_hardware_send_packet\n", dev->name); 1469 printk(KERN_DEBUG"%s: smctr_hardware_send_packet\n", dev->name);
1470 1470
1471 if(tp->status != OPEN) 1471 if(tp->status != OPEN)
1472 return (-1); 1472 return -1;
1473 1473
1474 if(tp->monitor_state_ready != 1) 1474 if(tp->monitor_state_ready != 1)
1475 return (-1); 1475 return -1;
1476 1476
1477 for(;;) 1477 for(;;)
1478 { 1478 {
1479 /* Send first buffer from queue */ 1479 /* Send first buffer from queue */
1480 skb = skb_dequeue(&tp->SendSkbQueue); 1480 skb = skb_dequeue(&tp->SendSkbQueue);
1481 if(skb == NULL) 1481 if(skb == NULL)
1482 return (-1); 1482 return -1;
1483 1483
1484 tp->QueueSkb++; 1484 tp->QueueSkb++;
1485 1485
1486 if(skb->len < SMC_HEADER_SIZE || skb->len > tp->max_packet_size) return (-1); 1486 if(skb->len < SMC_HEADER_SIZE || skb->len > tp->max_packet_size)
1487 return -1;
1487 1488
1488 smctr_enable_16bit(dev); 1489 smctr_enable_16bit(dev);
1489 smctr_set_page(dev, (__u8 *)tp->ram_access); 1490 smctr_set_page(dev, (__u8 *)tp->ram_access);
@@ -1492,7 +1493,7 @@ static int smctr_hardware_send_packet(struct net_device *dev,
1492 == (FCBlock *)(-1L)) 1493 == (FCBlock *)(-1L))
1493 { 1494 {
1494 smctr_disable_16bit(dev); 1495 smctr_disable_16bit(dev);
1495 return (-1); 1496 return -1;
1496 } 1497 }
1497 1498
1498 smctr_tx_move_frame(dev, skb, 1499 smctr_tx_move_frame(dev, skb,
@@ -1508,7 +1509,7 @@ static int smctr_hardware_send_packet(struct net_device *dev,
1508 smctr_disable_16bit(dev); 1509 smctr_disable_16bit(dev);
1509 } 1510 }
1510 1511
1511 return (0); 1512 return 0;
1512} 1513}
1513 1514
1514static int smctr_init_acbs(struct net_device *dev) 1515static int smctr_init_acbs(struct net_device *dev)
@@ -1552,7 +1553,7 @@ static int smctr_init_acbs(struct net_device *dev)
1552 tp->acb_curr = tp->acb_head->next_ptr; 1553 tp->acb_curr = tp->acb_head->next_ptr;
1553 tp->num_acbs_used = 0; 1554 tp->num_acbs_used = 0;
1554 1555
1555 return (0); 1556 return 0;
1556} 1557}
1557 1558
1558static int smctr_init_adapter(struct net_device *dev) 1559static int smctr_init_adapter(struct net_device *dev)
@@ -1590,13 +1591,14 @@ static int smctr_init_adapter(struct net_device *dev)
1590 1591
1591 if(smctr_checksum_firmware(dev)) 1592 if(smctr_checksum_firmware(dev))
1592 { 1593 {
1593 printk(KERN_ERR "%s: Previously loaded firmware is missing\n",dev->name); return (-ENOENT); 1594 printk(KERN_ERR "%s: Previously loaded firmware is missing\n",dev->name);
1595 return -ENOENT;
1594 } 1596 }
1595 1597
1596 if((err = smctr_ram_memory_test(dev))) 1598 if((err = smctr_ram_memory_test(dev)))
1597 { 1599 {
1598 printk(KERN_ERR "%s: RAM memory test failed.\n", dev->name); 1600 printk(KERN_ERR "%s: RAM memory test failed.\n", dev->name);
1599 return (-EIO); 1601 return -EIO;
1600 } 1602 }
1601 1603
1602 smctr_set_rx_look_ahead(dev); 1604 smctr_set_rx_look_ahead(dev);
@@ -1608,7 +1610,7 @@ static int smctr_init_adapter(struct net_device *dev)
1608 { 1610 {
1609 printk(KERN_ERR "%s: Initialization of card failed (%d)\n", 1611 printk(KERN_ERR "%s: Initialization of card failed (%d)\n",
1610 dev->name, err); 1612 dev->name, err);
1611 return (-EINVAL); 1613 return -EINVAL;
1612 } 1614 }
1613 1615
1614 /* This routine clobbers the TRC's internal registers. */ 1616 /* This routine clobbers the TRC's internal registers. */
@@ -1616,7 +1618,7 @@ static int smctr_init_adapter(struct net_device *dev)
1616 { 1618 {
1617 printk(KERN_ERR "%s: Card failed internal self test (%d)\n", 1619 printk(KERN_ERR "%s: Card failed internal self test (%d)\n",
1618 dev->name, err); 1620 dev->name, err);
1619 return (-EINVAL); 1621 return -EINVAL;
1620 } 1622 }
1621 1623
1622 /* Re-Initialize adapter's internal registers */ 1624 /* Re-Initialize adapter's internal registers */
@@ -1625,17 +1627,17 @@ static int smctr_init_adapter(struct net_device *dev)
1625 { 1627 {
1626 printk(KERN_ERR "%s: Initialization of card failed (%d)\n", 1628 printk(KERN_ERR "%s: Initialization of card failed (%d)\n",
1627 dev->name, err); 1629 dev->name, err);
1628 return (-EINVAL); 1630 return -EINVAL;
1629 } 1631 }
1630 1632
1631 smctr_enable_bic_int(dev); 1633 smctr_enable_bic_int(dev);
1632 1634
1633 if((err = smctr_issue_enable_int_cmd(dev, TRC_INTERRUPT_ENABLE_MASK))) 1635 if((err = smctr_issue_enable_int_cmd(dev, TRC_INTERRUPT_ENABLE_MASK)))
1634 return (err); 1636 return err;
1635 1637
1636 smctr_disable_16bit(dev); 1638 smctr_disable_16bit(dev);
1637 1639
1638 return (0); 1640 return 0;
1639} 1641}
1640 1642
1641static int smctr_init_card_real(struct net_device *dev) 1643static int smctr_init_card_real(struct net_device *dev)
@@ -1703,15 +1705,15 @@ static int smctr_init_card_real(struct net_device *dev)
1703 smctr_init_shared_memory(dev); 1705 smctr_init_shared_memory(dev);
1704 1706
1705 if((err = smctr_issue_init_timers_cmd(dev))) 1707 if((err = smctr_issue_init_timers_cmd(dev)))
1706 return (err); 1708 return err;
1707 1709
1708 if((err = smctr_issue_init_txrx_cmd(dev))) 1710 if((err = smctr_issue_init_txrx_cmd(dev)))
1709 { 1711 {
1710 printk(KERN_ERR "%s: Hardware failure\n", dev->name); 1712 printk(KERN_ERR "%s: Hardware failure\n", dev->name);
1711 return (err); 1713 return err;
1712 } 1714 }
1713 1715
1714 return (0); 1716 return 0;
1715} 1717}
1716 1718
1717static int smctr_init_rx_bdbs(struct net_device *dev) 1719static int smctr_init_rx_bdbs(struct net_device *dev)
@@ -1763,7 +1765,7 @@ static int smctr_init_rx_bdbs(struct net_device *dev)
1763 tp->rx_bdb_curr[i] = tp->rx_bdb_head[i]->next_ptr; 1765 tp->rx_bdb_curr[i] = tp->rx_bdb_head[i]->next_ptr;
1764 } 1766 }
1765 1767
1766 return (0); 1768 return 0;
1767} 1769}
1768 1770
1769static int smctr_init_rx_fcbs(struct net_device *dev) 1771static int smctr_init_rx_fcbs(struct net_device *dev)
@@ -1813,7 +1815,7 @@ static int smctr_init_rx_fcbs(struct net_device *dev)
1813 tp->rx_fcb_curr[i] = tp->rx_fcb_head[i]->next_ptr; 1815 tp->rx_fcb_curr[i] = tp->rx_fcb_head[i]->next_ptr;
1814 } 1816 }
1815 1817
1816 return(0); 1818 return 0;
1817} 1819}
1818 1820
1819static int smctr_init_shared_memory(struct net_device *dev) 1821static int smctr_init_shared_memory(struct net_device *dev)
@@ -1871,7 +1873,7 @@ static int smctr_init_shared_memory(struct net_device *dev)
1871 smctr_init_rx_bdbs(dev); 1873 smctr_init_rx_bdbs(dev);
1872 smctr_init_rx_fcbs(dev); 1874 smctr_init_rx_fcbs(dev);
1873 1875
1874 return (0); 1876 return 0;
1875} 1877}
1876 1878
1877static int smctr_init_tx_bdbs(struct net_device *dev) 1879static int smctr_init_tx_bdbs(struct net_device *dev)
@@ -1901,7 +1903,7 @@ static int smctr_init_tx_bdbs(struct net_device *dev)
1901 tp->tx_bdb_head[i]->back_ptr = bdb; 1903 tp->tx_bdb_head[i]->back_ptr = bdb;
1902 } 1904 }
1903 1905
1904 return (0); 1906 return 0;
1905} 1907}
1906 1908
1907static int smctr_init_tx_fcbs(struct net_device *dev) 1909static int smctr_init_tx_fcbs(struct net_device *dev)
@@ -1940,7 +1942,7 @@ static int smctr_init_tx_fcbs(struct net_device *dev)
1940 tp->num_tx_fcbs_used[i] = 0; 1942 tp->num_tx_fcbs_used[i] = 0;
1941 } 1943 }
1942 1944
1943 return (0); 1945 return 0;
1944} 1946}
1945 1947
1946static int smctr_internal_self_test(struct net_device *dev) 1948static int smctr_internal_self_test(struct net_device *dev)
@@ -1949,33 +1951,33 @@ static int smctr_internal_self_test(struct net_device *dev)
1949 int err; 1951 int err;
1950 1952
1951 if((err = smctr_issue_test_internal_rom_cmd(dev))) 1953 if((err = smctr_issue_test_internal_rom_cmd(dev)))
1952 return (err); 1954 return err;
1953 1955
1954 if((err = smctr_wait_cmd(dev))) 1956 if((err = smctr_wait_cmd(dev)))
1955 return (err); 1957 return err;
1956 1958
1957 if(tp->acb_head->cmd_done_status & 0xff) 1959 if(tp->acb_head->cmd_done_status & 0xff)
1958 return (-1); 1960 return -1;
1959 1961
1960 if((err = smctr_issue_test_hic_cmd(dev))) 1962 if((err = smctr_issue_test_hic_cmd(dev)))
1961 return (err); 1963 return err;
1962 1964
1963 if((err = smctr_wait_cmd(dev))) 1965 if((err = smctr_wait_cmd(dev)))
1964 return (err); 1966 return err;
1965 1967
1966 if(tp->acb_head->cmd_done_status & 0xff) 1968 if(tp->acb_head->cmd_done_status & 0xff)
1967 return (-1); 1969 return -1;
1968 1970
1969 if((err = smctr_issue_test_mac_reg_cmd(dev))) 1971 if((err = smctr_issue_test_mac_reg_cmd(dev)))
1970 return (err); 1972 return err;
1971 1973
1972 if((err = smctr_wait_cmd(dev))) 1974 if((err = smctr_wait_cmd(dev)))
1973 return (err); 1975 return err;
1974 1976
1975 if(tp->acb_head->cmd_done_status & 0xff) 1977 if(tp->acb_head->cmd_done_status & 0xff)
1976 return (-1); 1978 return -1;
1977 1979
1978 return (0); 1980 return 0;
1979} 1981}
1980 1982
1981/* 1983/*
@@ -2468,14 +2470,14 @@ static int smctr_issue_enable_int_cmd(struct net_device *dev,
2468 int err; 2470 int err;
2469 2471
2470 if((err = smctr_wait_while_cbusy(dev))) 2472 if((err = smctr_wait_while_cbusy(dev)))
2471 return (err); 2473 return err;
2472 2474
2473 tp->sclb_ptr->int_mask_control = interrupt_enable_mask; 2475 tp->sclb_ptr->int_mask_control = interrupt_enable_mask;
2474 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_CMD_CLEAR_INTERRUPT_MASK; 2476 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_CMD_CLEAR_INTERRUPT_MASK;
2475 2477
2476 smctr_set_ctrl_attention(dev); 2478 smctr_set_ctrl_attention(dev);
2477 2479
2478 return (0); 2480 return 0;
2479} 2481}
2480 2482
2481static int smctr_issue_int_ack(struct net_device *dev, __u16 iack_code, __u16 ibits) 2483static int smctr_issue_int_ack(struct net_device *dev, __u16 iack_code, __u16 ibits)
@@ -2483,7 +2485,7 @@ static int smctr_issue_int_ack(struct net_device *dev, __u16 iack_code, __u16 ib
2483 struct net_local *tp = netdev_priv(dev); 2485 struct net_local *tp = netdev_priv(dev);
2484 2486
2485 if(smctr_wait_while_cbusy(dev)) 2487 if(smctr_wait_while_cbusy(dev))
2486 return (-1); 2488 return -1;
2487 2489
2488 tp->sclb_ptr->int_mask_control = ibits; 2490 tp->sclb_ptr->int_mask_control = ibits;
2489 tp->sclb_ptr->iack_code = iack_code << 1; /* use the offset from base */ tp->sclb_ptr->resume_control = 0; 2491 tp->sclb_ptr->iack_code = iack_code << 1; /* use the offset from base */ tp->sclb_ptr->resume_control = 0;
@@ -2491,7 +2493,7 @@ static int smctr_issue_int_ack(struct net_device *dev, __u16 iack_code, __u16 ib
2491 2493
2492 smctr_set_ctrl_attention(dev); 2494 smctr_set_ctrl_attention(dev);
2493 2495
2494 return (0); 2496 return 0;
2495} 2497}
2496 2498
2497static int smctr_issue_init_timers_cmd(struct net_device *dev) 2499static int smctr_issue_init_timers_cmd(struct net_device *dev)
@@ -2502,10 +2504,10 @@ static int smctr_issue_init_timers_cmd(struct net_device *dev)
2502 __u16 *pTimer_Struc = (__u16 *)tp->misc_command_data; 2504 __u16 *pTimer_Struc = (__u16 *)tp->misc_command_data;
2503 2505
2504 if((err = smctr_wait_while_cbusy(dev))) 2506 if((err = smctr_wait_while_cbusy(dev)))
2505 return (err); 2507 return err;
2506 2508
2507 if((err = smctr_wait_cmd(dev))) 2509 if((err = smctr_wait_cmd(dev)))
2508 return (err); 2510 return err;
2509 2511
2510 tp->config_word0 = THDREN | DMA_TRIGGER | USETPT | NO_AUTOREMOVE; 2512 tp->config_word0 = THDREN | DMA_TRIGGER | USETPT | NO_AUTOREMOVE;
2511 tp->config_word1 = 0; 2513 tp->config_word1 = 0;
@@ -2648,7 +2650,7 @@ static int smctr_issue_init_timers_cmd(struct net_device *dev)
2648 2650
2649 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_INIT_TRC_TIMERS, 0); 2651 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_INIT_TRC_TIMERS, 0);
2650 2652
2651 return (err); 2653 return err;
2652} 2654}
2653 2655
2654static int smctr_issue_init_txrx_cmd(struct net_device *dev) 2656static int smctr_issue_init_txrx_cmd(struct net_device *dev)
@@ -2659,12 +2661,12 @@ static int smctr_issue_init_txrx_cmd(struct net_device *dev)
2659 void **txrx_ptrs = (void *)tp->misc_command_data; 2661 void **txrx_ptrs = (void *)tp->misc_command_data;
2660 2662
2661 if((err = smctr_wait_while_cbusy(dev))) 2663 if((err = smctr_wait_while_cbusy(dev)))
2662 return (err); 2664 return err;
2663 2665
2664 if((err = smctr_wait_cmd(dev))) 2666 if((err = smctr_wait_cmd(dev)))
2665 { 2667 {
2666 printk(KERN_ERR "%s: Hardware failure\n", dev->name); 2668 printk(KERN_ERR "%s: Hardware failure\n", dev->name);
2667 return (err); 2669 return err;
2668 } 2670 }
2669 2671
2670 /* Initialize Transmit Queue Pointers that are used, to point to 2672 /* Initialize Transmit Queue Pointers that are used, to point to
@@ -2695,7 +2697,7 @@ static int smctr_issue_init_txrx_cmd(struct net_device *dev)
2695 2697
2696 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_INIT_TX_RX, 0); 2698 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_INIT_TX_RX, 0);
2697 2699
2698 return (err); 2700 return err;
2699} 2701}
2700 2702
2701static int smctr_issue_insert_cmd(struct net_device *dev) 2703static int smctr_issue_insert_cmd(struct net_device *dev)
@@ -2704,7 +2706,7 @@ static int smctr_issue_insert_cmd(struct net_device *dev)
2704 2706
2705 err = smctr_setup_single_cmd(dev, ACB_CMD_INSERT, ACB_SUB_CMD_NOP); 2707 err = smctr_setup_single_cmd(dev, ACB_CMD_INSERT, ACB_SUB_CMD_NOP);
2706 2708
2707 return (err); 2709 return err;
2708} 2710}
2709 2711
2710static int smctr_issue_read_ring_status_cmd(struct net_device *dev) 2712static int smctr_issue_read_ring_status_cmd(struct net_device *dev)
@@ -2712,15 +2714,15 @@ static int smctr_issue_read_ring_status_cmd(struct net_device *dev)
2712 int err; 2714 int err;
2713 2715
2714 if((err = smctr_wait_while_cbusy(dev))) 2716 if((err = smctr_wait_while_cbusy(dev)))
2715 return (err); 2717 return err;
2716 2718
2717 if((err = smctr_wait_cmd(dev))) 2719 if((err = smctr_wait_cmd(dev)))
2718 return (err); 2720 return err;
2719 2721
2720 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_READ_TRC_STATUS, 2722 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_READ_TRC_STATUS,
2721 RW_TRC_STATUS_BLOCK); 2723 RW_TRC_STATUS_BLOCK);
2722 2724
2723 return (err); 2725 return err;
2724} 2726}
2725 2727
2726static int smctr_issue_read_word_cmd(struct net_device *dev, __u16 aword_cnt) 2728static int smctr_issue_read_word_cmd(struct net_device *dev, __u16 aword_cnt)
@@ -2728,15 +2730,15 @@ static int smctr_issue_read_word_cmd(struct net_device *dev, __u16 aword_cnt)
2728 int err; 2730 int err;
2729 2731
2730 if((err = smctr_wait_while_cbusy(dev))) 2732 if((err = smctr_wait_while_cbusy(dev)))
2731 return (err); 2733 return err;
2732 2734
2733 if((err = smctr_wait_cmd(dev))) 2735 if((err = smctr_wait_cmd(dev)))
2734 return (err); 2736 return err;
2735 2737
2736 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_READ_VALUE, 2738 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_READ_VALUE,
2737 aword_cnt); 2739 aword_cnt);
2738 2740
2739 return (err); 2741 return err;
2740} 2742}
2741 2743
2742static int smctr_issue_remove_cmd(struct net_device *dev) 2744static int smctr_issue_remove_cmd(struct net_device *dev)
@@ -2745,14 +2747,14 @@ static int smctr_issue_remove_cmd(struct net_device *dev)
2745 int err; 2747 int err;
2746 2748
2747 if((err = smctr_wait_while_cbusy(dev))) 2749 if((err = smctr_wait_while_cbusy(dev)))
2748 return (err); 2750 return err;
2749 2751
2750 tp->sclb_ptr->resume_control = 0; 2752 tp->sclb_ptr->resume_control = 0;
2751 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_CMD_REMOVE; 2753 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_CMD_REMOVE;
2752 2754
2753 smctr_set_ctrl_attention(dev); 2755 smctr_set_ctrl_attention(dev);
2754 2756
2755 return (0); 2757 return 0;
2756} 2758}
2757 2759
2758static int smctr_issue_resume_acb_cmd(struct net_device *dev) 2760static int smctr_issue_resume_acb_cmd(struct net_device *dev)
@@ -2761,7 +2763,7 @@ static int smctr_issue_resume_acb_cmd(struct net_device *dev)
2761 int err; 2763 int err;
2762 2764
2763 if((err = smctr_wait_while_cbusy(dev))) 2765 if((err = smctr_wait_while_cbusy(dev)))
2764 return (err); 2766 return err;
2765 2767
2766 tp->sclb_ptr->resume_control = SCLB_RC_ACB; 2768 tp->sclb_ptr->resume_control = SCLB_RC_ACB;
2767 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_RESUME_CONTROL_VALID; 2769 tp->sclb_ptr->valid_command = SCLB_VALID | SCLB_RESUME_CONTROL_VALID;
@@ -2770,7 +2772,7 @@ static int smctr_issue_resume_acb_cmd(struct net_device *dev)
2770 2772
2771 smctr_set_ctrl_attention(dev); 2773 smctr_set_ctrl_attention(dev);
2772 2774
2773 return (0); 2775 return 0;
2774} 2776}
2775 2777
2776static int smctr_issue_resume_rx_bdb_cmd(struct net_device *dev, __u16 queue) 2778static int smctr_issue_resume_rx_bdb_cmd(struct net_device *dev, __u16 queue)
@@ -2779,7 +2781,7 @@ static int smctr_issue_resume_rx_bdb_cmd(struct net_device *dev, __u16 queue)
2779 int err; 2781 int err;
2780 2782
2781 if((err = smctr_wait_while_cbusy(dev))) 2783 if((err = smctr_wait_while_cbusy(dev)))
2782 return (err); 2784 return err;
2783 2785
2784 if(queue == MAC_QUEUE) 2786 if(queue == MAC_QUEUE)
2785 tp->sclb_ptr->resume_control = SCLB_RC_RX_MAC_BDB; 2787 tp->sclb_ptr->resume_control = SCLB_RC_RX_MAC_BDB;
@@ -2790,7 +2792,7 @@ static int smctr_issue_resume_rx_bdb_cmd(struct net_device *dev, __u16 queue)
2790 2792
2791 smctr_set_ctrl_attention(dev); 2793 smctr_set_ctrl_attention(dev);
2792 2794
2793 return (0); 2795 return 0;
2794} 2796}
2795 2797
2796static int smctr_issue_resume_rx_fcb_cmd(struct net_device *dev, __u16 queue) 2798static int smctr_issue_resume_rx_fcb_cmd(struct net_device *dev, __u16 queue)
@@ -2801,7 +2803,7 @@ static int smctr_issue_resume_rx_fcb_cmd(struct net_device *dev, __u16 queue)
2801 printk(KERN_DEBUG "%s: smctr_issue_resume_rx_fcb_cmd\n", dev->name); 2803 printk(KERN_DEBUG "%s: smctr_issue_resume_rx_fcb_cmd\n", dev->name);
2802 2804
2803 if(smctr_wait_while_cbusy(dev)) 2805 if(smctr_wait_while_cbusy(dev))
2804 return (-1); 2806 return -1;
2805 2807
2806 if(queue == MAC_QUEUE) 2808 if(queue == MAC_QUEUE)
2807 tp->sclb_ptr->resume_control = SCLB_RC_RX_MAC_FCB; 2809 tp->sclb_ptr->resume_control = SCLB_RC_RX_MAC_FCB;
@@ -2812,7 +2814,7 @@ static int smctr_issue_resume_rx_fcb_cmd(struct net_device *dev, __u16 queue)
2812 2814
2813 smctr_set_ctrl_attention(dev); 2815 smctr_set_ctrl_attention(dev);
2814 2816
2815 return (0); 2817 return 0;
2816} 2818}
2817 2819
2818static int smctr_issue_resume_tx_fcb_cmd(struct net_device *dev, __u16 queue) 2820static int smctr_issue_resume_tx_fcb_cmd(struct net_device *dev, __u16 queue)
@@ -2823,14 +2825,14 @@ static int smctr_issue_resume_tx_fcb_cmd(struct net_device *dev, __u16 queue)
2823 printk(KERN_DEBUG "%s: smctr_issue_resume_tx_fcb_cmd\n", dev->name); 2825 printk(KERN_DEBUG "%s: smctr_issue_resume_tx_fcb_cmd\n", dev->name);
2824 2826
2825 if(smctr_wait_while_cbusy(dev)) 2827 if(smctr_wait_while_cbusy(dev))
2826 return (-1); 2828 return -1;
2827 2829
2828 tp->sclb_ptr->resume_control = (SCLB_RC_TFCB0 << queue); 2830 tp->sclb_ptr->resume_control = (SCLB_RC_TFCB0 << queue);
2829 tp->sclb_ptr->valid_command = SCLB_RESUME_CONTROL_VALID | SCLB_VALID; 2831 tp->sclb_ptr->valid_command = SCLB_RESUME_CONTROL_VALID | SCLB_VALID;
2830 2832
2831 smctr_set_ctrl_attention(dev); 2833 smctr_set_ctrl_attention(dev);
2832 2834
2833 return (0); 2835 return 0;
2834} 2836}
2835 2837
2836static int smctr_issue_test_internal_rom_cmd(struct net_device *dev) 2838static int smctr_issue_test_internal_rom_cmd(struct net_device *dev)
@@ -2840,7 +2842,7 @@ static int smctr_issue_test_internal_rom_cmd(struct net_device *dev)
2840 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST, 2842 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST,
2841 TRC_INTERNAL_ROM_TEST); 2843 TRC_INTERNAL_ROM_TEST);
2842 2844
2843 return (err); 2845 return err;
2844} 2846}
2845 2847
2846static int smctr_issue_test_hic_cmd(struct net_device *dev) 2848static int smctr_issue_test_hic_cmd(struct net_device *dev)
@@ -2850,7 +2852,7 @@ static int smctr_issue_test_hic_cmd(struct net_device *dev)
2850 err = smctr_setup_single_cmd(dev, ACB_CMD_HIC_TEST, 2852 err = smctr_setup_single_cmd(dev, ACB_CMD_HIC_TEST,
2851 TRC_HOST_INTERFACE_REG_TEST); 2853 TRC_HOST_INTERFACE_REG_TEST);
2852 2854
2853 return (err); 2855 return err;
2854} 2856}
2855 2857
2856static int smctr_issue_test_mac_reg_cmd(struct net_device *dev) 2858static int smctr_issue_test_mac_reg_cmd(struct net_device *dev)
@@ -2860,7 +2862,7 @@ static int smctr_issue_test_mac_reg_cmd(struct net_device *dev)
2860 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST, 2862 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST,
2861 TRC_MAC_REGISTERS_TEST); 2863 TRC_MAC_REGISTERS_TEST);
2862 2864
2863 return (err); 2865 return err;
2864} 2866}
2865 2867
2866static int smctr_issue_trc_loopback_cmd(struct net_device *dev) 2868static int smctr_issue_trc_loopback_cmd(struct net_device *dev)
@@ -2870,7 +2872,7 @@ static int smctr_issue_trc_loopback_cmd(struct net_device *dev)
2870 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST, 2872 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST,
2871 TRC_INTERNAL_LOOPBACK); 2873 TRC_INTERNAL_LOOPBACK);
2872 2874
2873 return (err); 2875 return err;
2874} 2876}
2875 2877
2876static int smctr_issue_tri_loopback_cmd(struct net_device *dev) 2878static int smctr_issue_tri_loopback_cmd(struct net_device *dev)
@@ -2880,7 +2882,7 @@ static int smctr_issue_tri_loopback_cmd(struct net_device *dev)
2880 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST, 2882 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST,
2881 TRC_TRI_LOOPBACK); 2883 TRC_TRI_LOOPBACK);
2882 2884
2883 return (err); 2885 return err;
2884} 2886}
2885 2887
2886static int smctr_issue_write_byte_cmd(struct net_device *dev, 2888static int smctr_issue_write_byte_cmd(struct net_device *dev,
@@ -2891,10 +2893,10 @@ static int smctr_issue_write_byte_cmd(struct net_device *dev,
2891 int err; 2893 int err;
2892 2894
2893 if((err = smctr_wait_while_cbusy(dev))) 2895 if((err = smctr_wait_while_cbusy(dev)))
2894 return (err); 2896 return err;
2895 2897
2896 if((err = smctr_wait_cmd(dev))) 2898 if((err = smctr_wait_cmd(dev)))
2897 return (err); 2899 return err;
2898 2900
2899 for(iword = 0, ibyte = 0; iword < (unsigned int)(aword_cnt & 0xff); 2901 for(iword = 0, ibyte = 0; iword < (unsigned int)(aword_cnt & 0xff);
2900 iword++, ibyte += 2) 2902 iword++, ibyte += 2)
@@ -2903,8 +2905,8 @@ static int smctr_issue_write_byte_cmd(struct net_device *dev,
2903 | (*((__u8 *)byte + ibyte + 1)); 2905 | (*((__u8 *)byte + ibyte + 1));
2904 } 2906 }
2905 2907
2906 return (smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_WRITE_VALUE, 2908 return smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_WRITE_VALUE,
2907 aword_cnt)); 2909 aword_cnt);
2908} 2910}
2909 2911
2910static int smctr_issue_write_word_cmd(struct net_device *dev, 2912static int smctr_issue_write_word_cmd(struct net_device *dev,
@@ -2914,10 +2916,10 @@ static int smctr_issue_write_word_cmd(struct net_device *dev,
2914 unsigned int i, err; 2916 unsigned int i, err;
2915 2917
2916 if((err = smctr_wait_while_cbusy(dev))) 2918 if((err = smctr_wait_while_cbusy(dev)))
2917 return (err); 2919 return err;
2918 2920
2919 if((err = smctr_wait_cmd(dev))) 2921 if((err = smctr_wait_cmd(dev)))
2920 return (err); 2922 return err;
2921 2923
2922 for(i = 0; i < (unsigned int)(aword_cnt & 0xff); i++) 2924 for(i = 0; i < (unsigned int)(aword_cnt & 0xff); i++)
2923 tp->misc_command_data[i] = *((__u16 *)word + i); 2925 tp->misc_command_data[i] = *((__u16 *)word + i);
@@ -2925,7 +2927,7 @@ static int smctr_issue_write_word_cmd(struct net_device *dev,
2925 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_WRITE_VALUE, 2927 err = smctr_setup_single_cmd_w_data(dev, ACB_CMD_MCT_WRITE_VALUE,
2926 aword_cnt); 2928 aword_cnt);
2927 2929
2928 return (err); 2930 return err;
2929} 2931}
2930 2932
2931static int smctr_join_complete_state(struct net_device *dev) 2933static int smctr_join_complete_state(struct net_device *dev)
@@ -2935,7 +2937,7 @@ static int smctr_join_complete_state(struct net_device *dev)
2935 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE, 2937 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE,
2936 JS_JOIN_COMPLETE_STATE); 2938 JS_JOIN_COMPLETE_STATE);
2937 2939
2938 return (err); 2940 return err;
2939} 2941}
2940 2942
2941static int smctr_link_tx_fcbs_to_bdbs(struct net_device *dev) 2943static int smctr_link_tx_fcbs_to_bdbs(struct net_device *dev)
@@ -2959,7 +2961,7 @@ static int smctr_link_tx_fcbs_to_bdbs(struct net_device *dev)
2959 } 2961 }
2960 } 2962 }
2961 2963
2962 return (0); 2964 return 0;
2963} 2965}
2964 2966
2965static int smctr_load_firmware(struct net_device *dev) 2967static int smctr_load_firmware(struct net_device *dev)
@@ -2974,7 +2976,7 @@ static int smctr_load_firmware(struct net_device *dev)
2974 2976
2975 if (request_firmware(&fw, "tr_smctr.bin", &dev->dev)) { 2977 if (request_firmware(&fw, "tr_smctr.bin", &dev->dev)) {
2976 printk(KERN_ERR "%s: firmware not found\n", dev->name); 2978 printk(KERN_ERR "%s: firmware not found\n", dev->name);
2977 return (UCODE_NOT_PRESENT); 2979 return UCODE_NOT_PRESENT;
2978 } 2980 }
2979 2981
2980 tp->num_of_tx_buffs = 4; 2982 tp->num_of_tx_buffs = 4;
@@ -3036,7 +3038,7 @@ static int smctr_load_firmware(struct net_device *dev)
3036 smctr_disable_16bit(dev); 3038 smctr_disable_16bit(dev);
3037 out: 3039 out:
3038 release_firmware(fw); 3040 release_firmware(fw);
3039 return (err); 3041 return err;
3040} 3042}
3041 3043
3042static int smctr_load_node_addr(struct net_device *dev) 3044static int smctr_load_node_addr(struct net_device *dev)
@@ -3052,7 +3054,7 @@ static int smctr_load_node_addr(struct net_device *dev)
3052 } 3054 }
3053 dev->addr_len = 6; 3055 dev->addr_len = 6;
3054 3056
3055 return (0); 3057 return 0;
3056} 3058}
3057 3059
3058/* Lobe Media Test. 3060/* Lobe Media Test.
@@ -3146,14 +3148,14 @@ static int smctr_lobe_media_test_cmd(struct net_device *dev)
3146 if(smctr_wait_cmd(dev)) 3148 if(smctr_wait_cmd(dev))
3147 { 3149 {
3148 printk(KERN_ERR "Lobe Failed test state\n"); 3150 printk(KERN_ERR "Lobe Failed test state\n");
3149 return (LOBE_MEDIA_TEST_FAILED); 3151 return LOBE_MEDIA_TEST_FAILED;
3150 } 3152 }
3151 } 3153 }
3152 3154
3153 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST, 3155 err = smctr_setup_single_cmd(dev, ACB_CMD_MCT_TEST,
3154 TRC_LOBE_MEDIA_TEST); 3156 TRC_LOBE_MEDIA_TEST);
3155 3157
3156 return (err); 3158 return err;
3157} 3159}
3158 3160
3159static int smctr_lobe_media_test_state(struct net_device *dev) 3161static int smctr_lobe_media_test_state(struct net_device *dev)
@@ -3163,7 +3165,7 @@ static int smctr_lobe_media_test_state(struct net_device *dev)
3163 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE, 3165 err = smctr_setup_single_cmd(dev, ACB_CMD_CHANGE_JOIN_STATE,
3164 JS_LOBE_TEST_STATE); 3166 JS_LOBE_TEST_STATE);
3165 3167
3166 return (err); 3168 return err;
3167} 3169}
3168 3170
3169static int smctr_make_8025_hdr(struct net_device *dev, 3171static int smctr_make_8025_hdr(struct net_device *dev,
@@ -3212,7 +3214,7 @@ static int smctr_make_8025_hdr(struct net_device *dev,
3212 break; 3214 break;
3213 } 3215 }
3214 3216
3215 return (0); 3217 return 0;
3216} 3218}
3217 3219
3218static int smctr_make_access_pri(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3220static int smctr_make_access_pri(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3225,7 +3227,7 @@ static int smctr_make_access_pri(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3225 tsv->svv[0] = MSB(tp->authorized_access_priority); 3227 tsv->svv[0] = MSB(tp->authorized_access_priority);
3226 tsv->svv[1] = LSB(tp->authorized_access_priority); 3228 tsv->svv[1] = LSB(tp->authorized_access_priority);
3227 3229
3228 return (0); 3230 return 0;
3229} 3231}
3230 3232
3231static int smctr_make_addr_mod(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3233static int smctr_make_addr_mod(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3236,7 +3238,7 @@ static int smctr_make_addr_mod(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3236 tsv->svv[0] = 0; 3238 tsv->svv[0] = 0;
3237 tsv->svv[1] = 0; 3239 tsv->svv[1] = 0;
3238 3240
3239 return (0); 3241 return 0;
3240} 3242}
3241 3243
3242static int smctr_make_auth_funct_class(struct net_device *dev, 3244static int smctr_make_auth_funct_class(struct net_device *dev,
@@ -3250,7 +3252,7 @@ static int smctr_make_auth_funct_class(struct net_device *dev,
3250 tsv->svv[0] = MSB(tp->authorized_function_classes); 3252 tsv->svv[0] = MSB(tp->authorized_function_classes);
3251 tsv->svv[1] = LSB(tp->authorized_function_classes); 3253 tsv->svv[1] = LSB(tp->authorized_function_classes);
3252 3254
3253 return (0); 3255 return 0;
3254} 3256}
3255 3257
3256static int smctr_make_corr(struct net_device *dev, 3258static int smctr_make_corr(struct net_device *dev,
@@ -3262,7 +3264,7 @@ static int smctr_make_corr(struct net_device *dev,
3262 tsv->svv[0] = MSB(correlator); 3264 tsv->svv[0] = MSB(correlator);
3263 tsv->svv[1] = LSB(correlator); 3265 tsv->svv[1] = LSB(correlator);
3264 3266
3265 return (0); 3267 return 0;
3266} 3268}
3267 3269
3268static int smctr_make_funct_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3270static int smctr_make_funct_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3280,7 +3282,7 @@ static int smctr_make_funct_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3280 tsv->svv[2] = MSB(tp->misc_command_data[1]); 3282 tsv->svv[2] = MSB(tp->misc_command_data[1]);
3281 tsv->svv[3] = LSB(tp->misc_command_data[1]); 3283 tsv->svv[3] = LSB(tp->misc_command_data[1]);
3282 3284
3283 return (0); 3285 return 0;
3284} 3286}
3285 3287
3286static int smctr_make_group_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3288static int smctr_make_group_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3305,7 +3307,7 @@ static int smctr_make_group_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3305 tsv->svv[2] == 0x00 && tsv->svv[3] == 0x00) 3307 tsv->svv[2] == 0x00 && tsv->svv[3] == 0x00)
3306 tsv->svv[0] = 0x00; 3308 tsv->svv[0] = 0x00;
3307 3309
3308 return (0); 3310 return 0;
3309} 3311}
3310 3312
3311static int smctr_make_phy_drop_num(struct net_device *dev, 3313static int smctr_make_phy_drop_num(struct net_device *dev,
@@ -3324,7 +3326,7 @@ static int smctr_make_phy_drop_num(struct net_device *dev,
3324 tsv->svv[2] = MSB(tp->misc_command_data[1]); 3326 tsv->svv[2] = MSB(tp->misc_command_data[1]);
3325 tsv->svv[3] = LSB(tp->misc_command_data[1]); 3327 tsv->svv[3] = LSB(tp->misc_command_data[1]);
3326 3328
3327 return (0); 3329 return 0;
3328} 3330}
3329 3331
3330static int smctr_make_product_id(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3332static int smctr_make_product_id(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3337,7 +3339,7 @@ static int smctr_make_product_id(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3337 for(i = 0; i < 18; i++) 3339 for(i = 0; i < 18; i++)
3338 tsv->svv[i] = 0xF0; 3340 tsv->svv[i] = 0xF0;
3339 3341
3340 return (0); 3342 return 0;
3341} 3343}
3342 3344
3343static int smctr_make_station_id(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3345static int smctr_make_station_id(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3358,7 +3360,7 @@ static int smctr_make_station_id(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3358 tsv->svv[4] = MSB(tp->misc_command_data[2]); 3360 tsv->svv[4] = MSB(tp->misc_command_data[2]);
3359 tsv->svv[5] = LSB(tp->misc_command_data[2]); 3361 tsv->svv[5] = LSB(tp->misc_command_data[2]);
3360 3362
3361 return (0); 3363 return 0;
3362} 3364}
3363 3365
3364static int smctr_make_ring_station_status(struct net_device *dev, 3366static int smctr_make_ring_station_status(struct net_device *dev,
@@ -3374,7 +3376,7 @@ static int smctr_make_ring_station_status(struct net_device *dev,
3374 tsv->svv[4] = 0; 3376 tsv->svv[4] = 0;
3375 tsv->svv[5] = 0; 3377 tsv->svv[5] = 0;
3376 3378
3377 return (0); 3379 return 0;
3378} 3380}
3379 3381
3380static int smctr_make_ring_station_version(struct net_device *dev, 3382static int smctr_make_ring_station_version(struct net_device *dev,
@@ -3400,7 +3402,7 @@ static int smctr_make_ring_station_version(struct net_device *dev,
3400 else 3402 else
3401 tsv->svv[9] = 0xc4; /* EBCDIC - D */ 3403 tsv->svv[9] = 0xc4; /* EBCDIC - D */
3402 3404
3403 return (0); 3405 return 0;
3404} 3406}
3405 3407
3406static int smctr_make_tx_status_code(struct net_device *dev, 3408static int smctr_make_tx_status_code(struct net_device *dev,
@@ -3414,7 +3416,7 @@ static int smctr_make_tx_status_code(struct net_device *dev,
3414 /* Stripped frame status of Transmitted Frame */ 3416 /* Stripped frame status of Transmitted Frame */
3415 tsv->svv[1] = tx_fstatus & 0xff; 3417 tsv->svv[1] = tx_fstatus & 0xff;
3416 3418
3417 return (0); 3419 return 0;
3418} 3420}
3419 3421
3420static int smctr_make_upstream_neighbor_addr(struct net_device *dev, 3422static int smctr_make_upstream_neighbor_addr(struct net_device *dev,
@@ -3436,7 +3438,7 @@ static int smctr_make_upstream_neighbor_addr(struct net_device *dev,
3436 tsv->svv[4] = MSB(tp->misc_command_data[2]); 3438 tsv->svv[4] = MSB(tp->misc_command_data[2]);
3437 tsv->svv[5] = LSB(tp->misc_command_data[2]); 3439 tsv->svv[5] = LSB(tp->misc_command_data[2]);
3438 3440
3439 return (0); 3441 return 0;
3440} 3442}
3441 3443
3442static int smctr_make_wrap_data(struct net_device *dev, MAC_SUB_VECTOR *tsv) 3444static int smctr_make_wrap_data(struct net_device *dev, MAC_SUB_VECTOR *tsv)
@@ -3444,7 +3446,7 @@ static int smctr_make_wrap_data(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3444 tsv->svi = WRAP_DATA; 3446 tsv->svi = WRAP_DATA;
3445 tsv->svl = S_WRAP_DATA; 3447 tsv->svl = S_WRAP_DATA;
3446 3448
3447 return (0); 3449 return 0;
3448} 3450}
3449 3451
3450/* 3452/*
@@ -3464,9 +3466,9 @@ static int smctr_open(struct net_device *dev)
3464 3466
3465 err = smctr_init_adapter(dev); 3467 err = smctr_init_adapter(dev);
3466 if(err < 0) 3468 if(err < 0)
3467 return (err); 3469 return err;
3468 3470
3469 return (err); 3471 return err;
3470} 3472}
3471 3473
3472/* Interrupt driven open of Token card. */ 3474/* Interrupt driven open of Token card. */
@@ -3481,9 +3483,9 @@ static int smctr_open_tr(struct net_device *dev)
3481 3483
3482 /* Now we can actually open the adapter. */ 3484 /* Now we can actually open the adapter. */
3483 if(tp->status == OPEN) 3485 if(tp->status == OPEN)
3484 return (0); 3486 return 0;
3485 if(tp->status != INITIALIZED) 3487 if(tp->status != INITIALIZED)
3486 return (-1); 3488 return -1;
3487 3489
3488 /* FIXME: it would work a lot better if we masked the irq sources 3490 /* FIXME: it would work a lot better if we masked the irq sources
3489 on the card here, then we could skip the locking and poll nicely */ 3491 on the card here, then we could skip the locking and poll nicely */
@@ -3560,7 +3562,7 @@ static int smctr_open_tr(struct net_device *dev)
3560out: 3562out:
3561 spin_unlock_irqrestore(&tp->lock, flags); 3563 spin_unlock_irqrestore(&tp->lock, flags);
3562 3564
3563 return (err); 3565 return err;
3564} 3566}
3565 3567
3566/* Check for a network adapter of this type, 3568/* Check for a network adapter of this type,
@@ -3675,7 +3677,7 @@ static int __init smctr_probe1(struct net_device *dev, int ioaddr)
3675 3677
3676 dev->netdev_ops = &smctr_netdev_ops; 3678 dev->netdev_ops = &smctr_netdev_ops;
3677 dev->watchdog_timeo = HZ; 3679 dev->watchdog_timeo = HZ;
3678 return (0); 3680 return 0;
3679 3681
3680out: 3682out:
3681 return err; 3683 return err;
@@ -3699,13 +3701,13 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3699 case INIT: 3701 case INIT:
3700 if((rcode = smctr_rcv_init(dev, rmf, &correlator)) == HARDWARE_FAILED) 3702 if((rcode = smctr_rcv_init(dev, rmf, &correlator)) == HARDWARE_FAILED)
3701 { 3703 {
3702 return (rcode); 3704 return rcode;
3703 } 3705 }
3704 3706
3705 if((err = smctr_send_rsp(dev, rmf, rcode, 3707 if((err = smctr_send_rsp(dev, rmf, rcode,
3706 correlator))) 3708 correlator)))
3707 { 3709 {
3708 return (err); 3710 return err;
3709 } 3711 }
3710 break; 3712 break;
3711 3713
@@ -3713,13 +3715,13 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3713 if((rcode = smctr_rcv_chg_param(dev, rmf, 3715 if((rcode = smctr_rcv_chg_param(dev, rmf,
3714 &correlator)) ==HARDWARE_FAILED) 3716 &correlator)) ==HARDWARE_FAILED)
3715 { 3717 {
3716 return (rcode); 3718 return rcode;
3717 } 3719 }
3718 3720
3719 if((err = smctr_send_rsp(dev, rmf, rcode, 3721 if((err = smctr_send_rsp(dev, rmf, rcode,
3720 correlator))) 3722 correlator)))
3721 { 3723 {
3722 return (err); 3724 return err;
3723 } 3725 }
3724 break; 3726 break;
3725 3727
@@ -3728,16 +3730,16 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3728 rmf, &correlator)) != POSITIVE_ACK) 3730 rmf, &correlator)) != POSITIVE_ACK)
3729 { 3731 {
3730 if(rcode == HARDWARE_FAILED) 3732 if(rcode == HARDWARE_FAILED)
3731 return (rcode); 3733 return rcode;
3732 else 3734 else
3733 return (smctr_send_rsp(dev, rmf, 3735 return smctr_send_rsp(dev, rmf,
3734 rcode, correlator)); 3736 rcode, correlator);
3735 } 3737 }
3736 3738
3737 if((err = smctr_send_rpt_addr(dev, rmf, 3739 if((err = smctr_send_rpt_addr(dev, rmf,
3738 correlator))) 3740 correlator)))
3739 { 3741 {
3740 return (err); 3742 return err;
3741 } 3743 }
3742 break; 3744 break;
3743 3745
@@ -3746,17 +3748,17 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3746 rmf, &correlator)) != POSITIVE_ACK) 3748 rmf, &correlator)) != POSITIVE_ACK)
3747 { 3749 {
3748 if(rcode == HARDWARE_FAILED) 3750 if(rcode == HARDWARE_FAILED)
3749 return (rcode); 3751 return rcode;
3750 else 3752 else
3751 return (smctr_send_rsp(dev, rmf, 3753 return smctr_send_rsp(dev, rmf,
3752 rcode, 3754 rcode,
3753 correlator)); 3755 correlator);
3754 } 3756 }
3755 3757
3756 if((err = smctr_send_rpt_attch(dev, rmf, 3758 if((err = smctr_send_rpt_attch(dev, rmf,
3757 correlator))) 3759 correlator)))
3758 { 3760 {
3759 return (err); 3761 return err;
3760 } 3762 }
3761 break; 3763 break;
3762 3764
@@ -3765,17 +3767,17 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3765 rmf, &correlator)) != POSITIVE_ACK) 3767 rmf, &correlator)) != POSITIVE_ACK)
3766 { 3768 {
3767 if(rcode == HARDWARE_FAILED) 3769 if(rcode == HARDWARE_FAILED)
3768 return (rcode); 3770 return rcode;
3769 else 3771 else
3770 return (smctr_send_rsp(dev, rmf, 3772 return smctr_send_rsp(dev, rmf,
3771 rcode, 3773 rcode,
3772 correlator)); 3774 correlator);
3773 } 3775 }
3774 3776
3775 if((err = smctr_send_rpt_state(dev, rmf, 3777 if((err = smctr_send_rpt_state(dev, rmf,
3776 correlator))) 3778 correlator)))
3777 { 3779 {
3778 return (err); 3780 return err;
3779 } 3781 }
3780 break; 3782 break;
3781 3783
@@ -3786,17 +3788,17 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3786 != POSITIVE_ACK) 3788 != POSITIVE_ACK)
3787 { 3789 {
3788 if(rcode == HARDWARE_FAILED) 3790 if(rcode == HARDWARE_FAILED)
3789 return (rcode); 3791 return rcode;
3790 else 3792 else
3791 return (smctr_send_rsp(dev, rmf, 3793 return smctr_send_rsp(dev, rmf,
3792 rcode, 3794 rcode,
3793 correlator)); 3795 correlator);
3794 } 3796 }
3795 3797
3796 if((err = smctr_send_tx_forward(dev, rmf, 3798 if((err = smctr_send_tx_forward(dev, rmf,
3797 &tx_fstatus)) == HARDWARE_FAILED) 3799 &tx_fstatus)) == HARDWARE_FAILED)
3798 { 3800 {
3799 return (err); 3801 return err;
3800 } 3802 }
3801 3803
3802 if(err == A_FRAME_WAS_FORWARDED) 3804 if(err == A_FRAME_WAS_FORWARDED)
@@ -3805,7 +3807,7 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3805 rmf, tx_fstatus)) 3807 rmf, tx_fstatus))
3806 == HARDWARE_FAILED) 3808 == HARDWARE_FAILED)
3807 { 3809 {
3808 return (err); 3810 return err;
3809 } 3811 }
3810 } 3812 }
3811 break; 3813 break;
@@ -3834,7 +3836,7 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3834 if((err = smctr_send_rsp(dev, rmf,rcode, 3836 if((err = smctr_send_rsp(dev, rmf,rcode,
3835 correlator))) 3837 correlator)))
3836 { 3838 {
3837 return (err); 3839 return err;
3838 } 3840 }
3839 } 3841 }
3840 3842
@@ -3899,7 +3901,7 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3899 err = 0; 3901 err = 0;
3900 } 3902 }
3901 3903
3902 return (err); 3904 return err;
3903} 3905}
3904 3906
3905/* Adapter RAM test. Incremental word ODD boundary data test. */ 3907/* Adapter RAM test. Incremental word ODD boundary data test. */
@@ -3942,7 +3944,7 @@ static int smctr_ram_memory_test(struct net_device *dev)
3942 err_offset = j; 3944 err_offset = j;
3943 err_word = word_read; 3945 err_word = word_read;
3944 err_pattern = word_pattern; 3946 err_pattern = word_pattern;
3945 return (RAM_TEST_FAILED); 3947 return RAM_TEST_FAILED;
3946 } 3948 }
3947 } 3949 }
3948 } 3950 }
@@ -3966,14 +3968,14 @@ static int smctr_ram_memory_test(struct net_device *dev)
3966 err_offset = j; 3968 err_offset = j;
3967 err_word = word_read; 3969 err_word = word_read;
3968 err_pattern = word_pattern; 3970 err_pattern = word_pattern;
3969 return (RAM_TEST_FAILED); 3971 return RAM_TEST_FAILED;
3970 } 3972 }
3971 } 3973 }
3972 } 3974 }
3973 3975
3974 smctr_set_page(dev, (__u8 *)tp->ram_access); 3976 smctr_set_page(dev, (__u8 *)tp->ram_access);
3975 3977
3976 return (0); 3978 return 0;
3977} 3979}
3978 3980
3979static int smctr_rcv_chg_param(struct net_device *dev, MAC_HEADER *rmf, 3981static int smctr_rcv_chg_param(struct net_device *dev, MAC_HEADER *rmf,
@@ -3986,7 +3988,7 @@ static int smctr_rcv_chg_param(struct net_device *dev, MAC_HEADER *rmf,
3986 3988
3987 /* This Frame can only come from a CRS */ 3989 /* This Frame can only come from a CRS */
3988 if((rmf->dc_sc & SC_MASK) != SC_CRS) 3990 if((rmf->dc_sc & SC_MASK) != SC_CRS)
3989 return(E_INAPPROPRIATE_SOURCE_CLASS); 3991 return E_INAPPROPRIATE_SOURCE_CLASS;
3990 3992
3991 /* Remove MVID Length from total length. */ 3993 /* Remove MVID Length from total length. */
3992 vlen = (signed short)rmf->vl - 4; 3994 vlen = (signed short)rmf->vl - 4;
@@ -4058,7 +4060,7 @@ static int smctr_rcv_chg_param(struct net_device *dev, MAC_HEADER *rmf,
4058 } 4060 }
4059 } 4061 }
4060 4062
4061 return (rcode); 4063 return rcode;
4062} 4064}
4063 4065
4064static int smctr_rcv_init(struct net_device *dev, MAC_HEADER *rmf, 4066static int smctr_rcv_init(struct net_device *dev, MAC_HEADER *rmf,
@@ -4071,7 +4073,7 @@ static int smctr_rcv_init(struct net_device *dev, MAC_HEADER *rmf,
4071 4073
4072 /* This Frame can only come from a RPS */ 4074 /* This Frame can only come from a RPS */
4073 if((rmf->dc_sc & SC_MASK) != SC_RPS) 4075 if((rmf->dc_sc & SC_MASK) != SC_RPS)
4074 return (E_INAPPROPRIATE_SOURCE_CLASS); 4076 return E_INAPPROPRIATE_SOURCE_CLASS;
4075 4077
4076 /* Remove MVID Length from total length. */ 4078 /* Remove MVID Length from total length. */
4077 vlen = (signed short)rmf->vl - 4; 4079 vlen = (signed short)rmf->vl - 4;
@@ -4133,7 +4135,7 @@ static int smctr_rcv_init(struct net_device *dev, MAC_HEADER *rmf,
4133 } 4135 }
4134 } 4136 }
4135 4137
4136 return (rcode); 4138 return rcode;
4137} 4139}
4138 4140
4139static int smctr_rcv_tx_forward(struct net_device *dev, MAC_HEADER *rmf) 4141static int smctr_rcv_tx_forward(struct net_device *dev, MAC_HEADER *rmf)
@@ -4145,7 +4147,7 @@ static int smctr_rcv_tx_forward(struct net_device *dev, MAC_HEADER *rmf)
4145 4147
4146 /* This Frame can only come from a CRS */ 4148 /* This Frame can only come from a CRS */
4147 if((rmf->dc_sc & SC_MASK) != SC_CRS) 4149 if((rmf->dc_sc & SC_MASK) != SC_CRS)
4148 return (E_INAPPROPRIATE_SOURCE_CLASS); 4150 return E_INAPPROPRIATE_SOURCE_CLASS;
4149 4151
4150 /* Remove MVID Length from total length */ 4152 /* Remove MVID Length from total length */
4151 vlen = (signed short)rmf->vl - 4; 4153 vlen = (signed short)rmf->vl - 4;
@@ -4193,7 +4195,7 @@ static int smctr_rcv_tx_forward(struct net_device *dev, MAC_HEADER *rmf)
4193 } 4195 }
4194 } 4196 }
4195 4197
4196 return (rcode); 4198 return rcode;
4197} 4199}
4198 4200
4199static int smctr_rcv_rq_addr_state_attch(struct net_device *dev, 4201static int smctr_rcv_rq_addr_state_attch(struct net_device *dev,
@@ -4250,7 +4252,7 @@ static int smctr_rcv_rq_addr_state_attch(struct net_device *dev,
4250 } 4252 }
4251 } 4253 }
4252 4254
4253 return (rcode); 4255 return rcode;
4254} 4256}
4255 4257
4256static int smctr_rcv_unknown(struct net_device *dev, MAC_HEADER *rmf, 4258static int smctr_rcv_unknown(struct net_device *dev, MAC_HEADER *rmf,
@@ -4284,7 +4286,7 @@ static int smctr_rcv_unknown(struct net_device *dev, MAC_HEADER *rmf,
4284 rsv = (MAC_SUB_VECTOR *)((__u32)rsv + rsv->svl); 4286 rsv = (MAC_SUB_VECTOR *)((__u32)rsv + rsv->svl);
4285 } 4287 }
4286 4288
4287 return (E_UNRECOGNIZED_VECTOR_ID); 4289 return E_UNRECOGNIZED_VECTOR_ID;
4288} 4290}
4289 4291
4290/* 4292/*
@@ -4311,7 +4313,7 @@ static int smctr_reset_adapter(struct net_device *dev)
4311 */ 4313 */
4312 outb(tp->trc_mask | CSR_CLRTINT | CSR_CLRCBUSY, ioaddr + CSR); 4314 outb(tp->trc_mask | CSR_CLRTINT | CSR_CLRCBUSY, ioaddr + CSR);
4313 4315
4314 return (0); 4316 return 0;
4315} 4317}
4316 4318
4317static int smctr_restart_tx_chain(struct net_device *dev, short queue) 4319static int smctr_restart_tx_chain(struct net_device *dev, short queue)
@@ -4329,7 +4331,7 @@ static int smctr_restart_tx_chain(struct net_device *dev, short queue)
4329 err = smctr_issue_resume_tx_fcb_cmd(dev, queue); 4331 err = smctr_issue_resume_tx_fcb_cmd(dev, queue);
4330 } 4332 }
4331 4333
4332 return (err); 4334 return err;
4333} 4335}
4334 4336
4335static int smctr_ring_status_chg(struct net_device *dev) 4337static int smctr_ring_status_chg(struct net_device *dev)
@@ -4371,7 +4373,7 @@ static int smctr_ring_status_chg(struct net_device *dev)
4371 } 4373 }
4372 4374
4373 if(!(tp->ring_status_flags & RING_STATUS_CHANGED)) 4375 if(!(tp->ring_status_flags & RING_STATUS_CHANGED))
4374 return (0); 4376 return 0;
4375 4377
4376 switch(tp->ring_status) 4378 switch(tp->ring_status)
4377 { 4379 {
@@ -4421,7 +4423,7 @@ static int smctr_ring_status_chg(struct net_device *dev)
4421 break; 4423 break;
4422 } 4424 }
4423 4425
4424 return (0); 4426 return 0;
4425} 4427}
4426 4428
4427static int smctr_rx_frame(struct net_device *dev) 4429static int smctr_rx_frame(struct net_device *dev)
@@ -4486,7 +4488,7 @@ static int smctr_rx_frame(struct net_device *dev)
4486 break; 4488 break;
4487 } 4489 }
4488 4490
4489 return (err); 4491 return err;
4490} 4492}
4491 4493
4492static int smctr_send_dat(struct net_device *dev) 4494static int smctr_send_dat(struct net_device *dev)
@@ -4502,7 +4504,7 @@ static int smctr_send_dat(struct net_device *dev)
4502 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, 4504 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE,
4503 sizeof(MAC_HEADER))) == (FCBlock *)(-1L)) 4505 sizeof(MAC_HEADER))) == (FCBlock *)(-1L))
4504 { 4506 {
4505 return (OUT_OF_RESOURCES); 4507 return OUT_OF_RESOURCES;
4506 } 4508 }
4507 4509
4508 /* Initialize DAT Data Fields. */ 4510 /* Initialize DAT Data Fields. */
@@ -4524,7 +4526,7 @@ static int smctr_send_dat(struct net_device *dev)
4524 4526
4525 /* Start Transmit. */ 4527 /* Start Transmit. */
4526 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE))) 4528 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE)))
4527 return (err); 4529 return err;
4528 4530
4529 /* Wait for Transmit to Complete */ 4531 /* Wait for Transmit to Complete */
4530 for(i = 0; i < 10000; i++) 4532 for(i = 0; i < 10000; i++)
@@ -4538,7 +4540,7 @@ static int smctr_send_dat(struct net_device *dev)
4538 if(!(fcb->frame_status & FCB_COMMAND_DONE) || 4540 if(!(fcb->frame_status & FCB_COMMAND_DONE) ||
4539 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS)) 4541 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS))
4540 { 4542 {
4541 return (INITIALIZE_FAILED); 4543 return INITIALIZE_FAILED;
4542 } 4544 }
4543 4545
4544 /* De-allocated Tx FCB and Frame Buffer 4546 /* De-allocated Tx FCB and Frame Buffer
@@ -4549,7 +4551,7 @@ static int smctr_send_dat(struct net_device *dev)
4549 tp->tx_queue_status[MAC_QUEUE] = NOT_TRANSMITING; 4551 tp->tx_queue_status[MAC_QUEUE] = NOT_TRANSMITING;
4550 smctr_update_tx_chain(dev, fcb, MAC_QUEUE); 4552 smctr_update_tx_chain(dev, fcb, MAC_QUEUE);
4551 4553
4552 return (0); 4554 return 0;
4553} 4555}
4554 4556
4555static void smctr_timeout(struct net_device *dev) 4557static void smctr_timeout(struct net_device *dev)
@@ -4610,7 +4612,7 @@ static int smctr_send_lobe_media_test(struct net_device *dev)
4610 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(struct trh_hdr) 4612 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(struct trh_hdr)
4611 + S_WRAP_DATA + S_WRAP_DATA)) == (FCBlock *)(-1L)) 4613 + S_WRAP_DATA + S_WRAP_DATA)) == (FCBlock *)(-1L))
4612 { 4614 {
4613 return (OUT_OF_RESOURCES); 4615 return OUT_OF_RESOURCES;
4614 } 4616 }
4615 4617
4616 /* Initialize DAT Data Fields. */ 4618 /* Initialize DAT Data Fields. */
@@ -4639,7 +4641,7 @@ static int smctr_send_lobe_media_test(struct net_device *dev)
4639 /* Start Transmit. */ 4641 /* Start Transmit. */
4640 tmf->vl = SWAP_BYTES(tmf->vl); 4642 tmf->vl = SWAP_BYTES(tmf->vl);
4641 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE))) 4643 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE)))
4642 return (err); 4644 return err;
4643 4645
4644 /* Wait for Transmit to Complete. (10 ms). */ 4646 /* Wait for Transmit to Complete. (10 ms). */
4645 for(i=0; i < 10000; i++) 4647 for(i=0; i < 10000; i++)
@@ -4653,7 +4655,7 @@ static int smctr_send_lobe_media_test(struct net_device *dev)
4653 if(!(fcb->frame_status & FCB_COMMAND_DONE) || 4655 if(!(fcb->frame_status & FCB_COMMAND_DONE) ||
4654 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS)) 4656 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS))
4655 { 4657 {
4656 return (LOBE_MEDIA_TEST_FAILED); 4658 return LOBE_MEDIA_TEST_FAILED;
4657 } 4659 }
4658 4660
4659 /* De-allocated Tx FCB and Frame Buffer 4661 /* De-allocated Tx FCB and Frame Buffer
@@ -4664,7 +4666,7 @@ static int smctr_send_lobe_media_test(struct net_device *dev)
4664 tp->tx_queue_status[MAC_QUEUE] = NOT_TRANSMITING; 4666 tp->tx_queue_status[MAC_QUEUE] = NOT_TRANSMITING;
4665 smctr_update_tx_chain(dev, fcb, MAC_QUEUE); 4667 smctr_update_tx_chain(dev, fcb, MAC_QUEUE);
4666 4668
4667 return (0); 4669 return 0;
4668} 4670}
4669 4671
4670static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf, 4672static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf,
@@ -4679,7 +4681,7 @@ static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf,
4679 + S_ADDRESS_MODIFER + S_GROUP_ADDRESS + S_FUNCTIONAL_ADDRESS)) 4681 + S_ADDRESS_MODIFER + S_GROUP_ADDRESS + S_FUNCTIONAL_ADDRESS))
4680 == (FCBlock *)(-1L)) 4682 == (FCBlock *)(-1L))
4681 { 4683 {
4682 return (0); 4684 return 0;
4683 } 4685 }
4684 4686
4685 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4687 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4722,7 +4724,7 @@ static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf,
4722*/ 4724*/
4723 tmf->vl = SWAP_BYTES(tmf->vl); 4725 tmf->vl = SWAP_BYTES(tmf->vl);
4724 4726
4725 return (smctr_trc_send_packet(dev, fcb, MAC_QUEUE)); 4727 return smctr_trc_send_packet(dev, fcb, MAC_QUEUE);
4726} 4728}
4727 4729
4728static int smctr_send_rpt_attch(struct net_device *dev, MAC_HEADER *rmf, 4730static int smctr_send_rpt_attch(struct net_device *dev, MAC_HEADER *rmf,
@@ -4737,7 +4739,7 @@ static int smctr_send_rpt_attch(struct net_device *dev, MAC_HEADER *rmf,
4737 + S_AUTHORIZED_FUNCTION_CLASS + S_AUTHORIZED_ACCESS_PRIORITY)) 4739 + S_AUTHORIZED_FUNCTION_CLASS + S_AUTHORIZED_ACCESS_PRIORITY))
4738 == (FCBlock *)(-1L)) 4740 == (FCBlock *)(-1L))
4739 { 4741 {
4740 return (0); 4742 return 0;
4741 } 4743 }
4742 4744
4743 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4745 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4776,7 +4778,7 @@ static int smctr_send_rpt_attch(struct net_device *dev, MAC_HEADER *rmf,
4776*/ 4778*/
4777 tmf->vl = SWAP_BYTES(tmf->vl); 4779 tmf->vl = SWAP_BYTES(tmf->vl);
4778 4780
4779 return (smctr_trc_send_packet(dev, fcb, MAC_QUEUE)); 4781 return smctr_trc_send_packet(dev, fcb, MAC_QUEUE);
4780} 4782}
4781 4783
4782static int smctr_send_rpt_state(struct net_device *dev, MAC_HEADER *rmf, 4784static int smctr_send_rpt_state(struct net_device *dev, MAC_HEADER *rmf,
@@ -4791,7 +4793,7 @@ static int smctr_send_rpt_state(struct net_device *dev, MAC_HEADER *rmf,
4791 + S_RING_STATION_STATUS + S_STATION_IDENTIFER)) 4793 + S_RING_STATION_STATUS + S_STATION_IDENTIFER))
4792 == (FCBlock *)(-1L)) 4794 == (FCBlock *)(-1L))
4793 { 4795 {
4794 return (0); 4796 return 0;
4795 } 4797 }
4796 4798
4797 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4799 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4826,7 +4828,7 @@ static int smctr_send_rpt_state(struct net_device *dev, MAC_HEADER *rmf,
4826*/ 4828*/
4827 tmf->vl = SWAP_BYTES(tmf->vl); 4829 tmf->vl = SWAP_BYTES(tmf->vl);
4828 4830
4829 return (smctr_trc_send_packet(dev, fcb, MAC_QUEUE)); 4831 return smctr_trc_send_packet(dev, fcb, MAC_QUEUE);
4830} 4832}
4831 4833
4832static int smctr_send_rpt_tx_forward(struct net_device *dev, 4834static int smctr_send_rpt_tx_forward(struct net_device *dev,
@@ -4839,7 +4841,7 @@ static int smctr_send_rpt_tx_forward(struct net_device *dev,
4839 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(MAC_HEADER) 4841 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(MAC_HEADER)
4840 + S_TRANSMIT_STATUS_CODE)) == (FCBlock *)(-1L)) 4842 + S_TRANSMIT_STATUS_CODE)) == (FCBlock *)(-1L))
4841 { 4843 {
4842 return (0); 4844 return 0;
4843 } 4845 }
4844 4846
4845 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4847 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4862,7 +4864,7 @@ static int smctr_send_rpt_tx_forward(struct net_device *dev,
4862*/ 4864*/
4863 tmf->vl = SWAP_BYTES(tmf->vl); 4865 tmf->vl = SWAP_BYTES(tmf->vl);
4864 4866
4865 return(smctr_trc_send_packet(dev, fcb, MAC_QUEUE)); 4867 return smctr_trc_send_packet(dev, fcb, MAC_QUEUE);
4866} 4868}
4867 4869
4868static int smctr_send_rsp(struct net_device *dev, MAC_HEADER *rmf, 4870static int smctr_send_rsp(struct net_device *dev, MAC_HEADER *rmf,
@@ -4875,7 +4877,7 @@ static int smctr_send_rsp(struct net_device *dev, MAC_HEADER *rmf,
4875 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(MAC_HEADER) 4877 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, sizeof(MAC_HEADER)
4876 + S_CORRELATOR + S_RESPONSE_CODE)) == (FCBlock *)(-1L)) 4878 + S_CORRELATOR + S_RESPONSE_CODE)) == (FCBlock *)(-1L))
4877 { 4879 {
4878 return (0); 4880 return 0;
4879 } 4881 }
4880 4882
4881 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4883 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4888,7 +4890,7 @@ static int smctr_send_rsp(struct net_device *dev, MAC_HEADER *rmf,
4888 tsv = (MAC_SUB_VECTOR *)((__u32)tmf + sizeof(MAC_HEADER)); 4890 tsv = (MAC_SUB_VECTOR *)((__u32)tmf + sizeof(MAC_HEADER));
4889 smctr_make_corr(dev, tsv, correlator); 4891 smctr_make_corr(dev, tsv, correlator);
4890 4892
4891 return (0); 4893 return 0;
4892} 4894}
4893 4895
4894static int smctr_send_rq_init(struct net_device *dev) 4896static int smctr_send_rq_init(struct net_device *dev)
@@ -4907,7 +4909,7 @@ static int smctr_send_rq_init(struct net_device *dev)
4907 + S_RING_STATION_VERSION_NUMBER + S_ADDRESS_MODIFER)) 4909 + S_RING_STATION_VERSION_NUMBER + S_ADDRESS_MODIFER))
4908 == (FCBlock *)(-1L))) 4910 == (FCBlock *)(-1L)))
4909 { 4911 {
4910 return (0); 4912 return 0;
4911 } 4913 }
4912 4914
4913 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr; 4915 tmf = (MAC_HEADER *)fcb->bdb_ptr->data_block_ptr;
@@ -4943,7 +4945,7 @@ static int smctr_send_rq_init(struct net_device *dev)
4943 tmf->vl = SWAP_BYTES(tmf->vl); 4945 tmf->vl = SWAP_BYTES(tmf->vl);
4944 4946
4945 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE))) 4947 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE)))
4946 return (err); 4948 return err;
4947 4949
4948 /* Wait for Transmit to Complete */ 4950 /* Wait for Transmit to Complete */
4949 for(i = 0; i < 10000; i++) 4951 for(i = 0; i < 10000; i++)
@@ -4957,7 +4959,7 @@ static int smctr_send_rq_init(struct net_device *dev)
4957 fstatus = fcb->frame_status; 4959 fstatus = fcb->frame_status;
4958 4960
4959 if(!(fstatus & FCB_COMMAND_DONE)) 4961 if(!(fstatus & FCB_COMMAND_DONE))
4960 return (HARDWARE_FAILED); 4962 return HARDWARE_FAILED;
4961 4963
4962 if(!(fstatus & FCB_TX_STATUS_E)) 4964 if(!(fstatus & FCB_TX_STATUS_E))
4963 count++; 4965 count++;
@@ -4971,7 +4973,7 @@ static int smctr_send_rq_init(struct net_device *dev)
4971 smctr_update_tx_chain(dev, fcb, MAC_QUEUE); 4973 smctr_update_tx_chain(dev, fcb, MAC_QUEUE);
4972 } while(count < 4 && ((fstatus & FCB_TX_AC_BITS) ^ FCB_TX_AC_BITS)); 4974 } while(count < 4 && ((fstatus & FCB_TX_AC_BITS) ^ FCB_TX_AC_BITS));
4973 4975
4974 return (smctr_join_complete_state(dev)); 4976 return smctr_join_complete_state(dev);
4975} 4977}
4976 4978
4977static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf, 4979static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf,
@@ -4984,13 +4986,13 @@ static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf,
4984 4986
4985 /* Check if this is the END POINT of the Transmit Forward Chain. */ 4987 /* Check if this is the END POINT of the Transmit Forward Chain. */
4986 if(rmf->vl <= 18) 4988 if(rmf->vl <= 18)
4987 return (0); 4989 return 0;
4988 4990
4989 /* Allocate Transmit FCB only by requesting 0 bytes 4991 /* Allocate Transmit FCB only by requesting 0 bytes
4990 * of data buffer. 4992 * of data buffer.
4991 */ 4993 */
4992 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, 0)) == (FCBlock *)(-1L)) 4994 if((fcb = smctr_get_tx_fcb(dev, MAC_QUEUE, 0)) == (FCBlock *)(-1L))
4993 return (0); 4995 return 0;
4994 4996
4995 /* Set pointer to Transmit Frame Buffer to the data 4997 /* Set pointer to Transmit Frame Buffer to the data
4996 * portion of the received TX Forward frame, making 4998 * portion of the received TX Forward frame, making
@@ -5006,7 +5008,7 @@ static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf,
5006 fcb->bdb_ptr->buffer_length = rmf->vl - 4 - 2; 5008 fcb->bdb_ptr->buffer_length = rmf->vl - 4 - 2;
5007 5009
5008 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE))) 5010 if((err = smctr_trc_send_packet(dev, fcb, MAC_QUEUE)))
5009 return (err); 5011 return err;
5010 5012
5011 /* Wait for Transmit to Complete */ 5013 /* Wait for Transmit to Complete */
5012 for(i = 0; i < 10000; i++) 5014 for(i = 0; i < 10000; i++)
@@ -5020,7 +5022,7 @@ static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf,
5020 if(!(fcb->frame_status & FCB_COMMAND_DONE)) 5022 if(!(fcb->frame_status & FCB_COMMAND_DONE))
5021 { 5023 {
5022 if((err = smctr_issue_resume_tx_fcb_cmd(dev, MAC_QUEUE))) 5024 if((err = smctr_issue_resume_tx_fcb_cmd(dev, MAC_QUEUE)))
5023 return (err); 5025 return err;
5024 5026
5025 for(i = 0; i < 10000; i++) 5027 for(i = 0; i < 10000; i++)
5026 { 5028 {
@@ -5030,12 +5032,12 @@ static int smctr_send_tx_forward(struct net_device *dev, MAC_HEADER *rmf,
5030 } 5032 }
5031 5033
5032 if(!(fcb->frame_status & FCB_COMMAND_DONE)) 5034 if(!(fcb->frame_status & FCB_COMMAND_DONE))
5033 return (HARDWARE_FAILED); 5035 return HARDWARE_FAILED;
5034 } 5036 }
5035 5037
5036 *tx_fstatus = fcb->frame_status; 5038 *tx_fstatus = fcb->frame_status;
5037 5039
5038 return (A_FRAME_WAS_FORWARDED); 5040 return A_FRAME_WAS_FORWARDED;
5039} 5041}
5040 5042
5041static int smctr_set_auth_access_pri(struct net_device *dev, 5043static int smctr_set_auth_access_pri(struct net_device *dev,
@@ -5044,11 +5046,11 @@ static int smctr_set_auth_access_pri(struct net_device *dev,
5044 struct net_local *tp = netdev_priv(dev); 5046 struct net_local *tp = netdev_priv(dev);
5045 5047
5046 if(rsv->svl != S_AUTHORIZED_ACCESS_PRIORITY) 5048 if(rsv->svl != S_AUTHORIZED_ACCESS_PRIORITY)
5047 return (E_SUB_VECTOR_LENGTH_ERROR); 5049 return E_SUB_VECTOR_LENGTH_ERROR;
5048 5050
5049 tp->authorized_access_priority = (rsv->svv[0] << 8 | rsv->svv[1]); 5051 tp->authorized_access_priority = (rsv->svv[0] << 8 | rsv->svv[1]);
5050 5052
5051 return (POSITIVE_ACK); 5053 return POSITIVE_ACK;
5052} 5054}
5053 5055
5054static int smctr_set_auth_funct_class(struct net_device *dev, 5056static int smctr_set_auth_funct_class(struct net_device *dev,
@@ -5057,22 +5059,22 @@ static int smctr_set_auth_funct_class(struct net_device *dev,
5057 struct net_local *tp = netdev_priv(dev); 5059 struct net_local *tp = netdev_priv(dev);
5058 5060
5059 if(rsv->svl != S_AUTHORIZED_FUNCTION_CLASS) 5061 if(rsv->svl != S_AUTHORIZED_FUNCTION_CLASS)
5060 return (E_SUB_VECTOR_LENGTH_ERROR); 5062 return E_SUB_VECTOR_LENGTH_ERROR;
5061 5063
5062 tp->authorized_function_classes = (rsv->svv[0] << 8 | rsv->svv[1]); 5064 tp->authorized_function_classes = (rsv->svv[0] << 8 | rsv->svv[1]);
5063 5065
5064 return (POSITIVE_ACK); 5066 return POSITIVE_ACK;
5065} 5067}
5066 5068
5067static int smctr_set_corr(struct net_device *dev, MAC_SUB_VECTOR *rsv, 5069static int smctr_set_corr(struct net_device *dev, MAC_SUB_VECTOR *rsv,
5068 __u16 *correlator) 5070 __u16 *correlator)
5069{ 5071{
5070 if(rsv->svl != S_CORRELATOR) 5072 if(rsv->svl != S_CORRELATOR)
5071 return (E_SUB_VECTOR_LENGTH_ERROR); 5073 return E_SUB_VECTOR_LENGTH_ERROR;
5072 5074
5073 *correlator = (rsv->svv[0] << 8 | rsv->svv[1]); 5075 *correlator = (rsv->svv[0] << 8 | rsv->svv[1]);
5074 5076
5075 return (POSITIVE_ACK); 5077 return POSITIVE_ACK;
5076} 5078}
5077 5079
5078static int smctr_set_error_timer_value(struct net_device *dev, 5080static int smctr_set_error_timer_value(struct net_device *dev,
@@ -5082,34 +5084,34 @@ static int smctr_set_error_timer_value(struct net_device *dev,
5082 int err; 5084 int err;
5083 5085
5084 if(rsv->svl != S_ERROR_TIMER_VALUE) 5086 if(rsv->svl != S_ERROR_TIMER_VALUE)
5085 return (E_SUB_VECTOR_LENGTH_ERROR); 5087 return E_SUB_VECTOR_LENGTH_ERROR;
5086 5088
5087 err_tval = (rsv->svv[0] << 8 | rsv->svv[1])*10; 5089 err_tval = (rsv->svv[0] << 8 | rsv->svv[1])*10;
5088 5090
5089 smctr_issue_write_word_cmd(dev, RW_TER_THRESHOLD, &err_tval); 5091 smctr_issue_write_word_cmd(dev, RW_TER_THRESHOLD, &err_tval);
5090 5092
5091 if((err = smctr_wait_cmd(dev))) 5093 if((err = smctr_wait_cmd(dev)))
5092 return (err); 5094 return err;
5093 5095
5094 return (POSITIVE_ACK); 5096 return POSITIVE_ACK;
5095} 5097}
5096 5098
5097static int smctr_set_frame_forward(struct net_device *dev, 5099static int smctr_set_frame_forward(struct net_device *dev,
5098 MAC_SUB_VECTOR *rsv, __u8 dc_sc) 5100 MAC_SUB_VECTOR *rsv, __u8 dc_sc)
5099{ 5101{
5100 if((rsv->svl < 2) || (rsv->svl > S_FRAME_FORWARD)) 5102 if((rsv->svl < 2) || (rsv->svl > S_FRAME_FORWARD))
5101 return (E_SUB_VECTOR_LENGTH_ERROR); 5103 return E_SUB_VECTOR_LENGTH_ERROR;
5102 5104
5103 if((dc_sc & DC_MASK) != DC_CRS) 5105 if((dc_sc & DC_MASK) != DC_CRS)
5104 { 5106 {
5105 if(rsv->svl >= 2 && rsv->svl < 20) 5107 if(rsv->svl >= 2 && rsv->svl < 20)
5106 return (E_TRANSMIT_FORWARD_INVALID); 5108 return E_TRANSMIT_FORWARD_INVALID;
5107 5109
5108 if((rsv->svv[0] != 0) || (rsv->svv[1] != 0)) 5110 if((rsv->svv[0] != 0) || (rsv->svv[1] != 0))
5109 return (E_TRANSMIT_FORWARD_INVALID); 5111 return E_TRANSMIT_FORWARD_INVALID;
5110 } 5112 }
5111 5113
5112 return (POSITIVE_ACK); 5114 return POSITIVE_ACK;
5113} 5115}
5114 5116
5115static int smctr_set_local_ring_num(struct net_device *dev, 5117static int smctr_set_local_ring_num(struct net_device *dev,
@@ -5118,13 +5120,13 @@ static int smctr_set_local_ring_num(struct net_device *dev,
5118 struct net_local *tp = netdev_priv(dev); 5120 struct net_local *tp = netdev_priv(dev);
5119 5121
5120 if(rsv->svl != S_LOCAL_RING_NUMBER) 5122 if(rsv->svl != S_LOCAL_RING_NUMBER)
5121 return (E_SUB_VECTOR_LENGTH_ERROR); 5123 return E_SUB_VECTOR_LENGTH_ERROR;
5122 5124
5123 if(tp->ptr_local_ring_num) 5125 if(tp->ptr_local_ring_num)
5124 *(__u16 *)(tp->ptr_local_ring_num) 5126 *(__u16 *)(tp->ptr_local_ring_num)
5125 = (rsv->svv[0] << 8 | rsv->svv[1]); 5127 = (rsv->svv[0] << 8 | rsv->svv[1]);
5126 5128
5127 return (POSITIVE_ACK); 5129 return POSITIVE_ACK;
5128} 5130}
5129 5131
5130static unsigned short smctr_set_ctrl_attention(struct net_device *dev) 5132static unsigned short smctr_set_ctrl_attention(struct net_device *dev)
@@ -5140,7 +5142,7 @@ static unsigned short smctr_set_ctrl_attention(struct net_device *dev)
5140 outb(tp->trc_mask, ioaddr + CSR); 5142 outb(tp->trc_mask, ioaddr + CSR);
5141 } 5143 }
5142 5144
5143 return (0); 5145 return 0;
5144} 5146}
5145 5147
5146static void smctr_set_multicast_list(struct net_device *dev) 5148static void smctr_set_multicast_list(struct net_device *dev)
@@ -5159,7 +5161,7 @@ static int smctr_set_page(struct net_device *dev, __u8 *buf)
5159 amask = (__u8)((tptr & PR_PAGE_MASK) >> 8); 5161 amask = (__u8)((tptr & PR_PAGE_MASK) >> 8);
5160 outb(amask, dev->base_addr + PR); 5162 outb(amask, dev->base_addr + PR);
5161 5163
5162 return (0); 5164 return 0;
5163} 5165}
5164 5166
5165static int smctr_set_phy_drop(struct net_device *dev, MAC_SUB_VECTOR *rsv) 5167static int smctr_set_phy_drop(struct net_device *dev, MAC_SUB_VECTOR *rsv)
@@ -5167,13 +5169,13 @@ static int smctr_set_phy_drop(struct net_device *dev, MAC_SUB_VECTOR *rsv)
5167 int err; 5169 int err;
5168 5170
5169 if(rsv->svl != S_PHYSICAL_DROP) 5171 if(rsv->svl != S_PHYSICAL_DROP)
5170 return (E_SUB_VECTOR_LENGTH_ERROR); 5172 return E_SUB_VECTOR_LENGTH_ERROR;
5171 5173
5172 smctr_issue_write_byte_cmd(dev, RW_PHYSICAL_DROP_NUMBER, &rsv->svv[0]); 5174 smctr_issue_write_byte_cmd(dev, RW_PHYSICAL_DROP_NUMBER, &rsv->svv[0]);
5173 if((err = smctr_wait_cmd(dev))) 5175 if((err = smctr_wait_cmd(dev)))
5174 return (err); 5176 return err;
5175 5177
5176 return (POSITIVE_ACK); 5178 return POSITIVE_ACK;
5177} 5179}
5178 5180
5179/* Reset the ring speed to the opposite of what it was. This auto-pilot 5181/* Reset the ring speed to the opposite of what it was. This auto-pilot
@@ -5195,16 +5197,16 @@ static int smctr_set_ring_speed(struct net_device *dev)
5195 smctr_reset_adapter(dev); 5197 smctr_reset_adapter(dev);
5196 5198
5197 if((err = smctr_init_card_real(dev))) 5199 if((err = smctr_init_card_real(dev)))
5198 return (err); 5200 return err;
5199 5201
5200 smctr_enable_bic_int(dev); 5202 smctr_enable_bic_int(dev);
5201 5203
5202 if((err = smctr_issue_enable_int_cmd(dev, TRC_INTERRUPT_ENABLE_MASK))) 5204 if((err = smctr_issue_enable_int_cmd(dev, TRC_INTERRUPT_ENABLE_MASK)))
5203 return (err); 5205 return err;
5204 5206
5205 smctr_disable_16bit(dev); 5207 smctr_disable_16bit(dev);
5206 5208
5207 return (0); 5209 return 0;
5208} 5210}
5209 5211
5210static int smctr_set_rx_look_ahead(struct net_device *dev) 5212static int smctr_set_rx_look_ahead(struct net_device *dev)
@@ -5233,7 +5235,7 @@ static int smctr_set_rx_look_ahead(struct net_device *dev)
5233 *((__u16 *)(tp->ram_access)) = sword; 5235 *((__u16 *)(tp->ram_access)) = sword;
5234 } 5236 }
5235 5237
5236 return (0); 5238 return 0;
5237} 5239}
5238 5240
5239static int smctr_set_trc_reset(int ioaddr) 5241static int smctr_set_trc_reset(int ioaddr)
@@ -5243,7 +5245,7 @@ static int smctr_set_trc_reset(int ioaddr)
5243 r = inb(ioaddr + MSR); 5245 r = inb(ioaddr + MSR);
5244 outb(MSR_RST | r, ioaddr + MSR); 5246 outb(MSR_RST | r, ioaddr + MSR);
5245 5247
5246 return (0); 5248 return 0;
5247} 5249}
5248 5250
5249/* 5251/*
@@ -5259,10 +5261,10 @@ static int smctr_setup_single_cmd(struct net_device *dev,
5259 printk(KERN_DEBUG "%s: smctr_setup_single_cmd\n", dev->name); 5261 printk(KERN_DEBUG "%s: smctr_setup_single_cmd\n", dev->name);
5260 5262
5261 if((err = smctr_wait_while_cbusy(dev))) 5263 if((err = smctr_wait_while_cbusy(dev)))
5262 return (err); 5264 return err;
5263 5265
5264 if((err = (unsigned int)smctr_wait_cmd(dev))) 5266 if((err = (unsigned int)smctr_wait_cmd(dev)))
5265 return (err); 5267 return err;
5266 5268
5267 tp->acb_head->cmd_done_status = 0; 5269 tp->acb_head->cmd_done_status = 0;
5268 tp->acb_head->cmd = command; 5270 tp->acb_head->cmd = command;
@@ -5270,7 +5272,7 @@ static int smctr_setup_single_cmd(struct net_device *dev,
5270 5272
5271 err = smctr_issue_resume_acb_cmd(dev); 5273 err = smctr_issue_resume_acb_cmd(dev);
5272 5274
5273 return (err); 5275 return err;
5274} 5276}
5275 5277
5276/* 5278/*
@@ -5287,7 +5289,7 @@ static int smctr_setup_single_cmd_w_data(struct net_device *dev,
5287 tp->acb_head->data_offset_lo 5289 tp->acb_head->data_offset_lo
5288 = (__u16)TRC_POINTER(tp->misc_command_data); 5290 = (__u16)TRC_POINTER(tp->misc_command_data);
5289 5291
5290 return(smctr_issue_resume_acb_cmd(dev)); 5292 return smctr_issue_resume_acb_cmd(dev);
5291} 5293}
5292 5294
5293static char *smctr_malloc(struct net_device *dev, __u16 size) 5295static char *smctr_malloc(struct net_device *dev, __u16 size)
@@ -5298,7 +5300,7 @@ static char *smctr_malloc(struct net_device *dev, __u16 size)
5298 m = (char *)(tp->ram_access + tp->sh_mem_used); 5300 m = (char *)(tp->ram_access + tp->sh_mem_used);
5299 tp->sh_mem_used += (__u32)size; 5301 tp->sh_mem_used += (__u32)size;
5300 5302
5301 return (m); 5303 return m;
5302} 5304}
5303 5305
5304static int smctr_status_chg(struct net_device *dev) 5306static int smctr_status_chg(struct net_device *dev)
@@ -5333,7 +5335,7 @@ static int smctr_status_chg(struct net_device *dev)
5333 break; 5335 break;
5334 } 5336 }
5335 5337
5336 return (0); 5338 return 0;
5337} 5339}
5338 5340
5339static int smctr_trc_send_packet(struct net_device *dev, FCBlock *fcb, 5341static int smctr_trc_send_packet(struct net_device *dev, FCBlock *fcb,
@@ -5355,7 +5357,7 @@ static int smctr_trc_send_packet(struct net_device *dev, FCBlock *fcb,
5355 err = smctr_issue_resume_tx_fcb_cmd(dev, queue); 5357 err = smctr_issue_resume_tx_fcb_cmd(dev, queue);
5356 } 5358 }
5357 5359
5358 return (err); 5360 return err;
5359} 5361}
5360 5362
5361static __u16 smctr_tx_complete(struct net_device *dev, __u16 queue) 5363static __u16 smctr_tx_complete(struct net_device *dev, __u16 queue)
@@ -5409,7 +5411,7 @@ static __u16 smctr_tx_complete(struct net_device *dev, __u16 queue)
5409 break; 5411 break;
5410 } 5412 }
5411 5413
5412 return (err); 5414 return err;
5413} 5415}
5414 5416
5415static unsigned short smctr_tx_move_frame(struct net_device *dev, 5417static unsigned short smctr_tx_move_frame(struct net_device *dev,
@@ -5450,7 +5452,7 @@ static unsigned short smctr_tx_move_frame(struct net_device *dev,
5450 pbuff += len; 5452 pbuff += len;
5451 } 5453 }
5452 5454
5453 return (0); 5455 return 0;
5454} 5456}
5455 5457
5456/* Update the error statistic counters for this adapter. */ 5458/* Update the error statistic counters for this adapter. */
@@ -5493,7 +5495,7 @@ static int smctr_update_err_stats(struct net_device *dev)
5493 if(tstat->token_errors) 5495 if(tstat->token_errors)
5494 tstat->token_errors += *(tp->misc_command_data + 5) >> 8; 5496 tstat->token_errors += *(tp->misc_command_data + 5) >> 8;
5495 5497
5496 return (0); 5498 return 0;
5497} 5499}
5498 5500
5499static int smctr_update_rx_chain(struct net_device *dev, __u16 queue) 5501static int smctr_update_rx_chain(struct net_device *dev, __u16 queue)
@@ -5530,7 +5532,7 @@ static int smctr_update_rx_chain(struct net_device *dev, __u16 queue)
5530 tp->rx_bdb_curr[queue]->back_ptr->info = BDB_NOT_CHAIN_END; 5532 tp->rx_bdb_curr[queue]->back_ptr->info = BDB_NOT_CHAIN_END;
5531 tp->rx_bdb_curr[queue] = bdb; 5533 tp->rx_bdb_curr[queue] = bdb;
5532 5534
5533 return (0); 5535 return 0;
5534} 5536}
5535 5537
5536static int smctr_update_tx_chain(struct net_device *dev, FCBlock *fcb, 5538static int smctr_update_tx_chain(struct net_device *dev, FCBlock *fcb,
@@ -5542,13 +5544,13 @@ static int smctr_update_tx_chain(struct net_device *dev, FCBlock *fcb,
5542 printk(KERN_DEBUG "smctr_update_tx_chain\n"); 5544 printk(KERN_DEBUG "smctr_update_tx_chain\n");
5543 5545
5544 if(tp->num_tx_fcbs_used[queue] <= 0) 5546 if(tp->num_tx_fcbs_used[queue] <= 0)
5545 return (HARDWARE_FAILED); 5547 return HARDWARE_FAILED;
5546 else 5548 else
5547 { 5549 {
5548 if(tp->tx_buff_used[queue] < fcb->memory_alloc) 5550 if(tp->tx_buff_used[queue] < fcb->memory_alloc)
5549 { 5551 {
5550 tp->tx_buff_used[queue] = 0; 5552 tp->tx_buff_used[queue] = 0;
5551 return (HARDWARE_FAILED); 5553 return HARDWARE_FAILED;
5552 } 5554 }
5553 5555
5554 tp->tx_buff_used[queue] -= fcb->memory_alloc; 5556 tp->tx_buff_used[queue] -= fcb->memory_alloc;
@@ -5566,7 +5568,7 @@ static int smctr_update_tx_chain(struct net_device *dev, FCBlock *fcb,
5566 fcb->frame_status = 0; 5568 fcb->frame_status = 0;
5567 tp->tx_fcb_end[queue] = fcb->next_ptr; 5569 tp->tx_fcb_end[queue] = fcb->next_ptr;
5568 netif_wake_queue(dev); 5570 netif_wake_queue(dev);
5569 return (0); 5571 return 0;
5570 } 5572 }
5571} 5573}
5572 5574
@@ -5587,12 +5589,12 @@ static int smctr_wait_cmd(struct net_device *dev)
5587 } 5589 }
5588 5590
5589 if(loop_count == 0) 5591 if(loop_count == 0)
5590 return(HARDWARE_FAILED); 5592 return HARDWARE_FAILED;
5591 5593
5592 if(tp->acb_head->cmd_done_status & 0xff) 5594 if(tp->acb_head->cmd_done_status & 0xff)
5593 return(HARDWARE_FAILED); 5595 return HARDWARE_FAILED;
5594 5596
5595 return (0); 5597 return 0;
5596} 5598}
5597 5599
5598static int smctr_wait_while_cbusy(struct net_device *dev) 5600static int smctr_wait_while_cbusy(struct net_device *dev)
@@ -5624,9 +5626,9 @@ static int smctr_wait_while_cbusy(struct net_device *dev)
5624 } 5626 }
5625 5627
5626 if(timeout) 5628 if(timeout)
5627 return (0); 5629 return 0;
5628 else 5630 else
5629 return (HARDWARE_FAILED); 5631 return HARDWARE_FAILED;
5630} 5632}
5631 5633
5632#ifdef MODULE 5634#ifdef MODULE