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: remove extra new line after link duplex
[dpdk.git]
/
examples
/
performance-thread
/
l3fwd-thread
/
main.c
diff --git
a/examples/performance-thread/l3fwd-thread/main.c
b/examples/performance-thread/l3fwd-thread/main.c
index
dd46895
..
84c1d7b
100644
(file)
--- a/
examples/performance-thread/l3fwd-thread/main.c
+++ b/
examples/performance-thread/l3fwd-thread/main.c
@@
-40,6
+40,7
@@
#include <rte_udp.h>
#include <rte_string_fns.h>
#include <rte_pause.h>
#include <rte_udp.h>
#include <rte_string_fns.h>
#include <rte_pause.h>
+#include <rte_timer.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@
-330,7
+331,7
@@
struct ipv4_5tuple {
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
-} __
attribute__((__packed__))
;
+} __
rte_packed
;
union ipv4_5tuple_host {
struct {
union ipv4_5tuple_host {
struct {
@@
-353,7
+354,7
@@
struct ipv6_5tuple {
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
-} __
attribute__((__packed__))
;
+} __
rte_packed
;
union ipv6_5tuple_host {
struct {
union ipv6_5tuple_host {
struct {
@@
-868,7
+869,7
@@
get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid,
#endif
static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid)
#endif
static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid)
- __
attribute__((unused))
;
+ __
rte_unused
;
#if ((APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) && \
(ENABLE_MULTI_BUFFER_OPTIMIZE == 1))
#if ((APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) && \
(ENABLE_MULTI_BUFFER_OPTIMIZE == 1))
@@
-1119,7
+1120,7
@@
simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid)
struct rte_ether_hdr *eth_hdr[8];
union ipv6_5tuple_host key[8];
struct rte_ether_hdr *eth_hdr[8];
union ipv6_5tuple_host key[8];
- __
attribute__((unused))
struct rte_ipv6_hdr *ipv6_hdr[8];
+ __
rte_unused
struct rte_ipv6_hdr *ipv6_hdr[8];
eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *);
eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *);
eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *);
eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *);
@@
-1876,7
+1877,7
@@
process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
/*
* CPU-load stats collector
*/
/*
* CPU-load stats collector
*/
-static int
+static int
__rte_noreturn
cpu_load_collector(__rte_unused void *arg) {
unsigned i, j, k;
uint64_t hits;
cpu_load_collector(__rte_unused void *arg) {
unsigned i, j, k;
uint64_t hits;
@@
-2298,7
+2299,7
@@
sched_spawner(__rte_unused void *arg) {
}
/* main processing loop */
}
/* main processing loop */
-static int
+static int
__rte_noreturn
pthread_tx(void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
pthread_tx(void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
@@
-3431,6
+3432,7
@@
check_all_ports_link_status(uint32_t port_mask)
uint16_t portid;
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
uint16_t portid;
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
+ int ret;
printf("\nChecking link status");
fflush(stdout);
printf("\nChecking link status");
fflush(stdout);
@@
-3440,7
+3442,14
@@
check_all_ports_link_status(uint32_t port_mask)
if ((port_mask & (1 << portid)) == 0)
continue;
memset(&link, 0, sizeof(link));
if ((port_mask & (1 << portid)) == 0)
continue;
memset(&link, 0, sizeof(link));
- rte_eth_link_get_nowait(portid, &link);
+ ret = rte_eth_link_get_nowait(portid, &link);
+ if (ret < 0) {
+ all_ports_up = 0;
+ if (print_flag == 1)
+ printf("Port %u link get failed: %s\n",
+ portid, rte_strerror(-ret));
+ continue;
+ }
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
@@
-3448,7
+3457,7
@@
check_all_ports_link_status(uint32_t port_mask)
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
- ("full-duplex") : ("half-duplex
\n
"));
+ ("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
continue;
else
printf("Port %d Link Down\n", portid);
continue;
@@
-3497,6
+3506,10
@@
main(int argc, char **argv)
argc -= ret;
argv += ret;
argc -= ret;
argv += ret;
+ ret = rte_timer_subsystem_init();
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Failed to initialize timer subystem\n");
+
/* pre-init dst MACs for all ports to 02:00:00:00:00:xx */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
dest_eth_addr[portid] = RTE_ETHER_LOCAL_ADMIN_ADDR +
/* pre-init dst MACs for all ports to 02:00:00:00:00:xx */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
dest_eth_addr[portid] = RTE_ETHER_LOCAL_ADMIN_ADDR +
@@
-3554,7
+3567,13
@@
main(int argc, char **argv)
n_tx_queue = MAX_TX_QUEUE_PER_PORT;
printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
nb_rx_queue, (unsigned)n_tx_queue);
n_tx_queue = MAX_TX_QUEUE_PER_PORT;
printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
nb_rx_queue, (unsigned)n_tx_queue);
- rte_eth_dev_info_get(portid, &dev_info);
+
+ ret = rte_eth_dev_info_get(portid, &dev_info);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error during getting device (port %u) info: %s\n",
+ portid, strerror(-ret));
+
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@
-3583,7
+3602,12
@@
main(int argc, char **argv)
"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
ret, portid);
"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
print_ethaddr("Destination:",
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
print_ethaddr("Destination:",
@@
-3645,14
+3669,10
@@
main(int argc, char **argv)
/* init RX queues */
for (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) {
/* init RX queues */
for (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) {
- struct rte_eth_dev *dev;
- struct rte_eth_conf *conf;
struct rte_eth_rxconf rxq_conf;
portid = rx_thread[i].rx_queue_list[queue].port_id;
queueid = rx_thread[i].rx_queue_list[queue].queue_id;
struct rte_eth_rxconf rxq_conf;
portid = rx_thread[i].rx_queue_list[queue].port_id;
queueid = rx_thread[i].rx_queue_list[queue].queue_id;
- dev = &rte_eth_devices[portid];
- conf = &dev->data->dev_conf;
if (numa_on)
socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id);
if (numa_on)
socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id);
@@
-3662,9
+3682,14
@@
main(int argc, char **argv)
printf("rxq=%d,%d,%d ", portid, queueid, socketid);
fflush(stdout);
printf("rxq=%d,%d,%d ", portid, queueid, socketid);
fflush(stdout);
- rte_eth_dev_info_get(portid, &dev_info);
+ ret = rte_eth_dev_info_get(portid, &dev_info);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error during getting device (port %u) info: %s\n",
+ portid, strerror(-ret));
+
rxq_conf = dev_info.default_rxconf;
rxq_conf = dev_info.default_rxconf;
- rxq_conf.offloads =
conf->
rxmode.offloads;
+ rxq_conf.offloads =
port_conf.
rxmode.offloads;
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
socketid,
&rxq_conf,
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
socketid,
&rxq_conf,
@@
-3694,8
+3719,13
@@
main(int argc, char **argv)
* to itself through 2 cross-connected ports of the
* target machine.
*/
* to itself through 2 cross-connected ports of the
* target machine.
*/
- if (promiscuous_on)
- rte_eth_promiscuous_enable(portid);
+ if (promiscuous_on) {
+ ret = rte_eth_promiscuous_enable(portid);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_promiscuous_enable: err=%s, port=%u\n",
+ rte_strerror(-ret), portid);
+ }
}
for (i = 0; i < n_rx_thread; i++) {
}
for (i = 0; i < n_rx_thread; i++) {