src/dpdk/drivers/net/bnxt/tf_ulp/ulp_mapper.c
static int32_t
ulp_mapper_resource_ident_allocate(struct bnxt_ulp_context *ulp_ctx,
				   struct bnxt_ulp_mapper_data *mapper_data,
				   struct bnxt_ulp_glb_resource_info *glb_res)
{
	struct tf_alloc_identifier_parms iparms = { 0 };
	struct tf_free_identifier_parms fparms;
	uint64_t regval;
	struct tf *tfp;
	int32_t rc = 0;

	tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
	if (!tfp)
		return -EINVAL;

	iparms.ident_type = glb_res->resource_type;
	iparms.dir = glb_res->direction;

	/* Allocate the Identifier using tf api */
	rc = tf_alloc_identifier(tfp, &iparms);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
			    (iparms.dir == TF_DIR_RX) ? "RX" : "TX",
			    iparms.ident_type);
		return rc;
	}

	/* entries are stored as big-endian format */
	regval = tfp_cpu_to_be_64((uint64_t)iparms.id);
	/* write to the mapper global resource */
	rc = ulp_mapper_glb_resource_write(mapper_data, glb_res, regval);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to write to global resource id\n");
		/* Free the identifier when update failed */
		fparms.dir = iparms.dir;
		fparms.ident_type = iparms.ident_type;
		fparms.id = iparms.id;
		tf_free_identifier(tfp, &fparms);
		return rc;
	}
	return rc;
}
/*
 * Internal function to allocate identity resource and store it in mapper data.
 *
 * returns 0 on success
 */
Internal function to allocate identity resource and store it in mapper data.
returns 0 on success
Internal function to allocate identity resource and store it in mapper data . returns 0 on success
static int32_t
ulp_mapper_resource_ident_allocate(struct bnxt_ulp_context *ulp_ctx,
				   struct bnxt_ulp_mapper_data *mapper_data,
				   struct bnxt_ulp_glb_resource_info *glb_res)
{
	struct tf_alloc_identifier_parms iparms = { 0 };
	struct tf_free_identifier_parms fparms;
	uint64_t regval;
	struct tf *tfp;
	int32_t rc = 0;
	tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
	if (!tfp)
		return -EINVAL;
	iparms.ident_type = glb_res->resource_type;
	iparms.dir = glb_res->direction;
	rc = tf_alloc_identifier(tfp, &iparms);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
			    (iparms.dir == TF_DIR_RX) ? "RX" : "TX",
			    iparms.ident_type);
		return rc;
	}
	regval = tfp_cpu_to_be_64((uint64_t)iparms.id);
	rc = ulp_mapper_glb_resource_write(mapper_data, glb_res, regval);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to write to global resource id\n");
		fparms.dir = iparms.dir;
		fparms.ident_type = iparms.ident_type;
		fparms.id = iparms.id;
		tf_free_identifier(tfp, &fparms);
		return rc;
	}
	return rc;
}
static int32_t ulp_mapper_resource_ident_allocate ( struct bnxt_ulp_context * ulp_ctx , struct bnxt_ulp_mapper_data * mapper_data , struct bnxt_ulp_glb_resource_info * glb_res ) { struct tf_alloc_identifier_parms iparms = { 0 } ; struct tf_free_identifier_parms fparms ; uint64_t regval ; struct tf * tfp ; int32_t rc = 0 ; tfp = bnxt_ulp_cntxt_tfp_get ( ulp_ctx ) ; if ( ! tfp ) return - EINVAL ; iparms . ident_type = glb_res -> resource_type ; iparms . dir = glb_res -> direction ; rc = tf_alloc_identifier ( tfp , & iparms ) ; if ( rc ) { BNXT_TF_DBG ( ERR , " \n " , ( iparms . dir == TF_DIR_RX ) ? " " : " " , iparms . ident_type ) ; return rc ; } regval = tfp_cpu_to_be_64 ( ( uint64_t ) iparms . id ) ; rc = ulp_mapper_glb_resource_write ( mapper_data , glb_res , regval ) ; if ( rc ) { BNXT_TF_DBG ( ERR , " \n " ) ; fparms . dir = iparms . dir ; fparms . ident_type = iparms . ident_type ; fparms . id = iparms . id ; tf_free_identifier ( tfp , & fparms ) ; return rc ; } return rc ; }
Internal function to allocate identity resource and store it in mapper data.
Internal function to allocate identity resource and store it in mapper data .
/* Allocate the Identifier using tf api */ /* entries are stored as big-endian format */ /* write to the mapper global resource */ /* Free the identifier when update failed */