[][openwrt][mt7988][crypto][Add support for L2GREoIPsec]
[Description]
Add some support for L2GREoIPsec
- Change hw_srv from 2 to 3
- Allow the traffic to be offloaded if inner IP proto is L2GRE
[Release-log]
N/A
Change-Id: I6127480a6c1cd900499aeff9f1112de78c11e73f
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9320486
diff --git a/feed/kernel/crypto-eip/src/xfrm-offload.c b/feed/kernel/crypto-eip/src/xfrm-offload.c
index 56908ac..2d8702d 100644
--- a/feed/kernel/crypto-eip/src/xfrm-offload.c
+++ b/feed/kernel/crypto-eip/src/xfrm-offload.c
@@ -32,10 +32,11 @@
#if IS_ENABLED(CONFIG_NET_MEDIATEK_HNAT)
extern int (*ra_sw_nat_hook_tx)(struct sk_buff *skb, int gmac_no);
-static inline bool is_tops_udp_tunnel(struct sk_buff *skb)
+static inline bool is_tops_tunnel(struct sk_buff *skb)
{
return skb_hnat_tops(skb) && (ntohs(skb->protocol) == ETH_P_IP) &&
- (ip_hdr(skb)->protocol == IPPROTO_UDP);
+ (ip_hdr(skb)->protocol == IPPROTO_UDP ||
+ ip_hdr(skb)->protocol == IPPROTO_GRE);
}
static inline bool is_tcp(struct sk_buff *skb)
@@ -64,7 +65,7 @@
cdesc->desc1.token_len = 48;
cdesc->desc1.p_tr[0] = __pa(xfrm_params->p_tr) | 2;
- cdesc->desc2.hw_srv = 2;
+ cdesc->desc2.hw_srv = 3;
cdesc->desc2.allow_pad = 1;
cdesc->desc2.strip_pad = 1;
@@ -362,7 +363,7 @@
* flow since it may cause network fail due to fragmentation
*/
if (ra_sw_nat_hook_tx &&
- ((is_tops_udp_tunnel(skb) || is_tcp(skb)) && is_hnat_rate_reach(skb)))
+ ((is_tops_tunnel(skb) || is_tcp(skb)) && is_hnat_rate_reach(skb)))
hnat_bind_crypto_entry(skb, dst->dev, fill_inner_info);
/* Set magic tag for tport setting, reset to 0 after tport is set */