sis900.c (9edd576d89a5b6d3e136d7dcab654d887c0d25b7) sis900.c (f2cedb63df14342ad40a8b5b324fc5d94a60b665)
1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
2 Copyright 1999 Silicon Integrated System Corporation
3 Revision: 1.08.10 Apr. 2 2006
4
5 Modified from the driver which is originally written by Donald Becker.
6
7 This software may be used and distributed according to the terms
8 of the GNU General Public License (GPL), incorporated herein by reference.

--- 513 unchanged lines hidden (view full) ---

522 else if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90) )
523 ret = sis635_get_mac_addr(pci_dev, net_dev);
524 else if (sis_priv->chipset_rev == SIS96x_900_REV)
525 ret = sis96x_get_mac_addr(pci_dev, net_dev);
526 else
527 ret = sis900_get_mac_addr(pci_dev, net_dev);
528
529 if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) {
1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
2 Copyright 1999 Silicon Integrated System Corporation
3 Revision: 1.08.10 Apr. 2 2006
4
5 Modified from the driver which is originally written by Donald Becker.
6
7 This software may be used and distributed according to the terms
8 of the GNU General Public License (GPL), incorporated herein by reference.

--- 513 unchanged lines hidden (view full) ---

522 else if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90) )
523 ret = sis635_get_mac_addr(pci_dev, net_dev);
524 else if (sis_priv->chipset_rev == SIS96x_900_REV)
525 ret = sis96x_get_mac_addr(pci_dev, net_dev);
526 else
527 ret = sis900_get_mac_addr(pci_dev, net_dev);
528
529 if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) {
530 random_ether_addr(net_dev->dev_addr);
530 eth_hw_addr_random(net_dev);
531 printk(KERN_WARNING "%s: Unreadable or invalid MAC address,"
532 "using random generated one\n", dev_name);
533 }
534
535 /* 630ET : set the mii access mode as software-mode */
536 if (sis_priv->chipset_rev == SIS630ET_900_REV)
537 outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
538

--- 75 unchanged lines hidden (view full) ---

614 if (netif_msg_probe(sis_priv))
615 printk(KERN_DEBUG "%s: MII at address %d"
616 " not accessible\n",
617 dev_name, phy_addr);
618 continue;
619 }
620
621 if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
531 printk(KERN_WARNING "%s: Unreadable or invalid MAC address,"
532 "using random generated one\n", dev_name);
533 }
534
535 /* 630ET : set the mii access mode as software-mode */
536 if (sis_priv->chipset_rev == SIS630ET_900_REV)
537 outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
538

--- 75 unchanged lines hidden (view full) ---

614 if (netif_msg_probe(sis_priv))
615 printk(KERN_DEBUG "%s: MII at address %d"
616 " not accessible\n",
617 dev_name, phy_addr);
618 continue;
619 }
620
621 if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
622 printk(KERN_WARNING "Cannot allocate mem for struct mii_phy\n");
623 mii_phy = sis_priv->first_mii;
624 while (mii_phy) {
625 struct mii_phy *phy;
626 phy = mii_phy;
627 mii_phy = mii_phy->next;
628 kfree(phy);
629 }
630 return 0;

--- 531 unchanged lines hidden (view full) ---

1162 sis_priv->rx_ring[i].cmdsts = 0;
1163 sis_priv->rx_ring[i].bufptr = 0;
1164 }
1165
1166 /* allocate sock buffers */
1167 for (i = 0; i < NUM_RX_DESC; i++) {
1168 struct sk_buff *skb;
1169
622 mii_phy = sis_priv->first_mii;
623 while (mii_phy) {
624 struct mii_phy *phy;
625 phy = mii_phy;
626 mii_phy = mii_phy->next;
627 kfree(phy);
628 }
629 return 0;

--- 531 unchanged lines hidden (view full) ---

1161 sis_priv->rx_ring[i].cmdsts = 0;
1162 sis_priv->rx_ring[i].bufptr = 0;
1163 }
1164
1165 /* allocate sock buffers */
1166 for (i = 0; i < NUM_RX_DESC; i++) {
1167 struct sk_buff *skb;
1168
1170 if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
1169 if ((skb = netdev_alloc_skb(net_dev, RX_BUF_SIZE)) == NULL) {
1171 /* not enough memory for skbuff, this makes a "hole"
1172 on the buffer ring, it is not clear how the
1173 hardware will react to this kind of degenerated
1174 buffer */
1175 break;
1176 }
1177 sis_priv->rx_skbuff[i] = skb;
1178 sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE;

--- 586 unchanged lines hidden (view full) ---

1765 struct sk_buff * rx_skb;
1766
1767 pci_unmap_single(sis_priv->pci_dev,
1768 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
1769 PCI_DMA_FROMDEVICE);
1770
1771 /* refill the Rx buffer, what if there is not enough
1772 * memory for new socket buffer ?? */
1170 /* not enough memory for skbuff, this makes a "hole"
1171 on the buffer ring, it is not clear how the
1172 hardware will react to this kind of degenerated
1173 buffer */
1174 break;
1175 }
1176 sis_priv->rx_skbuff[i] = skb;
1177 sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE;

--- 586 unchanged lines hidden (view full) ---

1764 struct sk_buff * rx_skb;
1765
1766 pci_unmap_single(sis_priv->pci_dev,
1767 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
1768 PCI_DMA_FROMDEVICE);
1769
1770 /* refill the Rx buffer, what if there is not enough
1771 * memory for new socket buffer ?? */
1773 if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
1772 if ((skb = netdev_alloc_skb(net_dev, RX_BUF_SIZE)) == NULL) {
1774 /*
1775 * Not enough memory to refill the buffer
1776 * so we need to recycle the old one so
1777 * as to avoid creating a memory hole
1778 * in the rx ring
1779 */
1780 skb = sis_priv->rx_skbuff[entry];
1781 net_dev->stats.rx_dropped++;

--- 41 unchanged lines hidden (view full) ---

1823 /* refill the Rx buffer, what if the rate of refilling is slower
1824 * than consuming ?? */
1825 for (; sis_priv->cur_rx != sis_priv->dirty_rx; sis_priv->dirty_rx++) {
1826 struct sk_buff *skb;
1827
1828 entry = sis_priv->dirty_rx % NUM_RX_DESC;
1829
1830 if (sis_priv->rx_skbuff[entry] == NULL) {
1773 /*
1774 * Not enough memory to refill the buffer
1775 * so we need to recycle the old one so
1776 * as to avoid creating a memory hole
1777 * in the rx ring
1778 */
1779 skb = sis_priv->rx_skbuff[entry];
1780 net_dev->stats.rx_dropped++;

--- 41 unchanged lines hidden (view full) ---

1822 /* refill the Rx buffer, what if the rate of refilling is slower
1823 * than consuming ?? */
1824 for (; sis_priv->cur_rx != sis_priv->dirty_rx; sis_priv->dirty_rx++) {
1825 struct sk_buff *skb;
1826
1827 entry = sis_priv->dirty_rx % NUM_RX_DESC;
1828
1829 if (sis_priv->rx_skbuff[entry] == NULL) {
1831 if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
1830 if ((skb = netdev_alloc_skb(net_dev, RX_BUF_SIZE)) == NULL) {
1832 /* not enough memory for skbuff, this makes a
1833 * "hole" on the buffer ring, it is not clear
1834 * how the hardware will react to this kind
1835 * of degenerated buffer */
1836 if (netif_msg_rx_err(sis_priv))
1837 printk(KERN_INFO "%s: Memory squeeze, "
1838 "deferring packet.\n",
1839 net_dev->name);

--- 656 unchanged lines hidden ---
1831 /* not enough memory for skbuff, this makes a
1832 * "hole" on the buffer ring, it is not clear
1833 * how the hardware will react to this kind
1834 * of degenerated buffer */
1835 if (netif_msg_rx_err(sis_priv))
1836 printk(KERN_INFO "%s: Memory squeeze, "
1837 "deferring packet.\n",
1838 net_dev->name);

--- 656 unchanged lines hidden ---