From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by dpdk.org (Postfix) with ESMTP id CE783475D for ; Mon, 19 Sep 2016 20:50:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2527; q=dns/txt; s=iport; t=1474311018; x=1475520618; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=gdBKr+AUmBSlR8hrepYfDt/mIDonzXYC/OgLyZd8tNo=; b=cUcgrEtFgum8lbiAhMFANZ84E9KWaQOnz6DGIMxz2Qx6EGSm3xnYdqp2 aXTte/7ceKnopERbe0W09pX3Q+20mppKMjcUX/4hDBBKGOkutay73vsp/ TuYiG8ss/6V+BqucduH41nx46n+UioIZZ1lYindrOgO8+jd4/upEawF15 A=; X-IronPort-AV: E=Sophos;i="5.30,363,1470700800"; d="scan'208";a="150859233" Received: from alln-core-7.cisco.com ([173.36.13.140]) by rcdn-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Sep 2016 18:50:17 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id u8JIoHv6017156; Mon, 19 Sep 2016 18:50:17 GMT Received: by cisco.com (Postfix, from userid 412739) id B4F223FAAE0F; Mon, 19 Sep 2016 11:50:17 -0700 (PDT) From: Nelson Escobar To: dev@dpdk.org Cc: bruce.richardson@intel.com, Nelson Escobar Date: Mon, 19 Sep 2016 11:50:10 -0700 Message-Id: <1474311011-19978-2-git-send-email-neescoba@cisco.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1474311011-19978-1-git-send-email-neescoba@cisco.com> References: <1474311011-19978-1-git-send-email-neescoba@cisco.com> Subject: [dpdk-dev] [PATCH 2/3] net/enic: move code checking link status 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, 19 Sep 2016 18:50:19 -0000 Move link check code so that it can be used by interrupt handler. Signed-off-by: Nelson Escobar Reviewed-by: John Daley --- drivers/net/enic/enic.h | 1 + drivers/net/enic/enic_ethdev.c | 10 +--------- drivers/net/enic/enic_main.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 4c16ef1..5c9345f 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -273,4 +273,5 @@ uint16_t enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); int enic_set_mtu(struct enic *enic, uint16_t new_mtu); +int enic_link_update(struct enic *enic); #endif /* _ENIC_H_ */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 6cbecb1..e10c824 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -403,17 +403,9 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev, __rte_unused int wait_to_complete) { struct enic *enic = pmd_priv(eth_dev); - int ret; - int link_status = 0; ENICPMD_FUNC_TRACE(); - link_status = enic_get_link_status(enic); - ret = (link_status == enic->link_status); - enic->link_status = link_status; - eth_dev->data->dev_link.link_status = link_status; - eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; - eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev); - return ret; + return enic_link_update(enic); } static void enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev, diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index aec24d2..aaf47e6 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -411,6 +411,21 @@ enic_free_consistent(void *priv, rte_free(mze); } +int enic_link_update(struct enic *enic) +{ + struct rte_eth_dev *eth_dev = enic->rte_dev; + int ret; + int link_status = 0; + + link_status = enic_get_link_status(enic); + ret = (link_status == enic->link_status); + enic->link_status = link_status; + eth_dev->data->dev_link.link_status = link_status; + eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; + eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev); + return ret; +} + static void enic_intr_handler(__rte_unused struct rte_intr_handle *handle, void *arg) -- 2.7.0