Skip to content

Commit 50a5852

Browse files
jahurleydavem330
authored andcommitted
nfp: flower: set tunnel ttl value to net default
Firmware requires that the ttl value for an encapsulating ipv4 tunnel header be included as an action field. Prior to the support of Geneve tunnel encap (when ttl set was removed completely), ttl value was extracted from the tunnel key. However, tests have shown that this can still produce a ttl of 0. Fix the issue by setting the namespace default value for each new tunnel. Follow up patch for net-next will do a full route lookup. Fixes: 3ca3059 ("nfp: flower: compile Geneve encap actions") Fixes: b27d6a9 ("nfp: compile flower vxlan tunnel set actions") Signed-off-by: John Hurley <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c212d2c commit 50a5852

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/net/ethernet/netronome/nfp/flower/action.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,21 @@ static int
183183
nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
184184
const struct tc_action *action,
185185
struct nfp_fl_pre_tunnel *pre_tun,
186-
enum nfp_flower_tun_type tun_type)
186+
enum nfp_flower_tun_type tun_type,
187+
struct net_device *netdev)
187188
{
188189
size_t act_size = sizeof(struct nfp_fl_set_ipv4_udp_tun);
189190
struct ip_tunnel_info *ip_tun = tcf_tunnel_info(action);
190191
u32 tmp_set_ip_tun_type_index = 0;
191192
/* Currently support one pre-tunnel so index is always 0. */
192193
int pretun_idx = 0;
194+
struct net *net;
193195

194196
if (ip_tun->options_len)
195197
return -EOPNOTSUPP;
196198

199+
net = dev_net(netdev);
200+
197201
set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL;
198202
set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ;
199203

@@ -204,6 +208,7 @@ nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
204208

205209
set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index);
206210
set_tun->tun_id = ip_tun->key.tun_id;
211+
set_tun->ttl = net->ipv4.sysctl_ip_default_ttl;
207212

208213
/* Complete pre_tunnel action. */
209214
pre_tun->ipv4_dst = ip_tun->key.u.ipv4.dst;
@@ -511,7 +516,8 @@ nfp_flower_loop_action(const struct tc_action *a,
511516
*a_len += sizeof(struct nfp_fl_pre_tunnel);
512517

513518
set_tun = (void *)&nfp_fl->action_data[*a_len];
514-
err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type);
519+
err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type,
520+
netdev);
515521
if (err)
516522
return err;
517523
*a_len += sizeof(struct nfp_fl_set_ipv4_udp_tun);

drivers/net/ethernet/netronome/nfp/flower/cmsg.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ struct nfp_fl_set_ipv4_udp_tun {
190190
__be16 reserved;
191191
__be64 tun_id __packed;
192192
__be32 tun_type_index;
193-
__be32 extra[3];
193+
__be16 reserved2;
194+
u8 ttl;
195+
u8 reserved3;
196+
__be32 extra[2];
194197
};
195198

196199
/* Metadata with L2 (1W/4B)

0 commit comments

Comments
 (0)