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 3340C41EB1; Thu, 16 Mar 2023 15:20:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FB3C40DF6; Thu, 16 Mar 2023 15:20:08 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2075.outbound.protection.outlook.com [40.107.92.75]) by mails.dpdk.org (Postfix) with ESMTP id B134540DDC for ; Thu, 16 Mar 2023 15:20:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQvmPRFh1oxAuKbC5afxSbdFT6mGb0xHDkfieUDhM6yAQqlEFTTgfyaXPzrDHg+J6zQKGPsHBCjZajXwNn7vOe/jbmhQKa5fCcaWFX7Kc/jRimXEOFDY/sxi8EiyfKTMU+bHiz7PqkiB1gBKpfuiHO+yrEqqFFOamnFlfX0UmyUtr5f9XzcavKcfLaV5EFGB4lxvocOVDuG5lYNCzDCqKead7n0IJv28UVkV+L0R48rckTK8/Lnct9SYFcV7MZu58DWu20GinVJAqcyF2J2WsFhGQymqCevDHqQmot9TLZADWu18cO2od4YLkI0APEVF3lUmfHkjw7U7BzCUb4MsOQ== 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=vvJJxry5ELcRXsmXl5qBDGHELyJkHQ0vMPnjuRMOE90=; b=Y0GxsjCtvKRAfAYeqlpRey7XolCciec2E/XLRt7RxSLBAcN9go925lrx07lCsP2MyVHDa9Pccw55SrVzO1+Yxga4niLQshpT3OBaLghwWg+imdljVFphvU+VYgcKAjM6BKN7xQdr+vmQfT8lBPSD+B6uDz4cMSShecnzD2uZwJg7jnnpfN3fvcVevz7OuPiiXc2SfmLHibrxUE7ogSMuBhgfTyQOiNAlPxv0PI6011cgu+Iyg7qSlEfMZ9O+OcqQsoOsL4Y/CyEFGOu3P6OLcuejj0R103HNg1e5pdaaLe1S8ytWy6o+60P3T/vGSTEkxZJFGXkYSZfo1sonottdrA== 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=vvJJxry5ELcRXsmXl5qBDGHELyJkHQ0vMPnjuRMOE90=; b=TioODrefkKy4oegyQbhpAedx/3Wcq5IObYC3omLhtltzwwBYlAWAe1ZqSj4eO5KPJ8c5EHt3knTz0SLMQc6LKLKJz8yB454TGamqgDT/ul+cLbTHZGp4xCYOhjljlgHv+cLe/HhdmRP7eZ4nkFekkW8TGK1xMtkRqKogMAHO18o31STGEqRV5VPaCr2KZcqUQVbdDQKBlPkUnIEQyCBZ3q3HU5YVPMwlq6YtbwbK1M78vBP0pVSie31/1dk7vhMbT5TIEF4LCYmzb4DGMs/L5f6U7udC/4kp+hl4USxin6qQm+dwODx62MLWKCI41ZUKWfEmXdWo1jwXOyAhIPit6g== Received: from MN2PR14CA0025.namprd14.prod.outlook.com (2603:10b6:208:23e::30) by PH7PR12MB5782.namprd12.prod.outlook.com (2603:10b6:510:1d1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.31; Thu, 16 Mar 2023 14:20:03 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::75) by MN2PR14CA0025.outlook.office365.com (2603:10b6:208:23e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.31 via Frontend Transport; Thu, 16 Mar 2023 14:20:02 +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 BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.13 via Frontend Transport; Thu, 16 Mar 2023 14:20:02 +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.5; Thu, 16 Mar 2023 07:19:50 -0700 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.37; Thu, 16 Mar 2023 07:19:48 -0700 From: Gregory Etelson To: CC: , , , Ori Kam , Aman Singh , Yuying Zhang Subject: [PATCH V2 1/2] app/testpmd: change flow rule type Date: Thu, 16 Mar 2023 16:19:33 +0200 Message-ID: <20230316141934.23181-1-getelson@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230222141139.3233715-2-elibr@nvidia.com> References: <20230222141139.3233715-2-elibr@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: BL02EPF00010209:EE_|PH7PR12MB5782:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f09d358-fba7-4f7e-7df6-08db2629886f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: boYzp5QuJgzlnGoGWCXnCHKUbCK/rGqu16NXzdF++P5LtF/qT+aKDePmMYAzYmNysJtAXZShvNEnM7Af2zEyzlD0X9blCkmHX0QiAxQBHvh1xWBJ5+8Wmjn+Of0kpzBJmwzxqZehpUAYy5xydSjV38TzOkiXf2o0lAD8B4B9yQjiZ/GiOmX7XYdVOS2CyCvJzCnmVODjPT8dBDtzjMlbLw0yH6UQ4BEwusXhnqyLFVBcym1iZqtBvJf8r2nFNifNUH2FigLvjoqtG/V4Iu4N1YlOMM5MomC/+mvTgpKWkO0nl22HfiHCnHGaeTWsAzKFL9PIkKF35HZHqj2Zrto7CrVUdIofevY7D3NkA4vqlckS/I3PYTlbBjcIZmjItRzLBxVVfaqmDoiO45Rbz4mwB6du0Rx0cfA7yYRsCnd0fZE/w2RKOx3KpwS0SEypQOEezwPMFWocFMSSl94z+pTz2YPw3YjcJRx1TJZMwb/JmAVRogMLq4FmxsfavsvHC6e320/X/wp5PDgJGJXSRoH45/beUA5MPDl5HP1qiW4D8HAdVSTEezE8FfWJiEw9iOP4zo7ECyTYxZfEAEQjfZ99th11AiLRnXdajq+LCZs8ndGKM3Ke5tlPGPn/Bss0Cae5HbZxjpDxv7fcQxV2AVK7mi2cME9zgtho+cfl/Ke2P9h4VKyruOdTMCHxDjbxxu8dPF0O9azR4fmEMAPlv/C5En17+O9TW5brhcefXhSp4B7KYg/ycrHHDB1yG8lE21jz 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)(376002)(346002)(136003)(396003)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(54906003)(8936002)(41300700001)(478600001)(40480700001)(55016003)(40460700003)(70586007)(8676002)(70206006)(4326008)(6916009)(82740400003)(86362001)(36756003)(82310400005)(356005)(36860700001)(7636003)(26005)(1076003)(186003)(6666004)(7696005)(6286002)(16526019)(5660300002)(2906002)(316002)(83380400001)(426003)(47076005)(336012)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2023 14:20:02.5392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f09d358-fba7-4f7e-7df6-08db2629886f 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: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5782 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 From: Eli Britstein Change flow rule type to be uint64_t (instead of currently uint32_t) to be able to accommodate larger IDs, as a pre-step towards allowing user-id to flows. Signed-off-by: Eli Britstein --- app/test-pmd/cmdline_flow.c | 12 ++++++------ app/test-pmd/config.c | 34 ++++++++++++++++++---------------- app/test-pmd/testpmd.h | 10 +++++----- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 9309607f11..aab0df91c2 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -1085,16 +1085,16 @@ struct buffer { uint8_t *data; } vc; /**< Validate/create arguments. */ struct { - uint32_t *rule; - uint32_t rule_n; + uint64_t *rule; + uint64_t rule_n; } destroy; /**< Destroy arguments. */ struct { char file[128]; bool mode; - uint32_t rule; + uint64_t rule; } dump; /**< Dump arguments. */ struct { - uint32_t rule; + uint64_t rule; struct rte_flow_action action; } query; /**< Query arguments. */ struct { @@ -9683,7 +9683,7 @@ parse_qo_destroy(struct context *ctx, const struct token *token, void *buf, unsigned int size) { struct buffer *out = buf; - uint32_t *flow_id; + uint64_t *flow_id; /* Token name must match. */ if (parse_default(ctx, token, str, len, NULL, 0) < 0) @@ -10899,7 +10899,7 @@ comp_rule_id(struct context *ctx, const struct token *token, port = &ports[ctx->port]; for (pf = port->flow_list; pf != NULL; pf = pf->next) { if (buf && i == ent) - return snprintf(buf, size, "%u", pf->id); + return snprintf(buf, size, "%"PRIu64, pf->id); ++i; } if (buf) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 018536f177..804af98c0e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2725,7 +2725,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, flow = rte_flow_async_create_by_index(port_id, queue_id, &op_attr, pt->table, rule_idx, actions, actions_idx, job, &error); if (!flow) { - uint32_t flow_id = pf->id; + uint64_t flow_id = pf->id; port_queue_flow_destroy(port_id, queue_id, true, 1, &flow_id); free(job); return port_flow_complain(&error); @@ -2736,14 +2736,14 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, pf->flow = flow; job->pf = pf; port->flow_list = pf; - printf("Flow rule #%u creation enqueued\n", pf->id); + printf("Flow rule #%"PRIu64" creation enqueued\n", pf->id); return 0; } /** Enqueue number of destroy flow rules operations. */ int port_queue_flow_destroy(portid_t port_id, queueid_t queue_id, - bool postpone, uint32_t n, const uint32_t *rule) + bool postpone, uint32_t n, const uint64_t *rule) { struct rte_flow_op_attr op_attr = { .postpone = postpone }; struct rte_port *port; @@ -2790,7 +2790,8 @@ port_queue_flow_destroy(portid_t port_id, queueid_t queue_id, ret = port_flow_complain(&error); continue; } - printf("Flow rule #%u destruction enqueued\n", pf->id); + printf("Flow rule #%"PRIu64" destruction enqueued\n", + pf->id); *tmp = pf->next; break; } @@ -3089,7 +3090,7 @@ port_queue_flow_push(portid_t port_id, queueid_t queue_id) /** Pull queue operation results from the queue. */ static int port_queue_aged_flow_destroy(portid_t port_id, queueid_t queue_id, - const uint32_t *rule, int nb_flows) + const uint64_t *rule, int nb_flows) { struct rte_port *port = &ports[port_id]; struct rte_flow_op_result *res; @@ -3152,7 +3153,7 @@ port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy) { void **contexts; int nb_context, total = 0, idx; - uint32_t *rules = NULL; + uint64_t *rules = NULL; struct rte_port *port; struct rte_flow_error error; enum age_action_context_type *type; @@ -3208,7 +3209,7 @@ port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy) switch (*type) { case ACTION_AGE_CONTEXT_TYPE_FLOW: ctx.pf = container_of(type, struct port_flow, age_type); - printf("%-20s\t%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 + printf("%-20s\t%" PRIu64 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t\n", "Flow", ctx.pf->id, @@ -3356,13 +3357,13 @@ port_flow_create(portid_t port_id, port->flow_list = pf; if (tunnel_ops->enabled) port_flow_tunnel_offload_cmd_release(port_id, tunnel_ops, pft); - printf("Flow rule #%u created\n", pf->id); + printf("Flow rule #%"PRIu64" created\n", pf->id); return 0; } /** Destroy a number of flow rules. */ int -port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule) +port_flow_destroy(portid_t port_id, uint32_t n, const uint64_t *rule) { struct rte_port *port; struct port_flow **tmp; @@ -3391,7 +3392,7 @@ port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule) ret = port_flow_complain(&error); continue; } - printf("Flow rule #%u destroyed\n", pf->id); + printf("Flow rule #%"PRIu64" destroyed\n", pf->id); *tmp = pf->next; free(pf); break; @@ -3436,7 +3437,7 @@ port_flow_flush(portid_t port_id) /** Dump flow rules. */ int -port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id, +port_flow_dump(portid_t port_id, bool dump_all, uint64_t rule_id, const char *file_name) { int ret = 0; @@ -3465,7 +3466,8 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id, } } if (found == false) { - fprintf(stderr, "Failed to dump to flow %d\n", rule_id); + fprintf(stderr, "Failed to dump to flow %"PRIu64"\n", + rule_id); return -EINVAL; } } @@ -3495,7 +3497,7 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id, /** Query a flow rule. */ int -port_flow_query(portid_t port_id, uint32_t rule, +port_flow_query(portid_t port_id, uint64_t rule, const struct rte_flow_action *action) { struct rte_flow_error error; @@ -3517,7 +3519,7 @@ port_flow_query(portid_t port_id, uint32_t rule, if (pf->id == rule) break; if (!pf) { - fprintf(stderr, "Flow rule #%u not found\n", rule); + fprintf(stderr, "Flow rule #%"PRIu64" not found\n", rule); return -ENOENT; } ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR, @@ -3624,7 +3626,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy) switch (*type) { case ACTION_AGE_CONTEXT_TYPE_FLOW: ctx.pf = container_of(type, struct port_flow, age_type); - printf("%-20s\t%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 + printf("%-20s\t%" PRIu64 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t\n", "Flow", ctx.pf->id, @@ -3702,7 +3704,7 @@ port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group) const struct rte_flow_action *action = pf->rule.actions; const char *name; - printf("%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t", + printf("%" PRIu64 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t", pf->id, pf->rule.attr->group, pf->rule.attr->priority, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index bdfbfd36d3..c2b0a0a48b 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -216,7 +216,7 @@ struct port_table { struct port_flow { struct port_flow *next; /**< Next flow in list. */ struct port_flow *tmp; /**< Temporary linking. */ - uint32_t id; /**< Flow rule ID. */ + uint64_t id; /**< Flow rule ID. */ struct rte_flow *flow; /**< Opaque flow object returned by PMD. */ struct rte_flow_conv_rule rule; /**< Saved flow rule description. */ enum age_action_context_type age_type; /**< Age action context type. */ @@ -966,7 +966,7 @@ int port_queue_flow_create(portid_t port_id, queueid_t queue_id, const struct rte_flow_item *pattern, const struct rte_flow_action *actions); int port_queue_flow_destroy(portid_t port_id, queueid_t queue_id, - bool postpone, uint32_t n, const uint32_t *rule); + bool postpone, uint32_t n, const uint64_t *rule); int port_queue_action_handle_create(portid_t port_id, uint32_t queue_id, bool postpone, uint32_t id, const struct rte_flow_indir_action_conf *conf, @@ -1002,11 +1002,11 @@ int port_action_handle_query(portid_t port_id, uint32_t id); void update_age_action_context(const struct rte_flow_action *actions, struct port_flow *pf); int mcast_addr_pool_destroy(portid_t port_id); -int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule); +int port_flow_destroy(portid_t port_id, uint32_t n, const uint64_t *rule); int port_flow_flush(portid_t port_id); int port_flow_dump(portid_t port_id, bool dump_all, - uint32_t rule, const char *file_name); -int port_flow_query(portid_t port_id, uint32_t rule, + uint64_t rule, const char *file_name); +int port_flow_query(portid_t port_id, uint64_t rule, const struct rte_flow_action *action); void port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group); void port_flow_aged(portid_t port_id, uint8_t destroy); -- 2.25.1