netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Saeed Mahameed <saeedm@mellanox.com>,
	"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
	"kafai@fb.com" <kafai@fb.com>, Tariq Toukan <tariqt@mellanox.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>
Subject: Re: [net RFC] net/mlx4_en: Use frag stride in crossing page boundary condition
Date: Tue, 19 Jun 2018 17:25:20 -0700	[thread overview]
Message-ID: <1bd6da9b-fa46-25e7-8921-cb56eb91e71b@gmail.com> (raw)
In-Reply-To: <deda277de538f2083fb23479f26afa03ffc79644.camel@mellanox.com>



On 06/19/2018 11:05 AM, Saeed Mahameed wrote:

> this is only true for XDP setup, for non XDP max stride_size can only
> be around ~3k and only for mtu > ~6k
> 
> For XDP setup you suggested:
> -               priv->frag_info[0].frag_size = eff_mtu;
> +               priv->frag_info[0].frag_size = PAGE_SIZE;
> 
> currently the condition is:
> 
> release = frags->page_offset + frag_info->frag_size > PAGE_SIZE;
> 
> so my solution and yours have the same problem you described above.
> 
> the problem is not with the initial values or with stride/farg size
> math, it just that in XDP we shouldn't reuse at ALL. I agree with you
> that we need to optimize and maybe for PAGE_SIZE > 8k we need to allow
> XDP setup to reuses. but for now there is a data corruption to handle.


Sure, we all agree there is a bug to fix.

The way you are fixing it is kind of illogical.

The NIC can use a frag if its _size_ is big enough to receive the frame.

The _stride_  is an abstraction created by the driver to report an estimation of the _truesize_,
or memory consumption, so that linux can better track overall memory usage.

For example, if MTU=1500, the size of the fragment is 1536 bytes, but since we can put only
2 fragments per 4KB page (on x86), we declare the _stride_ to be 2048 bytes.

Declaring that a final blob of a page, being 1600 bytes, not able to receive a frame because
_stride_ is 2048 is illogical and waste resources.

  reply	other threads:[~2018-06-20  0:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14  0:53 [net RFC] net/mlx4_en: Use frag stride in crossing page boundary condition Saeed Mahameed
2018-06-14  2:30 ` Eric Dumazet
2018-06-14 18:56   ` Saeed Mahameed
2018-06-14 19:12     ` Eric Dumazet
2018-06-14 20:47       ` Saeed Mahameed
2018-06-14 20:53         ` Saeed Mahameed
2018-06-14 21:04           ` Saeed Mahameed
2018-06-14 23:49             ` Eric Dumazet
2018-06-19 18:05               ` Saeed Mahameed
2018-06-20  0:25                 ` Eric Dumazet [this message]
2018-06-20 23:41                   ` Saeed Mahameed
2018-06-21  0:28                     ` Eric Dumazet

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=1bd6da9b-fa46-25e7-8921-cb56eb91e71b@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=edumazet@google.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=tariqt@mellanox.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).