From patchwork Thu Aug 11 07:13:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 114826 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 D69BBA0548; Thu, 11 Aug 2022 09:13:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B9EC40DDE; Thu, 11 Aug 2022 09:13:38 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2087.outbound.protection.outlook.com [40.107.92.87]) by mails.dpdk.org (Postfix) with ESMTP id 26FF340DDA for ; Thu, 11 Aug 2022 09:13:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pep/ibiAqVde68AfxT0TNLbdNe9VcPiMV9r4vDo7iECQ+oFDbBKgoFVNMBPVkaQxUC5QhOW3z+t3zFEfLOUmfY7ugMdkAqxgd5cGniHg5huJXoSkieHlj2PSqVjrDRScoVJV/sLCNMf4Bghw4OPzLQWyHn/RS+A950LM4C/YLkReRJQaDJrHud/F0BtcMT4wrpKvrf27Qg/4IAKXYndSMxjYWShHBoOZw0m1QSXF2VLL2s2UvQSLAtqeRwpHTPGEBsnFxTxC+CB1frcJ3Z2My0RGMi5HgyNpB8v5HID9GjNxkqdySmqB0GpYfQfMQ6Xz3J0gWBD2H3mlCrZXLcO1MQ== 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=WIk/2NIb3dxwL5k1H5VDvJDJGh5+AEC0ujkvbvHHM+E=; b=VrJNH2dYDqn4GeO6KuJ3Kg33xQg9bisppFOZY3rRyEUo0Cc6FsHTk81xpoTjcWGYXgVYnB4L9OyInH9Qa8Iv7Gp/rDzJOQxHGWCTgg+Et8KDbKt54xsfqbWWfeu3U4U0JMtk+JQQfwLFGlehfmvP5FfxieFsxcAGvqw5XoYH9GQCA9qq+o3Wde8ksH5fWQLI8n8hYClffGcQFTG16tHyCZvAnnqxVFIpV6wTHwgbyJzX7OBIeohWDLwyoX2QB/mA8lj0rjLP8MbSm65asVnqqh3nvDgbEUhc5NLXZ+Fmg5NwvHpYD0HESPkXK4ukctezrWktF1Jgc1Tf1QcWqxcN5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=xilinx.com 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=WIk/2NIb3dxwL5k1H5VDvJDJGh5+AEC0ujkvbvHHM+E=; b=ezP5RLtxE0y4AWYVhkABhz9U2Hn/iE+AEHXJMWh+sf5VclY2HN6h6NcKnx4jId8GYzkNlZGiQHHyQMWjprHQm3542etwFlykeOgW4Tna3dZel84ilm7/McJsII4gioq4FzVQYkuijilVgOeLf3jah9yO3aqoHaSUwWTT1GjKA8YFJNLNuK1uN9CcqqcmkwXSp6XqWIVdediU7VIzEDc33ECc4HB7bRHEuBQvaZGtjbgnSCCV9t6biA0SzAWSvR+eJu9/Z9xaR3K+P0X4L269VHVEYKuNrT8LNqS/kQlWUMWWZtAOTp9xdjw2p9OCvkO/IEV9SEgwXtYuzn/al+canA== Received: from DM6PR13CA0062.namprd13.prod.outlook.com (2603:10b6:5:134::39) by CY4PR12MB1399.namprd12.prod.outlook.com (2603:10b6:903:38::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Thu, 11 Aug 2022 07:13:35 +0000 Received: from DM6NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::f6) by DM6PR13CA0062.outlook.office365.com (2603:10b6:5:134::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.9 via Frontend Transport; Thu, 11 Aug 2022 07:13:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT041.mail.protection.outlook.com (10.13.172.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5525.11 via Frontend Transport; Thu, 11 Aug 2022 07:13:35 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 11 Aug 2022 07:13:34 +0000 Received: from nvidia.com (10.126.231.35) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 11 Aug 2022 00:13:31 -0700 From: Rongwei Liu To: , , , , Aman Singh , Yuying Zhang , Ferruh Yigit , "Andrew Rybchenko" CC: , Subject: [RFC] ethdev: add direction info when creating the transfer table Date: Thu, 11 Aug 2022 10:13:15 +0300 Message-ID: <20220811071315.851032-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To drhqmail201.nvidia.com (10.126.190.180) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 221a2b89-9ff4-40a4-fedc-08da7b690199 X-MS-TrafficTypeDiagnostic: CY4PR12MB1399:EE_ 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: jhv2jYLVcZ45RUIisbTlg95BnQHJc0Bz2bWBTiMI4h67XRiZE2q/lmnmn/ccrPi7OjCah1Y8d79tGX3I7zm1Br3qtdMo4xIo7cd049ovZKgK3Kf1W1o3d3DweibXjld/kYqYSyFZlrb8jHW4hlAyHZKDaoR71kT2vxdonCVpSadFQ71C6EQxETLZIKry3pFV7OmLBhtra0ESdaZAmIomVdrVMO53KBomek30AphZgbf+QKfW/km68Fg9RrRlV+o9/g39/FubAOELaagNoImf6jqHYlbCzmrSUZyLQ7kg8Ydms8WU0Brv6wmfP0pNjhHI3T5CNFz5kz46TVDbhAJNChhLq6Ka7AG+jZUg6svTsHZJdrKU38PhahToOFOY99NG++QZqL+q8WOpJD0DWYtwPZb3n6VG66OYtH86plWZXd1TOy1R58K5yjTOuq6r8h8w/HrVbx2DL6O+UatdxU5d7A8jRRJ+nt+fJcCTCNoWfrVTyz5jSqIrUCgyAkrgbhkbeJY+41/AOxZevRu/dk+R2E3aHZwctfVEKs6YTzrEVHbfdZTmciD9QCx3jhpFY7uAFGgPUYfguNFJFZKVpGH1BTfp66sLk2jZcjPv+6wLWJvtvJcYtoKwzgW/r+gP7X8h/2gipbB+iw3XztQD3/3Apj3nTU87xhwKr7uwQmItB1CkU5yvluobAPgnfQ6kh3lK3+7LQrzyinubHp8UJUuWeC9zMzCUiBabcsqPBRgQV2pLiPd0sr4dDWCDHcqj8MUJeWQRzwSRArZSt2xWt1zjqWpg9Z8/DpZlKqv8WqRaQ6l+6ufJkH5AJoOTOmgQrZ1HCZpcWuTnspviqNz1Xl9Aig== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(396003)(346002)(39860400002)(136003)(376002)(40470700004)(46966006)(36840700001)(55016003)(356005)(26005)(6666004)(7696005)(41300700001)(6286002)(82740400003)(186003)(47076005)(426003)(36860700001)(81166007)(1076003)(82310400005)(336012)(2616005)(16526019)(107886003)(86362001)(83380400001)(40480700001)(70206006)(8676002)(4326008)(70586007)(2906002)(8936002)(40460700003)(54906003)(5660300002)(478600001)(110136005)(36756003)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 07:13:35.3748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 221a2b89-9ff4-40a4-fedc-08da7b690199 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1399 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 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_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. By default, the transfer domain is bi-direction, and no behavior changes. 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 --- app/test-pmd/cmdline_flow.c | 26 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 ++- lib/ethdev/rte_flow.h | 9 ++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 7f50028eb7..b25b595e82 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -177,6 +177,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, @@ -1141,6 +1143,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, @@ -2881,6 +2885,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", @@ -8894,6 +8910,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.flow_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.flow_attr.transfer_mode = 2; + return len; default: return -1; } diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 330e34427d..603b7988dd 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3332,7 +3332,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 a79f1e7ef0..512b08d817 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -130,7 +130,14 @@ 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. */ + /** + * 0 means bidirection, + * 0x1 origin uplink, + * 0x2 origin vport, + * N/A both set. + */ + uint32_t transfer_mode:2; + uint32_t reserved:27; /**< Reserved, must be zero. */ }; /**