[dpdk-dev] [PATCH v3 1/5] net/af_xdp: introduce AF XDP PMD driver

Stephen Hemminger stephen at networkplumber.org
Thu Mar 21 16:25:51 CET 2019


On Thu, 21 Mar 2019 17:18:41 +0800
Xiaolong Ye <xiaolong.ye at intel.com> wrote:

> +	for (i = 0; i < rcvd; i++) {
> +		const struct xdp_desc *desc;
> +		uint64_t addr;
> +		uint32_t len;
> +		void *pkt;
> +
> +		desc = xsk_ring_cons__rx_desc(rx, idx_rx++);
> +		addr = desc->addr;
> +		len = desc->len;
> +		pkt = xsk_umem__get_data(rxq->umem->buffer, addr);
> +
> +		mbuf = rte_pktmbuf_alloc(rxq->mb_pool);

You could use rte_pktmbuf_alloc_bulk to get the mbufs in one call
before doing this. It saves rcvd-1 atomic operations.


More information about the dev mailing list