Skip to content

Commit

Permalink
xfrm: remove hdr_offset indirection
Browse files Browse the repository at this point in the history
After previous patches all remaining users set the function pointer to
the same function: xfrm6_find_1stfragopt.

So remove this function pointer and call ip6_find_1stfragopt directly.

Reduces size of xfrm_type to 64 bytes on 64bit platforms.

Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
Florian Westphal authored and klassert committed Jun 11, 2021
1 parent 848b18f commit d1002d2
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 14 deletions.
3 changes: 0 additions & 3 deletions include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ struct xfrm_type {
int (*output)(struct xfrm_state *, struct sk_buff *pskb);
int (*reject)(struct xfrm_state *, struct sk_buff *,
const struct flowi *);
int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
};

int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
Expand Down Expand Up @@ -1605,8 +1604,6 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
u8 **prevhdr);

#ifdef CONFIG_XFRM
void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
Expand Down
1 change: 0 additions & 1 deletion net/ipv6/ah6.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,6 @@ static const struct xfrm_type ah6_type = {
.destructor = ah6_destroy,
.input = ah6_input,
.output = ah6_output,
.hdr_offset = xfrm6_find_1stfragopt,
};

static struct xfrm6_protocol ah6_protocol = {
Expand Down
1 change: 0 additions & 1 deletion net/ipv6/esp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,6 @@ static const struct xfrm_type esp6_type = {
.destructor = esp6_destroy,
.input = esp6_input,
.output = esp6_output,
.hdr_offset = xfrm6_find_1stfragopt,
};

static struct xfrm6_protocol esp6_protocol = {
Expand Down
1 change: 0 additions & 1 deletion net/ipv6/ipcomp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ static const struct xfrm_type ipcomp6_type = {
.destructor = ipcomp_destroy,
.input = ipcomp_input,
.output = ipcomp_output,
.hdr_offset = xfrm6_find_1stfragopt,
};

static struct xfrm6_protocol ipcomp6_protocol = {
Expand Down
7 changes: 0 additions & 7 deletions net/ipv6/xfrm6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
#include <net/ip6_route.h>
#include <net/xfrm.h>

int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
u8 **prevhdr)
{
return ip6_find_1stfragopt(skb, prevhdr);
}
EXPORT_SYMBOL(xfrm6_find_1stfragopt);

void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu)
{
struct flowi6 fl6;
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static int xfrm6_hdr_offset(struct xfrm_state *x, struct sk_buff *skb, u8 **prev
break;
}

return x->type->hdr_offset(x, skb, prevhdr);
return ip6_find_1stfragopt(skb, prevhdr);
}

/* Add encapsulation header.
Expand Down

0 comments on commit d1002d2

Please sign in to comment.