DPDK patches and discussions
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Rosen Xu <rosen.xu@intel.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	 Huisong Li <lihuisong@huawei.com>
Cc: dev@dpdk.org, Rushil Gupta <rushilg@google.com>,
	 Joshua Washington <joshwash@google.com>
Subject: [PATCH] ethdev: account for smaller MTU when setting default
Date: Tue,  7 Nov 2023 15:41:40 -0800	[thread overview]
Message-ID: <20231107234207.643574-1-joshwash@google.com> (raw)

Currently, if not specified in the user configuration,
rte_eth_dev_configure() sets the MTU of the device to RTE_EHTER_MTU.
This value could potentially be larger than the MTU that the device
supports. This change updates the configured MTU to be the minimum of
the maximum suported MTU and the default DPDK MTU.

Fixes: 1bb4a528c4 ("ethdev: fix max Rx packet length")
Signed-off-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Rushil Gupta <rushilg@google.com>
---
 lib/ethdev/rte_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9163ef47ea..bba94311d3 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1419,7 +1419,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	}
 
 	if (dev_conf->rxmode.mtu == 0)
-		dev->data->dev_conf.rxmode.mtu = RTE_ETHER_MTU;
+		dev->data->dev_conf.rxmode.mtu
+			= RTE_MIN(RTE_ETHER_MTU, dev_info.max_mtu);
 
 	ret = eth_dev_validate_mtu(port_id, &dev_info,
 			dev->data->dev_conf.rxmode.mtu);
-- 
2.42.0.869.gea05f2083d-goog


                 reply	other threads:[~2023-11-07 23:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231107234207.643574-1-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=lihuisong@huawei.com \
    --cc=rosen.xu@intel.com \
    --cc=rushilg@google.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=thomas@monjalon.net \
    /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).