Lines Matching refs:hmp
577 struct hamachi_private *hmp; in hamachi_init_one() local
637 hmp = dev->priv; in hamachi_init_one()
638 spin_lock_init(&hmp->lock); in hamachi_init_one()
640 hmp->mii_if.dev = dev; in hamachi_init_one()
641 hmp->mii_if.mdio_read = mdio_read; in hamachi_init_one()
642 hmp->mii_if.mdio_write = mdio_write; in hamachi_init_one()
643 hmp->mii_if.phy_id_mask = 0x1f; in hamachi_init_one()
644 hmp->mii_if.reg_num_mask = 0x1f; in hamachi_init_one()
649 hmp->tx_ring = (struct hamachi_desc *)ring_space; in hamachi_init_one()
650 hmp->tx_ring_dma = ring_dma; in hamachi_init_one()
655 hmp->rx_ring = (struct hamachi_desc *)ring_space; in hamachi_init_one()
656 hmp->rx_ring_dma = ring_dma; in hamachi_init_one()
687 hmp->chip_id = chip_id; in hamachi_init_one()
688 hmp->pci_dev = pdev; in hamachi_init_one()
692 hmp->option = option; in hamachi_init_one()
694 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
696 hmp->mii_if.full_duplex = 0; in hamachi_init_one()
697 hmp->default_port = option & 15; in hamachi_init_one()
698 if (hmp->default_port) in hamachi_init_one()
699 hmp->mii_if.force_media = 1; in hamachi_init_one()
702 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
705 if (hmp->mii_if.full_duplex || (option & 0x080)) in hamachi_init_one()
706 hmp->duplex_lock = 1; in hamachi_init_one()
718 hmp->rx_int_var = rx_int_var >= 0 ? rx_int_var : in hamachi_init_one()
720 hmp->tx_int_var = tx_int_var >= 0 ? tx_int_var : in hamachi_init_one()
755 if (chip_tbl[hmp->chip_id].flags & CanHaveMII) { in hamachi_init_one()
761 hmp->phys[phy_idx++] = phy; in hamachi_init_one()
762 hmp->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); in hamachi_init_one()
765 dev->name, phy, mii_status, hmp->mii_if.advertising); in hamachi_init_one()
768 hmp->mii_cnt = phy_idx; in hamachi_init_one()
769 if (hmp->mii_cnt > 0) in hamachi_init_one()
770 hmp->mii_if.phy_id = hmp->phys[0]; in hamachi_init_one()
772 memset(&hmp->mii_if, 0, sizeof(hmp->mii_if)); in hamachi_init_one()
783 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_init_one()
784 hmp->rx_ring_dma); in hamachi_init_one()
786 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_init_one()
787 hmp->tx_ring_dma); in hamachi_init_one()
857 struct hamachi_private *hmp = dev->priv; in hamachi_open() local
875 writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr); in hamachi_open()
876 writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4); in hamachi_open()
877 writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr); in hamachi_open()
878 writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4); in hamachi_open()
880 writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr); in hamachi_open()
881 writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr); in hamachi_open()
921 dev->if_port = hmp->default_port; in hamachi_open()
926 if (hmp->duplex_lock != 1) in hamachi_open()
927 hmp->mii_if.full_duplex = 1; in hamachi_open()
955 rx_int_var = hmp->rx_int_var; in hamachi_open()
956 tx_int_var = hmp->tx_int_var; in hamachi_open()
995 init_timer(&hmp->timer); in hamachi_open()
996 hmp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */ in hamachi_open()
997 hmp->timer.data = (unsigned long)dev; in hamachi_open()
998 hmp->timer.function = &hamachi_timer; /* timer handler */ in hamachi_open()
999 add_timer(&hmp->timer); in hamachi_open()
1006 struct hamachi_private *hmp = dev->priv; in hamachi_tx() local
1010 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++) { in hamachi_tx()
1011 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_tx()
1014 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_tx()
1017 skb = hmp->tx_skbuff[entry]; in hamachi_tx()
1019 pci_unmap_single(hmp->pci_dev, in hamachi_tx()
1020 hmp->tx_ring[entry].addr, skb->len, in hamachi_tx()
1023 hmp->tx_skbuff[entry] = 0; in hamachi_tx()
1025 hmp->tx_ring[entry].status_n_length = 0; in hamachi_tx()
1027 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_tx()
1029 hmp->stats.tx_packets++; in hamachi_tx()
1038 struct hamachi_private *hmp = dev->priv; in hamachi_timer() local
1056 hmp->timer.expires = RUN_AT(next_tick); in hamachi_timer()
1057 add_timer(&hmp->timer); in hamachi_timer()
1063 struct hamachi_private *hmp = dev->priv; in hamachi_tx_timeout() local
1071 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); in hamachi_tx_timeout()
1073 printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length); in hamachi_tx_timeout()
1074 printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); in hamachi_tx_timeout()
1076 printk(" %4.4x", hmp->tx_ring[i].status_n_length); in hamachi_tx_timeout()
1092 hmp->rx_ring[i].status_n_length &= cpu_to_le32(~DescOwn); in hamachi_tx_timeout()
1101 hmp->tx_ring[i].status_n_length = cpu_to_le32( in hamachi_tx_timeout()
1103 (hmp->tx_ring[i].status_n_length & 0x0000FFFF)); in hamachi_tx_timeout()
1105 hmp->tx_ring[i].status_n_length &= 0x0000ffff; in hamachi_tx_timeout()
1106 skb = hmp->tx_skbuff[i]; in hamachi_tx_timeout()
1108 pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, in hamachi_tx_timeout()
1111 hmp->tx_skbuff[i] = 0; in hamachi_tx_timeout()
1120 hmp->tx_full = 0; in hamachi_tx_timeout()
1121 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_tx_timeout()
1122 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_tx_timeout()
1127 struct sk_buff *skb = hmp->rx_skbuff[i]; in hamachi_tx_timeout()
1130 pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, in hamachi_tx_timeout()
1131 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); in hamachi_tx_timeout()
1133 hmp->rx_skbuff[i] = 0; in hamachi_tx_timeout()
1138 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); in hamachi_tx_timeout()
1139 hmp->rx_skbuff[i] = skb; in hamachi_tx_timeout()
1144 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, in hamachi_tx_timeout()
1145 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); in hamachi_tx_timeout()
1146 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_tx_timeout()
1147 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); in hamachi_tx_timeout()
1149 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_tx_timeout()
1151 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_tx_timeout()
1155 hmp->stats.tx_errors++; in hamachi_tx_timeout()
1169 struct hamachi_private *hmp = dev->priv; in hamachi_init_ring() local
1172 hmp->tx_full = 0; in hamachi_init_ring()
1173 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_init_ring()
1174 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_init_ring()
1181 hmp->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); in hamachi_init_ring()
1189 hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ : in hamachi_init_ring()
1194 hmp->rx_ring[i].status_n_length = 0; in hamachi_init_ring()
1195 hmp->rx_skbuff[i] = 0; in hamachi_init_ring()
1199 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); in hamachi_init_ring()
1200 hmp->rx_skbuff[i] = skb; in hamachi_init_ring()
1205 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, in hamachi_init_ring()
1206 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); in hamachi_init_ring()
1208 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_init_ring()
1209 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); in hamachi_init_ring()
1211 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_init_ring()
1212 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1215 hmp->tx_skbuff[i] = 0; in hamachi_init_ring()
1216 hmp->tx_ring[i].status_n_length = 0; in hamachi_init_ring()
1219 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1261 struct hamachi_private *hmp = dev->priv; in hamachi_start_xmit() local
1270 if (hmp->tx_full) { in hamachi_start_xmit()
1272 printk(KERN_WARNING "%s: Hamachi transmit queue full at slot %d.\n",dev->name, hmp->cur_tx); in hamachi_start_xmit()
1286 entry = hmp->cur_tx % TX_RING_SIZE; in hamachi_start_xmit()
1288 hmp->tx_skbuff[entry] = skb; in hamachi_start_xmit()
1320 hmp->tx_ring[entry].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, in hamachi_start_xmit()
1333 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1336 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1338 hmp->cur_tx++; in hamachi_start_xmit()
1357 if ((hmp->cur_tx - hmp->dirty_tx) < (TX_RING_SIZE - 4)) in hamachi_start_xmit()
1360 hmp->tx_full = 1; in hamachi_start_xmit()
1367 dev->name, hmp->cur_tx, entry); in hamachi_start_xmit()
1376 struct hamachi_private *hmp = dev->priv; in hamachi_rx() local
1377 int entry = hmp->cur_rx % RX_RING_SIZE; in hamachi_rx()
1378 int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx; in hamachi_rx()
1382 entry, hmp->rx_ring[entry].status_n_length); in hamachi_rx()
1387 struct hamachi_desc *desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1395 pci_dma_sync_single(hmp->pci_dev, desc->addr, hmp->rx_buf_sz, in hamachi_rx()
1407 dev->name, hmp->cur_rx, data_size, desc_status); in hamachi_rx()
1409 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); in hamachi_rx()
1412 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000, in hamachi_rx()
1413 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff, in hamachi_rx()
1414 hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length); in hamachi_rx()
1415 hmp->stats.rx_length_errors++; in hamachi_rx()
1422 hmp->stats.rx_errors++; in hamachi_rx()
1423 if (frame_status & 0x00600000) hmp->stats.rx_length_errors++; in hamachi_rx()
1424 if (frame_status & 0x00080000) hmp->stats.rx_frame_errors++; in hamachi_rx()
1425 if (frame_status & 0x00100000) hmp->stats.rx_crc_errors++; in hamachi_rx()
1426 if (frame_status < 0) hmp->stats.rx_dropped++; in hamachi_rx()
1463 hmp->rx_skbuff[entry]->data, pkt_len, 0); in hamachi_rx()
1466 memcpy(skb_put(skb, pkt_len), hmp->rx_ring_dma in hamachi_rx()
1470 pci_unmap_single(hmp->pci_dev, in hamachi_rx()
1471 hmp->rx_ring[entry].addr, in hamachi_rx()
1472 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); in hamachi_rx()
1473 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); in hamachi_rx()
1474 hmp->rx_skbuff[entry] = NULL; in hamachi_rx()
1538 hmp->stats.rx_packets++; in hamachi_rx()
1540 entry = (++hmp->cur_rx) % RX_RING_SIZE; in hamachi_rx()
1544 for (; hmp->cur_rx - hmp->dirty_rx > 0; hmp->dirty_rx++) { in hamachi_rx()
1547 entry = hmp->dirty_rx % RX_RING_SIZE; in hamachi_rx()
1548 desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1549 if (hmp->rx_skbuff[entry] == NULL) { in hamachi_rx()
1550 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); in hamachi_rx()
1552 hmp->rx_skbuff[entry] = skb; in hamachi_rx()
1557 desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, in hamachi_rx()
1558 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); in hamachi_rx()
1560 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); in hamachi_rx()
1582 struct hamachi_private *hmp; in hamachi_interrupt() local
1593 hmp = dev->priv; in hamachi_interrupt()
1594 spin_lock(&hmp->lock); in hamachi_interrupt()
1614 if (hmp->tx_full){ in hamachi_interrupt()
1615 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++){ in hamachi_interrupt()
1616 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_interrupt()
1619 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_interrupt()
1621 skb = hmp->tx_skbuff[entry]; in hamachi_interrupt()
1624 pci_unmap_single(hmp->pci_dev, in hamachi_interrupt()
1625 hmp->tx_ring[entry].addr, in hamachi_interrupt()
1629 hmp->tx_skbuff[entry] = 0; in hamachi_interrupt()
1631 hmp->tx_ring[entry].status_n_length = 0; in hamachi_interrupt()
1633 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_interrupt()
1635 hmp->stats.tx_packets++; in hamachi_interrupt()
1637 if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 4){ in hamachi_interrupt()
1639 hmp->tx_full = 0; in hamachi_interrupt()
1677 spin_unlock(&hmp->lock); in hamachi_interrupt()
1685 struct hamachi_private *hmp = dev->priv; in hamachi_error() local
1711 hmp->stats.tx_fifo_errors++; in hamachi_error()
1713 hmp->stats.rx_fifo_errors++; in hamachi_error()
1719 struct hamachi_private *hmp = dev->priv; in hamachi_close() local
1730 dev->name, hmp->cur_tx, hmp->dirty_tx, hmp->cur_rx, hmp->dirty_rx); in hamachi_close()
1743 (int)hmp->tx_ring_dma); in hamachi_close()
1746 readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', in hamachi_close()
1747 i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); in hamachi_close()
1749 (int)hmp->rx_ring_dma); in hamachi_close()
1752 readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', in hamachi_close()
1753 i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); in hamachi_close()
1755 if (*(u8*)hmp->rx_skbuff[i]->tail != 0x69) { in hamachi_close()
1757 hmp->rx_skbuff[i]->tail; in hamachi_close()
1771 del_timer_sync(&hmp->timer); in hamachi_close()
1775 skb = hmp->rx_skbuff[i]; in hamachi_close()
1776 hmp->rx_ring[i].status_n_length = 0; in hamachi_close()
1777 hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ in hamachi_close()
1779 pci_unmap_single(hmp->pci_dev, in hamachi_close()
1780 hmp->rx_ring[i].addr, hmp->rx_buf_sz, in hamachi_close()
1783 hmp->rx_skbuff[i] = 0; in hamachi_close()
1787 skb = hmp->tx_skbuff[i]; in hamachi_close()
1789 pci_unmap_single(hmp->pci_dev, in hamachi_close()
1790 hmp->tx_ring[i].addr, skb->len, in hamachi_close()
1793 hmp->tx_skbuff[i] = 0; in hamachi_close()
1805 struct hamachi_private *hmp = dev->priv; in hamachi_get_stats() local
1817 hmp->stats.rx_bytes = readl(ioaddr + 0x330); /* Total Uni+Brd+Multi */ in hamachi_get_stats()
1818 hmp->stats.tx_bytes = readl(ioaddr + 0x3B0); /* Total Uni+Brd+Multi */ in hamachi_get_stats()
1819 hmp->stats.multicast = readl(ioaddr + 0x320); /* Multicast Rx */ in hamachi_get_stats()
1821 hmp->stats.rx_length_errors = readl(ioaddr + 0x368); /* Over+Undersized */ in hamachi_get_stats()
1822 hmp->stats.rx_over_errors = readl(ioaddr + 0x35C); /* Jabber */ in hamachi_get_stats()
1823 hmp->stats.rx_crc_errors = readl(ioaddr + 0x360); /* Jabber */ in hamachi_get_stats()
1824 hmp->stats.rx_frame_errors = readl(ioaddr + 0x364); /* Symbol Errs */ in hamachi_get_stats()
1825 hmp->stats.rx_missed_errors = readl(ioaddr + 0x36C); /* Dropped */ in hamachi_get_stats()
1827 return &hmp->stats; in hamachi_get_stats()
1969 struct hamachi_private *hmp = dev->priv; in hamachi_remove_one() local
1971 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_remove_one()
1972 hmp->rx_ring_dma); in hamachi_remove_one()
1973 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_remove_one()
1974 hmp->tx_ring_dma); in hamachi_remove_one()