examples/vhost: fix port init in mergeable mode
authorChenbo Xia <chenbo.xia@intel.com>
Thu, 4 Nov 2021 05:11:02 +0000 (13:11 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 16 Nov 2021 10:01:22 +0000 (11:01 +0100)
commit5932109ac869aa6ad130989e7532294635e20d47
tree2389d6fd432b6e7245ed1bb9115bb260de0159cc
parentcbff4d8dc99fcc78dd6ebfa714c6de6d12627068
examples/vhost: fix port init in mergeable mode

When the example starts in mergeable mode with an i40e port,
it fails to launch because the examples use default mtu MAX_MTU
to configure ethdev. The root cause is some devices have Ethernet
frame overhead and then MAX_MTU will be larger than device's max
mtu, so the ethdev configure will fail.

This patch checks the device's max MTU before setting the ethdev
configuration. If the device has a max MTU, use that value to
configure.

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

Reported-by: Xingguang He <xingguang.he@intel.com>
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
examples/vhost/main.c