From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30070.outbound.protection.outlook.com [40.107.3.70]) by dpdk.org (Postfix) with ESMTP id EC3F82BF5 for ; Sun, 14 Jan 2018 09:27:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xkVyC+jV1jj879YTRGDi9C2oRuMlZoq3Aa1g/ifIDiw=; b=S9lhnXnPVf0t9eP1y38+0m0hgG0avcyVYKM/R05/n97y7pJ22zLzAC4nX/PfvzjYP1S2B02iP9KcKMqmuq153ziMxo9EtjKJhDXlrjJ+/6QIE6eGjBXQIoVIKaOgF7LoZ1QWQXslBjuwD1UyS1r/ofKZ3J222yn4aisupDu7X/g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=wisamm@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB2877.eurprd05.prod.outlook.com (2603:10a6:800:b8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Sun, 14 Jan 2018 08:27:20 +0000 From: Wisam Jaddo To: jingjing.wu@intel.com Cc: dev@dpdk.org, wenzhuo.lu@intel.com, orika@mellanox.com, shahafs@mellanox.com, rasland@mellanox.com, thomas@monjalon.net Date: Sun, 14 Jan 2018 10:27:10 +0200 Message-Id: <1515918430-32108-1-git-send-email-wisamm@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0206.eurprd08.prod.outlook.com (2603:10a6:802:15::15) To VI1PR0502MB2877.eurprd05.prod.outlook.com (2603:10a6:800:b8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54d1f403-c851-4efa-2a6a-08d55b28a1e6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:VI1PR0502MB2877; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB2877; 3:s0bkhzxkWygP21CPVpfURLJt/IUw/y3v9NALDMvwGuOtUPg6mQyhesTPlldeYYsFH7nXYLkSbBv9epRMCjFuTSEX3odqVRlQ2FQCSBc8GJfnS6Qvo6+Z4rTRaEEhIjqBtEkobdTAcLtsXT4M2GVJTYioOCObA1hm5p3J56gzyIM4nC4aBV/XsabgtsM41wqXhuNtiXR/ES+wV+rKhCJpGEgcEzxt0wihrCk264HYUedRouPbTpaLBEfuwdcw+oR2; 25:dyMjxlkKWB1c7pHo02hp7cP+SIZHyOf2WcpyGeDs/VM1UWOjU64blri/V5Yds1o6SH8AGDJ8C/78gcJDOHNZqnmTEW6sRx7BbHdAKj5WFshVnnvmoPBGElQxsW9lsLnjhrNUGT2KMJ2wo+wGGn8h+H75p51fxt2SFD9TicbowCTcF8LmSyLAr3aIEVshWWP0kTn9TwAJ1+79axHLTSebp6cIUyvGNCLSqYrhXpx0dRfkWkhlGpj9SsWUZmOG4Ai/BhMXTxzDFOtjDnE2K/6JC5JC2/WvtEf8KWtb5Lv19JCX8CTEl6uPyCAyM9cjXSss5JW81wigx1eXuCEejbbmcA==; 31:BIdQM/gaCV/9SwtSFswSA7WHjSHXd3Qzt6/HSlgJqzurTcEdqeKd6iu2fBN0DvokcTHaJ0ZtV99sSdkJqCoPHDbl+2jFVEFVOZ5cEQP/cS3RvUE3yJzLvmQiO6M81SSDV7i6PRkHvvyHaVxxnrdWTW2xsHvLxMKGFv08VLcA3YoVTzaTtpvF4Cx372+IE8Kl8R3qV59Vou2Y/3E0bq9kce6QSfbqm5Ud9cr5Jk5VnRw= X-MS-TrafficTypeDiagnostic: VI1PR0502MB2877: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB2877; 20:iEeadrUSRvk1DZRvBanjsthGCdtY3O1O99maK5unB31+RASo25C5bwuh4m6zmibRSu2E9cNGhxd88RkVTXxieoFpmBh0BboTKzwvAdRK3hKADpKjpITVhjgdk+8TvJfNHzx+Wi0P1eZ8grHGevJvEL+e72Za74+pZdYeug7y/5FUxucPRUF9UsM/we77O3rBbrt0vGHL71g4M2/0kiSyI2JxyesLBxJSbEa+BB1kLhXzQvj/hOPuQrhvvad+3TcY+T/cjtJH9zPAuF1+vhnXkZy7Q6MW6hEdaStjEfL65AAl4FEd/Not4R+kN9I1TDc56YSL0ZCkGDn216EuQIV1JM0m4EVmj5ikL9yQMQ8Bvzbfz7jKKe/fy10V/7UiaN8i2gC9Ws80zUoio7fquoi4XWzh2EgFTCZrwXx0co3NRhvSa/SKc8nByRVdi2y0aGGD+ROC4sUF6YnEwemiYMUTKswE4Z9UFG2V5yfkZb1X7Ey3EYQ2RH+MslNWyRkioDtN; 4:rJrOUxmrrUULAdJeh2a4q7QQomAn/Gv8uiITIm7j2/CM9QvN7Wfld8gKcDY36PZwCZZ6MB0oCKgHumoNy1TZzlP0xrDjhuOhpHJxAHKgDN2iL0zaCDs/1SFpjaJ5xblorxVTEdRt/iX/1tYpJ3k6fmHBVmn+NFojbUWIsuPeuLM0ZSltYYj+rQn77XNyh2/CO6QRB6dFsR7KJ1oLybpTDlYGKPIXHRvKKfruSEMokGe5LRmY2v+euaaZpLjTrFd0z+BT7X5qor7/Y/BxWD62VHHBAd2Q3D267FbVehRwuFNNAJDyLIXD726AQHKb2wEd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(3231023)(944501161)(93006095)(93001095)(10201501046)(6055026)(6041268)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0502MB2877; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0502MB2877; X-Forefront-PRVS: 05529C6FDB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(396003)(376002)(346002)(39860400002)(189003)(199004)(51416003)(81166006)(7696005)(81156014)(25786009)(5660300001)(52116002)(8936002)(305945005)(47776003)(66066001)(8676002)(21086003)(16526018)(7736002)(2906002)(2361001)(4326008)(55016002)(105586002)(36756003)(50226002)(16586007)(50466002)(97736004)(3846002)(386003)(48376002)(69596002)(2950100002)(6916009)(106356001)(6666003)(86362001)(2351001)(478600001)(6116002)(316002)(53936002)(33026002)(68736007)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB2877; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0502MB2877; 23:fRIZIF04i7t+5dnPJhcJ5rkWOwV6SIfbVS+XcE+?= =?us-ascii?Q?Xp0IGRIcwpMi2vKvYVZ4YFp1tjpws2zF33SnKE0nmFxxAYwSBFEaI7qLVCPe?= =?us-ascii?Q?UVE0tOw0MD9PzXXjtSvftJCB/NjV10kykQTnYPkDZCih85Ez33/bIS5+tf9D?= =?us-ascii?Q?2cLNPPxWTLAjqGKvkdzigRhKNvxRZ1eKpyjxhZn26EMl4o3AtO6bc4V8wVx3?= =?us-ascii?Q?oiK3vJWSxs6IuCc6Ka8nEaGIVDylJPvCgMsoo07PbSeh+H9Cj538BJoJRe0o?= =?us-ascii?Q?uWdoimkJUUhsecnFsRhhdCzbRqT8tpPo14+rco2BZ6b1cHd310YuZjbV523C?= =?us-ascii?Q?tZe/aXDeXuYfXSbnz6uI+JINCa9Exp+niW54B4x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6C+NoqKs7FsSEQOUyrDrLfqJhLJCCUoa8DnOSGNlybYBfh+Q4fJflXotrywHo075Nj4gAb/sVndzoqVd3ULxNWgGhRZVbmkBOvY7YX8GrAcnfygvFZyOx1yFiLNeVLBFT/MYbtDLwcqPHgthN8sDVq9TOutxRMZxPtsBv+RSl2RhtJ1nd1f+gojeTcbnVdk8qoiSAotVfme7uO0/p1Jos8QwnLm89hQ9BLBoz3xCpnudtc/u26lVG2C6vnV9Fa2eFPlQrmKEI0wf21d4fJddbSl9OZxRzDWX9qwwSPk7o5dcah+XeyZnAyBYO3n8ZY1cj8A+uwzo=; 5:YI5+g3x8wH/UNmYSyKPpgABA0OvvAlH5D6bxyMNx4w7+gcLBt1y/OTnTAz2tCO+XukpZVU6kKudE11TfElhQNFKBfUMx+BZRQ3Kse83aHMdKYg1CB+g62Ab/vhjWrzfkMmSQ58X8mPjDe5XnEP5zbZzdzfsQCaOJVC0w55DyPlE=; 24:mVfjcywDoxLq10vwSt+zKgBGjqLZ5Ik9o+j8fCtrS4KgTqApvlU0cHiM0wrMzooFADIWmqqwyC2tLh1EZ6cdDwNR8EGtOZKZDxyZ2cULPck=; 7:HqhcD1EjDw+z9Nr6reZ3jPe/bzSPPb2OgDNhokv2FvXkaoWj8X1amNegU08zjm4w8OGIs1iKSzHOb3XODw0O146pxjJ4IM+LT+qXnnJF4G1wJ6xn3r5yvrITMYQC5csR9x0t4LXoXNNAGT181/VCsH1doHrl5KKuRR48D4kiaCiBvu28gXBOtrU4FX+abiMWP/F83HTmpYHhKBwFxeEUDYQgZabrkVq+4Tl+ZkURFYm02+D+TRG4Fqi9pCsitZw3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2018 08:27:20.8329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54d1f403-c851-4efa-2a6a-08d55b28a1e6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB2877 Subject: [dpdk-dev] [PATCH v2] app/testpmd: add eth peer CLI command 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: , X-List-Received-Date: Sun, 14 Jan 2018 08:27:27 -0000 This command will simulate the process of setting the eth-peer from command line. It will be useful to preform extra testing. usage: testpmd> set eth-peer . Signed-off-by: Wisam Jaddo Acked-by: Wenzhuo Lu --- changes in v2: added Ack from Wenzhuo, and sending to ML again due to the issue of not receiving it from the first time. --- app/test-pmd/cmdline.c | 49 +++++++++++++++++++++++++++++ app/test-pmd/config.c | 19 +++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 ++++++ 4 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d963..605720d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set nbcore (num)\n" " Set number of cores.\n\n" + "set eth-peer (port_id) (peer_addr)\n" + " set the peer address for certain port.\n\n" + "set coremask (mask)\n" " Set the forwarding cores hexadecimal mask.\n\n" @@ -2954,6 +2957,51 @@ cmdline_parse_inst_t cmd_set_fwd_mask = { }, }; +/* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */ +struct cmd_eth_peer_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t eth_peer; + portid_t port_id; + cmdline_fixed_string_t peer_addr; +}; + +static void cmd_set_eth_peer_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_eth_peer_result *res = parsed_result; + + if (test_done == 0) { + printf("Please stop forwarding first\n"); + return; + } + if (!strcmp(res->eth_peer, "eth-peer")) { + set_fwd_eth_peer(res->port_id, res->peer_addr); + fwd_config_setup(); + } +} +cmdline_parse_token_string_t cmd_eth_peer_set = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, set, "set"); +cmdline_parse_token_string_t cmd_eth_peer = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, eth_peer, "eth-peer"); +cmdline_parse_token_num_t cmd_eth_peer_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result, port_id, UINT16); +cmdline_parse_token_string_t cmd_eth_peer_addr = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, peer_addr, NULL); + +cmdline_parse_inst_t cmd_set_fwd_eth_peer = { + .f = cmd_set_eth_peer_parsed, + .data = NULL, + .help_str = "set eth-peer ", + .tokens = { + (void *)&cmd_eth_peer_set, + (void *)&cmd_eth_peer, + (void *)&cmd_eth_peer_port_id, + (void *)&cmd_eth_peer_addr, + NULL, + }, +}; + /* * SET NBPORT, NBCORE, PACKET BURST, and VERBOSE LEVEL CONFIGURATION */ @@ -15558,6 +15606,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_fwd_list, (cmdline_parse_inst_t *)&cmd_set_fwd_mask, + (cmdline_parse_inst_t *)&cmd_set_fwd_eth_peer, (cmdline_parse_inst_t *)&cmd_set_fwd_mode, (cmdline_parse_inst_t *)&cmd_set_fwd_retry_mode, (cmdline_parse_inst_t *)&cmd_set_burst_tx_retry, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index cd2ac11..876ee83 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -78,6 +78,7 @@ #include #endif #include +#include #include "testpmd.h" @@ -2234,6 +2235,24 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc) return 0; } +void +set_fwd_eth_peer(portid_t port_id, char *peer_addr) +{ + uint8_t c, new_peer_addr[6]; + 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) { + 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]; +} + int set_fwd_lcores_mask(uint64_t lcoremask) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27..a2e1a5c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -632,6 +632,7 @@ int set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc); int set_fwd_lcores_mask(uint64_t lcoremask); void set_fwd_lcores_number(uint16_t nb_lc); +void set_fwd_eth_peer(portid_t port_id, char *peer_addr); void set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt); void set_fwd_ports_mask(uint64_t portmask); void set_fwd_ports_number(uint16_t nb_pt); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9789139..7f09cf9 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -459,6 +459,15 @@ set nbport (num) This is equivalent to the ``--nb-ports`` command-line option. +set eth-peer +~~~~~~~~~~~~ + +Set the forwarding peer address for certain port:: + + testpmd> set eth-peer (port_id) (perr_addr) + +This is equivalent to the ``--eth-peer`` command-line option. + set nbcore ~~~~~~~~~~ -- 2.7.4