On Sun May 18, 2025 at 11:23 AM EDT, Andrew Lunn wrote:
This also comes back to my point of there being at least four vendors of devices like yours. Linux does not want four or more implementations of this, each 90% the same, just a different way of converting this structure of operations into messages over a transport bus.
You have to define the protocol. Mainline needs that so when the next vendor comes along, we can point at your protocol and say that is how it has to be implemented in Mainline. Make your firmware on the SoC understand it. You have the advantage that you are here first, you get to define that protocol, but you do need to clearly define it.
I understand that this is the preferred way and I'll push internally for going that direction. That being said, Greybus seems to offer the capability to have a custom driver for a given PID/VID, if a module doesn't implement a Greybus-standardized protocol. Would a custom Greybus driver for, just as an example, our Wifi stack be an acceptable option?
You have listed how your implementation is similar to Greybus. You say what is not so great is streaming, i.e. the bulk data transfer needed to implement xmit_sync() and xmit_async() above. Greybus is too much RPC based. RPCs are actually what you want for most of the operations listed above, but i agree for data, in order to keep the transport fully loaded, you want double buffering. However, that appears to be possible with the current Greybus code.
gb_operation_unidirectional_timeout() says:
- Note that successful send of a unidirectional operation does not imply that
- the request as actually reached the remote end of the connection.
*/
So long as you are doing your memory management correctly, i don't see why you cannot implement double buffering in the transport driver.
I also don't see why you cannot extend the Greybus upper API and add a true gb_operation_unidirectional_async() call.
Just because touching a well established subsystem is scary, but I understand that we're allowed to make changes that make sense.
You also said that lots of small transfers are inefficient, and you wanted to combine small high level messages into one big transport layer message. This is something you frequently see with USB Ethernet dongles. The Ethernet driver puts a number of small Ethernet packets into one USB URB. The USB layer itself has no idea this is going on. I don't see why the same cannot be done here, greybus itself does not need to be aware of the packet consolidation.
Yeah, so in this design, CPC would really be limited to the transport bus (SPI for now), to do packet consolidation and managing RCP available buffers. I think at this point, the next step is to come up with a proof of concept of Greybus over CPC and see if that works or not.
Let me add that I sincerely appreciate that you took the time to review this RFC and provided an upstream-compatible alternative to what we proposed, so thank you for that.
Damien