From: Robert Baldyga <r.baldyga@samsung.com>
To: Michal Nazarewicz <mina86@mina86.com>, balbi@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, m.szyprowski@samsung.com,
andrzej.p@samsung.com
Subject: Re: [PATCH v2 1/3] usb: gadget: f_fs: virtual address mapping
Date: Mon, 28 Jul 2014 13:52:31 +0200 [thread overview]
Message-ID: <53D6397F.50403@samsung.com> (raw)
In-Reply-To: <xa1tk36xrde3.fsf@mina86.com>
On 07/28/2014 12:22 PM, Michal Nazarewicz wrote:
> On Mon, Jul 28 2014, Robert Baldyga <r.baldyga@samsung.com> wrote:
>> On 07/25/2014 04:18 PM, Michal Nazarewicz wrote:
>>> On Fri, Jul 25 2014, Robert Baldyga wrote:
>>>> This patch adds virtual endpoint address mapping to functionfs.
>>>>
>>>> So far endpoint addresses given by user through endpoint descriptors
>>>> were ignored, and replaced by physical endpoint addresses. Endpoint
>>>> address in wIndex field of setup requesti, addressed to endpoint, was
>>>> the physical endpoint address, and names of files in functionfs
>>>> directory was numered in order, and were the same as indexes of
>>>> ffs_epfile in epfile array. In result user has no way to indicate
>>>> which file in functionfs is associated with which particular
>>>> requested endpoint. He also didn't know which endpoint is recipient
>>>> of setup request.
>>>
>>> Couldn't that be solved by simply providing the mapping to user space?
>>
>> There would be only small differences in code (add mapping instead of
>> changing file names) so why would we not want do it in more intuitive
>> way?
>
> So I'm confused again. With your patch, the endpoint number read from
> user space will have barring *only* on the file name and it *will not*
> correspond to the real/physical endpoint number, right? Why do we want
> that? What's the advantage over having endpoints numbered in the order
> they were specified?
>
> To know what physical number endpoint has, user space would have to read
> the descriptor via the new proposed ioctl or get a mapping from ep file
> names to physical endpoint numbers.
No, endpoint number read from user space will also affects on value in
wIndex field in setup request. The goal is to have only one number
identifying each endpoint. User can choose this number through endpoint
descriptor, and then use it in each context - to open endpoint file, to
find recipient of setup request, to recognize which endpoint is linked
with particular fd using FUNCTIONFS_ENDPOINT_DESC ioctl.
Yes, this ioctl returns bEndpointAddress in function address space. To
obtain physical endpoint address (which shouldn't be needed in functions
compatible with USB specification), there is another ioctl -
FUNCTIONFS_ENDPOINT_REVMAP.
The main advantage is that each function has its own "sandbox" and it
can work as if it was the only function in gadget. Furthermore it's less
confusing for user than ignoring endpoint number chosen in descriptor,
create endpoint files numbered in order they were specified, and refer
to endpoints using physical addresses in setup requests...
>
>>>> There was also one more problem - if endpoint addresses in descriptors
>>>> were non-consecutive, there were created redundant files, which could
>>>> cause problems in kernel, when user tryed to read/write to them.
>>>> It was result of fact that maximum endpoint address was taken as
>>>> total number of endpoints in funciton.
>>>
>>> This is kinda unrelated though. I mean it's a separate bug.
>>
>> Yes, but it can be fixed by the way, as a side effect, so there is no
>> sense (and probably no simple way) to move it into separate patch.
>
> Right, but now, we're arguing about the whole patch as opposed to having
> part of it already acked. :P
>
next prev parent reply other threads:[~2014-07-28 11:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 13:36 [PATCH v2 0/3] usb: gadget: f_fs: userspace API fixes and improvements Robert Baldyga
2014-07-25 13:36 ` [PATCH v2 1/3] usb: gadget: f_fs: virtual address mapping Robert Baldyga
2014-07-25 14:18 ` Michal Nazarewicz
2014-07-28 5:52 ` Robert Baldyga
2014-07-28 10:22 ` Michal Nazarewicz
2014-07-28 11:52 ` Robert Baldyga [this message]
2014-07-28 15:21 ` Michal Nazarewicz
2014-07-29 6:12 ` Robert Baldyga
2014-07-25 13:36 ` [PATCH v2 2/3] usb: gadget: f_fs: add ioctl returning ep descriptor Robert Baldyga
2014-07-25 14:15 ` Michal Nazarewicz
2014-07-28 6:10 ` Robert Baldyga
2014-07-28 10:24 ` Michal Nazarewicz
2014-07-28 6:42 ` Marek Szyprowski
2014-07-28 6:47 ` Greg KH
2014-07-25 13:36 ` [PATCH v2 3/3] usb: gadget: f_fs: make numbers in ep file names the same as ep addresses Robert Baldyga
2014-07-25 14:14 ` Michal Nazarewicz
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=53D6397F.50403@samsung.com \
--to=r.baldyga@samsung.com \
--cc=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mina86@mina86.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