* [PATCH 1/1] niu: panic on reset
@ 2008-09-04 23:55 Santwona.Behera
2008-09-08 20:20 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Santwona.Behera @ 2008-09-04 23:55 UTC (permalink / raw)
To: netdev, davem; +Cc: Matheos Worku, agospoda, Santwona Behera
The reset_task function in the niu driver does not reset the hardware
fully. The buffer addresses and pointers are not being reset/updated in
the hardware and that leads to panic on reset.
Signed-off-by: santwona.behera@sun.com <santwona.behera@sun.com>
---
drivers/net/niu.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index e4765b7..422d7e5 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6006,11 +6006,27 @@ static void niu_reset_task(struct work_struct *work)
niu_stop_hw(np);
+ spin_unlock_irqrestore(&np->lock, flags);
+
+ niu_free_channels(np);
+
+ err = niu_alloc_channels(np);
+ if (err) {
+ dev_err(np->device, PFX "%s:Failed to alloc niu channels\n",
+ np->dev->name);
+ return;
+ }
+
+ spin_lock_irqsave(&np->lock, flags);
+
err = niu_init_hw(np);
if (!err) {
np->timer.expires = jiffies + HZ;
add_timer(&np->timer);
niu_netif_start(np);
+ } else {
+ dev_err(np->device, PFX "%s:Failed to init hw\n",
+ np->dev->name);
}
spin_unlock_irqrestore(&np->lock, flags);
--
1.5.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] niu: panic on reset
2008-09-04 23:55 [PATCH 1/1] niu: panic on reset Santwona.Behera
@ 2008-09-08 20:20 ` David Miller
2008-09-10 17:01 ` Matheos Worku
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2008-09-08 20:20 UTC (permalink / raw)
To: Santwona.Behera; +Cc: netdev, Matheos.Worku, agospoda
From: Santwona.Behera@Sun.COM
Date: Thu, 04 Sep 2008 16:55:16 -0700
[ Please learn how to hit the return key every 80 characters or so,
long lines are very difficult to read on text-only email clients
like the one I use. Expecting auto-formatting and other beautifications
in email readers amongst kernel developers is a very bad idea. ]
> The reset_task function in the niu driver does not reset the
> hardware fully. The buffer addresses and pointers are not being
> reset/updated in the hardware and that leads to panic on reset.
>
> Signed-off-by: santwona.behera@sun.com <santwona.behera@sun.com>
This is way overkill just to fix this bug and it adds a new failure
mode for the driver which is a seriously negative aspect to this fix.
Instead, simply write a function which reloads the buffers addresses
properly instead of calling the functions to free and reallocate all
of these dynamic datastructures just to get those side effects.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] niu: panic on reset
2008-09-08 20:20 ` David Miller
@ 2008-09-10 17:01 ` Matheos Worku
2008-09-10 20:28 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Matheos Worku @ 2008-09-10 17:01 UTC (permalink / raw)
To: David Miller; +Cc: Santwona.Behera, netdev
David Miller wrote:
>From: Santwona.Behera@Sun.COM
>Date: Thu, 04 Sep 2008 16:55:16 -0700
>
>[ Please learn how to hit the return key every 80 characters or so,
> long lines are very difficult to read on text-only email clients
> like the one I use. Expecting auto-formatting and other beautifications
> in email readers amongst kernel developers is a very bad idea. ]
>
>
>
>>The reset_task function in the niu driver does not reset the
>>hardware fully. The buffer addresses and pointers are not being
>>reset/updated in the hardware and that leads to panic on reset.
>>
>>Signed-off-by: santwona.behera@sun.com <santwona.behera@sun.com>
>>
>>
>
>This is way overkill just to fix this bug and it adds a new failure
>mode for the driver which is a seriously negative aspect to this fix.
>
>
Dave,
Thanks for the feedback.
Instead of creating a new function, Santwona was borrowing an existing
logic from niu_change_mtu function. Rather than introducing a new
function and possibly a new failure mode, we were trying to re-use existing
logic, reducing the probability of a new bug.
Regards,
Matheos
>Instead, simply write a function which reloads the buffers addresses
>properly instead of calling the functions to free and reallocate all
>of these dynamic datastructures just to get those side effects.
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] niu: panic on reset
2008-09-10 17:01 ` Matheos Worku
@ 2008-09-10 20:28 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-09-10 20:28 UTC (permalink / raw)
To: Matheos.Worku; +Cc: Santwona.Behera, netdev
From: Matheos Worku <Matheos.Worku@Sun.COM>
Date: Wed, 10 Sep 2008 10:01:42 -0700
> Instead of creating a new function, Santwona was borrowing an existing
> logic from niu_change_mtu function. Rather than introducing a new
> function and possibly a new failure mode, we were trying to re-use existing
> logic, reducing the probability of a new bug.
But in essence the patch does add a new failure mode. It now can fail
if a memory allocation cannot succeed at the current point in time.
That was not true previously, and if you just fix up the buffer pointers
or whatever state to be reset, you won't have this possible failure mode
either.
We should fix this correctly.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-10 20:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-04 23:55 [PATCH 1/1] niu: panic on reset Santwona.Behera
2008-09-08 20:20 ` David Miller
2008-09-10 17:01 ` Matheos Worku
2008-09-10 20:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).