Re: [RFC net-next 10/15] ipxlat: add 4to6 pre-fragmentation path
From: Xavier HSINYUAN
Date: Mon May 18 2026 - 08:39:06 EST
Hi Ralf,
>+int ipxlat_46_plan_prefrag(struct ipxlat_priv *ipxlat, struct sk_buff *skb)
>+{
>+ unsigned int pkt_len6, pmtu6, threshold6, frag_max_size, pkt_len4,
>+ old_l3_len, new_l3_len;
>+ struct ipxlat_cb *cb = ipxlat_skb_cb(skb);
>+ const struct iphdr *in4 = ip_hdr(skb);
>+ int l3_delta, frag_l3_delta;
>+
>+ if (unlikely(cb->frag_max_size)) {
>+ DEBUG_NET_WARN_ON_ONCE(1);
>+ cb->frag_max_size = 0;
>+ }
>+
>+ pkt_len4 = iph_totlen(skb, in4);
>+ old_l3_len = cb->l3_hdr_len;
>+ new_l3_len = sizeof(struct ipv6hdr) +
>+ (ip_is_fragment(in4) ? sizeof(struct frag_hdr) : 0);
>+ l3_delta = (int)new_l3_len - (int)old_l3_len;
>+ pkt_len6 = pkt_len4 + l3_delta;
>+
>+ pmtu6 = ipxlat_46_lookup_pmtu6(ipxlat, skb, in4);
>+ threshold6 = min(pmtu6, READ_ONCE(ipxlat->lowest_ipv6_mtu));
>+
>+ if (likely(pkt_len6 <= threshold6))
>+ return 0;
>+
>+ /* df packets are never locally pre-fragmented */
>+ if (likely(be16_to_cpu(in4->frag_off) & IP_DF)) {
>+ /* Let the IPv6 forwarding path raise PTB when needed and rely
>+ * on the reverse 6->4 ICMP translation path for feedback.
>+ */
>+ return 0;
>+ }
How about putting the DF check before the PMTU lookup?
ipxlat_46_lookup_pmtu6() requires ip6_route_output() and dst_release(),
but the DF bit is much cheaper to test and is typically set on most
TCP/QUIC packets. It looks like a pure reorder but I have not verified
it carefully.
Best regards,
Xavier