===================================================================================================
[[ ---- patch snippet ---- ]]
===================================================================================================
@@ -64,6 +64,12 @@
#include "davinci_cpdma.h"
+//// DEBUGGING ONLY!!!!
+#include <linux/jiffies.h>
+static unsigned long qstopped_jifs = 0;
+static unsigned long poll_func_jifs = 0;
+static u32 last_num_rx_pkts = 0, last_num_tx_pkts = 0;
+
static int debug_level;
module_param(debug_level, int, 0);
MODULE_PARM_DESC(debug_level, "DaVinci EMAC debug level (NETIF_MSG bits)");
@@ -1055,7 +1061,19 @@
* queue is stopped then start the queue as we have free desc for tx
*/
if (unlikely(netif_queue_stopped(ndev)))
+ {
netif_wake_queue(ndev);
+ if (qstopped_jifs > 0)
+ {
+ // we've been stopped, measure how long
+ if ( time_after_eq(jiffies, (qstopped_jifs + HZ/2)) )
+ {
+ // we've been stopped >= 1/2 second!!!
+ printk(KERN_ERR "===EMAC: TX queue has been stopped for > 1/2 second!!!\n");
+ }
+ }
+ qstopped_jifs = 0;
+ }
ndev->stats.tx_packets++;
ndev->stats.tx_bytes += len;
dev_kfree_skb_any(skb);
@@ -1105,7 +1123,11 @@
* tell the kernel to stop sending us tx frames.
*/
if (unlikely(!cpdma_check_free_tx_desc(priv->txchan)))
+ {
netif_stop_queue(ndev);
+ // we just stopped, record the time
+ qstopped_jifs = jiffies;
+ }
return NETDEV_TX_OK;
@@ -1374,6 +1396,15 @@
u32 status = 0;
u32 num_tx_pkts = 0, num_rx_pkts = 0;
+
+unsigned long tmp = jiffies;
+if ( time_after_eq(tmp, (poll_func_jifs + HZ/2)) )
+{
+ // we've been stopped >= 1/2 second!!!
+ printk(KERN_ERR "===EMAC: POLL FUNCTION, last RX/TX=[%d][%d]\n", last_num_rx_pkts, last_num_tx_pkts);
+}
+poll_func_jifs = tmp;
+
/* Check interrupt vectors and call packet processing */
status = emac_read(EMAC_MACINVECTOR);
@@ -1385,6 +1416,10 @@
if (status & mask) {
num_tx_pkts = cpdma_chan_process(priv->txchan,
EMAC_DEF_TX_MAX_SERVICE);
+ if (num_tx_pkts < 0)
+ {
+printk(KERN_ERR "=== ERR!!! num_tx_pkts=%d\n", num_tx_pkts);
+ }
} /* TX processing */
mask = EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC;
@@ -1394,8 +1429,17 @@
if (status & mask) {
num_rx_pkts = cpdma_chan_process(priv->rxchan, budget);
+ if (num_rx_pkts < 0)
+ {
+printk(KERN_ERR "=== ERR!!! num_rx_pkts=%d\n", num_rx_pkts);
+ }
} /* RX processing */
+
+last_num_tx_pkts = num_tx_pkts;
+last_num_rx_pkts = num_rx_pkts;
+
+
mask = EMAC_DM644X_MAC_IN_VECTOR_HOST_INT;
if (priv->version == EMAC_VERSION_2)
mask = EMAC_DM646X_MAC_IN_VECTOR_HOST_INT;