* [patch net-next 1/2] team: add fix_features
@ 2011-11-17 14:16 Jiri Pirko
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jiri Pirko @ 2011-11-17 14:16 UTC (permalink / raw)
To: netdev
Cc: davem, eric.dumazet, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
do fix features in similar way as bonding code does
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/team/team.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index f309274..5b169c1 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -953,6 +953,27 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev)
return err;
}
+static netdev_features_t team_fix_features(struct net_device *dev,
+ netdev_features_t features)
+{
+ struct team_port *port;
+ struct team *team = netdev_priv(dev);
+ netdev_features_t mask;
+
+ mask = features;
+ features &= ~NETIF_F_ONE_FOR_ALL;
+ features |= NETIF_F_ALL_FOR_ALL;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(port, &team->port_list, list) {
+ features = netdev_increment_features(features,
+ port->dev->features,
+ mask);
+ }
+ rcu_read_unlock();
+ return features;
+}
+
static const struct net_device_ops team_netdev_ops = {
.ndo_init = team_init,
.ndo_uninit = team_uninit,
@@ -968,6 +989,7 @@ static const struct net_device_ops team_netdev_ops = {
.ndo_vlan_rx_kill_vid = team_vlan_rx_kill_vid,
.ndo_add_slave = team_add_slave,
.ndo_del_slave = team_del_slave,
+ .ndo_fix_features = team_fix_features,
};
--
1.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 14:16 [patch net-next 1/2] team: add fix_features Jiri Pirko
@ 2011-11-17 14:16 ` Jiri Pirko
2011-11-17 14:31 ` Eric Dumazet
2011-11-18 20:00 ` David Miller
2011-11-17 20:28 ` [patch net-next 1/2] team: add fix_features Michał Mirosław
2011-11-18 20:00 ` David Miller
2 siblings, 2 replies; 9+ messages in thread
From: Jiri Pirko @ 2011-11-17 14:16 UTC (permalink / raw)
To: netdev
Cc: davem, eric.dumazet, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
Apparently using variable-length array is not correct
(https://lkml.org/lkml/2011/10/23/25). So remove it.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/team/team.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 5b169c1..c48ef19 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -96,10 +96,13 @@ int team_options_register(struct team *team,
size_t option_count)
{
int i;
- struct team_option *dst_opts[option_count];
+ struct team_option **dst_opts;
int err;
- memset(dst_opts, 0, sizeof(dst_opts));
+ dst_opts = kzalloc(sizeof(struct team_option *) * option_count,
+ GFP_KERNEL);
+ if (!dst_opts)
+ return -ENOMEM;
for (i = 0; i < option_count; i++, option++) {
struct team_option *dst_opt;
@@ -119,12 +122,14 @@ int team_options_register(struct team *team,
for (i = 0; i < option_count; i++)
list_add_tail(&dst_opts[i]->list, &team->option_list);
+ kfree(dst_opts);
return 0;
rollback:
for (i = 0; i < option_count; i++)
kfree(dst_opts[i]);
+ kfree(dst_opts);
return err;
}
--
1.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
@ 2011-11-17 14:31 ` Eric Dumazet
2011-11-17 15:10 ` Jiri Pirko
2011-11-18 20:00 ` David Miller
1 sibling, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2011-11-17 14:31 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, bhutchings, shemminger, andy, fbl, jzupka, ivecera,
mirqus
Le jeudi 17 novembre 2011 à 15:16 +0100, Jiri Pirko a écrit :
> Apparently using variable-length array is not correct
> (https://lkml.org/lkml/2011/10/23/25). So remove it.
>
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> ---
> drivers/net/team/team.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> index 5b169c1..c48ef19 100644
> --- a/drivers/net/team/team.c
> +++ b/drivers/net/team/team.c
> @@ -96,10 +96,13 @@ int team_options_register(struct team *team,
> size_t option_count)
> {
> int i;
> - struct team_option *dst_opts[option_count];
> + struct team_option **dst_opts;
> int err;
>
> - memset(dst_opts, 0, sizeof(dst_opts));
> + dst_opts = kzalloc(sizeof(struct team_option *) * option_count,
> + GFP_KERNEL);
> + if (!dst_opts)
> + return -ENOMEM;
> for (i = 0; i < option_count; i++, option++) {
> struct team_option *dst_opt;
>
> @@ -119,12 +122,14 @@ int team_options_register(struct team *team,
> for (i = 0; i < option_count; i++)
> list_add_tail(&dst_opts[i]->list, &team->option_list);
>
> + kfree(dst_opts);
> return 0;
>
> rollback:
> for (i = 0; i < option_count; i++)
> kfree(dst_opts[i]);
>
> + kfree(dst_opts);
> return err;
> }
>
Please use kmemdup() as well, or someone else will do it ;)
dst_opt = kmalloc(sizeof(*option), GFP_KERNEL);
...
memcpy(dst_opt, option, sizeof(*option));
-> dst_opt = kmemdup(...);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 14:31 ` Eric Dumazet
@ 2011-11-17 15:10 ` Jiri Pirko
2011-11-17 18:40 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Jiri Pirko @ 2011-11-17 15:10 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, davem, bhutchings, shemminger, andy, fbl, jzupka, ivecera,
mirqus
Thu, Nov 17, 2011 at 03:31:18PM CET, eric.dumazet@gmail.com wrote:
>Le jeudi 17 novembre 2011 à 15:16 +0100, Jiri Pirko a écrit :
>> Apparently using variable-length array is not correct
>> (https://lkml.org/lkml/2011/10/23/25). So remove it.
>>
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>> ---
>> drivers/net/team/team.c | 9 +++++++--
>> 1 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>> index 5b169c1..c48ef19 100644
>> --- a/drivers/net/team/team.c
>> +++ b/drivers/net/team/team.c
>> @@ -96,10 +96,13 @@ int team_options_register(struct team *team,
>> size_t option_count)
>> {
>> int i;
>> - struct team_option *dst_opts[option_count];
>> + struct team_option **dst_opts;
>> int err;
>>
>> - memset(dst_opts, 0, sizeof(dst_opts));
>> + dst_opts = kzalloc(sizeof(struct team_option *) * option_count,
>> + GFP_KERNEL);
>> + if (!dst_opts)
>> + return -ENOMEM;
>> for (i = 0; i < option_count; i++, option++) {
>> struct team_option *dst_opt;
>>
>> @@ -119,12 +122,14 @@ int team_options_register(struct team *team,
>> for (i = 0; i < option_count; i++)
>> list_add_tail(&dst_opts[i]->list, &team->option_list);
>>
>> + kfree(dst_opts);
>> return 0;
>>
>> rollback:
>> for (i = 0; i < option_count; i++)
>> kfree(dst_opts[i]);
>>
>> + kfree(dst_opts);
>> return err;
>> }
>>
>
>Please use kmemdup() as well, or someone else will do it ;)
>
>dst_opt = kmalloc(sizeof(*option), GFP_KERNEL);
>...
>memcpy(dst_opt, option, sizeof(*option));
>
>-> dst_opt = kmemdup(...);
>
Sure, I'll do this in separate patch.
Thanks!
Jirka
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 15:10 ` Jiri Pirko
@ 2011-11-17 18:40 ` David Miller
2011-11-17 18:52 ` Jiri Pirko
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2011-11-17 18:40 UTC (permalink / raw)
To: jpirko
Cc: eric.dumazet, netdev, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
From: Jiri Pirko <jpirko@redhat.com>
Date: Thu, 17 Nov 2011 16:10:32 +0100
> Sure, I'll do this in separate patch.
No, you'll do it in _this_ patch.
Jiri, please stop resisting the incorporation of feedback into
the patches you post. You've done this twice in the past 3 days
and it's really irritating.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 18:40 ` David Miller
@ 2011-11-17 18:52 ` Jiri Pirko
0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2011-11-17 18:52 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, netdev, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
Thu, Nov 17, 2011 at 07:40:22PM CET, davem@davemloft.net wrote:
>From: Jiri Pirko <jpirko@redhat.com>
>Date: Thu, 17 Nov 2011 16:10:32 +0100
>
>> Sure, I'll do this in separate patch.
>
>No, you'll do it in _this_ patch.
>
>Jiri, please stop resisting the incorporation of feedback into
>the patches you post. You've done this twice in the past 3 days
>and it's really irritating.
Well, the change Eric suggested is unrelated to this patch so it seemed
good to me to do not mangle it together.
Anyway, I'm sorry being source of irritation :( (alhought I have
absolutelly no intention to do so)
Jirka
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 1/2] team: add fix_features
2011-11-17 14:16 [patch net-next 1/2] team: add fix_features Jiri Pirko
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
@ 2011-11-17 20:28 ` Michał Mirosław
2011-11-18 20:00 ` David Miller
2 siblings, 0 replies; 9+ messages in thread
From: Michał Mirosław @ 2011-11-17 20:28 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, eric.dumazet, bhutchings, shemminger, andy, fbl,
jzupka, ivecera
2011/11/17 Jiri Pirko <jpirko@redhat.com>:
> do fix features in similar way as bonding code does
[...]
Looks the same like in bonding. ;)
Best Regards,
Michał Mirosław
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 1/2] team: add fix_features
2011-11-17 14:16 [patch net-next 1/2] team: add fix_features Jiri Pirko
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
2011-11-17 20:28 ` [patch net-next 1/2] team: add fix_features Michał Mirosław
@ 2011-11-18 20:00 ` David Miller
2 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-11-18 20:00 UTC (permalink / raw)
To: jpirko
Cc: netdev, eric.dumazet, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
From: Jiri Pirko <jpirko@redhat.com>
Date: Thu, 17 Nov 2011 15:16:04 +0100
> do fix features in similar way as bonding code does
>
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch net-next 2/2] team: avoid using variable-length array
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
2011-11-17 14:31 ` Eric Dumazet
@ 2011-11-18 20:00 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2011-11-18 20:00 UTC (permalink / raw)
To: jpirko
Cc: netdev, eric.dumazet, bhutchings, shemminger, andy, fbl, jzupka,
ivecera, mirqus
From: Jiri Pirko <jpirko@redhat.com>
Date: Thu, 17 Nov 2011 15:16:05 +0100
> Apparently using variable-length array is not correct
> (https://lkml.org/lkml/2011/10/23/25). So remove it.
>
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-11-18 20:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 14:16 [patch net-next 1/2] team: add fix_features Jiri Pirko
2011-11-17 14:16 ` [patch net-next 2/2] team: avoid using variable-length array Jiri Pirko
2011-11-17 14:31 ` Eric Dumazet
2011-11-17 15:10 ` Jiri Pirko
2011-11-17 18:40 ` David Miller
2011-11-17 18:52 ` Jiri Pirko
2011-11-18 20:00 ` David Miller
2011-11-17 20:28 ` [patch net-next 1/2] team: add fix_features Michał Mirosław
2011-11-18 20:00 ` 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).