From: Bruce Richardson Date: Tue, 11 Feb 2014 15:35:19 +0000 (+0000) Subject: examples: minor changes X-Git-Tag: spdx-start~11000 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=13c4ebd65a77fae2d6c5a08a2a2f3498758b68d2;p=dpdk.git examples: minor changes A series of minor changes to example applications included in the Intel DPDK 1.6 release. * changes to NIC configuration flags, e.g. specifying RSS * replacing local "DIM" macro with common "RTE_DIM" macro * minor whitespace changes for alignment. Signed-off-by: Bruce Richardson --- diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index 19b3adf1af..cdf683228c 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -159,6 +159,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ .hw_ip_checksum = 1, /**< IP checksum offload enabled */ diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index f8e14fb7e1..4880a5f595 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -223,7 +223,8 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .mq_mode = ETH_MQ_RX_RSS, + .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ .hw_ip_checksum = 1, /**< IP checksum offload enabled */ diff --git a/examples/kni/main.c b/examples/kni/main.c index af59758ee2..274990b319 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -243,8 +243,8 @@ signal_handler(int signum) return; } - /* When we receive a RTMIN signal, stop kni processing */ - if (signum == SIGRTMIN) { + /* When we receive a RTMIN or SIGINT signal, stop kni processing */ + if (signum == SIGRTMIN || signum == SIGINT){ printf("SIGRTMIN is received, and the KNI processing is " "going to stop\n"); rte_atomic32_inc(&kni_stop); @@ -864,6 +864,7 @@ main(int argc, char** argv) signal(SIGUSR1, signal_handler); signal(SIGUSR2, signal_handler); signal(SIGRTMIN, signal_handler); + signal(SIGINT, signal_handler); /* Initialise EAL */ ret = rte_eal_init(argc, argv); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 65017bc64c..2d94366613 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -163,6 +163,11 @@ static const struct rte_eth_txconf tx_conf = { }, .tx_free_thresh = 0, /* Use PMD default values */ .tx_rs_thresh = 0, /* Use PMD default values */ + /* + * As the example won't handle mult-segments and offload cases, + * set the flag by default. + */ + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, }; struct rte_mempool * l2fwd_pktmbuf_pool = NULL; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 3215631a2e..219f802cd1 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -235,6 +235,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 199424eea6..fb811fad33 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -195,6 +195,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 50939c3157..1ba4ca2d3c 100755 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -215,6 +215,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ @@ -1505,6 +1506,7 @@ populate_ipv4_many_flow_into_table(const struct rte_hash* h, uint8_t b = (uint8_t) (((i/NUMBER_PORT_USED)/BYTE_VALUE_MAX)%BYTE_VALUE_MAX); uint8_t c = (uint8_t) ((i/NUMBER_PORT_USED)/(BYTE_VALUE_MAX*BYTE_VALUE_MAX)); /* Create the ipv4 exact match flow */ + memset(&entry, 0, sizeof(entry)); switch (i & (NUMBER_PORT_USED -1)) { case 0: entry = ipv4_l3fwd_route_array[0]; @@ -1548,6 +1550,7 @@ populate_ipv6_many_flow_into_table(const struct rte_hash* h, uint8_t b = (uint8_t) (((i/NUMBER_PORT_USED)/BYTE_VALUE_MAX)%BYTE_VALUE_MAX); uint8_t c = (uint8_t) ((i/NUMBER_PORT_USED)/(BYTE_VALUE_MAX*BYTE_VALUE_MAX)); /* Create the ipv6 exact match flow */ + memset(&entry, 0, sizeof(entry)); switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv6_l3fwd_route_array[0]; break; case 1: entry = ipv6_l3fwd_route_array[1]; break; diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 5b225c7b4e..6a2f21853c 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -76,6 +76,7 @@ static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ .hw_ip_checksum = 1, /**< IP checksum offload enabled */ diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 69126185c8..12fa28d6a2 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -240,7 +240,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) { struct rte_eth_conf port_conf = { .rxmode = { - .mq_mode = ETH_MQ_RX_RSS, + .mq_mode = ETH_MQ_RX_RSS, .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ .hw_ip_checksum = 1, /**< IP checksum offload enabled */ @@ -284,7 +284,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) } for (q = 0; q < tx_rings; q ++) { - retval = rte_eth_tx_queue_setup(port, q, RX_RING_SIZE, + retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, rte_eth_dev_socket_id(port), &tx_conf_default); if (retval < 0) return retval; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index f5df448652..bc767034c2 100755 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -82,6 +82,7 @@ static struct rte_mempool *pool = NULL; ***/ static struct rte_eth_conf port_conf = { .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, .header_split = 0, @@ -150,7 +151,6 @@ struct rte_meter_trtcm_params app_trtcm_params[] = { {.cir = 1000000 * 46, .pir = 1500000 * 46, .cbs = 2048, .pbs = 2048}, }; -#define DIM(a) (sizeof (a) / sizeof ((a)[0])) #define APP_FLOWS_MAX 256 FLOW_METER app_flows[APP_FLOWS_MAX]; @@ -160,7 +160,7 @@ app_configure_flow_table(void) { uint32_t i, j; - for (i = 0, j = 0; i < APP_FLOWS_MAX; i ++, j = (j + 1) % DIM(PARAMS)){ + for (i = 0, j = 0; i < APP_FLOWS_MAX; i ++, j = (j + 1) % RTE_DIM(PARAMS)){ FUNC_CONFIG(&app_flows[i], &PARAMS[j]); } } diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 88f5443e83..21e0fc71ed 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -97,7 +97,7 @@ static void send_pause_frame(uint8_t port_id, uint16_t duration) ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; - *((uint64_t *)tmp) = 0x010000C28001; + *((uint64_t *)tmp) = 0x010000C28001ULL; hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_FLOW_CONTROL); diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 6bd85c044f..fac24aa5b9 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -130,6 +130,7 @@ static const struct rte_eth_rxconf rx_conf_default = { .hthresh = RX_HTHRESH, .wthresh = RX_WTHRESH, }, + .rx_drop_en = 1, }; /* @@ -472,7 +473,7 @@ sighup_handler(int signum) * Main thread that does the work, reading from INPUT_PORT * and writing to OUTPUT_PORT */ -static __attribute__((noreturn)) int +static int lcore_main(__attribute__((__unused__)) void* dummy) { const uint16_t lcore_id = (uint16_t)rte_lcore_id(); @@ -504,6 +505,11 @@ lcore_main(__attribute__((__unused__)) void* dummy) printf("core %u(lcore %u) reading queues %i-%i\n", (unsigned)core_id, (unsigned)lcore_id, startQueue, endQueue - 1); + if (startQueue == endQueue) { + printf("lcore %u has nothing to do\n", lcore_id); + return (0); + } + for (;;) { struct rte_mbuf *buf[MAX_PKT_BURST]; const uint16_t buf_size = sizeof(buf) / sizeof(buf[0]);