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 69758A046B for ; Mon, 22 Jul 2019 18:15:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AFC591BEB8; Mon, 22 Jul 2019 18:15:35 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id EEE081BEB4 for ; Mon, 22 Jul 2019 18:15:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 09:15:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,295,1559545200"; d="scan'208";a="192772745" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.10]) ([10.237.221.10]) by fmsmga004.fm.intel.com with ESMTP; 22 Jul 2019 09:15:31 -0700 To: Raslan Darawsheh , Stephen Hemminger , "dev@dpdk.org" Cc: Bernard Iremonger References: <20190516180427.17270-1-stephen@networkplumber.org> <20190708182614.1677-1-stephen@networkplumber.org> <20190708182614.1677-8-stephen@networkplumber.org> From: Ferruh Yigit Openpgp: preference=signencrypt Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= mQINBFXZCFABEADCujshBOAaqPZpwShdkzkyGpJ15lmxiSr3jVMqOtQS/sB3FYLT0/d3+bvy qbL9YnlbPyRvZfnP3pXiKwkRoR1RJwEo2BOf6hxdzTmLRtGtwWzI9MwrUPj6n/ldiD58VAGQ +iR1I/z9UBUN/ZMksElA2D7Jgg7vZ78iKwNnd+vLBD6I61kVrZ45Vjo3r+pPOByUBXOUlxp9 GWEKKIrJ4eogqkVNSixN16VYK7xR+5OUkBYUO+sE6etSxCr7BahM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0het60wJQQ45O8TpTcxpc9nGzcE4MTaLAI3E8TjIXAO0cPqUNLyp g0DXezmTw5BU+SKZ51+jSKOtFmzJCHOJZQaMeCHD+G3CrdUHQVQBb5AeuH3KFv9ltgDcWsc8 YO70o3+tGHwcEnyXLdrI0q05wV7ncnLdkgVo+VUN4092bNMPwYly1TZWcU3Jw5gczOUEfTY7 sgo6E/sGX3B+FzgIs5t4yi1XOweCAQ/mPnb6uFeNENEFyGKyMG1HtjwBqnftbiFO3qitEIUY xWGQH23oKscv7i9lT0gg2D+ktzZhVWwHJVY/2vWSB9aCSWChcH2BT+lWrkwSpoPhy+almM84 Qz2wF72/d4ce4L27pSrS+vOXtXHLGOOGcAn8yr9TV0kM4aR+NbGBRXGKhG6w4lY54uNd9IBa ARIPUhij5JSygxZCBaJKo+X64AHGkk5bXq+f0anwAMNuJXbYC/lz4DEdKmPgQGShOWNs1Y1a N3cI87Hun/RBVwQ0a3Tr1g6OWJ6xK8cYbMcoR8NZ7L9ALMeJeuUDQR39+fEeHg/6sQN0P0mv 0sL+//BAJphCzDk8ztbrFw+JaPtgzZpRSM6JhxnY+YMAsatJRXA0WSpYP5zzl7yu/GZJIgsv VQ== Message-ID: <2ffe6500-f5ed-035b-1de6-ce6da65bfaf4@intel.com> Date: Mon, 22 Jul 2019 17:15:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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" On 7/21/2019 2:42 PM, Raslan Darawsheh wrote: > Hi Guys, > > We have a failure in testpmd commands when parsing rte_flow commands as following 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 > > the check for get_ether_addr6/3 is expecting that you reach the end of string 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 = 0x28225fa "98:03:9B:5C:D9:00 / end actions queue index 0 / end\n" Hi Raslan, Will it work if only 'cmdline_flow.c' change reverted? If so I suggest revert only 'cmdline_flow.c' change for rc2, and we can work on the proper fix later. > > > 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 >> >> 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 >> 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(-) >> >> 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 >> >> #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 = 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 >