Skip to contentSkip to conversation

can/usb: Add PEAK-System PCAN USB adapters driver

PATCH Superseded Stephane Grosjean 3 participants 11 messages Feb 17, 2012 – Feb 22, 2012 CAN network drivers

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover can/usb: Add PEAK-System PCAN USB adapters driver

That serie of patches adds the peak_usb driver which handles the PCAN-USB and PCAN-USB Pro adapters from PEAK-System (http://www.peak-system.com).
These patches are planned for kernel v3.02.00 and above.

Stephane Grosjean (3):
can/usb: PEAK-System Technik USB adapters driver core can/usb: PEAK-System Technik PCAN-USB specific part can/usb: PEAK-System Technik PCAN-USB Pro specific part

 drivers/net/can/usb/Kconfig                  |    5 +
 drivers/net/can/usb/Makefile                 |    1 +
 drivers/net/can/usb/peak_usb/Makefile        |    2 +
 drivers/net/can/usb/peak_usb/pcan_usb.c      |  901 ++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |  954 ++++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |  146 ++++
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  | 1036 ++++++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_pro.h  |  178 +++++
 8 files changed, 3223 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/can/usb/peak_usb/Makefile
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.h
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_pro.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_pro.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v5 1/3 can/usb: PEAK-System Technik USB adapters driver core

This patch adds the core of the peak_usb driver which handles PEAK-System Technik PCAN USB adapters. It defines the parts which are common to the PCAN-USB adapters: can network interfaces management, network-to/from-usb data path interface, timestamps management...

---
v5 changes:
- add some missing usb_anchor_urb() before re-submitting IN urbs
- ask now for usb core to free the transfer buffers when freeing urbs
- respin OUT urbs unlinking on device close
- change any (onoff) ? 1 : 0 into !!onoff
- change probe msgs into something closer to other peak_xx drivers

 drivers/net/can/usb/Kconfig                  |    5 +
 drivers/net/can/usb/Makefile                 |    1 +
 drivers/net/can/usb/peak_usb/Makefile        |    2 +
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |  954 ++++++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |  146 ++++
 5 files changed, 1108 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/can/usb/peak_usb/Makefile
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.h
drivers/net/can/usb/Kconfig +5 -0
index 0452549..fd3cd6f 100644
@@ -13,4 +13,9 @@ config CAN_ESD_USB2
           This driver supports the CAN-USB/2 interface
           from esd electronic system design gmbh (http://www.esd.eu).
 
+config CAN_PEAK_USB
+	tristate "PEAK PCAN-USB/USB Pro interfaces"
+	---help---
+	  This driver supports the PCAN-USB and PCAN-USB Pro adapters
+	  from PEAK-System Technik (http://www.peak-system.com).
 endmenu
drivers/net/can/usb/Makefile +1 -0
index fce3cf1..da6d1d3 100644
@@ -4,5 +4,6 @@
 
 obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o
 obj-$(CONFIG_CAN_ESD_USB2) += esd_usb2.o
+obj-$(CONFIG_CAN_PEAK_USB) += peak_usb/
 
 ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
drivers/net/can/usb/peak_usb/Makefile new file +2 -0
new file mode 100644
index 0000000..1aefbc8
@@ -0,0 +1,2 @@
+obj-$(CONFIG_CAN_PEAK_USB) += peak_usb.o
+peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o
drivers/net/can/usb/peak_usb/pcan_usb_core.c new file +954 -0

954 lines not on this page · raw message

drivers/net/can/usb/peak_usb/pcan_usb_core.h new file +146 -0

146 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#2 lore raw
In reply to Stephane Grosjean
Quoted 3 lines · Stephane Grosjean

That serie of patches adds the peak_usb driver which handles the PCAN-USB and PCAN-USB Pro adapters from PEAK-System (http://www.peak-system.com).
These patches are planned for kernel v3.02.00 and above.

Hello Stephane,

i tested this driver on my way back home yesterday.

The error handling looks good now.

But the plug-out of the USB hardware (USB & USBpro) when sending traffic through these interfaces leads to heavy problems.

My setup was

bus0: pcmcia#0, USBpro#0, USB, USB
bus1: pcmcia#1, USBpro#1

I was sending with 'cangen -g0 -i' on both USBpro interfaces.

When unplug the USBpro i got the following kernel dump. After waiting some more seconds after this kernel dump the system crashed finally - i assume he issue corrupted some more kernel internal data structures ...

In the log below the kernel didn't crash immediately therefore i was luckily able to save it.

This behaviour is reproducible with both USB & USBpro under tx load.

Regards,
Oliver

Feb 21 19:38:01 vwagwolkf484 kernel: [  218.383844] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.383861] pcmcia_socket pcmcia_socket0: cs: memory probe 0xf1da0000-0xf2a6ffff: excluding 0xf1f38000-0xf2003fff
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.393616] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 18)
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.404691] CAN device driver interface
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.407556] sja1000 CAN netdevice driver
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.450049] peak_pcmcia 0.0: PEAK-System pcmcia card PC_CAN_CARD fw 1.5
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.453698] peak_pcmcia 0.0: can0 on channel 0 at 0x00012100 irq 18
Feb 21 19:38:01 vwagwolkf484 kernel: [  218.455216] peak_pcmcia 0.0: can1 on channel 1 at 0x00012120 irq 18
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.686726] usb 2-1.3: new high-speed USB device number 6 using ehci_hcd
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779176] usb 2-1.3: config 1 interface 0 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779184] usb 2-1.3: config 1 interface 1 altsetting 0 bulk endpoint 0x86 has invalid maxpacket 64
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779923] usb 2-1.3: New USB device found, idVendor=0c72, idProduct=000d
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779928] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779933] usb 2-1.3: Product: PCAN-USB-PRO DEVICE
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.779936] usb 2-1.3: Manufacturer: PEAK-System Technik GmbH
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.822189] peak_usb 2-1.3:1.0: PEAK-System PCAN-USB Pro hwrev 0 serial FFFFFFFF.00000001 (2 channels)
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.822948] peak_usb 2-1.3:1.0: can2: attached to PCAN-USB Pro channel 0 (device 1)
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.825182] peak_usb 2-1.3:1.0: can3: attached to PCAN-USB Pro channel 1 (device 0)
Feb 21 19:39:18 vwagwolkf484 kernel: [  295.825270] usbcore: registered new interface driver peak_usb
Feb 21 19:49:28 vwagwolkf484 kernel: [  904.970430] peak_pcmcia 0.0: setting BTR0=0x00 BTR1=0x1c
Feb 21 19:49:38 vwagwolkf484 kernel: [  914.219487] peak_pcmcia 0.0: setting BTR0=0x00 BTR1=0x1c
Feb 21 19:49:47 vwagwolkf484 kernel: [  923.079481] peak_usb 2-1.3:1.0: can2: setting ccbt=0x001c0006
Feb 21 19:49:51 vwagwolkf484 kernel: [  927.612330] peak_usb 2-1.3:1.0: can3: setting ccbt=0x001c0006
Feb 21 19:51:07 vwagwolkf484 kernel: [ 1003.785392] can: controller area network core (rev 20090105 abi 8)
Feb 21 19:51:07 vwagwolkf484 kernel: [ 1003.785478] NET: Registered protocol family 29
Feb 21 19:51:07 vwagwolkf484 kernel: [ 1003.791537] can: raw protocol (rev 20090105)
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.796273] usb 2-1.1: new full-speed USB device number 7 using ehci_hcd
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893358] usb 2-1.1: New USB device found, idVendor=0c72, idProduct=000c
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893363] usb 2-1.1: New USB device strings: Mfr=0, Product=3, SerialNumber=0
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893367] usb 2-1.1: Product: VER1:PEAK    
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893368] VER2:02.8.01        
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893368] DAT :06.05.2004
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893369] TIME:09:35:37
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.893370]                              ...
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.895828] peak_usb 2-1.1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
Feb 21 19:57:48 vwagwolkf484 kernel: [ 1403.896329] peak_usb 2-1.1:1.0: can4: attached to PCAN-USB channel 0 (device 46)
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.436831] usb 2-1.4: new full-speed USB device number 8 using ehci_hcd
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533390] usb 2-1.4: New USB device found, idVendor=0c72, idProduct=000c
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533394] usb 2-1.4: New USB device strings: Mfr=0, Product=3, SerialNumber=0
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533398] usb 2-1.4: Product: VER1:PEAK    
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533399] VER2:02.8.01        
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533400] DAT :06.05.2004
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533401] TIME:09:35:37
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.533402]                              ...
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.536035] peak_usb 2-1.4:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
Feb 21 19:57:55 vwagwolkf484 kernel: [ 1410.536525] peak_usb 2-1.4:1.0: can5: attached to PCAN-USB channel 0 (device 255)
Feb 21 20:00:01 vwagwolkf484 kernel: [ 1536.509165] peak_usb 2-1.1:1.0: can4: setting BTR0=0x00 BTR1=0x1c
Feb 21 20:00:06 vwagwolkf484 kernel: [ 1541.171104] peak_usb 2-1.4:1.0: can5: setting BTR0=0x00 BTR1=0x1c
Feb 21 20:27:05 vwagwolkf484 acpid: client 1249[0:0] has disconnected
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519539] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519592] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519632] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519707] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519746] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.523654] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.523701] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.523779] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.523812] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.523905] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.527772] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.527813] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.527898] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.527945] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.528024] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.531890] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.531936] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.532017] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.532070] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.532141] peak_usb 2-1.3:1.0: can2: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.536010] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.536057] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.536135] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.536187] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.536259] peak_usb 2-1.3:1.0: can2: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.540126] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.540172] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.540251] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.540285] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.540377] peak_usb 2-1.3:1.0: can2: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.544244] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.544285] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.544369] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.544418] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.544497] peak_usb 2-1.3:1.0: can2: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.548362] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.548409] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.548488] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.548537] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.548613] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.552483] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.552534] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.552606] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.552662] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.552729] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.556598] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.556642] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.556724] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.556772] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.556850] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.560716] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.560764] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.560842] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.560891] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.564836] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.564884] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.564959] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.565014] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.568951] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.568999] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.569076] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.569110] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.573069] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.573108] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.573194] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.573200] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.581180] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.582981] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.582998] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.583004] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.591165] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.593000] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.593012] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.593028] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.601395] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.603321] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.604797] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.606299] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.610389] usb 2-1.3: USB disconnect, device number 6
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.613502] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615086] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615110] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615114] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615117] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615120] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615124] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615130] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623962] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623969] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623973] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623976] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623980] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623983] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623986] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623990] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623993] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 avahi-daemon[1445]: Withdrawing workstation service for can3.
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.648060] BUG: unable to handle kernel NULL pointer dereference at 00000004
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.649863] IP: [<c104eaf5>] commit_creds+0x15/0xf0
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.651651] *pdpt = 000000002dd77001 *pde = 0000000000000000 
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.653379] Oops: 0000 [#1] SMP 
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.655193] Modules linked in: can_raw can peak_usb peak_pcmcia sja1000 can_dev acpi_cpufreq mperf cpufreq_powersave cpufreq_conservative cpufreq_userspace vcan bnep rfcomm binfmt_misc uinput fuse loop arc4 btusb bluetooth iwlwifi mac80211 snd_hda_codec_hdmi snd_hda_codec_idt pcmcia usbmouse usbhid hid snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq cfg80211 snd_timer snd_seq_device dell_wmi snd sparse_keymap sdhci_pci sdhci soundcore tpm_tis psmouse dell_laptop tpm dcdbas serio_raw i2c_i801 mmc_core yenta_socket rfkill snd_page_alloc wmi tpm_bios battery processor ac evdev power_supply
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.661581] 
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.663608] Pid: 3270, comm: net.agent Not tainted 3.3.0-rc4-00019-g27e74da-dirty #3 Dell Inc. Latitude E6510
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.665862] EIP: 0060:[<c104eaf5>] EFLAGS: 00010246 CPU: 3
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.668036] EIP is at commit_creds+0x15/0xf0
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.670272] EAX: 00000004 EBX: f2790a40 ECX: 000001fa EDX: 00000000
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.672509] ESI: 00000004 EDI: f2974d80 EBP: eddc1dd0 ESP: eddc1dc4
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.674751]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.676738] Process net.agent (pid: 3270, ti=eddc0000 task=f2974d80 task.ti=eddc0000)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.678506] Stack:
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.680242]  f0799380 00000000 00000000 eddc1ddc c10d9261 f0799380 eddc1e4c c1117c2b
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.682105]  00000000 00001812 00000000 f1a408c0 f0799380 b76f1000 f2974d80 00000008
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.683908]  00000001 080606c0 08060320 0805f320 08048000 eddc1e30 08048000 b76f1000
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.685770] Call Trace:
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.687689]  [<c10d9261>] install_exec_creds+0x11/0x40
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.689569]  [<c1117c2b>] load_elf_binary+0x72b/0xa20
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.691356]  [<c1117500>] ? do_mmap+0x70/0x70
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.693140]  [<c10dae4d>] search_binary_handler+0xed/0x310
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.694971]  [<c10dad84>] ? search_binary_handler+0x24/0x310
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.696890]  [<c11172ea>] load_script+0x24a/0x270
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.698746]  [<c10dae46>] ? search_binary_handler+0xe6/0x310
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.700541]  [<c106e335>] ? __lock_release+0x95/0xc0
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.702336]  [<c11170a0>] ? locks_remove_flock+0x120/0x120
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.704206]  [<c10dae4d>] search_binary_handler+0xed/0x310
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.706009]  [<c10dad84>] ? search_binary_handler+0x24/0x310
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.707821]  [<c10db695>] do_execve_common+0x225/0x2a0
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.710234]  [<c10db722>] do_execve+0x12/0x20
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.712394]  [<c100ad82>] sys_execve+0x32/0x70
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.714244]  [<c144be12>] ptregs_execve+0x12/0x18
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.716031]  [<c144bd97>] ? sysenter_do_call+0x12/0x36
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.717882] Code: bc 27 00 00 00 00 e8 6b ff ff ff 5d c3 0f 0b 8d b4 26 00 00 00 00 55 89 e5 57 56 89 c6 53 64 8b 3d 30 b7 69 c1 8b 9f e0 01 00 00 <8b> 00 3b 9f e4 01 00 00 0f 85 c6 00 00 00 8b 06 85 c0 0f 8e ba 
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.720237] EIP: [<c104eaf5>] commit_creds+0x15/0xf0 SS:ESP 0068:eddc1dc4
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.722348] CR2: 0000000000000004
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.724447] ---[ end trace 235c4f770db8b51e ]---
Feb 21 20:27:10 vwagwolkf484 udevd[2643]: 'net.agent' [3270] terminated by signal 9 (Killed)
Feb 21 20:27:10 vwagwolkf484 NetworkManager[1214]:    SCPlugin-Ifupdown: devices removed (path: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/net/can3, iface: can3)
Feb 21 20:27:10 vwagwolkf484 avahi-daemon[1445]: Withdrawing workstation service for can2.
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.739715] peak_usb 2-1.3:1.0: can3 removed
Feb 21 20:27:10 vwagwolkf484 NetworkManager[1214]:    SCPlugin-Ifupdown: devices removed (path: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/net/can2, iface: can2)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.771675] peak_usb 2-1.3:1.0: can2 removed
Feb 21 20:27:19 vwagwolkf484 dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
Feb 21 20:27:32 vwagwolkf484 dhclient: No DHCPOFFERS received.
Feb 21 20:27:32 vwagwolkf484 dhclient: No working leases in persistent database - sleeping.
#3 lore raw
Quoted 5 lines · Oliver Hartkopp
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519539] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519592] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519632] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519707] peak_usb 2-1.3:1.0: can3: Rx URB aborted (-71)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.519746] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!

(..)

Quoted 7 lines
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615114] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615117] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615120] peak_usb 2-1.3:1.0: can2: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615124] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.615130] peak_usb 2-1.3:1.0: can_put_echo_skb: BUG! echo_skb is occupied!
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623962] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
Feb 21 20:27:10 vwagwolkf484 kernel: [ 3162.623969] peak_usb 2-1.3:1.0: can3: Tx URB aborted (-108)
-71  => EPROTO          71      /* Protocol error */
-108 => ESHUTDOWN       108     /* Cannot send after transport endpoint shutdown */

+/*
+ * callback for bulk Tx urb
+ */
+static void peak_usb_write_bulk_callback(struct urb *urb) +{

+       struct peak_tx_urb_context *context = urb->context;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;

+
+ BUG_ON(!context);
+
+ dev = context->dev;
+ netdev = dev->netdev;
+
+ atomic_dec(&dev->active_tx_urbs);
+
+ if (!netif_device_present(netdev))
+ return;
+
+ switch (urb->status) {
+ case 0: /* tx ok */
+ netdev->trans_start = jiffies;
+

+               /* transmission complete interrupt */
+               netdev->stats.tx_packets++;
+               netdev->stats.tx_bytes += context->dlc;

+
+ can_get_echo_skb(netdev, context->echo_index);
+ break;
+
+ case -ENOENT: /* on ifconfig down */
+ break;
+ default:
+ netdev_err(netdev, "Tx URB aborted (%d)\n", urb->status);

Just printing this status and continue with business as usual (netif_wake_queue!) is probably not the right approach 8-)

Please check if it makes sense to check (urb->status != 0) earlier in this callback function.

+ }
+
+ /* release context */
+ context->echo_index = PCAN_USB_MAX_TX_URBS;
+
+ netif_wake_queue(netdev);
+}

#4 lore raw
Quoted 7 lines · Oliver Hartkopp

On 22.02.2012 08:05, Oliver Hartkopp wrote:

Just printing this status and continue with business as usual (netif_wake_queue!) is probably not the right approach 8-)

Please check if it makes sense to check (urb->status != 0) earlier in this callback function.

Hi Oliver,

I took time to have a look to how things are done in other (net+usb) drivers and it's not easy to conclude to anything: some are testing that status (but with some other errno values) while others are always waking up the netdev queues... So, I tried to do a "mixed-of", cleaned up the code and tested it in (something like) your conditions, that is:

PC1:
can0 -> usb-pro ch1 -+
can1 -> usb-pro ch2 |
can2 -> usb ---------+

                     | 1Mpbs

PC2: |
can0 -> pcmcia ch1 --+

PC1:
cangen -g0 -i can0
cangen -g0 -i can2
candump any

I did the two following tests:

- removing the peak_usb driver while sending/reading data:

[ 4354.534576] peak_usb 1-1:1.0: can0: attached to PCAN-USB Pro channel 0 (device 1898240)
[ 4354.535574] peak_usb 1-1:1.0: can1: attached to PCAN-USB Pro channel 1 (device 2)
[ 4360.388020] usb 4-1: new full speed USB device number 7 using uhci_hcd
[ 4360.588035] peak_usb 4-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
[ 4360.592034] peak_usb 4-1:1.0: can2: attached to PCAN-USB channel 0 (device 255)
[ 4363.753037] peak_usb 1-1:1.0: can0: setting ccbt=0x00140006
[ 4363.770637] peak_usb 1-1:1.0: can1: setting ccbt=0x00140006
[ 4363.787775] peak_usb 4-1:1.0: can2: setting BTR0=0x00 BTR1=0x14
[ 4385.878968] usbcore: deregistering interface driver peak_usb
[ 4385.920049] peak_usb 4-1:1.0: can2 removed
[ 4385.948036] peak_usb 1-1:1.0: can1 removed
[ 4385.964042] peak_usb 1-1:1.0: can0 removed
[ 4385.964076] peak_usb: PCAN-USB interfaces driver unloaded

=> ok

- unplug the usb then usb-pro adapters while sending/reading data:

[ 5043.008127] peak_usb 4-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
[ 5043.012133] peak_usb 4-1:1.0: can0: attached to PCAN-USB channel 0 (device 255)
[ 5048.029973] peak_usb 1-1:1.0: PEAK-System PCAN-USB Pro hwrev 0 serial FFFFFFFF.00000001 (2 channels)
[ 5048.030596] peak_usb 1-1:1.0: can1: attached to PCAN-USB Pro channel 0 (device 1898240)
[ 5048.031717] peak_usb 1-1:1.0: can2: attached to PCAN-USB Pro channel 1 (device 2)
[ 5053.795570] peak_usb 4-1:1.0: can0: setting BTR0=0x00 BTR1=0x14
[ 5053.825418] peak_usb 1-1:1.0: can1: setting ccbt=0x00140006
[ 5053.844272] peak_usb 1-1:1.0: can2: setting ccbt=0x00140006
[ 5081.440039] usb 4-1: USB disconnect, device number 8
[ 5081.468028] peak_usb 4-1:1.0: can0 removed
[ 5096.856274] usb 1-1: USB disconnect, device number 16
[ 5096.876038] peak_usb 1-1:1.0: can2 removed
[ 5096.896051] peak_usb 1-1:1.0: can1 removed

(then rmmod):

[ 6489.510730] usbcore: deregistering interface driver peak_usb
[ 6489.510756] peak_usb: PCAN-USB interfaces driver unloaded

=> Ok

(I definitively prefer my logs to yours ;-)

In my opinion, the Kernel hangs you got don't come from the netif_wake_queue() wrong usage, but these tests lead to run some failure cases in the driver with potential bad memory usage... So I did a pass on (I hope) all of these cases too. Anyway, this should be better now.

So, if you don't have any other comments or any other (not very friendly) tests, I'm ready to send a new version of the peak_usb.

Once again, thanks for your time.

Stéphane

--
PEAK-System Technik GmbH, Otto-Roehm-Strasse 69, D-64293 Darmstadt Geschaeftsleitung: A.Gach/U.Wilhelm,St.Nr.:007/241/13586 FA Darmstadt HRB-9183 Darmstadt, Ust.IdNr.:DE 202220078, WEE-Reg.-Nr.: DE39305391 Tel.+49 (0)6151-817320 / Fax:+49 (0)6151-817329, [email protected]

#5 lore raw
Quoted 54 lines · Stephane Grosjean
Quoted 9 lines · Oliver Hartkopp

On 22.02.2012 08:05, Oliver Hartkopp wrote:

Just printing this status and continue with business as usual (netif_wake_queue!) is probably not the right approach 8-)

Please check if it makes sense to check (urb->status != 0) earlier in this callback function.

Hi Oliver,

I took time to have a look to how things are done in other (net+usb) drivers and it's not easy to conclude to anything: some are testing that status (but with some other errno values) while others are always waking up the netdev queues... So, I tried to do a "mixed-of", cleaned up the code and tested it in (something like) your conditions, that is:

PC1:
can0 -> usb-pro ch1 -+
can1 -> usb-pro ch2 |
can2 -> usb ---------+

                     | 1Mpbs

PC2: |
can0 -> pcmcia ch1 --+

PC1:
cangen -g0 -i can0
cangen -g0 -i can2
candump any

I did the two following tests:

- removing the peak_usb driver while sending/reading data:

[ 4354.534576] peak_usb 1-1:1.0: can0: attached to PCAN-USB Pro channel 0
(device 1898240)
[ 4354.535574] peak_usb 1-1:1.0: can1: attached to PCAN-USB Pro channel 1
(device 2)
[ 4360.388020] usb 4-1: new full speed USB device number 7 using uhci_hcd
[ 4360.588035] peak_usb 4-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial
FFFFFFFF (1 channel)
[ 4360.592034] peak_usb 4-1:1.0: can2: attached to PCAN-USB channel 0 (device
255)
[ 4363.753037] peak_usb 1-1:1.0: can0: setting ccbt=0x00140006
[ 4363.770637] peak_usb 1-1:1.0: can1: setting ccbt=0x00140006
[ 4363.787775] peak_usb 4-1:1.0: can2: setting BTR0=0x00 BTR1=0x14
[ 4385.878968] usbcore: deregistering interface driver peak_usb
[ 4385.920049] peak_usb 4-1:1.0: can2 removed
[ 4385.948036] peak_usb 1-1:1.0: can1 removed
[ 4385.964042] peak_usb 1-1:1.0: can0 removed
[ 4385.964076] peak_usb: PCAN-USB interfaces driver unloaded
Quoted 1 line

=> ok

Hm - i didn't test that so far.

But nice it works :-)

Quoted 13 lines

- unplug the usb then usb-pro adapters while sending/reading data:

[ 5043.008127] peak_usb 4-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial
FFFFFFFF (1 channel)
[ 5043.012133] peak_usb 4-1:1.0: can0: attached to PCAN-USB channel 0 (device
255)
[ 5048.029973] peak_usb 1-1:1.0: PEAK-System PCAN-USB Pro hwrev 0 serial
FFFFFFFF.00000001 (2 channels)
[ 5048.030596] peak_usb 1-1:1.0: can1: attached to PCAN-USB Pro channel 0
(device 1898240)
[ 5048.031717] peak_usb 1-1:1.0: can2: attached to PCAN-USB Pro channel 1

(device 2)

Quoted 8 lines
[ 5053.795570] peak_usb 4-1:1.0: can0: setting BTR0=0x00 BTR1=0x14
[ 5053.825418] peak_usb 1-1:1.0: can1: setting ccbt=0x00140006
[ 5053.844272] peak_usb 1-1:1.0: can2: setting ccbt=0x00140006
[ 5081.440039] usb 4-1: USB disconnect, device number 8
[ 5081.468028] peak_usb 4-1:1.0: can0 removed
[ 5096.856274] usb 1-1: USB disconnect, device number 16
[ 5096.876038] peak_usb 1-1:1.0: can2 removed
[ 5096.896051] peak_usb 1-1:1.0: can1 removed

Doesn't fit to your described setup ... anyway ...

Quoted 9 lines

(then rmmod):

[ 6489.510730] usbcore: deregistering interface driver peak_usb
[ 6489.510756] peak_usb: PCAN-USB interfaces driver unloaded

=> Ok

(I definitively prefer my logs to yours ;-)

i can imagine that :-)

Pls try the following:

PC1:
can0 -> usb-pro ch1 ----+

can1 -> usb-pro ch2 -+  |
can2 -> usb ---------+  |
                     |  | 1Mpbs
PC2:                 |  |
can0 -> pcmcia ch1 --+  |

can1 -> pcmcia ch2 -----+

PC1:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

PC2:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

and then pull the usb-pro from PC1 ...

That's really unfriendly 8-)

Quoted 9 lines

In my opinion, the Kernel hangs you got don't come from the netif_wake_queue() wrong usage, but these tests lead to run some failure cases in the driver with potential bad memory usage... So I did a pass on (I hope) all of these cases too. Anyway, this should be better now.

So, if you don't have any other comments or any other (not very friendly) tests, I'm ready to send a new version of the peak_usb.

Please check this use-case above. And when it works with your fixed driver you can probalby check the 'old' v5 version to see if you can follow my bug report on your setup.

Best regards,
Oliver

#6 lore raw
Quoted 16 lines · Oliver Hartkopp

Pls try the following:

PC1:

can0 ->  usb-pro ch1 ----+
can1 ->  usb-pro ch2 -+  |
can2 ->  usb ---------+  |
                      |  | 1Mpbs
PC2:                 |  |
can0 ->  pcmcia ch1 --+  |
can1 ->  pcmcia ch2 -----+

PC1:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

Quoted 8 lines

PC2:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

and then pull the usb-pro from PC1 ...

That's really unfriendly 8-)

Ok, I found another cable and set up your tesbed: now the usb-pro is pulled and both "candump" always are displaying data sent by "cangen can0" from PC2 and read from pcan-usb on PC1... Both drivers can be removed without any problem.

Quoted 4 lines

Please check this use-case above. And when it works with your fixed driver you can probalby check the 'old' v5 version to see if you can follow my bug report on your setup.

???
I'm sorry I don't understand what you mean: why should I check the v5 version? And what is (to) "follow your bug report on my setup" ???

Stéphane

--
PEAK-System Technik GmbH, Otto-Roehm-Strasse 69, D-64293 Darmstadt Geschaeftsleitung: A.Gach/U.Wilhelm,St.Nr.:007/241/13586 FA Darmstadt HRB-9183 Darmstadt, Ust.IdNr.:DE 202220078, WEE-Reg.-Nr.: DE39305391 Tel.+49 (0)6151-817320 / Fax:+49 (0)6151-817329, [email protected]

#7 lore raw
Quoted 23 lines · Stephane Grosjean
Quoted 21 lines · Oliver Hartkopp

Pls try the following:

PC1:

can0 ->  usb-pro ch1 ----+
can1 ->  usb-pro ch2 -+  |
can2 ->  usb ---------+  |
                      |  | 1Mpbs
PC2:                 |  |
can0 ->  pcmcia ch1 --+  |
can1 ->  pcmcia ch2 -----+

PC1:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

PC2:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

Quoted 8 lines
Quoted 3 lines

and then pull the usb-pro from PC1 ...

That's really unfriendly 8-)

Ok, I found another cable and set up your tesbed: now the usb-pro is pulled and both "candump" always are displaying data sent by "cangen can0" from PC2 and read from pcan-usb on PC1... Both drivers can be removed without any problem.

cangen can0 only on PC2?

pls put the cangen on PC2 _and_ PC1 as shown above.

Quoted 7 lines
Quoted 4 lines

Please check this use-case above. And when it works with your fixed driver you can probalby check the 'old' v5 version to see if you can follow my bug report on your setup.

???
I'm sorry I don't understand what you mean: why should I check the v5 version?

Didn't you write that you made some changes before the test??

Quoted 1 line

And what is (to) "follow your bug report on my setup" ???

I just wanted to make sure that you can see the same effect with your setup that i had with version 5.

Regards,
Oliver

#8 lore raw
Quoted 29 lines · Oliver Hartkopp
Quoted 27 lines · Stephane Grosjean
Quoted 24 lines · Oliver Hartkopp

Pls try the following:

PC1:

can0 ->   usb-pro ch1 ----+
can1 ->   usb-pro ch2 -+  |
can2 ->   usb ---------+  |
                       |  | 1Mpbs
PC2:                 |  |
can0 ->   pcmcia ch1 --+  |
can1 ->   pcmcia ch2 -----+

PC1:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

PC2:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

and then pull the usb-pro from PC1 ...

That's really unfriendly 8-)

Quoted 8 lines
Quoted 3 lines

Ok, I found another cable and set up your tesbed: now the usb-pro is pulled and both "candump" always are displaying data sent by "cangen can0" from PC2 and read from pcan-usb on PC1... Both drivers can be removed without any problem.

cangen can0 only on PC2?

pls put the cangen on PC2 _and_ PC1 as shown above.

Sorry but your scheme showed cangen only on can0 and can1... which are mapped to usb-pro can interfaces. on PC1, which is pulled from PC1! So, no more can data is sent from PC1! Remains only "cangen can0" from PC2! I just did another test, adding "cangen can2" on PC1 too... Everything is still ok, on both sides...

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Please check this use-case above. And when it works with your fixed driver you can probalby check the 'old' v5 version to see if you can follow my bug report on your setup.

Quoted 8 lines
Quoted 2 lines

???
I'm sorry I don't understand what you mean: why should I check the v5 version?

Didn't you write that you made some changes before the test??

Quoted 1 line

And what is (to) "follow your bug report on my setup" ???

I just wanted to make sure that you can see the same effect with your setup that i had with version 5.

Ok, confusion came from the fact that, once I did modifications into v5, this automatically became a "v6" for me ...
So you want me to reproduce your crash using the "old" v5, right? I already did that, I confirm that the pc hanged with v5, removing the driver and/or pulling (one of) the usb adapters.

Should I now wait for any linux-usb ml review before posting this v6?

Regards,

Stéphane
--
PEAK-System Technik GmbH, Otto-Roehm-Strasse 69, D-64293 Darmstadt Geschaeftsleitung: A.Gach/U.Wilhelm,St.Nr.:007/241/13586 FA Darmstadt HRB-9183 Darmstadt, Ust.IdNr.:DE 202220078, WEE-Reg.-Nr.: DE39305391 Tel.+49 (0)6151-817320 / Fax:+49 (0)6151-817329, [email protected]

#9 lore raw
Quoted 35 lines · Stephane Grosjean
Quoted 34 lines · Oliver Hartkopp
Quoted 31 lines · Stephane Grosjean
Quoted 16 lines · Oliver Hartkopp

Pls try the following:

PC1:

can0 ->   usb-pro ch1 ----+
can1 ->   usb-pro ch2 -+  |
can2 ->   usb ---------+  |
                       |  | 1Mpbs
PC2:                 |  |
can0 ->   pcmcia ch1 --+  |
can1 ->   pcmcia ch2 -----+

PC1:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

Quoted 8 lines

PC2:
cangen -g0 -i can0
cangen -g0 -i can1
candump any

and then pull the usb-pro from PC1 ...

That's really unfriendly 8-)

Ok, I found another cable and set up your tesbed: now the usb-pro is pulled and both "candump" always are displaying data sent by "cangen can0" from PC2 and read from pcan-usb on PC1... Both drivers can be removed without any problem.

Quoted 8 lines
Quoted 4 lines

cangen can0 only on PC2?

pls put the cangen on PC2 _and_ PC1 as shown above.

Sorry but your scheme showed cangen only on can0 and can1... which are mapped to usb-pro can interfaces. on PC1, which is pulled from PC1! So, no more can data is sent from PC1! Remains only "cangen can0" from PC2!

It's not relevant if there's any traffic left, when you pulled the usb-pro.

The trick is to get maximum load (rx AND tx) to the USB adapter when disconnecting the USB.

Therefore putting max tx load to _both_ PCs CAN interfaces was my plan - and this is presented in the testbed description IMHO. Or did i miss anything?

Quoted 2 lines

I just did another test, adding "cangen can2" on PC1 too... Everything is still ok, on both sides...

Fine.

Quoted 10 lines
Quoted 4 lines
Quoted 1 line

And what is (to) "follow your bug report on my setup" ???

I just wanted to make sure that you can see the same effect with your setup that i had with version 5.

Ok, confusion came from the fact that, once I did modifications into v5, this automatically became a "v6" for me ...
So you want me to reproduce your crash using the "old" v5, right? I already did that, I confirm that the pc hanged with v5, removing the driver and/or pulling (one of) the usb adapters.

Ah, ok. That's important. Because if i would had any problems that you do not see in your setup, my testbed might have been broken or my kernel might be misconfigured for that testing purpose.

Quoted 1 line

Should I now wait for any linux-usb ml review before posting this v6?

IMO it makes no sense to review an outdated patch.

Please post your v6 as you did for the v5 - adding some changelog.

Regards,
Oliver

#10 lore raw
In reply to Stephane Grosjean

Hello USB Mailinglist,

Quoted 3 lines · Stephane Grosjean

That serie of patches adds the peak_usb driver which handles the PCAN-USB and PCAN-USB Pro adapters from PEAK-System (http://www.peak-system.com).
These patches are planned for kernel v3.02.00 and above.

Can someone please take a look at the USB related parts of these drivers, please?

regards, Marc

Quoted 22 lines

Stephane Grosjean (3):
can/usb: PEAK-System Technik USB adapters driver core can/usb: PEAK-System Technik PCAN-USB specific part can/usb: PEAK-System Technik PCAN-USB Pro specific part

 drivers/net/can/usb/Kconfig                  |    5 +
 drivers/net/can/usb/Makefile                 |    1 +
 drivers/net/can/usb/peak_usb/Makefile        |    2 +
 drivers/net/can/usb/peak_usb/pcan_usb.c      |  901 ++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |  954 ++++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |  146 ++++
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  | 1036 ++++++++++++++++++++++++++
 drivers/net/can/usb/peak_usb/pcan_usb_pro.h  |  178 +++++
 8 files changed, 3223 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/can/usb/peak_usb/Makefile
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_core.h
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_pro.c
 create mode 100644 drivers/net/can/usb/peak_usb/pcan_usb_pro.h
Signature · 4 lines
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   |