net/virtio: allocate fake mbuf in Rx queue
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 16 Mar 2021 09:38:24 +0000 (10:38 +0100)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 31 Mar 2021 05:31:41 +0000 (07:31 +0200)
commitb59d4d5502dcb1b57be81eb21b5e8bcb80de49e7
tree53a9583773948631106c6dc4fe59ce82c8cc05ba
parent76fd789cc7dddbaa2c08065b7c3ca915b5c07e7c
net/virtio: allocate fake mbuf in Rx queue

While it is worth clarifying whether the fake mbuf
in virtnet_rx struct is really necessary, it is sure
that it heavily impacts cache usage by being part of
the struct. Indeed, it uses two cachelines, and
requires alignment on a cacheline.

Before this series, it means it took 120 bytes in
virtnet_rx struct:

struct virtnet_rx {
 struct virtqueue *vq; /*0 8*/

 /* XXX 56 bytes hole, try to pack */

 /* --- cacheline 1 boundary (64 bytes) --- */
 struct rte_mbuf fake_mbuf __attribute__((__aligned__(64))); /*64 128*/
 /* --- cacheline 3 boundary (192 bytes) --- */

This patch allocates it using malloc in order to optimize
virtnet_rx cache usage and so virtqueue cache usage.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Tested-by: Balazs Nemeth <bnemeth@redhat.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_rxtx.h