CV-Bowen opened a new pull request, #22328:
URL: https://github.com/apache/nuttx/pull/22328

   ## Summary
   
   Let a service carry data in its name service announcement, so that it
   does not need its own sync message after the binding:
   
   - `openamp: let a service attach extra data to its ns announcement`
     (open-amp patch 0031): `ns_get_extra_cb` on the endpoint fills in up
     to `RPMSG_NS_EXTRA_SIZE` (88) bytes, sent after `struct rpmsg_ns_msg`:
   
     ```
     0            32       36       40         40 + extra_len
     +------------+--------+--------+----------+
     | name[32]   | addr   | flags  | extra    |
     +------------+--------+--------+----------+
     ```
   
     An announcement without extra data is unchanged. A destroy
     announcement never carries any.
   - `openamp: hand the announced extra data to the bind callbacks` (patch
     0032): `ns_bound_extra_cb` on the endpoint and `ns_bind_extra_cb` on
     the device receive the data and are called instead of `ns_bound_cb` /
     `ns_bind_cb` when set. rpmsg_virtio and rpmsg_port accept an
     announcement longer than `struct rpmsg_ns_msg`, up to 128 bytes; the
     rpmsg_port caller changes in the same commit so that every commit
     builds.
   - `drivers/rpmsg: pass the announced extra data down to the bind
     callbacks`: new `rpmsg_bind_extra_cb_t` and
     `rpmsg_register_callback_extra()` / `rpmsg_unregister_callback_extra()`.
     `rpmsg_register_callback()` is unchanged. virtio, rpmsg_port and the
     router edge install `rpmsg_ns_bind_extra()`.
   - `drivers/rpmsg: keep the announced extra data until its service
     registers`: an announcement that arrives before its service registers
     is kept in a `struct rpmsg_bind_s`; the record now stores the data, so
     the replay from `rpmsg_register_callback_extra()` passes it on.
   
   ## Impact
   
   - New API: `ns_get_extra_cb` / `ns_bound_extra_cb` in
     `struct rpmsg_endpoint`, `ns_bind_extra_cb` in `struct rpmsg_device`,
     `rpmsg_bind_extra_cb_t`, `rpmsg_register_callback_extra()`,
     `rpmsg_unregister_callback_extra()`. Existing callbacks work as before.
   - Protocol: an announcement can be up to 128 bytes. A peer without this
     change drops a longer announcement, so a service that sets
     `ns_get_extra_cb` needs this change on both sides. Announcements of
     services without extra data are byte for byte the same.
   - No in-tree service sets `ns_get_extra_cb` yet.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU 
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
   
   Every commit builds sim:rpserver, sim:rpproxy, sim:rpserver_uart,
   qemu-armv8a:rpserver and qemu-armv8a:rpproxy with 0 warnings.
   
   imx93-qsb:rpmsg (arm-gnu-toolchain 13.2.rel1, `make`): ITCM grows by
   224 bytes.
   
   **Extra data at run time.** A test-only change (not in this PR) makes
   rpmsg-ping announce "P137:<cpu>" and log what the peer announced; the
   server also creates an endpoint "p140x" announcing "P140:<cpu>", and the
   proxy registers `rpmsg_register_callback_extra()` for it 3 s after boot,
   so the announcement is first kept as a bind record and replayed.
   
   sim:rpserver + sim:rpproxy:
   
   ```
   [    0.090092] [proxy] p137_bound_extra: P137T rpmsg-ping bound, extra 12 
'P137:server'
   [    0.090146] [server] p137_bound_extra: P137T rpmsg-ping bound, extra 11 
'P137:proxy'
   [    0.090134] [proxy] p137_bound: P137T rpmsg-ping-rt bound, no extra 
callback
   [    3.090096] [proxy] p140_bind: P140T deferred bind p140x from server, 
extra 12 'P140:server'
   ```
   
   qemu-armv8a:rpserver + qemu-armv8a:rpproxy, over both the ivshmem link
   (server / proxy) and the rpmsg_port_uart link (server2 / proxy2);
   `rpmsg ping all` passes on both sides:
   
   ```
   [    0.150048] [ 8] [ ALERT] [proxy] p137_bound_extra: P137T rpmsg-ping 
bound, extra 12 'P137:server'
   [    0.154081] [ 5] [ ALERT] [proxy] p137_bound_extra: P137T rpmsg-ping 
bound, extra 13 'P137:server2'
   [    0.425880] [ 9] [ ALERT] [server] p137_bound_extra: P137T rpmsg-ping 
bound, extra 11 'P137:proxy'
   [    0.428418] [ 5] [ ALERT] [server] p137_bound_extra: P137T rpmsg-ping 
bound, extra 12 'P137:proxy2'
   [    3.144253] [ 2] [ ALERT] [proxy] p140_bind: P140T deferred bind p140x 
from server, extra 12 'P140:server'
   ```
   
   No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC 
disabled, which current master needs for nxinit to start nsh there; unrelated 
to this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to