linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
@ 2011-11-28 13:25 Mosler, Martin
  2011-11-28 13:37 ` Wolfgang Grandegger
  2011-11-28 14:22 ` Wolfgang Grandegger
  0 siblings, 2 replies; 7+ messages in thread
From: Mosler, Martin @ 2011-11-28 13:25 UTC (permalink / raw)
  To: linux-can; +Cc: wg, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.

Signed-off-by: Martin Mosler <mmo@zuehlke.com>

--- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
+++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
@@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
    case 0:
        netif_stop_queue(dev);
        dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
+       out_8(&regs->cantier, priv->tx_active);
        return NETDEV_TX_BUSY;
    case 1:
        /*  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 13:25 [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again Mosler, Martin
@ 2011-11-28 13:37 ` Wolfgang Grandegger
  2011-11-28 13:59   ` AW: " Mosler, Martin
  2011-11-28 14:22 ` Wolfgang Grandegger
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2011-11-28 13:37 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

On 11/28/2011 02:25 PM, Mosler, Martin wrote:
> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
> 
> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
> 
> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>     case 0:
>         netif_stop_queue(dev);
>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
> +       out_8(&regs->cantier, priv->tx_active);
>         return NETDEV_TX_BUSY;
>     case 1:
>         /*  

Hm, did you see the error message. Actually, it should never happen, IIRC.

Wolfgang.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 13:37 ` Wolfgang Grandegger
@ 2011-11-28 13:59   ` Mosler, Martin
  2011-11-28 14:08     ` Wolfgang Grandegger
  0 siblings, 1 reply; 7+ messages in thread
From: Mosler, Martin @ 2011-11-28 13:59 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

>> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
>>
>> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
>>
>> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
>> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
>> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>>     case 0:
>>         netif_stop_queue(dev);
>>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
>> +       out_8(&regs->cantier, priv->tx_active);
>>         return NETDEV_TX_BUSY;
>>     case 1:
>>         /*
>
>Hm, did you see the error message. Actually, it should never happen, IIRC.
>
>Wolfgang.

It is in fact a very rare condition, but it was triggered during testing when pulling CAN-HI and CAN-LO lines
to GND and VCC in various combinations to verify how the system is recovering. I am working with a MPC5125 
if this is valuable information. (This was only one issue I ran into, I had to do other modifications for other 
issues as well, but I think they are chip specific, I'll share them in a separate thread if you like).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: AW: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 13:59   ` AW: " Mosler, Martin
@ 2011-11-28 14:08     ` Wolfgang Grandegger
  2011-11-28 14:13       ` AW: " Mosler, Martin
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2011-11-28 14:08 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

On 11/28/2011 02:59 PM, Mosler, Martin wrote:
>>> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
>>>
>>> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
>>>
>>> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
>>> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
>>> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>>>     case 0:
>>>         netif_stop_queue(dev);
>>>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
>>> +       out_8(&regs->cantier, priv->tx_active);
>>>         return NETDEV_TX_BUSY;
>>>     case 1:
>>>         /*
>>
>> Hm, did you see the error message. Actually, it should never happen, IIRC.
>>
>> Wolfgang.
> 
> It is in fact a very rare condition, but it was triggered during testing when pulling CAN-HI and CAN-LO lines
> to GND and VCC in various combinations to verify how the system is recovering. I am working with a MPC5125 
> if this is valuable information. (This was only one issue I ran into, I had to do other modifications for other 
> issues as well, but I think they are chip specific, I'll share them in a separate thread if you like).

Sounds like a problem with bus-off recovery. The software has restarted
the queue but the TX objects are still active. How do you handle
bus-offs? Manually? restart-ms = ?

Would be great if you post patches for your other issues.

Wolfgang.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: AW: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 14:08     ` Wolfgang Grandegger
@ 2011-11-28 14:13       ` Mosler, Martin
  2011-11-28 14:31         ` Wolfgang Grandegger
  0 siblings, 1 reply; 7+ messages in thread
From: Mosler, Martin @ 2011-11-28 14:13 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

>>>> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
>>>>
>>>> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
>>>>
>>>> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
>>>> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
>>>> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>>>>     case 0:
>>>>         netif_stop_queue(dev);
>>>>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
>>>> +       out_8(&regs->cantier, priv->tx_active);
>>>>         return NETDEV_TX_BUSY;
>>>>     case 1:
>>>>         /*
>>>
>>> Hm, did you see the error message. Actually, it should never happen, IIRC.
>>>
>>> Wolfgang.
>>
>> It is in fact a very rare condition, but it was triggered during testing when pulling CAN-HI and CAN-LO lines
>> to GND and VCC in various combinations to verify how the system is recovering. I am working with a MPC5125
>> if this is valuable information. (This was only one issue I ran into, I had to do other modifications for other
>> issues as well, but I think they are chip specific, I'll share them in a separate thread if you like).
>
>Sounds like a problem with bus-off recovery. The software has restarted
>the queue but the TX objects are still active. How do you handle
>bus-offs? Manually? restart-ms = ?
>
>Would be great if you post patches for your other issues.
>
>Wolfgang.

We are using restart-ms = 500 for now.

I'll post the other patches after I know I did the submit process correctly for this one and when I reviewed 
them more closely, as it is my first submission to the kernel.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 13:25 [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again Mosler, Martin
  2011-11-28 13:37 ` Wolfgang Grandegger
@ 2011-11-28 14:22 ` Wolfgang Grandegger
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Grandegger @ 2011-11-28 14:22 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

On 11/28/2011 02:25 PM, Mosler, Martin wrote:
> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.

Please break lines after 72 chars, or so.

> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
> 
> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>     case 0:
>         netif_stop_queue(dev);
>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
> +       out_8(&regs->cantier, priv->tx_active);
>         return NETDEV_TX_BUSY;
>     case 1:
>         /*  

I cannot apply this patch. It is white space mangled (no tabs but
spaces, etc.). Please fix your mail agent or, even better, use "git
send-email".

Wolfgang.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: AW: AW: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
  2011-11-28 14:13       ` AW: " Mosler, Martin
@ 2011-11-28 14:31         ` Wolfgang Grandegger
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Grandegger @ 2011-11-28 14:31 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can, socketcan, lucas.demarchi, davem, mkl, netdev, linux-kernel

On 11/28/2011 03:13 PM, Mosler, Martin wrote:
>>>>> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
>>>>>
>>>>> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
>>>>>
>>>>> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
>>>>> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
>>>>> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>>>>>     case 0:
>>>>>         netif_stop_queue(dev);
>>>>>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
>>>>> +       out_8(&regs->cantier, priv->tx_active);
>>>>>         return NETDEV_TX_BUSY;
>>>>>     case 1:
>>>>>         /*
>>>>
>>>> Hm, did you see the error message. Actually, it should never happen, IIRC.
>>>>
>>>> Wolfgang.
>>>
>>> It is in fact a very rare condition, but it was triggered during testing when pulling CAN-HI and CAN-LO lines
>>> to GND and VCC in various combinations to verify how the system is recovering. I am working with a MPC5125
>>> if this is valuable information. (This was only one issue I ran into, I had to do other modifications for other
>>> issues as well, but I think they are chip specific, I'll share them in a separate thread if you like).
>>
>> Sounds like a problem with bus-off recovery. The software has restarted
>> the queue but the TX objects are still active. How do you handle
>> bus-offs? Manually? restart-ms = ?
>>
>> Would be great if you post patches for your other issues.
>>
>> Wolfgang.
> 
> We are using restart-ms = 500 for now.

OK. How the hardware recovers on bus-off on the MPC51xx and especially
on the MPC51xx is still a mystery to me. I think the real problem is
that the software does not wait until the hardware has fully recovered
from bus-off by going to error active. Do you have a kernel log (dmesg
output) with CONFIG_CAN_DEBUG_DEVICES=y and CONFIG_PRINTK_TIME=y?

> I'll post the other patches after I know I did the submit process correctly for this one and when I reviewed 
> them more closely, as it is my first submission to the kernel.

I just commented on that.

Thanks.

Wolfgang.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-28 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28 13:25 [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again Mosler, Martin
2011-11-28 13:37 ` Wolfgang Grandegger
2011-11-28 13:59   ` AW: " Mosler, Martin
2011-11-28 14:08     ` Wolfgang Grandegger
2011-11-28 14:13       ` AW: " Mosler, Martin
2011-11-28 14:31         ` Wolfgang Grandegger
2011-11-28 14:22 ` Wolfgang Grandegger

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).