Skip to content

Commit 5832c4a

Browse files
alobakindavem330
authored andcommitted
ip_tunnel: convert __be16 tunnel flags to bitmaps
Historically, tunnel flags like TUNNEL_CSUM or TUNNEL_ERSPAN_OPT have been defined as __be16. Now all of those 16 bits are occupied and there's no more free space for new flags. It can't be simply switched to a bigger container with no adjustments to the values, since it's an explicit Endian storage, and on LE systems (__be16)0x0001 equals to (__be64)0x0001000000000000. We could probably define new 64-bit flags depending on the Endianness, i.e. (__be64)0x0001 on BE and (__be64)0x00010000... on LE, but that would introduce an Endianness dependency and spawn a ton of Sparse warnings. To mitigate them, all of those places which were adjusted with this change would be touched anyway, so why not define stuff properly if there's no choice. Define IP_TUNNEL_*_BIT counterparts as a bit number instead of the value already coded and a fistful of <16 <-> bitmap> converters and helpers. The two flags which have a different bit position are SIT_ISATAP_BIT and VTI_ISVTI_BIT, as they were defined not as __cpu_to_be16(), but as (__force __be16), i.e. had different positions on LE and BE. Now they both have strongly defined places. Change all __be16 fields which were used to store those flags, to IP_TUNNEL_DECLARE_FLAGS() -> DECLARE_BITMAP(__IP_TUNNEL_FLAG_NUM) -> unsigned long[1] for now, and replace all TUNNEL_* occurrences to their bitmap counterparts. Use the converters in the places which talk to the userspace, hardware (NFP) or other hosts (GRE header). The rest must explicitly use the new flags only. This must be done at once, otherwise there will be too many conversions throughout the code in the intermediate commits. Finally, disable the old __be16 flags for use in the kernel code (except for the two 'irregular' flags mentioned above), to prevent any accidental (mis)use of them. For the userspace, nothing is changed, only additions were made. Most noticeable bloat-o-meter difference (.text): vmlinux: 307/-1 (306) gre.ko: 62/0 (62) ip_gre.ko: 941/-217 (724) [*] ip_tunnel.ko: 390/-900 (-510) [**] ip_vti.ko: 138/0 (138) ip6_gre.ko: 534/-18 (516) [*] ip6_tunnel.ko: 118/-10 (108) [*] gre_flags_to_tnl_flags() grew, but still is inlined [**] ip_tunnel_find() got uninlined, hence such decrease The average code size increase in non-extreme case is 100-200 bytes per module, mostly due to sizeof(long) > sizeof(__be16), as %__IP_TUNNEL_FLAG_NUM is less than %BITS_PER_LONG and the compilers are able to expand the majority of bitmap_*() calls here into direct operations on scalars. Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 117aef1 commit 5832c4a

40 files changed

+715
-415
lines changed

drivers/net/bareudp.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct bareudp_dev {
6161
static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
6262
{
6363
struct metadata_dst *tun_dst = NULL;
64+
IP_TUNNEL_DECLARE_FLAGS(key) = { };
6465
struct bareudp_dev *bareudp;
6566
unsigned short family;
6667
unsigned int len;
@@ -137,7 +138,10 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
137138
bareudp->dev->stats.rx_dropped++;
138139
goto drop;
139140
}
140-
tun_dst = udp_tun_rx_dst(skb, family, TUNNEL_KEY, 0, 0);
141+
142+
__set_bit(IP_TUNNEL_KEY_BIT, key);
143+
144+
tun_dst = udp_tun_rx_dst(skb, family, key, 0, 0);
141145
if (!tun_dst) {
142146
bareudp->dev->stats.rx_dropped++;
143147
goto drop;
@@ -285,10 +289,10 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
285289
struct bareudp_dev *bareudp,
286290
const struct ip_tunnel_info *info)
287291
{
292+
bool udp_sum = test_bit(IP_TUNNEL_CSUM_BIT, info->key.tun_flags);
288293
bool xnet = !net_eq(bareudp->net, dev_net(bareudp->dev));
289294
bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
290295
struct socket *sock = rcu_dereference(bareudp->sock);
291-
bool udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
292296
const struct ip_tunnel_key *key = &info->key;
293297
struct rtable *rt;
294298
__be16 sport, df;
@@ -316,7 +320,8 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
316320

317321
tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
318322
ttl = key->ttl;
319-
df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
323+
df = test_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, key->tun_flags) ?
324+
htons(IP_DF) : 0;
320325
skb_scrub_packet(skb, xnet);
321326

322327
err = -ENOSPC;
@@ -338,7 +343,8 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
338343
udp_tunnel_xmit_skb(rt, sock->sk, skb, saddr, info->key.u.ipv4.dst,
339344
tos, ttl, df, sport, bareudp->port,
340345
!net_eq(bareudp->net, dev_net(bareudp->dev)),
341-
!(info->key.tun_flags & TUNNEL_CSUM));
346+
!test_bit(IP_TUNNEL_CSUM_BIT,
347+
info->key.tun_flags));
342348
return 0;
343349

344350
free_dst:
@@ -350,10 +356,10 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
350356
struct bareudp_dev *bareudp,
351357
const struct ip_tunnel_info *info)
352358
{
359+
bool udp_sum = test_bit(IP_TUNNEL_CSUM_BIT, info->key.tun_flags);
353360
bool xnet = !net_eq(bareudp->net, dev_net(bareudp->dev));
354361
bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
355362
struct socket *sock = rcu_dereference(bareudp->sock);
356-
bool udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
357363
const struct ip_tunnel_key *key = &info->key;
358364
struct dst_entry *dst = NULL;
359365
struct in6_addr saddr, daddr;
@@ -402,7 +408,8 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
402408
udp_tunnel6_xmit_skb(dst, sock->sk, skb, dev,
403409
&saddr, &daddr, prio, ttl,
404410
info->key.label, sport, bareudp->port,
405-
!(info->key.tun_flags & TUNNEL_CSUM));
411+
!test_bit(IP_TUNNEL_CSUM_BIT,
412+
info->key.tun_flags));
406413
return 0;
407414

408415
free_dst:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ bool mlx5e_tc_tun_encap_info_equal_generic(struct mlx5e_encap_key *a,
117117

118118
bool mlx5e_tc_tun_encap_info_equal_options(struct mlx5e_encap_key *a,
119119
struct mlx5e_encap_key *b,
120-
__be16 tun_flags);
120+
u32 tun_type);
121121
#endif /* CONFIG_MLX5_ESWITCH */
122122

123123
#endif //__MLX5_EN_TC_TUNNEL_H__

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ bool mlx5e_tc_tun_encap_info_equal_generic(struct mlx5e_encap_key *a,
587587

588588
bool mlx5e_tc_tun_encap_info_equal_options(struct mlx5e_encap_key *a,
589589
struct mlx5e_encap_key *b,
590-
__be16 tun_flags)
590+
u32 tun_type)
591591
{
592592
struct ip_tunnel_info *a_info;
593593
struct ip_tunnel_info *b_info;
@@ -596,8 +596,8 @@ bool mlx5e_tc_tun_encap_info_equal_options(struct mlx5e_encap_key *a,
596596
if (!mlx5e_tc_tun_encap_info_equal_generic(a, b))
597597
return false;
598598

599-
a_has_opts = !!(a->ip_tun_key->tun_flags & tun_flags);
600-
b_has_opts = !!(b->ip_tun_key->tun_flags & tun_flags);
599+
a_has_opts = test_bit(tun_type, a->ip_tun_key->tun_flags);
600+
b_has_opts = test_bit(tun_type, b->ip_tun_key->tun_flags);
601601

602602
/* keys are equal when both don't have any options attached */
603603
if (!a_has_opts && !b_has_opts)

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ static int mlx5e_gen_ip_tunnel_header_geneve(char buf[],
106106
memset(geneveh, 0, sizeof(*geneveh));
107107
geneveh->ver = MLX5E_GENEVE_VER;
108108
geneveh->opt_len = tun_info->options_len / 4;
109-
geneveh->oam = !!(tun_info->key.tun_flags & TUNNEL_OAM);
110-
geneveh->critical = !!(tun_info->key.tun_flags & TUNNEL_CRIT_OPT);
109+
geneveh->oam = test_bit(IP_TUNNEL_OAM_BIT, tun_info->key.tun_flags);
110+
geneveh->critical = test_bit(IP_TUNNEL_CRIT_OPT_BIT,
111+
tun_info->key.tun_flags);
111112
mlx5e_tunnel_id_to_vni(tun_info->key.tun_id, geneveh->vni);
112113
geneveh->proto_type = htons(ETH_P_TEB);
113114

114-
if (tun_info->key.tun_flags & TUNNEL_GENEVE_OPT) {
115+
if (test_bit(IP_TUNNEL_GENEVE_OPT_BIT, tun_info->key.tun_flags)) {
115116
if (!geneveh->opt_len)
116117
return -EOPNOTSUPP;
117118
ip_tunnel_info_opts_get(geneveh->options, tun_info);
@@ -188,7 +189,7 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
188189

189190
/* make sure that we're talking about GENEVE options */
190191

191-
if (enc_opts.key->dst_opt_type != TUNNEL_GENEVE_OPT) {
192+
if (enc_opts.key->dst_opt_type != IP_TUNNEL_GENEVE_OPT_BIT) {
192193
NL_SET_ERR_MSG_MOD(extack,
193194
"Matching on GENEVE options: option type is not GENEVE");
194195
netdev_warn(priv->netdev,
@@ -337,7 +338,8 @@ static int mlx5e_tc_tun_parse_geneve(struct mlx5e_priv *priv,
337338
static bool mlx5e_tc_tun_encap_info_equal_geneve(struct mlx5e_encap_key *a,
338339
struct mlx5e_encap_key *b)
339340
{
340-
return mlx5e_tc_tun_encap_info_equal_options(a, b, TUNNEL_GENEVE_OPT);
341+
return mlx5e_tc_tun_encap_info_equal_options(a, b,
342+
IP_TUNNEL_GENEVE_OPT_BIT);
341343
}
342344

343345
struct mlx5e_tc_tunnel geneve_tunnel = {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,24 @@ static int mlx5e_gen_ip_tunnel_header_gretap(char buf[],
3131
const struct ip_tunnel_key *tun_key = &e->tun_info->key;
3232
struct gre_base_hdr *greh = (struct gre_base_hdr *)(buf);
3333
__be32 tun_id = tunnel_id_to_key32(tun_key->tun_id);
34+
IP_TUNNEL_DECLARE_FLAGS(unsupp) = { };
3435
int hdr_len;
3536

3637
*ip_proto = IPPROTO_GRE;
3738

3839
/* the HW does not calculate GRE csum or sequences */
39-
if (tun_key->tun_flags & (TUNNEL_CSUM | TUNNEL_SEQ))
40+
__set_bit(IP_TUNNEL_CSUM_BIT, unsupp);
41+
__set_bit(IP_TUNNEL_SEQ_BIT, unsupp);
42+
43+
if (ip_tunnel_flags_intersect(tun_key->tun_flags, unsupp))
4044
return -EOPNOTSUPP;
4145

4246
greh->protocol = htons(ETH_P_TEB);
4347

4448
/* GRE key */
4549
hdr_len = mlx5e_tc_tun_calc_hlen_gretap(e);
4650
greh->flags = gre_tnl_flags_to_gre_flags(tun_key->tun_flags);
47-
if (tun_key->tun_flags & TUNNEL_KEY) {
51+
if (test_bit(IP_TUNNEL_KEY_BIT, tun_key->tun_flags)) {
4852
__be32 *ptr = (__be32 *)(((u8 *)greh) + hdr_len - 4);
4953
*ptr = tun_id;
5054
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int mlx5e_gen_ip_tunnel_header_vxlan(char buf[],
9090
const struct vxlan_metadata *md;
9191
struct vxlanhdr *vxh;
9292

93-
if ((tun_key->tun_flags & TUNNEL_VXLAN_OPT) &&
93+
if (test_bit(IP_TUNNEL_VXLAN_OPT_BIT, tun_key->tun_flags) &&
9494
e->tun_info->options_len != sizeof(*md))
9595
return -EOPNOTSUPP;
9696
vxh = (struct vxlanhdr *)((char *)udp + sizeof(struct udphdr));
@@ -99,7 +99,7 @@ static int mlx5e_gen_ip_tunnel_header_vxlan(char buf[],
9999
udp->dest = tun_key->tp_dst;
100100
vxh->vx_flags = VXLAN_HF_VNI;
101101
vxh->vx_vni = vxlan_vni_field(tun_id);
102-
if (tun_key->tun_flags & TUNNEL_VXLAN_OPT) {
102+
if (test_bit(IP_TUNNEL_VXLAN_OPT_BIT, tun_key->tun_flags)) {
103103
md = ip_tunnel_info_opts(e->tun_info);
104104
vxlan_build_gbp_hdr(vxh, md);
105105
}
@@ -125,7 +125,7 @@ static int mlx5e_tc_tun_parse_vxlan_gbp_option(struct mlx5e_priv *priv,
125125
return -EOPNOTSUPP;
126126
}
127127

128-
if (enc_opts.key->dst_opt_type != TUNNEL_VXLAN_OPT) {
128+
if (enc_opts.key->dst_opt_type != IP_TUNNEL_VXLAN_OPT_BIT) {
129129
NL_SET_ERR_MSG_MOD(extack, "Wrong VxLAN option type: not GBP");
130130
return -EOPNOTSUPP;
131131
}
@@ -208,7 +208,8 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
208208
static bool mlx5e_tc_tun_encap_info_equal_vxlan(struct mlx5e_encap_key *a,
209209
struct mlx5e_encap_key *b)
210210
{
211-
return mlx5e_tc_tun_encap_info_equal_options(a, b, TUNNEL_VXLAN_OPT);
211+
return mlx5e_tc_tun_encap_info_equal_options(a, b,
212+
IP_TUNNEL_VXLAN_OPT_BIT);
212213
}
213214

214215
static int mlx5e_tc_tun_get_remote_ifindex(struct net_device *mirred_dev)

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5464,13 +5464,16 @@ static bool mlx5e_tc_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb
54645464
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
54655465
struct tunnel_match_enc_opts enc_opts = {};
54665466
struct mlx5_rep_uplink_priv *uplink_priv;
5467+
IP_TUNNEL_DECLARE_FLAGS(flags) = { };
54675468
struct mlx5e_rep_priv *uplink_rpriv;
54685469
struct metadata_dst *tun_dst;
54695470
struct tunnel_match_key key;
54705471
u32 tun_id, enc_opts_id;
54715472
struct net_device *dev;
54725473
int err;
54735474

5475+
__set_bit(IP_TUNNEL_KEY_BIT, flags);
5476+
54745477
enc_opts_id = tunnel_id & ENC_OPTS_BITS_MASK;
54755478
tun_id = tunnel_id >> ENC_OPTS_BITS;
54765479

@@ -5503,14 +5506,14 @@ static bool mlx5e_tc_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb
55035506
case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
55045507
tun_dst = __ip_tun_set_dst(key.enc_ipv4.src, key.enc_ipv4.dst,
55055508
key.enc_ip.tos, key.enc_ip.ttl,
5506-
key.enc_tp.dst, TUNNEL_KEY,
5509+
key.enc_tp.dst, flags,
55075510
key32_to_tunnel_id(key.enc_key_id.keyid),
55085511
enc_opts.key.len);
55095512
break;
55105513
case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
55115514
tun_dst = __ipv6_tun_set_dst(&key.enc_ipv6.src, &key.enc_ipv6.dst,
55125515
key.enc_ip.tos, key.enc_ip.ttl,
5513-
key.enc_tp.dst, 0, TUNNEL_KEY,
5516+
key.enc_tp.dst, 0, flags,
55145517
key32_to_tunnel_id(key.enc_key_id.keyid),
55155518
enc_opts.key.len);
55165519
break;
@@ -5528,11 +5531,16 @@ static bool mlx5e_tc_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb
55285531

55295532
tun_dst->u.tun_info.key.tp_src = key.enc_tp.src;
55305533

5531-
if (enc_opts.key.len)
5534+
if (enc_opts.key.len) {
5535+
ip_tunnel_flags_zero(flags);
5536+
if (enc_opts.key.dst_opt_type)
5537+
__set_bit(enc_opts.key.dst_opt_type, flags);
5538+
55325539
ip_tunnel_info_opts_set(&tun_dst->u.tun_info,
55335540
enc_opts.key.data,
55345541
enc_opts.key.len,
5535-
enc_opts.key.dst_opt_type);
5542+
flags);
5543+
}
55365544

55375545
skb_dst_set(skb, (struct dst_entry *)tun_dst);
55385546
dev = dev_get_by_index(&init_net, key.filter_ifindex);

drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ mlxsw_sp_ipip_netdev_parms6(const struct net_device *ol_dev)
2727
static bool
2828
mlxsw_sp_ipip_parms4_has_ikey(const struct ip_tunnel_parm_kern *parms)
2929
{
30-
return !!(parms->i_flags & TUNNEL_KEY);
30+
return test_bit(IP_TUNNEL_KEY_BIT, parms->i_flags);
3131
}
3232

3333
static bool mlxsw_sp_ipip_parms6_has_ikey(const struct __ip6_tnl_parm *parms)
3434
{
35-
return !!(parms->i_flags & TUNNEL_KEY);
35+
return test_bit(IP_TUNNEL_KEY_BIT, parms->i_flags);
3636
}
3737

3838
static bool
3939
mlxsw_sp_ipip_parms4_has_okey(const struct ip_tunnel_parm_kern *parms)
4040
{
41-
return !!(parms->o_flags & TUNNEL_KEY);
41+
return test_bit(IP_TUNNEL_KEY_BIT, parms->o_flags);
4242
}
4343

4444
static bool mlxsw_sp_ipip_parms6_has_okey(const struct __ip6_tnl_parm *parms)
4545
{
46-
return !!(parms->o_flags & TUNNEL_KEY);
46+
return test_bit(IP_TUNNEL_KEY_BIT, parms->o_flags);
4747
}
4848

4949
static u32 mlxsw_sp_ipip_parms4_ikey(const struct ip_tunnel_parm_kern *parms)
@@ -242,12 +242,15 @@ static bool mlxsw_sp_ipip_can_offload_gre4(const struct mlxsw_sp *mlxsw_sp,
242242
const struct net_device *ol_dev)
243243
{
244244
struct ip_tunnel *tunnel = netdev_priv(ol_dev);
245-
__be16 okflags = TUNNEL_KEY; /* We can't offload any other features. */
246245
bool inherit_ttl = tunnel->parms.iph.ttl == 0;
247246
bool inherit_tos = tunnel->parms.iph.tos & 0x1;
247+
IP_TUNNEL_DECLARE_FLAGS(okflags) = { };
248248

249-
return (tunnel->parms.i_flags & ~okflags) == 0 &&
250-
(tunnel->parms.o_flags & ~okflags) == 0 &&
249+
/* We can't offload any other features. */
250+
__set_bit(IP_TUNNEL_KEY_BIT, okflags);
251+
252+
return ip_tunnel_flags_subset(tunnel->parms.i_flags, okflags) &&
253+
ip_tunnel_flags_subset(tunnel->parms.o_flags, okflags) &&
251254
inherit_ttl && inherit_tos &&
252255
mlxsw_sp_ipip_tunnel_complete(MLXSW_SP_L3_PROTO_IPV4, ol_dev);
253256
}
@@ -443,10 +446,13 @@ static bool mlxsw_sp_ipip_can_offload_gre6(const struct mlxsw_sp *mlxsw_sp,
443446
struct __ip6_tnl_parm tparm = mlxsw_sp_ipip_netdev_parms6(ol_dev);
444447
bool inherit_tos = tparm.flags & IP6_TNL_F_USE_ORIG_TCLASS;
445448
bool inherit_ttl = tparm.hop_limit == 0;
446-
__be16 okflags = TUNNEL_KEY; /* We can't offload any other features. */
449+
IP_TUNNEL_DECLARE_FLAGS(okflags) = { };
450+
451+
/* We can't offload any other features. */
452+
__set_bit(IP_TUNNEL_KEY_BIT, okflags);
447453

448-
return (tparm.i_flags & ~okflags) == 0 &&
449-
(tparm.o_flags & ~okflags) == 0 &&
454+
return ip_tunnel_flags_subset(tparm.i_flags, okflags) &&
455+
ip_tunnel_flags_subset(tparm.o_flags, okflags) &&
450456
inherit_ttl && inherit_tos &&
451457
mlxsw_sp_ipip_tunnel_complete(MLXSW_SP_L3_PROTO_IPV6, ol_dev);
452458
}

drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ mlxsw_sp_span_entry_gretap4_parms(struct mlxsw_sp *mlxsw_sp,
461461

462462
if (!(to_dev->flags & IFF_UP) ||
463463
/* Reject tunnels with GRE keys, checksums, etc. */
464-
tparm.i_flags || tparm.o_flags ||
464+
!ip_tunnel_flags_empty(tparm.i_flags) ||
465+
!ip_tunnel_flags_empty(tparm.o_flags) ||
465466
/* Require a fixed TTL and a TOS copied from the mirrored packet. */
466467
inherit_ttl || !inherit_tos ||
467468
/* A destination address may not be "any". */
@@ -565,7 +566,8 @@ mlxsw_sp_span_entry_gretap6_parms(struct mlxsw_sp *mlxsw_sp,
565566

566567
if (!(to_dev->flags & IFF_UP) ||
567568
/* Reject tunnels with GRE keys, checksums, etc. */
568-
tparm.i_flags || tparm.o_flags ||
569+
!ip_tunnel_flags_empty(tparm.i_flags) ||
570+
!ip_tunnel_flags_empty(tparm.o_flags) ||
569571
/* Require a fixed TTL and a TOS copied from the mirrored packet. */
570572
inherit_ttl || !inherit_tos ||
571573
/* A destination address may not be "any". */

0 commit comments

Comments
 (0)