On Fri, Oct 21, 2022 at 5:38 AM Mike Pattrick <[email protected]> wrote:
> @@ -530,3 +531,17 @@ dp_packet_compare_offsets(struct dp_packet *b1, struct 
> dp_packet *b2,
>      }
>      return true;
>  }
> +
> +/* Checks if the packet 'p' is compatible with netdev_ol_flags 'flags'
> + * and if not, update the packet with the software fall back. */
> +void
> +dp_packet_ol_send_prepare(struct dp_packet *p, const uint64_t flags)
> +{
> +    if (!(flags & NETDEV_TX_OFFLOAD_IPV4_CKSUM)) {
> +        if (!dp_packet_ip_checksum_good(p) && dp_packet_hwol_tx_ip_csum(p)) {
> +            dp_packet_ip_set_header_csum(p);
> +            dp_packet_ol_set_ip_csum_good(p);
> +        }
> +        dp_packet_hwol_reset_tx_ip_csum(p);
> +    }
> +}

Sorry, I am coming back on this patch.

Asking for hw offloading of ipv4 csum in all cases is fine with hw
nics, since it won't cost much for OVS to ask for it.
But for virtual devices, like vhost, asking for ipv4 csum adds a cost
to OVS processing.

In my PVP setup with patch 4 applied, I lose more than 10% in terms of
pps for (untouched and just fwded) udp packets.
This loss is a conjunction of both ip and udp csum offloading being requested.

We could avoid it for "known to be good" packets.
I suggest the following incremental change:

 void
 dp_packet_ol_send_prepare(struct dp_packet *p, const uint64_t flags)
 {
-    if (!(flags & NETDEV_TX_OFFLOAD_IPV4_CKSUM)) {
-        if (!dp_packet_ip_checksum_good(p) && dp_packet_hwol_tx_ip_csum(p)) {
-            dp_packet_ip_set_header_csum(p);
-            dp_packet_ol_set_ip_csum_good(p);
-        }
+    if (dp_packet_ip_checksum_good(p) || !dp_packet_hwol_tx_ip_csum(p)) {
+        dp_packet_hwol_reset_tx_ip_csum(p);
+    } else if (!(flags & NETDEV_TX_OFFLOAD_IPV4_CKSUM)) {
+        dp_packet_ip_set_header_csum(p);
+        dp_packet_ol_set_ip_csum_good(p);
         dp_packet_hwol_reset_tx_ip_csum(p);
     }


-- 
David Marchand

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to