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 35CEDA0524; Wed, 5 May 2021 14:24:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF5BC41114; Wed, 5 May 2021 14:23:54 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by mails.dpdk.org (Postfix) with ESMTP id 4803F41106 for ; Wed, 5 May 2021 14:23:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWJfrZ1AqYG92g4OIyoMzbned216rdkyKIVswLEOqmwvsfa65Hpe7K8eskEBe4KFTnRM+qezYvKOJSH1mERDkJps5JxID9bpMsaEKCXFPYFb8m8/ZUufeIS1i96qlprZR9dpAax39F37M4OuAijLYUmNY/3dGcA0qJx2dnwVMMH+Cxgag1rbqceHfda/Z/QGABtpWhZu6j3T95kZW2O6D9towpDK0XpP4nWDxOj8ySKlBB/bbITiOHb+xFKeCktzV/zucYgPoH1/HQqBer7ZRSkb4TbG5Dl59hixQOok2HO3WupVle6eHJUtmukaNdZ0tJMzFfBIlTlGuoNdpjesPQ== 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=KR37BJARjaH4/fI2wcVL1IwqC43ddwIMyvlzcEnn2mE=; b=Kn03X4IR3+D1fBcj9u0UTsWAaYNhybJnozDQS0ulD+BUxIa8xevgOJT8qCeFY82Cs/TffKdV0AMO4e6HzWA/zzDdd+9khBzh1Fsv9jbxFvVPjT/FYaTwkfUXqb3BF4HbrXnE7u96AESoq8+/6SpGuKHVyTZ72BfBmZRFWWXPqqbINz738dNgWrBAVgU+BXwFSh+kmcctk2Z0J+cMG0pV1xoRbb/M5qiRndHHXPLO85XxvDSn/zm4pBlTtoBfDawB1l+jWIUXHCjGtnhbKCBd11LGp3WYFXR1d2Q4WngOdUmkRiHV5pRkAWY3cejCMzuuXNdwyOAMg9Xh/A6x1D70VA== 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=KR37BJARjaH4/fI2wcVL1IwqC43ddwIMyvlzcEnn2mE=; b=M8fXjJibvLMwQxA9nsNavxW01tin1jJwSGjCWDHlhVAbCFIn1rVyaiFACgNH5Rnrh1DoL+UO3khfieecmEkzm5YLem5/oYwq/w9IgQByU1QCiuRYaIZ995p+4+KiiCnlBzG8jup8EeNBjGtWUvIBuJd1QZZeqrtwxkI/Dzn6/F4zABd6G4urGocOjzUJjaXFhFR4zQtXxs1OyAZiFfAG4x//aRf7MJx/oOpCyHcKuqGlSG5UnPRO4DZePIlmsKQ+QZJfO+5liJ/2XZ2yANY65E30he3bUabE/NpUJzrazizawdxzveaUaAkkkgSXxD5cCe+KR5G/OMWUwy01PNRX1A== Received: from DM3PR08CA0011.namprd08.prod.outlook.com (2603:10b6:0:52::21) by MN2PR12MB3648.namprd12.prod.outlook.com (2603:10b6:208:c1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Wed, 5 May 2021 12:23:52 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:0:52:cafe::f) by DM3PR08CA0011.outlook.office365.com (2603:10b6:0:52::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:52 +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 DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) 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 12:23:51 +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 12:23:49 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:13 +0300 Message-ID: <20210505122328.51129-3-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-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: 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: 8a7a6ff4-6ede-4a90-473d-08d90fc0a4a1 X-MS-TrafficTypeDiagnostic: MN2PR12MB3648: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4HoCR+yPLGt+t13JR5NNQPntyR9jrgkLCyF3E6pymomCtDYnaAuAVhtxlzHV67WzMtymj02fc5kVAxouii2ICgZrCqXySq4/ANlW/oPH8aeDYufELlC7xvjycIskxWi9whYeP5BpB/0h7e56o3IIpyIWnRUdb9wc4+WSnFIH/RsdV5fZjgC9rILYCDcWVmWrnHCCXg+foRvNmk6OOLzttiVKXP62Jp8/0XllxL7ZidwOiRTkDlocvdQJBPbTKD+iy8DOgtMgJTacYUycyCQzBhFdNu82hUUf4flNnpZOD5lS4OfyXRdp9drn6T7u5YYb6sb6d8UNTpkc1Ca5GAElHSMUlNF6i2DepTj/Ml3WQLQk0NDeg45IZHheGqELXTPWU9Egidfe5mOw6C3hY7uuMbvo/+hQbEkCd21PFLhIWgjHwwhq3GzD5tnpTeF/mF8ELlcFyXQnEYuhWA8kssSPyoL0qN/BZG0qMM0hpXVcdnpSGlQ865qP0HI8wLx5JmammTnOe4Y2rPnFk0EslfqeTp/TU/B+bjdZydNEVDkMe3E+zti4XuDGn10RwHxXolbNTxsgxalie4QTDiL1wi5Zpvma5OOR9XNgLNAbRLDX/41JZs8/mguQdp+9UpwMkSdGpbPdCVK0GaH6LhzvwNVJrtV8gputmQuZcCw64VQcyfg= 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)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(36860700001)(4326008)(478600001)(8936002)(70206006)(336012)(7696005)(6666004)(7636003)(356005)(2616005)(5660300002)(110136005)(26005)(82740400003)(6286002)(16526019)(54906003)(1076003)(8676002)(316002)(55016002)(107886003)(36756003)(36906005)(426003)(82310400003)(83380400001)(70586007)(2906002)(47076005)(186003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:51.8387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a7a6ff4-6ede-4a90-473d-08d90fc0a4a1 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: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3648 Subject: [dpdk-dev] [PATCH v7 02/17] common/mlx5: add CT offload capability checking 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" During startup, the ASO connection tracking offload capability could be queried via HCA_CAP_QUERY command. If the HW doesn't support ASO CT, the value would be 0 by default. The following initialization should be skipped and the creation of the CT object should return a failure directly. The following CT creation should also check this capability. With the old driver, the pre-processing macro should be used in order to make the compiling pass. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 3 +++ 4 files changed, 9 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 3334bd5cb2..007834a49b 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -189,6 +189,8 @@ has_sym_args = [ 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h', 'mlx5dv_dump_dr_rule' ], + [ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ], ] config = configuration_data() foreach arg:has_sym_args diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 1b54c05313..7a0efa59e5 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -783,6 +783,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, MLX5_GET(cmd_hca_cap, hcattr, umr_indirect_mkey_disabled); attr->umr_modify_entity_size_disabled = MLX5_GET(cmd_hca_cap, hcattr, umr_modify_entity_size_disabled); + attr->ct_offload = !!(MLX5_GET64(cmd_hca_cap, hcattr, + general_obj_types) & + MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD); if (attr->qos.sup) { MLX5_SET(query_hca_cap_in, in, op_mod, MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP | diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index 5681e03fee..e6f9b90293 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -137,6 +137,7 @@ struct mlx5_hca_attr { uint32_t qp_ts_format:2; uint32_t regex:1; uint32_t reg_c_preserve:1; + uint32_t ct_offload:1; /* General obj type ASO CT offload supported. */ uint32_t regexp_num_of_engines; uint32_t log_max_ft_sampler_num:8; uint32_t geneve_tlv_opt; diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 683ab40338..b385b6f518 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1139,6 +1139,8 @@ enum { (1ULL << MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO) #define MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT \ (1ULL << MLX5_OBJ_TYPE_GENEVE_TLV_OPT) +#define MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD \ + (1ULL << MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD) enum { MLX5_HCA_CAP_OPMOD_GET_MAX = 0, @@ -2487,6 +2489,7 @@ enum { MLX5_GENERAL_OBJ_TYPE_FLEX_PARSE_GRAPH = 0x0022, MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO = 0x0024, MLX5_GENERAL_OBJ_TYPE_FLOW_HIT_ASO = 0x0025, + MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD = 0x0031, }; struct mlx5_ifc_general_obj_in_cmd_hdr_bits { -- 2.26.2