mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
vxlan: simplify vxlan_remcsum
Part of the parameters is not needed. Simplify the caller of this function in preparation of making vxlan rx more comprehensible. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
54bfd872bf
commit
be5cfeab8f
1 changed files with 8 additions and 14 deletions
|
@ -1135,29 +1135,25 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct vxlanhdr *vxlan_remcsum(struct sk_buff *skb, struct vxlanhdr *vh,
|
static bool vxlan_remcsum(struct sk_buff *skb, u32 vxflags, __be32 vni_field)
|
||||||
size_t hdrlen, __be32 vni_field,
|
|
||||||
bool nopartial)
|
|
||||||
{
|
{
|
||||||
size_t start, offset, plen;
|
size_t start, offset, plen;
|
||||||
|
|
||||||
if (skb->remcsum_offload)
|
if (skb->remcsum_offload)
|
||||||
return vh;
|
return true;
|
||||||
|
|
||||||
start = vxlan_rco_start(vni_field);
|
start = vxlan_rco_start(vni_field);
|
||||||
offset = start + vxlan_rco_offset(vni_field);
|
offset = start + vxlan_rco_offset(vni_field);
|
||||||
|
|
||||||
plen = hdrlen + offset + sizeof(u16);
|
plen = sizeof(struct vxlanhdr) + offset + sizeof(u16);
|
||||||
|
|
||||||
if (!pskb_may_pull(skb, plen))
|
if (!pskb_may_pull(skb, plen))
|
||||||
return NULL;
|
return false;
|
||||||
|
|
||||||
vh = (struct vxlanhdr *)(udp_hdr(skb) + 1);
|
skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset,
|
||||||
|
!!(vxflags & VXLAN_F_REMCSUM_NOPARTIAL));
|
||||||
|
|
||||||
skb_remcsum_process(skb, (void *)vh + hdrlen, start, offset,
|
return true;
|
||||||
nopartial);
|
|
||||||
|
|
||||||
return vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
|
static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
|
||||||
|
@ -1285,9 +1281,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
if ((flags & VXLAN_HF_RCO) && (vs->flags & VXLAN_F_REMCSUM_RX)) {
|
if ((flags & VXLAN_HF_RCO) && (vs->flags & VXLAN_F_REMCSUM_RX)) {
|
||||||
if (!vxlan_remcsum(skb, vxlan_hdr(skb), sizeof(struct vxlanhdr),
|
if (!vxlan_remcsum(skb, vs->flags, vni_field))
|
||||||
vni_field,
|
|
||||||
!!(vs->flags & VXLAN_F_REMCSUM_NOPARTIAL)))
|
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
flags &= ~VXLAN_HF_RCO;
|
flags &= ~VXLAN_HF_RCO;
|
||||||
|
|
Loading…
Reference in a new issue