[rdkb][common][bsp][Refactor and sync kernel from openwrt]

[Description]
5c5acbe [[Panther] AX5400 development]
81b754a [In dual image, the root_fs_data volume cannot be mounted rightly when  image is damaged]
89582fd [kernel][common][eth][Update SFP patch fail issue]
319b70b [MT7622+Kite WHNAT development]
5e3eb21 [kernel][common][eth][Fix SFP patch fail issue]
ccc8407 [kernel][mt7988][eip197][Add aes-sha256 IPSec inline mode]

[Release-log]

Change-Id: Iba99a1d4cd2fe4479bd79d7e3987ac9a89a6e8c2
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/080-wireguard-0072-net-WireGuard-secure-network-tunnel.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/080-wireguard-0072-net-WireGuard-secure-network-tunnel.patch
index a29da1e..ec6d0e5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/080-wireguard-0072-net-WireGuard-secure-network-tunnel.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/080-wireguard-0072-net-WireGuard-secure-network-tunnel.patch
@@ -192,7 +192,7 @@
 
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
-@@ -17585,6 +17585,14 @@ L:	linux-gpio@vger.kernel.org
+@@ -17586,6 +17586,14 @@ L:	linux-gpio@vger.kernel.org
  S:	Maintained
  F:	drivers/gpio/gpio-ws16c48.c
  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/130-add-linux-spidev-compatible-si3210.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/130-add-linux-spidev-compatible-si3210.patch
index 321cbe2..911c05f 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/130-add-linux-spidev-compatible-si3210.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/130-add-linux-spidev-compatible-si3210.patch
@@ -8,7 +8,7 @@
 
 --- a/drivers/spi/spidev.c
 +++ b/drivers/spi/spidev.c
-@@ -689,6 +689,7 @@ static const struct of_device_id spidev_
+@@ -687,6 +687,7 @@ static const struct of_device_id spidev_
  	{ .compatible = "lwn,bk4" },
  	{ .compatible = "dh,dhcom-board" },
  	{ .compatible = "menlo,m53cpld" },
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch
index deed70e..f6a3a82 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch
@@ -49,7 +49,7 @@
  static bool enable_hooks __read_mostly;
  MODULE_PARM_DESC(enable_hooks, "Always enable conntrack hooks");
  module_param(enable_hooks, bool, 0000);
-@@ -650,6 +653,7 @@ enum nf_ct_sysctl_index {
+@@ -649,6 +652,7 @@ enum nf_ct_sysctl_index {
  	NF_SYSCTL_CT_PROTO_TIMEOUT_GRE_STREAM,
  #endif
  
@@ -57,7 +57,7 @@
  	__NF_SYSCTL_CT_LAST_SYSCTL,
  };
  
-@@ -976,6 +980,13 @@ static struct ctl_table nf_ct_sysctl_tab
+@@ -969,6 +973,13 @@ static struct ctl_table nf_ct_sysctl_tab
  		.proc_handler   = proc_dointvec_jiffies,
  	},
  #endif
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
index 39f7af2..0830f2a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
@@ -328,7 +328,7 @@
  	if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
  		return -1;
  
-@@ -1504,6 +1658,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
+@@ -1506,6 +1660,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
  	t->parms.link = p->link;
  	t->parms.proto = p->proto;
  	t->parms.fwmark = p->fwmark;
@@ -343,7 +343,7 @@
  	dst_cache_reset(&t->dst_cache);
  	ip6_tnl_link_config(t);
  	return 0;
-@@ -1542,6 +1704,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
+@@ -1544,6 +1706,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
  	p->flowinfo = u->flowinfo;
  	p->link = u->link;
  	p->proto = u->proto;
@@ -351,7 +351,7 @@
  	memcpy(p->name, u->name, sizeof(u->name));
  }
  
-@@ -1926,6 +2089,15 @@ static int ip6_tnl_validate(struct nlatt
+@@ -1928,6 +2091,15 @@ static int ip6_tnl_validate(struct nlatt
  	return 0;
  }
  
@@ -367,7 +367,7 @@
  static void ip6_tnl_netlink_parms(struct nlattr *data[],
  				  struct __ip6_tnl_parm *parms)
  {
-@@ -1963,6 +2135,46 @@ static void ip6_tnl_netlink_parms(struct
+@@ -1965,6 +2137,46 @@ static void ip6_tnl_netlink_parms(struct
  
  	if (data[IFLA_IPTUN_FWMARK])
  		parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]);
@@ -414,7 +414,7 @@
  }
  
  static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[],
-@@ -2078,6 +2290,12 @@ static void ip6_tnl_dellink(struct net_d
+@@ -2080,6 +2292,12 @@ static void ip6_tnl_dellink(struct net_d
  
  static size_t ip6_tnl_get_size(const struct net_device *dev)
  {
@@ -427,7 +427,7 @@
  	return
  		/* IFLA_IPTUN_LINK */
  		nla_total_size(4) +
-@@ -2107,6 +2325,24 @@ static size_t ip6_tnl_get_size(const str
+@@ -2109,6 +2327,24 @@ static size_t ip6_tnl_get_size(const str
  		nla_total_size(0) +
  		/* IFLA_IPTUN_FWMARK */
  		nla_total_size(4) +
@@ -452,7 +452,7 @@
  		0;
  }
  
-@@ -2114,6 +2350,9 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2116,6 +2352,9 @@ static int ip6_tnl_fill_info(struct sk_b
  {
  	struct ip6_tnl *tunnel = netdev_priv(dev);
  	struct __ip6_tnl_parm *parm = &tunnel->parms;
@@ -462,7 +462,7 @@
  
  	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
  	    nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
-@@ -2123,9 +2362,27 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2125,9 +2364,27 @@ static int ip6_tnl_fill_info(struct sk_b
  	    nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
  	    nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
  	    nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) ||
@@ -491,7 +491,7 @@
  	if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) ||
  	    nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) ||
  	    nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) ||
-@@ -2165,6 +2422,7 @@ static const struct nla_policy ip6_tnl_p
+@@ -2167,6 +2424,7 @@ static const struct nla_policy ip6_tnl_p
  	[IFLA_IPTUN_ENCAP_DPORT]	= { .type = NLA_U16 },
  	[IFLA_IPTUN_COLLECT_METADATA]	= { .type = NLA_FLAG },
  	[IFLA_IPTUN_FWMARK]		= { .type = NLA_U32 },
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
index 10e58b4..f46dc94 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
@@ -53,7 +53,7 @@
  
 --- a/net/ipv4/fib_semantics.c
 +++ b/net/ipv4/fib_semantics.c
-@@ -142,6 +142,10 @@ const struct fib_prop fib_props[RTN_MAX
+@@ -143,6 +143,10 @@ const struct fib_prop fib_props[RTN_MAX
  		.error	= -EINVAL,
  		.scope	= RT_SCOPE_NOWHERE,
  	},
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/745-net-mdio-i2c-add-support-for-Clause-45-accesses.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/745-net-mdio-i2c-add-support-for-Clause-45-accesses.patch
index 761a94b..3b33f63 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/745-net-mdio-i2c-add-support-for-Clause-45-accesses.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/745-net-mdio-i2c-add-support-for-Clause-45-accesses.patch
@@ -15,7 +15,7 @@
 
 --- a/drivers/net/phy/mdio-i2c.c
 +++ b/drivers/net/phy/mdio-i2c.c
-@@ -33,17 +33,24 @@ static int i2c_mii_read(struct mii_bus *
+@@ -32,17 +32,24 @@ static int i2c_mii_read(struct mii_bus *
  {
  	struct i2c_adapter *i2c = bus->priv;
  	struct i2c_msg msgs[2];
@@ -43,7 +43,7 @@
  	msgs[1].addr = bus_addr;
  	msgs[1].flags = I2C_M_RD;
  	msgs[1].len = sizeof(data);
-@@ -61,18 +68,23 @@ static int i2c_mii_write(struct mii_bus
+@@ -60,18 +67,23 @@ static int i2c_mii_write(struct mii_bus
  	struct i2c_adapter *i2c = bus->priv;
  	struct i2c_msg msg;
  	int ret;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.c
index 4d85f50..ff61b90 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.c
@@ -204,10 +204,41 @@
 		key_len += SHA1_DIGEST_SIZE;
 		memcpy(context->data + SIZE_IN_WORDS(key_len),
 		       &xs->id.spi, 4);
+	} else if (strcmp(xs->aalg->alg_name, "hmac(sha256)") == 0) {
+		key_aalg = &xs->aalg->alg_key[0];
+		hmac_setkey("sha256-generic", key_aalg,
+			    xs->aalg->alg_key_len / 8,
+			    &istate.state, &ostate.state);
+		key_ealg = &xs->ealg->alg_key[0];
+		key_len = xs->ealg->alg_key_len / 8;
+		write_state_le(context->data, (const u32 *)key_ealg, key_len);
+		write_state_be(context->data + SIZE_IN_WORDS(key_len),
+			       (const u32 *)&istate.state, SHA256_DIGEST_SIZE);
+
+		key_len += SHA256_DIGEST_SIZE;
+		write_state_be(context->data + SIZE_IN_WORDS(key_len),
+			       (const u32 *)&ostate.state, SHA256_DIGEST_SIZE);
+
+		key_len += SHA256_DIGEST_SIZE;
+		memcpy(context->data + SIZE_IN_WORDS(key_len),
+		       &xs->id.spi, 4);
+
+		if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) {
+			/* rx path */
+			context->control0 = CTRL_WORD0_IN_SHA256;
+			context->control1 = CTRL_WORD1_IN_SHA256;
+			context->data[50] = 0x07041010;
+			context->data[52] = 0xdd070010;
+			context->data[53] = 0xe4561820;
+		} else {
+			/* tx path */
+			context->control0 = CTRL_WORD0_OUT_SHA256;
+			context->control1 = CTRL_WORD1_OUT_SHA256;
+			context->data[50] = 0x01021010;
+			context->data[53] = 0xe1560817;
+			context->data[55] = 0x0000004d;
+		}
 	}
-	//TODO: sha256
-	//else if (strcmp(xs->aalg->alg_name, "hmac(sha256)") == 0) {
-	//}
 
 	/**
 	 * Set CDRT for inline IPSec
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.h
index 5d7635a..a662dc3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_ipsec.h
@@ -8,6 +8,10 @@
 #define CTRL_WORD1_OUT		0x51400001
 #define CTRL_WORD0_IN		0x096ba20f
 #define CTRL_WORD1_IN		0x00010001
+#define CTRL_WORD0_OUT_SHA256	0x19eb1606
+#define CTRL_WORD1_OUT_SHA256	0x57400001
+#define CTRL_WORD0_IN_SHA256	0x09eba20f
+#define CTRL_WORD1_IN_SHA256	0x00010001
 #define SIZE_IN_WORDS(x)	((x) >> 2)
 
 /* Global memory */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/net/ra_nat.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/net/ra_nat.h
index 5f3bead..f5231ca 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/net/ra_nat.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/net/ra_nat.h
@@ -130,7 +130,7 @@
 	uint16_t rsv2:7;
 	u16 MAGIC_TAG_PROTECT;
 } __packed;
-#else
+#elif defined(CONFIG_MEDIATEK_NETSYS_V2)
 struct dmad_rx_descinfo4 {
 	uint32_t foe_entry_num:15;
 	uint32_t rsv0:3;
@@ -151,6 +151,24 @@
 	uint16_t rsv4:4;
 	u16 MAGIC_TAG_PROTECT;
 } __packed;
+#else
+struct dmad_rx_descinfo4 {
+	uint32_t foe_entry_num:14;
+	uint32_t CRSN:5;
+	uint32_t SPORT:3;
+	uint32_t rsv:1;
+	uint32_t ALG:1;
+	uint32_t IF:8;
+	uint32_t MAGIC_TAG_PROTECT: 16;
+	uint32_t WDMAID:8;
+	uint32_t RXID:2;
+	uint32_t WCID:8;
+	uint32_t BSSID:6;
+#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
+	u16 SOURCE;
+	u16 DEST;
+#endif
+} __packed;
 #endif
 
 struct pdma_rx_desc_info4 {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch
new file mode 100755
index 0000000..99f72c0
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch
@@ -0,0 +1,27 @@
+Index: linux-5.4.224/init/do_mounts.c
+===================================================================
+--- linux-5.4.224.orig/init/do_mounts.c
++++ linux-5.4.224/init/do_mounts.c
+@@ -576,7 +576,8 @@ void __init mount_root(void)
+ 	}
+ #endif
+ #ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
+-	if (!mount_ubi_rootfs())
++	extern bool dual_boot;
++	if (!dual_boot && !mount_ubi_rootfs())
+ 		return;
+ #endif
+ #ifdef CONFIG_BLOCK
+Index: linux-5.4.224/kernel/boot_param.c
+===================================================================
+--- linux-5.4.224.orig/kernel/boot_param.c
++++ linux-5.4.224/kernel/boot_param.c
+@@ -10,7 +10,7 @@
+ 
+ #define BOOT_PARAM_STR_MAX_LEN			256
+ 
+-static bool dual_boot;
++bool dual_boot;
+ module_param(dual_boot, bool, 0444);
+ 
+ static bool no_split_rootfs_data;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch
index cfbc28f..ee68b4e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch
@@ -350,10 +350,10 @@
  	return mii;
  }
  EXPORT_SYMBOL_GPL(mdio_i2c_alloc);
-diff --git a/drivers/net/phy/mdio-i2c.h b/drivers/net/phy/mdio-i2c.h
+diff --git a/include/linux/mdio/mdio-i2c.h b/include/linux/mdio/mdio-i2c.h
 index 751dab2..1c21140 100644
---- a/drivers/net/phy/mdio-i2c.h
-+++ b/drivers/net/phy/mdio-i2c.h
+--- a/include/linux/mdio/mdio-i2c.h
++++ b/include/linux/mdio/mdio-i2c.h
 @@ -11,6 +11,14 @@ struct device;
  struct i2c_adapter;
  struct mii_bus;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
index 1571f1a..b77fdc5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
@@ -67,6 +67,7 @@
     file://0950-add-pmic-config.patch \
     file://0950-pwm-mediatek-add-longer-period-support.patch \
     file://0960-watchdog-add-mt7986-assert.patch \
+    file://0961-dual-image-mount-rootfs.patch \
     file://0990-gsw-rtl8367s-mt7622-support.patch \
     file://0991-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch \
     file://0992-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch \
diff --git a/recipes-kernel/linux/linux-mediatek_5.4.bb b/recipes-kernel/linux/linux-mediatek_5.4.bb
index 9a9c5cb..1b0f51c 100644
--- a/recipes-kernel/linux/linux-mediatek_5.4.bb
+++ b/recipes-kernel/linux/linux-mediatek_5.4.bb
@@ -8,8 +8,8 @@
 
 KBRANCH ?= "linux-5.4.y"
 
-LINUX_VERSION ?= "5.4.230"
-SRCREV_machine ?= "90245959a5b936ee013266e5d1e6a508ed69274e"
+LINUX_VERSION ?= "5.4.231"
+SRCREV_machine ?= "59342376e8f0c704299dc7a2c14fed07ffb962e2"
 KMETA = "kernel-meta"
 SRCREV_meta ?= "feeb59687bc0f054af837a5061f8d413ec7c93e9"