Patchwork [net-next] team: implement carrier change

login
register
mail settings
Submitter Flavio Leitner
Date Dec. 30, 2012, 1:31 a.m.
Message ID <1356831061-1483-1-git-send-email-fbl@redhat.com>
Download mbox | patch
Permalink /patch/208692/
State Accepted
Delegated to: David Miller
Headers show

Comments

Flavio Leitner - Dec. 30, 2012, 1:31 a.m.
The user space teamd daemon may need to control the
master's carrier state depending on the selected mode.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 drivers/net/team/team.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
Jiri Pirko - Dec. 30, 2012, 8:50 a.m.
Sun, Dec 30, 2012 at 02:31:01AM CET, fbl@redhat.com wrote:
>The user space teamd daemon may need to control the
>master's carrier state depending on the selected mode.
>
>Signed-off-by: Flavio Leitner <fbl@redhat.com>
>---
> drivers/net/team/team.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index f711039..14cb843 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -1708,6 +1708,15 @@ static netdev_features_t team_fix_features(struct net_device *dev,
> 	return features;
> }
> 
>+static int team_change_carrier(struct net_device *dev, bool new_carrier)
>+{
>+	if (new_carrier)
>+		netif_carrier_on(dev);
>+	else
>+		netif_carrier_off(dev);
>+	return 0;
>+}
>+
> static const struct net_device_ops team_netdev_ops = {
> 	.ndo_init		= team_init,
> 	.ndo_uninit		= team_uninit,
>@@ -1730,6 +1739,7 @@ static const struct net_device_ops team_netdev_ops = {
> 	.ndo_add_slave		= team_add_slave,
> 	.ndo_del_slave		= team_del_slave,
> 	.ndo_fix_features	= team_fix_features,
>+	.ndo_change_carrier     = team_change_carrier,
> };
> 
> /***********************
>-- 
>1.8.0.1

Acked-by: Jiri Pirko <jiri@resnulli.us>
>
--
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
David Miller - Dec. 30, 2012, 10:32 a.m.
From: Flavio Leitner <fbl@redhat.com>
Date: Sat, 29 Dec 2012 23:31:01 -0200

> The user space teamd daemon may need to control the
> master's carrier state depending on the selected mode.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>

Applied.
--
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
=?ISO-8859-2?Q?Micha=B3_Miros=B3aw?= - Dec. 30, 2012, 1:03 p.m.
2012/12/30 Flavio Leitner <fbl@redhat.com>:
> The user space teamd daemon may need to control the
> master's carrier state depending on the selected mode.
[...]
> +static int team_change_carrier(struct net_device *dev, bool new_carrier)
> +{
> +       if (new_carrier)
> +               netif_carrier_on(dev);
> +       else
> +               netif_carrier_off(dev);
> +       return 0;
> +}
> +
[...]
> +       .ndo_change_carrier     = team_change_carrier,

I wonder what else you might put in the .ndo_change_carrier
implementation? It's already the same for dummy device and tunnels
would get more copies. Maybe it would be enough to allocate a bit in
netdev->priv_flags and use that in dev_change_carrier() instead?

Best Regards,
Michał Mirosław
--
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
Jiri Pirko - Dec. 30, 2012, 1:06 p.m.
30. 12. 2012 v 14:03, Michał Mirosław <mirqus@gmail.com>:

> 2012/12/30 Flavio Leitner <fbl@redhat.com>:
>> The user space teamd daemon may need to control the
>> master's carrier state depending on the selected mode.
> [...]
>> +static int team_change_carrier(struct net_device *dev, bool new_carrier)
>> +{
>> +       if (new_carrier)
>> +               netif_carrier_on(dev);
>> +       else
>> +               netif_carrier_off(dev);
>> +       return 0;
>> +}
>> +
> [...]
>> +       .ndo_change_carrier     = team_change_carrier,
> 
> I wonder what else you might put in the .ndo_change_carrier
> implementation? It's already the same for dummy device and tunnels
> would get more copies. Maybe it would be enough to allocate a bit in
> netdev->priv_flags and use that in dev_change_carrier() instead?
>  

Flavio has a patch adding some more code here prepared already. Will be posted soon.

> Best Regards,
> Michał Mirosław
--
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

Patch

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index f711039..14cb843 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1708,6 +1708,15 @@  static netdev_features_t team_fix_features(struct net_device *dev,
 	return features;
 }
 
+static int team_change_carrier(struct net_device *dev, bool new_carrier)
+{
+	if (new_carrier)
+		netif_carrier_on(dev);
+	else
+		netif_carrier_off(dev);
+	return 0;
+}
+
 static const struct net_device_ops team_netdev_ops = {
 	.ndo_init		= team_init,
 	.ndo_uninit		= team_uninit,
@@ -1730,6 +1739,7 @@  static const struct net_device_ops team_netdev_ops = {
 	.ndo_add_slave		= team_add_slave,
 	.ndo_del_slave		= team_del_slave,
 	.ndo_fix_features	= team_fix_features,
+	.ndo_change_carrier     = team_change_carrier,
 };
 
 /***********************