ovpn retains the inner socket on encrypted UDP skbs so that write accounting and TCP Small Queues remain correct. netdev_pick_tx, however, interprets that socket as the transmitted flow and spreads one outer OpenVPN channel across hardware queues according to the inner socket's cached queue, XPS and the producing CPU. Packets of one packet-ID sequence then race through different queues, and the resulting reordering can exceed the receiver's replay window.
Clear the inner-flow hash and request hash-based queue selection in the UDP output path, so that the lower device hashes the completed outer tuple while skb->sk and its destructor keep describing the inner owner. Clear the policy again after decapsulation. With one peer between two directly connected mlx5 ports and four or eight inner TCP flows sent from different CPUs, the outer flow used five to nine TX queues and the receiver rejected 2000 to 4800 packets per 20-second run whose packet IDs had fallen behind the replay window. With this change, all of them used a single TX queue and no packet was rejected. Signed-off-by: Ralf Lici <[email protected]> --- drivers/net/ovpn/io.c | 1 + drivers/net/ovpn/udp.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c index f14eb4e6c46a..e09a27969fce 100644 --- a/drivers/net/ovpn/io.c +++ b/drivers/net/ovpn/io.c @@ -76,6 +76,7 @@ static void ovpn_netdev_write(struct ovpn_peer *peer, struct sk_buff *skb) /* skb hash for transport packet no longer valid after decapsulation */ skb_clear_hash(skb); + skb_clear_tx_queue_from_hash(skb); /* post-decrypt scrub -- prepare to inject encapsulated packet onto the * interface, based on __skb_tunnel_rx() in dst.h diff --git a/drivers/net/ovpn/udp.c b/drivers/net/ovpn/udp.c index 055cdb1bee13..892b33edaf8c 100644 --- a/drivers/net/ovpn/udp.c +++ b/drivers/net/ovpn/udp.c @@ -467,6 +467,11 @@ void ovpn_udp_send_skb(struct ovpn_peer *peer, struct sock *sk, skb->dev = peer->ovpn->dev; skb->mark = key.mark; + /* select the physical queue from the completed outer flow while + * skb->sk remains the inner socket for write accounting and TSQ + */ + skb_clear_hash(skb); + skb_set_tx_queue_from_hash(skb); /* no checksum performed at this layer */ skb->ip_summed = CHECKSUM_NONE; -- 2.56.0 _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
