Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29a1fbc8 authored by Florian Schilhabel's avatar Florian Schilhabel Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8192su: fix for rtl819xU:Error TX URB for zero byte xxx, error -2



according to 'linux device drivers',
ENOENT, ECONNRESET, ESHUTDOWN are not real transmission errors.
also, a little cosmetics.

Signed-off-by: default avatarFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2f225608
Loading
Loading
Loading
Loading
+21 −15
Original line number Original line Diff line number Diff line
@@ -2341,22 +2341,21 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)


	status = usb_submit_urb(tx_urb, GFP_ATOMIC);
	status = usb_submit_urb(tx_urb, GFP_ATOMIC);
	if (!status) {
	if (!status) {
//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27
		/*
		 * we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted.
		 * Otherwise, it will be halt to wait for another packet. WB. 2008.08.27
		 */
		bool bSend0Byte = false;
		bool bSend0Byte = false;
		u8 zero = 0;
		u8 zero = 0;
		if(udev->speed == USB_SPEED_HIGH)
		if(udev->speed == USB_SPEED_HIGH) {
		{
			if (skb->len > 0 && skb->len % 512 == 0)
			if (skb->len > 0 && skb->len % 512 == 0)
				bSend0Byte = true;
				bSend0Byte = true;
		}
		}
		else
		else {
		{
			if (skb->len > 0 && skb->len % 64 == 0)
			if (skb->len > 0 && skb->len % 64 == 0)
				bSend0Byte = true;
				bSend0Byte = true;
		}
		}
		if (bSend0Byte)
		if (bSend0Byte) {
		{
#if 1
			tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
			tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
			if(!tx_urb_zero) {
			if(!tx_urb_zero) {
				RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
				RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
@@ -2366,11 +2365,18 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)
					usb_sndbulkpipe(udev,idx_pipe), &zero,
					usb_sndbulkpipe(udev,idx_pipe), &zero,
					0, tx_zero_isr, dev);
					0, tx_zero_isr, dev);
			status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
			status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
			if (status){
			switch (status) {
			RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
				case 0:
					break;
				case -ECONNRESET:
				case -ENOENT:
				case -ESHUTDOWN:
					break;
				default:
					RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d",
						atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
					return -1;
					return -1;
			}
			}
#endif
		}
		}
		dev->trans_start = jiffies;
		dev->trans_start = jiffies;
		atomic_inc(&priv->tx_pending[tcb_desc->queue_index]);
		atomic_inc(&priv->tx_pending[tcb_desc->queue_index]);