src/dpdk/drivers/net/ark/ark_ethdev.c
static int
ark_config_device(struct rte_eth_dev *dev)
{
	struct ark_adapter *ark = dev->data->dev_private;
	uint16_t num_q, i;
	struct ark_mpu_t *mpu;

	/*
	 * Make sure that the packet director, generator and checker are in a
	 * known state
	 */
	ark->start_pg = 0;
	ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
	if (ark->pg == NULL)
		return -1;
	ark_pktgen_reset(ark->pg);
	ark->pc = ark_pktchkr_init(ark->pktchkr.v, 0, 1);
	if (ark->pc == NULL)
		return -1;
	ark_pktchkr_stop(ark->pc);
	ark->pd = ark_pktdir_init(ark->pktdir.v);
	if (ark->pd == NULL)
		return -1;

	/* Verify HW */
	if (ark_udm_verify(ark->udm.v))
		return -1;
	if (ark_ddm_verify(ark->ddm.v))
		return -1;

	/* UDM */
	if (ark_udm_reset(ark->udm.v)) {
		ARK_PMD_LOG(ERR, "Unable to stop and reset UDM\n");
		return -1;
	}
	/* Keep in reset until the MPU are cleared */

	/* MPU reset */
	mpu = ark->mpurx.v;
	num_q = ark_api_num_queues(mpu);
	ark->rx_queues = num_q;
	for (i = 0; i < num_q; i++) {
		ark_mpu_reset(mpu);
		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
	}

	ark_udm_stop(ark->udm.v, 0);
	ark_udm_configure(ark->udm.v,
			  RTE_PKTMBUF_HEADROOM,
			  RTE_MBUF_DEFAULT_DATAROOM,
			  ARK_RX_WRITE_TIME_NS);
	ark_udm_stats_reset(ark->udm.v);
	ark_udm_stop(ark->udm.v, 0);

	/* TX -- DDM */
	if (ark_ddm_stop(ark->ddm.v, 1))
		ARK_PMD_LOG(ERR, "Unable to stop DDM\n");

	mpu = ark->mputx.v;
	num_q = ark_api_num_queues(mpu);
	ark->tx_queues = num_q;
	for (i = 0; i < num_q; i++) {
		ark_mpu_reset(mpu);
		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
	}

	ark_ddm_reset(ark->ddm.v);
	ark_ddm_stats_reset(ark->ddm.v);

	ark_ddm_stop(ark->ddm.v, 0);
	ark_rqp_stats_reset(ark->rqpacing);

	return 0;
}
/*
 *Initial device configuration when device is opened
 * setup the DDM, and UDM
 * Called once per PCIE device
 */
Initial device configuration when device is opened
setup the DDM, and UDM
Called once per PCIE device
Initial device configuration when device is opened setup the DDM and UDM Called once per PCIE device
static int
ark_config_device(struct rte_eth_dev *dev)
{
	struct ark_adapter *ark = dev->data->dev_private;
	uint16_t num_q, i;
	struct ark_mpu_t *mpu;
	ark->start_pg = 0;
	ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
	if (ark->pg == NULL)
		return -1;
	ark_pktgen_reset(ark->pg);
	ark->pc = ark_pktchkr_init(ark->pktchkr.v, 0, 1);
	if (ark->pc == NULL)
		return -1;
	ark_pktchkr_stop(ark->pc);
	ark->pd = ark_pktdir_init(ark->pktdir.v);
	if (ark->pd == NULL)
		return -1;
	if (ark_udm_verify(ark->udm.v))
		return -1;
	if (ark_ddm_verify(ark->ddm.v))
		return -1;
	if (ark_udm_reset(ark->udm.v)) {
		ARK_PMD_LOG(ERR, "Unable to stop and reset UDM\n");
		return -1;
	}
	mpu = ark->mpurx.v;
	num_q = ark_api_num_queues(mpu);
	ark->rx_queues = num_q;
	for (i = 0; i < num_q; i++) {
		ark_mpu_reset(mpu);
		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
	}
	ark_udm_stop(ark->udm.v, 0);
	ark_udm_configure(ark->udm.v,
			  RTE_PKTMBUF_HEADROOM,
			  RTE_MBUF_DEFAULT_DATAROOM,
			  ARK_RX_WRITE_TIME_NS);
	ark_udm_stats_reset(ark->udm.v);
	ark_udm_stop(ark->udm.v, 0);
	if (ark_ddm_stop(ark->ddm.v, 1))
		ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
	mpu = ark->mputx.v;
	num_q = ark_api_num_queues(mpu);
	ark->tx_queues = num_q;
	for (i = 0; i < num_q; i++) {
		ark_mpu_reset(mpu);
		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
	}
	ark_ddm_reset(ark->ddm.v);
	ark_ddm_stats_reset(ark->ddm.v);
	ark_ddm_stop(ark->ddm.v, 0);
	ark_rqp_stats_reset(ark->rqpacing);
	return 0;
}
static int ark_config_device ( struct rte_eth_dev * dev ) { struct ark_adapter * ark = dev -> data -> dev_private ; uint16_t num_q , i ; struct ark_mpu_t * mpu ; ark -> start_pg = 0 ; ark -> pg = ark_pktgen_init ( ark -> pktgen . v , 0 , 1 ) ; if ( ark -> pg == NULL ) return -1 ; ark_pktgen_reset ( ark -> pg ) ; ark -> pc = ark_pktchkr_init ( ark -> pktchkr . v , 0 , 1 ) ; if ( ark -> pc == NULL ) return -1 ; ark_pktchkr_stop ( ark -> pc ) ; ark -> pd = ark_pktdir_init ( ark -> pktdir . v ) ; if ( ark -> pd == NULL ) return -1 ; if ( ark_udm_verify ( ark -> udm . v ) ) return -1 ; if ( ark_ddm_verify ( ark -> ddm . v ) ) return -1 ; if ( ark_udm_reset ( ark -> udm . v ) ) { ARK_PMD_LOG ( ERR , " \n " ) ; return -1 ; } mpu = ark -> mpurx . v ; num_q = ark_api_num_queues ( mpu ) ; ark -> rx_queues = num_q ; for ( i = 0 ; i < num_q ; i ++ ) { ark_mpu_reset ( mpu ) ; mpu = RTE_PTR_ADD ( mpu , ARK_MPU_QOFFSET ) ; } ark_udm_stop ( ark -> udm . v , 0 ) ; ark_udm_configure ( ark -> udm . v , RTE_PKTMBUF_HEADROOM , RTE_MBUF_DEFAULT_DATAROOM , ARK_RX_WRITE_TIME_NS ) ; ark_udm_stats_reset ( ark -> udm . v ) ; ark_udm_stop ( ark -> udm . v , 0 ) ; if ( ark_ddm_stop ( ark -> ddm . v , 1 ) ) ARK_PMD_LOG ( ERR , " \n " ) ; mpu = ark -> mputx . v ; num_q = ark_api_num_queues ( mpu ) ; ark -> tx_queues = num_q ; for ( i = 0 ; i < num_q ; i ++ ) { ark_mpu_reset ( mpu ) ; mpu = RTE_PTR_ADD ( mpu , ARK_MPU_QOFFSET ) ; } ark_ddm_reset ( ark -> ddm . v ) ; ark_ddm_stats_reset ( ark -> ddm . v ) ; ark_ddm_stop ( ark -> ddm . v , 0 ) ; ark_rqp_stats_reset ( ark -> rqpacing ) ; return 0 ; }
Initial device configuration when device is opened
 setup the DDM, and UDM
 Called once per PCIE device
Initial device configuration when device is opened setup the DDM and UDM Called once per PCIE device
/*
	 * Make sure that the packet director, generator and checker are in a
	 * known state
	 */ /* Verify HW */ /* UDM */ /* Keep in reset until the MPU are cleared */ /* MPU reset */ /* TX -- DDM */