Message ID | 20241119171832.1119-1-denkenz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | ad000eabb49ada6d4eb67008e06f09fe6810996f |
Headers | show |
Series | [v2,1/8] rmnet: Add skeleton | expand |
Hello: This series was applied to ofono.git (master) by Denis Kenzior <denkenz@gmail.com>: On Tue, 19 Nov 2024 11:18:12 -0600 you wrote: > Add skeleton of the RMNet interface management module. Implement the > basic API structure and register the module with oFono core. > --- > Makefile.am | 2 ++ > src/rmnet.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > src/rmnet.h | 25 +++++++++++++++++++++++ > 3 files changed, 86 insertions(+) > create mode 100644 src/rmnet.c > create mode 100644 src/rmnet.h Here is the summary with links: - [v2,1/8] rmnet: Add skeleton https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=ad000eabb49a - [v2,2/8] rmnet: Add logic to dump out RMNet interfaces https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=5f5b3b65efdd - [v2,3/8] rmnet: Track link notifications https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=cfb78944ec4f - [v2,4/8] rmnet: Track used mux ids https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=db18da4b4e91 - [v2,5/8] rmnet: Delete stale RMnet links at startup https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=0cc9a035a8d1 - [v2,6/8] rmnet: Implement rmnet_del_interfaces https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=982aa444b98e - [v2,7/8] rmnet: Implement getting new interfaces https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=99a68a774de0 - [v2,8/8] rmnet: Implement cancel https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=a0d8117a04c9 You are awesome, thank you!
diff --git a/Makefile.am b/Makefile.am index d379201d362b..d107dc410fd2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -353,6 +353,8 @@ builtin_sources += plugins/u8500.c endif if QMIMODEM +builtin_sources += src/rmnet.h src/rmnet.c + qmi_sources = drivers/qmimodem/qmi.h drivers/qmimodem/qmi.c \ drivers/qmimodem/ctl.h \ drivers/qmimodem/dms.h \ diff --git a/src/rmnet.c b/src/rmnet.c new file mode 100644 index 000000000000..58f841a49a59 --- /dev/null +++ b/src/rmnet.c @@ -0,0 +1,59 @@ +/* + * oFono - Open Source Telephony + * Copyright (C) 2024 Cruise, LLC + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stddef.h> +#include <errno.h> +#include <unistd.h> +#include <linux/rtnetlink.h> +#include <net/if.h> + +#include <ell/ell.h> + +#include "ofono.h" +#include "rmnet.h" + +static struct l_netlink *rtnl; + +int rmnet_get_interfaces(uint32_t parent_ifindex, unsigned int n_interfaces, + rmnet_new_interfaces_func_t cb, + void *user_data, rmnet_destroy_func_t destroy) +{ + return -ENOTSUP; +} + +int rmnet_del_interfaces(unsigned int n_interfaces, + const struct rmnet_ifinfo *interfaces) +{ + return -ENOTSUP; +} + +int rmnet_cancel(int id) +{ + return -ENOTSUP; +} + +static int rmnet_init(void) +{ + DBG(""); + + rtnl = l_netlink_new(NETLINK_ROUTE); + if (!rtnl) + return -EIO; + + return 0; +} + +static void rmnet_exit(void) +{ + l_netlink_destroy(rtnl); +} + +OFONO_MODULE(rmnet, rmnet_init, rmnet_exit) diff --git a/src/rmnet.h b/src/rmnet.h new file mode 100644 index 000000000000..dc416e0d5d51 --- /dev/null +++ b/src/rmnet.h @@ -0,0 +1,25 @@ +/* + * oFono - Open Source Telephony + * Copyright (C) 2024 Cruise, LLC + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +struct rmnet_ifinfo { + uint32_t ifindex; + uint16_t mux_id; + char ifname[IF_NAMESIZE]; +}; + +typedef void (*rmnet_new_interfaces_func_t)(int error, + unsigned int n_interfaces, + const struct rmnet_ifinfo *interfaces, + void *user_data); +typedef void (*rmnet_destroy_func_t)(void *user_data); + +int rmnet_get_interfaces(uint32_t parent_ifindex, unsigned int n_interfaces, + rmnet_new_interfaces_func_t cb, + void *user_data, rmnet_destroy_func_t destroy); +int rmnet_del_interfaces(unsigned int n_interfaces, + const struct rmnet_ifinfo *interfaces); +int rmnet_cancel(int id);