X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fdistributor%2Fmain.c;h=0266d95b6f24b8b06fe057cdaa3b8cdf5ac93113;hb=39c722626590632411252114beb5359548031775;hp=13fb04d679d3573c6abd8f73206d81b30196daf5;hpb=b12964f621dcb9bc0f71975c9ab2b5c9b58eed39;p=dpdk.git diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 13fb04d679..0266d95b6f 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -42,29 +42,16 @@ #include #include #include +#include #include #define RX_RING_SIZE 256 #define TX_RING_SIZE 512 #define NUM_MBUFS ((64*1024)-1) -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 #define RTE_RING_SZ 1024 -/* uncommnet below line to enable debug logs */ -/* #define DEBUG */ - -#ifdef DEBUG -#define LOG_LEVEL RTE_LOG_DEBUG -#define LOG_DEBUG(log_type, fmt, args...) do { \ - RTE_LOG(DEBUG, log_type, fmt, ##args) \ -} while (0) -#else -#define LOG_LEVEL RTE_LOG_INFO -#define LOG_DEBUG(log_type, fmt, args...) do {} while (0) -#endif - #define RTE_LOGTYPE_DISTRAPP RTE_LOGTYPE_USER1 /* mask of enabled ports */ @@ -240,7 +227,8 @@ lcore_rx(struct lcore_params *p) uint16_t sent = rte_ring_enqueue_burst(r, (void *)bufs, nb_ret); app_stats.rx.enqueued_pkts += sent; if (unlikely(sent < nb_ret)) { - LOG_DEBUG(DISTRAPP, "%s:Packet loss due to full ring\n", __func__); + RTE_LOG(DEBUG, DISTRAPP, + "%s:Packet loss due to full ring\n", __func__); while (sent < nb_ret) rte_pktmbuf_free(bufs[sent++]); } @@ -271,7 +259,8 @@ flush_one_port(struct output_buffer *outbuf, uint8_t outp) app_stats.tx.tx_pkts += nb_tx; if (unlikely(nb_tx < outbuf->count)) { - LOG_DEBUG(DISTRAPP, "%s:Packet loss with tx_burst\n", __func__); + RTE_LOG(DEBUG, DISTRAPP, + "%s:Packet loss with tx_burst\n", __func__); do { rte_pktmbuf_free(outbuf->mbufs[nb_tx]); } while (++nb_tx < outbuf->count); @@ -336,13 +325,13 @@ lcore_tx(struct rte_ring *in_r) /* for traffic we receive, queue it up for transmit */ uint16_t i; - _mm_prefetch(bufs[0], 0); - _mm_prefetch(bufs[1], 0); - _mm_prefetch(bufs[2], 0); + rte_prefetch_non_temporal((void *)bufs[0]); + rte_prefetch_non_temporal((void *)bufs[1]); + rte_prefetch_non_temporal((void *)bufs[2]); for (i = 0; i < nb_rx; i++) { struct output_buffer *outbuf; uint8_t outp; - _mm_prefetch(bufs[i + 3], 0); + rte_prefetch_non_temporal((void *)bufs[i + 3]); /* * workers should update in_port to hold the * output port value @@ -528,12 +517,9 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error: number of ports must be even, except " "when using a single port\n"); - mbuf_pool = rte_mempool_create("MBUF_POOL", NUM_MBUFS * nb_ports, - MBUF_SIZE, MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", + NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); nb_ports_available = nb_ports;