All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [RFT PATCH v1 5/5] usb: Handle QT_TOKEN_STATUS_XACTERR error when sending data
Date: Mon, 23 Mar 2020 12:59:39 +0100	[thread overview]
Message-ID: <c679c54e-3028-8e51-652f-34e74ebcab0b@denx.de> (raw)
In-Reply-To: <20200323081832.11716f4d@jawa>

On 3/23/20 8:18 AM, Lukasz Majewski wrote:
> Hi Marek,

Hi,

>> On 3/22/20 2:00 PM, Lukasz Majewski wrote:
>>> This code adds check if QT_TOKEN_STATUS_XACTERR error occurred.
>>> When it is detected the token is reconfigured and transmission is
>>> retried.
>>>
>>> This code is the port to newest U-Boot of the fix from - "rayvt"
>>> (from [1]).
>>>
>>> Links:
>>> [1] - https://forum.doozan.com/read.php?3,35295,35295#msg-35295
>>> [2] -
>>> https://www.dropbox.com/s/nrkrd1no63viuu8/uboot-bodhi-2016.05-timeoutTD.patch?dl=0
>>>
>>>
>>> Signed-off-by: Lukasz Majewski <lukma@denx.de>
>>> [Unfortunately, the original patch [2] did not contain S-o-B from
>>> the original author - "rayvt"]
>>> ---
>>>
>>>  drivers/usb/host/ehci-hcd.c | 27 ++++++++++++++++++++++++++-
>>>  1 file changed, 26 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/ehci-hcd.c
>>> b/drivers/usb/host/ehci-hcd.c index 0a77111f80..45eda7ad24 100644
>>> --- a/drivers/usb/host/ehci-hcd.c
>>> +++ b/drivers/usb/host/ehci-hcd.c
>>> @@ -315,6 +315,7 @@ ehci_submit_async(struct usb_device *dev,
>>> unsigned long pipe, void *buffer, int timeout;
>>>  	int ret = 0;
>>>  	struct ehci_ctrl *ctrl = ehci_get_ctrl(dev);
>>> +	int trynum;
>>>  
>>>  	debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n",
>>> dev, pipe, buffer, length, req);
>>> @@ -560,6 +561,10 @@ ehci_submit_async(struct usb_device *dev,
>>> unsigned long pipe, void *buffer,
>>> ehci_writel(&ctrl->hcor->or_usbsts, (usbsts & 0x3f)); 
>>>  	/* Enable async. schedule. */
>>> +	trynum = 1;	/* No more than 2 tries, in case of
>>> XACTERR. */ +retry_xacterr:;
>>> +	vtd = &qtd[qtd_counter - 1];
>>> +
>>>  	cmd = ehci_readl(&ctrl->hcor->or_usbcmd);
>>>  	cmd |= CMD_ASE;
>>>  	ehci_writel(&ctrl->hcor->or_usbcmd, cmd);  
>>
>> Are you sure always retrying the transfer if you get XACTERR is the
>> right thing to do, even if you get that e.g. on filesystem writes ?
> 
> Please correct me if I'm wrong, but this function - ehci_submit_async
> - doesn't work with filesystem. It just setups proper EHCI descriptor
>   and checks if it was sent with or without errors.

If you're writing into a block device, this function is used. If you get
XACTERR during the transfer and you retry, is there a chance the data
get actually written to the device ?

> When the XACTERR happens, proper flag is cleared and the transmission
> is retried.

What happens to the payload if it's a host-to-device transfer, do the
data get discarded or do they get written to the storage ?

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2020-03-23 11:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 13:00 [RFT PATCH v1 0/5] usb: Improve robustness of ehci-hcd controller operation Lukasz Majewski
2020-03-22 13:00 ` [RFT PATCH v1 1/5] Revert "usb: ehci-hcd: Keep async schedule running" Lukasz Majewski
2020-03-22 13:18   ` Marek Vasut
2020-03-23  6:57     ` Lukasz Majewski
2020-03-23 11:46       ` Marek Vasut
2020-03-23 12:41         ` Lukasz Majewski
2020-03-24  0:58           ` Marek Vasut
2020-03-24  7:06             ` Lukasz Majewski
2020-03-24 15:07               ` Marek Vasut
2020-03-24 18:11                 ` Lukasz Majewski
2020-03-24 18:33                   ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 2/5] usb: Handle XACTERR error in DATA phase of USB storage Lukasz Majewski
2020-03-22 13:23   ` Marek Vasut
2020-03-23  7:00     ` Lukasz Majewski
2020-03-23 11:50       ` Marek Vasut
2020-03-23 13:03         ` Lukasz Majewski
2020-03-24  1:01           ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 3/5] usb: Add some delay to wait for slow USB devices to be operational Lukasz Majewski
2020-03-22 13:29   ` Marek Vasut
2020-03-23  7:04     ` Lukasz Majewski
2020-03-23 11:52       ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 4/5] usb: Provide code to handle spinup of USB usb devices (mostly HDDs) Lukasz Majewski
2020-03-22 13:32   ` Marek Vasut
2020-03-23  7:53     ` Lukasz Majewski
2020-03-23 11:57       ` Marek Vasut
2020-03-23 12:54         ` Lukasz Majewski
2020-03-24  1:04           ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 5/5] usb: Handle QT_TOKEN_STATUS_XACTERR error when sending data Lukasz Majewski
2020-03-22 13:45   ` Marek Vasut
2020-03-23  7:18     ` Lukasz Majewski
2020-03-23 11:59       ` Marek Vasut [this message]
2020-03-23 12:58         ` Lukasz Majewski
2020-03-24  1:06           ` Marek Vasut
2020-03-23 20:58 ` [RFT PATCH v1 0/5] usb: Improve robustness of ehci-hcd controller operation Tom Rini
2020-03-23 22:11   ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c679c54e-3028-8e51-652f-34e74ebcab0b@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.