diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2021-06-22 01:51:00 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-22 10:01:17 -0700 |
commit | 699409240389c2994e5fa1cb7d7599129bc7cfdf (patch) | |
tree | ccb93be7cb9825b86d0156507a0827cbd875fcc5 /include/linux/wwan.h | |
parent | 83068395bbfcd96db74af75c6dc3a87a4f952220 (diff) |
wwan: core: add WWAN common private data for netdev
The WWAN core not only multiplex the netdev configuration data, but
process it too, and needs some space to store its private data
associated with the netdev. Add a structure to keep common WWAN core
data. The structure will be stored inside the netdev private data before
WWAN driver private data and have a field to make it easier to access
the driver data. Also add a helper function that simplifies drivers
access to their data.
At the moment we use the common WWAN private data to store the WWAN data
link (channel) id at the time the link is created, and report it back to
user using the .fill_info() RTNL callback. This should help the user to
be aware which network interface is bound to which WWAN device data
channel.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
CC: M Chetan Kumar <m.chetan.kumar@intel.com>
CC: Intel Corporation <linuxwwan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/wwan.h')
-rw-r--r-- | include/linux/wwan.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/wwan.h b/include/linux/wwan.h index 91590db70a12..9fac819f92e3 100644 --- a/include/linux/wwan.h +++ b/include/linux/wwan.h @@ -9,6 +9,7 @@ #include <linux/poll.h> #include <linux/skbuff.h> #include <linux/netlink.h> +#include <linux/netdevice.h> /** * enum wwan_port_type - WWAN port types @@ -126,6 +127,23 @@ void wwan_port_txon(struct wwan_port *port); */ void *wwan_port_get_drvdata(struct wwan_port *port); +/** + * struct wwan_netdev_priv - WWAN core network device private data + * @link_id: WWAN device data link id + * @drv_priv: driver private data area, size is determined in &wwan_ops + */ +struct wwan_netdev_priv { + u32 link_id; + + /* must be last */ + u8 drv_priv[] __aligned(sizeof(void *)); +}; + +static inline void *wwan_netdev_drvpriv(struct net_device *dev) +{ + return ((struct wwan_netdev_priv *)netdev_priv(dev))->drv_priv; +} + /* * Used to indicate that the WWAN core should not create a default network * link. |