linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: grygorii.strashko@ti.com, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	hawk@kernel.org, xdp-newbies@vger.kernel.org, ast@kernel.org,
	aniel@iogearbox.net, jakub.kicinski@netronome.com,
	john.fastabend@gmail.com
Subject: Re: [RFC PATCH 3/3] net: ethernet: ti: cpsw: add XDP support
Date: Fri, 19 Apr 2019 13:42:30 +0300	[thread overview]
Message-ID: <20190419104228.GA4268@khorivan> (raw)
In-Reply-To: <20190419083156.GA6687@apalos>

On Fri, Apr 19, 2019 at 11:31:56AM +0300, Ilias Apalodimas wrote:
>Hi Ivan,
>
>> +static struct page *cpsw_alloc_page(struct cpsw_common *cpsw)
>> +{
>> +	struct page_pool *pool = cpsw->rx_page_pool;
>> +	struct page *page;
>> +	int i = 0;
>> +
>> +	do {
>> +		page = page_pool_dev_alloc_pages(pool);
>> +		if (!page)
>> +			return NULL;
>> +
>> +		/* skip pages used by skb netstack */
>I think the comment here is wrong and might confuse people.
>The page ref cnt is 1, which means the packet was *processed* and netstack is
>done with it, hence you can re-use it.
>If it's !=1 then you correctly unmap the buffer and decrease the ref cnt, so it
>will eventually be freed and not returned to the pool, right?
It's compensation substitution for page_pool support in skb netsack.
And should be considered in combine with:

skb = build_skb(xmeta, cpsw_rxbuf_total_len(pkt_size));
...
page_pool_recycle_direct(pool, page);
page_ref_inc(page);
netif_receive_skb(skb);

Here order is important.

I will correct comments in final version (w/o overloading) ofc, leaving
thinking environment for people. I think it's fair enough about this.

>> +		if (page_ref_count(page) == 1)
>> +			break;
>> +
>> +		/* it's a pitty, but free page */
>> +		page_pool_recycle_direct(pool, page);
>> +	} while (++i < descs_pool_size);
>> +
>> +	return page;
>> +}
>> +
>
> /Ilias

-- 
Regards,
Ivan Khoronzhuk

  reply	other threads:[~2019-04-19 19:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 17:49 [RFC PATCH 0/3] net: ethernet: ti: cpsw: Add XDP support Ivan Khoronzhuk
2019-04-17 17:49 ` [RFC PATCH 1/3] net: ethernet: ti: davinci_cpdma: add dma mapped submit Ivan Khoronzhuk
2019-04-17 17:49 ` [RFC PATCH 2/3] net: ethernet: ti: davinci_cpdma: return handler status Ivan Khoronzhuk
2019-04-17 17:49 ` [RFC PATCH 3/3] net: ethernet: ti: cpsw: add XDP support Ivan Khoronzhuk
2019-04-17 22:46   ` Jakub Kicinski
2019-04-18  9:40     ` Ivan Khoronzhuk
2019-04-18 17:41       ` Jakub Kicinski
2019-04-18 18:30         ` Ivan Khoronzhuk
2019-04-18 18:44           ` Jakub Kicinski
2019-04-19  8:31   ` Ilias Apalodimas
2019-04-19 10:42     ` Ivan Khoronzhuk [this message]
2019-04-18  6:12 ` [RFC PATCH 0/3] net: ethernet: ti: cpsw: Add " Björn Töpel
2019-04-18  9:47   ` Ivan Khoronzhuk
2019-04-19  8:24 ` Grygorii Strashko

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=20190419104228.GA4268@khorivan \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=aniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.org \
    /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).