From patchwork Wed Oct 13 18:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 101471 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 E6EB4A0C55; Wed, 13 Oct 2021 20:45:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83AEB411C6; Wed, 13 Oct 2021 20:45:39 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id C1B184111B for ; Wed, 13 Oct 2021 20:45:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JVryAbt4XIoZeqIUvBadaKNz/oTvINVT1JWB7LlBcjgoW8Pfj6Ja66tbayzxfJMUkn/j5a/o/+G+5BLJaR3I4+zHc8SVhcHUrqc1x0n8VuogcdVaFfd6uKYfNlBhJ7veT44dXGLuXcwkFgEHMAQOODL5/A82f+bpF4AyVvCQ2gsseXYLJHnyBCXMmxdvAT2K3+Ky/TjGUZ3bMrPPHsG+ldsH8Tj7CUFJ/DZWFBoAJ5KPwG52D/h2U4upQTjHIQx7KrJsXKsWbJi1crnqQczvcbOLXQ8LvKBmbTx3RjdIqO2xn++nkovCOB27f6LzYOTUtOT0ebTgMe+vS8PxixB9jg== 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=fJQlXd4sWlmMAshUvDkUS8JWKCbLuTdzFTgDzj7TR6s=; b=nYjsXcmKSoY7QWQt/z4FTxhGNXNisgfiz9a4HEJKvbk/gt8CiCwX1QQ52TrGdsfGCo+EwM4u0R0mSsN6Gvk3gpFceC+ccXaeT1FR8MXmIer4LHmz8TNpCZPWcxJYPEbgFaw8bCm2wIYASjfIhuO17ME10HELG1YL05AzvGOkPjGdddPH8vcyD0TSDC9zsx4BjIAgWbNjYdPT5tkC2YI+9/Q9us4yGpO+scTNvsRKkzj/4wzR++lMwd3d4nNgznn/WhNO6yjQWFtyB+88HfCwtYBvpK40pSDbVgEs+M5y98G4Mw53Hc0oFA/RUQJ4xu3ruh3/5//NTVl7tjmQ6R6ZSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=fJQlXd4sWlmMAshUvDkUS8JWKCbLuTdzFTgDzj7TR6s=; b=D63PjVochEYIC0pY5nKEn1a2NmwFvqp8KZGWf9ZxP49e3ul6WrGplJ2DZk8zOfxYU+P9Z+pb7g2MgH+dshq6h1tqikc3aN9DeGMX4warqBuZ/1qLyfLbNoIVsOsx9lVCf3GGUEmL1buHjY9MXF7I/NL6sUDD5U7z+ZsEPtbZaOIiFyaS9LSxwFv25Qlf1u90na0+U3chQx59zI24J2h3YbVSZxMZ1RCvySsnMOilLlWxdOtulo8gf89vA4vPQOylTKPTlcJwICIJkEjw4hjd0yIPmrvCP2+zMroDn0Jf1yH1T2F+mOGplz0xk3otozZNc8LYLgYDgychcvnzKF5DaQ== Received: from MW3PR06CA0026.namprd06.prod.outlook.com (2603:10b6:303:2a::31) by SA0PR12MB4397.namprd12.prod.outlook.com (2603:10b6:806:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 13 Oct 2021 18:45:36 +0000 Received: from CO1NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::2c) by MW3PR06CA0026.outlook.office365.com (2603:10b6:303:2a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Wed, 13 Oct 2021 18:45:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT058.mail.protection.outlook.com (10.13.174.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 18:45:35 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 13 Oct 2021 18:45:33 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Wed, 13 Oct 2021 21:45:12 +0300 Message-ID: <20211013184516.25338-2-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211013184516.25338-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211013184516.25338-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02bb3969-3ae2-4270-cb68-08d98e79a4eb X-MS-TrafficTypeDiagnostic: SA0PR12MB4397: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MgRpYM8bY1UMQZw00sIl/skrYS9TO6udwvFE5M80K5+M9FO81jq2yVQ7isjEej5Lc0ArITdt6R+lkwLB4lw+CuMsG1LkKZ9Vu4i5bI3U6xLpuYP8FMmuW4PHaP0CkE7leZI0jNGrBdCpydLMHaQvUUrLCbZsWXvyzy9V3F6rBY/iRrVTgkBQ+A+gjjgPaQxACDHvLuNl6J2V6shkEQqeWqJsDnH9gYbn9AbHmjOTPzzzQDYHZ/kbVhNIG7W+3QUX83/KRFxKNGZWhqzzJlfclcBKC5ojPNtYf1fz84Hfeky7ErU5SuBCaZV1S+NiwV+0ePEJBKRDR7RrmrdzfSGorxtMm4nlIZcaNEpz2+luu9f01i+0C3wGy7ZbYEN5TVJ/vXfpf8nNClaAjWrxADlgOQ7TsmyQErNc1liULEfI+1LjAW/3DUXOKRYIvRkGLKtlE6o9tKvTbN6DjxauIR8XR59kD2nNUDZ/ucU8DepSgiUzXVNwU3IZZ3n/PXiDvGfWW8BK4p/RssoD6/q8U8xBEnk2wnFSrYeI54r4U1YcAMVQvSbqePUjD1TSuTFk6L4Kzlmkizi7ZTQBmr53ajLiEUlYNah5a+4SN3uweUGJpaTr5i9zsAPo+PACaWGBKpvKeOucMMHOxZWYZGjZdKUX6Lz4HIvq1Ci9zjHsdLGfgx3pQGNTrWE4y8n6xI3f4Yx95bhIgBs2wudrpJWpWFM8zR3Rkm93/Dm4BDQc4v2HTpI= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(426003)(2616005)(16526019)(6666004)(8936002)(336012)(15650500001)(26005)(83380400001)(2906002)(82310400003)(36756003)(186003)(1076003)(70586007)(70206006)(55016002)(8676002)(54906003)(47076005)(36860700001)(6916009)(6286002)(4326008)(356005)(7636003)(5660300002)(508600001)(86362001)(7696005)(316002)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 18:45:35.7430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02bb3969-3ae2-4270-cb68-08d98e79a4eb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4397 Subject: [dpdk-dev] [PATCH v6 1/5] ethdev: update modify field flow action 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 Sender: "dev" The generic modify field flow action introduced in [1] has some issues related to the immediate source operand: - immediate source can be presented either as an unsigned 64-bit integer or pointer to data pattern in memory. There was no explicit pointer field defined in the union. - the byte ordering for 64-bit integer was not specified. Many fields have shorter lengths and byte ordering is crucial. - how the bit offset is applied to the immediate source field was not defined and documented. - 64-bit integer size is not enough to provide IPv6 addresses. In order to cover the issues and exclude any ambiguities the following is done: - introduce the explicit pointer field in rte_flow_action_modify_data structure - replace the 64-bit unsigned integer with 16-byte array - update the modify field flow action documentation Appropriate deprecation notice has been removed. [1] commit 73b68f4c54a0 ("ethdev: introduce generic modify flow action") Fixes: 2ba49b5f3721 ("doc: announce change to ethdev modify action data") Signed-off-by: Viacheslav Ovsiienko Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 24 +++++++++++++++++++++++- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_21_11.rst | 7 +++++++ lib/ethdev/rte_flow.h | 16 ++++++++++++---- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2b42d5ec8c..b08087511f 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2835,6 +2835,22 @@ a packet to any other part of it. ``value`` sets an immediate value to be used as a source or points to a location of the value in memory. It is used instead of ``level`` and ``offset`` for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively. +The data in memory should be presented exactly in the same byte order and +length as in the relevant flow item, i.e. data for field with type +``RTE_FLOW_FIELD_MAC_DST`` should follow the conventions of ``dst`` field +in ``rte_flow_item_eth`` structure, with type ``RTE_FLOW_FIELD_IPV6_SRC`` - +``rte_flow_item_ipv6`` conventions, and so on. If the field size is larger than +16 bytes the pattern can be provided as pointer only. + +The bitfield extracted from the memory being applied as second operation +parameter is defined by action width and by the destination field offset. +Application should provide the data in immediate value memory (either as +buffer or by pointer) exactly as item field without any applied explicit offset, +and destination packet field (with specified width and bit offset) will be +replaced by immediate source bits from the same bit offset. For example, +to replace the third byte of MAC address with value 0x85, application should +specify destination width as 8, destination offset as 16, and provide immediate +value as sequence of bytes {xxx, xxx, 0x85, xxx, xxx, xxx}. .. _table_rte_flow_action_modify_field: @@ -2865,7 +2881,13 @@ for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively. +---------------+----------------------------------------------------------+ | ``offset`` | number of bits to skip at the beginning | +---------------+----------------------------------------------------------+ - | ``value`` | immediate value or a pointer to this value | + | ``value`` | immediate value buffer (source field only, not | + | | applicable to destination) for RTE_FLOW_FIELD_VALUE | + | | field type | + +---------------+----------------------------------------------------------+ + | ``pvalue`` | pointer to immediate value data (source field only, not | + | | applicable to destination) for RTE_FLOW_FIELD_POINTER | + | | field type | +---------------+----------------------------------------------------------+ Action: ``CONNTRACK`` diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index a2fe766d4b..dee14077a5 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -120,10 +120,6 @@ Deprecation Notices * ethdev: Announce moving from dedicated modify function for each field, to using the general ``rte_flow_modify_field`` action. -* ethdev: The struct ``rte_flow_action_modify_data`` will be modified - to support modifying fields larger than 64 bits. - In addition, documentation will be updated to clarify byte order. - * ethdev: Attribute ``shared`` of the ``struct rte_flow_action_count`` is deprecated and will be removed in DPDK 21.11. Shared counters should be managed using shared actions API (``rte_flow_shared_action_create`` etc). diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index dfc2cbdeed..578c1206e7 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -187,6 +187,13 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. +* ethdev: ``rte_flow_action_modify_data`` structure updated, immediate data + array is extended, data pointer field is explicitly added to union, the + action behavior is defined in more strict fashion and documentation updated. + The immediate value behavior has been changed, the entire immediate field + should be provided, and offset for immediate source bitfield is assigned + from destination one. + ABI Changes ----------- diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 7b1ed7f110..f14f77772b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3217,10 +3217,18 @@ struct rte_flow_action_modify_data { uint32_t offset; }; /** - * Immediate value for RTE_FLOW_FIELD_VALUE or - * memory address for RTE_FLOW_FIELD_POINTER. + * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the + * same byte order and length as in relevant rte_flow_item_xxx. + * The immediate source bitfield offset is inherited from + * the destination's one. */ - uint64_t value; + uint8_t value[16]; + /** + * Memory address for RTE_FLOW_FIELD_POINTER, memory layout + * should be the same as for relevant field in the + * rte_flow_item_xxx structure. + */ + void *pvalue; }; }; @@ -3240,7 +3248,7 @@ enum rte_flow_modify_op { * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD * * Modify a destination header field according to the specified - * operation. Another packet field can be used as a source as well + * operation. Another field of the packet can be used as a source as well * as tag, mark, metadata, immediate value or a pointer to it. */ struct rte_flow_action_modify_field {