diff mbox

[net-next] bonding: net_ratelimit() pr_warn()s in 802.3ad mode

Message ID 1394987380-15765-1-git-send-email-vfalico@redhat.com
State Changes Requested, archived
Headers show

Commit Message

Veaceslav Falico March 16, 2014, 4:29 p.m. UTC
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(-)

Comments

Eric Dumazet March 16, 2014, 4:45 p.m. UTC | #1
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)




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Veaceslav Falico March 16, 2014, 4:50 p.m. UTC | #2
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)
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches March 16, 2014, 4:59 p.m. UTC | #3
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.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Veaceslav Falico March 16, 2014, 5:02 p.m. UTC | #4
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.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;