diff mbox series

[ovs-dev,v5,12/12] netdev-dpdk: Adjust IPv4 checksum capability for vhost-user.

Message ID 20250603094637.1250238-13-david.marchand@redhat.com
State Superseded
Delegated to: Ilya Maximets
Headers show
Series OVS checksum offloads revamp. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/cirrus-robot success cirrus build: passed
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

David Marchand June 3, 2025, 9:46 a.m. UTC
If no L4 checksum can be requested, OVS may as well compute IPv4
checksum when needed.

This allows a small optimisation where the whole preparation step can be
skipped on a batch when a (vhost-user) DPDK port has no offload
capability.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/netdev-dpdk.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

David Marchand June 4, 2025, 12:01 p.m. UTC | #1
On Tue, Jun 3, 2025 at 11:49 AM David Marchand via dev
<ovs-dev@openvswitch.org> wrote:
>
> If no L4 checksum can be requested, OVS may as well compute IPv4
> checksum when needed.
>
> This allows a small optimisation where the whole preparation step can be
> skipped on a batch when a (vhost-user) DPDK port has no offload
> capability.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

There was some hiccup on a ipsec test.
215: IPsec -- Libreswan NxN geneve tunnels + reconciliation ok

Recheck-request: github-robot
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index b9e5ad9b8f..5dee56be31 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -3303,10 +3303,12 @@  netdev_dpdk_common_send(struct netdev *netdev, struct dp_packet_batch *batch,
     stats->tx_mtu_exceeded_drops += pkt_cnt - cnt;
     pkt_cnt = cnt;
 
-    /* Prepare each mbuf for hardware offloading. */
-    cnt = netdev_dpdk_prep_hwol_batch(dev, pkts, pkt_cnt);
-    stats->tx_invalid_hwol_drops += pkt_cnt - cnt;
-    pkt_cnt = cnt;
+    if (netdev->ol_flags) {
+        /* Prepare each mbuf for hardware offloading. */
+        cnt = netdev_dpdk_prep_hwol_batch(dev, pkts, pkt_cnt);
+        stats->tx_invalid_hwol_drops += pkt_cnt - cnt;
+        pkt_cnt = cnt;
+    }
 
     /* Apply Quality of Service policy. */
     cnt = netdev_dpdk_qos_run(dev, pkts, pkt_cnt, true);
@@ -4910,6 +4912,10 @@  new_device(int vid)
                     dev->hw_ol_features |= NETDEV_TX_TCP_CKSUM_OFFLOAD;
                     dev->hw_ol_features |= NETDEV_TX_UDP_CKSUM_OFFLOAD;
                     dev->hw_ol_features |= NETDEV_TX_SCTP_CKSUM_OFFLOAD;
+
+                    /* There is no support in virtio net to offload IPv4 csum,
+                     * but the vhost library handles IPv4 csum offloading. */
+                    dev->hw_ol_features |= NETDEV_TX_IPV4_CKSUM_OFFLOAD;
                 }
 
                 if (userspace_tso_enabled()
@@ -4928,10 +4934,6 @@  new_device(int vid)
                 }
             }
 
-            /* There is no support in virtio net to offload IPv4 csum,
-             * but the vhost library handles IPv4 csum offloading fine. */
-            dev->hw_ol_features |= NETDEV_TX_IPV4_CKSUM_OFFLOAD;
-
             netdev_dpdk_update_netdev_flags(dev);
 
             ovsrcu_index_set(&dev->vid, vid);