On 3 Nov 2026, at 13:01, David Marchand wrote:
> Split the monolithic struct netdev_dpdk into three structures:
> - netdev_dpdk_common: fields shared between eth and vhost
> - netdev_dpdk_eth: ethernet specific fields
> - netdev_dpdk_vhost: vhost specific fields
>
> Each type specific struct embeds netdev_dpdk_common. The mutex and
> list_node move to the per type structs since they are only relevant
> to one type.
>
> This opens an opportunity to optimise those structures layout.
>
> The tl;dr looks like:
>
> Before split:
> netdev_dpdk 896 bytes 14 cache lines
>
> After split:
> netdev_dpdk_eth 824 bytes 13 cache lines
> netdev_dpdk_vhost 736 bytes 12 cache lines
>
> The details.
>
> Before the change, cache line uses for datapath (R = read, W = write):
>
> Eth Rx: 2 cache lines (2R)
> CL0: flags (R)
> CL4: ingress_policer (R)
>
> Eth Tx: 6 cache lines (4R + 2W)
> CL0: port_id, max_packet_len, flags, tx_q (R)
> CL1: dpdk_mp (R)
> CL2: up.ol_flags (R)
> CL4: qos_conf (R)
> CL5: stats counters (W)
> CL10: stats_lock (W), sw_stats ptr (R)
>
> Vhost Rx: 3 cache lines (3R)
> CL0: flags (R)
> CL1: vid, vhost_reconfigured, dpdk_mp (R)
> CL4: ingress_policer, vhost_rxq_enabled (R)
>
> Vhost Tx: 6 cache lines (4R + 2W)
> CL0: max_packet_len, flags, tx_q (R)
> CL1: dpdk_mp, vid, vhost_reconfigured,
> vhost_tx_retries_max (R)
> CL2: up.ol_flags (R)
> CL4: qos_conf (R)
> CL5: stats counters (W)
> CL10: stats_lock (W), sw_stats ptr (R)
>
> In all paths, read Rx fields (ingress_policer) and read Tx fields
> (qos_conf, tx_q) can share the common hot cache line since all accesses
> are reads and no false sharing occurs.
>
> Control path only fields (mtu, socket_id, queue sizes, boolean flags,
> etc...) can be packed into the padding of datapath blocks.
> These fields only change on datapath reconfiguration events and
> are never accessed in the data path.
>
> The embedded netdev structure does not need to be marked as cache line
> aligned, since it is already cache aligned by the preceding stats block,
> and nothing after it requires isolation from datapath fields.
>
> vhost_rxq_enabled can move into the vid hot cache line because it is
> accessed in the Rx data path alongside vid and vhost_reconfigured.
>
> Which ends up after splitting and packing as:
>
> Eth Rx: 1 cache line (1R) (saved 1 cache line)
> CL1: flags, ingress_policer (R)
>
> Eth Tx: 5 cache lines (3R + 2W) (saved 1 cache line)
> CL0: port_id (R)
> CL1: max_packet_len, flags, tx_q, dpdk_mp, qos_conf (R)
> CL2: stats counters (W)
> CL7: stats_lock (W), sw_stats ptr (R)
> CL8: up.ol_flags (R)
>
> Vhost Rx: 2 cache lines (2R) (saved 1 cache line)
> CL0: vid, vhost_reconfigured, vhost_rxq_enabled (R)
> CL1: flags, dpdk_mp, ingress_policer (R)
>
> Vhost Tx: 5 cache lines (3R + 2W) (saved 1 cache line)
> CL0: vid, vhost_reconfigured, vhost_tx_retries_max (R)
> CL1: max_packet_len, flags, tx_q, dpdk_mp, qos_conf (R)
> CL2: stats counters (W)
> CL7: stats_lock (W), sw_stats ptr (R)
> CL8: up.ol_flags (R)
>
> Signed-off-by: David Marchand <[email protected]>
Thanks David for the series, it looks good to me. I did some basic
performance testing in my PVP setup and saw no regressions.
Please go ahead with a non-RFC version of this patch.
Cheers,
Eelco
Acked-by: Eelco Chaudron <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev