[dpdk-dev] [PATCH v10 1/8] ethdev: use constants for link state
Zhang, Helin
helin.zhang at intel.com
Tue Mar 15 02:26:21 CET 2016
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, March 15, 2016 5:56 AM
> To: marcdevel at gmail.com; Richardson, Bruce <bruce.richardson at intel.com>;
> Doherty, Declan <declan.doherty at intel.com>; Ananyev, Konstantin
> <konstantin.ananyev at intel.com>; Lu, Wenzhuo <wenzhuo.lu at intel.com>;
> Zhang, Helin <helin.zhang at intel.com>; Chen, Jing D <jing.d.chen at intel.com>;
> harish.patil at qlogic.com; rahul.lakkireddy at chelsio.com; johndale at cisco.com;
> vido at cesnet.cz; adrien.mazarguil at 6wind.com;
> alejandro.lucero at netronome.com
> Cc: dev at 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 <marcdevel at gmail.com>
> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
> ---
................
> 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
More information about the dev
mailing list