From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1BEF3A00E6 for ; Fri, 22 Mar 2019 14:02:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3EBD01B5F7; Fri, 22 Mar 2019 14:01:48 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8E3F41B5E4 for ; Fri, 22 Mar 2019 14:01:39 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2019 06:01:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="284955659" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 22 Mar 2019 06:01:37 -0700 From: Ian Stokes To: dev@dpdk.org Cc: stephen@networkplumber.org, Ian Stokes Date: Fri, 22 Mar 2019 13:01:18 +0000 Message-Id: <1553259678-4515-8-git-send-email-ian.stokes@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> Subject: [dpdk-dev] [PATCH v2 7/7] app/testpmd: verify mtu with rte_eth_dev_info_get() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190322130118.pQnnQYfOk7W9GDNAAyCNv89AWVP4UH2JEfaizjYVopQ@z> 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 --- app/test-pmd/config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b9e5dd923..6ca97d0e7 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1063,9 +1063,13 @@ 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) + return; diag = rte_eth_dev_set_mtu(port_id, mtu); if (diag == 0) return; -- 2.13.6