tools/pkgconf: update to 2.1.0
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 752-v5.16-net-dsa-qca8k-fix-MTU-calculation.patch
1 From 65258b9d8cde45689bdc86ca39b50f01f983733b Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robert.marko@sartura.hr>
3 Date: Fri, 19 Nov 2021 03:03:50 +0100
4 Subject: [PATCH] net: dsa: qca8k: fix MTU calculation
5
6 qca8k has a global MTU, so its tracking the MTU per port to make sure
7 that the largest MTU gets applied.
8 Since it uses the frame size instead of MTU the driver MTU change function
9 will then add the size of Ethernet header and checksum on top of MTU.
10
11 The driver currently populates the per port MTU size as Ethernet frame
12 length + checksum which equals 1518.
13
14 The issue is that then MTU change function will go through all of the
15 ports, find the largest MTU and apply the Ethernet header + checksum on
16 top of it again, so for a desired MTU of 1500 you will end up with 1536.
17
18 This is obviously incorrect, so to correct it populate the per port struct
19 MTU with just the MTU and not include the Ethernet header + checksum size
20 as those will be added by the MTU change function.
21
22 Fixes: f58d2598cf70 ("net: dsa: qca8k: implement the port MTU callbacks")
23 Signed-off-by: Robert Marko <robert.marko@sartura.hr>
24 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
25 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
26 Signed-off-by: David S. Miller <davem@davemloft.net>
27 ---
28 drivers/net/dsa/qca8k.c | 6 +++++-
29 1 file changed, 5 insertions(+), 1 deletion(-)
30
31 --- a/drivers/net/dsa/qca8k.c
32 +++ b/drivers/net/dsa/qca8k.c
33 @@ -1256,8 +1256,12 @@ qca8k_setup(struct dsa_switch *ds)
34 /* Set initial MTU for every port.
35 * We have only have a general MTU setting. So track
36 * every port and set the max across all port.
37 + * Set per port MTU to 1500 as the MTU change function
38 + * will add the overhead and if its set to 1518 then it
39 + * will apply the overhead again and we will end up with
40 + * MTU of 1536 instead of 1518
41 */
42 - priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN;
43 + priv->port_mtu[i] = ETH_DATA_LEN;
44 }
45
46 /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */