1801 |
1801 |
1802 if (dev == rtl_ecat_dev.dev) |
1802 if (dev == rtl_ecat_dev.dev) |
1803 { |
1803 { |
1804 if (rtl_ecat_dev.state != ECAT_DS_SENT) |
1804 if (rtl_ecat_dev.state != ECAT_DS_SENT) |
1805 { |
1805 { |
1806 EC_DBG(KERN_WARNING "EtherCAT: Wrong status at timeout!\n"); |
1806 EC_DBG(KERN_WARNING "EtherCAT: Wrong status at timeout: %i\n", |
|
1807 rtl_ecat_dev.state); |
1807 } |
1808 } |
1808 else |
1809 |
1809 { |
1810 rtl_ecat_dev.state = ECAT_DS_TIMEOUT; |
1810 rtl_ecat_dev.state = ECAT_DS_TIMEOUT; |
|
1811 } |
|
1812 } |
1811 } |
1813 |
1812 |
1814 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1813 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1815 |
1814 |
1816 /* disable Tx ASAP, if not already */ |
1815 /* disable Tx ASAP, if not already */ |
1877 if (dev != rtl_ecat_dev.dev) dev_kfree_skb(skb); |
1876 if (dev != rtl_ecat_dev.dev) dev_kfree_skb(skb); |
1878 tp->stats.tx_dropped++; |
1877 tp->stats.tx_dropped++; |
1879 return 0; |
1878 return 0; |
1880 } |
1879 } |
1881 |
1880 |
|
1881 /* Note: the chip doesn't have auto-pad! */ |
|
1882 if (dev == rtl_ecat_dev.dev) |
|
1883 { |
|
1884 rt_spin_lock_irq(&tp->lock); |
|
1885 } |
|
1886 else |
|
1887 { |
|
1888 spin_lock_irq(&tp->lock); |
|
1889 } |
|
1890 |
1882 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1891 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1883 |
|
1884 /* Note: the chip doesn't have auto-pad! */ |
|
1885 if(dev == rtl_ecat_dev.dev) |
|
1886 rt_spin_lock_irq(&tp->lock); |
|
1887 else |
|
1888 spin_lock_irq(&tp->lock); |
|
1889 |
1892 |
1890 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1893 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1891 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1894 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1892 |
1895 |
1893 dev->trans_start = jiffies; |
1896 dev->trans_start = jiffies; |
1895 tp->cur_tx++; |
1898 tp->cur_tx++; |
1896 wmb(); |
1899 wmb(); |
1897 |
1900 |
1898 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
1901 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
1899 |
1902 |
1900 if (dev != rtl_ecat_dev.dev && ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)) |
1903 if (dev != rtl_ecat_dev.dev |
|
1904 && ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)) |
|
1905 { |
1901 netif_stop_queue (dev); |
1906 netif_stop_queue (dev); |
|
1907 } |
1902 |
1908 |
1903 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1909 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1904 |
1910 |
1905 if(dev == rtl_ecat_dev.dev) |
1911 if(dev == rtl_ecat_dev.dev) |
1906 rt_spin_unlock_irq(&tp->lock); |
1912 rt_spin_unlock_irq(&tp->lock); |
1928 |
1934 |
1929 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
1935 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
1930 |
1936 |
1931 if (dev == rtl_ecat_dev.dev) |
1937 if (dev == rtl_ecat_dev.dev) |
1932 { |
1938 { |
1933 (rtl_ecat_dev.tx_intr_cnt)++; |
1939 rtl_ecat_dev.tx_intr_cnt++; |
1934 rdtscl(rtl_ecat_dev.tx_time); // Get CPU cycles |
1940 rdtscl(rtl_ecat_dev.tx_time); // Get CPU cycles |
1935 } |
1941 } |
1936 |
1942 |
1937 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
1943 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
1938 |
1944 |
1939 while (tx_left > 0) { |
1945 while (tx_left > 0) { |
1940 int entry = dirty_tx % NUM_TX_DESC; |
1946 int entry = dirty_tx % NUM_TX_DESC; |
1941 int txstatus; |
1947 int txstatus; |
1942 |
1948 |
2121 |
2129 |
2122 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
2130 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
2123 |
2131 |
2124 if (dev == rtl_ecat_dev.dev) |
2132 if (dev == rtl_ecat_dev.dev) |
2125 { |
2133 { |
2126 (rtl_ecat_dev.rx_intr_cnt)++; |
2134 rtl_ecat_dev.rx_intr_cnt++; |
2127 rdtscl(rtl_ecat_dev.rx_time); // Get CPU cycles |
2135 rdtscl(rtl_ecat_dev.rx_time); // Get CPU cycles |
2128 } |
2136 } |
2129 |
2137 |
2130 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2138 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2131 |
2139 |
2151 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
2159 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
2152 |
2160 |
2153 #if RTL8139_DEBUG > 2 |
2161 #if RTL8139_DEBUG > 2 |
2154 if (dev == rtl_ecat_dev.dev) |
2162 if (dev == rtl_ecat_dev.dev) |
2155 { |
2163 { |
2156 int i; |
2164 int i; |
2157 DPRINTK ("%s: Frame contents ", dev->name); |
2165 DPRINTK("%s: Frame contents ", dev->name); |
2158 for (i = 0; i < 70; i++) |
2166 for (i = 0; i < 70; i++) EC_DBG(" %2.2x", rx_ring[ring_offset + i]); |
2159 EC_DBG (" %2.2x", |
2167 EC_DBG(".\n"); |
2160 rx_ring[ring_offset + i]); |
|
2161 EC_DBG (".\n"); |
|
2162 } |
2168 } |
2163 #endif |
2169 #endif |
2164 |
2170 |
2165 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2171 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2166 |
2172 |
2201 skb = dev_alloc_skb(pkt_size + 2); |
2207 skb = dev_alloc_skb(pkt_size + 2); |
2202 |
2208 |
2203 if (skb) |
2209 if (skb) |
2204 { |
2210 { |
2205 skb->dev = dev; |
2211 skb->dev = dev; |
2206 skb_reserve (skb, 2); /* 16 byte align the IP fields. */ |
2212 skb_reserve(skb, 2); /* 16 byte align the IP fields. */ |
2207 eth_copy_and_sum (skb, &rx_ring[ring_offset + 4], pkt_size, 0); |
2213 eth_copy_and_sum(skb, &rx_ring[ring_offset + 4], pkt_size, 0); |
2208 skb_put (skb, pkt_size); |
2214 skb_put (skb, pkt_size); |
2209 skb->protocol = eth_type_trans (skb, dev); // Entfernt auch den Ethernet Header! |
2215 skb->protocol = eth_type_trans(skb, dev); // Entfernt auch den Ethernet Header! |
2210 netif_rx(skb); |
2216 netif_rx(skb); |
2211 |
2217 |
2212 |
|
2213 dev->last_rx = jiffies; |
2218 dev->last_rx = jiffies; |
2214 tp->stats.rx_bytes += pkt_size; |
2219 tp->stats.rx_bytes += pkt_size; |
2215 tp->stats.rx_packets++; |
2220 tp->stats.rx_packets++; |
2216 } |
2221 } |
2217 else |
2222 else |
2358 RTL_W16 (IntrStatus, ackstat); |
2363 RTL_W16 (IntrStatus, ackstat); |
2359 |
2364 |
2360 DPRINTK ("%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.\n", |
2365 DPRINTK ("%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.\n", |
2361 dev->name, ackstat, status, RTL_R16 (IntrStatus)); |
2366 dev->name, ackstat, status, RTL_R16 (IntrStatus)); |
2362 |
2367 |
|
2368 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
|
2369 |
2363 if ((dev == rtl_ecat_dev.dev || netif_running (dev)) && (status & RxAckBits)) |
2370 if ((dev == rtl_ecat_dev.dev || netif_running (dev)) && (status & RxAckBits)) |
2364 rtl8139_rx_interrupt (dev, tp, ioaddr); |
2371 { |
|
2372 rtl8139_rx_interrupt (dev, tp, ioaddr); |
|
2373 } |
|
2374 |
|
2375 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2365 |
2376 |
2366 /* Check uncommon events with one test. */ |
2377 /* Check uncommon events with one test. */ |
2367 if (status & (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | |
2378 if (status & (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | |
2368 RxFIFOOver | RxErr)) |
2379 RxFIFOOver | RxErr)) |
2369 rtl8139_weird_interrupt (dev, tp, ioaddr, |
2380 rtl8139_weird_interrupt (dev, tp, ioaddr, |
2370 status, link_changed); |
2381 status, link_changed); |
2371 |
2382 |
2372 if ((dev == rtl_ecat_dev.dev || netif_running (dev)) && (status & (TxOK | TxErr))) { |
2383 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
|
2384 |
|
2385 if ((dev == rtl_ecat_dev.dev || netif_running (dev)) |
|
2386 && (status & (TxOK | TxErr))) |
|
2387 { |
2373 rtl8139_tx_interrupt (dev, tp, ioaddr); |
2388 rtl8139_tx_interrupt (dev, tp, ioaddr); |
2374 if (status & TxErr) |
2389 if (status & TxErr) |
2375 RTL_W16 (IntrStatus, TxErr); |
2390 RTL_W16 (IntrStatus, TxErr); |
2376 } |
2391 } |
|
2392 |
|
2393 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2377 |
2394 |
2378 boguscnt--; |
2395 boguscnt--; |
2379 } while (boguscnt > 0); |
2396 } while (boguscnt > 0); |
2380 |
2397 |
2381 if (boguscnt <= 0) { |
2398 if (boguscnt <= 0) { |
2789 { |
2806 { |
2790 struct rtl8139_private *np = dev->priv; |
2807 struct rtl8139_private *np = dev->priv; |
2791 struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; |
2808 struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; |
2792 int rc; |
2809 int rc; |
2793 |
2810 |
|
2811 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ |
|
2812 |
2794 if (dev == rtl_ecat_dev.dev || !netif_running(dev)) |
2813 if (dev == rtl_ecat_dev.dev || !netif_running(dev)) |
2795 return -EINVAL; |
2814 return -EINVAL; |
|
2815 |
|
2816 /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ |
2796 |
2817 |
2797 if (cmd == SIOCETHTOOL) |
2818 if (cmd == SIOCETHTOOL) |
2798 rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); |
2819 rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); |
2799 |
2820 |
2800 else { |
2821 else { |