DPDK patches and discussions
 help / color / mirror / 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	[thread overview]
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	other threads:[~2019-06-12  3:21 UTC|newest]

Thread overview: 20+ 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 ` 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   ` 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   ` Xiaolong Ye
2019-05-15  8:38 ` [dpdk-dev] [PATCH v1 3/3] net/af_xdp: add busy poll support Xiaolong Ye
2019-05-15  8:38   ` 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 publicly 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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).