From: Nelson Escobar <neescoba@cisco.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, Nelson Escobar <neescoba@cisco.com>
Subject: [dpdk-dev] [PATCH 2/3] net/enic: move code checking link status
Date: Mon, 19 Sep 2016 11:50:10 -0700 [thread overview]
Message-ID: <1474311011-19978-2-git-send-email-neescoba@cisco.com> (raw)
In-Reply-To: <1474311011-19978-1-git-send-email-neescoba@cisco.com>
Move link check code so that it can be used by interrupt handler.
Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
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
next prev parent reply other threads:[~2016-09-19 18:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 18:50 [dpdk-dev] [PATCH 1/3] net/enic: cleanup interrupt setup when stopping port Nelson Escobar
2016-09-19 18:50 ` Nelson Escobar [this message]
2016-09-19 18:50 ` [dpdk-dev] [PATCH 3/3] net/enic: enable link check interrupts Nelson Escobar
2016-09-27 14:23 ` Bruce Richardson
2016-09-27 14:24 ` [dpdk-dev] [PATCH 1/3] net/enic: cleanup interrupt setup when stopping port Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474311011-19978-2-git-send-email-neescoba@cisco.com \
--to=neescoba@cisco.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).