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:3ca3059dc3
("nfp: flower: compile Geneve encap actions") Fixes:b27d6a95a7
("nfp: compile flower vxlan tunnel set actions") Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c212d2c7fc
commit
50a5852a65
@ -183,17 +183,21 @@ static int
|
||||
nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
|
||||
const struct tc_action *action,
|
||||
struct nfp_fl_pre_tunnel *pre_tun,
|
||||
enum nfp_flower_tun_type tun_type)
|
||||
enum nfp_flower_tun_type tun_type,
|
||||
struct net_device *netdev)
|
||||
{
|
||||
size_t act_size = sizeof(struct nfp_fl_set_ipv4_udp_tun);
|
||||
struct ip_tunnel_info *ip_tun = tcf_tunnel_info(action);
|
||||
u32 tmp_set_ip_tun_type_index = 0;
|
||||
/* Currently support one pre-tunnel so index is always 0. */
|
||||
int pretun_idx = 0;
|
||||
struct net *net;
|
||||
|
||||
if (ip_tun->options_len)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
net = dev_net(netdev);
|
||||
|
||||
set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL;
|
||||
set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ;
|
||||
|
||||
@ -204,6 +208,7 @@ nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
|
||||
|
||||
set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index);
|
||||
set_tun->tun_id = ip_tun->key.tun_id;
|
||||
set_tun->ttl = net->ipv4.sysctl_ip_default_ttl;
|
||||
|
||||
/* Complete pre_tunnel action. */
|
||||
pre_tun->ipv4_dst = ip_tun->key.u.ipv4.dst;
|
||||
@ -511,7 +516,8 @@ nfp_flower_loop_action(const struct tc_action *a,
|
||||
*a_len += sizeof(struct nfp_fl_pre_tunnel);
|
||||
|
||||
set_tun = (void *)&nfp_fl->action_data[*a_len];
|
||||
err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type);
|
||||
err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type,
|
||||
netdev);
|
||||
if (err)
|
||||
return err;
|
||||
*a_len += sizeof(struct nfp_fl_set_ipv4_udp_tun);
|
||||
|
@ -190,7 +190,10 @@ struct nfp_fl_set_ipv4_udp_tun {
|
||||
__be16 reserved;
|
||||
__be64 tun_id __packed;
|
||||
__be32 tun_type_index;
|
||||
__be32 extra[3];
|
||||
__be16 reserved2;
|
||||
u8 ttl;
|
||||
u8 reserved3;
|
||||
__be32 extra[2];
|
||||
};
|
||||
|
||||
/* Metadata with L2 (1W/4B)
|
||||
|
Loading…
Reference in New Issue
Block a user