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 32A1943A06; Tue, 30 Jan 2024 07:49:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4A6340395; Tue, 30 Jan 2024 07:49:50 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2072.outbound.protection.outlook.com [40.107.92.72]) by mails.dpdk.org (Postfix) with ESMTP id AB89A4029A for ; Tue, 30 Jan 2024 07:49:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUxqPn13NLCYdH3DRrJPSJM3L4E6wI2eX4HmsWJW2Gp13p/HLasHfW4Bs+V8vhxhenWYZYpqlJcjjX1YZGSv/fqSL1G2kXFxF/O52ajCVxn7jq411NyeEayJhtUyJJwRPOEP4+rwTjqo2i56Bz1Ne/GI+yw/d/IaFXfPI7XKHQn0+i+d2dbu1TVYaqfJOpWKPJ8Pywhd36qasJQ1NOJBcY8qhLIFwMX6dBA1zoM6wPnDWyUJiDdP/pm/S1H2KpLy+DiI82v1kSxV9nDShCkcOJSRGo+DPpiXH1/0ZIPWUbZKHS7saOPBrONi8v9W+8LPgZotop9P9IlMXhWBSkKw+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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3Unx3SzNEpn73ewTVtz60bghtWAY/IAgk+3bv64ZLIE=; b=hLQ+YMyOW0cuKYr95+uK5xbpUz5taF4kM7FdyZEK6a7AoT2wVdnn0+cjaO14mdURIOUhTczq5hUWFv/w+v5kVTmfZUutebqWf7Qq0MnTVuMukqWmAIa5Mppm4ybdLjKWlTPiu6hTdqWectvDOyNeh5AwOvBked2M0vJPIwJA7F7kR0zfx0Kbk08wMoiGlQUJZTAnNN2EDQEG2Es88P65Ktxis1R3YCiLdkhhzMEjhsCGD6ZSvF3xP8BEe8/eJ29ibm7LKGjoBOg6uiYXlPMf5MTixUFOafiWcTaTkfKjd05cv2uKk81CXiHmue4VqDU5EYHoc2EQlDvc1mKSLmN+ig== 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 (0) 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=3Unx3SzNEpn73ewTVtz60bghtWAY/IAgk+3bv64ZLIE=; b=dEjOtoY+fFtNHUMAoVHkFmGDdLNldgretcBOFGar5F/xAy0Ccn4n7N2AW6Gp1wbq4C35b7ZqIo5b5d318Keqynh6cg3P5CvQFOGopVaRqJJJqxm6HS1KQHhY+D+c8khvnE4j16QsgWVE70G+x6z00haIvAudAaa/C2flSmfYWLe22hfQztdcezK9oWO7VPitDAzGoLvfilIY/TpAcrlnGnv+BMNAUeoHfMscxKLdUkiQzFSTYeqghwSt4v1RsEXZgPmCaHcJeplIgR8lmtP7Yw0KBpnFCh5UBZhJl9Hbn1yvPa1czw9AKAiY/f/RVXUBy+Jqc7jE4pRVXmZjbQqyiQ== Received: from MW4PR04CA0092.namprd04.prod.outlook.com (2603:10b6:303:83::7) by CH0PR12MB5026.namprd12.prod.outlook.com (2603:10b6:610:e1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34; Tue, 30 Jan 2024 06:49:45 +0000 Received: from CO1PEPF000044F3.namprd05.prod.outlook.com (2603:10b6:303:83:cafe::d3) by MW4PR04CA0092.outlook.office365.com (2603:10b6:303:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34 via Frontend Transport; Tue, 30 Jan 2024 06:49:45 +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 CO1PEPF000044F3.mail.protection.outlook.com (10.167.241.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Tue, 30 Jan 2024 06:49:45 +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.41; Mon, 29 Jan 2024 22:49:33 -0800 Received: from nvidia.com (10.126.231.35) 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.41; Mon, 29 Jan 2024 22:49:30 -0800 From: Gavin Li To: , , , , CC: , , Subject: [PATCH V1] net/mlx5: store IPv6 TC detection result in physical device Date: Tue, 30 Jan 2024 08:49:13 +0200 Message-ID: <20240130064913.1916709-1-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] 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: CO1PEPF000044F3:EE_|CH0PR12MB5026:EE_ X-MS-Office365-Filtering-Correlation-Id: 9eb50afb-0a39-4103-8b55-08dc215fa4e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lYNa/toFT6X5X9JgMl4iAWAO/2TyyjMf5+SgiGPjJEZ30B2aJsdCh4WCJ9pdrXkS5VtMT0kovjwt8aIOQpvY20zdgha2UCPToW0xcCALqPiDeMO8gjN+f0neLCRoz/wWVncByYUKUxCwfhs0uM3zGtV3iPXU72kaSxbLj//tje+Ag65ucVUY+Y7PgXNKidjcLyZ2QPNw1ApR0UqnG/wxwcliHTlr0H/U86MTTikdZgHiT69+V9TXgHqqtAsPivMJW7ckp+ty3gYIqyawtzBKTqPzCxfkS9W3DYm+UMrHsu5jF3UXT9LUAPkniyC6TWyp0RhiorC2PMOz69Cr3ItEW/F0thX4WUsJUF4YZQIn9NgsNt3LQQaG3uX1vlHxOTBd0lYZ/rh8kqLF4uidiA60pkRgrvL3vkPaRs6AZ4tBuNM2MPpFYygM+ULTRqFUjAvPnDeKKJC5mxXXwhzk09mHNGjHGF+dX56ONqF18qxdIVNAetylU4OWl2T9GqtcytY6hrNUjbyaVPitNWFjAu9mkXq7rerKoKJpYbWt39zDPJrkkkwixY6q4lZC03Yrpn5NZoSkL4QW309eeZsLJ0g7VfYDQ3Elum60E5xxEt2H9gxE1jdeBQj0YutP/6T9UGFNWgJlMwRohpe8lrc/HGVqH1G5/DeEPFL9WmCDfPTWSMeR6QUpTaX7h5tD0ITmfhi6tUpfjtBgvZ485PaUmkdIYmeOA+deTbgl1GV1ZrTpDwkbRhK2FttGQpmLQcJz5uIg 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:(13230031)(4636009)(346002)(376002)(136003)(396003)(39860400002)(230922051799003)(451199024)(1800799012)(82310400011)(64100799003)(186009)(46966006)(40470700004)(36840700001)(36756003)(2906002)(41300700001)(2616005)(1076003)(16526019)(83380400001)(6286002)(26005)(55016003)(426003)(336012)(316002)(6636002)(54906003)(110136005)(70206006)(70586007)(6666004)(40480700001)(40460700003)(478600001)(7696005)(107886003)(36860700001)(82740400003)(7636003)(356005)(47076005)(8936002)(4326008)(8676002)(86362001)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 06:49:45.0518 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9eb50afb-0a39-4103-8b55-08dc215fa4e8 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: CO1PEPF000044F3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5026 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 Previously, discovering of IPv6 traffic class would happen on each device not sharing context with others. However, It's not necessary to repeat it on devices of the same physical device. A flow will be created and destroyed in the detection, which may trigger cache allocation and take more memory in scale cases. To solve the problem, store the discovering of IPv6 traffic class result in physical device, and do it only once per physical device. Fixes: 569b8340a012 ("net/mlx5: discover IPv6 traffic class support in RDMA core") Signed-off-by: Gavin Li Acked-by: Suanming Mou --- drivers/net/mlx5/linux/mlx5_os.c | 12 +++++++----- drivers/net/mlx5/mlx5.h | 13 ++++++++++++- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index e47d0d0238..dd140e9934 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1602,11 +1602,13 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, goto error; } rte_rwlock_init(&priv->ind_tbls_lock); - if (!priv->sh->cdev->config.hca_attr.modify_outer_ipv6_traffic_class || - (sh->config.dv_flow_en == 1 && - !priv->sh->ipv6_tc_fallback && - mlx5_flow_discover_ipv6_tc_support(eth_dev))) - priv->sh->ipv6_tc_fallback = 1; + if (sh->phdev->config.ipv6_tc_fallback == MLX5_IPV6_TC_UNKNOWN) { + if (!sh->cdev->config.hca_attr.modify_outer_ipv6_traffic_class || + (sh->config.dv_flow_en == 1 && mlx5_flow_discover_ipv6_tc_support(eth_dev))) + sh->phdev->config.ipv6_tc_fallback = MLX5_IPV6_TC_FALLBACK; + else + sh->phdev->config.ipv6_tc_fallback = MLX5_IPV6_TC_OK; + } if (priv->sh->config.dv_flow_en == 2) { #ifdef HAVE_MLX5_HWS_SUPPORT if (priv->sh->config.dv_esw_en) { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 683029023e..ce9aa64a1d 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1421,6 +1421,17 @@ struct mlx5_dev_registers { struct mlx5_geneve_tlv_options; +enum mlx5_ipv6_tc_support { + MLX5_IPV6_TC_UNKNOWN = 0, + MLX5_IPV6_TC_FALLBACK, + MLX5_IPV6_TC_OK, +}; + +struct mlx5_common_nic_config { + enum mlx5_ipv6_tc_support ipv6_tc_fallback; + /* Whether ipv6 traffic class should use old value. */ +}; + /** * Physical device structure. * This device is created once per NIC to manage recourses shared by all ports @@ -1431,6 +1442,7 @@ struct mlx5_physical_device { struct mlx5_dev_ctx_shared *sh; /* Created on sherd context. */ uint64_t guid; /* System image guid, the uniq ID of physical device. */ struct mlx5_geneve_tlv_options *tlv_options; + struct mlx5_common_nic_config config; uint32_t refcnt; }; @@ -1459,7 +1471,6 @@ struct mlx5_dev_ctx_shared { uint32_t lag_rx_port_affinity_en:1; /* lag_rx_port_affinity is supported. */ uint32_t hws_max_log_bulk_sz:5; - uint32_t ipv6_tc_fallback:1; /* Log of minimal HWS counters created hard coded. */ uint32_t hws_max_nb_counters; /* Maximal number for HWS counters. */ uint32_t max_port; /* Maximal IB device port index. */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6998be107f..1d2fdd3391 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1608,7 +1608,7 @@ mlx5_modify_flex_item(const struct rte_eth_dev *dev, static inline bool mlx5_dv_modify_ipv6_traffic_class_supported(struct mlx5_priv *priv) { - return !priv->sh->ipv6_tc_fallback; + return priv->sh->phdev->config.ipv6_tc_fallback == MLX5_IPV6_TC_OK; } void -- 2.34.1