netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly
@ 2012-11-21 12:34 Jiri Pirko
  2012-11-21 12:53 ` Jiri Pirko
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2012-11-21 12:34 UTC (permalink / raw)
  To: netdev; +Cc: davem, dan.carpenter

The thing is that team_dev_queue_xmit() returns NET_XMIT_* or -E*.
bc_trasmit() should return true in case all went well. So use ! to get
correct retval from team_dev_queue_xmit() result.
This bug caused iface statistics to be badly computed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 drivers/net/team/team_mode_broadcast.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/team/team_mode_broadcast.c b/drivers/net/team/team_mode_broadcast.c
index 9db0171..c5db428 100644
--- a/drivers/net/team/team_mode_broadcast.c
+++ b/drivers/net/team/team_mode_broadcast.c
@@ -29,8 +29,8 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
 			if (last) {
 				skb2 = skb_clone(skb, GFP_ATOMIC);
 				if (skb2) {
-					ret = team_dev_queue_xmit(team, last,
-								  skb2);
+					ret = !team_dev_queue_xmit(team, last,
+								   skb2);
 					if (!sum_ret)
 						sum_ret = ret;
 				}
@@ -39,7 +39,7 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
 		}
 	}
 	if (last) {
-		ret = team_dev_queue_xmit(team, last, skb);
+		ret = !team_dev_queue_xmit(team, last, skb);
 		if (!sum_ret)
 			sum_ret = ret;
 	}
-- 
1.8.0

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

* Re: [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly
  2012-11-21 12:34 [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly Jiri Pirko
@ 2012-11-21 12:53 ` Jiri Pirko
  2012-11-21 16:55   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2012-11-21 12:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, dan.carpenter


I forgot to mention this bug was introduced by:
team: add broadcast mode (5fc889911a99043a97da1daa0d010ad72cbc3042)

Wed, Nov 21, 2012 at 01:34:45PM CET, jiri@resnulli.us wrote:
>The thing is that team_dev_queue_xmit() returns NET_XMIT_* or -E*.
>bc_trasmit() should return true in case all went well. So use ! to get
>correct retval from team_dev_queue_xmit() result.
>This bug caused iface statistics to be badly computed.
>
>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>---
> drivers/net/team/team_mode_broadcast.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/team/team_mode_broadcast.c b/drivers/net/team/team_mode_broadcast.c
>index 9db0171..c5db428 100644
>--- a/drivers/net/team/team_mode_broadcast.c
>+++ b/drivers/net/team/team_mode_broadcast.c
>@@ -29,8 +29,8 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
> 			if (last) {
> 				skb2 = skb_clone(skb, GFP_ATOMIC);
> 				if (skb2) {
>-					ret = team_dev_queue_xmit(team, last,
>-								  skb2);
>+					ret = !team_dev_queue_xmit(team, last,
>+								   skb2);
> 					if (!sum_ret)
> 						sum_ret = ret;
> 				}
>@@ -39,7 +39,7 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
> 		}
> 	}
> 	if (last) {
>-		ret = team_dev_queue_xmit(team, last, skb);
>+		ret = !team_dev_queue_xmit(team, last, skb);
> 		if (!sum_ret)
> 			sum_ret = ret;
> 	}
>-- 
>1.8.0
>

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

* Re: [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly
  2012-11-21 12:53 ` Jiri Pirko
@ 2012-11-21 16:55   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-21 16:55 UTC (permalink / raw)
  To: jiri; +Cc: netdev, dan.carpenter

From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 21 Nov 2012 13:53:28 +0100

> 
> I forgot to mention this bug was introduced by:
> team: add broadcast mode (5fc889911a99043a97da1daa0d010ad72cbc3042)
> 
> Wed, Nov 21, 2012 at 01:34:45PM CET, jiri@resnulli.us wrote:
>>The thing is that team_dev_queue_xmit() returns NET_XMIT_* or -E*.
>>bc_trasmit() should return true in case all went well. So use ! to get
>>correct retval from team_dev_queue_xmit() result.
>>This bug caused iface statistics to be badly computed.
>>
>>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>Signed-off-by: Jiri Pirko <jiri@resnulli.us>

I incorporated the reference to the bug introducing commit and
applied this patch, thanks.

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

end of thread, other threads:[~2012-11-21 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 12:34 [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly Jiri Pirko
2012-11-21 12:53 ` Jiri Pirko
2012-11-21 16:55   ` David Miller

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