int
rte_ethtool_net_open(uint16_t port_id)
{
- rte_eth_dev_stop(port_id);
+ int ret;
+
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0)
+ return ret;
return rte_eth_dev_start(port_id);
}
int
rte_ethtool_net_stop(uint16_t port_id)
{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- rte_eth_dev_stop(port_id);
-
- return 0;
+ return rte_eth_dev_stop(port_id);
}
int
if (stat != 0)
return stat;
- rte_eth_dev_stop(port_id);
+ stat = rte_eth_dev_stop(port_id);
+ if (stat != 0)
+ return stat;
stat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,
rte_socket_id(), NULL);
RTE_ETH_FOREACH_DEV(portid) {
rte_event_eth_rx_adapter_stop(portid);
rte_event_eth_tx_adapter_stop(portid);
- rte_eth_dev_stop(portid);
+ if (rte_eth_dev_stop(portid) < 0)
+ printf("Failed to stop port %u", portid);
}
rte_eal_mp_wait_lcore();
printf("%s%s", what, buf);
}
-static void
+static int
main_loop(void)
{
struct rte_mbuf *mbufs[32];
uint16_t nb_rx;
uint16_t i;
uint16_t j;
+ int ret;
while (!force_quit) {
for (i = 0; i < nr_queues; i++) {
/* closing and releasing resources */
rte_flow_flush(port_id, &error);
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret < 0)
+ printf("Failed to stop port %u: %s",
+ port_id, rte_strerror(-ret));
rte_eth_dev_close(port_id);
+ return ret;
}
#define CHECK_INTERVAL 1000 /* 100ms */
rte_exit(EXIT_FAILURE, "error in creating flow");
}
- main_loop();
-
- return 0;
+ return main_loop();
}
uint32_t j;
for (i = 0; i < cfg.nb_ports; i++) {
printf("Closing port %d\n", cfg.ports[i].rxtx_port);
- rte_eth_dev_stop(cfg.ports[i].rxtx_port);
+ ret = rte_eth_dev_stop(cfg.ports[i].rxtx_port);
+ if (ret != 0)
+ RTE_LOG(ERR, IOAT, "rte_eth_dev_stop: err=%s, port=%u\n",
+ rte_strerror(-ret), cfg.ports[i].rxtx_port);
+
rte_eth_dev_close(cfg.ports[i].rxtx_port);
if (copy_mode == COPY_MODE_IOAT_NUM) {
for (j = 0; j < cfg.ports[i].nb_queues; j++) {
if ((conf->eth_portmask & (1 << port_id)) == 0)
continue;
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
+ EH_LOG_ERR("Failed to stop port %u, err: %d",
+ port_id, ret);
+ return ret;
+ }
}
/* Setup eventdev */
" for port %u, err msg: %s\n", portid,
err.message);
}
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ RTE_LOG(ERR, IPSEC,
+ "rte_eth_dev_stop: err=%s, port=%u\n",
+ rte_strerror(-ret), portid);
+
rte_eth_dev_close(portid);
printf(" Done\n");
}
RTE_LOG(INFO, APP, "Change MTU of port %d to %u\n", port_id, new_mtu);
/* Stop specific port */
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
+ RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
+ port_id, rte_strerror(-ret));
+ return ret;
+ }
memcpy(&conf, &port_conf, sizeof(conf));
/* Set new MTU */
rte_atomic32_inc(&kni_pause);
if (if_up != 0) { /* Configure network interface up */
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
+ RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
+ port_id, rte_strerror(-ret));
+ rte_atomic32_dec(&kni_pause);
+ return ret;
+ }
ret = rte_eth_dev_start(port_id);
- } else /* Configure network interface down */
- rte_eth_dev_stop(port_id);
+ } else { /* Configure network interface down */
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
+ RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
+ port_id, rte_strerror(-ret));
+ rte_atomic32_dec(&kni_pause);
+ return ret;
+ }
+ }
rte_atomic32_dec(&kni_pause);
kni_free_kni(uint16_t port_id)
{
uint8_t i;
+ int ret;
struct kni_port_params **p = kni_port_params_array;
if (port_id >= RTE_MAX_ETHPORTS || !p[port_id])
printf("Fail to release kni\n");
p[port_id]->kni[i] = NULL;
}
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0)
+ RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
+ port_id, rte_strerror(-ret));
return 0;
}
if ((rsrc->enabled_port_mask &
(1 << port_id)) == 0)
continue;
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret < 0)
+ printf("rte_eth_dev_stop:err=%d, port=%u\n",
+ ret, port_id);
}
rte_eal_mp_wait_lcore();
(1 << port_id)) == 0)
continue;
printf("Closing port %d...", port_id);
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret < 0)
+ printf("rte_eth_dev_stop:err=%d, port=%u\n",
+ ret, port_id);
rte_eth_dev_close(port_id);
printf(" Done\n");
}
if ((l2fwd_enabled_port_mask & (1 << portid)) == 0)
continue;
printf("Closing port %d...", portid);
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ printf("rte_eth_dev_stop: err=%d, port=%d\n",
+ ret, portid);
rte_eth_dev_close(portid);
printf(" Done\n");
}
if ((enabled_port_mask & (1 << portid)) == 0)
continue;
printf("Closing port %d...", portid);
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ printf("Failed to stop port %u: %s\n",
+ portid, rte_strerror(-ret));
rte_eth_dev_close(portid);
printf(" Done\n");
}
if ((enabled_port_mask & (1 << portid)) == 0)
continue;
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ RTE_LOG(ERR, L3FWD_POWER, "rte_eth_dev_stop: err=%d, port=%u\n",
+ ret, portid);
+
rte_eth_dev_close(portid);
}
RTE_ETH_FOREACH_DEV(portid) {
if ((enabled_port_mask & (1 << portid)) == 0)
continue;
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ printf("rte_eth_dev_stop: err=%d, port=%u\n",
+ ret, portid);
}
rte_eal_mp_wait_lcore();
if ((enabled_port_mask & (1 << portid)) == 0)
continue;
printf("Closing port %d...", portid);
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ printf("rte_eth_dev_stop: err=%d, port=%u\n",
+ ret, portid);
rte_eth_dev_close(portid);
printf(" Done\n");
}