From: Leon Romanovsky <leon@kernel.org>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: "linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Dexuan Cui <decui@microsoft.com>,
KY Srinivasan <kys@microsoft.com>,
Paul Rosswurm <paulros@microsoft.com>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"vkuznets@redhat.com" <vkuznets@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
Long Li <longli@microsoft.com>,
"ssengar@linux.microsoft.com" <ssengar@linux.microsoft.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
Ajay Sharma <sharmaajay@microsoft.com>,
"hawk@kernel.org" <hawk@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3,net-next, 2/4] net: mana: Refactor RX buffer allocation code to prepare for various MTU
Date: Thu, 13 Apr 2023 19:30:59 +0300 [thread overview]
Message-ID: <20230413163059.GS17993@unreal> (raw)
In-Reply-To: <PH7PR21MB3116194E8F7D56EB434B56A6CA989@PH7PR21MB3116.namprd21.prod.outlook.com>
On Thu, Apr 13, 2023 at 02:03:50PM +0000, Haiyang Zhang wrote:
>
>
> > -----Original Message-----
> > From: Leon Romanovsky <leon@kernel.org>
> > Sent: Thursday, April 13, 2023 9:04 AM
> > To: Haiyang Zhang <haiyangz@microsoft.com>
> > Cc: linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; Dexuan Cui
> > <decui@microsoft.com>; KY Srinivasan <kys@microsoft.com>; Paul Rosswurm
> > <paulros@microsoft.com>; olaf@aepfle.de; vkuznets@redhat.com;
> > davem@davemloft.net; wei.liu@kernel.org; edumazet@google.com;
> > kuba@kernel.org; pabeni@redhat.com; Long Li <longli@microsoft.com>;
> > ssengar@linux.microsoft.com; linux-rdma@vger.kernel.org;
> > daniel@iogearbox.net; john.fastabend@gmail.com; bpf@vger.kernel.org;
> > ast@kernel.org; Ajay Sharma <sharmaajay@microsoft.com>;
> > hawk@kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH V3,net-next, 2/4] net: mana: Refactor RX buffer allocation
> > code to prepare for various MTU
> >
> > On Wed, Apr 12, 2023 at 02:16:01PM -0700, Haiyang Zhang wrote:
> > > Move out common buffer allocation code from mana_process_rx_cqe() and
> > > mana_alloc_rx_wqe() to helper functions.
> > > Refactor related variables so they can be changed in one place, and buffer
> > > sizes are in sync.
> > >
> > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > > Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> > > ---
> > > V3:
> > > Refectored to multiple patches for readability. Suggested by Jacob Keller.
> > >
> > > V2:
> > > Refectored to multiple patches for readability. Suggested by Yunsheng Lin.
> > >
> > > ---
> > > drivers/net/ethernet/microsoft/mana/mana_en.c | 154 ++++++++++-------
> > -
> > > include/net/mana/mana.h | 6 +-
> > > 2 files changed, 91 insertions(+), 69 deletions(-)
> >
> > <...>
> >
> > > +static void *mana_get_rxfrag(struct mana_rxq *rxq, struct device *dev,
> > > + dma_addr_t *da, bool is_napi)
> > > +{
> > > + struct page *page;
> > > + void *va;
> > > +
> > > + /* Reuse XDP dropped page if available */
> > > + if (rxq->xdp_save_va) {
> > > + va = rxq->xdp_save_va;
> > > + rxq->xdp_save_va = NULL;
> > > + } else {
> > > + page = dev_alloc_page();
> >
> > Documentation/networking/page_pool.rst
> > 10 Basic use involves replacing alloc_pages() calls with the
> > 11 page_pool_alloc_pages() call. Drivers should use
> > page_pool_dev_alloc_pages()
> > 12 replacing dev_alloc_pages().
> >
> > General question, is this sentence applicable to all new code or only
> > for XDP related paths?
>
> Quote from the context before that sentence --
>
> =============
> Page Pool API
> =============
> The page_pool allocator is optimized for the XDP mode that uses one frame
> per-page, but it can fallback on the regular page allocator APIs.
> Basic use involves replacing alloc_pages() calls with the
> page_pool_alloc_pages() call. Drivers should use page_pool_dev_alloc_pages()
> replacing dev_alloc_pages().
>
> --unquote
>
> So the page pool is optimized for the XDP, and that sentence is applicable to drivers
> that have set up page pool for XDP optimization.
"but it can fallback on the regular page allocator APIs."
> static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool) //need a pool been set up
>
> Back to our mana driver, we don't have page pool setup yet. (will consider in the future)
> So we cannot call page_pool_dev_alloc_pages(pool) in this place yet.
ok, thanks
>
> Thanks,
> - Haiyang
>
next prev parent reply other threads:[~2023-04-13 16:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 21:15 [PATCH V3,net-next, 0/4] net: mana: Add support for jumbo frame Haiyang Zhang
2023-04-12 21:16 ` [PATCH V3,net-next, 1/4] net: mana: Use napi_build_skb in RX path Haiyang Zhang
2023-04-12 21:16 ` [PATCH V3,net-next, 2/4] net: mana: Refactor RX buffer allocation code to prepare for various MTU Haiyang Zhang
2023-04-13 13:04 ` Leon Romanovsky
2023-04-13 14:03 ` Haiyang Zhang
2023-04-13 16:30 ` Leon Romanovsky [this message]
2023-04-13 16:40 ` Jakub Kicinski
2023-04-13 16:59 ` Leon Romanovsky
2023-04-13 17:01 ` Jakub Kicinski
2023-04-15 2:04 ` Jakub Kicinski
2023-04-15 14:09 ` Haiyang Zhang
2023-04-12 21:16 ` [PATCH V3,net-next, 3/4] net: mana: Enable RX path to handle various MTU sizes Haiyang Zhang
2023-04-15 2:06 ` Jakub Kicinski
2023-04-15 14:25 ` Haiyang Zhang
2023-04-17 17:52 ` Jakub Kicinski
2023-04-17 19:52 ` Haiyang Zhang
2023-04-12 21:16 ` [PATCH V3,net-next, 4/4] net: mana: Add support for jumbo frame Haiyang Zhang
2023-04-15 2:08 ` [PATCH V3,net-next, 0/4] " Jakub Kicinski
2023-04-15 14:11 ` Haiyang Zhang
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=20230413163059.GS17993@unreal \
--to=leon@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=pabeni@redhat.com \
--cc=paulros@microsoft.com \
--cc=sharmaajay@microsoft.com \
--cc=ssengar@linux.microsoft.com \
--cc=vkuznets@redhat.com \
--cc=wei.liu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.