diff options
| author | Qiuwen Lu <[email protected]> | 2017-03-29 12:47:05 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2017-03-29 12:47:05 +0800 |
| commit | 0e25a38782e49d0fabf2ab2c374ba5be2cbc28ae (patch) | |
| tree | 2e3021b49e6af8b464ff30d66d5ac1da7561bff6 | |
| parent | 66017e83cfa431f3eee8ab8da22c35b05154292b (diff) | |
性能优化,修改了VNODE入队列的实现,循环展开。调整APP入队列哈希操作等。
| -rw-r--r-- | app/src/marsio.c | 1 | ||||
| -rw-r--r-- | app/src/rawio.c | 2 | ||||
| -rw-r--r-- | examples/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | examples/rxonly.c | 2 | ||||
| -rw-r--r-- | include/internal/mr_config.h.in | 11 | ||||
| -rw-r--r-- | infra/src/vnode_mirror.c | 41 |
6 files changed, 52 insertions, 8 deletions
diff --git a/app/src/marsio.c b/app/src/marsio.c index 7221d03..8ed226e 100644 --- a/app/src/marsio.c +++ b/app/src/marsio.c @@ -353,6 +353,7 @@ int marsio_thread_init(struct mr_instance * instance) thread_info.instance = instance; thread_info.cpu_id = cpu_id; thread_info.thread_id = instance->to_suppose_tid++; + RTE_PER_LCORE(_lcore_id) = cpu_id; ret = RT_SUCCESS; goto out; diff --git a/app/src/rawio.c b/app/src/rawio.c index 0432241..d9a3f87 100644 --- a/app/src/rawio.c +++ b/app/src/rawio.c @@ -64,7 +64,7 @@ int marsio_send_burst(struct mr_sendpath * sendpath, queue_id_t sid, marsio_buff /* 计算哈希,目前全部按SID填 */ hash_t hash[MR_BURST_MAX]; - for (int i = 0; i < nr_mbufs; i++) hash[i] = sid; + for (int i = 0; i < nr_mbufs; i++) hash[i] = __mbufs[i]->hash.usr; vnode_mirror_enqueue_bulk(sendpath->target_vdi->vnode_tx_prod, sid, __mbufs, hash, nr_mbufs); return RT_SUCCESS; diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a9e81f7..311215c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,5 +9,8 @@ target_link_libraries(mrtest-l2fwd marsio pthread) add_executable(mrtest-fb feedback.c) target_link_libraries(mrtest-fb marsio pthread) +add_executable(mrtest-rxonly rxonly.c) +target_link_libraries(mrtest-rxonly marsio pthread) + #add_executable(pag_rx_sample pag/rx_sample.c) #target_link_libraries(pag_rx_sample pag)
\ No newline at end of file diff --git a/examples/rxonly.c b/examples/rxonly.c index 9bd2f9c..633cbc4 100644 --- a/examples/rxonly.c +++ b/examples/rxonly.c @@ -29,7 +29,7 @@ void * rxonly_loop(void * arg) for (;;) { ret = marsio_recv_burst(dev_handler, sid, rx_buff, nr_burst); - marsio_buff_free(dev_handler, rx_buff, nr_burst); + marsio_buff_free(dev_handler, rx_buff, ret); } return (void *)NULL; diff --git a/include/internal/mr_config.h.in b/include/internal/mr_config.h.in index 009cf7b..9c5b954 100644 --- a/include/internal/mr_config.h.in +++ b/include/internal/mr_config.h.in @@ -1,6 +1,7 @@ -#pragma once
+#pragma once
-#cmakedefine MR_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
-#cmakedefine MR_GLOBAL_CONFFILE "@MR_GLOBAL_CONFFILE@"
-#cmakedefine MR_LOCAL_CONFFILE "@MR_LOCAL_CONFFILE@"
-#cmakedefine PAG_LOCAL_CONFFILE "@PAG_LOCAL_CONFFILE@"
\ No newline at end of file +#cmakedefine MR_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
+#cmakedefine MR_GLOBAL_CONFFILE "@MR_GLOBAL_CONFFILE@"
+#cmakedefine MR_LOCAL_CONFFILE "@MR_LOCAL_CONFFILE@"
+#cmakedefine PAG_LOCAL_CONFFILE "@PAG_LOCAL_CONFFILE@" +#cmakedefine MR_VNODE_MIRROR_BY_REFCNT "@MR_VNODE_MIRROR_BY_REFCNT@"
\ No newline at end of file diff --git a/infra/src/vnode_mirror.c b/infra/src/vnode_mirror.c index 23efe1c..108b23e 100644 --- a/infra/src/vnode_mirror.c +++ b/infra/src/vnode_mirror.c @@ -71,7 +71,7 @@ static inline int dist_tunnel_dequeue(struct tunnel_desc * desc, void * obj, int static inline void dist_tunnel_enqueue_without_buffer(struct tunnel_desc * desc, void * obj) { assert(desc->en_buffer == NULL && desc->sz_en_buffer == 0); - int ret = rte_ring_enqueue_burst(desc->tunnel_object, &obj, 1); + int ret = rte_ring_sp_enqueue_burst(desc->tunnel_object, &obj, 1); if (unlikely(ret != 1)) rte_pktmbuf_free(obj); return; } @@ -80,6 +80,7 @@ static inline void dist_tunnel_enqueue_without_buffer(struct tunnel_desc * desc, // only use by prod. // TODO: rewrite in SSE/SSE2/AVX/AVX2 intrinsics +#if 0 static inline void dist_tunnel_block_enqueue_with_hash(struct tunnel_block * block, int prodq, struct rte_mbuf * obj[], uint32_t hash[], int nr_obj) { @@ -94,6 +95,44 @@ static inline void dist_tunnel_block_enqueue_with_hash(struct tunnel_block * blo } } +#endif + +#define __FWDSTEP 4 + +static inline void dist_tunnel_block_enqueue_with_hash(struct tunnel_block * block, + int prodq, struct rte_mbuf * obj[], uint32_t hash[], int nr_obj) +{ + struct tunnel_desc * tunnel; + unsigned int idx = 0; + unsigned int consq; + + switch (nr_obj % 4) + { + case 0: + while (idx != nr_obj) { + consq = hash[idx] % block->nr_consq; + tunnel = *tunnel_block_locate(block, prodq, consq); + dist_tunnel_enqueue(block->prod, block->cons, prodq, consq, tunnel, obj[idx]); + idx++; + case 3: + consq = hash[idx] % block->nr_consq; + tunnel = *tunnel_block_locate(block, prodq, consq); + dist_tunnel_enqueue(block->prod, block->cons, prodq, consq, tunnel, obj[idx]); + idx++; + case 2: + consq = hash[idx] % block->nr_consq; + tunnel = *tunnel_block_locate(block, prodq, consq); + dist_tunnel_enqueue(block->prod, block->cons, prodq, consq, tunnel, obj[idx]); + idx++; + case 1: + consq = hash[idx] % block->nr_consq; + tunnel = *tunnel_block_locate(block, prodq, consq); + dist_tunnel_enqueue(block->prod, block->cons, prodq, consq, tunnel, obj[idx]); + idx++; + } + } +} + // Tunnel Block Dequeue, dequeue from block, only used by cons. // TODO: rewrite in SSE/SSE2/AVX/AVX2 intrinsics |
