Thread (167 messages) 167 messages, 19 authors, 2016-04-06

Re: [PATCH v10 1/8] ethdev: use constants for link state

From: Zhang, Helin <hidden>
Date: 2016-03-15 01:26:45

-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Tuesday, March 15, 2016 5:56 AM
To: marcdevel@gmail.com; Richardson, Bruce <redacted>;
Doherty, Declan [off-list ref]; Ananyev, Konstantin
[off-list ref]; Lu, Wenzhuo [off-list ref];
Zhang, Helin [off-list ref]; Chen, Jing D [off-list ref];
harish.patil@qlogic.com; rahul.lakkireddy@chelsio.com; johndale@cisco.com;
vido@cesnet.cz; adrien.mazarguil@6wind.com;
alejandro.lucero@netronome.com
Cc: dev@dpdk.org
Subject: [PATCH v10 1/8] ethdev: use constants for link state

Define and use ETH_LINK_UP and ETH_LINK_DOWN where appropriate.

Signed-off-by: Marc Sune <redacted>
Signed-off-by: Thomas Monjalon <redacted>
---

................
quoted hunk ↗ jump to hunk
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index
d867976..6704a82 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -247,7 +247,7 @@ struct rte_eth_stats {  struct rte_eth_link {
 	uint16_t link_speed;      /**< ETH_LINK_SPEED_[10, 100, 1000, 10000] */
 	uint16_t link_duplex;     /**< ETH_LINK_[HALF_DUPLEX, FULL_DUPLEX]
*/
-	uint8_t  link_status : 1; /**< 1 -> link up, 0 -> link down */
+	uint8_t  link_status : 1; /**< ETH_LINK_[DOWN/UP] */
 }__attribute__((aligned(8)));     /**< aligned for atomic64 read/write */

 #define ETH_LINK_SPEED_AUTONEG  0       /**< Auto-negotiate link
speed. */
@@ -259,9 +259,12 @@ struct rte_eth_link {
 #define ETH_LINK_SPEED_20G      20000   /**< 20 gigabits/second. */
 #define ETH_LINK_SPEED_40G      40000   /**< 40 gigabits/second. */

+/* Utility constants */
 #define ETH_LINK_AUTONEG_DUPLEX 0       /**< Auto-negotiate duplex.
*/
 #define ETH_LINK_HALF_DUPLEX    1       /**< Half-duplex connection. */
 #define ETH_LINK_FULL_DUPLEX    2       /**< Full-duplex connection. */
+#define ETH_LINK_DOWN           0 /**< Link is down. */
+#define ETH_LINK_UP             1 /**< Link is up. */
I was thinking if there is a link state of ETH_LINK_UNKOWN is needed?
Sometimes, it cannot get the real link status from hardware.
Any comments about this from others?

/Helin
 /**
  * A structure used to configure the ring threshold registers of an RX/TX
--
2.7.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help