Skip to content

Commit

Permalink
samples/bpf: xdpsock: Remove forward declaration of ip_fast_csum()
Browse files Browse the repository at this point in the history
There is a forward declaration of ip_fast_csum() just before its
implementation, remove the unneeded forward declaration.

While at it mark the implementation as static inline.

Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Link: https://lore.kernel.org/bpf/20210806122855.26115-3-simon.horman@corigine.com
  • Loading branch information
Niklas Söderlund authored and Andrii Nakryiko committed Aug 6, 2021
1 parent 29f24c4 commit f4700a6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions samples/bpf/xdpsock_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,13 @@ static unsigned int do_csum(const unsigned char *buff, int len)
return result;
}

__sum16 ip_fast_csum(const void *iph, unsigned int ihl);

/*
* This is a version of ip_compute_csum() optimized for IP headers,
* which always checksum on 4 octet boundaries.
* This function code has been taken from
* Linux kernel lib/checksum.c
*/
__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
{
return (__sum16)~do_csum(iph, ihl * 4);
}
Expand Down

0 comments on commit f4700a6

Please sign in to comment.