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 4E630A00C4; Mon, 14 Feb 2022 10:35:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19B6B41140; Mon, 14 Feb 2022 10:35:31 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2047.outbound.protection.outlook.com [40.107.100.47]) by mails.dpdk.org (Postfix) with ESMTP id 793BB40DDA; Mon, 14 Feb 2022 10:35:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DBfRTBzSzWT/+Di7af880OTjLoCx15yx4E5FdyPeXzC+9RJXLN9SPHBvxpn0aKhgAzq+vMWnxtigcinTma/GgA+mEGWBAJ145uWEHwdZpf9mKLiu+R4bUphB+KVoYHdnyVEUDUsxABdE1ysyOFFnduTPtvb0kxCOM0HkqKVxHDRwnFAWxEABoQE0sYJtsIhitBsirZaRIwtvI7EpM1c0JapkzQ/kiPJ8aEtRJct5qGgWlkD7OV/zkphOFfd3lwqOCoM5XbDOEq69T2Ec2dSFw/4I5XZliz29wlmlxs+5cbjkjvl1Eld0JqH68hVsqUXRNxpTtOs0owz7I8dfjBJEhw== 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=5DD+hDC+M89V/i9/JhvonDUCsUBnf6dS8SRpt45aCEo=; b=DNGHJ0vqHHE13IvrOZclfcjIGk7EB6MQwyrrwVs1haam5fWKxEerFIlJozfFk2esTfp6CRUYOm7z2QfbcGoR+PRDg2j5/1GcjHLovJfXJT8j/T2xdifsX95IMFeIzBI0akMbhUxnDytx5QbWCCgPw5vgdTtvc1PGMSk/phvnAPy9Y13Txlpc5Eka/WZdjcIGWWlhDp6lo0vza8ws+ASrUtxfu2c8+B1uJrKIEDMp0FLKq8qcg+6LrHXZ88Kp58fuso2q3uqGSOMhMx86gfKXuYWCc3hb+5DFkaytsnOm7hjCPrhQbLoCNx0iEt+oaKlVXJSngNWVz5FgYungdnjM9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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 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=5DD+hDC+M89V/i9/JhvonDUCsUBnf6dS8SRpt45aCEo=; b=nex1lnclY3uqXRiXon/3JbQA80KQDpy+gqWrTJ/BlmRy+Ex3CI3Kl9ngOHiY7aQJTfwNCTO16m5BHdHgd5WQ0hsPkKio2GoQM9VjZQNoPvjBm+BhfeOFL+cZp6WXjPB9H4oUgiA8XTiTu836TisBuHBN1jA2ZrXwt47xkT1OAbhJaWEZNy2OcMLl6iqXrHaJgD/TKjXIT00FsOKyhJ6pHzwwglYbcPQSp/nC275uO5nMjtLjOyvR1kY7p2d+D1qgVjHq5vI6PNRMqQW0Lx9YlwOhewg1xqQu6jzJDhdTbp3uU37ezZZxMGegFCAEMYTaFD5MMgRgjK4N3rOMwCckwQ== Received: from CO2PR04CA0126.namprd04.prod.outlook.com (2603:10b6:104:7::28) by CY4PR12MB1365.namprd12.prod.outlook.com (2603:10b6:903:43::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.18; Mon, 14 Feb 2022 09:35:26 +0000 Received: from CO1NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::f8) by CO2PR04CA0126.outlook.office365.com (2603:10b6:104:7::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12 via Frontend Transport; Mon, 14 Feb 2022 09:35:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT036.mail.protection.outlook.com (10.13.174.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 09:35:25 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 14 Feb 2022 09:35:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Mon, 14 Feb 2022 01:35:24 -0800 Received: from nvidia.com (10.127.8.13) by mail.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.9 via Frontend Transport; Mon, 14 Feb 2022 01:35:21 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Subject: [PATCH v2 01/20] net/mlx5: fix wrong check sibling device config mismatch Date: Mon, 14 Feb 2022 11:34:52 +0200 Message-ID: <20220214093511.1592698-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214093511.1592698-1-michaelba@nvidia.com> References: <20220127153950.812953-1-michaelba@nvidia.com> <20220214093511.1592698-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d813b7e6-94d9-40ea-ebce-08d9ef9d5496 X-MS-TrafficTypeDiagnostic: CY4PR12MB1365:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PbXz5HoVFqK6PcZCkOsEOjzaTCxr6luLRF1S9B5rVcfoHVKDhYAPpOgf8JSFLLxQl/kg6G7WbiKuRcbYQvmfcoZ8qKwdGUM+UnJTyQoF5aSAytYVgIXsC6a5QYWO2aqFNRUkS2cWIKMzMhkFoXBlmLLLOG4f6VTS4wePETDk3aUp1c3xUh+g2h2EdVU35cZTUfvCBUTmmHayVyDB998o1/UB3r5ap4cpKhHcTaTDHWnntSuMxxszy4jHW8GK8Nags+ij7W0chu0H5qAeLC5qKC046nU72AKUVVOr3yKM3+1GMYLdIrOmXKDxFTAUGJra6PkH5R8vucShs07IpRQE7iKdqbk/o5JhgR6bHMPUUExfzLVk1TAZgrxiEAvd308xvyaYOJ1rbkJDKvl2z8Dj/g4Y72zLNodpQ4wBkAw34IEJWclbaxsqwsUe6vykUGK90AIjBHbEMZ9Las++EeZZuDjUhEBowjem1bSt6p3g7PnoYgKZZorQysCkjXrcP1lliKm8jlyS6fPtmsWujpdbeT56iXB5eUbJ6hzdxsLPf5otNsVjt1TxQxOeINGNYISXn0JfCnb6DjJdLpoDSxVN255GURz9hNdD21w0xfF3sp6XIOpQOwLpDXTAxmP1d6dPU9ZJA1Pfg4JrftDZXdrFhZXxaiKX5bpZFqKjS7b6x9jUTbgqhRCAjhWH1ZjgFGj5wSVcQzCzA4dyNCRkm0+RMw== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(47076005)(55016003)(4326008)(5660300002)(36756003)(40460700003)(86362001)(2906002)(70206006)(6916009)(450100002)(70586007)(8936002)(8676002)(54906003)(316002)(83380400001)(508600001)(356005)(81166007)(1076003)(36860700001)(6666004)(7696005)(2616005)(82310400004)(426003)(336012)(186003)(26005)(6286002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 09:35:25.6622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d813b7e6-94d9-40ea-ebce-08d9ef9d5496 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1365 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 The MLX5 net driver supports "probe again". In probing again, it creates a new ethdev under an existing infiniband device context. Sibling devices sharing infiniband device context should have compatible configurations, so some of the devargs given in the probe again, the ones that are mainly relevant to the sharing device context are sent to the mlx5_dev_check_sibling_config function which makes sure that they compatible its siblings. However, the arguments are adjusted according to the capability of the device, and the function compares the arguments of the probe again before the adjustment with the arguments of the siblings after the adjustment. A user who sends the same values to all siblings may fail in this comparison if he requested something that the device does not support and adjusted. This patch moves the call to the mlx5_dev_check_sibling_config function after the relevant adjustments. Fixes: 92d5dd483450 ("net/mlx5: check sibling device configurations mismatch") Fixes: 2d241515ebaf ("net/mlx5: add devarg for extensive metadata support") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 41 ++++++++++++++++-------------- drivers/net/mlx5/windows/mlx5_os.c | 28 ++++++++++++-------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index bbe05bb837..e157795b63 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1241,6 +1241,28 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } /* Override some values set by hardware configuration. */ mlx5_args(config, dpdk_dev->devargs); + /* Update final values for devargs before check sibling config. */ +#if !defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_MLX5DV_DR) + if (config->dv_flow_en) { + DRV_LOG(WARNING, "DV flow is not supported."); + config->dv_flow_en = 0; + } +#endif +#ifdef HAVE_MLX5DV_DR_ESWITCH + if (!(sh->cdev->config.hca_attr.eswitch_manager && config->dv_flow_en && + (switch_info->representor || switch_info->master))) + config->dv_esw_en = 0; +#else + config->dv_esw_en = 0; +#endif + if (!priv->config.dv_esw_en && + priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) { + DRV_LOG(WARNING, + "Metadata mode %u is not supported (no E-Switch).", + priv->config.dv_xmeta_en); + priv->config.dv_xmeta_en = MLX5_XMETA_MODE_LEGACY; + } + /* Check sibling device configurations. */ err = mlx5_dev_check_sibling_config(priv, config, dpdk_dev); if (err) goto error; @@ -1251,12 +1273,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, #if !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) && \ !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) DRV_LOG(DEBUG, "counters are not supported"); -#endif -#if !defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_MLX5DV_DR) - if (config->dv_flow_en) { - DRV_LOG(WARNING, "DV flow is not supported"); - config->dv_flow_en = 0; - } #endif config->ind_table_max_size = sh->device_attr.max_rwq_indirection_table_size; @@ -1652,13 +1668,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, * Verbs context returned by ibv_open_device(). */ mlx5_link_update(eth_dev, 0); -#ifdef HAVE_MLX5DV_DR_ESWITCH - if (!(config->hca_attr.eswitch_manager && config->dv_flow_en && - (switch_info->representor || switch_info->master))) - config->dv_esw_en = 0; -#else - config->dv_esw_en = 0; -#endif /* Detect minimal data bytes to inline. */ mlx5_set_min_inline(spawn, config); /* Store device configuration on private structure. */ @@ -1725,12 +1734,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, err = -err; goto error; } - if (!priv->config.dv_esw_en && - priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) { - DRV_LOG(WARNING, "metadata mode %u is not supported " - "(no E-Switch)", priv->config.dv_xmeta_en); - priv->config.dv_xmeta_en = MLX5_XMETA_MODE_LEGACY; - } mlx5_set_metadata_mask(eth_dev); if (priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY && !priv->sh->dv_regc0_mask) { diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 7f3532426f..3db33cd0cf 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -439,6 +439,21 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } /* Override some values set by hardware configuration. */ mlx5_args(config, dpdk_dev->devargs); + /* Update final values for devargs before check sibling config. */ + config->dv_esw_en = 0; + if (!config->dv_flow_en) { + DRV_LOG(ERR, "Windows flow mode must be DV flow enable."); + err = ENOTSUP; + goto error; + } + if (!priv->config.dv_esw_en && + priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) { + DRV_LOG(WARNING, + "Metadata mode %u is not supported (no E-Switch).", + priv->config.dv_xmeta_en); + priv->config.dv_xmeta_en = MLX5_XMETA_MODE_LEGACY; + } + /* Check sibling device configurations. */ err = mlx5_dev_check_sibling_config(priv, config, dpdk_dev); if (err) goto error; @@ -600,7 +615,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, * Verbs context returned by ibv_open_device(). */ mlx5_link_update(eth_dev, 0); - config->dv_esw_en = 0; /* Detect minimal data bytes to inline. */ mlx5_set_min_inline(spawn, config); /* Store device configuration on private structure. */ @@ -622,12 +636,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } /* No supported flow priority number detection. */ priv->sh->flow_max_priority = -1; - if (!priv->config.dv_esw_en && - priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) { - DRV_LOG(WARNING, "metadata mode %u is not supported " - "(no E-Switch)", priv->config.dv_xmeta_en); - priv->config.dv_xmeta_en = MLX5_XMETA_MODE_LEGACY; - } mlx5_set_metadata_mask(eth_dev); if (priv->config.dv_xmeta_en != MLX5_XMETA_MODE_LEGACY && !priv->sh->dv_regc0_mask) { @@ -661,12 +669,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, goto error; } } - if (sh->devx && config->dv_flow_en) { + if (sh->devx) { priv->obj_ops = devx_obj_ops; } else { - DRV_LOG(ERR, "Flow mode %u is not supported " - "(Windows flow must be DevX with DV flow enabled).", - priv->config.dv_flow_en); + DRV_LOG(ERR, "Windows flow must be DevX."); err = ENOTSUP; goto error; } -- 2.25.1