From bdc7a1347a5398bab0ae9012a5ea6eb12abace43 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sat, 4 Jul 2020 11:36:02 +0800 Subject: [PATCH] generic: fix sfe patches --- ...-linux-kernel-to-support-shortcut-fe.patch | 14 ++++---- ...-linux-kernel-to-support-shortcut-fe.patch | 14 ++++---- ...-linux-kernel-to-support-shortcut-fe.patch | 32 ++++++++----------- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/target/linux/generic/hack-4.14/999-net-patch-linux-kernel-to-support-shortcut-fe.patch b/target/linux/generic/hack-4.14/999-net-patch-linux-kernel-to-support-shortcut-fe.patch index 05f64b2869..9199c67df3 100644 --- a/target/linux/generic/hack-4.14/999-net-patch-linux-kernel-to-support-shortcut-fe.patch +++ b/target/linux/generic/hack-4.14/999-net-patch-linux-kernel-to-support-shortcut-fe.patch @@ -44,17 +44,17 @@ + bool "Enables kernel network stack path for Shortcut Forwarding Engine --- a/net/core/dev.c 2019-01-16 20:38:37.274933833 +0800 +++ b/net/core/dev.c 2019-01-16 20:44:07.773594898 +0800 -@@ -3001,8 +3001,17 @@ static int xmit_one(struct sk_buff *skb, - unsigned int len; - int rc; - +@@ -3005,8 +3005,17 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, + !(skb->imq_flags & IMQ_F_ENQUEUE)) + #else + if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) ++#endif +#ifdef CONFIG_SHORTCUT_FE + /* If this skb has been fast forwarded then we don't want it to + * go to any taps (by definition we're trying to bypass them). + */ + if (!skb->fast_forwarded) { -+#endif - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) + #endif dev_queue_xmit_nit(skb, dev); +#ifdef CONFIG_SHORTCUT_FE + } @@ -233,4 +233,4 @@ +#endif if (likely(ret == 0 && !missed)) - goto out_unlock; \ No newline at end of file + goto out_unlock; diff --git a/target/linux/generic/hack-4.19/999-net-patch-linux-kernel-to-support-shortcut-fe.patch b/target/linux/generic/hack-4.19/999-net-patch-linux-kernel-to-support-shortcut-fe.patch index 05f64b2869..a258338da7 100644 --- a/target/linux/generic/hack-4.19/999-net-patch-linux-kernel-to-support-shortcut-fe.patch +++ b/target/linux/generic/hack-4.19/999-net-patch-linux-kernel-to-support-shortcut-fe.patch @@ -44,17 +44,17 @@ + bool "Enables kernel network stack path for Shortcut Forwarding Engine --- a/net/core/dev.c 2019-01-16 20:38:37.274933833 +0800 +++ b/net/core/dev.c 2019-01-16 20:44:07.773594898 +0800 -@@ -3001,8 +3001,17 @@ static int xmit_one(struct sk_buff *skb, - unsigned int len; - int rc; - +@@ -3256,8 +3256,17 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, + !(skb->imq_flags & IMQ_F_ENQUEUE)) + #else + if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) ++#endif +#ifdef CONFIG_SHORTCUT_FE + /* If this skb has been fast forwarded then we don't want it to + * go to any taps (by definition we're trying to bypass them). + */ + if (!skb->fast_forwarded) { -+#endif - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) + #endif dev_queue_xmit_nit(skb, dev); +#ifdef CONFIG_SHORTCUT_FE + } @@ -233,4 +233,4 @@ +#endif if (likely(ret == 0 && !missed)) - goto out_unlock; \ No newline at end of file + goto out_unlock; diff --git a/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch b/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch index 720b378b68..ab1d89ec99 100644 --- a/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch +++ b/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch @@ -47,22 +47,15 @@ Signed-off-by: Murat Sezgin + bool "Enables kernel network stack path for Shortcut Forwarding Engine" --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -2972,6 +2972,12 @@ static int xmit_one(struct sk_buff *skb, - unsigned int len; - int rc; - +@@ -2974,7 +2974,15 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, + #else + if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) + #endif +#ifdef CONFIG_SHORTCUT_FE + /* If this skb has been fast forwarded then we don't want it to + * go to any taps (by definition we're trying to bypass them). + */ + if (!skb->fast_forwarded) { -+#endif - #if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) - if ((!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) && - !(skb->imq_flags & IMQ_F_ENQUEUE)) -@@ -2979,6 +2985,9 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) - #endif dev_queue_xmit_nit(skb, dev); +#ifdef CONFIG_SHORTCUT_FE + } @@ -70,34 +63,35 @@ Signed-off-by: Murat Sezgin #ifdef CONFIG_ETHERNET_PACKET_MANGLE if (!dev->eth_mangle_tx || -@@ -4130,6 +4139,11 @@ void netdev_rx_handler_unregister(struct +@@ -4126,6 +4134,11 @@ void netdev_rx_handler_unregister(struct net_device *dev) } EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); +#ifdef CONFIG_SHORTCUT_FE -+int (*fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly; -+EXPORT_SYMBOL_GPL(fast_nat_recv); ++int (*athrs_fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly; ++EXPORT_SYMBOL_GPL(athrs_fast_nat_recv); +#endif + /* * Limit the use of PFMEMALLOC reserves to those protocols that implement * the special handling of PFMEMALLOC skbs. -@@ -4177,6 +4191,9 @@ static int __netif_receive_skb_core(stru - bool deliver_exact = false; +@@ -4174,6 +4187,10 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) int ret = NET_RX_DROP; __be16 type; + +#ifdef CONFIG_SHORTCUT_FE + int (*fast_recv)(struct sk_buff *skb); +#endif - ++ net_timestamp_check(!netdev_tstamp_prequeue, skb); -@@ -4203,6 +4220,14 @@ another_round: + trace_netif_receive_skb(skb); +@@ -4199,6 +4216,14 @@ another_round: goto out; } +#ifdef CONFIG_SHORTCUT_FE -+ fast_recv = rcu_dereference(fast_nat_recv); ++ fast_recv = rcu_dereference(athrs_fast_nat_recv); + if (fast_recv && fast_recv(skb)) { + ret = NET_RX_SUCCESS; + goto out;