On Thu, 8 Oct 2026 at 15:36, Eelco Chaudron <[email protected]> wrote:
> On 29 Sep 2026, at 10:34, 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.
> >
> > Signed-off-by: David Marchand <[email protected]>
>
> Hi David,
>
> See some comments below, mainly on padded cache line usage (waste).
> But in general the patch looks good to me.
>
> //Eelco
>
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>
> [...]
>
> > +struct netdev_dpdk_eth {
> > + PADDED_MEMBERS(CACHE_LINE_SIZE,
> > dpdk_port_t port_id;
>
> Wrapping a single dpdk_port_t in PADDED_MEMBERS creates
> 62 bytes of padding. Could port_id move down into the
> non-padded section of the struct?
Yes, as I mentioned in the cover letter, this topic is one hole (pun
intended) in the last patch.
I did not want to optimise the layout in the RFC series initially.
I spent some time on the topic and it seems promising.
I moved all the "hot" fields at the start of the specialised types,
and same in the common type.
Then I filled the "hot" cache lines with control path fields that do
not change (unless a reconfiguration event happens).
The rest of the structures then have all other cp fields with no
explicit padding/alignments.
It saves us some memory and also improves the number of cache lines
accesses in the datapath code.
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
After split:
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)
--
David Marchand
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev