From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id B9E655A40 for ; Mon, 20 Apr 2015 23:54:12 +0200 (CEST) Received: by pdea3 with SMTP id a3so220319233pde.3 for ; Mon, 20 Apr 2015 14:54:11 -0700 (PDT) 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=ZSb3v1y2yOSJCXbws0c+WKPIax47tgVMRYebDbaM20E=; b=BPApGsPHE6hKYE9Zv3Saq9Gnq8pUmFjTZZifzm6EwzgS26EQRpbyZsIe73Keqp1rwx tf3ppPY6YSAyLK5JhMa9iF2TJc58lmUWxkPbIH2WGEeuPCUIdFnC1eLNTNYVXjp1hl7E BE9pm3prBJF1GA7g4dU28jebuVhl/Q2CKdXbSJqrp3NMQHkHgfOp0q6modyeC+cCcKMm 1pY/aVP0S46gIFvyFAoV/ZGtXgVGBb4NQlaxKJ1fPAg1nnUq1zb21RqizjatjwP+FZny qoXlULAZA8OtoC6Ayue0aFHeMMTGD5vl8hSNbuLzK5Q2d6NzxaNPjDQ2At7doJ3MuIJ7 13Xg== X-Gm-Message-State: ALoCoQligwKui8EYEHPG8A0fjIDGkKYi812STUBUoySTwMR4YfBwuE8eNj3vD8Eu/TUocUSgGoHi X-Received: by 10.67.15.34 with SMTP id fl2mr31564083pad.119.1429566851309; Mon, 20 Apr 2015 14:54:11 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id kr9sm278619pab.30.2015.04.20.14.54.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Apr 2015 14:54:10 -0700 (PDT) From: Stephen Hemminger To: alexmay@microsoft.com Date: Mon, 20 Apr 2015 14:54:08 -0700 Message-Id: <1429566854-17490-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429566854-17490-1-git-send-email-stephen@networkplumber.org> References: <1429566854-17490-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 21:54:13 -0000 From: 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 --- 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