From: Johannes Berg <johannes@sipsolutions.net>
To: Arnd Bergmann <arnd@arndb.de>, Dan Williams <dcbw@redhat.com>
Cc: DTML <devicetree@vger.kernel.org>,
syadagir@codeaurora.org, Eric Caruso <ejcaruso@google.com>,
David Miller <davem@davemloft.net>,
linux-arm-msm@vger.kernel.org,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
evgreen@chromium.org,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Networking <netdev@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Alex Elder <elder@linaro.org>,
Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>,
linux-soc@vger.kernel.org, abhishek.esse@gmail.com,
cpratapa@codeaurora.org, Ben Chan <benchan@google.com>
Subject: Re: [PATCH v2 00/17] net: introduce Qualcomm IPA driver
Date: Mon, 17 Jun 2019 14:25:32 +0200 [thread overview]
Message-ID: <e6ba8a9063e63506c0b88a70418d74ca4efe85cd.camel@sipsolutions.net> (raw)
In-Reply-To: <dbb32f185d2c3a654083ee0a7188379e1f88d899.camel@sipsolutions.net>
On Mon, 2019-06-17 at 13:42 +0200, Johannes Berg wrote:
> But anyway, as I alluded to above, I had something like this in mind:
I forgot to state this here, but this was *heavily* influenced by
discussions with Dan - many thanks to him.
> driver_dev
> struct device *dev (USB, PCI, ...)
> net_device NA
> net_device NB
> tty TA
> ...
>
> (I'm cutting out the rmnet layer here for now)
>
> while having a separate that just links all the pieces together:
>
> wwan_device W
> ---> dev
> ---> NA
> ---> NB
> ---> TA
>
> So the driver is still responsible for creating the netdevs (or can of
> course delegate that to an "rmnet" library), but then all it also does
> is register the netdevs with the WWAN core like
>
> wwan_add_netdev(dev, NA)
[snip]
So to put some more meat to this, here's an API definition for both
userspace and internal APIs:
diff --git a/include/net/wwan.h b/include/net/wwan.h
new file mode 100644
index 000000000000..91413ec01def
--- /dev/null
+++ b/include/net/wwan.h
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * WWAN stack interfaces
+ *
+ * Copyright (C) 2019 Intel Corporation
+ *
+ * This defines the interaction of WWAN drivers with the WWAN stack,
+ * which allows userspace configuration of sessions etc.
+ */
+#ifndef __NET_WWAN_H
+#define __NET_WWAN_H
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/device.h>
+
+struct wwan_device {
+ u32 id;
+ void *data;
+/* private: */
+ struct list_head list;
+ struct device *dev;
+ struct wwan_device_ops *ops;
+};
+
+/**
+ * struct wwan_netdev_config - WWAN netdevice configuration
+ * @pdn: PDN identifier this netdev uses
+ */
+struct wwan_netdev_config {
+ u32 pdn;
+};
+
+/**
+ * wwan_device_ops - WWAN device operations
+ */
+struct wwan_device_ops {
+ /**
+ * @add_netdev: Add a new netdev with the given configuration, must
+ * return the new netdev pointer but not call wwan_attach_netdev().
+ */
+ struct net_device *(*add_netdev)(struct wwan_device *wwan,
+ struct wwan_netdev_config *config);
+ /**
+ * @remove_netdev: remove the given netdev
+ */
+ int (*remove_netdev)(struct wwan_device *wwan, struct net_device *dev);
+
+ /*
+ * More TBD:
+ * - add/remove serial port channels?
+ * ideally with some common (library) code to support this
+ * Or maybe not - serial is pretty limiting. Perhaps instead:
+ * - support something like AF_WWAN sockets for control data
+ */
+};
+
+/**
+ * wwan_add - add a WWAN device without preconfigured channels
+ * @dev: underlying struct device
+ * @ops: methods to create new channels
+ * @data: data for the new WWAN device
+ *
+ * Returns: a struct wwan_device pointer, or an ERR_PTR().
+ */
+struct wwan_device *
+wwan_add(struct device *dev, struct wwan_device_ops *ops, void *data);
+
+/**
+ * wwan_remove - remove the given WWAN device
+ * @wwan: WWAN device to remove.
+ *
+ * Note that the WWAN device may not be fully removed if it still has
+ * any channels attached, but nonetheless callers must assume that the
+ * pointer is no longer valid after calling this function.
+ */
+void wwan_remove(struct wwan_device *wwan);
+
+/**
+ * wwan_attach_netdev - attach a preconfigured netdev to the WWAN device
+ * @dev: struct device underlying the WWAN device
+ * @netdev: netdev to attach
+ * @config: configuration for this netdev
+ * @tentative: mark the attachment as tentative, don't consider this as
+ * part of a WWAN device unless other channels are attached as well.
+ * Set this to %false in drivers that know they're a WWAN device
+ * and to %true in generic drivers that may or may not be a WWAN
+ * device and want to wait for other channels.
+ *
+ * Returns: a struct wwan_device pointer or ERR_PTR(). Note that a valid
+ * pointer is returned even for the tentative case.
+ *
+ * Note that there's no need to detach again, this happens automatically
+ * when the netdev is removed.
+ */
+struct wwan_device *
+wwan_attach_netdev(struct device *dev, struct net_device *netdev,
+ struct wwan_netdev_config *config, bool tentative);
+
+/* TBD */
+struct wwan_device *
+wwan_attach_tty(struct device *dev, struct tty_port *port, bool tentative);
+void wwan_detach_tty(struct device *dev, struct tty_port *port);
+
+#endif /* __NET_WWAN_H */
diff --git a/include/uapi/linux/wwan.h b/include/uapi/linux/wwan.h
new file mode 100644
index 000000000000..af327aab881c
--- /dev/null
+++ b/include/uapi/linux/wwan.h
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+/*
+ * WWAN generic netlink interfaces
+ *
+ * Copyright (C) 2019 Intel Corporation
+ *
+ * This defines the WWAN generic netlink family APIs for userspace
+ * to control WWAN devices.
+ */
+#ifndef __UAPI_LINUX_WWAN_H
+#define __UAPI_LINUX_WWAN_H
+#include <linux/types.h>
+
+#define WWAN_NAME "wwan"
+
+enum wwan_commands {
+ WWAN_CMD_UNSPEC,
+
+ WWAN_CMD_GET_DEVICE, /* get or dump */
+ WWAN_CMD_SET_DEVICE, /* set name or similar */
+ WWAN_CMD_NEW_DEVICE, /* notification */
+ WWAN_CMD_DEL_DEVICE, /* notification */
+
+ WWAN_CMD_GET_NETDEV, /* probably not needed - show all data in GET_DEVICE dump? */
+ WWAN_CMD_SET_NETDEV, /* probably not supported? */
+ WWAN_CMD_NEW_NETDEV,
+ WWAN_CMD_DEL_NETDEV,
+};
+
+/* TODO DOCS */
+enum wwan_chan_type {
+ WWAN_CHAN_TYPE_UNDEFINED,
+ WWAN_CHAN_TYPE_NETDEV,
+ WWAN_CHAN_TYPE_TTY,
+ /* ... */
+};
+
+enum wwan_chan_attrs {
+ /**
+ * @WWAN_CHAN_ATTR_UNSPEC: unused/reserved
+ */
+ WWAN_CHAN_ATTR_UNSPEC,
+
+ /**
+ * @WWAN_CHAN_ATTR_TYPE: channel type according to &enum wwan_chan_type
+ */
+ WWAN_CHAN_ATTR_TYPE,
+
+ /**
+ * @WWAN_CHAN_ATTR_IFIDX: interface index (for netdev channels)
+ */
+ WWAN_CHAN_ATTR_IFIDX,
+
+ /* need something for TTY - major/minor number? /dev/ name? */
+
+ /* ... */
+};
+
+enum wwan_attrs {
+ /**
+ * @WWAN_ATTR_UNSPEC: unused/reserved
+ */
+ WWAN_ATTR_UNSPEC,
+
+ /**
+ * @WWAN_ATTR_DEVICE_ID: device ID
+ */
+ WWAN_ATTR_DEVICE_ID,
+
+ /**
+ * @WWAN_ATTR_DEVICE_NAME: name of the underlying struct device
+ */
+ WWAN_ATTR_DEVICE_NAME,
+
+ /**
+ * @WWAN_ATTR_IFIDX: interface index for %WWAN_CMD_NEW_NETDEV
+ */
+ WWAN_ATTR_IFIDX,
+
+ /**
+ * @WWAN_ATTR_PDN: PDN for %WWAN_CMD_NEW_NETDEV
+ */
+ WWAN_ATTR_PDN,
+
+ /**
+ * @WWAN_ATTR_CHANNELS: nested array of channels in dump, using
+ * the &enum wwan_chan_attrs.
+ */
+ WWAN_ATTR_CHANNELS,
+
+ /* ... */
+};
+
+#endif /* __UAPI_LINUX_WWAN_H */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-17 12:25 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 3:53 [PATCH v2 00/17] net: introduce Qualcomm IPA driver Alex Elder
2019-05-31 3:53 ` [PATCH v2 01/17] bitfield.h: add FIELD_MAX() and field_max() Alex Elder
2019-05-31 3:53 ` [PATCH v2 02/17] dt-bindings: soc: qcom: add IPA bindings Alex Elder
2019-06-10 22:08 ` Rob Herring
2019-06-11 2:11 ` Alex Elder
2019-07-03 15:09 ` Alex Elder
2019-05-31 3:53 ` [PATCH v2 03/17] soc: qcom: ipa: main code Alex Elder
2019-05-31 21:50 ` David Miller
2019-05-31 22:25 ` Alex Elder
2019-05-31 3:53 ` [PATCH v2 04/17] soc: qcom: ipa: configuration data Alex Elder
2019-05-31 3:53 ` [PATCH v2 05/17] soc: qcom: ipa: clocking, interrupts, and memory Alex Elder
2019-05-31 3:53 ` [PATCH v2 06/17] soc: qcom: ipa: GSI headers Alex Elder
2019-05-31 3:53 ` [PATCH v2 07/17] soc: qcom: ipa: the generic software interface Alex Elder
2019-05-31 3:53 ` [PATCH v2 08/17] soc: qcom: ipa: GSI transactions Alex Elder
2019-05-31 3:53 ` [PATCH v2 09/17] soc: qcom: ipa: IPA interface to GSI Alex Elder
2019-05-31 3:53 ` [PATCH v2 10/17] soc: qcom: ipa: IPA endpoints Alex Elder
2019-05-31 3:53 ` [PATCH v2 11/17] soc: qcom: ipa: immediate commands Alex Elder
2019-05-31 3:53 ` [PATCH v2 12/17] soc: qcom: ipa: IPA network device and microcontroller Alex Elder
2019-05-31 3:53 ` [PATCH v2 13/17] soc: qcom: ipa: AP/modem communications Alex Elder
2019-05-31 3:53 ` [PATCH v2 14/17] soc: qcom: ipa: support build of IPA code Alex Elder
2019-05-31 3:53 ` [PATCH v2 15/17] MAINTAINERS: add entry for the Qualcomm IPA driver Alex Elder
2019-05-31 3:53 ` [PATCH v2 16/17] arm64: dts: sdm845: add IPA information Alex Elder
2019-05-31 3:53 ` [PATCH v2 17/17] arm64: defconfig: enable build of IPA code Alex Elder
2019-05-31 14:58 ` [PATCH v2 00/17] net: introduce Qualcomm IPA driver Dan Williams
2019-05-31 16:36 ` Alex Elder
2019-05-31 19:19 ` Arnd Bergmann
2019-05-31 20:47 ` Alex Elder
2019-05-31 21:12 ` Arnd Bergmann
2019-05-31 22:08 ` Alex Elder
2019-06-07 17:43 ` Alex Elder
2019-05-31 23:33 ` Bjorn Andersson
2019-05-31 23:59 ` Subash Abhinov Kasiviswanathan
2019-06-03 10:04 ` Arnd Bergmann
2019-06-03 13:32 ` Alex Elder
2019-06-04 8:13 ` Arnd Bergmann
2019-06-04 15:18 ` Dan Williams
2019-06-04 20:04 ` Arnd Bergmann
2019-06-04 21:29 ` Dan Williams
2019-06-06 17:42 ` Alex Elder
2019-06-11 8:12 ` Johannes Berg
2019-06-11 11:56 ` Arnd Bergmann
2019-06-11 15:53 ` Dan Williams
2019-06-11 16:52 ` Subash Abhinov Kasiviswanathan
2019-06-11 17:22 ` Dan Williams
2019-06-12 8:31 ` Arnd Bergmann
2019-06-12 14:27 ` Dan Williams
2019-06-12 15:06 ` Arnd Bergmann
2019-06-17 11:42 ` Johannes Berg
2019-06-17 12:25 ` Johannes Berg [this message]
2019-06-18 15:20 ` Alex Elder
2019-06-18 18:06 ` Dan Williams
2019-06-24 16:21 ` Alex Elder
2019-06-25 14:14 ` Johannes Berg
2019-06-26 13:36 ` Alex Elder
2019-06-26 17:55 ` Johannes Berg
2019-06-18 18:48 ` Johannes Berg
2019-06-24 16:21 ` Alex Elder
2019-06-18 13:45 ` Alex Elder
2019-06-18 19:03 ` Johannes Berg
2019-06-18 20:09 ` Arnd Bergmann
2019-06-18 20:15 ` Johannes Berg
2019-06-18 20:33 ` Arnd Bergmann
2019-06-18 20:39 ` Johannes Berg
2019-06-18 21:06 ` Arnd Bergmann
2019-06-19 20:56 ` Dan Williams
2019-06-24 16:21 ` Alex Elder
2019-06-24 16:40 ` Arnd Bergmann
2019-06-25 14:19 ` Johannes Berg
2019-06-26 13:39 ` Alex Elder
2019-06-26 13:58 ` Arnd Bergmann
2019-06-26 17:48 ` Johannes Berg
2019-06-26 17:45 ` Johannes Berg
2019-06-26 13:51 ` Alex Elder
2019-06-17 11:28 ` Johannes Berg
2019-06-18 13:16 ` Alex Elder
2019-06-18 13:48 ` Arnd Bergmann
2019-06-18 19:14 ` Johannes Berg
2019-06-18 19:59 ` Arnd Bergmann
2019-06-18 20:36 ` Johannes Berg
2019-06-18 20:55 ` Arnd Bergmann
2019-06-18 21:02 ` Johannes Berg
2019-06-18 21:15 ` Subash Abhinov Kasiviswanathan
2019-06-19 12:23 ` Arnd Bergmann
2019-06-19 18:47 ` Subash Abhinov Kasiviswanathan
2019-06-20 1:25 ` Dan Williams
2019-06-24 16:21 ` Alex Elder
2019-06-17 12:14 ` Johannes Berg
2019-06-18 14:00 ` Alex Elder
2019-06-18 19:22 ` Johannes Berg
2019-06-24 16:21 ` Alex Elder
2019-06-03 14:50 ` Dan Williams
2019-06-03 14:54 ` Dan Williams
2019-06-03 15:52 ` Alex Elder
2019-06-03 16:18 ` Dan Williams
2019-06-03 19:04 ` Subash Abhinov Kasiviswanathan
2019-06-04 15:21 ` Dan Williams
2019-05-31 23:27 ` Bjorn Andersson
2019-06-10 2:44 ` Alex Elder
2019-06-20 13:41 ` [PATCH v2 05/17] soc: qcom: ipa: clocking, interrupts, and memory Hillf Danton
2019-06-24 16:30 ` WWAN Controller Framework (was IPA [PATCH v2 00/17]) Alex Elder
2019-06-24 17:06 ` Alex Elder
2019-06-25 14:34 ` Johannes Berg
2019-06-26 13:40 ` Alex Elder
2019-06-26 17:58 ` Johannes Berg
2019-06-24 19:54 ` Dan Williams
2019-06-24 21:16 ` Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6ba8a9063e63506c0b88a70418d74ca4efe85cd.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=abhishek.esse@gmail.com \
--cc=arnd@arndb.de \
--cc=benchan@google.com \
--cc=bjorn.andersson@linaro.org \
--cc=cpratapa@codeaurora.org \
--cc=davem@davemloft.net \
--cc=dcbw@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=ejcaruso@google.com \
--cc=elder@linaro.org \
--cc=evgreen@chromium.org \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=subashab@codeaurora.org \
--cc=syadagir@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).