All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hayes Wang <hayeswang@realtek.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	nic_swsd <nic_swsd@realtek.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH net v2] r8152: avoid the driver drops a lot of packets
Date: Thu, 7 Sep 2023 09:38:36 -0700	[thread overview]
Message-ID: <20230907093836.3253c0d5@kernel.org> (raw)
In-Reply-To: <7f8b32a91f5849c99609f78520b23535@realtek.com>

On Thu, 7 Sep 2023 07:16:50 +0000 Hayes Wang wrote:
> > Before we tweak the heuristics let's make sure rx_bottom() behaves
> > correctly. Could you make sure that
> >  - we don't perform _any_ rx processing when budget is 0
> >    (see the NAPI documentation under Documentation/networking)  
> 
> The work_done would be 0, and napi_complete_done() wouldn't be called.
> However, skb_queue_len(&tp->rx_queue) may be increased. I think it is
> not acceptable, right?

If budget is 0 we got called by netconsole, meaning we may be holding
arbitrary locks. And we can't use napi_alloc_skb() which is for
softirq/bh context only. We should only try to complete Tx in that
case, since r8152_poll() doesn't handle any Tx the right thing seems
to be to add if (!budget) return 0;

> >  - finish the current aggregate even if budget run out, return
> >    work_done = budget in that case.
> >    With this change the rx_queue thing should be gone completely.  
> 
> Excuse me. I don't understand this part. I know that when the packets are
> more than budget, the maximum packets which could be handled is budget.
> That is, return work_done = budget. However, the extra packets would be queued
> to rx_queue. I don't understand what you mean about " the rx_queue thing
> should be gone completely". I think the current driver would return
> work_done = budget, and queue the other packets. I don't sure what you
> want me to change.

Nothing will explode if we process a few more packets than budget
(assuming budget > 0). If we already do allocations and prepare
those skbs - there's no point holding onto them in the driver.
Just sent them up the stack (and then we won't need the local rx_queue).

> >  - instead of copying the head use napi_get_frags() + napi_gro_frags()
> >    it gives you an skb, you just attach the page to it as a frag and
> >    hand it back to GRO. This makes sure you never pull data into head
> >    rather than just headers.  
> 
> I would study about them. Thanks.
> 
> Should I include above changes for this patch?
> I think I have to submit another patches for above.
> 
> > Please share the performance results with those changes.  
> 
> I couldn't reproduce the problem, so I couldn't provide the result
> with the differences.

Hm, if you can't repro my intuition would be to only take the patch for
budget=0 handling into net, and the rest as improvements into net-next.

      reply	other threads:[~2023-09-07 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  3:11 [PATCH net v2] r8152: avoid the driver drops a lot of packets Hayes Wang
2023-09-07  0:28 ` Jakub Kicinski
2023-09-07  7:16   ` Hayes Wang
2023-09-07 16:38     ` Jakub Kicinski [this message]

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=20230907093836.3253c0d5@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=hayeswang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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.