From patchwork Wed Apr 20 11:44:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 12129 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 83490568B; Wed, 20 Apr 2016 13:44:36 +0200 (CEST) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 4465D558A for ; Wed, 20 Apr 2016 13:44:30 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id u206so76780193wme.1 for ; Wed, 20 Apr 2016 04:44:30 -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=s3qNSkN7PmVP/RJit2Ps0DN1jsQqAssY1asRMEMW6y0=; b=D3P317gkMrWGeEm+1pX3rcvS6h3hGCQdKk1ePS+lXWxlWSJFBTZpbQ9kG0E0/7Pi/q ZmtUzxGhP5gU9G+9sPuYagGtGCb+lWigmTSTioUdhM3jMFW8LTMNEjg2EPBdt79k2c48 EB8rVKqBrpoc5/HjGKlxyfvB2CzGGLNsbotll33PWA8nfDLs9tIoMEqrnBUNBq3jG2i7 +nuBcLeClEwNHXvgwaeCG4yEQyC+7pwqXrgDgJGI+4zpjXgf+Ww4pySU+HIIUdrzeGfO TEPMXw5sZ4YoRJUvIoeUCd7iVlSEtFbQGbHS9t62BySEQ+5fDw1llLVdHPWJcp/1MRpR 2Tpg== 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=s3qNSkN7PmVP/RJit2Ps0DN1jsQqAssY1asRMEMW6y0=; b=jRraQaDjyZyqfpRTXlV8OknidVbJreEhJR+xpvsfsX131c26ZsDCRDpsUD3W+olcgl 6P1IVwAhbAViqaP2gF0Zic9rrnDZwIlAj7U7ORRZUT8EEsZGam5vF1IMuGiKIRP3PyDQ phpkJJz3+tAluKONmUWG7JPrbNIry/5b5oCyzyfFr5iDVbJwQ9dRhnv0JPAl/S5OBxxQ ONEvXjZhHiDiOKE16UL2fg9qbRc4toRze9/V/OdgHIAAIj30KVAt0OO4UitT78+/gpuQ 5CSTMMvA68xz6YxqSSp7zgVXOhFD4wiT84omLWFQXykwiAQjY3jBsElhqXA0eLM7uglt e5ng== X-Gm-Message-State: AOPr4FVLTj5TIPeenn6pm/d46SFqWLRyNCWcClO2PZf0NkSpvQFDWHEtcJvOUD6h2bnI0NyR X-Received: by 10.194.192.106 with SMTP id hf10mr8119214wjc.134.1461152670036; Wed, 20 Apr 2016 04:44:30 -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.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 04:44:29 -0700 (PDT) From: David Marchand To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, viktorin@rehivetech.com Date: Wed, 20 Apr 2016 13:44:07 +0200 Message-Id: <1461152657-19969-8-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 07/17] ethdev: 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 eth_drv, 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_ether/rte_ethdev.c | 14 +++++++------- lib/librte_ether/rte_ethdev.h | 13 +++++++++++++ lib/librte_ether/rte_ether_version.map | 8 ++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index a31018e..7b908a7 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) return 0; } -static int -rte_eth_dev_init(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +int +rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev) { struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; @@ -293,8 +293,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, return diag; } -static int -rte_eth_dev_uninit(struct rte_pci_device *pci_dev) +int +rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) { const struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; @@ -351,8 +351,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev) void rte_eth_driver_register(struct eth_driver *eth_drv) { - eth_drv->pci_drv.devinit = rte_eth_dev_init; - eth_drv->pci_drv.devuninit = rte_eth_dev_uninit; + eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe; + eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove; rte_eal_pci_register(ð_drv->pci_drv); } diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 022733e..7a7a69e 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -4279,6 +4279,19 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id, uint32_t mask, uint8_t en); +/** + * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev + * interface. + */ +int rte_eth_dev_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 ethdev + * interface. + */ +int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index 214ecc7..31017d4 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -132,3 +132,11 @@ DPDK_16.04 { rte_eth_tx_buffer_set_err_callback; } DPDK_2.2; + +DPDK_16.07 { + global: + + rte_eth_dev_pci_probe; + rte_eth_dev_pci_remove; + +} DPDK_16.04;