From: David Awogbemila <awogbemila@google.com>
To: Saeed Mahameed <saeed@kernel.org>
Cc: netdev@vger.kernel.org, Catherine Sullivan <csully@google.com>,
Yangchun Fu <yangchun@google.com>
Subject: Re: [PATCH 2/4] gve: Add support for raw addressing to the rx path
Date: Fri, 6 Nov 2020 12:11:11 -0800 [thread overview]
Message-ID: <CAL9ddJdhMET3AJJ16eEMbJcCwCWH1a6b7njmA8xnu=obx2tadQ@mail.gmail.com> (raw)
In-Reply-To: <5c28ff0dbee9895665082fc2cfb59c15dc905322.camel@kernel.org>
On Tue, Nov 3, 2020 at 3:19 PM Saeed Mahameed <saeed@kernel.org> wrote:
>
> On Tue, 2020-11-03 at 09:46 -0800, David Awogbemila wrote:
> > From: Catherine Sullivan <csully@google.com>
> >
> > Add support to use raw dma addresses in the rx path. Due to this new
> > support we can alloc a new buffer instead of making a copy.
> >
> > RX buffers are handed to the networking stack and are
> > re-allocated as needed, avoiding the need to use
> > skb_copy_to_linear_data() as in "qpl" mode.
> >
> > Reviewed-by: Yangchun Fu <yangchun@google.com>
> > Signed-off-by: Catherine Sullivan <csully@google.com>
> > Signed-off-by: David Awogbemila <awogbemila@google.com>
> > ---
> > drivers/net/ethernet/google/gve/gve.h | 9 +-
> > drivers/net/ethernet/google/gve/gve_adminq.c | 14 +-
> > drivers/net/ethernet/google/gve/gve_desc.h | 10 +-
> > drivers/net/ethernet/google/gve/gve_main.c | 3 +-
> > drivers/net/ethernet/google/gve/gve_rx.c | 220 +++++++++++++++
> > ----
> > 5 files changed, 203 insertions(+), 53 deletions(-)
> >
>
> ...
>
> > static inline u32 gve_num_rx_qpls(struct gve_priv *priv)
> > {
> > - return priv->rx_cfg.num_queues;
> > + if (priv->raw_addressing)
> > + return 0;
> > + else
> > + return priv->rx_cfg.num_queues;
>
> else statement is redundant.
Thanks, I'll take the else statement away.
>
>
> >
> > static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
> > {
> > struct gve_priv *priv = rx->gve;
> > u32 slots;
> > + int err;
> > int i;
> >
> > /* Allocate one page per Rx queue slot. Each page is split into
> > two
> > @@ -71,12 +96,31 @@ static int gve_prefill_rx_pages(struct
> > gve_rx_ring *rx)
> > if (!rx->data.page_info)
> > return -ENOMEM;
> >
> > - rx->data.qpl = gve_assign_rx_qpl(priv);
> > -
> > + if (!rx->data.raw_addressing)
> > + rx->data.qpl = gve_assign_rx_qpl(priv);
> > for (i = 0; i < slots; i++) {
> > - struct page *page = rx->data.qpl->pages[i];
> > - dma_addr_t addr = i * PAGE_SIZE;
> > + struct page *page;
> > + dma_addr_t addr;
> > +
> > + if (rx->data.raw_addressing) {
> > + err = gve_alloc_page(priv, &priv->pdev->dev,
> > &page,
> > + &addr, DMA_FROM_DEVICE);
> > + if (err) {
> > + int j;
> >
>
> the code is skewed right, 5 level indentation is a lot.
> you can just goto alloc_err; and handle the rewind on the exit path of
> the function .
>
> BTW you could split this loop to two independent flows if you utilize
> gve_rx_alloc_buffer()
>
> if (!raw_Addressing) {
> page = rx->data.qpl->pages[i];
> addr = i * PAGE_SIZE;
> gve_setup_rx_buffer(...);
> continue;
> }
>
> /* raw addressing mode */
> err = gve_rx_alloc_buffer(...);
> if (err)
> goto alloc_err;
>
Thanks, I'll eliminate the skew andI'll take the suggestion to
separate the independent flows.
next prev parent reply other threads:[~2020-11-06 20:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 17:46 [PATCH net-next v5 0/4] GVE Raw Addressing David Awogbemila
2020-11-03 17:46 ` [PATCH 1/4] gve: Add support for raw addressing device option David Awogbemila
2020-11-03 22:43 ` Saeed Mahameed
2020-11-06 19:41 ` David Awogbemila
2020-11-09 21:02 ` David Awogbemila
2020-11-03 17:46 ` [PATCH 2/4] gve: Add support for raw addressing to the rx path David Awogbemila
2020-11-03 23:18 ` Saeed Mahameed
2020-11-06 20:11 ` David Awogbemila [this message]
2020-11-03 17:46 ` [PATCH 3/4] gve: Rx Buffer Recycling David Awogbemila
2020-11-04 0:01 ` Saeed Mahameed
2020-11-06 20:16 ` David Awogbemila
2020-11-03 17:46 ` [PATCH 4/4] gve: Add support for raw addressing in the tx path David Awogbemila
2020-11-04 0:35 ` Saeed Mahameed
2020-11-06 22:27 ` David Awogbemila
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='CAL9ddJdhMET3AJJ16eEMbJcCwCWH1a6b7njmA8xnu=obx2tadQ@mail.gmail.com' \
--to=awogbemila@google.com \
--cc=csully@google.com \
--cc=netdev@vger.kernel.org \
--cc=saeed@kernel.org \
--cc=yangchun@google.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).