[Openvpn-devel,net-next,4/4] ovpn: hash the outer flow from its flowi

Message ID 148b9524e5fcbbe18a18368ba6a2abe3904b4d24.1794922487.git.ralf@mandelbit.com
State New
Headers
Series ovpn: select physical TX queues from the outer flow |

Commit Message

Ralf Lici Nov. 17, 2026, 2:11 p.m. UTC
  Selecting the physical TX queue from the packet hash makes
netdev_pick_tx dissect every outer packet, although ovpn already holds
the outer flow in the flowi it routes with. On IPv6, the stack derives
the hash from that flowi only when it generates an automatic flow
label.

Set the hash from the outer flowi in both output paths, so that queue
selection depends neither on dissecting the packet nor on automatic
flow labels.

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

Patch

diff --git a/drivers/net/ovpn/udp.c b/drivers/net/ovpn/udp.c
index 892b33edaf8c..f9741fd86c20 100644
--- a/drivers/net/ovpn/udp.c
+++ b/drivers/net/ovpn/udp.c
@@ -288,6 +288,8 @@  static int ovpn_udp4_output(struct ovpn_peer *peer, struct ovpn_bind *bind,
 	spin_unlock_bh(&peer->lock);
 
 transmit:
+	/* hash the outer flow for queue selection without dissecting it */
+	skb_get_hash_flowi4(skb, &fl);
 	udp_tunnel_xmit_skb(rt, sk, skb, fl.saddr, fl.daddr, 0,
 			    ip4_dst_hoplimit(&rt->dst), 0, fl.fl4_sport,
 			    fl.fl4_dport, false, sk->sk_no_check_tx, 0);
@@ -388,6 +390,8 @@  static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind,
 	 * udp_tunnel_xmit_skb()
 	 */
 	skb->ignore_df = 1;
+	/* hash the outer flow for queue selection without dissecting it */
+	skb_get_hash_flowi6(skb, &fl);
 	udp_tunnel6_xmit_skb(dst, sk, skb, skb->dev, &fl.saddr, &fl.daddr, 0,
 			     ip6_dst_hoplimit(dst), 0, fl.fl6_sport,
 			     fl.fl6_dport, udp_get_no_check6_tx(sk), 0);