linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5e: Fix build error without IPV6
@ 2019-11-27 13:27 YueHaibing
  2019-11-27 19:26 ` David Miller
  2019-11-30  7:32 ` Saeed Mahameed
  0 siblings, 2 replies; 5+ messages in thread
From: YueHaibing @ 2019-11-27 13:27 UTC (permalink / raw)
  To: saeedm, leon, davem, eli, roid, elibr, kliteyn, ozsh, pablo, yuehaibing
  Cc: netdev, linux-rdma, linux-kernel

If IPV6 is not set and CONFIG_MLX5_ESWITCH is y,
building fails:

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:322:5: error: redefinition of mlx5e_tc_tun_create_header_ipv6
 int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:7:0:
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:67:1: note: previous definition of mlx5e_tc_tun_create_header_ipv6 was here
 mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use #ifdef to guard this, also move mlx5e_route_lookup_ipv6
to cleanup unused warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: e689e998e102 ("net/mlx5e: TC, Stub out ipv6 tun create header function")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 .../net/ethernet/mellanox/mlx5/core/en/tc_tun.c    | 74 +++++++++++-----------
 1 file changed, 38 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
index 784b1e2..6ed8753 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -130,42 +130,6 @@ static const char *mlx5e_netdev_kind(struct net_device *dev)
 		return "unknown";
 }
 
-static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
-				   struct net_device *mirred_dev,
-				   struct net_device **out_dev,
-				   struct net_device **route_dev,
-				   struct flowi6 *fl6,
-				   struct neighbour **out_n,
-				   u8 *out_ttl)
-{
-	struct dst_entry *dst;
-	struct neighbour *n;
-
-	int ret;
-
-	ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
-					 fl6);
-	if (ret < 0)
-		return ret;
-
-	if (!(*out_ttl))
-		*out_ttl = ip6_dst_hoplimit(dst);
-
-	ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
-	if (ret < 0) {
-		dst_release(dst);
-		return ret;
-	}
-
-	n = dst_neigh_lookup(dst, &fl6->daddr);
-	dst_release(dst);
-	if (!n)
-		return -ENOMEM;
-
-	*out_n = n;
-	return 0;
-}
-
 static int mlx5e_gen_ip_tunnel_header(char buf[], __u8 *ip_proto,
 				      struct mlx5e_encap_entry *e)
 {
@@ -319,6 +283,43 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
 	return err;
 }
 
+#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
+static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
+				   struct net_device *mirred_dev,
+				   struct net_device **out_dev,
+				   struct net_device **route_dev,
+				   struct flowi6 *fl6,
+				   struct neighbour **out_n,
+				   u8 *out_ttl)
+{
+	struct dst_entry *dst;
+	struct neighbour *n;
+
+	int ret;
+
+	ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
+					 fl6);
+	if (ret < 0)
+		return ret;
+
+	if (!(*out_ttl))
+		*out_ttl = ip6_dst_hoplimit(dst);
+
+	ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
+	if (ret < 0) {
+		dst_release(dst);
+		return ret;
+	}
+
+	n = dst_neigh_lookup(dst, &fl6->daddr);
+	dst_release(dst);
+	if (!n)
+		return -ENOMEM;
+
+	*out_n = n;
+	return 0;
+}
+
 int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
 				    struct net_device *mirred_dev,
 				    struct mlx5e_encap_entry *e)
@@ -436,6 +437,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
 	neigh_release(n);
 	return err;
 }
+#endif
 
 bool mlx5e_tc_tun_device_to_offload(struct mlx5e_priv *priv,
 				    struct net_device *netdev)
-- 
2.7.4



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

* Re: [PATCH] net/mlx5e: Fix build error without IPV6
  2019-11-27 13:27 [PATCH] net/mlx5e: Fix build error without IPV6 YueHaibing
@ 2019-11-27 19:26 ` David Miller
  2019-11-30  7:33   ` Saeed Mahameed
  2019-11-30  7:32 ` Saeed Mahameed
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2019-11-27 19:26 UTC (permalink / raw)
  To: yuehaibing
  Cc: saeedm, leon, eli, roid, elibr, kliteyn, ozsh, pablo, netdev,
	linux-rdma, linux-kernel

From: YueHaibing <yuehaibing@huawei.com>
Date: Wed, 27 Nov 2019 21:27:00 +0800

> If IPV6 is not set and CONFIG_MLX5_ESWITCH is y,
> building fails:
> 
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:322:5: error: redefinition of mlx5e_tc_tun_create_header_ipv6
>  int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:7:0:
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:67:1: note: previous definition of mlx5e_tc_tun_create_header_ipv6 was here
>  mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Use #ifdef to guard this, also move mlx5e_route_lookup_ipv6
> to cleanup unused warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: e689e998e102 ("net/mlx5e: TC, Stub out ipv6 tun create header function")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Saeed et al., how do you want to handle this?

Thanks.

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

* Re: [PATCH] net/mlx5e: Fix build error without IPV6
  2019-11-27 13:27 [PATCH] net/mlx5e: Fix build error without IPV6 YueHaibing
  2019-11-27 19:26 ` David Miller
@ 2019-11-30  7:32 ` Saeed Mahameed
  1 sibling, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2019-11-30  7:32 UTC (permalink / raw)
  To: davem, Yevgeny Kliteynik, pablo, Oz Shlomo, Eli Cohen,
	Eli Britstein, yuehaibing, leon, Roi Dayan
  Cc: netdev, linux-rdma, linux-kernel

On Wed, 2019-11-27 at 21:27 +0800, YueHaibing wrote:
> If IPV6 is not set and CONFIG_MLX5_ESWITCH is y,
> building fails:
> 
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:322:5: error:
> redefinition of mlx5e_tc_tun_create_header_ipv6
>  int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:7:0:
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:67:1: note:
> previous definition of mlx5e_tc_tun_create_header_ipv6 was here
>  mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Use #ifdef to guard this, also move mlx5e_route_lookup_ipv6
> to cleanup unused warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: e689e998e102 ("net/mlx5e: TC, Stub out ipv6 tun create header
> function")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>


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

* Re: [PATCH] net/mlx5e: Fix build error without IPV6
  2019-11-27 19:26 ` David Miller
@ 2019-11-30  7:33   ` Saeed Mahameed
  2019-11-30 17:42     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Saeed Mahameed @ 2019-11-30  7:33 UTC (permalink / raw)
  To: yuehaibing, davem
  Cc: linux-rdma, Yevgeny Kliteynik, Oz Shlomo, pablo, Eli Cohen,
	linux-kernel, netdev, Eli Britstein, leon, Roi Dayan

On Wed, 2019-11-27 at 11:26 -0800, David Miller wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> Date: Wed, 27 Nov 2019 21:27:00 +0800
> 
> > If IPV6 is not set and CONFIG_MLX5_ESWITCH is y,
> > building fails:
> > 
> > drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:322:5: error:
> redefinition of mlx5e_tc_tun_create_header_ipv6
> >  int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
> >      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > In file included from
> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:7:0:
> > drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:67:1: note:
> previous definition of mlx5e_tc_tun_create_header_ipv6 was here
> >  mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
> >  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > Use #ifdef to guard this, also move mlx5e_route_lookup_ipv6
> > to cleanup unused warning.
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Fixes: e689e998e102 ("net/mlx5e: TC, Stub out ipv6 tun create
> header function")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Saeed et al., how do you want to handle this?
> 

LGTM, I guess you can push this to net since this is dealing with a
build error ?

Thanks in Advance,
Saeed.


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

* Re: [PATCH] net/mlx5e: Fix build error without IPV6
  2019-11-30  7:33   ` Saeed Mahameed
@ 2019-11-30 17:42     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-11-30 17:42 UTC (permalink / raw)
  To: saeedm
  Cc: yuehaibing, linux-rdma, kliteyn, ozsh, pablo, eli, linux-kernel,
	netdev, elibr, leon, roid

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Sat, 30 Nov 2019 07:33:48 +0000

> On Wed, 2019-11-27 at 11:26 -0800, David Miller wrote:
>> From: YueHaibing <yuehaibing@huawei.com>
>> Date: Wed, 27 Nov 2019 21:27:00 +0800
>> 
>> > If IPV6 is not set and CONFIG_MLX5_ESWITCH is y,
>> > building fails:
>> > 
>> > drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:322:5: error:
>> redefinition of mlx5e_tc_tun_create_header_ipv6
>> >  int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>> >      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> > In file included from
>> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:7:0:
>> > drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:67:1: note:
>> previous definition of mlx5e_tc_tun_create_header_ipv6 was here
>> >  mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
>> >  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> > 
>> > Use #ifdef to guard this, also move mlx5e_route_lookup_ipv6
>> > to cleanup unused warning.
>> > 
>> > Reported-by: Hulk Robot <hulkci@huawei.com>
>> > Fixes: e689e998e102 ("net/mlx5e: TC, Stub out ipv6 tun create
>> header function")
>> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> 
>> Saeed et al., how do you want to handle this?
>> 
> 
> LGTM, I guess you can push this to net since this is dealing with a
> build error ?

Ok, I'll do that, thanks.

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

end of thread, other threads:[~2019-11-30 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 13:27 [PATCH] net/mlx5e: Fix build error without IPV6 YueHaibing
2019-11-27 19:26 ` David Miller
2019-11-30  7:33   ` Saeed Mahameed
2019-11-30 17:42     ` David Miller
2019-11-30  7:32 ` Saeed Mahameed

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