netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode
@ 2014-03-16 16:29 Veaceslav Falico
  2014-03-16 16:45 ` Eric Dumazet
  2014-03-16 16:59 ` Joe Perches
  0 siblings, 2 replies; 5+ messages in thread
From: Veaceslav Falico @ 2014-03-16 16:29 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Only ratelimit the ones that might spam, omiting the ones from
enslave/deslave.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_3ad.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index dee2a84..f2700aa 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1280,7 +1280,7 @@ static void ad_port_selection_logic(struct port *port)
 				break;
 			}
 		}
-		if (!curr_port) {
+		if (!curr_port && net_ratelimit()) {
 			/* meaning: the port was related to an aggregator
 			 * but was not on the aggregator port list
 			 */
@@ -1445,9 +1445,10 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
 		break;
 
 	default:
-		pr_warn("%s: Impossible agg select mode %d\n",
-			curr->slave->bond->dev->name,
-			__get_agg_selection_mode(curr->lag_ports));
+		if (net_ratelimit())
+			pr_warn("%s: Impossible agg select mode %d\n",
+				curr->slave->bond->dev->name,
+				__get_agg_selection_mode(curr->lag_ports));
 		break;
 	}
 
@@ -1559,7 +1560,7 @@ static void ad_agg_selection_logic(struct aggregator *agg)
 		}
 
 		/* check if any partner replys */
-		if (best->is_individual) {
+		if (best->is_individual && net_ratelimit()) {
 			pr_warn("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
 				best->slave ?
 				best->slave->bond->dev->name : "NULL");
@@ -2080,7 +2081,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
 
 		/* select the active aggregator for the bond */
 		if (port) {
-			if (!port->slave) {
+			if (!port->slave && net_ratelimit()) {
 				pr_warn("%s: Warning: bond's first port is uninitialized\n",
 					bond->dev->name);
 				goto re_arm;
@@ -2095,7 +2096,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
 	/* for each port run the state machines */
 	bond_for_each_slave_rcu(bond, slave, iter) {
 		port = &(SLAVE_AD_INFO(slave).port);
-		if (!port->slave) {
+		if (!port->slave && net_ratelimit()) {
 			pr_warn("%s: Warning: Found an uninitialized port\n",
 				bond->dev->name);
 			goto re_arm;
@@ -2157,7 +2158,7 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave,
 
 		port = &(SLAVE_AD_INFO(slave).port);
 
-		if (!port->slave) {
+		if (!port->slave && net_ratelimit()) {
 			pr_warn("%s: Warning: port of slave %s is uninitialized\n",
 				slave->dev->name, slave->bond->dev->name);
 			return ret;
-- 
1.8.4

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

* Re: [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode
  2014-03-16 16:29 [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode Veaceslav Falico
@ 2014-03-16 16:45 ` Eric Dumazet
  2014-03-16 16:50   ` Veaceslav Falico
  2014-03-16 16:59 ` Joe Perches
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2014-03-16 16:45 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On Sun, 2014-03-16 at 17:29 +0100, Veaceslav Falico wrote:

> @@ -1559,7 +1560,7 @@ static void ad_agg_selection_logic(struct aggregator *agg)
>  		}
>  
>  		/* check if any partner replys */
> -		if (best->is_individual) {
> +		if (best->is_individual && net_ratelimit()) {

This looks odd, to mix conditions that are not of the same domain.

Have you considered using pr_warn_ratelimited() ?

>  			pr_warn("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
>  				best->slave ?
>  				best->slave->bond->dev->name : "NULL");
> @@ -2080,7 +2081,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)

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

* Re: [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode
  2014-03-16 16:45 ` Eric Dumazet
@ 2014-03-16 16:50   ` Veaceslav Falico
  0 siblings, 0 replies; 5+ messages in thread
From: Veaceslav Falico @ 2014-03-16 16:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On Sun, Mar 16, 2014 at 09:45:15AM -0700, Eric Dumazet wrote:
>On Sun, 2014-03-16 at 17:29 +0100, Veaceslav Falico wrote:
>
>> @@ -1559,7 +1560,7 @@ static void ad_agg_selection_logic(struct aggregator *agg)
>>  		}
>>
>>  		/* check if any partner replys */
>> -		if (best->is_individual) {
>> +		if (best->is_individual && net_ratelimit()) {
>
>This looks odd, to mix conditions that are not of the same domain.

It indeed looks odd and kinda hard to read.

>
>Have you considered using pr_warn_ratelimited() ?

Nice, didn't know (or forgot...) about that function.

Thanks, will use it and re-send.

>
>>  			pr_warn("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
>>  				best->slave ?
>>  				best->slave->bond->dev->name : "NULL");
>> @@ -2080,7 +2081,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>
>
>
>

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

* Re: [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode
  2014-03-16 16:29 [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode Veaceslav Falico
  2014-03-16 16:45 ` Eric Dumazet
@ 2014-03-16 16:59 ` Joe Perches
  2014-03-16 17:02   ` Veaceslav Falico
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-03-16 16:59 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On Sun, 2014-03-16 at 17:29 +0100, Veaceslav Falico wrote:
> Only ratelimit the ones that might spam, omiting the ones from
> enslave/deslave.

No, this patch isn't good and must not be applied.
You've also changed flow here.

> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
[]
> @@ -2080,7 +2081,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>  
>  		/* select the active aggregator for the bond */
>  		if (port) {
> -			if (!port->slave) {
> +			if (!port->slave && net_ratelimit()) {
>  				pr_warn("%s: Warning: bond's first port is uninitialized\n",
>  					bond->dev->name);
>  				goto re_arm;

Now the goto is ratelimited too.

> @@ -2095,7 +2096,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>  	/* for each port run the state machines */
>  	bond_for_each_slave_rcu(bond, slave, iter) {
>  		port = &(SLAVE_AD_INFO(slave).port);
> -		if (!port->slave) {
> +		if (!port->slave && net_ratelimit()) {
>  			pr_warn("%s: Warning: Found an uninitialized port\n",
>  				bond->dev->name);
>  			goto re_arm;

here too.

> @@ -2157,7 +2158,7 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave,
>  
>  		port = &(SLAVE_AD_INFO(slave).port);
>  
> -		if (!port->slave) {
> +		if (!port->slave && net_ratelimit()) {
>  			pr_warn("%s: Warning: port of slave %s is uninitialized\n",
>  				slave->dev->name, slave->bond->dev->name);
>  			return ret;

And the return 3.

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

* Re: [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode
  2014-03-16 16:59 ` Joe Perches
@ 2014-03-16 17:02   ` Veaceslav Falico
  0 siblings, 0 replies; 5+ messages in thread
From: Veaceslav Falico @ 2014-03-16 17:02 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On Sun, Mar 16, 2014 at 09:59:23AM -0700, Joe Perches wrote:
>On Sun, 2014-03-16 at 17:29 +0100, Veaceslav Falico wrote:
>> Only ratelimit the ones that might spam, omiting the ones from
>> enslave/deslave.
>
>No, this patch isn't good and must not be applied.
>You've also changed flow here.

Hrm, seems like geomagnetic storm that's going on outside buffed my
stupidity.

Sent v2 with pr_warn_ratelimit(), it changes nothing in the logic.

>
>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>[]
>> @@ -2080,7 +2081,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>>
>>  		/* select the active aggregator for the bond */
>>  		if (port) {
>> -			if (!port->slave) {
>> +			if (!port->slave && net_ratelimit()) {
>>  				pr_warn("%s: Warning: bond's first port is uninitialized\n",
>>  					bond->dev->name);
>>  				goto re_arm;
>
>Now the goto is ratelimited too.
>
>> @@ -2095,7 +2096,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>>  	/* for each port run the state machines */
>>  	bond_for_each_slave_rcu(bond, slave, iter) {
>>  		port = &(SLAVE_AD_INFO(slave).port);
>> -		if (!port->slave) {
>> +		if (!port->slave && net_ratelimit()) {
>>  			pr_warn("%s: Warning: Found an uninitialized port\n",
>>  				bond->dev->name);
>>  			goto re_arm;
>
>here too.
>
>> @@ -2157,7 +2158,7 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave,
>>
>>  		port = &(SLAVE_AD_INFO(slave).port);
>>
>> -		if (!port->slave) {
>> +		if (!port->slave && net_ratelimit()) {
>>  			pr_warn("%s: Warning: port of slave %s is uninitialized\n",
>>  				slave->dev->name, slave->bond->dev->name);
>>  			return ret;
>
>And the return 3.
>

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

end of thread, other threads:[~2014-03-16 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-16 16:29 [PATCH net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode Veaceslav Falico
2014-03-16 16:45 ` Eric Dumazet
2014-03-16 16:50   ` Veaceslav Falico
2014-03-16 16:59 ` Joe Perches
2014-03-16 17:02   ` Veaceslav Falico

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