DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes
@ 2017-01-12  9:03 Andrew Rybchenko
  2017-01-12  9:03 ` [dpdk-dev] [PATCH 1/4] net/sfc: avoid usage of possibly uninitialized link_mode Andrew Rybchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2017-01-12  9:03 UTC (permalink / raw)
  To: dev

Fix few problems with link status information and flow control settings.

Patches are grouped into a series since flow control fix discovers
link status sync issue just after port start.

Andrew Rybchenko (4):
  net/sfc: avoid usage of possibly uninitialized link_mode
  net/sfc: sync link status knowledge with HW on start
  net/sfc: report correct link status when port is not started
  net/sfc: fix flow control settings set on port start

 drivers/net/sfc/sfc_ethdev.c | 14 +++++++++-----
 drivers/net/sfc/sfc_port.c   | 41 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 7 deletions(-)

-- 
1.8.2.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 1/4] net/sfc: avoid usage of possibly uninitialized link_mode
  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 ` Andrew Rybchenko
  2017-01-12  9:03 ` [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start Andrew Rybchenko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2017-01-12  9:03 UTC (permalink / raw)
  To: dev

In fact efx_port_poll() always initializes it, but it isn't
explicitly documented feature of the API. Moreover, the API
annocation suggests that return code should be checked.

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_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 3f0df76..d13b6d6 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -198,7 +198,8 @@
 	if (wait_to_complete) {
 		efx_link_mode_t link_mode;
 
-		efx_port_poll(sa->nic, &link_mode);
+		if (efx_port_poll(sa->nic, &link_mode) != 0)
+			link_mode = EFX_LINK_UNKNOWN;
 		sfc_port_link_mode_to_info(link_mode, &current_link);
 
 		if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
-- 
1.8.2.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start
  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
  2017-01-12  9:03 ` [dpdk-dev] [PATCH 3/4] net/sfc: report correct link status when port is not started Andrew Rybchenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2017-01-12  9:03 UTC (permalink / raw)
  To: dev

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, &current_link);
+
+	EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
+	rte_atomic64_set((rte_atomic64_t *)dev_link,
+			 *(uint64_t *)&current_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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 3/4] net/sfc: report correct link status when port is not started
  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 ` [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start Andrew Rybchenko
@ 2017-01-12  9:03 ` Andrew Rybchenko
  2017-01-12  9:03 ` [dpdk-dev] [PATCH 4/4] net/sfc: fix flow control settings set on port start Andrew Rybchenko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2017-01-12  9:03 UTC (permalink / raw)
  To: dev

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_ethdev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index d13b6d6..3ad9ada 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -188,14 +188,17 @@
 
 	sfc_log_init(sa, "entry");
 
-	if (sa->state != SFC_ADAPTER_STARTED)
-		return 0;
-
 retry:
 	EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
 	*(int64_t *)&old_link = rte_atomic64_read((rte_atomic64_t *)dev_link);
 
-	if (wait_to_complete) {
+	if (sa->state != SFC_ADAPTER_STARTED) {
+		sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &current_link);
+		if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
+					 *(uint64_t *)&old_link,
+					 *(uint64_t *)&current_link))
+			goto retry;
+	} else if (wait_to_complete) {
 		efx_link_mode_t link_mode;
 
 		if (efx_port_poll(sa->nic, &link_mode) != 0)
-- 
1.8.2.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 4/4] net/sfc: fix flow control settings set on port start
  2017-01-12  9:03 [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Andrew Rybchenko
                   ` (2 preceding siblings ...)
  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 ` 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
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2017-01-12  9:03 UTC (permalink / raw)
  To: dev

efx_phy_adv_cap_set() sets all advertised phy capabilities including
pause capabilities which are also configured using efx_mac_fcntl_set().

If we set speed and autonegotiation capabilities only, we should
preserve already configured pause capabilities.

Fixes: 7a56123f8a60 ("net/sfc: support link speed and duplex settings")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
---
 drivers/net/sfc/sfc_port.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c
index e2d8544..5998a99 100644
--- a/drivers/net/sfc/sfc_port.c
+++ b/drivers/net/sfc/sfc_port.c
@@ -87,6 +87,9 @@
 {
 	struct sfc_port *port = &sa->port;
 	int rc;
+	uint32_t phy_adv_cap;
+	const uint32_t phy_pause_caps =
+		((1u << EFX_PHY_CAP_PAUSE) | (1u << EFX_PHY_CAP_ASYM));
 
 	sfc_log_init(sa, "entry");
 
@@ -107,8 +110,13 @@
 	if (rc != 0)
 		goto fail_mac_fcntl_set;
 
-	sfc_log_init(sa, "set phy adv caps to %#x", port->phy_adv_cap);
-	rc = efx_phy_adv_cap_set(sa->nic, port->phy_adv_cap);
+	/* Preserve pause capabilities set by above efx_mac_fcntl_set()  */
+	efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_CURRENT, &phy_adv_cap);
+	SFC_ASSERT((port->phy_adv_cap & phy_pause_caps) == 0);
+	phy_adv_cap = port->phy_adv_cap | (phy_adv_cap & phy_pause_caps);
+
+	sfc_log_init(sa, "set phy adv caps to %#x", phy_adv_cap);
+	rc = efx_phy_adv_cap_set(sa->nic, phy_adv_cap);
 	if (rc != 0)
 		goto fail_phy_adv_cap_set;
 
-- 
1.8.2.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes
  2017-01-12  9:03 [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Andrew Rybchenko
                   ` (3 preceding siblings ...)
  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 ` Ferruh Yigit
  2017-01-18 19:23 ` Ferruh Yigit
  5 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2017-01-16 17:07 UTC (permalink / raw)
  To: Andrew Rybchenko, dev

On 1/12/2017 9:03 AM, Andrew Rybchenko wrote:
> Fix few problems with link status information and flow control settings.
> 
> Patches are grouped into a series since flow control fix discovers
> link status sync issue just after port start.
> 
> Andrew Rybchenko (4):
>   net/sfc: avoid usage of possibly uninitialized link_mode
>   net/sfc: sync link status knowledge with HW on start
>   net/sfc: report correct link status when port is not started
>   net/sfc: fix flow control settings set on port start
<...>

Hi Andrew,

These are fixes to the code in next-net, and used fixes tags with commit
ids from next-net. But next-net is allowed to re-write the git history,
so those commit ids may change.

That is why I am waiting the RC1, when next-net merged into main tree,
commit ids will be fixed after that point and can get these fixes.

Regards,
ferruh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes
  2017-01-12  9:03 [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Andrew Rybchenko
                   ` (4 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2017-01-18 19:23 UTC (permalink / raw)
  To: Andrew Rybchenko, dev

On 1/12/2017 9:03 AM, Andrew Rybchenko wrote:
> Fix few problems with link status information and flow control settings.
> 
> Patches are grouped into a series since flow control fix discovers
> link status sync issue just after port start.
> 
> Andrew Rybchenko (4):
>   net/sfc: avoid usage of possibly uninitialized link_mode
>   net/sfc: sync link status knowledge with HW on start
>   net/sfc: report correct link status when port is not started
>   net/sfc: fix flow control settings set on port start
> 
<...>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-18 19:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start Andrew Rybchenko
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

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).