From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com
 [209.85.192.196]) by dpdk.org (Postfix) with ESMTP id 83F072BF5
 for <dev@dpdk.org>; Mon, 18 Jun 2018 21:31:14 +0200 (CEST)
Received: by mail-pf0-f196.google.com with SMTP id a22-v6so8661824pfo.12
 for <dev@dpdk.org>; Mon, 18 Jun 2018 12:31:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=S6y9mbtsOQ1oRB5J13yJGiWc+yGp3eTcHHoNFq0GEds=;
 b=kxNFotNBMwd5yWUwWr5lJEf2QMMt6HZm27jumPJyHJXzS/Xutoq9An7kR6VTPBsaKr
 aOMpTCs0yt3x42jMHLTvvG/2ndoNW0CKkhQJy/kq+GVoFFodF0O8wgGp/XHva+H98szm
 4+lmAHFlBVNWDwf3NG0WjeiQpfDQJiPou5ZzbW53cOi5tlIylgX1wKEOJXtVRaWmQRL6
 jwnWbEWRXIVF2F1jBlCkOHV2UI7g/NfHmtHGsgQ2lYZ8ounqxZJ0+jgov+fCYt0iaTIo
 53KNyH60X1/rFrCoZJQQK/O6TOtVktmkghsLxXMjNNdfgP9VFD8WOobbw5Q/wEtSPJXF
 5dkw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=S6y9mbtsOQ1oRB5J13yJGiWc+yGp3eTcHHoNFq0GEds=;
 b=OnqysySNJmMNdbf2VVDNtD3Kd5qhQ/2fYyUmEE+hG8wg3RH+bOEGOMhPKF27poxUT+
 oezuLmjdNcyIIJkjvCpcSoaMoP4KR5TR4orQWiwzufOKX3xfBaKZTQEOrwFr6BAAlyv2
 yc3MoVBmCEZ0Ir5W5DFF3uQkBmmAwU9nBfJVd1T2pBwCyIt/ggzx7R7pOtVAdmStfIBu
 4fPjWmGHWavaaRUMWRGgwkc8JQHZ80lpVEfveXK8wteMvJ6ZC6UkUfECRsthvURY7T8h
 7nsz9n0BL98G5W2lTMeB5cpyGUmTeQUdejm5GCLZFkwX/HHd+LiCiCEXX7jREjQ5Kyg9
 nm6A==
X-Gm-Message-State: APt69E3Ml/DRP9XqynWymfTxkoKFkmVucztR46nWLjaCrUgpCmzBJ3AC
 KJPbx35vWM4t4LMiCEQc6pYpBg==
X-Google-Smtp-Source: ADUXVKJLb+YrXkMPgtBBGTxh8VNa4hK2ZIGhCyNnEEggAVVCEUGl0x/rMoV+/nJCiEW0BT3REoB71g==
X-Received: by 2002:a65:5581:: with SMTP id
 j1-v6mr11887814pgs.388.1529350273625; 
 Mon, 18 Jun 2018 12:31:13 -0700 (PDT)
Received: from xeon-e3 (204-195-35-107.wavecable.com. [204.195.35.107])
 by smtp.gmail.com with ESMTPSA id d6-v6sm23598710pgc.38.2018.06.18.12.31.13
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 18 Jun 2018 12:31:13 -0700 (PDT)
Date: Mon, 18 Jun 2018 12:31:05 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Message-ID: <20180618123105.10bed42d@xeon-e3>
In-Reply-To: <8CEF83825BEC744B83065625E567D7C260CB34E5@IRSMSX108.ger.corp.intel.com>
References: <20180611182526.32327-1-stephen@networkplumber.org>
 <20180611182526.32327-3-stephen@networkplumber.org>
 <8CEF83825BEC744B83065625E567D7C260CB34E5@IRSMSX108.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v2 2/2] testpmd: add ability to set tx IP and
 UDP parameters
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Jun 2018 19:31:14 -0000

On Thu, 14 Jun 2018 10:30:21 +0000
"Iremonger, Bernard" <bernard.iremonger@intel.com> wrote:

> Hi Stephen,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> > Hemminger
> > Sent: Monday, June 11, 2018 7:25 PM
> > To: dev@dpdk.org
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH v2 2/2] testpmd: add ability to set tx IP and UDP
> > parameters
> > 
> > Allow user to override the hard coded IP address and UDP port values in Tx
> > only test.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
> >  app/test-pmd/testpmd.h                |  6 ++++
> >  app/test-pmd/txonly.c                 | 16 ++++-----
> >  doc/guides/testpmd_app_ug/run_app.rst |  9 +++++
> >  4 files changed, 72 insertions(+), 8 deletions(-)
> > 
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
> > 75807623c719..6d666e088fd9 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -19,6 +19,7 @@
> >  #include <stdint.h>
> >  #include <unistd.h>
> >  #include <inttypes.h>
> > +#include <arpa/inet.h>
> > 
> >  #include <rte_common.h>
> >  #include <rte_byteorder.h>
> > @@ -65,6 +66,7 @@ usage(char* progname)
> >  #ifdef RTE_LIBRTE_CMDLINE
> >  	       "--eth-peers-configfile= | "
> >  	       "--eth-peer=X,M:M:M:M:M:M | "
> > +	       "--tx-ip=SRC,DST | --tx-udp=PORT | "
> >  #endif
> >  	       "--pkt-filter-mode= |"
> >  	       "--rss-ip | --rss-udp | "
> > @@ -625,6 +627,8 @@ launch_args_parse(int argc, char** argv)
> >  		{ "vxlan-gpe-port",		1, 0, 0 },
> >  		{ "mlockall",			0, 0, 0 },
> >  		{ "no-mlockall",		0, 0, 0 },
> > +		{ "tx-ip",			1, 0, 0 },
> > +		{ "tx-udp",			1, 0, 0 },
> >  		{ 0, 0, 0, 0 },
> >  	};
> > 
> > @@ -717,6 +721,51 @@ launch_args_parse(int argc, char** argv)
> >  				nb_peer_eth_addrs++;
> >  			}
> >  #endif
> > +			if (!strcmp(lgopts[opt_idx].name, "tx-ip")) {
> > +				struct in_addr in;
> > +				char *end;
> > +
> > +				end = strchr(optarg, ',');
> > +				if (end == optarg || !end)
> > +					rte_exit(EXIT_FAILURE,
> > +						 "Invalid tx-ip: %s", optarg);
> > +
> > +				*end++ = 0;
> > +				if (inet_aton(optarg, &in) == 0)
> > +					rte_exit(EXIT_FAILURE,
> > +						 "Invalid source IP address:
> > %s\n", optarg);  
> 
> Line over 80 characters should be fixed.
> 
> > +				tx_ip_src_addr =
> > rte_be_to_cpu_32(in.s_addr);
> > +
> > +				if (inet_aton(end, &in) == 0)
> > +					rte_exit(EXIT_FAILURE,
> > +						 "Invalid destination IP
> > address: %s\n", optarg);  
> 
> Line over 80 characters should be fixed.
> 
> > +				tx_ip_dst_addr =
> > rte_be_to_cpu_32(in.s_addr);
> > +			}
> > +			if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
> > +				char *end = NULL;
> > +
> > +				errno = 0;
> > +				n = strtoul(optarg, &end, 10);
> > +				if (errno != 0 || end == optarg || n >
> > UINT16_MAX ||  
> 
> Line over 80 characters should be fixed.

I don't want to get into major code restructuring, just to deal with existing parsing.
The 80 limit is really too small.