headers: backport napi add functions
PATCH 1/8 headers: backport napi add functions
Deal with the removed weight argument
Signed-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/netdevice.h | 38 ++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-)
backport/backport-include/linux/netdevice.h +19 -19
@@ -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
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 2/8 headers: backport usb_maxpacket api change
The third argument was removed
Signed-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/usb.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backport/backport-include/linux/usb.h
backport/backport-include/linux/usb.h new file +14 -0
@@ -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
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 3/8 headers: add txq_trans_cond_update
In reply to Felix FietkauSigned-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/netdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
backport/backport-include/linux/netdevice.h +11 -0
@@ -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) {
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 4/8 headers: add __vstring and __assign_vstr
In reply to Felix FietkauUsed within tracepoints on a few drivers
Signed-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/trace/trace_events.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backport/backport-include/trace/trace_events.h
backport/backport-include/trace/trace_events.h new file +16 -0
@@ -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>
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 5/8 headers: backport mmc_sw_reset and mmc_hw_reset API changes
In reply to Felix FietkauSigned-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/mmc/core.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 backport/backport-include/linux/mmc/core.h
backport/backport-include/linux/mmc/core.h new file +22 -0
@@ -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
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 6/8 headers: add DEFINE_SIMPLE_DEV_PM_OPS
In reply to Felix FietkauSigned-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/pm.h | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
backport/backport-include/linux/pm.h +30 -0
@@ -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 */
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 7/8 headers: backport device_get_mac_address api change
In reply to Felix FietkauSigned-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/etherdevice.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
backport/backport-include/linux/etherdevice.h +12 -0
@@ -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 */
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 8/8 headers: add skb_tcp_all_headers
In reply to Felix FietkauSigned-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/tcp.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backport/backport-include/linux/tcp.h
backport/backport-include/linux/tcp.h new file +14 -0
@@ -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
Signature · 4 lines
2.36.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in