mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Selvarasu Ganesan <selvarasu.g@samsung.com>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"quic_akakum@quicinc.com" <quic_akakum@quicinc.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jh0801.jung@samsung.com" <jh0801.jung@samsung.com>,
	"dh10.jung@samsung.com" <dh10.jung@samsung.com>,
	"naushad@samsung.com" <naushad@samsung.com>,
	"akash.m5@samsung.com" <akash.m5@samsung.com>,
	"rc93.raju@samsung.com" <rc93.raju@samsung.com>,
	"taehyun.cho@samsung.com" <taehyun.cho@samsung.com>,
	"hongpooh.kim@samsung.com" <hongpooh.kim@samsung.com>,
	"eomji.oh@samsung.com" <eomji.oh@samsung.com>,
	"shijie.cai@samsung.com" <shijie.cai@samsung.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>
Subject: Re: [PATCH] usb: dwc3: gadget: Add TxFIFO resizing supports for single port RAM
Date: Sat, 9 Nov 2024 01:05:56 +0000	[thread overview]
Message-ID: <20241109010542.q5walgpxwht6ghbx@synopsys.com> (raw)
In-Reply-To: <0c8b4491-605f-466c-86cd-1f17c70d6b7b@samsung.com>

++ Alan Stern

On Fri, Nov 08, 2024, Selvarasu Ganesan wrote:

> >> +	ram_depth = spram_type ? DWC3_RAM0_DEPTH(dwc->hwparams.hwparams6) :
> >> +			DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
> > Don't use spram_type as a boolean. Perhaps define a macro for type value
> > 1 and 0 (for single vs 2-port)
> Are you expecting something like below?
> 
> #define DWC3_SINGLE_PORT_RAM     1
> #define DWC3_TW0_PORT_RAM        0

Yes. I think it's more readable if we name the variable to "ram_type"
and use the macros above as I suggested.

If you still plan to use it as boolean, please rename the variable
spram_type to is_single_port_ram (no one knows what "spram_type" mean
without the programming guide or some documention).

>

< snip >

> >>
> > We may need to think a little more on how to budgeting the resource
> > properly to accomodate for different requirements. If there's no single
> > formula to satisfy for all platform, perhaps we may need to introduce
> > parameters that users can set base on the needs of their application.

> Agree. Need to introduce some parameters to control the required fifos 
> by user that based their usecase.
> Here's a rephrased version of your proposal:
> 
> To address the issue of determining the required number of FIFOs for 
> different types of transfers, we propose introducing dynamic FIFO 
> calculation for all type of EP transfers based on the maximum packet 
> size, and remove hard code value for required fifos in driver,  

The current fifo calculation already takes on the max packet size into
account.

For SuperSpeed and above, we can guess how much fifo is needed base on
the maxburst and mult settings. However, for bulk endpoint in highspeed,
it needs a bit more checking.

> Additionally, we suggest introducing DT properties(tx-fifo-max-num-iso, 
> tx-fifo-max-bulk and tx-fifo-max-intr) for all types of transfers 

This constraint should be decided from the function driver. We should
try to keep this more generic since your gadget may be used as mass
storage device instead of UVC where bulk performance is needed more.

> (except control EP) to allow users to control the required FIFOs instead 
> of relying solely on the tx-fifo-max-num. This approach will provide 
> more flexibility and customization options for users based on their 
> specific use cases.
> 
> Please let me know if you have any comments on the above approach.
> 

How about this: Implement gadget->ops->match_ep() for dwc3 and update
the note in usb_ep_autoconfig() API.

If the function driver looks for an endpoint by passing in the
descriptor with wMaxPacketSize set to 0, mark the endpoint to used for
performance. This is closely related to the usb_ep_autoconfig() behavior
where it returns the endpoint's maxpacket_limit if wMaxPacketSize is not
provided. We just need to expand this behavior to look for performance
endpoint.

If the function driver provides the wMaxPacketSize during
usb_ep_autoconfig(), then use the minimum required fifo.

What do you think? Will this work for you?

BR,
Thinh

  reply	other threads:[~2024-11-09  1:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20241107104306epcas5p136bea5d14a1bb3fe9ba1a7830bf366c6@epcas5p1.samsung.com>
2024-11-07 10:40 ` Selvarasu Ganesan
2024-11-07 23:34   ` Thinh Nguyen
2024-11-08  4:54     ` Selvarasu Ganesan
2024-11-09  1:05       ` Thinh Nguyen [this message]
2024-11-11 14:39         ` Selvarasu Ganesan

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=20241109010542.q5walgpxwht6ghbx@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=akash.m5@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=dh10.jung@samsung.com \
    --cc=eomji.oh@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hongpooh.kim@samsung.com \
    --cc=jh0801.jung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=naushad@samsung.com \
    --cc=quic_akakum@quicinc.com \
    --cc=rc93.raju@samsung.com \
    --cc=selvarasu.g@samsung.com \
    --cc=shijie.cai@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=taehyun.cho@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®