app/testpmd: fix MTU configuration before device start

There is no point to do rte_eth_dev_mtu_set() before configure since
set MTU value is overwritten on configure anyway. So, setting of MTU
before configure is rejected now on ethdev level.

If testpmd is going to do configure (e.g. just after testpmd start
with disabled devices start up or any configuration changes in stopped
state which require reconfigure), just save requested MTU in device
config to be applied on reconfigure.

Fixes: 1bb4a528c4 ("ethdev: fix max Rx packet length")
Fixes: b26bee10ee ("ethdev: forbid MTU set before device configure")

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Andrew Rybchenko 2021-10-24 19:42:37 +03:00 committed by Ferruh Yigit
parent 684366134c
commit 4c96e084fd

View File

@ -1241,10 +1241,12 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
diag = rte_eth_dev_set_mtu(port_id, mtu);
if (diag != 0) {
fprintf(stderr, "Set MTU failed. diag=%d\n", diag);
return;
if (port->need_reconfig == 0) {
diag = rte_eth_dev_set_mtu(port_id, mtu);
if (diag != 0) {
fprintf(stderr, "Set MTU failed. diag=%d\n", diag);
return;
}
}
port->dev_conf.rxmode.mtu = mtu;