[dpdk-dev,v4,1/7] ether: add function to query for link state interrupt
Commit Message
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
2015-04-21 10:32, Stephen Hemminger:
> 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 ++++++++++++
[...]
> /**
> + * 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);
It requires change in map file to work with shared library.
On Wed, 8 Jul 2015 23:42:05 +0000
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2015-04-21 10:32, Stephen Hemminger:
> > 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 ++++++++++++
> [...]
> > /**
> > + * 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);
>
> It requires change in map file to work with shared library.
A better way to solve this to move drv_flags out of PCI driver and into generic driver
data structure.
@@ -1340,6 +1340,20 @@ rte_eth_dev_start(uint8_t port_id)
return 0;
}
+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_dev_stop(uint8_t port_id)
{
@@ -2064,6 +2064,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