> -----Original Message----- > From: Maxime Coquelin <maxime.coque...@redhat.com> > Sent: Monday, December 21, 2020 5:14 AM > To: dev@dpdk.org; Xia, Chenbo <chenbo....@intel.com>; olivier.m...@6wind.com; > amore...@redhat.com; david.march...@redhat.com > Cc: Maxime Coquelin <maxime.coque...@redhat.com> > Subject: [PATCH 14/40] net/virtio: pack virtio HW struct > > This patch improves the virtio_hw struct packing, > going from 88 down to 80 bytes with a 6 bytes hole in > the end of the first cacheline. Fields only used in the > slow path are placed in the end, so that hot path only > uses the first cacheline. > > Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com> > --- > drivers/net/virtio/virtio_pci.h | 45 ++++++++++++++++----------------- > 1 file changed, 22 insertions(+), 23 deletions(-) > > diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h > index 5629b37050..15f68f141c 100644 > --- a/drivers/net/virtio/virtio_pci.h > +++ b/drivers/net/virtio/virtio_pci.h > @@ -246,26 +246,25 @@ struct virtio_pci_ops { > struct virtio_net_config; > > struct virtio_hw { > - struct virtnet_ctl *cvq; > - uint64_t req_guest_features; > - uint64_t guest_features; > - uint32_t max_queue_pairs; > - bool started; > - uint16_t max_mtu; > - uint16_t vtnet_hdr_size; > - uint8_t vlan_strip; > - uint8_t use_msix; > - uint8_t use_vec_rx; > - uint8_t use_vec_tx; > - uint8_t use_inorder_rx; > - uint8_t use_inorder_tx; > - uint8_t weak_barriers; > - bool has_tx_offload; > - bool has_rx_offload; > - uint16_t port_id; > - uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; > - uint32_t speed; /* link speed in MB */ > - uint8_t duplex; > + struct virtqueue **vqs; > + uint64_t guest_features; > + uint16_t vtnet_hdr_size; > + uint8_t started; > + uint8_t weak_barriers; > + uint8_t vlan_strip; > + uint8_t has_tx_offload; > + uint8_t has_rx_offload; > + uint8_t use_vec_rx; > + uint8_t use_vec_tx; > + uint8_t use_inorder_rx; > + uint8_t use_inorder_tx; > + uint8_t opened; > + uint16_t port_id; > + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; > + uint32_t speed; /* link speed in MB */ > + uint8_t duplex; > + uint8_t use_msix; > + uint16_t max_mtu; > /* > * App management thread and virtio interrupt handler thread > * both can change device state, this lock is meant to avoid > @@ -273,9 +272,9 @@ struct virtio_hw { > */ > rte_spinlock_t state_lock; > struct rte_mbuf **inject_pkts; > - bool opened; > - > - struct virtqueue **vqs; > + uint16_t max_queue_pairs; > + uint64_t req_guest_features; > + struct virtnet_ctl *cvq; > }; > > struct virtio_pci_dev { > -- > 2.29.2
Reviewed-by: Chenbo Xia <chenbo....@intel.com>