public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel•org>
To: Alexander Lobakin <aleksander.lobakin@intel•com>
Cc: Geoff Levand <geoff@infradead•org>, <netdev@vger•kernel.org>,
	"David S. Miller" <davem@davemloft•net>,
	Alexander Lobakin <alexandr.lobakin@intel•com>,
	Alexander Duyck <alexander.duyck@gmail•com>,
	Paolo Abeni <pabeni@redhat•com>
Subject: Re: [PATCH net v6 1/2] net/ps3_gelic_net: Fix RX sk_buff length
Date: Tue, 28 Feb 2023 12:31:35 -0800	[thread overview]
Message-ID: <20230228123135.251edc25@kernel.org> (raw)
In-Reply-To: <03f987ab-2cc1-21f6-a4cb-2df1273a8560@intel.com>

On Tue, 28 Feb 2023 16:47:25 +0100 Alexander Lobakin wrote:
> >> +		return -ENOMEM;
> >> +	}  
> > 
> > And generally reshuffling the code.
> > 
> > Once again - please don't do any of that in a bug fix.
> > Describe precisely what the problem is and fix that problem,  
> 
> IIRC the original problem is that the skb linear parts are not always
> aligned to a boundary which this particular HW requires. So initially
> there was something like "allocate len + alignment - 1, then
> PTR_ALIGN()",

Let's focus on where the bug is. At a quick look I'm guessing that 
the bug is that we align the CPU buffer instead of the DMA buffer.
We should pass the entire allocate len + alignment - 1 as length 
to dma_map() and then align the dma_addr. dma_addr is what the device
sees. Not the virtual address of skb->data.

If I'm right the bug is not in fact directly addressed by the patch.
I'm guessing the patch helps because at least the patch passes the
aligned length to the dma_map(), rather than GELIC_NET_MAX_MTU (which
is not a multiple of 128).

> but I said that it's a waste of memory and we shouldn't do
> that, using napi_alloc_frag_align() instead.
> I guess if that would've been described, this could go as a fix? I don't
> think wasting memory is a good fix, even if we need to change the
> allocation scheme...

In general doing such a rewrite may be fine, if the author is an expert
and the commit message is very precise. Here we are at v6 already and
IMHO the problem is not even well understood.

Let's focus on understanding the problem and writing a _minimal_ fix.

The waste of memory claim can't be taken seriously when the MTU define
is bumped by 500 with no mention in the commit msg, as you also noticed.

Minimal fix, please.

  reply	other threads:[~2023-02-28 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26  2:25 [PATCH net v6 0/2] net/ps3_gelic_net: DMA related fixes Geoff Levand
2023-02-26  2:25 ` [PATCH net v6 1/2] net/ps3_gelic_net: Fix RX sk_buff length Geoff Levand
2023-02-28  2:20   ` Jakub Kicinski
2023-02-28 15:47     ` Alexander Lobakin
2023-02-28 20:31       ` Jakub Kicinski [this message]
2023-03-05  2:07         ` Geoff Levand
2023-02-28 16:12   ` Alexander Lobakin
2023-03-26 20:38     ` Geoff Levand
2023-02-26  2:25 ` [PATCH net v6 2/2] net/ps3_gelic_net: Use dma_mapping_error Geoff Levand
2023-02-28 16:14   ` Alexander Lobakin

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=20230228123135.251edc25@kernel.org \
    --to=kuba@kernel$(echo .)org \
    --cc=aleksander.lobakin@intel$(echo .)com \
    --cc=alexander.duyck@gmail$(echo .)com \
    --cc=alexandr.lobakin@intel$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=geoff@infradead$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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