From: Jakub Kicinski <kuba@kernel.org>
To: Taehee Yoo <ap420073@gmail.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
andrew+netdev@lunn.ch, horms@kernel.org,
michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
hawk@kernel.org, ilias.apalodimas@linaro.org,
netdev@vger.kernel.org, dw@davidwei.uk, kuniyu@amazon.com,
sdf@fomichev.me, ahmed.zaki@intel.com,
aleksander.lobakin@intel.com, hongguang.gao@broadcom.com,
Mina Almasry <almasrymina@google.com>
Subject: Re: [PATCH v2 net-next] eth: bnxt: add support rx side device memory TCP
Date: Mon, 14 Apr 2025 15:47:16 -0700 [thread overview]
Message-ID: <20250414154716.67412a8d@kernel.org> (raw)
In-Reply-To: <20250410074351.4155508-1-ap420073@gmail.com>
On Thu, 10 Apr 2025 07:43:51 +0000 Taehee Yoo wrote:
> @@ -1251,27 +1269,41 @@ static u32 __bnxt_rx_agg_pages(struct bnxt *bp,
> RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
>
> cons_rx_buf = &rxr->rx_agg_ring[cons];
> - skb_frag_fill_page_desc(frag, cons_rx_buf->page,
> - cons_rx_buf->offset, frag_len);
> - shinfo->nr_frags = i + 1;
> + if (skb) {
> + skb_add_rx_frag_netmem(skb, i, cons_rx_buf->netmem,
> + cons_rx_buf->offset,
> + frag_len, BNXT_RX_PAGE_SIZE);
I thought BNXT_RX_PAGE_SIZE is the max page size supported by HW.
We currently only allocate order 0 pages/netmems, so the truesize
calculation should use PAGE_SIZE, AFAIU?
> + } else {
> + skb_frag_t *frag = &shinfo->frags[i];
> +
> + skb_frag_fill_netmem_desc(frag, cons_rx_buf->netmem,
> + cons_rx_buf->offset,
> + frag_len);
> + shinfo->nr_frags = i + 1;
> + }
> __clear_bit(cons, rxr->rx_agg_bmap);
>
> - /* It is possible for bnxt_alloc_rx_page() to allocate
> + /* It is possible for bnxt_alloc_rx_netmem() to allocate
> * a sw_prod index that equals the cons index, so we
> * need to clear the cons entry now.
> */
> - mapping = cons_rx_buf->mapping;
> - page = cons_rx_buf->page;
> - cons_rx_buf->page = NULL;
> + netmem = cons_rx_buf->netmem;
> + cons_rx_buf->netmem = 0;
>
> - if (xdp && page_is_pfmemalloc(page))
> + if (xdp && netmem_is_pfmemalloc(netmem))
> xdp_buff_set_frag_pfmemalloc(xdp);
>
> - if (bnxt_alloc_rx_page(bp, rxr, prod, GFP_ATOMIC) != 0) {
> + if (bnxt_alloc_rx_netmem(bp, rxr, prod, GFP_ATOMIC) != 0) {
> + if (skb) {
> + skb->len -= frag_len;
> + skb->data_len -= frag_len;
> + skb->truesize -= BNXT_RX_PAGE_SIZE;
and here.
> + }
> +bool dev_is_mp_channel(struct net_device *dev, int i)
> +{
> + return !!dev->_rx[i].mp_params.mp_priv;
> +}
> +EXPORT_SYMBOL(dev_is_mp_channel);
Sorry for a late comment but since you only use this helper after
allocating the payload pool -- do you think we could make the helper
operate on a page pool rather than device? I mean something like:
bool page_pool_is_unreadable(pp)
{
return !!pp->mp_ops;
}
? I could be wrong but I'm worried that we may migrate the mp
settings to dev->cfg at some point, and then this helper will
be ambiguous (current vs pending settings).
The dev_is_mp_channel() -> page_pool_is_readable() refactor is up to
you, but I think the truesize needs to be fixed.
--
pw-bot: cr
next prev parent reply other threads:[~2025-04-14 22:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 7:43 [PATCH v2 net-next] eth: bnxt: add support rx side device memory TCP Taehee Yoo
2025-04-10 23:39 ` Hongguang Gao
2025-04-14 22:47 ` Jakub Kicinski [this message]
2025-04-15 3:29 ` Taehee Yoo
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=20250414154716.67412a8d@kernel.org \
--to=kuba@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hongguang.gao@broadcom.com \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=kuniyu@amazon.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=sdf@fomichev.me \
/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).