dde_linux: fix packet size calc. of Nic drivers

skb_push() already increases the skb->len by ETH_HLEN, hence adding
ETH_HLEN to the packet_size is redundant.

A too large packet size becomes a problem for large MTUs. With a maximum
MTU of 1500, adding ETH_HLEN twice will lead to a packet size of 1528.
Since this is larger than what we expect for good-old Ethernet (max. 1522),
some clients (e.g. the e1000 model in vbox5) may drop these packets.

Fixes genodelabs/genode#4228
This commit is contained in:
Johannes Schlatow 2021-07-20 18:36:26 +02:00 committed by Christian Helmuth
parent 119d72ad94
commit 1aba330ae6
4 changed files with 12 additions and 12 deletions

View File

@ -26,7 +26,7 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_push(skb, ETH_HLEN);
helper.packet = skb->data;
helper.packet_size = ETH_HLEN;
helper.packet_size = skb->len;
helper.frag = 0;
helper.frag_size = 0;
@ -43,9 +43,9 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_frag_t *f = &skb_shinfo(skb)->frags[0];
helper.frag = skb_frag_address(f);
helper.frag_size = skb_frag_size(f);
/* fragment contains payload but header is still found in packet */
helper.packet_size = ETH_HLEN;
}
else
helper.packet_size += skb->len;
return helper;
}

View File

@ -30,7 +30,7 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_push(skb, ETH_HLEN);
helper.packet = skb->data;
helper.packet_size = ETH_HLEN;
helper.packet_size = skb->len;
helper.frag = 0;
helper.frag_size = 0;
@ -47,9 +47,9 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_frag_t *f = &skb_shinfo(skb)->frags[0];
helper.frag = skb_frag_address(f);
helper.frag_size = skb_frag_size(f);
/* fragment contains payload but header is still found in packet */
helper.packet_size = ETH_HLEN;
}
else
helper.packet_size += skb->len;
return helper;
}

View File

@ -26,7 +26,7 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_push(skb, ETH_HLEN);
helper.packet = skb->data;
helper.packet_size = ETH_HLEN;
helper.packet_size = skb->len;
helper.frag = 0;
helper.frag_size = 0;
@ -43,9 +43,9 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_frag_t *f = &skb_shinfo(skb)->frags[0];
helper.frag = skb_frag_address(f);
helper.frag_size = skb_frag_size(f);
/* fragment contains payload but header is still found in packet */
helper.packet_size = ETH_HLEN;
}
else
helper.packet_size += skb->len;
return helper;
}

View File

@ -38,7 +38,7 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_push(skb, ETH_HLEN);
helper.packet = skb->data;
helper.packet_size = ETH_HLEN;
helper.packet_size = skb->len;
helper.frag = 0;
helper.frag_size = 0;
@ -55,9 +55,9 @@ struct Skb skb_helper(struct sk_buff *skb)
skb_frag_t *f = &skb_shinfo(skb)->frags[0];
helper.frag = skb_frag_address(f);
helper.frag_size = skb_frag_size(f);
/* fragment contains payload but header is still found in packet */
helper.packet_size = ETH_HLEN;
}
else
helper.packet_size += skb->len;
return helper;
}