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 BB967A0093;
	Mon, 15 Jun 2020 11:02:17 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id A5C5B4CA6;
	Mon, 15 Jun 2020 11:02:12 +0200 (CEST)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
 [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 9B80C4C90
 for <dev@dpdk.org>; Mon, 15 Jun 2020 11:02:10 +0200 (CEST)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
 by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
 20200615090210euoutp0209321b5a7bb6c4a657f1faa63684b0b8~YrCH0sDg73275132751euoutp02w
 for <dev@dpdk.org>; Mon, 15 Jun 2020 09:02:10 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
 20200615090210euoutp0209321b5a7bb6c4a657f1faa63684b0b8~YrCH0sDg73275132751euoutp02w
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
 s=mail20170921; t=1592211730;
 bh=qh9JCtxcjKOea/2bzK40RVNX0VCSjD1DsMJBarBtp44=;
 h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From;
 b=ZUfJ8KiyZyIjzcmbMDoan/lMNpAlDt6zsaEm3Xy+HPyFziBxxprXv4SA7aCI6+5ll
 vXQynTpKe4ba6u4ZwHLc7TqLKAOViJyWPfbsOpBeAVz0UO/L8lGPEu9pJaM93ltf6T
 Z/048Z4RnfZr0hlvoZKyLhKoZoqQog5wPIkAy0Nk=
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
 eucas1p2.samsung.com (KnoxPortal) with ESMTP id
 20200615090209eucas1p24cbb082467ba1a41b663c5cefd8a669e~YrCHmbng91969219692eucas1p2K;
 Mon, 15 Jun 2020 09:02:09 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
 eusmges3new.samsung.com (EUCPMTA) with SMTP id DE.D0.60698.11937EE5; Mon, 15
 Jun 2020 10:02:09 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
 eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
 20200615090209eucas1p15c676b9ad46b95ce91d63f4fad92dab8~YrCHRzx7p1085310853eucas1p1f;
 Mon, 15 Jun 2020 09:02:09 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
 eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
 20200615090209eusmtrp1e9156bc202493b6babad7fef4b10ac8e~YrCHRK6s31019610196eusmtrp1D;
 Mon, 15 Jun 2020 09:02:09 +0000 (GMT)
X-AuditID: cbfec7f5-a0fff7000001ed1a-6c-5ee73911a624
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
 eusmgms1.samsung.com (EUCPMTA) with SMTP id C7.1A.08375.11937EE5; Mon, 15
 Jun 2020 10:02:09 +0100 (BST)
Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by
 eusmtip1.samsung.com (KnoxPortal) with ESMTPA id
 20200615090208eusmtip1f66ac127a03eb03f5fc73597b8e701e6~YrCGkAwYt0231502315eusmtip1T;
 Mon, 15 Jun 2020 09:02:08 +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, wei.zhao1@intel.com, jia.guo@intel.com,
 beilei.xing@intel.com, qiming.yang@intel.com, wenzhuo.lu@intel.com
Date: Mon, 15 Jun 2020 12:01:49 +0300
Message-Id: <20200615090158.18912-2-i.dyukov@samsung.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200615090158.18912-1-i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SFcWLqA1BuEP/EHV5pOAwAA
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsVy+t/xu7qCls/jDM6tlbN4MOUum0X3hxYm
 i+0rutgs3n3azmRxZ+9pdotZl5rYLZ7/ecVsMWXnDkaLTw9OsFicvrmZ3WLN14vMFlvP/GV0
 4PH4tWApq8fiPS+ZPI7dnMbu8X7fVTaPvi2rGD1WP/nBFsAWpWdTlF9akqqQkV9cYqsUbWhh
 pGdoaaFnZGKpZ2hsHmtlZKqkb2eTkpqTWZZapG+XoJdx6v4B1oJnEhXPN99lbWD8KtzFyMkh
 IWAiseXSV9YuRi4OIYGljBLvps9m62LkAEpISLx+wgxRIyzx51oXG4gtJPCZUWJmnyyIzSag
 IXG6Yx4TSK+IwBImib2rzjGCJIQFLCReXpvICDKHRUBV4sKnRJAwr4ClRN+k+6wQM+UlVm84
 ADafU8BK4uLBGewQ8zMlXs2/wwphy0lcn/+FCaJXUOLkzCcsICOZBdQl1s8TAgkzA41p3jqb
 eQKj4CwkVbMQqmYhqVrAyLyKUSS1tDg3PbfYUK84Mbe4NC9dLzk/dxMjMPa2Hfu5eQfjpY3B
 hxgFOBiVeHgtQp/FCbEmlhVX5h5ilOBgVhLhdTp7Ok6INyWxsiq1KD++qDQntfgQoynQlxOZ
 pUST84FpIa8k3tDU0NzC0tDc2NzYzEJJnLdD4GCMkEB6YklqdmpqQWoRTB8TB6dUAyOzg8wT
 No6II792q1y6uJwnc89VPbngb5oKIQ96F8lcT42e0Wgb7xepI3jtC6dh5g3V63lLq1cpGi5c
 FhG1VmH3I3Oe9jXPtV+nfDE0Md29L99r3uQzfJfab/5e6GrF3vldqKGtS+LADeNTbN/TXxQd
 XFF8c71nvvzO78bX/t5I+L555uQUizYlluKMREMt5qLiRAAclR240wIAAA==
X-CMS-MailID: 20200615090209eucas1p15c676b9ad46b95ce91d63f4fad92dab8
X-Msg-Generator: CA
Content-Type: text/plain; charset="utf-8"
X-RootMTR: 20200615090209eucas1p15c676b9ad46b95ce91d63f4fad92dab8
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20200615090209eucas1p15c676b9ad46b95ce91d63f4fad92dab8
References: <20200427095737.11082-1-i.dyukov@samsung.com>
 <20200615090158.18912-1-i.dyukov@samsung.com>
 <CGME20200615090209eucas1p15c676b9ad46b95ce91d63f4fad92dab8@eucas1p1.samsung.com>
Subject: [dpdk-dev] [PATCH v3 1/7] ethdev: allow unknown link speed
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: i.dyukov@samsung.com
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 information, 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 a49242bcd..2090af501 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -303,6 +303,7 @@ struct rte_eth_stats {
 #define ETH_SPEED_NUM_56G      56000 /**<  56 Gbps */
 #define ETH_SPEED_NUM_100G    100000 /**< 100 Gbps */
 #define ETH_SPEED_NUM_200G    200000 /**< 200 Gbps */
+#define ETH_SPEED_NUM_UNKNOWN UINT32_MAX /**< Unknown */
 
 /**
  * A structure used to retrieve link-level information of an Ethernet port.
@@ -2262,15 +2263,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 information written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
@@ -2279,15 +2281,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 information written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
-- 
2.17.1