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 48CDBA00C4; Mon, 14 Feb 2022 10:36:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 718AF411C3; Mon, 14 Feb 2022 10:35:50 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48]) by mails.dpdk.org (Postfix) with ESMTP id 0D8FB411B8 for ; Mon, 14 Feb 2022 10:35:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PvniZybhZi3pumNIfDS26IqbSpDr9aosUNW1sSRkp2faHpHpiZDBxAICMpETTYuTVlHfMNU06iYB2JGf9DTjtQdBMRG3GOcWAYL+bSF4Bx0odTtcGSqPcu+uYyroToiOk09VRMVl6WTE6/dT+m9b5o5Zc/e7CAUtk8jQ7xWJ4HJMfNYcT0xWmT8PEfAQWJ7mGnE+zUy0gMmEVgoYVCV/hGjXVh4lH97yHen7/CFH0JLqu/plMeH+A6Tq903GYDhxZfiaAh6cAX2NzTJHRj08OtV/WyXELTPj2kYlHV3+yAg1bcT4GuERWRuwEXBP31+LNVEWTvZEVa4omLLZplGYvw== 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=XfFotosyWJZuO/LY5sFsY8mA2VbQm/2OqOT818ZJ8GI=; b=gNynhMO4ZY1krYVsqUSs76ka/FOCScyWBZuwIjIh24zNVpNKXZ8OT+U6nnlPZPvNOj+beAuC+1DmsFyku3SGhKMyTzf5HmWgREXHO46hL/Bc5iTvPP4QVKfBlVXK1goLHJUuaEPjfezCNij9abJwM+8vUXO6LJSkBk+1ua5bklPTZWLjjJl/Waf4AcCBZ9QmNHtIJw5R7DGqviPSdIvb65ONf8o9bIDVDL3oUaA32JxZ3+HQZl6LqyI/3060oUCG5BsUCS9zzcSeXVP1E/FVEEow8rdBA4IVrCtHfR73Ojwrd8iwXNhhmSfMRc7NDtnBMsYL6DJFiZGm76VWxTR+lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=temperror 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=XfFotosyWJZuO/LY5sFsY8mA2VbQm/2OqOT818ZJ8GI=; b=LYA6VYrtp1xV36XtSQIA5uHM8OwHZQ0g5pJ6eO0w9G9dwUC/k86Bhgf20chlymrrT8LGlzBZU5QqzOu9vnk+p4vfh8RfY7Z7+GhGXgUdGwFuJ0aEbo1ScnbdTbQI6/tOPqwgmqvCkXViE8DiwM+WZttgQN5bD+3aIdMeecS1tlv5/NdjsCuBTQSAS7WHDvZC2yTq7irDrN7Cokkygfysl7iCnDgDn/EIa5mX8K6zWsvEM4zjVo1fwwiqtk3eII055TVWRZsvCqogG9bd5kryhcImOKQWXXN5crIEsimDklDEIFyrjPfm82nLecKJz+UxbyeafxgFXdrIVaElbD8ZIw== Received: from BN9PR03CA0761.namprd03.prod.outlook.com (2603:10b6:408:13a::16) by MN2PR12MB3165.namprd12.prod.outlook.com (2603:10b6:208:ac::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 09:35:47 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13a:cafe::24) by BN9PR03CA0761.outlook.office365.com (2603:10b6:408:13a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 09:35:47 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=temperror action=none header.from=nvidia.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of nvidia.com: DNS Timeout) Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) 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:46 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 14 Feb 2022 09:35:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) 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:43 -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:41 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Subject: [PATCH v2 10/20] common/mlx5: share VF checking function Date: Mon, 14 Feb 2022 11:35:01 +0200 Message-ID: <20220214093511.1592698-11-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: 8a63391f-932d-4165-0a43-08d9ef9d60f6 X-MS-TrafficTypeDiagnostic: MN2PR12MB3165:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p5/N3mxODAIks9VIAUFtjWBS3CU34YIititeNNXUuPnBfWYoHc3FPw4H192RzB48rJBPBYkFn71FtsG1Hb8MLicaP3f7yl2Hdcvd+Lo1aL85C4P6wfrQK2PTSETejpJ4mXnSfRLvoQGVUChS23pulouwMraNLvO2Fvs9i1qlXB1NAJBm+l3mcyr6uahmW7Zvw2DxXi2HNUPepYWhkGvzr0O3wuLtuibX3VTEU++1Z7VS5OxQPH622/+mpgt+hFxApRFRC9UBfjaAYb6L61CMYu/PhKJTKB7ihbkKastcr4VUS8/v63n76an/2HA6VavGoE3JYRM8QZ54mLHbfmyz1VOTTza8ZgYHJDJT9JqVmRTPc3bGvmUMuz08kzV/jjKryeXQI8W3yAsmRjmmHFM9uE7sPyaKpZ7gcAmMX/StJZy95uQcAZx1F8adrWI+8/nJ/F2vZ/Pj0NjUz4BIwnXi9y/wnSIEumfQDyo5vb9TW7VwkuZoJiE659ddLwTX9Nntk5flyTP6Ee65huhtd+wXWerD02gBnzN1R2PoXg4eJZ5jF97KwBi+zyCcRy1p3WeBAbvG1S/W42h0nC2F6e9/d6MEp/Xn4P6AfJXGqFxPcxd4FjvX4CtBiNCXAm2PhNqhaILcjjQ/t/UrryuFniRUxojRBGfPHfj0K4AeovRjhj8SyR2Uq/cF70fWjOmOnfuRuiFy//3KNXpoMWQQYizPVw== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(6666004)(356005)(83380400001)(7696005)(70206006)(70586007)(4326008)(8676002)(63370400001)(81166007)(63350400001)(8936002)(54906003)(5660300002)(508600001)(316002)(86362001)(6916009)(40460700003)(107886003)(6286002)(26005)(2906002)(1076003)(186003)(426003)(82310400004)(336012)(36756003)(47076005)(55016003)(36860700001)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 09:35:46.3402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a63391f-932d-4165-0a43-08d9ef9d60f6 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3165 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 check if device is VF work for Linux as same as Windows. This patch removes it to the function implemented in the folder shared between the operating systems, removing the duplication. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.h | 15 +++++++++++++++ drivers/common/mlx5/mlx5_common_pci.c | 18 ++++++++++++++++++ drivers/common/mlx5/version.map | 1 + drivers/net/mlx5/linux/mlx5_os.c | 18 +----------------- drivers/net/mlx5/windows/mlx5_os.c | 16 +--------------- 5 files changed, 36 insertions(+), 32 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index e8809844af..80f59c81fb 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -487,6 +488,20 @@ __rte_internal bool mlx5_dev_is_pci(const struct rte_device *dev); +/** + * Test PCI device is a VF device. + * + * @param pci_dev + * Pointer to PCI device. + * + * @return + * - True on PCI device is a VF device. + * - False otherwise. + */ +__rte_internal +bool +mlx5_dev_is_vf_pci(struct rte_pci_device *pci_dev); + __rte_internal int mlx5_dev_mempool_subscribe(struct mlx5_common_device *cdev); diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c index 458630351c..66626953f1 100644 --- a/drivers/common/mlx5/mlx5_common_pci.c +++ b/drivers/common/mlx5/mlx5_common_pci.c @@ -107,6 +107,24 @@ mlx5_dev_is_pci(const struct rte_device *dev) return strcmp(dev->bus->name, "pci") == 0; } +bool +mlx5_dev_is_vf_pci(struct rte_pci_device *pci_dev) +{ + switch (pci_dev->id.device_id) { + case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX6VF: + case PCI_DEVICE_ID_MELLANOX_CONNECTXVF: + return true; + default: + break; + } + return false; +} + bool mlx5_dev_pci_match(const struct mlx5_class_driver *drv, const struct rte_device *dev) diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map index 462b7cea5e..59ab434631 100644 --- a/drivers/common/mlx5/version.map +++ b/drivers/common/mlx5/version.map @@ -13,6 +13,7 @@ INTERNAL { mlx5_common_verbs_dereg_mr; # WINDOWS_NO_EXPORT mlx5_dev_is_pci; + mlx5_dev_is_vf_pci; mlx5_dev_mempool_unregister; mlx5_dev_mempool_subscribe; diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 2616668149..d1bf89922e 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2100,7 +2100,6 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(cdev->dev); struct mlx5_dev_spawn_data *list = NULL; struct mlx5_dev_config dev_config; - unsigned int dev_config_vf; struct rte_eth_devargs eth_da = *req_eth_da; struct rte_pci_addr owner_pci = pci_dev->addr; /* Owner PF. */ struct mlx5_bond_info bond_info; @@ -2421,21 +2420,6 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, * (i.e. master first, then representors from lowest to highest ID). */ qsort(list, ns, sizeof(*list), mlx5_dev_spawn_data_cmp); - /* Device specific configuration. */ - switch (pci_dev->id.device_id) { - case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX6VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTXVF: - dev_config_vf = 1; - break; - default: - dev_config_vf = 0; - break; - } if (eth_da.type != RTE_ETH_REPRESENTOR_NONE) { /* Set devargs default values. */ if (eth_da.nb_mh_controllers == 0) { @@ -2459,7 +2443,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, /* Default configuration. */ mlx5_os_config_default(&dev_config, &cdev->config); - dev_config.vf = dev_config_vf; + dev_config.vf = mlx5_dev_is_vf_pci(pci_dev); list[i].eth_dev = mlx5_dev_spawn(cdev->dev, &list[i], &dev_config, ð_da); if (!list[i].eth_dev) { diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 9d25dcfa40..cca99f3eea 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -926,6 +926,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev) }, .dv_flow_en = 1, .log_hp_size = MLX5_ARG_UNSET, + .vf = mlx5_dev_is_vf_pci(pci_dev), }; int ret; uint32_t restore; @@ -940,21 +941,6 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev) strerror(rte_errno)); return -rte_errno; } - /* Device specific configuration. */ - switch (pci_dev->id.device_id) { - case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX6VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTXVF: - dev_config.vf = 1; - break; - default: - dev_config.vf = 0; - break; - } spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, &dev_config); if (!spawn.eth_dev) return -rte_errno; -- 2.25.1