uint16_t port_id;
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
+ int ret;
printf("\nChecking link status...");
fflush(stdout);
if ((port_mask & (1 << port_id)) == 0)
continue;
memset(&link, 0, sizeof(link));
- rte_eth_link_get_nowait(port_id, &link);
+ ret = rte_eth_link_get_nowait(port_id, &link);
+ if (ret < 0) {
+ all_ports_up = 0;
+ if (print_flag == 1)
+ printf("Port %u link get failed: %s\n",
+ port_id, rte_strerror(-ret));
+ continue;
+ }
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
uint16_t port_id, last_port;
uint32_t nb_mbufs;
uint16_t nb_ports;
- int ret;
+ int i, ret;
/* init EAL */
ret = rte_eal_init(argc, argv);
rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, rsrc,
SKIP_MASTER);
l2fwd_event_print_stats(rsrc);
- rte_eal_mp_wait_lcore();
+ if (rsrc->event_mode) {
+ struct l2fwd_event_resources *evt_rsrc =
+ rsrc->evt_rsrc;
+ for (i = 0; i < evt_rsrc->rx_adptr.nb_rx_adptr; i++)
+ rte_event_eth_rx_adapter_stop(
+ evt_rsrc->rx_adptr.rx_adptr[i]);
+ for (i = 0; i < evt_rsrc->tx_adptr.nb_tx_adptr; i++)
+ rte_event_eth_tx_adapter_stop(
+ evt_rsrc->tx_adptr.tx_adptr[i]);
- RTE_ETH_FOREACH_DEV(port_id) {
- if ((rsrc->enabled_port_mask &
- (1 << port_id)) == 0)
- continue;
- printf("Closing port %d...", port_id);
- rte_eth_dev_stop(port_id);
- rte_eth_dev_close(port_id);
- printf(" Done\n");
+ RTE_ETH_FOREACH_DEV(port_id) {
+ if ((rsrc->enabled_port_mask &
+ (1 << port_id)) == 0)
+ continue;
+ rte_eth_dev_stop(port_id);
+ }
+
+ rte_eal_mp_wait_lcore();
+ RTE_ETH_FOREACH_DEV(port_id) {
+ if ((rsrc->enabled_port_mask &
+ (1 << port_id)) == 0)
+ continue;
+ rte_eth_dev_close(port_id);
+ }
+
+ rte_event_dev_stop(evt_rsrc->event_d_id);
+ rte_event_dev_close(evt_rsrc->event_d_id);
+
+ } else {
+ rte_eal_mp_wait_lcore();
+
+ RTE_ETH_FOREACH_DEV(port_id) {
+ if ((rsrc->enabled_port_mask &
+ (1 << port_id)) == 0)
+ continue;
+ printf("Closing port %d...", port_id);
+ rte_eth_dev_stop(port_id);
+ rte_eth_dev_close(port_id);
+ printf(" Done\n");
+ }
}
printf("Bye...\n");