netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] team: update master carrier state
@ 2012-12-30 18:27 Flavio Leitner
  2012-12-30 21:47 ` Jiri Pirko
  0 siblings, 1 reply; 5+ messages in thread
From: Flavio Leitner @ 2012-12-30 18:27 UTC (permalink / raw)
  To: netdev; +Cc: Jiri Pirko, Flavio Leitner

Update master's carrier state when there is any
change with its ports.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 drivers/net/team/team.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 918a901..78c7d87 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1400,13 +1400,11 @@ static void team_destructor(struct net_device *dev)
 
 static int team_open(struct net_device *dev)
 {
-	netif_carrier_on(dev);
 	return 0;
 }
 
 static int team_close(struct net_device *dev)
 {
-	netif_carrier_off(dev);
 	return 0;
 }
 
@@ -2560,21 +2558,43 @@ send_event:
 
 }
 
+static void __team_carrier_check(struct team *team)
+{
+	struct team_port *port;
+	bool team_linkup;
+
+	team_linkup = false;
+	list_for_each_entry(port, &team->port_list, list) {
+		if (port->linkup) {
+			team_linkup = true;
+			break;
+		}
+	}
+
+	if (team_linkup)
+		netif_carrier_on(team->dev);
+	else
+		netif_carrier_off(team->dev);
+}
+
 static void __team_port_change_check(struct team_port *port, bool linkup)
 {
 	if (port->state.linkup != linkup)
 		__team_port_change_send(port, linkup);
+	__team_carrier_check(port->team);
 }
 
 static void __team_port_change_port_added(struct team_port *port, bool linkup)
 {
 	__team_port_change_send(port, linkup);
+	__team_carrier_check(port->team);
 }
 
 static void __team_port_change_port_removed(struct team_port *port)
 {
 	port->removed = true;
 	__team_port_change_send(port, false);
+	__team_carrier_check(port->team);
 }
 
 static void team_port_change_check(struct team_port *port, bool linkup)
-- 
1.8.0.1

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

* Re: [PATCH net-next] team: update master carrier state
  2012-12-30 18:27 [PATCH net-next] team: update master carrier state Flavio Leitner
@ 2012-12-30 21:47 ` Jiri Pirko
  2012-12-30 22:06   ` Flavio Leitner
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2012-12-30 21:47 UTC (permalink / raw)
  To: Flavio Leitner; +Cc: netdev

Sun, Dec 30, 2012 at 07:27:29PM CET, fbl@redhat.com wrote:
>Update master's carrier state when there is any
>change with its ports.


This patch looks good to me. Just one nitpick I spotted....

>+	bool team_linkup;
>+
>+	team_linkup = false;


This can be squashed together.

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

* Re: [PATCH net-next] team: update master carrier state
  2012-12-30 21:47 ` Jiri Pirko
@ 2012-12-30 22:06   ` Flavio Leitner
  2012-12-30 22:10     ` Jiri Pirko
  0 siblings, 1 reply; 5+ messages in thread
From: Flavio Leitner @ 2012-12-30 22:06 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev

On Sun, Dec 30, 2012 at 10:47:23PM +0100, Jiri Pirko wrote:
> Sun, Dec 30, 2012 at 07:27:29PM CET, fbl@redhat.com wrote:
> >Update master's carrier state when there is any
> >change with its ports.
> 
> 
> This patch looks good to me. Just one nitpick I spotted....
> 
> >+	bool team_linkup;
> >+
> >+	team_linkup = false;
> 
> 
> This can be squashed together.

Ok, but that increases the static size of the module because it
moves the variable out of bss.

I have no strong opinion on either case, so it's up to you.

Thanks,
-- 
fbl

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

* Re: [PATCH net-next] team: update master carrier state
  2012-12-30 22:06   ` Flavio Leitner
@ 2012-12-30 22:10     ` Jiri Pirko
  2013-01-03 10:15       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2012-12-30 22:10 UTC (permalink / raw)
  To: netdev

Sun, Dec 30, 2012 at 11:06:16PM CET, fbl@redhat.com wrote:
>On Sun, Dec 30, 2012 at 10:47:23PM +0100, Jiri Pirko wrote:
>> Sun, Dec 30, 2012 at 07:27:29PM CET, fbl@redhat.com wrote:
>> >Update master's carrier state when there is any
>> >change with its ports.
>> 
>> 
>> This patch looks good to me. Just one nitpick I spotted....
>> 
>> >+	bool team_linkup;
>> >+
>> >+	team_linkup = false;
>> 
>> 
>> This can be squashed together.
>
>Ok, but that increases the static size of the module because it
>moves the variable out of bss.
>
>I have no strong opinion on either case, so it's up to you.

Ok :)

Acked-by: Jiri Pirko <jiri@resnulli.us>

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

* Re: [PATCH net-next] team: update master carrier state
  2012-12-30 22:10     ` Jiri Pirko
@ 2013-01-03 10:15       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-01-03 10:15 UTC (permalink / raw)
  To: jiri; +Cc: netdev

From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 30 Dec 2012 23:10:52 +0100

> Sun, Dec 30, 2012 at 11:06:16PM CET, fbl@redhat.com wrote:
>>On Sun, Dec 30, 2012 at 10:47:23PM +0100, Jiri Pirko wrote:
>>> Sun, Dec 30, 2012 at 07:27:29PM CET, fbl@redhat.com wrote:
>>> >Update master's carrier state when there is any
>>> >change with its ports.
>>> 
>>> 
>>> This patch looks good to me. Just one nitpick I spotted....
>>> 
>>> >+	bool team_linkup;
>>> >+
>>> >+	team_linkup = false;
>>> 
>>> 
>>> This can be squashed together.
>>
>>Ok, but that increases the static size of the module because it
>>moves the variable out of bss.
>>
>>I have no strong opinion on either case, so it's up to you.
> 
> Ok :)
> 
> Acked-by: Jiri Pirko <jiri@resnulli.us>

Applied.

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

end of thread, other threads:[~2013-01-03 10:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-30 18:27 [PATCH net-next] team: update master carrier state Flavio Leitner
2012-12-30 21:47 ` Jiri Pirko
2012-12-30 22:06   ` Flavio Leitner
2012-12-30 22:10     ` Jiri Pirko
2013-01-03 10:15       ` 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).