Skip to contentSkip to conversation

net/bonding: fix link properties with autoneg

PATCH In review Chas Williams 4 participants 7 messages Feb 13, 2018 – Jun 16, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bonding: fix link properties with autoneg

From: Chas Williams <[email protected]>

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid. To be completely correct, there should be additional checks to prevent a slave that negotiates a different speed from being activated.

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +4 -3
index 92ad688..5559879 100644
@@ -1545,9 +1545,10 @@ link_properties_valid(struct rte_eth_dev *ethdev,
 	if (bond_ctx->mode == BONDING_MODE_8023AD) {
 		struct rte_eth_link *bond_link = &bond_ctx->mode4.slave_link;
 
-		if (bond_link->link_duplex != slave_link->link_duplex ||
-			bond_link->link_autoneg != slave_link->link_autoneg ||
-			bond_link->link_speed != slave_link->link_speed)
+		if (bond_link->link_autoneg != slave_link->link_autoneg ||
+		    (bond_link->link_autoneg != ETH_LINK_AUTONEG &&
+		     (bond_link->link_duplex != slave_link->link_duplex ||
+		      bond_link->link_speed != slave_link->link_speed)))
 			return -1;
 	}
 
Signature · 1 line
2.9.5
#1 lore raw

13/02/2018 23:54, Chas Williams:

Quoted 9 lines

From: Chas Williams <[email protected]>

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid. To be completely correct, there should be additional checks to prevent a slave that negotiates a different speed from being activated.

Please add Fixes line to all your fix patches. Thanks

#2 lore raw
In reply to Chas Williams

Hi Chas

From: Chas Williams, Wednesday, February 14, 2018 12:55 AM

Quoted 3 lines

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid.

Ok for this.

Quoted 3 lines

To be completely correct, there
should be additional checks to prevent a slave that negotiates a different speed from being activated.

Looks like every changing in the link properties should cause LSC interrupt.
In the bonding LCS interrupt you could handle and to deactivate the device.
Also you should deal with the case of the first slave, what is happen if the first slave has invalid link properties? How can you know that the speed\duplex_mode is invalid?
Are we sure LACP mode can run with auto negotiation?

Quoted 30 lines
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -2
index 92ad688..5559879 100644
@@ -1545,9 +1545,10 @@ link_properties_valid(struct rte_eth_dev
 *ethdev,
 	if (bond_ctx->mode == BONDING_MODE_8023AD) {
 		struct rte_eth_link *bond_link = &bond_ctx-
 >mode4.slave_link;
 
-		if (bond_link->link_duplex != slave_link->link_duplex ||
-			bond_link->link_autoneg != slave_link->link_autoneg

||

drivers/net/bonding/rte_eth_bond_pmd.c +4 -2
-			bond_link->link_speed != slave_link->link_speed)
+		if (bond_link->link_autoneg != slave_link->link_autoneg ||
+		    (bond_link->link_autoneg != ETH_LINK_AUTONEG &&
+		     (bond_link->link_duplex != slave_link->link_duplex ||
+		      bond_link->link_speed != slave_link->link_speed)))
 			return -1;
 	}
 
--

2.9.5

#3 lore raw
Quoted 13 lines · Matan Azrad

Hi Chas

From: Chas Williams, Wednesday, February 14, 2018 12:55 AM

Quoted 3 lines

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid.

Ok for this.

Quoted 3 lines

To be completely correct, there
should be additional checks to prevent a slave that negotiates a different speed from being activated.

Quoted 5 lines

Looks like every changing in the link properties should cause LSC interrupt.
In the bonding LCS interrupt you could handle and to deactivate the device.
Also you should deal with the case of the first slave, what is happen if the first slave has invalid link properties? How can you know that the speed\duplex_mode is invalid?
Are we sure LACP mode can run with auto negotiation?

Yes, I am pretty sure bonding doesn't get this right when the interfaces aren't link up. While what bonding is doing is likely wrong, it doesn't mean that the behavior of the PMDs are correct in leaving the link_status unset until the first
LSC interrupt.

I plan to get around to looking at this bonding problem in a little bit. Luckily
it seems that we always tend to get matched links and even if bonding is advertising the wrong aggregate speed and duplex we are find for now. It wouldn't pass close inspection by a protocol analyzer though.

Quoted 31 lines
Quoted 30 lines
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -2
index 92ad688..5559879 100644
@@ -1545,9 +1545,10 @@ link_properties_valid(struct rte_eth_dev
 *ethdev,
      if (bond_ctx->mode == BONDING_MODE_8023AD) {
              struct rte_eth_link *bond_link = &bond_ctx-
 >mode4.slave_link;
 
-             if (bond_link->link_duplex != slave_link->link_duplex ||
-                     bond_link->link_autoneg != slave_link->link_autoneg

||

drivers/net/bonding/rte_eth_bond_pmd.c +4 -2
-                     bond_link->link_speed != slave_link->link_speed)
+             if (bond_link->link_autoneg != slave_link->link_autoneg ||
+                 (bond_link->link_autoneg != ETH_LINK_AUTONEG &&
+                  (bond_link->link_duplex != slave_link->link_duplex ||
+                   bond_link->link_speed != slave_link->link_speed)))
                      return -1;
      }
 
--

2.9.5

#4 lore raw

Hi Chas

From: Chas Williams, Monday, April 16, 2018 7:44 PM

Quoted 27 lines
Quoted 9 lines · Matan Azrad

Hi Chas

From: Chas Williams, Wednesday, February 14, 2018 12:55 AM

Quoted 3 lines

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid.

Ok for this.

Quoted 7 lines
Quoted 3 lines

To be completely correct, there
should be additional checks to prevent a slave that negotiates a different speed from being activated.

Looks like every changing in the link properties should cause LSC interrupt. In the bonding LCS interrupt you could handle and to deactivate the device. Also you should deal with the case of the first slave, what is happen if the

first slave has invalid link properties?

Quoted 2 lines

How can you know that the speed\duplex_mode is invalid? Are we sure LACP mode can run with auto negotiation?

Yes, I am pretty sure bonding doesn't get this right when the interfaces aren't link up. While what bonding is doing is likely wrong, it doesn't mean that the behavior of the PMDs are correct in leaving the link_status unset until the first LSC interrupt.

Quoted 5 lines

I plan to get around to looking at this bonding problem in a little bit. Luckily it seems that we always tend to get matched links and even if bonding is advertising the wrong aggregate speed and duplex we are find for now. It wouldn't pass close inspection by a protocol analyzer though.

So, Are you going to fix it,
If no, I think you can open a bug in Bugzilla.

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -2
index 92ad688..5559879 100644
@@ -1545,9 +1545,10 @@ link_properties_valid(struct rte_eth_dev
 *ethdev,
      if (bond_ctx->mode == BONDING_MODE_8023AD) {
              struct rte_eth_link *bond_link = &bond_ctx-
 >mode4.slave_link;
 
-             if (bond_link->link_duplex != slave_link->link_duplex ||
-                     bond_link->link_autoneg != slave_link->link_autoneg

||

drivers/net/bonding/rte_eth_bond_pmd.c +5 -2
-                     bond_link->link_speed != slave_link->link_speed)
+             if (bond_link->link_autoneg != slave_link->link_autoneg ||
+                 (bond_link->link_autoneg != ETH_LINK_AUTONEG &&
+                  (bond_link->link_duplex != slave_link->link_duplex ||
+                   bond_link->link_speed !=
+ slave_link->link_speed)))
                      return -1;
      }
 
--

2.9.5

#5 lore raw
Quoted 30 lines · Matan Azrad

Hi Chas

From: Chas Williams, Monday, April 16, 2018 7:44 PM

Quoted 27 lines
Quoted 9 lines · Matan Azrad

Hi Chas

From: Chas Williams, Wednesday, February 14, 2018 12:55 AM

Quoted 3 lines

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid.

Ok for this.

Quoted 7 lines
Quoted 3 lines

To be completely correct, there
should be additional checks to prevent a slave that negotiates a different speed from being activated.

Looks like every changing in the link properties should cause LSC interrupt. In the bonding LCS interrupt you could handle and to deactivate the device. Also you should deal with the case of the first slave, what is happen if the

first slave has invalid link properties?

Quoted 2 lines

How can you know that the speed\duplex_mode is invalid? Are we sure LACP mode can run with auto negotiation?

Yes, I am pretty sure bonding doesn't get this right when the interfaces aren't link up. While what bonding is doing is likely wrong, it doesn't mean that the behavior of the PMDs are correct in leaving the link_status unset until the first LSC interrupt.

Quoted 8 lines
Quoted 5 lines

I plan to get around to looking at this bonding problem in a little bit. Luckily it seems that we always tend to get matched links and even if bonding is advertising the wrong aggregate speed and duplex we are find for now. It wouldn't pass close inspection by a protocol analyzer though.

So, Are you going to fix it,
If no, I think you can open a bug in Bugzilla.

Hi Matan, Chas,

What is the latest status of the patch?
And I guess there is another issue as well discussed here, is it still valid?

Thanks,
ferruh

#6 lore raw
Quoted 47 lines · Ferruh Yigit
Quoted 19 lines · Matan Azrad

Hi Chas

From: Chas Williams, Monday, April 16, 2018 7:44 PM

Quoted 16 lines
Quoted 14 lines · Matan Azrad

Hi Chas

From: Chas Williams, Wednesday, February 14, 2018 12:55 AM

Quoted 3 lines

If a link is carrier down and using autonegotiation, then the PMD may not have detected a speed yet. In this case the best we can do is ignore the link speed and duplex since they aren't valid.

Ok for this.

Quoted 3 lines

To be completely correct, there
should be additional checks to prevent a slave that negotiates a different speed from being activated.

Looks like every changing in the link properties should cause LSC

interrupt.

Quoted 1 line
Quoted 1 line
Quoted 1 line

In the bonding LCS interrupt you could handle and to deactivate the

device.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Also you should deal with the case of the first slave, what is happen

if the

Quoted 6 lines
Quoted 6 lines

first slave has invalid link properties?

Quoted 2 lines

How can you know that the speed\duplex_mode is invalid? Are we sure LACP mode can run with auto negotiation?

Yes, I am pretty sure bonding doesn't get this right when the interfaces aren't link up. While what bonding is doing is likely wrong, it

doesn't mean

Quoted 1 line
Quoted 1 line

that the behavior of the PMDs are correct in leaving the link_status

unset

Quoted 3 lines
Quoted 3 lines

until the first LSC interrupt.

I plan to get around to looking at this bonding problem in a little

bit. Luckily it

Quoted 2 lines
Quoted 2 lines

seems that we always tend to get matched links and even if bonding is advertising the wrong aggregate speed and duplex we are find for now.

It

Quoted 5 lines
Quoted 2 lines

wouldn't pass close inspection by a protocol analyzer though.

So, Are you going to fix it,
If no, I think you can open a bug in Bugzilla.

Quoted 9 lines

Hi Matan, Chas,

What is the latest status of the patch?
And I guess there is another issue as well discussed here, is it still valid?

Thanks,
ferruh

I think this issue is better addressed by
http://dpdk.org/dev/patchwork/patch/40572/

There's just a little more cleanup that needs to be done in that patch.