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 2E20DA0A02; Tue, 27 Apr 2021 17:38:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC4714121B; Tue, 27 Apr 2021 17:38:43 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2063.outbound.protection.outlook.com [40.107.236.63]) by mails.dpdk.org (Postfix) with ESMTP id DE4314121B for ; Tue, 27 Apr 2021 17:38:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qinz7JMJPe7kBXS8E5YSiZlYTOYtuHSCVfENqjPQ94RnnpTNgirEo0lUodffPM3SbYv7qZ1Vyke2UHvYUnc3ERaTQ5OUk6Mr3q5HKIXauL7Nr3g3oipAcaYurBm9NVmLorlfM25M9WDAyZDO46gPXDONqOb3gXvNXBWUn3FQSlvjgc6mmEKldxkh93CfIDvj5xsjTPhD8EApLvVkTEUKZvNLoc5dJOrB7GADZesMXsDk8a2pO3/hDpcmk82ql7tgGJd0NTW2o7ay+1jS+bdsCWqLWPQsoQNIPRm7xFb2xzCKWnM+iG5pdX3o0S124H82y59hrEGjkgGIQ2vGq8+H/g== 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=/kNDqzP/rdvVAZFOK8IRZIjUZYE0ZpvDNNygeeMpZc8=; b=Imf3kvtwjOAZ27euaHcFBCC6b0Y3mrHGP0ZUWl1RlkYxQYZx2ysSYxwb5mlNcYohLjQ7NUnMNB5qHjmeTCy3Jdn+raGDxfk2ELQow3aiGjJ3cifdX2qlSW10ORI/6c84plDseEdWOjMsUg9+a/59Z66P3mXVEKF0ZwQVfbGjbelh/vL6ePdi5ST80rpdiNjCHxDihLYgwP4JYQQkK6XMJn7aji7P7+ryFZpGnNYt5xCO+rrCvvIzEEHknx32KSXK0oYrWBBXtLZuvgORbgbIG+8XB+1x3zk1WMEGNuvcNwU/TZwx00YdFGKit03Adx83b/OCH8QWk8uQ45Hup+acUQ== 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=/kNDqzP/rdvVAZFOK8IRZIjUZYE0ZpvDNNygeeMpZc8=; b=T6Qdw1m9H4SySV+W5bLalQsQC+YC9LoLQOhHmBs+UAZf01SqeBSSu7n2DGbrdAEpHTxJExQ5FUhvwNp9Tju19TwqpDUvuRIiZcbG5h9LaF859beS2yJBfgFvIw4wOlJycQgn8qSxKj+7FjFj5EOOltrL0EMwxs1VQuPMGKQNQcPyPIfMzKoYtgl+OqK8bS7uBNWGHl1H89+jblO/DH5eEhKFKJlD7lBh9qlXe01j0d1VFkdq2H3lisE5QH7dWVNAsGzqcQ8XzouQkKFdc7joL+5syuBCnAzd4wWDlLq+uEISm/0VNwFAA5x3rsTKX4GF0p/k5DdpvsNERTe3kYdoNg== Received: from MWHPR14CA0030.namprd14.prod.outlook.com (2603:10b6:300:12b::16) by MN2PR12MB3117.namprd12.prod.outlook.com (2603:10b6:208:d1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25; Tue, 27 Apr 2021 15:38:41 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::32) by MWHPR14CA0030.outlook.office365.com (2603:10b6:300:12b::16) 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:38:41 +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 CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) 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:38:41 +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:38:39 +0000 From: Bing Zhao To: , CC: , , Date: Tue, 27 Apr 2021 18:37:56 +0300 Message-ID: <20210427153811.11554-3-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: bc5d230f-4b8a-467b-f2d0-08d9099288b5 X-MS-TrafficTypeDiagnostic: MN2PR12MB3117: 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: hHZWVPN44lGA0hx78zsFGDUneI+nHEat7G1L28nV4QpNw3EXpI3uRe7jUjx0FFHB7aB7n9bGGY0DPokws0ZwxlMEcCk2JYXn+ObTS2WQL/SXFYzAelbO4D5IBQ5WMidD9D1WtrgLl/nc/oIh4NSy9hpI3YH/B3nMszd5+tZZ2ByQlVzTiF+c7l5cbYSh7KE6ocber9K+7ZVZT77nsiUgYm6nQE/uD4ibpNdBO4PuiA03pYxeM84fQ+oBaCK5+xv5aasT+Lik+/8jz9LZ/ndcJw1lfOzb5a7YiZALE1Heft5WO4I7J0FKgGtZQ+q4Q9kGYOYh7/+1gEdwsPqfItbxKl5BAxmEgYiO2VmEZK0y5o+KcRELd6R89YgVHbjapt3OOzLJa0oEuh5DM+d02j3S6be5NJ8jqa+Ba2XF8oOLwRNEGrvU5i58ZRBIoQ2Pj/gD6Ca1YfN+RZCPrQH47eHkKx2MrJiA5BYUXNl1CH9paFgWXQNpSmPX5enT4XCf23YS+Iz5r5y+sTKaipClF861+8jWUta7l70psdC/pRGZR+7lrKOOydd/5bnnjjxf2gSqy8hu45Jh71S3L62SOcC0nicT6uaQKh6tap0SjjztjviYaOZILa/wU7bj9Z4Oh49eTEOoXXgYa8evZs6TAbjQ0pPxKWYCLmZsBaZJL2o+jAA= 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)(346002)(376002)(396003)(136003)(39860400002)(46966006)(36840700001)(8676002)(16526019)(5660300002)(6286002)(426003)(1076003)(107886003)(86362001)(70206006)(478600001)(82740400003)(70586007)(336012)(6666004)(26005)(2906002)(36860700001)(47076005)(4326008)(7696005)(54906003)(83380400001)(8936002)(7636003)(36906005)(110136005)(55016002)(36756003)(2616005)(316002)(82310400003)(186003)(6636002)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 15:38:41.2017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc5d230f-4b8a-467b-f2d0-08d9099288b5 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: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3117 Subject: [dpdk-dev] [PATCH 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 --- 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 3334bd5..007834a 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 6c6f439..4300536 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -760,6 +760,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 eee8fee..956b0b1 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -136,6 +136,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 853eb58..d9987e1 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1134,6 +1134,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, @@ -2449,6 +2451,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.5.5