From patchwork Tue Feb 7 14:02:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 123248 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 80B8141C30; Tue, 7 Feb 2023 15:02:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 715AF427F5; Tue, 7 Feb 2023 15:02:51 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) by mails.dpdk.org (Postfix) with ESMTP id 466CB410F6 for ; Tue, 7 Feb 2023 15:02:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZL6WrRHnmhAwnjVu+EEaqFsWAt875E4PsBbM2DA7HpryweLK1umIct0ZGt4pnaH8cRXdFfntpIkAkWAakiajxAx00Bvz/hQwegF0CCRK+mB5Z4lUjn4y6oLuQdb+oN58/+tVVeZU813jXf29WwSkGFgfs0SpPNeOqTNu8aQ3l9NMMoJJAA6xPNnm19WD/mtHQkOSUoR3MOjQartct+/bcmFND2UtxWUMNuF1u9Ry5CYfVpiEHj/ZxZIULFpedVub40j9u/OI8mftiPYsoLBUZ0dKn2XCX57WWyTdmJz01aoPDv1J9IUATt6z1PWrkENOUfyGZtm9vZuDOBVJYg+0yw== 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=yEjhMocXTXEU9lUPoCeptIKldBJLuvWflV8kOZc1aeQ=; b=eY+ta8KJHkhomN+IRY9hd4ryLDe5BTWMkmgXGUBMbVFvF49AjebXf7273Sof0ZLcvmZnaUFBg74xqaVu2TPgjlkWpUptrKeFxVEHWe0rlPlhqaDARbNopbBU2VXTfpn1oDRBQKzCCHV+8HYu27aCzmfcK7cjA3K/61mZ1LIWUpJaMAoAgu3bRK2qwIl/0ysKFEQwZHJy70FG2D/HJSDBApkpl6hnsQ3tcxxXVvUcfZ0ejjoHR5qchohpQCSLOYxahCq4Tdz02HKbavD7O9FIO5LJhmJbKUu+vE7F1bX7/OfeSduAgyt5eW9ZVTz8W4dFKOGgN+szzeJqUfywSDTblw== 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=yEjhMocXTXEU9lUPoCeptIKldBJLuvWflV8kOZc1aeQ=; b=Wi8LRpxiwgpBQY4QHCQ7716cPq5oMo87SHSt9CICxsnhcbGHae/4s6H3SvLZDGZ2Acc8h9SGHWwehCbwnan5MGvy9PLX0tVl0LAVcZzvxe2gUd1yjVtJylJSmeFlZXQLpqalK4OhbYWUIemDKL1JfL/AEHtG2fIMJtfKFNvNVDwJ4hHfJfq0Mb6CC+Qo5leF5J93KTszCB2AJE38NOomJImiLxKQqsPdWQ2fyjOB2YNQKHIWk95x6o8n3iaFL5UXdEaBLNFnRrLNX8T1HbRVgtzB/34U6yXanc1N7388XpGAf3bFB6t8DgqtSPDMvDZW/sBR/IhZqU5fN7zwdyzFxw== Received: from MW4PR03CA0355.namprd03.prod.outlook.com (2603:10b6:303:dc::30) by DS7PR12MB6214.namprd12.prod.outlook.com (2603:10b6:8:96::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Tue, 7 Feb 2023 14:02:48 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::88) by MW4PR03CA0355.outlook.office365.com (2603:10b6:303:dc::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Tue, 7 Feb 2023 14:02:48 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Tue, 7 Feb 2023 14:02:48 +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; Tue, 7 Feb 2023 06:02:35 -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; Tue, 7 Feb 2023 06:02:33 -0800 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 3/9] app/testpmd: add shared indirect action support Date: Tue, 7 Feb 2023 16:02:00 +0200 Message-ID: <20230207140206.29139-3-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230207140206.29139-1-viacheslavo@nvidia.com> References: <20230206095229.23027-1-viacheslavo@nvidia.com> <20230207140206.29139-1-viacheslavo@nvidia.com> MIME-Version: 1.0 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: CO1NAM11FT068:EE_|DS7PR12MB6214:EE_ X-MS-Office365-Filtering-Correlation-Id: edfa8bec-e18f-407d-c822-08db0913fe8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bd5q62OIGiZLF/uGP8kzfhTTmf3QVOA7ergFuCsjLvIksxIqYqFZXZ7R5MM+VnJsyiBiiu8bKW4JSClRXWD4TozItvp/F2uJ9wijlP+yTWWGmBeJkodLAY5xe1vBlSiOGvCQdXRv+nUEpdjIfHxgqz0BBaP2r4j2AjYk1LGCw2BiDa9EVFlWoO2CaTYMeQHq8jyic7ljsbWzd9ZKFRahLSbE+rZg39/t8qSfm4OXf+8i/1GRzj/fUsgLv7BGo3nOhNXU9sGQj75zX/gBesN6pAcs0/ttkrHtLSTurliE/jlyBfVl+KeR6C6wcmjqJDEwninmBbai1a5ZEINA4yMg6ZjptFP7Twjw5N60DU2fNu6WCgLZI+eFZLVEfNc9MfkD/jwqyiU7LEdVIR/syzqEf2fKPOLX71DH4noJksE+8DPjeG6xy+2ZQDF1kP4UAXncE65adqvtZ/N/Q6/2ceFE1/R39gtxgHc1yHG1FNEK0piBbpUeQ04+TxLUatthHrimnftS+LyI7+Jd4jw22MczJjnWHGyj4ro32X2ZpF5ObCjFNcd71PQaEKWlNjvaSjwC5i/WEofOH+1JQIhHvQhao4am42Jbuqvdit+3LeDlALoQ/R+vZLipjbuqp9Q7TT1pACBY4AfK2cKcaYqShJsqX6/S8mkFWx8D1df5Do18Z/wAi1CT/7U/fXi6RyvUaD4plsG4NAY7wpITFpcgqY0VPg== 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)(136003)(376002)(346002)(396003)(39860400002)(451199018)(46966006)(40470700004)(36840700001)(316002)(54906003)(26005)(6286002)(186003)(86362001)(55016003)(47076005)(336012)(7696005)(82310400005)(36756003)(426003)(40480700001)(40460700003)(16526019)(36860700001)(2906002)(6666004)(41300700001)(8676002)(5660300002)(70206006)(4326008)(6916009)(478600001)(8936002)(2616005)(1076003)(82740400003)(356005)(83380400001)(70586007)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2023 14:02:48.1852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edfa8bec-e18f-407d-c822-08db0913fe8d 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6214 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 Acked-by: Ori Kam --- 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;