[Openvpn-devel,RFC,net-next,7/9] ovpn: prefetch GSO segments before in-place encryption

Message ID 382879c187b1acca65198c467d1263266243ea50.1789485693.git.ralf@mandelbit.com
State Superseded
Headers
Series ovpn: preserve GSO and GRO batching |

Commit Message

Ralf Lici Sept. 15, 2026, 3:23 p.m. UTC
  Software segmentation exposes the complete skb list before encryption
begins. While encrypting each segment, request write ownership of the
next linear segment cache line by cache line. A single skb naturally
skips the prefetch path.

Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
 drivers/net/ovpn/io.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c
index 11f7f16d7b79..cb7503a3e79c 100644
--- a/drivers/net/ovpn/io.c
+++ b/drivers/net/ovpn/io.c
@@ -472,6 +472,12 @@  static void ovpn_send(struct ovpn_priv *ovpn, struct sk_buff *skb,
 	 * independently
 	 */
 	skb_list_walk_safe(skb, curr, next) {
+		/* encrypting this segment can hide the cost of fetching the
+		 * next segment's data into the cache
+		 */
+		if (next)
+			ovpn_skb_prefetchw(next);
+
 		if (unlikely(!ovpn_encrypt_one(peer, curr))) {
 			ovpn_dev_dstats_tx_dropped(ovpn->dev, 1);
 			kfree_skb(curr);