From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E95AA432CF; Wed, 8 Nov 2023 07:06:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CB82402D4; Wed, 8 Nov 2023 07:06:02 +0100 (CET) Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by mails.dpdk.org (Postfix) with ESMTP id D06E940279 for ; Wed, 8 Nov 2023 07:06:00 +0100 (CET) Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-5b83d8797f4so4311607a12.3 for ; Tue, 07 Nov 2023 22:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699423560; x=1700028360; darn=dpdk.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=JZFTmrnozfgkQdKvinm319iYnr01/BSVU7RREbxENO8=; b=AMi9Y+d5H4ta80NzvOSFwD9hh2erc077GmjN9H3su/kuMSs0yW50rnctmJzBcCE1Qt eI59h+U/clBNQDzktkwpAqPi++03QtBROb8xRb+r/dN2N15zFaaX2fYt82Gx8c8QMkU/ wpd3/d4QnDckLkgNbNjt8BTTYFUUHMxx3iagV3YuqPlrOUlSFUmay9O0/dmtyJYnBer6 9eECjySA18D4rmOgN9lpI7IKh4Gn1EDxNrdBq+nqWKRRUC0sG07WCnzJ5JQYnzmP4Sza JDs8GHucoTqZOod9NdkDqNINZUjdl0aQVl1Do4d+RoJLR75cKsNg4MSKf1BxXfcaxAJy GaMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699423560; x=1700028360; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JZFTmrnozfgkQdKvinm319iYnr01/BSVU7RREbxENO8=; b=HEevQ5q03oSOonntwZjwM0+oCCtimvH124IaeceSXBIhfR9ulQMrq+2bxy1WuAPWfh aPTwrQ8E/hnJ6oFPQ1D6TYotIB3wko5SL5rK5MKJ8pbCYtxe5TighWrMPJ48DpcUzqiZ 1CW97Ar8ejbRiKailEPYJF3IPCVHmbnoVPcxpROEs7KdB6J+uotaISq6pO632CnVeXwP 6Lu4iwsrHdBsSoCYBoHxUUJtGgQn9N/onMtM3hCwzfWKidIUoAojVKKa0M6uj9J7Wt/l VB6S6zqyM1isQfKJR2me8MMSGJZFGONX637j+cWO5SA6uqdxboPdXhJfrI7rrtPY6nwc 0pLQ== X-Gm-Message-State: AOJu0YzRKQLlLeccGntFM78eHbkgB/SjRdLR4G5dER0qs5Q2oqDL5b7I hx6fk6NQMq+AsQNT2XOWfBBFu7esMxX0Mw== X-Google-Smtp-Source: AGHT+IELjF1Qk0rVmi5DN5JbGAdDg+1brnWkQ8XSPWXHtGC4Bf8w/AR6dZ1RcH3y3rE2OEnKllb6ynSw7bHZug== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:74f2:7b5:42ea:65e8]) (user=joshwash job=sendgmr) by 2002:a63:4307:0:b0:5bd:3e1c:c163 with SMTP id q7-20020a634307000000b005bd3e1cc163mr10116pga.1.1699423559757; Tue, 07 Nov 2023 22:05:59 -0800 (PST) Date: Tue, 7 Nov 2023 22:05:34 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog Message-ID: <20231108060535.1249507-1-joshwash@google.com> Subject: [PATCH v2] ethdev: account for smaller MTU when setting default From: Joshua Washington To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Hyong Youb Kim , Rosen Xu , Somnath Kotur , Huisong Li Cc: dev@dpdk.org, Rushil Gupta , Joshua Washington Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Rushil Gupta --- lib/ethdev/rte_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 9163ef47ea..3858983fcc 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1419,7 +1419,9 @@ 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 = + (dev_info.max_mtu == 0) ? RTE_ETHER_MTU : + RTE_MIN(dev_info.max_mtu, RTE_ETHER_MTU); ret = eth_dev_validate_mtu(port_id, &dev_info, dev->data->dev_conf.rxmode.mtu); -- 2.42.0.869.gea05f2083d-goog