cfriedt/greybus-for-zephyr

greybus: tcpip + tls: use a single socket

Opened this issue · 0 comments

The TLS transport works. However, TLS is incredibly memory intensive. The problem is multiplied several times over with each active TLS service and connection.

As a space optimization (in terms of dynamic memory requirements) a good solution would be to "concentrate" all Greybus connections through a single TCP/IP port by stuffing the CPort ID inside of one of the reserved portions of the Greybus Message Header, much like the UART transport already does.

It's is likely to be a win-win, as all communications need to go through a single physical connection regardless of the transport used.

The original gbridge author probably thought it might be better to map CPorts to TCP/IP ports for performance purposes, but since every greybus handler is threaded anyway, things will be handled async anyway.

We'll be optimistic in assuming that higher-bandwidth Greybus protocols do not start the lower bandwidth ones.

This feature is mirrored in cfriedt/gbridge#8.

For details, see cport_pack() / cport_unpack().