diff options
Diffstat (limited to 'drivers/net/smc9194.c')
| -rw-r--r-- | drivers/net/smc9194.c | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index f9a960e7fc1f..e94521cf70a1 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; |
| @@ -1075,7 +1071,7 @@ static void print_packet( byte * buf, int length ) | |||
| 1075 | int remainder; | 1071 | int remainder; |
| 1076 | int lines; | 1072 | int lines; |
| 1077 | 1073 | ||
| 1078 | printk("Packet of length %d \n", length ); | 1074 | printk("Packet of length %d\n", length); |
| 1079 | lines = length / 16; | 1075 | lines = length / 16; |
| 1080 | remainder = length % 16; | 1076 | remainder = length % 16; |
| 1081 | 1077 | ||
| @@ -1202,7 +1198,7 @@ static void smc_rcv(struct net_device *dev) | |||
| 1202 | 1198 | ||
| 1203 | if ( packet_number & FP_RXEMPTY ) { | 1199 | if ( packet_number & FP_RXEMPTY ) { |
| 1204 | /* we got called , but nothing was on the FIFO */ | 1200 | /* we got called , but nothing was on the FIFO */ |
| 1205 | PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO. \n")); | 1201 | PRINTK((CARDNAME ": WARNING: smc_rcv with nothing on FIFO.\n")); |
| 1206 | /* don't need to restore anything */ | 1202 | /* don't need to restore anything */ |
| 1207 | return; | 1203 | return; |
| 1208 | } | 1204 | } |
| @@ -1258,14 +1254,14 @@ static void smc_rcv(struct net_device *dev) | |||
| 1258 | to send the DWORDs or the bytes first, or some | 1254 | to send the DWORDs or the bytes first, or some |
| 1259 | mixture. A mixture might improve already slow PIO | 1255 | mixture. A mixture might improve already slow PIO |
| 1260 | performance */ | 1256 | performance */ |
| 1261 | PRINTK3((" Reading %d dwords (and %d bytes) \n", | 1257 | PRINTK3((" Reading %d dwords (and %d bytes)\n", |
| 1262 | packet_length >> 2, packet_length & 3 )); | 1258 | packet_length >> 2, packet_length & 3 )); |
| 1263 | insl(ioaddr + DATA_1 , data, packet_length >> 2 ); | 1259 | insl(ioaddr + DATA_1 , data, packet_length >> 2 ); |
| 1264 | /* read the left over bytes */ | 1260 | /* read the left over bytes */ |
| 1265 | insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC), | 1261 | insb( ioaddr + DATA_1, data + (packet_length & 0xFFFFFC), |
| 1266 | packet_length & 0x3 ); | 1262 | packet_length & 0x3 ); |
| 1267 | #else | 1263 | #else |
| 1268 | PRINTK3((" Reading %d words and %d byte(s) \n", | 1264 | PRINTK3((" Reading %d words and %d byte(s)\n", |
| 1269 | (packet_length >> 1 ), packet_length & 1 )); | 1265 | (packet_length >> 1 ), packet_length & 1 )); |
| 1270 | insw(ioaddr + DATA_1 , data, packet_length >> 1); | 1266 | insw(ioaddr + DATA_1 , data, packet_length >> 1); |
| 1271 | if ( packet_length & 1 ) { | 1267 | if ( packet_length & 1 ) { |
| @@ -1334,7 +1330,7 @@ static void smc_tx( struct net_device * dev ) | |||
| 1334 | outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER ); | 1330 | outw( PTR_AUTOINC | PTR_READ, ioaddr + POINTER ); |
| 1335 | 1331 | ||
| 1336 | tx_status = inw( ioaddr + DATA_1 ); | 1332 | tx_status = inw( ioaddr + DATA_1 ); |
| 1337 | PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status )); | 1333 | PRINTK3((CARDNAME": TX DONE STATUS: %4x\n", tx_status)); |
| 1338 | 1334 | ||
| 1339 | dev->stats.tx_errors++; | 1335 | dev->stats.tx_errors++; |
| 1340 | if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++; | 1336 | if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++; |
| @@ -1348,7 +1344,7 @@ static void smc_tx( struct net_device * dev ) | |||
| 1348 | #endif | 1344 | #endif |
| 1349 | 1345 | ||
| 1350 | if ( tx_status & TS_SUCCESS ) { | 1346 | if ( tx_status & TS_SUCCESS ) { |
| 1351 | printk(CARDNAME": Successful packet caused interrupt \n"); | 1347 | printk(CARDNAME": Successful packet caused interrupt\n"); |
| 1352 | } | 1348 | } |
| 1353 | /* re-enable transmit */ | 1349 | /* re-enable transmit */ |
| 1354 | SMC_SELECT_BANK( 0 ); | 1350 | SMC_SELECT_BANK( 0 ); |
| @@ -1394,7 +1390,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1394 | int handled = 0; | 1390 | int handled = 0; |
| 1395 | 1391 | ||
| 1396 | 1392 | ||
| 1397 | PRINTK3((CARDNAME": SMC interrupt started \n")); | 1393 | PRINTK3((CARDNAME": SMC interrupt started\n")); |
| 1398 | 1394 | ||
| 1399 | saved_bank = inw( ioaddr + BANK_SELECT ); | 1395 | saved_bank = inw( ioaddr + BANK_SELECT ); |
| 1400 | 1396 | ||
| @@ -1409,7 +1405,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1409 | /* set a timeout value, so I don't stay here forever */ | 1405 | /* set a timeout value, so I don't stay here forever */ |
| 1410 | timeout = 4; | 1406 | timeout = 4; |
| 1411 | 1407 | ||
| 1412 | PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x \n", mask )); | 1408 | PRINTK2((KERN_WARNING CARDNAME ": MASK IS %x\n", mask)); |
| 1413 | do { | 1409 | do { |
| 1414 | /* read the status flag, and mask it */ | 1410 | /* read the status flag, and mask it */ |
| 1415 | status = inb( ioaddr + INTERRUPT ) & mask; | 1411 | status = inb( ioaddr + INTERRUPT ) & mask; |
| @@ -1419,7 +1415,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1419 | handled = 1; | 1415 | handled = 1; |
| 1420 | 1416 | ||
| 1421 | PRINTK3((KERN_WARNING CARDNAME | 1417 | PRINTK3((KERN_WARNING CARDNAME |
| 1422 | ": Handling interrupt status %x \n", status )); | 1418 | ": Handling interrupt status %x\n", status)); |
| 1423 | 1419 | ||
| 1424 | if (status & IM_RCV_INT) { | 1420 | if (status & IM_RCV_INT) { |
| 1425 | /* Got a packet(s). */ | 1421 | /* Got a packet(s). */ |
| @@ -1453,7 +1449,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1453 | 1449 | ||
| 1454 | } else if (status & IM_ALLOC_INT ) { | 1450 | } else if (status & IM_ALLOC_INT ) { |
| 1455 | PRINTK2((KERN_DEBUG CARDNAME | 1451 | PRINTK2((KERN_DEBUG CARDNAME |
| 1456 | ": Allocation interrupt \n")); | 1452 | ": Allocation interrupt\n")); |
| 1457 | /* clear this interrupt so it doesn't happen again */ | 1453 | /* clear this interrupt so it doesn't happen again */ |
| 1458 | mask &= ~IM_ALLOC_INT; | 1454 | mask &= ~IM_ALLOC_INT; |
| 1459 | 1455 | ||
| @@ -1471,9 +1467,9 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1471 | dev->stats.rx_fifo_errors++; | 1467 | dev->stats.rx_fifo_errors++; |
| 1472 | outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); | 1468 | outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); |
| 1473 | } else if (status & IM_EPH_INT ) { | 1469 | } else if (status & IM_EPH_INT ) { |
| 1474 | PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n")); | 1470 | PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT\n")); |
| 1475 | } else if (status & IM_ERCV_INT ) { | 1471 | } else if (status & IM_ERCV_INT ) { |
| 1476 | PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT \n")); | 1472 | PRINTK((CARDNAME ": UNSUPPORTED: ERCV INTERRUPT\n")); |
| 1477 | outb( IM_ERCV_INT, ioaddr + INTERRUPT ); | 1473 | outb( IM_ERCV_INT, ioaddr + INTERRUPT ); |
| 1478 | } | 1474 | } |
| 1479 | } while ( timeout -- ); | 1475 | } while ( timeout -- ); |
| @@ -1483,7 +1479,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id) | |||
| 1483 | SMC_SELECT_BANK( 2 ); | 1479 | SMC_SELECT_BANK( 2 ); |
| 1484 | outb( mask, ioaddr + INT_MASK ); | 1480 | outb( mask, ioaddr + INT_MASK ); |
| 1485 | 1481 | ||
| 1486 | PRINTK3(( KERN_WARNING CARDNAME ": MASK is now %x \n", mask )); | 1482 | PRINTK3((KERN_WARNING CARDNAME ": MASK is now %x\n", mask)); |
| 1487 | outw( saved_pointer, ioaddr + POINTER ); | 1483 | outw( saved_pointer, ioaddr + POINTER ); |
| 1488 | 1484 | ||
| 1489 | SMC_SELECT_BANK( saved_bank ); | 1485 | SMC_SELECT_BANK( saved_bank ); |
