From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 355AFA00BE;
	Mon, 27 Apr 2020 11:58:02 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 6CAFE1C439;
	Mon, 27 Apr 2020 11:57:58 +0200 (CEST)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
 [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 3A7CA1C437
 for <dev@dpdk.org>; Mon, 27 Apr 2020 11:57:55 +0200 (CEST)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
 by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
 20200427095754euoutp02599c7b053742c288a526cb872d84b22f~JpLzDVRlX1999619996euoutp02C
 for <dev@dpdk.org>; Mon, 27 Apr 2020 09:57:54 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
 20200427095754euoutp02599c7b053742c288a526cb872d84b22f~JpLzDVRlX1999619996euoutp02C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
 s=mail20170921; t=1587981474;
 bh=6QG3nTWgBM+UdAT06i01J64mPudMRemN0uiP97ewDGU=;
 h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From;
 b=tiAkUmqjtSnHbJIGqjOeByKxMinTGc3+S5uTJeMJfsihUc8arsz0NW3i2N+koVJj4
 P9d3DzMVK4qnAQTzU3EEe25sFTqa+Lmcky1IHait8mp09cwlVNFU/YwXQKfcpUPB1m
 FpqFUHVAKhvyUS07luWfYyKwhH+5/V5RaXcWOOE4=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
 eucas1p2.samsung.com (KnoxPortal) with ESMTP id
 20200427095753eucas1p2a4f363e00203fd29dae840fe24030a96~JpLytHq4g3010530105eucas1p2_;
 Mon, 27 Apr 2020 09:57:53 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
 eusmges2new.samsung.com (EUCPMTA) with SMTP id E5.E3.60679.1ACA6AE5; Mon, 27
 Apr 2020 10:57:53 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
 eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
 20200427095753eucas1p24327f9862457d9f3bc892a60c8645814~JpLyVHf0W2020820208eucas1p2n;
 Mon, 27 Apr 2020 09:57:53 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
 eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
 20200427095753eusmtrp1cd54fc18ba374f98943bae788dce4f9f~JpLyUcc782257022570eusmtrp1i;
 Mon, 27 Apr 2020 09:57:53 +0000 (GMT)
X-AuditID: cbfec7f4-0e5ff7000001ed07-0c-5ea6aca161c3
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
 eusmgms1.samsung.com (EUCPMTA) with SMTP id 5A.D2.08375.1ACA6AE5; Mon, 27
 Apr 2020 10:57:53 +0100 (BST)
Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by
 eusmtip1.samsung.com (KnoxPortal) with ESMTPA id
 20200427095752eusmtip11a4497025d9aaaf5aa7b7d905deb8d5f~JpLx1JwjT1355513555eusmtip1h;
 Mon, 27 Apr 2020 09:57:52 +0000 (GMT)
From: Ivan Dyukov <i.dyukov@samsung.com>
To: dev@dpdk.org, i.dyukov@samsung.com, v.kuramshin@samsung.com,
 thomas@monjalon.net, david.marchand@redhat.com, ferruh.yigit@intel.com,
 arybchenko@solarflare.com
Date: Mon, 27 Apr 2020 12:57:23 +0300
Message-Id: <20200427095737.11082-2-i.dyukov@samsung.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200427095737.11082-1-i.dyukov@samsung.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPK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2B3aPXwuWsnos3vOSyePYzWnsHu/3XWXz6Nuy
 itFj9ZMfbAFsUXo2RfmlJakKGfnFJbZK0YYWRnqGlhZ6RiaWeobG5rFWRqZK+nY2Kak5mWWp
 Rfp2CXoZT9ovsBS8lKhYfcO7gfGrcBcjJ4eEgInEgTU3WLsYuTiEBJYySqy7+Im9i5EDKCEh
 8foJM0SNsMSfa11sILaQwGdGiXuv2EFsNgENidMd85hAekUE1jFKfJz5BqxBWMBCYtG6ZhYQ
 m0VAVeLn9eVgDbwClhL9Ry8wQgyVl1i94QAzyC5OASuJZ/+TIeaHS1y88hssLCSgLPH5agJE
 p6DEyZlPWEDCzALqEuvnCYGEmYGGNG+dzTyBUXAWkqpZCFWzkFQtYGRexSiSWlqcm55bbKhX
 nJhbXJqXrpecn7uJERhF24793LyD8dLG4EOMAhyMSjy8HNuXxgmxJpYVV+YeYpTgYFYS4X2U
 sSxOiDclsbIqtSg/vqg0J7X4EKMp0JMTmaVEk/OBEZ5XEm9oamhuYWlobmxubGahJM7bIXAw
 RkggPbEkNTs1tSC1CKaPiYNTqoExyuFPocmnSbl7lQ+cYO/jPpHieDriI39w5M3yyB1pDeZH
 0ksZD6xWzND8P5XfSord3Lqcy0l0phWbuMfJY8l8bMVfb6wWeG0Yn/vryBTv9GVxf9Z4/WBr
 nrT0+BWtN1ukikLi69KcHKdIJPj8qGD4uPm0bDWHyr4uuyO3v/e1B1z6dHxVwwIlluKMREMt
 5qLiRAD7h4D1uAIAAA==
X-CMS-MailID: 20200427095753eucas1p24327f9862457d9f3bc892a60c8645814
X-Msg-Generator: CA
Content-Type: text/plain; charset="utf-8"
X-RootMTR: 20200427095753eucas1p24327f9862457d9f3bc892a60c8645814
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20200427095753eucas1p24327f9862457d9f3bc892a60c8645814
References: <4816966.qqrk5fENW1@thomas>
 <20200427095737.11082-1-i.dyukov@samsung.com>
 <CGME20200427095753eucas1p24327f9862457d9f3bc892a60c8645814@eucas1p2.samsung.com>
Subject: [dpdk-dev] [PATCH v1 1/6] ethdev: allow unknown link speed
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: 4816966.qqrk5fENW1@thomas.org
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Thomas Monjalon <thomas@monjalon.net>

When querying the link informations, the link status is
a mandatory major information.
Other boolean values are supposed to be accurate:
	- duplex mode (half/full)
	- negotiation (auto/fixed)

This API update is making explicit that the link speed information
is optional.
The value ETH_SPEED_NUM_NONE (0) was already part of the API.
The value ETH_SPEED_NUM_UNKNOWN (infinite) is added to cover
two different cases:
	- speed is not known by the driver
	- device is virtual

Suggested-by: Morten Brørup <mb@smartsharesystems.com>
Suggested-by: Benoit Ganne <bganne@cisco.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_ethdev/rte_ethdev.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 0f6d0530d..2f94a09d4 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -301,6 +301,7 @@ struct rte_eth_stats {
 #define ETH_SPEED_NUM_50G      50000 /**<  50 Gbps */
 #define ETH_SPEED_NUM_56G      56000 /**<  56 Gbps */
 #define ETH_SPEED_NUM_100G    100000 /**< 100 Gbps */
+#define ETH_SPEED_NUM_UNKNOWN UINT32_MAX /**< Unknown */
 
 /**
  * A structure used to retrieve link-level information of an Ethernet port.
@@ -2260,15 +2261,16 @@ int rte_eth_allmulticast_disable(uint16_t port_id);
 int rte_eth_allmulticast_get(uint16_t port_id);
 
 /**
- * Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
- * or FULL-DUPLEX) of the physical link of an Ethernet device. It might need
- * to wait up to 9 seconds in it.
+ * Retrieve the link status (up/down), the duplex mode (half/full),
+ * the negotiation (auto/fixed), and if available, the speed (Mbps).
+ *
+ * It might need to wait up to 9 seconds.
+ * @see rte_eth_link_get_nowait.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param link
- *   A pointer to an *rte_eth_link* structure to be filled with
- *   the status, the speed and the mode of the Ethernet device link.
+ *   Link informations written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
@@ -2277,15 +2279,13 @@ int rte_eth_allmulticast_get(uint16_t port_id);
 int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link);
 
 /**
- * Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
- * or FULL-DUPLEX) of the physical link of an Ethernet device. It is a no-wait
- * version of rte_eth_link_get().
+ * Retrieve the link status (up/down), the duplex mode (half/full),
+ * the negotiation (auto/fixed), and if available, the speed (Mbps).
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param link
- *   A pointer to an *rte_eth_link* structure to be filled with
- *   the status, the speed and the mode of the Ethernet device link.
+ *   Link informations written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
-- 
2.17.1