From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id F1D239AAC for ; Wed, 25 Mar 2015 19:11:53 +0100 (CET) Received: by pacwe9 with SMTP id we9so36558013pac.1 for ; Wed, 25 Mar 2015 11:11:53 -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=IH3Xs6sa7sMbTtDtuIu+1zEq35Fl2vaH6/V9auBhu98=; b=htXZIkOE84V0cJ6X8d87BIzfWIYFrXxF4xQMY+9DzoFqFDD4nCDUVlGEBX1iuzVA+r arqoD9uao7AxFBG5ta9oPWBq/CSvsZNUBwJ1rjCgBMHgxlO8bvjYF818UELMf8ssPeIB hqQSLaimGW1QMGVJdWmxqN1jQ/ga//5er9IcHq0GOFY05vN7u4DAO6jEnuDz1gb/ajkA onLx0IuLQNgD0o8lbxMHIvhRk0l353RV2YDGC4bFf8R1+y+0PgA/JRNuxop8Z4msYDew GW/K4pnixXedeLmDQ7FWhVSj/BzOpD5pCzuS6IBavGcjHB3T7vQ0EP7j83F/ysPC+d+Y qkyg== X-Gm-Message-State: ALoCoQlRNGQMP2tU/j0fCKk3DK0FnHzI9izu0qCJxvZMCXWZbyLT5FLhOpRqqrpfmSHEvLsQgmer X-Received: by 10.70.18.97 with SMTP id v1mr19340707pdd.152.1427307113177; Wed, 25 Mar 2015 11:11:53 -0700 (PDT) Received: from uryu.home.lan ([144.49.132.3]) by mx.google.com with ESMTPSA id h9sm3161177pdo.5.2015.03.25.11.11.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Mar 2015 11:11:52 -0700 (PDT) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: simonxiaolinux@hotmail.com, alexmay@microsoft.com, kys@microsoft.com Date: Wed, 25 Mar 2015 11:11:19 -0700 Message-Id: <1427307085-5493-2-git-send-email-shemming@brocade.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427307085-5493-1-git-send-email-shemming@brocade.com> References: <1427307085-5493-1-git-send-email-shemming@brocade.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2 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: Wed, 25 Mar 2015 18:11:54 -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 03fce08..afe6923 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1376,6 +1376,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 21aa359..124117a 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -2037,6 +2037,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