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