From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C51541BE9; Mon, 6 Feb 2023 10:54:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 016A242D7C; Mon, 6 Feb 2023 10:53:31 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2061.outbound.protection.outlook.com [40.107.95.61]) by mails.dpdk.org (Postfix) with ESMTP id 165F542D55 for ; Mon, 6 Feb 2023 10:53:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jdnAyCiOLnTe8cgRUS6X6uoRSJy5Q6hOPXuPs/cCnk7InvCSe4opdrx5bU3I7N/h0d6URvvh6OW9XCPp73xrzvfCsrd+6G7M0HoC875Y2B+ztNQeh+nAaYNg+tdF+hkaCzJxRJ3IrLJ6+7ro2LljPc8Z+hM/zj2vT8ZD2nFfe6D9SZ9xDStDnMA7lOjCC7RI0XYzN5zdq1QO6hfUOLm6H0CzCQCd8v9aNhgif8l2TAK0qjIa40rydiif84WlgCY8h/w9cqbVGpZK+4Am/+B4wN78LTIOLZBZwHsGLdYWG6OD9Uh6uK4vq/CsKlJjHt8KMg+j2XJIed163iietoS0Qg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9cpITNXtxYxYyWGS5vZ+93nJo+JkAO9K+6ByZ+HWew0=; b=BFsn/tURN7qkRZduaY5ExoZZRtxGycepBNA4WWLyrGWifw/L+8ZUcgMHO2UpQ4BZ5NNfZG8xwN9na7mEtB0azB+fBuuzlfCB2Cyk4LP4Au4p+xEcrx7fhVg3AwRQoQkIgC7yD9iKpM9hdXtFBQUoPWfpXE91JsbVKPzyPeeA1pgocCIHACVNd5kBVG+nxAEd+gy//x6v8Q9nnbX1mAsAZOQgvdMRqnEwZ20CkK1QHg1S2HEhnQ0g83dQ37dMxlR4MjuI6NvtC3gi40G5zhmhE4o78KLMs0l95zslZcyWNTq8ro7rbbWxX8bKj4xa02tV9uPkEZiHnxMrzCpMwKdbXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9cpITNXtxYxYyWGS5vZ+93nJo+JkAO9K+6ByZ+HWew0=; b=pQCLBLJ5Ohh69mDKROCgD45Y2XGduC1CCI7v1AB6tlK7H3KLCoFK+946rWH3f7jfoTr8v163/1TYbeaOGF50aZTM5PgljL15B5O0UHQymkt5X0RWR8mZ3RFJiEOmta58Vtk477SldLias+kO6ipSThGFzMTy6ihpJmrN5iwlek4Dl/FwsRrGCbi8TD+yRszy/4OCesu9/6APZ/6H/ybkvlAiHtC+6P/ZSE3dJk6yGoEaItwXSL4Jre8fBJrly9Rp5VGg6BKyzrbT/lXxtRFfHLS+HGbd2VOtIauHn6zxL4v1iHAbeUOg8T4c/ttPwSAWizBFr80HoR0lwXbeG57W3Q== Received: from MW4PR04CA0309.namprd04.prod.outlook.com (2603:10b6:303:82::14) by SA0PR12MB7091.namprd12.prod.outlook.com (2603:10b6:806:2d5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 09:53:27 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::25) by MW4PR04CA0309.outlook.office365.com (2603:10b6:303:82::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 09:53:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Mon, 6 Feb 2023 09:53:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 6 Feb 2023 01:53:15 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 6 Feb 2023 01:53:13 -0800 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH 8/9] app/testpmd: add shared indirect action support Date: Mon, 6 Feb 2023 11:52:28 +0200 Message-ID: <20230206095229.23027-8-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230206095229.23027-1-viacheslavo@nvidia.com> References: <20221228165433.18185-1-viacheslavo@nvidia.com> <20230206095229.23027-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT060:EE_|SA0PR12MB7091:EE_ X-MS-Office365-Filtering-Correlation-Id: 370bd344-d1c3-4f21-e447-08db0827fe90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uSVSU/kyDZ+a6TkEUvPzNtDz88TIZt1BJFO+qkAUPzqHSleUGkk4xeFfnCVsNllo76IFeJTLMwWhO57jEFo7KP2t6TyxtN+0AMqzkgxi5flZhrpVaVk+ZWyaEHiaf39dvk6cSrLHCsHJHQuIDa3ElrdJYD37x8DyWApT+bHGEmHwSJVWaDngCY/099KTr9uJ3Tb1XirhqGvBjbTHlrgtUm3fn0M5Lwyp++YVhLCEQDGlcPVgkhAlruo6NfeWoDfpXn7FUdOXatsf3KpYWUcwCHTNN5SwB9/8CJxYy42loGN1Hn55nnmY0eJApQOhZpvpqa9jfzhYqCdt2RmAdNGtoaJ20i2AqdXplguOKjtirgG9xSSfkG5X1yFKWtG0tyDIgb33Jr7Zlkvxp0aThYHGFxD/ohZlRBA/roplaJJd9riR/7Mg339khJ5LS0vydOQSkng36ZEWXBn6ZmXzm114eq0KhMDhMSi50sdnHQksRFscKGDcAlPBRG5DFiTzGY0ppikQD0p2d/wVvnyROlq4sxlgVShMlbR4+lguPw0bXng4IwEpLpLqF5GInb69wbYSUUR9nsUy8pNkjwejagXCBnplGlXQbg2/407fPbOimvWsTA12XtfA1IGVJp2lekkDLvHCi2WbGcsb5+cWCrCpGJYjWF0P32m6+94aWfwWvexI/PI/8uDvMMvcd0W4qiPUIHhB4zhrUGK/dsE1SA3Pjw== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(39860400002)(346002)(136003)(396003)(451199018)(46966006)(40470700004)(36840700001)(70586007)(70206006)(4326008)(316002)(26005)(186003)(54906003)(5660300002)(8936002)(41300700001)(2906002)(8676002)(6916009)(7696005)(478600001)(6666004)(1076003)(6286002)(16526019)(40460700003)(2616005)(36756003)(336012)(426003)(47076005)(83380400001)(36860700001)(55016003)(356005)(7636003)(82740400003)(40480700001)(82310400005)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 09:53:26.9618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 370bd344-d1c3-4f21-e447-08db0827fe90 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7091 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The shared indirect action can be shared between ports, action should be created on single port and the handle can be used in the templates and flows on multiple ports, example: flow configure 0 queues_number 1 queues_size 64 counters_number 64 flow configure 1 queues_number 1 queues_size 64 counters_number 0 host_port 0 flags 1 flow indirect_action 0 create ingress action_id 0 action count / end flow actions_template 0 create ingress actions_template_id 8 template indirect 0 / queue index 0 / end mask count / queue index 0 / end flow actions_template 1 create ingress actions_template_id 18 template shared_indirect 0 0 / queue index 0 / end mask count / queue index 0 / end Signed-off-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index b88756903b..734959ba9b 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -595,6 +595,8 @@ enum index { ACTION_SAMPLE_INDEX, ACTION_SAMPLE_INDEX_VALUE, ACTION_INDIRECT, + ACTION_SHARED_INDIRECT, + INDIRECT_ACTION_PORT, INDIRECT_ACTION_ID2PTR, ACTION_MODIFY_FIELD, ACTION_MODIFY_FIELD_OP, @@ -1882,6 +1884,7 @@ static const enum index next_action[] = { ACTION_AGE_UPDATE, ACTION_SAMPLE, ACTION_INDIRECT, + ACTION_SHARED_INDIRECT, ACTION_MODIFY_FIELD, ACTION_CONNTRACK, ACTION_CONNTRACK_UPDATE, @@ -2387,6 +2390,9 @@ static int parse_ia_destroy(struct context *ctx, const struct token *token, static int parse_ia_id2ptr(struct context *ctx, const struct token *token, const char *str, unsigned int len, void *buf, unsigned int size); +static int parse_ia_port(struct context *ctx, const struct token *token, + const char *str, unsigned int len, void *buf, + unsigned int size); static int parse_mp(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -6374,6 +6380,23 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))), .call = parse_vc, }, + [ACTION_SHARED_INDIRECT] = { + .name = "shared_indirect", + .help = "apply indirect action by id and port", + .priv = PRIV_ACTION(INDIRECT, 0), + .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_PORT)), + .args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t)), + ARGS_ENTRY_ARB(0, sizeof(uint32_t))), + .call = parse_vc, + }, + [INDIRECT_ACTION_PORT] = { + .name = "{indirect_action_port}", + .type = "INDIRECT_ACTION_PORT", + .help = "indirect action port", + .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)), + .call = parse_ia_port, + .comp = comp_none, + }, [INDIRECT_ACTION_ID2PTR] = { .name = "{action_id}", .type = "INDIRECT_ACTION_ID", @@ -9788,6 +9811,31 @@ parse_port(struct context *ctx, const struct token *token, return ret; } +/** Parse tokens for shared indirect actions. */ +static int +parse_ia_port(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct rte_flow_action *action = ctx->object; + uint32_t id; + int ret; + + (void)buf; + (void)size; + ctx->objdata = 0; + ctx->object = &id; + ctx->objmask = NULL; + ret = parse_int(ctx, token, str, len, ctx->object, sizeof(id)); + ctx->object = action; + if (ret != (int)len) + return ret; + /* set indirect action */ + if (action) + action->conf = (void *)(uintptr_t)id; + return ret; +} + static int parse_ia_id2ptr(struct context *ctx, const struct token *token, const char *str, unsigned int len, @@ -9808,7 +9856,10 @@ parse_ia_id2ptr(struct context *ctx, const struct token *token, return ret; /* set indirect action */ if (action) { - action->conf = port_action_handle_get_by_id(ctx->port, id); + portid_t port_id = ctx->port; + if (ctx->prev == INDIRECT_ACTION_PORT) + port_id = (portid_t)(uintptr_t)action->conf; + action->conf = port_action_handle_get_by_id(port_id, id); ret = (action->conf) ? ret : -1; } return ret; -- 2.18.1