zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.98k stars 6.69k forks source link

ipc_service: Separate priv data from main configuration #44187

Open rakons opened 2 years ago

rakons commented 2 years ago

Is your enhancement proposal related to a problem? Please describe. Currently the configuration of the endpoint stores pointer to its name, priority, callback pointers and pointer to priv data. It all adds to 24 B that has to be stored in RAM.

It real application it is very common to have all the pointers for specific endpoint type to be constant that may be placed in the ROM memory. In most cases also the priority and the pointer to the name may be stored here. But it is totally different case with priv pointer. If I create 3 instances of IPC endpoints and wish to communicate with 3 different cores - now I have to prepare totally different configurations for it and store it into RAM that is kept the whole time the Endpoint is in use. And in such case all the data in configuration would be the same, only the priv pointer is used to differentiate the source of the callback.

It complicates configuration and wastes RAM.

Describe the solution you'd like It would look much better if we change the ipc_service_register_endpoint into a form:

int ipc_service_register_endpoint(const struct device *instance,
                  struct ipc_ept *ept,
                  const struct ipc_ept_cfg *cfg,
                  void *priv);

Then we can place all the common configuration in one place of the module, and keep it in ROM. The ipc_service backends should store configuration structure and priv pointer separately. And in the moment of registering endpoint instead of copying all the configuration to just change the priv pointer we can alternate it in a nice an readable form.

carlocaione commented 2 years ago

@rakons moving the priv from ipc_ept_cfg to a function parameter seems a good idea. Can you push a PR for that?

zephyrbot commented 9 months ago

Hi @carlocaione, @arnopo,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@rakons you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!