From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50050.outbound.protection.outlook.com [40.107.5.50]) by dpdk.org (Postfix) with ESMTP id 7DA251D7 for ; Thu, 4 Jan 2018 10:05:45 +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=L47FjVyEaWik8JsLuY+jpKXfxxMfq7aA/iWSk5/OlJo=; b=KZ7Cc8MJsXRRofTv85Sr22tu4ERecw79WbrB8wj5g6qSLYLxKOczo03MtgKT67N27oI1p3HtKt9rFNDn3MgaDd/qWADJOslg04zTe3KibSE7NJGe+GG3d+2uPWQkKLkAfrvu8rSCn6u7/4e+a67iBiU5tmKcgXfuwAtIE17NImM= Received: from AM5PR0502MB2865.eurprd05.prod.outlook.com (10.175.44.7) by AM5PR0502MB2868.eurprd05.prod.outlook.com (10.175.44.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 4 Jan 2018 09:05:44 +0000 Received: from AM5PR0502MB2865.eurprd05.prod.outlook.com ([fe80::d50c:a2ef:3510:3e6b]) by AM5PR0502MB2865.eurprd05.prod.outlook.com ([fe80::d50c:a2ef:3510:3e6b%18]) with mapi id 15.20.0386.006; Thu, 4 Jan 2018 09:05:43 +0000 From: Wisam Monther To: "jingjing.wu@intel.com" , Raslan Darawsheh CC: "dev@dpdk.org" , Ori Kam , Shahaf Shuler , Wisam Monther Thread-Topic: [PATCH] app/testpmd: add eth peer CLI command Thread-Index: AQHTfX31SSQFPLGBgkCrX2TFTgiGM6Njez7A Date: Thu, 4 Jan 2018 09:05:43 +0000 Message-ID: References: <1514205777-22188-1-git-send-email-wisamm@mellanox.com> In-Reply-To: <1514205777-22188-1-git-send-email-wisamm@mellanox.com> 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=wisamm@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5PR0502MB2868; 6:7LVDoLiKJ8IFMNPFHnmsTye5MUojFGzpDJIxnSV0yDqdESfqeEKwgFMzn9Y7IuFqCmAn6Hk6P4e6M7+EzkgzOEQ8EFeK878nYFTlSmzCnfh/wdBi1NxOcTOe8cChV158dYZUafjZZVBkMRAuDWp2fiSc40SLB7Uy0hBrjLoYmrgL1rJ9Haf1MU+5HjpAqfEIiGbiM55Urh3AbJgyoxvLdXqyNMB6AxZ3CFbgkBO/8oDf61aoZJs20PSDZnassh4iZ1iKHRPpTshSK+eHfmDyrovlccLC70A6r1OYPCHpNbKjK+yH0mLZbbsEL4mMrJ2hfcazUjC3dkyAMUP2ssDlQ4L8NkuPbq/t6tpXXrpp9/6sfKi4T+TM6AkH25lwez9c; 5:Zs41PF/kHo4KtwDJrwfXngroXbJteGtGLEN7o6sg3N2awSKckXP3fDfKZ84HS5dhVqnevlUr4u4Mfe6M3CNuinW0wVrYzJUWUWQBg9A5gXjC12egB7TaXqVEU+hmrsLW7UOp37bQOfySf/QTiJkSQED5Pq2cthmIhYzEmGCM96Q=; 24:FP6oTiDr2mDdV6o5MAAJZoOhFS+CoWQ2xtMQMBo4ZgTE1ey4cCkn+14VlyqhTjIrFV1mkxz0XGGRFJPCgsZlfrAPwsNBikSa4TfPFaP4oog=; 7:6mTJnkljSM6tKhihUfJZ1gWXDhqCtCx/EHxAWI37kBDYcIDqq9CypaLtjYpSFPzTbTUZDKTjaAWOiefDceGghq8WEifaMOcl1ae2Sz7RjDxYkue77ft+VNZ4af9QT5iNiOHBMA6NDbuy2+wVxlUEkElEnXMmHWBZb8ZMQAuWUEvfrRFeyAzlNNaXuzYxl7aaTsJwhoeCMMZ5/6X44FHCxOx/j9kmO3D9ZxNWgLVcrMHB0EdVT8cA9VNnIGhxLRv9 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e4a706c8-4321-40b2-3dfd-08d553525619 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060); SRVR:AM5PR0502MB2868; x-ms-traffictypediagnostic: AM5PR0502MB2868: 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)(93006095)(93001095)(3231023)(944501075)(3002001)(10201501046)(6055026)(6041268)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM5PR0502MB2868; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM5PR0502MB2868; x-forefront-prvs: 054231DC40 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(366004)(39860400002)(39380400002)(376002)(189003)(199004)(13464003)(3660700001)(478600001)(3280700002)(5250100002)(8936002)(8676002)(81156014)(81166006)(316002)(3846002)(97736004)(53546011)(4326008)(68736007)(229853002)(2906002)(6506007)(86362001)(2501003)(25786009)(107886003)(6116002)(53936002)(6246003)(102836004)(6436002)(105586002)(76176011)(33656002)(99286004)(106356001)(55016002)(66066001)(14454004)(7696005)(9686003)(2900100001)(6636002)(2950100002)(110136005)(54906003)(305945005)(5660300001)(7736002)(74316002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0502MB2868; H:AM5PR0502MB2865.eurprd05.prod.outlook.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-antispam-message-info: tvzL+AzOf9dXFgzZzp+yzsu2fqDlXKsWLbC1Dwigqo9DZEOBjpXJhwX72eIp9yqYrOPeGW3IuxFO+EqqlLkYcA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: e4a706c8-4321-40b2-3dfd-08d553525619 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jan 2018 09:05:43.8774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0502MB2868 Subject: Re: [dpdk-dev] [PATCH] 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: Thu, 04 Jan 2018 09:05:45 -0000 +Raslan. BRs, Wisam Jaddo -----Original Message----- From: Wisam Jaddo [mailto:wisamm@mellanox.com]=20 Sent: Monday, December 25, 2017 2:43 PM To: jingjing.wu@intel.com Cc: dev@dpdk.org; Ori Kam; Wisam Monther; Shahaf Shuler Subject: [PATCH] app/testpmd: add eth peer CLI command 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 --- 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" =20 + "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" =20 @@ -2954,6 +2957,51 @@ cmdline_parse_inst_t cmd_set_fwd_mask =3D { }, }; =20 +/* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */ struct=20 +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 =3D parsed_result; + + if (test_done =3D=3D 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 =3D + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, set, "set");=20 +cmdline_parse_token_string_t cmd_eth_peer =3D + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, eth_peer,=20 +"eth-peer"); cmdline_parse_token_num_t cmd_eth_peer_port_id =3D + TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result, port_id, UINT16);=20 +cmdline_parse_token_string_t cmd_eth_peer_addr =3D + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, peer_addr, NULL); + +cmdline_parse_inst_t cmd_set_fwd_eth_peer =3D { + .f =3D cmd_set_eth_peer_parsed, + .data =3D NULL, + .help_str =3D "set eth-peer ", + .tokens =3D { + (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[] =3D { (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-pm= d/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 =20 #include "testpmd.h" =20 @@ -2234,6 +2235,24 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigne= d int nb_lc) return 0; } =20 +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 =3D 0; c < 6; c++) + peer_eth_addrs[port_id].addr_bytes[c] =3D + new_peer_addr[c]; +} + int set_fwd_lcores_mask(uint64_t lcoremask) { diff --git a/app/test-pmd/testp= md.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, unsign= ed int nb_lc); int set_fwd_lcores_mask(uint64_t lcoremask); void set_fwd_= lcores_number(uint16_t nb_lc); =20 +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/gui= des/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) =20 This is equivalent to the ``--nb-ports`` command-line option. =20 +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 ~~~~~~~~~~ =20 -- 2.7.4