summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stokes <ian.stokes@intel.com>2019-03-29 17:52:19 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 19:00:52 +0100
commit0c85cab92f3a9a5ebb81d7ceadd3f775f2d5c6ff (patch)
treeee2b9ecfa2593818483259546591213782817973
parentae35fd61fce131989a5441eb7fc7272a15762be1 (diff)
downloaddpdk-next-eventdev-0c85cab92f3a9a5ebb81d7ceadd3f775f2d5c6ff.zip
dpdk-next-eventdev-0c85cab92f3a9a5ebb81d7ceadd3f775f2d5c6ff.tar.gz
dpdk-next-eventdev-0c85cab92f3a9a5ebb81d7ceadd3f775f2d5c6ff.tar.xz
app/testpmd: verify MTU with device provided limits
This commit uses the MTU fields populated in rte_eth_dev_info_get() to validate the MTU value being passed in port_mtu_set(). Signed-off-by: Ian Stokes <ian.stokes@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--app/test-pmd/config.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9e5dd9..cadcb51 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1063,9 +1063,16 @@ void
port_mtu_set(portid_t port_id, uint16_t mtu)
{
int diag;
+ struct rte_eth_dev_info dev_info;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu) {
+ printf("Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n",
+ mtu, dev_info.min_mtu, dev_info.max_mtu);
+ return;
+ }
diag = rte_eth_dev_set_mtu(port_id, mtu);
if (diag == 0)
return;