2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

netdev-dpdk: Adjust IPv4 checksum capability for vhost-user.

If no L4 checksum can be requested, OVS may as well compute IPv4
checksum when needed.

This allows a small optimization 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>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
David Marchand 2025-06-17 09:21:03 +02:00 committed by Ilya Maximets
parent dd443c1a7a
commit ab062d3cb4

View File

@ -3303,10 +3303,12 @@ netdev_dpdk_common_send(struct netdev *netdev, struct dp_packet_batch *batch,
stats->tx_mtu_exceeded_drops += pkt_cnt - cnt; stats->tx_mtu_exceeded_drops += pkt_cnt - cnt;
pkt_cnt = cnt; pkt_cnt = cnt;
/* Prepare each mbuf for hardware offloading. */ if (netdev->ol_flags) {
cnt = netdev_dpdk_prep_hwol_batch(dev, pkts, pkt_cnt); /* Prepare each mbuf for hardware offloading. */
stats->tx_invalid_hwol_drops += pkt_cnt - cnt; cnt = netdev_dpdk_prep_hwol_batch(dev, pkts, pkt_cnt);
pkt_cnt = cnt; stats->tx_invalid_hwol_drops += pkt_cnt - cnt;
pkt_cnt = cnt;
}
/* Apply Quality of Service policy. */ /* Apply Quality of Service policy. */
cnt = netdev_dpdk_qos_run(dev, pkts, pkt_cnt, true); 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_TCP_CKSUM_OFFLOAD;
dev->hw_ol_features |= NETDEV_TX_UDP_CKSUM_OFFLOAD; dev->hw_ol_features |= NETDEV_TX_UDP_CKSUM_OFFLOAD;
dev->hw_ol_features |= NETDEV_TX_SCTP_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() 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); netdev_dpdk_update_netdev_flags(dev);
ovsrcu_index_set(&dev->vid, vid); ovsrcu_index_set(&dev->vid, vid);