From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08B53A0487 for ; Fri, 5 Jul 2019 19:12:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E01EA1BDF0; Fri, 5 Jul 2019 19:12:34 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 407F51B95D for ; Fri, 5 Jul 2019 19:12:33 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id q10so4568104pff.9 for ; Fri, 05 Jul 2019 10:12:33 -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=RfeLG5jW++wWUIqZcjvqlTg0Fks10jnx7FjkjB5Dafc=; b=PA0rp5nL1VzvcA8zXlfXHMHTtzkPeIZcT1ceT2Pz0FCRBwKBdks2+08WKb3n6ktmME wXoQ8jPDNh0WMtSIjfQ3tnDdslj4w1RrtiRixl6a3tDBWAWwf3ITEcDmWzhEog0qBd3+ 7Hmgb4343Ba0yG3PfP5SE4JcyX0EuJns1P3ZA0yXmXZeVmKwHkU1jN6aOPDnHUQIputR Tkchl6vW+ibm0SPxAi/SmEf/wJb2UoMxlE4y/eE0zr8DgvxCai1MZKyHhZqepmaNQ5K9 dOG35WEBaSCtJ6gsrfS2e8wpmW+YW8ukwtHwBoxVKelJkENNx6pr+vLkKpmWGBl4+Vwp pIhg== 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=RfeLG5jW++wWUIqZcjvqlTg0Fks10jnx7FjkjB5Dafc=; b=kyxJG8WymHdGpfuy9JbD3uWUs30CPRpcPwAGUpuZd+QxJ4VfXq0fRW6RP9zSQaKo4+ FxP78QcM15jgHJDEDn7A4B3iD4A8cOFpLXTS1+0sJSOUVJOKxnkEU2l85QgYfERJ5Aro tbXuom2wx2SEl9BPVtKpSyczFcRrgBgj6TNGTJyyd1gBv+iwyf9BNqvpnKdvvHL7eS0J qtbK0KrDTE+5ra24FEXMTLxKlDgX2rkLou4i/7pDROOzVbIH/sp0IYm0Lj876tdi9xn2 e7Xk2uy5j89w4KKOp06QNxawIUW70jVJk9gUg921yy1+btxy7QBdY2oqbHQ/Pelkg1ux zvKw== X-Gm-Message-State: APjAAAXggc9Aa1DUSqj8UxG6PGUhiIrNLxOzdB2RLA+Ehtw5bgB52J1x RWOKNI/lzNDRlkBdv9BCSAgrGg== X-Google-Smtp-Source: APXvYqxNKiF1rGabJJtk5O3MNMQPiHmDxeBH12yj146BopDHag5yqE0Et95yW8O2Mq7YWeCwih+3pg== X-Received: by 2002:a17:90a:2430:: with SMTP id h45mr7091736pje.14.1562346752232; Fri, 05 Jul 2019 10:12:32 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 27sm8554626pgt.6.2019.07.05.10.12.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 05 Jul 2019 10:12:32 -0700 (PDT) Date: Fri, 5 Jul 2019 10:12:25 -0700 From: Stephen Hemminger To: "Iremonger, Bernard" Cc: "dev@dpdk.org" Message-ID: <20190705101225.27aad596@hermes.lan> In-Reply-To: <8CEF83825BEC744B83065625E567D7C260DC13EB@IRSMSX108.ger.corp.intel.com> References: <20190516180427.17270-1-stephen@networkplumber.org> <20190702221247.28391-1-stephen@networkplumber.org> <20190702221247.28391-9-stephen@networkplumber.org> <8CEF83825BEC744B83065625E567D7C260DC13EB@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 v7 08/12] app/testpmd: use new ethernet address parser 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" On Wed, 3 Jul 2019 13:30:35 +0000 "Iremonger, Bernard" wrote: > Hi Stephen, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen > > Hemminger > > Sent: Tuesday, July 2, 2019 11:13 PM > > To: dev@dpdk.org > > Cc: Stephen Hemminger > > Subject: [dpdk-dev] [PATCH v7 08/12] app/testpmd: use new ethernet > > address parser > > > > The cmdline_parse_ether_addr does not need to be used everywhere in > > testpmd. Can use rte_ether_unformat_addr instead. > > As an added bonus it eliminates some code for copying. > > > > Signed-off-by: Stephen Hemminger > > --- > > app/test-pmd/cmdline_flow.c | 5 ++--- > > app/test-pmd/config.c | 10 +++------- > > app/test-pmd/parameters.c | 15 +++------------ > > 3 files changed, 8 insertions(+), 22 deletions(-) > > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index 201bd9de56e0..2b02ca29b7ac 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -18,7 +18,6 @@ > > #include > > #include > > #include > > -#include > > #include > > > > #include "testpmd.h" > > @@ -4627,8 +4626,8 @@ parse_mac_addr(struct context *ctx, const struct > > token *token, > > /* Only network endian is supported. */ > > if (!arg->hton) > > goto error; > > - ret = cmdline_parse_etheraddr(NULL, str, &tmp, size); > > - if (ret < 0 || (unsigned int)ret != len) > > + ret = rte_ether_unformat_addr(str, &tmp); > > + if (ret < 0) > > goto error; > > if (!ctx->object) > > return len; > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > ab458c8d2837..1d804705d96c 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -49,7 +49,6 @@ > > #include > > #endif > > #include > > -#include > > #include > > > > #include "testpmd.h" > > @@ -2278,19 +2277,16 @@ pkt_fwd_config_display(struct fwd_config *cfg) > > void set_fwd_eth_peer(portid_t port_id, char *peer_addr) { > > - uint8_t c, new_peer_addr[6]; > > + struct rte_ether_addr new_peer_addr; > > if (!rte_eth_dev_is_valid_port(port_id)) { > > printf("Error: Invalid port number %i\n", port_id); > > return; > > } > > - if (cmdline_parse_etheraddr(NULL, peer_addr, &new_peer_addr, > > - sizeof(new_peer_addr)) < 0) { > > + if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) { > > printf("Error: Invalid ethernet address: %s\n", peer_addr); > > return; > > } > > - for (c = 0; c < 6; c++) > > - peer_eth_addrs[port_id].addr_bytes[c] = > > - new_peer_addr[c]; > > + peer_eth_addrs[port_id] = new_peer_addr; > > } > > > > int > > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index > > 245b610641ee..975a97807009 100644 > > --- a/app/test-pmd/parameters.c > > +++ b/app/test-pmd/parameters.c > > @@ -39,10 +39,6 @@ > > #include > > #include > > #include > > -#ifdef RTE_LIBRTE_CMDLINE > > -#include > > -#include > > -#endif > > #ifdef RTE_LIBRTE_PMD_BOND > > #include > > #endif > > @@ -227,8 +223,7 @@ init_peer_eth_addrs(char *config_filename) > > if (fgets(buf, sizeof(buf), config_file) == NULL) > > break; > > > > - if (cmdline_parse_etheraddr(NULL, buf, > > &peer_eth_addrs[i], > > - sizeof(peer_eth_addrs[i])) < 0) { > > + if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) { > > printf("Bad MAC address format on line %d\n", i+1); > > fclose(config_file); > > return -1; > > @@ -727,7 +722,6 @@ launch_args_parse(int argc, char** argv) > > } > > if (!strcmp(lgopts[opt_idx].name, "eth-peer")) { > > char *port_end; > > - uint8_t c, peer_addr[6]; > > > > errno = 0; > > n = strtoul(optarg, &port_end, 10); @@ - > > 739,14 +733,11 @@ launch_args_parse(int argc, char** argv) > > "eth-peer: port %d >= > > RTE_MAX_ETHPORTS(%d)\n", > > n, RTE_MAX_ETHPORTS); > > > > - if (cmdline_parse_etheraddr(NULL, > > port_end, > > - &peer_addr, > > sizeof(peer_addr)) < 0) > > + if (rte_ether_unformat_addr(port_end, > > + > > &peer_eth_addrs[n]) < 0) > > rte_exit(EXIT_FAILURE, > > "Invalid ethernet address: > > %s\n", > > port_end); > > - for (c = 0; c < 6; c++) > > - peer_eth_addrs[n].addr_bytes[c] = > > - peer_addr[c]; > > nb_peer_eth_addrs++; > > } > > #endif > > -- > > 2.20.1 > > ./devtools/checkpatches.sh v7-08-12-app-testpmd-use-new-ethernet-address-parser.patch > > WARNING:LONG_LINE: line over 80 characters > #126: FILE: app/test-pmd/parameters.c:737: > + &peer_eth_addrs[n]) < 0) > > No harm to fix this, otherwise Fixing the long lines (the right way) would require refactoring testpmd here. Not something I want to do. > > Acked-by: Bernard Iremonger