From patchwork Wed Apr 20 11:44:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 12128 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id A06DB5681; Wed, 20 Apr 2016 13:44:35 +0200 (CEST) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 40D8747CD for ; Wed, 20 Apr 2016 13:44:29 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id u206so76779490wme.1 for ; Wed, 20 Apr 2016 04:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3zRHycFl3kgP79YpNF03hxaPx4xp6Awb0mKve6RtADE=; b=DzUjMseoD4JYmbluaqNCZCVG4G81vJpbT58WdEpnZJGAXbVtBUf8nohIKwKBiYJo4Q O3RJdHON7+R9I55m6L2dxXvsb8iku6CnCxYtEC9n6CC37sNm13Z28IAOHuotxZvl9vxS Cm4j1Ih/hg189avWEOcwDW0jFqkLS5wDyEou40zEd0a9znDccMSfLt/E9eZdaGCMmnxr daILxMN5OLtNX0mgIvl8emXv1xfZA0ScYf4arvbDt2nvuwzFlcCVsEuw87dZtujZky21 M9dGNpOcs4ahae9bkuC44TEgH6DnkBOQDD6yda0DkRrhZDWbppFYbwaFJE2E8ir0lPbA s+hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3zRHycFl3kgP79YpNF03hxaPx4xp6Awb0mKve6RtADE=; b=XFoj7HSC2APiad4Ge3XMCBSCiQC2nWBtRo9XgxbhqEZ1Gv3eNiYdH+1M6PHB23KAPD H8d9II3FSQMf3gveRW3oZWAZWk0pjIMa3ffORq5KYTKzNNrXNd2t7/hyTfgQf5s53SQV flOcVJPVRgS3iYFF5fk7PN6pF8LJbekenoFLFyXhKR8rSaXdZzneZcc7Hds9SGG2jmVC j68xg5ByxMBO3WHj03i9HAmEVNAAwmLnZ1hNnL/lWXg9OQ75jpPaSy3Yn2QOALW4kPnQ 9UL7H/NkmyicPNi/mVTPz/7kwxzO+16eUEAP/8JHS9Uj83HZlA5bV0kDtIFDS/mF1dUx 2I2A== X-Gm-Message-State: AOPr4FXF3R5Tq/6ga6smX9okvUOLWQ2lJJ1QLDebeS5V/kWfT7nO5b5bAX+/SqXIa8iaSIkw X-Received: by 10.194.23.226 with SMTP id p2mr8204172wjf.131.1461152669089; Wed, 20 Apr 2016 04:44:29 -0700 (PDT) Received: from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net. [78.126.77.144]) by smtp.gmail.com with ESMTPSA id m6sm5195708wje.21.2016.04.20.04.44.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 04:44:28 -0700 (PDT) From: David Marchand To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, viktorin@rehivetech.com Date: Wed, 20 Apr 2016 13:44:06 +0200 Message-Id: <1461152657-19969-7-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461152657-19969-1-git-send-email-david.marchand@6wind.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1461152657-19969-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2 06/17] crypto: export init/uninit common wrappers for pci drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Preparing for getting rid of rte_cryptodev_driver, here are two wrappers that can be used by pci drivers that assume a 1 to 1 association between pci resource and upper interface. Signed-off-by: David Marchand --- lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++-------- lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 8 ++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index bf35df0..19a9939 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -340,9 +340,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size, return cryptodev; } -static int -rte_cryptodev_init(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +int +rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev) { struct rte_cryptodev_driver *cryptodrv; struct rte_cryptodev *cryptodev; @@ -401,8 +401,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv, return -ENXIO; } -static int -rte_cryptodev_uninit(struct rte_pci_device *pci_dev) +int +rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev) { const struct rte_cryptodev_driver *cryptodrv; struct rte_cryptodev *cryptodev; @@ -450,15 +450,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv, { /* Call crypto device initialization directly if device is virtual */ if (type == PMD_VDEV) - return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv, + return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv, NULL); /* * Register PCI driver for physical device intialisation during * PCI probing */ - cryptodrv->pci_drv.devinit = rte_cryptodev_init; - cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit; + cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe; + cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove; rte_eal_pci_register(&cryptodrv->pci_drv); diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index c977c61..3fb7c7c 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv, void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev, enum rte_cryptodev_event_type event); +/** + * Wrapper for use by pci drivers as a .devinit function to attach to a crypto + * interface. + */ +int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev); + +/** + * Wrapper for use by pci drivers as a .devuninit function to detach a crypto + * interface. + */ +int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev); #ifdef __cplusplus } diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 41004e1..8d0edfb 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -32,3 +32,11 @@ DPDK_16.04 { local: *; }; + +DPDK_16.07 { + global: + + rte_cryptodev_pci_probe; + rte_cryptodev_pci_remove; + +} DPDK_16.04;