wctc4xxp: Clear packet error count when reloading firmware.

When the firmware is reloaded and reset, the packet error count is not.
This can create a condition where the firmware could report an error like
the following if a channel was closed without any new errors:

  wctc4xxp 0000:07:08.0: 18446744073709551597 errored receive packets

wcdte.packet_errors is also renamed to wcdte.reported_packet_errors to not
conflict with the packet_errors member of the descriptor lists.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit d5f13c5116)
This commit is contained in:
Shaun Ruffell 2015-06-04 09:19:59 -05:00 committed by Russ Meyerriecks
parent 62d7a00fdc
commit 48032024a3

View File

@ -375,7 +375,7 @@ struct wcdte {
#endif #endif
struct timer_list watchdog; struct timer_list watchdog;
u16 open_channels; u16 open_channels;
unsigned long packet_errors; unsigned long reported_packet_errors;
}; };
struct wcdte_netdev_priv { struct wcdte_netdev_priv {
@ -2024,12 +2024,12 @@ static void wctc4xxp_check_for_rx_errors(struct wcdte *wc)
unsigned long errors = wctc4xxp_get_packet_errors(wc->rxd); unsigned long errors = wctc4xxp_get_packet_errors(wc->rxd);
/* Print warning when the number of errors changes */ /* Print warning when the number of errors changes */
if (wc->packet_errors != errors) { if (wc->reported_packet_errors != errors) {
if (printk_ratelimit()) { if (printk_ratelimit()) {
dev_err(&wc->pdev->dev, dev_err(&wc->pdev->dev,
"%lu errored receive packets.\n", "%lu errored receive packets.\n",
errors - wc->packet_errors); errors - wc->reported_packet_errors);
wc->packet_errors = errors; wc->reported_packet_errors = errors;
} }
} }
} }
@ -3870,6 +3870,7 @@ static int wctc4xxp_reset_driver_state(struct wcdte *wc)
release_firmware(firmware); release_firmware(firmware);
spin_lock_irqsave(&wc->rxd->lock, flags); spin_lock_irqsave(&wc->rxd->lock, flags);
wc->rxd->packet_errors = 0; wc->rxd->packet_errors = 0;
wc->reported_packet_errors = 0;
spin_unlock_irqrestore(&wc->rxd->lock, flags); spin_unlock_irqrestore(&wc->rxd->lock, flags);
return res; return res;
} }