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 C0E9CA0C51; Wed, 21 Jul 2021 16:39:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C756C410E0; Wed, 21 Jul 2021 16:39:30 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2088.outbound.protection.outlook.com [40.107.102.88]) by mails.dpdk.org (Postfix) with ESMTP id 4009A410DA for ; Wed, 21 Jul 2021 16:39:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KsuACilu7SBvjev/OuXRFlIAbOHYHVr1BEJElBMpf6lSye3A1MN0UiKxk0fNhxDHJ/Tc2Gl0mp+3gD/+kmZs+AtFlN9D0IW97Kjpsi8YmKgRcrO3Du/g5tZYw/Os9g9SvnzWi91pJZ+3IoUya/a9dldjeZiHF/fGg8+U+lt98EdjZDIQxK9h+rO76XnTSFyZ+rCdFxqXnKZCw1D/tdB6rUAlCwPN/MK69zX8/wafT0CdlDyvmiRQmWGQ5IaMVS4BHvzUm+1D7Yl8WkwkCVYs7DaHp9ycY+geVRLdmUebVFtFdWRjD/ikwurFbGNBg7Ns5HXXgIKwMasmT0jNEj8inA== 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=rl2uYNU3PJwFDLMEVwCQ501cJ41fMuc9/av32MXb7/Y=; b=HDWzLcslHsr9+uv9PZ+uwV6IjkZgPdIPJuHl4bRJMqPoFzhQULSSTckcz07SgZuwWTSCCd/McQXYMOZu+jF7os1EvslQw8ASgR+QEvX1fpCURvGjwfRTopWUBnhaGARJ2We1X+dXluAoj4ZBk/5/WNbbou3wUwlch1zryIyES4xTwkyp7XD1eJf6XrDqzVPtlktCCGWkwZ0SHblQv7RQfzg5kVGCSqubwrli4oCJDH546vxOzRVLHwT9m2OTg8broUb9J9uruXgNGdef1QArBiMa3L8xTkCSci1cOtPo/yKM2HbL7lfT4X5FcXeal7CpN/TvcFSlFgqpnkS57918wA== 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=quarantine 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=rl2uYNU3PJwFDLMEVwCQ501cJ41fMuc9/av32MXb7/Y=; b=SR+Ba6mbisonfa38+oPgqnsR7R8Ju/xhdtWIiYc3j4ULfBiVEyqLi6puFweUGxXYbh4pw26LlDVKeyDc+FImyPSURgXf7bgeA7xtphcHHtQh4h0OR0QsyUyrTSxcd0Ye6jYZKjzt2m2kXXGYAET0AhH2JTyWqyrLLwp4RyrlUDEK7W5bywTCeMAv+XovQDu8QrgCxvFGPTr8QIKQOTou1nfeLz4k/QSRIJSuRTdhmUYIK258Uo+KYOkoibZtoMYJkftS2e6bO82bpdeFs6ve5rj/rxQN7Ur9sOJjC5OKBYXdWTTUZyQKhmqtnAr8gGGuMooL8ejqE4ohygeTsT1IUw== Received: from BN0PR03CA0013.namprd03.prod.outlook.com (2603:10b6:408:e6::18) by DM8PR12MB5493.namprd12.prod.outlook.com (2603:10b6:8:3d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Wed, 21 Jul 2021 14:39:28 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::9f) by BN0PR03CA0013.outlook.office365.com (2603:10b6:408:e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Wed, 21 Jul 2021 14:39:28 +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 BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 14:39:27 +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, 21 Jul 2021 14:39:25 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Ori Kam Date: Wed, 21 Jul 2021 22:37:37 +0800 Message-ID: <20210721143743.24626-11-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721143743.24626-1-xuemingl@nvidia.com> References: <20210616040935.311733-1-xuemingl@nvidia.com> <20210721143743.24626-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3282342d-1d2e-42f3-80b3-08d94c5557ea X-MS-TrafficTypeDiagnostic: DM8PR12MB5493: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rcJ3GANTB17yI4OMVePEoGv/jnBKytEZyUr2wRZiy0vqcilXh6Xd3r8PHnX593jiSnbvbUfM9Rxw/WhSPCqSwMhHel6iOpDPX/j6o4pTNeN5NxyteiR+zK9nMV5qckVE1IArmA3zLNtEj8jpjED8E1cd2rkCIexjsush15UOfTLYr8WoSMRShTo2Do8dEB1V1/oWqTzTPMX7ASdSBIEU/5cbu3Jm8vY+rxzy5X8E7we9S7RI83nciFzqOjmBgib97KbImJQr5CjQ2iDBkFp5ZcYByJmZ2UhEPHkyjrHbz0B7NPIb/7nyMItbWoDNF4qLeMrFYgNhHq925nd/jV/jPX79v4Qbg942HuRsAybppgUWRh6mPtOBC7/75XlZ4NrD0zsK/JgSJIILF3TZt98MOH2TZhAsPImraVDzDsqinYopv3Vmpjht7xN7mwWQfwOAC17w53RMIqBUF2Iyto5a1BkBc0zmF2Qtq0Z8Mai3IvfEcc7cyT69dVN7+l2UnUNnSikCxfTK37fXNDIKEBrI1rgFyMAfeHW7hl451QSDCqaRhbid8m7P0PRGdmPeA+LCzVXUI0LPpayGK25lVsX2QSXpY9X/bewZ40mgNDrAJlvx8jAr84xtpVCrJtzyjlXS7qMKGJxGpO69vw+pMLsoA7c3agsIQy8y0S9zYjSnidnQZXqmERDWelE9xpL5In6pDMrl7kn3ANSkJrT69FtyyA== 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)(396003)(39860400002)(376002)(46966006)(36840700001)(1076003)(478600001)(6636002)(82310400003)(336012)(4326008)(7696005)(36756003)(2616005)(70206006)(8676002)(8936002)(316002)(36906005)(37006003)(26005)(86362001)(107886003)(82740400003)(36860700001)(6286002)(54906003)(83380400001)(47076005)(6862004)(55016002)(2906002)(70586007)(16526019)(7636003)(356005)(426003)(5660300002)(6666004)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 14:39:27.8904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3282342d-1d2e-42f3-80b3-08d94c5557ea 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: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5493 Subject: [dpdk-dev] [PATCH v4 10/16] 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 Acked-by: Viacheslav Ovsiienko --- 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