DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] app/testpmd: verify MTU with device provided limits
       [not found] <--dry-run>
@ 2019-03-29 17:48 ` Ferruh Yigit
  2019-03-29 17:48   ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Ferruh Yigit @ 2019-03-29 17:48 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Ian Stokes

From: Ian Stokes <ian.stokes@intel.com>

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>
---
 app/test-pmd/config.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9e5dd923..cadcb512f 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;
-- 
2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-dev] [PATCH v2] app/testpmd: verify MTU with device provided limits
  2019-03-29 17:48 ` [dpdk-dev] [PATCH v2] app/testpmd: verify MTU with device provided limits Ferruh Yigit
@ 2019-03-29 17:48   ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2019-03-29 17:48 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Ian Stokes

From: Ian Stokes <ian.stokes@intel.com>

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>
---
 app/test-pmd/config.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9e5dd923..cadcb512f 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;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-29 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <--dry-run>
2019-03-29 17:48 ` [dpdk-dev] [PATCH v2] app/testpmd: verify MTU with device provided limits Ferruh Yigit
2019-03-29 17:48   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).