[][openwrt][mt7988][crypto][Refactor xfrm packet mode path]
[Description]
Refactor xfrm packet mode path.
In previous version, for hw offloadable packets, we still use sw path to
encrypt/encap packets. After this commit, if a packet is offloadable,
crypto driver will send packet to tx. We don't need to go through rest
xfrm flow, so return directly.
[Release-log]
N/A
Change-Id: I51c0738a5fa7fcd3a775ab4d0086dc8646c991c3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8135674
diff --git a/target/linux/mediatek/patches-5.4/999-2728-xfrm-extend-packet-mode-to-support-esp-tunnel-mode.patch b/target/linux/mediatek/patches-5.4/999-2728-xfrm-extend-packet-mode-to-support-esp-tunnel-mode.patch
index ba9bc98..d41c0f3 100644
--- a/target/linux/mediatek/patches-5.4/999-2728-xfrm-extend-packet-mode-to-support-esp-tunnel-mode.patch
+++ b/target/linux/mediatek/patches-5.4/999-2728-xfrm-extend-packet-mode-to-support-esp-tunnel-mode.patch
@@ -9,20 +9,27 @@
goto resume;
do {
-@@ -568,16 +568,6 @@ int xfrm_output(struct sock *sk, struct
- struct xfrm_state *x = skb_dst(skb)->xfrm;
- int err;
+@@ -570,12 +570,10 @@ int xfrm_output(struct sock *sk, struct
-- if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET) {
-- if (!xfrm_dev_offload_ok(skb, x)) {
+ if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET) {
+ if (!xfrm_dev_offload_ok(skb, x)) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
- kfree_skb(skb);
- return -EHOSTUNREACH;
-- }
++ secpath_reset(skb);
++ goto sw_path;
+ }
-
- return xfrm_output_resume(skb, 0);
-- }
--
- secpath_reset(skb);
++ return 0;
+ }
- if (xfrm_dev_offload_ok(skb, x)) {
+ secpath_reset(skb);
+@@ -606,6 +604,7 @@ int xfrm_output(struct sock *sk, struct
+ if (x->xso.dev && x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)
+ goto out;
+ } else {
++sw_path:
+ if (skb_is_gso(skb))
+ return xfrm_output_gso(net, sk, skb);
+ }