backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] headers: backport napi add functions
@ 2022-10-13  8:53 Felix Fietkau
  2022-10-13  8:53 ` [PATCH 2/8] headers: backport usb_maxpacket api change Felix Fietkau
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Deal with the removed weight argument

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/netdevice.h | 38 ++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 9b3291bb7188..c0c6a97945b1 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -23,27 +23,27 @@ static inline bool backport_napi_complete(struct napi_struct *n)
 #define napi_complete LINUX_BACKPORT(napi_complete)
 #endif /* < 4.10 */
 
-#if LINUX_VERSION_IS_LESS(4,5,0)
-#define netif_tx_napi_add LINUX_BACKPORT(netif_tx_napi_add)
-/**
- *	netif_tx_napi_add - initialize a napi context
- *	@dev:  network device
- *	@napi: napi context
- *	@poll: polling function
- *	@weight: default weight
- *
- * This variant of netif_napi_add() should be used from drivers using NAPI
- * to exclusively poll a TX queue.
- * This will avoid we add it into napi_hash[], thus polluting this hash table.
- */
-static inline void netif_tx_napi_add(struct net_device *dev,
-				     struct napi_struct *napi,
-				     int (*poll)(struct napi_struct *, int),
-				     int weight)
+#if LINUX_VERSION_IS_LESS(6,1,0)
+static inline void backport_netif_napi_add(struct net_device *dev,
+					   struct napi_struct *napi,
+					   int (*poll)(struct napi_struct *, int))
+{
+	netif_napi_add(dev, napi, poll, NAPI_POLL_WEIGHT);
+}
+#define netif_napi_add LINUX_BACKPORT(netif_napi_add)
+
+static inline void backport_netif_napi_add_tx(struct net_device *dev,
+					      struct napi_struct *napi,
+					      int (*poll)(struct napi_struct *, int))
 {
-	netif_napi_add(dev, napi, poll, weight);
+#if LINUX_VERSION_IS_LESS(4,5,0)
+	netif_napi_add(dev, napi, poll);
+#else
+	netif_tx_napi_add(dev, napi, poll, NAPI_POLL_WEIGHT);
+#endif
 }
-#endif /* < 4.5 */
+#define netif_napi_add_tx LINUX_BACKPORT(netif_napi_add_tx)
+#endif /* < 6.1 */
 
 #ifndef NETIF_F_CSUM_MASK
 #define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM
-- 
2.36.1

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

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

* [PATCH 2/8] headers: backport usb_maxpacket api change
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 3/8] headers: add txq_trans_cond_update Felix Fietkau
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

The third argument was removed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/usb.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 backport/backport-include/linux/usb.h

diff --git a/backport/backport-include/linux/usb.h b/backport/backport-include/linux/usb.h
new file mode 100644
index 000000000000..844cdcc7d55e
--- /dev/null
+++ b/backport/backport-include/linux/usb.h
@@ -0,0 +1,14 @@
+#ifndef __BACKPORT_LINUX_USB_H
+#define __BACKPORT_LINUX_USB_H
+#include_next <linux/usb.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(5,19,0)
+static inline u16 backport_usb_maxpacket(struct usb_device *udev, int pipe)
+{
+	return usb_maxpacket(udev, pipe, usb_pipeout(pipe));
+}
+#define usb_maxpacket LINUX_BACKPORT(usb_maxpacket)
+#endif /* <5.19 */
+
+#endif
-- 
2.36.1

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

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

* [PATCH 3/8] headers: add txq_trans_cond_update
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
  2022-10-13  8:53 ` [PATCH 2/8] headers: backport usb_maxpacket api change Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 4/8] headers: add __vstring and __assign_vstr Felix Fietkau
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/netdevice.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index c0c6a97945b1..1d2ac66b403b 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -254,6 +254,17 @@ struct net_device_path_ctx {
 };
 #endif /* NET_DEVICE_PATH_STACK_MAX */
 
+#if LINUX_VERSION_IS_LESS(5,17,0)
+static inline void backport_txq_trans_cond_update(struct netdev_queue *txq)
+{
+	unsigned long now = jiffies;
+
+	if (READ_ONCE(txq->trans_start) != now)
+		WRITE_ONCE(txq->trans_start, now);
+}
+#define txq_trans_cond_update LINUX_BACKPORT(txq_trans_cond_update)
+#endif /* < 5.17 */
+
 #if LINUX_VERSION_IS_LESS(5,18,0)
 static inline int LINUX_BACKPORT(netif_rx)(struct sk_buff *skb)
 {
-- 
2.36.1

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

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

* [PATCH 4/8] headers: add __vstring and __assign_vstr
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
  2022-10-13  8:53 ` [PATCH 2/8] headers: backport usb_maxpacket api change Felix Fietkau
  2022-10-13  8:53 ` [PATCH 3/8] headers: add txq_trans_cond_update Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 5/8] headers: backport mmc_sw_reset and mmc_hw_reset API changes Felix Fietkau
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Used within tracepoints on a few drivers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/trace/trace_events.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 backport/backport-include/trace/trace_events.h

diff --git a/backport/backport-include/trace/trace_events.h b/backport/backport-include/trace/trace_events.h
new file mode 100644
index 000000000000..fd6a4f3c343d
--- /dev/null
+++ b/backport/backport-include/trace/trace_events.h
@@ -0,0 +1,16 @@
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(6,0,0)
+#undef VSTRING_MSG_MAX
+#define VSTRING_MSG_MAX	512
+
+#undef __vstring
+#define __vstring(msg, fmt, va) __dynamic_array(char, msg, VSTRING_MSG_MAX)
+
+#undef __assign_vstr
+#define __assign_vstr(msg, fmt, va)					  \
+	WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), VSTRING_MSG_MAX, \
+			       fmt, *va) >= VSTRING_MSG_MAX)
+#endif /* <6.0 */
+
+#include_next <trace/trace_events.h>
-- 
2.36.1

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

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

* [PATCH 5/8] headers: backport mmc_sw_reset and mmc_hw_reset API changes
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
                   ` (2 preceding siblings ...)
  2022-10-13  8:53 ` [PATCH 4/8] headers: add __vstring and __assign_vstr Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 6/8] headers: add DEFINE_SIMPLE_DEV_PM_OPS Felix Fietkau
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/mmc/core.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 backport/backport-include/linux/mmc/core.h

diff --git a/backport/backport-include/linux/mmc/core.h b/backport/backport-include/linux/mmc/core.h
new file mode 100644
index 000000000000..525994c27e06
--- /dev/null
+++ b/backport/backport-include/linux/mmc/core.h
@@ -0,0 +1,22 @@
+#ifndef __BACKPORT_LINUX_MMC_CORE_H
+#define __BACKPORT_LINUX_MMC_CORE_H
+
+#include_next <linux/mmc/card.h>
+#include_next <linux/mmc/core.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(5,19,0)
+static inline int backport_mmc_sw_reset(struct mmc_card *card)
+{
+	return mmc_sw_reset(card->host);
+}
+#define mmc_sw_reset LINUX_BACKPORT(mmc_sw_reset)
+
+static inline int backport_mmc_hw_reset(struct mmc_card *card)
+{
+	return mmc_hw_reset(card->host);
+}
+#define mmc_hw_reset LINUX_BACKPORT(mmc_hw_reset)
+#endif /* <5.19 */
+
+#endif
-- 
2.36.1

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

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

* [PATCH 6/8] headers: add DEFINE_SIMPLE_DEV_PM_OPS
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
                   ` (3 preceding siblings ...)
  2022-10-13  8:53 ` [PATCH 5/8] headers: backport mmc_sw_reset and mmc_hw_reset API changes Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 7/8] headers: backport device_get_mac_address api change Felix Fietkau
  2022-10-13  8:53 ` [PATCH 8/8] headers: add skb_tcp_all_headers Felix Fietkau
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/pm.h | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/backport/backport-include/linux/pm.h b/backport/backport-include/linux/pm.h
index 926b0bf15c8e..24d760fab33c 100644
--- a/backport/backport-include/linux/pm.h
+++ b/backport/backport-include/linux/pm.h
@@ -14,4 +14,34 @@
 #define PMSG_IS_AUTO(msg)	(((msg).event & PM_EVENT_AUTO) != 0)
 #endif
 
+#ifndef DEFINE_SIMPLE_DEV_PM_OPS
+
+#define pm_sleep_ptr(_ptr) (IS_ENABLED(CONFIG_PM_SLEEP) ? (_ptr) : NULL)
+
+#define SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	.suspend = pm_sleep_ptr(suspend_fn), \
+	.resume = pm_sleep_ptr(resume_fn), \
+	.freeze = pm_sleep_ptr(suspend_fn), \
+	.thaw = pm_sleep_ptr(resume_fn), \
+	.poweroff = pm_sleep_ptr(suspend_fn), \
+	.restore = pm_sleep_ptr(resume_fn),
+
+#define RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
+	.runtime_suspend = suspend_fn, \
+	.runtime_resume = resume_fn, \
+	.runtime_idle = idle_fn,
+
+#define _DEFINE_DEV_PM_OPS(name, \
+			   suspend_fn, resume_fn, \
+			   runtime_suspend_fn, runtime_resume_fn, idle_fn) \
+const struct dev_pm_ops name = { \
+	SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
+}
+
+#define DEFINE_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
+	_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
+
+#endif
+
 #endif /* __BACKPORT_PM_H */
-- 
2.36.1

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

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

* [PATCH 7/8] headers: backport device_get_mac_address api change
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
                   ` (4 preceding siblings ...)
  2022-10-13  8:53 ` [PATCH 6/8] headers: add DEFINE_SIMPLE_DEV_PM_OPS Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  2022-10-13  8:53 ` [PATCH 8/8] headers: add skb_tcp_all_headers Felix Fietkau
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/etherdevice.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/backport/backport-include/linux/etherdevice.h b/backport/backport-include/linux/etherdevice.h
index f6fa51f3829c..51a7d6d73f7e 100644
--- a/backport/backport-include/linux/etherdevice.h
+++ b/backport/backport-include/linux/etherdevice.h
@@ -2,6 +2,7 @@
 #define _BACKPORT_LINUX_ETHERDEVICE_H
 #include_next <linux/etherdevice.h>
 #include <linux/version.h>
+#include <linux/property.h>
 
 
 #if LINUX_VERSION_IS_LESS(4,11,0)
@@ -52,4 +53,15 @@ static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
 }
 #endif /* LINUX_VERSION_IS_LESS(5,15,0) */
 
+#if LINUX_VERSION_IS_LESS(5,16,0)
+static inline int backport_device_get_mac_address(struct device *dev, char *addr)
+{
+	if (!device_get_mac_address(dev, addr, ETH_ALEN))
+		return -ENOENT;
+
+	return 0;
+}
+#define device_get_mac_address LINUX_BACKPORT(device_get_mac_address)
+#endif /* LINUX_VERSION_IS_LESS(5,16,0) */
+
 #endif /* _BACKPORT_LINUX_ETHERDEVICE_H */
-- 
2.36.1

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

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

* [PATCH 8/8] headers: add skb_tcp_all_headers
  2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
                   ` (5 preceding siblings ...)
  2022-10-13  8:53 ` [PATCH 7/8] headers: backport device_get_mac_address api change Felix Fietkau
@ 2022-10-13  8:53 ` Felix Fietkau
  6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2022-10-13  8:53 UTC (permalink / raw)
  To: backports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/tcp.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 backport/backport-include/linux/tcp.h

diff --git a/backport/backport-include/linux/tcp.h b/backport/backport-include/linux/tcp.h
new file mode 100644
index 000000000000..2483cbebf66c
--- /dev/null
+++ b/backport/backport-include/linux/tcp.h
@@ -0,0 +1,14 @@
+#ifndef __BACKPORT_LINUX_TCP_H
+#define __BACKPORT_LINUX_TCP_H
+
+#include_next <linux/tcp.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(6,0,0)
+static inline int skb_tcp_all_headers(const struct sk_buff *skb)
+{
+	return skb_transport_offset(skb) + tcp_hdrlen(skb);
+}
+#endif
+
+#endif
-- 
2.36.1

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

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

end of thread, other threads:[~2022-10-13  8:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13  8:53 [PATCH 1/8] headers: backport napi add functions Felix Fietkau
2022-10-13  8:53 ` [PATCH 2/8] headers: backport usb_maxpacket api change Felix Fietkau
2022-10-13  8:53 ` [PATCH 3/8] headers: add txq_trans_cond_update Felix Fietkau
2022-10-13  8:53 ` [PATCH 4/8] headers: add __vstring and __assign_vstr Felix Fietkau
2022-10-13  8:53 ` [PATCH 5/8] headers: backport mmc_sw_reset and mmc_hw_reset API changes Felix Fietkau
2022-10-13  8:53 ` [PATCH 6/8] headers: add DEFINE_SIMPLE_DEV_PM_OPS Felix Fietkau
2022-10-13  8:53 ` [PATCH 7/8] headers: backport device_get_mac_address api change Felix Fietkau
2022-10-13  8:53 ` [PATCH 8/8] headers: add skb_tcp_all_headers Felix Fietkau

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).