Skip to content

Commit

Permalink
ethdev: account for smaller MTU when setting default
Browse files Browse the repository at this point in the history
[ upstream commit da266c6556d22b470679484b62e3f9db192e4032 ]

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 supported MTU and the default DPDK MTU.

Fixes: 1bb4a52 ("ethdev: fix max Rx packet length")

Signed-off-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Rushil Gupta <rushilg@google.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
  • Loading branch information
josh8551021 authored and kevintraynor committed Nov 16, 2023
1 parent 7c56526 commit 4308ee1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ethdev/rte_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,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);
Expand Down

0 comments on commit 4308ee1

Please sign in to comment.