From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start
Date: Thu, 12 Jan 2017 09:03:21 +0000 [thread overview]
Message-ID: <1484211803-21449-3-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1484211803-21449-1-git-send-email-arybchenko@solarflare.com>
Fixes: 215e8b89d8a8 ("net/sfc: implement device operation to retrieve link info")
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
---
drivers/net/sfc/sfc_port.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c
index dc6ecdf..e2d8544 100644
--- a/drivers/net/sfc/sfc_port.c
+++ b/drivers/net/sfc/sfc_port.c
@@ -61,6 +61,27 @@
return 0;
}
+static int
+sfc_port_init_dev_link(struct sfc_adapter *sa)
+{
+ struct rte_eth_link *dev_link = &sa->eth_dev->data->dev_link;
+ int rc;
+ efx_link_mode_t link_mode;
+ struct rte_eth_link current_link;
+
+ rc = efx_port_poll(sa->nic, &link_mode);
+ if (rc != 0)
+ return rc;
+
+ sfc_port_link_mode_to_info(link_mode, ¤t_link);
+
+ EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
+ rte_atomic64_set((rte_atomic64_t *)dev_link,
+ *(uint64_t *)¤t_link);
+
+ return 0;
+}
+
int
sfc_port_start(struct sfc_adapter *sa)
{
@@ -129,9 +150,17 @@
if (rc != 0)
goto fail_mac_drain;
+ /* Synchronize link status knowledge */
+ rc = sfc_port_init_dev_link(sa);
+ if (rc != 0)
+ goto fail_port_init_dev_link;
+
sfc_log_init(sa, "done");
return 0;
+fail_port_init_dev_link:
+ (void)efx_mac_drain(sa->nic, B_TRUE);
+
fail_mac_drain:
(void)efx_mac_stats_periodic(sa->nic, &port->mac_stats_dma_mem,
0, B_FALSE);
--
1.8.2.3
next prev parent reply other threads:[~2017-01-12 9:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 9:03 [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Andrew Rybchenko
2017-01-12 9:03 ` [dpdk-dev] [PATCH 1/4] net/sfc: avoid usage of possibly uninitialized link_mode Andrew Rybchenko
2017-01-12 9:03 ` Andrew Rybchenko [this message]
2017-01-12 9:03 ` [dpdk-dev] [PATCH 3/4] net/sfc: report correct link status when port is not started Andrew Rybchenko
2017-01-12 9:03 ` [dpdk-dev] [PATCH 4/4] net/sfc: fix flow control settings set on port start Andrew Rybchenko
2017-01-16 17:07 ` [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Ferruh Yigit
2017-01-18 19:23 ` Ferruh Yigit
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=1484211803-21449-3-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.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).