From: Jakub Kicinski <kuba@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, gospo@broadcom.com, bpf@vger.kernel.org,
somnath.kotur@broadcom.com,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH net-next 3/3] bnxt_en: Let the page pool manage the DMA mapping
Date: Mon, 31 Jul 2023 11:44:27 -0700 [thread overview]
Message-ID: <20230731114427.0da1f73b@kernel.org> (raw)
In-Reply-To: <CACKFLinHWLMScGbYKZ+zNAn2iV1zqLkNVWDMQwJRZYd-yRiY7g@mail.gmail.com>
On Mon, 31 Jul 2023 11:16:55 -0700 Michael Chan wrote:
> > > Remember pp.max_len is used for dma_sync_for_device.
> > > If driver is smart, it can set pp.max_len according to MTU, as the (DMA
> > > sync for) device knows hardware will not go beyond this.
> > > On Intel "dma_sync_for_device" is a no-op, so most drivers done
> > > optimized for this. I remember is had HUGE effects on ARM EspressoBin board.
> >
> > Note that (AFAIU) there is no MTU here, these are pages for LRO/GRO,
> > they will be filled with TCP payload start to end. page_pool_put_page()
> > does nothing for non-last frag, so we'll only sync for the last
> > (BNXT_RX_PAGE-sized) frag released, and we need to sync the entire
> > host page.
>
> Correct, there is no MTU here. Remember this matters only when
> PAGE_SIZE > BNXT_RX_PAGE_SIZE (e.g. 64K PAGE_SIZE and 32K
> BNXT_RX_PAGE_SIZE). I think we want to dma_sync_for_device for 32K in
> this case.
Maybe I'm misunderstanding. Let me tell you how I think this works and
perhaps we should update the docs based on this discussion.
Note that the max_len is applied to the full host page when the full
host page is returned. Not to fragments, and not at allocation.
The .max_len is the max offset within the host page that the HW may
access. For page-per-packet, 1500B MTU this could matter quite a bit,
because we only have to sync ~1500B rather than 4096B.
some wasted headroom/padding, pp.offset can be used to skip
/ device may touch this section
/ / device will not touch, sync not needed
/ / /
|**| ===== MTU 1500B ====== | - skb_shinfo and unused --- |
<------ .max_len -------->
For fragmented pages it becomes:
middle skb_shinfo
/ remainder
/ |
|**| == MTU == | - shinfo- |**| == MTU == | - shinfo- |+++|
<------------ .max_len ---------------->
So max_len will only exclude the _last_ shinfo and the wasted space
(reminder of dividing page by buffer size). We must sync _all_ packet
sections ("== MTU ==") within the packet.
In bnxt's case - the page is fragmented (latter diagram), and there is
no start offset or wasted space. Ergo .max_len = PAGE_SIZE.
Where did I get off the track?
next prev parent reply other threads:[~2023-07-31 18:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 23:18 [PATCH net-next 0/3] bnxt_en: Add support for page pool Michael Chan
2023-07-28 23:18 ` [PATCH net-next 1/3] bnxt_en: Fix page pool logic for page size >= 64K Michael Chan
2023-07-29 0:35 ` Jakub Kicinski
2023-07-28 23:18 ` [PATCH net-next 2/3] bnxt_en: Use the unified RX page pool buffers for XDP and non-XDP Michael Chan
2023-07-28 23:18 ` [PATCH net-next 3/3] bnxt_en: Let the page pool manage the DMA mapping Michael Chan
2023-07-29 0:42 ` Jakub Kicinski
2023-07-31 17:47 ` Jesper Dangaard Brouer
2023-07-31 18:00 ` Jakub Kicinski
2023-07-31 18:16 ` Michael Chan
2023-07-31 18:44 ` Jakub Kicinski [this message]
2023-07-31 20:20 ` Michael Chan
2023-07-31 20:44 ` Jakub Kicinski
2023-07-31 21:11 ` Michael Chan
2023-08-01 17:06 ` Jesper Dangaard Brouer
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=20230731114427.0da1f73b@kernel.org \
--to=kuba@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gospo@broadcom.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=somnath.kotur@broadcom.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 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.