src/dpdk/drivers/net/mlx5/mlx5_trigger.c
int
mlx5_dev_start(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	int ret;
	int fine_inline;

	DRV_LOG(DEBUG, "port %u starting device", dev->data->port_id);
	fine_inline = rte_mbuf_dynflag_lookup
		(RTE_PMD_MLX5_FINE_GRANULARITY_INLINE, NULL);
	if (fine_inline >= 0)
		rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline;
	else
		rte_net_mlx5_dynf_inline_mask = 0;
	if (dev->data->nb_rx_queues > 0) {
		ret = mlx5_dev_configure_rss_reta(dev);
		if (ret) {
			DRV_LOG(ERR, "port %u reta config failed: %s",
				dev->data->port_id, strerror(rte_errno));
			return -rte_errno;
		}
	}
	ret = mlx5_txpp_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	ret = mlx5_txq_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	ret = mlx5_rxq_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	/*
	 * Such step will be skipped if there is no hairpin TX queue configured
	 * with RX peer queue from the same device.
	 */
	ret = mlx5_hairpin_auto_bind(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	/* Set started flag here for the following steps like control flow. */
	dev->data->dev_started = 1;
	ret = mlx5_rx_intr_vec_enable(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Rx interrupt vector creation failed",
			dev->data->port_id);
		goto error;
	}
	mlx5_os_stats_init(dev);
	ret = mlx5_traffic_enable(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u failed to set defaults flows",
			dev->data->port_id);
		goto error;
	}
	/* Set a mask and offset of dynamic metadata flows into Rx queues. */
	mlx5_flow_rxq_dynf_metadata_set(dev);
	/* Set flags and context to convert Rx timestamps. */
	mlx5_rxq_timestamp_set(dev);
	/* Set a mask and offset of scheduling on timestamp into Tx queues. */
	mlx5_txq_dynf_timestamp_set(dev);
	/*
	 * In non-cached mode, it only needs to start the default mreg copy
	 * action and no flow created by application exists anymore.
	 * But it is worth wrapping the interface for further usage.
	 */
	ret = mlx5_flow_start_default(dev);
	if (ret) {
		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	rte_wmb();
	dev->tx_pkt_burst = mlx5_select_tx_function(dev);
	dev->rx_pkt_burst = mlx5_select_rx_function(dev);
	/* Enable datapath on secondary process. */
	mlx5_mp_os_req_start_rxtx(dev);
	if (priv->sh->intr_handle.fd >= 0) {
		priv->sh->port[priv->dev_port - 1].ih_port_id =
					(uint32_t)dev->data->port_id;
	} else {
		DRV_LOG(INFO, "port %u starts without LSC and RMV interrupts.",
			dev->data->port_id);
		dev->data->dev_conf.intr_conf.lsc = 0;
		dev->data->dev_conf.intr_conf.rmv = 0;
	}
	if (priv->sh->intr_handle_devx.fd >= 0)
		priv->sh->port[priv->dev_port - 1].devx_ih_port_id =
					(uint32_t)dev->data->port_id;
	return 0;
error:
	ret = rte_errno; /* Save rte_errno before cleanup. */
	/* Rollback. */
	dev->data->dev_started = 0;
	mlx5_flow_stop_default(dev);
	mlx5_traffic_disable(dev);
	mlx5_txq_stop(dev);
	mlx5_rxq_stop(dev);
	mlx5_txpp_stop(dev); /* Stop last. */
	rte_errno = ret; /* Restore rte_errno. */
	return -rte_errno;
}
/**
 * DPDK callback to start the device.
 *
 * Simulate device start by attaching all configured flows.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
DPDK callback to start the device.
Simulate device start by attaching all configured flows.

@param dev
Pointer to Ethernet device structure.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
DPDK callback to start the device . Simulate device start by attaching all configured flows . @param dev Pointer to Ethernet device structure . @return 0 on success a negative errno value otherwise and rte_errno is set .
int
mlx5_dev_start(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	int ret;
	int fine_inline;
	DRV_LOG(DEBUG, "port %u starting device", dev->data->port_id);
	fine_inline = rte_mbuf_dynflag_lookup
		(RTE_PMD_MLX5_FINE_GRANULARITY_INLINE, NULL);
	if (fine_inline >= 0)
		rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline;
	else
		rte_net_mlx5_dynf_inline_mask = 0;
	if (dev->data->nb_rx_queues > 0) {
		ret = mlx5_dev_configure_rss_reta(dev);
		if (ret) {
			DRV_LOG(ERR, "port %u reta config failed: %s",
				dev->data->port_id, strerror(rte_errno));
			return -rte_errno;
		}
	}
	ret = mlx5_txpp_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	ret = mlx5_txq_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	ret = mlx5_rxq_start(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	ret = mlx5_hairpin_auto_bind(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	dev->data->dev_started = 1;
	ret = mlx5_rx_intr_vec_enable(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u Rx interrupt vector creation failed",
			dev->data->port_id);
		goto error;
	}
	mlx5_os_stats_init(dev);
	ret = mlx5_traffic_enable(dev);
	if (ret) {
		DRV_LOG(ERR, "port %u failed to set defaults flows",
			dev->data->port_id);
		goto error;
	}
	mlx5_flow_rxq_dynf_metadata_set(dev);
	mlx5_rxq_timestamp_set(dev);
	mlx5_txq_dynf_timestamp_set(dev);
	ret = mlx5_flow_start_default(dev);
	if (ret) {
		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
			dev->data->port_id, strerror(rte_errno));
		goto error;
	}
	rte_wmb();
	dev->tx_pkt_burst = mlx5_select_tx_function(dev);
	dev->rx_pkt_burst = mlx5_select_rx_function(dev);
	mlx5_mp_os_req_start_rxtx(dev);
	if (priv->sh->intr_handle.fd >= 0) {
		priv->sh->port[priv->dev_port - 1].ih_port_id =
					(uint32_t)dev->data->port_id;
	} else {
		DRV_LOG(INFO, "port %u starts without LSC and RMV interrupts.",
			dev->data->port_id);
		dev->data->dev_conf.intr_conf.lsc = 0;
		dev->data->dev_conf.intr_conf.rmv = 0;
	}
	if (priv->sh->intr_handle_devx.fd >= 0)
		priv->sh->port[priv->dev_port - 1].devx_ih_port_id =
					(uint32_t)dev->data->port_id;
	return 0;
error:
	ret = rte_errno; 
	dev->data->dev_started = 0;
	mlx5_flow_stop_default(dev);
	mlx5_traffic_disable(dev);
	mlx5_txq_stop(dev);
	mlx5_rxq_stop(dev);
	mlx5_txpp_stop(dev); 
	rte_errno = ret; 
	return -rte_errno;
}
int mlx5_dev_start ( struct rte_eth_dev * dev ) { struct mlx5_priv * priv = dev -> data -> dev_private ; int ret ; int fine_inline ; DRV_LOG ( DEBUG , " " , dev -> data -> port_id ) ; fine_inline = rte_mbuf_dynflag_lookup ( RTE_PMD_MLX5_FINE_GRANULARITY_INLINE , NULL ) ; if ( fine_inline >= 0 ) rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline ; else rte_net_mlx5_dynf_inline_mask = 0 ; if ( dev -> data -> nb_rx_queues > 0 ) { ret = mlx5_dev_configure_rss_reta ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; return - rte_errno ; } } ret = mlx5_txpp_start ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; goto error ; } ret = mlx5_txq_start ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; goto error ; } ret = mlx5_rxq_start ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; goto error ; } ret = mlx5_hairpin_auto_bind ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; goto error ; } dev -> data -> dev_started = 1 ; ret = mlx5_rx_intr_vec_enable ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id ) ; goto error ; } mlx5_os_stats_init ( dev ) ; ret = mlx5_traffic_enable ( dev ) ; if ( ret ) { DRV_LOG ( ERR , " " , dev -> data -> port_id ) ; goto error ; } mlx5_flow_rxq_dynf_metadata_set ( dev ) ; mlx5_rxq_timestamp_set ( dev ) ; mlx5_txq_dynf_timestamp_set ( dev ) ; ret = mlx5_flow_start_default ( dev ) ; if ( ret ) { DRV_LOG ( DEBUG , " " , dev -> data -> port_id , strerror ( rte_errno ) ) ; goto error ; } rte_wmb ( ) ; dev -> tx_pkt_burst = mlx5_select_tx_function ( dev ) ; dev -> rx_pkt_burst = mlx5_select_rx_function ( dev ) ; mlx5_mp_os_req_start_rxtx ( dev ) ; if ( priv -> sh -> intr_handle . fd >= 0 ) { priv -> sh -> port [ priv -> dev_port - 1 ] . ih_port_id = ( uint32_t ) dev -> data -> port_id ; } else { DRV_LOG ( INFO , " " , dev -> data -> port_id ) ; dev -> data -> dev_conf . intr_conf . lsc = 0 ; dev -> data -> dev_conf . intr_conf . rmv = 0 ; } if ( priv -> sh -> intr_handle_devx . fd >= 0 ) priv -> sh -> port [ priv -> dev_port - 1 ] . devx_ih_port_id = ( uint32_t ) dev -> data -> port_id ; return 0 ; error : ret = rte_errno ; dev -> data -> dev_started = 0 ; mlx5_flow_stop_default ( dev ) ; mlx5_traffic_disable ( dev ) ; mlx5_txq_stop ( dev ) ; mlx5_rxq_stop ( dev ) ; mlx5_txpp_stop ( dev ) ; rte_errno = ret ; return - rte_errno ; }
DPDK callback to start the device.
DPDK callback to start the device .
/*
	 * Such step will be skipped if there is no hairpin TX queue configured
	 * with RX peer queue from the same device.
	 */ /* Set started flag here for the following steps like control flow. */ /* Set a mask and offset of dynamic metadata flows into Rx queues. */ /* Set flags and context to convert Rx timestamps. */ /* Set a mask and offset of scheduling on timestamp into Tx queues. */ /*
	 * In non-cached mode, it only needs to start the default mreg copy
	 * action and no flow created by application exists anymore.
	 * But it is worth wrapping the interface for further usage.
	 */ /* Enable datapath on secondary process. */ /* Save rte_errno before cleanup. */ /* Rollback. */ /* Stop last. */ /* Restore rte_errno. */