From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by dpdk.org (Postfix) with ESMTP id 3D37E1B37C for ; Tue, 16 Jan 2018 19:38:17 +0100 (CET) Received: by mail-pg0-f68.google.com with SMTP id z17so9932453pgc.4 for ; Tue, 16 Jan 2018 10:38:17 -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=RsltqttZrmWueDTX7IoPklMpTsZ+kFMiZozVRX9vBkM=; b=lJ03LJDD/s8DdsvNX0f26iljATnjgX12zxs1gRseTu6G2tPkyBjrLizawtwQEz8rDB KQsKqHO0Xh1p4vONJCKZ9+oa6N/tyAZKzy3m0ThXjJFfZzIVE5EsZMsoJH0HeHkKEs9W wUG4suJiqL5ttEMsMMCvEQcY1dYSwFtm3nS5I4LwD6g82HNxdzQXYXOl1G0wztavBohv uF4GkSLCGN+4SfvOppOw4CSydivdlUrL824VCfe/KapgjYbzL5xpiCTmOSvbsLgFZmhK KUr2jhixC/GZyZ8up1RiBTPrZcrPxIu6UVxnHFx8PQZN/zZqFThYS48a2d30pS87p7OU 5B1Q== 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=RsltqttZrmWueDTX7IoPklMpTsZ+kFMiZozVRX9vBkM=; b=czTvdhdLUkeRJqK0vht3SrrFnAygENk9v4DH3tmn6aC2NCoWfBTd4wR+/dnev1adVD Rw95/KWIF2ju89EysCc8cmAi99CUWwli72ojUI2kx5QYCRU9HdE7ChdfK9NGYaO63lAx cFAIaoXWl0/xuPtgIXLsmPmNZkyMIALRMR0Oh7SaCt9RgQzE9pneNGm+whz0UI5xwkoK Eb2jBEntEj4VH3eNN9euDeD6LODZ7rLwlTM75zJyddbH5/D6PPoGSmQ23wG90qRKURkJ LLDM6D9nQeyIt3w6nyqQLZuTcPuu4xSJb0Z5O1DfIDsnTvRjSh6FbVZGaPMwuizmYIVK NMHg== X-Gm-Message-State: AKwxytdKXZIFXiDTTau0rpqw2GUJ/L1aoFXDonGP4Cve7xeLmgRXPsh7 g/jLFtW9SlDEmoYayv0n/N5SJ0uhdvM= X-Google-Smtp-Source: ACJfBouVbYAhTiaSpDDUCRw2t2e99T41x1Q3FKEAK2PWg88CCj9sMy/YjpNobydqe5VBXFHagvNfbg== X-Received: by 10.98.237.6 with SMTP id u6mr1091606pfh.190.1516127895748; Tue, 16 Jan 2018 10:38:15 -0800 (PST) Received: from xeon-e3.lan (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id 77sm4560351pfc.187.2018.01.16.10.38.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 10:38:14 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 16 Jan 2018 10:37:50 -0800 Message-Id: <20180116183755.24542-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116183755.24542-1-stephen@networkplumber.org> References: <20180116183755.24542-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v5 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: Tue, 16 Jan 2018 18:38:17 -0000 Use new rte_linkstatus update API Signed-off-by: Stephen Hemminger --- 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 fc386154f0b9..517918624658 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -627,34 +627,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"); @@ -2327,17 +2299,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); @@ -2390,10 +2361,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; @@ -9854,9 +9822,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 b96d77a0caed..0605fc107240 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1034,20 +1034,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) @@ -2069,6 +2055,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: @@ -2100,8 +2087,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