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 5A1C8A046B for ; Sun, 21 Jul 2019 15:42:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 775822BE5; Sun, 21 Jul 2019 15:42:31 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60081.outbound.protection.outlook.com [40.107.6.81]) by dpdk.org (Postfix) with ESMTP id 88E732BC7 for ; Sun, 21 Jul 2019 15:42:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaUSjzM8sIxeFlJDzeSdJ2KvYsgeZCeLHCKd+80GcvzgFAj+QRXKKw0B8bFRE/77QrJNf0ODfvcN9ErNUmBCozou2fgDC1ifrgMahUFUNm3cz8PLiCltTxc349g+VsrH5DR5BOF9s2fSOUKcbeg5gPtQKoaxWSd4PQ6aIp2mvCTAAtg4yTVQwNqtLUQtRdZgf0lL8UPLydioW8LrjjBdEop3OaFuY9oHmBjEKyZNLLwFyr7tNk4rdpu1e3lz6YZDUXt3EK8Vw5xrFLJkYhCPxASOz1Xj7vvOLf99TerGCd3/nAsX4W/8fkWFIjFsc1Iy6r8O6Y9Vu7VnMGQi8cX/jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EDQ8p6i7NU54VeTu94/XetRp12pq0hhnsJUOsn68rCA=; b=Ne0jO0kXTlCiOiuwHpmw77iJBHnVWGGN7CPnkRqxNzVbuJh1XS+DzCXcY/QsnZyyhicykK4IUD4nHlMpQ5q/X3rMyZvuff28ir2dPOGl+/JOiFx423uSOc8sTv0P/ycqZFISh5BhvoZNsb2dvSLkQLotccHudgBNfko4we3MkM5Zu6S/5ZOrC13fn4sieEKTD0tP3PYDuMESvjcglafJu+XGmv8l+crrbGaqBLk/Y6qPMNvJhBpywFwftb8QIJ2OJl94j2dWcLDvczK+8ul9BtpXsK8TKHj/5/RVUz6quMOraNosciIubdfF5vhDArZhCOUfAi6BNXcqnHxO4wRS7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EDQ8p6i7NU54VeTu94/XetRp12pq0hhnsJUOsn68rCA=; b=Tmh0uJ0+KAOLDKGHrATIrr2HixqSLbtDi1nGRAUjBH4lu5qdjOH5kuWzI87mal97EqYo9cJAPwuDkOytyD0A0WrAGZkP0DsoQe6qqMXHFymeFlNE+3rYFnEnYlyPWAcR6bDE5l8/oco5He0+RfFD+DLNFs3bFJxIFCCHFNpU0vQ= Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com (52.134.65.161) by DB3PR0502MB3996.eurprd05.prod.outlook.com (52.134.65.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.15; Sun, 21 Jul 2019 13:42:27 +0000 Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::bcc1:5331:1dca:7360]) by DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::bcc1:5331:1dca:7360%7]) with mapi id 15.20.2094.013; Sun, 21 Jul 2019 13:42:27 +0000 From: Raslan Darawsheh To: Stephen Hemminger , "dev@dpdk.org" CC: Bernard Iremonger Thread-Topic: [dpdk-dev] [PATCH v9 07/11] app/testpmd: use new ethernet address parser Thread-Index: AQHVNbreWQKj01N9kk2Eez3S8IautKbVJ5qQ Date: Sun, 21 Jul 2019 13:42:26 +0000 Message-ID: References: <20190516180427.17270-1-stephen@networkplumber.org> <20190708182614.1677-1-stephen@networkplumber.org> <20190708182614.1677-8-stephen@networkplumber.org> In-Reply-To: <20190708182614.1677-8-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-originating-ip: [212.29.221.74] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c368f5dc-878e-4bce-c4fb-08d70de144de x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB3996; x-ms-traffictypediagnostic: DB3PR0502MB3996: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 0105DAA385 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(376002)(39860400002)(366004)(346002)(13464003)(199004)(189003)(256004)(14444005)(6116002)(66556008)(66476007)(66446008)(64756008)(3846002)(478600001)(66946007)(76116006)(186003)(305945005)(486006)(9686003)(4326008)(81156014)(81166006)(2501003)(86362001)(52536014)(66066001)(6246003)(14454004)(8936002)(110136005)(6436002)(316002)(5660300002)(99286004)(26005)(68736007)(71190400001)(55016002)(71200400001)(2906002)(7696005)(33656002)(476003)(102836004)(7736002)(11346002)(446003)(76176011)(25786009)(229853002)(6506007)(53546011)(74316002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3996; H:DB3PR0502MB3964.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: OJpFKqtgLgGGcfJx6JNFvMXRrGA/pvH+aeh5NFj+nnLDXgY1Hc6oEyYJudOKjD8JaXw8H16qT179hiiYYcQVv86uQCPNm4LbeQusva5t+cTVzuk9KBUcxP0vfXuebFuqxWnnLrao3AqGjZD9EVRyOdP62h+c5oWly4t6OhhXE7UWjZ/8OhBfIpfBo/hdblBvcHjDVwmcayxUvEsE8tJ9VW4AhJQ90i86hV4HVn0jb+9eoMYDovkMxZMTmhG1V35PHLW+ZEKzLPl4LaR25yzu85OtY9/GkoTkRreSHCFZlWjs/l26cc/3KeDF9PWxIJPaB9GJLGxAPnLNqi2aYFqxPRiY/Ly9OkJr9C+C2mFamyvQOegxzTyDz8LDdIBpmUgfL3U2aU0BHkaRcZtWd6qpTtoH5iAanV1XM7ekTAw5tO4= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c368f5dc-878e-4bce-c4fb-08d70de144de X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2019 13:42:26.7658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rasland@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3996 Subject: Re: [dpdk-dev] [PATCH v9 07/11] 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 Guys, We have a failure in testpmd commands when parsing rte_flow commands as fo= llowing which were interduce by this patch: This rule is a valid rule to be added to testpmd: flow validate 0 priority 2 ingress group 0 pattern eth dst is 98:03:9B:5C= :D9:00 / end actions queue index 0 / end but, currently with latest master it will fail with Bad arguments=20 the check for get_ether_addr6/3 is expecting that you reach the end of stri= ng when it parse a MAC address but for rte_flow commands it's not the case, since we provide the full string: gdb) p s $3 =3D 0x28225fa "98:03:9B:5C:D9:00 / end actions queue index 0 / end\n" Kindest regards, Raslan Darawsheh > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > Sent: Monday, July 8, 2019 9:26 PM > To: dev@dpdk.org > Cc: Stephen Hemminger ; Bernard > Iremonger > Subject: [dpdk-dev] [PATCH v9 07/11] 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 > Acked-by: Bernard Iremonger > --- > 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 e3e8448c9421..c92c748b18eb 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" > @@ -4734,8 +4733,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