diff mbox

[net-next,V2,13/16] net: fec: print more debug info in fec_timeout

Message ID 1456360619-24390-14-git-send-email-troy.kisky@boundarydevices.com (mailing list archive)
State New, archived
Headers show

Commit Message

Troy Kisky Feb. 25, 2016, 12:36 a.m. UTC
Print the current interrupt flags and mask and
the interrupt state during the last interrupt in
fec_timeout.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
 drivers/net/ethernet/freescale/fec.h      | 1 +
 drivers/net/ethernet/freescale/fec_main.c | 4 ++++
 2 files changed, 5 insertions(+)

Comments

Andy Duan March 4, 2016, 10:06 a.m. UTC | #1
From: Troy Kisky <troy.kisky@boundarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; b38611@freescale.com
> Cc: fabio.estevam@freescale.com; l.stach@pengutronix.de; andrew@lunn.ch;
> tremyfr@gmail.com; linux@arm.linux.org.uk; linux-arm-
> kernel@lists.infradead.org; laci@boundarydevices.com; shawnguo@kernel.org;
> johannes@sipsolutions.net; stillcompiling@gmail.com;
> sergei.shtylyov@cogentembedded.com; arnd@arndb.de; Troy Kisky
> <troy.kisky@boundarydevices.com>
> Subject: [PATCH net-next V2 13/16] net: fec: print more debug info in
> fec_timeout
> 
> Print the current interrupt flags and mask and the interrupt state during the last
> interrupt in fec_timeout.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
>  drivers/net/ethernet/freescale/fec.h      | 1 +
>  drivers/net/ethernet/freescale/fec_main.c | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/freescale/fec.h
> b/drivers/net/ethernet/freescale/fec.h
> index 001200b..615cca1 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -506,6 +506,7 @@ struct fec_enet_private {
>  	unsigned int total_tx_ring_size;
>  	unsigned int total_rx_ring_size;
>  	uint	events;
> +	uint	last_ievents;
> 
>  	struct	platform_device *pdev;
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index afd4060..9a3136b 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1107,6 +1107,9 @@ fec_timeout(struct net_device *ndev)
>  	int i;
>  	uint events = 0;
> 
> +	pr_err("%s: last=%x %x, mask %x\n", __func__, fep->last_ievents,
> +	       readl(fep->hwp + FEC_IEVENT), readl(fep->hwp + FEC_IMASK));
> +
pr_err() -> netdev_err()

I don't want the debug patch enter to the driver.

>  	for (i = 0; i < fep->num_tx_queues; i++) {
>  		struct fec_enet_priv_tx_q *txq = fep->tx_queue[i];
>  		int index;
> @@ -1514,6 +1517,7 @@ fec_enet_interrupt(int irq, void *dev_id)
> 
>  	if (!int_events)
>  		return IRQ_NONE;
> +	fep->last_ievents = int_events;
> 
>  	if (int_events & (FEC_ENET_RXF | FEC_ENET_TXF)) {
>  		if (napi_schedule_prep(&fep->napi)) {
> --
> 2.5.0
Troy Kisky March 4, 2016, 4:05 p.m. UTC | #2
On 3/4/2016 3:06 AM, Fugang Duan wrote:
> From: Troy Kisky <troy.kisky@boundarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
>> To: netdev@vger.kernel.org; davem@davemloft.net; b38611@freescale.com
>> Cc: fabio.estevam@freescale.com; l.stach@pengutronix.de; andrew@lunn.ch;
>> tremyfr@gmail.com; linux@arm.linux.org.uk; linux-arm-
>> kernel@lists.infradead.org; laci@boundarydevices.com; shawnguo@kernel.org;
>> johannes@sipsolutions.net; stillcompiling@gmail.com;
>> sergei.shtylyov@cogentembedded.com; arnd@arndb.de; Troy Kisky
>> <troy.kisky@boundarydevices.com>
>> Subject: [PATCH net-next V2 13/16] net: fec: print more debug info in
>> fec_timeout
>>
>> Print the current interrupt flags and mask and the interrupt state during the last
>> interrupt in fec_timeout.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  drivers/net/ethernet/freescale/fec.h      | 1 +
>>  drivers/net/ethernet/freescale/fec_main.c | 4 ++++
>>  2 files changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec.h
>> b/drivers/net/ethernet/freescale/fec.h
>> index 001200b..615cca1 100644
>> --- a/drivers/net/ethernet/freescale/fec.h
>> +++ b/drivers/net/ethernet/freescale/fec.h
>> @@ -506,6 +506,7 @@ struct fec_enet_private {
>>  	unsigned int total_tx_ring_size;
>>  	unsigned int total_rx_ring_size;
>>  	uint	events;
>> +	uint	last_ievents;
>>
>>  	struct	platform_device *pdev;
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c
>> index afd4060..9a3136b 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -1107,6 +1107,9 @@ fec_timeout(struct net_device *ndev)
>>  	int i;
>>  	uint events = 0;
>>
>> +	pr_err("%s: last=%x %x, mask %x\n", __func__, fep->last_ievents,
>> +	       readl(fep->hwp + FEC_IEVENT), readl(fep->hwp + FEC_IMASK));
>> +
> pr_err() -> netdev_err()
> 


Sounds good
Joe Perches March 4, 2016, 5:35 p.m. UTC | #3
On Fri, 2016-03-04 at 09:05 -0700, Troy Kisky wrote:
> On 3/4/2016 3:06 AM, Fugang Duan wrote:
> > From: Troy Kisky <troy.kisky@boundarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
[]
> > > Print the current interrupt flags and mask and the interrupt state during the last
> > > interrupt in fec_timeout.
[]
> > > diff --git a/drivers/net/ethernet/freescale/fec_main.c
[]
> > > @@ -1107,6 +1107,9 @@ fec_timeout(struct net_device *ndev)
> > >  	int i;
> > >  	uint events = 0;
> > > 
> > > +	pr_err("%s: last=%x %x, mask %x\n", __func__, fep->last_ievents,
> > > +	       readl(fep->hwp + FEC_IEVENT), readl(fep->hwp + FEC_IMASK));
> > > +
> > pr_err() -> netdev_err()
> Sounds good

This seems like debugging information rather than
an error a user can do anything with and if there's
a timeout, how likely is it that the hardware is
hosed and this would  repetitively and unnecessarily
fill up logs?

So maybe netdev_dbg and net_ratelimit() too.

	if (net_ratelimit()
		netdev_<level>(etc...)
Troy Kisky March 4, 2016, 7:06 p.m. UTC | #4
On 3/4/2016 10:35 AM, Joe Perches wrote:
> On Fri, 2016-03-04 at 09:05 -0700, Troy Kisky wrote:
>> On 3/4/2016 3:06 AM, Fugang Duan wrote:
>>> From: Troy Kisky <troy.kisky@boundarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
> []
>>>> Print the current interrupt flags and mask and the interrupt state during the last
>>>> interrupt in fec_timeout.
> []
>>>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> []
>>>> @@ -1107,6 +1107,9 @@ fec_timeout(struct net_device *ndev)
>>>>  	int i;
>>>>  	uint events = 0;
>>>>
>>>> +	pr_err("%s: last=%x %x, mask %x\n", __func__, fep->last_ievents,
>>>> +	       readl(fep->hwp + FEC_IEVENT), readl(fep->hwp + FEC_IMASK));
>>>> +
>>> pr_err() -> netdev_err()
>> Sounds good
> 
> This seems like debugging information rather than
> an error a user can do anything with and if there's
> a timeout, how likely is it that the hardware is
> hosed and this would  repetitively and unnecessarily
> fill up logs?
> 
> So maybe netdev_dbg and net_ratelimit() too.
> 
> 	if (net_ratelimit()
> 		netdev_<level>(etc...)
> 
> 

This patch hasn't been helpful to me in quite a while. I'll just drop it.
I know where to get it if I need it again.


Thanks
Troy
diff mbox

Patch

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 001200b..615cca1 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -506,6 +506,7 @@  struct fec_enet_private {
 	unsigned int total_tx_ring_size;
 	unsigned int total_rx_ring_size;
 	uint	events;
+	uint	last_ievents;
 
 	struct	platform_device *pdev;
 
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index afd4060..9a3136b 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1107,6 +1107,9 @@  fec_timeout(struct net_device *ndev)
 	int i;
 	uint events = 0;
 
+	pr_err("%s: last=%x %x, mask %x\n", __func__, fep->last_ievents,
+	       readl(fep->hwp + FEC_IEVENT), readl(fep->hwp + FEC_IMASK));
+
 	for (i = 0; i < fep->num_tx_queues; i++) {
 		struct fec_enet_priv_tx_q *txq = fep->tx_queue[i];
 		int index;
@@ -1514,6 +1517,7 @@  fec_enet_interrupt(int irq, void *dev_id)
 
 	if (!int_events)
 		return IRQ_NONE;
+	fep->last_ievents = int_events;
 
 	if (int_events & (FEC_ENET_RXF | FEC_ENET_TXF)) {
 		if (napi_schedule_prep(&fep->napi)) {