DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Joshua Washington <joshwash@google.com>
Cc: Junfeng Guo <junfeng.guo@intel.com>,
	Jeroen de Borst <jeroendb@google.com>,
	Rushil Gupta <rushilg@google.com>,
	dev@dpdk.org, Ferruh Yigit <ferruh.yigit@amd.com>
Subject: Re: [PATCH] net/gve: Update max_rx_pktlen to be based on MTU
Date: Mon, 16 Oct 2023 15:58:51 -0700	[thread overview]
Message-ID: <20231016155851.32978666@hermes.local> (raw)
In-Reply-To: <20231016205948.2252342-1-joshwash@google.com>

On Mon, 16 Oct 2023 13:59:48 -0700
Joshua Washington <joshwash@google.com> wrote:

> conjunction with the MTU fix, causes problems with testpmd, as setting the
> packet length with the --max-pkt-len flag causes the MTU to be set
> higher than possible due to underflow.
> 
> As an example, setting --max-pkt-len=1460 (the default MTU on Google
> Cloud VMs) causes testpmd to set the following:
>     mtu = 1460 - eth_overhead,
> 
> where eth_overhead = dev->max_rx_pktlen - dev->max_mtu = 65535 - 1460.
> 
> Thus, mtu = 1460 - 65535 + 1460 = 2921 due to underflow.
> 
> Signed-off-by: Joshua Washington <joshwash@google.com>
> 
> Fixes: 030025b74202 ("net/gve: fix max MTU limit")
> Cc: joshwash@google.com

Never mind, previous comment.
You are correctly doing the inverse of this common code pattern.

In testpmd:
static uint32_t
eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
{
	uint32_t overhead_len;

	if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu)
		overhead_len = max_rx_pktlen - max_mtu;
	else
		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;

	return overhead_len;
}

  parent reply	other threads:[~2023-10-16 22:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 20:59 Joshua Washington
2023-10-16 21:20 ` Stephen Hemminger
2023-10-16 22:58 ` Stephen Hemminger [this message]
2023-10-26 17:38 ` Ferruh Yigit

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=20231016155851.32978666@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=jeroendb@google.com \
    --cc=joshwash@google.com \
    --cc=junfeng.guo@intel.com \
    --cc=rushilg@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).