Hi Jacob,
On 29.08.22 15:20, Jacob Kroon wrote:
Hi Wolfgang and Marc,
On 8/29/22 11:14, Jacob Kroon wrote:
On 8/26/22 13:24, Jacob Kroon wrote:
On 8/25/22 15:25, Jacob Kroon wrote:
Hi,
I am using a CM-ITC board
(https://www.compulab.com/products/computer-on-modules/cm-itc/) with
an application that uses the CAN interface. After a while of
successfully sending packets, sendto() starts returning ENOBUFS. I
wait a whole second and try to send, several retries, but I get
ENOBUFS every time. I'm using kernel 5.15.59, and I've tried both
the pch_can and c_can_pci driver, but both show the same error.
In the console I see several of:
can0: can_put_echo_skb: BUG! echo_skb 0 is occupied
I've also tried to increase the txqueuelen to 1000, as suggested here
https://stackoverflow.com/questions/40424433/write-no-buffer-space-available-socket-can-linux-can
but I think that if I increase the queuelen the threads just block
forever in sendto() (sockets are opened in blocking mode)
If I bring down the interface with
ifconfig can0 down
ifconfig can0 up
the transmitting does get unblocked.
Is there anything I can do to debug this further ? Any other ideas ?
First I get the print:
can_put_echo_skb: BUG! echo_skb 0 is occupied!
then netif_stop_queue() is called from here:
https://github.com/torvalds/linux/blob/master/drivers/net/can/c_can/c_can_main.c#L469
and then there is no call to netif_start_queue(), so the bus hangs.
Switching back to the pch_can driver. I'm guessing here but it would
seem that the driver is not receiving the TX interrupt for
'PCH_TX_OBJ_END' that would wake up the netif queue, since with the
changes below I can't reproduce the hang, although I'm still seeing a
lot of "echo_skb <x> is occupied!":
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 964c8a09226a..75ad2272d9b2 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -719,8 +720,7 @@ static void pch_can_tx_complete(struct net_device
*ndev, u32 int_stat)
PCH_IF_MCONT_DLC);
stats->tx_bytes += dlc;
stats->tx_packets++;
- if (int_stat == PCH_TX_OBJ_END)
- netif_wake_queue(ndev);
+ netif_wake_queue(ndev);
}
Is there a recommended driver for the Intel EG20T PCH CAN controller ?
pch_can or c_can_pci ?
I'm very happy that you show up with this question!
AFAIK the PCH_CAN driver was contributed by some OKI developers on
behalf of Intel to support their EG20T platform. This driver has not
been worked on for years now.
Later the C_CAN driver got its PCI support which should have made the
PCH_CAN driver obsolete as they are both using the C_CAN IP core.
So my suggestion would be to work with the well maintained c_can_pci and
mark the pch_can obsolete in the Linux kernel.
IIRC Marc is very experienced with the C_CAN driver but he is still on
vacation this week.
Regarding your problem:
"BUG! echo_skb 0 is occupied" should never show up but I wonder if you
probably have another CAN specific problem with your setup.
Did you set up a CAN network with at least two CAN nodes, identical
bitrate settings and 2x120 Ohms (== 60 Ohms) termination between CAN_L
and CAN_H?
Do you have another CAN node which can be attached to the EG20T setup
(e.g. some ECU or an USB CAN adapter)?
Best regards,
Oliver