-
Notifications
You must be signed in to change notification settings - Fork 5
Support for more methods, new error API, unit test in libhexagonrpc #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
e6d033f to
f9e7000
Compare
|
In libhexagonrpc, the use of function pointers brings up a performance concern since the CPU might not be able to pipeline effectively. GCC inlines things to the point where the functions are known at compile-time, while Clang doesn't inline This optimization can be compiler-specific for now. First, we need to decide on one implementation. Since no other issues have been raised here, I'll let this supersede #6. |
|
The |
d170a73 to
6ce931b
Compare
When the kernel side of FastRPC fails, the return value is -1 and errno is set. When the remote side of FastRPC fails, the return value is an AEE error code. It is not specialized for the reverse tunnel. Add an error API that can convert the return value to a string-based error. Signed-off-by: Richard Acayan <[email protected]>
When there are more than 31 methods in a remote interface, an extended method ID is added to the primary input buffer when the ID is greater than 30. Select the method from the primary input buffer when the ID is greater than 30 in the reverse tunnel. Signed-off-by: Richard Acayan <[email protected]>
The current method definition format has a few issues. There is no way to represent `apps_std_mkdir(in string dir, in long long mode)` because it has a sequence before a fixed-length argument. The fixed-length arguments are passed in 4-byte units, making large fixed-length arrays awkward. Sequences of sequences cannot be represented. Add a new version of the remote method definition to support more methods, with sequences of sequences, mixed input and output arguments, and fixed-length data structures greater than 32 bits. Signed-off-by: Richard Acayan <[email protected]>
The code for opening and closing a remote interface with an error is duplicated in hexagonrpcd and chrecd. Like the remotectl interface itself, the error handling is useful for most FastRPC applications. Add a new API for opening and closing remote interfaces with error checking. Signed-off-by: Richard Acayan <[email protected]>
The handle API is a high-level interface that puts all error messages in the same buffer. Use the handle API to open and close the adsp_default_listener remote interface. Signed-off-by: Richard Acayan <[email protected]>
The handle API is a high-level interface that puts all error messages in the same buffer. Use the handle API to open and close the chre_slpi remote interface for code deduplication. Signed-off-by: Richard Acayan <[email protected]>
The FastRPC peer can encode a 32-bit size for a variable-length sequence. The members of the sequence can have a size more than 1, potentially using more than 32 bits. Expand the buffer size to a size_t. Signed-off-by: Richard Acayan <[email protected]>
To use interp4 method definitions for everything, the reverse tunnel needs to be updated to understand them. Add support for the new method definitions, preferring them if present. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the remotectl interface to interp4, split it into a header and source file, and update the users. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the chre_slpi interface to interp4, split it into a header and source file, and update the users. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the chre_slpi interface to interp4, split it into a header and source file, and add the new definitions to the implementation. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the apps_mem interface to interp4, split it into a header and source file, and add the new definitions to the implementation. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the adsp_listener interface to interp4, split it into a header and source file, and update the users. Signed-off-by: Richard Acayan <[email protected]>
The new interp4 definitions add support for more remote methods with sequences of multi-byte data, sequences of sequences, plain integers interleaved with sequences, and constant-size data other than 32-bit integers. The new definitions are complex and can't fit in a simple macro. Switch the chre_slpi interface to interp4, split it into a header and source file, and update the users. Signed-off-by: Richard Acayan <[email protected]>
With the remote method definitions converted to interp4, the interp2 definitions are no longer needed. Replace the interp2 definitions with the interp4 definitions recently added. Signed-off-by: Richard Acayan <[email protected]>
Both the hexagonfs and iobuffer tests need malloc and free. The iobuffer test also needs REMOTE_SCALARS_MAKE. Include stdlib directly and include the new libhexagonrpc header file. Signed-off-by: Richard Acayan <[email protected]>
The iobuffer decoder depends on REMOTE_SCALARS_INBUFS to know the number of encoded input buffers without knowing the exact length of the encoded input. Depend on the new hexagonrpc header which is being switched to. Signed-off-by: Richard Acayan <[email protected]>
There is now no user of the interp2 APIs in the source tree. Remove them. Signed-off-by: Richard Acayan <[email protected]>
The hexagonrpc function is getting very complex and deserves its own unit test. Add a unit test for the hexagonrpc function. Signed-off-by: Richard Acayan <[email protected]>
6ce931b to
c706676
Compare
This supersedes #6 (at least if the design makes sense).
Method definitions
The largest change is to the method definitions. The new top-level struct is
hrpc_method_def_interp4. It contains an array of inner types, and of accepted arguments which may reference inner types by array index.An argument is defined as a tuple of 2 numbers: type and data. Currently, data is either a size or an index for an inner type. Referencing open source IDL's on the internet, this is the conversion:
Inner types are basically arrays of arguments, used to define a type that has a sequence as a member. They are restricted to 2 of the types, currently preventing recursion:
Interface files
With the addition of inner types, it's harder to keep the array defined in a macro that can change based on compilation unit. The only readable option I found was to split the data structures into a C file, while the inline functions go in the header file.
The inline functions are changed to pass the file descriptor and handle from thread-local variables instead of parameters. This is similar to how the original fastrpc does it, but it still requires explicit
hexagonrpc_fd_from_env(void)andhrpc_open_...(size_t n_err, char *err)calls at the start of the program.More information will be provided as this gets developed. There are a lot of changes to the API, so it will take some work to get this ready.