[dpdk-dev] [PATCH 06/44] event/octeontx2: allocate event inflight buffers

Jerin Jacob Kollanukkaran jerinj at marvell.com
Mon Jun 17 09:56:43 CEST 2019


> -----Original Message-----
> From: pbhagavatula at marvell.com <pbhagavatula at marvell.com>
> Sent: Sunday, June 2, 2019 12:23 AM
> To: Jerin Jacob Kollanukkaran <jerinj at marvell.com>; Pavan Nikhilesh
> Bhagavatula <pbhagavatula at marvell.com>
> Cc: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 06/44] event/octeontx2: allocate event inflight
> buffers
> 
> From: Pavan Nikhilesh <pbhagavatula at marvell.com>
> 
> Allocate buffers in DRAM that hold inflight events.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
> ---
> 
> +static int
> +sso_xaq_allocate(struct otx2_sso_evdev *dev) {
> +	const struct rte_memzone *mz;
> +	struct npa_aura_s *aura;
> +	static int reconfig_cnt;
> +	char pool_name[30];

Use RTE_MEMZONE_NAMESIZE

> +	if (mz == NULL) {
> +		otx2_err("failed to allocate mem for fcmem");
> +		return -ENOMEM;
> +	}
> +
> +	dev->fc_iova = mz->iova;
> +	dev->fc_mem = mz->addr;
> +
> +	aura = (struct npa_aura_s *)((uintptr_t)dev->fc_mem + OTX2_ALIGN);
> +	memset(aura, 0, sizeof(struct npa_aura_s));
> +
> +	aura->fc_ena = 1;
> +	aura->fc_addr = dev->fc_iova;
> +	aura->fc_hyst_bits = 0; /* Store count on all updates */
> +
> +	/* Taken from HRM 14.3.3(4) */
> +	xaq_cnt = dev->nb_event_queues * OTX2_SSO_XAQ_CACHE_CNT;
> +	xaq_cnt += (dev->iue / dev->xae_waes) +
> +			(OTX2_SSO_XAQ_SLACK * dev->nb_event_queues);
> +
> +	otx2_sso_dbg("configuring %d xaq buffers", xaq_cnt);
> +	/* Setup XAQ based on number of nb queues. */
> +	snprintf(pool_name, 30, "otx2_xaq_buf_pool_%d", reconfig_cnt);
> +	dev->xaq_pool = (void *)rte_mempool_create_empty(pool_name,
> +			xaq_cnt, dev->xaq_buf_size, 0, 0,
> +			rte_socket_id(), 0);
> +
> +	if (dev->xaq_pool == NULL) {
> +		otx2_err("unable to create empty mempool.");
> +		rte_memzone_free(mz);
> +		return -ENOMEM;
> +	}
> +
> +	rc = rte_mempool_set_ops_byname(dev->xaq_pool,
> +					rte_mbuf_platform_mempool_ops(),
> aura);
> +	if (rc != 0) {
> +		otx2_err("unable to set xaqpool ops.");
> +		goto alloc_fail;
> +	}
> +
> +	rc = rte_mempool_populate_default(dev->xaq_pool);
> +	if (rc < 0) {
> +		otx2_err("unable to set populate xaqpool.");
> +		goto alloc_fail;
> +	}
> +	reconfig_cnt++;
> +	dev->xaq_lmt = xaq_cnt - (OTX2_SSO_XAQ_SLACK / 2 *
> +				  dev->nb_event_queues);

Add comment on why divide by 2.




More information about the dev mailing list