Re: [RFC net-next 10/15] ipxlat: add 4to6 pre-fragmentation path

From: Ralf Lici

Date: Fri Jun 05 2026 - 08:36:58 EST


On Mon, 18 May 2026 20:36:25 +0800, Xavier HSINYUAN <XavierHsinyuan@xxxxxxxxxxx> wrote:
> Hi Ralf,
>

Hi Xavier,

Sorry for the slow reply. This got buried while I was busy with other
kernel work.

> >+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.
>

Yes, that looks right to me. The PMTU lookup is only needed for the
non-DF path, where we may actually compute a pre-fragmentation cap. For
DF packets ipxlat_46_plan_prefrag should leave frag_max_size unset and
let the later IPv6 output path generate PTB if the translated packet is
too large.

I'll move the DF check before ipxlat_46_lookup_pmtu6, after the stale
frag_max_size clearing.

Thanks!

--
Ralf Lici
Mandelbit Srl