[dpdk-dev] [PATCH 3/3] vhost: arrange virtio_net fields for better cache sharing

2016-06-01 Thread Xie, Huawei
On 5/3/2016 8:42 AM, Yuanhan Liu wrote:
> the ifname[] field takes so much space, that it seperate some frequently
> used fields into different caches, say, features and broadcast_rarp.
>
> This patch move all those fields that will be accessed frequently in Rx/Tx
> together (before the ifname[] field) to let them share one cache line.
>
> Signed-off-by: Yuanhan Liu 

Acked-by: Huawei Xie 



[dpdk-dev] [PATCH 3/3] vhost: arrange virtio_net fields for better cache sharing

2016-05-02 Thread Yuanhan Liu
the ifname[] field takes so much space, that it seperate some frequently
used fields into different caches, say, features and broadcast_rarp.

This patch move all those fields that will be accessed frequently in Rx/Tx
together (before the ifname[] field) to let them share one cache line.

Signed-off-by: Yuanhan Liu 
---
 lib/librte_vhost/vhost-net.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_vhost/vhost-net.h b/lib/librte_vhost/vhost-net.h
index 9dec83c..3b0ffe7 100644
--- a/lib/librte_vhost/vhost-net.h
+++ b/lib/librte_vhost/vhost-net.h
@@ -123,16 +123,16 @@ struct virtio_net {
int vid;
uint32_tflags;
uint16_tvhost_hlen;
+   /* to tell if we need broadcast rarp packet */
+   rte_atomic16_t  broadcast_rarp;
+   uint32_tvirt_qp_nb;
+   struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
charifname[IF_NAME_SZ];
-   uint32_tvirt_qp_nb;
uint64_tlog_size;
uint64_tlog_base;
struct ether_addr   mac;

-   /* to tell if we need broadcast rarp packet */
-   rte_atomic16_t  broadcast_rarp;
-   struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
 } __rte_cache_aligned;

 /**
-- 
1.9.0