aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/via-velocity.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/via-velocity.c')
-rw-r--r--drivers/net/via-velocity.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index f23d207ad3fc..a0f7820cb54b 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -411,11 +411,11 @@ static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 fla
411 if (val == -1) 411 if (val == -1)
412 *opt |= (def ? flag : 0); 412 *opt |= (def ? flag : 0);
413 else if (val < 0 || val > 1) { 413 else if (val < 0 || val > 1) {
414 printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n", 414 printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",
415 devname, name); 415 devname, name);
416 *opt |= (def ? flag : 0); 416 *opt |= (def ? flag : 0);
417 } else { 417 } else {
418 printk(KERN_INFO "%s: set parameter %s to %s\n", 418 printk(KERN_INFO "%s: set parameter %s to %s\n",
419 devname, name, val ? "TRUE" : "FALSE"); 419 devname, name, val ? "TRUE" : "FALSE");
420 *opt |= (val ? flag : 0); 420 *opt |= (val ? flag : 0);
421 } 421 }
@@ -527,7 +527,7 @@ static void velocity_rx_reset(struct velocity_info *vptr)
527 * hardware. 527 * hardware.
528 */ 528 */
529 529
530static void velocity_init_registers(struct velocity_info *vptr, 530static void velocity_init_registers(struct velocity_info *vptr,
531 enum velocity_init_type type) 531 enum velocity_init_type type)
532{ 532{
533 struct mac_regs __iomem * regs = vptr->mac_regs; 533 struct mac_regs __iomem * regs = vptr->mac_regs;
@@ -559,7 +559,7 @@ static void velocity_init_registers(struct velocity_info *vptr,
559 559
560 mac_clear_isr(regs); 560 mac_clear_isr(regs);
561 writel(CR0_STOP, &regs->CR0Clr); 561 writel(CR0_STOP, &regs->CR0Clr);
562 writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), 562 writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT),
563 &regs->CR0Set); 563 &regs->CR0Set);
564 564
565 break; 565 break;
@@ -695,7 +695,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
695 * can support more than MAX_UNITS. 695 * can support more than MAX_UNITS.
696 */ 696 */
697 if (velocity_nics >= MAX_UNITS) { 697 if (velocity_nics >= MAX_UNITS) {
698 dev_notice(&pdev->dev, "already found %d NICs.\n", 698 dev_notice(&pdev->dev, "already found %d NICs.\n",
699 velocity_nics); 699 velocity_nics);
700 return -ENODEV; 700 return -ENODEV;
701 } 701 }
@@ -705,16 +705,16 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
705 dev_err(&pdev->dev, "allocate net device failed.\n"); 705 dev_err(&pdev->dev, "allocate net device failed.\n");
706 goto out; 706 goto out;
707 } 707 }
708 708
709 /* Chain it all together */ 709 /* Chain it all together */
710 710
711 SET_MODULE_OWNER(dev); 711 SET_MODULE_OWNER(dev);
712 SET_NETDEV_DEV(dev, &pdev->dev); 712 SET_NETDEV_DEV(dev, &pdev->dev);
713 vptr = netdev_priv(dev); 713 vptr = netdev_priv(dev);
714 714
715 715
716 if (first) { 716 if (first) {
717 printk(KERN_INFO "%s Ver. %s\n", 717 printk(KERN_INFO "%s Ver. %s\n",
718 VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); 718 VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION);
719 printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); 719 printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n");
720 printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n"); 720 printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n");
@@ -728,7 +728,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
728 dev->irq = pdev->irq; 728 dev->irq = pdev->irq;
729 729
730 ret = pci_enable_device(pdev); 730 ret = pci_enable_device(pdev);
731 if (ret < 0) 731 if (ret < 0)
732 goto err_free_dev; 732 goto err_free_dev;
733 733
734 ret = velocity_get_pci_info(vptr, pdev); 734 ret = velocity_get_pci_info(vptr, pdev);
@@ -761,16 +761,16 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
761 761
762 velocity_get_options(&vptr->options, velocity_nics, dev->name); 762 velocity_get_options(&vptr->options, velocity_nics, dev->name);
763 763
764 /* 764 /*
765 * Mask out the options cannot be set to the chip 765 * Mask out the options cannot be set to the chip
766 */ 766 */
767 767
768 vptr->options.flags &= info->flags; 768 vptr->options.flags &= info->flags;
769 769
770 /* 770 /*
771 * Enable the chip specified capbilities 771 * Enable the chip specified capbilities
772 */ 772 */
773 773
774 vptr->flags = vptr->options.flags | (info->flags & 0xFF000000UL); 774 vptr->flags = vptr->options.flags | (info->flags & 0xFF000000UL);
775 775
776 vptr->wol_opts = vptr->options.wol_opts; 776 vptr->wol_opts = vptr->options.wol_opts;
@@ -804,9 +804,9 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
804 804
805 velocity_print_info(vptr); 805 velocity_print_info(vptr);
806 pci_set_drvdata(pdev, dev); 806 pci_set_drvdata(pdev, dev);
807 807
808 /* and leave the chip powered down */ 808 /* and leave the chip powered down */
809 809
810 pci_set_power_state(pdev, PCI_D3hot); 810 pci_set_power_state(pdev, PCI_D3hot);
811#ifdef CONFIG_PM 811#ifdef CONFIG_PM
812 { 812 {
@@ -845,9 +845,9 @@ static void __devinit velocity_print_info(struct velocity_info *vptr)
845 struct net_device *dev = vptr->dev; 845 struct net_device *dev = vptr->dev;
846 846
847 printk(KERN_INFO "%s: %s\n", dev->name, get_chip_name(vptr->chip_id)); 847 printk(KERN_INFO "%s: %s\n", dev->name, get_chip_name(vptr->chip_id));
848 printk(KERN_INFO "%s: Ethernet Address: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", 848 printk(KERN_INFO "%s: Ethernet Address: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
849 dev->name, 849 dev->name,
850 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], 850 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
851 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); 851 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
852} 852}
853 853
@@ -888,12 +888,12 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc
888{ 888{
889 if (pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0) 889 if (pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0)
890 return -EIO; 890 return -EIO;
891 891
892 pci_set_master(pdev); 892 pci_set_master(pdev);
893 893
894 vptr->ioaddr = pci_resource_start(pdev, 0); 894 vptr->ioaddr = pci_resource_start(pdev, 0);
895 vptr->memaddr = pci_resource_start(pdev, 1); 895 vptr->memaddr = pci_resource_start(pdev, 1);
896 896
897 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) { 897 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) {
898 dev_err(&pdev->dev, 898 dev_err(&pdev->dev,
899 "region #0 is not an I/O resource, aborting.\n"); 899 "region #0 is not an I/O resource, aborting.\n");
@@ -932,10 +932,10 @@ static int velocity_init_rings(struct velocity_info *vptr)
932 u8 *pool; 932 u8 *pool;
933 933
934 /* 934 /*
935 * Allocate all RD/TD rings a single pool 935 * Allocate all RD/TD rings a single pool
936 */ 936 */
937 937
938 psize = vptr->options.numrx * sizeof(struct rx_desc) + 938 psize = vptr->options.numrx * sizeof(struct rx_desc) +
939 vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq; 939 vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq;
940 940
941 /* 941 /*
@@ -945,7 +945,7 @@ static int velocity_init_rings(struct velocity_info *vptr)
945 pool = pci_alloc_consistent(vptr->pdev, psize, &pool_dma); 945 pool = pci_alloc_consistent(vptr->pdev, psize, &pool_dma);
946 946
947 if (pool == NULL) { 947 if (pool == NULL) {
948 printk(KERN_ERR "%s : DMA memory allocation failed.\n", 948 printk(KERN_ERR "%s : DMA memory allocation failed.\n",
949 vptr->dev->name); 949 vptr->dev->name);
950 return -ENOMEM; 950 return -ENOMEM;
951 } 951 }
@@ -957,11 +957,11 @@ static int velocity_init_rings(struct velocity_info *vptr)
957 vptr->rd_pool_dma = pool_dma; 957 vptr->rd_pool_dma = pool_dma;
958 958
959 tsize = vptr->options.numtx * PKT_BUF_SZ * vptr->num_txq; 959 tsize = vptr->options.numtx * PKT_BUF_SZ * vptr->num_txq;
960 vptr->tx_bufs = pci_alloc_consistent(vptr->pdev, tsize, 960 vptr->tx_bufs = pci_alloc_consistent(vptr->pdev, tsize,
961 &vptr->tx_bufs_dma); 961 &vptr->tx_bufs_dma);
962 962
963 if (vptr->tx_bufs == NULL) { 963 if (vptr->tx_bufs == NULL) {
964 printk(KERN_ERR "%s: DMA memory allocation failed.\n", 964 printk(KERN_ERR "%s: DMA memory allocation failed.\n",
965 vptr->dev->name); 965 vptr->dev->name);
966 pci_free_consistent(vptr->pdev, psize, pool, pool_dma); 966 pci_free_consistent(vptr->pdev, psize, pool, pool_dma);
967 return -ENOMEM; 967 return -ENOMEM;
@@ -994,7 +994,7 @@ static void velocity_free_rings(struct velocity_info *vptr)
994{ 994{
995 int size; 995 int size;
996 996
997 size = vptr->options.numrx * sizeof(struct rx_desc) + 997 size = vptr->options.numrx * sizeof(struct rx_desc) +
998 vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq; 998 vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq;
999 999
1000 pci_free_consistent(vptr->pdev, size, vptr->rd_ring, vptr->rd_pool_dma); 1000 pci_free_consistent(vptr->pdev, size, vptr->rd_ring, vptr->rd_pool_dma);
@@ -1046,7 +1046,7 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1046 break; 1046 break;
1047 } 1047 }
1048 done++; 1048 done++;
1049 dirty = (dirty < vptr->options.numrx - 1) ? dirty + 1 : 0; 1049 dirty = (dirty < vptr->options.numrx - 1) ? dirty + 1 : 0;
1050 } while (dirty != vptr->rd_curr); 1050 } while (dirty != vptr->rd_curr);
1051 1051
1052 if (done) { 1052 if (done) {
@@ -1069,7 +1069,7 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1069static int velocity_init_rd_ring(struct velocity_info *vptr) 1069static int velocity_init_rd_ring(struct velocity_info *vptr)
1070{ 1070{
1071 int ret = -ENOMEM; 1071 int ret = -ENOMEM;
1072 unsigned int rsize = sizeof(struct velocity_rd_info) * 1072 unsigned int rsize = sizeof(struct velocity_rd_info) *
1073 vptr->options.numrx; 1073 vptr->options.numrx;
1074 1074
1075 vptr->rd_info = kmalloc(rsize, GFP_KERNEL); 1075 vptr->rd_info = kmalloc(rsize, GFP_KERNEL);
@@ -1132,14 +1132,14 @@ static void velocity_free_rd_ring(struct velocity_info *vptr)
1132 * Returns zero on success or a negative posix errno code for 1132 * Returns zero on success or a negative posix errno code for
1133 * failure. 1133 * failure.
1134 */ 1134 */
1135 1135
1136static int velocity_init_td_ring(struct velocity_info *vptr) 1136static int velocity_init_td_ring(struct velocity_info *vptr)
1137{ 1137{
1138 int i, j; 1138 int i, j;
1139 dma_addr_t curr; 1139 dma_addr_t curr;
1140 struct tx_desc *td; 1140 struct tx_desc *td;
1141 struct velocity_td_info *td_info; 1141 struct velocity_td_info *td_info;
1142 unsigned int tsize = sizeof(struct velocity_td_info) * 1142 unsigned int tsize = sizeof(struct velocity_td_info) *
1143 vptr->options.numtx; 1143 vptr->options.numtx;
1144 1144
1145 /* Init the TD ring entries */ 1145 /* Init the TD ring entries */
@@ -1177,15 +1177,15 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr,
1177{ 1177{
1178 struct velocity_td_info * td_info = &(vptr->td_infos[q][n]); 1178 struct velocity_td_info * td_info = &(vptr->td_infos[q][n]);
1179 int i; 1179 int i;
1180 1180
1181 if (td_info == NULL) 1181 if (td_info == NULL)
1182 return; 1182 return;
1183 1183
1184 if (td_info->skb) { 1184 if (td_info->skb) {
1185 for (i = 0; i < td_info->nskb_dma; i++) 1185 for (i = 0; i < td_info->nskb_dma; i++)
1186 { 1186 {
1187 if (td_info->skb_dma[i]) { 1187 if (td_info->skb_dma[i]) {
1188 pci_unmap_single(vptr->pdev, td_info->skb_dma[i], 1188 pci_unmap_single(vptr->pdev, td_info->skb_dma[i],
1189 td_info->skb->len, PCI_DMA_TODEVICE); 1189 td_info->skb->len, PCI_DMA_TODEVICE);
1190 td_info->skb_dma[i] = (dma_addr_t) NULL; 1190 td_info->skb_dma[i] = (dma_addr_t) NULL;
1191 } 1191 }
@@ -1202,7 +1202,7 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr,
1202 * Free up the transmit ring for this particular velocity adapter. 1202 * Free up the transmit ring for this particular velocity adapter.
1203 * We free the ring contents but not the ring itself. 1203 * We free the ring contents but not the ring itself.
1204 */ 1204 */
1205 1205
1206static void velocity_free_td_ring(struct velocity_info *vptr) 1206static void velocity_free_td_ring(struct velocity_info *vptr)
1207{ 1207{
1208 int i, j; 1208 int i, j;
@@ -1228,7 +1228,7 @@ static void velocity_free_td_ring(struct velocity_info *vptr)
1228 * any received packets from the receive queue. Hand the ring 1228 * any received packets from the receive queue. Hand the ring
1229 * slots back to the adapter for reuse. 1229 * slots back to the adapter for reuse.
1230 */ 1230 */
1231 1231
1232static int velocity_rx_srv(struct velocity_info *vptr, int status) 1232static int velocity_rx_srv(struct velocity_info *vptr, int status)
1233{ 1233{
1234 struct net_device_stats *stats = &vptr->stats; 1234 struct net_device_stats *stats = &vptr->stats;
@@ -1289,14 +1289,14 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status)
1289 * Process the status bits for the received packet and determine 1289 * Process the status bits for the received packet and determine
1290 * if the checksum was computed and verified by the hardware 1290 * if the checksum was computed and verified by the hardware
1291 */ 1291 */
1292 1292
1293static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb) 1293static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
1294{ 1294{
1295 skb->ip_summed = CHECKSUM_NONE; 1295 skb->ip_summed = CHECKSUM_NONE;
1296 1296
1297 if (rd->rdesc1.CSM & CSM_IPKT) { 1297 if (rd->rdesc1.CSM & CSM_IPKT) {
1298 if (rd->rdesc1.CSM & CSM_IPOK) { 1298 if (rd->rdesc1.CSM & CSM_IPOK) {
1299 if ((rd->rdesc1.CSM & CSM_TCPKT) || 1299 if ((rd->rdesc1.CSM & CSM_TCPKT) ||
1300 (rd->rdesc1.CSM & CSM_UDPKT)) { 1300 (rd->rdesc1.CSM & CSM_UDPKT)) {
1301 if (!(rd->rdesc1.CSM & CSM_TUPOK)) { 1301 if (!(rd->rdesc1.CSM & CSM_TUPOK)) {
1302 return; 1302 return;
@@ -1339,7 +1339,7 @@ static inline int velocity_rx_copy(struct sk_buff **rx_skb, int pkt_size,
1339 *rx_skb = new_skb; 1339 *rx_skb = new_skb;
1340 ret = 0; 1340 ret = 0;
1341 } 1341 }
1342 1342
1343 } 1343 }
1344 return ret; 1344 return ret;
1345} 1345}
@@ -1370,11 +1370,11 @@ static inline void velocity_iph_realign(struct velocity_info *vptr,
1370 * velocity_receive_frame - received packet processor 1370 * velocity_receive_frame - received packet processor
1371 * @vptr: velocity we are handling 1371 * @vptr: velocity we are handling
1372 * @idx: ring index 1372 * @idx: ring index
1373 * 1373 *
1374 * A packet has arrived. We process the packet and if appropriate 1374 * A packet has arrived. We process the packet and if appropriate
1375 * pass the frame up the network stack 1375 * pass the frame up the network stack
1376 */ 1376 */
1377 1377
1378static int velocity_receive_frame(struct velocity_info *vptr, int idx) 1378static int velocity_receive_frame(struct velocity_info *vptr, int idx)
1379{ 1379{
1380 void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int); 1380 void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int);
@@ -1402,7 +1402,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
1402 /* 1402 /*
1403 * Drop frame not meeting IEEE 802.3 1403 * Drop frame not meeting IEEE 802.3
1404 */ 1404 */
1405 1405
1406 if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) { 1406 if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) {
1407 if (rd->rdesc0.RSR & RSR_RL) { 1407 if (rd->rdesc0.RSR & RSR_RL) {
1408 stats->rx_length_errors++; 1408 stats->rx_length_errors++;
@@ -1424,7 +1424,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
1424 PCI_DMA_FROMDEVICE); 1424 PCI_DMA_FROMDEVICE);
1425 1425
1426 skb_put(skb, pkt_len - 4); 1426 skb_put(skb, pkt_len - 4);
1427 skb->protocol = eth_type_trans(skb, skb->dev); 1427 skb->protocol = eth_type_trans(skb, skb->dev);
1428 1428
1429 stats->rx_bytes += pkt_len; 1429 stats->rx_bytes += pkt_len;
1430 netif_rx(skb); 1430 netif_rx(skb);
@@ -1442,7 +1442,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
1442 * requires *64* byte alignment of the buffer which makes life 1442 * requires *64* byte alignment of the buffer which makes life
1443 * less fun than would be ideal. 1443 * less fun than would be ideal.
1444 */ 1444 */
1445 1445
1446static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) 1446static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1447{ 1447{
1448 struct rx_desc *rd = &(vptr->rd_ring[idx]); 1448 struct rx_desc *rd = &(vptr->rd_ring[idx]);
@@ -1459,11 +1459,11 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1459 skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->data & 63); 1459 skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->data & 63);
1460 rd_info->skb->dev = vptr->dev; 1460 rd_info->skb->dev = vptr->dev;
1461 rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); 1461 rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE);
1462 1462
1463 /* 1463 /*
1464 * Fill in the descriptor to match 1464 * Fill in the descriptor to match
1465 */ 1465 */
1466 1466
1467 *((u32 *) & (rd->rdesc0)) = 0; 1467 *((u32 *) & (rd->rdesc0)) = 0;
1468 rd->len = cpu_to_le32(vptr->rx_buf_sz); 1468 rd->len = cpu_to_le32(vptr->rx_buf_sz);
1469 rd->inten = 1; 1469 rd->inten = 1;
@@ -1481,7 +1481,7 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1481 * we can complete and clean up. Update any statistics as 1481 * we can complete and clean up. Update any statistics as
1482 * neccessary/ 1482 * neccessary/
1483 */ 1483 */
1484 1484
1485static int velocity_tx_srv(struct velocity_info *vptr, u32 status) 1485static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
1486{ 1486{
1487 struct tx_desc *td; 1487 struct tx_desc *td;
@@ -1493,7 +1493,7 @@ static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
1493 struct net_device_stats *stats = &vptr->stats; 1493 struct net_device_stats *stats = &vptr->stats;
1494 1494
1495 for (qnum = 0; qnum < vptr->num_txq; qnum++) { 1495 for (qnum = 0; qnum < vptr->num_txq; qnum++) {
1496 for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0; 1496 for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0;
1497 idx = (idx + 1) % vptr->options.numtx) { 1497 idx = (idx + 1) % vptr->options.numtx) {
1498 1498
1499 /* 1499 /*
@@ -1598,12 +1598,12 @@ static void velocity_print_link_status(struct velocity_info *vptr)
1598 * @status: card status 1598 * @status: card status
1599 * 1599 *
1600 * Process an error report from the hardware and attempt to recover 1600 * Process an error report from the hardware and attempt to recover
1601 * the card itself. At the moment we cannot recover from some 1601 * the card itself. At the moment we cannot recover from some
1602 * theoretically impossible errors but this could be fixed using 1602 * theoretically impossible errors but this could be fixed using
1603 * the pci_device_failed logic to bounce the hardware 1603 * the pci_device_failed logic to bounce the hardware
1604 * 1604 *
1605 */ 1605 */
1606 1606
1607static void velocity_error(struct velocity_info *vptr, int status) 1607static void velocity_error(struct velocity_info *vptr, int status)
1608{ 1608{
1609 1609
@@ -1614,7 +1614,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
1614 BYTE_REG_BITS_ON(TXESR_TDSTR, &regs->TXESR); 1614 BYTE_REG_BITS_ON(TXESR_TDSTR, &regs->TXESR);
1615 writew(TRDCSR_RUN, &regs->TDCSRClr); 1615 writew(TRDCSR_RUN, &regs->TDCSRClr);
1616 netif_stop_queue(vptr->dev); 1616 netif_stop_queue(vptr->dev);
1617 1617
1618 /* FIXME: port over the pci_device_failed code and use it 1618 /* FIXME: port over the pci_device_failed code and use it
1619 here */ 1619 here */
1620 } 1620 }
@@ -1627,7 +1627,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
1627 vptr->mii_status = check_connection_type(regs); 1627 vptr->mii_status = check_connection_type(regs);
1628 1628
1629 /* 1629 /*
1630 * If it is a 3119, disable frame bursting in 1630 * If it is a 3119, disable frame bursting in
1631 * halfduplex mode and enable it in fullduplex 1631 * halfduplex mode and enable it in fullduplex
1632 * mode 1632 * mode
1633 */ 1633 */
@@ -1663,10 +1663,10 @@ static void velocity_error(struct velocity_info *vptr, int status)
1663 enable_flow_control_ability(vptr); 1663 enable_flow_control_ability(vptr);
1664 1664
1665 /* 1665 /*
1666 * Re-enable auto-polling because SRCI will disable 1666 * Re-enable auto-polling because SRCI will disable
1667 * auto-polling 1667 * auto-polling
1668 */ 1668 */
1669 1669
1670 enable_mii_autopoll(regs); 1670 enable_mii_autopoll(regs);
1671 1671
1672 if (vptr->mii_status & VELOCITY_LINK_FAIL) 1672 if (vptr->mii_status & VELOCITY_LINK_FAIL)
@@ -1689,7 +1689,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
1689 * Release an transmit buffer. If the buffer was preallocated then 1689 * Release an transmit buffer. If the buffer was preallocated then
1690 * recycle it, if not then unmap the buffer. 1690 * recycle it, if not then unmap the buffer.
1691 */ 1691 */
1692 1692
1693static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_info *tdinfo) 1693static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_info *tdinfo)
1694{ 1694{
1695 struct sk_buff *skb = tdinfo->skb; 1695 struct sk_buff *skb = tdinfo->skb;
@@ -1723,7 +1723,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
1723 * All the ring allocation and set up is done on open for this 1723 * All the ring allocation and set up is done on open for this
1724 * adapter to minimise memory usage when inactive 1724 * adapter to minimise memory usage when inactive
1725 */ 1725 */
1726 1726
1727static int velocity_open(struct net_device *dev) 1727static int velocity_open(struct net_device *dev)
1728{ 1728{
1729 struct velocity_info *vptr = netdev_priv(dev); 1729 struct velocity_info *vptr = netdev_priv(dev);
@@ -1742,10 +1742,10 @@ static int velocity_open(struct net_device *dev)
1742 ret = velocity_init_td_ring(vptr); 1742 ret = velocity_init_td_ring(vptr);
1743 if (ret < 0) 1743 if (ret < 0)
1744 goto err_free_rd_ring; 1744 goto err_free_rd_ring;
1745 1745
1746 /* Ensure chip is running */ 1746 /* Ensure chip is running */
1747 pci_set_power_state(vptr->pdev, PCI_D0); 1747 pci_set_power_state(vptr->pdev, PCI_D0);
1748 1748
1749 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 1749 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
1750 1750
1751 ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED, 1751 ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED,
@@ -1771,7 +1771,7 @@ err_free_desc_rings:
1771 goto out; 1771 goto out;
1772} 1772}
1773 1773
1774/** 1774/**
1775 * velocity_change_mtu - MTU change callback 1775 * velocity_change_mtu - MTU change callback
1776 * @dev: network device 1776 * @dev: network device
1777 * @new_mtu: desired MTU 1777 * @new_mtu: desired MTU
@@ -1780,7 +1780,7 @@ err_free_desc_rings:
1780 * this interface. It gets called on a change by the network layer. 1780 * this interface. It gets called on a change by the network layer.
1781 * Return zero for success or negative posix error code. 1781 * Return zero for success or negative posix error code.
1782 */ 1782 */
1783 1783
1784static int velocity_change_mtu(struct net_device *dev, int new_mtu) 1784static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1785{ 1785{
1786 struct velocity_info *vptr = netdev_priv(dev); 1786 struct velocity_info *vptr = netdev_priv(dev);
@@ -1789,7 +1789,7 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1789 int ret = 0; 1789 int ret = 0;
1790 1790
1791 if ((new_mtu < VELOCITY_MIN_MTU) || new_mtu > (VELOCITY_MAX_MTU)) { 1791 if ((new_mtu < VELOCITY_MIN_MTU) || new_mtu > (VELOCITY_MAX_MTU)) {
1792 VELOCITY_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Invalid MTU.\n", 1792 VELOCITY_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Invalid MTU.\n",
1793 vptr->dev->name); 1793 vptr->dev->name);
1794 return -EINVAL; 1794 return -EINVAL;
1795 } 1795 }
@@ -1837,7 +1837,7 @@ out_unlock:
1837 * Shuts down the internal operations of the velocity and 1837 * Shuts down the internal operations of the velocity and
1838 * disables interrupts, autopolling, transmit and receive 1838 * disables interrupts, autopolling, transmit and receive
1839 */ 1839 */
1840 1840
1841static void velocity_shutdown(struct velocity_info *vptr) 1841static void velocity_shutdown(struct velocity_info *vptr)
1842{ 1842{
1843 struct mac_regs __iomem * regs = vptr->mac_regs; 1843 struct mac_regs __iomem * regs = vptr->mac_regs;
@@ -1868,10 +1868,10 @@ static int velocity_close(struct net_device *dev)
1868 velocity_get_ip(vptr); 1868 velocity_get_ip(vptr);
1869 if (dev->irq != 0) 1869 if (dev->irq != 0)
1870 free_irq(dev->irq, dev); 1870 free_irq(dev->irq, dev);
1871 1871
1872 /* Power down the chip */ 1872 /* Power down the chip */
1873 pci_set_power_state(vptr->pdev, PCI_D3hot); 1873 pci_set_power_state(vptr->pdev, PCI_D3hot);
1874 1874
1875 /* Free the resources */ 1875 /* Free the resources */
1876 velocity_free_td_ring(vptr); 1876 velocity_free_td_ring(vptr);
1877 velocity_free_rd_ring(vptr); 1877 velocity_free_rd_ring(vptr);
@@ -1889,7 +1889,7 @@ static int velocity_close(struct net_device *dev)
1889 * Called by the networ layer to request a packet is queued to 1889 * Called by the networ layer to request a packet is queued to
1890 * the velocity. Returns zero on success. 1890 * the velocity. Returns zero on success.
1891 */ 1891 */
1892 1892
1893static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) 1893static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1894{ 1894{
1895 struct velocity_info *vptr = netdev_priv(dev); 1895 struct velocity_info *vptr = netdev_priv(dev);
@@ -1919,7 +1919,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1919 td_ptr->td_buf[0].queue = 0; 1919 td_ptr->td_buf[0].queue = 0;
1920 1920
1921 /* 1921 /*
1922 * Pad short frames. 1922 * Pad short frames.
1923 */ 1923 */
1924 if (pktlen < ETH_ZLEN) { 1924 if (pktlen < ETH_ZLEN) {
1925 /* Cannot occur until ZC support */ 1925 /* Cannot occur until ZC support */
@@ -1942,7 +1942,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1942 if (nfrags > 6) { 1942 if (nfrags > 6) {
1943 memcpy(tdinfo->buf, skb->data, skb->len); 1943 memcpy(tdinfo->buf, skb->data, skb->len);
1944 tdinfo->skb_dma[0] = tdinfo->buf_dma; 1944 tdinfo->skb_dma[0] = tdinfo->buf_dma;
1945 td_ptr->tdesc0.pktsize = 1945 td_ptr->tdesc0.pktsize =
1946 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); 1946 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
1947 td_ptr->td_buf[0].pa_high = 0; 1947 td_ptr->td_buf[0].pa_high = 0;
1948 td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; 1948 td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize;
@@ -2043,7 +2043,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2043 * and need to identify initially if we are, and if not exit as 2043 * and need to identify initially if we are, and if not exit as
2044 * efficiently as possible. 2044 * efficiently as possible.
2045 */ 2045 */
2046 2046
2047static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs) 2047static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs)
2048{ 2048{
2049 struct net_device *dev = dev_instance; 2049 struct net_device *dev = dev_instance;
@@ -2067,7 +2067,7 @@ static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs)
2067 * Keep processing the ISR until we have completed 2067 * Keep processing the ISR until we have completed
2068 * processing and the isr_status becomes zero 2068 * processing and the isr_status becomes zero
2069 */ 2069 */
2070 2070
2071 while (isr_status != 0) { 2071 while (isr_status != 0) {
2072 mac_write_isr(vptr->mac_regs, isr_status); 2072 mac_write_isr(vptr->mac_regs, isr_status);
2073 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) 2073 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
@@ -2079,7 +2079,7 @@ static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs)
2079 isr_status = mac_read_isr(vptr->mac_regs); 2079 isr_status = mac_read_isr(vptr->mac_regs);
2080 if (max_count > vptr->options.int_works) 2080 if (max_count > vptr->options.int_works)
2081 { 2081 {
2082 printk(KERN_WARNING "%s: excessive work at interrupt.\n", 2082 printk(KERN_WARNING "%s: excessive work at interrupt.\n",
2083 dev->name); 2083 dev->name);
2084 max_count = 0; 2084 max_count = 0;
2085 } 2085 }
@@ -2099,7 +2099,7 @@ static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs)
2099 * for a velocity adapter. Reload the CAMs with the new address 2099 * for a velocity adapter. Reload the CAMs with the new address
2100 * filter ruleset. 2100 * filter ruleset.
2101 */ 2101 */
2102 2102
2103static void velocity_set_multi(struct net_device *dev) 2103static void velocity_set_multi(struct net_device *dev)
2104{ 2104{
2105 struct velocity_info *vptr = netdev_priv(dev); 2105 struct velocity_info *vptr = netdev_priv(dev);
@@ -2146,11 +2146,11 @@ static void velocity_set_multi(struct net_device *dev)
2146 * the hardware into the counters before letting the network 2146 * the hardware into the counters before letting the network
2147 * layer display them. 2147 * layer display them.
2148 */ 2148 */
2149 2149
2150static struct net_device_stats *velocity_get_stats(struct net_device *dev) 2150static struct net_device_stats *velocity_get_stats(struct net_device *dev)
2151{ 2151{
2152 struct velocity_info *vptr = netdev_priv(dev); 2152 struct velocity_info *vptr = netdev_priv(dev);
2153 2153
2154 /* If the hardware is down, don't touch MII */ 2154 /* If the hardware is down, don't touch MII */
2155 if(!netif_running(dev)) 2155 if(!netif_running(dev))
2156 return &vptr->stats; 2156 return &vptr->stats;
@@ -2189,7 +2189,7 @@ static struct net_device_stats *velocity_get_stats(struct net_device *dev)
2189 * Called when the user issues an ioctl request to the network 2189 * Called when the user issues an ioctl request to the network
2190 * device in question. The velocity interface supports MII. 2190 * device in question. The velocity interface supports MII.
2191 */ 2191 */
2192 2192
2193static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 2193static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2194{ 2194{
2195 struct velocity_info *vptr = netdev_priv(dev); 2195 struct velocity_info *vptr = netdev_priv(dev);
@@ -2197,10 +2197,10 @@ static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2197 2197
2198 /* If we are asked for information and the device is power 2198 /* If we are asked for information and the device is power
2199 saving then we need to bring the device back up to talk to it */ 2199 saving then we need to bring the device back up to talk to it */
2200 2200
2201 if (!netif_running(dev)) 2201 if (!netif_running(dev))
2202 pci_set_power_state(vptr->pdev, PCI_D0); 2202 pci_set_power_state(vptr->pdev, PCI_D0);
2203 2203
2204 switch (cmd) { 2204 switch (cmd) {
2205 case SIOCGMIIPHY: /* Get address of MII PHY in use. */ 2205 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
2206 case SIOCGMIIREG: /* Read MII PHY register. */ 2206 case SIOCGMIIREG: /* Read MII PHY register. */
@@ -2213,8 +2213,8 @@ static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2213 } 2213 }
2214 if (!netif_running(dev)) 2214 if (!netif_running(dev))
2215 pci_set_power_state(vptr->pdev, PCI_D3hot); 2215 pci_set_power_state(vptr->pdev, PCI_D3hot);
2216 2216
2217 2217
2218 return ret; 2218 return ret;
2219} 2219}
2220 2220
@@ -2222,7 +2222,7 @@ static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2222 * Definition for our device driver. The PCI layer interface 2222 * Definition for our device driver. The PCI layer interface
2223 * uses this to handle all our card discover and plugging 2223 * uses this to handle all our card discover and plugging
2224 */ 2224 */
2225 2225
2226static struct pci_driver velocity_driver = { 2226static struct pci_driver velocity_driver = {
2227 .name = VELOCITY_NAME, 2227 .name = VELOCITY_NAME,
2228 .id_table = velocity_id_table, 2228 .id_table = velocity_id_table,
@@ -2242,7 +2242,7 @@ static struct pci_driver velocity_driver = {
2242 * the probe functions for each velocity adapter installed 2242 * the probe functions for each velocity adapter installed
2243 * in the system. 2243 * in the system.
2244 */ 2244 */
2245 2245
2246static int __init velocity_init_module(void) 2246static int __init velocity_init_module(void)
2247{ 2247{
2248 int ret; 2248 int ret;
@@ -2258,11 +2258,11 @@ static int __init velocity_init_module(void)
2258 * velocity_cleanup - module unload 2258 * velocity_cleanup - module unload
2259 * 2259 *
2260 * When the velocity hardware is unloaded this function is called. 2260 * When the velocity hardware is unloaded this function is called.
2261 * It will clean up the notifiers and the unregister the PCI 2261 * It will clean up the notifiers and the unregister the PCI
2262 * driver interface for this hardware. This in turn cleans up 2262 * driver interface for this hardware. This in turn cleans up
2263 * all discovered interfaces before returning from the function 2263 * all discovered interfaces before returning from the function
2264 */ 2264 */
2265 2265
2266static void __exit velocity_cleanup_module(void) 2266static void __exit velocity_cleanup_module(void)
2267{ 2267{
2268 velocity_unregister_notifier(); 2268 velocity_unregister_notifier();
@@ -2276,8 +2276,8 @@ module_exit(velocity_cleanup_module);
2276/* 2276/*
2277 * MII access , media link mode setting functions 2277 * MII access , media link mode setting functions
2278 */ 2278 */
2279 2279
2280 2280
2281/** 2281/**
2282 * mii_init - set up MII 2282 * mii_init - set up MII
2283 * @vptr: velocity adapter 2283 * @vptr: velocity adapter
@@ -2285,7 +2285,7 @@ module_exit(velocity_cleanup_module);
2285 * 2285 *
2286 * Set up the PHY for the current link state. 2286 * Set up the PHY for the current link state.
2287 */ 2287 */
2288 2288
2289static void mii_init(struct velocity_info *vptr, u32 mii_status) 2289static void mii_init(struct velocity_info *vptr, u32 mii_status)
2290{ 2290{
2291 u16 BMCR; 2291 u16 BMCR;
@@ -2298,7 +2298,7 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status)
2298 MII_REG_BITS_OFF((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs); 2298 MII_REG_BITS_OFF((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs);
2299 /* 2299 /*
2300 * Turn on ECHODIS bit in NWay-forced full mode and turn it 2300 * Turn on ECHODIS bit in NWay-forced full mode and turn it
2301 * off it in NWay-forced half mode for NWay-forced v.s. 2301 * off it in NWay-forced half mode for NWay-forced v.s.
2302 * legacy-forced issue. 2302 * legacy-forced issue.
2303 */ 2303 */
2304 if (vptr->mii_status & VELOCITY_DUPLEX_FULL) 2304 if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
@@ -2318,7 +2318,7 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status)
2318 MII_REG_BITS_ON((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs); 2318 MII_REG_BITS_ON((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs);
2319 /* 2319 /*
2320 * Turn on ECHODIS bit in NWay-forced full mode and turn it 2320 * Turn on ECHODIS bit in NWay-forced full mode and turn it
2321 * off it in NWay-forced half mode for NWay-forced v.s. 2321 * off it in NWay-forced half mode for NWay-forced v.s.
2322 * legacy-forced issue 2322 * legacy-forced issue
2323 */ 2323 */
2324 if (vptr->mii_status & VELOCITY_DUPLEX_FULL) 2324 if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
@@ -2330,11 +2330,11 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status)
2330 case PHYID_MARVELL_1000: 2330 case PHYID_MARVELL_1000:
2331 case PHYID_MARVELL_1000S: 2331 case PHYID_MARVELL_1000S:
2332 /* 2332 /*
2333 * Assert CRS on Transmit 2333 * Assert CRS on Transmit
2334 */ 2334 */
2335 MII_REG_BITS_ON(PSCR_ACRSTX, MII_REG_PSCR, vptr->mac_regs); 2335 MII_REG_BITS_ON(PSCR_ACRSTX, MII_REG_PSCR, vptr->mac_regs);
2336 /* 2336 /*
2337 * Reset to hardware default 2337 * Reset to hardware default
2338 */ 2338 */
2339 MII_REG_BITS_ON((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs); 2339 MII_REG_BITS_ON((ANAR_ASMDIR | ANAR_PAUSE), MII_REG_ANAR, vptr->mac_regs);
2340 break; 2340 break;
@@ -2354,7 +2354,7 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status)
2354 * 2354 *
2355 * Turn off the autopoll and wait for it to disable on the chip 2355 * Turn off the autopoll and wait for it to disable on the chip
2356 */ 2356 */
2357 2357
2358static void safe_disable_mii_autopoll(struct mac_regs __iomem * regs) 2358static void safe_disable_mii_autopoll(struct mac_regs __iomem * regs)
2359{ 2359{
2360 u16 ww; 2360 u16 ww;
@@ -2408,7 +2408,7 @@ static void enable_mii_autopoll(struct mac_regs __iomem * regs)
2408 * Perform a single read of an MII 16bit register. Returns zero 2408 * Perform a single read of an MII 16bit register. Returns zero
2409 * on success or -ETIMEDOUT if the PHY did not respond. 2409 * on success or -ETIMEDOUT if the PHY did not respond.
2410 */ 2410 */
2411 2411
2412static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data) 2412static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data)
2413{ 2413{
2414 u16 ww; 2414 u16 ww;
@@ -2444,7 +2444,7 @@ static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data)
2444 * Perform a single write to an MII 16bit register. Returns zero 2444 * Perform a single write to an MII 16bit register. Returns zero
2445 * on success or -ETIMEDOUT if the PHY did not respond. 2445 * on success or -ETIMEDOUT if the PHY did not respond.
2446 */ 2446 */
2447 2447
2448static int velocity_mii_write(struct mac_regs __iomem *regs, u8 mii_addr, u16 data) 2448static int velocity_mii_write(struct mac_regs __iomem *regs, u8 mii_addr, u16 data)
2449{ 2449{
2450 u16 ww; 2450 u16 ww;
@@ -2483,7 +2483,7 @@ static int velocity_mii_write(struct mac_regs __iomem *regs, u8 mii_addr, u16 da
2483 * mii_status accordingly. The requested link state information 2483 * mii_status accordingly. The requested link state information
2484 * is also returned. 2484 * is also returned.
2485 */ 2485 */
2486 2486
2487static u32 velocity_get_opt_media_mode(struct velocity_info *vptr) 2487static u32 velocity_get_opt_media_mode(struct velocity_info *vptr)
2488{ 2488{
2489 u32 status = 0; 2489 u32 status = 0;
@@ -2515,7 +2515,7 @@ static u32 velocity_get_opt_media_mode(struct velocity_info *vptr)
2515 * 2515 *
2516 * Enable autonegotation on this interface 2516 * Enable autonegotation on this interface
2517 */ 2517 */
2518 2518
2519static void mii_set_auto_on(struct velocity_info *vptr) 2519static void mii_set_auto_on(struct velocity_info *vptr)
2520{ 2520{
2521 if (MII_REG_BITS_IS_ON(BMCR_AUTO, MII_REG_BMCR, vptr->mac_regs)) 2521 if (MII_REG_BITS_IS_ON(BMCR_AUTO, MII_REG_BMCR, vptr->mac_regs))
@@ -2539,7 +2539,7 @@ static void mii_set_auto_off(struct velocity_info * vptr)
2539 * Set up the flow control on this interface according to 2539 * Set up the flow control on this interface according to
2540 * the supplied user/eeprom options. 2540 * the supplied user/eeprom options.
2541 */ 2541 */
2542 2542
2543static void set_mii_flow_control(struct velocity_info *vptr) 2543static void set_mii_flow_control(struct velocity_info *vptr)
2544{ 2544{
2545 /*Enable or Disable PAUSE in ANAR */ 2545 /*Enable or Disable PAUSE in ANAR */
@@ -2576,7 +2576,7 @@ static void set_mii_flow_control(struct velocity_info *vptr)
2576 * PHY and also velocity hardware setup accordingly. In particular 2576 * PHY and also velocity hardware setup accordingly. In particular
2577 * we need to set up CD polling and frame bursting. 2577 * we need to set up CD polling and frame bursting.
2578 */ 2578 */
2579 2579
2580static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status) 2580static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
2581{ 2581{
2582 u32 curr_status; 2582 u32 curr_status;
@@ -2686,7 +2686,7 @@ static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
2686 * Check the current MII status and determine the link status 2686 * Check the current MII status and determine the link status
2687 * accordingly 2687 * accordingly
2688 */ 2688 */
2689 2689
2690static u32 mii_check_media_mode(struct mac_regs __iomem * regs) 2690static u32 mii_check_media_mode(struct mac_regs __iomem * regs)
2691{ 2691{
2692 u32 status = 0; 2692 u32 status = 0;
@@ -2818,14 +2818,14 @@ static void enable_flow_control_ability(struct velocity_info *vptr)
2818 * Called before an ethtool operation. We need to make sure the 2818 * Called before an ethtool operation. We need to make sure the
2819 * chip is out of D3 state before we poke at it. 2819 * chip is out of D3 state before we poke at it.
2820 */ 2820 */
2821 2821
2822static int velocity_ethtool_up(struct net_device *dev) 2822static int velocity_ethtool_up(struct net_device *dev)
2823{ 2823{
2824 struct velocity_info *vptr = netdev_priv(dev); 2824 struct velocity_info *vptr = netdev_priv(dev);
2825 if (!netif_running(dev)) 2825 if (!netif_running(dev))
2826 pci_set_power_state(vptr->pdev, PCI_D0); 2826 pci_set_power_state(vptr->pdev, PCI_D0);
2827 return 0; 2827 return 0;
2828} 2828}
2829 2829
2830/** 2830/**
2831 * velocity_ethtool_down - post hook for ethtool 2831 * velocity_ethtool_down - post hook for ethtool
@@ -2834,7 +2834,7 @@ static int velocity_ethtool_up(struct net_device *dev)
2834 * Called after an ethtool operation. Restore the chip back to D3 2834 * Called after an ethtool operation. Restore the chip back to D3
2835 * state if it isn't running. 2835 * state if it isn't running.
2836 */ 2836 */
2837 2837
2838static void velocity_ethtool_down(struct net_device *dev) 2838static void velocity_ethtool_down(struct net_device *dev)
2839{ 2839{
2840 struct velocity_info *vptr = netdev_priv(dev); 2840 struct velocity_info *vptr = netdev_priv(dev);
@@ -2872,7 +2872,7 @@ static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd
2872 cmd->duplex = DUPLEX_FULL; 2872 cmd->duplex = DUPLEX_FULL;
2873 else 2873 else
2874 cmd->duplex = DUPLEX_HALF; 2874 cmd->duplex = DUPLEX_HALF;
2875 2875
2876 return 0; 2876 return 0;
2877} 2877}
2878 2878
@@ -2882,7 +2882,7 @@ static int velocity_set_settings(struct net_device *dev, struct ethtool_cmd *cmd
2882 u32 curr_status; 2882 u32 curr_status;
2883 u32 new_status = 0; 2883 u32 new_status = 0;
2884 int ret = 0; 2884 int ret = 0;
2885 2885
2886 curr_status = check_connection_type(vptr->mac_regs); 2886 curr_status = check_connection_type(vptr->mac_regs);
2887 curr_status &= (~VELOCITY_LINK_FAIL); 2887 curr_status &= (~VELOCITY_LINK_FAIL);
2888 2888
@@ -2994,7 +2994,7 @@ static struct ethtool_ops velocity_ethtool_ops = {
2994 * are used by tools like kudzu to interrogate the link state of the 2994 * are used by tools like kudzu to interrogate the link state of the
2995 * hardware 2995 * hardware
2996 */ 2996 */
2997 2997
2998static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2998static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2999{ 2999{
3000 struct velocity_info *vptr = netdev_priv(dev); 3000 struct velocity_info *vptr = netdev_priv(dev);
@@ -3002,7 +3002,7 @@ static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
3002 unsigned long flags; 3002 unsigned long flags;
3003 struct mii_ioctl_data *miidata = if_mii(ifr); 3003 struct mii_ioctl_data *miidata = if_mii(ifr);
3004 int err; 3004 int err;
3005 3005
3006 switch (cmd) { 3006 switch (cmd) {
3007 case SIOCGMIIPHY: 3007 case SIOCGMIIPHY:
3008 miidata->phy_id = readb(&regs->MIIADR) & 0x1f; 3008 miidata->phy_id = readb(&regs->MIIADR) & 0x1f;
@@ -3033,7 +3033,7 @@ static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
3033 3033
3034/** 3034/**
3035 * velocity_save_context - save registers 3035 * velocity_save_context - save registers
3036 * @vptr: velocity 3036 * @vptr: velocity
3037 * @context: buffer for stored context 3037 * @context: buffer for stored context
3038 * 3038 *
3039 * Retrieve the current configuration from the velocity hardware 3039 * Retrieve the current configuration from the velocity hardware
@@ -3041,7 +3041,7 @@ static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
3041 * restore functions. This allows us to save things we need across 3041 * restore functions. This allows us to save things we need across
3042 * power down states 3042 * power down states
3043 */ 3043 */
3044 3044
3045static void velocity_save_context(struct velocity_info *vptr, struct velocity_context * context) 3045static void velocity_save_context(struct velocity_info *vptr, struct velocity_context * context)
3046{ 3046{
3047 struct mac_regs __iomem * regs = vptr->mac_regs; 3047 struct mac_regs __iomem * regs = vptr->mac_regs;
@@ -3061,13 +3061,13 @@ static void velocity_save_context(struct velocity_info *vptr, struct velocity_co
3061 3061
3062/** 3062/**
3063 * velocity_restore_context - restore registers 3063 * velocity_restore_context - restore registers
3064 * @vptr: velocity 3064 * @vptr: velocity
3065 * @context: buffer for stored context 3065 * @context: buffer for stored context
3066 * 3066 *
3067 * Reload the register configuration from the velocity context 3067 * Reload the register configuration from the velocity context
3068 * created by velocity_save_context. 3068 * created by velocity_save_context.
3069 */ 3069 */
3070 3070
3071static void velocity_restore_context(struct velocity_info *vptr, struct velocity_context *context) 3071static void velocity_restore_context(struct velocity_info *vptr, struct velocity_context *context)
3072{ 3072{
3073 struct mac_regs __iomem * regs = vptr->mac_regs; 3073 struct mac_regs __iomem * regs = vptr->mac_regs;