.. | .. |
---|
41 | 41 | #endif |
---|
42 | 42 | #include <net/netprio_cgroup.h> |
---|
43 | 43 | #include <net/xdp.h> |
---|
| 44 | +#include <net/netoob.h> |
---|
44 | 45 | |
---|
45 | 46 | #include <linux/netdev_features.h> |
---|
46 | 47 | #include <linux/neighbour.h> |
---|
.. | .. |
---|
296 | 297 | __LINK_STATE_LINKWATCH_PENDING, |
---|
297 | 298 | __LINK_STATE_DORMANT, |
---|
298 | 299 | __LINK_STATE_TESTING, |
---|
| 300 | + __LINK_STATE_OOB, |
---|
299 | 301 | }; |
---|
300 | 302 | |
---|
301 | 303 | |
---|
.. | .. |
---|
1534 | 1536 | ANDROID_KABI_RESERVE(6); |
---|
1535 | 1537 | ANDROID_KABI_RESERVE(7); |
---|
1536 | 1538 | ANDROID_KABI_RESERVE(8); |
---|
| 1539 | +#ifdef CONFIG_NET_OOB |
---|
| 1540 | + struct sk_buff * (*ndo_alloc_oob_skb)(struct net_device *dev, |
---|
| 1541 | + dma_addr_t *dma_addr); |
---|
| 1542 | + void (*ndo_free_oob_skb)(struct net_device *dev, |
---|
| 1543 | + struct sk_buff *skb, |
---|
| 1544 | + dma_addr_t dma_addr); |
---|
| 1545 | +#endif |
---|
1537 | 1546 | }; |
---|
1538 | 1547 | |
---|
1539 | 1548 | /** |
---|
.. | .. |
---|
1725 | 1734 | * @tlsdev_ops: Transport Layer Security offload operations |
---|
1726 | 1735 | * @header_ops: Includes callbacks for creating,parsing,caching,etc |
---|
1727 | 1736 | * of Layer 2 headers. |
---|
| 1737 | + * @net_oob_context: Out-of-band networking context (oob stage diversion) |
---|
1728 | 1738 | * |
---|
1729 | 1739 | * @flags: Interface flags (a la BSD) |
---|
1730 | 1740 | * @priv_flags: Like 'flags' but invisible to userspace, |
---|
.. | .. |
---|
1982 | 1992 | |
---|
1983 | 1993 | #if IS_ENABLED(CONFIG_TLS_DEVICE) |
---|
1984 | 1994 | const struct tlsdev_ops *tlsdev_ops; |
---|
| 1995 | +#endif |
---|
| 1996 | + |
---|
| 1997 | +#ifdef CONFIG_NET_OOB |
---|
| 1998 | + struct oob_netdev_context oob_context; |
---|
1985 | 1999 | #endif |
---|
1986 | 2000 | |
---|
1987 | 2001 | const struct header_ops *header_ops; |
---|
.. | .. |
---|
4190 | 4204 | |
---|
4191 | 4205 | void netif_device_attach(struct net_device *dev); |
---|
4192 | 4206 | |
---|
| 4207 | +#ifdef CONFIG_NET_OOB |
---|
| 4208 | + |
---|
| 4209 | +static inline bool netif_oob_diversion(const struct net_device *dev) |
---|
| 4210 | +{ |
---|
| 4211 | + return test_bit(__LINK_STATE_OOB, &dev->state); |
---|
| 4212 | +} |
---|
| 4213 | + |
---|
| 4214 | +static inline void netif_enable_oob_diversion(struct net_device *dev) |
---|
| 4215 | +{ |
---|
| 4216 | + return set_bit(__LINK_STATE_OOB, &dev->state); |
---|
| 4217 | +} |
---|
| 4218 | + |
---|
| 4219 | +static inline void netif_disable_oob_diversion(struct net_device *dev) |
---|
| 4220 | +{ |
---|
| 4221 | + clear_bit(__LINK_STATE_OOB, &dev->state); |
---|
| 4222 | + smp_mb__after_atomic(); |
---|
| 4223 | +} |
---|
| 4224 | + |
---|
| 4225 | +int netif_xmit_oob(struct sk_buff *skb); |
---|
| 4226 | + |
---|
| 4227 | +static inline bool netdev_is_oob_capable(struct net_device *dev) |
---|
| 4228 | +{ |
---|
| 4229 | + return !!(dev->oob_context.flags & IFF_OOB_CAPABLE); |
---|
| 4230 | +} |
---|
| 4231 | + |
---|
| 4232 | +static inline void netdev_enable_oob_port(struct net_device *dev) |
---|
| 4233 | +{ |
---|
| 4234 | + dev->oob_context.flags |= IFF_OOB_PORT; |
---|
| 4235 | +} |
---|
| 4236 | + |
---|
| 4237 | +static inline void netdev_disable_oob_port(struct net_device *dev) |
---|
| 4238 | +{ |
---|
| 4239 | + dev->oob_context.flags &= ~IFF_OOB_PORT; |
---|
| 4240 | +} |
---|
| 4241 | + |
---|
| 4242 | +static inline bool netdev_is_oob_port(struct net_device *dev) |
---|
| 4243 | +{ |
---|
| 4244 | + return !!(dev->oob_context.flags & IFF_OOB_PORT); |
---|
| 4245 | +} |
---|
| 4246 | + |
---|
| 4247 | +static inline struct sk_buff *netdev_alloc_oob_skb(struct net_device *dev, |
---|
| 4248 | + dma_addr_t *dma_addr) |
---|
| 4249 | +{ |
---|
| 4250 | + return dev->netdev_ops->ndo_alloc_oob_skb(dev, dma_addr); |
---|
| 4251 | +} |
---|
| 4252 | + |
---|
| 4253 | +static inline void netdev_free_oob_skb(struct net_device *dev, |
---|
| 4254 | + struct sk_buff *skb, |
---|
| 4255 | + dma_addr_t dma_addr) |
---|
| 4256 | +{ |
---|
| 4257 | + dev->netdev_ops->ndo_free_oob_skb(dev, skb, dma_addr); |
---|
| 4258 | +} |
---|
| 4259 | + |
---|
| 4260 | +#else |
---|
| 4261 | + |
---|
| 4262 | +static inline bool netif_oob_diversion(const struct net_device *dev) |
---|
| 4263 | +{ |
---|
| 4264 | + return false; |
---|
| 4265 | +} |
---|
| 4266 | + |
---|
| 4267 | +static inline bool netdev_is_oob_capable(struct net_device *dev) |
---|
| 4268 | +{ |
---|
| 4269 | + return false; |
---|
| 4270 | +} |
---|
| 4271 | + |
---|
| 4272 | +static inline void netdev_enable_oob_port(struct net_device *dev) |
---|
| 4273 | +{ |
---|
| 4274 | +} |
---|
| 4275 | + |
---|
| 4276 | +static inline void netdev_disable_oob_port(struct net_device *dev) |
---|
| 4277 | +{ |
---|
| 4278 | +} |
---|
| 4279 | + |
---|
| 4280 | +static inline bool netdev_is_oob_port(struct net_device *dev) |
---|
| 4281 | +{ |
---|
| 4282 | + return false; |
---|
| 4283 | +} |
---|
| 4284 | + |
---|
| 4285 | +#endif |
---|
| 4286 | + |
---|
4193 | 4287 | /* |
---|
4194 | 4288 | * Network interface message level settings |
---|
4195 | 4289 | */ |
---|