src/dpdk/lib/librte_mbuf/rte_mbuf_dyn.c
static int
init_shared_mem(void)
{
	const struct rte_memzone *mz;
	uint64_t mask;

	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
		mz = rte_memzone_reserve_aligned(RTE_MBUF_DYN_MZNAME,
						sizeof(struct mbuf_dyn_shm),
						SOCKET_ID_ANY, 0,
						RTE_CACHE_LINE_SIZE);
	} else {
		mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME);
	}
	if (mz == NULL)
		return -1;

	shm = mz->addr;

	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
		/* init free_space, keep it sync'd with
		 * rte_mbuf_dynfield_copy().
		 */
		memset(shm, 0, sizeof(*shm));
		mark_free(dynfield1);

		/* init free_flags */
		for (mask = PKT_FIRST_FREE; mask <= PKT_LAST_FREE; mask <<= 1)
			shm->free_flags |= mask;

		process_score();
	}

	return 0;
}
/* Allocate and initialize the shared memory. Assume tailq is locked */
Allocate and initialize the shared memory. Assume tailq is locked
Allocate and initialize the shared memory . Assume tailq is locked
static int
init_shared_mem(void)
{
	const struct rte_memzone *mz;
	uint64_t mask;
	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
		mz = rte_memzone_reserve_aligned(RTE_MBUF_DYN_MZNAME,
						sizeof(struct mbuf_dyn_shm),
						SOCKET_ID_ANY, 0,
						RTE_CACHE_LINE_SIZE);
	} else {
		mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME);
	}
	if (mz == NULL)
		return -1;
	shm = mz->addr;
	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
		memset(shm, 0, sizeof(*shm));
		mark_free(dynfield1);
		for (mask = PKT_FIRST_FREE; mask <= PKT_LAST_FREE; mask <<= 1)
			shm->free_flags |= mask;
		process_score();
	}
	return 0;
}
static int init_shared_mem ( void ) { const struct rte_memzone * mz ; uint64_t mask ; if ( rte_eal_process_type ( ) == RTE_PROC_PRIMARY ) { mz = rte_memzone_reserve_aligned ( RTE_MBUF_DYN_MZNAME , sizeof ( struct mbuf_dyn_shm ) , SOCKET_ID_ANY , 0 , RTE_CACHE_LINE_SIZE ) ; } else { mz = rte_memzone_lookup ( RTE_MBUF_DYN_MZNAME ) ; } if ( mz == NULL ) return -1 ; shm = mz -> addr ; if ( rte_eal_process_type ( ) == RTE_PROC_PRIMARY ) { memset ( shm , 0 , sizeof ( * shm ) ) ; mark_free ( dynfield1 ) ; for ( mask = PKT_FIRST_FREE ; mask <= PKT_LAST_FREE ; mask <<= 1 ) shm -> free_flags |= mask ; process_score ( ) ; } return 0 ; }
Allocate and initialize the shared memory.
Allocate and initialize the shared memory .
/* init free_space, keep it sync'd with
		 * rte_mbuf_dynfield_copy().
		 */ /* init free_flags */