Subject: Recovering from BABBLE,STALLED state in uhci on netbsd
To: 'tech-kern@netbsd.org' <tech-kern@netbsd.org>
From: Rakesh Jalali <RJalali@evertz.com>
List: tech-kern
Date: 11/27/2002 14:52:36
	On sending several interrupt transfers from a device(using
national's usbn9603chip)
	and host (uhci on netbsd 1.5), BABBLE is detected on the host since
the device
	is sending more than 64 bytes of data.  

	The host controller on detecting more than 64 bytes, raises the
BABBLE, 
	STALLED flag and puts the TD(transfer descriptor) to INACTIVE state.

	The host does not send an ACK for the transfer. The device 
	on not getting the ACK retransmits the data, this time with the 
	correct data size (64 bytes) but the same data toggle. The host
controller 
	sends an ACK for the retransmitted transfer but does not process 
	it i.e. does not pass it to the layers above. All the interrupt
transfers after
	this are processed correctly.

	Now to my question:
	1. Why is the retransmitted packet from the device to the host
	ACK'ed but not processed?

      2. What happens when a TD is set to INACTIVE state on detection
        of BABBLE,STALLED flag? 
	 How is the host controller supposed to recover from BABBLE,STALLED
	 state

	Any help on this would be greatly appreciated.

	Thanks


	Rakesh Jalali



	==========================================================
	***********OUTPUT FROM NETBSD KERNEL ON HOST IN DEBUG
MODE************

	fc-default# usb_transfer_complete: pipe=0xe00abf80 xfer=0xe00a1700
status=0 actl
	en=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete:
pipeusb_transfer_comp
	lete: pipe=0xe00abf80 xfer=0xe00a1700 status=0 actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	=0xe00abf80 xfer=0xe00a1700 status=0 actlen=64
	Oct  7 16:32:44 fc-default /netbsd: usb_uhci_idone: error, addr=4,
endpt=0x81, s
	tatus 0x500000<BABBLE,STALLED>
	usb_transfer_complete: pipe=0xe00abf80 xfer=0xe00a1700 status=13
actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	transfer_complete: repeat=1 new head=0xe00a1700
	Oct  7 16:32:44 fc-default /netbsd: uhci_intr_done: length=64
	Oct  7 16:32:44 fc-default /netbsd: uhci_device_intr_done: requeing
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete:
pipe=0xe00abf80 xfer=
	0xe00a1700 status=0 actlen=64
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete: repeat=1
new head=0xe
	00a1700
	Oct  7 16:32:44 fc-defauhci_idone: error, addr=4, endpt=0x81, status
0x500000<BA
	BBLE,STALLED>
	usb_transfer_complete: pipe=0xe00abf80 xfer=0xe00a1700 status=13
actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	ult /netbsd: uhci_intr_done: length=64
	Oct  7 16:32:44 fc-default /netbsd: uhci_device_intr_done: requeing
	Oct  7 16:32:44 fc-default /netbsd: uhci_idone: error, addr=4,
endpt=0x81, statu
	s 0x500000<BABBLE,STALLED>
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete:
pipe=0xe00abf80 xfer=
	0xe00a1700 status=13 actlen=64
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete: repeat=1
new head=0xe
	00a1700
	Oct  7 16:32:44 fc-default /netbsd: uhci_intr_done: length=64
	Oct  7 16:32:44 fc-default /netbsd: uhci_device_intr_done: requeing
	Oct  7 16:32:44 fc-default /netbsd: uhci_idone: error, addr=4,
endpt=0x81, statu
	s 0x500000<BABBLE,STALLED>
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete:
pipe=0xe00abf80 xfer=
	0xe00a1700 status=13 actlen=64
	Oct  7 16:32:44 fc-default /netbsd: usb_transfer_complete: repeat=1
new head=0xe
	00a1700
	Oct  7 16:32:44 fc-default /netbsd: uhci_intr_done: length=64
	Oct  7 16:32:44 fc-default /netbsd: uhci_device_intr_done: requeing
	usb_transfer_complete: pipe=0xe00abf80 xfer=0xe00a1700 status=0
actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	Oct  7 16:32:50 fc-default /netbsd: usb_transfer_complete:
pipe=0xe00ausb_transf
	er_complete: pipe=0xe00abf80 xfer=0xe00a1700 status=0 actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing
	bf80 xfer=0xe00a1700 status=0 actlen=64
	Oct  7 16:32:50 fc-default /netbsd:
usb_transferusb_transfer_complete: pipe=0xe0
	0abf80 xfer=0xe00a1700 status=0 actlen=64
	usb_transfer_complete: repeat=1 new head=0xe00a1700
	uhci_intr_done: length=64
	uhci_device_intr_done: requeing

	**********END OUTPUT FROM NETBSD KERNEL**********
	====================================================