Skip to content

Commit

Permalink
xfrm: remove tos indirection from afinfo_policy
Browse files Browse the repository at this point in the history
Only used by ipv4, we can read the fl4 tos value directly instead.

Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
Florian Westphal authored and klassert committed Apr 23, 2019
1 parent e54d152 commit f24ea52
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 24 deletions.
1 change: 0 additions & 1 deletion include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ struct xfrm_policy_afinfo {
void (*decode_session)(struct sk_buff *skb,
struct flowi *fl,
int reverse);
int (*get_tos)(const struct flowi *fl);
int (*init_path)(struct xfrm_dst *path,
struct dst_entry *dst,
int nfheader_len);
Expand Down
6 changes: 0 additions & 6 deletions net/ipv4/xfrm4_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ static int xfrm4_get_saddr(struct net *net, int oif,
return 0;
}

static int xfrm4_get_tos(const struct flowi *fl)
{
return IPTOS_RT_MASK & fl->u.ip4.flowi4_tos; /* Strip ECN bits */
}

static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
int nfheader_len)
{
Expand Down Expand Up @@ -272,7 +267,6 @@ static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
.dst_lookup = xfrm4_dst_lookup,
.get_saddr = xfrm4_get_saddr,
.decode_session = _decode_session4,
.get_tos = xfrm4_get_tos,
.init_path = xfrm4_init_path,
.fill_dst = xfrm4_fill_dst,
.blackhole_route = ipv4_blackhole_route,
Expand Down
6 changes: 0 additions & 6 deletions net/ipv6/xfrm6_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ static int xfrm6_get_saddr(struct net *net, int oif,
return 0;
}

static int xfrm6_get_tos(const struct flowi *fl)
{
return 0;
}

static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst,
int nfheader_len)
{
Expand Down Expand Up @@ -292,7 +287,6 @@ static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
.dst_lookup = xfrm6_dst_lookup,
.get_saddr = xfrm6_get_saddr,
.decode_session = _decode_session6,
.get_tos = xfrm6_get_tos,
.init_path = xfrm6_init_path,
.fill_dst = xfrm6_fill_dst,
.blackhole_route = ip6_blackhole_route,
Expand Down
14 changes: 3 additions & 11 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2450,18 +2450,10 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl,

static int xfrm_get_tos(const struct flowi *fl, int family)
{
const struct xfrm_policy_afinfo *afinfo;
int tos;

afinfo = xfrm_policy_get_afinfo(family);
if (!afinfo)
return 0;

tos = afinfo->get_tos(fl);
if (family == AF_INET)
return IPTOS_RT_MASK & fl->u.ip4.flowi4_tos;

rcu_read_unlock();

return tos;
return 0;
}

static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
Expand Down

0 comments on commit f24ea52

Please sign in to comment.