* mcp251x can't drop the can0 Interface
@ 2014-02-07 20:12 John Whitmore
2014-02-08 17:10 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: John Whitmore @ 2014-02-07 20:12 UTC (permalink / raw)
To: linux-can
I guess you might say that I'm playing with an MCP2515 connected to a
RaspberryPi. I've got a problem which I've asked about on the RaspberryPi
forum but have never received an answer, so as a last resort I thought I'd try
here.
Basically I bring up the MCP2515 in listen mode at a certain baud rate. I
wanted to work on auto detetection of baud rate. So after listening for a
period of time at a certain baud rate I try to change the baud rate but I
can't do that with the linux mcp251x driver (I don't think it's the driver's
fault but have no idea whose it is). I've put in some debug statements
to see what happens when I execute "ifconfig can0 down" and basically the
interface goes down momentarily and then gets brough straight back up
again. So when I try to use the "ip" command to set the new baud rate I get an
error that the device is busy.
Now I'm not sure if the issue is in the linux kernel or in the system
utilities "ifconfig" and "ip", but just wondered if anybody has seen this
behaviour. (I saw that there was a book published in January on linux
networking and must see if it deals with internals or just socket
programming.) If somebody could point me in the correct direction to look I'd
be very grateful. Or if somebody can confirm or deny this behaviour.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mcp251x can't drop the can0 Interface
2014-02-07 20:12 mcp251x can't drop the can0 Interface John Whitmore
@ 2014-02-08 17:10 ` Marc Kleine-Budde
2014-02-10 22:28 ` John Whitmore
0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-08 17:10 UTC (permalink / raw)
To: John Whitmore, linux-can
[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]
On 02/07/2014 09:12 PM, John Whitmore wrote:
> I guess you might say that I'm playing with an MCP2515 connected to a
> RaspberryPi. I've got a problem which I've asked about on the RaspberryPi
> forum but have never received an answer, so as a last resort I thought I'd try
> here.
>
> Basically I bring up the MCP2515 in listen mode at a certain baud rate. I
> wanted to work on auto detetection of baud rate. So after listening for a
> period of time at a certain baud rate I try to change the baud rate but I
> can't do that with the linux mcp251x driver (I don't think it's the driver's
> fault but have no idea whose it is). I've put in some debug statements
> to see what happens when I execute "ifconfig can0 down" and basically the
> interface goes down momentarily and then gets brough straight back up
> again. So when I try to use the "ip" command to set the new baud rate I get an
> error that the device is busy.
Please add this patch to the driver:
-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index cdb9808..b1ea15c 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -697,6 +697,8 @@ static int mcp251x_stop(struct net_device *net)
struct mcp251x_priv *priv = netdev_priv(net);
struct spi_device *spi = priv->spi;
+ dump_stack();
+
close_candev(net);
priv->force_quit = 1;
@@ -941,6 +943,8 @@ static int mcp251x_open(struct net_device *net)
unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
int ret;
+ dump_stack();
+
ret = open_candev(net);
if (ret) {
dev_err(&spi->dev, "unable to set initial baudrate!\n");
-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
Then reproduce your problem, then send dmesg output.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: mcp251x can't drop the can0 Interface
2014-02-08 17:10 ` Marc Kleine-Budde
@ 2014-02-10 22:28 ` John Whitmore
2014-02-10 22:34 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: John Whitmore @ 2014-02-10 22:28 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 2498 bytes --]
On Sat, Feb 08, 2014 at 06:10:29PM +0100, Marc Kleine-Budde wrote:
> On 02/07/2014 09:12 PM, John Whitmore wrote:
> > I guess you might say that I'm playing with an MCP2515 connected to a
> > RaspberryPi. I've got a problem which I've asked about on the RaspberryPi
> > forum but have never received an answer, so as a last resort I thought I'd try
> > here.
> >
> > Basically I bring up the MCP2515 in listen mode at a certain baud rate. I
> > wanted to work on auto detetection of baud rate. So after listening for a
> > period of time at a certain baud rate I try to change the baud rate but I
> > can't do that with the linux mcp251x driver (I don't think it's the driver's
> > fault but have no idea whose it is). I've put in some debug statements
> > to see what happens when I execute "ifconfig can0 down" and basically the
> > interface goes down momentarily and then gets brough straight back up
> > again. So when I try to use the "ip" command to set the new baud rate I get an
> > error that the device is busy.
>
> Please add this patch to the driver:
>
> -------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
> diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
> index cdb9808..b1ea15c 100644
> --- a/drivers/net/can/mcp251x.c
> +++ b/drivers/net/can/mcp251x.c
> @@ -697,6 +697,8 @@ static int mcp251x_stop(struct net_device *net)
> struct mcp251x_priv *priv = netdev_priv(net);
> struct spi_device *spi = priv->spi;
>
> + dump_stack();
> +
> close_candev(net);
>
> priv->force_quit = 1;
> @@ -941,6 +943,8 @@ static int mcp251x_open(struct net_device *net)
> unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
> int ret;
>
> + dump_stack();
> +
> ret = open_candev(net);
> if (ret) {
> dev_err(&spi->dev, "unable to set initial baudrate!\n");
>
> -------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
>
> Then reproduce your problem, then send dmesg output.
>
Sorry for the slight delay went from the RaspberryPi 3.6 Kernel to the 3.10 to
see if maybe the later version worked. I'm afraid neither worked.
John
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Industrial Linux Solutions | Phone: +49-231-2826-924 |
> Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
>
[-- Attachment #2: dmesg.zip --]
[-- Type: application/zip, Size: 15873 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mcp251x can't drop the can0 Interface
2014-02-10 22:28 ` John Whitmore
@ 2014-02-10 22:34 ` Marc Kleine-Budde
2014-02-10 22:43 ` John Whitmore
0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-10 22:34 UTC (permalink / raw)
To: John Whitmore; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
On 02/10/2014 11:28 PM, John Whitmore wrote:
> Sorry for the slight delay went from the RaspberryPi 3.6 Kernel to the 3.10 to
> see if maybe the later version worked. I'm afraid neither worked.
Your "ifplugd" is meesing around with the CAN interface.
> [ 86.044493] CPU: 0 PID: 1713 Comm: ifplugd Not tainted 3.10.29-can+ #2
> [ 86.044583] [<c0013aa4>] (unwind_backtrace+0x0/0xf0) from [<c0010e00>] (show_stack+0x10/0x14)
> [ 86.044642] [<c0010e00>] (show_stack+0x10/0x14) from [<bf00ddd4>] (mcp251x_open+0x18/0x1d0 [mcp251x])
> [ 86.044694] [<bf00ddd4>] (mcp251x_open+0x18/0x1d0 [mcp251x]) from [<c0327544>] (__dev_open+0xd4/0x144)
> [ 86.044728] [<c0327544>] (__dev_open+0xd4/0x144) from [<c0327788>] (__dev_change_flags+0x88/0x130)
> [ 86.044756] [<c0327788>] (__dev_change_flags+0x88/0x130) from [<c032789c>] (dev_change_flags+0x10/0x48)
> [ 86.044795] [<c032789c>] (dev_change_flags+0x10/0x48) from [<c0381ba0>] (devinet_ioctl+0x630/0x6f8)
> [ 86.044839] [<c0381ba0>] (devinet_ioctl+0x630/0x6f8) from [<c031195c>] (sock_ioctl+0x70/0x298)
> [ 86.044882] [<c031195c>] (sock_ioctl+0x70/0x298) from [<c00dc174>] (do_vfs_ioctl+0x7c/0x5c4)
> [ 86.044913] [<c00dc174>] (do_vfs_ioctl+0x7c/0x5c4) from [<c00dc6f4>] (SyS_ioctl+0x38/0x60)
> [ 86.044947] [<c00dc6f4>] (SyS_ioctl+0x38/0x60) from [<c000db40>] (ret_fast_syscall+0x0/0x30)
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mcp251x can't drop the can0 Interface
2014-02-10 22:34 ` Marc Kleine-Budde
@ 2014-02-10 22:43 ` John Whitmore
0 siblings, 0 replies; 5+ messages in thread
From: John Whitmore @ 2014-02-10 22:43 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
On Mon, Feb 10, 2014 at 11:34:45PM +0100, Marc Kleine-Budde wrote:
> On 02/10/2014 11:28 PM, John Whitmore wrote:
> > Sorry for the slight delay went from the RaspberryPi 3.6 Kernel to the 3.10 to
> > see if maybe the later version worked. I'm afraid neither worked.
>
> Your "ifplugd" is meesing around with the CAN interface.
>
> > [ 86.044493] CPU: 0 PID: 1713 Comm: ifplugd Not tainted 3.10.29-can+ #2
> > [ 86.044583] [<c0013aa4>] (unwind_backtrace+0x0/0xf0) from [<c0010e00>] (show_stack+0x10/0x14)
> > [ 86.044642] [<c0010e00>] (show_stack+0x10/0x14) from [<bf00ddd4>] (mcp251x_open+0x18/0x1d0 [mcp251x])
> > [ 86.044694] [<bf00ddd4>] (mcp251x_open+0x18/0x1d0 [mcp251x]) from [<c0327544>] (__dev_open+0xd4/0x144)
> > [ 86.044728] [<c0327544>] (__dev_open+0xd4/0x144) from [<c0327788>] (__dev_change_flags+0x88/0x130)
> > [ 86.044756] [<c0327788>] (__dev_change_flags+0x88/0x130) from [<c032789c>] (dev_change_flags+0x10/0x48)
> > [ 86.044795] [<c032789c>] (dev_change_flags+0x10/0x48) from [<c0381ba0>] (devinet_ioctl+0x630/0x6f8)
> > [ 86.044839] [<c0381ba0>] (devinet_ioctl+0x630/0x6f8) from [<c031195c>] (sock_ioctl+0x70/0x298)
> > [ 86.044882] [<c031195c>] (sock_ioctl+0x70/0x298) from [<c00dc174>] (do_vfs_ioctl+0x7c/0x5c4)
> > [ 86.044913] [<c00dc174>] (do_vfs_ioctl+0x7c/0x5c4) from [<c00dc6f4>] (SyS_ioctl+0x38/0x60)
> > [ 86.044947] [<c00dc6f4>] (SyS_ioctl+0x38/0x60) from [<c000db40>] (ret_fast_syscall+0x0/0x30)
>
oops have to look into that. Learning something new every day. Thanks a
million for your help!
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Industrial Linux Solutions | Phone: +49-231-2826-924 |
> Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-10 22:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 20:12 mcp251x can't drop the can0 Interface John Whitmore
2014-02-08 17:10 ` Marc Kleine-Budde
2014-02-10 22:28 ` John Whitmore
2014-02-10 22:34 ` Marc Kleine-Budde
2014-02-10 22:43 ` John Whitmore
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.