From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 1C52B532D for ; Mon, 14 Mar 2016 22:57:21 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id l68so127394754wml.0 for ; Mon, 14 Mar 2016 14:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q8reN5knKc0wSMVlgXvhVZn/6YA660Hlz5aKTNHzvC8=; b=S8CzQ6MD1p1tuHijvWQFc0cOFvhe2LoJyTVw4n4sTz+hHSBQA7zASG/7oHEEkGK/lg bpAFCJL6aRf4w8cmmORf1LHlnxwsTJOE9b8Fbhep+bIvy0iAUlnI0WXCa4xXG03m0eWM WsECdT61PM4yMSrWZTaC1uN3UJcIdNAxD8xQFEwu5EJ68oIlxIuMAUBLIjC5CX3HGd+J TfdNXTMAiZEIz3z87CfyOUEumzs51r1VpFYf2rmTgfs+7U7j0eNcOSpHadX8s1MqWb1c smQXZciiZigNwJjpqQrKgzj1QiOgRP38Idzur3VkhlCgx9y5ASgTbATvuxqYkUAwXFr6 Yd0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q8reN5knKc0wSMVlgXvhVZn/6YA660Hlz5aKTNHzvC8=; b=TGmdvIw97WRSgIHIkpJc3E3ad9FQHmPgJ9PaOpqt1/xNHxZIN2RTuJEZO74MuuR4DS gKRIWnf3i9b3GhBDsmRgVic7at3TD5QUbpS0ZYeqcLbs0NTLjZ1HzxFnINgIqusjEXyl 0v1oloJGII25kGVM1yxoAf221wNgQ/kRTOpX7FeFT6VwtkeC71AuBrZG369glELrdJPO YKWrEGdmDAmwSCSyJhrfRiOL8PBAWYbHqyeEKFuSKYpOGvxOza+4QzXIT7592wUsjGjW XWxQNq4J7vVWqSgWorQD+h5sC0CStq3m37it+j3YNP0EJ9A+HWxOP+iiro2ndYVyzy7+ /fRQ== X-Gm-Message-State: AD7BkJID1+SNW9CxLC/hxjGTQdjsbFNzRxSEqugeYatiMVP0G9mVKFDEyxKOlXnwApLc9Ebv X-Received: by 10.28.211.1 with SMTP id k1mr21672637wmg.93.1457992640982; Mon, 14 Mar 2016 14:57:20 -0700 (PDT) Received: from XPS13.localdomain (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id w133sm17918804wmd.3.2016.03.14.14.57.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Mar 2016 14:57:20 -0700 (PDT) From: Thomas Monjalon To: marcdevel@gmail.com, bruce.richardson@intel.com, declan.doherty@intel.com, konstantin.ananyev@intel.com, wenzhuo.lu@intel.com, helin.zhang@intel.com, jing.d.chen@intel.com, 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 Date: Mon, 14 Mar 2016 22:55:40 +0100 Message-Id: <1457992546-32230-3-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457992546-32230-1-git-send-email-thomas.monjalon@6wind.com> References: <1456793151-1475-1-git-send-email-marcdevel@gmail.com> <1457992546-32230-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH v10 2/8] ethdev: use constants for link duplex X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2016 21:57:21 -0000 From: Marc Sune 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 --- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_ethdev.h | 2 -- lib/librte_ether/rte_ethdev.h | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 58f9c7a..2f3529f 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1076,7 +1076,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 614d8cb..0e58fa9 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2024,7 +2024,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 62a8dff..99c55bd 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2959,7 +2959,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 76a0faf..aa5ae10 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1383,7 +1383,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 fed9571..66423a0 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 6704a82..12b552d 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 */ -- 2.7.0