when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely.
if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx") Signed-off-by: SteveX Yang <stevex.y...@intel.com> --- drivers/net/igc/igc_ethdev.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index 7f5066df4..98e98b3e4 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -337,11 +337,22 @@ static int eth_igc_configure(struct rte_eth_dev *dev) { struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev); + uint32_t frame_size = dev->data->mtu + IGC_ETH_OVERHEAD; int ret; PMD_INIT_FUNC_TRACE(); - ret = igc_check_mq_mode(dev); + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = eth_igc_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + + ret = igc_check_mq_mode(dev); if (ret != 0) return ret; -- 2.17.1