[rdkb][common][bsp][Refactor and sync kernel from openwrt]
[Description]
76cd4287 [mt7986][trng][change trng version]
37641870 [openwrt][mt7987][bsp][Add support for the mt7987 platform]
73fe5221 [kernel][mt7987][hnat][Refactor fqos flag assignment when HQoS is enabled for the NETSYSv3.1]
b4d8a1ed [kernel][common][eth][Add nf hw offload]
9872cf38 [kernel][mt7987][eth][Switch to real clock driver for the ETH]
e49e90e7 [set trng clock is ao]
[Release-log]
Change-Id: I47177c3ac8287a95f5bff802123e5bdb068fb009
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2726-mtkhnat-tnl-interface-offload-check.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2726-mtkhnat-tnl-interface-offload-check.patch
new file mode 100644
index 0000000..5f8bf62
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2726-mtkhnat-tnl-interface-offload-check.patch
@@ -0,0 +1,66 @@
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
+index c30952f..6c0860b 100644
+--- a/include/linux/netdevice.h
++++ b/include/linux/netdevice.h
+@@ -851,6 +851,7 @@ enum net_device_path_type {
+ DEV_PATH_DSA,
+ DEV_PATH_DSLITE,
+ DEV_PATH_6RD,
++ DEV_PATH_TNL,
+ };
+
+ struct net_device_path {
+diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
+index 7d3c782..d7a5a9a 100644
+--- a/net/l2tp/l2tp_ppp.c
++++ b/net/l2tp/l2tp_ppp.c
+@@ -89,6 +89,7 @@
+ #include <linux/nsproxy.h>
+ #include <net/net_namespace.h>
+ #include <net/netns/generic.h>
++#include <net/netfilter/nf_flow_table.h>
+ #include <net/ip.h>
+ #include <net/udp.h>
+ #include <net/inet_common.h>
+@@ -124,9 +125,14 @@ struct pppol2tp_session {
+ };
+
+ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
++static int l2tp_ppp_flow_offload_check(struct ppp_channel *chan,
++ struct flow_offload_hw_path *path);
+
+ static const struct ppp_channel_ops pppol2tp_chan_ops = {
+ .start_xmit = pppol2tp_xmit,
++#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
++ .flow_offload_check = l2tp_ppp_flow_offload_check,
++#endif /* IS_ENABLED(CONFIG_NF_FLOW_TABLE) */
+ };
+
+ static const struct proto_ops pppol2tp_ops;
+@@ -335,6 +341,26 @@ static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
+ return error;
+ }
+
++#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
++static int l2tp_ppp_flow_offload_check(struct ppp_channel *chan,
++ struct flow_offload_hw_path *path)
++{
++ struct sock *sk = (struct sock *)chan->private;
++ struct l2tp_session *session;
++
++ if (path->flags & BIT(DEV_PATH_TNL))
++ return -EEXIST;
++
++ session = pppol2tp_sock_to_session(sk);
++ if (!session)
++ return -EINVAL;
++
++ path->flags |= BIT(DEV_PATH_TNL);
++
++ return 0;
++}
++#endif /* IS_ENABLED(CONFIG_NF_FLOW_TABLE) */
++
+ /* Transmit function called by generic PPP driver. Sends PPP frame
+ * over PPPoL2TP socket.
+ *