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 83F9DA0487 for ; Wed, 3 Jul 2019 15:30:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 743DB1E25; Wed, 3 Jul 2019 15:30:40 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id BAF061E20 for ; Wed, 3 Jul 2019 15:30:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 06:30:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,446,1557212400"; d="scan'208";a="164346209" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga008.fm.intel.com with ESMTP; 03 Jul 2019 06:30:36 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.46]) by IRSMSX151.ger.corp.intel.com ([169.254.4.183]) with mapi id 14.03.0439.000; Wed, 3 Jul 2019 14:30:36 +0100 From: "Iremonger, Bernard" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v7 08/12] app/testpmd: use new ethernet address parser Thread-Index: AQHVMSOJsHal9M88JU2hGtrpnaKfqqa445rw Date: Wed, 3 Jul 2019 13:30:35 +0000 Message-ID: <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> In-Reply-To: <20190702221247.28391-9-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDI3NjdmMDYtYzJjOS00ZGNhLTgzNTYtYmM4NmI5NjFhMDIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUWEraHBmK1dkK1BsQU9RaGJGb28zSGlOV1pOdmlLc0Eycytzb1JjdWdncW1tZ0ZMZk5qRlpGSm1keTdcL2NRMlcifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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" 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 >=20 > 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. >=20 > 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(-) >=20 > 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 >=20 > #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 =3D cmdline_parse_etheraddr(NULL, str, &tmp, size); > - if (ret < 0 || (unsigned int)ret !=3D len) > + ret =3D 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 >=20 > #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 =3D 0; c < 6; c++) > - peer_eth_addrs[port_id].addr_bytes[c] =3D > - new_peer_addr[c]; > + peer_eth_addrs[port_id] =3D new_peer_addr; > } >=20 > 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) =3D=3D NULL) > break; >=20 > - 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]; >=20 > errno =3D 0; > n =3D strtoul(optarg, &port_end, 10); @@ - > 739,14 +733,11 @@ launch_args_parse(int argc, char** argv) > "eth-peer: port %d >=3D > RTE_MAX_ETHPORTS(%d)\n", > n, RTE_MAX_ETHPORTS); >=20 > - 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 =3D 0; c < 6; c++) > - peer_eth_addrs[n].addr_bytes[c] =3D > - peer_addr[c]; > nb_peer_eth_addrs++; > } > #endif > -- > 2.20.1 ./devtools/checkpatches.sh v7-08-12-app-testpmd-use-new-ethernet-address-pa= rser.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 Acked-by: Bernard Iremonger