mtd: fix build with GCC 14
[openwrt/openwrt.git] / target / linux / generic / pending-6.1 / 705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 6 May 2022 21:38:42 +0200
3 Subject: [PATCH] net: dsa: tag_mtk: add padding for tx packets
4
5 Padding for transmitted packets needs to account for the special tag.
6 With not enough padding, garbage bytes are inserted by the switch at the
7 end of small packets.
8
9 Fixes: 5cd8985a1909 ("net-next: dsa: add Mediatek tag RX/TX handler")
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/net/dsa/tag_mtk.c
14 +++ b/net/dsa/tag_mtk.c
15 @@ -27,6 +27,13 @@ static struct sk_buff *mtk_tag_xmit(stru
16
17 skb_set_queue_mapping(skb, dp->index);
18
19 + /* The Ethernet switch we are interfaced with needs packets to be at
20 + * least 64 bytes (including FCS) otherwise their padding might be
21 + * corrupted. With tags enabled, we need to make sure that packets are
22 + * at least 68 bytes (including FCS and tag).
23 + */
24 + eth_skb_pad(skb);
25 +
26 /* Build the special tag after the MAC Source Address. If VLAN header
27 * is present, it's required that VLAN header and special tag is
28 * being combined. Only in this way we can allow the switch can parse