Skip to content

Commit 0763120

Browse files
shifty91Paolo Abeni
authored andcommitted
net: dsa: hellcreek: Calculate checksums in tagger
In case the checksum calculation is offloaded to the DSA master network interface, it will include the switch trailing tag. As soon as the switch strips that tag on egress, the calculated checksum is wrong. Therefore, add the checksum calculation to the tagger (if required) before adding the switch tag. This way, the hellcreek code works with all DSA master interfaces regardless of their declared feature set. Fixes: 01ef09c ("net: dsa: Add tag handling for Hirschmann Hellcreek switches") Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20220415103320.90657-1-kurt@linutronix.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent cbe6c3a commit 0763120

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/dsa/tag_hellcreek.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ static struct sk_buff *hellcreek_xmit(struct sk_buff *skb,
2121
struct dsa_port *dp = dsa_slave_to_port(dev);
2222
u8 *tag;
2323

24+
/* Calculate checksums (if required) before adding the trailer tag to
25+
* avoid including it in calculations. That would lead to wrong
26+
* checksums after the switch strips the tag.
27+
*/
28+
if (skb->ip_summed == CHECKSUM_PARTIAL &&
29+
skb_checksum_help(skb))
30+
return NULL;
31+
2432
/* Tag encoding */
2533
tag = skb_put(skb, HELLCREEK_TAG_LEN);
2634
*tag = BIT(dp->index);

0 commit comments

Comments
 (0)