From patchwork Thu Oct 11 13:31:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 46628 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 162DC1B5B3; Thu, 11 Oct 2018 15:31:47 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00073.outbound.protection.outlook.com [40.107.0.73]) by dpdk.org (Postfix) with ESMTP id 6E8E81B5B3 for ; Thu, 11 Oct 2018 15:31:45 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=AhLj11ob/0HcfILYWa9gHHhjvgwGHR1GFfdxqclQ6gU=; b=Fl4SBjn5WViaSxrHo+n6RIvTQBV9sTLCMZ2ko3cd/aXo+tRZJ+2m1ktfuazWdRIlLdfiba32RHetbHVSbEiUlR6fr1p/LBNyUZjAQalm8CLW0sao1AUyaF9hIziCTrEuGIAOavlxAXy5iO6yK2Qrc06Ho1jHNFLJs1jMFnFz41M= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB2791.eurprd05.prod.outlook.com (10.172.226.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Thu, 11 Oct 2018 13:31:44 +0000 Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913]) by DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 13:31:44 +0000 From: Jack Min To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 2/3] app/testpmd: add commands of modify MAC address Thread-Index: AQHUYWbAZ0Bap5VxUEWNpBFj22kyqQ== Date: Thu, 11 Oct 2018 13:31:43 +0000 Message-ID: <20181011133109.1520-3-jackmin@mellanox.com> References: <20181010131108.24167-1-jackmin@mellanox.com> <20181011133109.1520-1-jackmin@mellanox.com> In-Reply-To: <20181011133109.1520-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR0302CA0021.apcprd03.prod.outlook.com (2603:1096:202::31) To DB6PR0501MB2023.eurprd05.prod.outlook.com (2603:10a6:4:6::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [118.201.220.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0501MB2791; 6:kbsZ6ydRXi+QFSZsbzTtBhCvNZNW06kOTJ1Rpeji7cQN+HSVePPXDWG7nm+69V7jdvuf8ER4YBRiIPWv6S08wuaXnRJcqaNvH+oY7PWQXQNkM1h+Msh4RD60htasnpgNzBbFSgevEax6ifLb9zWv518Eics3H6wzdWwWLhimle0oukY0ZE2APDa373PvzgCkiTv9/OrYeACiFjTdxHq4xkjG5LmF8sJYbxwaEXEvfroivhS514agx3BWk4ziUlT+IUBFRCPoS+A/5WxiBcP+YJrC4mZrfIUSHL8ErnWTk+Jf0Ss0xu41yX5ICfz1ZNteXG4WGpbD8LVQl3nREjVoEnpkYU36g6JvFr/0WQWr+ih+QSD9Icir2NnEu4Fivpky9XMvuSpNE9HRAglyQ1/Ph1lJzI9BowNmuIafu36R2x9WKa2O8lTcU5YWyVjDlpiMiMuj/YNxYGNYhg4YWDsv8A==; 5:GpTwmHEerJdH1aI6zmTSycKzGR70ppEs/RlLsQd44LsJy+bJl5RzSozjgeJtcHg1+vwUPw5bNLXXHVxB323c2mrA/c9l3C/ZFHDix89n+6Tp+g1ggNudyNILLmzXDzR3z2f+HJDBrVD6eAE0wSEbOFJhNoB++PepUJL1zoTSVWA=; 7:QIpgsFoW0bUEIVZ0ScTI8tqy5zCLboTcmTGr2KYViW+PdMASZ22/Mb89QMBcRmfCe3/RTwcGQZ38Bk0V5jVdDxl4yogIbcSoJ8o1egFTolx6ecf/iezBcKfpFp42MfYGkzPQ9EfpRQNuSeCuEmABtDy5/VbuUOFEL5oIGaNqSV1ausoRPC07XHiVWdCh6bmBt0fmJuvV7ewTdlW9Bt0HoF4X8/kMPhcvyGvPi63c90IcdaPXtcj5P89SNSOJDhkH x-ms-office365-filtering-correlation-id: b0f607fb-48c6-44ed-9c57-08d62f7de240 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0501MB2791; x-ms-traffictypediagnostic: DB6PR0501MB2791: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:DB6PR0501MB2791; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2791; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(39860400002)(396003)(376002)(346002)(199004)(189003)(305945005)(53936002)(7736002)(99286004)(105586002)(316002)(478600001)(6506007)(386003)(52116002)(36756003)(106356001)(68736007)(76176011)(110136005)(4326008)(6116002)(81156014)(1076002)(8936002)(8676002)(5250100002)(102836004)(3846002)(81166006)(256004)(2900100001)(14454004)(5660300001)(71190400001)(71200400001)(66066001)(97736004)(446003)(6512007)(11346002)(6486002)(86362001)(26005)(25786009)(6436002)(486006)(186003)(2616005)(476003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2791; H:DB6PR0501MB2023.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-microsoft-antispam-message-info: INLELg5mKi7MQjpkxAoiJ7Kkf8IJehzsIJMEJXs36ykRlmXokFoDDwMa/YTWTtlMFO/CMRo6SB/TzqmRi7yRFRq2IZ1TjRxKeP6/d8U+F3NeNJxxUFE3OTebe7D5/HrPNsWPss7jzqnxV99RJEW9/QRoWu1Rr3lSjjVBxAnYm8ulwQLsebdAePSY0OTSe8dQsBSOL6ZXh9v1eK739VKctitJQNwpVBcs0tt0CBnzfEqUSRUxxIUpb/Eh6nGifuzGGl87MRYMqhtpnWTIoqP6h5qwcgMFUp+OUaIoDGWy14Bs+D0o67xxuw0HLfJ7pd/x14LW19W/JBdIIBIAtiVu+VTXI8HdRROvVIRCUuAlPJ4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0f607fb-48c6-44ed-9c57-08d62f7de240 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 13:31:43.9525 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2791 Subject: [dpdk-dev] [PATCH v3 2/3] app/testpmd: add commands of modify MAC address 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" add commands to support following actions: - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC - RTE_FLOW_ACTION_TYPE_SET_MAC_DST Signed-off-by: Xiaoyu Min Acked-by: Yongseok Koh --- app/test-pmd/cmdline_flow.c | 50 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++ 2 files changed, 58 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 3efc2d86e..a527b6bb4 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -259,6 +259,10 @@ enum index { ACTION_DEC_TTL, ACTION_SET_TTL, ACTION_SET_TTL_TTL, + ACTION_SET_MAC_SRC, + ACTION_SET_MAC_SRC_MAC_SRC, + ACTION_SET_MAC_DST, + ACTION_SET_MAC_DST_MAC_DST, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -841,6 +845,8 @@ static const enum index next_action[] = { ACTION_MAC_SWAP, ACTION_DEC_TTL, ACTION_SET_TTL, + ACTION_SET_MAC_SRC, + ACTION_SET_MAC_DST, ZERO, }; @@ -949,6 +955,12 @@ static const enum index action_set_ipv4_src[] = { ZERO, }; +static const enum index action_set_mac_src[] = { + ACTION_SET_MAC_SRC_MAC_SRC, + ACTION_NEXT, + ZERO, +}; + static const enum index action_set_ipv4_dst[] = { ACTION_SET_IPV4_DST_IPV4_DST, ACTION_NEXT, @@ -991,6 +1003,12 @@ static const enum index action_jump[] = { ZERO, }; +static const enum index action_set_mac_dst[] = { + ACTION_SET_MAC_DST_MAC_DST, + ACTION_NEXT, + ZERO, +}; + static int parse_init(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -2670,6 +2688,38 @@ static const struct token token_list[] = { (struct rte_flow_action_set_ttl, ttl_value)), .call = parse_vc_conf, }, + [ACTION_SET_MAC_SRC] = { + .name = "set_mac_src", + .help = "set source mac address", + .priv = PRIV_ACTION(SET_MAC_SRC, + sizeof(struct rte_flow_action_set_mac)), + .next = NEXT(action_set_mac_src), + .call = parse_vc, + }, + [ACTION_SET_MAC_SRC_MAC_SRC] = { + .name = "mac_addr", + .help = "new source mac address", + .next = NEXT(action_set_mac_src, NEXT_ENTRY(MAC_ADDR)), + .args = ARGS(ARGS_ENTRY_HTON + (struct rte_flow_action_set_mac, mac_addr)), + .call = parse_vc_conf, + }, + [ACTION_SET_MAC_DST] = { + .name = "set_mac_dst", + .help = "set destination mac address", + .priv = PRIV_ACTION(SET_MAC_DST, + sizeof(struct rte_flow_action_set_mac)), + .next = NEXT(action_set_mac_dst), + .call = parse_vc, + }, + [ACTION_SET_MAC_DST_MAC_DST] = { + .name = "mac_addr", + .help = "new destination mac address to set", + .next = NEXT(action_set_mac_dst, NEXT_ENTRY(MAC_ADDR)), + .args = ARGS(ARGS_ENTRY_HTON + (struct rte_flow_action_set_mac, mac_addr)), + .call = parse_vc_conf, + }, }; /** Remove and return last entry from argument stack. */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 77233987b..1ca3e8c20 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3744,6 +3744,14 @@ This section lists supported actions and their attributes, if any. - ``set_ttl``: Set TTL value with specificed value - ``ttl_value {unsigned}``: The new TTL value to be set +- ``set_mac_src``: set source MAC address + + - ``mac_addr {MAC-48}``: new source MAC address + +- ``set_mac_dst``: set destination MAC address + + - ``mac_addr {MAC-48}``: new destination MAC address + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~