Revert "Revert "net: introduce CAN specific pointer in the struct net_device""
This reverts commit 4a23c8ded3
as the
kabi can be updated at this point in time.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I10081148d8e3937c395d686c662f1b2853c10bca
This commit is contained in:

committed by
Todd Kjos

parent
e094831fec
commit
46074eb650
@@ -1633,6 +1633,12 @@ enum netdev_priv_flags {
|
||||
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
|
||||
#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
|
||||
|
||||
/* Specifies the type of the struct net_device::ml_priv pointer */
|
||||
enum netdev_ml_priv_type {
|
||||
ML_PRIV_NONE,
|
||||
ML_PRIV_CAN,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct net_device - The DEVICE structure.
|
||||
*
|
||||
@@ -1828,6 +1834,7 @@ enum netdev_priv_flags {
|
||||
* @nd_net: Network namespace this network device is inside
|
||||
*
|
||||
* @ml_priv: Mid-layer private
|
||||
* @ml_priv_type: Mid-layer private type
|
||||
* @lstats: Loopback statistics
|
||||
* @tstats: Tunnel statistics
|
||||
* @dstats: Dummy statistics
|
||||
@@ -2140,8 +2147,10 @@ struct net_device {
|
||||
possible_net_t nd_net;
|
||||
|
||||
/* mid-layer private */
|
||||
void *ml_priv;
|
||||
enum netdev_ml_priv_type ml_priv_type;
|
||||
|
||||
union {
|
||||
void *ml_priv;
|
||||
struct pcpu_lstats __percpu *lstats;
|
||||
struct pcpu_sw_netstats __percpu *tstats;
|
||||
struct pcpu_dstats __percpu *dstats;
|
||||
@@ -2340,6 +2349,29 @@ static inline void netdev_reset_rx_headroom(struct net_device *dev)
|
||||
netdev_set_rx_headroom(dev, -1);
|
||||
}
|
||||
|
||||
static inline void *netdev_get_ml_priv(struct net_device *dev,
|
||||
enum netdev_ml_priv_type type)
|
||||
{
|
||||
if (dev->ml_priv_type != type)
|
||||
return NULL;
|
||||
|
||||
return dev->ml_priv;
|
||||
}
|
||||
|
||||
static inline void netdev_set_ml_priv(struct net_device *dev,
|
||||
void *ml_priv,
|
||||
enum netdev_ml_priv_type type)
|
||||
{
|
||||
WARN(dev->ml_priv_type && dev->ml_priv_type != type,
|
||||
"Overwriting already set ml_priv_type (%u) with different ml_priv_type (%u)!\n",
|
||||
dev->ml_priv_type, type);
|
||||
WARN(!dev->ml_priv_type && dev->ml_priv,
|
||||
"Overwriting already set ml_priv and ml_priv_type is ML_PRIV_NONE!\n");
|
||||
|
||||
dev->ml_priv = ml_priv;
|
||||
dev->ml_priv_type = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* Net namespace inlines
|
||||
*/
|
||||
|
Reference in New Issue
Block a user