get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/122341/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 122341,
    "url": "https://patches.dpdk.org/api/patches/122341/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230119045824.665663-8-rongweil@nvidia.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230119045824.665663-8-rongweil@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230119045824.665663-8-rongweil@nvidia.com",
    "date": "2023-01-19T04:58:20",
    "name": "[v2,07/11] net/mlx5: add flex item modify field implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9e7b327ff8889c255eb960072955bfe36b4164ca",
    "submitter": {
        "id": 2223,
        "url": "https://patches.dpdk.org/api/people/2223/?format=api",
        "name": "rongwei liu",
        "email": "rongweil@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230119045824.665663-8-rongweil@nvidia.com/mbox/",
    "series": [
        {
            "id": 26603,
            "url": "https://patches.dpdk.org/api/series/26603/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26603",
            "date": "2023-01-19T04:58:13",
            "name": "add flex item support",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/26603/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/122341/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/122341/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 54F1842403;\n\tThu, 19 Jan 2023 05:59:45 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C330B42D7E;\n\tThu, 19 Jan 2023 05:59:16 +0100 (CET)",
            "from NAM02-BN1-obe.outbound.protection.outlook.com\n (mail-bn1nam02on2072.outbound.protection.outlook.com [40.107.212.72])\n by mails.dpdk.org (Postfix) with ESMTP id 159F042D89\n for <dev@dpdk.org>; Thu, 19 Jan 2023 05:59:15 +0100 (CET)",
            "from MW4PR03CA0260.namprd03.prod.outlook.com (2603:10b6:303:b4::25)\n by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan\n 2023 04:59:13 +0000",
            "from CO1NAM11FT017.eop-nam11.prod.protection.outlook.com\n (2603:10b6:303:b4:cafe::c5) by MW4PR03CA0260.outlook.office365.com\n (2603:10b6:303:b4::25) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.19 via Frontend\n Transport; Thu, 19 Jan 2023 04:59:13 +0000",
            "from mail.nvidia.com (216.228.117.161) by\n CO1NAM11FT017.mail.protection.outlook.com (10.13.175.108) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 04:59:12 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 18 Jan\n 2023 20:58:57 -0800",
            "from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com\n (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 18 Jan\n 2023 20:58:55 -0800"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=noGGt18q69vWlxUz0rEANILAhwNUsiYuhoJq0oUkXjkr4tyy0aPG+KTeiwbmYaNhjqThxKmMEcvDHDIjPDXIkNZ7n3GKrJgLha8T6EMhB5vvQDnXhCd1nVSqQuyikE78BqC4CskbMwkAzCbMGVTNu3MTPwQNtf4rdP13V4zIU77LYydGqARBdItZNqR3fzQhHgTQjFIYuxnWjlX3MC97OFCBnvTd9h/UUQ7JKp5yg1AFj4u+9PtMrOwdvlewRMwTSzHrZ16WziHuz7mj4cWw1Nga+7WhdnROExXQdU3LtE2JyTaqkN9ToJSOAVI9wCVA6//7d4PX+pWOYqp8VI5NlA==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=MrWtwZVWkGTYzmtix6QbsusLzxU6flqfhA9QbPO+mbE=;\n b=BqRzEboH/HFf72eUBrwS2WZRuQxZwGylexDF8K/YKs5NEWw0e/sCHp9Av8V1iGc0DaxrL/bnXf1eZ4PL+nD+/KQ1NJu61fvPgqEEFp3EYsrd19Ltqfa/7CPhc1J3xiRvPDEvKjo5tloRAaaK+qhOP7iNDtwOUOdSWRBfPaTZAjJbK4JfEkAqQHx+dSY5qc/vcrxNQnhWax13vZ9HpQipO4tVGfkVGWso4VA6hkO5C041nSF8DoyrAGFiCn66CyOrhrlUqDViQH6LObvimv7s/+jzYuji9OsD2YHQ6hG1D3CFmbgFeJr+lGAoYZSA5rp+nkjYteHvBPKCggIzv+GKbA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.161) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=MrWtwZVWkGTYzmtix6QbsusLzxU6flqfhA9QbPO+mbE=;\n b=t/+JrsAbYNEUl0FT6+ojGCI/MNOydmd+594mBglwyVSTfvtJKHNESFmIHUR6gW3yc+rmryWgAAwKUgF8MlYTohZeD9U+eqzxIFPLNsAkVRWloZNnVyfB3XrNzshfI9POT77Wgkwwa6idcHGEKD4SbJbo+2icgexPhYsCAkDPD2Q/YxrDfZMgeYApuuka/t7CiaTQLLwqoCRZudc6J6eS6zCWmoW8pJU2VER7jEbp7iVUbMAOYV0bJaVf9NcnedXFGOiyV7wEsD4WSHaaFKXrN1XjEmXkoV56avTi9gMlI57OFmeq0ahkkSBrmSxoX8ZRx9lfMNE/ysrMZvh7ejVxjA==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.161)\n smtp.mailfrom=nvidia.com;\n dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.117.161 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C",
        "From": "Rongwei Liu <rongweil@nvidia.com>",
        "To": "<matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,\n <thomas@monjalon.net>",
        "CC": "<dev@dpdk.org>, <rasland@nvidia.com>",
        "Subject": "[PATCH v2 07/11] net/mlx5: add flex item modify field implementation",
        "Date": "Thu, 19 Jan 2023 06:58:20 +0200",
        "Message-ID": "<20230119045824.665663-8-rongweil@nvidia.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20230119045824.665663-1-rongweil@nvidia.com>",
        "References": "<20221221084000.3680015-2-rongweil@nvidia.com>\n <20230119045824.665663-1-rongweil@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.126.231.37]",
        "X-ClientProxiedBy": "rnnvmail201.nvidia.com (10.129.68.8) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "CO1NAM11FT017:EE_|MN2PR12MB4373:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "46456156-b672-4135-40df-08daf9d9e835",
        "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": "\n +tzuN03YX3LtYNodQK7HzonQSz/5Ju7x7nwAAsJI5AoeAzNFL8G6xzJlXTHpaWN6O09jUw4TPcheR9JtP++AHxO+HUfNQCUcWPSL19r46UD3k/fYm+NwnRXwvuAx8Llp3vFekkg/8G+hmGrkF+/gerkH7M670tQndtXW11iqr/jIFUxY2aroNqWGsWR7+Ykx28ufTo57NNFczew9cdpIxsA81im071ZQ5TZGrK52dT7VGpeqORaLSI/5+CDhUbRomrzPqTwpzL8H8kH7FA0ImhowkQm/wA3caPx03eUYViJxdUEXZI9zr7No6nZi0k2AoQT/49IbgCxumZINCvmvwbi9+BiLP7phhmu33TyNUKaRUzLMRgvimkb6l/qx7bRvwomgcFeAyeSveRwlfjDM8q4ocPtpHQA+rrYh2apfspsnk3vJN0A7g8vb0JDwc+spSnTLnrTwuzSuZ6tPd7AJByJGUKT6/uCJkZwZ349f5uT7GaVywZiO8Kawzrodwxm3f3Z+yI/A5A8zYwmHV4Vy0dxPgtthXnlzIF+m8/XXKONxFLL+hREg0or/Acya5V/CNQj3q1jlu/TRKRuPsVI+m+JmNt/EFEK1tGLCQRTuetiZ1RjiymPk9qXZQu+Gv0KELpmal877jfgeeMbsmcuOK4t0Hth4dwzVgLpF8gQtrqK6H0xpoEpic+WkZXvdpZRSBOrZFPbq95BvWoiRneqe0Q==",
        "X-Forefront-Antispam-Report": "CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE;\n SFS:(13230022)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199015)(46966006)(36840700001)(40470700004)(86362001)(70586007)(55016003)(70206006)(5660300002)(8936002)(2906002)(82740400003)(36860700001)(7636003)(316002)(4326008)(54906003)(110136005)(107886003)(426003)(47076005)(7696005)(6666004)(478600001)(356005)(36756003)(82310400005)(41300700001)(8676002)(40480700001)(186003)(1076003)(16526019)(83380400001)(6286002)(336012)(26005)(2616005)(40460700003);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "19 Jan 2023 04:59:12.3807 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 46456156-b672-4135-40df-08daf9d9e835",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT017.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MN2PR12MB4373",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Add flex item modify field HWS implementation.\nThe minimum modify boundary is one byte.\n\nSigned-off-by: Rongwei Liu <rongweil@nvidia.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>\n---\n drivers/common/mlx5/mlx5_prm.h  |   1 +\n drivers/net/mlx5/mlx5_flow.h    |   3 +\n drivers/net/mlx5/mlx5_flow_dv.c | 165 +++++++++++++++++++++++++++++---\n drivers/net/mlx5/mlx5_flow_hw.c |  14 ++-\n 4 files changed, 170 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h\nindex ce6cd98fd7..0c2a516e9d 100644\n--- a/drivers/common/mlx5/mlx5_prm.h\n+++ b/drivers/common/mlx5/mlx5_prm.h\n@@ -759,6 +759,7 @@ enum mlx5_modification_field {\n \tMLX5_MODI_OUT_IP_ECN = 0x73,\n \tMLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,\n \tMLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,\n+\tMLX5_MODI_INVALID = INT_MAX,\n };\n \n /* Total number of metadata reg_c's. */\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex c8761c4e5a..c71fa1c0ad 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -1080,6 +1080,8 @@ struct field_modify_info {\n \tuint32_t size; /* Size of field in protocol header, in bytes. */\n \tuint32_t offset; /* Offset of field in protocol header, in bytes. */\n \tenum mlx5_modification_field id;\n+\tuint32_t shift;\n+\tuint8_t is_flex; /* Temporary indicator for flex item modify filed WA. */\n };\n \n /* HW steering flow attributes. */\n@@ -1244,6 +1246,7 @@ struct rte_flow_actions_template {\n \tuint16_t mhdr_off; /* Offset of DR modify header action. */\n \tuint32_t refcnt; /* Reference counter. */\n \tuint16_t rx_cpy_pos; /* Action position of Rx metadata to be copied. */\n+\tuint8_t flex_item; /* flex item index. */\n };\n \n /* Jump action struct. */\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 284f18da11..92a5914d4b 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -414,10 +414,15 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,\n \t\t\t++field;\n \t\t\tcontinue;\n \t\t}\n-\t\t/* Deduce actual data width in bits from mask value. */\n-\t\toff_b = rte_bsf32(mask) + carry_b;\n-\t\tsize_b = sizeof(uint32_t) * CHAR_BIT -\n-\t\t\t off_b - __builtin_clz(mask);\n+\t\tif (type == MLX5_MODIFICATION_TYPE_COPY && field->is_flex) {\n+\t\t\toff_b = 32 - field->shift + carry_b - field->size * CHAR_BIT;\n+\t\t\tsize_b = field->size * CHAR_BIT - carry_b;\n+\t\t} else {\n+\t\t\t/* Deduce actual data width in bits from mask value. */\n+\t\t\toff_b = rte_bsf32(mask) + carry_b;\n+\t\t\tsize_b = sizeof(uint32_t) * CHAR_BIT -\n+\t\t\t\t off_b - __builtin_clz(mask);\n+\t\t}\n \t\tMLX5_ASSERT(size_b);\n \t\tactions[i] = (struct mlx5_modification_cmd) {\n \t\t\t.action_type = type,\n@@ -437,40 +442,46 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,\n \t\t\t * Destination field overflow. Copy leftovers of\n \t\t\t * a source field to the next destination field.\n \t\t\t */\n-\t\t\tcarry_b = 0;\n \t\t\tif ((size_b > dcopy->size * CHAR_BIT - dcopy->offset) &&\n \t\t\t    dcopy->size != 0) {\n \t\t\t\tactions[i].length =\n \t\t\t\t\tdcopy->size * CHAR_BIT - dcopy->offset;\n-\t\t\t\tcarry_b = actions[i].length;\n+\t\t\t\tcarry_b += actions[i].length;\n \t\t\t\tnext_field = false;\n+\t\t\t} else {\n+\t\t\t\tcarry_b = 0;\n \t\t\t}\n \t\t\t/*\n \t\t\t * Not enough bits in a source filed to fill a\n \t\t\t * destination field. Switch to the next source.\n \t\t\t */\n \t\t\tif ((size_b < dcopy->size * CHAR_BIT - dcopy->offset) &&\n-\t\t\t    (size_b == field->size * CHAR_BIT - off_b)) {\n-\t\t\t\tactions[i].length =\n-\t\t\t\t\tfield->size * CHAR_BIT - off_b;\n+\t\t\t    ((size_b == field->size * CHAR_BIT - off_b) ||\n+\t\t\t     field->is_flex)) {\n+\t\t\t\tactions[i].length = size_b;\n \t\t\t\tdcopy->offset += actions[i].length;\n \t\t\t\tnext_dcopy = false;\n \t\t\t}\n-\t\t\tif (next_dcopy)\n-\t\t\t\t++dcopy;\n \t\t} else {\n \t\t\tMLX5_ASSERT(item->spec);\n \t\t\tdata = flow_dv_fetch_field((const uint8_t *)item->spec +\n \t\t\t\t\t\t   field->offset, field->size);\n \t\t\t/* Shift out the trailing masked bits from data. */\n \t\t\tdata = (data & mask) >> off_b;\n+\t\t\tif (field->is_flex)\n+\t\t\t\tactions[i].offset = 32 - field->shift - field->size * CHAR_BIT;\n \t\t\tactions[i].data1 = rte_cpu_to_be_32(data);\n \t\t}\n \t\t/* Convert entire record to expected big-endian format. */\n \t\tactions[i].data0 = rte_cpu_to_be_32(actions[i].data0);\n+\t\tif ((type != MLX5_MODIFICATION_TYPE_COPY ||\n+\t\t     dcopy->id != (enum mlx5_modification_field)UINT32_MAX) &&\n+\t\t    field->id != (enum mlx5_modification_field)UINT32_MAX)\n+\t\t\t++i;\n+\t\tif (next_dcopy && type == MLX5_MODIFICATION_TYPE_COPY)\n+\t\t\t++dcopy;\n \t\tif (next_field)\n \t\t\t++field;\n-\t\t++i;\n \t} while (field->size);\n \tif (resource->actions_num == i)\n \t\treturn rte_flow_error_set(error, EINVAL,\n@@ -1421,6 +1432,131 @@ flow_modify_info_mask_32_masked(uint32_t length, uint32_t off, uint32_t post_mas\n \treturn rte_cpu_to_be_32(mask & post_mask);\n }\n \n+static void\n+mlx5_modify_flex_item(const struct rte_eth_dev *dev,\n+\t\t      const struct mlx5_flex_item *flex,\n+\t\t      const struct rte_flow_action_modify_data *data,\n+\t\t      struct field_modify_info *info,\n+\t\t      uint32_t *mask, uint32_t width)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_hca_flex_attr *attr = &priv->sh->cdev->config.hca_attr.flex;\n+\tuint32_t i, j;\n+\tint id = 0;\n+\tuint32_t pos = 0;\n+\tconst struct mlx5_flex_pattern_field *map;\n+\tuint32_t offset = data->offset;\n+\tuint32_t width_left = width;\n+\tuint32_t def;\n+\tuint32_t cur_width = 0;\n+\tuint32_t tmp_ofs;\n+\tuint32_t idx = 0;\n+\tstruct field_modify_info tmp;\n+\tint tmp_id;\n+\n+\tif (!attr->ext_sample_id) {\n+\t\tDRV_LOG(ERR, \"FW doesn't support modify field with flex item.\");\n+\t\treturn;\n+\t}\n+\t/*\n+\t * search for the mapping instance until Accumulated width is no\n+\t * less than data->offset.\n+\t */\n+\tfor (i = 0; i < flex->mapnum; i++) {\n+\t\tif (flex->map[i].width + pos > data->offset)\n+\t\t\tbreak;\n+\t\tpos += flex->map[i].width;\n+\t}\n+\tif (i >= flex->mapnum)\n+\t\treturn;\n+\ttmp_ofs = pos < data->offset ? data->offset - pos : 0;\n+\tfor (j = i; i < flex->mapnum && width_left > 0; ) {\n+\t\tmap = flex->map + i;\n+\t\tid = mlx5_flex_get_sample_id(flex, i, &pos, false, &def);\n+\t\tif (id == -1) {\n+\t\t\ti++;\n+\t\t\t/* All left length is dummy */\n+\t\t\tif (pos >= data->offset + width)\n+\t\t\t\treturn;\n+\t\t\tcur_width = map->width;\n+\t\t/* One mapping instance covers the whole width. */\n+\t\t} else if (pos + map->width >= (data->offset + width)) {\n+\t\t\tcur_width = width_left;\n+\t\t} else {\n+\t\t\tcur_width = cur_width + map->width - tmp_ofs;\n+\t\t\tpos += map->width;\n+\t\t\t/*\n+\t\t\t * Continue to search next until:\n+\t\t\t * 1. Another flex parser ID.\n+\t\t\t * 2. Width has been covered.\n+\t\t\t */\n+\t\t\tfor (j = i + 1; j < flex->mapnum; j++) {\n+\t\t\t\ttmp_id = mlx5_flex_get_sample_id(flex, j, &pos, false, &def);\n+\t\t\t\tif (tmp_id == -1) {\n+\t\t\t\t\ti = j;\n+\t\t\t\t\tpos -= flex->map[j].width;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tif (id >= (int)flex->devx_fp->num_samples ||\n+\t\t\t\t    id >= MLX5_GRAPH_NODE_SAMPLE_NUM ||\n+\t\t\t\t    tmp_id >= (int)flex->devx_fp->num_samples ||\n+\t\t\t\t    tmp_id >= MLX5_GRAPH_NODE_SAMPLE_NUM)\n+\t\t\t\t\treturn;\n+\t\t\t\tif (flex->devx_fp->sample_ids[id].id !=\n+\t\t\t\t\t\tflex->devx_fp->sample_ids[tmp_id].id ||\n+\t\t\t\t    flex->map[j].shift != flex->map[j - 1].width +\n+\t\t\t\t\t\t\t  flex->map[j - 1].shift) {\n+\t\t\t\t\ti = j;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tif ((pos + flex->map[j].width) >= (data->offset + width)) {\n+\t\t\t\t\tcur_width = width_left;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tpos += flex->map[j].width;\n+\t\t\t\tcur_width += flex->map[j].width;\n+\t\t\t}\n+\t\t}\n+\t\tif (cur_width > width_left)\n+\t\t\tcur_width = width_left;\n+\t\telse if (cur_width < width_left && (j == flex->mapnum || i == flex->mapnum))\n+\t\t\treturn;\n+\n+\t\tMLX5_ASSERT(id < (int)flex->devx_fp->num_samples);\n+\t\tif (id >= (int)flex->devx_fp->num_samples || id >= MLX5_GRAPH_NODE_SAMPLE_NUM)\n+\t\t\treturn;\n+\t\t/* Use invalid entry as placeholder for DUMMY mapping. */\n+\t\tinfo[idx] = (struct field_modify_info){cur_width / CHAR_BIT, offset / CHAR_BIT,\n+\t\t\t     id == -1 ? MLX5_MODI_INVALID :\n+\t\t\t     (enum mlx5_modification_field)\n+\t\t\t     flex->devx_fp->sample_ids[id].modify_field_id,\n+\t\t\t     map->shift + tmp_ofs, 1};\n+\t\toffset += cur_width;\n+\t\twidth_left -= cur_width;\n+\t\tif (!mask) {\n+\t\t\tinfo[idx].offset = (32 - cur_width - map->shift - tmp_ofs);\n+\t\t\tinfo[idx].size = cur_width / CHAR_BIT + info[idx].offset / CHAR_BIT;\n+\t\t}\n+\t\tcur_width = 0;\n+\t\ttmp_ofs = 0;\n+\t\tidx++;\n+\t}\n+\tif (unlikely(width_left > 0)) {\n+\t\tMLX5_ASSERT(false);\n+\t\treturn;\n+\t}\n+\tif (mask)\n+\t\tmemset(mask, 0xff, data->offset / CHAR_BIT + width / CHAR_BIT);\n+\t/* Re-order the info to follow IPv6 address. */\n+\tfor (i = 0; i < idx / 2; i++) {\n+\t\ttmp = info[i];\n+\t\tMLX5_ASSERT(info[i].id);\n+\t\tMLX5_ASSERT(info[idx - 1 - i].id);\n+\t\tinfo[i] = info[idx - 1 - i];\n+\t\tinfo[idx - 1 - i] = tmp;\n+\t}\n+}\n+\n void\n mlx5_flow_field_id_to_modify_info\n \t\t(const struct rte_flow_action_modify_data *data,\n@@ -1883,6 +2019,11 @@ mlx5_flow_field_id_to_modify_info\n \t\t\t\tinfo[idx].offset = data->offset;\n \t\t}\n \t\tbreak;\n+\tcase RTE_FLOW_FIELD_FLEX_ITEM:\n+\t\tMLX5_ASSERT(data->flex_handle != NULL && !(data->offset & 0x7));\n+\t\tmlx5_modify_flex_item(dev, (const struct mlx5_flex_item *)data->flex_handle,\n+\t\t\t\t      data, info, mask, width);\n+\t\tbreak;\n \tcase RTE_FLOW_FIELD_POINTER:\n \tcase RTE_FLOW_FIELD_VALUE:\n \tdefault:\ndiff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c\nindex 742b0b0d43..2e263880d7 100644\n--- a/drivers/net/mlx5/mlx5_flow_hw.c\n+++ b/drivers/net/mlx5/mlx5_flow_hw.c\n@@ -4550,6 +4550,17 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,\n \t\t\tat->actions[i].conf = actions->conf;\n \t\t\tat->masks[i].conf = masks->conf;\n \t\t}\n+\t\tif (actions->type == RTE_FLOW_ACTION_TYPE_MODIFY_FIELD) {\n+\t\t\tconst struct rte_flow_action_modify_field *info = actions->conf;\n+\n+\t\t\tif ((info->dst.field == RTE_FLOW_FIELD_FLEX_ITEM &&\n+\t\t\t     flow_hw_flex_item_acquire(dev, info->dst.flex_handle,\n+\t\t\t\t\t\t       &at->flex_item)) ||\n+\t\t\t     (info->src.field == RTE_FLOW_FIELD_FLEX_ITEM &&\n+\t\t\t      flow_hw_flex_item_acquire(dev, info->src.flex_handle,\n+\t\t\t\t\t\t\t&at->flex_item)))\n+\t\t\t\tgoto error;\n+\t\t}\n \t}\n \tat->tmpl = flow_hw_dr_actions_template_create(at);\n \tif (!at->tmpl)\n@@ -4581,7 +4592,7 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n static int\n-flow_hw_actions_template_destroy(struct rte_eth_dev *dev __rte_unused,\n+flow_hw_actions_template_destroy(struct rte_eth_dev *dev,\n \t\t\t\t struct rte_flow_actions_template *template,\n \t\t\t\t struct rte_flow_error *error __rte_unused)\n {\n@@ -4594,6 +4605,7 @@ flow_hw_actions_template_destroy(struct rte_eth_dev *dev __rte_unused,\n \t\t\t\t   \"action template in using\");\n \t}\n \tLIST_REMOVE(template, next);\n+\tflow_hw_flex_item_release(dev, &template->flex_item);\n \tif (template->tmpl)\n \t\tmlx5dr_action_template_destroy(template->tmpl);\n \tmlx5_free(template);\n",
    "prefixes": [
        "v2",
        "07/11"
    ]
}