[dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone

Wu, Jingjing jingjing.wu at intel.com
Fri Nov 6 06:39:46 CET 2015


> -	static uint64_t id = 0;
>  	const struct rte_memzone *mz = NULL;
>  	char z_name[RTE_MEMZONE_NAMESIZE];
> 
>  	if (!mem)
>  		return I40E_ERR_PARAM;
> 
> -	id++;
> -	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
> +	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());

Why change id++ to rte_rand() ?

>  #ifdef RTE_LIBRTE_XEN_DOM0
>  	mz = rte_memzone_reserve_bounded(z_name, size,
> SOCKET_ID_ANY, 0,
>  					 alignment, RTE_PGSIZE_2M);
> @@ -2929,7 +2927,6 @@
> i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
>  	if (!mz)
>  		return I40E_ERR_NO_MEMORY;
> 
> -	mem->id = id;
>  	mem->size = size;
>  	mem->va = mz->addr;
>  #ifdef RTE_LIBRTE_XEN_DOM0
> @@ -2937,6 +2934,8 @@
> i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> #else
>  	mem->pa = mz->phys_addr;
>  #endif
> +	mem->zone = (const void *)mz;
> +	PMD_DRV_LOG(DEBUG, "memzone allocated: %p", mem->zone);
> 
Why not print the name of mem_zone instead of pointer?


Thanks
Jingjing


More information about the dev mailing list