dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: alexmay-0li6OtcxBFHby3iVrkZq2A@public.gmane.org
Cc: dev-VfR2kkLFssw@public.gmane.org,
	Stephen Hemminger
	<shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 1/7] ether: add function to query for link state interrupt
Date: Mon, 20 Apr 2015 14:54:08 -0700	[thread overview]
Message-ID: <1429566854-17490-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1429566854-17490-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>

From: Stephen Hemminger <shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>

Allow application to query whether link state will work.
This is also part of abstracting dependency on PCI.

Signed-off-by: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.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 e20cca5..9577d17 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -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)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 4648290..991023b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -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
-- 
2.1.4

  parent reply	other threads:[~2015-04-20 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 21:54 [PATCH 0/7] Hyper-V Poll Mode Driver Stephen Hemminger
     [not found] ` <1429566854-17490-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-20 21:54   ` Stephen Hemminger [this message]
2015-04-20 21:54   ` [PATCH 2/7] pmd: change drivers initialization for pci Stephen Hemminger
2015-04-20 21:54   ` [PATCH 3/7] hv: add basic vmbus support Stephen Hemminger
     [not found]     ` <1429566854-17490-4-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-21 12:23       ` Neil Horman
2015-04-20 21:54   ` [PATCH 4/7] hv: uio driver Stephen Hemminger
2015-04-20 21:54   ` [PATCH 5/7] hv: poll mode driver Stephen Hemminger
2015-04-20 21:54   ` [PATCH 6/7] hv: enable driver in common config Stephen Hemminger
2015-04-20 21:54   ` [PATCH 7/7] hv: add kernel patch Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2015-02-05  1:13 [PATCH 0/7] Hyper-v driver and infrastructure Stephen Hemminger
     [not found] ` <1423098809-21305-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-02-05  1:13   ` [PATCH 1/7] ether: add function to query for link state interrupt Stephen Hemminger
     [not found]     ` <1423098809-21305-2-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-02-05  1:47       ` Neil Horman
     [not found]     ` <2d9df6f5729c42a9a2b85a20b7316243@BRMWP-EXMB11.corp.brocade.com>
     [not found]       ` <2d9df6f5729c42a9a2b85a20b7316243-sI283RzA5cMA50eAn2D9H4CDckiq/fhJZeezCHUQhQ4@public.gmane.org>
2015-02-05  5:49         ` Stephen Hemminger
2015-02-05 12:39           ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429566854-17490-2-git-send-email-stephen@networkplumber.org \
    --to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
    --cc=alexmay-0li6OtcxBFHby3iVrkZq2A@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).