From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 47CFE41C37;
	Wed,  8 Feb 2023 04:06:58 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CE89240DFD;
	Wed,  8 Feb 2023 04:06:57 +0100 (CET)
Received: from NAM10-MW2-obe.outbound.protection.outlook.com
 (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69])
 by mails.dpdk.org (Postfix) with ESMTP id 3D5FA40DDB
 for <dev@dpdk.org>; Wed,  8 Feb 2023 04:06:56 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=E9vvMCiApOWF3+BEDABdEbjFt6ctx7yf2Dl9E3GMkxEnarLD8rPE1cheI+90q7mWt7woHxed8bri00myTKXq/Dn9tUO90qmlXai+GxxZlxmsQhGYo33CP4fRO3kLZB+OCsrMRwMRU+r7i63AwkiTwuVdHYK0yGkJPpxRzrYoHnhwhlhmpxpzYUzfs/U0Q6MQ2PXgXikO7Gl4Hukv6j4skZaW1UIJH/+JhRzegMf6LfQGf7bOSP6fcFXHqJQfhdJ4TdrJ24tW+uoBwzaUlb75sie8T+nrdVL0vfElVCch12LM7FG5fvGYe3FH8rBtGM0yde7P5O5S4rIptpOvfJcEDg==
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=+km2p1EH6vVYOXFCmL8VFbGcRDChJTo8uoacbJx/JtM=;
 b=ak6TXbB3fEOt0kKzapnFJnoYSxwrPv2QcKkE2uf/DGptYWEsB1uqA6/C2K+B9hxSXQWvh+awNawmImlDNw8/qb+hGi4xPyuYJHP31gCI5gZHXYAJ2JbT1+yhAJj4Y/tzbeQ/1N51xCnbeflC2lPKzDbh+ZuAiJkpeI055xJg8aUx2GfAWah7T5a8dBwZGdb0tzs00CmfUTyJgxn28D+5oT/EnEWcTtklffyDUveqbDkdF/pbZ6wX2MtLB1dlZnjgg0Z3BXtQh9V67n1broaUNEr4G0Oqg7KTwMy0C/sivFPSYxU056flzMWPc0ztznZCRfEdKmRb/jkt4NsQ3ZvQVg==
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=+km2p1EH6vVYOXFCmL8VFbGcRDChJTo8uoacbJx/JtM=;
 b=TDULtt9ju5ZwY4UmeSjIxJwdE85qDpYsBeZb6h0dBx12SqVIjrGyDJ+/YD2z0dfXEemSIvdgIoe8c+exAThYRA+9OVX2lAYroGZM8cZCcOVJK2IY1q6j/gPKVDGBh7i/Qd5b8YX0kwyD1U+8LYgKg9wV8lsrTWO3V76Ier4j7GRnKtmpzv2VE4YkFgvXIuyfvczm0GTooVXuknMFyC+u2zE+EOwQnI8Riiqfp3JkWprck34bMRLQPis76KZSGg3dOSU2Orard9BJJfgb92ISvnoXZI4QBIJ6ZNCcvFqvlCUgiq+Gw9JxXkr1wuae+Lz3EKuX4T66gfHedpzYnSYpVA==
Received: from CY5PR19CA0051.namprd19.prod.outlook.com (2603:10b6:930:1a::19)
 by CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35; Wed, 8 Feb
 2023 03:06:54 +0000
Received: from CY4PEPF0000C96E.namprd02.prod.outlook.com
 (2603:10b6:930:1a:cafe::15) by CY5PR19CA0051.outlook.office365.com
 (2603:10b6:930:1a::19) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend
 Transport; Wed, 8 Feb 2023 03:06:54 +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
 CY4PEPF0000C96E.mail.protection.outlook.com (10.167.242.6) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.6086.16 via Frontend Transport; Wed, 8 Feb 2023 03:06:54 +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.36; Tue, 7 Feb 2023
 19:06:46 -0800
Received: from pegasus01.mtr.labs.mlnx (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.36; Tue, 7 Feb 2023 19:06:44 -0800
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
CC: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
 <andrew.rybchenko@oktetlabs.ru>, <orika@nvidia.com>
Subject: [PATCH v4 0/4] ethdev: add template table insertion and matching types
Date: Wed, 8 Feb 2023 05:06:20 +0200
Message-ID: <20230208030624.78465-1-akozyrev@nvidia.com>
X-Mailer: git-send-email 2.18.2
In-Reply-To: <20230208024755.72743-1-akozyrev@nvidia.com>
References: <20230208024755.72743-1-akozyrev@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain
X-Originating-IP: [10.126.230.37]
X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To
 rnnvmail201.nvidia.com (10.129.68.8)
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CY4PEPF0000C96E:EE_|CY5PR12MB6179:EE_
X-MS-Office365-Filtering-Correlation-Id: b9f8054b-a7e0-48d2-f734-08db0981881e
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: Zh5jGzmv9d7K+wDzW7Vz56ac/E0ZtesWSnkNhsX+L4EeZHm5uj7vLfi+p5Llu9cBLVKPtx6zM0A7tqCJrdStbh6RW5phCZQPqkZsCd0DNdO3B/8o5dpnwjTOr3O2EtrKp4LtJfjnrrcVtLJw2KAHX9WQt7tZIYChuk8Dw21l39tadJEVKezkZ78eFU3bRHcJ2YNi9fzv4VPZFbKZMOxYNX9Axz7yLQv8aUQZCWp0ZQKEL6Ji7/lywSATv7nJA+mxxgs7lRZqJIPcuxkLnF49V+hwzXYfzCMB9oc/n5C4DHTFxLItSZhAeHC/hULpEsEfEL1LYcFilK/Trt6tAAc13ml3VpDk68Qvwhj/Npxe4NZOsXHhgIMnQ0x+caEk2lwQxIUDHquz5CMhL++jN2THLg3qSKpbqk9hLhtckGHUe3SIu64pEM27A6sDHVKmTVn/k/FBkcHJF0/9hEWKAv7RoYdQkRnu+nk0QpYecFLflKf0OdpH05oA9Q1c+cRu4KOAmrJ/Vh+oWARnyKMt3VqeqOmysGekwz5rbC/fdtkQudEyNutBggOBtuYvdUbLh0Y6Jn7QOuLzpxxF3IS0si1iLFemLKS5r7MWe74VpSyiyUEvVEiceravzRgMH9N0xKZ85f9jOnW/d5Z671SrQe/BjubYA58Mkq5CkTjKOIVnv576juDSZ1q70uvXkB5S7TYwRQGwlvj4EMgQa3mywyV96l+ry2tOuSf98nUp4w9SwnKqyQNMTjkW+iTJ9rTlzkOkJRSmIJuUv6xJX4o5Ajrm0MjD86c7WioC+JYlqfKEOO0=
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)(39860400002)(136003)(396003)(451199018)(40470700004)(36840700001)(46966006)(40460700003)(5660300002)(41300700001)(36860700001)(86362001)(8936002)(2616005)(336012)(36756003)(966005)(54906003)(6666004)(478600001)(1076003)(82310400005)(26005)(316002)(107886003)(16526019)(186003)(40480700001)(426003)(8676002)(6916009)(83380400001)(70206006)(4326008)(47076005)(70586007)(2906002)(7636003)(356005)(82740400003);
 DIR:OUT; SFP:1101; 
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 03:06:54.0657 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: b9f8054b-a7e0-48d2-f734-08db0981881e
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: CY4PEPF0000C96E.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6179
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>,
 <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>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Bring more flexibility and control over both flow rule insertion
and packet matching mechanisms. Introduce 2 new flow table types:

1. Allow a user to specify the insertion type used in template tables.
The insertion type is responsible for choosing the appropriate key
value used to map inserted flow rules into a template table.

Flow rules can be inserted by calculating the hash value for
the pattern or inserted by index via the new create_by_index() API.
The idea of the index-based insertion is to avoid additional matches
and simply execute predefined actions after jumping to the index.

The insertion into an already occupied index results in an error.
The old rule must be destroyed first. An index cannot be bigger than
the size of the table, otherwise, the rule is rejected as well.

2. Allow a user to specify the hash calculation function used in template
tables. The hash calculation type is responsible for the calculation of
the flow rule index a packet would hit upon arrival at the table.

Control over this is useful for applications with custom RSS algorithms,
for example. An application can select various packet fields to serve as
a hash calculation source and jump to the appropriate flow rule location.
The RSS hash result will be used as the index in the table. For the linear
hash function, the mapping is one-to-one and the hash result is the index.
For other hash functions, the index is the hash result module table size.
The RSS hash result can be retrieved via modify_field API: HASH_RESULT.

RFC: https://patchwork.dpdk.org/project/dpdk/patch/20221214022110.393410-1-akozyrev@nvidia.com/
v2: changed the behavior in case of insertion into the same index.
v3: refined the commit message to highlight index-based table advantage.
v4: fixed a typo in the commit message.

Series-acked-by:  Ori Kam <orika@nvidia.com>

Alexander Kozyrev (4):
  ethdev: add template table insertion type
  ethdev: add template table hash calculation function
  app/testpmd: add template table insertion type
  app/testpmd: add template table hash calculation function

 app/test-pmd/cmdline_flow.c            | 166 +++++++++++++++++++++++--
 app/test-pmd/config.c                  |  10 +-
 app/test-pmd/testpmd.h                 |   2 +-
 doc/guides/prog_guide/rte_flow.rst     |  20 +++
 doc/guides/rel_notes/release_23_03.rst |   9 ++
 lib/ethdev/rte_flow.c                  |  24 ++++
 lib/ethdev/rte_flow.h                  |  95 ++++++++++++++
 lib/ethdev/rte_flow_driver.h           |  11 ++
 lib/ethdev/version.map                 |   3 +
 9 files changed, 329 insertions(+), 11 deletions(-)

-- 
2.18.2