From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 080131B1AB for ; Tue, 23 Jan 2018 00:55:16 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id 23so8341815pfp.3 for ; Mon, 22 Jan 2018 15:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S8y8qXX65UaxyxHP8Apj/Xg0Tktkr9ZuX8owxa4CYGQ=; b=e1x7T2/MSicQZXbAF2v5CptOn7nGyGvpcBMuPu/98s/VBvEKt53gAkNyJNdSPx8sS+ YEmtLn03jneAD7dDcW6+o2ev+e1J4HC+GFNh7S8m1QJbeK1PLGW1vKcVoU6s/6WjRFyQ kcM2Wz0PxhCtmpybOKfeQAdaw0CHmy8+xY09evqxUdCiBP8VqgNa55rDLVv+ptz8+U5b xmMfiZz0OWG0iXIcnBgmtOChhlx2upA2dZ1uREyP3Tx7fqJGofDM0rMfqWiU0VBS3T2A or1kbwkXBolwthR2yj5su52PrcmBcU/YtHAF83TZWtWhTtWY4043Lx4mutNBkHVXulJx SwzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S8y8qXX65UaxyxHP8Apj/Xg0Tktkr9ZuX8owxa4CYGQ=; b=WBGCCqF0bmQY52Xo+dtWPmV5qyOFDn4feIdNGEyf4LwNX935L1oSG+w4/+rjUdbL9y +tmhOWDZfuQ05V4gmUnWNvsI7l1Hvn7ttUPso0RaGizovoHmRPTyWmPZ+R9s5C8J8pn7 /DKnO5YW2oF/kt8fwfPcxgQPdwJLJMRVFIXDzpN965kxMlHFNq9zjc7Bx9hUIMFk+jmx roUT/n6K090A88y53MWxSIsMKbf8NahNtBF20+2VQN683TI/UMvXIwUqHfhHpJQMdhCR xQdnRSxhJ2tI9BjfSpJQfu8QvNW1oxnD26kSyNXM5yM5M4noMIzorBDyBFsDjlhjH3Zp 6qZw== X-Gm-Message-State: AKwxyteSbKoLuAmzTFPhOlud9/DqnfyrFXdBQEZV8Lm1owQXSUkLXPCa t8OoUa1my1r9LSiHSRwu3NY9pIS8QqE= X-Google-Smtp-Source: AH8x227mKM/LIHD5IXAdbU0nLOC8P04G1K/wZg7tJUj6Syv/2necssDg8mrdnETgiL6o1/Mhsxa1/A== X-Received: by 10.101.81.5 with SMTP id f5mr7537865pgq.78.1516665314984; Mon, 22 Jan 2018 15:55:14 -0800 (PST) Received: from xeon-e3.lan (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id a24sm1623825pff.160.2018.01.22.15.55.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 15:55:13 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ferruh Yigit Date: Mon, 22 Jan 2018 15:54:53 -0800 Message-Id: <20180122235458.28562-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180122235458.28562-1-stephen@networkplumber.org> References: <20180122235458.28562-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v7 10/15] net/i40e: use rte_eth_linkstatus functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 23:55:16 -0000 Use new rte_linkstatus update API Signed-off-by: Stephen Hemminger Signed-off-by: Ferruh Yigit --- drivers/net/i40e/i40e_ethdev.c | 43 +++++---------------------------------- drivers/net/i40e/i40e_ethdev_vf.c | 18 ++-------------- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index c4df65df0cf6..15f18776e198 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -628,34 +628,6 @@ static struct rte_pci_driver rte_i40e_pmd = { .remove = eth_i40e_pci_remove, }; -static inline int -rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev, - struct rte_eth_link *link) -{ - struct rte_eth_link *dst = link; - struct rte_eth_link *src = &(dev->data->dev_link); - - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) - return -1; - - return 0; -} - -static inline int -rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev, - struct rte_eth_link *link) -{ - struct rte_eth_link *dst = &(dev->data->dev_link); - struct rte_eth_link *src = link; - - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) - return -1; - - return 0; -} - RTE_PMD_REGISTER_PCI(net_i40e, rte_i40e_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_i40e, pci_id_i40e_map); RTE_PMD_REGISTER_KMOD_DEP(net_i40e, "* igb_uio | uio_pci_generic | vfio-pci"); @@ -2347,17 +2319,16 @@ i40e_dev_link_update(struct rte_eth_dev *dev, #define MAX_REPEAT_TIME 10 /* 1s (10 * 100ms) in total */ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_link_status link_status; - struct rte_eth_link link, old; + struct rte_eth_link link; int status; unsigned rep_cnt = MAX_REPEAT_TIME; bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false; memset(&link, 0, sizeof(link)); - memset(&old, 0, sizeof(old)); - memset(&link_status, 0, sizeof(link_status)); - rte_i40e_dev_atomic_read_link_status(dev, &old); do { + memset(&link_status, 0, sizeof(link_status)); + /* Get link status information from hardware */ status = i40e_aq_get_link_info(hw, enable_lse, &link_status, NULL); @@ -2410,10 +2381,7 @@ i40e_dev_link_update(struct rte_eth_dev *dev, ETH_LINK_SPEED_FIXED); out: - rte_i40e_dev_atomic_write_link_status(dev, &link); - if (link.link_status == old.link_status) - return -1; - + rte_eth_linkstatus_set(dev, &link); i40e_notify_all_vfs_link_status(dev); return 0; @@ -10034,9 +10002,8 @@ i40e_start_timecounters(struct rte_eth_dev *dev) uint32_t tsync_inc_h; /* Get current link speed. */ - memset(&link, 0, sizeof(link)); i40e_dev_link_update(dev, 1); - rte_i40e_dev_atomic_read_link_status(dev, &link); + rte_eth_linkstatus_get(dev, &link); switch (link.link_speed) { case ETH_SPEED_NUM_40G: diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 6ac3f8c04a50..e34a2bf93787 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1036,20 +1036,6 @@ static const struct rte_pci_id pci_id_i40evf_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -static inline int -i40evf_dev_atomic_write_link_status(struct rte_eth_dev *dev, - struct rte_eth_link *link) -{ - struct rte_eth_link *dst = &(dev->data->dev_link); - struct rte_eth_link *src = link; - - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) - return -1; - - return 0; -} - /* Disable IRQ0 */ static inline void i40evf_disable_irq0(struct i40e_hw *hw) @@ -2077,6 +2063,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev, * while Linux driver does not */ + memset(&new_link, 0, sizeof(new_link)); /* Linux driver PF host */ switch (vf->link_speed) { case I40E_LINK_SPEED_100MB: @@ -2108,8 +2095,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev, new_link.link_autoneg = dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED; - i40evf_dev_atomic_write_link_status(dev, &new_link); - + rte_eth_linkstatus_set(dev, &new_link); return 0; } -- 2.15.1