aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smc9194.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smc9194.c')
-rw-r--r--drivers/net/smc9194.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index f9a960e7fc1f..acb81a876ac6 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -64,7 +64,6 @@ static const char version[] =
64#include <linux/interrupt.h> 64#include <linux/interrupt.h>
65#include <linux/ioport.h> 65#include <linux/ioport.h>
66#include <linux/in.h> 66#include <linux/in.h>
67#include <linux/slab.h>
68#include <linux/string.h> 67#include <linux/string.h>
69#include <linux/init.h> 68#include <linux/init.h>
70#include <linux/crc32.h> 69#include <linux/crc32.h>
@@ -417,7 +416,7 @@ static void smc_shutdown( int ioaddr )
417 416
418 417
419/* 418/*
420 . Function: smc_setmulticast( int ioaddr, int count, dev_mc_list * adds ) 419 . Function: smc_setmulticast( int ioaddr, struct net_device *dev )
421 . Purpose: 420 . Purpose:
422 . This sets the internal hardware table to filter out unwanted multicast 421 . This sets the internal hardware table to filter out unwanted multicast
423 . packets before they take up memory. 422 . packets before they take up memory.
@@ -438,26 +437,23 @@ static void smc_setmulticast(int ioaddr, struct net_device *dev)
438{ 437{
439 int i; 438 int i;
440 unsigned char multicast_table[ 8 ]; 439 unsigned char multicast_table[ 8 ];
441 struct dev_mc_list *cur_addr; 440 struct netdev_hw_addr *ha;
442 /* table for flipping the order of 3 bits */ 441 /* table for flipping the order of 3 bits */
443 unsigned char invert3[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; 442 unsigned char invert3[] = { 0, 4, 2, 6, 1, 5, 3, 7 };
444 443
445 /* start with a table of all zeros: reject all */ 444 /* start with a table of all zeros: reject all */
446 memset( multicast_table, 0, sizeof( multicast_table ) ); 445 memset( multicast_table, 0, sizeof( multicast_table ) );
447 446
448 netdev_for_each_mc_addr(cur_addr, dev) { 447 netdev_for_each_mc_addr(ha, dev) {
449 int position; 448 int position;
450 449
451 /* do we have a pointer here? */
452 if ( !cur_addr )
453 break;
454 /* make sure this is a multicast address - shouldn't this 450 /* make sure this is a multicast address - shouldn't this
455 be a given if we have it here ? */ 451 be a given if we have it here ? */
456 if ( !( *cur_addr->dmi_addr & 1 ) ) 452 if (!(*ha->addr & 1))
457 continue; 453 continue;
458 454
459 /* only use the low order bits */ 455 /* only use the low order bits */
460 position = ether_crc_le(6, cur_addr->dmi_addr) & 0x3f; 456 position = ether_crc_le(6, ha->addr) & 0x3f;
461 457
462 /* do some messy swapping to put the bit in the right spot */ 458 /* do some messy swapping to put the bit in the right spot */
463 multicast_table[invert3[position&7]] |= 459 multicast_table[invert3[position&7]] |=
@@ -529,7 +525,7 @@ static netdev_tx_t smc_wait_to_send_packet(struct sk_buff *skb,
529 numPages = ((length & 0xfffe) + 6) / 256; 525 numPages = ((length & 0xfffe) + 6) / 256;
530 526
531 if (numPages > 7 ) { 527 if (numPages > 7 ) {
532 printk(CARDNAME": Far too big packet error. \n"); 528 printk(CARDNAME": Far too big packet error.\n");
533 /* freeing the packet is a good thing here... but should 529 /* freeing the packet is a good thing here... but should
534 . any packets of this size get down here? */ 530 . any packets of this size get down here? */
535 dev_kfree_skb (skb); 531 dev_kfree_skb (skb);
@@ -571,9 +567,9 @@ static netdev_tx_t smc_wait_to_send_packet(struct sk_buff *skb,
571 if ( !time_out ) { 567 if ( !time_out ) {
572 /* oh well, wait until the chip finds memory later */ 568 /* oh well, wait until the chip finds memory later */
573 SMC_ENABLE_INT( IM_ALLOC_INT ); 569 SMC_ENABLE_INT( IM_ALLOC_INT );
574 PRINTK2((CARDNAME": memory allocation deferred. \n")); 570 PRINTK2((CARDNAME": memory allocation deferred.\n"));
575 /* it's deferred, but I'll handle it later */ 571 /* it's deferred, but I'll handle it later */
576 return NETDEV_TX_OK; 572 return NETDEV_TX_OK;
577 } 573 }
578 /* or YES! I can send the packet now.. */ 574 /* or YES! I can send the packet now.. */
579 smc_hardware_send_packet(dev); 575 smc_hardware_send_packet(dev);
@@ -611,7 +607,7 @@ static void smc_hardware_send_packet( struct net_device * dev )
611 ioaddr = dev->base_addr; 607 ioaddr = dev->base_addr;
612 608
613 if ( !skb ) { 609 if ( !skb ) {
614 PRINTK((CARDNAME": In XMIT with no packet to send \n")); 610 PRINTK((CARDNAME": In XMIT with no packet to send\n"));
615 return; 611 return;
616 } 612 }
617 length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; 613 length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
@@ -621,7 +617,7 @@ static void smc_hardware_send_packet( struct net_device * dev )
621 packet_no = inb( ioaddr + PNR_ARR + 1 ); 617 packet_no = inb( ioaddr + PNR_ARR + 1 );
622 if ( packet_no & 0x80 ) { 618 if ( packet_no & 0x80 ) {
623 /* or isn't there? BAD CHIP! */ 619 /* or isn't there? BAD CHIP! */
624 printk(KERN_DEBUG CARDNAME": Memory allocation failed. \n"); 620 printk(KERN_DEBUG CARDNAME": Memory allocation failed.\n");
625 dev_kfree_skb_any(skb); 621 dev_kfree_skb_any(skb);
626 lp->saved_skb = NULL; 622 lp->saved_skb = NULL;
627 netif_wake_queue(dev); 623 netif_wake_queue(dev);
@@ -686,7 +682,7 @@ static void smc_hardware_send_packet( struct net_device * dev )
686 /* and let the chipset deal with it */ 682 /* and let the chipset deal with it */
687 outw( MC_ENQUEUE , ioaddr + MMU_CMD ); 683 outw( MC_ENQUEUE , ioaddr + MMU_CMD );
688 684
689 PRINTK2((CARDNAME": Sent packet of length %d \n",length)); 685 PRINTK2((CARDNAME": Sent packet of length %d\n", length));
690 686
691 lp->saved_skb = NULL; 687 lp->saved_skb = NULL;
692 dev_kfree_skb_any (skb); 688 dev_kfree_skb_any (skb);
@@ -938,7 +934,7 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
938 if ( !chip_ids[ ( revision_register >> 4 ) & 0xF ] ) { 934 if ( !chip_ids[ ( revision_register >> 4 ) & 0xF ] ) {
939 /* I don't recognize this chip, so... */ 935 /* I don't recognize this chip, so... */
940 printk(CARDNAME ": IO %x: Unrecognized revision register:" 936 printk(CARDNAME ": IO %x: Unrecognized revision register:"
941 " %x, Contact author. \n", ioaddr, revision_register ); 937 " %x, Contact author.\n", ioaddr, revision_register);
942 938
943 retval = -ENODEV; 939 retval = -ENODEV;
944 goto err_out; 940 goto err_out;
@@ -1046,9 +1042,6 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
1046 */ 1042 */
1047 printk("ADDR: %pM\n", dev->dev_addr); 1043 printk("ADDR: %pM\n", dev->dev_addr);
1048 1044
1049 /* set the private data to zero by default */
1050 memset(netdev_priv(dev), 0, sizeof(struct smc_local));
1051
1052 /* Grab the IRQ */ 1045 /* Grab the IRQ */
1053 retval = request_irq(dev->irq, smc_interrupt, 0, DRV_NAME, dev); 1046 retval = request_irq(dev->irq, smc_interrupt, 0, DRV_NAME, dev);
1054 if (retval) { 1047 if (retval) {
@@ -1075,7 +1068,7 @@ static void print_packet( byte * buf, int length )
1075 int remainder; 1068 int remainder;
1076 int lines; 1069 int lines;
1077 1070
1078 printk("Packet of length %d \n", length ); 1071 printk("Packet of length %d\n", length);
1079 lines = length / 16; 1072 lines = length / 16;
1080 remainder = length % 16; 1073 remainder = length % 16;
1081 1074
@@ -1171,7 +1164,7 @@ static void smc_timeout(struct net_device *dev)
1171 /* "kick" the adaptor */ 1164 /* "kick" the adaptor */
1172 smc_reset( dev->base_addr ); 1165 smc_reset( dev->base_addr );
1173 smc_enable( dev->base_addr ); 1166 smc_enable( dev->base_addr );
1174 dev->trans_start = jiffies; 1167 dev->trans_start = jiffies; /* prevent tx timeout */
1175 /* clear anything saved */ 1168 /* clear anything saved */
1176 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL; 1169 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL;
1177 netif_wake_queue(dev); 1170 netif_wake_queue(dev);
@@ -1202,7 +1195,7 @@ static void smc_rcv(struct net_device *dev)
1202 1195
1203 if ( packet_number & FP_RXEMPTY ) { 1196 if ( packet_number & FP_RXEMPTY ) {
1204 /* we got called , but nothing was on the FIFO */ 1197 /* we got called , but nothing was on the FIFO */
1205 PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO. \n")); 1198 PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO.\n"));
1206 /* don't need to restore anything */ 1199 /* don't need to restore anything */
1207 return; 1200 return;
1208 } 1201 }
@@ -1258,14 +1251,14 @@ static void smc_rcv(struct net_device *dev)
1258 to send the DWORDs or the bytes first, or some 1251 to send the DWORDs or the bytes first, or some
1259 mixture. A mixture might improve already slow PIO 1252 mixture. A mixture might improve already slow PIO
1260 performance */ 1253 performance */
1261 PRINTK3((" Reading %d dwords (and %d bytes) \n", 1254 PRINTK3((" Reading %d dwords (and %d bytes)\n",
1262 packet_length >> 2, packet_length & 3 )); 1255 packet_length >> 2, packet_length & 3 ));
1263 insl(ioaddr + DATA_1 , data, packet_length >> 2 ); 1256 insl(ioaddr + DATA_1 , data, packet_length >> 2 );
1264 /* read the left over bytes */ 1257 /* read the left over bytes */
1265 insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC), 1258 insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC),
1266 packet_length & 0x3 ); 1259 packet_length & 0x3 );
1267#else 1260#else
1268 PRINTK3((" Reading %d words and %d byte(s) \n", 1261 PRINTK3((" Reading %d words and %d byte(s)\n",
1269 (packet_length >> 1 ), packet_length & 1 )); 1262 (packet_length >> 1 ), packet_length & 1 ));
1270 insw(ioaddr + DATA_1 , data, packet_length >> 1); 1263 insw(ioaddr + DATA_1 , data, packet_length >> 1);
1271 if ( packet_length & 1 ) { 1264 if ( packet_length & 1 ) {
@@ -1334,7 +1327,7 @@ static void smc_tx( struct net_device * dev )
1334 outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER ); 1327 outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER );
1335 1328
1336 tx_status = inw( ioaddr + DATA_1 ); 1329 tx_status = inw( ioaddr + DATA_1 );
1337 PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status )); 1330 PRINTK3((CARDNAME": TX DONE STATUS: %4x\n", tx_status));
1338 1331
1339 dev->stats.tx_errors++; 1332 dev->stats.tx_errors++;
1340 if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++; 1333 if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++;
@@ -1348,7 +1341,7 @@ static void smc_tx( struct net_device * dev )
1348#endif 1341#endif
1349 1342
1350 if ( tx_status & TS_SUCCESS ) { 1343 if ( tx_status & TS_SUCCESS ) {
1351 printk(CARDNAME": Successful packet caused interrupt \n"); 1344 printk(CARDNAME": Successful packet caused interrupt\n");
1352 } 1345 }
1353 /* re-enable transmit */ 1346 /* re-enable transmit */
1354 SMC_SELECT_BANK( 0 ); 1347 SMC_SELECT_BANK( 0 );
@@ -1394,7 +1387,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1394 int handled = 0; 1387 int handled = 0;
1395 1388
1396 1389
1397 PRINTK3((CARDNAME": SMC interrupt started \n")); 1390 PRINTK3((CARDNAME": SMC interrupt started\n"));
1398 1391
1399 saved_bank = inw( ioaddr + BANK_SELECT ); 1392 saved_bank = inw( ioaddr + BANK_SELECT );
1400 1393
@@ -1409,7 +1402,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1409 /* set a timeout value, so I don't stay here forever */ 1402 /* set a timeout value, so I don't stay here forever */
1410 timeout = 4; 1403 timeout = 4;
1411 1404
1412 PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x \n", mask )); 1405 PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x\n", mask));
1413 do { 1406 do {
1414 /* read the status flag, and mask it */ 1407 /* read the status flag, and mask it */
1415 status = inb( ioaddr + INTERRUPT ) & mask; 1408 status = inb( ioaddr + INTERRUPT ) & mask;
@@ -1419,7 +1412,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1419 handled = 1; 1412 handled = 1;
1420 1413
1421 PRINTK3((KERN_WARNING CARDNAME 1414 PRINTK3((KERN_WARNING CARDNAME
1422 ": Handling interrupt status %x \n", status )); 1415 ": Handling interrupt status %x\n", status));
1423 1416
1424 if (status & IM_RCV_INT) { 1417 if (status & IM_RCV_INT) {
1425 /* Got a packet(s). */ 1418 /* Got a packet(s). */
@@ -1453,7 +1446,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1453 1446
1454 } else if (status & IM_ALLOC_INT ) { 1447 } else if (status & IM_ALLOC_INT ) {
1455 PRINTK2((KERN_DEBUG CARDNAME 1448 PRINTK2((KERN_DEBUG CARDNAME
1456 ": Allocation interrupt \n")); 1449 ": Allocation interrupt\n"));
1457 /* clear this interrupt so it doesn't happen again */ 1450 /* clear this interrupt so it doesn't happen again */
1458 mask &= ~IM_ALLOC_INT; 1451 mask &= ~IM_ALLOC_INT;
1459 1452
@@ -1471,9 +1464,9 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1471 dev->stats.rx_fifo_errors++; 1464 dev->stats.rx_fifo_errors++;
1472 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); 1465 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT );
1473 } else if (status & IM_EPH_INT ) { 1466 } else if (status & IM_EPH_INT ) {
1474 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n")); 1467 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT\n"));
1475 } else if (status & IM_ERCV_INT ) { 1468 } else if (status & IM_ERCV_INT ) {
1476 PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT \n")); 1469 PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT\n"));
1477 outb( IM_ERCV_INT, ioaddr + INTERRUPT ); 1470 outb( IM_ERCV_INT, ioaddr + INTERRUPT );
1478 } 1471 }
1479 } while ( timeout -- ); 1472 } while ( timeout -- );
@@ -1483,7 +1476,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1483 SMC_SELECT_BANK( 2 ); 1476 SMC_SELECT_BANK( 2 );
1484 outb( mask, ioaddr + INT_MASK ); 1477 outb( mask, ioaddr + INT_MASK );
1485 1478
1486 PRINTK3(( KERN_WARNING CARDNAME ": MASK is now %x \n", mask )); 1479 PRINTK3((KERN_WARNING CARDNAME ": MASK is now %x\n", mask));
1487 outw( saved_pointer, ioaddr + POINTER ); 1480 outw( saved_pointer, ioaddr + POINTER );
1488 1481
1489 SMC_SELECT_BANK( saved_bank ); 1482 SMC_SELECT_BANK( saved_bank );