From patchwork Wed Sep 28 09:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 117045 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 311BFA00C2; Wed, 28 Sep 2022 11:18:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D52354113D; Wed, 28 Sep 2022 11:18:56 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2069.outbound.protection.outlook.com [40.107.223.69]) by mails.dpdk.org (Postfix) with ESMTP id 1A51D4113C for ; Wed, 28 Sep 2022 11:18:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iNiHo1vX73rCl6Xf5Uw2Z4djHtYf3ynTiX3IWjZ9rl2tJB7P7LjDmwXm10KK8RFCAXae9duvJXjmK3jaOcVLJR/bhlE/jTZ2NfI37Fy8HRDg/A1AqBNu6QiyTb2QAleBOJyaki0jKslWoLMn9OFQmOacuwPk3TAdALGhodM+GUo5BTs3O5IOTQw/pew4ONbGvb1KiHOv/JwgubiJWgGFkMRiTXpb4blQyOlqivgFArcTPfExb3n0yFODn3dPeQjKwb0XhWqV0XxAnbjyl4/E7s8d7gIiWE/iRCTMM/66hM4puaV+aelAHiOaV0ORRpqRVUX68u+zODsPaOnFk4hwvA== 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=mp1U18HTjb0DfAEMZs/2tvvq+JOFABDp/F2xfyPe/fQ=; b=lMmG4lpYggV+och39W9BZsNJGqCCKuHUaDHsUyHTO+ZQ4csFZz3uCtL8vdadrodWuqzsJ6oFcNpZm/fH2rQK0edOtIZCUV4jWYn2Ff52l3mCswabGIIrRs9E5tt+KWNup43rxQHPvL7JZO4B+UcndK/QGHx0ZOZFI2PK9ggM25LzNL97H7+ncJuG8zoGey//foVZT/1HCMH6pp8T2xIrqd7Yfo2UmYqfchfdyXfmH0xmTiOAcKaRbDjqmo/wcLe0CsG5h7PA2bSmkd9B/+3Xc9YvOmBRPSIKHE7DK57kclHsD0/DOfP84ljt4d20TTkb8TzaMUBw1ynXzLUOvxvLOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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=mp1U18HTjb0DfAEMZs/2tvvq+JOFABDp/F2xfyPe/fQ=; b=RvzcnSsh4yHHL4ToG0Cp2e9PLbP6gTOfjNg1vKwMWx2eZSgDQiTcMVLaWo2VCOW41W0B7mKIi2mmIXEyjJ4pcDxVNCedAx2bx5quWq0Th2mjy2bPpATAUoCCPL/Omy+HRFr/2bQsKfYs4bwEZMzz++/vlx+TCCOjhqO7/mTd5ptZxJu3x5QkdNQOYDwwF+ZOIfYkvu4flfqv0i4W9CkPiGzOV9qWUM7/v3Le6x/oKXbY0kCozQo9TWtunn7Q96MfA5NDZMZzGuqXOsjhW7w/VKGTfAgocXNCaG7yss8TMIFN15zC4QJYx1yaOSqo4iQ0LK/yOmcPRBmSEfE1M+80Gg== Received: from BLAPR03CA0045.namprd03.prod.outlook.com (2603:10b6:208:32d::20) by CY5PR12MB6226.namprd12.prod.outlook.com (2603:10b6:930:22::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Wed, 28 Sep 2022 09:18:53 +0000 Received: from BL02EPF0000C407.namprd05.prod.outlook.com (2603:10b6:208:32d:cafe::52) by BLAPR03CA0045.outlook.office365.com (2603:10b6:208:32d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Wed, 28 Sep 2022 09:18:53 +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 BL02EPF0000C407.mail.protection.outlook.com (10.167.241.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.13 via Frontend Transport; Wed, 28 Sep 2022 09:18:52 +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.26; Wed, 28 Sep 2022 02:18:36 -0700 Received: from nvidia.com (10.126.231.35) 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.29; Wed, 28 Sep 2022 02:18:33 -0700 From: Rongwei Liu To: , , , , Aman Singh , Yuying Zhang , Ferruh Yigit , "Andrew Rybchenko" CC: , Subject: [PATCH v2] ethdev: add hint when creating async transfer table Date: Wed, 28 Sep 2022 12:18:17 +0300 Message-ID: <20220928091817.67842-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] 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: BL02EPF0000C407:EE_|CY5PR12MB6226:EE_ X-MS-Office365-Filtering-Correlation-Id: cb2b2a4b-5219-41f6-c67f-08daa132763e X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qzQkVcKgm5YtYKIpvoGg2ypS2iw48GRGz5uSntOXfqVwOA0GD0J8k7otpZ7baxDMDEmqixY6eg8VNzYG/3izjKrc67534CAQfdnITsTbmqfFc2nXHJ3Je0GmQu4wJk5ll0EiYjCuubhzwOk1Nm/nROk5/DxxCZhbLFg5euiQ+hpSKoHP3pIFdEFJzkLwLVFbk3DabfDWtObPD8OjOL3DtU54Qf4fn8oXQtYF1Vu6qbi7PGrpQ2nrmoas/SXHEvQuY+xg7fsqqjVQZocBWmUC7nuHwRtIc/xtzhObYQm2BY+MVXXi14qy7tiokXVeAee9ukVfaPYMGylOGCuBBhReZLNzLNVoKfEv8MNJcXH2HHpas9tpA12MAPKel1QV+cEXqYqbABXSVOB9sBC9kM1bComnpHRlEwB6xC5egm+8aJoW4E5PCjEviTtiVPDGlxlq3kUn+lzvWaO6T442gOTtyqKJQTDiqs21+GSi0nNqSnc8EAXy1TRhjFml3vAwD05lzk9eAAKx7Y+JSLtjutT0H8xflKNij+93igjwa8hrtR45DSfCtwfxRlRMSSHbSNx8Sdwkfzb1mILNC8EF2PRDqLzAhtB3OcH0bEqEA1qu6ZRU51NIIFYMx428Z761shIH4F9dOJajbQ726wBSAlUXoShEIzGraHy1ROApEVzOUkJ6VjlyUxTSTqKdIoGtSI5vjwV+vlFZoGuqKrpr3rbNiVt8d9egIh6BWkN1HORCq4r/8bMxmlSEyU9yy6oZF49OzzoWr3wOJr0KzAVifnrFbw== 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:(13230022)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(82310400005)(2616005)(336012)(47076005)(426003)(478600001)(356005)(70586007)(7636003)(316002)(6286002)(70206006)(1076003)(8676002)(16526019)(40460700003)(4326008)(2906002)(36756003)(36860700001)(110136005)(41300700001)(82740400003)(107886003)(6666004)(83380400001)(5660300002)(186003)(8936002)(40480700001)(26005)(86362001)(55016003)(54906003)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 09:18:52.8421 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb2b2a4b-5219-41f6-c67f-08daa132763e 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: BL02EPF0000C407.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6226 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: , Reply-To: 5d8d42b2-7011-cb46-7f2c-1b1019c4151e@oktetlabs.ru Errors-To: dev-bounces@dpdk.org The transfer domain rule is able to match traffic wire/vf origin and it means two directions' underlayer resource. In customer deployments, they usually match only one direction traffic in single flow table: either from wire or from vf. Introduce one new member transfer_mode into rte_flow_template_table_attr to indicate the flow table direction property: from wire, from vf or bi-direction(default). It helps to save underlayer memory also on insertion rate, and this new field doesn't expose any matching criteira. By default, the transfer domain is to match bi-direction traffic, and no behavior changed. 1. Match wire origin only flow template_table 0 create group 0 priority 0 transfer wire_orig... 2. Match vf origin only flow template_table 0 create group 0 priority 0 transfer vf_orig... Signed-off-by: Rongwei Liu Acked-by: Ori Kam v2: Move the new field to template table attribute. --- app/test-pmd/cmdline_flow.c | 26 +++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 7 ++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 ++- lib/ethdev/rte_flow.h | 9 ++++++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index d97be6fe98..beacb0a802 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -178,6 +178,8 @@ enum index { TABLE_INGRESS, TABLE_EGRESS, TABLE_TRANSFER, + TABLE_TRANSFER_WIRE_ORIG, + TABLE_TRANSFER_VF_ORIG, TABLE_RULES_NUMBER, TABLE_PATTERN_TEMPLATE, TABLE_ACTIONS_TEMPLATE, @@ -1142,6 +1144,8 @@ static const enum index next_table_attr[] = { TABLE_INGRESS, TABLE_EGRESS, TABLE_TRANSFER, + TABLE_TRANSFER_WIRE_ORIG, + TABLE_TRANSFER_VF_ORIG, TABLE_RULES_NUMBER, TABLE_PATTERN_TEMPLATE, TABLE_ACTIONS_TEMPLATE, @@ -2882,6 +2886,18 @@ static const struct token token_list[] = { .next = NEXT(next_table_attr), .call = parse_table, }, + [TABLE_TRANSFER_WIRE_ORIG] = { + .name = "wire_orig", + .help = "affect rule direction to transfer", + .next = NEXT(next_table_attr), + .call = parse_table, + }, + [TABLE_TRANSFER_VF_ORIG] = { + .name = "vf_orig", + .help = "affect rule direction to transfer", + .next = NEXT(next_table_attr), + .call = parse_table, + }, [TABLE_RULES_NUMBER] = { .name = "rules_number", .help = "number of rules in table", @@ -8895,6 +8911,16 @@ parse_table(struct context *ctx, const struct token *token, case TABLE_TRANSFER: out->args.table.attr.flow_attr.transfer = 1; return len; + case TABLE_TRANSFER_WIRE_ORIG: + if (!out->args.table.attr.flow_attr.transfer) + return -1; + out->args.table.attr.transfer_mode = 1; + return len; + case TABLE_TRANSFER_VF_ORIG: + if (!out->args.table.attr.flow_attr.transfer) + return -1; + out->args.table.attr.transfer_mode = 2; + return len; default: return -1; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 588914b231..de8d6836d6 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3748,6 +3748,13 @@ the maximum number of flow rules is defined at table creation time. Any flow rule creation beyond the maximum table size is rejected. Application may create another table to accommodate more rules in this case. +Attribute: transfer_mode +^^^^^^^^^^^^^^^^^^^^^^^^ + +This is an optional table attribute and meaningless if `Attribute: Transfer` +is not specified. It doesn't expose any matching criteria but just as a hint +to indicate PMD where to bound the rules. + .. code-block:: c struct rte_flow_template_table * diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 5fbec06c35..9a97c5f513 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3125,7 +3125,8 @@ It is bound to ``rte_flow_template_table_create()``:: flow template_table {port_id} create [table_id {id}] [group {group_id}] - [priority {level}] [ingress] [egress] [transfer] + [priority {level}] [ingress] [egress] + [transfer [vf_orig] [wire_orig]] rules_number {number} pattern_template {pattern_template_id} actions_template {actions_template_id} diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 017f690798..40c0ebbb1a 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -130,7 +130,7 @@ struct rte_flow_attr { * through a suitable port. @see rte_flow_pick_transfer_proxy(). */ uint32_t transfer:1; - uint32_t reserved:29; /**< Reserved, must be zero. */ + uint32_t reserved:27; /**< Reserved, must be zero. */ }; /** @@ -5233,6 +5233,13 @@ struct rte_flow_template_table_attr { * Maximum number of flow rules that this table holds. */ uint32_t nb_flows; + /** + * 0 means bidirection, + * 0x1 origin uplink, + * 0x2 origin vport, + * N/A both set. + */ + uint32_t transfer_mode:2; }; /**