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 C505541C61; Fri, 10 Feb 2023 16:18:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3F3342D16; Fri, 10 Feb 2023 16:18:00 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 08B3142D0B for ; Fri, 10 Feb 2023 16:17:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IelWZHXckx/Rexl1B4o6NUXglXlGA5PPGovoutnW8DrFEgAj1StbNsw5zqizB0+CpLcHxgxrgWDQKhMsa6MZIQOf3e58iojzvBqmZEaSTYJ4jrFEIlikN2e7Z7egQo3yeJEV3s5ALChIIi+qjx1cbAoA0Usr0YvAjnhY8uI/deaG4wZsIWIfDf4dieSHh/Sql48Sx9+uWz0kOwFyQjPL31qTL4n9cNj6fRHDvlE7mJs4qO7i8gTUHeZYAlEnT6yvrRhn/bPY4LZOd+DGe/STkRwFOesFpSNSXFxENxFFwJ7OvW4+uLff9ipa0a1Lx+6UdOwfiAcDNvqSv+JPk9UxGg== 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=tckNMrm2fuSRwjemKipf1gUTnwiteN2UYy3v78P0K/I=; b=XyWySigEVf5SJOf8uo/F3vYaIHd+ygqxUeU3igBRp+6wmq9kicQB3+wPUs7n00HCStIWOGDePRJb4hu7O4WRe74LCjoK2/6q0/PnnJ/n2KHQ6Gq+ZEyMyLgMReoqifQWiB1iovHZdJY0KHQaCa9MwlOabjxwVOg5cf8XjCg2eJ6M8kNqAAAjivuaZVPI3uUR18x9CI5vpFm96ajc7Oe6B7OfvrP/tx1Pj5Qh3C2Hfzz17EBsoxvbfhhQPkbXyle5DRm4nGog1aITchELrqgs7t6ZwHu7HRWJ9uNEVjRyg7d8bQhx5B/L6+bCh2obFmPI/FZ6hMHDNMPIy9WyBPogDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=tckNMrm2fuSRwjemKipf1gUTnwiteN2UYy3v78P0K/I=; b=T6PrW8RSh4g5W1X6aT6AF7aQaRoyUuD9muqg786CrxT0RpLIecPEowxLAZAcNcSMOPHptxzwcBJUS2+tEvd3nDjVaqTwmR4RLrujYYwJs48OzACNHOJxtX3BPn3m7x6lvZ6w6iEUnPqYfyTWiADLEsHPCairu+MxpcBjnmNcbru9q5O8uzVG34406lNuBs8m3OFrsvm3MEwEjAjp4dejnssZmVXPXpgKfNa8OpuyZeB1cWoEgu6dEHoPyLb/J22tCyC7yE4/NN4rjPijIrSGlB0OGlD7LrQ/kabozWp5DJsSEC99XJFh96P9uSDpp4gdf2308ST42pcsOsjIXbDphg== Received: from MW4PR03CA0094.namprd03.prod.outlook.com (2603:10b6:303:b7::9) by DS0PR12MB7827.namprd12.prod.outlook.com (2603:10b6:8:146::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.19; Fri, 10 Feb 2023 15:17:57 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::3f) by MW4PR03CA0094.outlook.office365.com (2603:10b6:303:b7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.21 via Frontend Transport; Fri, 10 Feb 2023 15:17:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.21 via Frontend Transport; Fri, 10 Feb 2023 15:17:56 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 10 Feb 2023 07:17:45 -0800 Received: from nvidia.com (10.126.231.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; Fri, 10 Feb 2023 07:17:43 -0800 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v3 3/3] app/testpmd: add shared indirect action support Date: Fri, 10 Feb 2023 17:17:09 +0200 Message-ID: <20230210151709.1619-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230210151709.1619-1-viacheslavo@nvidia.com> References: <20230206095229.23027-1-viacheslavo@nvidia.com> <20230210151709.1619-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT012:EE_|DS0PR12MB7827:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aeb37c7-5a2c-49c9-bcfe-08db0b79fd36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5dcEpeaQFRtLkaGC2NHC51RdEHc5UFQ6bhZ/wz4Cv8jY4Yg4FI4Zdb1tsW9oG8D5BaLtw2peOlq3KOR8DIS1gF8WHh1sHyIHWDI1fUPhFYqOQcvDTgbhgO9SycYC5Ip/rAOLRQfWub4davNY61rdyj+bk3Z43ihmUAdZz7tNggwpxzoIMGlAsWvVZawDXaMxQ6W78WvkzKEAlrHa405U+lceL4HVQEch/iIRIrRsxhM457Busm6j/cMnquRdzz92nVMgtKUgtE5JqFjLlJRMPPR92qlf3Ap+NJvUFhFd1epyFZ/swDrQvprmoBn+OW0UNXbIdHRphYDDCOm/5m+H01WR3ProYWUgxwD4rpdXTeVyfmk30ibBzVcPGLKmoROKemH/AB7Fne8dTfqPMwuM2gZZ68+dz6j0VUcFY66c241xT4EyhVAjqnXf7N7e709Rf5/VJ1jQkD2EwJOwtatHdzCwRl28Bakos1dMOkI9/J+h86bR/x5aqYbGwHZfL8aj1eznKdxf/Zxgf8ISOkPfeF0TyI3vDRgsDG7aoZjSq1qB7BPbtaZCcgfCxcKwWlWPoHtJZZAx5q8wNcb64qmHagN/bOR8yu9+FeEvuhMd3FzbtYtjqw74wg5f+eSGmV3BSmGQN7lUOMpgQSnVmlRDOBeFzGefKVV3NlXNVvktBqV/ZPXzM2c7wrlNQ6PeXb0K/A/vtqvGuRDJeZTb/rysDw== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199018)(40470700004)(46966006)(36840700001)(5660300002)(6286002)(36860700001)(26005)(82740400003)(7636003)(186003)(8936002)(40460700003)(1076003)(356005)(2906002)(16526019)(41300700001)(6666004)(70586007)(6916009)(70206006)(8676002)(4326008)(2616005)(86362001)(336012)(316002)(83380400001)(47076005)(478600001)(55016003)(82310400005)(54906003)(426003)(36756003)(40480700001)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2023 15:17:56.8666 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8aeb37c7-5a2c-49c9-bcfe-08db0b79fd36 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7827 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 7778828919..f2403622d6 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -607,6 +607,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, @@ -1926,6 +1928,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, @@ -2435,6 +2438,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); @@ -6522,6 +6528,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", @@ -10006,6 +10029,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, @@ -10026,7 +10074,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