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 9D076A0C51; Tue, 13 Jul 2021 15:17:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2953F412A1; Tue, 13 Jul 2021 15:16:49 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) by mails.dpdk.org (Postfix) with ESMTP id EDC5E41296 for ; Tue, 13 Jul 2021 15:16:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dcqjdXB6wC6mj0mWOVasLVIB9XTdmCZsgLjFWiF+siJqGW7jmdY6wMihxNDty+sQwzC4cSkqWrykfEmbnkecvSgoqGm2bWRf9ooQUZA578VoVetveh8QtKxYCP+cMWkvFQqw3m/fIi1ctsKQqgiinVTk4uoP8FIRp09e9J0TXDV9yIba2xD2/KRiLRIY0VwSSnopHyJJxikZ0Amg/F6eJx1RM333PPx+G+FHHD675H9pQpSR7P8/LDhmqQ18Mt5oox765GaQJCkOE+qNr7tA031Hpiy13Nx/WvJr0nsWo/XHpi1yJ0VBAfQ/Yov8MS7X6Ck6IcZ4xzEp5QcvYp7g6A== 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=srrU3wVlzdJ2zt+Jgy1MbW7rVmmCEl+uIlCWxdbXPnY=; b=G5xFiHRbWwmH7EUrZM+V74uCpKZZTuIJ4G9CpAkSTBs5m14SvokX5eMG4BRts7OGLbe/BdhL+OfI5kR+YR7+Y3VAdSbZ8XPnW8xLNGXxReWK48oVcVarjptNtcWiE5K4fQ8UQ5mpJwERZs7qpbQs518MOGUdxCS3N9Y0HDTAMEvtEVlckEkYn+z2Em3Ynby8Xbn0G6+qlv1qd0V3vw2DZcDh2UkKbbkc06xDFZzxTnqhDFUhinfWixxFnZ6qcZYslDmbBgwlBCL0AxaeqCdoKFe/5s6eTaVom/Zor1f+TqhvBi4stqDYisfqMQixZKxv70dHO7F2y8KyTEpNgubi6w== 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=srrU3wVlzdJ2zt+Jgy1MbW7rVmmCEl+uIlCWxdbXPnY=; b=ehy3lf2qro4MaqKZEvndasBXzKFqGanDIY6/SoiwsOvXIvSWZcjlwwKfsmeNd8klLELM0RymgdADfPmghFAiv/vfm3S5vlQvKoIXna0fpCQOmsF1pNM+0pa/oG9IwHFCGmvJenGKgf1TsNIDgpp1BsHzae393Phvc8k+YtuSdZrzUMZkPBzVG3XoWtHa5czsEoXchS62o/cxohmKFdxvPIiaXAbO3n6/J38wcyoy4Tkq2o4YbM2IxyJWFtXRndI1x/ZDpZ303S4+0yq6wARKqjVIx4bKxZYrFcCQbiFR6y1TfGhwLWdLSn6VJ6k68CNF8RcNptV8hDRAjRupfHnKig== Received: from MW4PR03CA0043.namprd03.prod.outlook.com (2603:10b6:303:8e::18) by CH2PR12MB3687.namprd12.prod.outlook.com (2603:10b6:610:2b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Tue, 13 Jul 2021 13:16:45 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::ac) by MW4PR03CA0043.outlook.office365.com (2603:10b6:303:8e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 13 Jul 2021 13:16:44 +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 CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4308.20 via Frontend Transport; Tue, 13 Jul 2021 13:16:34 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:10 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Ori Kam Date: Tue, 13 Jul 2021 21:14:32 +0800 Message-ID: <20210713131437.30170-10-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616040935.311733-2-xuemingl@nvidia.com> References: <20210616040935.311733-2-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.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: 10211708-f080-457b-b8e8-08d94600765c X-MS-TrafficTypeDiagnostic: CH2PR12MB3687: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AqbsK5QKtXs0vGtlWElzb24gGJ+kpQeK7/eMff5LDUT+ene2T8vSbhFYt3qte2X4ve9d7JiC+taZbv1IRtPeZ1iwcplzWxmtt+hAnF2g4/JGKHscGDZ1op2lKU6G1lkZTlng6nqhyaMchaEUAO1a3XoM5lLHOWdaA2FgTCnoql/yrN4EVVGwaP4KMCZOr3AX8kEv9rajnrN82Lg7HWVs4JDY76Q/w4I/DJdCweAtjHaZwzQ1ZeQAonaRa5p220v/MBAhy1D34WnmxSW3YOYjR+qYEYO5My0OGlt1fvA/uP7rTqD/n6+9HUTQQuji44MLZZadyjKQv5W0J9T+ARFFg3lAWFiboU82pMOEevKBl0QQMXdfj06RBMLpYPLcUTYAjSeqNHv/6MeBjleqWS2jRCYu9KEetoRTdnT/Xe/GT6JjfK8CVOK/u5+5KsYAOWA57E9zKNNvWtEWIp74siUDvrtfrltgfTrlLQgii2nSKOJoKqGdO33isQZdNoBtar/8zy1rOfDDS8wUdS33K2BVh0RdSc2pw7Q8jX8eTzNDNy400tXCEq1uyVOrWWfx8nvLjp5wZjPR4/bvE90z1xXjUVW3MmVmMmhTYvfYPhcH1IADX8CNbPKAAMSYG698zNI49pdmX25tDFZncG6BzlbANShDQ6G78OMPtYnQioyhyYzJ4prIppj5+mBc+jMjq4qAQRgDeguPv72OTam5E8T+ZWb46PqXOM8CQZ4axwGF2e8= 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)(39860400002)(136003)(36840700001)(46966006)(2906002)(7696005)(55016002)(16526019)(1076003)(70586007)(26005)(5660300002)(47076005)(70206006)(6286002)(186003)(7636003)(36860700001)(336012)(54906003)(8676002)(37006003)(4326008)(83380400001)(6636002)(36906005)(316002)(356005)(107886003)(8936002)(6666004)(2616005)(86362001)(82310400003)(478600001)(82740400003)(36756003)(34020700004)(426003)(6862004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 13:16:34.2359 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10211708-f080-457b-b8e8-08d94600765c 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3687 Subject: [dpdk-dev] [PATCH v2 09/14] regex/mlx5: migrate to common driver 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" To support auxiliary bus, upgrades driver to use mlx5 common driver structure. Signed-off-by: Xueming Li --- drivers/regex/mlx5/mlx5_regex.c | 49 ++++++++++++--------------------- drivers/regex/mlx5/mlx5_regex.h | 1 - 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index dcb2ced88e..9d93eaa934 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -9,8 +9,8 @@ #include #include #include +#include -#include #include #include #include @@ -76,15 +76,13 @@ mlx5_regex_engines_status(struct ibv_context *ctx, int num_engines) } static void -mlx5_regex_get_name(char *name, struct rte_pci_device *pci_dev __rte_unused) +mlx5_regex_get_name(char *name, struct rte_device *dev) { - sprintf(name, "mlx5_regex_%02x:%02x.%02x", pci_dev->addr.bus, - pci_dev->addr.devid, pci_dev->addr.function); + sprintf(name, "mlx5_regex_%s", dev->name); } static int -mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, - struct rte_pci_device *pci_dev) +mlx5_regex_dev_probe(struct rte_device *rte_dev) { struct ibv_device *ibv; struct mlx5_regex_priv *priv = NULL; @@ -94,16 +92,10 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, int ret; uint32_t val; - ibv = mlx5_os_get_ibv_device(&pci_dev->addr); - if (!ibv) { - DRV_LOG(ERR, "No matching IB device for PCI slot " - PCI_PRI_FMT ".", pci_dev->addr.domain, - pci_dev->addr.bus, pci_dev->addr.devid, - pci_dev->addr.function); + ibv = mlx5_os_get_ibv_dev(rte_dev); + if (ibv == NULL) return -rte_errno; - } - DRV_LOG(INFO, "PCI information matches for device \"%s\".", - ibv->name); + DRV_LOG(INFO, "Probe device \"%s\".", ibv->name); ctx = mlx5_glue->dv_open_device(ibv); if (!ctx) { DRV_LOG(ERR, "Failed to open IB device \"%s\".", ibv->name); @@ -146,7 +138,7 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, priv->is_bf2 = 1; /* Default RXP programming mode to Shared. */ priv->prog_mode = MLX5_RXP_SHARED_PROG_MODE; - mlx5_regex_get_name(name, pci_dev); + mlx5_regex_get_name(name, rte_dev); priv->regexdev = rte_regexdev_register(name); if (priv->regexdev == NULL) { DRV_LOG(ERR, "Failed to register RegEx device."); @@ -180,7 +172,7 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, priv->regexdev->enqueue = mlx5_regexdev_enqueue_gga; #endif priv->regexdev->dequeue = mlx5_regexdev_dequeue; - priv->regexdev->device = (struct rte_device *)pci_dev; + priv->regexdev->device = rte_dev; priv->regexdev->data->dev_private = priv; priv->regexdev->state = RTE_REGEXDEV_READY; priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; @@ -213,13 +205,13 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } static int -mlx5_regex_pci_remove(struct rte_pci_device *pci_dev) +mlx5_regex_dev_remove(struct rte_device *rte_dev) { char name[RTE_REGEXDEV_NAME_MAX_LEN]; struct rte_regexdev *dev; struct mlx5_regex_priv *priv = NULL; - mlx5_regex_get_name(name, pci_dev); + mlx5_regex_get_name(name, rte_dev); dev = rte_regexdev_get_device_by_name(name); if (!dev) return 0; @@ -254,24 +246,19 @@ static const struct rte_pci_id mlx5_regex_pci_id_map[] = { } }; -static struct mlx5_pci_driver mlx5_regex_driver = { - .driver_class = MLX5_CLASS_REGEX, - .pci_driver = { - .driver = { - .name = RTE_STR(MLX5_REGEX_DRIVER_NAME), - }, - .id_table = mlx5_regex_pci_id_map, - .probe = mlx5_regex_pci_probe, - .remove = mlx5_regex_pci_remove, - .drv_flags = 0, - }, +static struct mlx5_class_driver mlx5_regex_driver = { + .drv_class = MLX5_CLASS_REGEX, + .name = RTE_STR(MLX5_REGEX_DRIVER_NAME), + .id_table = mlx5_regex_pci_id_map, + .probe = mlx5_regex_dev_probe, + .remove = mlx5_regex_dev_remove, }; RTE_INIT(rte_mlx5_regex_init) { mlx5_common_init(); if (mlx5_glue) - mlx5_pci_driver_register(&mlx5_regex_driver); + mlx5_class_driver_register(&mlx5_regex_driver); } RTE_LOG_REGISTER_DEFAULT(mlx5_regex_logtype, NOTICE) diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h index 51a2101e53..45200bf937 100644 --- a/drivers/regex/mlx5/mlx5_regex.h +++ b/drivers/regex/mlx5/mlx5_regex.h @@ -59,7 +59,6 @@ struct mlx5_regex_db { struct mlx5_regex_priv { TAILQ_ENTRY(mlx5_regex_priv) next; struct ibv_context *ctx; /* Device context. */ - struct rte_pci_device *pci_dev; struct rte_regexdev *regexdev; /* Pointer to the RegEx dev. */ uint16_t nb_queues; /* Number of queues. */ struct mlx5_regex_qp *qps; /* Pointer to the qp array. */ -- 2.25.1