| From 0d65414c2ec0772539b728d075aab23b026b553b Mon Sep 17 00:00:00 2001 |
| From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| Date: Fri, 23 Feb 2024 09:10:09 +0800 |
| Subject: [PATCH 1/3] backports: add SKB_DROP_REASON and kfree_skb_reason |
| backport on Kernel 5.4 |
| |
| --- |
| backport-include/linux/skbuff.h | 8 ++++++++ |
| backport-include/net/dropreason-core.h | 6 ++++++ |
| 2 files changed, 14 insertions(+) |
| |
| diff --git a/backport-include/linux/skbuff.h b/backport-include/linux/skbuff.h |
| index c1592c2..9e23251 100644 |
| --- a/backport-include/linux/skbuff.h |
| +++ b/backport-include/linux/skbuff.h |
| @@ -144,4 +144,12 @@ static inline u64 skb_get_kcov_handle(struct sk_buff *skb) |
| #define napi_build_skb build_skb |
| #endif |
| |
| +#if LINUX_VERSION_IS_LESS(6,0,0) |
| +#define kfree_skb_reason LINUX_BACKPORT(kfree_skb_reason) |
| +static inline void kfree_skb_reason(struct sk_buff *skb, int reason) |
| +{ |
| + return kfree_skb(skb); |
| +} |
| +#endif |
| + |
| #endif /* __BACKPORT_SKBUFF_H */ |
| diff --git a/backport-include/net/dropreason-core.h b/backport-include/net/dropreason-core.h |
| index ab8532e..31c60b9 100644 |
| --- a/backport-include/net/dropreason-core.h |
| +++ b/backport-include/net/dropreason-core.h |
| @@ -13,6 +13,12 @@ |
| |
| #include <linux/version.h> |
| |
| +/* backport for 5.4 */ |
| +#if LINUX_VERSION_IS_LESS(5,5,0) |
| +#define SKB_DROP_REASON_NOT_SPECIFIED 2 |
| +#define SKB_DROP_REASON_MAX 69 |
| +#endif |
| + |
| #if LINUX_VERSION_IS_LESS(5,18,0) |
| #define SKB_NOT_DROPPED_YET SKB_DROP_REASON_MAX |
| #endif |
| -- |
| 2.18.0 |
| |