diff mbox series

[11/38] backports: stub structs but remove ndo_fill_forward_path

Message ID 20221011230356.fc6d493894a6.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid (mailing list archive)
State New, archived
Headers show
Series backports updates | expand

Commit Message

Johannes Berg Oct. 11, 2022, 9:04 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/netdevice.h | 55 +++++++++++++++++++++
 patches/0107-net-forward-path.cocci         | 19 +++++++
 2 files changed, 74 insertions(+)
 create mode 100644 patches/0107-net-forward-path.cocci

Comments

Felix Fietkau Oct. 12, 2022, 8:18 a.m. UTC | #1
On 11.10.22 23:04, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>   backport/backport-include/linux/netdevice.h | 55 +++++++++++++++++++++
>   patches/0107-net-forward-path.cocci         | 19 +++++++
>   2 files changed, 74 insertions(+)
>   create mode 100644 patches/0107-net-forward-path.cocci
> 

> diff --git a/patches/0107-net-forward-path.cocci b/patches/0107-net-forward-path.cocci
> new file mode 100644
> index 000000000000..f612239404a6
> --- /dev/null
> +++ b/patches/0107-net-forward-path.cocci
> @@ -0,0 +1,19 @@
> +@ops@
> +identifier ops, fn;
> +@@
> +const struct net_device_ops ops = {
> ++#if LINUX_VERSION_IS_GEQ(5,13,0)
> +  .ndo_fill_forward_path = fn,
> ++#endif
> +  ...
> +};
> +
> +@@
> +identifier ops.fn;
> +@@
> ++#if LINUX_VERSION_IS_GEQ(5,13,0)
> +int fn(...)
> +{
> +...
> +}
> ++#endif /* LINUX_VERSION_IS_GEQ(5,13,0) */
How about using #ifdef NET_DEVICE_PATH_STACK_MAX here as well?

- Felix
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg Oct. 12, 2022, 8:50 a.m. UTC | #2
On Wed, 2022-10-12 at 10:18 +0200, Felix Fietkau wrote:
> 
> > +++ b/patches/0107-net-forward-path.cocci
> > @@ -0,0 +1,19 @@
> > +@ops@
> > +identifier ops, fn;
> > +@@
> > +const struct net_device_ops ops = {
> > ++#if LINUX_VERSION_IS_GEQ(5,13,0)
> > +  .ndo_fill_forward_path = fn,
> > ++#endif
> > +  ...
> > +};
> > +
> > +@@
> > +identifier ops.fn;
> > +@@
> > ++#if LINUX_VERSION_IS_GEQ(5,13,0)
> > +int fn(...)
> > +{
> > +...
> > +}
> > ++#endif /* LINUX_VERSION_IS_GEQ(5,13,0) */

> How about using #ifdef NET_DEVICE_PATH_STACK_MAX here as well?
> 

I guess that would work, don't remember that I thought about it and
rejected that for some reason.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox series

Patch

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index c6ca8b5556d5..d2e175243560 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -199,4 +199,59 @@  static inline void backport_dev_hold(struct net_device *dev)
 #define dev_hold LINUX_BACKPORT(dev_hold)
 #endif /* < 5.15 */
 
+#ifndef NET_DEVICE_PATH_STACK_MAX
+enum net_device_path_type {
+	DEV_PATH_ETHERNET = 0,
+	DEV_PATH_VLAN,
+	DEV_PATH_BRIDGE,
+	DEV_PATH_PPPOE,
+	DEV_PATH_DSA,
+};
+
+struct net_device_path {
+	enum net_device_path_type	type;
+	const struct net_device		*dev;
+	union {
+		struct {
+			u16		id;
+			__be16		proto;
+			u8		h_dest[ETH_ALEN];
+		} encap;
+		struct {
+			enum {
+				DEV_PATH_BR_VLAN_KEEP,
+				DEV_PATH_BR_VLAN_TAG,
+				DEV_PATH_BR_VLAN_UNTAG,
+				DEV_PATH_BR_VLAN_UNTAG_HW,
+			}		vlan_mode;
+			u16		vlan_id;
+			__be16		vlan_proto;
+		} bridge;
+		struct {
+			int port;
+			u16 proto;
+		} dsa;
+	};
+};
+
+#define NET_DEVICE_PATH_STACK_MAX	5
+#define NET_DEVICE_PATH_VLAN_MAX	2
+
+struct net_device_path_stack {
+	int			num_paths;
+	struct net_device_path	path[NET_DEVICE_PATH_STACK_MAX];
+};
+
+struct net_device_path_ctx {
+	const struct net_device *dev;
+	const u8		*daddr;
+
+	int			num_vlans;
+	struct {
+		u16		id;
+		__be16		proto;
+	} vlan[NET_DEVICE_PATH_VLAN_MAX];
+};
+#endif /* NET_DEVICE_PATH_STACK_MAX */
+
 #endif /* __BACKPORT_NETDEVICE_H */
diff --git a/patches/0107-net-forward-path.cocci b/patches/0107-net-forward-path.cocci
new file mode 100644
index 000000000000..f612239404a6
--- /dev/null
+++ b/patches/0107-net-forward-path.cocci
@@ -0,0 +1,19 @@ 
+@ops@
+identifier ops, fn;
+@@
+const struct net_device_ops ops = {
++#if LINUX_VERSION_IS_GEQ(5,13,0)
+  .ndo_fill_forward_path = fn,
++#endif
+  ...
+};
+
+@@
+identifier ops.fn;
+@@
++#if LINUX_VERSION_IS_GEQ(5,13,0)
+int fn(...)
+{
+...
+}
++#endif /* LINUX_VERSION_IS_GEQ(5,13,0) */