Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ec4f2d3 authored by Sameer Nanda's avatar Sameer Nanda Committed by David S. Miller
Browse files

forcedeth: allow to silence "TX timeout" debug messages



This adds a new module parameter "debug_tx_timeout" to silence most
debug messages in case of TX timeout. These messages don't provide a
signal/noise ratio high enough for production systems and, with ~30kB
logged each time, they tend to add to a cascade effect if the system
is already under stress (memory pressure, disk, etc.).

By default, the parameter is clear, meaning that only a single warning
will be reported.

Signed-off-by: default avatarDavid Decotigny <david.decotigny@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89328783
Loading
Loading
Loading
Loading
+57 −41
Original line number Original line Diff line number Diff line
@@ -891,6 +891,11 @@ enum {
};
};
static int dma_64bit = NV_DMA_64BIT_ENABLED;
static int dma_64bit = NV_DMA_64BIT_ENABLED;


/*
 * Debug output control for tx_timeout
 */
static bool debug_tx_timeout = false;

/*
/*
 * Crossover Detection
 * Crossover Detection
 * Realtek 8201 phy + some OEM boards do not work properly.
 * Realtek 8201 phy + some OEM boards do not work properly.
@@ -2477,20 +2482,23 @@ static void nv_tx_timeout(struct net_device *dev)
	u32 status;
	u32 status;
	union ring_type put_tx;
	union ring_type put_tx;
	int saved_tx_limit;
	int saved_tx_limit;
	int i;


	if (np->msi_flags & NV_MSI_X_ENABLED)
	if (np->msi_flags & NV_MSI_X_ENABLED)
		status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
		status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
	else
	else
		status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;
		status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;


	netdev_info(dev, "Got tx_timeout. irq: %08x\n", status);
	netdev_warn(dev, "Got tx_timeout. irq status: %08x\n", status);

	if (unlikely(debug_tx_timeout)) {
		int i;


		netdev_info(dev, "Ring at %lx\n", (unsigned long)np->ring_addr);
		netdev_info(dev, "Ring at %lx\n", (unsigned long)np->ring_addr);
		netdev_info(dev, "Dumping tx registers\n");
		netdev_info(dev, "Dumping tx registers\n");
		for (i = 0; i <= np->register_size; i += 32) {
		for (i = 0; i <= np->register_size; i += 32) {
			netdev_info(dev,
			netdev_info(dev,
			    "%3x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
				    "%3x: %08x %08x %08x %08x "
				    "%08x %08x %08x %08x\n",
				    i,
				    i,
				    readl(base + i + 0), readl(base + i + 4),
				    readl(base + i + 0), readl(base + i + 4),
				    readl(base + i + 8), readl(base + i + 12),
				    readl(base + i + 8), readl(base + i + 12),
@@ -2501,7 +2509,8 @@ static void nv_tx_timeout(struct net_device *dev)
		for (i = 0; i < np->tx_ring_size; i += 4) {
		for (i = 0; i < np->tx_ring_size; i += 4) {
			if (!nv_optimized(np)) {
			if (!nv_optimized(np)) {
				netdev_info(dev,
				netdev_info(dev,
				    "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n",
					    "%03x: %08x %08x // %08x %08x "
					    "// %08x %08x // %08x %08x\n",
					    i,
					    i,
					    le32_to_cpu(np->tx_ring.orig[i].buf),
					    le32_to_cpu(np->tx_ring.orig[i].buf),
					    le32_to_cpu(np->tx_ring.orig[i].flaglen),
					    le32_to_cpu(np->tx_ring.orig[i].flaglen),
@@ -2513,7 +2522,10 @@ static void nv_tx_timeout(struct net_device *dev)
					    le32_to_cpu(np->tx_ring.orig[i+3].flaglen));
					    le32_to_cpu(np->tx_ring.orig[i+3].flaglen));
			} else {
			} else {
				netdev_info(dev,
				netdev_info(dev,
				    "%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x\n",
					    "%03x: %08x %08x %08x "
					    "// %08x %08x %08x "
					    "// %08x %08x %08x "
					    "// %08x %08x %08x\n",
					    i,
					    i,
					    le32_to_cpu(np->tx_ring.ex[i].bufhigh),
					    le32_to_cpu(np->tx_ring.ex[i].bufhigh),
					    le32_to_cpu(np->tx_ring.ex[i].buflow),
					    le32_to_cpu(np->tx_ring.ex[i].buflow),
@@ -2529,6 +2541,7 @@ static void nv_tx_timeout(struct net_device *dev)
					    le32_to_cpu(np->tx_ring.ex[i+3].flaglen));
					    le32_to_cpu(np->tx_ring.ex[i+3].flaglen));
			}
			}
		}
		}
	}


	spin_lock_irq(&np->lock);
	spin_lock_irq(&np->lock);


@@ -6157,6 +6170,9 @@ module_param(phy_cross, int, 0);
MODULE_PARM_DESC(phy_cross, "Phy crossover detection for Realtek 8201 phy is enabled by setting to 1 and disabled by setting to 0.");
MODULE_PARM_DESC(phy_cross, "Phy crossover detection for Realtek 8201 phy is enabled by setting to 1 and disabled by setting to 0.");
module_param(phy_power_down, int, 0);
module_param(phy_power_down, int, 0);
MODULE_PARM_DESC(phy_power_down, "Power down phy and disable link when interface is down (1), or leave phy powered up (0).");
MODULE_PARM_DESC(phy_power_down, "Power down phy and disable link when interface is down (1), or leave phy powered up (0).");
module_param(debug_tx_timeout, bool, 0);
MODULE_PARM_DESC(debug_tx_timeout,
		 "Dump tx related registers and ring when tx_timeout happens");


MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>");
MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>");
MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver");
MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver");