[dpdk-dev] [RFC 03/14] bnxt: use rte_link_update

Stephen Hemminger stephen at networkplumber.org
Fri Jul 14 20:30:16 CEST 2017


Use new API to update link status, and fix incorrect return
value.  The link_update operation should have been returning -1
if link changed.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/bnxt/bnxt_ethdev.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c9d11228be46..4c79eb51fc22 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -469,20 +469,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
-static inline int
-rte_bnxt_atomic_write_link_status(struct rte_eth_dev *eth_dev,
-				struct rte_eth_link *link)
-{
-	struct rte_eth_link *dst = &eth_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;
-}
-
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev)
 {
 	struct rte_eth_link *link = &eth_dev->data->dev_link;
@@ -685,12 +671,9 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	} while (!new.link_status && cnt--);
 
 out:
-	/* Timed out or success */
-	if (new.link_status != eth_dev->data->dev_link.link_status ||
-	new.link_speed != eth_dev->data->dev_link.link_speed) {
-		rte_bnxt_atomic_write_link_status(eth_dev, &new);
+	rc = _rte_eth_link_update(eth_dev, &new);
+	if (rc)
 		bnxt_print_link_info(eth_dev);
-	}
 
 	return rc;
 }
-- 
2.11.0



More information about the dev mailing list