netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features()
@ 2018-05-31 12:01 Dan Carpenter
  2018-05-31 17:30 ` Samudrala, Sridhar
  2018-06-04 13:31 ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2018-05-31 12:01 UTC (permalink / raw)
  To: David S. Miller, Sridhar Samudrala; +Cc: netdev, kernel-janitors

This has an '&' vs '|' typo so it starts with vlan_features set to none.
Also a u32 type isn't large enough to hold all the feature bits, it
should be netdev_features_t.

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
index 8b508e2cf29b..ef50158e90a9 100644
--- a/drivers/net/net_failover.c
+++ b/drivers/net/net_failover.c
@@ -380,7 +380,8 @@ static rx_handler_result_t net_failover_handle_frame(struct sk_buff **pskb)
 
 static void net_failover_compute_features(struct net_device *dev)
 {
-	u32 vlan_features = FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = FAILOVER_VLAN_FEATURES |
+					  NETIF_F_ALL_FOR_ALL;
 	netdev_features_t enc_features  = FAILOVER_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |

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

* Re: [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features()
  2018-05-31 12:01 [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features() Dan Carpenter
@ 2018-05-31 17:30 ` Samudrala, Sridhar
  2018-06-04 13:31 ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Samudrala, Sridhar @ 2018-05-31 17:30 UTC (permalink / raw)
  To: Dan Carpenter, David S. Miller
  Cc: netdev, kernel-janitors, Jiri Pirko, Jay Vosburgh


On 5/31/2018 5:01 AM, Dan Carpenter wrote:
> This has an '&' vs '|' typo so it starts with vlan_features set to none.
> Also a u32 type isn't large enough to hold all the feature bits, it
> should be netdev_features_t.
>
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

The patch looks correct, but this code is based on team/bonding drivers.
So would like to get a confirmation from Jiri/Jay and if a similar fix is
needed in those drivers too.


>
> diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
> index 8b508e2cf29b..ef50158e90a9 100644
> --- a/drivers/net/net_failover.c
> +++ b/drivers/net/net_failover.c
> @@ -380,7 +380,8 @@ static rx_handler_result_t net_failover_handle_frame(struct sk_buff **pskb)
>   
>   static void net_failover_compute_features(struct net_device *dev)
>   {
> -	u32 vlan_features = FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
> +	netdev_features_t vlan_features = FAILOVER_VLAN_FEATURES |
> +					  NETIF_F_ALL_FOR_ALL;
>   	netdev_features_t enc_features  = FAILOVER_ENC_FEATURES;
>   	unsigned short max_hard_header_len = ETH_HLEN;
>   	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |

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

* Re: [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features()
  2018-05-31 12:01 [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features() Dan Carpenter
  2018-05-31 17:30 ` Samudrala, Sridhar
@ 2018-06-04 13:31 ` David Miller
  2018-06-04 14:43   ` [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32 Dan Carpenter
  2018-06-04 14:46   ` [PATCH 2/2 net] team: use " Dan Carpenter
  1 sibling, 2 replies; 8+ messages in thread
From: David Miller @ 2018-06-04 13:31 UTC (permalink / raw)
  To: dan.carpenter; +Cc: sridhar.samudrala, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 31 May 2018 15:01:25 +0300

> @@ -380,7 +380,8 @@ static rx_handler_result_t net_failover_handle_frame(struct sk_buff **pskb)
>  
>  static void net_failover_compute_features(struct net_device *dev)
>  {
> -	u32 vlan_features = FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
> +	netdev_features_t vlan_features = FAILOVER_VLAN_FEATURES |
> +					  NETIF_F_ALL_FOR_ALL;

The type does need to be corrected to netdev_features_t, but the
logical operation is correct.

It's a policy operation that was simply by-hand propagated all
over the place where these kinds of calculations are performed.

So vlan_features is starting with a value of 0 intentionally.

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

* [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32
  2018-06-04 13:31 ` David Miller
@ 2018-06-04 14:43   ` Dan Carpenter
  2018-06-04 21:30     ` David Miller
  2018-06-04 14:46   ` [PATCH 2/2 net] team: use " Dan Carpenter
  1 sibling, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2018-06-04 14:43 UTC (permalink / raw)
  To: David S. Miller, Sridhar Samudrala; +Cc: netdev, kernel-janitors

The features mask needs to be a netdev_features_t (u64) because a u32
is not big enough.

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In the original patch, I thought that the & should be | and I
    introduced a bug.

diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
index 8b508e2cf29b..83f7420ddea5 100644
--- a/drivers/net/net_failover.c
+++ b/drivers/net/net_failover.c
@@ -380,7 +380,8 @@ static rx_handler_result_t net_failover_handle_frame(struct sk_buff **pskb)
 
 static void net_failover_compute_features(struct net_device *dev)
 {
-	u32 vlan_features = FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = FAILOVER_VLAN_FEATURES &
+					  NETIF_F_ALL_FOR_ALL;
 	netdev_features_t enc_features  = FAILOVER_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |

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

* [PATCH 2/2 net] team: use netdev_features_t instead of u32
  2018-06-04 13:31 ` David Miller
  2018-06-04 14:43   ` [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32 Dan Carpenter
@ 2018-06-04 14:46   ` Dan Carpenter
  2018-06-04 14:49     ` Jiri Pirko
  2018-06-04 21:31     ` David Miller
  1 sibling, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2018-06-04 14:46 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: David S. Miller, netdev, kernel-janitors

This code was introduced in 2011 around the same time that we made
netdev_features_t a u64 type.  These days a u32 is not big enough to
hold all the potential features.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 267dcc929f6c..8863fa023500 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1004,7 +1004,8 @@ static void team_port_disable(struct team *team,
 static void __team_compute_features(struct team *team)
 {
 	struct team_port *port;
-	u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = TEAM_VLAN_FEATURES &
+					  NETIF_F_ALL_FOR_ALL;
 	netdev_features_t enc_features  = TEAM_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |

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

* Re: [PATCH 2/2 net] team: use netdev_features_t instead of u32
  2018-06-04 14:46   ` [PATCH 2/2 net] team: use " Dan Carpenter
@ 2018-06-04 14:49     ` Jiri Pirko
  2018-06-04 21:31     ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2018-06-04 14:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David S. Miller, netdev, kernel-janitors

Mon, Jun 04, 2018 at 04:46:01PM CEST, dan.carpenter@oracle.com wrote:
>This code was introduced in 2011 around the same time that we made
>netdev_features_t a u64 type.  These days a u32 is not big enough to
>hold all the potential features.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32
  2018-06-04 14:43   ` [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32 Dan Carpenter
@ 2018-06-04 21:30     ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2018-06-04 21:30 UTC (permalink / raw)
  To: dan.carpenter; +Cc: sridhar.samudrala, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 4 Jun 2018 17:43:21 +0300

> The features mask needs to be a netdev_features_t (u64) because a u32
> is not big enough.
> 
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: In the original patch, I thought that the & should be | and I
>     introduced a bug.

Applied.

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

* Re: [PATCH 2/2 net] team: use netdev_features_t instead of u32
  2018-06-04 14:46   ` [PATCH 2/2 net] team: use " Dan Carpenter
  2018-06-04 14:49     ` Jiri Pirko
@ 2018-06-04 21:31     ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2018-06-04 21:31 UTC (permalink / raw)
  To: dan.carpenter; +Cc: jiri, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 4 Jun 2018 17:46:01 +0300

> This code was introduced in 2011 around the same time that we made
> netdev_features_t a u64 type.  These days a u32 is not big enough to
> hold all the potential features.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2018-06-04 21:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 12:01 [PATCH 1/2 net-next] net_failover: fix net_failover_compute_features() Dan Carpenter
2018-05-31 17:30 ` Samudrala, Sridhar
2018-06-04 13:31 ` David Miller
2018-06-04 14:43   ` [PATCH 1/2 v2 net-next] net_failover: Use netdev_features_t instead of u32 Dan Carpenter
2018-06-04 21:30     ` David Miller
2018-06-04 14:46   ` [PATCH 2/2 net] team: use " Dan Carpenter
2018-06-04 14:49     ` Jiri Pirko
2018-06-04 21:31     ` 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).