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