* DPDK callback to stop the device. * * Simulate device stop by detaching all configured flows. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. * The following error values are defined: * * - -EBUSY: If transfer proxy port cannot be stopped, * because other port representors are still
| 1412 | * because other port representors are still running. |
| 1413 | */ |
| 1414 | int |
| 1415 | mlx5_dev_stop(struct rte_eth_dev *dev) |
| 1416 | { |
| 1417 | struct mlx5_priv *priv = dev->data->dev_private; |
| 1418 | |
| 1419 | #ifdef HAVE_MLX5_HWS_SUPPORT |
| 1420 | if (priv->sh->config.dv_flow_en == 2) { |
| 1421 | /* If there is no E-Switch, then there are no start/stop order limitations. */ |
| 1422 | if (!priv->sh->config.dv_esw_en) |
| 1423 | goto continue_dev_stop; |
| 1424 | /* If representor is being stopped, then it is always allowed. */ |
| 1425 | if (priv->representor) |
| 1426 | goto continue_dev_stop; |
| 1427 | if (mlx5_hw_proxy_port_allowed_stop(dev)) { |
| 1428 | dev->data->dev_started = 1; |
| 1429 | return -rte_errno; |
| 1430 | } |
| 1431 | } |
| 1432 | continue_dev_stop: |
| 1433 | #endif |
| 1434 | dev->data->dev_started = 0; |
| 1435 | /* Prevent crashes when queues are still in use. */ |
| 1436 | dev->rx_pkt_burst = rte_eth_pkt_burst_dummy; |
| 1437 | dev->tx_pkt_burst = rte_eth_pkt_burst_dummy; |
| 1438 | rte_wmb(); |
| 1439 | /* Disable datapath on secondary process. */ |
| 1440 | mlx5_mp_os_req_stop_rxtx(dev); |
| 1441 | rte_delay_us_sleep(1000 * priv->rxqs_n); |
| 1442 | DRV_LOG(DEBUG, "port %u stopping device", dev->data->port_id); |
| 1443 | if (priv->sh->config.dv_flow_en == 2) { |
| 1444 | if (!__atomic_load_n(&priv->hws_mark_refcnt, __ATOMIC_RELAXED)) |
| 1445 | flow_hw_rxq_flag_set(dev, false); |
| 1446 | } else { |
| 1447 | mlx5_flow_stop_default(dev); |
| 1448 | } |
| 1449 | /* Control flows for default traffic can be removed firstly. */ |
| 1450 | mlx5_traffic_disable(dev); |
| 1451 | /* All RX queue flags will be cleared in the flush interface. */ |
| 1452 | mlx5_flow_list_flush(dev, MLX5_FLOW_TYPE_GEN, true); |
| 1453 | mlx5_flow_meter_rxq_flush(dev); |
| 1454 | mlx5_action_handle_detach(dev); |
| 1455 | #ifdef HAVE_MLX5_HWS_SUPPORT |
| 1456 | mlx5_flow_hw_cleanup_ctrl_rx_templates(dev); |
| 1457 | #endif |
| 1458 | mlx5_rx_intr_vec_disable(dev); |
| 1459 | priv->sh->port[priv->dev_port - 1].ih_port_id = RTE_MAX_ETHPORTS; |
| 1460 | priv->sh->port[priv->dev_port - 1].devx_ih_port_id = RTE_MAX_ETHPORTS; |
| 1461 | priv->sh->port[priv->dev_port - 1].nl_ih_port_id = RTE_MAX_ETHPORTS; |
| 1462 | mlx5_txq_stop(dev); |
| 1463 | mlx5_rxq_stop(dev); |
| 1464 | if (priv->obj_ops.lb_dummy_queue_release) |
| 1465 | priv->obj_ops.lb_dummy_queue_release(dev); |
| 1466 | mlx5_txpp_stop(dev); |
| 1467 | |
| 1468 | return 0; |
| 1469 | } |
| 1470 | |
| 1471 | #ifdef HAVE_MLX5_HWS_SUPPORT |
nothing calls this directly
no test coverage detected