All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Pawel Laszczak <pawell@cadence.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1
Date: Sat, 22 Oct 2022 21:43:18 +0800	[thread overview]
Message-ID: <20221022134318.GA51416@nchen-desktop> (raw)
In-Reply-To: <BYAPR07MB5381E4649DFD2BD0C528AC0FDD2D9@BYAPR07MB5381.namprd07.prod.outlook.com>

On 22-10-21 05:03:25, Pawel Laszczak wrote:
> >
> >
> >On 22-10-19 02:07:17, Pawel Laszczak wrote:
> >> Patch modifies the TD_SIZE in TRB before ZLP TRB.
> >> The TD_SIZE in TRB before ZLP TRB must be set to 1 to force processing
> >> ZLP TRB by controller.
> >>
> >> Cc: <stable@vger.kernel.org>
> >> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence
> >> USBSSP DRD Driver")
> >> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> >> ---
> >>  drivers/usb/cdns3/cdnsp-ring.c | 15 ++++++++-------
> >>  1 file changed, 8 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/usb/cdns3/cdnsp-ring.c
> >> b/drivers/usb/cdns3/cdnsp-ring.c index 794e413800ae..4809d0e894bb
> >> 100644
> >> --- a/drivers/usb/cdns3/cdnsp-ring.c
> >> +++ b/drivers/usb/cdns3/cdnsp-ring.c
> >> @@ -1765,18 +1765,19 @@ static u32 cdnsp_td_remainder(struct
> >cdnsp_device *pdev,
> >>  			      struct cdnsp_request *preq,
> >>  			      bool more_trbs_coming)
> >>  {
> >> -	u32 maxp, total_packet_count;
> >> -
> >> -	/* One TRB with a zero-length data packet. */
> >> -	if (!more_trbs_coming || (transferred == 0 && trb_buff_len == 0) ||
> >> -	    trb_buff_len == td_total_len)
> >> -		return 0;
> >> +	u32 maxp, total_packet_count, remainder;
> >>
> >>  	maxp = usb_endpoint_maxp(preq->pep->endpoint.desc);
> >>  	total_packet_count = DIV_ROUND_UP(td_total_len, maxp);
> >>
> >>  	/* Queuing functions don't count the current TRB into transferred. */
> >> -	return (total_packet_count - ((transferred + trb_buff_len) / maxp));
> >> +	remainder = (total_packet_count - ((transferred + trb_buff_len) /
> >> +maxp));
> >> +
> >> +	/* Before ZLP driver needs set TD_SIZE=1. */
> >> +	if (!remainder && more_trbs_coming)
> >> +		remainder = 1;
> >
> >Without ZLP, TD_SIZE = 0 for the last TRB.
> >With ZLP, TD_SIZE = 1 for current TRB, and TD_SIZE = 0 for the next TRB (the
> >last zero-length packet) right?
> 
> Yes, you have right.
> 

Pawel, With your changes, the return value is 1 for function
cdnsp_queue_ctrl_tx. Without your changes, it is 0, something wrong?

-- 

Thanks,
Peter Chen

  reply	other threads:[~2022-10-22 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  6:07 [PATCH] usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1 Pawel Laszczak
2022-10-20 13:20 ` Peter Chen
2022-10-21  5:03   ` Pawel Laszczak
2022-10-22 13:43     ` Peter Chen [this message]
2022-10-24 14:10       ` Pawel Laszczak

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=20221022134318.GA51416@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=stable@vger.kernel.org \
    /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.