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 14205A0C45; Wed, 16 Jun 2021 06:11:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0BAD410FB; Wed, 16 Jun 2021 06:10:14 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by mails.dpdk.org (Postfix) with ESMTP id 7C621410E6 for ; Wed, 16 Jun 2021 06:10:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G8cQdJYc+t+maJa9bpxB5hDj2Nzf+kXA+QWdY4fJVl3+2HuF//Wq7SF67pnnGyjsnjNS6UPA1VUkMhXr7oMVJxz0LsPspFWjLJfUGdhgo4kCaonz8NzzayGSp9S9eJM/wi2d2mR/kqvKBaxtSehBa9byGnt+d0kqG4EMbN4WX603IO/fcsX8EsNuSLhYlO1LlIVLwx+Jm6Wl1q9WSRBVueYfJ1BQBofzcRG99MAJjajJnAZGHCp3lVaVvcQv0Dl5+GpnS23LkYwl7/Wk6UsADhJANa/9Q2ffInMGvYTULd9BfN/w8mTfN6lV4a/q7cRJz7IFfFBSxwPJ6wdVvEVQvA== 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=PrZyZHTE5PszadpTZM8J2MakB2lsYam8OI2uEHPviB5c2L4Duc9GDZttSXK+zdsOpEel5j2Hg8zxKc7i3M44jhAykXp+/CGkIfJbuLwWU85mHmZTe+DhGplLXVDtpl31Qrq0dPRhpt+cgF2cZRu9nI+GTW2AV5jhThaC2a7wrXFl4rwcIukr2QaugIs/N/JrqoTFvWQ6xkVUhVOkLcxYIdxCw1GKkAZ5NZCQ28ne3Z2cUMU18hXyd/7Ygqu5kUceqXdqT6kYe+EYLFaDvPOLd+EwgSfilJpCsWXD+4eV7yYhAJTt1N6aPds27C4ubpemGbyof6wtvslfKVLjuKIPDQ== 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=YFtyDHHAI+lYoF74m0A4u5ZQw1XHTzVvbHjf+6i2NhpJuzbUl0nLFTkQPiKe7iFmkHmwyWExL/otwP5YQqnOfgccMRG0SG17wsX5WVJKbb9cWSwK2YIDC5RAVv/yslAE5C4nwLzie62adUyx8MlT60wtQvrvOZRWrBUYScY6c8L9rDRQ0CWiFze89TxOb8p22/XggvZTa9u4nC8hygA6iIjtpk2Cu9D7iFMXAPRcGkGiDOWyYzQNU6knTK8dwskFaG74tXzZlBHI0hMKKAj8L2hBNaHAqrYt5x8CuEFrq6lK0nrn8Wrp6AIOK+co7DbiCQDwReUBltKi3ZNEQQf3iA== Received: from BN0PR04CA0106.namprd04.prod.outlook.com (2603:10b6:408:ec::21) by BY5PR12MB3665.namprd12.prod.outlook.com (2603:10b6:a03:1a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Wed, 16 Jun 2021 04:10:11 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::b) by BN0PR04CA0106.outlook.office365.com (2603:10b6:408:ec::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Wed, 16 Jun 2021 04:10:11 +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 BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4242.16 via Frontend Transport; Wed, 16 Jun 2021 04:10:11 +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; Wed, 16 Jun 2021 04:10:06 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Ori Kam Date: Wed, 16 Jun 2021 07:09:30 +0300 Message-ID: <20210616040935.311733-10-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210527133759.17401-2-xuemingl@nvidia.com> References: <20210527133759.17401-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: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ae7f6b7-268d-4485-9598-08d9307ca2a6 X-MS-TrafficTypeDiagnostic: BY5PR12MB3665: 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: XtNmh9HtcgVBB7ZEE+OTxfUcjAugvYezX0bfl7kb6hwXzA2lkVLyxISaT5wNTzqcBQXF2WlpbGeGR40736D7B2al0XIG6czLHE/rZ0IXgVdCxkQGgDXWyEeTfBEx++VNcTzfHi2DFfJUSJA8L+f88Aq8rX6wcULeHP40wPhtQ4TyJ8T6aqakAgJHjSINwkqDhZmDGzrMz3WuSOrzN3Edi8GsfEBj5Fqdh1orCsMq1rMAV+v3XtOdAp/P4QNOUUV57WlGc9496FLsDqS7iSK9ptfm3C1EWrJbM3x5N8Mngz0G2ovS1gW6uiVi8d0d2pdVd72MzBf6wb4fJtVhyQ4eJs3zva3p2EmxK0akmlSlqibmTDfwsZ7wzC7577l0jRnkr3na2Vq+wAYX3VwkQtuf2waz3DocCUWOlxV3slg5mfzvwugRHfILXtdoLaLnJy6TfZNN664x9CNdUzIpSKeTRlHsme9izolkbjPkGDEYCnavLbPIib2Z5e1a6nDX4hBb7RslwKp01xc3vpC58+h5XVT0m70bJRXzxEJj1v49pY2b6/N9qfuc0S5Hot4D5WRzxI4PEK8wi5EyVSJAGyGEMajpyrySYJfS7re0+zxURvB8YM0whHzqSRLOTjE5pA4n9iuHR0rwAwe6nmhwzOSBCcu/v5NsBQI6nH3JCvyGfl4= 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)(136003)(346002)(39860400002)(376002)(396003)(46966006)(36840700001)(4326008)(36756003)(36860700001)(7696005)(2906002)(6636002)(8676002)(2616005)(36906005)(336012)(316002)(6862004)(82310400003)(54906003)(47076005)(82740400003)(7636003)(186003)(70586007)(83380400001)(70206006)(426003)(1076003)(8936002)(356005)(86362001)(37006003)(478600001)(107886003)(5660300002)(6286002)(6666004)(55016002)(26005)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2021 04:10:11.0681 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ae7f6b7-268d-4485-9598-08d9307ca2a6 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: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3665 Subject: [dpdk-dev] [PATCH v1 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