backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] backports: stub structs but remove ndo_fill_forward_path
@ 2022-02-21 14:11 Johannes Berg
  2022-02-21 14:11 ` [PATCH 2/3] backports: add memset_after/memset_startat Johannes Berg
  2022-02-21 14:11 ` [PATCH 3/3] backports: add ktime_get_coarse_boottime_ns Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2022-02-21 14:11 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

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/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 2ef89e04c1a9..6214a69a3e65 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -192,4 +192,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) */
-- 
2.35.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] backports: add memset_after/memset_startat
  2022-02-21 14:11 [PATCH 1/3] backports: stub structs but remove ndo_fill_forward_path Johannes Berg
@ 2022-02-21 14:11 ` Johannes Berg
  2022-02-21 14:11 ` [PATCH 3/3] backports: add ktime_get_coarse_boottime_ns Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2022-02-21 14:11 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/string.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backport/backport-include/linux/string.h b/backport/backport-include/linux/string.h
index 39257e5f66ab..dc29dcf72b24 100644
--- a/backport/backport-include/linux/string.h
+++ b/backport/backport-include/linux/string.h
@@ -12,4 +12,24 @@ extern void *memdup_user_nul(const void __user *, size_t);
 int match_string(const char * const *array, size_t n, const char *string);
 #endif /* LINUX_VERSION_IS_LESS(4,5,0) */
 
+#ifndef memset_after
+#define memset_after(obj, v, member)					\
+({									\
+	u8 *__ptr = (u8 *)(obj);					\
+	typeof(v) __val = (v);						\
+	memset(__ptr + offsetofend(typeof(*(obj)), member), __val,	\
+	       sizeof(*(obj)) - offsetofend(typeof(*(obj)), member));	\
+})
+#endif
+
+#ifndef memset_startat
+#define memset_startat(obj, v, member)					\
+({									\
+	u8 *__ptr = (u8 *)(obj);					\
+	typeof(v) __val = (v);						\
+	memset(__ptr + offsetof(typeof(*(obj)), member), __val,		\
+	       sizeof(*(obj)) - offsetof(typeof(*(obj)), member));	\
+})
+#endif
+
 #endif /* __BACKPORT_LINUX_STRING_H */
-- 
2.35.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] backports: add ktime_get_coarse_boottime_ns
  2022-02-21 14:11 [PATCH 1/3] backports: stub structs but remove ndo_fill_forward_path Johannes Berg
  2022-02-21 14:11 ` [PATCH 2/3] backports: add memset_after/memset_startat Johannes Berg
@ 2022-02-21 14:11 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2022-02-21 14:11 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

... and simplify the code while at it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/timekeeping.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h
index 80c625569d6e..87744572bce6 100644
--- a/backport/backport-include/linux/timekeeping.h
+++ b/backport/backport-include/linux/timekeeping.h
@@ -6,23 +6,18 @@
 #include_next <linux/timekeeping.h>
 
 #if LINUX_VERSION_IS_LESS(5,3,0)
-#define ktime_get_boottime_ns LINUX_BACKPORT(ktime_get_boottime_ns)
-static inline u64 ktime_get_boottime_ns(void)
-{
-	return ktime_get_boot_ns();
-}
+#define ktime_get_boottime_ns ktime_get_boot_ns
+#define ktime_get_coarse_boottime_ns ktime_get_boot_ns
 #endif /* < 5.3 */
 
 #if LINUX_VERSION_IS_LESS(4,18,0)
 extern time64_t ktime_get_boottime_seconds(void);
-#endif /* < 4.18 */
 
-#if LINUX_VERSION_IS_LESS(4,18,0)
 #define ktime_get_raw_ts64 LINUX_BACKPORT(ktime_get_raw_ts64)
 static inline void ktime_get_raw_ts64(struct timespec64 *ts)
 {
 	return getrawmonotonic64(ts);
 }
-#endif
+#endif /* < 4.18 */
 
 #endif /* __BACKPORT_TIMEKEEPING_H */
-- 
2.35.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-21 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 14:11 [PATCH 1/3] backports: stub structs but remove ndo_fill_forward_path Johannes Berg
2022-02-21 14:11 ` [PATCH 2/3] backports: add memset_after/memset_startat Johannes Berg
2022-02-21 14:11 ` [PATCH 3/3] backports: add ktime_get_coarse_boottime_ns Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).