<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<br><br>First of all many thanks to etherlab and Florian Pose for this fantastic piece of open-source software. A programmer who cares about the strict accuracy of grammatical rules in kernel messages deserves the most deepest respect :<br><br>EC_MASTER_WARN(master, "%u datagram%s UNMATCHED!\n",<br> master->stats.unmatched,<br> master->stats.unmatched == 1 ? "" : "s");<br><br>I have precisely a little question about this warning. When I run the user/main.c example on Beckhoff slaves (EK1100, EL2008, EL4134, EL3102), the first time after a "/etc/init.d/ethercat start" everything runs smoothly and there are no warning in dmesg. But every subsequent calls to ec_user_example generate a "WARNING 0: 1 datagram UNMATCHED!" warning.<br><br>If I go through a "/etc/init.d/ethercat stop" "/etc/init.d/ethercat start" cycle, the first call, and only the first call just after is warning-less. I just found that strange so I would like to report it. Here you can find some debug 1 level messages surrounding this warning :<br><br>EtherCAT 0: Domain0: Logical address 0x00000000, 23 byte, expected working counter 7.<br>EtherCAT 0: Datagram domain0-0: Logical offset 0x00000000, 23 byte, type LRW.<br>EtherCAT DEBUG 0: Stopping master thread.<br>EtherCAT DEBUG 0: Master IDLE thread exiting...<br>EtherCAT 0: Master thread exited.<br>EtherCAT DEBUG 0: FSM datagram is d16d9be0.<br>EtherCAT 0: Starting EtherCAT-OP thread.<br>EtherCAT DEBUG 0: Operation thread running with fsm interval = 1000 us, max data size=11250<br>EtherCAT WARNING 0: 1 datagram UNMATCHED!<br>EtherCAT DEBUG 0: mmap()<br>EtherCAT DEBUG 0: Vma fault, virtual_address = b7854000, offset = 0, page = c33fbf80<br>EtherCAT DEBUG 0-1: Changing state from PREOP to OP.<br>EtherCAT DEBUG 0-1: Configuring...<br>EtherCAT DEBUG 0-1: Now in INIT.<br>EtherCAT DEBUG 0-1: Clearing FMMU configurations...<br>EtherCAT DEBUG 0-1: Clearing sync manager configurations...<br>EtherCAT DEBUG 0-1: Clearing DC assignment...<br><br>It happens with the generic or the 8139too driver. I'm running linux 2.6.35.7 with xenomai patch on a slackware 13.1. The machine is a HP Z400. I installed the latest 1.5 etherlab master.<br><br>I modified the 8139too driver of the 2.6.35.7 to obtain 8139too-2.6.35-ethercat.c. You can find the patch below. I did not tested it extensively. But so far no bug.<br><br>Best,<br>Jacques Gangloff<br><br>*** 8139too-2.6.35-orig.c<span class="Apple-tab-span" style="white-space: pre; "> </span>2010-10-07 18:16:39.000000000 +0200<br>--- 8139too-2.6.35-ethercat.c<span class="Apple-tab-span" style="white-space: pre; "> </span>2010-10-08 10:00:22.000000000 +0200<br>***************<br>*** 1,4 ****<br>--- 1,41 ----<br>+ /******************************************************************************<br>+ *<br>+ * $Id$<br>+ *<br>+ * Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH<br>+ *<br>+ * This file is part of the IgH EtherCAT Master.<br>+ *<br>+ * The IgH EtherCAT Master is free software; you can redistribute it and/or<br>+ * modify it under the terms of the GNU General Public License version 2, as<br>+ * published by the Free Software Foundation.<br>+ *<br>+ * The IgH EtherCAT Master is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General<br>+ * Public License for more details.<br>+ *<br>+ * You should have received a copy of the GNU General Public License along<br>+ * with the IgH EtherCAT Master; if not, write to the Free Software<br>+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>+ *<br>+ * ---<br>+ *<br>+ * The license mentioned above concerns the source code only. Using the<br>+ * EtherCAT technology and brand is only permitted in compliance with the<br>+ * industrial property and similar rights of Beckhoff Automation GmbH.<br>+ *<br>+ *****************************************************************************/<br>+<br>+ /**<br>+ \file<br>+ EtherCAT driver for RTL8139-compatible NICs.<br>+ */<br>+<br>+ /**********************************RTL_W16_F(IntrMask, rtl8139_intr_mask);*******************************************/<br>+<br> /*<br>+ Former documentation:<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>8139too.c: A RealTek RTL-8139 Fast Ethernet driver for Linux.<br><br>***************<br>*** 89,97 ****<br><br> */<br><br>! #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt<br>!<br>! #define DRV_NAME<span class="Apple-tab-span" style="white-space: pre; "> </span>"8139too"<br> #define DRV_VERSION<span class="Apple-tab-span" style="white-space: pre; "> </span>"0.9.28"<br><br><br>--- 126,132 ----<br><br> */<br><br>! #define DRV_NAME<span class="Apple-tab-span" style="white-space: pre; "> </span>"ec_8139too"<br> #define DRV_VERSION<span class="Apple-tab-span" style="white-space: pre; "> </span>"0.9.28"<br><br><br>***************<br>*** 113,119 ****<br> #include <linux/gfp.h><br> #include <asm/irq.h><br><br>! #define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION<br><br> /* Default Message level */<br> #define RTL8139_DEF_MSG_ENABLE (NETIF_MSG_DRV | \<br>--- 148,161 ----<br> #include <linux/gfp.h><br> #include <asm/irq.h><br><br>! #include "../globals.h"<br>! #include "ecdev.h"<br>!<br>! #define RTL8139_DRIVER_NAME DRV_NAME \<br>! " EtherCAT-capable Fast Ethernet driver " \<br>! DRV_VERSION ", master " EC_MASTER_VERSION<br>!<br>! #define PFX DRV_NAME ": "<br><br> /* Default Message level */<br> #define RTL8139_DEF_MSG_ENABLE (NETIF_MSG_DRV | \<br>***************<br>*** 132,140 ****<br> # define assert(expr) do {} while (0)<br> #else<br> # define assert(expr) \<br>! if (unlikely(!(expr))) {<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>\<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_err("Assertion failed! %s,%s,%s,line=%d\n",<span class="Apple-tab-span" style="white-space: pre; "> </span>\<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> #expr, __FILE__, __func__, __LINE__);<span class="Apple-tab-span" style="white-space: pre; "> </span>\<br> }<br> #endif<br><br>--- 174,182 ----<br> # define assert(expr) do {} while (0)<br> #else<br> # define assert(expr) \<br>! if(unlikely(!(expr))) {<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> \<br>! pr_err("Assertion failed! %s,%s,%s,line=%d\n",<span class="Apple-tab-span" style="white-space: pre; "> </span>\<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>#expr, __FILE__, __func__, __LINE__);<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>\<br> }<br> #endif<br><br>***************<br>*** 272,278 ****<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>{0,}<br> };<br>! MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl);<br><br> static struct {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>const char str[ETH_GSTRING_LEN];<br>--- 314,322 ----<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>{0,}<br> };<br>!<br>! /* prevent driver from being loaded automatically */<br>! //MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl);<br><br> static struct {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>const char str[ETH_GSTRING_LEN];<br>***************<br>*** 604,615 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct mii_if_info<span class="Apple-tab-span" style="white-space: pre; "> </span>mii;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>regs_len;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>fifo_copy_timeout;<br> };<br><br>! MODULE_AUTHOR ("Jeff Garzik <<a href="mailto:jgarzik@pobox.com">jgarzik@pobox.com</a>>");<br>! MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");<br> MODULE_LICENSE("GPL");<br>! MODULE_VERSION(DRV_VERSION);<br><br> module_param(use_io, int, 0);<br> MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");<br>--- 648,661 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct mii_if_info<span class="Apple-tab-span" style="white-space: pre; "> </span>mii;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>regs_len;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>fifo_copy_timeout;<br>+<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span>ec_device_t *ecdev;<br> };<br><br>! MODULE_AUTHOR("Florian Pose <<a href="mailto:fp@igh-essen.com">fp@igh-essen.com</a>>");<br>! MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");<br> MODULE_LICENSE("GPL");<br>! MODULE_VERSION(EC_MASTER_VERSION);<br><br> module_param(use_io, int, 0);<br> MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");<br>***************<br>*** 622,627 ****<br>--- 668,675 ----<br> MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps");<br> MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)");<br><br>+ void ec_poll(struct net_device *);<br>+<br> static int read_eeprom (void __iomem *ioaddr, int location, int addr_len);<br> static int rtl8139_open (struct net_device *dev);<br> static int mdio_read (struct net_device *dev, int phy_id, int location);<br>***************<br>*** 630,637 ****<br> static void rtl8139_start_thread(struct rtl8139_private *tp);<br> static void rtl8139_tx_timeout (struct net_device *dev);<br> static void rtl8139_init_ring (struct net_device *dev);<br>! static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> struct net_device *dev);<br> #ifdef CONFIG_NET_POLL_CONTROLLER<br> static void rtl8139_poll_controller(struct net_device *dev);<br> #endif<br>--- 678,685 ----<br> static void rtl8139_start_thread(struct rtl8139_private *tp);<br> static void rtl8139_tx_timeout (struct net_device *dev);<br> static void rtl8139_init_ring (struct net_device *dev);<br>! static int rtl8139_start_xmit (struct sk_buff *skb,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> struct net_device *dev);<br> #ifdef CONFIG_NET_POLL_CONTROLLER<br> static void rtl8139_poll_controller(struct net_device *dev);<br> #endif<br>***************<br>*** 960,966 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->device == PCI_DEVICE_ID_REALTEK_8139 &&<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("OQO Model 2 detected. Forcing PIO\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>use_io = 1;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>--- 1008,1014 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->device == PCI_DEVICE_ID_REALTEK_8139 &&<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("8139too: OQO Model 2 detected. Forcing PIO\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>use_io = 1;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>***************<br>*** 1013,1031 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.reg_num_mask = 0x1f;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* dev is fully set up and ready to use now */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("about to register device named %s (%p)...\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>i = register_netdev (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (i) goto err_out;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_set_drvdata (pdev, dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> board_info[ent->driver_data].name,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->base_addr, dev->dev_addr, dev->irq);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Identified 8139 chip type '%s'\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> rtl_chip_info[tp->chipset].name);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Find the connected MII xcvrs.<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> Doing this in open() would allow detecting external xcvrs later, but<br>--- 1061,1086 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.reg_num_mask = 0x1f;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* dev is fully set up and ready to use now */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>// offer device to EtherCAT master module<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("about to register device named %s (%p)...\n", dev->name, dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>i = register_netdev (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (i) goto err_out;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_set_drvdata (pdev, dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: %s at 0x%lx, %pM, IRQ %d\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>board_info[ent->driver_data].name,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->base_addr,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->dev_addr,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->irq);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Identified 8139 chip type '%s'\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, rtl_chip_info[tp->chipset].name);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Find the connected MII xcvrs.<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> Doing this in open() would allow detecting external xcvrs later, but<br>***************<br>*** 1038,1049 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (mii_status != 0xffff && mii_status != 0x0000) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u16 advertising = mdio_read(dev, phy, 4);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->phys[phy_idx++] = phy;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "MII transceiver %d status 0x%04x advertising %04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> phy, mii_status, advertising);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (phy_idx == 0) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "No MII transceivers found! Assuming SYM transceiver\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->phys[0] = 32;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>} else<br>--- 1093,1105 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (mii_status != 0xffff && mii_status != 0x0000) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u16 advertising = mdio_read(dev, phy, 4);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->phys[phy_idx++] = phy;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: MII transceiver %d status 0x%4.4x advertising %4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, phy, mii_status, advertising);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (phy_idx == 0) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: No MII transceivers found! Assuming SYM transceiver.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->phys[0] = 32;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>} else<br>***************<br>*** 1062,1076 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (board_idx < MAX_UNITS && full_duplex[board_idx] > 0)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex = full_duplex[board_idx];<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->mii.full_duplex) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "Media type forced to Full Duplex\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Changing the MII-advertised media because might prevent<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> re-connection. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.force_media = 1;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->default_port) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, " Forcing %dMbps %s-duplex operation\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (option & 0x20 ? 100 : 10),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (option & 0x10 ? "full" : "half"));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mdio_write(dev, tp->phys[0], 0,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> ((option & 0x20) ? 0x2000 : 0) | <span class="Apple-tab-span" style="white-space: pre; "> </span>/* 100Mbps? */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> ((option & 0x10) ? 0x0100 : 0)); /* Full duplex? */<br>--- 1118,1132 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (board_idx < MAX_UNITS && full_duplex[board_idx] > 0)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex = full_duplex[board_idx];<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->mii.full_duplex) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: Media type forced to Full Duplex.\n", dev->name);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Changing the MII-advertised media because might prevent<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> re-connection. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.force_media = 1;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->default_port) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info(" Forcing %dMbps %s-duplex operation.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (option & 0x20 ? 100 : 10),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (option & 0x10 ? "full" : "half"));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mdio_write(dev, tp->phys[0], 0,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> ((option & 0x20) ? 0x2000 : 0) | <span class="Apple-tab-span" style="white-space: pre; "> </span>/* 100Mbps? */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> ((option & 0x10) ? 0x0100 : 0)); /* Full duplex? */<br>***************<br>*** 1080,1085 ****<br>--- 1136,1146 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (rtl_chip_info[tp->chipset].flags & HasHltClk)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (HltClk, 'H');<span class="Apple-tab-span" style="white-space: pre; "> </span>/* 'R' would leave the clock running. */<br><br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev && ecdev_open(tp->ecdev)) {<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>ecdev_withdraw(tp->ecdev);<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto err_out;<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>+<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br><br> err_out:<br>***************<br>*** 1092,1103 ****<br> static void __devexit rtl8139_remove_one (struct pci_dev *pdev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct net_device *dev = pci_get_drvdata (pdev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (dev != NULL);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>flush_scheduled_work();<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>unregister_netdev (dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>__rtl8139_cleanup_dev (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_disable_device (pdev);<br>--- 1153,1171 ----<br> static void __devexit rtl8139_remove_one (struct pci_dev *pdev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct net_device *dev = pci_get_drvdata (pdev);<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (dev != NULL);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>flush_scheduled_work();<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>ecdev_close(tp->ecdev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>ecdev_withdraw(tp->ecdev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>unregister_netdev (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>__rtl8139_cleanup_dev (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_disable_device (pdev);<br>***************<br>*** 1299,1314 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int retval;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (retval)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return retval;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->tx_bufs = dma_alloc_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> &tp->tx_bufs_dma, GFP_KERNEL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> &tp->rx_ring_dma, GFP_KERNEL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>free_irq(dev->irq, dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->tx_bufs)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dma_free_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,<br>--- 1367,1385 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int retval;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>retval = request_irq(dev->irq, rtl8139_interrupt,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>IRQF_SHARED, dev->name, dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (retval)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return retval;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->tx_bufs = dma_alloc_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> &tp->tx_bufs_dma, GFP_KERNEL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> &tp->rx_ring_dma, GFP_KERNEL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) free_irq(dev->irq, dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->tx_bufs)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dma_free_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,<br>***************<br>*** 1330,1343 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_hw_start (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_start_queue (dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, ifup, dev,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> "%s() ioaddr %#llx IRQ %d GP Pins %02x %s-duplex\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> __func__,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (unsigned long long)pci_resource_start (tp->pci_dev, 1),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->irq, RTL_R8 (MediaStatus),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->mii.full_duplex ? "full" : "half");<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_start_thread(tp);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> }<br>--- 1401,1416 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_hw_start (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_start_queue (dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_ifup(tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: rtl8139_open() ioaddr %#llx IRQ %d"<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>" GP Pins %2.2x %s-duplex.\n", dev->name,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>(unsigned long long)pci_resource_start (tp->pci_dev, 1),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->irq, RTL_R8 (MediaStatus),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex ? "full" : "half");<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_start_thread(tp);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> }<br>***************<br>*** 1347,1354 ****<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->phys[0] >= 0) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mii_check_media(&tp->mii, netif_msg_link(tp), init_media);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>--- 1420,1434 ----<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u16 state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>ecdev_set_link(tp->ecdev, state ? 1 : 0);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->phys[0] >= 0) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mii_check_media(&tp->mii, netif_msg_link(tp), init_media);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>***************<br>*** 1393,1399 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Config3, RTL_R8 (Config3) & ~Cfg3_Magic);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "init buffer addresses\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Lock Config[01234] and BMCR register writes */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Lock);<br>--- 1473,1479 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Config3, RTL_R8 (Config3) & ~Cfg3_Magic);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("init buffer addresses\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Lock Config[01234] and BMCR register writes */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Lock);<br>***************<br>*** 1414,1421 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if ((!(tmp & CmdRxEnb)) || (!(tmp & CmdTxEnb)))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Enable all known interrupts by setting the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, rtl8139_intr_mask);<br> }<br><br><br>--- 1494,1502 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if ((!(tmp & CmdRxEnb)) || (!(tmp & CmdTxEnb)))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Enable all known interrupts by setting the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, rtl8139_intr_mask);<br> }<br><br><br>***************<br>*** 1549,1565 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->mii.force_media && mii_lpa != 0xffff) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>int duplex = ((mii_lpa & LPA_100FULL) ||<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (mii_lpa & 0x01C0) == 0x0040);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->mii.full_duplex != duplex) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex = duplex;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (mii_lpa) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "Setting %s-duplex based on MII #%d link partner ability of %04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->mii.full_duplex ? "full" : "half",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->phys[0], mii_lpa);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_info(dev, "media is unconnected, link down, or incompatible connection\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #if 0<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Unlock);<br>--- 1630,1649 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->mii.force_media && mii_lpa != 0xffff) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>int duplex = (mii_lpa & LPA_100FULL)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> || (mii_lpa & 0x01C0) == 0x0040;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->mii.full_duplex != duplex) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex = duplex;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (mii_lpa) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: Setting %s-duplex based on MII #%d link"<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>" partner ability of %4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->mii.full_duplex ? "full" : "half",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->phys[0], mii_lpa);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_info("%s: media is unconnected, link down, or incompatible connection\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #if 0<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Unlock);<br>***************<br>*** 1573,1584 ****<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tune_twister (dev, tp);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Media selection tick, Link partner %04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(NWayLPAR));<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Other registers are IntMask %04x IntStatus %04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(IntrMask), RTL_R16(IntrStatus));<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Chip config %02x %02x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R8(Config0), RTL_R8(Config1));<br> }<br><br> static void rtl8139_thread (struct work_struct *work)<br>--- 1657,1669 ----<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tune_twister (dev, tp);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Media selection tick, Link partner %4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, RTL_R16 (NWayLPAR));<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Other registers are IntMask %4.4x IntStatus %4.4x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, RTL_R16 (IntrMask), RTL_R16 (IntrStatus));<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Chip config %2.2x %2.2x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, RTL_R8 (Config0),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R8 (Config1));<br> }<br><br> static void rtl8139_thread (struct work_struct *work)<br>***************<br>*** 1636,1652 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int i;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>u8 tmp8;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R8(ChipCmd), RTL_R16(IntrStatus),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(IntrMask), RTL_R8(MediaStatus));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Emit info to figure out what went wrong. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Tx queue start entry %ld dirty entry %ld\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->cur_tx, tp->dirty_tx);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>for (i = 0; i < NUM_TX_DESC; i++)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Tx descriptor %d is %08lx%s\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> i, RTL_R32(TxStatus0 + (i * 4)),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> i == tp->dirty_tx % NUM_TX_DESC ?<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> " (queue head)" : "");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->xstats.tx_timeouts++;<br><br>--- 1721,1737 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int i;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>u8 tmp8;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Transmit timeout, status %2.2x %4.4x %4.4x media %2.2x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, RTL_R8 (ChipCmd),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_R16(IntrStatus), RTL_R16(IntrMask), RTL_R8(MediaStatus));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Emit info to figure out what went wrong. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Tx queue start entry %ld dirty entry %ld.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, tp->cur_tx, tp->dirty_tx);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>for (i = 0; i < NUM_TX_DESC; i++)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Tx descriptor %d is %8.8lx.%s\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, i, RTL_R32 (TxStatus0 + (i * 4)),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>i == tp->dirty_tx % NUM_TX_DESC ?<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>" (queue head)" : "");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->xstats.tx_timeouts++;<br><br>***************<br>*** 1655,1675 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp8 & CmdTxEnb)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, CmdRxEnb);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_bh(&tp->rx_lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Disable interrupts by clearing the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0x0000);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Stop a shared interrupt from scavenging while we are. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irq(&tp->lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tx_clear (tp);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_irq(&tp->lock);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* ...and finally, reset everything */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_running(dev)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_hw_start (dev);<br>- <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_wake_queue (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_bh(&tp->rx_lock);<br> }<br><br> static void rtl8139_tx_timeout (struct net_device *dev)<br>--- 1740,1766 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp8 & CmdTxEnb)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, CmdRxEnb);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tx_clear (tp);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_hw_start (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> spin_lock_bh(&tp->rx_lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> /* Disable interrupts by clearing the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_W16 (IntrMask, 0x0000);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> /* Stop a shared interrupt from scavenging while we are. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> spin_lock_irq(&tp->lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> rtl8139_tx_clear (tp);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> spin_unlock_irq(&tp->lock);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> /* ...and finally, reset everything */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> if (netif_running(dev)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> rtl8139_hw_start (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> netif_wake_queue (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> }<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> spin_unlock_bh(&tp->rx_lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br> static void rtl8139_tx_timeout (struct net_device *dev)<br>***************<br>*** 1677,1690 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->watchdog_fired = 1;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->have_thread) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>INIT_DELAYED_WORK(&tp->thread, rtl8139_thread);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>schedule_delayed_work(&tp->thread, next_tick);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>! static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> struct net_device *dev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br>--- 1768,1780 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->watchdog_fired = 1;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev && !tp->have_thread) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>INIT_DELAYED_WORK(&tp->thread, rtl8139_thread);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>schedule_delayed_work(&tp->thread, next_tick);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>! static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br>***************<br>*** 1700,1732 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (len < ETH_ZLEN)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>memset(tp->tx_buf[entry], 0, ETH_ZLEN);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev_kfree_skb(skb);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev_kfree_skb(skb);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_dropped++;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return NETDEV_TX_OK;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave(&tp->lock, flags);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/*<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> * Writing to TxStatus triggers a DMA transfer of the data<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> * copied to tp->tx_buf[entry] above. Use a memory barrier<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> * to make sure that the device sees the updated data.<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>wmb();<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_tx++;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_stop_queue (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_irqrestore(&tp->lock, flags);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, tx_queued, dev, "Queued Tx packet size %u to slot %d\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> len, entry);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>return NETDEV_TX_OK;<br> }<br><br><br>--- 1790,1833 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (len < ETH_ZLEN)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>memset(tp->tx_buf[entry], 0, ETH_ZLEN);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) dev_kfree_skb(skb);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) dev_kfree_skb(skb);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_dropped++;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>wmb();<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->trans_start = jiffies;<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_tx++;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave(&tp->lock, flags);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/*<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> * Writing to TxStatus triggers a DMA transfer of the data<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> * copied to tp->tx_buf[entry] above. Use a memory barrier<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> * to make sure that the device sees the updated data.<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>wmb();<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_tx++;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_stop_queue (dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_irqrestore(&tp->lock, flags);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_tx_queued(tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Queued Tx packet size %u to slot %d.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, len, entry);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> }<br><br><br>***************<br>*** 1753,1760 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Note: TxCarrierLost is always asserted at 100mbps. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (txstatus & (TxOutOfWindow | TxAborted)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* There was an major error, log it. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, tx_err, dev, "Transmit error, Tx status %08x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> txstatus);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_errors++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (txstatus & TxAborted) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_aborted_errors++;<br>--- 1854,1862 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Note: TxCarrierLost is always asserted at 100mbps. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (txstatus & (TxOutOfWindow | TxAborted)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* There was an major error, log it. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_tx_err(tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Transmit error, Tx status %8.8x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, txstatus);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_errors++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (txstatus & TxAborted) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.tx_aborted_errors++;<br>***************<br>*** 1783,1791 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> #ifndef RTL8139_NDEBUG<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->cur_tx - dirty_tx > NUM_TX_DESC) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_err(dev, "Out-of-sync dirty pointer, %ld vs. %ld\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dirty_tx, tp->cur_tx);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dirty_tx += NUM_TX_DESC;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #endif /* RTL8139_NDEBUG */<br>--- 1885,1893 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> #ifndef RTL8139_NDEBUG<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev && tp->cur_tx - dirty_tx > NUM_TX_DESC) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_err("%s: Out-of-sync dirty pointer, %ld vs. %ld.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, dirty_tx, tp->cur_tx);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dirty_tx += NUM_TX_DESC;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #endif /* RTL8139_NDEBUG */<br>***************<br>*** 1794,1800 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->dirty_tx != dirty_tx) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->dirty_tx = dirty_tx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mb();<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_wake_queue (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>--- 1896,1902 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->dirty_tx != dirty_tx) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->dirty_tx = dirty_tx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mb();<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) netif_wake_queue (dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>***************<br>*** 1808,1820 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int tmp_work;<br> #endif<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, rx_err, dev, "Ethernet frame had errors, status %08x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> rx_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_errors++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!(rx_status & RxStatusOK)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (rx_status & RxTooLong) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Oversized Ethernet frame, status %04x!\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> rx_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* A.C.: The chip hangs here. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (rx_status & (RxBadSymbol | RxBadAlign))<br>--- 1910,1923 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int tmp_work;<br> #endif<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_rx_err (tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Ethernet frame had errors, status %8.8x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, rx_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_errors++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!(rx_status & RxStatusOK)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (rx_status & RxTooLong) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Oversized Ethernet frame, status %4.4x!\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> <span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, rx_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* A.C.: The chip hangs here. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (rx_status & (RxBadSymbol | RxBadAlign))<br>***************<br>*** 1846,1852 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp_work <= 0)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_warn(dev, "rx stop wait too long\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* restart receive */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tmp_work = 200;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>while (--tmp_work > 0) {<br>--- 1949,1955 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp_work <= 0)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_warning(PFX "rx stop wait too long\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* restart receive */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tmp_work = 200;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>while (--tmp_work > 0) {<br>***************<br>*** 1857,1863 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp_work <= 0)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_warn(dev, "tx/rx enable wait too long\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* and reinitialize all rx related registers */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8_F (Cfg9346, Cfg9346_Unlock);<br>--- 1960,1966 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmp_work <= 0)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_warning(PFX "tx/rx enable wait too long\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* and reinitialize all rx related registers */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8_F (Cfg9346, Cfg9346_Unlock);<br>***************<br>*** 1868,1874 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxConfig, tp->rx_config);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_rx = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "init buffer addresses\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Lock Config[01234] and BMCR register writes */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Lock);<br>--- 1971,1977 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxConfig, tp->rx_config);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_rx = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("init buffer addresses\n");<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Lock Config[01234] and BMCR register writes */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (Cfg9346, Cfg9346_Lock);<br>***************<br>*** 1922,1933 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int cur_rx = tp->cur_rx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int rx_size = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "In %s(), current %04x BufAddr %04x, free to %04x, Cmd %02x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> __func__, (u16)cur_rx,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(RxBufAddr), RTL_R16(RxBufPtr), RTL_R8(ChipCmd));<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>while (netif_running(dev) && received < budget &&<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span> (RTL_R8 (ChipCmd) & RxBufEmpty) == 0) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u32 ring_offset = cur_rx % RX_BUF_LEN;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u32 rx_status;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int pkt_size;<br>--- 2025,2038 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int cur_rx = tp->cur_rx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int rx_size = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: In rtl8139_rx(), current %4.4x BufAddr %4.4x,"<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> " free to %4.4x, Cmd %2.2x.\n", dev->name, (u16)cur_rx,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16 (RxBufAddr),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd));<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>while ((tp->ecdev || netif_running(dev))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>&& received < budget<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>&& (RTL_R8 (ChipCmd) & RxBufEmpty) == 0) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u32 ring_offset = cur_rx % RX_BUF_LEN;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>u32 rx_status;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned int pkt_size;<br>***************<br>*** 1940,1951 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_size = rx_status >> 16;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pkt_size = rx_size - 4;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, rx_status, dev, "%s() status %04x, size %04x, cur %04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> __func__, rx_status, rx_size, cur_rx);<br> #if RTL8139_DEBUG > 2<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>print_hex_dump(KERN_DEBUG, "Frame contents: ",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> DUMP_PREFIX_OFFSET, 16, 1,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> &rx_ring[ring_offset], 70, true);<br> #endif<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Packet copy from FIFO still in progress.<br>--- 2045,2065 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_size = rx_status >> 16;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pkt_size = rx_size - 4;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_rx_status(tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: rtl8139_rx() status %4.4x, size %4.4x,"<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>" cur %4.4x.\n", dev->name, rx_status,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> rx_size, cur_rx);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #if RTL8139_DEBUG > 2<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>{<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>int i;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Frame contents ", dev->name);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>for (i = 0; i < 70; i++)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_cont(" %2.2x",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_ring[ring_offset + i]);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_cont(".\n");<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> #endif<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Packet copy from FIFO still in progress.<br>***************<br>*** 1956,1966 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->fifo_copy_timeout)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->fifo_copy_timeout = jiffies + 2;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>else if (time_after(jiffies, tp->fifo_copy_timeout)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "hung FIFO. Reset\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_size = 0;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto no_early_rx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, intr, dev, "fifo copy in progress\n");<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->xstats.early_rx++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>--- 2070,2083 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->fifo_copy_timeout)<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->fifo_copy_timeout = jiffies + 2;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>else if (time_after(jiffies, tp->fifo_copy_timeout)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: hung FIFO. Reset.", dev->name);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_size = 0;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto no_early_rx;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_intr(tp)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: fifo copy in progress.",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>tp->xstats.early_rx++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>break;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>***************<br>*** 1981,2008 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Malloc up new buffer, compatible with net-2e. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Omit the four octet CRC from the length. */<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb = netdev_alloc_skb_ip_align(dev, pkt_size);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (likely(skb)) {<br> #if RX_BUF_IDX == 3<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);<br> #else<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4], pkt_size);<br> #endif<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_put (skb, pkt_size);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb->protocol = eth_type_trans (skb, dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_bytes += pkt_size;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_packets++;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_receive_skb (skb);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (net_ratelimit())<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_warn(dev, "Memory squeeze, dropping packet\n");<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_dropped++;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>received++;<br><br>--- 2098,2135 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>ecdev_receive(tp->ecdev,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>&rx_ring[ring_offset + 4], pkt_size);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->last_rx = jiffies;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_bytes += pkt_size;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_packets++;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Malloc up new buffer, compatible with net-2e. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Omit the four octet CRC from the length. */<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb = netdev_alloc_skb(dev, pkt_size + NET_IP_ALIGN);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (likely(skb)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_reserve (skb, NET_IP_ALIGN);<span class="Apple-tab-span" style="white-space: pre; "> </span>/* 16 byte align the IP fields. */<br> #if RX_BUF_IDX == 3<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);<br> #else<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4], pkt_size);<br> #endif<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb_put (skb, pkt_size);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>skb->protocol = eth_type_trans (skb, dev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_bytes += pkt_size;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_packets++;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_receive_skb (skb);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (net_ratelimit())<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_warning("%s: Memory squeeze, dropping packet.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_dropped++;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>received++;<br><br>***************<br>*** 2015,2023 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(!received || rx_size == 0xfff0))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_isr_ack(tp);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Done %s(), current %04x BufAddr %04x, free to %04x, Cmd %02x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> __func__, cur_rx,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(RxBufAddr), RTL_R16(RxBufPtr), RTL_R8(ChipCmd));<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_rx = cur_rx;<br><br>--- 2142,2151 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(!received || rx_size == 0xfff0))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_isr_ack(tp);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x,"<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx,<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16 (RxBufAddr),<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd));<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>tp->cur_rx = cur_rx;<br><br>***************<br>*** 2038,2044 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> void __iomem *ioaddr,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> int status, int link_changed)<br> {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "Abnormal interrupt, status %08x\n", status);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (dev != NULL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (tp != NULL);<br>--- 2166,2173 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> void __iomem *ioaddr,<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> int status, int link_changed)<br> {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Abnormal interrupt, status %8.8x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, status);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (dev != NULL);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>assert (tp != NULL);<br>***************<br>*** 2066,2072 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pci_write_config_word (tp->pci_dev, PCI_STATUS, pci_cmd_status);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_err(dev, "PCI Bus error %04x\n", pci_cmd_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>--- 2195,2202 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pci_write_config_word (tp->pci_dev, PCI_STATUS, pci_cmd_status);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_err("%s: PCI Bus error %4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, pci_cmd_status);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> }<br><br>***************<br>*** 2098,2103 ****<br>--- 2228,2238 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return work_done;<br> }<br><br>+ void ec_poll(struct net_device *dev)<br>+ {<br>+ rtl8139_interrupt(0, dev);<br>+ }<br>+<br> /* The interrupt handler does all of the Rx thread work and cleans up<br> after the Tx thread. */<br> static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)<br>***************<br>*** 2109,2120 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int link_changed = 0; /* avoid bogus "uninit" warning */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int handled = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock (&tp->lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>status = RTL_R16 (IntrStatus);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* shared irq? */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely((status & rtl8139_intr_mask) == 0))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>handled = 1;<br><br>--- 2244,2260 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int link_changed = 0; /* avoid bogus "uninit" warning */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int handled = 0;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>status = RTL_R16 (IntrStatus);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock (&tp->lock);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>status = RTL_R16 (IntrStatus);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* shared irq? */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely((status & rtl8139_intr_mask) == 0))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>handled = 1;<br><br>***************<br>*** 2122,2131 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(status == 0xFFFF))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* close possible race's with dev_close */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(!netif_running(dev))) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Acknowledge all of the current interrupt sources ASAP, but<br>--- 2262,2273 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(status == 0xFFFF))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* close possible race's with dev_close */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (unlikely(!netif_running(dev))) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>goto out;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Acknowledge all of the current interrupt sources ASAP, but<br>***************<br>*** 2140,2148 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Receive packets are processed by poll routine.<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> If not running start it now. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (status & RxAckBits){<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (napi_schedule_prep(&tp->napi)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>__napi_schedule(&tp->napi);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>--- 2282,2296 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Receive packets are processed by poll routine.<br> <span class="Apple-tab-span" style="white-space: pre; "> </span> If not running start it now. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (status & RxAckBits){<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* EtherCAT device: Just receive all frames */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_rx(dev, tp, 100); // FIXME<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Mark for polling */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (napi_schedule_prep(&tp->napi)) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>__napi_schedule(&tp->napi);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br>***************<br>*** 2157,2166 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrStatus, TxErr);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> out:<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock (&tp->lock);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "exiting interrupt, intr_status=%#4.4x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(IntrStatus));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return IRQ_RETVAL(handled);<br> }<br><br>--- 2305,2314 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrStatus, TxErr);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br> out:<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tp->ecdev) spin_unlock (&tp->lock);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: exiting interrupt, intr_status=%#4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->name, RTL_R16 (IntrStatus));<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>return IRQ_RETVAL(handled);<br> }<br><br>***************<br>*** 2206,2232 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long flags;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_stop_queue(dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>napi_disable(&tp->napi);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_dbg(tp, ifdown, dev, "Shutting down ethercard, status was 0x%04x\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> RTL_R16(IntrStatus));<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave (&tp->lock, flags);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Stop the chip's Tx and Rx DMA processes. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Disable interrupts by clearing the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Update the error counts. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_missed_errors += RTL_R32 (RxMissed);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxMissed, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_irqrestore (&tp->lock, flags);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>free_irq (dev->irq, dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tx_clear (tp);<br><br>--- 2354,2393 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long flags;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev) {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Stop the chip's Tx and Rx DMA processes. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Disable interrupts by clearing the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Update the error counts. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_missed_errors += RTL_R32 (RxMissed);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxMissed, 0);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>} else {<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>netif_stop_queue(dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>napi_disable(&tp->napi);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_msg_ifdown(tp))<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: Shutting down ethercard, status was 0x%4.4x.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, RTL_R16 (IntrStatus));<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave (&tp->lock, flags);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Stop the chip's Tx and Rx DMA processes. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W8 (ChipCmd, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Disable interrupts by clearing the interrupt mask. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W16 (IntrMask, 0);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Update the error counts. */<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_missed_errors += RTL_R32 (RxMissed);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxMissed, 0);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_unlock_irqrestore (&tp->lock, flags);<br>!<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>free_irq (dev->irq, dev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>}<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_tx_clear (tp);<br><br>***************<br>*** 2449,2455 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int rc;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!netif_running(dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return -EINVAL;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irq(&tp->lock);<br>--- 2610,2616 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int rc;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev || !netif_running(dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return -EINVAL;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irq(&tp->lock);<br>***************<br>*** 2466,2472 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long flags;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (netif_running(dev)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave (&tp->lock, flags);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_missed_errors += RTL_R32 (RxMissed);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxMissed, 0);<br>--- 2627,2633 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>void __iomem *ioaddr = tp->mmio_addr;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>unsigned long flags;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev || netif_running(dev)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>spin_lock_irqsave (&tp->lock, flags);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->stats.rx_missed_errors += RTL_R32 (RxMissed);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>RTL_W32 (RxMissed, 0);<br>***************<br>*** 2487,2494 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int rx_mode;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>u32 tmp;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>netdev_dbg(dev, "rtl8139_set_rx_mode(%04x) done -- Rx config %08lx\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> dev->flags, RTL_R32(RxConfig));<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Note: do not reorder, GCC is clever about common statements. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (dev->flags & IFF_PROMISC) {<br>--- 2648,2655 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>int rx_mode;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>u32 tmp;<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>pr_debug("%s: rtl8139_set_rx_mode(%4.4x) done -- Rx config %8.8lx.\n",<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>dev->name, dev->flags, RTL_R32 (RxConfig));<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>/* Note: do not reorder, GCC is clever about common statements. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>if (dev->flags & IFF_PROMISC) {<br>***************<br>*** 2496,2503 ****<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> AcceptBroadcast | AcceptMulticast | AcceptMyPhys |<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> AcceptAllPhys;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mc_filter[1] = mc_filter[0] = 0xffffffff;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>} else if ((netdev_mc_count(dev) > multicast_filter_limit) ||<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> (dev->flags & IFF_ALLMULTI)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Too many to filter perfectly -- accept all multicasts. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mc_filter[1] = mc_filter[0] = 0xffffffff;<br>--- 2657,2664 ----<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> AcceptBroadcast | AcceptMulticast | AcceptMyPhys |<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> AcceptAllPhys;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mc_filter[1] = mc_filter[0] = 0xffffffff;<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>} else if ((netdev_mc_count(dev) > multicast_filter_limit)<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span> || (dev->flags & IFF_ALLMULTI)) {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Too many to filter perfectly -- accept all multicasts. */<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>mc_filter[1] = mc_filter[0] = 0xffffffff;<br>***************<br>*** 2544,2550 ****<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_save_state (pdev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!netif_running (dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_device_detach (dev);<br>--- 2705,2711 ----<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_save_state (pdev);<br><br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev || !netif_running (dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>netif_device_detach (dev);<br>***************<br>*** 2570,2578 ****<br> static int rtl8139_resume (struct pci_dev *pdev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct net_device *dev = pci_get_drvdata (pdev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_restore_state (pdev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (!netif_running (dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_set_power_state (pdev, PCI_D0);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_init_ring (dev);<br>--- 2731,2740 ----<br> static int rtl8139_resume (struct pci_dev *pdev)<br> {<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>struct net_device *dev = pci_get_drvdata (pdev);<br>+ <span class="Apple-tab-span" style="white-space: pre; "> </span>struct rtl8139_private *tp = netdev_priv(dev);<br><br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_restore_state (pdev);<br>! <span class="Apple-tab-span" style="white-space: pre; "> </span>if (tp->ecdev || !netif_running (dev))<br> <span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>pci_set_power_state (pdev, PCI_D0);<br> <span class="Apple-tab-span" style="white-space: pre; "> </span>rtl8139_init_ring (dev);<br><br><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>_________________________</div><div><br></div><div>Prof. Jacques GANGLOFF</div><div>Phone : +33 (0)3 68 85 44 68</div><div>Mobile : +33 (0)6 43 49 74 29</div><div><br></div><div>Université de Strasbourg</div><div>LSIIT - AVR</div><div>Bd. Sébastien Brant</div><div>BP 10413</div><div>F - 67412 ILLKIRCH</div><div><a href="http://eavr.u-strasbg.fr/~jacques/">http://eavr.u-strasbg.fr/~jacques/</a></div><div>_________________________</div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></body></html>