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.c61
1 files changed, 26 insertions, 35 deletions
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index 3f2f7843aa4e..7486d0908064 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);
@@ -694,8 +691,6 @@ static void smc_hardware_send_packet( struct net_device * dev )
694 691
695 /* we can send another packet */ 692 /* we can send another packet */
696 netif_wake_queue(dev); 693 netif_wake_queue(dev);
697
698 return;
699} 694}
700 695
701/*------------------------------------------------------------------------- 696/*-------------------------------------------------------------------------
@@ -937,7 +932,7 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
937 if ( !chip_ids[ ( revision_register >> 4 ) & 0xF ] ) { 932 if ( !chip_ids[ ( revision_register >> 4 ) & 0xF ] ) {
938 /* I don't recognize this chip, so... */ 933 /* I don't recognize this chip, so... */
939 printk(CARDNAME ": IO %x: Unrecognized revision register:" 934 printk(CARDNAME ": IO %x: Unrecognized revision register:"
940 " %x, Contact author. \n", ioaddr, revision_register ); 935 " %x, Contact author.\n", ioaddr, revision_register);
941 936
942 retval = -ENODEV; 937 retval = -ENODEV;
943 goto err_out; 938 goto err_out;
@@ -1045,9 +1040,6 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
1045 */ 1040 */
1046 printk("ADDR: %pM\n", dev->dev_addr); 1041 printk("ADDR: %pM\n", dev->dev_addr);
1047 1042
1048 /* set the private data to zero by default */
1049 memset(netdev_priv(dev), 0, sizeof(struct smc_local));
1050
1051 /* Grab the IRQ */ 1043 /* Grab the IRQ */
1052 retval = request_irq(dev->irq, smc_interrupt, 0, DRV_NAME, dev); 1044 retval = request_irq(dev->irq, smc_interrupt, 0, DRV_NAME, dev);
1053 if (retval) { 1045 if (retval) {
@@ -1074,7 +1066,7 @@ static void print_packet( byte * buf, int length )
1074 int remainder; 1066 int remainder;
1075 int lines; 1067 int lines;
1076 1068
1077 printk("Packet of length %d \n", length ); 1069 printk("Packet of length %d\n", length);
1078 lines = length / 16; 1070 lines = length / 16;
1079 remainder = length % 16; 1071 remainder = length % 16;
1080 1072
@@ -1170,7 +1162,7 @@ static void smc_timeout(struct net_device *dev)
1170 /* "kick" the adaptor */ 1162 /* "kick" the adaptor */
1171 smc_reset( dev->base_addr ); 1163 smc_reset( dev->base_addr );
1172 smc_enable( dev->base_addr ); 1164 smc_enable( dev->base_addr );
1173 dev->trans_start = jiffies; 1165 dev->trans_start = jiffies; /* prevent tx timeout */
1174 /* clear anything saved */ 1166 /* clear anything saved */
1175 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL; 1167 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL;
1176 netif_wake_queue(dev); 1168 netif_wake_queue(dev);
@@ -1201,7 +1193,7 @@ static void smc_rcv(struct net_device *dev)
1201 1193
1202 if ( packet_number & FP_RXEMPTY ) { 1194 if ( packet_number & FP_RXEMPTY ) {
1203 /* we got called , but nothing was on the FIFO */ 1195 /* we got called , but nothing was on the FIFO */
1204 PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO. \n")); 1196 PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO.\n"));
1205 /* don't need to restore anything */ 1197 /* don't need to restore anything */
1206 return; 1198 return;
1207 } 1199 }
@@ -1257,14 +1249,14 @@ static void smc_rcv(struct net_device *dev)
1257 to send the DWORDs or the bytes first, or some 1249 to send the DWORDs or the bytes first, or some
1258 mixture. A mixture might improve already slow PIO 1250 mixture. A mixture might improve already slow PIO
1259 performance */ 1251 performance */
1260 PRINTK3((" Reading %d dwords (and %d bytes) \n", 1252 PRINTK3((" Reading %d dwords (and %d bytes)\n",
1261 packet_length >> 2, packet_length & 3 )); 1253 packet_length >> 2, packet_length & 3 ));
1262 insl(ioaddr + DATA_1 , data, packet_length >> 2 ); 1254 insl(ioaddr + DATA_1 , data, packet_length >> 2 );
1263 /* read the left over bytes */ 1255 /* read the left over bytes */
1264 insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC), 1256 insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC),
1265 packet_length & 0x3 ); 1257 packet_length & 0x3 );
1266#else 1258#else
1267 PRINTK3((" Reading %d words and %d byte(s) \n", 1259 PRINTK3((" Reading %d words and %d byte(s)\n",
1268 (packet_length >> 1 ), packet_length & 1 )); 1260 (packet_length >> 1 ), packet_length & 1 ));
1269 insw(ioaddr + DATA_1 , data, packet_length >> 1); 1261 insw(ioaddr + DATA_1 , data, packet_length >> 1);
1270 if ( packet_length & 1 ) { 1262 if ( packet_length & 1 ) {
@@ -1333,7 +1325,7 @@ static void smc_tx( struct net_device * dev )
1333 outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER ); 1325 outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER );
1334 1326
1335 tx_status = inw( ioaddr + DATA_1 ); 1327 tx_status = inw( ioaddr + DATA_1 );
1336 PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status )); 1328 PRINTK3((CARDNAME": TX DONE STATUS: %4x\n", tx_status));
1337 1329
1338 dev->stats.tx_errors++; 1330 dev->stats.tx_errors++;
1339 if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++; 1331 if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++;
@@ -1347,7 +1339,7 @@ static void smc_tx( struct net_device * dev )
1347#endif 1339#endif
1348 1340
1349 if ( tx_status & TS_SUCCESS ) { 1341 if ( tx_status & TS_SUCCESS ) {
1350 printk(CARDNAME": Successful packet caused interrupt \n"); 1342 printk(CARDNAME": Successful packet caused interrupt\n");
1351 } 1343 }
1352 /* re-enable transmit */ 1344 /* re-enable transmit */
1353 SMC_SELECT_BANK( 0 ); 1345 SMC_SELECT_BANK( 0 );
@@ -1361,7 +1353,6 @@ static void smc_tx( struct net_device * dev )
1361 lp->packets_waiting--; 1353 lp->packets_waiting--;
1362 1354
1363 outb( saved_packet, ioaddr + PNR_ARR ); 1355 outb( saved_packet, ioaddr + PNR_ARR );
1364 return;
1365} 1356}
1366 1357
1367/*-------------------------------------------------------------------- 1358/*--------------------------------------------------------------------
@@ -1393,7 +1384,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1393 int handled = 0; 1384 int handled = 0;
1394 1385
1395 1386
1396 PRINTK3((CARDNAME": SMC interrupt started \n")); 1387 PRINTK3((CARDNAME": SMC interrupt started\n"));
1397 1388
1398 saved_bank = inw( ioaddr + BANK_SELECT ); 1389 saved_bank = inw( ioaddr + BANK_SELECT );
1399 1390
@@ -1408,7 +1399,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1408 /* set a timeout value, so I don't stay here forever */ 1399 /* set a timeout value, so I don't stay here forever */
1409 timeout = 4; 1400 timeout = 4;
1410 1401
1411 PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x \n", mask )); 1402 PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x\n", mask));
1412 do { 1403 do {
1413 /* read the status flag, and mask it */ 1404 /* read the status flag, and mask it */
1414 status = inb( ioaddr + INTERRUPT ) & mask; 1405 status = inb( ioaddr + INTERRUPT ) & mask;
@@ -1418,7 +1409,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1418 handled = 1; 1409 handled = 1;
1419 1410
1420 PRINTK3((KERN_WARNING CARDNAME 1411 PRINTK3((KERN_WARNING CARDNAME
1421 ": Handling interrupt status %x \n", status )); 1412 ": Handling interrupt status %x\n", status));
1422 1413
1423 if (status & IM_RCV_INT) { 1414 if (status & IM_RCV_INT) {
1424 /* Got a packet(s). */ 1415 /* Got a packet(s). */
@@ -1452,7 +1443,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1452 1443
1453 } else if (status & IM_ALLOC_INT ) { 1444 } else if (status & IM_ALLOC_INT ) {
1454 PRINTK2((KERN_DEBUG CARDNAME 1445 PRINTK2((KERN_DEBUG CARDNAME
1455 ": Allocation interrupt \n")); 1446 ": Allocation interrupt\n"));
1456 /* clear this interrupt so it doesn't happen again */ 1447 /* clear this interrupt so it doesn't happen again */
1457 mask &= ~IM_ALLOC_INT; 1448 mask &= ~IM_ALLOC_INT;
1458 1449
@@ -1470,9 +1461,9 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1470 dev->stats.rx_fifo_errors++; 1461 dev->stats.rx_fifo_errors++;
1471 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); 1462 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT );
1472 } else if (status & IM_EPH_INT ) { 1463 } else if (status & IM_EPH_INT ) {
1473 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n")); 1464 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT\n"));
1474 } else if (status & IM_ERCV_INT ) { 1465 } else if (status & IM_ERCV_INT ) {
1475 PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT \n")); 1466 PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT\n"));
1476 outb( IM_ERCV_INT, ioaddr + INTERRUPT ); 1467 outb( IM_ERCV_INT, ioaddr + INTERRUPT );
1477 } 1468 }
1478 } while ( timeout -- ); 1469 } while ( timeout -- );
@@ -1482,7 +1473,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1482 SMC_SELECT_BANK( 2 ); 1473 SMC_SELECT_BANK( 2 );
1483 outb( mask, ioaddr + INT_MASK ); 1474 outb( mask, ioaddr + INT_MASK );
1484 1475
1485 PRINTK3(( KERN_WARNING CARDNAME ": MASK is now %x \n", mask )); 1476 PRINTK3((KERN_WARNING CARDNAME ": MASK is now %x\n", mask));
1486 outw( saved_pointer, ioaddr + POINTER ); 1477 outw( saved_pointer, ioaddr + POINTER );
1487 1478
1488 SMC_SELECT_BANK( saved_bank ); 1479 SMC_SELECT_BANK( saved_bank );