[dpdk-dev] [PATCH v4 1/2] ethdev: fix MTU doesn't update when jumbo frame disabled
From: Steve Yang <hidden>
Date: 2021-01-25 08:35:35
Subsystem:
library code, the rest · Maintainers:
Andrew Morton, Linus Torvalds
The MTU value should be updated to 'max_rx_pkt_len - overhead'
no matter if the JUMBO FRAME offload enabled. If not update this MTU,
use will get the wrong MTU info via some command.
E.g.: 'show port info all' in testpmd tool.
Actually, the 'max_rx_pkt_len' has been used for other purposes in many
places now, even though the 'max_rx_pkt_len' is expected 'Only used if
JUMBO_FRAME enabled'.
For examples,
'max_rx_pkt_len' perhaps can be used as the 'rx_ctx.rxmax' in i40e.
Fixes: bf0f90d92d30 ("ethdev: fix max Rx packet length check")
Signed-off-by: Steve Yang <redacted>
---
lib/librte_ethdev/rte_ethdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index daf5f24f7e..42857e3b67 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c@@ -1421,10 +1421,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ret = -EINVAL; goto rollback; } - - /* Scale the MTU size to adapt max_rx_pkt_len */ - dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len - - overhead_len; } else { uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len; if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
@@ -1434,6 +1430,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, RTE_ETHER_MTU + overhead_len; } + /* Scale the MTU size to adapt max_rx_pkt_len */ + dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len - + overhead_len; + /* * If LRO is enabled, check that the maximum aggregated packet * size is supported by the configured device.
--
2.17.1