From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4994DA0A02; Tue, 27 Apr 2021 17:40:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 826AA41290; Tue, 27 Apr 2021 17:39:22 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by mails.dpdk.org (Postfix) with ESMTP id 7C552412AE for ; Tue, 27 Apr 2021 17:39:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JS6H5JaF71zuxkZiJLGa8EmN9IGmiyMhlbyz5Gr0xMGjZ4c1wnoQgoEdNXFki8A50XJ98a5pz10LYQcEt84bAN3fGCIdO6BRMLDvjuNet3CF8nT+FrKzwJPsOWr2RT9vssrV4dmyzfFu5Adq7ecbgqnJzEkeTqGTB5axzQ4JWgYzi/6RCol78KCs+Jop9dvIilI3Fv5gz28t5gyDs7n7HOBgkvDfk0BvXay0nqgQOQBie1Cdy2DZnPMPEVN+asVb5hHQ4XtT92KoR+Nx5E6gKZ+EkOYLKe2k8gYFHADeOpCKNhBs6/GRpBIktu6wOpf/z9ULTkQUn5cyDtKLNMVRxQ== 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-SenderADCheck; bh=eZHuWPBc7HjIBWpBjoWVKes89il8+exHYoidqgsICrw=; b=E9bGPriQy+5QY58IJQfWGLfxwOzn8LL8bRiCt45WL6hVRj4DH39VAvp3dDJKFghkauBQrrzt0i+LTAixNWHxy7T96U+cerdo6mmT9pJNpBwBNMuiyc/5/iwt0chEd955DSecGhs2Hfi7+PbSfXf9BI3ganUU8Q/hJ1c9no2YivdZgdHCNIElNzYcdACN+GvzGwqb7r5aBapDxpYkCUz1twhEfIJGsLeqL8RXbjqJdFhnOs3n1d9r0vnlHihgd51kmNznEC3TIPr0bWHHz9+FHjTlz3ld5/L4VneswMuj3THKmL4i3V1und1UJbNvrNonfF4/HXpQOPVERUQCKN5BLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=eZHuWPBc7HjIBWpBjoWVKes89il8+exHYoidqgsICrw=; b=qGQRRrU8lbJUQPjr/SYxHu8peHKxywyYpfhU6SvbWgN9BeUIYiBiqay6yfPQA2GHoeEl1tjGv+goyNy6QIz2T1QOO0+Y45G0xHeVPphOgMiN+GgVNQC3DQfWrakwUt5a/aN3WZxO8guaC3Dv3wg2/6F8cIqC0AjHjJVkgI7l5QwznZmBlIkHnxdJVHEapY0SSj3aSm432BuE/KUKNJcmSFJFZBpczvECooppNidyJK2BTLW62yyHzDWUy4zU6dY1TFRAoWxm3iQ3nMadlqImBQ56q69QtbTCBj4Zgpx7HHrxYuUa62U6TZqRjnrP7NV7iTuIShBiso/LORVKHC6t7w== Received: from MW4PR03CA0049.namprd03.prod.outlook.com (2603:10b6:303:8e::24) by CH0PR12MB5369.namprd12.prod.outlook.com (2603:10b6:610:d4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20; Tue, 27 Apr 2021 15:39:17 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::ec) by MW4PR03CA0049.outlook.office365.com (2603:10b6:303:8e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Tue, 27 Apr 2021 15:39:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 15:39:17 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 27 Apr 2021 15:39:15 +0000 From: Bing Zhao To: , CC: , , Date: Tue, 27 Apr 2021 18:38:09 +0300 Message-ID: <20210427153811.11554-16-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210427153811.11554-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc783213-7709-4ca5-f1f1-08d909929e5c X-MS-TrafficTypeDiagnostic: CH0PR12MB5369: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x9w5N/tmHblv59t9BuV3acBjIptiva6wNwNCNlsRpnnxH4NED+HeI7KptHfuw6tGU/3s0wq07GsSCsQsQ/fqCOrIwdQjoN7RwK8No7oI8+3+kEJJxxjF+l1s+kyq3nDOhA2TpaZ8c4rijiO/fP0btz5zART/ORK1NEqmpvTPaAoeI/UCM3rDv+9T2HUvvYAuAnJpsFgnB7aEL7dZ8Px4CCn/8WPA1PzwaZlRN8QE81rLG6zyz0HRvFxUr5f/XVEUeCZtHkF+LavS/M+xc0Hz6+9XqrWvMVrhYMzy+wVKBfQ8lCX0iHnHqViylbXHxnRZPGhd7f4sTvItq8UkjfG3ZXI6mGtiSpQHxatSv+qrcjJICA/Eb7UCfouNguMlt54U/DPQ1EY1TRsZBOFIiGO0QnGmj+KJKdtJGhNZMY8qJ71PHXK9I6fqYm2qF23rm9wzZWzc1aoebI4Hd9Hd5BffZH/31ZKJ8pFR6GNjHXj70utGIxwpwXvwqSrT6BYvCnPVD8S0vIuSzTrpx5RZtpn0pleeYdGzCl6Z62Lly4EV5tGVyXvo9RFVUchq5YgWHjy4m5wMcDsXL0afRTMkD8FkokPnQrLDShnDPaNik0fCK3xoxjdMiZv9S9V+KsCLyLRJRxXPp+F2c+w2jg7qAruyb1BIUwQV64bLuL/WQu4WnI0= 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)(396003)(376002)(136003)(39860400002)(346002)(46966006)(36840700001)(36860700001)(83380400001)(70586007)(7696005)(47076005)(36756003)(186003)(55016002)(6636002)(82310400003)(36906005)(4326008)(70206006)(8936002)(16526019)(82740400003)(110136005)(316002)(26005)(54906003)(356005)(336012)(107886003)(7636003)(478600001)(426003)(6286002)(2616005)(1076003)(86362001)(6666004)(8676002)(2906002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 15:39:17.5343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc783213-7709-4ca5-f1f1-08d909929e5c 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5369 Subject: [dpdk-dev] [PATCH 15/17] net/mlx5: validation of CT item 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 item of ASO connection tracking will be translated into the register value when matching. The validation of this item has no dependency on other layers, since the flow including this item should be jumped from another group. All the layers checking was already done in the previous groups. Only the state bits conflict should be checked. It is assumed that the flow with CT item will always work on the TCP traffic. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index c52468c..3b896e3 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -147,6 +147,9 @@ enum mlx5_feature_name { #define MLX5_FLOW_LAYER_GENEVE_OPT (UINT64_C(1) << 32) #define MLX5_FLOW_LAYER_GTP_PSC (UINT64_C(1) << 33) +/* Conntrack item. */ +#define MLX5_FLOW_LAYER_ASO_CT (UINT64_C(1) << 34) + /* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2bf966c..6478625 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2598,6 +2598,52 @@ flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item, "specified range not supported"); } +/* + * Validate ASO CT item. + * + * @param[in] dev + * Pointer to the rte_eth_dev structure. + * @param[in] item + * Item specification. + * @param[in] item_flags + * Pointer to bit-fields that holds the items detected until now. + * @param[out] error + * Pointer to error structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +flow_dv_validate_item_aso_ct(struct rte_eth_dev *dev, + const struct rte_flow_item *item, + uint64_t *item_flags, + struct rte_flow_error *error) +{ + const struct rte_flow_item_conntrack *spec = item->spec; + const struct rte_flow_item_conntrack *mask = item->mask; + RTE_SET_USED(dev); + uint32_t flags; + + if (*item_flags & MLX5_FLOW_LAYER_ASO_CT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "Only one CT is supported"); + if (mask) + flags = spec->flags & mask->flags; + else + flags = spec->flags; + if ((flags & RTE_FLOW_CONNTRACK_PKT_STATE_VALID) && + ((flags & RTE_FLOW_CONNTRACK_PKT_STATE_INVALID) || + (flags & RTE_FLOW_CONNTRACK_PKT_STATE_BAD) || + (flags & RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED))) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "Conflict status bits"); + /* State change also needs to be considered. */ + *item_flags |= MLX5_FLOW_LAYER_ASO_CT; + return 0; +} + /** * Validate the pop VLAN action. * @@ -6695,6 +6741,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = MLX5_FLOW_LAYER_ECPRI; break; + case RTE_FLOW_ITEM_TYPE_CONNTRACK: + ret = flow_dv_validate_item_aso_ct(dev, items, + &item_flags, error); + if (ret < 0) + return ret; + break; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, -- 2.5.5