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 C92B7A04AF;
	Tue, 11 Aug 2020 10:53:16 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 10E4C1C027;
	Tue, 11 Aug 2020 10:53:07 +0200 (CEST)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
 [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 9EF4E1C01F
 for <dev@dpdk.org>; Tue, 11 Aug 2020 10:53:04 +0200 (CEST)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
 by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
 20200811085303euoutp01983d7e9e8b3748a92de51f940843da54~qKrcb-uoB0646906469euoutp01i;
 Tue, 11 Aug 2020 08:53:03 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
 20200811085303euoutp01983d7e9e8b3748a92de51f940843da54~qKrcb-uoB0646906469euoutp01i
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
 s=mail20170921; t=1597135983;
 bh=BG13JEDguLywByJwOXQTWe6Zorck+0Dg5OriYR0Hx5A=;
 h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From;
 b=BHGklrOaPad48h3jooD78okfYhawo4GoitxJA1+VaD7rgEeHYlB/7fgoMEDKxfzIY
 6y2N28WGDolw3LwUeU1S0qg8n2OBGIkFdTnUFM8V0C8xMLTcuAvef2TFm0LBv++nMp
 mcGV2Iq02t1fVJyyUHN3pQUF39HZrMvAQJo6W9Fs=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
 eucas1p1.samsung.com (KnoxPortal) with ESMTP id
 20200811085303eucas1p1ee60d3e4c37bbc07ccbf81bc38b08e9f~qKrcIxDu01584815848eucas1p1a;
 Tue, 11 Aug 2020 08:53:03 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
 eusmges2new.samsung.com (EUCPMTA) with SMTP id 7C.0C.05997.F6C523F5; Tue, 11
 Aug 2020 09:53:03 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
 eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
 20200811085302eucas1p22f4a941f6015f378792aae713123fbcc~qKrbn5oyJ0326203262eucas1p2f;
 Tue, 11 Aug 2020 08:53:02 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
 eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
 20200811085302eusmtrp108824ed0d9c7a4533e7462d71c7d4b41~qKrbm8K_I1606216062eusmtrp16;
 Tue, 11 Aug 2020 08:53:02 +0000 (GMT)
X-AuditID: cbfec7f4-677ff7000000176d-7f-5f325c6f81af
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
 eusmgms2.samsung.com (EUCPMTA) with SMTP id FA.3D.06017.E6C523F5; Tue, 11
 Aug 2020 09:53:02 +0100 (BST)
Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by
 eusmtip1.samsung.com (KnoxPortal) with ESMTPA id
 20200811085300eusmtip15d311123947fddb10c7e97e94111aafc~qKrZs7Bnw1362413624eusmtip1i;
 Tue, 11 Aug 2020 08:53:00 +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,
 mb@smartsharesystems.com, stephen@networkplumber.org,
 nicolas.chautru@intel.com, bruce.richardson@intel.com,
 konstantin.ananyev@intel.com, cristian.dumitrescu@intel.com,
 radu.nicolau@intel.com, akhil.goyal@nxp.com, declan.doherty@intel.com,
 skori@marvell.com, pbhagavatula@marvell.com, jerinj@marvell.com,
 kirankumark@marvell.com, david.hunt@intel.com, anatoly.burakov@intel.com,
 xiaoyun.li@intel.com, jingjing.wu@intel.com, john.mcnamara@intel.com,
 jasvinder.singh@intel.com, byron.marohn@intel.com, yipeng1.wang@intel.com
Date: Tue, 11 Aug 2020 11:52:20 +0300
Message-Id: <20200811085246.28735-2-i.dyukov@samsung.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200811085246.28735-1-i.dyukov@samsung.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf2wTBRTHfXfXu1td8SgjPNGga0JiTWTsR/QpxokYc8aEGP8gisqschno
 fqXHGOOvZZiVlLmNboHQ6tyYurFKCrZbZ6lzNkDpurpAGAwdbMJw2YQxxogwN3Dnlch/3+/3
 fV7ee8kTWXOQXy5uLdqm2ItsBRbeyHWevNv/XPEHWXmrj51YSr6+RqDLl1pYGmm4yNOeqc8Z
 GmzPpXDwSwO5hisYqnHdZCjY5uTp2kglR5PTQYaGfooL5D5TKdB0ZEygL/o9QGNzEywdaLoF
 1N/YYaC7v4R4ujF3kKOa2QGg2sApoGj1TY4afuwCqnJKNHWoVaCWoRU0PXKKo/gFv0Df3z7N
 UkffPNDeqA8oUXXf8Gq6PNv0rUFuCY8zcn3zaVY+eWGfIFfHGhn56GQXI9/oHuDlmkA7yL2X
 97Cyd/QO/7Zxo/HlzUrB1u2KPeOVj4xbDo+4hBL34zuGaxJCBXyT5oQUEaUc/DN4jHeCUTRL
 bYCXDnclzQzgoMOVNLcAGyYGhAct3301mSy0Ap6onAfd3AbsqzsLGsVLz2B8dyOjFdKkozwG
 584vGFFcIr2EvsH3NYaTVuIfvVOMpk3Sizh91WPQJzyF3iM9rKZTFnCvZ/g/bZZW4PmvZ5L8
 YowdGOU0zS7wuzo8rN47I+LZgKLr1/Ha6CHQ9RKciAaSFzyJ8fpqTtsNJQf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vaJAeBYTj+s6kgKMiFmE37YNEQEtZTR45J1dPF06D9dcvTfVE+THa+zd
 U1rGZOG9XU3UtA7H7We+/MmG4NZT/VP1JLMY1zlkgTXpr9nXYCePohDbf5TtH2X7j6pEpBPJ
 ebOgy9AJKqWg1QlmfYZyu0F3Hfkf5+bDH/UuZPVtciOGRoqZ0pwENlUm1uYKeTo3wjSpkEvX
 eD0pMmm6Nm83bzSkGs3ZvOBGsf4zj5Fhs7cb/G+oN6WysWwcaNg4dZx6GSjmSA8x95NlTIbW
 xO/k+Rze+DdH0EFhFoSv5jXMUIf4kguJYtu3qJzebmoHt36rpr55wmkoWpA/GfWgNs17uYCK
 6G3LTyoMPbEhsmiwXVa9v9ry3e1be4Xtv02uLdlSkjJfnFjx3u5Ne/tVPTx5YDNtqQ29NBZ+
 ps85Furak2Dn18G78QKffmFCRnn74XuC3PzFNZeNWK0QCZladilpFLS/AXjMThFOAwAA
X-CMS-MailID: 20200811085302eucas1p22f4a941f6015f378792aae713123fbcc
X-Msg-Generator: CA
Content-Type: text/plain; charset="utf-8"
X-RootMTR: 20200811085302eucas1p22f4a941f6015f378792aae713123fbcc
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20200811085302eucas1p22f4a941f6015f378792aae713123fbcc
References: <20200427095737.11082-1-i.dyukov@samsung.com>
 <20200811085246.28735-1-i.dyukov@samsung.com>
 <CGME20200811085302eucas1p22f4a941f6015f378792aae713123fbcc@eucas1p2.samsung.com>
Subject: [dpdk-dev] [PATCH v9 01/24] 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>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 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