src/dpdk/drivers/net/bnxt/bnxt_ring.c
int bnxt_alloc_async_cp_ring(struct bnxt *bp)
{
	struct bnxt_cp_ring_info *cpr = bp->async_cp_ring;
	struct bnxt_ring *cp_ring;
	uint8_t ring_type;
	int rc;

	if (BNXT_NUM_ASYNC_CPR(bp) == 0 || cpr == NULL)
		return 0;

	cp_ring = cpr->cp_ring_struct;

	if (BNXT_HAS_NQ(bp))
		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ;
	else
		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;

	rc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, 0,
				  HWRM_NA_SIGNATURE, HWRM_NA_SIGNATURE, 0);

	if (rc)
		return rc;

	cpr->cp_raw_cons = 0;
	cpr->valid = 0;
	bnxt_set_db(bp, &cpr->cp_db, ring_type, 0,
		    cp_ring->fw_ring_id, cp_ring->ring_mask);

	if (BNXT_HAS_NQ(bp))
		bnxt_db_nq(cpr);
	else
		bnxt_db_cq(cpr);

	return bnxt_hwrm_set_async_event_cr(bp);
}
/* Allocate dedicated async completion ring. */
Allocate dedicated async completion ring.
Allocate dedicated async completion ring .
int bnxt_alloc_async_cp_ring(struct bnxt *bp)
{
	struct bnxt_cp_ring_info *cpr = bp->async_cp_ring;
	struct bnxt_ring *cp_ring;
	uint8_t ring_type;
	int rc;
	if (BNXT_NUM_ASYNC_CPR(bp) == 0 || cpr == NULL)
		return 0;
	cp_ring = cpr->cp_ring_struct;
	if (BNXT_HAS_NQ(bp))
		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ;
	else
		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;
	rc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, 0,
				  HWRM_NA_SIGNATURE, HWRM_NA_SIGNATURE, 0);
	if (rc)
		return rc;
	cpr->cp_raw_cons = 0;
	cpr->valid = 0;
	bnxt_set_db(bp, &cpr->cp_db, ring_type, 0,
		    cp_ring->fw_ring_id, cp_ring->ring_mask);
	if (BNXT_HAS_NQ(bp))
		bnxt_db_nq(cpr);
	else
		bnxt_db_cq(cpr);
	return bnxt_hwrm_set_async_event_cr(bp);
}
int bnxt_alloc_async_cp_ring ( struct bnxt * bp ) { struct bnxt_cp_ring_info * cpr = bp -> async_cp_ring ; struct bnxt_ring * cp_ring ; uint8_t ring_type ; int rc ; if ( BNXT_NUM_ASYNC_CPR ( bp ) == 0 || cpr == NULL ) return 0 ; cp_ring = cpr -> cp_ring_struct ; if ( BNXT_HAS_NQ ( bp ) ) ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ ; else ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL ; rc = bnxt_hwrm_ring_alloc ( bp , cp_ring , ring_type , 0 , HWRM_NA_SIGNATURE , HWRM_NA_SIGNATURE , 0 ) ; if ( rc ) return rc ; cpr -> cp_raw_cons = 0 ; cpr -> valid = 0 ; bnxt_set_db ( bp , & cpr -> cp_db , ring_type , 0 , cp_ring -> fw_ring_id , cp_ring -> ring_mask ) ; if ( BNXT_HAS_NQ ( bp ) ) bnxt_db_nq ( cpr ) ; else bnxt_db_cq ( cpr ) ; return bnxt_hwrm_set_async_event_cr ( bp ) ; }
Allocate dedicated async completion ring.
Allocate dedicated async completion ring .