hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/include/linux/netdevice.h
....@@ -41,6 +41,7 @@
4141 #endif
4242 #include <net/netprio_cgroup.h>
4343 #include <net/xdp.h>
44
+#include <net/netoob.h>
4445
4546 #include <linux/netdev_features.h>
4647 #include <linux/neighbour.h>
....@@ -296,6 +297,7 @@
296297 __LINK_STATE_LINKWATCH_PENDING,
297298 __LINK_STATE_DORMANT,
298299 __LINK_STATE_TESTING,
300
+ __LINK_STATE_OOB,
299301 };
300302
301303
....@@ -1534,6 +1536,13 @@
15341536 ANDROID_KABI_RESERVE(6);
15351537 ANDROID_KABI_RESERVE(7);
15361538 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
15371546 };
15381547
15391548 /**
....@@ -1725,6 +1734,7 @@
17251734 * @tlsdev_ops: Transport Layer Security offload operations
17261735 * @header_ops: Includes callbacks for creating,parsing,caching,etc
17271736 * of Layer 2 headers.
1737
+ * @net_oob_context: Out-of-band networking context (oob stage diversion)
17281738 *
17291739 * @flags: Interface flags (a la BSD)
17301740 * @priv_flags: Like 'flags' but invisible to userspace,
....@@ -1982,6 +1992,10 @@
19821992
19831993 #if IS_ENABLED(CONFIG_TLS_DEVICE)
19841994 const struct tlsdev_ops *tlsdev_ops;
1995
+#endif
1996
+
1997
+#ifdef CONFIG_NET_OOB
1998
+ struct oob_netdev_context oob_context;
19851999 #endif
19862000
19872001 const struct header_ops *header_ops;
....@@ -4190,6 +4204,86 @@
41904204
41914205 void netif_device_attach(struct net_device *dev);
41924206
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
+
41934287 /*
41944288 * Network interface message level settings
41954289 */