DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: William Tu <u9012063@gmail.com>
Cc: Qi Zhang <qi.z.zhang@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	Karlsson Magnus <magnus.karlsson@intel.com>,
	Topel Bjorn <bjorn.topel@intel.com>,
	dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/af_xdp: enable zero copy by extbuf
Date: Wed, 12 Jun 2019 18:03:39 +0800
Message-ID: <20190612100339.GA32720@intel.com> (raw)
In-Reply-To: <CALDO+SYThUjdjBsc+0JGKCVnCRGYj4ryvgJ_uM8hD3NVn8U-Gg@mail.gmail.com>

Hi, 

On 06/11, William Tu wrote:
[snip]
>> @@ -294,16 +326,26 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>>
>>                 desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx + i);
>>                 mbuf = bufs[i];
>> -
>> -               desc->addr = (uint64_t)addrs[i];
>>                 desc->len = mbuf->pkt_len;
>> -               pkt = xsk_umem__get_data(umem->mz->addr,
>> -                                        desc->addr);
>> -               rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *),
>> -                          desc->len);
>> -               tx_bytes += mbuf->pkt_len;
>>
>> -               rte_pktmbuf_free(mbuf);
>> +               /*
>> +                * We need to make sure the external mbuf address is within
>> +                * current port's umem memzone range
>> +                */
>> +               if (pmd_zc && RTE_MBUF_HAS_EXTBUF(mbuf) &&
>> +                               in_umem_range(umem, (uint64_t)mbuf->buf_addr)) {
>> +                       desc->addr = (uint64_t)mbuf->buf_addr -
>> +                               umem->mz->addr_64;
>> +                       mbuf->buf_addr = xsk_umem__get_data(umem->mz->addr,
>> +                                       (uint64_t)addrs[i]);
>> +               } else {
>> +                       desc->addr = (uint64_t)addrs[i];
>> +                       pkt = xsk_umem__get_data(umem->mz->addr,
>> +                                       desc->addr);
>> +                       rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *),
>> +                                       desc->len);
>> +               }
>> +               tx_bytes += mbuf->pkt_len;
>>         }
>>
>>         xsk_ring_prod__submit(&txq->tx, nb_pkts);
>> @@ -313,6 +355,9 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>>         txq->stats.tx_pkts += nb_pkts;
>>         txq->stats.tx_bytes += tx_bytes;
>>
>> +       for (i = 0; i < nb_pkts; i++)
>> +               rte_pktmbuf_free(bufs[i]);
>> +
>
>Is it ok to free the mbuf here?
>If the AF_XDP is running pmd_zc=true, the packet mbuf is still in the tx
>ring and might not be sent out yet.

For pmd_zc=ture case, here mbuf->buf_addr has been exchanged to available addr
dequeued from umem->buf_ring, rte_pktmbuf_free would just call the free callback
umem_buf_release_to_fq to enqueue the addr to the buf_ring.

Thanks,
Xiaolong

>
>Regards,
>William
>

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15  8:38 [dpdk-dev] [PATCH v1 0/3] add more features for AF_XDP pmd Xiaolong Ye
2019-05-15  8:38 ` [dpdk-dev] [PATCH v1 1/3] net/af_xdp: enable zero copy by extbuf Xiaolong Ye
2019-05-15  8:38 ` [dpdk-dev] [PATCH v1 2/3] net/af_xdp: add multi-queue support Xiaolong Ye
2019-05-15  8:38 ` [dpdk-dev] [PATCH v1 3/3] net/af_xdp: add busy poll support Xiaolong Ye
2019-05-30  9:07 ` [dpdk-dev] [PATCH v2 0/3] add more features for AF_XDP pmd Xiaolong Ye
2019-05-30  9:07   ` [dpdk-dev] [PATCH v2 1/3] net/af_xdp: enable zero copy by extbuf Xiaolong Ye
2019-05-30 15:31     ` Stephen Hemminger
2019-05-31  1:49       ` Ye Xiaolong
2019-06-11 16:16     ` William Tu
2019-06-12 10:03       ` Ye Xiaolong [this message]
2019-06-13  0:32         ` William Tu
2019-05-30  9:07   ` [dpdk-dev] [PATCH v2 2/3] net/af_xdp: add multi-queue support Xiaolong Ye
2019-05-30 15:32     ` Stephen Hemminger
2019-05-31  1:53       ` Ye Xiaolong
2019-05-30  9:07   ` [dpdk-dev] [PATCH v2 3/3] net/af_xdp: remove unused struct member Xiaolong Ye
2019-06-10 16:54   ` [dpdk-dev] [PATCH v2 0/3] add more features for AF_XDP pmd Ferruh Yigit

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190612100339.GA32720@intel.com \
    --to=xiaolong.ye@intel.com \
    --cc=bjorn.topel@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=u9012063@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox