From: Ferruh Yigit Subject: Re: [PATCH v2 7/7] app/testpmd: verify mtu with rte_eth_dev_info_get() Date: Mon, 25 Mar 2019 14:20:32 +0000 Message-ID: <6aa38aa8-5bb3-fee1-0449-c1cc11115a67@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <1553259678-4515-8-git-send-email-ian.stokes@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: stephen@networkplumber.org To: Ian Stokes , dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 76B262BF7 for ; Mon, 25 Mar 2019 15:20:39 +0100 (CET) In-Reply-To: <1553259678-4515-8-git-send-email-ian.stokes@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/22/2019 1:01 PM, Ian Stokes wrote: > 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 For patch title, I think 'rte_eth_dev_info_get()' is implementation detail here, what we are verifying mtu against min/max MTU information provided by PMDs. What do you think something like: app/testpmd: verify MTU with PMD provided limits > --- > 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; This fails silently, I think better to put a log for failure. > diag = rte_eth_dev_set_mtu(port_id, mtu); > if (diag == 0) > return; >