Skip to content

Commit e689e99

Browse files
author
Saeed Mahameed
committed
net/mlx5e: TC, Stub out ipv6 tun create header function
Improve mlx5e_route_lookup_ipv6 function structure by avoiding #ifdef then return -EOPNOTSUPP in the middle of the function code. To do so, we stub out mlx5e_tc_tun_create_header_ipv6 which is the only caller of this helper function to avoid calling it altogether when ipv6 is compiled out, which should also cleanup some compiler warnings of unused variables. Signed-off-by: Saeed Mahameed <[email protected]> Reviewed-by: Eli Cohen <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent b6d1223 commit e689e99

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
141141
struct dst_entry *dst;
142142
struct neighbour *n;
143143

144-
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
145144
int ret;
146145

147146
ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
@@ -157,9 +156,6 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
157156
dst_release(dst);
158157
return ret;
159158
}
160-
#else
161-
return -EOPNOTSUPP;
162-
#endif
163159

164160
n = dst_neigh_lookup(dst, &fl6->daddr);
165161
dst_release(dst);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,16 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
5858
struct net_device *mirred_dev,
5959
struct mlx5e_encap_entry *e);
6060

61+
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
6162
int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
6263
struct net_device *mirred_dev,
6364
struct mlx5e_encap_entry *e);
65+
#else
66+
static inline int
67+
mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
68+
struct net_device *mirred_dev,
69+
struct mlx5e_encap_entry *e) { return -EOPNOTSUPP; }
70+
#endif
6471

6572
bool mlx5e_tc_tun_device_to_offload(struct mlx5e_priv *priv,
6673
struct net_device *netdev);

0 commit comments

Comments
 (0)