git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
examples/l3fwd: support config file for EM
[dpdk.git]
/
examples
/
packet_ordering
/
main.c
diff --git
a/examples/packet_ordering/main.c
b/examples/packet_ordering/main.c
index
b5fc6c5
..
99e67ef
100644
(file)
--- a/
examples/packet_ordering/main.c
+++ b/
examples/packet_ordering/main.c
@@
-29,6
+29,13
@@
/* Macros for printing using RTE_LOG */
#define RTE_LOGTYPE_REORDERAPP RTE_LOGTYPE_USER1
/* Macros for printing using RTE_LOG */
#define RTE_LOGTYPE_REORDERAPP RTE_LOGTYPE_USER1
+enum {
+#define OPT_DISABLE_REORDER "disable-reorder"
+ OPT_DISABLE_REORDER_NUM = 256,
+#define OPT_INSIGHT_WORKER "insight-worker"
+ OPT_INSIGHT_WORKER_NUM,
+};
+
unsigned int portmask;
unsigned int disable_reorder;
unsigned int insight_worker;
unsigned int portmask;
unsigned int disable_reorder;
unsigned int insight_worker;
@@
-157,9
+164,9
@@
parse_args(int argc, char **argv)
char **argvopt;
char *prgname = argv[0];
static struct option lgopts[] = {
char **argvopt;
char *prgname = argv[0];
static struct option lgopts[] = {
- {
"disable-reorder", 0, 0, 0
},
- {
"insight-worker", 0, 0, 0
},
- {NULL,
0, 0, 0
}
+ {
OPT_DISABLE_REORDER, 0, NULL, OPT_DISABLE_REORDER_NUM
},
+ {
OPT_INSIGHT_WORKER, 0, NULL, OPT_INSIGHT_WORKER_NUM
},
+ {NULL,
0, 0, 0
}
};
argvopt = argv;
};
argvopt = argv;
@@
-176,18
+183,18
@@
parse_args(int argc, char **argv)
return -1;
}
break;
return -1;
}
break;
+
/* long options */
/* long options */
- case 0:
- if (!strcmp(lgopts[option_index].name, "disable-reorder")) {
- printf("reorder disabled\n");
- disable_reorder = 1;
- }
- if (!strcmp(lgopts[option_index].name,
- "insight-worker")) {
- printf("print all worker statistics\n");
- insight_worker = 1;
- }
+ case OPT_DISABLE_REORDER_NUM:
+ printf("reorder disabled\n");
+ disable_reorder = 1;
break;
break;
+
+ case OPT_INSIGHT_WORKER_NUM:
+ printf("print all worker statistics\n");
+ insight_worker = 1;
+ break;
+
default:
print_usage(prgname);
return -1;
default:
print_usage(prgname);
return -1;
@@
-287,10
+294,10
@@
configure_eth_port(uint16_t port_id)
return ret;
}
return ret;
}
- if (dev_info.tx_offload_capa &
DEV
_TX_OFFLOAD_MBUF_FAST_FREE)
+ if (dev_info.tx_offload_capa &
RTE_ETH
_TX_OFFLOAD_MBUF_FAST_FREE)
port_conf.txmode.offloads |=
port_conf.txmode.offloads |=
-
DEV
_TX_OFFLOAD_MBUF_FAST_FREE;
- ret = rte_eth_dev_configure(port_id, rxRings, txRings, &port_conf
_default
);
+
RTE_ETH
_TX_OFFLOAD_MBUF_FAST_FREE;
+ ret = rte_eth_dev_configure(port_id, rxRings, txRings, &port_conf);
if (ret != 0)
return ret;
if (ret != 0)
return ret;
@@
-328,10
+335,7
@@
configure_eth_port(uint16_t port_id)
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
- port_id,
- addr.addr_bytes[0], addr.addr_bytes[1],
- addr.addr_bytes[2], addr.addr_bytes[3],
- addr.addr_bytes[4], addr.addr_bytes[5]);
+ port_id, RTE_ETHER_ADDR_BYTES(&addr));
ret = rte_eth_promiscuous_enable(port_id);
if (ret != 0)
ret = rte_eth_promiscuous_enable(port_id);
if (ret != 0)
@@
-345,10
+349,10
@@
print_stats(void)
{
uint16_t i;
struct rte_eth_stats eth_stats;
{
uint16_t i;
struct rte_eth_stats eth_stats;
- unsigned int lcore_id, last_lcore_id, ma
ster
_lcore_id, end_w_lcore_id;
+ unsigned int lcore_id, last_lcore_id, ma
in
_lcore_id, end_w_lcore_id;
last_lcore_id = get_last_lcore_id();
last_lcore_id = get_last_lcore_id();
- ma
ster_lcore_id = rte_get_master
_lcore();
+ ma
in_lcore_id = rte_get_main
_lcore();
end_w_lcore_id = get_previous_lcore_id(last_lcore_id);
printf("\nRX thread stats:\n");
end_w_lcore_id = get_previous_lcore_id(last_lcore_id);
printf("\nRX thread stats:\n");
@@
-360,7
+364,7
@@
print_stats(void)
for (lcore_id = 0; lcore_id <= end_w_lcore_id; lcore_id++) {
if (insight_worker
&& rte_lcore_is_enabled(lcore_id)
for (lcore_id = 0; lcore_id <= end_w_lcore_id; lcore_id++) {
if (insight_worker
&& rte_lcore_is_enabled(lcore_id)
- && lcore_id != ma
ster
_lcore_id) {
+ && lcore_id != ma
in
_lcore_id) {
printf("\nWorker thread stats on core [%u]:\n",
lcore_id);
printf(" - Pkts deqd from workers ring: %"PRIu64"\n",
printf("\nWorker thread stats on core [%u]:\n",
lcore_id);
printf(" - Pkts deqd from workers ring: %"PRIu64"\n",
@@
-451,7
+455,7
@@
rx_thread(struct rte_ring *ring_out)
/* mark sequence number */
for (i = 0; i < nb_rx_pkts; )
/* mark sequence number */
for (i = 0; i < nb_rx_pkts; )
-
pkts[i++]->seqn
= seqn++;
+
*rte_reorder_seqn(pkts[i++])
= seqn++;
/* enqueue to rx_to_workers ring */
ret = rte_ring_enqueue_burst(ring_out,
/* enqueue to rx_to_workers ring */
ret = rte_ring_enqueue_burst(ring_out,
@@
-658,7
+662,7
@@
main(int argc, char **argv)
{
int ret;
unsigned nb_ports;
{
int ret;
unsigned nb_ports;
- unsigned int lcore_id, last_lcore_id, ma
ster
_lcore_id;
+ unsigned int lcore_id, last_lcore_id, ma
in
_lcore_id;
uint16_t port_id;
uint16_t nb_ports_available;
struct worker_thread_args worker_args = {NULL, NULL};
uint16_t port_id;
uint16_t nb_ports_available;
struct worker_thread_args worker_args = {NULL, NULL};
@@
-682,7
+686,7
@@
main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid packet_ordering arguments\n");
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid packet_ordering arguments\n");
- /* Check if we have enough
t
cores */
+ /* Check if we have enough cores */
if (rte_lcore_count() < 3)
rte_exit(EXIT_FAILURE, "Error, This application needs at "
"least 3 logical cores to run:\n"
if (rte_lcore_count() < 3)
rte_exit(EXIT_FAILURE, "Error, This application needs at "
"least 3 logical cores to run:\n"
@@
-745,36
+749,40
@@
main(int argc, char **argv)
}
last_lcore_id = get_last_lcore_id();
}
last_lcore_id = get_last_lcore_id();
- ma
ster_lcore_id = rte_get_master
_lcore();
+ ma
in_lcore_id = rte_get_main
_lcore();
worker_args.ring_in = rx_to_workers;
worker_args.ring_out = workers_to_tx;
worker_args.ring_in = rx_to_workers;
worker_args.ring_out = workers_to_tx;
- /* Start worker_thread() on all the available
slave
cores but the last 1 */
+ /* Start worker_thread() on all the available
worker
cores but the last 1 */
for (lcore_id = 0; lcore_id <= get_previous_lcore_id(last_lcore_id); lcore_id++)
for (lcore_id = 0; lcore_id <= get_previous_lcore_id(last_lcore_id); lcore_id++)
- if (rte_lcore_is_enabled(lcore_id) && lcore_id != ma
ster
_lcore_id)
+ if (rte_lcore_is_enabled(lcore_id) && lcore_id != ma
in
_lcore_id)
rte_eal_remote_launch(worker_thread, (void *)&worker_args,
lcore_id);
if (disable_reorder) {
rte_eal_remote_launch(worker_thread, (void *)&worker_args,
lcore_id);
if (disable_reorder) {
- /* Start tx_thread() on the last
slave
core */
+ /* Start tx_thread() on the last
worker
core */
rte_eal_remote_launch((lcore_function_t *)tx_thread, workers_to_tx,
last_lcore_id);
} else {
send_args.ring_in = workers_to_tx;
rte_eal_remote_launch((lcore_function_t *)tx_thread, workers_to_tx,
last_lcore_id);
} else {
send_args.ring_in = workers_to_tx;
- /* Start send_thread() on the last
slave
core */
+ /* Start send_thread() on the last
worker
core */
rte_eal_remote_launch((lcore_function_t *)send_thread,
(void *)&send_args, last_lcore_id);
}
rte_eal_remote_launch((lcore_function_t *)send_thread,
(void *)&send_args, last_lcore_id);
}
- /* Start rx_thread() on the ma
ster
core */
+ /* Start rx_thread() on the ma
in
core */
rx_thread(rx_to_workers);
rx_thread(rx_to_workers);
- RTE_LCORE_FOREACH_
SLAVE
(lcore_id) {
+ RTE_LCORE_FOREACH_
WORKER
(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0)
return -1;
}
print_stats();
if (rte_eal_wait_lcore(lcore_id) < 0)
return -1;
}
print_stats();
+
+ /* clean up the EAL */
+ rte_eal_cleanup();
+
return 0;
}
return 0;
}