Message ID | 1423098809-21305-2-git-send-email-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 B4F81B3E3; Thu, 5 Feb 2015 02:13:37 +0100 (CET) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by dpdk.org (Postfix) with ESMTP id ACA1BB3D6 for <dev@dpdk.org>; Thu, 5 Feb 2015 02:13:35 +0100 (CET) Received: by mail-pa0-f43.google.com with SMTP id eu11so6427598pac.2 for <dev@dpdk.org>; Wed, 04 Feb 2015 17:13:35 -0800 (PST) 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=6laUR5CyHtnAajE9UXgJqFf2+Y9wCXebD0fsQMOTIGw=; b=XJtYeVMJn6JZhqe8gdS5cPCriOm8m2ygrVaJwYRSKNJ5cNgw6z3qRhgCBdZMTP42sb 6UG+eVMHnq1SYflzZeZQrWdnylbHXUBXBb9YYGpdhyCccaEmTNvVUmacpeES1suV6S05 klbFUqroU5DyU4bcfpWaSLI1WztjonxtWOLYsIZmebrH22RnJaFDTTJZZYu4IKvmskFz U6AhYctPo/F8Of6kchxBwbw/gFRBjv1bXt5Adjjd5cC8sJFvb5pU3xwD0nEdMz7/SFOR fil/jfuE3hZP5PU2fk12+zwZxD9gtHOb7RuDV/gpnoTuzW2IHH/g/wO586GLT/7PkVlU hCEw== X-Gm-Message-State: ALoCoQnCvya6Hu9/at83F2ZaW2soEc1pFszP0r0C/hN1itE+HxRZ2WooXqqHjkEimRFzP3pYsFuU X-Received: by 10.68.190.101 with SMTP id gp5mr1787582pbc.30.1423098815020; Wed, 04 Feb 2015 17:13:35 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id cz1sm3236673pdb.32.2015.02.04.17.13.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 17:13:34 -0800 (PST) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Date: Wed, 4 Feb 2015 17:13:23 -0800 Message-Id: <1423098809-21305-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1423098809-21305-1-git-send-email-stephen@networkplumber.org> References: <1423098809-21305-1-git-send-email-stephen@networkplumber.org> Cc: KY Srinivasan <kys@microsoft.com>, Stephen Hemminger <shemming@brocade.com> Subject: [dpdk-dev] [PATCH 1/7] ether: add function to query for link state interrupt X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Stephen Hemminger
Feb. 5, 2015, 1:13 a.m. UTC
From: Stephen Hemminger <shemming@brocade.com> Allow application to query whether link state will work. This is also part of abstracting dependency on PCI. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 26 insertions(+)
Comments
On Wed, Feb 04, 2015 at 05:13:23PM -0800, Stephen Hemminger wrote: > From: Stephen Hemminger <shemming@brocade.com> > > Allow application to query whether link state will work. > This is also part of abstracting dependency on PCI. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ > lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index ea3a1fb..4d803d0 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) > } > } > > +int > +rte_eth_has_link_state(uint8_t port_id) > +{ > + struct rte_eth_dev *dev; > + > + if (port_id >= nb_ports) { > + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > + return 0; > + } > + dev = &rte_eth_devices[port_id]; > + > + return (dev->pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) != 0; > +} > + > void > rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) > { > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 1200c1c..9d43ca3 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, > struct rte_eth_link *link); > > /** > + * Test whether device supports link state interrupt mode. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * - (1) if link state interrupt is supported > + * - (0) if link state interrupt is not supported > + */ > +extern int > +rte_eth_has_link_state(uint8_t port_id); > + > +/** > * Retrieve the general I/O statistics of an Ethernet device. > * > * @param port_id > -- > 2.1.4 > > I think if your intention is to expose this as an application (or other library visible api), you'll need to add it to the appropriate version map file for the link now. Should just be a single line addition Regards Neil
On Thu, 5 Feb 2015 01:47:37 +0000 Neil Horman <nhorman@tuxdriver.com> wrote: > On Wed, Feb 04, 2015 at 05:13:23PM -0800, Stephen Hemminger wrote: > > From: Stephen Hemminger <shemming@brocade.com> > > > > Allow application to query whether link state will work. > > This is also part of abstracting dependency on PCI. > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > > --- > > lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ > > lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ > > 2 files changed, 26 insertions(+) > > > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > > index ea3a1fb..4d803d0 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) > > } > > } > > > > +int > > +rte_eth_has_link_state(uint8_t port_id) > > +{ > > + struct rte_eth_dev *dev; > > + > > + if (port_id >= nb_ports) { > > + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > > + return 0; > > + } > > + dev = &rte_eth_devices[port_id]; > > + > > + return (dev->pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) != 0; > > +} > > + > > void > > rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) > > { > > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > > index 1200c1c..9d43ca3 100644 > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, > > struct rte_eth_link *link); > > > > /** > > + * Test whether device supports link state interrupt mode. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @return > > + * - (1) if link state interrupt is supported > > + * - (0) if link state interrupt is not supported > > + */ > > +extern int > > +rte_eth_has_link_state(uint8_t port_id); > > + > > +/** > > * Retrieve the general I/O statistics of an Ethernet device. > > * > > * @param port_id > > -- > > 2.1.4 > > > > > I think if your intention is to expose this as an application (or other library > visible api), you'll need to add it to the appropriate version map file for the > link now. Should just be a single line addition > > Regards > Neil > Will add that after other changes are approved. Also looking at the map files they seem to have been auto generated because some symbols are exposed which are unnecessary (example pci_driver_list)
On Wed, Feb 04, 2015 at 09:49:07PM -0800, Stephen Hemminger wrote: > On Thu, 5 Feb 2015 01:47:37 +0000 > Neil Horman <nhorman@tuxdriver.com> wrote: > > > On Wed, Feb 04, 2015 at 05:13:23PM -0800, Stephen Hemminger wrote: > > > From: Stephen Hemminger <shemming@brocade.com> > > > > > > Allow application to query whether link state will work. > > > This is also part of abstracting dependency on PCI. > > > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > > > --- > > > lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ > > > lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ > > > 2 files changed, 26 insertions(+) > > > > > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > > > index ea3a1fb..4d803d0 100644 > > > --- a/lib/librte_ether/rte_ethdev.c > > > +++ b/lib/librte_ether/rte_ethdev.c > > > @@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) > > > } > > > } > > > > > > +int > > > +rte_eth_has_link_state(uint8_t port_id) > > > +{ > > > + struct rte_eth_dev *dev; > > > + > > > + if (port_id >= nb_ports) { > > > + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > > > + return 0; > > > + } > > > + dev = &rte_eth_devices[port_id]; > > > + > > > + return (dev->pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) != 0; > > > +} > > > + > > > void > > > rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) > > > { > > > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > > > index 1200c1c..9d43ca3 100644 > > > --- a/lib/librte_ether/rte_ethdev.h > > > +++ b/lib/librte_ether/rte_ethdev.h > > > @@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, > > > struct rte_eth_link *link); > > > > > > /** > > > + * Test whether device supports link state interrupt mode. > > > + * > > > + * @param port_id > > > + * The port identifier of the Ethernet device. > > > + * @return > > > + * - (1) if link state interrupt is supported > > > + * - (0) if link state interrupt is not supported > > > + */ > > > +extern int > > > +rte_eth_has_link_state(uint8_t port_id); > > > + > > > +/** > > > * Retrieve the general I/O statistics of an Ethernet device. > > > * > > > * @param port_id > > > -- > > > 2.1.4 > > > > > > > > I think if your intention is to expose this as an application (or other library > > visible api), you'll need to add it to the appropriate version map file for the > > link now. Should just be a single line addition > > > > Regards > > Neil > > > > Will add that after other changes are approved. > Also looking at the map files they seem to have been auto generated > because some symbols are exposed which are unnecessary (example pci_driver_list) It wasn't quite auto generated. It was generated based on what the requisite header files for a library exposed to the various applications that used them. In your example above pci_driver_list is a global public variable, that is referenced by applications that the DPDK ships (in this case the test_pci application). I completely agree that it shouldn't need to be versioned, as it shouldn't be exposed at all, relying instead on accessor functions to reach it, but as such, it is what it is. By versioning it, we at least allow ourselves the option to maintain backwards compatibility if the list type changes or we wish to start hiding the symbol in future versions. Neil >
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ea3a1fb..4d803d0 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) } } +int +rte_eth_has_link_state(uint8_t port_id) +{ + struct rte_eth_dev *dev; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return 0; + } + dev = &rte_eth_devices[port_id]; + + return (dev->pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) != 0; +} + void rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 1200c1c..9d43ca3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link); /** + * Test whether device supports link state interrupt mode. + * + * @param port_id + * The port identifier of the Ethernet device. + * @return + * - (1) if link state interrupt is supported + * - (0) if link state interrupt is not supported + */ +extern int +rte_eth_has_link_state(uint8_t port_id); + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id