On Wed, Mar 27, 2024 at 5:51 PM David Marchand
<david.march...@redhat.com> wrote:
>      /* If packet is vxlan or geneve tunnel packet, calculate outer
>       * l2 len and outer l3 len. Inner l2/l3/l4 len are calculated
>       * before. */
> -    const uint64_t tunnel_type = mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK;
> -    if (tunnel_type == RTE_MBUF_F_TX_TUNNEL_GENEVE ||
> -        tunnel_type == RTE_MBUF_F_TX_TUNNEL_VXLAN) {
> +    if ((tunnel_type == RTE_MBUF_F_TX_TUNNEL_GENEVE ||
> +         tunnel_type == RTE_MBUF_F_TX_TUNNEL_VXLAN) &&
> +        mbuf->ol_flags & all_inner_requests) {
> +
>          mbuf->outer_l2_len = (char *) dp_packet_l3(pkt) -
>                   (char *) dp_packet_eth(pkt);
>          mbuf->outer_l3_len = (char *) dp_packet_l4(pkt) -
>                   (char *) dp_packet_l3(pkt);
> +    } else {
> +        if (OVS_UNLIKELY(!(mbuf->ol_flags & all_inner_requests))) {
> +            /* If no inner offloading is requesting, fallback to non 
> tunneling
> +             * checksum offloads. */

Inner marks must be reset before converting outer marks.

Otherwise, this results (with IPv4 traffic encapsulated in IPv6 geneve
tunnel) in such a ol_flags combination:
RTE_MBUF_F_RX_RSS_HASH
RTE_MBUF_F_TX_UDP_CKSUM
RTE_MBUF_F_TX_IP_CKSUM
RTE_MBUF_F_TX_IPV4
RTE_MBUF_F_TX_IPV6

v2 in preparation.


>
> -        /* If neither inner checksums nor TSO is requested, inner marks
> -         * should not be set. */
> -        if (!(mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM |
> -                                RTE_MBUF_F_TX_L4_MASK  |
> -                                RTE_MBUF_F_TX_TCP_SEG))) {
> -            mbuf->ol_flags &= ~(RTE_MBUF_F_TX_IPV4 |
> -                                RTE_MBUF_F_TX_IPV6);
> +            if (mbuf->ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) {
> +                mbuf->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
> +                mbuf->ol_flags |= RTE_MBUF_F_TX_IPV4;
> +            }
> +            if (mbuf->ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM) {
> +                mbuf->ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM;
> +                mbuf->ol_flags |= (mbuf->ol_flags & 
> RTE_MBUF_F_TX_OUTER_IPV4) ?
> +                                  RTE_MBUF_F_TX_IPV4 : RTE_MBUF_F_TX_IPV6;
> +            }
> +            mbuf->ol_flags &= ~(all_outer_requests | all_outer_marks);


-- 
David Marchand

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to