From: Marc Sune Date: Thu, 31 Mar 2016 22:12:25 +0000 (+0200) Subject: ethdev: use constants for link duplex X-Git-Tag: spdx-start~7100 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1131900006078c2e4f8cd5493c9a794a91701ab9;p=dpdk.git ethdev: use constants for link duplex Some duplex values are replaced from 0 to half-duplex when link is down. Some drivers are still using their own constants for duplex modes. Signed-off-by: Marc Sune --- diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 9c50674b12..b78ac04cdf 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1108,7 +1108,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_UP; } else if (!link_check && (link.link_status == ETH_LINK_UP)) { link.link_speed = 0; - link.link_duplex = 0; + link.link_duplex = ETH_LINK_HALF_DUPLEX; link.link_status = ETH_LINK_DOWN; } rte_em_dev_atomic_write_link_status(dev, &link); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 045fc6343f..4dfa7e3910 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2062,7 +2062,7 @@ eth_igb_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_UP; } else if (!link_check) { link.link_speed = 0; - link.link_duplex = 0; + link.link_duplex = ETH_LINK_HALF_DUPLEX; link.link_status = ETH_LINK_DOWN; } rte_igb_dev_atomic_write_link_status(dev, &link); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8bcd0d8489..5721882f0d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3066,7 +3066,7 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_DOWN; link.link_speed = 0; - link.link_duplex = 0; + link.link_duplex = ETH_LINK_HALF_DUPLEX; memset(&old, 0, sizeof(old)); rte_ixgbe_dev_atomic_read_link_status(dev, &old); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 3ebc221f99..63a368ac82 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1401,7 +1401,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet memset(&link, 0, sizeof(link)); virtio_dev_atomic_read_link_status(dev, &link); old = link; - link.link_duplex = FULL_DUPLEX; + link.link_duplex = ETH_LINK_FULL_DUPLEX; link.link_speed = SPEED_10G; if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index fed9571ce8..66423a0700 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -42,8 +42,6 @@ #define SPEED_100 100 #define SPEED_1000 1000 #define SPEED_10G 10000 -#define HALF_DUPLEX 1 -#define FULL_DUPLEX 2 #ifndef PAGE_SIZE #define PAGE_SIZE 4096 diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index c5a215a556..2d13f92ecd 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -246,7 +246,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] */ + uint16_t link_duplex; /**< ETH_LINK_[HALF/FULL]_DUPLEX */ uint8_t link_status : 1; /**< ETH_LINK_[DOWN/UP] */ }__attribute__((aligned(8))); /**< aligned for atomic64 read/write */