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 35317A0524; Wed, 5 May 2021 11:52:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DA8F41169; Wed, 5 May 2021 11:51:04 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2051.outbound.protection.outlook.com [40.107.244.51]) by mails.dpdk.org (Postfix) with ESMTP id 61ABE41166 for ; Wed, 5 May 2021 11:51:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TO2KTlVoUbltZ775CGFg0iuKAwB6S3jSnrK/PRM/eTC61EmrdiisInoikCdSyhsDOyrpDT5rc3dGHJer5QtwwoayynbWFMVZWfcou/N8BLnGouf4JGQnHxMHQE3/mSyTsTlNLNd92AB9HRnGnj1VrObkDK/kqPEApsPjSTIMsab//QV5qvdXb4g3F8ei5TQPpc7wpnxlC8I6o4bW7Ft70qUl+pvLDKLskdUdcH5aLPModXWFR8xsa8eG8MIKtHsxNPxAs1+R3qyhd95yUH3VYtNJZjoj+yaWU3hP0boQ0Muj/nsb/AhhrsH7/c49Lx3+KzrQw6QquSPehmv7b0/+3Q== 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=pB2JDdw5HhOcdJTdStmrnzVoSmA5KgdEG5lJ6IR5Weg=; b=TnBIsrbQscBY3e/lM9KfeNl9NgHKD96e4QUzupryagwEflzmQ+xYTAYtZw1ZaGxtETBv/p5IbCSUew5TLrkiqqgnM5qr4RfpiWEqOsXohW1psseaOEyiyYzGQHxxm4GfkidOblGbTsuDF/fmyJ64sC19AdKjmViN5pKJ3k+uHqJCNwX8KkxZVhcH6B0OuDppk/KfPfkcL+hCnhtdJcKIWZnRRdJBUy7adht/i15lhADS8A4mJykUm1eEmDq9cSqtjlD4jAHDadlYB00YU31jVqRsxzqhxjfzGN9Uc0QvF1fSEmy1CZKvYpZNFwGeKdHDPFfEE7S1k9oudnMM8Dcvnw== 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=pB2JDdw5HhOcdJTdStmrnzVoSmA5KgdEG5lJ6IR5Weg=; b=sj8I8SCNgcw37HaEENfHBy0Vc/b1gdGPq/wgSdZvSeP2xysiTp8/8a4KNyVJXcXECgh6YwsWtCeTpfunYlRDsaeks3Kz85/9N3B6QriwoQx+TAp+6kBpssqS834dUXjRA2a5KDfYxLJuqoXs6ya5auisHwnPqOfpMzhI4nu0QYQ82J+aUkIBqnSu9C2wmy6QLMepiDhaXQrQ4J0x+vJchktK/CF3gCtkvKcyvZB27ieVfnJR4TI3QWH3M2J/a4oLs1xfjZTbiHalZGKT1p2I+iPEOhgw9BiXbvgk3UXCV6lE4Sfsq/uwtt7H3xiJfi2Qc/ncKaSXQjR2Lx8Fmv7auw== Received: from BN9PR03CA0608.namprd03.prod.outlook.com (2603:10b6:408:106::13) by CY4PR12MB1573.namprd12.prod.outlook.com (2603:10b6:910:d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.35; Wed, 5 May 2021 09:50:57 +0000 Received: from BN8NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::13) by BN9PR03CA0608.outlook.office365.com (2603:10b6:408:106::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Wed, 5 May 2021 09:50:57 +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 BN8NAM11FT017.mail.protection.outlook.com (10.13.177.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 09:50:57 +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; Wed, 5 May 2021 09:50:54 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 12:50:07 +0300 Message-ID: <20210505095009.40250-16-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505095009.40250-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505095009.40250-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: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b61f5a23-e2e8-4beb-bd7e-08d90fab483f X-MS-TrafficTypeDiagnostic: CY4PR12MB1573: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: 1WWLdwPFJUZRBneCGU8CcP/idyA3FZk9LFysd+wbqTLdWstj5TOyJfCIL+p1dAv3uYtd77unMtuEtxXfDOV3Xh3fBEyQ9ACuZFce6XEUWQDMTjsmUEcJI6+ZzrMOu7mzbALi+FuRIvLJIfvgQyQ+szPR4k/YoAi1y4gM0PUgGYKBc1vgwg4vTsEH0vLwcIcJDiEvoyruao/5K3+VHeI27dFUDkQeL9TcWQZAdXpJLgz9lx1s55fb7qLcHEcZ+KmoejXouOWK5g2pvUI+z1DCh2tzZPWbaDs2d59WV4SD6xzSulz8VELOF18LfJFmkvmBSTcIGJFqJf05NFEipP+e/hRX+3lhs+2yNaxISKSJobkw8Zo1cRU42IeGqmsgziiZHur+JOb9UG3ao5Iai+M9jne6dtQVZMF76BZqYOdDL7foEgAht7iMPSRQn+lZBj2b+qEZyd/+46r3WRMTX8h0ruXv8d9tgvWeli6tQyrD3RCRs4KoH57O1L0EzBHfVNQA9bnkgq2iZ3HV6euQhoDzbxxRgJGwtVk8zsLSkymAVU6RW26XSJCvlzP/m9vMz8kQSf7me0yo+sv7dHRwrmzk+OazNIZ91CXv2ceUuvLjDHCzri/aIbdh9epThOK9TjdvXnNWC1Pz5ydwa1VWhWkCSGrN5J+v5Fb23FPWhFVRpV0= 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)(136003)(376002)(346002)(396003)(39860400002)(36840700001)(46966006)(107886003)(1076003)(7636003)(82310400003)(82740400003)(8936002)(316002)(86362001)(47076005)(36906005)(336012)(83380400001)(36756003)(6286002)(110136005)(36860700001)(356005)(55016002)(478600001)(2616005)(426003)(2906002)(5660300002)(6666004)(186003)(16526019)(4326008)(70586007)(8676002)(26005)(70206006)(54906003)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 09:50:57.3737 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b61f5a23-e2e8-4beb-bd7e-08d90fab483f 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: BN8NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1573 Subject: [dpdk-dev] [PATCH v6 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 | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 9ad518b824..e6b9d1def0 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -151,6 +151,9 @@ enum mlx5_feature_name { /* INTEGRITY item bit */ #define MLX5_FLOW_ITEM_INTEGRITY (UINT64_C(1) << 34) +/* Conntrack item. */ +#define MLX5_FLOW_LAYER_ASO_CT (UINT64_C(1) << 35) + /* 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 f329ea4b49..b691781fee 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2623,6 +2623,51 @@ 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) + mask = &rte_flow_item_conntrack_mask; + flags = spec->flags & mask->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. * @@ -6925,6 +6970,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = MLX5_FLOW_ITEM_INTEGRITY; 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.27.0