Skip to content

Commit 5f9fc33

Browse files
YueHaibingdavem330
authored andcommitted
net/mlx5e: Fix build error without IPV6
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 <[email protected]> Fixes: e689e99 ("net/mlx5e: TC, Stub out ipv6 tun create header function") Signed-off-by: YueHaibing <[email protected]> Acked-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2745aea commit 5f9fc33

File tree

1 file changed

+38
-36
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+38
-36
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -130,42 +130,6 @@ static const char *mlx5e_netdev_kind(struct net_device *dev)
130130
return "unknown";
131131
}
132132

133-
static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
134-
struct net_device *mirred_dev,
135-
struct net_device **out_dev,
136-
struct net_device **route_dev,
137-
struct flowi6 *fl6,
138-
struct neighbour **out_n,
139-
u8 *out_ttl)
140-
{
141-
struct dst_entry *dst;
142-
struct neighbour *n;
143-
144-
int ret;
145-
146-
ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
147-
fl6);
148-
if (ret < 0)
149-
return ret;
150-
151-
if (!(*out_ttl))
152-
*out_ttl = ip6_dst_hoplimit(dst);
153-
154-
ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
155-
if (ret < 0) {
156-
dst_release(dst);
157-
return ret;
158-
}
159-
160-
n = dst_neigh_lookup(dst, &fl6->daddr);
161-
dst_release(dst);
162-
if (!n)
163-
return -ENOMEM;
164-
165-
*out_n = n;
166-
return 0;
167-
}
168-
169133
static int mlx5e_gen_ip_tunnel_header(char buf[], __u8 *ip_proto,
170134
struct mlx5e_encap_entry *e)
171135
{
@@ -319,6 +283,43 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
319283
return err;
320284
}
321285

286+
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
287+
static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
288+
struct net_device *mirred_dev,
289+
struct net_device **out_dev,
290+
struct net_device **route_dev,
291+
struct flowi6 *fl6,
292+
struct neighbour **out_n,
293+
u8 *out_ttl)
294+
{
295+
struct dst_entry *dst;
296+
struct neighbour *n;
297+
298+
int ret;
299+
300+
ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
301+
fl6);
302+
if (ret < 0)
303+
return ret;
304+
305+
if (!(*out_ttl))
306+
*out_ttl = ip6_dst_hoplimit(dst);
307+
308+
ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
309+
if (ret < 0) {
310+
dst_release(dst);
311+
return ret;
312+
}
313+
314+
n = dst_neigh_lookup(dst, &fl6->daddr);
315+
dst_release(dst);
316+
if (!n)
317+
return -ENOMEM;
318+
319+
*out_n = n;
320+
return 0;
321+
}
322+
322323
int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
323324
struct net_device *mirred_dev,
324325
struct mlx5e_encap_entry *e)
@@ -436,6 +437,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
436437
neigh_release(n);
437438
return err;
438439
}
440+
#endif
439441

440442
bool mlx5e_tc_tun_device_to_offload(struct mlx5e_priv *priv,
441443
struct net_device *netdev)

0 commit comments

Comments
 (0)