Commit Graph

69 Commits

Author SHA1 Message Date
Konrad Dybcio
520d10f554 ns: fix format warnings 2024-04-09 13:14:34 +02:00
Konrad Dybcio
140f46d4ed lookup: fix format warnings 2024-04-09 13:14:34 +02:00
Konrad Dybcio
dece9315ea treewide: meson
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
2024-04-09 13:14:34 +02:00
Konrad Dybcio
20d1f78be8 lookup: Add more services
42667c34e2/sec_config
2024-04-08 22:30:02 +02:00
Konrad Dybcio
7777177772 Merge pull request #25 from Ristovski/patch-1
lookup: Add several new services
2024-04-08 22:24:32 +02:00
Richard Acayan
22a69b4f5e lookup: add IMS data service
The IMS data service is the service responsible for configuring a
connection used by the modem for IMS. Add the service.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2024-03-25 21:48:37 -04:00
Rafael Ristovski
d81b7a377c lookup: Add several new services 2023-11-01 17:14:40 +01:00
Dylan Van Assche
d0d471c96e lookup: add Snapdragon Sensor Core service
SDM845 and later expose a Snapdragon Sensor Core service (400) to access the sensors
 managed by a remoteproc. Add this service to the known list of services.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
2023-01-17 22:59:41 -06:00
Bjorn Andersson
983b223423 lookup: Add TFTP to known services list
Service 4096 is a QRTR based implementation of the TFTP RFCs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-11-16 10:38:14 -06:00
Loic Poulain
cb1a6476e6 qrtr-lookup: Add DPM service name
Data Port Mapper service is ID 47.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-11-06 22:09:30 -08:00
Alex Khouderchah
fef484babd libqrtr: Use size_t for offsets
Currently, offsetof produces an unsigned long, while qmi_elem_info's
offset member is a uint32_t. Since this is not the same type on all
platforms, this change uses a size_t for both. stddef.h is also
included for the standard offsetof definition, which also produces a
size_t.

This change also makes similar modifications to list.h.
2020-09-28 10:18:59 -05:00
Bjorn Andersson
7bd5cf3024 ns: Go dormant when exsting name server is found
With the introduction of the in-kernel nameserver launching the user
space qrtr-ns will fail, but typically other services depends on its
presence. As such, go dormant instead of failing when noticed that the
name service is already present.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-01 18:05:04 -08:00
Bjorn Andersson
111403fe72 map: Fix removal of entries from the table
Removing entries from an open addressed hash table creates holes in the
collision chains, preventing previous colliding entries to be found.  By
inserting tombstones, rather than clearing deleted entries makes it
possible to distinguish the end of a chain from a hole.

Reviewed-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-04-18 17:29:11 -07:00
Eric Caruso
c1bdfb37db logging: add min priority and other cleanup
The dprintf macro shadows a real libc symbol which is called
differently, so we should change it to something else (in this
case LOGD) and change it to use the libqrtr logging facilities.
This also means we should add a minimum priority to the logging
library so we don't log DEBUG-level messages by default.

Additionally there were some warn/warnx calls left over that
have been changed to PLOGW/LOGW respectively.
2018-12-10 16:03:04 -08:00
Eric Caruso
c9c4a3cdbd qrtr-lookup: print better information about DIAG service
The DIAG service has its own encoding for the instance number which
is unrelated to the version. This means that the information we
show to the user in the version and instance columns of the table is
parsed incorrectly and often useless. Instead, treat the instance
number as special if the service is a DIAG service and print out a
more meaningful interpretation.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-12-10 15:59:56 -08:00
Ben Chan
eb666db04e qrtr-ns: initialize waiter_ticket struct in waiter_wait_timeout()
waiter_wait_timeout() doesn't initialize the 'callback' and 'updated'
fields of the waiter_ticket struct. The 'updated' field may contain some
garbage value, which is later read in waiter_ticket_check().

Signed-off-by: Ben Chan <benchan@chromium.org>
2018-07-05 06:58:25 -07:00
Bjorn Andersson
a9c50b634f qrtr-lookup: Add description of service 52
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-25 16:36:04 -07:00
Ben Chan
4b7025a7c7 lookup: fix service name for service type 17
Service type 17 (0x11) is Specific Absorption Rate service, while
service type 25 (0x19) is Service Access Proxy service.
2018-06-22 10:54:20 -07:00
Eric Caruso
140a462c88 ns: add -s option for logging to syslog
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
de5ee77b00 logging: add use_syslog to qlog_setup
This causes qlog to log to syslog instead of logging to stderr.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
f64c25c8af Unify logging into one function
This prepares us to add log-to-syslog functionality by passing
all logging through one place.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
516011d79f cfg, ns: factor out qrtr_set_address function
This function in qrtr-ns was largely copied from the main
function of qrtr-cfg. We should just factor it out so there is
one implementation instead.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-05-01 11:49:23 -07:00
Eric Caruso
3c60eb7e0e cfg, lookup, ns: avoid using __progname
The __progname symbol is a GNU extension and thus not portable,
but basename (from libgen.h) and argv[0] can be used portably
instead.

(qrtr-lookup already used argv[0] but did not apply basename, so
do that for consisntency.)

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-01 11:41:34 -07:00
Eric Caruso
366003c923 lookup: alphabetize includes
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-01 11:41:34 -07:00
Eric Caruso
43723b6424 ns: alphabetize includes
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-01 11:41:34 -07:00
Bjorn Andersson
7d9a2e7df9 ns: Add argument to stay in foreground
When running in Android we want to keep qrtr-ns in the foreground, so
that init's service handler can keep track of it. Add the -f flag to
skip the fork().

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-19 18:13:34 -07:00
Bjorn Andersson
bd51b700ba ns: Allow qrtr-ns to configure node id
Instead of calling qrtr-cfg separately to configure the local address
just pass this as an argument to qrtr-ns, allowing us to run a single
command to instantiate qrtr.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-19 18:07:18 -07:00
Bjorn Andersson
3d819eecb2 cfg: Trigger kernel module autoloading
By opening a socket before attempting to configure the address we
trigger kernel module loading, if qrtr is compiled as such.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-19 18:02:00 -07:00
Bjorn Andersson
17c4c1038e qrtr: Drop container.h
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-31 21:07:39 +00:00
Bjorn Andersson
0ec649d4e6 qrtr: Backport future qrtr.h uapi
The uapi qrtr.h is extended with additional types and constants. Drop
the local qrtr.h to use the one from linux-headers and extend it
conditionally while we're waiting for the updated file.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-31 05:53:49 +00:00
Bjorn Andersson
7c35e025d9 lookup: Add DIAG service
Add the DIAG service, as mentioned in msm-4.4

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-02 21:30:38 -07:00
Bjorn Andersson
a6f9b18bd9 qrtr-ns: Sanity check origin of messages
Restrict the origin of certain messages to limit the ability of clients
to inject invalid data in the service registry.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 23:00:58 -07:00
Bjorn Andersson
be5ed574af qrtr-ns: Move DEL_SERVER logic to server_del
When a server is disappearing, either from a DEL_SERVER, BYE or
DEL_CLIENT message the same messages needs to be sent; to local
observers and through broadcasts to remote nodes.

So move the logic from the DEL_SERVER command handler to server_del, in
order to invoke this regardless of reason for the server's
disappearance.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 22:48:24 -07:00
Bjorn Andersson
86747d0fcc qrtr-ns: Propagate the node in BYE
As we propagate the BYE to local listeners we have to also pass the
information on which node is down, so use the typical "node" field for
this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 21:33:22 -07:00
Bjorn Andersson
411616148f lookup: Extend service name table
A number of services are mentioned in the Qualcomm downstream kernels,
add these to the list of known names to improve the output.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-30 11:53:52 -07:00
Bjorn Andersson
c1fb6f0bd0 lookup: Report service, version and instance separate
Instead of reporting "service" as id:instance split the "instance" in version
and instance and present the three entities separately.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-14 12:11:27 -07:00
Bjorn Andersson
0a2f2111f7 ns: Replace lookup result with new and del server messages
Instead of having a custom lookup result, just pass new and delete
server messages - allowing clients to receive notifications about dying
services as well, without having to extend the lookup result message.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-07 10:00:28 -07:00
Bjorn Andersson
b804dcae1b cfg: Request and check return value
Request the return value of the operation from the kernel and check if
it's an error, to inform the user about e.g. not having sufficient
permission.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 22:15:33 -07:00
Bjorn Andersson
0b9959552e ns: Cleanup socket creation
Now that we only have one socket we can clean up the socket creation
code further.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:51:09 -07:00
Bjorn Andersson
a4aa8250c1 ns: Rename context socket
Now that we only have one socket for our context we can simplify the
name of the struct member.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:50:55 -07:00
Bjorn Andersson
0bc03abb43 ns: Remove the ns service
Now that we have moved all operations to the control socket we can
remove the ns handler. The query function in the library is racy, as
there might be non-response messages in our incoming buffer when we
start reading, so this is dropped too - rather than just being
translated to the new interface.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:50:54 -07:00
Bjorn Andersson
f775838736 lookup: Transition to using control port
Convert qrtr-lookup to use the control port for queries, allowing us to
drop the ns service altogether.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:49:31 -07:00
Bjorn Andersson
326aad23ae ns: Introduce lookup registration
Introduce a subscription based lookup model, in order for a client to be
able to listen to a future spawning service. The client can register any
number of queries with the ns and the ns will post lookup-results as
services are registred.

As a special case the list of lookup-results that is sent out as a
result of the registration of a new lookup will be finished by an empty
lookup response, allowing tools like qrtr-lookup to terminate as the
entire list of currently registed services is received.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:49:30 -07:00
Bjorn Andersson
b4393f4515 ns: Handle BYE control message
The BYE control message signals that a node is gone, drop all services
from our register and propagate this message to all local servies - to
allow them to clean up any resources associated with potential remote
clients.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-07 04:46:42 +00:00
Bjorn Andersson
032b2443b3 ns: Make del_client always propagate del_client
Following the downstream kernel we should propagate a del_client to all
local services as the dying socket might have acted - or once acted - as
a client as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:44:59 -07:00
Bjorn Andersson
765aa8d57f ns: Implement DEL_CLIENT
Upon receiving a DEL_CLIENT some local or remote client has been
disconnected. If this is a local server we remove the server from the
lists and announce the removal to the remotes. Otherwise we need to
inform local servers that one of their clients might be gone, so we
propagate a DEL_SERVER message to all locally registered services.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:43:45 -07:00
Bjorn Andersson
ff29fb17a3 lib: Provide new API for clients to register services
Add a new set of operations to libqrtr for sending registration events
to the control service, rather than using the nameservice port.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:16:54 -07:00
Bjorn Andersson
35db849ec9 ns: Move qrtr_ctrl_cmd struct to ns.h
Move the qrtr_ctrl_cmd struct to the shared header file, order to
facilitate sending control messages directly from the library.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 12:39:43 -07:00
Bjorn Andersson
533edf89f5 ns: Cleanup debug and error prints
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 12:38:39 -07:00
Bjorn Andersson
fa0ef1f6e8 ns: Advertise new and removed services
Advertise services as we register and unregister them locally.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 21:33:40 -07:00